BUG-848 Fix netconf communication while using CHUNK encoding
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / handler / NetconfEXIToMessageDecoder.java
index cbfbfe1c05a21ebb5db74b5973ce32fc90f86c98..ae330d67e68344e16d1904b7c1547caea73cadb8 100644 (file)
@@ -34,8 +34,6 @@ public final class NetconfEXIToMessageDecoder extends ByteToMessageDecoder {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfEXIToMessageDecoder.class);
 
-//    private static final SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
-
     private final NetconfEXICodec codec;
 
     public NetconfEXIToMessageDecoder(final NetconfEXICodec codec) {
@@ -50,9 +48,9 @@ public final class NetconfEXIToMessageDecoder extends ByteToMessageDecoder {
          * the use of EXI, which means the next message needs to be decoded not by us, but rather
          * by the XML decoder.
          */
-        // If empty Byte buffer is passed to r.parse, EOFException is thrown
 
-        if (in.readableBytes() == 0) {
+        // If empty Byte buffer is passed to r.parse, EOFException is thrown
+        if (in.isReadable() == false) {
             LOG.debug("No more content in incoming buffer.");
             return;
         }
@@ -69,7 +67,6 @@ public final class NetconfEXIToMessageDecoder extends ByteToMessageDecoder {
         final DOMResult domResult = new DOMResult();
         handler.setResult(domResult);
 
-
         try (final InputStream is = new ByteBufInputStream(in)) {
             r.parse(new InputSource(is));
         }