Ray Milkey

Fix for ONOS-4740

Properly determine if the JSON payload contained any errors.

Change-Id: Id8e816f6627580dcaca3ccb6b7356d61be62392d
...@@ -204,7 +204,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { ...@@ -204,7 +204,7 @@ public class NetworkConfigWebResource extends AbstractWebResource {
204 errorMsgs.addAll(consumeJson(service, (ObjectNode) root.path(sk), 204 errorMsgs.addAll(consumeJson(service, (ObjectNode) root.path(sk),
205 service.getSubjectFactory(sk))); 205 service.getSubjectFactory(sk)));
206 }); 206 });
207 - if (errorMsgs.toString().length() > 0) { 207 + if (errorMsgs.size() > 0) {
208 return Response.status(MULTI_STATUS_RESPONE).entity(produceErrorJson(errorMsgs)).build(); 208 return Response.status(MULTI_STATUS_RESPONE).entity(produceErrorJson(errorMsgs)).build();
209 } 209 }
210 return Response.ok().build(); 210 return Response.ok().build();
...@@ -227,7 +227,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { ...@@ -227,7 +227,7 @@ public class NetworkConfigWebResource extends AbstractWebResource {
227 NetworkConfigService service = get(NetworkConfigService.class); 227 NetworkConfigService service = get(NetworkConfigService.class);
228 ObjectNode root = (ObjectNode) mapper().readTree(request); 228 ObjectNode root = (ObjectNode) mapper().readTree(request);
229 List<String> errorMsgs = consumeJson(service, root, service.getSubjectFactory(subjectClassKey)); 229 List<String> errorMsgs = consumeJson(service, root, service.getSubjectFactory(subjectClassKey));
230 - if (errorMsgs.toString().length() > 0) { 230 + if (errorMsgs.size() > 0) {
231 return Response.status(MULTI_STATUS_RESPONE).entity(produceErrorJson(errorMsgs)).build(); 231 return Response.status(MULTI_STATUS_RESPONE).entity(produceErrorJson(errorMsgs)).build();
232 } 232 }
233 return Response.ok().build(); 233 return Response.ok().build();
......