1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.apache.commons.resources;
25
26 import java.io.Serializable;
27
28 /***
29 * <p>This class is a general purpose wrapper exception for problems
30 * pertaining to Resources.</p>
31 */
32 public class ResourcesException extends RuntimeException implements Serializable {
33
34 /*** Exception message */
35 private String message = "";
36
37 /*** Cause of the exception */
38 private Throwable rootCause = null;
39
40 /***
41 * Construct an Exception with the specified message.
42 * @param message The message.
43 */
44 public ResourcesException(String message) {
45 this(message, null);
46 }
47
48 /***
49 * Construct an Exception with the specified cause.
50 * @param rootCause Cause of the exception.
51 */
52 public ResourcesException(Throwable rootCause) {
53 this.message = rootCause.getMessage();
54 this.rootCause = rootCause;
55 }
56
57 /***
58 * Construct an Exception with the specified message.
59 * and cause.
60 * @param message The message.
61 * @param rootCause Cause of the exception.
62 */
63 public ResourcesException(String message, Throwable rootCause) {
64 this.message = message;
65 this.rootCause = rootCause;
66 }
67
68 /***
69 * Return the message.
70 * @return The message.
71 */
72 public String getMessage() {
73 return message;
74 }
75
76 /***
77 * Return the cause.
78 * @return The cause of the Exception.
79 */
80 public Throwable getRootCause() {
81 return rootCause;
82 }
83 }