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 237186 - StringIndexOutOfBoundsException: String index out of range: 0
Summary: StringIndexOutOfBoundsException: String index out of range: 0
Status: RESOLVED DUPLICATE of bug 237479
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: All All
: P1 normal with 2 votes (vote)
Assignee: Dusan Balek
URL:
Keywords: NO74
Depends on:
Blocks:
 
Reported: 2013-10-16 10:07 UTC by Ondrej Vrabec
Modified: 2013-12-04 15:00 UTC (History)
24 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 204608


Attachments
stacktrace (4.13 KB, text/plain)
2013-10-16 10:07 UTC, Ondrej Vrabec
Details
stacktrace (4.68 KB, text/plain)
2013-10-16 13:40 UTC, Tomas Stupka
Details
stacktrace (4.88 KB, text/plain)
2013-10-16 15:19 UTC, Tomas Stupka
Details
stacktrace (4.02 KB, text/plain)
2013-10-16 20:16 UTC, janario
Details
stacktrace (4.02 KB, text/plain)
2013-10-16 20:19 UTC, janario
Details
stacktrace (4.02 KB, text/plain)
2013-10-17 09:34 UTC, Exceptions Reporter
Details
stacktrace (6.37 KB, text/plain)
2013-10-17 12:55 UTC, janario
Details
stacktrace (4.09 KB, text/plain)
2013-10-18 08:16 UTC, akobberup
Details
stacktrace (4.02 KB, text/plain)
2013-10-18 12:07 UTC, Ondrej Vrabec
Details
stacktrace (8.83 KB, text/plain)
2013-10-21 11:41 UTC, Ondrej Vrabec
Details
stacktrace (5.79 KB, text/plain)
2013-10-21 16:08 UTC, lforet
Details
stacktrace (3.06 KB, text/plain)
2013-10-21 18:59 UTC, Jesse Glick
Details
stacktrace (5.79 KB, text/plain)
2013-10-22 09:02 UTC, akobberup
Details
stacktrace (5.67 KB, text/plain)
2013-10-23 13:45 UTC, Tomas Stupka
Details
stacktrace (5.27 KB, text/plain)
2013-10-24 04:33 UTC, michbarsinai
Details
stacktrace (3.57 KB, text/plain)
2013-10-24 18:27 UTC, akobberup
Details
stacktrace (5.33 KB, text/plain)
2013-10-30 00:55 UTC, _ tboudreau
Details
stacktrace (4.02 KB, text/plain)
2013-10-30 03:49 UTC, _ tboudreau
Details
stacktrace (10.26 KB, text/plain)
2013-10-30 14:52 UTC, Ralph Ruijs
Details
stacktrace (4.09 KB, text/plain)
2013-10-31 14:22 UTC, rodrigorsantos
Details
stacktrace (4.09 KB, text/plain)
2013-10-31 14:25 UTC, rodrigorsantos
Details
stacktrace (4.53 KB, text/plain)
2013-10-31 14:28 UTC, rodrigorsantos
Details
stacktrace (4.02 KB, text/plain)
2013-10-31 17:55 UTC, Ralph Ruijs
Details
stacktrace (2.72 KB, text/plain)
2013-11-01 00:04 UTC, Chiana
Details
stacktrace (2.72 KB, text/plain)
2013-11-01 00:07 UTC, Chiana
Details
stacktrace (2.72 KB, text/plain)
2013-11-01 00:10 UTC, Chiana
Details
stacktrace (4.61 KB, text/plain)
2013-11-01 22:26 UTC, _ tboudreau
Details
stacktrace (4.02 KB, text/plain)
2013-11-05 09:05 UTC, ssazonov
Details
err. log. (7.73 KB, text/plain)
2013-11-05 09:29 UTC, akobberup
Details
stacktrace (4.02 KB, text/plain)
2013-11-06 10:26 UTC, Jiri Skrivanek
Details
stacktrace (5.20 KB, text/plain)
2013-11-06 12:11 UTC, Jiri Skrivanek
Details
stacktrace (4.02 KB, text/plain)
2013-11-09 19:15 UTC, sreimers
Details
stacktrace (4.02 KB, text/plain)
2013-11-12 22:30 UTC, sreimers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ondrej Vrabec 2013-10-16 10:07:36 UTC
Build: NetBeans IDE Dev (Build 20131016-50ca01cec1d2)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.0-b56, Java(TM) SE Runtime Environment, 1.7.0_40-b43
OS: Linux

User Comments:
helderneres: Rename a method parameter(Ctrl + R).

ovrabec: editing body of an if clause




