X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fosgi%2FNetconfOperationRouterImpl.java;h=11b8dc623c8a07903df1d05da46407aef1770a47;hb=3e7cfb454f0e9d2eab68aef8bf855746c4df5cdb;hp=54deb91837b002b76a7c7f80a6d01ef5ee56e9cc;hpb=3979e330c9f95a898c54a9234f3a07e3b2ae4349;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java index 54deb91837..11b8dc623c 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java @@ -121,8 +121,7 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter { String messageAsString = XmlUtil.toString(message); try { - netconfOperationExecution = getNetconfOperationWithHighestPriority( - message, session); + netconfOperationExecution = getNetconfOperationWithHighestPriority(message, session); } catch (IllegalArgumentException | IllegalStateException e) { logger.warn("Unable to handle rpc {} on session {}", messageAsString, session, e); @@ -140,8 +139,29 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter { throw new NetconfDocumentedException(errorMessage, e, NetconfDocumentedException.ErrorType.application, tag, NetconfDocumentedException.ErrorSeverity.error, errorInfo); + } catch (RuntimeException e) { + throw handleUnexpectedEx("Unexpected exception during netconf operation sort", e); } + try { + return executeOperationWithHighestPriority(message, netconfOperationExecution, messageAsString); + } catch (RuntimeException e) { + throw handleUnexpectedEx("Unexpected exception during netconf operation execution", e); + } + } + + private NetconfDocumentedException handleUnexpectedEx(String s, Exception e) throws NetconfDocumentedException { + logger.error(s, e); + + Map info = Maps.newHashMap(); + info.put(NetconfDocumentedException.ErrorSeverity.error.toString(), e.toString()); + return new NetconfDocumentedException("Unexpected error", + NetconfDocumentedException.ErrorType.application, + NetconfDocumentedException.ErrorTag.operation_failed, + NetconfDocumentedException.ErrorSeverity.error, info); + } + + private Document executeOperationWithHighestPriority(Document message, NetconfOperationExecution netconfOperationExecution, String messageAsString) throws NetconfDocumentedException { logger.debug("Forwarding netconf message {} to {}", messageAsString, netconfOperationExecution.operationWithHighestPriority);