You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by am...@apache.org on 2003/09/18 00:10:17 UTC

cvs commit: xml-security/src/org/apache/xml/security/utils IgnoreAllErrorHandler.java

amattheu    2003/09/17 15:10:17

  Modified:    src/org/apache/xml/security/utils IgnoreAllErrorHandler.java
  Log:
  Added functionality to quiet down SAX.
  
  Revision  Changes    Path
  1.5       +52 -37    xml-security/src/org/apache/xml/security/utils/IgnoreAllErrorHandler.java
  
  Index: IgnoreAllErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/utils/IgnoreAllErrorHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IgnoreAllErrorHandler.java	29 Apr 2003 21:36:56 -0000	1.4
  +++ IgnoreAllErrorHandler.java	17 Sep 2003 22:10:17 -0000	1.5
  @@ -59,7 +59,6 @@
   package org.apache.xml.security.utils;
   
   
  -
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXParseException;
  @@ -73,40 +72,56 @@
    */
   public class IgnoreAllErrorHandler implements ErrorHandler {
   
  -   /** {@link org.apache.commons.logging} logging facility */
  -    static org.apache.commons.logging.Log log = 
  -        org.apache.commons.logging.LogFactory.getLog(IgnoreAllErrorHandler.class.getName());
  -
  -   /** Field throwExceptions */
  -   static final boolean warnOnExceptions = true;
  -
  -   /** Field throwExceptions           */
  -   static final boolean throwExceptions = false;
  -
  -   //J-
  -    public void warning (SAXParseException ex) throws SAXException {
  -       if (IgnoreAllErrorHandler.warnOnExceptions) {
  -          log.warn("", ex);
  -       }
  -       if (IgnoreAllErrorHandler.throwExceptions) {
  -          throw ex;
  -       }
  -    }
  -    public void error (SAXParseException ex) throws SAXException {
  -       if (IgnoreAllErrorHandler.warnOnExceptions) {
  -          log.error("", ex);
  -       }
  -       if (IgnoreAllErrorHandler.throwExceptions) {
  -          throw ex;
  -       }
  -    }
  -    public void fatalError (SAXParseException ex) throws SAXException {
  -       if (IgnoreAllErrorHandler.warnOnExceptions) {
  -          log.warn("", ex);
  -       }
  -       if (IgnoreAllErrorHandler.throwExceptions) {
  -          throw ex;
  -       }
  -    }
  -    //J+
  +	/** {@link org.apache.commons.logging} logging facility */
  +	static org.apache.commons.logging.Log log =
  +		org.apache.commons.logging.LogFactory.getLog(
  +			IgnoreAllErrorHandler.class.getName());
  +
  +	/** Field throwExceptions */
  +	static final boolean warnOnExceptions =	System.getProperty(
  +		"org.apache.xml.security.test.warn.on.exceptions", "false").equals("true");
  +
  +	/** Field throwExceptions           */
  +	static final boolean throwExceptions = System.getProperty(
  +		"org.apache.xml.security.test.throw.exceptions", "false").equals("true");
  +
  +	
  +	/* (non-Javadoc)
  +	 * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
  +	 */
  +	public void warning(SAXParseException ex) throws SAXException {
  +		if (IgnoreAllErrorHandler.warnOnExceptions) {
  +			log.warn("", ex);
  +		}
  +		if (IgnoreAllErrorHandler.throwExceptions) {
  +			throw ex;
  +		}
  +	}
  +
  +
  +	/* (non-Javadoc)
  +	 * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
  +	 */
  +	public void error(SAXParseException ex) throws SAXException {
  +		if (IgnoreAllErrorHandler.warnOnExceptions) {
  +			log.error("", ex);
  +		}
  +		if (IgnoreAllErrorHandler.throwExceptions) {
  +			throw ex;
  +		}
  +	}
  +
  +
  +
  +	/* (non-Javadoc)
  +	 * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
  +	 */
  +	public void fatalError(SAXParseException ex) throws SAXException {
  +		if (IgnoreAllErrorHandler.warnOnExceptions) {
  +			log.warn("", ex);
  +		}
  +		if (IgnoreAllErrorHandler.throwExceptions) {
  +			throw ex;
  +		}
  +	}
   }