Commit 943d0c49 by Tuomas Riihimäki

GenericIntegerEntityConvert to support null values...

1 parent 46437a83
...@@ -58,9 +58,15 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int ...@@ -58,9 +58,15 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
T ret = null; T ret = null;
Integer id = null; Integer id = null;
if (value != null) { if (value != null) {
id = Integer.parseInt(value); try {
if (id != null) { id = Integer.parseInt(value);
ret = find(id); if (id != null) {
ret = find(id);
}
} catch (NumberFormatException nfe) {
if (value == null || !value.equals("null")) {
throw nfe;
}
} }
} }
logger.debug("Converted String {} to Integer {} became object {}", new Object[] { value, id, ret }); logger.debug("Converted String {} to Integer {} became object {}", new Object[] { value, id, ret });
...@@ -78,6 +84,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int ...@@ -78,6 +84,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
ret = entity.getId().toString(); ret = entity.getId().toString();
} }
} }
if (ret == null)
{
ret = "null";
}
return ret; return ret;
} }
// //
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!