Project

Profile

Help

Internal Saxon error

Added by Anonymous over 14 years ago

Legacy ID: #7993883 Legacy Poster: Vladimir Nesterovsky (vnesterovsky)

Hello Mr. Kay! I'm getting a compilation error in Saxon 9.2. While I'm trying to build a minimal demo, you may see a code snapshot and the error report. It might be you'll spot the error immediately: [code] <xsl:function name="p:get-merged-data-division" as="element()?"> <xsl:param name="program" as="element()"/> <xsl:variable name="escape-data-division" as="element()?"> <xsl:variable name="escapes" as="element()" select="t:get-escapes($program/procedure-division)"/> <xsl:if test="exists(escapes)"> <xsl:variable name="performs" as="element()" select=" for $perform in $program/procedure-division//perform-statement[times] return $perform[not(ancestor::comment[. >> $perform])] [ . intersect $escapes/ancestor::perform-statement ]"/> <xsl:for-each-group select="$escapes/meta/escape" group-by="xs:string(exactly-one(@name-ref))"> </xsl:for-each-group> <xsl:for-each select="$performs"> </xsl:for-each> </xsl:if> </xsl:variable> <xsl:variable name="data-divisions" as="element()*" select=" $program[self::program]/ ( data-division, procedure-division/t:get-complex-elements(.)/data-division ), $escape-data-division"/> <xsl:if test="exists($data-divisions)"> <xsl:sequence select=" p:merge-data-divisions($data-divisions, 2, $data-divisions[1])"/> </xsl:if> </xsl:function> [/code] and [code] Error on line 208 of cobol-complex-element.xslt: XPDY0002: Axis step child::element({http://www.bphx.com/cobol/2009-12-15}escapes, xs:anyType) cannot be used here: the context item is undefined *** Internal Saxon error: local variable encountered whose binding has been deleted Variable name: escapes Line number of reference: 216 in file:/D:/Cool/Tool/Cool_Encyclopedia/source/META-INF/stylesheets/cobolxom/cobol-complex-element.xslt Line number of declaration: 206 in file:/D:/Cool/Tool/Cool_Encyclopedia/source/META-INF/stylesheets/cobolxom/cobol-complex-element.xslt DECLARATION: Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:210) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:131) [/code] Thanks.


Replies (5)

Please register to reply

RE: Internal Saxon error - Added by Anonymous over 14 years ago

Legacy ID: #7993904 Legacy Poster: Vladimir Nesterovsky (vnesterovsky)

Note: The following is at line 201: [code] <xsl:function name="p:get-merged-data-division" as="element()?"> [/code]

RE: Internal Saxon error - Added by Anonymous over 14 years ago

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

This internal error generally comes after a complex sequence of optimizations, so it's not possible to diagnose it without a complete repro. Does it go away if you fix the first (correctly-reported) error, by changing <xsl:if test="exists(escapes)"> to <xsl:if test="exists($escapes)">? (It's still a bug even if it only happens on an error path, but it would be nice to know.) It's possible that Saxon has decided that the condition exists(escapes) is always false, and has therefore decided incorrectly that the variable $escapes is not referenced, or something like that.

RE: Internal Saxon error - Added by Anonymous over 14 years ago

Legacy ID: #7994225 Legacy Poster: Vladimir Nesterovsky (vnesterovsky)

You're right! I've missed $ before variable name. It was the second error report that blinded me. Sorry. After fixing the first error, second one goes away. Xsl is: [code] <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:p="private" exclude-result-prefixes="xs p"> <xsl:function name="p:get-merged-data-division" as="element()?"> <xsl:param name="program" as="element()"/> <xsl:variable name="escapes" as="element()*" select="$program"/> <xsl:if test="exists(escapes)"> <xsl:for-each-group select="$escapes" group-by="xs:string(@name-ref)"> </xsl:for-each-group> </xsl:if> </xsl:function> </xsl:stylesheet> [/code]

