|
|
|
@ -242,8 +242,9 @@ public class BuildMetadataFromXml { |
|
|
|
LOGGER.log(Level.SEVERE, |
|
|
|
"A maximum of one intlFormat pattern for a numberFormat element should be " + |
|
|
|
"defined."); |
|
|
|
throw new RuntimeException("Invalid number of intlFormat patterns for country: " + |
|
|
|
metadata.getId()); |
|
|
|
String countryId = metadata.getId().length() > 0 ? |
|
|
|
metadata.getId() : Integer.toString(metadata.getCountryCode()); |
|
|
|
throw new RuntimeException("Invalid number of intlFormat patterns for country: " + countryId); |
|
|
|
} else if (intlFormatPattern.getLength() == 0) { |
|
|
|
// Default to use the same as the national pattern if none is defined. |
|
|
|
intlFormat.mergeFrom(nationalFormat); |
|
|
|
@ -275,11 +276,13 @@ public class BuildMetadataFromXml { |
|
|
|
format.setPattern(validateRE(numberFormatElement.getAttribute(PATTERN))); |
|
|
|
|
|
|
|
NodeList formatPattern = numberFormatElement.getElementsByTagName(FORMAT); |
|
|
|
if (formatPattern.getLength() != 1) { |
|
|
|
LOGGER.log(Level.SEVERE, |
|
|
|
"Only one format pattern for a numberFormat element should be defined."); |
|
|
|
throw new RuntimeException("Invalid number of format patterns for country: " + |
|
|
|
metadata.getId()); |
|
|
|
int numFormatPatterns = formatPattern.getLength(); |
|
|
|
if (numFormatPatterns != 1) { |
|
|
|
LOGGER.log(Level.SEVERE, "One format pattern for a numberFormat element should be defined."); |
|
|
|
String countryId = metadata.getId().length() > 0 ? |
|
|
|
metadata.getId() : Integer.toString(metadata.getCountryCode()); |
|
|
|
throw new RuntimeException("Invalid number of format patterns (" + numFormatPatterns + |
|
|
|
") for country: " + countryId); |
|
|
|
} |
|
|
|
format.setFormat(formatPattern.item(0).getFirstChild().getNodeValue()); |
|
|
|
} |
|
|
|
|