Skip to content

Regression: encoding error when parsing a ISO-8859-1 pom with Maven Resolver #163

Closed

Description

@tmortagne

Maven Resolver (at least the 3.6.0 one) model processor uses ReaderFactory#newXmlReader to create a XmlStreamReader and then pass it to MXParser.

Problem is that since 1e18ddc MXParser assumes the input encoding is UTF8 and only changes that if the input reader is a InputStreamReader (which is not the case here since it's a XmlStreamReader). So we end up with exception:

UTF-8 BOM plus xml decl of ISO-8859-1 is incompatible

This whole check is not really needed here since XmlStreamReader is taking care of potential encoding issues already from what I understand.

Activity

  1. michael-o commented on Aug 9, 2021

    @michael-o
    Member

    Will take a look. Is your POM public?

  2. tmortagne commented on Aug 9, 2021

    @tmortagne
    Author

    Yes, in my case the problem was with https://repo1.maven.org/maven2/org/apache/commons/commons-parent/39/commons-parent-39.pom (when resolving the parents of commons-collections:commons-collections:3.2.2 to build its Model).

  3. michael-o commented on Aug 9, 2021

    @michael-o
    Member

    @belingueres Can you have a look at this?

  4. tmortagne commented on Aug 9, 2021

    @tmortagne
    Author

    I feel like MXParser#fileEncoding should be null by default instead of the arbitrary "UTF8" and the check should be done only if it's not null.

  5. michael-o commented on Aug 9, 2021

    @michael-o
    Member

    I feel like MXParser#fileEncoding should be null by default instead of the arbitrary "UTF8" and the check should be done only if it's not null.

    So it should autodiscover the encoding itself?

  6. tmortagne commented on Aug 9, 2021

    @tmortagne
    Author

    So it should autodiscover the encoding itself?

    No, just not compare the encoding with the declaration when it does not know what encoding the reader uses, same as before this change.

  7. michael-o commented on Aug 9, 2021

    @michael-o
    Member

    So it should autodiscover the encoding itself?

    No, just not compare the encoding with the declaration when it does not know what encoding the reader uses, same as before this change.

    Makes sense.

  8. belingueres commented on Aug 9, 2021

    @belingueres
    Contributor

    I'll take a look at it.

  9. added a commit that references this issue on Aug 9, 2021
    f999bdb
  10. haster commented on Aug 26, 2021

    @haster

    We just ran into the same issue and after a bit of searching found the bug ... only to then see this issue that perfectly captures what's going on 😄

    Thanks for raising it @tmortagne and for the quick fix @belingueres , can we expect a patch soon?

  11. olamy commented on Aug 26, 2021

    @olamy
    Member
  12. olamy commented on Aug 26, 2021

    @olamy
    Member

    releasing today

  13. added
    bug
    on Aug 26, 2021
  14. added a commit that references this issue on Aug 26, 2021
    bb346ad
  15. added a commit that references this issue on Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions