Summary: | Error in JDT Core during reconcile | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | David Pérez <david.perez.ingeniero> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | jerome_lanneluc, philippe_mulet |
Version: | 3.1 | ||
Target Milestone: | 3.1.1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
David Pérez
2005-06-30 08:18:37 EDT
Would you have steps to reproduce? This can only happen if the working copy has no source. I think the problem comes from the getContents() method on ICompilationUnit. Right now we have: public char[] getContents() { try { IBuffer buffer = this.getBuffer(); return buffer == null ? null : buffer.getCharacters(); } catch (JavaModelException e) { return CharOperation.NO_CHAR; } } instead of: public char[] getContents() { try { IBuffer buffer = this.getBuffer(); return buffer == null ? CharOperation.NO_CHAR : buffer.getCharacters(); } catch (JavaModelException e) { return CharOperation.NO_CHAR; } } Philippe, this might be a good candidate for 3.1.1. I believe getContents() should never return null, but an empty array. Right now the implementation is clearly inconsistent. Ok, though I wonder how this got introduced. We may want to check with Jerome. Probable cause: using Jadclipse plugin not prepared for Eclipse 3.1 Fixed and released in 3.1. maintenance stream. No regression test added as this is a case where no buffer is available. Jérôme, please comment if this is not desired, but there is no null check for the result of getContents(). So I am tempted to believe that null should not be returned. The fix is correct. The bug was introduced with revision 1.70 when changing getBuffer() to possibly return null. Verified with 3.2 M1 Verified for 3.1.1 using build M20050923-1430. See bug 110771 for fup on related concerns. |