From dd930c573b2822e7f55e9d1b9a945a023c3fdee6 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Mon, 8 Apr 2024 16:26:02 +0000 Subject: [PATCH] 8329787: Fix typo in CLDRConverter Reviewed-by: jlu, iris, lancea, bpb --- .../tools/cldrconverter/CLDRConverter.java | 4 +- ...java => SupplementalDataParseHandler.java} | 43 ++++++------------- .../SupplementalMetadataParseHandler.java | 4 +- 3 files changed, 17 insertions(+), 34 deletions(-) rename make/jdk/src/classes/build/tools/cldrconverter/{SupplementDataParseHandler.java => SupplementalDataParseHandler.java} (88%) diff --git a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java index 2fb45bec1d3..8d39ef4c1d5 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java @@ -97,7 +97,7 @@ public class CLDRConverter { private static final String DST = "dst"; private static final String NO_SUBST = "-"; - private static SupplementDataParseHandler handlerSuppl; + private static SupplementalDataParseHandler handlerSuppl; private static LikelySubtagsParseHandler handlerLikelySubtags; private static WinZonesParseHandler handlerWinZones; static PluralsParseHandler handlerPlurals; @@ -471,7 +471,7 @@ public class CLDRConverter { // SupplementalData file also provides the "parent" locales which // are othrwise not to be fallen back. Process them here as well. // - handlerSuppl = new SupplementDataParseHandler(); + handlerSuppl = new SupplementalDataParseHandler(); parseLDMLFile(new File(SPPL_SOURCE_FILE), handlerSuppl); Map parentData = handlerSuppl.getData("root"); parentData.keySet().stream() diff --git a/make/jdk/src/classes/build/tools/cldrconverter/SupplementDataParseHandler.java b/make/jdk/src/classes/build/tools/cldrconverter/SupplementalDataParseHandler.java similarity index 88% rename from make/jdk/src/classes/build/tools/cldrconverter/SupplementDataParseHandler.java rename to make/jdk/src/classes/build/tools/cldrconverter/SupplementalDataParseHandler.java index a2b5bd39ae2..f4d20160ffb 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/SupplementDataParseHandler.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/SupplementalDataParseHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,11 +38,11 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * Handles parsing of files in Locale Data Markup Language for SupplementData.xml + * Handles parsing of files in Locale Data Markup Language for supplementalData.xml * and produces a map that uses the keys and values of JRE locale data. */ -class SupplementDataParseHandler extends AbstractLDMLHandler { +class SupplementalDataParseHandler extends AbstractLDMLHandler { //UNM49 region and composition code used in supplementalData.xml private static final String WORLD = "001"; @@ -73,7 +73,7 @@ class SupplementDataParseHandler extends AbstractLDMLHandler { // "component" specific to this parent locale chain private String currentParentLocaleComponent; - SupplementDataParseHandler() { + SupplementalDataParseHandler() { firstDayMap = new HashMap<>(); minDaysMap = new HashMap<>(); parentLocalesMap = new HashMap<>(); @@ -132,32 +132,15 @@ class SupplementDataParseHandler extends AbstractLDMLHandler { switch (qName) { case "firstDay": if (!isIgnored(attributes)) { - String fd; - - switch (attributes.getValue("day")) { - case "sun": - fd = "1"; - break; - default: - case "mon": - fd = "2"; - break; - case "tue": - fd = "3"; - break; - case "wed": - fd = "4"; - break; - case "thu": - fd = "5"; - break; - case "fri": - fd = "6"; - break; - case "sat": - fd = "7"; - break; - } + String fd = switch (attributes.getValue("day")) { + case "sun" -> "1"; + case "tue" -> "3"; + case "wed" -> "4"; + case "thu" -> "5"; + case "fri" -> "6"; + case "sat" -> "7"; + default -> "2"; // Mon + }; firstDayMap.put(attributes.getValue("territories"), fd); } break; diff --git a/make/jdk/src/classes/build/tools/cldrconverter/SupplementalMetadataParseHandler.java b/make/jdk/src/classes/build/tools/cldrconverter/SupplementalMetadataParseHandler.java index 43016f424c6..101ee81b256 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/SupplementalMetadataParseHandler.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/SupplementalMetadataParseHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ import org.xml.sax.SAXException; /** * Handles parsing of files in Locale Data Markup Language for - * SupplementalMetadata.xml + * supplementalMetadata.xml */ class SupplementalMetadataParseHandler extends AbstractLDMLHandler {