This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b6abc2  revert to f7e01d2. the master branch is protected so that 
cannot reset to history version
7b6abc2 is described below

commit 7b6abc205643b6c2fad03bdb9aa3c35fb5aeabfd
Author: cvictory <shenglic...@gmail.com>
AuthorDate: Wed Jul 1 11:44:30 2020 +0800

    revert to f7e01d2. the master branch is protected so that cannot reset to 
history version
---
 java_exception/exception.go    |  4 +-
 java_unknown_exception.go      | 90 ------------------------------------------
 java_unknown_exception_test.go | 43 --------------------
 list.go                        |  6 ---
 object.go                      |  5 ---
 5 files changed, 2 insertions(+), 146 deletions(-)

diff --git a/java_exception/exception.go b/java_exception/exception.go
index 30515ef..2b3f5d3 100644
--- a/java_exception/exception.go
+++ b/java_exception/exception.go
@@ -98,7 +98,7 @@ type StackTraceElement struct {
        DeclaringClass string
        MethodName     string
        FileName       string
-       LineNumber     int32
+       LineNumber     int
 }
 
 //JavaClassName  java fully qualified path
@@ -121,4 +121,4 @@ func (Method) JavaClassName() string {
 
 func (Class) JavaClassName() string {
        return "java.lang.Class"
-}
\ No newline at end of file
+}
diff --git a/java_unknown_exception.go b/java_unknown_exception.go
deleted file mode 100644
index 5ea5a49..0000000
--- a/java_unknown_exception.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package hessian
-
-import (
-       "fmt"
-       "sync"
-)
-
-import (
-       "github.com/apache/dubbo-go-hessian2/java_exception"
-)
-
-var (
-       expRegMutex sync.Mutex
-)
-
-func checkAndGetException(cls classInfo) (structInfo, bool) {
-
-       if len(cls.fieldNameList) < 4 {
-               return structInfo{}, false
-       }
-       var (
-               throwable structInfo
-               ok        bool
-       )
-       var count = 0
-       for _, item := range cls.fieldNameList {
-               if item == "detailMessage" || item == "suppressedExceptions" || 
item == "stackTrace" || item == "cause" {
-                       count++
-               }
-       }
-       // if have these 4 fields, it is throwable struct
-       if count == 4 {
-               if throwable, ok = getStructInfo(cls.javaName); ok {
-                       return throwable, true
-               }
-               expRegMutex.Lock()
-               defer expRegMutex.Unlock()
-               RegisterPOJO(newBizException(cls.javaName))
-               if throwable, ok = getStructInfo(cls.javaName); ok {
-                       return throwable, true
-               }
-       }
-       return throwable, count == 4
-}
-
-type UnknownException struct {
-       SerialVersionUID     int64
-       DetailMessage        string
-       SuppressedExceptions []java_exception.Throwabler
-       StackTrace           []java_exception.StackTraceElement
-       Cause                java_exception.Throwabler
-       name                 string
-}
-
-// NewThrowable is the constructor
-func newBizException(name string) *UnknownException {
-       return &UnknownException{name: name, StackTrace: 
[]java_exception.StackTraceElement{}}
-}
-
-// Error output error message
-func (e UnknownException) Error() string {
-       return fmt.Sprintf("throw %v : %v", e.name, e.DetailMessage)
-}
-
-//JavaClassName  java fully qualified path
-func (e UnknownException) JavaClassName() string {
-       return e.name
-}
-
-// equals to getStackTrace in java
-func (e UnknownException) GetStackTrace() []java_exception.StackTraceElement {
-       return e.StackTrace
-}
diff --git a/java_unknown_exception_test.go b/java_unknown_exception_test.go
deleted file mode 100644
index fa14ed3..0000000
--- a/java_unknown_exception_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package hessian
-
-import (
-       "github.com/stretchr/testify/assert"
-       "testing"
-)
-
-func TestCheckAndGetException(t *testing.T) {
-       clazzInfo1 := classInfo{
-               javaName:      "com.test.UserDefinedException",
-               fieldNameList: []string{"detailMessage", "code", 
"suppressedExceptions", "stackTrace", "cause"},
-       }
-       s, b := checkAndGetException(clazzInfo1)
-       assert.True(t, b)
-
-       assert.Equal(t, s.javaName, "com.test.UserDefinedException")
-       assert.Equal(t, s.goName, "hessian.UnknownException")
-
-       clazzInfo2 := classInfo{
-               javaName:      "com.test.UserDefinedException",
-               fieldNameList: []string{"detailMessage", "code", 
"suppressedExceptions", "cause"},
-       }
-       s, b = checkAndGetException(clazzInfo2)
-       assert.False(t, b)
-       assert.Equal(t, s, structInfo{})
-}
diff --git a/list.go b/list.go
index 57aaa96..34c8aec 100644
--- a/list.go
+++ b/list.go
@@ -30,10 +30,6 @@ import (
        perrors "github.com/pkg/errors"
 )
 
-import (
-       "github.com/apache/dubbo-go-hessian2/java_exception"
-)
-
 var (
        listTypeNameMapper = &sync.Map{}
        listTypeMapper     = map[string]reflect.Type{
@@ -50,8 +46,6 @@ var (
                "date":             reflect.TypeOf(time.Time{}),
                "object":           reflect.TypeOf([]Object{}).Elem(),
                "java.lang.Object": reflect.TypeOf([]Object{}).Elem(),
-               // exception field
-               "java.lang.StackTraceElement": 
reflect.TypeOf([]*java_exception.StackTraceElement{}).Elem(),
        }
 )
 
diff --git a/object.go b/object.go
index 2a86820..e2ef7b3 100644
--- a/object.go
+++ b/object.go
@@ -377,7 +377,6 @@ func (d *Decoder) decInstance(typ reflect.Type, cls 
classInfo) (interface{}, err
 
                index, fieldStruct, err := findFieldWithCache(fieldName, typ)
                if err != nil {
-                       // skip field
                        d.DecodeValue()
                        continue
                }
@@ -548,10 +547,6 @@ func (d *Decoder) getStructDefByIndex(idx int) 
(reflect.Type, classInfo, error)
        cls = d.classInfoList[idx]
        s, ok = getStructInfo(cls.javaName)
        if !ok {
-               // exception
-               if s , ok = checkAndGetException(cls); ok {
-                       return s.typ, cls, nil
-               }
                if !d.isSkip {
                        err = perrors.Errorf("can not find go type name %s in 
registry", cls.javaName)
                }

Reply via email to