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

CLDR Ticket #9828(accepted tools)

Opened 7 months ago

Last modified 3 months ago

Fragile code in PathHeader

Reported by: mark Owned by: emmons
Component: unknown Data Locale:
Phase: rc Review:
Weeks: Data Xpath:
Xref:

Description

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.

Attachments

Change History

comment:1 Changed 7 months 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 3 months ago by emmons

  • Phase changed from dsub to rc

comment:3 Changed 3 months ago by emmons

  • Milestone changed from 31 to 32
View

Add a comment

Modify Ticket

Action
as accepted
Author


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

 
Note: See TracTickets for help on using tickets.