You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Herve Boutemy (JIRA)" <ji...@codehaus.org> on 2010/01/17 16:24:56 UTC

[jira] Closed: (MNG-2057) The Maven 2.0.2 XML parser fails to parse a UTF-8 POM that begins with the optional byte-order mark.

     [ http://jira.codehaus.org/browse/MNG-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy closed MNG-2057.
------------------------------

       Resolution: Duplicate
    Fix Version/s:     (was: 3.x (to be reviewed))
         Assignee: Herve Boutemy

see http://docs.codehaus.org/display/MAVENUSER/XML+encoding

> The Maven 2.0.2 XML parser fails to parse a UTF-8 POM that begins with the optional byte-order mark.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: MNG-2057
>                 URL: http://jira.codehaus.org/browse/MNG-2057
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: POM
>    Affects Versions: 2.0.2
>         Environment: java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
> Microsoft Windows XP [Version 5.1.2600]
>            Reporter: Steven Coco
>            Assignee: Herve Boutemy
>         Attachments: UTF8-BOM-pom.zip
>
>
> The Byte-Order mark is optional, and discouraged in the UTF-8 encoding; but the Unicode specification is clear that it is allowed -- if you read the Unicode Standard v4, section 2.6, and Table 2.3, and section 15.9, and table 15.3; it is clear that the BOM is allowed at the start of a UTF-8 file.
> It so happens that this is the way Windows NotePad saves files when you select UTF-8; and Maven will not parse it.  I'll attach a small POM saved this way, and I'll put it into a ZIP file to hopefully preserve the encoding.  Here is the Maven output:
> [INFO] Scanning for projects...
> [INFO] ----------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] ----------------------------------------------------------------------------
> [INFO] Error building POM (may not be this project's POM).
> Project ID: unknown
> POM Location: C:\Documents and Settings\Coco\Desktop\pom.xml
> Reason: Parse error reading POM. Reason: only whitespace content allowed before start tag and not \u
> ef (position: START_DOCUMENT seen \uef... @1:1)
> [INFO] ----------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.reactor.MavenExecutionException: Parse error reading POM. Reason: only whitespace c
> ontent allowed before start tag and not \uef (position: START_DOCUMENT seen \uef... @1:1)
>         at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:278)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.project.InvalidProjectModelException: Parse error reading POM. Reason: o
> nly whitespace content allowed before start tag and not \uef (position: START_DOCUMENT seen \uef...
> @1:1)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.
> java:1134)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.
> java:1094)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFile(DefaultMavenProje
> ctBuilder.java:289)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java
> :274)
>         at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:515)
>         at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:447)
>         at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:351)
>         ... 11 more
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: only whitespace content allowed
>  before start tag and not \uef (position: START_DOCUMENT seen \uef... @1:1)
>         at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1516)
>         at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1392)
>         at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1090)
>         at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:4545)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.
> java:1130)
>         ... 17 more
> [INFO] ----------------------------------------------------------------------------
> [INFO] Total time: < 1 second
> [INFO] Finished at: Wed Feb 08 21:14:03 EST 2006
> [INFO] Final Memory: 1M/2M
> [INFO] ----------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira