catch number parse exception in literal creation

This commit is contained in:
Jörg Prante 2018-01-30 00:33:24 +01:00
parent f065ce40bd
commit 6f932191b6
2 changed files with 20 additions and 15 deletions

View file

@ -94,10 +94,12 @@ public class DefaultLiteral implements Literal, Comparable<Literal> {
return value;
}
String s = value.toString();
try {
switch (type.toString()) {
case "xsd:long":
return Long.parseLong(s);
case "xsd:int":
return Integer.parseInt(s);
case "xsd:gYear":
return Integer.parseInt(s);
case "xsd:boolean":
@ -109,6 +111,9 @@ public class DefaultLiteral implements Literal, Comparable<Literal> {
default:
return s;
}
} catch (NumberFormatException e) {
return null;
}
}
@Override

View file

@ -1,6 +1,6 @@
group = org.xbib
name = content
version = 1.2.1
version = 1.2.2
jackson.version = 2.8.11
xbib-net.version = 1.0.0