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( new ModelProblemCollectorRequest( Severity.ERROR, Version.V20 )
.setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
.setException( e ) );
}
else
{
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
.setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
.setException( e ) );
}
}
if ( source != null )
{
source.setModelId( ModelProblemUtils.toId( model ) );
source.setLocation( modelSource.getLocation() );
}
}
catch ( ModelParseException e )
{
problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )