Bump upstream versions
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / jersey / providers / patch / JsonPatchBodyReader.java
index c2886b4de7a9d28cd870c5b2a6c150affa372f00..95190882a7c97fa0f3c520dd3663bdc4c58165c8 100644 (file)
@@ -89,19 +89,19 @@ public class JsonPatchBodyReader extends AbstractPatchBodyReader {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public PatchContext readFrom(final String uriPath, final InputStream entityStream) throws
-            RestconfDocumentedException {
+    public PatchContext readFrom(final String uriPath, final InputStream entityStream)
+            throws RestconfDocumentedException {
         try {
             return readFrom(
                     ParserIdentifier.toInstanceIdentifier(uriPath, getSchemaContext(),
                             Optional.ofNullable(getMountPointService())), entityStream);
         } catch (final Exception e) {
-            propagateExceptionAs(e);
-            return null; // no-op
+            throw propagateExceptionAs(e);
         }
     }
 
-    private static RuntimeException propagateExceptionAs(final Exception exception) throws RestconfDocumentedException {
+    private static RestconfDocumentedException propagateExceptionAs(final Exception exception)
+            throws RestconfDocumentedException {
         Throwables.throwIfInstanceOf(exception, RestconfDocumentedException.class);
         LOG.debug("Error parsing json input", exception);
 
@@ -239,8 +239,10 @@ public class JsonPatchBodyReader extends AbstractPatchBodyReader {
                             stack.exit();
                         }
 
-                        final EffectiveStatement<?, ?> parentStmt = stack.currentStatement();
-                        verify(parentStmt instanceof SchemaNode, "Unexpected parent %s", parentStmt);
+                        if (!stack.isEmpty()) {
+                            final EffectiveStatement<?, ?> parentStmt = stack.currentStatement();
+                            verify(parentStmt instanceof SchemaNode, "Unexpected parent %s", parentStmt);
+                        }
                         edit.setTargetSchemaNode(stack.toInference());
                     }