Skip to content

Commit

Permalink
CLDR-17144 Disable all CLDRModify -f except -fQ/-fP/-fV (#3502)
Browse files Browse the repository at this point in the history
-Revise checkSuboptions to throw IllegalArgumentException for FIX other than Q, P, V
  • Loading branch information
btangmu authored Feb 14, 2024
1 parent d6ec5ba commit 54b4262
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ public static void main(String[] args) throws Exception {
System.out.println(HELP_TEXT1 + fixList.showHelp() + HELP_TEXT2);
return;
}
checkSuboptions(options[FIX], fixList.getOptions());
checkSuboptions(options[JOIN_ARGS], allMergeOptions);
checkSuboptions(FIX, fixList.getOptions());
checkSuboptions(JOIN_ARGS, allMergeOptions);
String recurseOnDirectories = options[ALL_DIRS].value;
boolean makeResolved = options[RESOLVE].doesOccur; // Utility.COMMON_DIRECTORY + "main/";

Expand Down Expand Up @@ -638,7 +638,8 @@ public Retention getRetention(String path) {
Splitter.on(Pattern.compile("[,;|]")).trimResults().omitEmptyStrings();
protected static final boolean NUMBER_SYSTEM_HACK = true;

private static void checkSuboptions(UOption givenOptions, UnicodeSet allowedOptions) {
private static void checkSuboptions(int i, UnicodeSet allowedOptions) {
UOption givenOptions = options[i];
if (givenOptions.doesOccur && !allowedOptions.containsAll(givenOptions.value)) {
throw new IllegalArgumentException(
"Illegal sub-options for "
Expand All @@ -648,6 +649,15 @@ private static void checkSuboptions(UOption givenOptions, UnicodeSet allowedOpti
+ CldrUtility.LINE_SEPARATOR
+ "Use -? for help.");
}
if (i == FIX) {
final UnicodeSet allowedFilters = new UnicodeSet().add('P').add('Q').add('V');
for (char c : givenOptions.value.toCharArray()) {
if (!allowedFilters.contains(c)) {
throw new IllegalArgumentException(
"The filter " + c + " is currently disabled, see CLDR-17144");
}
}
}
}

private static void removePosix(CLDRFile toMergeIn) {
Expand Down

0 comments on commit 54b4262

Please sign in to comment.