W3C home > Mailing lists > Public > xproc-dev@w3.org > January 2010

Calabash NullPointerExceptions

From: Natan Cox <natan.cox@gmail.com>
Date: Fri, 8 Jan 2010 08:34:37 +0100
Message-ID: <28f8eb9d1001072334i2437df1eg19345f661bc72b3c@mail.gmail.com>
To: xproc-dev@w3.org
Hi Norman,

I was having some trouble getting a certain XProc step to work. Mainly my
fault because I did something like

  <p:xquery >
    <p:input port="query">
      <p:inline>
          &lt;html> &lt;body> &lt;ul> ... query here ... &lt;/ul> &lt;/body>
&lt;/html>
     </p:inline>
    </p:input>
    <p:input port="parameters" sequence="true">
      <p:empty/>
    </p:input>
  </p:xquery>

forgetting c:query in the p:inline.

I get a NullPointerException on node.getBaseURI()

            S9apiUtils.writeXdmValue(runtime, nodes, dest,
node.getBaseURI());


It would easier for me if in ReadableInline you would add after

        // Find the document element so we can get the base URI
        XdmNode node = null;
        for (int pos = 0; pos < nodes.size() && node == null; pos++) {
            if (((XdmNode) nodes.get(pos)).getNodeKind() ==
XdmNodeKind.ELEMENT) {
                node = (XdmNode) nodes.get(pos);
            }
        }

another null check on node and report a nice contextualized message of what
I did wrong.


Thanks, Natan
Received on Friday, 8 January 2010 17:15:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 8 January 2010 17:15:41 GMT