Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ognl] Update to 3.4.2 along with Map to OgnlContext changes #3035

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<dependency>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>3.3.4</version>
<version>3.4.2</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Object get(Object key) {
static class ContextAccessor implements PropertyAccessor {

@Override
public Object getProperty(Map context, Object target, Object name) {
public Object getProperty(OgnlContext context, Object target, Object name) {
Map map = (Map) target;

Object result = map.get(name);
Expand All @@ -123,7 +123,7 @@ public Object getProperty(Map context, Object target, Object name) {
}

@Override
public void setProperty(Map context, Object target, Object name, Object value) {
public void setProperty(OgnlContext context, Object target, Object name, Object value) {
Map<Object, Object> map = (Map<Object, Object>) target;
map.put(name, value);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
import java.util.concurrent.ConcurrentHashMap;

import ognl.Ognl;
import ognl.OgnlContext;
import ognl.OgnlException;

import org.apache.ibatis.builder.BuilderException;
Expand All @@ -42,7 +43,7 @@ private OgnlCache() {

public static Object getValue(String expression, Object root) {
try {
Map context = Ognl.createDefaultContext(root, MEMBER_ACCESS, CLASS_RESOLVER, null);
OgnlContext context = Ognl.createDefaultContext(root, MEMBER_ACCESS, CLASS_RESOLVER, null);
return Ognl.getValue(parseExpression(expression), context, root);
} catch (OgnlException e) {
throw new BuilderException("Error evaluating expression '" + expression + "'. Cause: " + e, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Member;
import java.util.Map;

import ognl.MemberAccess;
import ognl.OgnlContext;

import org.apache.ibatis.reflection.Reflector;

Expand All @@ -44,7 +44,7 @@ class OgnlMemberAccess implements MemberAccess {
}

@Override
public Object setup(Map context, Object target, Member member, String propertyName) {
public Object setup(OgnlContext context, Object target, Member member, String propertyName) {
Object result = null;
if (isAccessible(context, target, member, propertyName)) {
AccessibleObject accessible = (AccessibleObject) member;
Expand All @@ -57,12 +57,12 @@ public Object setup(Map context, Object target, Member member, String propertyNa
}

@Override
public void restore(Map context, Object target, Member member, String propertyName, Object state) {
public void restore(OgnlContext context, Object target, Member member, String propertyName, Object state) {
// Flipping accessible flag is not thread safe. See #1648
}

@Override
public boolean isAccessible(Map context, Object target, Member member, String propertyName) {
public boolean isAccessible(OgnlContext context, Object target, Member member, String propertyName) {
return canControlMemberAccessible;
}

Expand Down