Stacktrace: 
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
   at java.lang.String.charAt(String.java:658)
   at org.netbeans.api.java.source.TreeUtilities.decodeIdentifierInternal(TreeUtilities.java:1091)
   at org.netbeans.api.java.source.TreeUtilities.decodeIdentifier(TreeUtilities.java:1076)
   at org.netbeans.modules.java.editor.semantic.TokenList$3.run(TokenList.java:196)
   at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1391)
   at org.netbeans.modules.java.editor.semantic.TokenList.firstIdentifier(TokenList.java:177)
Comment 1 Ondrej Vrabec 2013-10-16 10:07:38 UTC
Created attachment 141139 [details]
stacktrace
Comment 2 Tomas Stupka 2013-10-16 13:40:21 UTC
Created attachment 141157 [details]
stacktrace

while editing
Comment 3 Tomas Stupka 2013-10-16 15:19:21 UTC
Created attachment 141163 [details]
stacktrace

trying to work
Comment 4 janario 2013-10-16 20:16:21 UTC
Created attachment 141176 [details]
stacktrace

Coding
Comment 5 janario 2013-10-16 20:19:21 UTC
Created attachment 141177 [details]
stacktrace

.
Comment 6 Exceptions Reporter 2013-10-17 09:34:23 UTC
Created attachment 141201 [details]
stacktrace

.
Comment 7 janario 2013-10-17 12:55:23 UTC
Created attachment 141206 [details]
stacktrace

coding
Comment 8 akobberup 2013-10-18 08:16:39 UTC
Created attachment 141241 [details]
stacktrace

coding?
Comment 9 Ondrej Vrabec 2013-10-18 12:07:09 UTC
happens too often
Comment 10 Ondrej Vrabec 2013-10-18 12:07:37 UTC
Created attachment 141248 [details]
stacktrace

this happens quite often simply when coding. All highlightings disappear and i need to reopen the file
Comment 11 _ gtzabari 2013-10-18 15:24:03 UTC
The easiest way to reproduce this is to try clicking on the "bug" link in the Exception Reporter tab. It's 100% reproducible :)
Comment 12 _ gtzabari 2013-10-18 15:24:49 UTC
Sorry. Please ignore my last comment. I was confusing this with another exception.
Comment 13 Ondrej Vrabec 2013-10-21 11:41:19 UTC
Created attachment 141347 [details]
stacktrace

coding
Comment 14 Exceptions Reporter 2013-10-21 11:41:27 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=204608
Comment 15 lforet 2013-10-21 16:08:24 UTC
Created attachment 141360 [details]
stacktrace

editing java source, completion on method was running.
Comment 16 Jesse Glick 2013-10-21 18:59:22 UTC
Created attachment 141369 [details]
stacktrace

Not sure, noticed this exception while editing.
Comment 17 akobberup 2013-10-22 09:02:32 UTC
Created attachment 141389 [details]
stacktrace

using codecompletion in java file
Comment 18 Tomas Stupka 2013-10-23 13:45:06 UTC
Created attachment 141481 [details]
stacktrace

anoying
Comment 19 michbarsinai 2013-10-24 04:33:07 UTC
Created attachment 141495 [details]
stacktrace

indenting a line using shift+option+left arrow
Comment 20 Exceptions Reporter 2013-10-24 15:06:07 UTC
This bug already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=204608
Comment 21 akobberup 2013-10-24 18:27:07 UTC
Created attachment 141531 [details]
stacktrace

punching in late evening code!
Comment 22 _ tboudreau 2013-10-30 00:55:12 UTC
Created attachment 141672 [details]
stacktrace

Had the line 
context.setContextPath("/");
and typed inside the parens "args.length > 0 ? args[0] :" to end up with
context.setContextPath(args.length > 0 ? args[0] : "/");
in a main method
Comment 23 _ tboudreau 2013-10-30 03:49:14 UTC
Created attachment 141676 [details]
stacktrace

Typed in Object o = org.jboss.logging.BasicLogger.class;
Comment 24 Ralph Ruijs 2013-10-30 14:52:33 UTC
Created attachment 141701 [details]
stacktrace

Removed the first character ( a / )  from the beginning of a java file by accident and then pressed ctrl+z to undo.
Comment 25 rodrigorsantos 2013-10-31 14:22:46 UTC
Created attachment 141747 [details]
stacktrace

<Please provide a description of the problem or the steps to reproduce>
Comment 26 rodrigorsantos 2013-10-31 14:25:46 UTC
Created attachment 141748 [details]
stacktrace

<Please provide a description of the problem or the steps to reproduce>
Comment 27 rodrigorsantos 2013-10-31 14:28:46 UTC
Created attachment 141750 [details]
stacktrace

<Please provide a description of the problem or the steps to reproduce>
Comment 28 Ralph Ruijs 2013-10-31 17:55:51 UTC
Created attachment 141756 [details]
stacktrace

Writing code
Comment 29 Chiana 2013-11-01 00:04:58 UTC
Created attachment 141759 [details]
stacktrace

