ArrayIndexOutOfBoundsException
Added by Anonymous about 18 years ago
Legacy ID: #3981625 Legacy Poster: jbreure (jbreure)
Hi, We use SAXON for our application and it has never failed us until a couple of days ago. And since then, we cannot find a workaround. One specific script throws an ArrayIndexOutOfBoundsException at random times, with various indexes but always for the method getElementList in the class TinyDocumentImpl. This particular XSLT stylesheet is accessing a lot of external files and each external access is using a URL which will return an XML file through another XSLT transformation on the same server. This system works fine for all our other scripts but for this particular one which is heavier than the others, it fails most of the time (but not always). The exception seems to happen at random times (sometimes at the beginnng of the script, or in the middle or at the end), and the error message is ususally different (the value of the index). We are currently using SAXON 8b.7.3 and tried 8b.8. Strangley enough, it worked fine the four or five first times we used SAXON 8b.8 but now, the error is thrown almost every time (even after restarting the web server). Thanks, Jean-Baptiste REURE The error message is as follows: java.lang.ArrayIndexOutOfBoundsException: 173 at net.sf.saxon.tinytree.TinyDocumentImpl.getElementList(TinyDocumentImpl.java:186) at net.sf.saxon.tinytree.TinyDocumentImpl.getAllElements(TinyDocumentImpl.java:164) at net.sf.saxon.tinytree.TinyNodeImpl.iterateAxis(TinyNodeImpl.java:435) at net.sf.saxon.expr.AxisExpression.iterate(AxisExpression.java:381) at net.sf.saxon.expr.PathExpression.map(PathExpression.java:814) at net.sf.saxon.expr.ContextMappingIterator.next(ContextMappingIterator.java:55) at net.sf.saxon.value.SequenceExtent.<init>(SequenceExtent.java:105) at net.sf.saxon.sort.DocumentOrderIterator.<init>(DocumentOrderIterator.java:30) at net.sf.saxon.sort.DocumentSorter.iterate(DocumentSorter.java:68) at net.sf.saxon.expr.VennExpression.iterate(VennExpression.java:315) at net.sf.saxon.expr.VennExpression.iterate(VennExpression.java:315) at net.sf.saxon.instruct.CopyOf.processLeavingTail(CopyOf.java:111) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:353) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:221) at net.sf.saxon.instruct.ForEach.processLeavingTail(ForEach.java:244) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) at net.sf.saxon.expr.LetExpression.process(LetExpression.java:221) at net.sf.saxon.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:240) at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:360) at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:182) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:343) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:353) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:352) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:353) at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:352) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:353) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:99) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:319) at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:351) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:312) at net.sf.saxon.Controller.transformDocument(Controller.java:1602) at net.sf.saxon.Controller.transform(Controller.java:1426)
Replies (3)
Please register to reply
RE: ArrayIndexOutOfBoundsException - Added by Anonymous about 18 years ago
Legacy ID: #3982869 Legacy Poster: Michael Kay (mhkay)
Thanks for reporting this. I'm afraid there's not much I can do unless I can reproduce it. I appreciate this might be difficult if you're having trouble getting it to happen predictably yourself. However, I'd be very grateful if you can try to find some way of isolating it and sending me the program that causes it to happen. The code is walking off the end of an array because there ought to be a "stopper" node at the end with depth=0, and is seems this is missing - so the code in error is not actually the code that failed. However, I might be able to code the method that's failing more defensively so it doesn't crash in this situation. Michael Kay
RE: ArrayIndexOutOfBoundsException - Added by Anonymous about 18 years ago
Legacy ID: #4033051 Legacy Poster: jbreure (jbreure)
Hi Michael, Sorry for the late reply, we've been tracking down the issue and busy with other internal ones. We couldn't localize the problem and what was causing it, apart from the fact that it was when accessing a whole lot of external documents using the document() function. As a fix, we now use java to load the external files and pass them to the XSLT in the input XML but it would be better for us to do more in the XSLT and less in the Java. You mention a fix to the method to have it fail gracefully instead of throwing an exception, any news on this? Maybe it would help us. Thanks, JB.
RE: ArrayIndexOutOfBoundsException - Added by Anonymous about 18 years ago
Legacy ID: #4034068 Legacy Poster: Michael Kay (mhkay)
It's running off the end of an array in the TinyTree; it should hit a stopper node that prevents this, but it seems that the stopper node hasn't been added. There seem to be other paths navigating the same array that don't rely on the presence of the stopper node, so I will change this path to work the same way, even though I can't actually reproduce the problem.
Please register to reply