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 */ 017 package 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 */ 025 public class PropertySetterException extends Exception { 026 private static final long serialVersionUID = -1352613734254235861L; 027 protected Throwable rootCause; 028 029 public PropertySetterException(String msg) { 030 super(msg); 031 } 032 033 public PropertySetterException(Throwable rootCause) { 034 super(); 035 this.rootCause = rootCause; 036 } 037 038 /** 039 * Returns descriptive text on the cause of this exception. 040 */ 041 public String getMessage() { 042 String msg = super.getMessage(); 043 if (msg == null && rootCause != null) { 044 msg = rootCause.getMessage(); 045 } 046 return msg; 047 } 048 }