001 /* 002 * $Id: ResourcesException.java 348357 2005-11-23 03:59:22Z niallp $ 003 * $Revision: 348357 $ 004 * $Date: 2005-11-23 03:59:22 +0000 (Wed, 23 Nov 2005) $ 005 * 006 * ==================================================================== 007 * 008 * Copyright 2003-2005 The Apache Software Foundation 009 * 010 * Licensed under the Apache License, Version 2.0 (the "License"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an "AS IS" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * 022 */ 023 024 package org.apache.commons.resources; 025 026 import java.io.Serializable; 027 028 /** 029 * <p>This class is a general purpose wrapper exception for problems 030 * pertaining to Resources.</p> 031 */ 032 public class ResourcesException extends RuntimeException implements Serializable { 033 034 /** Exception message */ 035 private String message = ""; 036 037 /** Cause of the exception */ 038 private Throwable rootCause = null; 039 040 /** 041 * Construct an Exception with the specified message. 042 * @param message The message. 043 */ 044 public ResourcesException(String message) { 045 this(message, null); 046 } 047 048 /** 049 * Construct an Exception with the specified cause. 050 * @param rootCause Cause of the exception. 051 */ 052 public ResourcesException(Throwable rootCause) { 053 this.message = rootCause.getMessage(); 054 this.rootCause = rootCause; 055 } 056 057 /** 058 * Construct an Exception with the specified message. 059 * and cause. 060 * @param message The message. 061 * @param rootCause Cause of the exception. 062 */ 063 public ResourcesException(String message, Throwable rootCause) { 064 this.message = message; 065 this.rootCause = rootCause; 066 } 067 068 /** 069 * Return the message. 070 * @return The message. 071 */ 072 public String getMessage() { 073 return message; 074 } 075 076 /** 077 * Return the cause. 078 * @return The cause of the Exception. 079 */ 080 public Throwable getRootCause() { 081 return rootCause; 082 } 083 }