hi, i have got NullPointer error in project propaties page on autotools-plugins.
in AutotoolsDefaultBuildDirHandler, sometimes AutotoolsDefaultBuildDirHandler("status")
returned null. (it happen that didn't add configure to Used tools, didn't
push apply button, when builder is autotools.)
just aviod by continue.
in MakeGenerator, at similler situation. when didn't apply tool-chain yet, but values are
changed. then push ok to invoke this.
if buildDir isn't null, return new Path(buildDir).
otherwise return null. the caller of this function may handle by set to default build value.
(at least in cdt-HEAD)
i'm not sure this is a correct way from a design viewpoint.
btw, i saw `FIXME: Use holder to set option value, not the "option" parameter`.
it may be related?
but i didnt see deeply yet. so i just put only a quick patch here.
### Eclipse Workspace Patch 1.0
#P com.redhat.eclipse.cdt.autotools
Index: src/com/redhat/eclipse/cdt/autotools/AutotoolsDefaultBuildDirHandler.java
===================================================================
RCS file: /cvs/eclipse/autotools/com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/AutotoolsDefaultBuildDirHandler.java,v
retrieving revision 1.4
diff -u -r1.4 AutotoolsDefaultBuildDirHandler.java
--- src/com/redhat/eclipse/cdt/autotools/AutotoolsDefaultBuildDirHandler.java 30 Oct 2007 22:36:17 -0000 1.4
+++ src/com/redhat/eclipse/cdt/autotools/AutotoolsDefaultBuildDirHandler.java 20 Feb 2008 12:06:59 -0000
@@ -61,6 +61,7 @@
continue;
}
ITool tool = config.getToolFromOutputExtension("status"); //$NON-NLS-1$
+ if (tool == null) continue;
// We now want to get the builddir option for the tool. If we use
// getOptionById(), we must know the full id which in our case has a generated
// numeric extension at the end. Otherwise, the base builddir option id
Index: src/com/redhat/eclipse/cdt/autotools/MakeGenerator.java
===================================================================
RCS file: /cvs/eclipse/autotools/com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/MakeGenerator.java,v
retrieving revision 1.35
diff -u -r1.35 MakeGenerator.java
--- src/com/redhat/eclipse/cdt/autotools/MakeGenerator.java 28 Jan 2008 20:45:12 -0000 1.35
+++ src/com/redhat/eclipse/cdt/autotools/MakeGenerator.java 20 Feb 2008 12:07:00 -0000
@@ -105,6 +105,7 @@
private void initializeBuildConfigDirs() {
ITool tool = cfg.getToolFromOutputExtension("status"); //$NON-NLS-1$
+ if (tool == null) return;
IOption[] options = tool.getOptions();
for (int i = 0; i < options.length; ++i) {
String id = options[i].getId();
@@ -251,7 +252,9 @@
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getBuildWorkingDir()
*/
public IPath getBuildWorkingDir() {
- return new Path(buildDir);
+ if (this.buildDir != null)
+ return new Path(buildDir);
+ return null;
}
/*