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 242867 - IndexOutOfBoundsException: Index: 11, Size: 8
Summary: IndexOutOfBoundsException: Index: 11, Size: 8
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-13 14:22 UTC by Jiri Kovalsky
Modified: 2014-09-15 11:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 151188


Attachments
stacktrace (4.21 KB, text/plain)
2014-03-13 14:22 UTC, Jiri Kovalsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2014-03-13 14:22:28 UTC
Build: NetBeans IDE 8.0 (Build 201403101706)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.0-b70, Java(TM) SE Runtime Environment, 1.8.0-b132
OS: Linux

User Comments:
jkovalsky: I had JUnitSampleProjectMaven testing project opened with tests generated for whole teststorun package initially with JUnit 3.* library. All tests were run, then I changed CalculatorTest.testDivide() test and wanted to debug it. IDE suggested to update JUnit library to 4.* and update pom.xml automatically. I agreed and replaced the library. Then I tried to debug that testDivide() method when this error probably occurred.

GUEST: Called create unit tests while having some errors in test files

EduardKarelEtc: attempting to create junit test for a package.

GUEST: Auto-creation (<Ctrl>+<U>) of a Test Class for a Java class.

GUEST: 1. Start the computer
2. Start Netbean
3. Click on an old java file in the editor.
4. Go to tools and create test.

GUEST: .

tboudreau: Pasted the inner class below into an empty unit test:

public class ValidationUITest {

    private class UI implements ValidationUI {

        Problem p;
        boolean cleared;

        public void assertCleared() {
            boolean old = cleared;
            cleared = false;
            assertTrue(old);
        }

        public void assertNotCleared() {
            assertFalse(cleared);
        }

        public void assertProblem(String msg) {
            assertNotNull(p);
            assertEquals(msg, p.getMessage());
            cleared = false;
        }

        public void clearProblem() {
            cleared = true;
            p = null;
        }

        public void setProblem(Problem problem) {
            p = problem;
        }

        public void assertNotProblem() {
            assertNull(p);
        }
    }
}




Stacktrace: 
java.lang.IndexOutOfBoundsException: Index: 11, Size: 8
   at com.sun.tools.javac.util.List.get(List.java:475)
   at org.netbeans.modules.junit.AbstractTestGenerator.findAbstractClassImplName(AbstractTestGenerator.java:1917)
   at org.netbeans.modules.junit.AbstractTestGenerator.generateMissingTestMethods(AbstractTestGenerator.java:976)
   at org.netbeans.modules.junit.AbstractTestGenerator.createOrUpdateTestClass(AbstractTestGenerator.java:354)
   at org.netbeans.modules.junit.AbstractTestGenerator.run(AbstractTestGenerator.java:282)
   at org.netbeans.modules.junit.AbstractTestGenerator.run(AbstractTestGenerator.java:119)
Comment 1 Jiri Kovalsky 2014-03-13 14:22:33 UTC
Created attachment 145995 [details]
stacktrace
Comment 2 Theofanis Oikonomou 2014-07-17 14:50:35 UTC
Changeset: 67e20af47f22
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2014-07-17 16:53
Message:
Comment 3 Quality Engineering 2014-07-19 10:19:11 UTC
Integrated into 'main-silver', will be available in build *201407190718* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/67e20af47f22
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #242867 - IndexOutOfBoundsException: Index: 11, Size: 8
Comment 4 Jiri Kovalsky 2014-09-15 11:47:02 UTC
Product Version: NetBeans IDE Dev (Build 201408210001)
Updates: Updates available
Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26
System: Linux version 3.13.0-24-generic running on amd64; UTF-8; en_US (nb)
User directory: /home/cesilko/.netbeans/dev
Cache directory: /home/cesilko/.cache/netbeans/dev

Works fine now i.e. didn't encounter the same exception when trying scenarios mentioned in this issue.