This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 233526

Summary: IndexOutOfBoundsException: end < start (16 < 31)
Product: editor Reporter: MackSix
Component: Hints & AnnotationsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED FIXED    
Severity: normal CC: MackSix
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 202582
Attachments: stacktrace
stacktrace

Description MackSix 2013-07-27 08:25:09 UTC
Build: NetBeans IDE Dev (Build 201307262300)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.0-b53, Java(TM) SE Runtime Environment, 1.7.0_40-ea-b34
OS: Windows 7

User Comments:
MackSix: 1. Created custom Inspection per http://wiki.netbeans.org/TS_73_InspectAndRefactor
2. Tried to edit the custom inspection and typed $1 before first curly brace.
This Exception was thrown.




Stacktrace: 
java.lang.IndexOutOfBoundsException: end < start (16 < 31)
   at org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription(ErrorDescriptionFactory.java:217)
   at org.netbeans.modules.java.hints.declarative.idebinding.HintsTask$1.run(HintsTask.java:134)
   at org.netbeans.modules.java.hints.declarative.idebinding.HintsTask$1.run(HintsTask.java:123)
   at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:493)
   at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:593)
   at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:155)
Comment 1 MackSix 2013-07-27 08:25:11 UTC
Created attachment 137885 [details]
stacktrace
Comment 2 MackSix 2013-07-27 08:39:43 UTC
1. Created custom Inspection per
http://wiki.netbeans.org/TS_73_InspectAndRefactor

Custom Inspection that works:

<!description="My Inspection">
{
    $1 $2;
    $2 = $3;
}=>
{
    $1 $2 = $3;
};;

2. Tried to edit and typed a "$4" in location shown below:

<!description="My Inspection">
{
   $1 $2;
   $2 = $3;

   $4
}=>
{
    $1 $2 = $3;
};;

This causes exception.
Comment 3 MackSix 2013-07-27 09:12:56 UTC
Created attachment 137887 [details]
stacktrace

1. Opened Inpect & Transform custom script in editor.
2. Tried editing it in editor.

This exception is thrown in editor too.
Comment 4 Jan Lahoda 2013-07-29 08:18:23 UTC
Fixed:
http://hg.netbeans.org/jet-main/rev/2fe25ab44dc7
Comment 5 Quality Engineering 2013-07-30 02:19:23 UTC
Integrated into 'main-silver', will be available in build *201307292300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2fe25ab44dc7
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #233526: some diagnostics need end pos table to get the end position - using the computed SourcePositions for that.