Browse Source

fix for issue #582

pull/583/head
Alanscut 5 years ago
parent
commit
eef677ab60
  1. 3
      json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java
  2. 5
      json-path/src/main/java/com/jayway/jsonpath/spi/json/GsonJsonProvider.java
  3. 3
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonNodeJsonProvider.java
  4. 3
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonOrgJsonProvider.java

3
json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java

@ -153,7 +153,8 @@ public abstract class AbstractJsonProvider implements JsonProvider {
} else if(obj instanceof String){
return ((String)obj).length();
}
throw new JsonPathException("length operation cannot be applied to " + obj!=null?obj.getClass().getName():"null");
throw new JsonPathException("length operation cannot be applied to " + (obj != null ? obj.getClass().getName()
: "null"));
}
/**

5
json-path/src/main/java/com/jayway/jsonpath/spi/json/GsonJsonProvider.java

@ -246,9 +246,8 @@ public class GsonJsonProvider extends AbstractJsonProvider {
}
}
}
throw new JsonPathException("length operation can not applied to " + obj != null ? obj.getClass().getName()
: "null");
throw new JsonPathException("length operation can not applied to " + (obj != null ? obj.getClass().getName()
: "null"));
}
@Override

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

@ -211,7 +211,8 @@ public class JacksonJsonNodeJsonProvider extends AbstractJsonProvider {
return element.size();
}
}
throw new JsonPathException("length operation can not applied to " + obj != null ? obj.getClass().getName() : "null");
throw new JsonPathException("length operation can not applied to " + (obj != null ? obj.getClass().getName()
: "null"));
}
@Override

3
json-path/src/main/java/com/jayway/jsonpath/spi/json/JsonOrgJsonProvider.java

@ -170,7 +170,8 @@ public class JsonOrgJsonProvider extends AbstractJsonProvider {
return ((String) obj).length();
}
}
throw new JsonPathException("length operation can not applied to " + obj != null ? obj.getClass().getName() : "null");
throw new JsonPathException("length operation can not applied to " + (obj != null ? obj.getClass().getName()
: "null"));
}
@Override

Loading…
Cancel
Save