Project

Profile

Help

Bug #4245

NullPointerException during static type checking of call to map:merge

Added by Michael Kay over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2019-07-02
Due date:
% Done:

100%

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

Description

An NPE occurs when compiling the following stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
    xmlns:my="http://www.example.com/xslt/fcn"
    exclude-result-prefixes="xs map"
    version="3.0">
    
    <xsl:template match="/">
        <xsl:variable name="map1" as="map(*)" select="map{'a':1}"/>
        <xsl:variable name="map2" as="map(*)" select="map{'b':2}"/>
        <!-- 2nd argument in map:merge() here compiles successfully. -->
        <xsl:sequence select="map:merge(($map1,$map2),map{'key-type':'string'})"/>
    </xsl:template>
    
    <xsl:function name="my:myfcn" as="map(*)">
        <xsl:variable name="map1" as="map(*)" select="map{'a':1}"/>
        <xsl:variable name="map2" as="map(*)" select="map{'b':2}"/>
        <xsl:sequence select="map:merge(($map1,$map2),map{'key-type':'string'})"/> 
    </xsl:function>
    
</xsl:stylesheet>

History

#1 Updated by Michael Kay over 2 years ago

  • Status changed from New to Resolved
  • Applies to branch 9.9 added
  • Fix Committed on Branch 9.9 added

The problem occurs because, during static analysis, the value of the options parameter is examined without first being normalized (normalization would insert a default value for the "duplicates" option).

Work-around: add an explicit value for "duplicates" in the options parameter.

The code had already been corrected on the development branch.

#2 Updated by O'Neil Delpratt over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.1.5 added

Bug fix applied in the Saxon 9.9.1.5 maintenance release.

Please register to edit this issue

Also available in: Atom PDF