[Unicode]   Common Locale Data Repository : Bug Tracking Home | Site Map | Search

CLDR Ticket #9828(accepted)

Opened 2 years ago

Last modified 3 months ago

Fragile code in PathHeader

Reported by: mark Owned by: emmons
Component: to-assess Data Locale:
Phase: rc Review:
Weeks: Data Xpath:


PathHeader maps from a currency code to a likely territory, then from likely territories to subcontinents.

The code is extremely fragile, since it contain mapping tables that don't use the territory codes, but instead the English names.

            Object[][] sctc = {
                    { "Northern America", "North America (C)" },
                    { "Central America", "North America (C)" },
                    { "Caribbean", "North America (C)" },
                    { "South America", "South America (C)" },
            final Map<String, String> subContinentToContinent = CldrUtility.asMap(sctc);
                    if (territory.equals("ZZ")) {
                        order = 999;
                        subContinent = englishFile.getName(CLDRFile.TERRITORY_NAME, territory);
                    } else {
                        subContinent = catFromTerritory.transform(territory);

                    String result = subContinentToContinent.get(subContinent); //the continent is the last word in the territory representation

where catFromTerritory is:

                public String transform(String source) {
                    String territory = hyphenSplitter.split(source);
                    String container = Containment.getContainer(territory);
                    order = Containment.getOrder(territory);
                    return englishFile.getName(CLDRFile.TERRITORY_NAME, container);

The map sctc should map the internal codes, NOT the English names.


Change History

comment:1 Changed 2 years ago by mark

  • Status changed from new to accepted
  • Cc emmons added
  • Priority changed from assess to major
  • Milestone changed from UNSCH to 31
  • Owner changed from anybody to emmons
  • type changed from unknown to tools

Talk to me about any questions

comment:2 Changed 2 years ago by emmons

  • Phase changed from dsub to rc

comment:3 Changed 2 years ago by emmons

  • Milestone changed from 31 to 32

comment:4 Changed 18 months ago by emmons

  • Milestone changed from 32 to upcoming

comment:5 Changed 10 months ago by emmons

  • Milestone changed from upcoming to UNSCH

comment:6 Changed 3 months ago by mark

  • Component changed from unknown to to-assess

Add a comment

Modify Ticket

as accepted

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.