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 net.smartlab.web; |
25 |
|
|
26 |
|
import javax.servlet.http.HttpServletRequest; |
27 |
|
|
28 |
|
import org.apache.commons.validator.Field; |
29 |
|
import org.apache.commons.validator.GenericValidator; |
30 |
|
import org.apache.commons.validator.ValidatorAction; |
31 |
|
import org.apache.commons.validator.util.ValidatorUtils; |
32 |
|
import org.apache.struts.action.ActionErrors; |
33 |
|
import org.apache.struts.validator.Resources; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@author |
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0,6 |
|
41 |
|
public class Validator { |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@param |
47 |
|
@param |
48 |
|
@param |
49 |
|
@param |
50 |
|
@param |
51 |
|
@return |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0,5 |
|
53 |
0
|
public static boolean confirmed(Object bean, ValidatorAction action, Field field, ActionErrors errors, HttpServletRequest request) {... |
54 |
0
|
String value = ValidatorUtils.getValueAsString(bean, field.getProperty()); |
55 |
0
|
String confirm = ValidatorUtils.getValueAsString(bean, field.getVarValue("confirm")); |
56 |
0
|
if (!GenericValidator.isBlankOrNull(value)) { |
57 |
0
|
try { |
58 |
0
|
if (!value.equals(confirm)) { |
59 |
0
|
errors.add(field.getKey(), Resources.getActionMessage(request, action, field)); |
60 |
0
|
return false; |
61 |
|
} |
62 |
|
} catch (Exception e) { |
63 |
|
errors.add(field.getKey(), Resources.getActionMessage(request, action, field)); |
64 |
|
return false; |
65 |
|
} |
66 |
|
} |
67 |
0
|
return true; |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
@param |
74 |
|
@param |
75 |
|
@param |
76 |
|
@param |
77 |
|
@param |
78 |
|
@return |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
0
|
public static boolean before(Object bean, ValidatorAction action, Field field, ActionErrors errors, HttpServletRequest request) {... |
81 |
0
|
return true; |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
@param |
88 |
|
@param |
89 |
|
@param |
90 |
|
@param |
91 |
|
@param |
92 |
|
@return |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
0
|
public static boolean after(Object bean, ValidatorAction action, Field field, ActionErrors errors, HttpServletRequest request) {... |
95 |
0
|
return true; |
96 |
|
} |
97 |
|
} |