Database float unpack

Better unpacking checks of floats coming back from the database
This commit is contained in:
Douglas Gillespie 2023-04-06 21:43:20 +01:00
parent a2da810690
commit 30fbc6d290
2 changed files with 10 additions and 1 deletions

View File

@ -16,7 +16,7 @@ public enum ReprocessStoreChoice {
public String toString() {
switch (this) {
case STARTNORMAL:
return "Start normally. No risk of overwriting";
return "Start normally. Note risk of overwriting!";
case CONTINUECURRENTFILE:
return "Continue from start of last input file processed";
case CONTINUENEXTFILE:

View File

@ -488,6 +488,15 @@ public class PamTableItem implements Cloneable {
if (value == null) {
return Float.NaN;
}
if (value instanceof String) {
try {
double val = Double.valueOf((String) value);
return (float) val;
}
catch (NumberFormatException ex) {
return Float.NaN;
}
}
if (value.getClass() == Double.class) {
double dVal = (Double) value;
return (float) dVal;