Skip to content

Commit 6fa0aa4

Browse files
committed
updated number parse bug fix
1 parent e211ed0 commit 6fa0aa4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

com.opendoorlogistics.core/src/com/opendoorlogistics/core/tables/ColumnValueProcessor.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,18 @@ public static Object convertToMe(ODLColumnType convertToMe, Object other, ODLCol
314314
}
315315

316316
try {
317-
// return Double.parseDouble((String) sOther);
318317

319-
// Changed from parseDouble to NumberFormat as this takes locale into account
320-
// and don't load correctly otherwise on French computers.
321-
NumberFormat nf = NumberFormat.getInstance();
322-
double number = nf.parse((String) sOther).doubleValue();
318+
// Test if we have a . in the number and if so, use java's parsedouble which always uses .
319+
double number=0;
320+
if(sOther.indexOf(".")!=-1){
321+
number = Double.parseDouble(sOther);
322+
}else{
323+
// If not, use the number format which takes account of localisation and will use commas in the correct country.
324+
NumberFormat nf = NumberFormat.getInstance();
325+
number = nf.parse((String) sOther).doubleValue();
326+
return number;
327+
}
328+
323329
return number;
324330
} catch (Throwable e) {
325331
return null;

0 commit comments

Comments
 (0)