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 241165 - StringIndexOutOfBoundsException: String index out of range: 1924
Summary: StringIndexOutOfBoundsException: String index out of range: 1924
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-30 11:49 UTC by brettryan
Modified: 2015-11-21 14:24 UTC (History)
14 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 202826


Attachments
stacktrace (2.08 KB, text/plain)
2014-01-30 11:49 UTC, brettryan
Details
stacktrace (2.08 KB, text/plain)
2014-03-28 10:22 UTC, fillumina
Details
stacktrace (2.08 KB, text/plain)
2014-04-08 02:13 UTC, misterm
Details
stacktrace (2.08 KB, text/plain)
2014-05-03 21:18 UTC, Michel Graciano
Details
stacktrace (2.08 KB, text/plain)
2014-05-03 21:21 UTC, Michel Graciano
Details
Sample project (7.53 KB, application/zip)
2014-05-03 21:27 UTC, Michel Graciano
Details
stacktrace (2.08 KB, text/plain)
2014-10-04 18:38 UTC, everflux
Details
stacktrace (2.08 KB, text/plain)
2014-10-16 16:37 UTC, wjdhamilton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description brettryan 2014-01-30 11:49:28 UTC
Build: NetBeans IDE Dev (Build 201401260001)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.0-b56, Java(TM) SE Runtime Environment, 1.7.0_40-b43
OS: Mac OS X

User Comments:
brettryan: Pressed enter on accept object method, I can see there is a lambda body that requires a semicolon at the end of the statement.

GUEST: java ????????

assylias: Thread t2 = new Thread((Runnable)() -> {try { l.countDown();} catch (InterruptedException e) {} });

GUEST: When I input " System.out.println();", the error is occurred.

      List<String> list = new ArrayList<>();
        
        list.add("a");
        list.add("11");
        list.add("bb");
        
        list.stream().forEach(s -> System.out.println(s));
        
        System.out.println("-----------------------------------");
        
        Collections.sort(list, (s1, s2) -> s1.compareTo(s2));
        
        list.forEach(s -> {
            System.out.println();
            System.out.println(s);
                });




Stacktrace: 
java.lang.StringIndexOutOfBoundsException: String index out of range: 1924
   at java.lang.String.substring(String.java:1907)
   at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.getEnvImpl(JavaCompletionProvider.java:5647)
   at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.getCompletionEnvironment(JavaCompletionProvider.java:5552)
   at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.resolveToolTip(JavaCompletionProvider.java:464)
   at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.run(JavaCompletionProvider.java:452)
   at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery$Task.run(JavaCompletionProvider.java:5886)
Comment 1 brettryan 2014-01-30 11:49:30 UTC
Created attachment 144579 [details]
stacktrace
Comment 2 Exceptions Reporter 2014-02-15 23:43:30 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=202826
Comment 3 fillumina 2014-03-28 10:22:00 UTC
Created attachment 146372 [details]
stacktrace

Adding the "e -> e.getJob()" in the following expression in java editor:

return employees.stream().filter(e -> e.getJob())
Comment 4 misterm 2014-04-08 02:13:39 UTC
Created attachment 146615 [details]
stacktrace

.
Comment 5 Michel Graciano 2014-05-03 21:18:19 UTC
Created attachment 147091 [details]
stacktrace

Editing some Java code with lambda expressions.
Comment 6 Michel Graciano 2014-05-03 21:21:19 UTC
Created attachment 147092 [details]
stacktrace

Editing some Java ode with lambda expressions.
Comment 7 Exceptions Reporter 2014-05-03 21:21:24 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=202826
Comment 8 Michel Graciano 2014-05-03 21:27:37 UTC
Created attachment 147093 [details]
Sample project

I am not sure it will be 100% reproducible for you, but for me it is.

Steps:
1. Open the source file ResumoTest.java, available in this attached project
2. At position 29:36 hit the CC (Ctrl + Space for my Linux)
3. This exception is thrown

Somethime the CC call in step 2 need to be hitted more than once, but I always can reproduce it.
Comment 9 Michel Graciano 2014-05-03 21:28:24 UTC
BTW, I have built the IDE in my workstation.
Product Version: NetBeans IDE Dev (Build 20140501-26bedde19dc9)
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.11.0-20-generic running on amd64; UTF-8; en_US (nb)
Comment 10 everflux 2014-10-04 18:38:25 UTC
Created attachment 149706 [details]
stacktrace

typing around in the IDE with java 8 stream features
Comment 11 wjdhamilton 2014-10-16 16:37:24 UTC
Created attachment 149946 [details]
stacktrace

Editing a test case. Trying to add the following line:
LocalDate expiry = collat.getExpiryDate().ifPresent(() -> fail("There should be no date here"));