Re: Calabash NullPointerExceptions

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 UTC