Summary: | [Search] NPE after move followed by undo | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Michael Valenta <Michael.Valenta> | ||||
Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | david_audel, philippe_mulet | ||||
Version: | 3.5 | ||||||
Target Milestone: | 3.5 M6 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Michael Valenta
2008-10-28 13:25:17 EDT
I cannot reproduce it with a simple test case using I20081026-2000. As I didn't change anything in search since 3.5M2, I doubt that the explanation could be that builds are different... Looking at corresponding line of code does not help a lot either. So, we need to figure out what is special in your config/wksp: 1) Can you reproduce in a fresh wksp? 2) Can you reproduce in the same wkps but another (simple) class? 3) Do you still have the problem after an exit/restart? 4) Anything else in the .log? If you can reproduce it each time you follow this scenario, then it would be interesting to set JDT/Core search debug ON by adding following lines in .options file: # Turn on debug tracing for org.eclipse.jdt.core plugin org.eclipse.jdt.core/debug=true # Reports java search activity org.eclipse.jdt.core/debug/search=true TIA It turns out this problem was caused by a failure in the Source>Externalize Strings... wizard. I was Internalizing strings in order to move classes to another plug-in. The string in the message bundle was ChangeFilePropertiesPreferencePage_TextTypesText=Text types are files that have one of the following properties:\n\ta) Are associated under the Eclipse Text Content Type tree\n\tb) Have a MIME prefixed by the "text/" category When it was internalized, the " near the end were not escaped which caused a compile error. I didn't see the compile error because I have error on non-NLSed set to true and was going to externalize after the move. So, there are two failures here: 1) Internalizing a string should escape double quotes 2) A compile error shouldn't cause an NPE in search Search is intended to be resilient to errors, this is just a bug. Created attachment 127307 [details]
Proposed patch
The only explanation for the NPE on the line shown in the stack trace is that the report level was null when trying to report the match. The only possibility that this happens is that it has been reported while visiting the MemberDeclarationVisitor before.
Theoretically, this is only possible when there's local type and this case was already protected before, but as there was a compiler error, I talked with David and it seems that in case of a statement recovery, this might happen...
Hence, the null checking sounds like an acceptable patch to make the Search resilient for such compiler errors...
Released for 3.5M6 in HEAD stream. Verified for 3.5M6 |