Project

Profile

Help

Bug #5829

closed

NullPointerException calling XdmFunctionItem.call() on a context-dependent function

Added by Michael Kay almost 2 years ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
s9api API
Sprint/Milestone:
-
Start date:
2023-01-17
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

When a context-dependent function such as fn:local-name() is obtained using XdmFunctionItem.getSystemFunction(), a NullPointerException occurs when the function is called.

Occurs with both the Java and .NET APIs.

Actions #1

Updated by Michael Kay almost 2 years ago

Added unit tests; fixed the code to throw a SaxonApiException with error code XPDE0002.

Actions #2

Updated by Michael Kay almost 2 years ago

I have taken the opportunity to convert all the JUnit tests in TestXdmFunction into NUnit tests and run them against SaxonCS 12; this is revealing some additional minor issues.

  • XdmFunctionItem.Invoke does not throw a SaxonApiException if execution fails with a dynamic error
  • A System.InvalidCastException is thrown if the argument to a function is of the wrong type
Actions #3

Updated by Michael Kay almost 2 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 11, 12, trunk added
Actions #4

Updated by Michael Kay almost 2 years ago

I've added the new NUnit tests to the SaxonCS 11 branch as well as SaxonCS 12.

Actions #5

Updated by Michael Kay almost 2 years ago

  • Status changed from Resolved to In Progress
  • Fix Committed on Branch deleted (11, 12, trunk)

The SaxonJ method XdmFunctionItem.call() had been enhanced to apply the function conversion rules to the supplied parameters. This is not happening in SaxonCS. The actual implementation code for system functions assumes that the arguments have been type-checked, and that it can safely cast the supplied values to the required type. On SaxonCS we're throwing a Cast exception because this isn't the case.

I've now changed the C# XdmFunctionItem.Invoke() to apply the function conversion rules in the same way that SaxonJ does.

Actions #6

Updated by Michael Kay almost 2 years ago

  • Status changed from In Progress to Resolved
Actions #7

Updated by O'Neil Delpratt 12 months ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 12.1 added

Please register to edit this issue

Also available in: Atom PDF