Skip to content

Commit

Permalink
Reverts call to addDefaultContext()
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Dec 30, 2024
1 parent 7497d97 commit 45b3aaa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/main/java/ognl/Ognl.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,22 +398,19 @@ public static Object getValue(Object tree, OgnlContext context, Object root) thr
* @throws OgnlException if there is a pathological environmental problem
*/
public static Object getValue(Object tree, OgnlContext context, Object root, Class<?> resultType) throws OgnlException {
if (context.getRoot() == null) {
context.setRoot(root);
}

Object result;
OgnlContext ognlContext = addDefaultContext(root, context);

Node node = (Node) tree;

if (node.getAccessor() != null) {
result = node.getAccessor().get(context, root);
result = node.getAccessor().get(ognlContext, root);
} else {
result = node.getValue(context, root);
result = node.getValue(ognlContext, root);
}

if (resultType != null) {
result = getTypeConverter(context).convertValue(context, root, null, null, result, resultType);
result = getTypeConverter(ognlContext).convertValue(ognlContext, root, null, null, result, resultType);
}
return result;
}
Expand Down

0 comments on commit 45b3aaa

Please sign in to comment.