You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2023/01/24 18:12:47 UTC

[Bug 66441] New: Static field import failed on Expression Language lookup

https://bz.apache.org/bugzilla/show_bug.cgi?id=66441

            Bug ID: 66441
           Summary: Static field import failed on Expression Language
                    lookup
           Product: Tomcat 10
           Version: 10.1.5
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: isaacrivriv@gmail.com
  Target Milestone: ------

Hello! Working with JSP pages and static imports using Tomcat's EL Jasper
implementation, I found that importing a static field with EL lookup did not
resolve to the correct value. Tried the following jsp

<%@ page import = "static myapp.Example.STATIC_VAR, static
myapp.Example.STATIC_METHOD" %>
<html>
   <head>
      <title>Import Static</title>
   </head>

   <body>
      EL expressions: <br/>
      ${STATIC_VAR}
      ${STATIC_METHOD()}

      <br/>
      <br/>

      JSP expressions: <br/>
      <%=STATIC_VAR%>
      <%=STATIC_METHOD()%>
   </body>
</html>


The JSP expressions resolve as expected but of the EL expressions, only
STATIC_METHOD() works. After some investigation we narrowed down that the
problem may potentially be here
https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/el/parser/AstIdentifier.java#L101-L103
where the variable is resolved by the NotFoundELResolver and the import block
to resolveStatic is not reached here
https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/el/parser/AstIdentifier.java#L105-L110. 


We are using the API from JakartaEE and not the API from Tomcat for Pages. If
we change to Tomcat's API then it does behave as expected. This is because the
ImportELResolver from Tomcat does a static lookup in its resolver here
https://github.com/apache/tomcat/blob/10.1.x/java/jakarta/servlet/jsp/el/ImportELResolver.java#L85-L92
whereas the Jakarta API does not cover it here
https://github.com/jakartaee/pages/blob/master/api/src/main/java/jakarta/servlet/jsp/el/ImportELResolver.java#L63-L71.
Not sure if this should be fixed in the implementation of Tomcat or if it's
something that should be address in the Jakarta Pages API. Any help is
appreciated, thanks in advance!!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66441] Static field import failed on Expression Language lookup

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66441

--- Comment #1 from Isaac Rivera Rivas <is...@gmail.com> ---
Here are a few clarifications for this issue,

1) This is for EE10 specifically, as we've tried to update our Open Liberty
Pages Implementation to support static imports into the Expression Language
environment. Before EE10, only JSP expressions could be used for this type of
imports.

2) This scenario occurs with a mix up between Tomcat's EL API/Impl mixed with
Jakarta Pages' 3.1 API.

3) Perhaps the Jakarta EE Pages API is more at fault and should be updated to
look at static variables (via importHandler.resolveStatic), just as Tomcat
ImportELResolver does. 

@Mark Thomas think you would know more here, any help would be appreciated!
Thank you!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66441] Static field import failed on Expression Language lookup

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66441

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Re-opening this as while Tomcat's pages API may handle this correctly, Jasper
(Tomcat's pages implementation) does not.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66441] Static field import failed on Expression Language lookup

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66441

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
This looks like a Jakarta EL API bug to me. I think it needs to handle the
static field. It also looks like the EvaluationListener#propertyResolved()
events aren't being triggered.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66441] Static field import failed on Expression Language lookup

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66441

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Fixed in:
- 11.0.x for 11.0.0-M3 onwards
- 10.1.x for 10.1.6 onwards
-  9.0.x for  9.0.72 onwards
-  8.5.x for  8.5.86 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org