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 123679 - ArrayIndexOutOfBoundsException: 1
Summary: ArrayIndexOutOfBoundsException: 1
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Lookup (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jaroslav Tulach
URL: http://statistics.netbeans.org/except...
Keywords:
: 119292 122378 123562 124405 126929 127265 127955 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-08 12:45 UTC by chrislundin
Modified: 2009-08-18 07:49 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 10323


Attachments
stacktrace (3.18 KB, text/plain)
2007-12-08 12:45 UTC, chrislundin
Details
stacktrace (3.09 KB, text/plain)
2007-12-10 15:07 UTC, Jiri Skrivanek
Details
stacktrace (3.09 KB, text/plain)
2007-12-11 12:20 UTC, ehsavoie
Details
stacktrace (3.00 KB, text/plain)
2008-01-04 10:44 UTC, Max Sauer
Details
java.lang.ArrayIndexOutOfBoundsException: 1 (10.54 KB, text/plain)
2008-01-21 11:22 UTC, Martin Schovanek
Details
stacktrace (3.09 KB, text/plain)
2008-01-23 14:55 UTC, Jan Lahoda
Details
stacktrace (3.09 KB, text/plain)
2008-01-24 09:35 UTC, Lukas Hasik
Details
stacktrace (3.09 KB, text/plain)
2008-01-26 01:42 UTC, _ krystyna
Details
stacktrace (3.26 KB, text/plain)
2008-02-04 15:11 UTC, novakm
Details
stacktrace (3.09 KB, text/plain)
2008-02-06 07:05 UTC, Jan Lahoda
Details
ide log (85.12 KB, text/plain)
2008-02-07 07:21 UTC, unr303
Details
stacktrace (6.42 KB, text/plain)
2008-02-13 11:32 UTC, Martin Schovanek
Details
stacktrace (6.42 KB, text/plain)
2008-02-15 01:09 UTC, pzajac
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chrislundin 2007-12-08 12:45:54 UTC
Build: NetBeans IDE 6.0 (Build 200711261600)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Windows XP, 5.1, x86

User Comments:
Comment 1 chrislundin 2007-12-08 12:45:58 UTC
Created attachment 54026 [details]
stacktrace
Comment 2 Jiri Skrivanek 2007-12-10 15:06:54 UTC
Build: NetBeans IDE Dev (Build 200712100000)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows XP, 5.1, x86

User Comments: 
It happens very often in automated tests since build 200712071200. I am able to reproduce it manually but not always:

- start with empty userdir
- create a new java project
- create a new package
- copy Main.java
- Paste|Copy Refactor into newly created package
- open it in editor
- close all files in editor file by file starting at left. When everything is closed the Navigator shows nothing and it has title "null - Navigator".
- focus Projects view or Files view and exception is thrown
Comment 3 Jiri Skrivanek 2007-12-10 15:07:00 UTC
Created attachment 54094 [details]
stacktrace
Comment 4 ehsavoie 2007-12-11 12:20:23 UTC
Build: NetBeans IDE Dev (Build 200712091200)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Linux, 2.6.22-14-386, i386

User Comments: 
Comment 5 ehsavoie 2007-12-11 12:20:27 UTC
Created attachment 54139 [details]
stacktrace
Comment 6 Exceptions Reporter 2008-01-04 10:39:49 UTC
THIS ISSUE HAS 5 MORE DUPLICATES
Comment 7 Max Sauer 2008-01-04 10:44:01 UTC
Build: NetBeans IDE Dev (Build 080104)
VM: Java HotSpot(TM) Client VM, 1.5.0_14-b03
OS: Linux, 2.6.20-16-generic, i386

User Comments: 
I just invoked 'close all documents' from context menu od an editor tab.
Comment 8 Max Sauer 2008-01-04 10:44:09 UTC
Created attachment 54682 [details]
stacktrace
Comment 9 Martin Schovanek 2008-01-08 09:45:54 UTC
Web automated tests randomly failing due this issue, increasing priority to P2.
Comment 10 Exceptions Reporter 2008-01-13 20:27:45 UTC
THIS ISSUE HAS 5 MORE DUPLICATES
Comment 11 Jaroslav Tulach 2008-01-14 13:10:29 UTC
*** Issue 119292 has been marked as a duplicate of this issue. ***
Comment 12 Jaroslav Tulach 2008-01-15 14:30:49 UTC
*** Issue 122378 has been marked as a duplicate of this issue. ***
Comment 13 Jaroslav Tulach 2008-01-16 08:29:53 UTC
I have simulated the problem:

# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: openide/util/test/unit/src/org/openide/util/lookup/ProxyLookupTest.java
--- openide/util/test/unit/src/org/openide/util/lookup/ProxyLookupTest.java Base (1.10)
+++ openide/util/test/unit/src/org/openide/util/lookup/ProxyLookupTest.java Locally Modified (Based On 1.10)
@@ -488,4 +487,47 @@
         
         assertEquals("C is overriden from removeLookupListener", Collections.emptyList(), res.allInstances());
     }
