FasterXML / jackson-dataformat-xml

Extension for Jackson JSON processor that adds support for serializing POJOs as XML (and deserializing from XML) as an alternative to JSON
Apache License 2.0
574 stars 222 forks source link

Class attribute annotation with "@" stopped working in 2.17.+, parsing says "name expected" #664

Closed ceggert87 closed 3 months ago

ceggert87 commented 4 months ago

Search before asking

Describe the bug

Hello there!

Hopefully this is the right project to report this issue:

In a project that uses the following annotations for a class:

@JacksonXmlRootElement(localName = "rule")
@JsonTypeInfo(use=JsonTypeInfo.Id.MINIMAL_CLASS, include= JsonTypeInfo.As.PROPERTY, property="@class")
public interface IRulePojo {

The parsing starts to fail now when switching from 2.16.2 to 2.17.+. The xmlpull claims:

org.xmlpull.v1.XmlPullParserException: name expected (position:START_TAG @3:11 in java.io.InputStreamReader@378f09a)

This issue can be avoided by not using "@", so changing the property to "_class", for example. Is this a deliberate change, or an issue that could be resolved with an update?

Thanks for any input!

Version Information

2.17.0, 2.17.1, 2.17.2

Reproduction

No response

Expected behavior

No response

Additional context

No response

pjfanning commented 4 months ago

The preferred XML parser for this module is Woodstox. Could you try that instead of the xmlpull parser?

cowtowncoder commented 3 months ago

Explanation is unfortunately not enough to understand the issue -- we'd need to see some code, to see what exactly is being done. And how is XPP parser relevant here? What kind of XML is being read (and written by what)?

ceggert87 commented 3 months ago

Thanks for your input! Unfortunately the project setup in which the issue occurs is not that easy to break down and change the parser in for me, so I was hoping it might be some obvious change for the 2.17 version that doesn't need reproducible examples. Since this is not the case I'd close the ticket then since a modernization would first be needed anyway. If the same obstacles occur, I'd re-open a ticket with more information and a sample project then. Sorry for the trouble!

cowtowncoder commented 3 months ago

@ceggert87 Makes sense: please do file a new issue as necessary!