Project

Profile

Help

Bug #3525

closed

Reflexive extension function returning byte[]

Added by Michael Kay about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2017-11-14
Due date:
% Done:

100%

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

Description

When a reflexive extension function has a return type of byte[], the values are converted to XPath xs:integer instances in the range 0-255: that is, the bytes are treated as unsigned. This is not the case if the return type is simply byte or Byte. Moreover, the return values are annotated as instances of xs:byte, which is incorrect in the case of values such as 255, because these are outside the range of an xs:byte.

The problem is exposed by the extension functions saxon:hexBinary-to-octets and saxon:base64Binary-to-octets, which are implemented as reflexive extension functions with a declared return type of byte[], yet are documented to return a sequence of integers in the range 0-255. These integers are incorrectly annotated as xs:byte instances; moreover it seems the static type inferencing assumes a static type of xs:byte*.

Note there is a danger that changing the behaviour here could break existing applications.


Related issues

Related to Saxon - Bug #3818: Reflexive java functions vs byte arraysClosedMichael Kay2018-06-12

Actions

Please register to edit this issue

Also available in: Atom PDF