+    
+    
+    public void testArrayIndexWithSetLookupAsInIssue123679() throws Exception {
+        final ProxyLookup pl = new ProxyLookup();
+        final int[] cnt = { 0 };
+        
+        class L extends Lookup {
+            L[] set;
+            Lookup l;
+            Collection<? extends Serializable> res;
+            
+            public L(String s) {
+                l = Lookups.singleton(s);
 }
+            
+            @Override
+            public <T> T lookup(Class<T> clazz) {
+                return l.lookup(clazz);
+            }
+
+            @Override
+            public <T> Result<T> lookup(Template<T> template) {
+                cnt[0]++;
+                if (set != null) {
+                    pl.setLookups(set);
+                    res = pl.lookupAll(Serializable.class);
+                }
+                Result<T> r = l.lookup(template);
+                return r;
+            }
+        }
+
+        L[] now = { new L("A"), new L("B") };
+        L[] old = { new L("C") };
+        pl.setLookups(old);
+        old[0].set = now;
+        
+        Result<String> res = pl.lookupResult(String.class);
+        assertEquals("Old items visible", 1, res.allItems().size());
+        
+        
+        pl.setLookups(new L("X"), new L("Y"), new L("Z"));
+    }
+}
Comment 14 Jaroslav Tulach 2008-01-16 08:46:37 UTC
#123679: Make setLookups really reentrant


IDE:-------------------------------------------------
IDE: [16.1.08 9:46] Committing started
Checking in test/unit/src/org/openide/util/lookup/ProxyLookupTest.java;
/shared/data/ccvs/repository/openide/util/test/unit/src/org/openide/util/lookup/ProxyLookupTest.java,v  <--  
ProxyLookupTest.java
new revision: 1.11; previous revision: 1.10
done
Checking in src/org/openide/util/lookup/ProxyLookup.java;
/shared/data/ccvs/repository/openide/util/src/org/openide/util/lookup/ProxyLookup.java,v  <--  ProxyLookup.java
new revision: 1.18; previous revision: 1.17
done
IDE: [16.1.08 9:46] Committing finished
Comment 15 Jiri Skrivanek 2008-01-18 09:28:47 UTC
Verified.
Comment 16 Martin Schovanek 2008-01-21 11:20:59 UTC
Still reproducible by automated tests, see attachment.
Comment 17 Martin Schovanek 2008-01-21 11:22:09 UTC
Created attachment 55307 [details]
java.lang.ArrayIndexOutOfBoundsException: 1
Comment 18 Jan Lahoda 2008-01-23 14:55:42 UTC
Build: NetBeans IDE Dev (Build 080120)
VM: Java HotSpot(TM) Client VM, 1.6.0_05-ea-b04
OS: Linux, 2.6.20-16-generic, i386

User Comments: 
Comment 19 Jan Lahoda 2008-01-23 14:55:48 UTC
Created attachment 55435 [details]
stacktrace
Comment 20 Lukas Hasik 2008-01-24 09:35:09 UTC
Build: NetBeans IDE Dev (Build 200801222102)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows XP, 5.1, x86