Was typing "private stat" in order to make "private static final long" after pasting "serialVersionUID = 6045816782746445251" on the line, the pasted text was copied from an error message in the output window.
Comment 30 Chiana 2013-11-01 00:07:58 UTC
Created attachment 141760 [details]
stacktrace

Was continuing to type after reporting id #698429
Comment 31 Chiana 2013-11-01 00:10:58 UTC
Created attachment 141761 [details]
stacktrace

Seems this occurs when you STOP typing
Comment 32 _ gtzabari 2013-11-01 00:23:07 UTC
Dusan must be getting 10,000 emails a day from this issue by now :)

Do we need to improve logging for this issue, or do you understand what's triggering this?
Comment 33 _ tboudreau 2013-11-01 22:26:07 UTC
Created attachment 141791 [details]
stacktrace

This happens so frequently as to make the IDE unusable.
Comment 34 _ tboudreau 2013-11-01 22:45:53 UTC
Typically after this happens 20-30 times, I wind up with the AWT thread frozen - not a deadlock per-se, since only one lock is involved, but these are the threads which share the NbEditorDocument - not sure if this is related or not:

"AWT-EventQueue-0" prio=10 tid=0x00007f69ac523000 nid=0x6fb1 in Object.wait() [0x00007f69b96c6000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:503)
	at javax.swing.text.AbstractDocument.writeLock(AbstractDocument.java:1344)
	- locked <0x000000077250aab8> (a org.netbeans.modules.editor.NbEditorDocument)
	at org.netbeans.editor.BaseDocument.extWriteLock(BaseDocument.java:1673)
	at org.netbeans.editor.BaseDocument.atomicLockImpl(BaseDocument.java:1721)
	- locked <0x000000077250aab8> (a org.netbeans.modules.editor.NbEditorDocument)
	- locked <0x000000077250aab8> (a org.netbeans.modules.editor.NbEditorDocument)
	at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:347)
	at org.netbeans.editor.BaseKit$InsertBreakAction.actionPerformed(BaseKit.java:1339)
	at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:339)
	at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1664)
	at javax.swing.JComponent.processKeyBinding(JComponent.java:2878)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2925)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2841)
	at java.awt.Component.processEvent(Component.java:6282)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4861)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4687)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727)
	at java.awt.Component.dispatchEventImpl(Component.java:4731)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Window.dispatchEventImpl(Window.java:2719)
	at java.awt.Component.dispatchEvent(Component.java:4687)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)

"org.netbeans.api.progress.ProgressUtils" daemon prio=10 tid=0x00007f6974402800 nid=0x705f in Object.wait() [0x00007f69b9ccb000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:503)
	at javax.swing.text.AbstractDocument.writeLock(AbstractDocument.java:1344)
	- locked <0x000000077250aab8> (a org.netbeans.modules.editor.NbEditorDocument)
	at org.netbeans.editor.BaseDocument.extWriteLock(BaseDocument.java:1673)
	at org.netbeans.editor.BaseDocument.atomicLockImpl(BaseDocument.java:1721)
	- locked <0x000000077250aab8> (a org.netbeans.modules.editor.NbEditorDocument)
	- locked <0x000000077250aab8> (a org.netbeans.modules.editor.NbEditorDocument)
	at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:347)
	at org.netbeans.editor.ActionFactory$FormatAction$1.run(ActionFactory.java:1655)
	at org.netbeans.modules.progress.ui.RunOffEDTImpl$1.run(RunOffEDTImpl.java:150)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
Comment 35 ssazonov 2013-11-05 09:05:26 UTC
Created attachment 141853 [details]
stacktrace

...
Comment 36 akobberup 2013-11-05 09:29:18 UTC
Created attachment 141854 [details]
err. log.

I am really looking forward to this being fixed, as
A) like Tim writes it is pretty disruptive to the experience, and
B) I am no fan of having the content of my java files logged in the IDE log. I use netbeans for my work, and as long as the class files are logged in messages.log i dont dare send in slowness reports or any other exception reports from the exception reporter directly, as i will not have my work classes shared with the world!

The attached stacktrace + debug is from daily build 201311050001.
Comment 37 Jiri Skrivanek 2013-11-06 10:26:39 UTC
Created attachment 141890 [details]
stacktrace

Editing java class.
Comment 38 Jiri Skrivanek 2013-11-06 12:11:40 UTC
Created attachment 141893 [details]
stacktrace

Editing java file.
Comment 39 sreimers 2013-11-09 19:15:16 UTC
Created attachment 142028 [details]
stacktrace

Typing in Java editor invoking code completion
Comment 40 sreimers 2013-11-12 22:30:20 UTC
Created attachment 142110 [details]
stacktrace

Navigating with alt - cursor keys
Comment 41 Dusan Balek 2013-12-04 15:00:03 UTC
Already fixed.

*** This bug has been marked as a duplicate of bug 237479 ***