Bug 3068 - checkRpcResponse - CancellationException 97/19197/3
authorJan Hajnar <jhajnar@cisco.com>
Tue, 28 Apr 2015 11:14:46 +0000 (13:14 +0200)
committerJan Hajnar <jhajnar@cisco.com>
Mon, 4 May 2015 06:11:15 +0000 (06:11 +0000)
* added catch for CancellationException in RestconfImpl

Change-Id: I3ebb2c4fd2a521ed0977075975a1302301b801fa
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java

index 1514a15d1132417849a0efb29e53b0ea26113b8f..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);
         }
     }