Maven
  1. Maven
  2. MNG-2254

the encoding parameter in xml declaration of POM is ignored

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.8
    • Component/s: POM::Encoding
    • Labels:
      None
    • Flags:
      Patch

      Description

      DefaultMavenProjectBuilder reads POM in system default character encoding, and the encoding parameter in xml declartion is ignored.
      to fix this problem, We should

      • fix modello-plugin-xpp3 to use the xml parser which is able to handle the encoding parameter properly
      • regenerate maven-model using fixed modello-plugin-xpp3
      • fix DefaultMavenProjectBuilder to use regenerated maven-model properly.
      1. DefaultMavenProjectBuilder.diff
        3 kB
        Naoki Nose
      2. MNG-2254_artifact.diff
        2 kB
        Hervé Boutemy
      3. MNG-2254_components.diff
        12 kB
        Hervé Boutemy
      4. MNG-2254_components-new.diff
        13 kB
        Hervé Boutemy
      5. MNG-2254.diff
        3 kB
        Hervé Boutemy
      6. MNG-2254-2.diff
        10 kB
        Hervé Boutemy
      7. mng-2254-PomEncoding.tgz
        2 kB
        Hervé Boutemy
      8. modello-plugin-xpp3.diff
        8 kB
        Naoki Nose

        Issue Links

          Activity

          Naoki Nose created issue -
          Naoki Nose made changes -
          Field Original Value New Value
          Attachment modello-plugin-xpp3.diff [ 20301 ]
          Naoki Nose made changes -
          Attachment DefaultMavenProjectBuilder.diff [ 20302 ]
          Hide
          Naoki Nose added a comment -

          Attached files are the patch to fix this issue.
          These files depend on the patch of MXParser which I attached to the following issue.

          http://jira.codehaus.org/browse/MNG-2148

          using a external standard xml pull parser may be better solution, as discussed in the following issue.

          http://jira.codehaus.org/browse/DOXIA-60

          Show
          Naoki Nose added a comment - Attached files are the patch to fix this issue. These files depend on the patch of MXParser which I attached to the following issue. http://jira.codehaus.org/browse/MNG-2148 using a external standard xml pull parser may be better solution, as discussed in the following issue. http://jira.codehaus.org/browse/DOXIA-60
          Carlos Sanchez made changes -
          Link This issue depends upon MNG-2148 [ MNG-2148 ]
          Carlos Sanchez made changes -
          Link This issue is related to DOXIA-60 [ DOXIA-60 ]
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2255 [ MNG-2255 ]
          Carlos Sanchez made changes -
          Link This issue is related to MRELEASE-87 [ MRELEASE-87 ]
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2215 [ MNG-2215 ]
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2187 [ MNG-2187 ]
          Hide
          Carlos Sanchez added a comment -

          it'd be better to swith to a external xml parser, see MNG-2255

          Show
          Carlos Sanchez added a comment - it'd be better to swith to a external xml parser, see MNG-2255
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2216 [ MNG-2216 ]
          Hide
          Stefan Hübner added a comment -

          As I just stated in MNG-2255 I think, that "...the parser used to read in maven's model isn't the problem really. It's more likely the way the POM is handed to the parser."

          See MNG-2255 for full discussion of the issue.

          Show
          Stefan Hübner added a comment - As I just stated in MNG-2255 I think, that "...the parser used to read in maven's model isn't the problem really. It's more likely the way the POM is handed to the parser." See MNG-2255 for full discussion of the issue.
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2362 [ MNG-2362 ]
          John Casey made changes -
          Fix Version/s 2.1 [ 11704 ]
          Jeff Maxwell made changes -
          Link This issue is depended upon by MNG-2450 [ MNG-2450 ]
          Carlos Sanchez made changes -
          Link This issue is duplicated by MNG-2618 [ MNG-2618 ]
          Jason van Zyl made changes -
          Fix Version/s 2.1 [ 11704 ]
          Fix Version/s 2.1.x [ 13142 ]
          Jason van Zyl made changes -
          Patch Submitted [Yes]
          Jason van Zyl made changes -
          Assignee Jason van Zyl [ jason ]
          Jason van Zyl made changes -
          Patch Submitted [Yes]
          Brett Porter made changes -
          Component/s POM [ 11339 ]
          Jason van Zyl made changes -
          Component/s POM [ 11339 ]
          Component/s POM::Encoding [ 12860 ]
          Hide
          Hervé Boutemy added a comment -

          for problems about encodings, there are ways to write a Reader that automagically detects the encoding of a XML stream:
          see https://rome.dev.java.net/apidocs/0_5/com/sun/syndication/io/XmlReader.html

          this permits to use a reader as a source for an XML parser without loosing any information: the magic is done by the reader, not by the parser.

          Such a solution would be an easy fix: the actual MavenXpp3Reader signature could be sufficient (even if using an InputStream would be more classical)

          Show
          Hervé Boutemy added a comment - for problems about encodings, there are ways to write a Reader that automagically detects the encoding of a XML stream: see https://rome.dev.java.net/apidocs/0_5/com/sun/syndication/io/XmlReader.html this permits to use a reader as a source for an XML parser without loosing any information: the magic is done by the reader, not by the parser. Such a solution would be an easy fix: the actual MavenXpp3Reader signature could be sufficient (even if using an InputStream would be more classical)
          Hide
          Jason van Zyl added a comment -

          Herve, if you want take a crack at this I would certainly incorporate this into Modello.

          Show
          Jason van Zyl added a comment - Herve, if you want take a crack at this I would certainly incorporate this into Modello.
          Jason van Zyl made changes -
          Fix Version/s 2.1.x [ 13142 ]
          Fix Version/s 2.0.8 [ 13139 ]
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2025 [ MNG-2025 ]
          Carlos Sanchez made changes -
          Link This issue is related to MNG-2025 [ MNG-2025 ]
          Carlos Sanchez made changes -
          Link This issue is duplicated by MNG-2025 [ MNG-2025 ]
          Carlos Sanchez made changes -
          Link This issue is duplicated by MNG-2932 [ MNG-2932 ]
          Hide
          Hervé Boutemy added a comment -

          Here is a patch to use XmlReader from plexus-utils 1.4.3-SNAPSHOT from MPLEXUS-11 branch.
          Modello change is not absolutely necessary: adding read(InputStream) to read(Reader) is only an enhencement to make people prefer the first one, but using the second one with an XmlReader instance is strictly the same

          Show
          Hervé Boutemy added a comment - Here is a patch to use XmlReader from plexus-utils 1.4.3-SNAPSHOT from MPLEXUS-11 branch. Modello change is not absolutely necessary: adding read(InputStream) to read(Reader) is only an enhencement to make people prefer the first one, but using the second one with an XmlReader instance is strictly the same
          Hervé Boutemy made changes -
          Attachment MNG-2254.diff [ 28222 ]
          Hervé Boutemy made changes -
          Attachment MNG-2254.diff [ 28222 ]
          Hervé Boutemy made changes -
          Attachment MNG-2254.diff [ 28408 ]
          Hide
          Hervé Boutemy added a comment -

          Here is a new patch fixing encoding detection for pom.xml, settings.xml and profiles.xml

          Show
          Hervé Boutemy added a comment - Here is a new patch fixing encoding detection for pom.xml, settings.xml and profiles.xml
          Hervé Boutemy made changes -
          Attachment MNG-2254-2.diff [ 28409 ]
          Hervé Boutemy made changes -
          Link This issue is depended upon by MANTTASKS-79 [ MANTTASKS-79 ]
          Hide
          Hervé Boutemy added a comment -

          see http://docs.codehaus.org/display/MAVENUSER/XML+encoding for the roadmap to XML encoding support in Maven2

          Show
          Hervé Boutemy added a comment - see http://docs.codehaus.org/display/MAVENUSER/XML+encoding for the roadmap to XML encoding support in Maven2
          Hide
          Jason van Zyl added a comment -

          I will take a look, I have walked through everything else this week: plexus and modello, so now I can push in the changes into Maven's core.

          Show
          Jason van Zyl added a comment - I will take a look, I have walked through everything else this week: plexus and modello, so now I can push in the changes into Maven's core.
          Hide
          Hervé Boutemy added a comment -

          splitted the patch into 2 pieces since maven-artifact has been moved to artifact

          Show
          Hervé Boutemy added a comment - splitted the patch into 2 pieces since maven-artifact has been moved to artifact
          Hervé Boutemy made changes -
          Attachment MNG-2254_artifact.diff [ 29045 ]
          Attachment MNG-2254_components.diff [ 29046 ]
          Brett Porter made changes -
          Patch Submitted [Yes]
          Hide
          Andrew Williams added a comment -

          Can you please clarify which patches apply and which do not

          Show
          Andrew Williams added a comment - Can you please clarify which patches apply and which do not
          Hide
          Hervé Boutemy added a comment - - edited

          the 2 latest only are to be applied:

          • MNG-2254_artifact.diff for maven/artifact/trunk and maven/components/branches/maven-2.0.x/maven-artifact
          • MNG-2254_components.diff for maven/components/trunk and maven/components/branches/maven-2.0.x
          Show
          Hervé Boutemy added a comment - - edited the 2 latest only are to be applied: MNG-2254 _artifact.diff for maven/artifact/trunk and maven/components/branches/maven-2.0.x/maven-artifact MNG-2254 _components.diff for maven/components/trunk and maven/components/branches/maven-2.0.x
          Hervé Boutemy made changes -
          Attachment MNG-2254_components.diff [ 29140 ]
          Hervé Boutemy made changes -
          Attachment MNG-2254_components.diff [ 29046 ]
          Hide
          Brian E. Fox added a comment -

          Can someone make an IT for this? See the instructions here: http://docs.codehaus.org/display/MAVEN/Creating+a+Maven+Integration+Test

          Show
          Brian E. Fox added a comment - Can someone make an IT for this? See the instructions here: http://docs.codehaus.org/display/MAVEN/Creating+a+Maven+Integration+Test
          Hide
          Hervé Boutemy added a comment -

          Hi Brian,

          Here is an IT to check that pom.xml encoding is properly detected: the sample pom.xml is in utf-16, then if encoding is not detected, the build simply fails (no complicated test to check that an accentuated character would have been correctly read)

          I checked that it fails without the patch, not that it works with the patch applied...

          Show
          Hervé Boutemy added a comment - Hi Brian, Here is an IT to check that pom.xml encoding is properly detected: the sample pom.xml is in utf-16, then if encoding is not detected, the build simply fails (no complicated test to check that an accentuated character would have been correctly read) I checked that it fails without the patch, not that it works with the patch applied...
          Hervé Boutemy made changes -
          Attachment mng-2254-PomEncoding.tgz [ 29858 ]
          Hide
          Brian E. Fox added a comment -

          Thanks Herve, the test looks good. I wasn't able to get the patches applied cleanly. Can you update them and then I'll apply and test? (i'm going to add the test to the core suite)

          Show
          Brian E. Fox added a comment - Thanks Herve, the test looks good. I wasn't able to get the patches applied cleanly. Can you update them and then I'll apply and test? (i'm going to add the test to the core suite)
          Hide
          Hervé Boutemy added a comment -

          ok: here is a new patch

          Show
          Hervé Boutemy added a comment - ok: here is a new patch
          Hervé Boutemy made changes -
          Attachment MNG-2254_components-new.diff [ 29877 ]
          Hide
          Hervé Boutemy added a comment -

          work done:

          • r585265 for trunk
          • r585268 for 2.0.x branch
          Show
          Hervé Boutemy added a comment - work done: r585265 for trunk r585268 for 2.0.x branch
          Hervé Boutemy made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Jason van Zyl [ jason ] Herve Boutemy [ hboutemy ]
          Hervé Boutemy made changes -
          Link This issue relates to MINSTALL-44 [ MINSTALL-44 ]
          Hervé Boutemy made changes -
          Link This issue relates to MDEPLOY-66 [ MDEPLOY-66 ]
          Hervé Boutemy made changes -
          Link This issue relates to MREPOSITORY-10 [ MREPOSITORY-10 ]
          Benjamin Bentmann made changes -
          Link This issue is duplicated by MNG-2818 [ MNG-2818 ]
          Benjamin Bentmann made changes -
          Link This issue relates to MPLUGINTESTING-5 [ MPLUGINTESTING-5 ]
          Hervé Boutemy made changes -
          Link This issue is duplicated by MNG-2057 [ MNG-2057 ]
          Maria Catherine Tan made changes -
          Link This issue is depended upon by CONTINUUM-2507 [ CONTINUUM-2507 ]
          Maria Catherine Tan made changes -
          Link This issue is depended upon by CONTINUUM-2507 [ CONTINUUM-2507 ]
          Maria Catherine Tan made changes -
          Link This issue relates to CONTINUUM-2507 [ CONTINUUM-2507 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Mark Thomas made changes -
          Link This issue is depended upon by MANTTASKS-14 [ MANTTASKS-14 ]
          Mark Thomas made changes -
          Link This issue is depended upon by MANTTASKS-79 [ MANTTASKS-79 ]
          Mark Thomas made changes -
          Link This issue relates to MDEPLOY-66 [ MDEPLOY-66 ]
          Mark Thomas made changes -
          Link This issue relates to DOXIA-60 [ DOXIA-60 ]
          Mark Thomas made changes -
          Link This issue relates to MINSTALL-44 [ MINSTALL-44 ]
          Mark Thomas made changes -
          Link This issue relates to MPLUGINTESTING-5 [ MPLUGINTESTING-5 ]
          Mark Thomas made changes -
          Link This issue is related to MRELEASE-87 [ MRELEASE-87 ]
          Mark Thomas made changes -
          Link This issue relates to MREPOSITORY-10 [ MREPOSITORY-10 ]
          Mark Thomas made changes -
          Workflow jira [ 12712902 ] Default workflow, editable Closed status [ 12755484 ]
          Mark Thomas made changes -
          Patch Submitted Yes [ 10763 ]
          Flags Patch [ 10430 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Link This issue is depended upon by MANTTASKS-14 [ MANTTASKS-14 ]
          Mark Thomas made changes -
          Link This issue is depended upon by MANTTASKS-79 [ MANTTASKS-79 ]
          Mark Thomas made changes -
          Link This issue relates to MDEPLOY-66 [ MDEPLOY-66 ]
          Mark Thomas made changes -
          Link This issue relates to DOXIA-60 [ DOXIA-60 ]
          Mark Thomas made changes -
          Link This issue relates to MINSTALL-44 [ MINSTALL-44 ]
          Mark Thomas made changes -
          Link This issue relates to MPLUGINTESTING-5 [ MPLUGINTESTING-5 ]
          Mark Thomas made changes -
          Link This issue is related to MRELEASE-87 [ MRELEASE-87 ]
          Mark Thomas made changes -
          Link This issue relates to MREPOSITORY-10 [ MREPOSITORY-10 ]
          Mark Thomas made changes -
          Workflow jira [ 12952253 ] Default workflow, editable Closed status [ 12989593 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          535d 23h 27m 1 Hervé Boutemy 17/Oct/07 02:07

            People

            • Assignee:
              Hervé Boutemy
              Reporter:
              Naoki Nose
            • Votes:
              9 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development