Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 167311 Details for
Bug 311864
[formatter] NPE with empty {@code }
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 3.43 KB, created by
Frederic Fusier
on 2010-05-06 10:24:59 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2010-05-06 10:24:59 EDT
Size:
3.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v >retrieving revision 1.208 >diff -u -r1.208 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 6 May 2010 09:30:57 -0000 1.208 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 6 May 2010 14:24:19 -0000 >@@ -3173,11 +3173,13 @@ > FormatJavadocBlock inlinedBlock = (FormatJavadocBlock)node; > if (isImmutableNode) { > text = (FormatJavadocText) inlinedBlock.getLastNode(); >- length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; // tag length >- if (nodeStart > (previousEnd+1)) { >- length++; // include space between nodes >- } >- this.scanner.resetTo(text.sourceStart , node.sourceEnd); >+ if (text != null) { >+ length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; // tag length >+ if (nodeStart > (previousEnd+1)) { >+ length++; // include space between nodes >+ } >+ this.scanner.resetTo(text.sourceStart , node.sourceEnd); >+ } > } > } > if (text != null) { >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v >retrieving revision 1.65 >diff -u -r1.65 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 6 May 2010 09:27:33 -0000 1.65 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 6 May 2010 14:24:21 -0000 >@@ -6753,4 +6753,48 @@ > ); > } > >+/** >+ * @bug 311864: [formatter] NPE with empty {@code } >+ * @test Ensure that no NPE occurs while formatting an empty code inline tag. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311864" >+ */ >+public void testBug0311864() throws JavaModelException { >+ this.formatterPrefs.use_tags = true; >+ String source = >+ "public class Test {\n" + >+ "\n" + >+ "/**\n" + >+ "* Compares two property values. For font or color the <i>description</i> of\n" + >+ "* the resource, {@link FontData} or {@link RGB}, is used for comparison.\n" + >+ "*\n" + >+ "* @param value1\n" + >+ "* first property value\n" + >+ "* @param value2\n" + >+ "* second property value\n" + >+ "* @return {@code true} if the values are equals; otherwise {@code}\n" + >+ "*/\n" + >+ "boolean foo(int value1, int value2) {\n" + >+ " return value1 > value2;\n" + >+ "}\n" + >+ "}\n"; >+ formatSource(source, >+ "public class Test {\n" + >+ "\n" + >+ " /**\n" + >+ " * Compares two property values. For font or color the <i>description</i> of\n" + >+ " * the resource, {@link FontData} or {@link RGB}, is used for comparison.\n" + >+ " * \n" + >+ " * @param value1\n" + >+ " * first property value\n" + >+ " * @param value2\n" + >+ " * second property value\n" + >+ " * @return {@code true} if the values are equals; otherwise {@code}\n" + >+ " */\n" + >+ " boolean foo(int value1, int value2) {\n" + >+ " return value1 > value2;\n" + >+ " }\n" + >+ "}\n" >+ ); >+} >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 311864
: 167311