View Javadoc
1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.commons.logging;
18  
19  /**
20   * <p>
21   * An exception that is thrown only if a suitable <code>LogFactory</code> or
22   * <code>Log</code> instance cannot be created by the corresponding factory
23   * methods.
24   * 
25   * 
26   * <p>
27   * In this version of JCL, this exception will never be thrown in practice.
28   * However, it is included here to ensure total compile time and run time
29   * compatibility with the original JCL 1.0.4.
30   * 
31   * @author Craig R. McClanahan
32   */
33  
34  public class LogConfigurationException extends RuntimeException {
35  
36      private static final long serialVersionUID = 8486587136871052495L;
37  
38      /**
39       * Construct a new exception with <code>null</code> as its detail message.
40       */
41      public LogConfigurationException() {
42          super();
43      }
44  
45      /**
46       * Construct a new exception with the specified detail message.
47       * 
48       * @param message
49       *          The detail message
50       */
51      public LogConfigurationException(String message) {
52          super(message);
53      }
54  
55      /**
56       * Construct a new exception with the specified cause and a derived detail
57       * message.
58       * 
59       * @param cause
60       *          The underlying cause
61       */
62      public LogConfigurationException(Throwable cause) {
63  
64          this((cause == null) ? null : cause.toString(), cause);
65  
66      }
67  
68      /**
69       * Construct a new exception with the specified detail message and cause.
70       * 
71       * @param message
72       *          The detail message
73       * @param cause
74       *          The underlying cause
75       */
76      public LogConfigurationException(String message, Throwable cause) {
77          super(message + " (Caused by " + cause + ")");
78          this.cause = cause; // Two-argument version requires JDK 1.4 or later
79      }
80  
81      /**
82       * The underlying cause of this exception.
83       */
84      protected Throwable cause = null;
85  
86      /**
87       * Return the underlying cause of this exception (if any).
88       */
89      public Throwable getCause() {
90          return (this.cause);
91      }
92  
93  }