Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.xml » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements. See the NOTICE file distributed with this
    4    * work for additional information regarding copyright ownership. The ASF
    5    * licenses this file to You under the Apache License, Version 2.0 (the
    6    * "License"); you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
    9    * or agreed to in writing, software distributed under the License is
   10    * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   11    * KIND, either express or implied. See the License for the specific language
   12    * governing permissions and limitations under the License.
   13    */
   14   package org.apache.webbeans.xml;
   15   
   16   import org.apache.webbeans.exception.WebBeansException;
   17   import org.apache.webbeans.logger.WebBeansLogger;
   18   import org.xml.sax.ErrorHandler;
   19   import org.xml.sax.SAXException;
   20   import org.xml.sax.SAXParseException;
   21   
   22   /**
   23    * Implementation of the {@link ErrorHandler} .
   24    * <p>
   25    * Error handler that is used for handling errors while parsing the document.
   26    * </p>
   27    * 
   28    * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
   29    * @since 1.0
   30    */
   31   public class WebBeansErrorHandler implements ErrorHandler
   32   {
   33       private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansErrorHandler.class);
   34   
   35       public void error(SAXParseException exception) throws SAXException
   36       {
   37           logger.error(exception.getMessage(), exception.getCause());
   38           throw new WebBeansException(exception);
   39       }
   40   
   41       public void fatalError(SAXParseException exception) throws SAXException
   42       {
   43           logger.fatal(exception.getMessage(), exception.getCause());
   44           throw new WebBeansException(exception);
   45       }
   46   
   47       public void warning(SAXParseException exception) throws SAXException
   48       {
   49           logger.debug(exception.getMessage(), exception.getCause());
   50       }
   51   
   52   }

Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.xml » [javadoc | source]