Source code

    001/*
    002 * Copyright 2001-2004 The Apache Software Foundation.
    003 *
    004 * Licensed under the Apache License, Version 2.0 (the "License");
    005 * you may not use this file except in compliance with the License.
    006 * You may obtain a copy of the License at
    007 *
    008 *      http://www.apache.org/licenses/LICENSE-2.0
    009 *
    010 * Unless required by applicable law or agreed to in writing, software
    011 * distributed under the License is distributed on an "AS IS" BASIS,
    012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    013 * See the License for the specific language governing permissions and
    014 * limitations under the License.
    015 */
    016
    017package org.apache.commons.logging;
    018
    019/**
    020 * <p>
    021 * An exception that is thrown only if a suitable <code>LogFactory</code> or
    022 * <code>Log</code> instance cannot be created by the corresponding factory
    023 * methods.
    024 * </p>
    025 *
    026 * <p>
    027 * In this version of JCL, this exception will never be thrown in practice.
    028 * However, it is included here to ensure total compile time and run time
    029 * compatibility with the original JCL 1.0.4.
    030 *
    031 * @author Craig R. McClanahan
    032 */
    033
    034public class LogConfigurationException extends RuntimeException {
    035
    036    private static final long serialVersionUID = 8486587136871052495L;
    037
    038    /**
    039     * Construct a new exception with <code>null</code> as its detail message.
    040     */
    041    public LogConfigurationException() {
    042        super();
    043    }
    044
    045    /**
    046     * Construct a new exception with the specified detail message.
    047     *
    048     * @param message
    049     *          The detail message
    050     */
    051    public LogConfigurationException(String message) {
    052        super(message);
    053    }
    054
    055    /**
    056     * Construct a new exception with the specified cause and a derived detail
    057     * message.
    058     *
    059     * @param cause
    060     *          The underlying cause
    061     */
    062    public LogConfigurationException(Throwable cause) {
    063
    064        this((cause == null) ? null : cause.toString(), cause);
    065
    066    }
    067
    068    /**
    069     * Construct a new exception with the specified detail message and cause.
    070     *
    071     * @param message
    072     *          The detail message
    073     * @param cause
    074     *          The underlying cause
    075     */
    076    public LogConfigurationException(String message, Throwable cause) {
    077        super(message + " (Caused by " + cause + ")");
    078        this.cause = cause; // Two-argument version requires JDK 1.4 or later
    079    }
    080
    081    /**
    082     * The underlying cause of this exception.
    083     */
    084    protected Throwable cause = null;
    085
    086    /**
    087     * Return the underlying cause of this exception (if any).
    088     */
    089    public Throwable getCause() {
    090        return (this.cause);
    091    }
    092
    093}