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

Bug 311387

Summary: [legacy] IBundleGroup.getBundles() returns no installed bundles, throwing an IOException on parse
Product: [Eclipse Project] Equinox Reporter: Joel Cayne <jcayne>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: kathy, pascal, paulslau, woskimi
Version: 3.5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 242621    

Description Joel Cayne CLA 2010-05-03 11:45:08 EDT
In follow-up to https://bugs.eclipse.org/bugs/show_bug.cgi?id=236709#c17, I tried to obtain the bundles for an installed feature in a shared install but no bundles are returned.

I added some debug messages to org.eclipse.update.internal.configurator.FullFeatureParser.parse() and it appears to be throwing an IOException:
java.io.FileNotFoundException: C:\p2installer\eclipse\features\org.eclipse.sdk_3.5.2.R35x_v20100119-7Q7bARBPWUHM_CSjz-8bF1f7_n8rLSyWHoiKoyxBQSGT4\feature.xml (The system cannot find the path specified). I believe it instead should be looking in .p2\org.eclipse.equinox.p2.touchpoint.eclipse/features.

Steps to reproduce:
1. Download and extract the Eclipse 3.5.2 p2 installer to
C:\p2installer\eclipse. Add org.eclipse.update.install.features=true to the installer.properties. Optionally, change the installer.properties to point to the Galileo update site.
2. Run p2installer.exe, selecting shared install and setting the install directory to C:\p2installer\eclipse. Install the Eclipse SDK.
3. Create a Sample Hello World plug-in with a UI. In the action put in the call to get the BundleGroupProviders and Bundles.
4. Create a feature to contain the sample plug-in and export the deployable feature with a metadata repository. Install the feature into the shared installation and restart Eclipse.
5. Using the Hello World button, run the action. The BundleGroupProviders will have a size, while the Bundles will be of size 0 and an IOException is thrown but not logged. Launching an Eclipse Run Configuration using the Shared install will correctly show the Bundles with entries.


Sample code used in the plug-in action:
IBundleGroupProvider providers[] = Platform.getBundleGroupProviders();
for (int i = 0; i < providers.length; i++) {
    IBundleGroupProvider provider = providers[i];
    IBundleGroup groups[] = provider.getBundleGroups();
    Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "Provider, " + provider.getName() + " has a group size of " + groups.length));

    for (int j = 0; j < groups.length; j++) {
        IBundleGroup group = groups[j];
        Bundle bundles[] = group.getBundles();
        Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "The group " + group.getName() + " has a bundle size of " + bundles.length));
        for (int k = 0; k < bundles.length; k++) {
            Bundle bundle = bundles[k];
            Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, bundle.getSymbolicName()));
        }
    }
}
Comment 1 Paul Slauenwhite CLA 2010-05-03 11:48:54 EDT
This is a critical issue for TPTP 4.7.0 (and our consuming products).
Comment 2 John Arthorne CLA 2010-05-03 12:50:45 EDT
Ah, I understand the problem. You are installing using the p2 bundle pooling concept which combines the bundles/features from multiple installations together in the same directory. This layout of bundles and features is completely unknown to legacy update manager so it will never be able to find the features. Even if it did find the features, it would return the wrong answer because it doesn't know which features belong to the profile that is running. I think the best solution for this is to address bug 236709 - have p2 provide the bundle groups since it understands the layout of p2 metadata.

You will notice on the Equinox download page that the p2 installer is listed as "early access". This is because the installer is not under active development, and the bundle pooling approach used by the installer is completely untested. What is TPTP using the installer for?
Comment 3 Joel Cayne CLA 2010-05-03 13:29:19 EDT
TPTP does not use the installer but this setup was reported in bug 242621. This scenario seemed to closely match the case discovered in bug 306703 which was requested by a consuming product.
Comment 4 Joel Cayne CLA 2010-05-14 11:50:51 EDT
(In reply to comment #2)
> I think the best solution for this is to address bug 236709 - have p2
> provide the bundle groups since it understands the layout of p2 metadata.
> 

John, would you be able to suggest how we can access these bundle groups using p2?

Thanks.
Comment 5 Paul Slauenwhite CLA 2010-06-23 14:15:30 EDT
(In reply to comment #1)
> This is a critical issue for TPTP 4.7.0 (and our consuming products).

Note, this is no longer a critical issue for TPTP 4.7.0 (and our consuming products) since the root cause of our symptom was Equinox defect https://bugs.eclipse.org/bugs/show_bug.cgi?id=316650.
Comment 6 John Arthorne CLA 2010-06-23 16:03:58 EDT

*** This bug has been marked as a duplicate of bug 316650 ***
Comment 7 Joel Cayne CLA 2010-11-17 12:25:08 EST
*** Bug 325723 has been marked as a duplicate of this bug. ***
Comment 8 Joel Cayne CLA 2010-11-25 14:14:08 EST
Re-opening since the same behavior still exists as seen through bug 325723 comment 12.
Comment 9 Joel Cayne CLA 2010-11-25 14:17:58 EST
*** Bug 325723 has been marked as a duplicate of this bug. ***