From a38b3bb168ada993bad1889ff5c42c3fc6b930f9 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Mon, 3 Jun 2024 10:05:05 -0500 Subject: [PATCH] CLDR-16158 synchronize CheckCLDR in TestCache - the data store on success is synchronized, but not the actual test itself --- .../java/org/unicode/cldr/test/TestCache.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestCache.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestCache.java index 724a13bfea1..4d4a249eb37 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestCache.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/TestCache.java @@ -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); + } } /** @@ -68,12 +70,14 @@ public void check(String path, List result, String value) { key, (Pair k) -> { List l = new ArrayList(); - 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) { @@ -82,7 +86,9 @@ public void check(String path, List result, String value) { } public void getExamples(String path, String value, List result) { - cc.getExamples(path, file.getFullXPath(path), value, options, result); + synchronized (cc) { + cc.getExamples(path, file.getFullXPath(path), value, options, result); + } } public List getPossibleProblems() {