KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > rdf > arp > ARPSaxErrorHandler


1 /*
2  * (c) Copyright 2001, 2002 Hewlett-Packard Development Company, LP
3  * See end of file.
4  */

5
6 package com.hp.hpl.jena.rdf.arp;
7
8 import com.hp.hpl.jena.rdf.model.RDFErrorHandler;
9 import org.xml.sax.SAXParseException JavaDoc;
10 import org.xml.sax.SAXException JavaDoc;
11 /**
12  * This class is not part of the API.
13  * It is public merely for test purposes.
14  * @author Jeremy Carroll
15  *
16  *
17  */

18 public class ARPSaxErrorHandler extends Object JavaDoc implements org.xml.sax.ErrorHandler JavaDoc {
19     protected RDFErrorHandler errorHandler;
20     
21     public ARPSaxErrorHandler(RDFErrorHandler errorHandler) {
22         this.errorHandler = errorHandler;
23     }
24     
25     public void error(SAXParseException JavaDoc e) throws SAXException JavaDoc {
26         ParseException pe = null;
27         if ( e instanceof ParseException ) {
28            pe = (ParseException)e;
29            pe.promoteMe = false;
30         }
31         errorHandler.error(e);
32         if ( pe!=null &&pe.promoteMe ) {
33             pe.promoteMe = false;
34             throw pe;
35         }
36     }
37     
38     public void warning(SAXParseException JavaDoc e) throws SAXException JavaDoc {
39         ParseException pe = null;
40         if ( e instanceof ParseException ) {
41            pe = (ParseException)e;
42            pe.promoteMe = false;
43         }
44         errorHandler.warning(e);
45         if ( pe!=null &&pe.promoteMe ) {
46             pe.promoteMe = false;
47             throw pe;
48         }
49     }
50     
51     public void fatalError(SAXParseException JavaDoc e) throws SAXException JavaDoc {
52         ParseException pe = null;
53         if ( e instanceof ParseException ) {
54            pe = (ParseException)e;
55            pe.promoteMe = false;
56         }
57         errorHandler.fatalError(e);
58         if ( pe!=null &&pe.promoteMe ) {
59             pe.promoteMe = false;
60             throw pe;
61         }
62     }
63
64     /**
65      * @param errorHandler The errorHandler to set.
66      */

67     void setErrorHandler(RDFErrorHandler errorHandler) {
68         this.errorHandler = errorHandler;
69     }
70
71 }
72 /*
73  * (c) Copyright 2001, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
74  * All rights reserved.
75  *
76  * Redistribution and use in source and binary forms, with or without
77  * modification, are permitted provided that the following conditions
78  * are met:
79  * 1. Redistributions of source code must retain the above copyright
80  * notice, this list of conditions and the following disclaimer.
81  * 2. Redistributions in binary form must reproduce the above copyright
82  * notice, this list of conditions and the following disclaimer in the
83  * documentation and/or other materials provided with the distribution.
84  * 3. The name of the author may not be used to endorse or promote products
85  * derived from this software without specific prior written permission.
86
87  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
88  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
89  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
90  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
91  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
92  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
93  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
94  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
95  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
96  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
97  */
Popular Tags