-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of non-Stax2-compatible Stax2 implementation fails when reading from byte[]
#482
Milestone
Comments
Thanks! I verified this fixed our test (I cherry-picked the fix into 2.12): diff --git a/pom.xml b/pom.xml
index 4eba2d1..500be94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
<revision>2.12.4</revision>
<changelist>-SNAPSHOT</changelist>
<java.level>8</java.level>
- <jenkins.version>2.222.4</jenkins.version>
+ <jenkins.version>2.300</jenkins.version>
<jackson.version>2.12.3</jackson.version>
<jackson-databind.version>${jackson.version}</jackson-databind.version>
</properties>
@@ -149,7 +149,7 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
- <version>${jackson.version}</version>
+ <version>2.12.4-SNAPSHOT</version>
</dependency>
<dependency>
diff --git a/src/test/java/com/fasterxml/jackson/dataformat/xml/XmlMapperTest.java b/src/test/java/com/fasterxml/jackson/dataformat/xml/XmlMapperTest.java
index a864ecd..825d5a4 100644
--- a/src/test/java/com/fasterxml/jackson/dataformat/xml/XmlMapperTest.java
+++ b/src/test/java/com/fasterxml/jackson/dataformat/xml/XmlMapperTest.java
@@ -10,8 +10,6 @@ import org.jvnet.hudson.test.RealJenkinsRule;
import java.nio.charset.StandardCharsets;
-import javax.xml.stream.XMLInputFactory;
-
public class XmlMapperTest {
@Rule public RealJenkinsRule rr = new RealJenkinsRule();
@@ -22,11 +20,7 @@ public class XmlMapperTest {
}
private static void _smokes(JenkinsRule r) throws Throwable {
- XMLInputFactory inputFactory =
- XMLInputFactory.newFactory(
- XMLInputFactory.class.getName(), XmlFactory.class.getClassLoader());
- XmlFactory factory = new XmlFactory(inputFactory);
- XmlMapper mapper = new XmlMapper(factory);
+ XmlMapper mapper = new XmlMapper();
String content = "<foo><bar><id>123</id></bar></foo>";
Foo foo = mapper.readValue(content.getBytes(StandardCharsets.UTF_8), Foo.class);
assertNotNull(foo.getBar()); |
This was referenced Jul 4, 2021
10 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(note: inspired by #481)
Looks like there is one error mode when using JDK-bundled Stax implementation -- or more generally, anything that does not implement Stax2 extensions. Exception when reading from
byte[]
looks something like this:It should be relatively easy to work around the issue, to provide input source non-Stax2 implementations can use instead.
The text was updated successfully, but these errors were encountered: