Project

Profile

Help

NPE in VariableReference during Xquery

Added by Anonymous about 17 years ago

Legacy ID: #4224048 Legacy Poster: jbeuree (jbeuree)

Hi, We've run into a problem where saxon is throwing a null pointer exception during an xquery transform. I've done some searches and couldn't find any problem quite the same. We're using saxon 8.7.1 on Solaris. Here's the relevant part of the stack trace: java.lang.NullPointerException at net.sf.saxon.expr.VariableReference.process(VariableReference.java:227) at net.sf.saxon.instruct.ElementCreator.constructElement(ElementCreator.java:250) at net.sf.saxon.instruct.ElementCreator.evaluateItem(ElementCreator.java:195) at net.sf.saxon.instruct.Instruction.iterate(Instruction.java:312) at net.sf.saxon.expr.Atomizer.iterate(Atomizer.java:96) at net.sf.saxon.value.Closure.iterate(Closure.java:282) at net.sf.saxon.value.Value.convertToJava(Value.java:747) at net.sf.saxon.functions.ExtensionFunctionCall.setupParams(ExtensionFunctionCall.java:332) at net.sf.saxon.functions.ExtensionFunctionCall.call(ExtensionFunctionCall.java:213) at net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctionCall.java:112) at net.sf.saxon.expr.ComputedExpression.evaluateItem(ComputedExpression.java:519) at net.sf.saxon.expr.ExpressionTool.eagerEvaluate(ExpressionTool.java:297) at net.sf.saxon.expr.ExpressionTool.lazyEvaluate(ExpressionTool.java:245) at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:164) at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:147) at net.sf.saxon.value.Closure.iterate(Closure.java:282) at net.sf.saxon.value.Value.getIterator(Value.java:223) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:211) at net.sf.saxon.value.Closure.iterate(Closure.java:282) at net.sf.saxon.value.Value.getIterator(Value.java:223) at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:211) at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:155) at net.sf.saxon.expr.IfExpression.iterate(IfExpression.java:234) at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:155) at net.sf.saxon.value.Closure.iterate(Closure.java:282) at net.sf.saxon.value.Value.getIterator(Value.java:223) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:211) at net.sf.saxon.instruct.Block$BlockIterator.next(Block.java:409) at net.sf.saxon.expr.ComputedExpression.process(ComputedExpression.java:603) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:338) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:164) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:336) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.constructElement(ElementCreator.java:250) at net.sf.saxon.instruct.ElementCreator.evaluateItem(ElementCreator.java:195) at net.sf.saxon.instruct.Instruction.iterate(Instruction.java:312) at net.sf.saxon.instruct.Block$BlockIterator.next(Block.java:409) at net.sf.saxon.query.XQueryExpression$ErrorReportingIterator.next(XQueryExpression.java:521) at net.sf.saxon.query.QueryResult.serializeSequence(QueryResult.java:126) We're running in a multithreaded environment so there may be multiple xquery transforms in progress at the same time. The xquery does make calls out to Java, and the stack trace seems to indicate this is part of the problem. Could the Java method being called somehow cause this? Thanks, Jerry


Replies (3)

Please register to reply

RE: NPE in VariableReference during Xquery - Added by Anonymous about 17 years ago

Legacy ID: #4224102 Legacy Poster: Michael Kay (mhkay)

Could you please see whether the same thing happens when running on Saxon 8.9.0.3? It's definitely a bug, but it's very likely to be one that has been fixed. Michael Kay http://www.saxonica.com/

RE: NPE in VariableReference during Xquery - Added by Anonymous about 17 years ago

Legacy ID: #4251896 Legacy Poster: jbeuree (jbeuree)

We don't see the same thing with 8.9.0.3, but instead get this rather large exception: java.lang.RuntimeException: DOM Level 3 Not implemented at org.apache.xmlbeans.impl.store.DomImpl._node_isSameNode(DomImpl.java:2438) at org.apache.xmlbeans.impl.store.Xobj$NodeXobj.isSameNode(Xobj.java:2472) at net.sf.saxon.dom.NodeWrapper.isSameNodeInfo(NodeWrapper.java:199) at net.sf.saxon.dom.NodeWrapper.compareOrder(NodeWrapper.java:294) at net.sf.saxon.sort.GlobalOrderComparer.compare(GlobalOrderComparer.java:35) at net.sf.saxon.sort.DocumentOrderIterator.compare(DocumentOrderIterator.java:53) at net.sf.saxon.sort.GenericSorter.quickSort1(GenericSorter.java:193) at net.sf.saxon.sort.GenericSorter.quickSort(GenericSorter.java:183) at net.sf.saxon.sort.DocumentOrderIterator.<init>(DocumentOrderIterator.java:34) at net.sf.saxon.sort.DocumentSorter.iterate(DocumentSorter.java:72) at net.sf.saxon.expr.ForExpression.iterate(ForExpression.java:502) at net.sf.saxon.value.MemoClosure.iterate(MemoClosure.java:89) at net.sf.saxon.value.Value.getIterator(Value.java:214) at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:276) at net.sf.saxon.functions.Existence.effectiveBooleanValue(Existence.java:34) at net.sf.saxon.expr.BooleanExpression.effectiveBooleanValue(BooleanExpression.java:171) at net.sf.saxon.expr.IfExpression.iterate(IfExpression.java:256) at net.sf.saxon.value.Closure.iterate(Closure.java:192) at net.sf.saxon.value.Value.getIterator(Value.java:214) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:300) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:370) at net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:363) at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:310) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:299) at net.sf.saxon.value.MemoClosure.iterate(MemoClosure.java:89) at net.sf.saxon.value.Value.getIterator(Value.java:214) at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:276) at net.sf.saxon.expr.ForExpression.process(ForExpression.java:514) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:284) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:349) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:367) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:405) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.expr.CardinalityChecker.process(CardinalityChecker.java:319) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:284) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:349) at net.sf.saxon.instruct.ElementCreator.constructElement(ElementCreator.java:324) at net.sf.saxon.instruct.ElementCreator.evaluateItem(ElementCreator.java:270) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:361) at net.sf.saxon.instruct.UserFunction.call(UserFunction.java:253) at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:321) at net.sf.saxon.expr.UserFunctionCall.evaluateItem(UserFunctionCall.java:285) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:361) at net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:363) at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:310) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:299) at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:218) at net.sf.saxon.expr.IfExpression.iterate(IfExpression.java:257) at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:218) at net.sf.saxon.expr.ForExpression$MappingAction.map(ForExpression.java:592) at net.sf.saxon.expr.MappingIterator.next(MappingIterator.java:54) at net.sf.saxon.value.SequenceExtent.<init>(SequenceExtent.java:98) at net.sf.saxon.value.SequenceExtent.makeSequenceExtent(SequenceExtent.java:129) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:370) at net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:363) at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:310) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:299) at net.sf.saxon.value.MemoClosure.iterate(MemoClosure.java:89) at net.sf.saxon.value.Value.getIterator(Value.java:214) at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:276) at net.sf.saxon.functions.Aggregate.evaluateItem(Aggregate.java:97) at net.sf.saxon.functions.Concat.evaluateItem(Concat.java:38) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:361) at net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:363) at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:310) at net.sf.saxon.expr.UserFunctionCall.iterate(UserFunctionCall.java:299) at net.sf.saxon.expr.Expression.effectiveBooleanValue(Expression.java:299) at net.sf.saxon.expr.IfExpression.iterate(IfExpression.java:256) at net.sf.saxon.instruct.BlockIterator.next(BlockIterator.java:42) at net.sf.saxon.value.SequenceExtent.<init>(SequenceExtent.java:98) at net.sf.saxon.value.SequenceExtent.makeSequenceExtent(SequenceExtent.java:129) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:370) at net.sf.saxon.instruct.GlobalVariable.getSelectValue(GlobalVariable.java:180) at net.sf.saxon.instruct.GlobalVariable.evaluateVariable(GlobalVariable.java:204) at net.sf.saxon.expr.VariableReference.evaluateVariable(VariableReference.java:319) at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:275) at net.sf.saxon.expr.ItemChecker.iterate(ItemChecker.java:125) at net.sf.saxon.value.MemoClosure.iterate(MemoClosure.java:89) at net.sf.saxon.expr.Literal.iterate(Literal.java:162) at net.sf.saxon.expr.FilterExpression.iterate(FilterExpression.java:682) at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:218) at net.sf.saxon.value.MemoClosure.iterate(MemoClosure.java:89) at net.sf.saxon.value.Value.getIterator(Value.java:214) at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:276) at net.sf.saxon.expr.PathExpression.iterate(PathExpression.java:826) at net.sf.saxon.expr.PathExpression.iterate(PathExpression.java:826) at net.sf.saxon.sort.DocumentSorter.iterate(DocumentSorter.java:72) at net.sf.saxon.expr.Expression.process(Expression.java:346) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:268) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:284) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:349) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:367) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.expr.IfExpression.process(IfExpression.java:270) at net.sf.saxon.expr.IfExpression.process(IfExpression.java:270) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:268) at net.sf.saxon.expr.TailCallLoop.process(TailCallLoop.java:117) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:284) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:349) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:367) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:268) at net.sf.saxon.instruct.UserFunction.process(UserFunction.java:284) at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:349) at net.sf.saxon.expr.IfExpression.process(IfExpression.java:272) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:268) at net.sf.saxon.expr.IfExpression.process(IfExpression.java:270) at net.sf.saxon.expr.IfExpression.process(IfExpression.java:272) at net.sf.saxon.expr.IfExpression.process(IfExpression.java:272) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:268) at net.sf.saxon.expr.ForExpression.process(ForExpression.java:523) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:367) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:405) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.instruct.ElementCreator.constructElement(ElementCreator.java:324) at net.sf.saxon.instruct.ElementCreator.evaluateItem(ElementCreator.java:270) at net.sf.saxon.instruct.Instruction.iterate(Instruction.java:320) at net.sf.saxon.instruct.BlockIterator.next(BlockIterator.java:42) at net.sf.saxon.query.XQueryExpression$ErrorReportingIterator.next(XQueryExpression.java:553) at net.sf.saxon.query.QueryResult.serializeSequence(QueryResult.java:154) at net.sf.saxon.query.QueryResult.serializeSequence(QueryResult.java:137)

RE: NPE in VariableReference during Xquery - Added by Anonymous about 17 years ago

Legacy ID: #4252576 Legacy Poster: Michael Kay (mhkay)

>We don't see the same thing with 8.9.0.3, but instead get this rather large exception: It's not a large exception, only a large stack trace (!), which simply reflects that it was detected when fairly deep in the application. Saxon 8.9 requires DOM level 3, as the message indicates. It looks as if the DOM implementation you are using is one supplied by XML Beans and that this doesn't support DOM level 3 methods. I'm afraid the incompatibilities in DOM interfaces between Java releases have caused Saxon (and other DOM implementations) a great deal of hassle, and significantly reduce the usefulness of DOM as an interoperability standard. Until Saxon 8.9, Saxon was using reflection to determine whether the DOM implementation supported level 3 or not, but (a) this was very expensive, and (b) it failed where (as appears to be the case here) the level 3 method is present in the implementation, but throws an exception to indicate that the method is actually not implemented. The alternative, in which Saxon avoided using the level 3 isSameNode() method, gives a severe performance penalty when running with a DOM that does support level 3. I'm afraid I don't see an easy workaround to this - I would need to know more about the application design.

    (1-3/3)

    Please register to reply