Project

Profile

Help

Bug #4449

closed

NPE in CaseVariants

Added by Vladimir Nesterovsky almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Multithreading
Sprint/Milestone:
-
Start date:
2020-02-02
Due date:
% Done:

100%

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

Description

During the transformation I got an exception:

Caused by: java.lang.NullPointerException
  at net.sf.saxon.regex.CaseVariants.getCaseVariants(CaseVariants.java:98)
  at net.sf.saxon.regex.REMatcher.equalCaseBlind(REMatcher.java:715)
  at net.sf.saxon.regex.Operation$OpAtom.iterateMatches(Operation.java:631)
  at net.sf.saxon.regex.Operation$OpUnambiguousRepeat.iterateMatches(Operation.java:774)
  at net.sf.saxon.regex.REMatcher.checkPreconditions(REMatcher.java:482)
  at net.sf.saxon.regex.REMatcher.match(REMatcher.java:385)
  at net.sf.saxon.regex.ARegularExpression.containsMatch(ARegularExpression.java:89)
  at net.sf.saxon.functions.Matches.call(Matches.java:78)
  at net.sf.saxon.functions.Matches.call(Matches.java:24)

It has happened once only and is not reproducible.

From looking into CaseVariants.getCaseVariants()

    public static int[] getCaseVariants(int code) {
        if (monoVariants == null) {
            build();
        }
        int mono = monoVariants.get(code);
        if (mono != monoVariants.getDefaultValue()) {
            return new int[]{mono};
        } else {
            int[] result = polyVariants.get(code); <-------------- NPE is here
            if (result == null) {
                return IntArraySet.EMPTY_INT_ARRAY;
            } else {
                return result;
            }
        }
    }
...

    private static IntToIntMap monoVariants = null;
    private static IntHashMap<int[]> polyVariants = null;


    static void build() {

        monoVariants = new IntToIntHashMap(2500);
        polyVariants = new IntHashMap<>(100);
...

I can guess the only reason: race between threads.

Please register to edit this issue

Also available in: Atom PDF