Project

Profile

Help

Bug #3188

closed

Internal Saxon error (local variable encountered whose binding has been deleted)

Added by Chris de Vreeze over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2017-03-31
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.7
Fix Committed on Branch:
9.7, trunk
Fixed in Maintenance Release:
Platforms:

Description

The following XPath throws an exception on Saxon-EE 9.7.0.15:

/xbrli:xbrl/xbrli:context[xbrli:scenario/xbrldi:typedMember[fn:resolve-QName(string(@dimension), .) =
  (xs:QName('ocw-dim:EquityIndividualSpecificationAxis'),
   xs:QName('ocw-dim:PropertyPlantEquipmentDepreciationSpecificationAxis'),
   xs:QName('ocw-dim:RealEstateEconomicValueSpecificationAxis'),
   xs:QName('ocw-dim:ContingentLiabilitiesSpecificationAxis'),
   xs:QName('ocw-dim:ContingentAssetsSpecificationAxis'),
   xs:QName('ocw-dim:ProvisionsIndividualSpecificationAxis'),
   xs:QName('ocw-dim:LiabilitiesNoncurrentIndividualSpecificationAxis'),
   xs:QName('ocw-dim:RelatedPartySpecificationAxis'),
   xs:QName('ocw-dim:GrantSpecificationAxis'),
   xs:QName('ocw-dim:ProjectSubsidyFinancialSpecificationAxis'))]]

For the input XML, see the attached file InstanceMinimal.xbrl. The XPath evaluator has been invoked as follows:

Processor processor = new Processor(true);

DocumentBuilder docBuilder = processor.newDocumentBuilder();
XdmItem contextItem = docBuilder.build(inputFile);

XPathCompiler xpathCompiler = processor.newXPathCompiler();
xpathCompiler.declareNamespace("fn", "http://www.w3.org/2005/xpath-functions");
xpathCompiler.declareNamespace("xbrli", "http://www.xbrl.org/2003/instance");
xpathCompiler.declareNamespace("xbrldi", "http://xbrl.org/2006/xbrldi");
xpathCompiler.declareNamespace("ocw-dim", "http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes");

XdmValue result = xpathCompiler.evaluate(xpathString, contextItem);

The error is as follows:

*** Internal Saxon error: local variable encountered whose binding has been deleted
Variable name: vv:loc2073707154
Line number of reference: 1 in 
Line number of declaration: 1 in 
DECLARATION:
<let xmlns:vv="http://saxon.sf.net/generated-variable" baseUri="" ns="xsl=http://www.w3.org/1999/XSL/Transform = xbrldi=http://xbrl.org/2006/xbrldi fn=http://www.w3.org/2005/xpath-functions ocw-dim=http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes saxon=http://saxon.sf.net/ xs=http://www.w3.org/2001/XMLSchema xbrli=http://www.xbrl.org/2003/instance" line="1" var="vv:loc2073707154" as="xs:QName+" indexable="true" slot="-999" eval="3">
 <literal count="10">
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="EquityIndividualSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="PropertyPlantEquipmentDepreciationSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="RealEstateEconomicValueSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="ContingentLiabilitiesSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="ContingentAssetsSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="ProvisionsIndividualSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="LiabilitiesNoncurrentIndividualSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="RelatedPartySpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="GrantSpecificationAxis"/>
  <qName pre="ocw-dim" uri="http://www.nltaxonomie.nl/nt11/ocw/20170301.b/dictionary/ocw-axes" loc="ProjectSubsidyFinancialSpecificationAxis"/>
 </literal>
 <filter flags="b">
  <axis name="child" nodeTest="element(Q{http://xbrl.org/2006/xbrldi}typedMember)"/>
  <gc op="=" card="M:N" comp="EQC">
   <fn name="resolve-QName">
    <fn name="string">
     <axis name="attribute" nodeTest="attribute(Q{}dimension)"/>
    </fn>
    <dot type="element(Q{http://xbrl.org/2006/xbrldi}typedMember)"/>
   </fn>
   <varRef name="vv:loc2073707154" slot="-999"/>
  </gc>
 </filter>
</let>
Exception in thread "main" java.lang.IllegalStateException: *** Internal Saxon error: local variable encountered whose binding has been deleted
	at net.sf.saxon.expr.parser.ExpressionTool.allocateSlots(ExpressionTool.java:777)
	at net.sf.saxon.expr.parser.ExpressionTool.allocateSlots(ExpressionTool.java:786)
	at net.sf.saxon.expr.parser.ExpressionTool.allocateSlots(ExpressionTool.java:786)
	at net.sf.saxon.expr.parser.ExpressionTool.allocateSlots(ExpressionTool.java:786)
	at net.sf.saxon.expr.parser.ExpressionTool.allocateSlots(ExpressionTool.java:786)
	at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:156)
	at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:506)
	at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:481)
	at net.sf.saxon.s9api.XPathCompiler.evaluate(XPathCompiler.java:529)

Strangely, if we remove a few QNames from the sequence of QNames, as in the XPath below, the error disappears. On Oracle Java 8 and IBM Java 6 we got the same results. The edited XPath:

/xbrli:xbrl/xbrli:context[xbrli:scenario/xbrldi:typedMember[fn:resolve-QName(string(@dimension), .) =
  (xs:QName('ocw-dim:EquityIndividualSpecificationAxis'),
   xs:QName('ocw-dim:PropertyPlantEquipmentDepreciationSpecificationAxis'),
   xs:QName('ocw-dim:RealEstateEconomicValueSpecificationAxis'),
   xs:QName('ocw-dim:ContingentLiabilitiesSpecificationAxis'),
   xs:QName('ocw-dim:ContingentAssetsSpecificationAxis'),
   xs:QName('ocw-dim:ProvisionsIndividualSpecificationAxis'),
   xs:QName('ocw-dim:LiabilitiesNoncurrentIndividualSpecificationAxis'),
   xs:QName('ocw-dim:ProjectSubsidyFinancialSpecificationAxis'))]]

When we rewrite the original XPath expression to the equivalent XPath below, as a workaround, the error goes away:

/xbrli:xbrl/xbrli:context[xbrli:scenario/xbrldi:typedMember[
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:EquityIndividualSpecificationAxis')) or 
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:PropertyPlantEquipmentDepreciationSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:RealEstateEconomicValueSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:ContingentLiabilitiesSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:ContingentAssetsSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:ProvisionsIndividualSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:LiabilitiesNoncurrentIndividualSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:RelatedPartySpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:GrantSpecificationAxis')) or
fn:resolve-QName(string(@dimension), .) = (xs:QName('ocw-dim:ProjectSubsidyFinancialSpecificationAxis'))]]

Files

InstanceMinimal.xbrl (1.14 KB) InstanceMinimal.xbrl Chris de Vreeze, 2017-03-31 16:19

Please register to edit this issue

Also available in: Atom PDF