@Override public String toString() { return getLocation(); } }
private Object getLocation( Source source, File defaultLocation ) { if ( source != null ) { return source.getLocation(); } return defaultLocation; }
@Override public String toString() { return getLocation(); }
if ( globalToolchainsFile.isFile() ) toolchainsRequest.setGlobalToolchainsSource( new FileSource( globalToolchainsFile ) ); toolchainsRequest.setUserToolchainsSource( new FileSource( userToolchainsFile ) ); slf4jLogger.warn( problem.getMessage() + " @ " + problem.getLocation() );
toolchains = toolchainsReader.read( toolchainsSource.getInputStream(), options ); toolchains = toolchainsReader.read( toolchainsSource.getInputStream(), options ); problems.add( Problem.Severity.WARNING, e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); problems.add( Problem.Severity.FATAL, "Non-parseable toolchains " + toolchainsSource.getLocation() + ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); return new PersistedToolchains(); problems.add( Problem.Severity.FATAL, "Non-readable toolchains " + toolchainsSource.getLocation() + ": " + e.getMessage(), -1, -1, e ); return new PersistedToolchains();
private static String toMessage( List<Problem> problems ) { StringWriter buffer = new StringWriter( 1024 ); PrintWriter writer = new PrintWriter( buffer ); writer.print( problems.size() ); writer.print( ( problems.size() == 1 ) ? " problem was " : " problems were " ); writer.print( "encountered while building the effective toolchains" ); writer.println(); for ( Problem problem : problems ) { writer.print( "[" ); writer.print( problem.getSeverity() ); writer.print( "] " ); writer.print( problem.getMessage() ); String location = problem.getLocation(); if ( !location.isEmpty() ) { writer.print( " @ " ); writer.print( location ); } writer.println(); } return buffer.toString(); } }
problems.setSource( settingsSource.getLocation() ); settings = settingsReader.read( settingsSource.getInputStream(), options ); settings = settingsReader.read( settingsSource.getInputStream(), options ); problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation() + ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); return new Settings(); problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation() + ": " + e.getMessage(), -1, -1, e ); return new Settings();
private Source getSettingsSource( File settingsFile, Source settingsSource ) { if ( settingsSource != null ) { return settingsSource; } else if ( settingsFile != null && settingsFile.exists() ) { return new FileSource( settingsFile ); } return null; }
@Override public String toString() { StringBuilder buffer = new StringBuilder( 128 ); buffer.append( '[' ).append( getSeverity() ).append( "] " ); buffer.append( getMessage() ); buffer.append( " @ " ).append( getLocation() ); return buffer.toString(); }
public String getLocation() { StringBuilder buffer = new StringBuilder( 256 ); if ( getSource().length() > 0 ) { if ( buffer.length() > 0 ) { buffer.append( ", " ); } buffer.append( getSource() ); } if ( getLineNumber() > 0 ) { if ( buffer.length() > 0 ) { buffer.append( ", " ); } buffer.append( "line " ).append( getLineNumber() ); } if ( getColumnNumber() > 0 ) { if ( buffer.length() > 0 ) { buffer.append( ", " ); } buffer.append( "column " ).append( getColumnNumber() ); } return buffer.toString(); }
@Override public ToolchainsBuildingResult build( ToolchainsBuildingRequest request ) throws ToolchainsBuildingException { ProblemCollector problems = ProblemCollectorFactory.newInstance( null ); PersistedToolchains globalToolchains = readToolchains( request.getGlobalToolchainsSource(), request, problems ); PersistedToolchains userToolchains = readToolchains( request.getUserToolchainsSource(), request, problems ); toolchainsMerger.merge( userToolchains, globalToolchains, TrackableBase.GLOBAL_LEVEL ); problems.setSource( "" ); if ( hasErrors( problems.getProblems() ) ) { throw new ToolchainsBuildingException( problems.getProblems() ); } return new DefaultToolchainsBuildingResult( userToolchains, problems.getProblems() ); }
private boolean hasErrors( List<Problem> problems ) { if ( problems != null ) { for ( Problem problem : problems ) { if ( Problem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 ) { return true; } } } return false; } }
@Override public String toString() { return getLocation(); }
/** * The default implementation is not visible, create it with this factory * * @param problems starting set of problems, may be {@code null} * @return a new instance of a ProblemCollector */ public static ProblemCollector newInstance( List<Problem> problems ) { return new DefaultProblemCollector( problems ); }
@Override public void add( Problem.Severity severity, String message, int line, int column, Exception cause ) { Problem problem = new DefaultProblem( message, severity, source, line, column, cause ); problems.add( problem ); }
private Object getLocation( Source source, File defaultLocation ) { if ( source != null ) { return source.getLocation(); } return defaultLocation; }
@Override public String toString() { return getLocation(); }
@Override public String toString() { return getLocation(); }
private Object getLocation( Source source, File defaultLocation ) { if ( source != null ) { return source.getLocation(); } return defaultLocation; }
private Object getLocation( Source source, File defaultLocation ) { if ( source != null ) { return source.getLocation(); } return defaultLocation; }