mirror of https://github.com/apache/maven.git
[MNG-2187] Improve error message when the pom is encoded in the wrong charset
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@929140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
912a565ffc
commit
9020e459a1
|
@ -359,7 +359,20 @@ public class DefaultModelBuilder
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
problems.add( Severity.FATAL, "Non-readable POM " + modelSource.getLocation() + ": " + e.getMessage(), e );
|
||||
String msg = e.getMessage();
|
||||
if ( msg == null || msg.length() <= 0 )
|
||||
{
|
||||
// NOTE: There's java.nio.charset.MalformedInputException and sun.io.MalformedInputException
|
||||
if ( e.getClass().getName().endsWith( "MalformedInputException" ) )
|
||||
{
|
||||
msg = "Some input bytes do not match the file encoding.";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = e.getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
problems.add( Severity.FATAL, "Non-readable POM " + modelSource.getLocation() + ": " + msg, e );
|
||||
throw new ModelBuildingException( problems.getRootModelId(), problems.getProblems() );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue