Skip to content
Snippets Groups Projects
Commit d2946ed0 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-nan-in-lists' into 'dev'

F nan in lists

See merge request !32
parents 9d51e956 3a8d8d9b
No related branches found
No related tags found
2 merge requests!41REL: update changelog, bump version of pom.xml, update DEPENDENCIES,!32F nan in lists
Pipeline #13654 failed
...@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
* #127 "nan" as value (list item) in properties with data type "LIST<DOUBLE>"
return with "Cannot parse value to double" error.
* #170 Updating an abstract list-type property with a default value fails with * #170 Updating an abstract list-type property with a default value fails with
"unkown error". "unkown error".
* #145 Documentation of importances and inheritance * #145 Documentation of importances and inheritance
......
...@@ -33,16 +33,19 @@ public class DoubleDatatype extends AbstractDatatype { ...@@ -33,16 +33,19 @@ public class DoubleDatatype extends AbstractDatatype {
public SingleValue parseValue(final Object value) throws Message { public SingleValue parseValue(final Object value) throws Message {
try { try {
if (value instanceof GenericValue) { if (value instanceof GenericValue) {
return new GenericValue(Double.parseDouble(((GenericValue) value).toDatabaseString())); return parse(((GenericValue) value).toDatabaseString());
} else { } else {
String valueStr = value.toString(); return parse(value.toString());
if (valueStr.toLowerCase().equals("nan")) {
valueStr = "NaN";
}
return new GenericValue(Double.parseDouble(valueStr));
} }
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
throw ServerMessages.CANNOT_PARSE_DOUBLE_VALUE; throw ServerMessages.CANNOT_PARSE_DOUBLE_VALUE;
} }
} }
private GenericValue parse(String valueStr) {
if (valueStr.toLowerCase().equals("nan")) {
valueStr = "NaN";
}
return new GenericValue(Double.parseDouble(valueStr));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment