01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.components.validation.impl;
18:
19: import org.xml.sax.ErrorHandler;
20: import org.xml.sax.SAXException;
21: import org.xml.sax.SAXParseException;
22:
23: /**
24: * <p>An implementation of the {@link ErrorHandler} interface re-throwing
25: * all exceptions passed to it.</p>
26: *
27: */
28: public final class DraconianErrorHandler implements ErrorHandler {
29:
30: /** <p>The singleton instance of the {@link DraconianErrorHandler}.</p> */
31: public static final DraconianErrorHandler INSTANCE = new DraconianErrorHandler();
32:
33: /** <p>Deny normal construction of instances of this class.</p> */
34: private DraconianErrorHandler() {
35: }
36:
37: /**
38: * <p>Simply re-throw the specified {@link SAXParseException}.</p>
39: */
40: public void warning(SAXParseException exception)
41: throws SAXException {
42: throw exception;
43: }
44:
45: /**
46: * <p>Simply re-throw the specified {@link SAXParseException}.</p>
47: */
48: public void error(SAXParseException exception) throws SAXException {
49: throw exception;
50: }
51:
52: /**
53: * <p>Simply re-throw the specified {@link SAXParseException}.</p>
54: */
55: public void fatalError(SAXParseException exception)
56: throws SAXException {
57: throw exception;
58: }
59: }
|