optimize exception bug: when user defined exception, it can use unknownexception
diff --git a/go.mod b/go.mod
index fb0a269..0060e17 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,7 @@
module github.com/apache/dubbo-go-hessian2
+go 1.14
+
require (
github.com/dubbogo/gost v1.9.0
github.com/pkg/errors v0.9.1
diff --git a/java_exception/exception.go b/java_exception/exception.go
index 30515ef..f5a00e9 100644
--- a/java_exception/exception.go
+++ b/java_exception/exception.go
@@ -90,9 +90,9 @@
return e.StackTrace
}
-////////////////////////////
+/////////////////////////////
// StackTraceElement
-////////////////////////////
+/////////////////////////////
type StackTraceElement struct {
DeclaringClass string
@@ -121,4 +121,4 @@
func (Class) JavaClassName() string {
return "java.lang.Class"
-}
\ No newline at end of file
+}
diff --git a/java_unknown_exception_test.go b/java_unknown_exception_test.go
index fa14ed3..ea24321 100644
--- a/java_unknown_exception_test.go
+++ b/java_unknown_exception_test.go
@@ -18,9 +18,11 @@
package hessian
import (
- "github.com/stretchr/testify/assert"
"testing"
)
+import (
+ "github.com/stretchr/testify/assert"
+)
func TestCheckAndGetException(t *testing.T) {
clazzInfo1 := classInfo{
diff --git a/list.go b/list.go
index 57aaa96..8d2dba5 100644
--- a/list.go
+++ b/list.go
@@ -18,6 +18,7 @@
package hessian
import (
+ "github.com/apache/dubbo-go-hessian2/java_exception"
"io"
"reflect"
"strconv"
@@ -30,10 +31,6 @@
perrors "github.com/pkg/errors"
)
-import (
- "github.com/apache/dubbo-go-hessian2/java_exception"
-)
-
var (
listTypeNameMapper = &sync.Map{}
listTypeMapper = map[string]reflect.Type{
@@ -50,7 +47,8 @@
"date": reflect.TypeOf(time.Time{}),
"object": reflect.TypeOf([]Object{}).Elem(),
"java.lang.Object": reflect.TypeOf([]Object{}).Elem(),
- // exception field
+
+ // exception field StackTraceElement
"java.lang.StackTraceElement": reflect.TypeOf([]*java_exception.StackTraceElement{}).Elem(),
}
)
diff --git a/object.go b/object.go
index 2a86820..558a427 100644
--- a/object.go
+++ b/object.go
@@ -548,8 +548,9 @@
cls = d.classInfoList[idx]
s, ok = getStructInfo(cls.javaName)
if !ok {
+
// exception
- if s , ok = checkAndGetException(cls); ok {
+ if s, ok = checkAndGetException(cls); ok {
return s.typ, cls, nil
}
if !d.isSkip {