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

Re: Calabash NullPointerExceptions

From: Natan Cox <natan.cox@gmail.com>
Date: Mon, 15 Mar 2010 20:25:17 +0100
Message-ID: <28f8eb9d1003151225t1dfe052dxd6a8fc0626a0173a@mail.gmail.com>
To: Norman Walsh <ndw@nwalsh.com>
Cc: XProc Dev <xproc-dev@w3.org>
Hmmm, unfortunately I don't have 2-month-old-non-working-code lying around
here.

Thanks for trying,
Natan

On Wed, Mar 10, 2010 at 5:13 PM, Norman Walsh <ndw@nwalsh.com> wrote:

> Natan Cox <natan.cox@gmail.com> writes:
> [...]
> > 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.
>
> I would, but I can't reproduce your error. This works for me:
>
> <p:declare-step version='1.0' xmlns:p="http://www.w3.org/ns/xproc"
> name="main"
>                xmlns:cx="http://xmlcalabash.com/ns/extensions"
>                xmlns:c="http://www.w3.org/ns/xproc-step">
>
>  <p:output port="result"/>
>
>  <p:xquery >
>    <p:input port="source"><p:empty/></p:input>
>     <p:input port="query">
>      <p:inline>
>         <c:data>
>           &lt;html> &lt;body> &lt;ul> ... query here ... &lt;/ul>
> &lt;/body> &lt;/html>
>         </c:data>
>      </p:inline>
>    </p:input>
>    <p:input port="parameters">
>       <p:empty/>
>    </p:input>
>  </p:xquery>
>
> </p:declare-step>
>
> Can you send me a pipeline that exhibits the problem?
>
>                                        Be seeing you,
>                                          norm
>
> --
> Norman Walsh <ndw@nwalsh.com> | In matters of style, swim with the
> http://nwalsh.com/            | current; in matters of principle, stand
>                              | like a rock.--Thomas Jefferson
>
Received on Monday, 15 March 2010 19:25:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 15 March 2010 19:25:51 GMT