azure-sdk-for-android icon indicating copy to clipboard operation
azure-sdk-for-android copied to clipboard

Investigate what it would take to upgrade Jackson dependencies to version `2.13+`

Open vcolin7 opened this issue 3 years ago • 0 comments

Currently, we cannot use any version of jackson-dataformat-xml higher than 2.12.x because, starting with 2.13.0, class XmlFactory uses method XMLInputFactory.newFactory() from package javax.xml.stream. This is a problem because Android itself does not include the aforementioned javax.xml.stream package, meaning that we need to rely on the third party library javax.xml.stream:stax-api:1.0-2 (which was written in 2008 and does not include any new changes made in recent years to javax.xml.stream) to allow Jackson to handle XML.

It is possible we will need to upgrade Jackson in the future, so to achieve that possible some courses of action are:

  • Contributing to Jackson so this conflicting API is not used internally: in the past, this code used to use XMLInputFactory.newInstance(). This comes with its own set of problems because this can happen again with a different unsupported API and we don't know how fast our contributions could get accepted into their project, or if that would even happen at all.
  • Shade the code we need from Java's javax.xml.stream. The problem is, as far as I know, Android does not like when you add things to the java.* namespace, so we would need to investigate how feasible this is.
  • Shade jackson-dataformat-xml classes into our project and make sure the conflicting classes are not used. We'd need to make sure we don't incur in any license violations and we'd be responsible of keeping up with updates Jackson makes to its other packages. Not desirable in my opinion.
  • Write our own serialization/deserialization library. High investment without an equally high reward.
  • Change dependencies and use a different serialization/deserialization library. Would need quite some investigation and making sure it does not produce different results than Jackson's.

More ideas and feedback are always welcome, this are only some thoughts I quickly put together about the topic :)

vcolin7 avatar Feb 16 '22 05:02 vcolin7