BUG-2459: reuse EXI Reader
[controller.git] / opendaylight / netconf / netconf-netty-util / src / main / java / org / opendaylight / controller / netconf / nettyutil / AbstractNetconfSession.java
index 13b72bc62c460ffdec7da204e2c9297c4914f7b7..a59b1a0d76bcdb01095e7c25e76377cd83ad019a 100644 (file)
@@ -132,9 +132,15 @@ public abstract class AbstractNetconfSession<S extends NetconfSession, L extends
             throw new IllegalStateException("Cannot instantiate encoder for options", e);
         }
 
-        final NetconfEXIToMessageDecoder exiDecoder = new NetconfEXIToMessageDecoder(exiCodec);
-        addExiHandlers(exiDecoder, exiEncoder);
+        final NetconfEXIToMessageDecoder exiDecoder;
+        try {
+            exiDecoder = NetconfEXIToMessageDecoder.create(exiCodec);
+        } catch (EXIOptionsException e) {
+            LOG.warn("Failed to instantiate EXI decodeer for {} on session {}", exiCodec, this, e);
+            throw new IllegalStateException("Cannot instantiate encoder for options", e);
+        }
 
+        addExiHandlers(exiDecoder, exiEncoder);
         LOG.debug("Session {} EXI handlers added to pipeline", this);
     }