Commit ac68e8bf authored by ortizh's avatar ortizh
Browse files

Catch exception thrown when trying to format a invalid float value

(avoid a client crash : see brisp 03 nov 2016). 
parent af78cc13
3.0.5-SNAPSHOT
--------------
* Catch exception thrown when trying to format a invalid float value (avoid a client crash : see brisp 03 nov 2016).
3.0.4
-----
......
......@@ -29,10 +29,16 @@ public class Float64Property extends FloatProperty {
}
public String getServerValue() {
if (isCommandBox) {
return this.propertyFormat.formatForDisplay(new Double(AtomicCommandBoxAccessorProxy.getInstance(serverId).getFloat64Value(containerId, id)).toString());
} else {
return this.propertyFormat.formatForDisplay(new Double(DataAccessor.getInstance(serverId).getFloat64Value(containerId, id)).toString());
try {
if (isCommandBox) {
return this.propertyFormat.formatForDisplay(new Double(AtomicCommandBoxAccessorProxy.getInstance(serverId).getFloat64Value(containerId, id)).toString());
} else {
return this.propertyFormat.formatForDisplay(new Double(DataAccessor.getInstance(serverId).getFloat64Value(containerId, id)).toString());
}
} catch (Exception e) {
System.err.println("Exception while getting value for property " + getName());
ConfigManager.CONFIGURATION_ERROR = true;
return "";
}
}
......
......@@ -50,7 +50,12 @@ public class DecimalFormat extends PropertyFormat {
"0.000000",
"0.0000000",
"0.00000000",
"0.000000000"};
"0.000000000",
"0.0000000000",
"0.00000000000",
"0.000000000000",
"0.0000000000000"
};
public DecimalFormat(int numberOfDecimalPlaces, boolean isScientific) {
......@@ -120,8 +125,6 @@ public class DecimalFormat extends PropertyFormat {
} else {
df = new java.text.DecimalFormat(decimalDisplayFormats[nbOfDecimalPlaces]);
}
return df.format(valueAsDouble);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment