Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 51150

Summary: Avoid "t.printStackTrace();" in Worker.java when logging unhandled errors
Product: [Eclipse Project] Platform Reporter: Luc Bourlier <eclipse>
Component: RuntimeAssignee: Szymon Ptaszkiewicz <sptaszkiewicz>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sptaszkiewicz
Version: 3.0   
Target Milestone: 4.5 M3   
Hardware: All   
OS: All   
Whiteboard:

Description Luc Bourlier CLA 2004-02-04 02:30:08 EST
I noticed a call to printStackTrace() in the catch block of the outer try of
Worker#run().
Is it on purpose ? I thought that the rule in Eclipse was to log all unexpected
exceptions in the .log file.
Comment 1 John Arthorne CLA 2004-02-09 13:45:17 EST
True.  Essentially, this catch block should never be hit.  There is a finally 
block inside of the outer try/catch, and it logs any exceptions in the .log.  
The outer finally is just there in case of drastic failure - for example failure 
while writing the log file.  Since the worker thread is about to die in this 
case, we don't want the error to be lost. I would be surprised if this catch 
block ever gets hit, but it's there just in case...
Comment 2 Szymon Ptaszkiewicz CLA 2014-09-29 09:14:35 EDT
(In reply to John Arthorne from comment #1)
> True.  Essentially, this catch block should never be hit.  There is a
> finally block inside of the outer try/catch, and it logs any exceptions in the
> .log.
> 
> The outer finally is just there in case of drastic failure - for example
> failure while writing the log file.  Since the worker thread is about to die in
> this case, we don't want the error to be lost. I would be surprised if this
> catch block ever gets hit, but it's there just in case...

Unfortunately, this catch block was hit quite a few times. See bug 392794 where tracking the cause of a deadlock was severely limited because of lack of proper information about those drastic errors in the log.

Reopening to replace "t.printStackTrace();" with something that will be written to the log file.
Comment 4 Szymon Ptaszkiewicz CLA 2014-09-30 11:26:09 EDT
Verified in I20140930-0800.