Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.2
-
None
-
None
Description
The createNumber() method in the TypeHandler class expects the decimal separator to be a dot ('.'). However the dot is not used in all the languages as a decimal separator. Most of the European countries, Russia and a lot of others countries uses a comma (',').
With the corresponding Locale, the createNumber() method fails, throwing an exception.
For example:
Type.java
public class Type { public static void main(final String[] args) { java.util.Locale.setDefault(java.util.Locale.GERMANY); String text = java.text.NumberFormat.getNumberInstance().format(12.34); Number nb = org.apache.commons.cli.TypeHandler.createNumber(text); System.out.println(nb); } }