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 154893 - StringIndexOutOfBoundsException: String index out of range: 97
Summary: StringIndexOutOfBoundsException: String index out of range: 97
Status: CLOSED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Petr Pisl
URL: http://statistics.netbeans.org/except...
Keywords:
: 154990 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-12-08 09:20 UTC by Marian Mirilovic
Modified: 2010-04-22 10:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 117033


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Mirilovic 2008-12-08 09:20:04 UTC
17 duplicates so far ...

Build: NetBeans IDE Dev (Build 080923)
VM: Java HotSpot(TM) Client VM, 11.0-b12, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b25
OS: Linux, 2.6.24-19-generic, i386
User comments: 
STACKTRACE: (first 10 lines)
java.lang.StringIndexOutOfBoundsException: String index out of range: 97
        at java.lang.String.charAt(String.java:687)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.sanitizeSource(GSFPHPParser.java:279)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.parseBuffer(GSFPHPParser.java:111)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.sanitize(GSFPHPParser.java:414)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.parseBuffer(GSFPHPParser.java:182)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.sanitize(GSFPHPParser.java:412)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.parseBuffer(GSFPHPParser.java:182)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.sanitize(GSFPHPParser.java:410)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.parseBuffer(GSFPHPParser.java:182)
        at org.netbeans.modules.php.editor.parser.GSFPHPParser.sanitize(GSFPHPParser.java:407)
Comment 1 Petr Pisl 2008-12-09 11:56:36 UTC
*** Issue 154990 has been marked as a duplicate of this issue. ***
Comment 2 Petr Pisl 2008-12-09 12:36:07 UTC
The problem can happen when the cursor is on the last line and the code contains an error.
fixed in trunk.
Comment 3 Quality Engineering 2008-12-10 05:57:26 UTC
Integrated into 'main-golden', will be available in build *200812100201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2277b67580af
User: Petr Pisl <ppisl@netbeans.org>
Log: #154893 - StringIndexOutOfBoundsException: String index out of range: 97
Comment 4 Petr Pisl 2008-12-10 13:14:41 UTC
The correct fix is 

-- a/php.editor/src/org/netbeans/modules/php/editor/parser/GSFPHPParser.java
+++ b/php.editor/src/org/netbeans/modules/php/editor/parser/GSFPHPParser.java
@@ -282,8 +282,9 @@ public class GSFPHPParser implements Par
    start++;
    if (end < source.length()) {
       c = source.charAt(end);
       while (end < source.length() && c != '\n' && c != '\r' && c != '{' && c != '}') {
       - c = source.charAt(++end);
       + c = source.charAt(end++);
    }
}
context.sanitizedSource = source.substring(0, start) + Utils.getSpaces(end-start) + source.substring(end); 


So without end++ before while.
Comment 5 jinb 2009-01-07 19:42:18 UTC
QA, please verify this fix till 14-Jan-2009, so it can be part of NB 6.5 patch 2.
Comment 6 Marian Mirilovic 2009-01-08 09:03:37 UTC
There is new report http://statistics.netbeans.org/analytics/exception.do?id=151030 ... reported after your fix, so not
sure it's already fixed.
Comment 7 Petr Pisl 2009-01-08 14:39:49 UTC
But the latest report is from an older build (NetBeans 6.5). I fixed this in December. Or I missed something?
Comment 8 jinb 2009-01-08 18:54:39 UTC
Well. If it fixed in trunk (main) it should be verified in trunk (main) and only after that it can be ported into
65_fixes (become part of some patch)
Comment 9 Marian Mirilovic 2009-01-09 11:53:10 UTC
to ppisl:
http://statistics.netbeans.org/analytics/exception.do?id=151030 is reported against build 090101... 
Comment 10 pgebauer 2009-01-14 09:54:22 UTC
The issue hasn't passed the nomination process for 65patch2 by cut-off date. It has been moved to 65patch3.
Comment 11 pgebauer 2009-04-08 14:13:33 UTC
The status whiteboard "65fixes4-candidate" has been removed.
At this time our proactive patches for the NetBeans 6.5.x IDE have concluded.

If you own a Sun service plan contract for NetBeans, you may wish to contact
Sun Service http://www.sun.com/contact/support.jsp to request a fix via the
product defect escalation process.

For more information on purchasing a Sun service plan contract for NetBeans,
refer to the service plan item "Sun Software Service Plans (S3P) for Developers"
in the Sun Service table found on our NetBeans Support Resources
page http://www.netbeans.org/kb/support.html
Comment 12 Marian Mirilovic 2010-04-22 10:34:22 UTC
v/c