17
17
18
18
package com .intergral .deep .agent .tracepoint .cf ;
19
19
20
- import com .intergral .deep .agent .ReflectionUtils ;
20
+ import com .intergral .deep .agent .Reflection ;
21
21
import com .intergral .deep .agent .Utils ;
22
22
import com .intergral .deep .agent .api .plugin .IEvaluator ;
23
+ import com .intergral .deep .agent .api .reflection .IReflection ;
23
24
import com .intergral .deep .agent .settings .Settings ;
24
25
import com .intergral .deep .agent .tracepoint .handler .FrameProcessor ;
25
26
import com .intergral .deep .agent .types .TracePointConfig ;
@@ -87,6 +88,7 @@ Map<String, Object> mapCFScopes(final Map<String, Object> variables) {
87
88
final Object localScope = variables .get ("__localScope" );
88
89
89
90
if (CFUtils .isScope (localScope )) {
91
+ //noinspection unchecked,rawtypes
90
92
final Map <Object , Object > lclMap = (Map ) localScope ;
91
93
for (Map .Entry <Object , Object > entry : lclMap .entrySet ()) {
92
94
final Object name = entry .getKey ();
@@ -102,14 +104,15 @@ Map<String, Object> mapCFScopes(final Map<String, Object> variables) {
102
104
}
103
105
104
106
// handle var scope
105
- final Object varScope = ReflectionUtils .getFieldValue (pageContext , "SymTab_varScope" );
107
+ final IReflection reflection = Reflection .getInstance ();
108
+ final Object varScope = reflection .getFieldValue (pageContext , "SymTab_varScope" );
106
109
107
110
if (CFUtils .isScope (varScope )) {
108
111
cfVars .put ("VARIABLES" , varScope );
109
112
}
110
113
111
114
// find the other build in scopes
112
- final Map <Object , Object > scopes = ReflectionUtils .getFieldValue (pageContext ,
115
+ final Map <Object , Object > scopes = reflection .getFieldValue (pageContext ,
113
116
"SymTab_builtinCFScopes" );
114
117
if (scopes == null ) {
115
118
return cfVars ;
@@ -146,13 +149,14 @@ Map<String, Object> convertLuceeScopes(final Map<String, Object> variables) {
146
149
147
150
final Map <String , Object > scopes = new HashMap <>();
148
151
// process the scopes from lucee
149
- scopes .put ("variables" , ReflectionUtils .getFieldValue (param0 , "variables" ));
150
- scopes .put ("argument" , ReflectionUtils .getFieldValue (param0 , "argument" ));
151
- scopes .put ("local" , getAndCheckLocal ("local" , param0 ));
152
+ final IReflection reflection = Reflection .getInstance ();
153
+ scopes .put ("variables" , reflection .getFieldValue (param0 , "variables" ));
154
+ scopes .put ("argument" , reflection .getFieldValue (param0 , "argument" ));
155
+ scopes .put ("local" , getAndCheckLocal (param0 ));
152
156
scopes .put ("cookie" , getAndCheckScope ("cookie" , param0 ));
153
- scopes .put ("server" , ReflectionUtils .getFieldValue (param0 , "server" ));
157
+ scopes .put ("server" , reflection .getFieldValue (param0 , "server" ));
154
158
scopes .put ("session" , getAndCheckScope ("session" , param0 ));
155
- scopes .put ("application" , ReflectionUtils .getFieldValue (param0 , "application" ));
159
+ scopes .put ("application" , reflection .getFieldValue (param0 , "application" ));
156
160
scopes .put ("cgi" , getAndCheckScope ("cgiR" , param0 ));
157
161
scopes .put ("request" , getAndCheckScope ("request" , param0 ));
158
162
scopes .put ("form" , getAndCheckScope ("_form" , param0 ));
@@ -165,15 +169,13 @@ Map<String, Object> convertLuceeScopes(final Map<String, Object> variables) {
165
169
166
170
167
171
/**
168
- * This method will get anc check that the field is a local scope as some parts can have no local
169
- * scope.
172
+ * This method will get and check that the field is a local scope as some parts can have no local scope.
170
173
*
171
- * @param local the name of the field to look for
172
174
* @param param0 the object to look at
173
175
* @return {@code null} if the field is not a valid local scope
174
176
*/
175
- private Object getAndCheckLocal (final String local , final Object param0 ) {
176
- final Object o = ReflectionUtils . getFieldValue (param0 , local );
177
+ private Object getAndCheckLocal (final Object param0 ) {
178
+ final Object o = Reflection . getInstance (). getFieldValue (param0 , " local" );
177
179
if (o == null || o .getClass ().getName ()
178
180
.equals ("lucee.runtime.type.scope.LocalNotSupportedScope" )) {
179
181
return null ;
@@ -192,9 +194,10 @@ private Object getAndCheckLocal(final String local, final Object param0) {
192
194
* discovered.
193
195
*/
194
196
private Object getAndCheckScope (final String name , final Object target ) {
195
- final Object local = ReflectionUtils .getFieldValue (target , name );
197
+ final IReflection reflection = Reflection .getInstance ();
198
+ final Object local = reflection .getFieldValue (target , name );
196
199
if (local != null ) {
197
- final Object isInitalized = ReflectionUtils .callMethod (local , "isInitalized" );
200
+ final Object isInitalized = reflection .callMethod (local , "isInitalized" );
198
201
if (isInitalized == null ) {
199
202
return null ;
200
203
}
0 commit comments