Project

Profile

Help

Bug #4490

closed

NPE in getItemType if type hierarchy is null for merged maps.

Added by Reece Dunn about 4 years ago. Updated over 3 years ago.

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

100%

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

Description

I have a query that is merging two maps:

    map:merge(($module-namespaces, $xquery-namespaces))

Here, the first map has attribute-based keys, while the second has xs:string based keys.

That query succeeds. However, when I call Item.getItemType with a null type hierarchy I get the following exception in Saxon 9.9.1.7:

Caused by: java.lang.NullPointerException
	at net.sf.saxon.type.Type.getCommonSuperType(Type.java:374)
	at net.sf.saxon.ma.map.HashTrieMap.getItemType(HashTrieMap.java:280)
	at net.sf.saxon.ma.map.HashTrieMap.getItemType(HashTrieMap.java:32)
	at net.sf.saxon.type.Type.getItemType(Type.java:213)

Looking at the source code for Type.getCommonSuperType at line 374, it is calling

int r = th.relationship(t1, t2);

without checking that th is null (which is allowed per the documentation on Type.getItemType).

This issue is also present in Saxon 10. The only difference is that the return type has changed to Affinity.

Please register to edit this issue

Also available in: Atom PDF