maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bentmann (JIRA)" <j...@codehaus.org>
Subject [jira] Closed: (MNG-2187) Improve error message when the pom is encoded in the wrong charset
Date Tue, 30 Mar 2010 13:52:22 GMT

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

Benjamin Bentmann closed MNG-2187.
----------------------------------

    Resolution: Fixed
      Assignee: Benjamin Bentmann

We now output
{noformat}
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   The project (D:\test\pom.xml) has 1 error
[ERROR]     Non-readable POM D:\test\pom.xml: Some input bytes do not match the file encoding.
MalformedInputException -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following
articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/MalformedInputException
{noformat}
as per [r929140|http://svn.apache.org/viewvc?view=revision&revision=929140].

Ideally, we would throw this kind of error on all JRE's but that is another story.

> Improve error message when the pom is encoded in the wrong charset
> ------------------------------------------------------------------
>
>                 Key: MNG-2187
>                 URL: http://jira.codehaus.org/browse/MNG-2187
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>          Components: Errors
>    Affects Versions: 2.0.2, 2.0.3
>            Reporter: Carlos Sanchez
>            Assignee: Benjamin Bentmann
>            Priority: Minor
>             Fix For: 3.0-alpha-8
>
>         Attachments: pom.xml
>
>
> When the pom is encoded in a charset different than the one declared in the xml header
(UTF8 by default) and containing an special char (รณ or something like that), under Sun's
JDK there's no error but under IBM JDK it crashes with
> sun.io.MalformedInputException
> It'd be good if we could check first the encoding or capture the exception and show an
error message instead.
> [INFO] Scanning for projects...
> [INFO] ----------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] ----------------------------------------------------------------------------
> [INFO] Error building POM (may not be this project's POM).
> Project ID: unknown
> Reason: Failed to build model from file '/home/demo/plexus-compiler/pom.xml'.
> Error: 'null'
> [INFO] ----------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.reactor.MavenExecutionException: Failed to build model from file '/home/demo/plexus-compiler/pom.xml'.
> Error: 'null'
>         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:85)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
>         at java.lang.reflect.Method.invoke(Method.java:391)
>         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.ProjectBuildingException: Failed to build model from
file '/home/demo/plexus-compiler/pom.xml'.
> Error: 'null'
>         at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1103)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFile(DefaultMavenProjectBuilder.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)
>         ... 12 more
> Caused by: sun.io.MalformedInputException
>         at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java(Compiled Code))
>         at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java(Inlined
Compiled Code))
>         at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java(Compiled
Code))
>         at sun.nio.cs.StreamDecoder.read(StreamDecoder.java(Compiled Code))
>         at java.io.InputStreamReader.read(InputStreamReader.java:208)
>         at java.io.Reader.read(Reader.java:113)
>         at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:212)
>         at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:200)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1117)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1094)
>         ... 17 more
> [INFO] ----------------------------------------------------------------------------
> [INFO] Total time: 1 second
> [INFO] Finished at: Wed Mar 29 04:25:41 PST 2006
> [INFO] Final Memory: 2M/5M
> [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

       

Mime
View raw message