/** * Collect an error reported by an underlying process such as a parser or a transformer without * throwing any exception. * * @param level The level of the exception. * @param exception The exception thrown by the underlying process. * * @throws NullPointerException If either argument is <code>null</code>. */ public final void collectQuietly(Level level, T exception) { this._collected.add(new CollectedError<>(level, exception)); if (this.flag.compareTo(level) <= 0) { this._hasError = true; } }
@Override public String toString() { return name().toLowerCase(); } };
/** * Collect an error reported by an underlying process such as a parser or a transformer. * * <p>Note: this method should generally be called at the end of a function at it can throw an exception if * the threshold was reached. * * @param level The level of the exception. * @param exception The exception thrown by the underlying process. * * @throws T If the exception threshold has been reached, the exception passed as argument is thrown. * @throws NullPointerException If either argument is <code>null</code>. */ public final void collect(Level level, T exception) throws T { this._collected.add(new CollectedError<>(level, exception)); if (this.flag.compareTo(level) <= 0) { this._hasError = true; } if (this.exception.compareTo(level) <= 0) throw exception; }
/** * Returns the source locator as XML. * * <p>Does nothing if the locator is <code>null</code>. * * @param xml the XML writer. * * @throws IOException If thrown by the XML writer. */ @Override public void toXML(XMLWriter xml) throws IOException { xml.openElement("collected"); xml.attribute("level", this._level.toString()); Errors.toXML(this._error, xml, false); xml.closeElement(); }