User Comments: 
-opened old mobility projects in 6.1M1
-the exception appeared when the IDE were compiling the opened project (on background)
Comment 21 Lukas Hasik 2008-01-24 09:35:13 UTC
Created attachment 55478 [details]
stacktrace
Comment 22 _ krystyna 2008-01-26 01:42:17 UTC
Build: NetBeans IDE Dev (Build 20080125171737)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows XP, 5.1, x86

User Comments: 
-closing VW project
Comment 23 _ krystyna 2008-01-26 01:42:20 UTC
Created attachment 55598 [details]
stacktrace
Comment 24 unr303 2008-01-30 12:28:51 UTC
Walking by class methods by clicking them in navigator window and got this exception.
Comment 25 unr303 2008-01-30 12:30:32 UTC
  Product Version         = NetBeans IDE Dev (Build 200801290002)
  Operating System        = Windows XP version 5.1 running on x86
SEVERE [global]
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.openide.util.lookup.ProxyLookup$R.lookupChange(ProxyLookup.java:407)
	at org.openide.util.lookup.ProxyLookup.setLookups(ProxyLookup.java:187)
Comment 26 novakm 2008-02-04 15:11:15 UTC
Build: NetBeans IDE Dev (Build 200802040003)
VM: Java HotSpot(TM) Client VM, 10.0-b19
OS: Windows Vista, 6.0, x86

User Comments: 
I accidentaly dragged and dropped a tab with diff of one project so it wasn't on the tabpane as other opened files. To fix this I closed it and then invoked Diff from Mercurial View. After that, the exception was thrown.
Comment 27 novakm 2008-02-04 15:11:24 UTC
Created attachment 55996 [details]
stacktrace
Comment 28 Exceptions Reporter 2008-02-05 16:04:25 UTC
THIS ISSUE HAS ALREADY 100 DUPLICATES
Comment 29 Jan Lahoda 2008-02-06 07:05:39 UTC
Build: NetBeans IDE Dev (Build 20080205131109)
VM: Java HotSpot(TM) Client VM, 1.6.0_05-ea-b04
OS: Linux, 2.6.20-16-generic, i386

User Comments: 
Comment 30 Jan Lahoda 2008-02-06 07:05:49 UTC
Created attachment 56131 [details]
stacktrace
Comment 31 unr303 2008-02-07 07:21:20 UTC
Created attachment 56213 [details]
ide log
Comment 32 Jaroslav Tulach 2008-02-07 08:59:30 UTC
http://hg.netbeans.org/main/rev/373b81870403
Comment 33 Jaroslav Tulach 2008-02-07 09:00:42 UTC
*** Issue 123562 has been marked as a duplicate of this issue. ***
Comment 34 Lukas Hasik 2008-02-11 15:25:20 UTC
Reopening because reproduced.
Steps: have a project with looot of java files. The AIOOBE appears when selecting lot of the files in projects view with
SHIFT + arrow key

Product Version: NetBeans IDE Dev (Build 200802110004)
Java: 1.6.0_03-ea; Java HotSpot(TM) Client VM 1.6.0_03-ea-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

SEVERE [global]
java.lang.ArrayIndexOutOfBoundsException: 15
        at org.openide.util.lookup.ProxyLookup$R.lookupChange(ProxyLookup.java:416)
        at org.openide.util.lookup.ProxyLookup.setLookups(ProxyLookup.java:189)
        at
org.netbeans.modules.project.ui.actions.LookupSensitiveAction$LastActivatedWindowLookup.updateLookups(LookupSensitiveAction.java:218)
        at
