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

Bug 20770

Summary: Surround with try/catch when RuntimeException is declared to be thrown
Product: [Eclipse Project] JDT Reporter: Stanimir Stamenkov <stanio>
Component: UIAssignee: Erich Gamma <erich_gamma>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Stanimir Stamenkov CLA 2002-06-20 22:54:57 EDT
When trying to surround the following statement:

int number = Integer.parseInt(strValue);

where strValue is of type String, with try/catch block Eclipse reports "No
uncaught exceptions are thrown by the selected code. Catch
java.lang.RuntimeException ?". Looking at the Integer.parseInt() method
declaration it is seen that NumberFormatException is declared in its throws
clause and I think Eclipse should build try/catch block for that exception
although it is RuntimeException. I checked that
java.lang.reflect.Method.getExceptionTypes() returns NumberFormatException in
the resulted Class[].
Comment 1 Dirk Baeumer CLA 2002-06-21 06:44:42 EDT

*** This bug has been marked as a duplicate of 18687 ***