Merge "Revert "BUG 2594 - PUT method returns wrong status on create""
authorTony Tkacik <ttkacik@cisco.com>
Fri, 8 Jan 2016 09:12:08 +0000 (09:12 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 8 Jan 2016 09:12:08 +0000 (09:12 +0000)
1  2 
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java

index 5356e75e460eef46fefc2aee69a7240e4a270a66,18b02cfa3449f32954f54320852aa500bf20947d..bc2d23cd70f052cde95e2a304b40f1786a626b70
@@@ -47,7 -47,6 +47,7 @@@ import org.opendaylight.controller.md.s
  import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
  import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
  import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 +import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException;
  import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
  import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
  import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
@@@ -489,8 -488,6 +489,8 @@@ public class RestconfImpl implements Re
                  if (cause instanceof IllegalArgumentException) {
                      throw new RestconfDocumentedException(cause.getMessage(), ErrorType.PROTOCOL,
                              ErrorTag.INVALID_VALUE);
 +                } else if (cause instanceof DOMRpcImplementationNotAvailableException) {
 +                    throw new RestconfDocumentedException(cause.getMessage(), ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED);
                  }
                  throw new RestconfDocumentedException("The operation encountered an unexpected error while executing.",cause);
              } else {
           * document the behavior).
           */
          int tries = 2;
-         Status status = Status.NOT_MODIFIED;
          while(true) {
              try {
                  if (mountPoint != null) {
-                     status = broker.readConfigurationData(mountPoint, normalizedII) != null ? Status.OK : Status.CREATED;
                      broker.commitConfigurationDataPut(mountPoint, normalizedII, payload.getData()).checkedGet();
                  } else {
-                     status = broker.readConfigurationData(normalizedII) != null ? Status.OK : Status.CREATED;
                      broker.commitConfigurationDataPut(controllerContext.getGlobalSchema(), normalizedII, payload.getData()).checkedGet();
                  }
  
              }
          }
  
-         return Response.status(status).build();
+         return Response.status(Status.OK).build();
      }
  
      private static void validateTopLevelNodeName(final NormalizedNodeContext node,