File tree 1 file changed +18
-0
lines changed
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 17
17
package org .apache .dubbo .rpc ;
18
18
19
19
import java .io .Serializable ;
20
+ import java .lang .reflect .Field ;
20
21
import java .util .HashMap ;
21
22
import java .util .Map ;
22
23
import java .util .function .Function ;
@@ -64,6 +65,23 @@ public AppResponse(Throwable exception) {
64
65
@ Override
65
66
public Object recreate () throws Throwable {
66
67
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
+ }
67
85
throw exception ;
68
86
}
69
87
return result ;
You can’t perform that action at this time.
0 commit comments