Skip to content

Commit

Permalink
CLDR-17346 ConsoleCheckCLDR fix for null xpath
Browse files Browse the repository at this point in the history
- could be surfaced by CLDR-17560 but more related to the code in this ticket
  • Loading branch information
srl295 committed Apr 29, 2024
1 parent 326a545 commit d7ed659
Showing 1 changed file with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1781,9 +1781,9 @@ private static String getIdString(String path, String value) {
private static void showValue(
CLDRFile cldrFile,
String prettyPath,
String localeID,
final String localeID,
String example,
String path,
final String path,
String value,
String fullPath,
String statusString,
Expand Down Expand Up @@ -2031,27 +2031,30 @@ private static String guessFilePath(Pair<String, String> locPath) {
final File base = new File(CLDRPaths.BASE_DIRECTORY);
final String loc = locPath.getFirst();
final String path = locPath.getSecond();
String subdir = "main";
if (path.startsWith("//ldml/annotations")) {
subdir = "annotations";
} else if (path.startsWith("//ldml/subdivisions")) {
subdir = "subdivisions";
}
File inCommon = new File(base, "common");
File subsub = new File(inCommon, subdir);
if (subsub.isDirectory()) {
File subFile = new File(subsub, loc + ".xml");
if (subFile.canRead())
return subFile.getAbsolutePath().substring(base.getAbsolutePath().length() + 1);
}
if (path != null) {
String subdir = "main";
if (path.startsWith("//ldml/annotations")) {
subdir = "annotations";
} else if (path.startsWith("//ldml/subdivisions")) {
subdir = "subdivisions";
}
File inCommon = new File(base, "common");
File subsub = new File(inCommon, subdir);
if (subsub.isDirectory()) {
File subFile = new File(subsub, loc + ".xml");
if (subFile.canRead())
return subFile.getAbsolutePath().substring(base.getAbsolutePath().length() + 1);
}

File inSeed = new File(base, "seed");
subsub = new File(inSeed, subdir);
if (subsub.isDirectory()) {
File subFile = new File(subsub, loc + ".xml");
if (subFile.canRead())
return subFile.getAbsolutePath().substring(base.getAbsolutePath().length() + 1);
File inSeed = new File(base, "seed");
subsub = new File(inSeed, subdir);
if (subsub.isDirectory()) {
File subFile = new File(subsub, loc + ".xml");
if (subFile.canRead())
return subFile.getAbsolutePath().substring(base.getAbsolutePath().length() + 1);
}
}
// no XPath - could be an entire-locale error.
return loc + ".xml";
}

Expand Down

0 comments on commit d7ed659

Please sign in to comment.