RE: Internal Saxon error - Added by Anonymous over 14 years ago

Legacy ID: #7996580 Legacy Poster: Gus Heck (gh-aspen)

I'm seeing a similar sort of error with a simpler query. (and I haven't [ yet :) ] found any similar mistake in the query) I'm using XmlBeans with the Saxon HE parser version 9.2.0.3j... The XML is read from http, stored temporarily as a string, and parsed into a org.w3c.dom.Document. I used inst2sch to generate a schema and generated object classes from there... The top level is DetailedReveiwDocument (I can send you the schema if you like, the XML I'm dealing with is the output of the REST api of our Crucible 1.6.2 install, and the schema should be relatively complete since the instance data I used contains almost 1000 reviews :). So then I do the following: [code] DetailedReviewsDocument doc = DetailedReviewsDocument.Factory.parse(dom.getDocumentElement()); XmlObject[] obj = doc.execQuery(query); [/code] [code]for $u in distinct-values(.//generalCommentData/user/userName) let $count := count(.//generalCommentData) where $u = ./generalCommentData/user/userName order by $count descending return {$u, $count}[/code] And I get the following: *** Internal Saxon error: local variable encountered whose binding has been deleted Variable name: saxon:dot7493991 Line number of reference: 3 in module with no systemId Line number of declaration: 1 in module with no systemId DECLARATION: | java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.apache.xmlbeans.impl.store.QueryDelegate.createInstance(QueryDelegate.java:81) at org.apache.xmlbeans.impl.store.Query$DelegateQueryImpl.createDelegateCompiledQuery(Query.java:266) at org.apache.xmlbeans.impl.store.Query.getCompiledQuery(Query.java:152) at org.apache.xmlbeans.impl.store.Query.getCompiledQuery(Query.java:85) at org.apache.xmlbeans.impl.store.Query.objectExecQuery(Query.java:75) at org.apache.xmlbeans.impl.store.Xobj.exec_query(Xobj.java:2519) at org.apache.xmlbeans.impl.values.XmlObjectBase.execQuery(XmlObjectBase.java:514) at org.apache.xmlbeans.impl.values.XmlObjectBase.execQuery(XmlObjectBase.java:496) at com.aspentech.crucible.query.CrucibleXQueryEngine.query(CrucibleXQueryEngine.java:37) at com.aspentech.crucible.query.Main$4.actionPerformed(Main.java:67) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:5517) at javax.swing.JComponent.processMouseEvent(JComponent.java:3135) at java.awt.Component.processEvent(Component.java:5282) at java.awt.Container.processEvent(Container.java:1966) at java.awt.Component.dispatchEventImpl(Component.java:3984) at java.awt.Container.dispatchEventImpl(Container.java:2024) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822) at java.awt.Container.dispatchEventImpl(Container.java:2010) at java.awt.Window.dispatchEventImpl(Window.java:1791) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedConstructorAccessor11.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.apache.xmlbeans.impl.store.QueryDelegate.createInstance(QueryDelegate.java:76) ... 33 more Caused by: java.lang.IllegalStateException: *** Internal Saxon error: local variable encountered whose binding has been deleted at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:535) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.expr.ExpressionTool.allocateSlots(ExpressionTool.java:541) at net.sf.saxon.query.XQueryExpression.(XQueryExpression.java:80) at net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:128) at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:484) at org.apache.xmlbeans.impl.xquery.saxon.XBeansXQuery.(XBeansXQuery.java:70) ... 37 more

RE: Internal Saxon error - Added by Anonymous over 14 years ago

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

I'm seeing a similar sort of error with a simpler query. It might be similar symptoms but the cause is quite different (and it would have been better to start a new thread). This one is the bug logged at https://sourceforge.net/tracker/?func=detail&aid=2912888&group_id=29872&atid=397617, and I've confirmed that the patch for that problem fixes it.

    (1-5/5)

    Please register to reply