Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 177660 - StringIndexOutOfBoundsException: String index out of range: -4
StringIndexOutOfBoundsException: String index out of range: -4
Product: java
Classification: Unclassified
Component: Source
All All
: P2 (vote)
: 6.x
Assigned To: Jan Lahoda
EXCEPTIONS_REPORT 68patch1-verified
Depends on:
  Show dependency treegraph
Reported: 2009-11-26 04:34 UTC by Erno Mononen
Modified: 2010-01-25 08:13 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT

stacktrace (1.26 KB, text/plain)
2009-11-26 04:34 UTC, Erno Mononen
stacktrace (1.26 KB, text/plain)
2009-11-26 08:15 UTC, Jan Pokorsky
stacktrace (1.26 KB, text/plain)
2009-11-27 07:57 UTC, Karol Harezlak

Note You need to log in before you can comment on or make changes to this bug.
Description Erno Mononen 2009-11-26 04:34:38 UTC
Build: NetBeans IDE Dev (Build 200911251400)
VM: Java HotSpot(TM) 64-Bit Server VM, 16.0-b08, Java(TM) SE Runtime Environment, 1.7.0-ea-b71
OS: Linux, 2.6.27-15-generic, amd64

User Comments:
GUEST: remove cast

GUEST: casting

GUEST: casting

GUEST: Tried to move a class from one package to another (via drag-and-drop).
Sometimes refactoring works, sometimes it doesn't, although it's consistant per specific file. That is, I can move class X from package A to B, but cannot move class Y from package C to D.

t_yano: I used a refacturring action 'inner to outer' against inner enum class.

mhuebner: clicked on "surround block with try/catch"

emononen: Applied a hint suggesting casting

GUEST: removing cast

java.lang.StringIndexOutOfBoundsException: String index out of range: -4
        at java.lang.String.substring(
        at org.netbeans.modules.parsing.api.ParserManager$
Comment 1 Erno Mononen 2009-11-26 04:34:42 UTC
Created attachment 91721 [details]
Comment 2 Jan Pokorsky 2009-11-26 08:15:48 UTC
Created attachment 91733 [details]
Comment 3 Karol Harezlak 2009-11-27 07:57:48 UTC
Created attachment 91783 [details]
Comment 4 Exceptions Reporter 2009-12-03 03:54:18 UTC
This bug already has 20 duplicates 
Comment 5 Jan Lahoda 2009-12-18 08:59:08 UTC
I am not completely sure what is the root cause, but I think that the CompilationUnitTree.getLineMap is likely not correctly updated after partial reparse. I have introduced a workaround that should hopefully fix this particular exception:

I have created a new bug #178862 to keep track about the CUT.getLineMap().

The workaround might be a good 6.8 patch1 candidate.
Comment 6 Quality Engineering 2009-12-19 23:40:30 UTC
Integrated into 'main-golden', will be available in build *200912200200* on (upload may still be in progress)
User: Jan Lahoda <>
Log: #177660: trying to prevent a StringIndexOutOfBoundsException.
Comment 7 pgebauer 2010-01-06 04:18:45 UTC
The whiteboard changed back to 68patch-candidate. The whiteboard 68patch1-candidate can be added by QA or Sustaining to issues those has been verified in the trunk already.
Comment 8 Peter Pis 2010-01-14 06:38:25 UTC
I was not able to reproduce. Verified in trunk.
Comment 9 pgebauer 2010-01-14 13:12:43 UTC
The fix has been ported into the release68_fixes repository.
Comment 10 Peter Pis 2010-01-25 08:13:32 UTC

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo