lightblue-platform / lightblue-rest

Data access layer as service REST API
GNU General Public License v3.0
9 stars 16 forks source link

CID 158169, 158168: Null pointer dereferences (NULL_RETURNS) #275

Open jewzaam opened 7 years ago

jewzaam commented 7 years ago
** CID 158169:  Null pointer dereferences  (NULL_RETURNS)
/lightblue-rest/crud/src/main/java/com/redhat/lightblue/rest/crud/cmd/AbstractLockCommand.java: 56 in com.redhat.lightblue.rest.crud.cmd.AbstractLockCommand.getLockCommand(java.lang.String)()

________________________________________________________________________________________________________
*** CID 158169:  Null pointer dereferences  (NULL_RETURNS)
/lightblue-rest/crud/src/main/java/com/redhat/lightblue/rest/crud/cmd/AbstractLockCommand.java: 56 in com.redhat.lightblue.rest.crud.cmd.AbstractLockCommand.getLockCommand(java.lang.String)()
50
51         public static AbstractLockCommand getLockCommand(String request) {
52             AbstractLockCommand command = null;
53             try {
54                 ObjectMapper mapper = new ObjectMapper();
55                 JsonNode rootNode = mapper.readValue(request, JsonNode.class);
>>>     CID 158169:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "rootNode".
56                 String operation = rootNode.get("operation").asText();
57                 String domain = rootNode.get("domain").asText();
58                 String callerId = rootNode.get("callerId").asText();
59                 String resourceId = rootNode.get("resourceId").asText();
60
61                 switch(operation) {
** CID 158168:  Null pointer dereferences  (NULL_RETURNS)
/lightblue-rest/crud/src/main/java/com/redhat/lightblue/rest/crud/AbstractCrudResource.java: 85 in com.redhat.lightblue.rest.crud.AbstractCrudResource.lock(java.lang.String)()

________________________________________________________________________________________________________
*** CID 158168:  Null pointer dereferences  (NULL_RETURNS)
/lightblue-rest/crud/src/main/java/com/redhat/lightblue/rest/crud/AbstractCrudResource.java: 85 in com.redhat.lightblue.rest.crud.AbstractCrudResource.lock(java.lang.String)()
79         }
80
81         @POST
82         @Path("/lock/")
83         public Response lock(String request) {
84             Error.reset();
>>>     CID 158168:  Null pointer dereferences  (NULL_RETURNS)
>>>     Calling a method on null object "com.redhat.lightblue.rest.crud.cmd.AbstractLockCommand.getLockCommand(request)".
85             CallStatus st = getLockCommand(request).run();
86             return Response.status(st.getHttpStatus()).entity(st.toString()).build();
87         }
88
89         @PUT
90         @Path("/lock/{domain}/{callerId}/{resourceId}")