xmlcalabash1 icon indicating copy to clipboard operation
xmlcalabash1 copied to clipboard

Ant task throws NullPointerException

Open eerohele opened this issue 7 years ago • 3 comments

xmlcalabash-1.1.9-96.

Buildfile:

<project xmlns:c="antlib:com.xmlcalabash" name="test" default="build">

  <typedef uri="antlib:com.xmlcalabash"
    resource="com/xmlcalabash/antlib.xml"
    classpath="xmlcalabash-1.1.9-96.jar"/>

  <target name="build">
    <c:calabash pipeline="xpl/pipe.xpl"/>
  </target>

</project>

Error:

Buildfile: /private/tmp/xmlcalabash-1.1.9-96/build.xml

build:
[c:calabash] Pipelining into /private/tmp/xmlcalabash-1.1.9-96

BUILD FAILED
/private/tmp/xmlcalabash-1.1.9-96/build.xml:8: java.lang.NullPointerException
    at com.xmlcalabash.drivers.Main.run(Main.java:182)
    at com.xmlcalabash.drivers.CalabashTask.process(CalabashTask.java:1309)
    at com.xmlcalabash.drivers.CalabashTask.execute(CalabashTask.java:1201)

It seems to me that runtime is null at Main.java#L182.

eerohele avatar Aug 11 '16 15:08 eerohele

I also get the same error using the latest xmlcalabash-1.1.16-97.jar.

dwcramer avatar Aug 15 '17 22:08 dwcramer

Hello. First, thanks for your work Mr Walsh. The problem is the runtime field in the com.xmlcalabash.drivers.Main class is not initialize when the protected method boolean run(UserArgs userArgs, XProcConfiguration config) is called. So just replace:

    boolean run(UserArgs userArgs, XProcConfiguration config) throws SaxonApiException, IOException, URISyntaxException {
        if (userArgs.isShowVersion()) {
            XProcConfiguration.showVersion(runtime);
        }

        XPipeline pipeline = null;

        if (userArgs.getPipeline() != null) {

by

    boolean run(UserArgs userArgs, XProcConfiguration config) throws SaxonApiException, IOException, URISyntaxException {
        if (userArgs.isShowVersion()) {
            XProcConfiguration.showVersion(runtime);
        }

        XPipeline pipeline = null;

        if (runtime == null) {
            runtime = new XProcRuntime(config);
        }

        if (userArgs.getPipeline() != null) {

It works.

lbize avatar Nov 19 '18 13:11 lbize

Thanks !

lbize avatar Dec 18 '18 17:12 lbize