View Javadoc

1   package org.apache.jcs.config;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /***
23   * This class is based on the log4j class org.apache.log4j.config.PropertySetter
24   * that was made by Anders Kristensen
25   *
26   */
27  
28  /***
29   * Thrown when an error is encountered whilst attempting to set a property using
30   * the {@link PropertySetter}utility class.
31   *
32   * @since 1.1
33   */
34  public class PropertySetterException
35      extends Exception
36  {
37      private static final long serialVersionUID = -210271658004609028L;
38  
39      /*** Description of the Field */
40      protected Throwable rootCause;
41  
42      /***
43       * Constructor for the PropertySetterException object
44       *
45       * @param msg
46       */
47      public PropertySetterException( String msg )
48      {
49          super( msg );
50      }
51  
52      /***
53       * Constructor for the PropertySetterException object
54       *
55       * @param rootCause
56       */
57      public PropertySetterException( Throwable rootCause )
58      {
59          super();
60          this.rootCause = rootCause;
61      }
62  
63      /***
64       * Returns descriptive text on the cause of this exception.
65       *
66       * @return The message value
67       */
68  
69      public String getMessage()
70      {
71          String msg = super.getMessage();
72          if ( msg == null && rootCause != null )
73          {
74              msg = rootCause.getMessage();
75          }
76          return msg;
77      }
78  }