From 4390cd0c2bac6c0290eb9572ccbc26f0cbd7fc48 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Thu, 14 Jul 2016 11:18:24 +0200 Subject: [PATCH] Fixed Jaxb2CollectionHttpMessageConverterTests - Added Woodstox before Aalto in the spring-web build, so that Woodstox is used as StAX implementation, and not the less featured Aalto. - Hardcoded Aalto dependency in XmlEventDecoder, instead of relying on the StAX XMLInputFactory. --- build.gradle | 7 ++++++- .../springframework/http/codec/xml/XmlEventDecoder.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index c5d82a4e6ff..9c0ea10f027 100644 --- a/build.gradle +++ b/build.gradle @@ -77,6 +77,7 @@ configure(allprojects) { project -> ext.tomcatVersion = "8.5.3" ext.tyrusVersion = "1.13" ext.undertowVersion = "1.4.0.CR3" + ext.woodstoxVersion = "5.0.2" ext.xmlunitVersion = "1.6" ext.xstreamVersion = "1.4.9" @@ -369,7 +370,7 @@ project("spring-core") { optional("io.netty:netty-buffer:${nettyVersion}") testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}") testCompile("xmlunit:xmlunit:${xmlunitVersion}") - testCompile("com.fasterxml.woodstox:woodstox-core:5.0.2") { + testCompile("com.fasterxml.woodstox:woodstox-core:${woodstoxVersion}") { exclude group: "stax", module: "stax-api" } } @@ -691,6 +692,9 @@ project("spring-web") { optional("io.reactivex:rxjava:${rxJavaVersion}") optional("io.undertow:undertow-core:1.3.20.Final") optional("io.netty:netty-buffer:${nettyVersion}") // Temporarily for JsonObjectDecoder + optional("com.fasterxml.woodstox:woodstox-core:${woodstoxVersion}") { // woodstox before aalto + exclude group: "stax", module: "stax-api" + } optional("com.fasterxml:aalto-xml:1.0.0") optional("org.apache.httpcomponents:httpclient:${httpclientVersion}") optional("org.apache.httpcomponents:httpasyncclient:${httpasyncVersion}") @@ -725,6 +729,7 @@ project("spring-web") { testCompile("org.eclipse.jetty:jetty-server:${jettyVersion}") testCompile("org.eclipse.jetty:jetty-servlet:${jettyVersion}") testCompile("com.squareup.okhttp3:mockwebserver:3.0.1") + } } diff --git a/spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java b/spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java index a468549246c..75c505b853e 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java +++ b/spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java @@ -30,6 +30,7 @@ import com.fasterxml.aalto.AsyncByteBufferFeeder; import com.fasterxml.aalto.AsyncXMLInputFactory; import com.fasterxml.aalto.AsyncXMLStreamReader; import com.fasterxml.aalto.evt.EventAllocatorImpl; +import com.fasterxml.aalto.stax.InputFactoryImpl; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -116,8 +117,7 @@ public class XmlEventDecoder extends AbstractDecoder { private static class AaltoDataBufferToXmlEvent implements Function> { - private static final AsyncXMLInputFactory inputFactory = - (AsyncXMLInputFactory) XmlEventDecoder.inputFactory; + private static final AsyncXMLInputFactory inputFactory = new InputFactoryImpl(); private final AsyncXMLStreamReader streamReader = inputFactory.createAsyncForByteBuffer();