Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316327 - [model] JavaElement.newNotPresentException exceptions caused by use of IJavaScriptProject#findType
Summary: [model] JavaElement.newNotPresentException exceptions caused by use of IJavaS...
Status: CLOSED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Project Inbox CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-09 11:26 EDT by Ian Tewksbury CLA
Modified: 2010-07-09 09:11 EDT (History)
1 user (show)

See Also:
cmjaun: review+
thatnitind: review+


Attachments
Fix Patch (4.23 KB, patch)
2010-06-09 11:26 EDT, Ian Tewksbury CLA
no flags Details | Diff
Fix Patch - Update 1 (4.34 KB, patch)
2010-06-09 14:15 EDT, Ian Tewksbury CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Tewksbury CLA 2010-06-09 11:26:39 EDT
Created attachment 171541 [details]
Fix Patch

The problem with IJavaScriptProject#findType is that it returns the first type to match the given FQN but that type may not actully be the one a caller is looking for.  Then if the caller asks for a field they are expecting on the type but its the wrong type a org.eclipse.wst.jsdt.internal.core.JavaElement.newNotPresentException is thrown.

Attached patch changes a couple of these cases I have found to use the #findTypes method to avoid this exception.
Comment 1 Chris Jaun CLA 2010-06-09 14:14:10 EDT
Ian is submitting an updated patch with a few minor updates. I approve.
Comment 2 Ian Tewksbury CLA 2010-06-09 14:15:19 EDT
Created attachment 171562 [details]
Fix Patch - Update 1

Added null safety.
Comment 3 Chris Jaun CLA 2010-06-22 15:42:35 EDT
Fix checked into 3.2.1
Comment 4 Ian Tewksbury CLA 2010-07-09 09:11:32 EDT
verified in WTP 3.2.1