naotsugu opened a new issue, #4646:
URL: https://github.com/apache/netbeans/issues/4646

   ### Apache NetBeans version
   
   Apache NetBeans 15
   
   ### What happened
   
   An exception is raised if an attribute is specified in the JavaDoc to be 
trimmed.
   
   ```
   java.lang.StringIndexOutOfBoundsException: begin 0, end 7, length 6
   at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4604)
   at java.base/java.lang.String.substring(String.java:2707)
   at 
org.netbeans.modules.java.editor.base.javadoc.JavadocImports.processDocTreeNode(JavadocImports.java:824)
   at 
org.netbeans.modules.java.editor.base.javadoc.JavadocImports.access$100(JavadocImports.java:81)
   at 
org.netbeans.modules.java.editor.base.javadoc.JavadocImports$1.scan(JavadocImports.java:135)
   at 
org.netbeans.modules.java.editor.base.javadoc.JavadocImports$1.scan(JavadocImports.java:117)
   at com.sun.source.util.DocTreeScanner.scanAndReduce(DocTreeScanner.java:88)
   at com.sun.source.util.DocTreeScanner.scan(DocTreeScanner.java:103)
   at com.sun.source.util.DocTreeScanner.visitReturn(DocTreeScanner.java:419)
   ```
   
   ### How to reproduce
   
   An exception will be thrown if a character containing spaces such as `{@ ` 
is present in the JavaDoc.
   
   ```
   /**
    * {@ 
    */
   ```
   Note that this character contains spaces.
   
   The following incorrect trim process is the cause.
   
   
   org.netbeans.modules.java.editor.base.javadoc.JavadocImports.java
   
   ```java
   int errorBodyLength = body.trim().substring(0, 
body.length()).trim().length();
   ```
   
   I do not understand the intent of the above, but I speculate that the 
following is appropriate.
   
   ```java
   int errorBodyLength = body.trim().length();
   ```
   
   Added in this pull. 
[https://github.com/apache/netbeans/pull/2954](https://github.com/apache/netbeans/pull/2954)
   
   
   
   ### Did this work correctly in an earlier version?
   
   Apache NetBeans 12.4
   
   ### Operating System
   
   MacOS 12.5.1
   
   ### JDK
   
   OpenJDK 64-Bit Server VM Corretto-18.0.0.37.1
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   Yes
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to