Skip to content

Commit

Permalink
CLDR-17535 Handle 4 edge cases with logKnownIssue for now
Browse files Browse the repository at this point in the history
  • Loading branch information
macchiati committed Aug 19, 2024
1 parent 453e44d commit 2765312
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;
import com.ibm.icu.util.ICUUncheckedIOException;
import com.ibm.icu.util.Output;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -260,7 +260,7 @@ private Map<String, LSRSource> readJson() {
processErrors.data = CldrUtility.protectCollection(processErrors.data);
return CldrUtility.protectCollection(result);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
throw new ICUUncheckedIOException(ex);
}
}

Expand Down Expand Up @@ -315,7 +315,7 @@ private Multimap<String, String> readWikidata() {
}
});
} catch (IOException ex) {
throw new UncheckedIOException(ex);
throw new ICUUncheckedIOException(ex);
}
return ImmutableMultimap.copyOf(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ void add(LanguageTagParser ltp, boolean source) {
final LanguageTagParser maxLtp = new LanguageTagParser();
final LanguageTagParser sourceLtp = new LanguageTagParser();

final Set<String> KNOWN_ERRORS = Set.of("en_Latn_MU", "en_Latn_SL", "en_Latn_TK", "en_Latn_ZM");
/**
* Return false if we should skip the language
*
Expand Down Expand Up @@ -206,15 +207,22 @@ public boolean checkAdding(String source) {
sourceLtp.setRegion(maxLtp.getRegion());
}
String test = sourceLtp.toString();
final String maximize = LIKELY.maximize(test);
String maximize = LIKELY.maximize(test);
if (!max.equals(maximize)) {
// max(source) = max, max(test) ≠ max
if (!assertEquals(
String.format(
"checkAdding: max(%s)->%s, however max(%s)->", source, max, test),
max,
maximize)) {
// LIKELY.maximize(test); // Could step into this for debugging.
if (KNOWN_ERRORS.contains(maximize)) {
logKnownIssue("CLDR-17897", "Fix GenerateLikelySubtags.java");
continue;
}
if (!max.equals(maximize)) {
// max(source) = max, max(test) ≠ max
if (!assertEquals(
String.format(
"checkAdding: max(%s)->%s, however max(%s)->",
source, max, test),
max,
maximize)) {
// LIKELY.maximize(test); // Could step into this for debugging.
}
}
}
sourceLtp.set(source); // restore
Expand Down

0 comments on commit 2765312

Please sign in to comment.