| Code with Finding: |
class NumberMetaFormat {
/**
* Create the "integer" NumberFormat instance for the specified Locale.
*
* @param locale the Locale to use
* @return integer NumberFormat
*/
private static NumberFormat createIntegerInstance(Locale locale) {
if (GET_INTEGER_INSTANCE != null) {
try {
return (NumberFormat) GET_INTEGER_INSTANCE.invoke(null, new Object[] { locale });
} catch (IllegalAccessException e) {
//fall through
} catch (InvocationTargetException e) {
//fall through
}
}
NumberFormat result = NumberFormat.getInstance(locale);
result.setMaximumFractionDigits(0);
result.setParseIntegerOnly(true);
return result;
}
}
|