01: /*
02: (c) Copyright 2001-2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: [See end of file]
04: $Id: RDFDefaultErrorHandler.java,v 1.13 2008/01/02 12:05:01 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.rdf.model.impl;
08:
09: import com.hp.hpl.jena.rdf.arp.ParseException;
10: import com.hp.hpl.jena.rdf.model.*;
11: import com.hp.hpl.jena.shared.*;
12:
13: import org.apache.commons.logging.Log;
14: import org.apache.commons.logging.LogFactory;
15:
16: /**
17: * The default error handler for I/O.
18: * This uses log4j as its utility.
19: * @author jjc,bwm
20: * @version $Revision: 1.13 $ $Date: 2008/01/02 12:05:01 $
21: */
22: public class RDFDefaultErrorHandler extends Object implements
23: RDFErrorHandler {
24:
25: /**
26: * Change this global to make all RDFDefaultErrorHandler's silent!
27: * Intended for testing purposes only.
28: */
29: public static boolean silent = false;
30:
31: public static final Log logger = LogFactory
32: .getLog(RDFDefaultErrorHandler.class);
33:
34: /** Creates new RDFDefaultErrorHandler */
35: public RDFDefaultErrorHandler() {
36: }
37:
38: public void warning(Exception e) {
39: if (!silent)
40: logger.warn(ParseException.formatMessage(e));
41: }
42:
43: public void error(Exception e) {
44: if (!silent)
45: logger.error(ParseException.formatMessage(e));
46: }
47:
48: public void fatalError(Exception e) {
49: if (!silent)
50: logger.error(ParseException.formatMessage(e));
51: throw e instanceof RuntimeException ? (RuntimeException) e
52: : new JenaException(e);
53: }
54: }
55: /*
56: * (c) Copyright 2001-2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
57: * All rights reserved.
58: *
59: * Redistribution and use in source and binary forms, with or without
60: * modification, are permitted provided that the following conditions
61: * are met:
62: * 1. Redistributions of source code must retain the above copyright
63: * notice, this list of conditions and the following disclaimer.
64: * 2. Redistributions in binary form must reproduce the above copyright
65: * notice, this list of conditions and the following disclaimer in the
66: * documentation and/or other materials provided with the distribution.
67: * 3. The name of the author may not be used to endorse or promote products
68: * derived from this software without specific prior written permission.
69:
70: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
71: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
72: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
73: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
74: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
75: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
76: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
77: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
78: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
79: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80: *
81: * $Id: RDFDefaultErrorHandler.java,v 1.13 2008/01/02 12:05:01 andy_seaborne Exp $
82: */
|