org.netarchivesuite.heritrix3wrapper.xmlutils.XmlErrorHandlerAbstract Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of heritrix3-wrapper Show documentation
Show all versions of heritrix3-wrapper Show documentation
Wrapper library for unpacking and communicating with Heritrix 3.
package org.netarchivesuite.heritrix3wrapper.xmlutils;
import java.util.LinkedList;
import java.util.List;
import org.xml.sax.ErrorHandler;
/**
* Abstract XML ErrorHandler base that allows access to some useful fields and methods.
*/
public abstract class XmlErrorHandlerAbstract implements ErrorHandler {
/** Errors accumulated. */
public int numberOfErrors;
/** Errors messages. */
public List errors = new LinkedList();
/** Fatal errors accumulated. */
public int numberOfFatalErrors;
/** Fatal errors messages. */
public List fatalErrors = new LinkedList();
/** Warnings accumulated. */
public int numberOfWarnings;
/** Warning messages. */
public List warnings = new LinkedList();
/**
* Reset accumulated errors counters.
*/
public void reset() {
numberOfErrors = 0;
numberOfFatalErrors = 0;
numberOfWarnings = 0;
errors.clear();
fatalErrors.clear();
warnings.clear();
}
/**
* Returns a boolean indicating whether this handler has recorded any errors.
* @return a boolean indicating whether this handler has recorded any errors
*/
public boolean hasErrors() {
return numberOfErrors != 0 || numberOfFatalErrors != 0 || numberOfWarnings != 0;
}
}