From: Tony Tkacik Date: Mon, 4 May 2015 08:42:10 +0000 (+0000) Subject: Merge "Bug 3068 - checkRpcResponse - CancellationException" X-Git-Tag: release/beryllium~618 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=f412b1da773035f89f5c686ef8a849d084752cb6;hp=68dafd6dd91eb3a8ea795cc438df5c6e6623e44a Merge "Bug 3068 - checkRpcResponse - CancellationException" --- diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java index 1514a15d11..5e9ab7b9d0 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java @@ -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); } }