Skip to content

Commit

Permalink
CLDR-16158 synchronize CheckCLDR in TestCache (#3772)
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored Jun 3, 2024
1 parent f2ab09e commit 5fcd56c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tools/cldr-code/src/main/java/org/unicode/cldr/test/TestCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ protected TestResultBundle(CheckCLDR.Options cldrOptions) {
options = cldrOptions;
pathCache = new ConcurrentHashMap<>();
file = getFactory().make(options.getLocale().getBaseName(), true);
cc.setCldrFileToCheck(file, options, possibleProblems);
synchronized (cc) {
cc.setCldrFileToCheck(file, options, possibleProblems);
}
}

/**
Expand All @@ -68,12 +70,14 @@ public void check(String path, List<CheckStatus> result, String value) {
key,
(Pair<String, String> k) -> {
List<CheckStatus> l = new ArrayList<CheckStatus>();
cc.check(
k.getFirst(),
file.getFullXPath(k.getFirst()),
k.getSecond(),
options,
l);
synchronized (cc) {
cc.check(
k.getFirst(),
file.getFullXPath(k.getFirst()),
k.getSecond(),
options,
l);
}
return l;
});
if (cachedResult != null) {
Expand All @@ -82,7 +86,9 @@ public void check(String path, List<CheckStatus> result, String value) {
}

public void getExamples(String path, String value, List<CheckStatus> result) {
cc.getExamples(path, file.getFullXPath(path), value, options, result);
synchronized (cc) {
cc.getExamples(path, file.getFullXPath(path), value, options, result);
}
}

public List<CheckStatus> getPossibleProblems() {
Expand Down

0 comments on commit 5fcd56c

Please sign in to comment.