ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53754] New: javac -> getCurrentCompilerArgs() causes NullPointerException
Date Tue, 21 Aug 2012 13:42:33 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53754

          Priority: P2
            Bug ID: 53754
          Assignee: notifications@ant.apache.org
           Summary: javac -> getCurrentCompilerArgs() causes
                    NullPointerException
          Severity: normal
    Classification: Unclassified
          Reporter: rubinov702@mail.ru
          Hardware: Macintosh
            Status: NEW
           Version: 1.8.2
         Component: Core tasks
           Product: Ant

The following code causes NullPointerException in a normal javac task scenario:

@Test
public void testJavac() throws Exception {
    Javac javac = new Javac();
    Project project = new Project();
    project.init();
    javac.setProject(project);
    javac.createCompilerArg();
    javac.setFork(true);
    javac.getCurrentCompilerArgs(); //NPE occurs
}

It is also reproducible with the simple build using <compilerarg/>:

<project name="project" default="all" basedir=".">
    <target name="all">
        <javac srcdir="./src" destdir="./buildbug" fork="true">
            <compilerarg/>
        </javac>
    </target>
</project>      


The stack trace:

BUILD FAILED
/buildproject.xml:5: java.lang.NullPointerException
    at
org.apache.tools.ant.util.facade.FacadeTaskHelper.getArgs(FacadeTaskHelper.java:134)
    at
org.apache.tools.ant.taskdefs.Javac.getCurrentCompilerArgs(Javac.java:748)
    at
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.addCurrentCompilerArgs(DefaultCompilerAdapter.java:550)
    at
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.setupJavacCommandlineSwitches(DefaultCompilerAdapter.java:328)
    at
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.setupModernJavacCommandlineSwitches(DefaultCompilerAdapter.java:340)
    at
org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:49)
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1134)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:809)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


Ant version:

Apache Ant(TM) version 1.8.2 compiled on May 16 2012
Detected Java version: 1.6 in:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Detected OS: Mac OS X

After some investigation I assume that the failing sequence is due to:

FacadeTaskHelper.getArgs() uses ImplementationSpecificArgument.getParts() ->
Commandline.Argument.getParts(), that returns null
and FacadeTaskHelper.getArgs() fails to handle the null value.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message