-
1. Re: decimal replaces with comma (34.00 is replace 34,00)
jaikiran Dec 30, 2016 9:37 AM (in response to mdelson)Which exact version of WildFly? Please post the entire exception stacktrace. Also, how and where are you providing that numeric value?
-
2. Re: decimal replaces with comma (34.00 is replace 34,00)
ctomc Dec 30, 2016 10:19 AM (in response to mdelson)Micheal Delson Nadar wrote:
<system-properties>
<property name="org.jboss.dashboard.LocaleManager.installedLocaleIds" value="en,es,de,fr,ja,pt"/>
<property name="org.jboss.dashboard.LocaleManager.defaultLocaleId" value="en"/>
</system-properties>
Why did you set this system properties? They do noting for WildFly at all.
-
3. Re: decimal replaces with comma (34.00 is replace 34,00)
mdelson Jan 3, 2017 1:46 AM (in response to ctomc)Thanks for the reply. I thought may be setting the system locale should help which actually didn't.
WildFly Version : wildfly-10.0.0.Final
Java Version : jdk1.8.0_72
we have only NumberFormatException seen as posted in initial post. There is no additional exception seen in server log.
we are using below code to change the number format
DecimalFormat amtFormat = new DecimalFormat("0.00");
......
...
double availableCredit = result.getDouble("AVAILABLE_CREDIT");
form.setAvailableCredit(amtFormat.format(availableCredit));
-
4. Re: decimal replaces with comma (34.00 is replace 34,00)
pferraro Jan 3, 2017 9:25 AM (in response to mdelson)The DecimalFormat constructor used above will use a locale specific DecimalFormatSymbols, specifically, the instance returned via: DecimalFormatSymbols (Java Platform SE 8 )
More details regarding locales and how to set the default locale for the JVM can be found here:
Internationalization: Understanding Locale in the Java Platform
-
5. Re: decimal replaces with comma (34.00 is replace 34,00)
mdelson Jan 4, 2017 2:52 AM (in response to pferraro)Will follow the link and confirm.Thank you.
-
6. Re: decimal replaces with comma (34.00 is replace 34,00)
anil_ch_jboss Mar 7, 2017 2:30 PM (in response to mdelson)Hi Micheal,
We are facing a similar issue, which works for 2-3 hrs after restart and later get the same decimal format error. Was your issue resolved and what was the change done?
-
7. Re: decimal replaces with comma (34.00 is replace 34,00)
mdelson Mar 8, 2017 2:02 AM (in response to anil_ch_jboss)we have resolved by handling the same at the code level
=====================static method===========================
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
public class CustomNumberFormat
{
public static DecimalFormat decFormat = null;
static
{
decFormat = (DecimalFormat) NumberFormat.getNumberInstance(new Locale("en", "UK"));
}
public static String twoDecimalFormat (double inValue)
{
String outValue = null;
try
{
decFormat.applyPattern("#0.00");
outValue = decFormat.format (inValue);
} catch (Exception e) {
}
return outValue;
}
public static String oneDecimalFormat (String inValue)
{
String outValue = null;
try
{
double parseValue = Double.parseDouble (inValue);
decFormat.applyPattern("#0.0");
outValue = decFormat.format (parseValue);
} catch (Exception e) {
}
return outValue;
}
================================================
call the same where ever needed as below
CustomNumberFormat.twoDecimalFormat(Double.parseDouble(resultTableData.get(i).get("MY_AMOUNT").toString()))