Fix for issue #582 -- NullPointerException of JsonProvider.length()
@ -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"));
/**
@ -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()
@Override
@ -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");
@ -170,7 +170,8 @@ public class JsonOrgJsonProvider extends AbstractJsonProvider {
return ((String) obj).length();