public void write( PrintWriter writer, Janitor janitor ) { if (owner instanceof SourceUnit) { SourceUnit source = (SourceUnit) owner; String name = source.getName(); int line = context.getStartLine(); int column = context.getStartColumn(); String sample = source.getSample( line, column, janitor ); if( sample != null ) { writer.println( source.getSample(line, column, janitor) ); } writer.println( name + ": " + line + ": " + this.message ); writer.println(""); } else { writer.println( "<No Relevant Source>: " + this.message ); writer.println(""); } }
public String lookup(ASTNode node) { StringBuilder text = new StringBuilder(); for (int i = node.getLineNumber(); i <= node.getLastLineNumber(); i++) { String line = sourceUnit.getSample(i, 0, janitor); if (line == null) { return null; // most probably a Groovy bug, but we prefer to handle this situation gracefully } try { if (i == node.getLastLineNumber()) line = line.substring(0, node.getLastColumnNumber() - 1); if (i == node.getLineNumber()) line = line.substring(node.getColumnNumber() - 1); text.append(line); if (i != node.getLastLineNumber()) text.append('\n'); } catch (StringIndexOutOfBoundsException e) { return null; // most probably a Groovy bug, but we prefer to handle this situation gracefully } } return text.toString().trim(); }
/** * Writes out a nicely formatted summary of the syntax error. */ public void write(PrintWriter output, Janitor janitor) { String name = source.getName(); int line = getCause().getStartLine(); int column = getCause().getStartColumn(); String sample = source.getSample(line, column, janitor); output.print(name + ": " + line + ": " + getCause().getMessage()); if (sample != null) { output.println(); output.print(sample); output.println(); } }
String lineText = sourceUnit.getSample(line, 0, janitor); if (lineText == null) throw new SourceTextNotAvailableException(stat, sourceUnit, "SourceUnit.getSample() returned null");
public void write( PrintWriter writer, Janitor janitor ) { SourceUnit source = (SourceUnit) owner; String name = source.getName(); int line = context.getStartLine(); int column = context.getStartColumn(); String sample = source.getSample( line, column, janitor ); if( sample != null ) { writer.println( source.getSample(line, column, janitor) ); } writer.println( name + ": " + line + ": " + this.message ); writer.println(""); }
public void write( PrintWriter writer, Janitor janitor ) { if (owner instanceof SourceUnit) { SourceUnit source = (SourceUnit) owner; String name = source.getName(); int line = context.getStartLine(); int column = context.getStartColumn(); String sample = source.getSample( line, column, janitor ); if( sample != null ) { writer.println( source.getSample(line, column, janitor) ); } writer.println( name + ": " + line + ": " + this.message ); writer.println(""); } else { writer.println( "<No Relevant Source>: " + this.message ); writer.println(""); } }
public void write( PrintWriter writer, Janitor janitor ) { if (owner instanceof SourceUnit) { SourceUnit source = (SourceUnit) owner; String name = source.getName(); int line = context.getStartLine(); int column = context.getStartColumn(); String sample = source.getSample( line, column, janitor ); if( sample != null ) { writer.println( source.getSample(line, column, janitor) ); } writer.println( name + ": " + line + ": " + this.message ); writer.println(""); } else { writer.println( "<No Relevant Source>: " + this.message ); writer.println(""); } }
public void write( PrintWriter writer, Janitor janitor ) { if (owner instanceof SourceUnit) { SourceUnit source = (SourceUnit) owner; String name = source.getName(); int line = context.getStartLine(); int column = context.getStartColumn(); String sample = source.getSample( line, column, janitor ); if( sample != null ) { writer.println( source.getSample(line, column, janitor) ); } writer.println( name + ": " + line + ": " + this.message ); writer.println(""); } else { writer.println( "<No Relevant Source>: " + this.message ); writer.println(""); } }
/** * Writes out a nicely formatted summary of the syntax error. */ public void write(PrintWriter output, Janitor janitor) { String name = source.getName(); int line = getCause().getStartLine(); int column = getCause().getStartColumn(); String sample = source.getSample(line, column, janitor); output.print(name + ": " + line + ": " + getCause().getMessage()); if (sample != null) { output.println(); output.print(sample); output.println(); } }
/** * Writes out a nicely formatted summary of the syntax error. */ public void write(PrintWriter output, Janitor janitor) { String name = source.getName(); int line = getCause().getStartLine(); int column = getCause().getStartColumn(); String sample = source.getSample(line, column, janitor); output.print(name + ": " + line + ": " + getCause().getMessage()); if (sample != null) { output.println(); output.print(sample); output.println(); } }
/** * Writes out a nicely formatted summary of the syntax error. */ public void write(PrintWriter output, Janitor janitor) { String name = source.getName(); int line = getCause().getStartLine(); int column = getCause().getStartColumn(); String sample = source.getSample(line, column, janitor); output.print(name + ": " + line + ": " + getCause().getMessage()); if (sample != null) { output.println(); output.print(sample); output.println(); } }
/** * Writes out a nicely formatted summary of the syntax error. */ public void write(PrintWriter output, Janitor janitor) { String name = source.getName(); int line = getCause().getStartLine(); int column = getCause().getStartColumn(); String sample = source.getSample(line, column, janitor); output.print(name + ": " + line + ": " + getCause().getMessage()); if (sample != null) { output.println(); output.print(sample); output.println(); } }
String lineText = sourceUnit.getSample(line, 0, janitor); if (lineText == null) throw new SourceTextNotAvailableException(stat, sourceUnit, "SourceUnit.getSample() returned null");