1 package org.devaki.nextobjects.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 import org.apache.commons.logging.Log;
17 import org.apache.commons.logging.LogFactory;
18 import org.xml.sax.ErrorHandler;
19 import org.xml.sax.SAXException;
20 import org.xml.sax.SAXParseException;
21 /***
22 * Implementation of ErrorHandler interface
23 * @author <a href="mailto:eflorent@devaki.org">Emmanuel Florent</a>
24 * */
25 class NOErrorHandler implements ErrorHandler
26 {
27 /*** The logger */
28 private static Log logger =
29 LogFactory.getLog(NOErrorHandler.class.getName());
30 /***
31 * warning
32 * @param exception the exception
33 * @throws SAXException sax exception
34 */
35 public final void warning(final SAXParseException exception)
36 throws SAXException
37 {
38 logger.warn(
39 exception.getMessage() + " Line: " + exception.getLineNumber());
40 throw new SAXException("Warning encountered");
41 }
42 /***
43 * error
44 * @param exception the exception
45 * @throws SAXException sax exception
46 */
47 public final void error(final SAXParseException exception)
48 throws SAXException
49 {
50 logger.error(
51 exception.getMessage() + " Line: " + exception.getLineNumber());
52 throw new SAXException("Error encountered");
53 }
54 /***
55 * fatal Error
56 * @param exception the exception
57 * @throws SAXException sax exception
58 */
59 public final void fatalError(final SAXParseException exception)
60 throws SAXException
61 {
62 logger.error(
63 exception.getMessage() + " Line: " + exception.getLineNumber());
64 logger.error("I give up");
65 throw new SAXException("Fatal Error encountered");
66 }
67 }