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 2022/10/02 21:26:02 UTC

[Bug 66292] New: JSP static include broken

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

            Bug ID: 66292
           Summary: JSP static include broken
           Product: Tomcat 9
           Version: 9.0.67
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: sander@buskens.org
  Target Milestone: -----

Created attachment 38400
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38400&action=edit
Webapp with demonstration of static include compile error

Some of our JSP pages with static includes which worked on Tomcat 9.0.65 broke
on Tomcat 9.0.67.

The behaviour manifests itself when you static include a JSP page from a
subdirectory and then include a JSP from the base directory, like so:

index.jsp contains 2 static includes to:
subdir/subdir_include.jsp <-- this one works
another_include.jsp <-- this one doesn't

Having debugged the code the problem appears to be in the
PageController.baseDirStack which looks differently after the
subdir/subdir_include.jsp has been processed and the baseDirStack has been
popped in PageController.doParse, in 9.0.65 the baseDirStack is defined as a
Stack:
    private final Stack<String> baseDirStack = new Stack<>();

and popped near the end of doParse as
        baseDirStack.pop();

In Tomcat 9.0.67 this has now become a:
    private final Queue<String> baseDirStack = new ArrayDeque<>();

and it is popped near the end of doParse as:
        baseDirStack.remove();

On 9.0.67 this returns the wrong baseDir causing the another_include.jsp to not
be found.

I have included a test which demonstrates the difference in behaviour of the
Stack.pop() and ArrayDeque.remove() and also a simplistic webapp to demonstrate
the JSP compilation failure on 9.0.67.

We stumbled on this problem on openjdk 11.0.16.1 but were able to also
reproduce it on jdk8.

-- 
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 66292] JSP static include broken

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

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

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

--- Comment #1 from Mark Thomas <ma...@apache.org> ---


*** This bug has been marked as a duplicate of bug 66277 ***

-- 
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