@@ -118,10 +118,8 @@ public String getExpressionString() {
118
118
public Object getValue () throws EvaluationException {
119
119
if (this .compiledAst != null ) {
120
120
try {
121
- TypedValue contextRoot =
122
- (this .evaluationContext != null ? this .evaluationContext .getRootObject () : null );
123
- return this .compiledAst .getValue (
124
- (contextRoot != null ? contextRoot .getValue () : null ), this .evaluationContext );
121
+ EvaluationContext context = getEvaluationContext ();
122
+ return this .compiledAst .getValue (context .getRootObject ().getValue (), context );
125
123
}
126
124
catch (Throwable ex ) {
127
125
// If running in mixed mode, revert to interpreted
@@ -148,10 +146,8 @@ public Object getValue() throws EvaluationException {
148
146
public <T > T getValue (@ Nullable Class <T > expectedResultType ) throws EvaluationException {
149
147
if (this .compiledAst != null ) {
150
148
try {
151
- TypedValue contextRoot =
152
- (this .evaluationContext != null ? this .evaluationContext .getRootObject () : null );
153
- Object result = this .compiledAst .getValue (
154
- (contextRoot != null ? contextRoot .getValue () : null ), this .evaluationContext );
149
+ EvaluationContext context = getEvaluationContext ();
150
+ Object result = this .compiledAst .getValue (context .getRootObject ().getValue (), context );
155
151
if (expectedResultType == null ) {
156
152
return (T ) result ;
157
153
}
@@ -185,7 +181,7 @@ public <T> T getValue(@Nullable Class<T> expectedResultType) throws EvaluationEx
185
181
public Object getValue (Object rootObject ) throws EvaluationException {
186
182
if (this .compiledAst != null ) {
187
183
try {
188
- return this .compiledAst .getValue (rootObject , this . evaluationContext );
184
+ return this .compiledAst .getValue (rootObject , getEvaluationContext () );
189
185
}
190
186
catch (Throwable ex ) {
191
187
// If running in mixed mode, revert to interpreted
@@ -213,7 +209,7 @@ public Object getValue(Object rootObject) throws EvaluationException {
213
209
public <T > T getValue (Object rootObject , @ Nullable Class <T > expectedResultType ) throws EvaluationException {
214
210
if (this .compiledAst != null ) {
215
211
try {
216
- Object result = this .compiledAst .getValue (rootObject , null );
212
+ Object result = this .compiledAst .getValue (rootObject , getEvaluationContext () );
217
213
if (expectedResultType == null ) {
218
214
return (T )result ;
219
215
}
@@ -250,8 +246,7 @@ public Object getValue(EvaluationContext context) throws EvaluationException {
250
246
251
247
if (this .compiledAst != null ) {
252
248
try {
253
- TypedValue contextRoot = context .getRootObject ();
254
- return this .compiledAst .getValue (contextRoot .getValue (), context );
249
+ return this .compiledAst .getValue (context .getRootObject ().getValue (), context );
255
250
}
256
251
catch (Throwable ex ) {
257
252
// If running in mixed mode, revert to interpreted
@@ -280,8 +275,7 @@ public <T> T getValue(EvaluationContext context, @Nullable Class<T> expectedResu
280
275
281
276
if (this .compiledAst != null ) {
282
277
try {
283
- TypedValue contextRoot = context .getRootObject ();
284
- Object result = this .compiledAst .getValue (contextRoot .getValue (), context );
278
+ Object result = this .compiledAst .getValue (context .getRootObject ().getValue (), context );
285
279
if (expectedResultType != null ) {
286
280
return ExpressionUtils .convertTypedValue (context , new TypedValue (result ), expectedResultType );
287
281
}
@@ -315,7 +309,7 @@ public Object getValue(EvaluationContext context, Object rootObject) throws Eval
315
309
316
310
if (this .compiledAst != null ) {
317
311
try {
318
- return this .compiledAst .getValue (rootObject ,context );
312
+ return this .compiledAst .getValue (rootObject , context );
319
313
}
320
314
catch (Throwable ex ) {
321
315
// If running in mixed mode, revert to interpreted
0 commit comments