MVEL

UnresolveablePropertyException for property "size()" on List from Collections' methods.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2.25
  • Fix Version/s: 1.3.0
  • Component/s: Core
  • Labels:
    None
  • Environment:
    Java 1.6.0_03 under Ubuntu Linux 7.10
  • Testcase included:
    yes
  • Number of attachments :
    1

Description

In some case, an UnresolveablePropertyException is raised when accessing the "size()" property on List coming from Collections' methods

I looks like MVEL resolve the property to the size() method of the Collections' private implementation class and not to the one of the List interface. Then, when the method is invoked, access is denied because of the method's declaring class being "hidden" (private inner class) in Collections.

Activity

Hide
Mike Brock added a comment -

fixed trunk.

Show
Mike Brock added a comment - fixed trunk.
Hide
Levi Hoogenberg added a comment -

I just ran into this issue with Collections.unmodifiableList using 1.3.4. Updating to 1.3.11 didn't help. Stack trace:

Caused by: org.mvel.PropertyAccessException: unable to resolve property: breadcrumbs.size()
at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:293)
at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:110)
at org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:186)
at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:50)
at org.mvel.MVEL.executeExpression(MVEL.java:286)
at nl.levi_h.website.jelly.uitdrukkingen.MvelUitdrukking.evaluate(MvelUitdrukking.java:34)
at org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse(ExpressionSupport.java:61)
at org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsBoolean(ExpressionSupport.java:71)
at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:41)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
... 87 more
Caused by: java.lang.IllegalAccessException: Class org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer can not access a member of class java.util.Collections$UnmodifiableCollection with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.reflect.Method.invoke(Method.java:578)
at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:608)
at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:271)
... 97 more

Show
Levi Hoogenberg added a comment - I just ran into this issue with Collections.unmodifiableList using 1.3.4. Updating to 1.3.11 didn't help. Stack trace: Caused by: org.mvel.PropertyAccessException: unable to resolve property: breadcrumbs.size() at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:293) at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:110) at org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:186) at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21) at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:50) at org.mvel.MVEL.executeExpression(MVEL.java:286) at nl.levi_h.website.jelly.uitdrukkingen.MvelUitdrukking.evaluate(MvelUitdrukking.java:34) at org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse(ExpressionSupport.java:61) at org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsBoolean(ExpressionSupport.java:71) at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:41) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) ... 87 more Caused by: java.lang.IllegalAccessException: Class org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer can not access a member of class java.util.Collections$UnmodifiableCollection with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65) at java.lang.reflect.Method.invoke(Method.java:578) at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:608) at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:271) ... 97 more

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: