View Javadoc
1   package org.apache.commons.jcs3.utils.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 that was made by
24   * Anders Kristensen
25   * <p>
26   * Thrown when an error is encountered whilst attempting to set a property using the
27   * {@link PropertySetter}utility class.
28   */
29  public class PropertySetterException
30      extends Exception
31  {
32      /** DOn't change */
33      private static final long serialVersionUID = -210271658004609028L;
34  
35      /** Description of the Field */
36      private final Throwable rootCause;
37  
38      /**
39       * Constructor for the PropertySetterException object
40       * <p>
41       * @param msg
42       */
43      public PropertySetterException( final String msg )
44      {
45          super( msg );
46          this.rootCause = null;
47      }
48  
49      /**
50       * Constructor for the PropertySetterException object
51       * <p>
52       * @param rootCause
53       */
54      public PropertySetterException( final Throwable rootCause )
55      {
56          this.rootCause = rootCause;
57      }
58  
59      /**
60       * Returns descriptive text on the cause of this exception.
61       * <p>
62       * @return The message value
63       */
64      @Override
65      public String getMessage()
66      {
67          String msg = super.getMessage();
68          if ( msg == null && rootCause != null )
69          {
70              msg = rootCause.getMessage();
71          }
72          return msg;
73      }
74  }