Merge "NETCONF-557: Add support for URL capability"
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / JSONRestconfServiceRfc8040Impl.java
index 52664062ec135d7091da5424a0a155b413aa7812..bcb93603d5aa64a984051c385b849398b8948623 100644 (file)
@@ -195,7 +195,8 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto
 
         final InputStream entityStream = new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8));
 
-        JsonToPatchBodyReader jsonToPatchBodyReader = new JsonToPatchBodyReader(schemaContextHandler);
+        JsonToPatchBodyReader jsonToPatchBodyReader =
+                new JsonToPatchBodyReader(schemaContextHandler, mountPointServiceHandler);
         final PatchContext context = jsonToPatchBodyReader.readFrom(uriPath, entityStream);
 
         LOG.debug("Parsed YangInstanceIdentifier: {}", context.getInstanceIdentifierContext().getInstanceIdentifier());
@@ -224,15 +225,10 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto
         }
 
         final InputStream entityStream = new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8));
-        try {
-            return JsonNormalizedNodeBodyReader.readFrom(instanceIdentifierContext, entityStream, isPost);
-        } catch (final IOException e) {
-            propagateExceptionAs(uriPath, e, "GET");
-            return null;
-        }
+        return JsonNormalizedNodeBodyReader.readFrom(instanceIdentifierContext, entityStream, isPost);
     }
 
-    private  String toJson(final PatchStatusContext patchStatusContext) throws IOException {
+    private static String toJson(final PatchStatusContext patchStatusContext) throws IOException {
         final PatchJsonBodyWriter writer = new PatchJsonBodyWriter();
         final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         writer.writeTo(patchStatusContext, PatchStatusContext.class, null, EMPTY_ANNOTATIONS,