|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ApplicationRuntimeException.java | - | 100% | 100% | 100% |
|
1 |
// Copyright 2004 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.hivemind;
|
|
16 |
|
|
17 |
/**
|
|
18 |
* General wrapper for any exception (normal or runtime) that may occur during
|
|
19 |
* runtime processing for the application. This is exception is used
|
|
20 |
* when the intent is to communicate a low-level failure to the user or
|
|
21 |
* developer; it is not expected to be caught. The {@link #getRootCause() rootCause}
|
|
22 |
* property is a <em>nested</em> exception.
|
|
23 |
*
|
|
24 |
* @author Howard Lewis Ship
|
|
25 |
*/
|
|
26 |
|
|
27 |
public class ApplicationRuntimeException extends RuntimeException implements Locatable |
|
28 |
{ |
|
29 |
private Throwable _rootCause;
|
|
30 |
private transient Location _location; |
|
31 |
private transient Object _component; |
|
32 |
|
|
33 | 1 |
public ApplicationRuntimeException(Throwable rootCause)
|
34 |
{ |
|
35 | 1 |
this(rootCause.getMessage(), rootCause);
|
36 |
} |
|
37 |
|
|
38 | 37 |
public ApplicationRuntimeException(String message)
|
39 |
{ |
|
40 | 37 |
this(message, null, null, null); |
41 |
} |
|
42 |
|
|
43 | 20 |
public ApplicationRuntimeException(String message, Throwable rootCause)
|
44 |
{ |
|
45 | 20 |
this(message, null, null, rootCause); |
46 |
} |
|
47 |
|
|
48 | 89 |
public ApplicationRuntimeException(
|
49 |
String message, |
|
50 |
Object component, |
|
51 |
Location location, |
|
52 |
Throwable rootCause) |
|
53 |
{ |
|
54 | 89 |
super(message);
|
55 |
|
|
56 | 89 |
_rootCause = rootCause; |
57 | 89 |
_component = component; |
58 |
|
|
59 | 89 |
_location = HiveMind.findLocation(new Object[] { location, rootCause, component });
|
60 |
} |
|
61 |
|
|
62 | 20 |
public ApplicationRuntimeException(String message, Location location, Throwable rootCause)
|
63 |
{ |
|
64 | 20 |
this(message, null, location, rootCause); |
65 |
} |
|
66 |
|
|
67 | 7 |
public Throwable getRootCause()
|
68 |
{ |
|
69 | 7 |
return _rootCause;
|
70 |
} |
|
71 |
|
|
72 | 13 |
public Location getLocation()
|
73 |
{ |
|
74 | 13 |
return _location;
|
75 |
} |
|
76 |
|
|
77 | 7 |
public Object getComponent()
|
78 |
{ |
|
79 | 7 |
return _component;
|
80 |
} |
|
81 |
} |
|