|
1 |
| package org.jconfig.error; |
|
2 |
| |
|
3 |
| import org.jconfig.utils.*; |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| public class ErrorReporter { |
|
17 |
| |
|
18 |
| private static ErrorHandler eh = null; |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
14
| public static ErrorHandler getErrorHandler() {
|
|
26 |
14
| if ( eh == null ) {
|
|
27 |
1
| String name = findHandler();
|
|
28 |
1
| if ( name == null ) {
|
|
29 |
1
| eh = getDefaultHandler();
|
|
30 |
| } |
|
31 |
| else { |
|
32 |
0
| try {
|
|
33 |
0
| eh = (ErrorHandler)Class.forName(name).newInstance();
|
|
34 |
| } |
|
35 |
| catch (Exception e) { |
|
36 |
0
| eh = getDefaultHandler();
|
|
37 |
| } |
|
38 |
| } |
|
39 |
| } |
|
40 |
14
| return eh;
|
|
41 |
| } |
|
42 |
| |
|
43 |
1
| private static ErrorHandler getDefaultHandler() {
|
|
44 |
| |
|
45 |
1
| return new NullDeviceErrorHandler();
|
|
46 |
| } |
|
47 |
| |
|
48 |
1
| private static String findHandler() {
|
|
49 |
1
| return ConfigurationUtils.getConfigProperty("jconfig.errorhandler");
|
|
50 |
| } |
|
51 |
| } |