| Summary: | [compiler][ant adapter] NPE when verbose = true and destDir not specified | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||||
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | sonia_dimitrov, veronika_irvine | ||||||
| Version: | 3.1 | ||||||||
| Target Milestone: | 3.1 RC2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Would be a candidate for RC2. 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.
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)
Thanks Veronika, the build succeeds with the change to your script. +1 for RC2 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
Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD Verified for 3.1 RC2 using build I20050610-0010 |
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)