Browse Source

Merge pull request #584 from Alanscut/redundant_if

imporve redundant if statement
pull/624/head
kallestenflo 5 years ago committed by GitHub
parent
commit
49e8b86ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java
  2. 4
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java

5
json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java

@ -379,10 +379,7 @@ public final class Utils {
* @throws IllegalArgumentException if the character sequence is empty * @throws IllegalArgumentException if the character sequence is empty
*/ */
public static <T extends CharSequence> T notEmpty(T chars, String message, Object... values) { public static <T extends CharSequence> T notEmpty(T chars, String message, Object... values) {
if (chars == null) { if (chars == null || chars.length() == 0) {
throw new IllegalArgumentException(String.format(message, values));
}
if (chars.length() == 0) {
throw new IllegalArgumentException(String.format(message, values)); throw new IllegalArgumentException(String.format(message, values));
} }
return chars; return chars;

4
json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java

@ -101,8 +101,8 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
return e.asInt(); return e.asInt();
} else if (e.isLong()) { } else if (e.isLong()) {
return e.asLong(); return e.asLong();
} else if (e.isBigDecimal()) { } else if (e.isBigInteger()) {
return e.decimalValue(); return e.bigIntegerValue();
} else if (e.isDouble()) { } else if (e.isDouble()) {
return e.doubleValue(); return e.doubleValue();
} else if (e.isFloat()) { } else if (e.isFloat()) {

Loading…
Cancel
Save