Coverage Report - org.owasp.dependencycheck.xml.suppression.SuppressionErrorHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
SuppressionErrorHandler
75%
3/4
N/A
1.667
 
 1  
 /*
 2  
  * This file is part of dependency-check-core.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  *
 16  
  * Copyright (c) 2013 Jeremy Long. All Rights Reserved.
 17  
  */
 18  
 package org.owasp.dependencycheck.xml.suppression;
 19  
 
 20  
 import org.owasp.dependencycheck.utils.XmlUtils;
 21  
 import org.xml.sax.ErrorHandler;
 22  
 import org.xml.sax.SAXException;
 23  
 import org.xml.sax.SAXParseException;
 24  
 
 25  
 /**
 26  
  * An XML parsing error handler.
 27  
  *
 28  
  * @author Jeremy Long
 29  
  */
 30  14
 public class SuppressionErrorHandler implements ErrorHandler {
 31  
 
 32  
     /**
 33  
      * The logger.
 34  
      */
 35  
     //private static final Logger LOGGER = LoggerFactory.getLogger(SuppressionErrorHandler.class);
 36  
 
 37  
     /**
 38  
      * Logs warnings.
 39  
      *
 40  
      * @param ex the warning to log
 41  
      * @throws SAXException is never thrown
 42  
      */
 43  
     @Override
 44  
     public void warning(SAXParseException ex) throws SAXException {
 45  
         //LOGGER.debug("", ex);
 46  3
     }
 47  
 
 48  
     /**
 49  
      * Handles errors.
 50  
      *
 51  
      * @param ex the error to handle
 52  
      * @throws SAXException is always thrown
 53  
      */
 54  
     @Override
 55  
     public void error(SAXParseException ex) throws SAXException {
 56  3
         throw new SAXException(XmlUtils.getPrettyParseExceptionInfo(ex));
 57  
     }
 58  
 
 59  
     /**
 60  
      * Handles fatal exceptions.
 61  
      *
 62  
      * @param ex a fatal exception
 63  
      * @throws SAXException is always
 64  
      */
 65  
     @Override
 66  
     public void fatalError(SAXParseException ex) throws SAXException {
 67  0
         throw new SAXException(XmlUtils.getPrettyParseExceptionInfo(ex));
 68  
     }
 69  
 }