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 183773 - [69cat] StringIndexOutOfBoundsException: String index out of range: -1
Summary: [69cat] StringIndexOutOfBoundsException: String index out of range: -1
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-09 13:53 UTC by Filip Zamboj
Modified: 2010-04-13 17:34 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 167826


Attachments
stacktrace (4.42 KB, text/plain)
2010-04-09 13:53 UTC, Filip Zamboj
Details
stacktrace (4.33 KB, text/plain)
2010-04-09 17:42 UTC, laurin1
Details
stacktrace (4.61 KB, text/plain)
2010-04-12 14:21 UTC, laurin1
Details
stacktrace (4.40 KB, text/plain)
2010-04-12 16:12 UTC, laurin1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Zamboj 2010-04-09 13:53:23 UTC
Build: NetBeans IDE Dev (Build 100409-426982565d9f)
VM: Java HotSpot(TM) 64-Bit Server VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux

User Comments:
fzamboj: attempt to override method using alt+insert 
1. choose method 
2. press enter




Stacktrace: 
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
   at java.lang.String.substring(String.java:1937)
   at org.netbeans.modules.php.editor.indent.TokenFormatter$1.replaceString(TokenFormatter.java:1397)
   at org.netbeans.modules.php.editor.indent.TokenFormatter$1.run(TokenFormatter.java:1086)
   at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:311)
   at org.netbeans.modules.php.editor.indent.TokenFormatter.reformat(TokenFormatter.java:340)
   at org.netbeans.modules.php.editor.indent.PHPFormatter.reformat(PHPFormatter.java:126)
Comment 1 Filip Zamboj 2010-04-09 13:53:30 UTC
Created attachment 96962 [details]
stacktrace
Comment 2 laurin1 2010-04-09 17:42:08 UTC
Created attachment 96980 [details]
stacktrace

expanding a php template (tab)
Comment 3 Petr Pisl 2010-04-12 11:03:45 UTC
I connot reproduce. Please, do you have a reproducible case? Laurin1, do you remember, which tamplate it was?
Comment 4 ukko 2010-04-12 11:28:18 UTC
(In reply to comment #3)
> I connot reproduce. Please, do you have a reproducible case? Laurin1, do you
> remember, which tamplate it was?

Here is a short video with an error http://ukkopekka.ru/includes/upload/out.ogv

Nightly builds Netbeans.
Comment 5 Petr Pisl 2010-04-12 11:50:57 UTC
Thanks for the video, but I can not still get the exception, even if my function looks almost as the function at the video. Is it possible to send me the file?
Comment 6 Petr Pisl 2010-04-12 11:53:33 UTC
One more idea, probably the file itself is not so much important. How did you set up the formatting? Did you altered the settings?
Comment 7 ukko 2010-04-12 12:00:32 UTC
(In reply to comment #6)
> One more idea, probably the file itself is not so much important. How did you
> set up the formatting? Did you altered the settings?

Yes, I have a lot has changed in the formatting options.

In any case, enclose a file with all settings.

http://ukkopekka.ru/includes/upload/nb_opt.zip

Try to reset the default?
Comment 8 ukko 2010-04-12 12:05:27 UTC
(In reply to comment #6)
> One more idea, probably the file itself is not so much important. How did you
> set up the formatting? Did you altered the settings?

Yes, I have a lot has changed in the formatting options.

In any case, enclose a file with all settings.

http://ukkopekka.ru/includes/upload/nb_opt.zip

Try to reset the default?
Comment 9 Petr Pisl 2010-04-12 12:37:36 UTC
Thanks very much, I'm now able to reproduce it. The reason is space within for that you have set up to true. I'm going to fix it.
Comment 10 laurin1 2010-04-12 14:21:22 UTC
Created attachment 97096 [details]
stacktrace

typing return;
Comment 11 Exceptions Reporter 2010-04-12 14:21:35 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=167826
Comment 12 laurin1 2010-04-12 16:12:22 UTC
Created attachment 97109 [details]
stacktrace

AutoCompleting a PHP template
Comment 13 Petr Pisl 2010-04-12 17:13:56 UTC
I have commit a fix for this in web-main. It should be OK now.
Comment 14 Quality Engineering 2010-04-13 17:34:06 UTC
Integrated into 'main-golden', will be available in build *201004131450* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/956755f300b3
User: Petr Pisl <ppisl@netbeans.org>
Log: #183773 -  [69cat] StringIndexOutOfBoundsException: String index out of range: -1