Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320124

Summary: ArrayIndexOutOfBoundsException can occur when using bundle command in the console
Product: [Eclipse Project] Equinox Reporter: Alasdair Nottingham <alasdair>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: l.kirchev, tjwatson
Version: unspecified   
Target Milestone: 3.6.1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
patch + test none

Description Alasdair Nottingham CLA 2010-07-16 12:18:29 EDT
Build Identifier: 3.6.0.v20100517

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 3
        at org.eclipse.osgi.internal.resolver.RequiresHolder.determineRequiresVisibility(StateHelperImpl.java:562)
        at org.eclipse.osgi.internal.resolver.RequiresHolder.<init>(StateHelperImpl.java:509)
        at org.eclipse.osgi.internal.resolver.StateHelperImpl.getPackages(StateHelperImpl.java:400)
        at org.eclipse.osgi.internal.resolver.StateHelperImpl.getVisiblePackages(StateHelperImpl.java:343)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._bundle(FrameworkCommandProvider.java:847)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:156)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:141)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:105)
        at java.lang.Thread.run(Thread.java:736)

Reproducible: Sometimes

Steps to Reproduce:
1.Install some bundles into a framework
2.use the bundle command to view them.
3.
Comment 1 Thomas Watson CLA 2010-07-16 12:20:05 EDT
This is caused by the typical i vs. j bug when iterating over two nested for loops.
Comment 2 Thomas Watson CLA 2010-07-16 16:17:14 EDT
For reference, this was introduced by the fix to bug 282966.
Comment 3 Thomas Watson CLA 2010-07-16 17:51:23 EDT
Created attachment 174541 [details]
patch + test

fix + testcase.
Comment 4 Thomas Watson CLA 2010-07-16 17:57:25 EDT
Fixed for 3.6.1 and HEAD.