diff --git a/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java b/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java index c38d365b4..6226b1346 100644 --- a/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java +++ b/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java @@ -212,8 +212,8 @@ public final void setAttribute(Attribute attribute) throws AttributeNotFoundExce try { PropertyEditor e = getPropertyEditor(getParent(aname).getClass(), pdesc.getName(), pdesc.getPropertyType()); e.setAsText((String) avalue); - OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(source); - ctx.setTypeConverter(typeConverter); + + OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(source, null, typeConverter); Ognl.setValue(aname, ctx, source, e.getValue()); } catch (Exception e) { throwMBeanException(e); @@ -643,8 +643,7 @@ private Class getAttributeClass(String signature) throws ClassNotFoundExcepti private Object getAttribute(Object object, String fqan, Class attrType) throws OgnlException { Object property; - OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(object); - ctx.setTypeConverter(new OgnlTypeConverter()); + OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(object, null, new OgnlTypeConverter()); if (attrType == null) { property = Ognl.getValue(fqan, ctx, object); } else { diff --git a/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java b/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java index 518ef92cd..ee96f0a6c 100644 --- a/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java +++ b/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java @@ -16,8 +16,6 @@ */ package org.apache.mina.integration.ognl; -import java.util.Map; - import ognl.ObjectPropertyAccessor; import ognl.OgnlContext; import ognl.OgnlException; @@ -67,7 +65,7 @@ public final boolean hasSetProperty(OgnlContext context, Object target, Object o } @Override - public final Object getPossibleProperty(Map context, Object target, String name) throws OgnlException { + public final Object getPossibleProperty(OgnlContext context, Object target, String name) throws OgnlException { Object answer = getProperty0((OgnlContext) context, target, name); if (answer == OgnlRuntime.NotFound) { answer = super.getPossibleProperty(context, target, name); @@ -76,7 +74,7 @@ public final Object getPossibleProperty(Map context, Object target, String name) } @Override - public final Object setPossibleProperty(Map context, Object target, String name, Object value) throws OgnlException { + public final Object setPossibleProperty(OgnlContext context, Object target, String name, Object value) throws OgnlException { if (context.containsKey(READ_ONLY_MODE)) { throw new OgnlException("Expression must be read-only: " + context.get(QUERY)); } diff --git a/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionFinder.java b/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionFinder.java index 106139392..2d7fca4af 100644 --- a/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionFinder.java +++ b/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionFinder.java @@ -16,7 +16,9 @@ */ package org.apache.mina.integration.ognl; +import java.util.HashMap; import java.util.LinkedHashSet; +import java.util.Map; import java.util.Set; import org.apache.mina.core.session.IoSession; @@ -108,12 +110,12 @@ public Set find(Iterable sessions) throws OgnlException { } Set answer = new LinkedHashSet<>(); + Map values = new HashMap<>(); + values.put(AbstractPropertyAccessor.READ_ONLY_MODE, true); + values.put(AbstractPropertyAccessor.QUERY, query); for (IoSession s : sessions) { - OgnlContext context = (OgnlContext) Ognl.createDefaultContext(s); - context.setTypeConverter(typeConverter); - context.put(AbstractPropertyAccessor.READ_ONLY_MODE, true); - context.put(AbstractPropertyAccessor.QUERY, query); + OgnlContext context = (OgnlContext) Ognl.createDefaultContext(s, null, typeConverter).withValues(values); Object result = Ognl.getValue(expression, context, s); if (result instanceof Boolean) { diff --git a/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/PropertyTypeConverter.java b/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/PropertyTypeConverter.java index 383230cc0..0d1fb209b 100644 --- a/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/PropertyTypeConverter.java +++ b/mina-integration-ognl/src/main/java/org/apache/mina/integration/ognl/PropertyTypeConverter.java @@ -18,7 +18,6 @@ import java.beans.PropertyEditor; import java.lang.reflect.Member; -import java.util.Map; import org.apache.mina.integration.beans.PropertyEditorFactory; @@ -46,7 +45,7 @@ public class PropertyTypeConverter implements TypeConverter { */ @Override @SuppressWarnings("unchecked") - public Object convertValue(Map ctx, Object target, Member member, String attrName, Object value, Class toType) { + public Object convertValue(OgnlContext ctx, Object target, Member member, String attrName, Object value, Class toType) { if (value == null) { return null; } diff --git a/pom.xml b/pom.xml index 810ab9e4b..bf7c231d0 100644 --- a/pom.xml +++ b/pom.xml @@ -144,8 +144,8 @@ 4.13.2 1.1.3 1.2.17 - 3.3.4 - 7.0.0 + 3.4.3 + 7.5.0 1.7.36 1.7.36 1.7.36