Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350361 - [1.7] Unhandled exception type Exception
Summary: [1.7] Unhandled exception type Exception
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-25 16:53 EDT by Volker Berlin CLA
Modified: 2011-08-05 02:54 EDT (History)
4 users (show)

See Also:


Attachments
Plausible patch (1.97 KB, patch)
2011-06-26 23:55 EDT, Srikanth Sankaran CLA
no flags Details | Diff
Patch + tests (3.20 KB, patch)
2011-06-27 07:55 EDT, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.