Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365731 - [aggregator] NPE when adding a bundle
Summary: [aggregator] NPE when adding a bundle
Status: RESOLVED FIXED
Alias: None
Product: CBI
Classification: Technology
Component: CBI p2 Repository Aggregator (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-06 09:00 EST by Boris Naguet CLA
Modified: 2016-09-16 15:59 EDT (History)
3 users (show)

See Also:


Attachments
Example with FindBugs plugin (871 bytes, text/plain)
2011-12-06 09:00 EST, Boris Naguet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Naguet CLA 2011-12-06 09:00:55 EST
Created attachment 207987 [details]
Example with FindBugs plugin

When I tryed to add some bundles to a P2 Mapped Repository, I encountered a NPE.
I realized that it happened only when the bundle had not a defined name when seen in the "Repository Browser".
 Although these Bundles have defined a Bundle-Name, in the MANIFEST.MF, they don't have the property org.eclipse.equinox.p2.name set in the aggregator (that's the only difference I've seen but I might be wrong).



Stacktrace:

java.lang.NullPointerException
	at org.eclipse.b3.aggregator.provider.InstallableUnitRequestItemProvider.appendIUText(InstallableUnitRequestItemProvider.java:196)
	at org.eclipse.b3.aggregator.provider.BundleItemProvider.getText(BundleItemProvider.java:109)
	at org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider.getText(AdapterFactoryLabelProvider.java:380)
	at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getText(WrappedViewerLabelProvider.java:108)
	at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:164)
	at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:152)
	at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:938)
	at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:106)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1018)
	at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:485)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2167)
	at org.eclipse.jface.viewers.AbstractTreeViewer.updateChildren(AbstractTreeViewer.java:2725)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(AbstractTreeViewer.java:1908)
	at org.eclipse.jface.viewers.TreeViewer.internalRefreshStruct(TreeViewer.java:721)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1883)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1840)
	at org.eclipse.jface.viewers.StructuredViewer$8.run(StructuredViewer.java:1535)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1443)
	at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:403)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1404)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1533)
	at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:548)
	at org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider$ViewerRefresh.refresh(AdapterFactoryContentProvider.java:495)
	at org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider$ViewerRefresh.run(AdapterFactoryContentProvider.java:463)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at ...
Comment 1 Boris Naguet CLA 2011-12-06 09:02:27 EST
I have the same issue with bundles from:
http://javadude.googlecode.com/svn/trunk/com.javadude.updatesite
Comment 2 Boris Naguet CLA 2011-12-06 09:10:46 EST
If I close and reopen, it seems that the bundle is kept, and if I don't open the corresponding Contribution node, I don't have the NPE.
 So I tried to generate:
* I had this warning:
Unable to resolve partial IU. Artifact file for org.eclipse.b3.p2.impl.ArtifactKeyImpl@2b968e76 (classifier: osgi.bundle, id: edu.umd.cs.findbugs.plugin.eclipse, version: 1.3.9.20090821) did not contain a bundle manifest
* Then the aggregation goes on (I have Mirror=true on the repo), the feature is copied but not the problematic bundle

As you can see here, the plugin HAS a bundle manifest:
http://findbugs.cs.umd.edu/eclipse/plugins/edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821.jar
Comment 3 Boris Naguet CLA 2011-12-06 09:27:56 EST
And here is another issue with the same repository:
- I set Mirror=false
- I removed the defined IU to mirror "as is"
- When I build metadata, I have the same warning:
<<Unable to resolve partial IU. Artifact file for org.eclipse.b3.p2.impl.ArtifactKeyImpl@2b968e76 (classifier: osgi.bundle, id: edu.umd.cs.findbugs.plugin.eclipse, version: 1.3.9.20090821) did not contain a bundle manifest>>

- When I try to install from it, it fails with:
Installable unit contains no artifacts: [R]edu.umd.cs.findbugs.plugin.eclipse 1.3.9.20090821.
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Install, operand=null --> [R]edu.umd.cs.findbugs.plugin.eclipse 1.3.9.20090821, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallBundleAction).

and just before:
Error parsing metadata repository
Error in file:/D:/buildTest/final/aggregate/content.jar at line 63, column 62: Missing required attribute in "property": value
Comment 4 David Williams CLA 2011-12-21 12:10:51 EST
I've only skim read this bug report, and in addition could be completely wrong in what I am about to say ... but, in the slim chance it helps .... 

I have seen that "Unable to resolve partial IU" message before, then a p2 repository happened to have a site.xml file at the repository site. Could that be a possibility here? site.xml files are not normally processed by p2 (it preferring the content.jar/xml file instead), but, they will be if p2 "thinks" the site is actually an old update manager site (i.e. this would happen if something goes wrong while it tries to fetch the content.jar/xml file). The handling of update manager sites was an attempt to provide a "transition", but not sure its ever worked real well or been well tested. 

So, if there is a site.xml file there, and its not really trying to be an old update manager site, it should be removed (or, renamed to something like site.xml.ORIG) ... plus, if the aggregator has already tried to fetch it, you'll have to shut down that Eclipse instance, and restart it, to make sure local caches are cleared. 

Again ... I could be pretty far off base, but my I've seen this recently with an old WTP "capabilities repo" and issue went away when I renamed the site.xml file and restarted Eclipse ... so, it might just be "superstitious behavior" on my part ... but thought I'd mention it, since you marked it "critical" figured you might want to try a way around the problem? [Not to mention, this assumes you "own" the repo and can rename the site.xml file ... if you do not own it, that'd invalidate my suggestion, but it'd still be interesting to know. And, of course, if it really is a traditional update manager repository on purpose, then that'd be a whole other category which would completely invalidate my suggested work around :) ]

Just trying to give some tiny bit of help.
Comment 5 Boris Naguet CLA 2011-12-27 04:37:54 EST
   Hi,
I don't have a good knowledge about the "old" repository structure with site.xml, but 
- the 2 update sites I try to aggregate contains a site.xml:
http://findbugs.cs.umd.edu/eclipse/site.xml
http://javadude.googlecode.com/svn/trunk/com.javadude.updatesite/site.xml

- They're not my update site but external sites (though it's still possible to send them an e-mail).

Regards
Comment 6 Thomas Hallgren CLA 2011-12-27 04:46:03 EST
This happens with plug-ins that don't have a name. The name isn't mandatory so the lacking check for null is indeed motivated and has been added now. The fix is in commot http://git.eclipse.org/c/b3/b3.git/commit/?id=14d69e52684020b8d6d29df6b077426d78412edc
Comment 7 David Williams CLA 2016-09-16 15:59:12 EDT
[Bookkeeping change only. Moving bugs to the new "home" of aggregator, CBI.
No change to assignee for resolved and verified bugs.]