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