Bug 173907 - [code assist] severe NPE on exception completions
Summary: [code assist] severe NPE on exception completions
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.3 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 177073 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-02-12 14:08 EST by Olivier Thomann CLA
Modified: 2007-03-20 01:44 EDT (History)
2 users (show)

See Also:


Attachments
Test case (2.25 KB, text/plain)
2007-02-12 14:09 EST, Olivier Thomann CLA
no flags Details
Proposed fix (1.38 KB, patch)
2007-02-12 14:11 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2007-02-12 14:08:33 EST
Using M5, I got severe NPE during code completion on the exception types inside a catch block formal parameter type.
Steps to reproduce:
1) Use the attached source code
2) Go to the IO inside the catch block formal parameter definition.
3) After the IO, invoke code assist.
4) NPE

I believe there are two places to fix. I'll provide a patch.
Thanks Pascal for the test case.
Comment 1 Olivier Thomann CLA 2007-02-12 14:09:21 EST
Created attachment 58792 [details]
Test case
Comment 2 Olivier Thomann CLA 2007-02-12 14:11:45 EST
Created attachment 58796 [details]
Proposed fix

David, please review.
This is quite severe as it seems that any code completion on exception type is failing.
Comment 3 Olivier Thomann CLA 2007-02-12 14:21:26 EST
This seems to be a consequence of fix for bug 157584.
Comment 4 Olivier Thomann CLA 2007-02-12 14:36:36 EST
The problem occurs because of the inner try statement with no catch blocks but a finally block. If you add a catch block to the inner try statement, the exception is not thrown. So the null check added in the patch should be fine.
This would be a good candidate for tomorrow's integration build :-).
Comment 5 David Audel CLA 2007-02-13 03:57:24 EST
Released for 3.3M6.

The proposed fix is good. Thanks.

I released your fix and added a regression test: CompletionTest#testCatchClauseExceptionRef15()
Comment 6 David Audel CLA 2007-03-13 04:35:55 EDT
*** Bug 177073 has been marked as a duplicate of this bug. ***
Comment 7 Maxime Daniel CLA 2007-03-20 01:44:16 EDT
Verified for 3.3 M6 using build I20070319-1335.