001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)ConfigErrorHandler.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.internal.security.config;
030:
031: import com.sun.jbi.StringTranslator;
032: import com.sun.jbi.internal.security.LocalStringConstants;
033:
034: import java.util.logging.Logger;
035: import org.xml.sax.ErrorHandler;
036: import org.xml.sax.SAXException;
037: import org.xml.sax.SAXParseException;
038:
039: /**
040: * Implementation of the ErrorHandler.
041: * @author Sun Microsystems, Inc.
042: */
043: public class ConfigErrorHandler implements ErrorHandler {
044: /** Private Logger for logging information. */
045: private Logger mLogger;
046:
047: /** The String Translator. */
048: private StringTranslator mTranslator;
049:
050: /**
051: * Creates a new instance of ConfigErrorHandler.
052: * @param translator is the String Translator
053: */
054: public ConfigErrorHandler(StringTranslator translator) {
055: mTranslator = translator;
056: mLogger = Logger
057: .getLogger(com.sun.jbi.internal.security.Constants.PACKAGE);
058: }
059:
060: /**
061: * Callback for parser errors.
062: * @param exception is the SAXParseException
063: * @throws org.xml.sax.SAXException on errors
064: */
065: public void error(SAXParseException exception) throws SAXException {
066: mLogger.severe(mTranslator.getString(
067: LocalStringConstants.BC_ERR_SAX_PARSING_EX,
068: new Integer(exception.getLineNumber()), new Integer(
069: exception.getColumnNumber()), exception
070: .toString()));
071: throw exception;
072: }
073:
074: /**
075: * Callback for parser fatal errors.
076: * @param exception is the SAXParseException
077: * @throws org.xml.sax.SAXException on errors
078: */
079: public void fatalError(SAXParseException exception)
080: throws SAXException {
081: mLogger.severe(mTranslator.getString(
082: LocalStringConstants.BC_ERR_SAX_PARSING_EX,
083: new Integer(exception.getLineNumber()), new Integer(
084: exception.getColumnNumber()), exception
085: .toString()));
086: throw exception;
087: }
088:
089: /**
090: * Callback for parser warnings.
091: * @param exception is the SAXParseException
092: * @throws org.xml.sax.SAXException on warnings
093: */
094: public void warning(SAXParseException exception)
095: throws SAXException {
096:
097: mLogger.severe(mTranslator.getString(
098: LocalStringConstants.BC_ERR_SAX_PARSING_EX,
099: new Integer(exception.getLineNumber()), new Integer(
100: exception.getColumnNumber()), exception
101: .toString()));
102: throw exception;
103: }
104:
105: }
|