Bug 61959

Summary: dangerous practice of catching Throwable
Product: [Eclipse Project] JDT Reporter: Jim des Rivieres <jeem>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M9   
Hardware: All   
OS: All   
Whiteboard:

Description Jim des Rivieres CLA 2004-05-12 13:56:36 EDT
Build I20040512

There are a number of occurrences in this component of the dangerous idiom:

   try {
      ...
   } catch (Throwable e) {
      ... // e not re-thrown
   }

It is very bad practice to catch Throwable (or Error) and eat it because there 
are myriad unrecoverable situations (like out of memory) that this will hide.

A (partial) list of the places that look dangerous are:
org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch - Main.java
org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util - Dumper.java
Comment 1 Philipe Mulet CLA 2004-05-12 16:07:59 EDT
The batch compiler is an independant tool which going to trap this exception 
and report it as an internal error. It isn't used inside Eclipse per se. 
Though we could probably only catch RuntimeException which are the ones we do 
mean to catch anyway here.

Need to look closer at Dumper.
Comment 2 Jerome Lanneluc CLA 2004-05-12 18:00:56 EDT
Just checked that Dumper (and IDumpable) are not used in jdt.core. We should 
just delete those.
Comment 3 Philipe Mulet CLA 2004-05-12 18:29:52 EDT
Removed Dumper & IDumpable.
Comment 4 Philipe Mulet CLA 2004-05-13 06:58:17 EDT
Replacing catch Throwable in compiler with: catch RuntimeException.
VM traps are now surfaced. 

Fixed
Comment 5 Olivier Thomann CLA 2004-05-18 13:50:23 EDT
Verified in 200405180816