Bug 97744 - [compiler][ant adapter] NPE when verbose = true and destDir not specified
Summary: [compiler][ant adapter] NPE when verbose = true and destDir not specified
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-31 17:17 EDT by Olivier Thomann CLA
Modified: 2005-06-10 09:40 EDT (History)
2 users (show)

See Also:


Attachments
Apply on HEAD on JDTCompilerAdapter class (1.17 KB, patch)
2005-05-31 17:28 EDT, Olivier Thomann CLA
no flags Details | Diff
custom build script for org.eclipse.swt.win32.wce_ppc.arm (10.00 KB, text/plain)
2005-06-01 09:32 EDT, Veronika Irvine CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2005-05-31 17:17:31 EDT
When the destination directory is not specified, it can be null and if the
verbose mode is true, it leads to a NPE.

This is a problem for SWT custom script.

With M7, it leads to:
java.lang.NullPointerException
        at
org.eclipse.jdt.core.JDTCompilerAdapter.setupJavacCommand(JDTCompilerAdapter.java:303)
        at
org.eclipse.jdt.core.JDTCompilerAdapter.execute(JDTCompilerAdapter.java:56)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
Comment 1 Olivier Thomann CLA 2005-05-31 17:17:58 EDT
Would be a candidate for RC2.
Comment 2 Olivier Thomann CLA 2005-05-31 17:28:29 EDT
Created attachment 22107 [details]
Apply on HEAD on JDTCompilerAdapter class

If the destination directory is not specified, it creates a file called
temp.log in the user.dir directory whatever "user.dir" can be.
Comment 3 Veronika Irvine CLA 2005-06-01 09:32:53 EDT
Created attachment 22134 [details]
custom build script for org.eclipse.swt.win32.wce_ppc.arm

Changed build script to specify destdir.

Attaching the original build script (without destDir)
Comment 4 Sonia Dimitrov CLA 2005-06-01 09:52:26 EDT
Thanks Veronika, the build succeeds with the change to your script.
Comment 5 Philipe Mulet CLA 2005-06-01 12:06:09 EDT
+1 for RC2
Comment 6 Olivier Thomann CLA 2005-06-01 14:32:57 EDT
Fixed and released in HEAD.
To verify, use an ant script in which the destination directory is not specified
for the javac ant task.

For example,

<?xml version="1.0" encoding="UTF-8"?>
<project name="compile" default="main" basedir="../.">
	<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
	<property name="temp.folder" value="d:/tests_sources"/>

	<target name="main">
		<javac srcdir="${temp.folder}/temp.bin" nowarn="on" deprecation="off"
debug="on" verbose="on"/>
	</target>
</project>


Please update the properties.

You would then end up with:

Buildfile: D:\eclipse\workspaces\test97744\P\scripts\build.xml

main:
       [javac] Compiling 2 source files
       [javac] -noExit -classpath
D:\jdks\jdk1.5.0_03\jre\lib\ext\dnsns.jar;D:\jdks\jdk1.5.0_03\jre\lib\ext\localedata.jar;D:\jdks\jdk1.5.0_03\jre\lib\ext\sunjce_provider.jar;D:\jdks\jdk1.5.0_03\jre\lib\ext\sunpkcs11.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-antlr.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-apache-bcel.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-apache-bsf.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-apache-log4j.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-apache-oro.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-apache-regexp.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-apache-resolver.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-commons-logging.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-commons-net.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-icontract.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-jai.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-javamail.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-jdepend.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-jmf.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-jsch.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-junit.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-launcher.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-netrexx.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-nodeps.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-starteam.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-stylebook.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-swing.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-trax.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-vaj.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-weblogic.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-xalan1.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.apache.ant_1.6.4\lib\ant-xslp.jar;D:\jdks\jdk1.5.0_03\lib\tools.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\9\1\.cp\ant_tasks\pde-ant.jar;D:\eclipse\3.1RC1\eclipse\plugins\org.eclipse.pde.build_3.1.0\lib\pdebuild-ant.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\74\1\.cp\ant_tasks\helpbase-ant.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\81\1\.cp\ant_tasks\resources-ant.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\87\1\.cp\pdeuiant.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\91\1\.cp\jdtCompilerAdapter.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\13\1\.cp\lib\antsupportlib.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\29\1\.cp\lib\antrunner.jar;D:\eclipse\3.1RC1\eclipse\configuration\org.eclipse.osgi\bundles\29\1\.cp\lib\remoteAnt.jar;D:\jdks\jdk1.5.0_03\jre\lib\rt.jar;D:\jdks\jdk1.5.0_03\jre\lib\jce.jar;D:\jdks\jdk1.5.0_03\jre\lib\jsse.jar;D:\tests_sources\temp.bin
D:\tests_sources\temp.bin\Y.java D:\tests_sources\temp.bin\p\X.java
       [javac] ----------
       [javac] 1. ERROR in D:\tests_sources\temp.bin\p\X.java
       [javac]  (at line 4)
       [javac] 	System.out.println("Hello World")
       [javac] 	                                ^
       [javac] Syntax error, insert ";" to complete BlockStatements
       [javac] ----------
       [javac] 1 problem (1 error)

BUILD FAILED
D:\eclipse\workspaces\test97744\P\scripts\build.xml:7: Compile failed; see the
compiler error output for details.

Total time: 2 seconds

No log is created, but you can still get the errors in the ant console.

If a destination dir is specified, you end up with:
       [javac] ----------
       [javac] 1. ERROR in D:\tests_sources\temp.bin\p\X.java
       [javac]  (at line 4)
       [javac] 	System.out.println("Hello World")
       [javac] 	                                ^
       [javac] Syntax error, insert ";" to complete BlockStatements
       [javac] ----------
       [javac] 1 problem (1 error)
       [javac] Compilation failed. Compiler errors are available in
D:\tests_sources\temp.bin.log
Comment 7 Frederic Fusier CLA 2005-06-07 13:27:46 EDT
Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD
Comment 8 David Audel CLA 2005-06-10 09:40:32 EDT
Verified for 3.1 RC2 using build I20050610-0010