value = sdFormat.parse(dateValue);
// OK
} catch (ParseException e)
{ // Error
log.info("Parsing '{}' to Date ("+datePattern+") failed for column {}. Message is "+e.toString(), value, getName());
throw new FieldIllegalValueException(this, String.valueOf(value), e);
}
}
break;
case DECIMAL:
if (value==null)
break;
if (!(value instanceof java.lang.Number))
{ try
{ // Convert to String and check
value = ObjectUtils.toDecimal(value);
// throws NumberFormatException if not a number!
} catch (NumberFormatException e)
{
log.info("Parsing '{}' to Decimal failed for column {}. Message is "+e.toString(), value, getName());
throw new FieldIllegalValueException(this, String.valueOf(value), e);
}
}
// validate Number
validateNumber(type, (Number)value);
break;
case FLOAT:
if (value==null)
break;
if (!(value instanceof java.lang.Number))
{ try
{ // Convert to String and check
value = ObjectUtils.toDouble(value);
// throws NumberFormatException if not a number!
} catch (NumberFormatException e)
{
log.info("Parsing '{}' to Double failed for column {}. Message is "+e.toString(), value, getName());
throw new FieldIllegalValueException(this, String.valueOf(value), e);
}
}
// validate Number
validateNumber(type, (Number)value);
break;
case INTEGER:
if (value==null)
break;
if (!(value instanceof java.lang.Number))
{ try
{ // Convert to String and check
value = ObjectUtils.toLong(value);
// throws NumberFormatException if not an integer!
} catch (NumberFormatException e)
{
log.info("Parsing '{}' to Integer failed for column {}. Message is "+e.toString(), value, getName());
throw new FieldIllegalValueException(this, String.valueOf(value), e);
}
}
// validate Number
validateNumber(type, (Number)value);
break;