From 94f05b97639debd56d338da3ea5a306b25fc9c65 Mon Sep 17 00:00:00 2001
From: wongoo <gelnyang@163.com>
Date: Thu, 4 Jul 2019 12:32:00 +0800
Subject: [PATCH] fix: java exception & unit test

---
 examples/dubbo/go-server/app/user.go                   | 3 ++-
 examples/dubbo/with-configcenter-go-server/app/user.go | 3 ++-
 go.mod                                                 | 2 +-
 go.sum                                                 | 4 ++--
 protocol/dubbo/client.go                               | 1 -
 protocol/dubbo/codec_test.go                           | 5 ++---
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/examples/dubbo/go-server/app/user.go b/examples/dubbo/go-server/app/user.go
index fcd9ea7b8..e2f5aec99 100644
--- a/examples/dubbo/go-server/app/user.go
+++ b/examples/dubbo/go-server/app/user.go
@@ -20,6 +20,7 @@ package main
 import (
 	"context"
 	"fmt"
+	"github.com/dubbogo/hessian2/java_exception"
 	"strconv"
 	"time"
 )
@@ -172,7 +173,7 @@ func (u *UserProvider) GetUser3() error {
 }
 
 func (u *UserProvider) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
-	return hessian.NewThrowable("exception")
+	return java_exception.NewThrowable("exception")
 }
 
 func (u *UserProvider) GetUsers(req []interface{}) ([]interface{}, error) {
diff --git a/examples/dubbo/with-configcenter-go-server/app/user.go b/examples/dubbo/with-configcenter-go-server/app/user.go
index e4400cc27..54c58ada4 100644
--- a/examples/dubbo/with-configcenter-go-server/app/user.go
+++ b/examples/dubbo/with-configcenter-go-server/app/user.go
@@ -20,6 +20,7 @@ package main
 import (
 	"context"
 	"fmt"
+	"github.com/dubbogo/hessian2/java_exception"
 	"strconv"
 	"time"
 )
@@ -146,7 +147,7 @@ func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User
 }
 
 func (u *UserProvider) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
-	return hessian.NewThrowable("exception")
+	return java_exception.NewThrowable("exception")
 }
 
 func (u *UserProvider) GetUser0(id string, name string) (User, error) {
diff --git a/go.mod b/go.mod
index 3c61a83f1..8fd3c215f 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/apache/dubbo-go
 require (
 	github.com/dubbogo/getty v1.0.7
 	github.com/dubbogo/gost v1.0.0
-	github.com/dubbogo/hessian2 v1.1.1
+	github.com/dubbogo/hessian2 v1.1.2
 	github.com/magiconair/properties v1.8.1
 	github.com/pkg/errors v0.8.1
 	github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec
diff --git a/go.sum b/go.sum
index 09b3e7fd0..859e9aab1 100644
--- a/go.sum
+++ b/go.sum
@@ -5,8 +5,8 @@ github.com/dubbogo/getty v1.0.7 h1:5Hg+JwXyCKm9Yr4yJkm98ahhnoa8c2h6br5QJxwQ+YU=
 github.com/dubbogo/getty v1.0.7/go.mod h1:cRMSuoCmwc5lULFFnYZTxyCfZhObmRTNbS7XRnPNHSo=
 github.com/dubbogo/gost v1.0.0 h1:obKvpJYdrIY2BidHYwYoj2E50OtwCDqVVVTcH2nnhAY=
 github.com/dubbogo/gost v1.0.0/go.mod h1:R7wZm1DrmrKGr50mBZVcg6C9ekG8aL5hP+sgWcIDwQg=
-github.com/dubbogo/hessian2 v1.1.1 h1:X8UlNUvn/lqct2GKY37MFGnZ2f51HRndAQHk6+RMtqc=
-github.com/dubbogo/hessian2 v1.1.1/go.mod h1:XFGDn4oSZX26zkcfhkM/fCJrOqwQJxk/xgWW1KMJBKM=
+github.com/dubbogo/hessian2 v1.1.2 h1:SRkPzIwVv2D+ZUOCE2XuI5kANoL01ShhAheLcc3usJE=
+github.com/dubbogo/hessian2 v1.1.2/go.mod h1:XFGDn4oSZX26zkcfhkM/fCJrOqwQJxk/xgWW1KMJBKM=
 github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
 github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
diff --git a/protocol/dubbo/client.go b/protocol/dubbo/client.go
index 56f95090c..8ba46e7b0 100644
--- a/protocol/dubbo/client.go
+++ b/protocol/dubbo/client.go
@@ -217,7 +217,6 @@ func (c *Client) call(ct CallType, addr string, svcUrl common.URL, method string
 
 	p := &DubboPackage{}
 	p.Service.Path = strings.TrimPrefix(svcUrl.Path, "/")
-	p.Service.Target = svcUrl.GetParam(constant.INTERFACE_KEY, "")
 	p.Service.Interface = svcUrl.GetParam(constant.INTERFACE_KEY, "")
 	p.Service.Version = svcUrl.GetParam(constant.VERSION_KEY, "")
 	p.Service.Method = method
diff --git a/protocol/dubbo/codec_test.go b/protocol/dubbo/codec_test.go
index f585666b3..4f5229d67 100644
--- a/protocol/dubbo/codec_test.go
+++ b/protocol/dubbo/codec_test.go
@@ -49,7 +49,6 @@ func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
 	// request
 	pkg.Header.Type = hessian.PackageRequest
 	pkg.Service.Interface = "Service"
-	pkg.Service.Target = "Service"
 	pkg.Service.Version = "2.6"
 	pkg.Service.Method = "Method"
 	pkg.Service.Timeout = time.Second
@@ -64,10 +63,10 @@ func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
 	assert.Equal(t, byte(S_Dubbo), pkgres.Header.SerialID)
 	assert.Equal(t, int64(10086), pkgres.Header.ID)
 	assert.Equal(t, "2.5.4", pkgres.Body.([]interface{})[0])
-	assert.Equal(t, "Service", pkgres.Body.([]interface{})[1])
+	assert.Equal(t, "", pkgres.Body.([]interface{})[1])
 	assert.Equal(t, "2.6", pkgres.Body.([]interface{})[2])
 	assert.Equal(t, "Method", pkgres.Body.([]interface{})[3])
 	assert.Equal(t, "Ljava/lang/String;", pkgres.Body.([]interface{})[4])
 	assert.Equal(t, []interface{}{"a"}, pkgres.Body.([]interface{})[5])
-	assert.Equal(t, map[interface{}]interface{}{"interface": "Service", "path": "", "timeout": "1000"}, pkgres.Body.([]interface{})[6])
+	assert.Equal(t, map[interface{}]interface{}{"interface": "Service", "path": "", "group": "", "timeout": "1000"}, pkgres.Body.([]interface{})[6])
 }
-- 
GitLab