The stack trace shows that you are evaluating the document() function. This has failed for some reason, and the crash occurs while trying to report the error. This requires the source document to have a base URI. The way you have set it up, there is no base URI available, because the source is a byte array. Use setSystemId() on the InputSource or SAXSource (preferably both) to define a base URI.
 
If your code is in a URIResolver then you don't need to build the document yourself, you can simply return the SAXSource, and Saxon will do the building.
 
Since the failure seems to be caused by a parsing failure, it might simply be that the byte array you've supplied is invalid XML.
 
I don't know why it's crashing rather than failing cleanly, if you can reproduce the problem on 6.5.2 then I will investigate this.
 

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com

-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of David Hooker
Sent: 18 June 2002 00:14
To: michael.h.kay@ntlworld.com
Cc: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Passing parameters to a transform

On further investigation (my own try-catch block around the below code), the actual exception that is thrown that causes the below exception is actually a NullPointerException:
 
javax.xml.transform.TransformerException: java.lang.NullPointerException
        at com.icl.saxon.om.Builder.build(Builder.java:266)
 
That line in the saxon source is where it is parsing the XML input.  The XML I'm sending in looks correct.  Are there any restrictions on the XML I can send in? (i.e. comments, whitespace, length, etc.)???
 
 
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of David Hooker
Sent: Monday, June 17, 2002 5:18 PM
To: michael.h.kay@ntlworld.com
Cc: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Passing parameters to a transform

Ok... I'm trying to build a Saxon tree straight from XML to return from the resolve call of my own URIResolver.  Here's my code:
 
        ByteArrayInputStream inBytes = new ByteArrayInputStream(outBytes.toByteArray());    // outBytes contains the XML
        InputSource inSource = new InputSource(inBytes);
        SAXSource saxSource = new SAXSource(inSource);
        TinyBuilder builder = new TinyBuilder();
        return builder.build(saxSource);
When I do this, I get the following exception when I transform:
 
java.lang.NullPointerException
        at com.icl.saxon.StandardErrorListener.getExpandedMessage(StandardErrorListener.java:180)
        at com.icl.saxon.StandardErrorListener.warning(StandardErrorListener.java:69)
        at com.icl.saxon.Controller.reportRecoverableError(Controller.java:532)
        at com.icl.saxon.functions.Document.makeDoc(Document.java:239)
        at com.icl.saxon.functions.Document.getDocuments(Document.java:134)
        at com.icl.saxon.functions.Document.evaluate(Document.java:70)
        at com.icl.saxon.functions.Document.reduce(Document.java:299)
        at com.icl.saxon.expr.PathExpression.reduce(PathExpression.java:160)
        at com.icl.saxon.expr.NodeSetExpression.evaluate(NodeSetExpression.java:39)
        at com.icl.saxon.style.XSLGeneralVariable.getSelectValue(XSLGeneralVariable.java:251)
        at com.icl.saxon.style.XSLParam.process(XSLParam.java:65)
        at com.icl.saxon.style.XSLStyleSheet.process(XSLStyleSheet.java:626)
        at com.icl.saxon.Controller.transformDocument(Controller.java:1071)
        at com.icl.saxon.Controller.transform(Controller.java:945)
    .....
 
Any ideas?
-----Original Message-----
From: Michael Kay [mailto:michael.h.kay@ntlworld.com]
Sent: Thursday, June 13, 2002 6:23 AM
To: 'David Hooker'
Subject: RE: [saxon] Passing parameters to a transform

 
Thanks for the guidance.  The 6.5.1 document didn't have that section "Result of an extension function", so I downloaded 7.1 and it was listed there.  I'm assuming that the information is compatible with 6.5.1. 
 
No, unfortunately, there were changes in 7.1 and support for javax.xml.transform.Source was one of them. For a list of what's in 6.5.1, see the source code: method convertJavaObjectToXPath in class com.icl.saxon.expr.FunctionProxy - sorry about this!
 
If you want to supply a tree as a parameter in 6.5.1, you'll have to convert it to a Saxon tree first. One way to do this is with a JAXP identity transformation, from a DOMSource (any DOM) to a DOMResult (Saxon DOM).
 
Michael Kay 
 
My plan is to get a javax.xml.transform.sax.SAXSource corresponding to my document (which is a dom4J DOM), and pass that as the parameter.  According to extensibility.html, this should work...
  • If the returned value is an instance of javax.xml.transform.Source (other than a NodeInfo), a tree is built from the specified Source object, and the root node of this tree is returned as the result of the function.
     
    Thanks again.