Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313484 - NullPointerException in ProvCommandProvider (p2.console) when profile doesn't exist
Summary: NullPointerException in ProvCommandProvider (p2.console) when profile doesn't...
Status: CLOSED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-19 04:54 EDT by Katya Stoycheva CLA
Modified: 2010-11-02 17:31 EDT (History)
1 user (show)

See Also:


Attachments
ProvCommandProvider adapted to show meaningful message when profile is missing instead of throwing NPE (5.19 KB, patch)
2010-05-19 04:57 EDT, Katya Stoycheva CLA
pascal: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Katya Stoycheva CLA 2010-05-19 04:54:52 EDT
Build Identifier: N20100512-2000

When trying to install a bundle via prov command (ProvCommandProvider), NullPointerException is produced. The reason is lack of registered profiles but the command expects at least 1 profile. When there's no profile, command returns null for IStatus. This seems unexpected by ProvCommandProvider - it shows to the end user the exception instead of some meaningful message what went wrong.

Here is the code that causes the exception:
...
IStatus s = ProvisioningHelper.install(agent, iu, version, ProvisioningHelper.getProfile(agent, profileId), new NullProgressMonitor());
...
if (s.isOK())
...

Reproducible: Always

Steps to Reproduce:
1.Download and unzip Equinox (http://download.eclipse.org/equinox/drops/N20100512-2000/index.php)
2.Start it in root folder (equinox) using 
java -jar plugins/org.eclipse.osgi_3.6.0.N20100512-2000.jar -configuration configuration –console
3.Setup dropins folder in config.ini:
org.eclipse.equinox.p2.reconciler.dropins.directory=dropins
4.Describe all plugins (and start them) in 
Equinox/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
5.Execute the command
provinstall abc 123
6. Observe the exception:
osgi> provinstall com.ibm.icu.source_4.0.1.v20090822 4.0.1
java.lang.NullPointerException
at org.eclipse.equinox.internal.p2.console.ProvCommandProvider._provinstall(ProvCommandProvider.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
at java.lang.Thread.run(Unknown Source)
Comment 1 Katya Stoycheva CLA 2010-05-19 04:57:13 EDT
Created attachment 169069 [details]
ProvCommandProvider adapted to show meaningful message when profile is missing instead of throwing NPE
Comment 2 Pascal Rapicault CLA 2010-11-02 17:31:05 EDT
Patch released in HEAD for build toward 3.7 M4