File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
java/libraries/net/src/processing/net Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,12 @@ public void stop() {
155155 try {
156156 disconnectEventMethod .invoke (parent , this );
157157 } catch (Exception e ) {
158- e .printStackTrace ();
158+ Throwable cause = e ;
159+ // unwrap the exception if it came from the user code
160+ if (e instanceof InvocationTargetException && e .getCause () != null ) {
161+ cause = e .getCause ();
162+ }
163+ cause .printStackTrace ();
159164 disconnectEventMethod = null ;
160165 }
161166 }
@@ -266,7 +271,12 @@ public void run() {
266271 clientEventMethod .invoke (parent , this );
267272 } catch (Exception e ) {
268273 System .err .println ("error, disabling clientEvent() for " + host );
269- e .printStackTrace ();
274+ Throwable cause = e ;
275+ // unwrap the exception if it came from the user code
276+ if (e instanceof InvocationTargetException && e .getCause () != null ) {
277+ cause = e .getCause ();
278+ }
279+ cause .printStackTrace ();
270280 clientEventMethod = null ;
271281 }
272282 }
Original file line number Diff line number Diff line change @@ -308,7 +308,12 @@ public void run() {
308308 serverEventMethod .invoke (parent , this , client );
309309 } catch (Exception e ) {
310310 System .err .println ("Disabling serverEvent() for port " + port );
311- e .printStackTrace ();
311+ Throwable cause = e ;
312+ // unwrap the exception if it came from the user code
313+ if (e instanceof InvocationTargetException && e .getCause () != null ) {
314+ cause = e .getCause ();
315+ }
316+ cause .printStackTrace ();
312317 serverEventMethod = null ;
313318 }
314319 }
You can’t perform that action at this time.
0 commit comments