Merge "BUG 3057 - notify added event source by topics created before"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / RestconfImpl.java
index 33795889a122536c14f9e6c61f368b8b7c949ece..5e9ab7b9d0a0b818a577ddbcec502f10e6196bca 100644 (file)
@@ -417,18 +417,13 @@ public class RestconfImpl implements RestconfService {
                 return retValue;
             }
             throw new RestconfDocumentedException("RpcError message", null, retValue.getErrors());
-        }
-        catch (final InterruptedException e) {
+        } catch (final InterruptedException e) {
             throw new RestconfDocumentedException(
                     "The operation was interrupted while executing and did not complete.", ErrorType.RPC,
                     ErrorTag.PARTIAL_OPERATION);
-        }
-        catch (final ExecutionException e) {
+        } catch (final ExecutionException e) {
             Throwable cause = e.getCause();
-            if (cause instanceof CancellationException) {
-                throw new RestconfDocumentedException("The operation was cancelled while executing.", ErrorType.RPC,
-                        ErrorTag.PARTIAL_OPERATION);
-            } else if (cause != null) {
+            if (cause != null) {
                 while (cause.getCause() != null) {
                     cause = cause.getCause();
                 }
@@ -444,6 +439,9 @@ public class RestconfImpl implements RestconfService {
                 throw new RestconfDocumentedException("The operation encountered an unexpected error while executing.",
                         e);
             }
+        } catch (final CancellationException e) {
+            throw new RestconfDocumentedException("The operation was cancelled while executing.", ErrorType.RPC,
+                    ErrorTag.PARTIAL_OPERATION);
         }
     }
 
@@ -697,7 +695,7 @@ public class RestconfImpl implements RestconfService {
                 if (mountPoint != null) {
                     broker.commitConfigurationDataPut(mountPoint, normalizedII, payload.getData()).checkedGet();
                 } else {
-                    broker.commitConfigurationDataPut(normalizedII, payload.getData()).checkedGet();
+                    broker.commitConfigurationDataPut(controllerContext.getGlobalSchema(), normalizedII, payload.getData()).checkedGet();
                 }
 
                 break;
@@ -828,12 +826,13 @@ public class RestconfImpl implements RestconfService {
             throw new RestconfDocumentedException("Input is required.", ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
         }
 
-        final URI payloadNS = payload.getData().getNodeType().getNamespace();
-        if (payloadNS == null) {
-            throw new RestconfDocumentedException(
-                    "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)",
-                    ErrorType.PROTOCOL, ErrorTag.UNKNOWN_NAMESPACE);
-        }
+        // FIXME: move this to parsing stage (we can have augmentation nodes here which do not have namespace)
+//        final URI payloadNS = payload.getData().getNodeType().getNamespace();
+//        if (payloadNS == null) {
+//            throw new RestconfDocumentedException(
+//                    "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)",
+//                    ErrorType.PROTOCOL, ErrorTag.UNKNOWN_NAMESPACE);
+//        }
 
         final DOMMountPoint mountPoint = payload.getInstanceIdentifierContext().getMountPoint();
         final InstanceIdentifierContext<?> iiWithData = payload.getInstanceIdentifierContext();
@@ -842,7 +841,7 @@ public class RestconfImpl implements RestconfService {
             if (mountPoint != null) {
                 broker.commitConfigurationDataPost(mountPoint, normalizedII, payload.getData()).checkedGet();
             } else {
-                broker.commitConfigurationDataPost(normalizedII, payload.getData()).checkedGet();
+                broker.commitConfigurationDataPost(controllerContext.getGlobalSchema(), normalizedII, payload.getData()).checkedGet();
             }
         } catch(final RestconfDocumentedException e) {
             throw e;