| Summary: | NPE in core when exiting | ||
|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Miles Parker <milesparker> |
| Component: | UI | Assignee: | PDE-UI-Inbox <pde-ui-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | curtis.windatt.public, Michael_Rennie |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
*** This bug has been marked as a duplicate of bug 353815 *** |
This is probably a bit of an edge case, but I'm getting an NPE when I exit out of a hosted runtime. I'm probably missing something from the set of plugins that PDE is expecting to have available, but I don't have any missing dependencies. This is the exception I'm seeing: java.lang.NullPointerException at org.eclipse.pde.internal.core.target.P2TargetUtils.getAgent(P2TargetUtils.java:300) at org.eclipse.pde.internal.core.target.P2TargetUtils.getProfileRegistry(P2TargetUtils.java:775) at org.eclipse.pde.internal.core.target.P2TargetUtils.cleanOrphanedTargetDefinitionProfiles(P2TargetUtils.java:159) at org.eclipse.pde.internal.core.PDECore$1.saving(PDECore.java:258) at org.eclipse.core.internal.resources.SaveManager.executeLifecycle(SaveManager.java:382) at org.eclipse.core.internal.resources.SaveManager$1.run(SaveManager.java:191) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.resources.SaveManager.broadcastLifecycle(SaveManager.java:194) at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1129) at org.eclipse.core.internal.resources.Workspace.save(Workspace.java:2375) at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor$5.run(IDEWorkbenchAdvisor.java:508) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Looking at the code, it it assuming that there is in fact a provider available. Perhaps it should be throwing another exception in this case? public static IProvisioningAgent getAgent() throws CoreException { //Is there already an agent for this location? String filter = "(locationURI=" + String.valueOf(AGENT_LOCATION) + ")"; //$NON-NLS-1$//$NON-NLS-2$ ServiceReference[] serviceReferences = null; BundleContext context = PDECore.getDefault().getBundleContext(); try { serviceReferences = context.getServiceReferences(IProvisioningAgent.SERVICE_NAME, filter); if (serviceReferences != null) { return (IProvisioningAgent) context.getService(serviceReferences[0]); } } catch (InvalidSyntaxException e) { // ignore } finally { if (serviceReferences != null) context.ungetService(serviceReferences[0]); } IProvisioningAgentProvider provider = (IProvisioningAgentProvider) PDECore.getDefault().acquireService(IProvisioningAgentProvider.SERVICE_NAME); try { IProvisioningAgent agent = provider.createAgent(AGENT_LOCATION); // turn off the garbage collector for the PDE agent. GC is managed on a coarser grain GarbageCollector garbageCollector = (GarbageCollector) agent.getService(GarbageCollector.class.getName()); if (garbageCollector != null) { garbageCollector.stop(); } return agent; } catch (ProvisionException e) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.IUBundleContainer_7, e)); } }