-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
None
e.g. Classes.coerce("1.0", Number.class) will rise a NumberFormatException.
Our workaround for this issue is as following:
{{public static Object coerce(final Class<?> clazz, Object val) throws ClassCastException {
if (val instanceof String && String.class != clazz) {
try
catch (NumberFormatException e) {
if (Boolean.class == clazz)
else
{ val = null; } }
}
return Classes.coerce(clazz, val);
}}}
It makes conversions much more robust. Could this be a general approach for ZK core?