1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.gridsystems.beanfilter;
18
19 import java.util.MissingResourceException;
20 import java.util.ResourceBundle;
21
22 import com.gridsystems.innergrid.kernel.KernelException;
23
24
25
26
27
28
29 public class EvalException extends KernelException {
30
31
32
33
34 private static final long serialVersionUID = -3283117668362489095L;
35
36
37
38
39 private static final ResourceBundle BUNDLE;
40
41 static {
42 ResourceBundle bundle;
43 try {
44 bundle = ResourceBundle.getBundle("eval-errors");
45 } catch (MissingResourceException e) {
46 bundle = null;
47 }
48 BUNDLE = bundle;
49 }
50
51
52
53
54
55
56
57 public EvalException(String code, Object... params) {
58 this(null, code, params);
59 }
60
61
62
63
64
65
66
67
68 public EvalException(Throwable cause, String code, Object... params) {
69 super(cause, code, getPattern(code), params);
70 }
71
72
73
74
75
76
77
78 private static String getPattern(String code) {
79 try {
80 if (code == null) {
81 return "null#notfound";
82 } else if (BUNDLE == null) {
83 return code + "#notfound";
84 } else {
85 return BUNDLE.getString(code);
86 }
87 } catch (MissingResourceException e) {
88 return code + "#notfound";
89 }
90 }
91 }