Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335614 - NPE in getUniqueIdentifier
Summary: NPE in getUniqueIdentifier
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-27 15:52 EST by Miwako Tokugawa CLA
Modified: 2020-09-04 15:25 EDT (History)
2 users (show)

See Also:


Attachments
backtrace (9.87 KB, text/plain)
2011-01-27 17:05 EST, Miwako Tokugawa CLA
no flags Details
testcase (run as junit plugin test) (3.64 KB, application/octet-stream)
2011-01-28 16:28 EST, Miwako Tokugawa CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miwako Tokugawa CLA 2011-01-27 15:52:51 EST
Build Identifier:  cdt7.0.1 (ok with cdt6.0.2)

Hi. 
I get the error described when I run a code using cdt7.0.1. The same code works ok when running with cdt6.0.2. The backtrace is as follows:
java.lang.NoClassDefFoundError: org/eclipse/cdt/managedbuilder/internal/dataprovider/ConfigurationDataProvider
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.findBuildInfo(ManagedBuildManager.java:2747)
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.getBuildInfo(ManagedBuildManager.java:2992)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.getConfigurationFromId(PropertyManager.java:379)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.access$0(PropertyManager.java:376)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager$LoaddedInfo.getConfiguration(PropertyManager.java:66)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.setLoaddedData(PropertyManager.java:404)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.getData(PropertyManager.java:350)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.loadProperties(PropertyManager.java:184)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.getProperties(PropertyManager.java:123)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.getProperty(PropertyManager.java:116)
        at org.eclipse.cdt.managedbuilder.internal.core.PropertyManager.getProperty(PropertyManager.java:451)
        at org.eclipse.cdt.managedbuilder.internal.core.Tool.<init>(Tool.java:348)
        at org.eclipse.cdt.managedbuilder.internal.core.ToolChain.<init>(ToolChain.java:260)
        at org.eclipse.cdt.managedbuilder.internal.core.FolderInfo.<init>(FolderInfo.java:141)
        at org.eclipse.cdt.managedbuilder.internal.core.Configuration.<init>(Configuration.java:416)
        at org.eclipse.cdt.managedbuilder.internal.core.ManagedProject.<init>(ManagedProject.java:142)
        at org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo.<init>(ManagedBuildInfo.java:127)
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.loadOldStyleBuildInfo(ManagedBuildManager.java:2035)
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.getOldStyleBuildInfo(ManagedBuildManager.java:2959)
        at org.eclipse.cdt.managedbuilder.internal.dataprovider.ProjectConverter.convertManagedBuildInfo(ProjectConverter.java:583)
        at org.eclipse.cdt.managedbuilder.internal.dataprovider.ProjectConverter.convertProject(ProjectConverter.java:147)
        at org.eclipse.cdt.internal.core.settings.model.xml.XmlProjectDescriptionStorage.getConvertedDescription(XmlProjectDescriptionStorage.java:414)
        at org.eclipse.cdt.internal.core.settings.model.xml.XmlProjectDescriptionStorage.getProjectDescription(XmlProjectDescriptionStorage.java:240)
        at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.getProjectDescriptionInternal(CProjectDescriptionManager.java:416)
        at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.getProjectDescription(CProjectDescriptionManager.java:398)
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.findBuildInfo(ManagedBuildManager.java:2731)
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.getBuildInfo(ManagedBuildManager.java:2992)
        at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.getBuildInfo(ManagedBuildManager.java:2947)


Reproducible: Always
Comment 1 Andrew Gvozdev CLA 2011-01-27 16:14:39 EST
The class is there in 7.0.X. Maybe you got memory issues or corrupted installation?
Comment 2 Miwako Tokugawa CLA 2011-01-27 16:22:53 EST
Right.. I'm using ConfigurationDataProvider.java in my source tree too. Let me check out cdt7_0_1 from scratch and try again.
Comment 3 Miwako Tokugawa CLA 2011-01-27 16:23:27 EST
(In reply to comment #2)
> Right.. I'm using ConfigurationDataProvider.java in my source tree too. Let me
> check out cdt7_0_1 from scratch and try again.
Sorry, typo. I"m "seeing"
Comment 4 Miwako Tokugawa CLA 2011-01-27 17:03:32 EST
Seems a little better with the fresh checkout. (no error)
I'm getting

!MESSAGE Plug-in "org.eclipse.cdt.managedbuilder.core" was unable to instantiate class "org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider".

The class shows up in the backtrace, so it is there.

Caused by: java.lang.NullPointerException:
        at org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin.getUniqueIdentifier(ManagedBuilderCorePlugin.java:73)
        at org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider.<clinit>(ConfigurationDataProvider.java:72)
Comment 5 Miwako Tokugawa CLA 2011-01-27 17:05:38 EST
Created attachment 187785 [details]
backtrace
Comment 6 Andrew Gvozdev CLA 2011-01-27 17:57:39 EST
As far as I understand, to be able to instantiate a class outside of the package its package needs to be exported in MANIFEST.MF of managedbuilder.core. If you are compiling 7.0.1 branch try to add in there
 org.eclipse.cdt.managedbuilder.internal.dataprovider;x-internal:=true,

If it does not help, looks like bug 313038 did some related changes, maybe try to apply the attached path in reverse.
Comment 7 Miwako Tokugawa CLA 2011-01-28 14:14:42 EST
>looks like bug 313038 did some related changes, maybe try
to apply the attached path in reverse.
Wow, thanks. Yeap, this fixed the problem.

Actually the ConfigurationDataProvider instantiation error is caused by a NPE, i.e.

Caused by: java.lang.NullPointerException:
        at org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin.getUniqueIdentifier(ManagedBuilderCorePlugin.java:73)
        at org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider.<clinit>(ConfigurationDataProvider.java:72)

When I comment out the CConfigurationDataProviderDescriptor.java change you made for bug 313028, i.e.

		try {
			fProvider = createProvider(extension);
		} catch (CoreException e) {
			CCorePlugin.log(e.getStatus());
		}
I don’t get the NPE or the instantiation error, and my code works ok.
Thanks.
Comment 8 James Blackburn CLA 2011-01-28 14:50:11 EST
Could you also try exporting the package in the manifest to see if that fixes the issue?
Comment 9 Miwako Tokugawa CLA 2011-01-28 14:51:45 EST
(In reply to comment #8)
> Could you also try exporting the package in the manifest to see if that fixes
> the issue?
Hi, James. I tried and it doesn't fix the issue.
Comment 10 James Blackburn CLA 2011-01-28 15:21:06 EST
We clearly need a test case for whatever your code is doing...
Comment 11 Miwako Tokugawa CLA 2011-01-28 16:28:30 EST
Created attachment 187884 [details]
testcase (run as junit plugin test)