[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] [Commented] (JEXL-388) v3.3-SNAPSHOT doesn't find public getter as property
From:       "Henri Biestro (Jira)" <jira () apache ! org>
Date:       2022-11-30 18:13:00
Message-ID: JIRA.13507158.1669681423000.159116.1669831980022 () Atlassian ! JIRA
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/JEXL-388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17641473#comment-17641473 \
] 

Henri Biestro commented on JEXL-388:
------------------------------------

Documentation for permissions is in the 3.3 Javadoc which can be generated using 'mvn \
clean install site'.

Wrt JEXL-342, the proposal has been \
[here|https://github.com/apache/commons-jexl/tree/master/src/test/java/org/apache/commons/jexl3/jexl342] \
for some time.

Wrt JEXL-387, I suspect the Uberspect receives a null logger which ultimately is \
related to a logging misconfiguration; I'd suggest solving this first, ideally using \
a dedicated logger (create the Uberspect, pass it to the JexlBuilder).

  

> v3.3-SNAPSHOT doesn't find public getter as property
> ----------------------------------------------------
> 
> Key: JEXL-388
> URL: https://issues.apache.org/jira/browse/JEXL-388
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 3.3
> Environment: Java 17; Windows 10
> Reporter: Garret Wilson
> Priority: Major
> 
> In my [Guise Mummy|https://github.com/globalmentor/guise-mummy] static site \
> generator I'm using JEXL to interpret the built-in [Mesh Expression \
> Language|https://github.com/globalmentor/guise-mummy/tree/main/mesh] (MEXL). \
> Everything was working fine with JEXL 3.1. In fact the entire [Guise Mummy web \
> site|https://guise.io/mummy/] itself was produced using Guise Mummy with MEXL on \
> top of JEXL. But when I upgrade to JEXL 3.3-SNAPSHOT, a couple of unit tests break. \
> In particular, the new version doesn't seem to find a public getter method on a \
> custom public class as a property. In the Mesh templating, we have an {{mx:each}} \
> attribute (similar to JSP or Thymeleaf) which loops through and replicates some \
> HTML element (e.g. an {{<li>}} inside an {{<ul>}}) for each value in a list. It \
> assigns each value, one at a time, to a variable {{it}} in the context. That is \
> working fine. But on each iteration it also assigns {{iter}} in the context, with \
> the value being an instance of \
> [{{MeshIterator}}|https://github.com/globalmentor/guise-mummy/blob/main/mesh/src/main/java/io/guise/mesh/MeshIterator.java]. \
> That object has, among other things, {{getCurrent()}}: {code:java}
> /**
> * Returns the current item. This will be the result of the last successful call to \
>                 {@link #next()}.
> * @throws NoSuchElementException if iteration has not yet started.
> * @return The current item.
> */
> public Object getCurrent() { ... }
> {code}
> To make a long story short, the MEXL expression should be able to use \
> {{iter.current}} to get the value, but it's not finding it. I traced through the \
> new code, and it's finding the {{MeshIterator}} instance just fine and assigning it \
> to {{iter}}. The problem is that JEXL's {{ClassMap}} (probably inside {{create()}}) \
> is not finding and caching {{getCurrent()}} mapped to the {{current}} property. It \
> looks like {{Permissions.allow()}} for method {{MeshIterator.getCurrent()}}, is \
> falling through to the end and returning {{explicit[0]}}, which happens to be \
> {{false}}. It looks like this comes from {{wildcardAllow(Class<?> clazz)}}, which \
> eventually calls {{wildcardAllow(Set<String> allowed, String name)}}. There's what \
> I presume to be a set of allowed packages. Is that new? Do we have to explicitly \
> provide a list of allowed packages for property discovery via reflection now? To \
> reproduce this: # Clone [Guise Mummy \
> 0.5.3|https://github.com/globalmentor/guise-mummy/releases/tag/v0.5.3]. # In the \
> overall project {{pom.xml}}, change the version of \
> {{org.apache.commons:commons-jexl3}} from {{<version>3.1</version>}} to \
> {{<version>3.3-SNAPSHOT</version>}}. (You'll also need to add the \
> {{https://repository.apache.org/content/repositories/snapshots/}} repository in the \
> POM.) # Run {{mvn clean verify}}.
> You'll see that {{io.guise.mesh.GuiseMeshTest.testMxEachWithIterVar()}} will fail \
> because {{iter.current}} can't be found.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic