Project

Profile

Help

NPE while trying to create new extension

Added by Anonymous over 14 years ago

Legacy ID: #7573322 Legacy Poster: Jussi Nummelin (jussin)

Hi, I'm trying to create new "extensions" to read some data from our internal data source during the transformation. I've made the thing according to the SQL extension examples, but now I'm hitting some NPE: java.lang.NullPointerException at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:525) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:527) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:527) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:489) at net.sf.saxon.style.StyleElement.allocateSlots(StyleElement.java:1061) at net.sf.saxon.style.XSLGeneralVariable.initializeInstruction(XSLGeneralVariable.java:411) at net.sf.saxon.style.XSLVariable.compile(XSLVariable.java:103) at net.sf.saxon.style.XSLStylesheet.compileStylesheet(XSLStylesheet.java:1089) at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:346) at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:163) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139) at net.sf.saxon.Transform.doTransform(Transform.java:682) Unfortunately that doesn't tell much. :( Any ideas what could be wrong in my extension class? Probably I'm returning something not-that-correct, but I have absolutely no idea what it could be. Thanks in advance. - Jussi -


Replies (3)

Please register to reply

RE: NPE while trying to create new extension - Added by Anonymous over 14 years ago

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

I'm afraid the element extensibility interface is not especially robust. I can't tell much from the stack trace, partly because I can't work out which Saxon version you are using: none of the versions in my IDE have the recursive call on allocateSlots at line 527. However, because the NPE is two lines before the recursive call, my guess would be that one of your custom Expressions has an iterateSubExpresions() method that is returning a null as one of the subexpressions.

RE: NPE while trying to create new extension - Added by Anonymous over 14 years ago

Legacy ID: #7575060 Legacy Poster: Jussi Nummelin (jussin)

Hi, Thanks Michael for your response. I was able to overcome this problem with some refactoring in my code. :) I'm still not 100% sure what was the data that I returned as null, but obviously something. :) BTW, I'm using 9.1.0.1 version. I'm using this because this version is included in ServiceMix Saxon component and I'm trying to develop some "utility" functionality to be used as part of the transformations.

RE: NPE while trying to create new extension - Added by Anonymous over 14 years ago

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

It's a shame that ServiceMix aren't keeping up to date with bug-fixing releases of Saxon, but you can probably substitute the Saxon 9.1.0.7 jar yourself - I'm very conservative with point releases about only fixing bugs, and not changing any APIs or introducing other incompatibilities.

    (1-3/3)

    Please register to reply