Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
ApplicationException |
|
| 1.0;1 |
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | ||
18 | package org.apache.shale.view; |
|
19 | ||
20 | import java.util.ArrayList; |
|
21 | import java.util.List; |
|
22 | ||
23 | /** |
|
24 | * <p>Runtime exception encapsulating a <code>List</code> of exceptions that |
|
25 | * have occurred during the request processing lifecycle.</p> |
|
26 | * |
|
27 | * @since 1.0.3 |
|
28 | */ |
|
29 | public class ApplicationException extends RuntimeException { |
|
30 | ||
31 | ||
32 | // ------------------------------------------------------------ Constructors |
|
33 | ||
34 | ||
35 | /** |
|
36 | * Serial version UID. |
|
37 | */ |
|
38 | private static final long serialVersionUID = 2180307410483666456L; |
|
39 | ||
40 | ||
41 | /** |
|
42 | * <p>Construct an exception with no message.</p> |
|
43 | */ |
|
44 | public ApplicationException() { |
|
45 | 0 | super(); |
46 | 0 | } |
47 | ||
48 | ||
49 | ||
50 | /** |
|
51 | * <p>Construct an exception with the specified message.</p> |
|
52 | * |
|
53 | * @param message The exception message |
|
54 | */ |
|
55 | public ApplicationException(String message) { |
|
56 | 0 | super(message); |
57 | 0 | } |
58 | ||
59 | ||
60 | /** |
|
61 | * <p>Construct an exception with the specified message and cause.</p> |
|
62 | * |
|
63 | * @param message The exception message |
|
64 | * @param cause The root cause |
|
65 | */ |
|
66 | public ApplicationException(String message, Throwable cause) { |
|
67 | 0 | super(message, cause); |
68 | 0 | this.exceptions = new ArrayList(1); |
69 | 0 | this.exceptions.add(cause); |
70 | 0 | } |
71 | ||
72 | ||
73 | /** |
|
74 | * <p>Construct an exception with the specified cause.</p> |
|
75 | * |
|
76 | * @param cause The root cause |
|
77 | */ |
|
78 | public ApplicationException(Throwable cause) { |
|
79 | 0 | super(cause); |
80 | 0 | this.exceptions = new ArrayList(1); |
81 | 0 | this.exceptions.add(cause); |
82 | 0 | } |
83 | ||
84 | ||
85 | /** |
|
86 | * <p>Construct an exception with the specified <code>List</code> of |
|
87 | * causes. The first exception in the list will be logged as the |
|
88 | * formal cause of this exception.</p> |
|
89 | * |
|
90 | * @param exceptions List of exceptions that have been thrown |
|
91 | */ |
|
92 | public ApplicationException(List exceptions) { |
|
93 | 0 | super((Exception) exceptions.get(0)); |
94 | 0 | this.exceptions = exceptions; |
95 | 0 | } |
96 | ||
97 | ||
98 | // ------------------------------------------------------- Public Properties |
|
99 | ||
100 | ||
101 | /** |
|
102 | * <p><code>List</code> of exceptions that are the cumulative cause of |
|
103 | * this exception.</p> |
|
104 | */ |
|
105 | private List exceptions; |
|
106 | ||
107 | ||
108 | /** |
|
109 | * <p>Return a <code>List</code> of exceptoins that are the cumulative |
|
110 | * cause of this exception.</p> |
|
111 | */ |
|
112 | public List getExceptions() { |
|
113 | 0 | return this.exceptions; |
114 | } |
|
115 | ||
116 | ||
117 | } |