001package org.apache.commons.jcs3.utils.config; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022/** 023 * This class is based on the log4j class org.apache.log4j.config.PropertySetter that was made by 024 * Anders Kristensen 025 * <p> 026 * Thrown when an error is encountered whilst attempting to set a property using the 027 * {@link PropertySetter}utility class. 028 */ 029public class PropertySetterException 030 extends Exception 031{ 032 /** DOn't change */ 033 private static final long serialVersionUID = -210271658004609028L; 034 035 /** Description of the Field */ 036 private final Throwable rootCause; 037 038 /** 039 * Constructor for the PropertySetterException object 040 * <p> 041 * @param msg 042 */ 043 public PropertySetterException( final String msg ) 044 { 045 super( msg ); 046 this.rootCause = null; 047 } 048 049 /** 050 * Constructor for the PropertySetterException object 051 * <p> 052 * @param rootCause 053 */ 054 public PropertySetterException( final Throwable rootCause ) 055 { 056 this.rootCause = rootCause; 057 } 058 059 /** 060 * Returns descriptive text on the cause of this exception. 061 * <p> 062 * @return The message value 063 */ 064 @Override 065 public String getMessage() 066 { 067 String msg = super.getMessage(); 068 if ( msg == null && rootCause != null ) 069 { 070 msg = rootCause.getMessage(); 071 } 072 return msg; 073 } 074}