/** * Report the errors and warnings */ public void report(Appendable out) { Formatter f = new Formatter(out); report("Error", getErrors(), f); report("Warning", getWarnings(), f); f.flush(); }
public boolean getInfo(Report other) { return getInfo(other,null); } public boolean getInfo(Report other, String prefix) {
public SetLocation exception(Throwable t, String s, Object... args) { StackTraceElement[] stackTrace = t.getStackTrace(); String method = stackTrace[0].getMethodName(); String cname = stackTrace[0].getClassName(); String e = String.format("["+shorten(cname) +"."+method+"] " +s, args); errors.add(e); trace("ERROR: %s", e); if (isExceptions() || isTrace()) if (t instanceof InvocationTargetException) t.getCause().printStackTrace(System.err); else t.printStackTrace(System.err); return location(e); }
public boolean getInfo(Report other, String prefix) { addErrors(prefix, other.getErrors()); addWarnings(prefix, other.getWarnings()); return other.isOk(); }
public boolean check(String... pattern) { Set<String> missed = Create.set(); if (pattern != null) { for (String p : pattern) { boolean match = false; Pattern pat = Pattern.compile(p); for (Iterator<String> i = errors.iterator(); i.hasNext();) { if (pat.matcher(i.next()).find()) { i.remove(); match = true; } } for (Iterator<String> i = warnings.iterator(); i.hasNext();) { if (pat.matcher(i.next()).find()) { i.remove(); match = true; } } if (!match) missed.add(p); } } if (missed.isEmpty() && isPerfect()) return true; if (!missed.isEmpty()) System.err.println("Missed the following patterns in the warnings or errors: " + missed); report(System.err); return false; }
public boolean isOk() { return reporter.isOk(); }
public List<String> getWarnings() { return reporter.getWarnings(); }
public List<String> getErrors() { return reporter.getErrors(); }
public boolean getInfo(Report other, String prefix) { addErrors(prefix, other.getErrors()); addWarnings(prefix, other.getWarnings()); return other.isOk(); }
public boolean isPerfect() { return isOk() && warnings.isEmpty(); }
public SetLocation exception(Throwable t, String s, Object... args) { StackTraceElement[] stackTrace = t.getStackTrace(); String method = stackTrace[0].getMethodName(); String cname = stackTrace[0].getClassName(); String e = String.format("["+shorten(cname) +"."+method+"] " +s, args); errors.add(e); trace("ERROR: %s", e); if (isExceptions() || isTrace()) if (t instanceof InvocationTargetException) t.getCause().printStackTrace(System.err); else t.printStackTrace(System.err); return location(e); }
/** * Report the errors and warnings */ public void report(Appendable out) { Formatter f = new Formatter(out); report("Error", getErrors(), f); report("Warning", getWarnings(), f); f.flush(); }
public boolean getInfo(Report other, String prefix) { addErrors(prefix, other.getErrors()); addWarnings(prefix, other.getWarnings()); return other.isOk(); }
public boolean isPerfect() { return isOk() && warnings.isEmpty(); }
public boolean getInfo(Report other) { return getInfo(other, null); }