Hide DeserializerExceptionHandler 73/105673/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Apr 2023 17:56:13 +0000 (19:56 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Apr 2023 19:21:31 +0000 (21:21 +0200)
This is an implementation-internal class and the only occupant of
netconf.server.util package. Move it to netconf.server and hide it.

JIRA: NETCONF-945
Change-Id: I2569e5343ac2e303101dd07cd73ce9cfb5e18ec3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/DeserializerExceptionHandler.java [moved from protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/util/DeserializerExceptionHandler.java with 78% similarity]
protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/ServerChannelInitializer.java
protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/DeserializerExceptionHandlerTest.java [moved from protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/util/DeserializerExceptionHandlerTest.java with 97% similarity]

similarity index 78%
rename from protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/util/DeserializerExceptionHandler.java
rename to protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/DeserializerExceptionHandler.java
index 03651ea1b3119f707a507d0055c4e3a3610eb45b..fedd4ee8a3ba1f308bc0e5960a17f2f6ef8c2df2 100644 (file)
@@ -5,29 +5,25 @@
  * 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.netconf.server.util;
+package org.opendaylight.netconf.server;
 
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import java.util.Map;
 import org.opendaylight.netconf.api.DocumentedException;
-import org.opendaylight.netconf.server.SendErrorExceptionUtil;
 import org.opendaylight.yangtools.yang.common.ErrorSeverity;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class DeserializerExceptionHandler extends ChannelInboundHandlerAdapter {
+final class DeserializerExceptionHandler extends ChannelInboundHandlerAdapter {
     private static final Logger LOG = LoggerFactory.getLogger(DeserializerExceptionHandler.class);
 
     @Override
     public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) {
         LOG.warn("An exception occurred during message handling", cause);
-        handleDeserializerException(ctx, cause);
-    }
 
-    private static void handleDeserializerException(final ChannelHandlerContext ctx, final Throwable cause) {
         final String message = cause.getMessage();
         SendErrorExceptionUtil.sendErrorMessage(ctx.channel(), new DocumentedException(message,
             ErrorType.RPC, ErrorTag.MALFORMED_MESSAGE, ErrorSeverity.ERROR,
index 52dc7d075101ee0c83bec4f8854615c9a414d233..dfe858bf547b70a89b4382e9c7b819fa327f722d 100644 (file)
@@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull;
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Promise;
 import org.opendaylight.netconf.nettyutil.AbstractChannelInitializer;
-import org.opendaylight.netconf.server.util.DeserializerExceptionHandler;
 
 public final class ServerChannelInitializer extends AbstractChannelInitializer<NetconfServerSession> {
     private static final String DESERIALIZER_EX_HANDLER_KEY = "deserializerExHandler";
similarity index 97%
rename from protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/util/DeserializerExceptionHandlerTest.java
rename to protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/DeserializerExceptionHandlerTest.java
index 2a4a1dc5584d52d9ba837285475e0d1c80652225..290c9b4c2b332785c2faf297efea281b33e30ea3 100644 (file)
@@ -5,7 +5,7 @@
  * 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.netconf.server.util;
+package org.opendaylight.netconf.server;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;