KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > transcoder > DefaultErrorHandler


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        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  */

18 package org.apache.batik.transcoder;
19
20 /**
21  * A default <tt>ErrorHandler</tt> that throws a
22  * <tt>TranscoderException</tt> when a fatal error occured and display
23  * a message when a warning or an error occured.
24  *
25  * @author <a HREF="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
26  * @version $Id: DefaultErrorHandler.java,v 1.3 2004/08/18 07:15:41 vhardy Exp $
27  */

28 public class DefaultErrorHandler implements ErrorHandler {
29
30     /**
31      * Invoked when an error occured while transcoding.
32      * @param ex the error informations encapsulated in a TranscoderException
33      * @exception TranscoderException if the method want to forward
34      * the exception
35      */

36     public void error(TranscoderException ex) throws TranscoderException {
37         System.err.println("ERROR: "+ex.getMessage());
38     }
39
40     /**
41      * Invoked when an fatal error occured while transcoding.
42      * @param ex the fatal error informations encapsulated in a
43      * TranscoderException
44      * @exception TranscoderException if the method want to forward
45      * the exception
46      */

47     public void fatalError(TranscoderException ex) throws TranscoderException {
48         throw ex;
49     }
50
51     /**
52      * Invoked when a warning occured while transcoding.
53      * @param ex the warning informations encapsulated in a TranscoderException
54      * @exception TranscoderException if the method want to forward
55      * the exception
56      */

57     public void warning(TranscoderException ex) throws TranscoderException {
58         System.err.println("WARNING: "+ex.getMessage());
59     }
60 }
61
Popular Tags