1 package org.apache.commons.jcs.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( 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( Throwable rootCause )
55 {
56 super();
57 this.rootCause = rootCause;
58 }
59
60 /**
61 * Returns descriptive text on the cause of this exception.
62 * <p>
63 * @return The message value
64 */
65 @Override
66 public String getMessage()
67 {
68 String msg = super.getMessage();
69 if ( msg == null && rootCause != null )
70 {
71 msg = rootCause.getMessage();
72 }
73 return msg;
74 }
75 }