problems.setSource( modelSource.getLocation() );
try
{
boolean strict = request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
InputSource source = request.isLocationTracking() ? new InputSource() : null;
Map<String, Object> options = new HashMap<String, Object>();
options.put( ModelProcessor.IS_STRICT, Boolean.valueOf( strict ) );
options.put( ModelProcessor.INPUT_SOURCE, source );
options.put( ModelProcessor.SOURCE, modelSource );
try
{
model = modelProcessor.read( modelSource.getInputStream(), options );
}
catch ( ModelParseException e )
{
if ( !strict )
{
throw e;
}
options.put( ModelProcessor.IS_STRICT, Boolean.FALSE );
try
{
model = modelProcessor.read( modelSource.getInputStream(), options );
}
catch ( ModelParseException ne )
{
// still unreadable even in non-strict mode, rethrow original error
throw e;
}
if ( pomFile != null )
{
problems.add( Severity.ERROR, "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage(),
null, e );
}
else
{
problems.add( Severity.WARNING, "Malformed POM " + modelSource.getLocation() + ": "
+ e.getMessage(), null, e );
}
}
if ( source != null )
{
source.setModelId( ModelProblemUtils.toId( model ) );
source.setLocation( pomFile != null ? pomFile.getAbsolutePath() : null );
}
}
catch ( ModelParseException e )
{
problems.add( Severity.FATAL, "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage(),