Skip to content

Commit

Permalink
Refactor boolean expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Jun 18, 2024
1 parent 6ac3044 commit 93bbcb2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gson/src/main/java/com/google/gson/stream/JsonWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,9 @@ public JsonWriter value(Number value) throws IOException {
if (strictness != Strictness.LENIENT) {
throw new IllegalArgumentException("Numeric values must be finite, but was " + string);
}
} else if (!(numberClass == Float.class
|| numberClass == Double.class
|| VALID_JSON_NUMBER_PATTERN.matcher(string).matches())) {
} else if (numberClass != Float.class
&& numberClass != Double.class
&& !VALID_JSON_NUMBER_PATTERN.matcher(string).matches()) {
throw new IllegalArgumentException(
"String created by " + numberClass + " is not a valid JSON number: " + string);
}
Expand Down

0 comments on commit 93bbcb2

Please sign in to comment.