cqframework / cql-engine

Clinical Quality Language Evaluation Engine
Apache License 2.0
61 stars 45 forks source link

Forcing Woodstox on all Jackson XML modules. #604

Closed vitorpamplona closed 2 years ago

vitorpamplona commented 2 years ago

Same fix as https://github.com/cqframework/clinical_quality_language/issues/768

A Java11-on-Android issue happens on all XmlMapper.builder() calls. The default XmlFactory provided by Jackson calls a JDK11's Streaming API for XML (StAX) javax.xml.stream.XMLInputFactory.newFactory function that does not exist on Android. That function is a simple service loader to find the XMLInputFactory and XMLOutputFactory implementations, which are provided Woodstox, a current forced dependency in our Jackson modules.

This issue can be easily solved by bypassing the service loader and hardcoding the use of Woodstox's Input and Output Factories:

XmlMapper.builder(new XmlFactory(new WstxInputFactory(), new WstxOutputFactory()))...

Instead of

XmlMapper.builder()...
JPercival commented 2 years ago

Whoops. Did the PRs in the wrong order. Mind fixing the conflicts on this?