All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.netarchivesuite.heritrix3wrapper.xmlutils.XmlErrorHandlerAbstract Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy