Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] NPE in getProvisioningJob()

There are two steps to executing an operation: resolution, then provisioning. It looks like you are attempting to provision without first resolving. You need to either first call getResolveJob() and run that job, or use ProfileChangeOperation#resolveModal. After resolving you should be able to provision.

Of course it is a bug in p2 that it throws an NPE here. The javadoc says it should return null if you attempt to get the provisioning job before resolving the operation. I will fix that.

John


On Mon, Jul 22, 2013 at 1:56 PM, Thomas Meyer <thomas@xxxxxxxx> wrote:
Hi,

I get this NPE:

!ENTRY org.eclipse.ui 4 4 2013-07-22 19:37:58.303
!MESSAGE An internal error has occurred.
!STACK 0
java.lang.NullPointerException
        at org.eclipse.equinox.p2.operations.ProfileChangeOperation.getProvisioningJob(ProfileChangeOperation.java:320)
        at org.rssowl.ui.internal.actions.FindUpdatesAction.run(FindUpdatesAction.java:102)
        at org.rssowl.ui.internal.Controller$11.run(Controller.java:1526)
        at org.rssowl.ui.internal.util.JobRunner$1.runInUIThread(JobRunner.java:97)
        at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
        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:3717)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3366)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.rssowl.ui.internal.Application.start(Application.java:119)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

I tried to change the RssOwl update mechanism to use the p2 framework.

The current code does the UpdateJob in FindUpdatesAction:

https://github.com/rssowl/RSSOwl/blob/master/org.rssowl.ui/src/org/rssowl/ui/internal/actions/FindUpdatesAction.java#L95

I tried to replace the update job with this:

      NullProgressMonitor monitor = new NullProgressMonitor();
      Collection<URI> repos = Arrays.asList(new URI(UPDATE_SITE));

      UpdateOperation updateOperation = operationFactory.createUpdateOperation(null, repos, monitor);
      ProvisioningJob job = updateOperation.getProvisioningJob(null);

But this code results in above NPE.

The p2 repository directory seems to be missing in my runtime:

org.eclipse.equinox.p2.core.IAgentLocation=file:/home/thomas/workspace/.metadata/.plugins/org.eclipse.pde.core/Launch%20RSSOwl%202.0/.p2/

$ pwd
/home/thomas/workspace/.metadata/.plugins/org.eclipse.pde.core/Launch RSSOwl 2.0

$ ll -a
insgesamt 32
drwxrwxr-x. 6 thomas thomas 4096 22. Jul 19:34 .
drwxrwxr-x. 9 thomas thomas 4096 22. Jul 19:33 ..
-rw-rw-r--. 1 thomas thomas  698 22. Jul 19:33 config.ini
-rw-rw-r--. 1 thomas thomas  184 22. Jul 19:33 dev.properties
drwxrwxr-x. 3 thomas thomas 4096 22. Jul 19:34 org.eclipse.core.runtime
drwxrwxr-x. 3 thomas thomas 4096 22. Jul 19:34 org.eclipse.equinox.app
drwxrwxr-x. 2 thomas thomas 4096 22. Jul 19:33 org.eclipse.equinox.simpleconfigurator
drwxrwxr-x. 4 thomas thomas 4096 22. Jul 19:34 org.eclipse.osgi

how's creating this directory?
what's missing in my approach?

with kind regards
thomas

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev


Back to the top