Project

Profile

Help

NPE with unparsed-entity-uri()

Added by David Fonquernie about 10 years ago

Hello,

When a XSL transformation is done from a Source having a null systemId, the use of the xsl function unparsed-entity-uri() throws a NullPointerException.

Caused by: java.lang.NullPointerException
	at java.net.URI$Parser.parse(Unknown Source)
	at java.net.URI.(Unknown Source)
	at net.sf.saxon.dom.DocumentWrapper.getUnparsedEntity(DocumentWrapper.java:286)
	at net.sf.saxon.tree.wrapper.SpaceStrippedDocument.getUnparsedEntity(SpaceStrippedDocument.java:137)
	at net.sf.saxon.functions.UnparsedEntity.evaluateItem(UnparsedEntity.java:128)
	at net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:301)
	at net.sf.saxon.expr.instruct.WithParam.getSelectValue(WithParam.java:392)
	at net.sf.saxon.expr.instruct.Instruction.assembleParams(Instruction.java:204)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:339)
	at net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:326)
	at net.sf.saxon.expr.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:52)
	at net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:301)
	at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:407)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:613)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:669)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:144)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:450)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:389)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:622)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:669)
	at net.sf.saxon.expr.instruct.Template.applyLeavingTail(Template.java:336)
	... 148 more

I get this error by doing:

transformerImpl.transform(new DOMSource(document), result);

I know, it's weird to try to get an entity URI without giving a base URI but I didn't expect a NPE. Is this a bug ?


Replies (3)

Please register to reply

RE: NPE with unparsed-entity-uri() - Added by Michael Kay about 10 years ago

Yes, it certainly shouldn't be an NPE. But it's not entirely clear what it should be. I've raised this as a spec bug:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27061

Meanwhile I'll change it to return some suitable error code.

RE: NPE with unparsed-entity-uri() - Added by Michael Kay about 10 years ago

For Saxon-built trees, if no base URI is known then the function returns the relative URI as written. So I will change the DOM implementation to do the same thing.

    (1-3/3)

    Please register to reply