Skip to content
Snippets Groups Projects
Commit 23cacaef authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

better double parsing management

parent c9f9bf62
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,11 @@ public class ParsingTool implements ParsingUtil {
public static final double parseDouble(String str) {
double value;
if ((str == null) || NAN.equalsIgnoreCase(str) || str.trim().isEmpty()) {
if (str == null) {
value = Double.NaN;
} else {
str = str.trim();
if (NAN.equalsIgnoreCase(str) || str.isEmpty()) {
value = Double.NaN;
} else if (INFINITY.equalsIgnoreCase(str) || POSITIVE_INFINITY.equalsIgnoreCase(str)) {
value = Double.POSITIVE_INFINITY;
......@@ -134,6 +138,7 @@ public class ParsingTool implements ParsingUtil {
} else {
value = Double.parseDouble(str);
}
}
return value;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment