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 155645

Summary: StringIndexOutOfBoundsException thrown in String.substring call of CasualDiff.diff when using Retouche
Product: java Reporter: tk_fhd_aui <tk_fhd_aui>
Component: SourceAssignee: Rastislav Komara <moonko>
Status: RESOLVED WORKSFORME    
Severity: blocker CC: imyousuf
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=47959
Issue Type: DEFECT Exception Reporter: 47959

Description tk_fhd_aui 2008-12-17 11:44:22 UTC
I hope P2 is correct - was not sure.

The problem was came up at 2 or 3 different people working with Retouche. At least two (me including) can't track it
down. Source code for both is available, one is linked in the exception report. It showed up in version 6.1 and 6.5 of
the IDE.

java.lang.StringIndexOutOfBoundsException: String index out of range: -2727
        at java.lang.String.substring(String.java:1938)
        at org.netbeans.modules.java.source.save.CasualDiff.diff(CasualDiff.java:167)
        at org.netbeans.api.java.source.WorkingCopy.processCurrentCompilationUnit(WorkingCopy.java:391)
        at org.netbeans.api.java.source.WorkingCopy.getChanges(WorkingCopy.java:452)
        at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:912)
        at com.smartitengineering.loggergenerator.CreateLogStatements.performAction(CreateLogStatements.java:97)
Comment 1 tk_fhd_aui 2008-12-17 12:32:30 UTC
Found some possible related bugs: 92127 and 92726

The problem seems to be reproducible by rewriting synthetic constructors/ initializers.

My current workaround is not to modify them which is in my first implementation acceptable.
Comment 2 Jan Lahoda 2009-01-05 14:50:28 UTC
I took a look at:
http://code.google.com/p/smart-codegen/
and tried to reproduce but I did not succeed. Could you please provide steps to reproduce. Ideally, a standalone unit
test, but user-level steps to reproduce would be fine too. Thanks.
Comment 3 Rastislav Komara 2009-02-03 10:53:14 UTC
Overtake.
Comment 4 pribyl 2009-04-17 14:06:35 UTC
Unfortunatelly, I cannot reproduce either. 
No additional info provided for more than a month -> closing as WORKSFORME.

Please reopen if you are experiencing this problem in later builds. Add as much info as possible (steps to reproduce,
test case, etc.)

Thanks a lot