org.netbeans.modules.project.ui.actions.LookupSensitiveAction$LastActivatedWindowLookup.propertyChange(LookupSensitiveAction.java:223)
Comment 35 Lukas Hasik 2008-02-11 15:25:51 UTC
*** Issue 126929 has been marked as a duplicate of this issue. ***
Comment 36 Exceptions Reporter 2008-02-13 01:36:25 UTC
THIS ISSUE HAS ALREADY 100 DUPLICATES
Comment 37 Martin Schovanek 2008-02-13 11:32:02 UTC
Build: NetBeans IDE Dev (Build 200802120006)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-121
OS: Mac OS X, 10.4.11, i386

User Comments: 
Browsing .java source in Navigator view
Comment 38 Martin Schovanek 2008-02-13 11:32:08 UTC
Created attachment 56588 [details]
stacktrace
Comment 39 Jaroslav Tulach 2008-02-14 12:33:56 UTC
*** Issue 127265 has been marked as a duplicate of this issue. ***
Comment 40 pzajac 2008-02-15 01:09:15 UTC
Build: NetBeans IDE Dev (Build 20080214091453)
VM: Java HotSpot(TM) Client VM, 1.5.0_12-b04
OS: Linux, 2.6.20-16-generic, i386

User Comments: 
Comment 41 pzajac 2008-02-15 01:09:23 UTC
Created attachment 56705 [details]
stacktrace
Comment 42 Jaroslav Tulach 2008-02-19 07:07:11 UTC
648ccb6d7e7d

ProxyLookup was rewritten quite a lot. It uses immutable internal data structures. This issue shall be eliminated.
Comment 43 Jaroslav Tulach 2008-02-21 22:27:54 UTC
*** Issue 127955 has been marked as a duplicate of this issue. ***
Comment 44 Jiri Skrivanek 2008-02-28 11:11:01 UTC
Seems to be fixed.
Comment 45 jinb 2008-03-05 19:42:52 UTC
backported into release601_fixes

/cvs/openide/util/src/org/openide/util/lookup/Attic/ProxyLookup.java,v  <--  ProxyLookup.java
new revision: 1.17.10.1; previous revision: 1.17
done
/cvs/openide/util/test/unit/src/org/openide/util/lookup/Attic/ProxyLookupTest.java,v  <--  ProxyLookupTest.java
new revision: 1.10.10.1; previous revision: 1.10
done
/cvs/openide/util/test/unit/src/org/openide/util/lookup/Attic/SimpleProxyLookupIssue42244Test.java,v  <-- 
SimpleProxyLookupIssue42244Test.java
new revision: 1.3.16.1; previous revision: 1.3
done
Comment 46 jiai 2008-03-08 21:17:09 UTC
When are these release601_fixes released?
Comment 47 Karthikeyan Rajeswaran 2008-03-08 21:22:54 UTC
http://wiki.netbeans.org/NetBeans601Patch2Plan
Planned release date: Mar 21 2008
Comment 48 Jaroslav Tulach 2008-03-10 16:06:19 UTC
*** Issue 124405 has been marked as a duplicate of this issue. ***
Comment 49 jinb 2008-03-11 15:21:00 UTC
Removing release601_fixes_candidate2/ release601_fixes_fixed status whiteboard values. The fix cannot be ported to the
fixes branch, since it cannot be made available on the update center.
Rolled back the changes in release601_fixes branch:

Checking in src/org/openide/util/lookup/ProxyLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/Attic/ProxyLookup.java,v  <--  ProxyLookup.java
new revision: 1.17.10.2; previous revision: 1.17.10.1
done
Checking in test/unit/src/org/openide/util/lookup/ProxyLookupTest.java;
/cvs/openide/util/test/unit/src/org/openide/util/lookup/Attic/ProxyLookupTest.java,v  <--  ProxyLookupTest.java
new revision: 1.10.10.2; previous revision: 1.10.10.1
done
Checking in test/unit/src/org/openide/util/lookup/SimpleProxyLookupIssue42244Test.java;
/cvs/openide/util/test/unit/src/org/openide/util/lookup/Attic/SimpleProxyLookupIssue42244Test.java,v  <-- 
SimpleProxyLookupIssue42244Test.java
new revision: 1.3.16.2; previous revision: 1.3.16.1
done