1 17 package com.sun.org.apache.xml.internal.security.utils; 18 19 20 import org.xml.sax.ErrorHandler ; 21 import org.xml.sax.SAXException ; 22 import org.xml.sax.SAXParseException ; 23 24 25 31 public class IgnoreAllErrorHandler implements ErrorHandler { 32 33 34 static java.util.logging.Logger log = 35 java.util.logging.Logger.getLogger( 36 IgnoreAllErrorHandler.class.getName()); 37 38 39 static final boolean warnOnExceptions = System.getProperty( 40 "com.sun.org.apache.xml.internal.security.test.warn.on.exceptions", "false").equals("true"); 41 42 43 static final boolean throwExceptions = System.getProperty( 44 "com.sun.org.apache.xml.internal.security.test.throw.exceptions", "false").equals("true"); 45 46 47 48 public void warning(SAXParseException ex) throws SAXException { 49 if (IgnoreAllErrorHandler.warnOnExceptions) { 50 log.log(java.util.logging.Level.WARNING, "", ex); 51 } 52 if (IgnoreAllErrorHandler.throwExceptions) { 53 throw ex; 54 } 55 } 56 57 58 59 public void error(SAXParseException ex) throws SAXException { 60 if (IgnoreAllErrorHandler.warnOnExceptions) { 61 log.log(java.util.logging.Level.SEVERE, "", ex); 62 } 63 if (IgnoreAllErrorHandler.throwExceptions) { 64 throw ex; 65 } 66 } 67 68 69 70 71 public void fatalError(SAXParseException ex) throws SAXException { 72 if (IgnoreAllErrorHandler.warnOnExceptions) { 73 log.log(java.util.logging.Level.WARNING, "", ex); 74 } 75 if (IgnoreAllErrorHandler.throwExceptions) { 76 throw ex; 77 } 78 } 79 } 80 | Popular Tags |