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

-----Original Message-----
From: [] On Behalf Of David Hooker
Sent: 18 June 2002 00:14
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
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: [] On Behalf Of David Hooker
Sent: Monday, June 17, 2002 5:18 PM
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();
When I do this, I get the following exception when I transform:
        at com.icl.saxon.StandardErrorListener.getExpandedMessage(
        at com.icl.saxon.StandardErrorListener.warning(
        at com.icl.saxon.Controller.reportRecoverableError(
        at com.icl.saxon.functions.Document.makeDoc(
        at com.icl.saxon.functions.Document.getDocuments(
        at com.icl.saxon.functions.Document.evaluate(
        at com.icl.saxon.functions.Document.reduce(
        at com.icl.saxon.expr.PathExpression.reduce(
        at com.icl.saxon.expr.NodeSetExpression.evaluate(
        at com.icl.saxon.Controller.transformDocument(
        at com.icl.saxon.Controller.transform(
Any ideas?
-----Original Message-----
From: Michael Kay []
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.