Resolution problems with Indigo: NPE in EclipsePlatformReaderType.getBestPlugin [message #903047] |
Tue, 21 August 2012 14:06  |
Eclipse User |
|
|
|
I've managed to do a few buckminster builds but I'm getting an error that puzzles me:
!ENTRY org.eclipse.core.jobs 4 2 2012-08-21 10:32:48.862
!MESSAGE An internal error occurred during: "getting resolutions".
!STACK 0
java.lang.NullPointerException
at org.eclipse.buckminster.pde.internal.EclipsePlatformReaderType.getBestPlugin(EclipsePlatformReaderType.java:85)
at org.eclipse.buckminster.pde.internal.EclipsePlatformReader.getBestPlugin(EclipsePlatformReader.java:310)
at org.eclipse.buckminster.pde.internal.EclipsePlatformReader.getPluginModelBase(EclipsePlatformReader.java:165)
at org.eclipse.buckminster.pde.cspecgen.bundle.BundleBuilder.parsePluginModelBase(BundleBuilder.java:119)
at org.eclipse.buckminster.pde.cspecgen.bundle.BundleBuilder.parseFile(BundleBuilder.java:269)
at org.eclipse.buckminster.pde.cspecgen.PDEBuilder.build(PDEBuilder.java:70)
at org.eclipse.buckminster.core.resolver.LocalResolver.localResolve(LocalResolver.java:339)
at org.eclipse.buckminster.core.metadata.WorkspaceInfo.resolveLocal(WorkspaceInfo.java:610)
at org.eclipse.buckminster.core.metadata.WorkspaceInfo.getResolution(WorkspaceInfo.java:465)
at org.eclipse.buckminster.core.metadata.WorkspaceInfo.getResolution(WorkspaceInfo.java:412)
at org.eclipse.buckminster.core.metadata.WorkspaceInfo.getAllResolutions(WorkspaceInfo.java:186)
at org.eclipse.buckminster.ui.providers.ResolutionsTreeContentProvider$AllResolutionsNode.createNode(ResolutionsTreeContentProvider.java:52)
at org.eclipse.buckminster.generic.model.tree.PendingTreeDataNode$1.run(PendingTreeDataNode.java:52)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
I have taken a look at the source code (Buckminster indigo branch from git) and noticed the following:
public static IPluginModelBase getBestPlugin(String componentName, VersionRange versionDesignator, NodeQuery query) {
IPluginModelBase candidate = null;
Version candidateVersion = null;
synchronized (activeMap) {
if (activeMap.isEmpty()) {
for (IPluginModelBase model : PluginRegistry.getAllModels()) {
BundleDescription desc = model.getBundleDescription();
String id = desc.getSymbolicName(); // line 85
IPluginModelBase[] mbArr = activeMap.get(id);
if (mbArr == null)
mbArr = new IPluginModelBase[] { model };
else {
IPluginModelBase[] newArr = new IPluginModelBase[mbArr.length + 1];
System.arraycopy(mbArr, 0, newArr, 0, mbArr.length);
newArr[mbArr.length] = model;
mbArr = newArr;
}
activeMap.put(id, mbArr);
}
}
...
The NPE at line 85 is understandable: getBundleDescription() may be null for some subtypes of IPluginModelBase.
FragmentModel => always null.
WorkspaceBundleFragmentModel and WorkspaceBundlePluginModel => null unless setBundleDescription() has been previously called with a non-null value.
Is this a bug in the buckminster/indigo release?
- Nicolas.
|
|
|
|
|
Re: Resolution problems with Indigo: NPE in EclipsePlatformReaderType.getBestPlugin [message #903121 is a reply to message #903117] |
Wed, 22 August 2012 02:35  |
Eclipse User |
|
|
|
Never mind. I found it. Thanks a lot.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=387739
- thomas
On 2012-08-22 08:07, Thomas Hallgren wrote:
> Hi Nicolas,
>
> If you get it working OK, could you please enter a bugzilla and attach the patch there?
>
> TIA,
> - thomas
>
> On 2012-08-21 20:20, Nicolas Rouquette wrote:
>> I experimented with a simple patch which seems to work for me.
>> To be sure, I have to create a proper patch feature with the change below, install it and see if it will work in the
>> environment where I experienced the NPE.
>>
>>
>> diff --git a/org.eclipse.buckminster.pde/src/java/org/eclipse/buckminster/pde/internal/EclipsePlatformReaderType.java
>> b/org.eclipse.buckminster.pde/src/java/org/eclipse/buckminster/pde/internal/EclipsePlatformReaderType.java
>> index ec8cfdd..d7003e5 100644
>> --- a/org.eclipse.buckminster.pde/src/java/org/eclipse/buckminster/pde/internal/EclipsePlatformReaderType.java
>> +++ b/org.eclipse.buckminster.pde/src/java/org/eclipse/buckminster/pde/internal/EclipsePlatformReaderType.java
>> @@ -82,6 +82,8 @@
>> if (activeMap.isEmpty()) {
>> for (IPluginModelBase model : PluginRegistry.getAllModels()) {
>> BundleDescription desc = model.getBundleDescription();
>> + if (desc == null)
>> + continue;
>> String id = desc.getSymbolicName();
>> IPluginModelBase[] mbArr = activeMap.get(id);
>> if (mbArr == null)
>>
>>
>> - Nicolas.
>
|
|
|
Powered by
FUDForum. Page generated in 0.07625 seconds