Actions
Bug #4449
closedNPE in CaseVariants
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.
Updated by Michael Kay almost 5 years ago
- Category set to Multithreading
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch trunk added
Yes, I think you're right, this method should be synchronized. Thanks for reporting it.
Updated by Michael Kay almost 5 years ago
I have checked other similar methods. Some are already synchronized, but the following need to be changed:
- Categories.getCategory()
- Initialization code in Normalizer.java constructor
Updated by Michael Kay almost 5 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 9.9, trunk added
Updated by O'Neil Delpratt over 4 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.9.1.7 added
Patch applied in the 9.9.1.7 maintenance release.
Please register to edit this issue
Actions