You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/07/01 06:24:13 UTC

[GitHub] [dubbo-go-hessian2] cvictory opened a new pull request #208: Ftr: catch exceptions that user defined

cvictory opened a new pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208


   1.当java抛出自定义业务异常的时候,当dubb-go client没有注册这个异常类型,这时候会出现错误。
   这里会将这种异常统一转换为BizException。
   
   2.原来的stackTraceElement数据丢失,进行修复。
   
   之前的pr : https://github.com/apache/dubbo-go-hessian2/pull/204  ,不小心在本地push错远程仓库,直接推进去了。 从代码层面进行了回滚,所以重新提交下PR。
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] cvictory commented on pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
cvictory commented on pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#issuecomment-654071687


   > @cvictory can u add a unit test that the exception data is from java, there are many ut samples in this project which decode bytes generated by java.
   
   增加了java的异常返回结果的用例,数据存在test_reource目录下的两个文件。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] AlexStocks merged pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
AlexStocks merged pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] cvictory commented on a change in pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
cvictory commented on a change in pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#discussion_r453191780



##########
File path: test_resource/RuntimeException.txt
##########
@@ -0,0 +1,5 @@
+Cjava.lang.RuntimeException�
detailMessagecause
+stackTracesuppressedExceptions`test exceptQ�V[java.lang.StackTraceElement�?Cjava.lang.StackTraceElement�declaringClass

Review comment:
       存储在里面是以byte数组形式。




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] cvictory commented on a change in pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
cvictory commented on a change in pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#discussion_r450038289



##########
File path: java_unknown_exception.go
##########
@@ -0,0 +1,88 @@
+/*
+ * 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 mutex 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 {

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] zouyx commented on a change in pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
zouyx commented on a change in pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#discussion_r453319320



##########
File path: java_unknown_exception.go
##########
@@ -0,0 +1,88 @@
+/*
+ * 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 mutex sync.Mutex

Review comment:
       I think should make this variable name more meaningful, like `getExceptionMutex`, `checkExceptionMutex` etc?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo commented on pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
wongoo commented on pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#issuecomment-653745105


   @cvictory can u add a unit test that the exception data is from java, there are many ut samples in this project which decode bytes generated by java.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo commented on pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
wongoo commented on pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#issuecomment-656162449


   @cvictory  sorry for delay reply.  DO NOT add binary data into, which can't be checked, u can test java response easily, ref https://github.com/apache/dubbo-go-hessian2/blob/master/decode_test.go#L93


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo commented on a change in pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
wongoo commented on a change in pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#discussion_r448142919



##########
File path: java_unknown_exception.go
##########
@@ -0,0 +1,88 @@
+/*
+ * 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 mutex 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 {

Review comment:
       does it should move this check after the mutex.lock() ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] hxmhlt commented on a change in pull request #208: Ftr: catch exceptions that user defined

Posted by GitBox <gi...@apache.org>.
hxmhlt commented on a change in pull request #208:
URL: https://github.com/apache/dubbo-go-hessian2/pull/208#discussion_r452123562



##########
File path: test_resource/RuntimeException.txt
##########
@@ -0,0 +1,5 @@
+Cjava.lang.RuntimeException�
detailMessagecause
+stackTracesuppressedExceptions`test exceptQ�V[java.lang.StackTraceElement�?Cjava.lang.StackTraceElement�declaringClass

Review comment:
       Why display not normal ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org