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 231840 - IndexOutOfBoundsException: index=1 >= size()=1
Summary: IndexOutOfBoundsException: index=1 >= size()=1
Status: REOPENED
Alias: None
Product: editor
Classification: Unclassified
Component: Lexer (show other bugs)
Version: 7.4
Hardware: All All
: P1 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-26 12:56 UTC by mmolda
Modified: 2018-02-13 12:11 UTC (History)
37 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 201022


Attachments
stacktrace (2.52 KB, text/plain)
2013-06-26 12:56 UTC, mmolda
Details
stacktrace (2.52 KB, text/plain)
2013-07-30 10:16 UTC, damianociarla
Details
stacktrace (2.52 KB, text/plain)
2013-08-07 23:56 UTC, hrza
Details
stacktrace (2.54 KB, text/plain)
2013-12-26 18:30 UTC, everflux
Details
stacktrace (2.54 KB, text/plain)
2014-01-14 15:15 UTC, Kenneth Ganfield
Details
HTML file, which cannot be edited through IndexOfBoundException (10.56 KB, text/html)
2016-10-26 14:56 UTC, wissenstein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mmolda 2013-06-26 12:56:26 UTC
Build: NetBeans IDE Dev (Build 201306252301)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.25-b01, Java(TM) SE Runtime Environment, 1.7.0_25-b15
OS: Windows 7

User Comments:
GUEST: hello
today i wrote to you my first exception and now i have again.
 i didnot use netbeans and was searching in the internet
and i saw netbeans signal. i have opening 2 project . first joomla25 second joomla25 and component for it which has soze like joomla25. i have 4 files opened and each file have not more 1800 lines

mmolda: Created new twig file, select all (Ctrl+A) and delete, start typing '{'
then exception pops out




Stacktrace: 
java.lang.IndexOutOfBoundsException: index=1 >= size()=1
   at org.netbeans.lib.lexer.JoinTokenList.tokenList(JoinTokenList.java:163)
   at org.netbeans.lib.lexer.JoinLexerInputOperation.tokenList(JoinLexerInputOperation.java:217)
   at org.netbeans.lib.lexer.JoinLexerInputOperation.fetchActiveTokenList(JoinLexerInputOperation.java:211)
   at org.netbeans.lib.lexer.JoinLexerInputOperation.createJoinToken(JoinLexerInputOperation.java:273)
   at org.netbeans.lib.lexer.JoinLexerInputOperation.createDefaultTokenInstance(JoinLexerInputOperation.java:239)
   at org.netbeans.lib.lexer.LexerInputOperation.createToken(LexerInputOperation.java:299)
Comment 1 mmolda 2013-06-26 12:56:27 UTC
Created attachment 136337 [details]
stacktrace
Comment 2 Exceptions Reporter 2013-07-24 16:45:47 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=201022
Comment 3 damianociarla 2013-07-30 10:16:01 UTC
Created attachment 137989 [details]
stacktrace

Twig file does not work
Comment 4 hrza 2013-08-07 23:56:12 UTC
Created attachment 138424 [details]
stacktrace

I got IndexOutOfBounds in middle of writting twig template... It was very strange, and this is first time i encouter this exception in editor. I reproduce it by opening block tag and pressing ctrl + f combination...
Comment 5 Exceptions Reporter 2013-08-21 17:22:05 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=201022
Comment 6 Exceptions Reporter 2013-08-21 17:31:05 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=201022
Comment 7 Exceptions Reporter 2013-08-21 17:40:05 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=201022
Comment 8 everflux 2013-12-26 18:30:25 UTC
Created attachment 143470 [details]
stacktrace

editing twig template
Comment 9 Kenneth Ganfield 2014-01-14 15:15:46 UTC
Created attachment 143947 [details]
stacktrace

typing in twig file in editor
Comment 10 Martin Balin 2016-07-07 07:32:04 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 11 Jenselme 2016-09-04 08:38:48 UTC
I just managed to reproduce this expection on a HTML file on Angular project. See: http://statistics.netbeans.org/exceptions/exception.do?id=829447

This happens on angular project after typing {{ at line 12. It also happens if I open an HTML file with two opening {{ but no matching }} to close the tag.

HTML Code:
<!doctype html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.0.6/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<div ng-controller="SettingsController">
<h1>{{name}}</h1>{{lastName}}
Name: <input type="text" ng-model="name"/>
[ <a href="" ng-click="greet()">greet</a> ]<br/>
Contact: {{
<ul>
<li ng-repeat="contact in contacts">
<select ng-model="contact.type" class="{{cssColor}}">
<option>phone</option>
<option>email</option>
</select>
<input type="text" ng-model="contact.value"/>
[ <a href="" ng-click="clearContact(contact)">clear</a>
Comment 12 Jenselme 2016-09-04 08:41:53 UTC
Strangely this doesn't happen on line 15.

Full HTML Code:
<!doctype html>
<html ng-app>
    <head>
        <script src="http://code.angularjs.org/1.0.6/angular.min.js"></script>
        <script src="script.js"></script>
    </head>
    <body>
        <div ng-controller="SettingsController">
            <h1>{{name}}</h1>{{lastName}}
            Name: <input type="text" ng-model="name"/>
            [ <a href="" ng-click="greet()">greet</a> ]<br/>
            Contact:
            <ul>
                <li ng-repeat="contact in contacts">
                    <select ng-model="contact.type" class="{{cssColor}}">
                        <option>phone</option>
                        <option>email</option>
                    </select>
                    <input type="text" ng-model="contact.value"/>
                    [ <a href="" ng-click="clearContact(contact)">clear</a>
                    | <a href="" ng-click="removeContact(contact)">X</a> ]
                </li>
                <li>[ <a href="" ng-dblclick="" ng-click="addContact()">add</a> ]</li>
            </ul>
            <div ng-controller="Ctrl">
                {{foo}}
                <div ng-click="print()"></div>
            </div>
        </div>
        <div ng-controller="Ctrl2">
            {{foo}}
        </div>
    </body>
</html>


Full JS Code:
function SettingsController($scope) {
    $scope.name = "John Smith";
    $scope.cssColor = "blue";
    $scope.contacts = [
        {type: 'phone', value: '408 555 1212'},
        {type: 'email', value: 'john.smith@example.org'}];

    $scope.greet = function() {
        alert(this.name);
    };

    $scope.addContact = function() {
        this.contacts.push({type: 'email', value: 'yourname@example.org'});
    };

    $scope.removeContact = function(contactToRemove) {
        var index = this.contacts.indexOf(contactToRemove);
        this.contacts.splice(index, 1);
    };

    $scope.clearContact = function(contact) {
        contact.type = 'phone';
        contact.value = '';
    };
    $scope.foo = 1;
}

function Ctrl($scope) {
    $scope.page = 1;
    $scope.printAttempt = {
        number: 1,
        total: 2
    }
    $scope.print = function() {
    };
}
function Ctrl2($scope) {
    $scope.foo = 1;
}
Comment 13 wissenstein 2016-10-26 14:56:28 UTC
Created attachment 162650 [details]
HTML file, which cannot be edited through IndexOfBoundException

Create a Maven Java Web Application. 
Put file component.html (attached) into the project.
Open file component.html in the editor.
Put cursor into line 182 and press Enter.

ACTUAL RESULT
IndexOfBoundException is thrown.

EXPECTED RESULT
A new line appears in the file and no exception is thrown.
Comment 14 wissenstein 2016-10-26 14:58:17 UTC
(In reply to wissenstein from comment #13)

Product Version = NetBeans IDE Dev (Build 201610260002)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_102
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.102-b14