View Javadoc

1   /***
2    * Copyright 2007 the original author or authors.
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   * For more information visit
11   *         http://72miles.com and
12   *         http://architecturerules.googlecode.com/svn/docs/index.html
13   */
14  
15  package com.seventytwomiles.architecturerules.configuration.xml;
16  
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.xml.sax.ErrorHandler;
21  import org.xml.sax.SAXException;
22  import org.xml.sax.SAXParseException;
23  
24  
25  
26  /***
27   * <p>Implementation of <code>ErrorHandler</code> to handle errors within
28   * commons digester parsing.</p>
29   *
30   * @author mikenereson
31   * @see ErrorHandler
32   */
33  class SaxErrorHandler implements ErrorHandler {
34  
35  
36      protected static final Log log = LogFactory.getLog(SaxErrorHandler.class);
37  
38  
39      /***
40       * @see ErrorHandler#error(SAXParseException)
41       */
42      public void error(final SAXParseException exception) throws SAXException {
43          log.error("error", exception);
44      }
45  
46  
47      /***
48       * @see ErrorHandler#fatalError(SAXParseException)
49       */
50      public void fatalError(final SAXParseException exception)
51              throws SAXException {
52          log.error("fatal error", exception);
53      }
54  
55  
56      /***
57       * @see ErrorHandler#warning(SAXParseException)
58       */
59      public void warning(final SAXParseException exception) throws SAXException {
60          log.warn(exception);
61      }
62  }