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

QName (de)serialization ignores prefix #4771

Open
1 task done
jpraet opened this issue Oct 30, 2024 · 1 comment
Open
1 task done

QName (de)serialization ignores prefix #4771

jpraet opened this issue Oct 30, 2024 · 1 comment
Labels
pr-welcome Issue for which progress most likely if someone submits a Pull Request

Comments

@jpraet
Copy link

jpraet commented Oct 30, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

QName (de)serialization ignores prefix, because it uses QName#toString() and QName#valueOf(java.lang.String).

Version Information

2.17.2

Reproduction

        QName qname = new QName("http://test.com", "test", "p");
        System.out.println(qname.getPrefix()); // <- p
        ObjectMapper mapper = new ObjectMapper();
        String ser = mapper.writeValueAsString(writer, qname);
        System.out.println(ser); // <- "{http://test.com}test"
        QName result = mapper.readValue(ser, QName.class);
        System.out.println(result.getPrefix()); // <- empty string

Expected behavior

QName prefix is preserved.

Additional context

No response

@cowtowncoder
Copy link
Member

Thank you for reporting this @jpraet.

I can see the problem, but it'll probably be difficult to resolve in a backwards-compatible way.

PRs welcome.

@cowtowncoder cowtowncoder added pr-welcome Issue for which progress most likely if someone submits a Pull Request and removed to-evaluate Issue that has been received but not yet evaluated labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-welcome Issue for which progress most likely if someone submits a Pull Request
Projects
None yet
Development

No branches or pull requests

2 participants