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

Bug 350361

Summary: [1.7] Unhandled exception type Exception
Product: [Eclipse Project] JDT Reporter: Volker Berlin <volker.berlin>
Component: CoreAssignee: Satyam Kandula <satyam.kandula>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, Olivier_Thomann, remy.suen, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Plausible patch
none
Patch + tests none

Description Volker Berlin CLA 2011-06-25 16:53:41 EDT
The file javax.management.remote.rmi.RMIConnectionImpl of the JDK 7 show the follow compiler error with "Java 7 Support in Eclipse JDT (BETA)". I use Version Eclipse 4.1.

The error message is: Unhandled exception type Exception

It is produced from the follow catch block:

                } catch (Exception e) {
                    if (e instanceof RuntimeException)
                        throw (RuntimeException) e;  // this line show the error
                    throw new PrivilegedActionException(e);
                }

The problem seems that the cast to a RuntimeException is ignored.

Volker
Comment 1 Olivier Thomann CLA 2011-06-26 12:43:58 EDT
Satyam, please investigate.
Comment 2 Srikanth Sankaran CLA 2011-06-26 22:36:32 EDT
Minimal, yet full test case:

public class X {
    public static void main(String[] args) {
    	try {
            throw new Exception();
        } catch (Exception e) {
            if (e instanceof RuntimeException)
                throw (RuntimeException) e;
        }
    }
}

Compiles fine with JDK 7b142.

Satyam, this should be treated as a serious bug and should be fixed
asap. Thanks.
Comment 3 Srikanth Sankaran CLA 2011-06-26 23:55:20 EDT
Created attachment 198619 [details]
Plausible patch

Not fully tested.

Basically the new Java 7 rethrow semantics should kick
in only when the catch parameter is directly rethrown.
Comment 4 Satyam Kandula CLA 2011-06-27 02:20:09 EDT
(In reply to comment #3)
> Created attachment 198619 [details]
> Plausible patch
> 
> Not fully tested.
> 
> Basically the new Java 7 rethrow semantics should kick
> in only when the catch parameter is directly rethrown.
Srikanth, Thanks for the patch. This patch looks good. I have added a test and running the test suite. Will release once the tests are good.
Comment 5 Satyam Kandula CLA 2011-06-27 07:55:32 EDT
Created attachment 198639 [details]
Patch + tests

Updated the patch slightly and added test.
Comment 6 Satyam Kandula CLA 2011-06-27 07:58:53 EDT
Released in BETA_JAVA7 branch.
Comment 7 Deepak Azad CLA 2011-07-19 08:25:14 EDT
Verified with v20110714-1300.