Skip to content
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

@JacksonXmlText does not work when paired with @JsonRawValue #545

Closed
dudleycodes opened this issue Aug 23, 2022 · 2 comments · Fixed by #544
Closed

@JacksonXmlText does not work when paired with @JsonRawValue #545

dudleycodes opened this issue Aug 23, 2022 · 2 comments · Fixed by #544
Milestone

Comments

@dudleycodes
Copy link

dudleycodes commented Aug 23, 2022

I apologize if there's a similar issue already opened - I didn't find anything when searching.

Describe the bug
When a field has both the @JsonRawValue and the @JacksonXmlText annotations, the @JacksonXlmText annotation has no effect.

Version information
com.fasterxml.jackson.core:jackson-annotations:2.13.3
com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.3

To Reproduce

@JacksonXmlRootElement(localName = "test-pojo")
public class TestPojo {
     @JacksonXmlProperty(isAttribute = true)
     String id;

     @JacksonXmlText
     @JsonRawValue
     String value;
}

//....

TestPojo sut = new TestPojo();
sut.id = "123";
sut.value = "<a>A</a><b someAttribute=\"B\">B</b>";

Actual output:

<test-pojo>
    <id>123</id>
     <value>
         <a>A</a>
         <b someAttribute="B">B</b>
     </value>
</test-pojo>

Expected output:

<test-pojo>
    <id>123</id>
    <a>A</a><b someAttribute="B">B</b>
</test-pojo>

Additional context

  • I tried cheating the system, by included a @JsonProperty("") annotation on the value field, it had no effect.
@dudleycodes dudleycodes added the to-evaluate Issue that has been received but not yet evaluated label Aug 23, 2022
@cowtowncoder cowtowncoder transferred this issue from FasterXML/jackson-databind Aug 31, 2022
@cowtowncoder
Copy link
Member

Moved to the right repository.

@cowtowncoder cowtowncoder changed the title @JacksonXmlText Doesn't Work When Paired With @JsonRawValue @JacksonXmlText does not work when paired with @JsonRawValue Aug 31, 2022
@cowtowncoder cowtowncoder added 2.14 and removed to-evaluate Issue that has been received but not yet evaluated labels Aug 31, 2022
@cowtowncoder cowtowncoder added this to the 2.14.0 milestone Aug 31, 2022
cowtowncoder added a commit that referenced this issue Aug 31, 2022
@cowtowncoder
Copy link
Member

Thank you for reporting this, @dudleycodes and thank you @yawkat for fixing it so quickly!
It will be in 2.14.0 (hoping to get first release candidate out within 2 weeks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants