Skip to content

Commit

Permalink
fix: more permissive parsing of fill_value
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed May 29, 2024
1 parent 91e08f7 commit b09ecce
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,12 @@ private static JsonElement parseFillValue(String fillValue, DataType dtype) {
if (fillValue == null || fillValue.isEmpty())
return JsonNull.INSTANCE;

switch (dtype) {
case INT8:
case UINT8:
case INT16:
case UINT16:
case INT32:
case UINT32:
case INT64:
case UINT64:
// Long is more than Double, so try that first
try {
return new JsonPrimitive(Long.parseLong(fillValue));
default:
return new JsonPrimitive(Double.parseDouble(fillValue));
}
} catch (final NumberFormatException ignore) {}

return new JsonPrimitive(Double.parseDouble(fillValue));
}

public long[] getShape() {
Expand Down

0 comments on commit b09ecce

Please sign in to comment.