Project

Profile

Help

Bug #1579

closed

ArrayIndexOutOfBounds Exception thrown when function-lookup() retrieves the name() function

Added by O'Neil Delpratt almost 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Internals
Sprint/Milestone:
-
Start date:
2012-07-11
Due date:
% Done:

100%

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

Description

The following query (taken from W3C FOTS:fn-function-lookup-264) causes Saxon to throw an ArrayIndexOutOfBounds Exception:

/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'name'), 0)()

Similar failures will occur when retrieving other functions that have an implicit first argument.

The stack trace of the exception thrown is as follows:

at net.sf.saxon.functions.NameFn.evaluateItem(NameFn.java:33)
	at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
	at com.saxonica.functions.hof.FirstClassFunction.invoke(FirstClassFunction.java:104)
	at com.saxonica.functions.hof.DynamicFunctionCallDefinition$DynamicFunctionCall.call(DynamicFunctionCallDefinition.java:158)
	at net.sf.saxon.functions.IntegratedFunctionCall.iterate(IntegratedFunctionCall.java:235)
	at net.sf.saxon.value.MemoClosure.iterate(MemoClosure.java:105)
	at net.sf.saxon.value.Value.asIterator(Value.java:127)
	at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:442)
	at net.sf.saxon.expr.SlashExpression.map(SlashExpression.java:712)
	at net.sf.saxon.expr.ContextMappingIterator.next(ContextMappingIterator.java:54)
	at net.sf.saxon.tree.iter.HomogeneityCheckerIterator.next(HomogeneityCheckerIterator.java:60)
	at net.sf.saxon.query.XQueryExpression$ErrorReportingIterator.next(XQueryExpression.java:917)
	at net.sf.saxon.value.SequenceExtent.<init>(SequenceExtent.java:105)
	at net.sf.saxon.value.SequenceExtent.makeSequenceExtent(SequenceExtent.java:147)
	at net.sf.saxon.s9api.XQueryEvaluator.evaluate(XQueryEvaluator.java:379)
	at com.saxonica.testdriver.FOTestSuiteDriver.runTestCase(FOTestSuiteDriver.java:1142)
Actions #1

Updated by O'Neil Delpratt almost 12 years ago

  • Category set to Internals
  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Bug fixed. Fix applied in the FunctionLookup class

Actions #2

Updated by O'Neil Delpratt almost 12 years ago

Change committed to svn repository.

Actions #3

Updated by Michael Kay almost 12 years ago

Note that the effect of the fix is that when function-lookup() locates a context-sensitive function such as name#0, it now fails cleanly (for example, saying that the context item is not available) rather than crashing. Since 9.4 was released, the specification of function-lookup() when applied to such functions has been clarified, and the revised specification will be implemented in a future Saxon release.

Actions #4

Updated by Michael Kay almost 12 years ago

  • Subject changed from ArrayIndexOutOfBounds Exception thrown in function-lookup-264 test case to ArrayIndexOutOfBounds Exception thrown when function-lookup() retrieves the name() function
  • Description updated (diff)
Actions #5

Updated by O'Neil Delpratt over 11 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 9.4.0.6

Please register to edit this issue

Also available in: Atom PDF