/** * Creates a new parser exception with the specified details. * * @param message The error message, may be {@code null}. * @param lineNumber The one-based index of the line containing the error or {@code -1} if unknown. * @param columnNumber The one-based index of the column containing the error or {@code -1} if unknown. * @param cause The nested cause of this error, may be {@code null}. */ public ModelParseException( String message, int lineNumber, int columnNumber, Throwable cause ) { super( message ); initCause( cause ); this.lineNumber = lineNumber; this.columnNumber = columnNumber; }
private Model read( Reader reader, boolean strict, InputSource source ) throws IOException { try { if ( source != null ) { return new MavenXpp3ReaderEx().read( reader, strict, source ); } else { return new MavenXpp3Reader().read( reader, strict ); } } catch ( XmlPullParserException e ) { throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
.setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ) .setException( e ) ); .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ) .setException( e ) ); .setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() ) .setException( e ) ); throw problems.newModelBuildingException();
line = e.getLineNumber(); column = e.getColumnNumber();
public Model read(Reader input, Map<String, ?> options) throws IOException, ModelParseException { if (input == null) { throw new IllegalArgumentException("XML Reader is null."); } Model model = null; try { model = reader.read(input); } catch (XmlPullParserException e) { throw new ModelParseException(e.getMessage(), -1, -1, e); } return model; } }
.setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ) .setException( e ) ); .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ) .setException( e ) ); .setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() ) .setException( e ) ); throw problems.newModelBuildingException();
line = e.getLineNumber(); column = e.getColumnNumber();
private Model read( Reader reader, boolean strict, InputSource source ) throws IOException { try { if ( source != null ) { return new MavenXpp3ReaderEx().read( reader, strict, source ); } else { return new MavenXpp3Reader().read( reader, strict ); } } catch ( XmlPullParserException e ) { throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
private Model loadRaw( final ModelSource source, final Map<String, Object> options, final RequestTrace trace, final ProjectToolsSession session ) throws ProjectToolsException { ModelLoaderEvent event = null; Model model; try { model = modelReader.read( source.getInputStream(), options ); event = newBuiltModelEvent( trace ).withModel( model ).withModelSource( source ).build(); return model; } catch ( ModelParseException e ) { event = newErrorEvent( trace ).withModelSource( source ).withError( e ).build(); throw new ProjectToolsException( "Failed to parse model: %s. Reason: %s", e, source, e.getMessage() ); } catch ( IOException e ) { event = newErrorEvent( trace ).withModelSource( source ).withError( e ).build(); throw new ProjectToolsException( "Failed to read model: %s. Reason: %s", e, source, e.getMessage() ); } finally { getDispatcher( session ).fire( event ); } }
/** * Creates a new parser exception with the specified details. * * @param message The error message, may be {@code null}. * @param lineNumber The one-based index of the line containing the error or {@code -1} if unknown. * @param columnNumber The one-based index of the column containing the error or {@code -1} if unknown. * @param cause The nested cause of this error, may be {@code null}. */ public ModelParseException( String message, int lineNumber, int columnNumber, Throwable cause ) { super( message ); initCause( cause ); this.lineNumber = lineNumber; this.columnNumber = columnNumber; }