Community
Participate
Working Groups
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.
Can you attach a stack trace?
Are you still seeing the problem, if so can you include a stack trace?
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?
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.
I understand your assessment.