19
19
package org .apache .struts2 .config_browser ;
20
20
21
21
import com .opensymphony .xwork2 .inject .Inject ;
22
- import com .opensymphony .xwork2 .util .reflection .ReflectionContextFactory ;
23
22
import com .opensymphony .xwork2 .util .reflection .ReflectionException ;
24
23
import com .opensymphony .xwork2 .util .reflection .ReflectionProvider ;
25
24
import com .opensymphony .xwork2 .validator .Validator ;
26
25
import org .apache .logging .log4j .LogManager ;
27
26
import org .apache .logging .log4j .Logger ;
27
+ import org .apache .struts2 .ActionContext ;
28
28
import org .apache .struts2 .interceptor .parameter .StrutsParameter ;
29
29
30
30
import java .beans .BeanInfo ;
@@ -49,19 +49,13 @@ public class ShowValidatorAction extends ListValidatorsAction {
49
49
private Set <PropertyInfo > properties = Collections .emptySet ();
50
50
private int selected = 0 ;
51
51
52
- ReflectionProvider reflectionProvider ;
53
- ReflectionContextFactory reflectionContextFactory ;
52
+ private ReflectionProvider reflectionProvider ;
54
53
55
54
@ Inject
56
55
public void setReflectionProvider (ReflectionProvider prov ) {
57
56
this .reflectionProvider = prov ;
58
57
}
59
58
60
- @ Inject
61
- public void setReflectionContextFactory (ReflectionContextFactory fac ) {
62
- this .reflectionContextFactory = fac ;
63
- }
64
-
65
59
public int getSelected () {
66
60
return selected ;
67
61
}
@@ -85,7 +79,6 @@ public String execute() throws Exception {
85
79
Validator validator = getSelectedValidator ();
86
80
properties = new TreeSet <>();
87
81
try {
88
- Map <String , Object > context = reflectionContextFactory .createDefaultContext (validator );
89
82
BeanInfo beanInfoFrom ;
90
83
try {
91
84
beanInfoFrom = Introspector .getBeanInfo (validator .getClass (), Object .class );
@@ -97,6 +90,7 @@ public String execute() throws Exception {
97
90
98
91
PropertyDescriptor [] pds = beanInfoFrom .getPropertyDescriptors ();
99
92
93
+ Map <String , Object > context = ActionContext .getContext ().getContextMap ();
100
94
for (PropertyDescriptor pd : pds ) {
101
95
String name = pd .getName ();
102
96
Object value = null ;
@@ -113,9 +107,9 @@ public String execute() throws Exception {
113
107
}
114
108
} catch (Exception e ) {
115
109
if (LOG .isWarnEnabled ()) {
116
- LOG .warn ("Unable to retrieve properties." , e );
110
+ LOG .warn ("Unable to retrieve properties." , e );
117
111
}
118
- addActionError ("Unable to retrieve properties: " + e . toString () );
112
+ addActionError ("Unable to retrieve properties: " + e );
119
113
}
120
114
121
115
if (hasErrors ()) {
0 commit comments