File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1717package org .apache .dubbo .rpc ;
1818
1919import java .io .Serializable ;
20+ import java .lang .reflect .Field ;
2021import java .util .HashMap ;
2122import java .util .Map ;
2223import java .util .function .Function ;
@@ -64,6 +65,23 @@ public AppResponse(Throwable exception) {
6465 @ Override
6566 public Object recreate () throws Throwable {
6667 if (exception != null ) {
68+ // fix issue#619
69+ try {
70+ // get Throwable class
71+ Class clazz = exception .getClass ();
72+ while (!clazz .getName ().equals (Throwable .class .getName ())) {
73+ clazz = clazz .getSuperclass ();
74+ }
75+ // get stackTrace value
76+ Field stackTraceField = clazz .getDeclaredField ("stackTrace" );
77+ stackTraceField .setAccessible (true );
78+ Object stackTrace = stackTraceField .get (exception );
79+ if (stackTrace == null ) {
80+ exception .setStackTrace (new StackTraceElement [0 ]);
81+ }
82+ } catch (Exception e ) {
83+ // ignore
84+ }
6785 throw exception ;
6886 }
6987 return result ;
You can’t perform that action at this time.
0 commit comments