X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Futil%2FDeserializerExceptionHandler.java;fp=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Futil%2FDeserializerExceptionHandler.java;h=0000000000000000000000000000000000000000;hb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4;hp=15205e4bed75e3440420c404dc90d3ead0ed5400;hpb=b2e81149739c87f0ecc2ce7f06448d7a5d3162b8;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/DeserializerExceptionHandler.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/DeserializerExceptionHandler.java deleted file mode 100644 index 15205e4bed..0000000000 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/DeserializerExceptionHandler.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.netconf.impl.util; - -import com.google.common.collect.Maps; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import java.util.Map; -import org.opendaylight.controller.config.util.xml.DocumentedException; -import org.opendaylight.controller.netconf.util.messages.SendErrorExceptionUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class DeserializerExceptionHandler implements ChannelHandler { - - private static final Logger LOG = LoggerFactory.getLogger(DeserializerExceptionHandler.class); - - @Override - public void handlerAdded(ChannelHandlerContext ctx) throws Exception { - // NOOP - } - - @Override - public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { - // NOOP - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - LOG.warn("An exception occurred during message handling", cause); - handleDeserializerException(ctx, cause); - } - - private void handleDeserializerException(ChannelHandlerContext ctx, Throwable cause) { - - Map info = Maps.newHashMap(); - info.put("cause", cause.getMessage()); - DocumentedException ex = new DocumentedException(cause.getMessage(), - DocumentedException.ErrorType.rpc, DocumentedException.ErrorTag.malformed_message, - DocumentedException.ErrorSeverity.error, info); - - SendErrorExceptionUtil.sendErrorMessage(ctx.channel(), ex); - } -}