Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316936 - [Help][Context] NPE on ContextFile
Summary: [Help][Context] NPE on ContextFile
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: platform-ua-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-15 11:59 EDT by Angel Vera CLA
Modified: 2011-02-03 13:58 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Angel Vera CLA 2010-06-15 11:59:53 EDT
While debugging a problem I found that there was a NPE thrown in ContextFile.hashCode because for whatever reason file was null. I am not sure in which situations this would happen, but I wonder if it can be handled in a better manner, perhaps printing out the bundleID that caused the error.
Comment 1 Chris Goldthorpe CLA 2010-06-15 13:55:32 EDT
Can you attach a stack trace?
Comment 2 Chris Goldthorpe CLA 2011-02-02 19:06:21 EST
Are you still seeing the problem, if so can you include a stack trace?
Comment 3 Angel Vera CLA 2011-02-03 11:01:47 EST
Sorry I would be hard for me to provide a stacktrace at this time. Is it possible to just do a null check and print something more useful?
Comment 4 Chris Goldthorpe CLA 2011-02-03 13:03:13 EST
The constructor for ContextFile() is only called from one place so I was able to determine that the only way file could be null would be if in the extension point declaration for the context is missing a file attribute. I verified that if I changed the code to set file to null the NPE you saw would occur.

Omitting the file attribute in a <context> element in plugin.xml causes an error at build time. The only way I could think that this situation could occur would be to modify plugin.xml outside of the build environment.

If I add a null pointer check to hashCode() an NPE will just thrown later when attempting to open the file. My inclination is to close this bug as WONTFIX since it represents a situation that would only occur if the build tools were bypassed when creating the plug-in and the extension does not match the schema, in which case the exception would give a clue as to how to fix the problem.
Comment 5 Angel Vera CLA 2011-02-03 13:58:12 EST
I understand your assessment.