X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-netty-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfXMLToMessageDecoderTest.java;h=aaa92e8050d332e3c2b1c8f7b78f62d23114cc55;hb=81441c1681143050118195459a1a731cf9be21bb;hp=f85a38769f1f5b451690f63c718d4804c7767719;hpb=e90bec01888e6b2a2503d21de25f3a674d607163;p=controller.git
diff --git a/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToMessageDecoderTest.java b/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToMessageDecoderTest.java
index f85a38769f..aaa92e8050 100644
--- a/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToMessageDecoderTest.java
+++ b/opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToMessageDecoderTest.java
@@ -14,6 +14,7 @@ import com.google.common.collect.Lists;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import org.junit.Test;
+import org.xml.sax.SAXParseException;
public class NetconfXMLToMessageDecoderTest {
@@ -30,4 +31,61 @@ public class NetconfXMLToMessageDecoderTest {
new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("".getBytes()), out);
assertEquals(1, out.size());
}
-}
\ No newline at end of file
+
+ @Test
+ public void testDecodeWithLeadingLFAndXmlDecl() throws Exception {
+ /* Test that we accept XML documents with a line feed (0x0a) before the
+ * XML declaration in the XML prologue.
+ * A leading LF is the case reported in BUG-2838.
+ */
+ final ArrayList