Skip to content

Commit

Permalink
Add a failing test for #463 -- fix will be in Woodstox 6.2.5 when rel…
Browse files Browse the repository at this point in the history
…eased
  • Loading branch information
cowtowncoder committed Apr 3, 2021
1 parent 9369bec commit 91a4f32
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.fasterxml.jackson.dataformat.xml.failing;

import java.nio.charset.StandardCharsets;

import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;

// [dataformat-xml#463]
// (but root cause of https://github.com/FasterXML/woodstox/issues/123)
public class XmlParserErrorHandling463Test extends XmlTestBase
{
private final XmlMapper MAPPER = newMapper();

public void testInvalidXmlDecl() throws Exception
{
final byte[] doc = "<?xml version=\"1.1\" encoding=\"U\"?>".getBytes(StandardCharsets.UTF_8);
try {
MAPPER.readTree(doc);
fail("Should not pass");
} catch (StreamReadException e) {
verifyException(e, "Unsupported encoding: U");
} catch (RuntimeException e) {
fail("Should fail with specific `StreamReadException` but got: "+e);
}
}
}

0 comments on commit 91a4f32

Please sign in to comment.