ndw / xmlcalabash1

XML Calabash, an XProc processor
http://xmlcalabash.com/
108 stars 41 forks source link

Ant task throws NullPointerException #240

Open eerohele opened 8 years ago

eerohele commented 8 years ago

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.

dwcramer commented 7 years ago

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

lbize commented 5 years ago

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 commented 5 years ago

Thanks !