[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

--- Comment #10 from Mark Thomas  ---
Those includes have at least one further include. Konstantin's suggestion is a
better one. With the broken .java file we can try and reverse engineer a test
case.

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



[tomcat] branch main updated: Fix BZ 65384 - Make test Locale independent

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 1de3b08  Fix BZ 65384 - Make test Locale independent
1de3b08 is described below

commit 1de3b08e6674bd5da9c3a96aa0321bde730609ae
Author: Mark Thomas 
AuthorDate: Fri Jun 18 10:16:52 2021 +0100

Fix BZ 65384 - Make test Locale independent
---
 test/org/apache/coyote/http2/TestFlowControl.java | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestFlowControl.java 
b/test/org/apache/coyote/http2/TestFlowControl.java
index 4d08781..e087641 100644
--- a/test/org/apache/coyote/http2/TestFlowControl.java
+++ b/test/org/apache/coyote/http2/TestFlowControl.java
@@ -18,6 +18,7 @@ package org.apache.coyote.http2;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Locale;
 import java.util.logging.Level;
 import java.util.logging.LogManager;
 
@@ -93,12 +94,14 @@ public class TestFlowControl extends Http2TestBase {
 int start = trace.indexOf("[content-length]-[") + 18;
 int end = trace.indexOf("]", start);
 String contentLength = trace.substring(start, end);
+// Language will depend on locale
+String language = Locale.getDefault().getLanguage();
 
 Assert.assertEquals(
 "3-HeadersStart\n" +
 "3-Header-[:status]-[404]\n" +
 "3-Header-[content-type]-[text/html;charset=utf-8]\n" +
-"3-Header-[content-language]-[en]\n" +
+"3-Header-[content-language]-[" + language + "]\n" +
 "3-Header-[content-length]-[" + contentLength + "]\n" +
 "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
 "3-HeadersEnd\n" +

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Fix BZ 65384 - Make test Locale independent

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 0c8b319  Fix BZ 65384 - Make test Locale independent
0c8b319 is described below

commit 0c8b319a1e8331b66b15b6c7163dd25778671935
Author: Mark Thomas 
AuthorDate: Fri Jun 18 10:16:52 2021 +0100

Fix BZ 65384 - Make test Locale independent
---
 test/org/apache/coyote/http2/TestFlowControl.java | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestFlowControl.java 
b/test/org/apache/coyote/http2/TestFlowControl.java
index 4d08781..e087641 100644
--- a/test/org/apache/coyote/http2/TestFlowControl.java
+++ b/test/org/apache/coyote/http2/TestFlowControl.java
@@ -18,6 +18,7 @@ package org.apache.coyote.http2;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Locale;
 import java.util.logging.Level;
 import java.util.logging.LogManager;
 
@@ -93,12 +94,14 @@ public class TestFlowControl extends Http2TestBase {
 int start = trace.indexOf("[content-length]-[") + 18;
 int end = trace.indexOf("]", start);
 String contentLength = trace.substring(start, end);
+// Language will depend on locale
+String language = Locale.getDefault().getLanguage();
 
 Assert.assertEquals(
 "3-HeadersStart\n" +
 "3-Header-[:status]-[404]\n" +
 "3-Header-[content-type]-[text/html;charset=utf-8]\n" +
-"3-Header-[content-language]-[en]\n" +
+"3-Header-[content-language]-[" + language + "]\n" +
 "3-Header-[content-length]-[" + contentLength + "]\n" +
 "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
 "3-HeadersEnd\n" +

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Fix BZ 65384 - Make test Locale independent

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 93eabb2  Fix BZ 65384 - Make test Locale independent
93eabb2 is described below

commit 93eabb24463790fad54ef220509f4c5356b21376
Author: Mark Thomas 
AuthorDate: Fri Jun 18 10:16:52 2021 +0100

Fix BZ 65384 - Make test Locale independent
---
 test/org/apache/coyote/http2/TestFlowControl.java | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestFlowControl.java 
b/test/org/apache/coyote/http2/TestFlowControl.java
index 4d08781..e087641 100644
--- a/test/org/apache/coyote/http2/TestFlowControl.java
+++ b/test/org/apache/coyote/http2/TestFlowControl.java
@@ -18,6 +18,7 @@ package org.apache.coyote.http2;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Locale;
 import java.util.logging.Level;
 import java.util.logging.LogManager;
 
@@ -93,12 +94,14 @@ public class TestFlowControl extends Http2TestBase {
 int start = trace.indexOf("[content-length]-[") + 18;
 int end = trace.indexOf("]", start);
 String contentLength = trace.substring(start, end);
+// Language will depend on locale
+String language = Locale.getDefault().getLanguage();
 
 Assert.assertEquals(
 "3-HeadersStart\n" +
 "3-Header-[:status]-[404]\n" +
 "3-Header-[content-type]-[text/html;charset=utf-8]\n" +
-"3-Header-[content-language]-[en]\n" +
+"3-Header-[content-language]-[" + language + "]\n" +
 "3-Header-[content-length]-[" + contentLength + "]\n" +
 "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
 "3-HeadersEnd\n" +

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Fix BZ 65384 - Make test Locale independent

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new dbb30f8  Fix BZ 65384 - Make test Locale independent
dbb30f8 is described below

commit dbb30f8d535a60da04bc777227ade988172b9c95
Author: Mark Thomas 
AuthorDate: Fri Jun 18 10:16:52 2021 +0100

Fix BZ 65384 - Make test Locale independent
---
 test/org/apache/coyote/http2/TestFlowControl.java | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestFlowControl.java 
b/test/org/apache/coyote/http2/TestFlowControl.java
index 4d08781..e087641 100644
--- a/test/org/apache/coyote/http2/TestFlowControl.java
+++ b/test/org/apache/coyote/http2/TestFlowControl.java
@@ -18,6 +18,7 @@ package org.apache.coyote.http2;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Locale;
 import java.util.logging.Level;
 import java.util.logging.LogManager;
 
@@ -93,12 +94,14 @@ public class TestFlowControl extends Http2TestBase {
 int start = trace.indexOf("[content-length]-[") + 18;
 int end = trace.indexOf("]", start);
 String contentLength = trace.substring(start, end);
+// Language will depend on locale
+String language = Locale.getDefault().getLanguage();
 
 Assert.assertEquals(
 "3-HeadersStart\n" +
 "3-Header-[:status]-[404]\n" +
 "3-Header-[content-type]-[text/html;charset=utf-8]\n" +
-"3-Header-[content-language]-[en]\n" +
+"3-Header-[content-language]-[" + language + "]\n" +
 "3-Header-[content-length]-[" + contentLength + "]\n" +
 "3-Header-[date]-[Wed, 11 Nov 2015 19:18:42 GMT]\n" +
 "3-HeadersEnd\n" +

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 65384] org.apache.coyote.http2.TestFlowControl test depends on user's language

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65384

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #2 from Mark Thomas  ---
Fixed in:
- 10.1.x for 10.1.0-M2 onwards
- 10.0.x for 10.0.8 onwards
- 9.0.x for 9.0.49 onwards
- 8.5.x for 8.5.69 onwards

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

qeepcologne  changed:

   What|Removed |Added

  Attachment #37902|0   |1
is obsolete||
  Attachment #37903|0   |1
is obsolete||
  Attachment #37904|0   |1
is obsolete||
  Attachment #37905|0   |1
is obsolete||

--- Comment #11 from qeepcologne  ---
Created attachment 37906
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37906&action=edit
LoginForm_jsp.java

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

Konstantin Kolinko  changed:

   What|Removed |Added

 Status|NEEDINFO|NEW

--- Comment #12 from Konstantin Kolinko  ---
(In reply to qeepcologne from comment #11)
> Created attachment 37906 [details]
> LoginForm_jsp.java

_jspx_dependants.put("/WEB-INF/lib/spring-security-taglibs-5.5.0.jar"
_jspx_dependants.put("/WEB-INF/lib/spring-webmvc-5.3.8.jar"

OK, I see what versions of the libs were used.

_jspx_dependants.put("/WEB-INF/tld/fn-1.1.1.tld",
_jspx_dependants.put("/WEB-INF/tld/c-1.1.2.tld",

I wonder why the app is using JSTL 1.1.x instead of the current version
(1.2.х).
https://tomcat.apache.org/download-taglibs.cgi
https://tomcat.apache.org/taglibs.html

I found those TLD files at
https://repo.maven.apache.org/maven2/taglibs/c/1.1.2/c-1.1.2.tld
https://repo.maven.apache.org/maven2/taglibs/fn/1.1.1/fn-1.1.1.tld

They are the same as c.tld and fn.tld in standard.jar of
jakarta-taglibs-standard-1.1.2.zip from
http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/


With those libs and files I am able to reproduce the error.
The libraries used:
jstl.jar
spring-beans-5.3.8.jar
spring-expression-5.3.8.jar
spring-security-taglibs-5.5.0.jar
spring-security-web-5.5.0.jar
spring-webmvc-5.3.8.jar
standard.jar

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

--- Comment #13 from Konstantin Kolinko  ---
Created attachment 37907
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37907&action=edit
test_no-libs.zip

To reproduce:
1) Unzip test_no-libs.zip into an empty directory
2) Download the following libraries and put them into WEB-INF/lib durectory:

https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-taglibs/5.5.0/spring-security-taglibs-5.5.0.jar

https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-web/5.5.0/spring-security-web-5.5.0.jar

https://repo.maven.apache.org/maven2/org/springframework/spring-beans/5.3.8/spring-beans-5.3.8.jar

https://repo.maven.apache.org/maven2/org/springframework/spring-expression/5.3.8/spring-expression-5.3.8.jar

https://repo.maven.apache.org/maven2/org/springframework/spring-webmvc/5.3.8/spring-webmvc-5.3.8.jar

3) zip or jar it and rename to test.war

4) Put the war file into ${catalina.base}/webapps-javaee
5) Start Tomcat 10
6) Open http://localhost:8080/test/LoginForm.jsp

The errors:

[[[
An error occurred at line: [509] in the generated java file:
[...\LoginForm_jsp.java]
out cannot be resolved to a variable

An error occurred at line: [543] in the generated java file:
[...\LoginForm_jsp.java]
out cannot be resolved to a variable
]]]

Those lines (509, 543) both are:

>   out = _jspx_page_context.popBody();

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

--- Comment #14 from Mark Thomas  ---
Thanks for that. I can recreate the issue now.

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

--- Comment #15 from Mark Thomas  ---
I have a fix. I just want to pull together a simpler test case for this then
I'll commit the test and the fix.

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



[Bug 65390] New: Problem in the code generated by jasper

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

Bug ID: 65390
   Summary: Problem in the code generated by jasper
   Product: Tomcat 9
   Version: 9.0.48
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Jasper
  Assignee: dev@tomcat.apache.org
  Reporter: tk...@ai-ag.de
  Target Milestone: -

Created attachment 37908
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37908&action=edit
Minimum Sample

We make heavy use of JSP-Taglibs, both java-based and tag-file-based.

Since Version 9.0.48 there is a Problem when using a combination of the
following:

 * A java-based tagfile which implements
"javax.servlet.jsp.tagext.TryCatchFinally"
 * A regular tag-file with "scriptless" body content
 * A JSP-Include directive

With the minimum sample provided, Jasper generates an inner class "Helper"
which uses wrong variable names.


We have noticed, that Jasper 9.0.48 adds a suffix to many variables, which
9.0.46 does not.
This is most likely the cause.

The attached minimum sample compiles with Jasper 9.0.46 und ist broken with
9.0.48.

I have also attached the generated java-files for quick comparison of the
generated code.

===
The error is:

[...]Failing_jsp.java:254: error: cannot find symbol
  if (_jspx_meth_st_005ftagwithbody_005f1(_jspx_parent, _jspx_page_context,
_jspx_push_body_count_st_005fwrapper_005f0))
   
^
  symbol:   variable _jspx_push_body_count_st_005fwrapper_005f0
  location: class Failing_jsp.Helper

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



[Bug 65390] Problem in the code generated by jasper

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

Remy Maucherat  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 OS||All
 Resolution|--- |DUPLICATE

--- Comment #1 from Remy Maucherat  ---


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

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

Remy Maucherat  changed:

   What|Removed |Added

 CC||tk...@ai-ag.de

--- Comment #16 from Remy Maucherat  ---
*** Bug 65390 has been marked as a duplicate of this bug. ***

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



svn commit: r1890894 - in /tomcat/site/trunk: docs/index.html xdocs/index.xml

2021-06-18 Thread kkolinko
Author: kkolinko
Date: Fri Jun 18 13:16:32 2021
New Revision: 1890894

URL: http://svn.apache.org/viewvc?rev=1890894&view=rev
Log:
Add a warning about regressions in Jasper.

Modified:
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/xdocs/index.xml

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1890894&r1=1890893&r2=1890894&view=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Fri Jun 18 13:16:32 2021
@@ -75,7 +75,10 @@ migration tool for Jakarta EE tool w
 Improve robustness of HTTP/2 HPACK decoding
 Improvements to the handling of the Transfer-Encoding header
 Review code used to generate Java source from JSPs and tags and remove code
-found to be unnecessary.
+found to be unnecessary.
+Warning: Please test that all your JSP pages are compiled 
successfully.
+There are known regressions caused by this change, to be fixed in the next 
release.
+See bugs https://bz.apache.org/bugzilla/show_bug.cgi?id=65387";>65387, https://bz.apache.org/bugzilla/show_bug.cgi?id=65390";>65390.
 
 
 Full details of these changes, and all the other changes, are available in the

Modified: tomcat/site/trunk/xdocs/index.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/index.xml?rev=1890894&r1=1890893&r2=1890894&view=diff
==
--- tomcat/site/trunk/xdocs/index.xml (original)
+++ tomcat/site/trunk/xdocs/index.xml Fri Jun 18 13:16:32 2021
@@ -96,7 +96,10 @@ migration tool for Jakarta EE tool w
 Improve robustness of HTTP/2 HPACK decoding
 Improvements to the handling of the Transfer-Encoding header
 Review code used to generate Java source from JSPs and tags and remove code
-found to be unnecessary.
+found to be unnecessary.
+Warning: Please test that all your JSP pages are compiled 
successfully.
+There are known regressions caused by this change, to be fixed in the next 
release.
+See bugs 65387, 65390.
 
 
 Full details of these changes, and all the other changes, are available in the



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Fix BZ 65387 - fix regression in generated code clean-up

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 6c1ec0a  Fix BZ 65387 - fix regression in generated code clean-up
6c1ec0a is described below

commit 6c1ec0aafa2d2446c7a50e12b6ec5fbd59ae2cc2
Author: Mark Thomas 
AuthorDate: Fri Jun 18 14:45:55 2021 +0100

Fix BZ 65387 - fix regression in generated code clean-up

Local variable out is required for TryCatchFinally tags
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387
---
 java/org/apache/jasper/compiler/Generator.java |  7 ---
 test/org/apache/jasper/compiler/TestGenerator.java | 24 --
 test/webapp/WEB-INF/bugs.tld   |  5 +
 test/webapp/jsp/generator/customtag-02.jsp |  4 ++--
 ...-catch-finally.jsp => try-catch-finally-01.jsp} |  9 
 ...-catch-finally.jsp => try-catch-finally-02.jsp} |  5 +
 webapps/docs/changelog.xml |  9 
 7 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 198632e..66ff231 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -1859,9 +1859,10 @@ class Generator {
 if (!isTagFile) {
 out.printil("jakarta.servlet.jsp.PageContext pageContext = 
_jspx_page_context;");
 }
-// Only need to define out if the tag has a non-empty body or
-// uses ... nodes
-if (!n.hasEmptyBody() || n.getNamedAttributeNodes().size() > 
0) {
+// Only need to define out if the tag has a non-empty body,
+// implements TryCtachFinally or uses
+// ... nodes
+if (!n.hasEmptyBody() || n.implementsTryCatchFinally() || 
n.getNamedAttributeNodes().size() > 0) {
 out.printil("jakarta.servlet.jsp.JspWriter out = 
_jspx_page_context.getOut();");
 }
 generateLocalVariables(out, n);
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index d55e5f9..c37451c 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -434,6 +434,11 @@ public class TestGenerator extends TomcatBaseTest {
 Assert.assertNotEquals(ids[0], ids[1]);
 }
 
+@Test
+public void testTryCtachFinally02 () throws Exception {
+doTestJsp("try-catch-finally-02.jsp");
+}
+
 public static class JspIdTag extends TagSupport implements JspIdConsumer {
 
 private static final long serialVersionUID = 1L;
@@ -456,7 +461,7 @@ public class TestGenerator extends TomcatBaseTest {
 }
 }
 
-public static class TryCatchFinallyTag extends BodyTagSupport implements 
TryCatchFinally {
+public static class TryCatchFinallyBodyTag extends BodyTagSupport 
implements TryCatchFinally {
 
 private static final long serialVersionUID = 1L;
 
@@ -481,6 +486,21 @@ public class TestGenerator extends TomcatBaseTest {
 }
 }
 
+public static class TryCatchFinallyTag extends TagSupport implements 
TryCatchFinally {
+
+private static final long serialVersionUID = 1L;
+
+@Override
+public void doCatch(Throwable t) throws Throwable {
+// NO-OP
+}
+
+@Override
+public void doFinally() {
+// NO-OP
+}
+}
+
 public static class TesterBodyTag extends BodyTagSupport {
 
 private static final long serialVersionUID = 1L;
@@ -820,7 +840,7 @@ public class TestGenerator extends TomcatBaseTest {
 
 @Test
 public void testCustomTag01() throws Exception {
-doTestJsp("try-catch-finally.jsp");
+doTestJsp("try-catch-finally-01.jsp");
 }
 
 @Test
diff --git a/test/webapp/WEB-INF/bugs.tld b/test/webapp/WEB-INF/bugs.tld
index 6428e87..1fff162 100644
--- a/test/webapp/WEB-INF/bugs.tld
+++ b/test/webapp/WEB-INF/bugs.tld
@@ -90,6 +90,11 @@
 JSP
   
   
+TryCatchFinallyBodyTag
+
org.apache.jasper.compiler.TestGenerator$TryCatchFinallyBodyTag
+JSP
+  
+  
 TesterBodyTag
 
org.apache.jasper.compiler.TestGenerator$TesterBodyTag
 JSP
diff --git a/test/webapp/jsp/generator/customtag-02.jsp 
b/test/webapp/jsp/generator/customtag-02.jsp
index 14e33eb..57cd254 100644
--- a/test/webapp/jsp/generator/customtag-02.jsp
+++ b/test/webapp/jsp/generator/customtag-02.jsp
@@ -16,8 +16,8 @@
 --%>
 <%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
 
-  
+  
 
 
-  
+  
 
\ No newline at end of file
diff --git a/test/webapp/jsp/generator/try-catch-finally.jsp 
b/test/webapp/jsp/generator/try-catch-finall

[tomcat] branch 10.0.x updated: Fix BZ 65387 - fix regression in generated code clean-up

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new d6a869e  Fix BZ 65387 - fix regression in generated code clean-up
d6a869e is described below

commit d6a869e681200a3d2c2279a789db8eb669021085
Author: Mark Thomas 
AuthorDate: Fri Jun 18 14:45:55 2021 +0100

Fix BZ 65387 - fix regression in generated code clean-up

Local variable out is required for TryCatchFinally tags
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387
---
 java/org/apache/jasper/compiler/Generator.java |  7 ---
 test/org/apache/jasper/compiler/TestGenerator.java | 24 --
 test/webapp/WEB-INF/bugs.tld   |  5 +
 test/webapp/jsp/generator/customtag-02.jsp |  4 ++--
 ...-catch-finally.jsp => try-catch-finally-01.jsp} |  9 
 ...-catch-finally.jsp => try-catch-finally-02.jsp} |  5 +
 webapps/docs/changelog.xml |  9 
 7 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 198632e..66ff231 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -1859,9 +1859,10 @@ class Generator {
 if (!isTagFile) {
 out.printil("jakarta.servlet.jsp.PageContext pageContext = 
_jspx_page_context;");
 }
-// Only need to define out if the tag has a non-empty body or
-// uses ... nodes
-if (!n.hasEmptyBody() || n.getNamedAttributeNodes().size() > 
0) {
+// Only need to define out if the tag has a non-empty body,
+// implements TryCtachFinally or uses
+// ... nodes
+if (!n.hasEmptyBody() || n.implementsTryCatchFinally() || 
n.getNamedAttributeNodes().size() > 0) {
 out.printil("jakarta.servlet.jsp.JspWriter out = 
_jspx_page_context.getOut();");
 }
 generateLocalVariables(out, n);
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index d55e5f9..c37451c 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -434,6 +434,11 @@ public class TestGenerator extends TomcatBaseTest {
 Assert.assertNotEquals(ids[0], ids[1]);
 }
 
+@Test
+public void testTryCtachFinally02 () throws Exception {
+doTestJsp("try-catch-finally-02.jsp");
+}
+
 public static class JspIdTag extends TagSupport implements JspIdConsumer {
 
 private static final long serialVersionUID = 1L;
@@ -456,7 +461,7 @@ public class TestGenerator extends TomcatBaseTest {
 }
 }
 
-public static class TryCatchFinallyTag extends BodyTagSupport implements 
TryCatchFinally {
+public static class TryCatchFinallyBodyTag extends BodyTagSupport 
implements TryCatchFinally {
 
 private static final long serialVersionUID = 1L;
 
@@ -481,6 +486,21 @@ public class TestGenerator extends TomcatBaseTest {
 }
 }
 
+public static class TryCatchFinallyTag extends TagSupport implements 
TryCatchFinally {
+
+private static final long serialVersionUID = 1L;
+
+@Override
+public void doCatch(Throwable t) throws Throwable {
+// NO-OP
+}
+
+@Override
+public void doFinally() {
+// NO-OP
+}
+}
+
 public static class TesterBodyTag extends BodyTagSupport {
 
 private static final long serialVersionUID = 1L;
@@ -820,7 +840,7 @@ public class TestGenerator extends TomcatBaseTest {
 
 @Test
 public void testCustomTag01() throws Exception {
-doTestJsp("try-catch-finally.jsp");
+doTestJsp("try-catch-finally-01.jsp");
 }
 
 @Test
diff --git a/test/webapp/WEB-INF/bugs.tld b/test/webapp/WEB-INF/bugs.tld
index 6428e87..1fff162 100644
--- a/test/webapp/WEB-INF/bugs.tld
+++ b/test/webapp/WEB-INF/bugs.tld
@@ -90,6 +90,11 @@
 JSP
   
   
+TryCatchFinallyBodyTag
+
org.apache.jasper.compiler.TestGenerator$TryCatchFinallyBodyTag
+JSP
+  
+  
 TesterBodyTag
 
org.apache.jasper.compiler.TestGenerator$TesterBodyTag
 JSP
diff --git a/test/webapp/jsp/generator/customtag-02.jsp 
b/test/webapp/jsp/generator/customtag-02.jsp
index 14e33eb..57cd254 100644
--- a/test/webapp/jsp/generator/customtag-02.jsp
+++ b/test/webapp/jsp/generator/customtag-02.jsp
@@ -16,8 +16,8 @@
 --%>
 <%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
 
-  
+  
 
 
-  
+  
 
\ No newline at end of file
diff --git a/test/webapp/jsp/generator/try-catch-finally.jsp 
b/test/webapp/jsp/generator/try-catch-fi

[Bug 65390] Problem in the code generated by jasper

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

Mark Thomas  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|DUPLICATE   |---

--- Comment #2 from Mark Thomas  ---
Can't be a duplicate as this impacts 9.0.x and the change that triggered 65387
was not back-ported to 9.0.x.

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



[Bug 65387] JSP compile error after upgrade 10.0.6 -> 10.0.7

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65387

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from Mark Thomas  ---
Fixed in:
- 10.1.x for 10.1.0-M2 onwards
- 10.0.x for 10.0.8 onwards

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



[Bug 65390] Problem in the code generated by jasper

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

--- Comment #3 from Remy Maucherat  ---
(In reply to Mark Thomas from comment #2)
> Can't be a duplicate as this impacts 9.0.x and the change that triggered
> 65387 was not back-ported to 9.0.x.

Good catch, I mostly stopped reading after TryCatchFinally since I was looking
at it at the same time. I haven't found the root cause of this issue yet
however.

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



[Bug 65390] Problem in the code generated by jasper

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

--- Comment #4 from Mark Thomas  ---
This is the problematic commit
https://github.com/apache/tomcat/commit/9f2d78449

I've reviewed the reason the code as removed and it was removed (by me) in
error. I'll restore the code shortly.

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



[tomcat] branch main updated: Fix BZ 65390 - revert code removal made in error

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new a65466f  Fix BZ 65390 - revert code removal made in error
a65466f is described below

commit a65466f13beed2fe65f5c569cd3b2f706406
Author: Mark Thomas 
AuthorDate: Fri Jun 18 16:54:45 2021 +0100

Fix BZ 65390 - revert code removal made in error

https://bz.apache.org/bugzilla/show_bug.cgi?id=65390
The code is required and should not have been removed.
Test case based one code provided by tk...@ai-ag.de
---
 java/org/apache/jasper/compiler/Generator.java |  4 
 test/org/apache/jasper/compiler/TestGenerator.java | 12 ++-
 test/webapp/WEB-INF/tags/bug65390.tag  | 20 ++
 test/webapp/bug6/bug65390-empty.jsp| 17 +++
 test/webapp/bug6/bug65390.jsp  | 24 ++
 webapps/docs/changelog.xml |  5 +
 6 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 66ff231..339de1f 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3322,6 +3322,10 @@ class Generator {
 boolean tmpIsFragment = isFragment;
 isFragment = true;
 String pushBodyCountVarSave = pushBodyCountVar;
+if (pushBodyCountVar != null) {
+// Use a fixed name for push body count, to simplify code gen
+pushBodyCountVar = "_jspx_push_body_count";
+}
 visitBody(n);
 out = outSave;
 parent = tmpParent;
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index c37451c..3b53bc1 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -435,7 +435,7 @@ public class TestGenerator extends TomcatBaseTest {
 }
 
 @Test
-public void testTryCtachFinally02 () throws Exception {
+public void testTryCtachFinally02() throws Exception {
 doTestJsp("try-catch-finally-02.jsp");
 }
 
@@ -970,6 +970,16 @@ public class TestGenerator extends TomcatBaseTest {
 Assert.assertEquals(body.toString(), 
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc);
 }
 
+@Test
+public void testBug65390() throws Exception {
+getTomcatInstanceTestWebapp(false, true);
+
+ByteChunk body = new ByteChunk();
+int rc = getUrl("http://localhost:"; + getPort() + 
"/test/bug6/bug65390.jsp", body, null);
+
+Assert.assertEquals(body.toString(), HttpServletResponse.SC_OK, rc);
+}
+
 private void doTestJsp(String jspName) throws Exception {
 doTestJsp(jspName, HttpServletResponse.SC_OK);
 }
diff --git a/test/webapp/WEB-INF/tags/bug65390.tag 
b/test/webapp/WEB-INF/tags/bug65390.tag
new file mode 100644
index 000..51d38c8
--- /dev/null
+++ b/test/webapp/WEB-INF/tags/bug65390.tag
@@ -0,0 +1,20 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless"%>
+<%
+getJspBody().invoke(null);
+%>
\ No newline at end of file
diff --git a/test/webapp/bug6/bug65390-empty.jsp 
b/test/webapp/bug6/bug65390-empty.jsp
new file mode 100644
index 000..2f7bb10
--- /dev/null
+++ b/test/webapp/bug6/bug65390-empty.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under 

[tomcat] branch 10.0.x updated: Fix BZ 65390 - revert code removal made in error

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new e2feddf  Fix BZ 65390 - revert code removal made in error
e2feddf is described below

commit e2feddfb9fc8f5bf8db96ece98528c65863b8907
Author: Mark Thomas 
AuthorDate: Fri Jun 18 16:54:45 2021 +0100

Fix BZ 65390 - revert code removal made in error

https://bz.apache.org/bugzilla/show_bug.cgi?id=65390
The code is required and should not have been removed.
Test case based one code provided by tk...@ai-ag.de
---
 java/org/apache/jasper/compiler/Generator.java |  4 
 test/org/apache/jasper/compiler/TestGenerator.java | 12 ++-
 test/webapp/WEB-INF/tags/bug65390.tag  | 20 ++
 test/webapp/bug6/bug65390-empty.jsp| 17 +++
 test/webapp/bug6/bug65390.jsp  | 24 ++
 webapps/docs/changelog.xml |  5 +
 6 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 66ff231..339de1f 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3322,6 +3322,10 @@ class Generator {
 boolean tmpIsFragment = isFragment;
 isFragment = true;
 String pushBodyCountVarSave = pushBodyCountVar;
+if (pushBodyCountVar != null) {
+// Use a fixed name for push body count, to simplify code gen
+pushBodyCountVar = "_jspx_push_body_count";
+}
 visitBody(n);
 out = outSave;
 parent = tmpParent;
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index c37451c..3b53bc1 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -435,7 +435,7 @@ public class TestGenerator extends TomcatBaseTest {
 }
 
 @Test
-public void testTryCtachFinally02 () throws Exception {
+public void testTryCtachFinally02() throws Exception {
 doTestJsp("try-catch-finally-02.jsp");
 }
 
@@ -970,6 +970,16 @@ public class TestGenerator extends TomcatBaseTest {
 Assert.assertEquals(body.toString(), 
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc);
 }
 
+@Test
+public void testBug65390() throws Exception {
+getTomcatInstanceTestWebapp(false, true);
+
+ByteChunk body = new ByteChunk();
+int rc = getUrl("http://localhost:"; + getPort() + 
"/test/bug6/bug65390.jsp", body, null);
+
+Assert.assertEquals(body.toString(), HttpServletResponse.SC_OK, rc);
+}
+
 private void doTestJsp(String jspName) throws Exception {
 doTestJsp(jspName, HttpServletResponse.SC_OK);
 }
diff --git a/test/webapp/WEB-INF/tags/bug65390.tag 
b/test/webapp/WEB-INF/tags/bug65390.tag
new file mode 100644
index 000..51d38c8
--- /dev/null
+++ b/test/webapp/WEB-INF/tags/bug65390.tag
@@ -0,0 +1,20 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless"%>
+<%
+getJspBody().invoke(null);
+%>
\ No newline at end of file
diff --git a/test/webapp/bug6/bug65390-empty.jsp 
b/test/webapp/bug6/bug65390-empty.jsp
new file mode 100644
index 000..2f7bb10
--- /dev/null
+++ b/test/webapp/bug6/bug65390-empty.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed un

[tomcat] branch 9.0.x updated: Fix BZ 65390 - revert code removal made in error

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 58497bd  Fix BZ 65390 - revert code removal made in error
58497bd is described below

commit 58497bd6798aff15631ecf86532dc9f318153074
Author: Mark Thomas 
AuthorDate: Fri Jun 18 16:54:45 2021 +0100

Fix BZ 65390 - revert code removal made in error

https://bz.apache.org/bugzilla/show_bug.cgi?id=65390
The code is required and should not have been removed.
Test case based one code provided by tk...@ai-ag.de
---
 java/org/apache/jasper/compiler/Generator.java |  4 
 test/org/apache/jasper/compiler/TestGenerator.java | 10 +
 test/webapp/WEB-INF/tags/bug65390.tag  | 20 ++
 test/webapp/bug6/bug65390-empty.jsp| 17 +++
 test/webapp/bug6/bug65390.jsp  | 24 ++
 webapps/docs/changelog.xml |  9 
 6 files changed, 84 insertions(+)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 0657506..d12bef8 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3330,6 +3330,10 @@ class Generator {
 boolean tmpIsFragment = isFragment;
 isFragment = true;
 String pushBodyCountVarSave = pushBodyCountVar;
+if (pushBodyCountVar != null) {
+// Use a fixed name for push body count, to simplify code gen
+pushBodyCountVar = "_jspx_push_body_count";
+}
 visitBody(n);
 out = outSave;
 parent = tmpParent;
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index e19f2ec..ae2c8cd 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -950,6 +950,16 @@ public class TestGenerator extends TomcatBaseTest {
 Assert.assertEquals(body.toString(), 
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc);
 }
 
+@Test
+public void testBug65390() throws Exception {
+getTomcatInstanceTestWebapp(false, true);
+
+ByteChunk body = new ByteChunk();
+int rc = getUrl("http://localhost:"; + getPort() + 
"/test/bug6/bug65390.jsp", body, null);
+
+Assert.assertEquals(body.toString(), HttpServletResponse.SC_OK, rc);
+}
+
 private void doTestJsp(String jspName) throws Exception {
 doTestJsp(jspName, HttpServletResponse.SC_OK);
 }
diff --git a/test/webapp/WEB-INF/tags/bug65390.tag 
b/test/webapp/WEB-INF/tags/bug65390.tag
new file mode 100644
index 000..51d38c8
--- /dev/null
+++ b/test/webapp/WEB-INF/tags/bug65390.tag
@@ -0,0 +1,20 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless"%>
+<%
+getJspBody().invoke(null);
+%>
\ No newline at end of file
diff --git a/test/webapp/bug6/bug65390-empty.jsp 
b/test/webapp/bug6/bug65390-empty.jsp
new file mode 100644
index 000..2f7bb10
--- /dev/null
+++ b/test/webapp/bug6/bug65390-empty.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib uri="http://tomcat.apache.org/bugs"

[tomcat] branch 9.0.x updated: Back-port rename as newer tests depend on it

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 30a967a  Back-port rename as newer tests depend on it
30a967a is described below

commit 30a967aa15e1da7e2e7f4a860965886e79438da5
Author: Mark Thomas 
AuthorDate: Fri Jun 18 17:04:09 2021 +0100

Back-port rename as newer tests depend on it
---
 test/org/apache/jasper/compiler/TestGenerator.java | 2 +-
 test/webapp/WEB-INF/bugs.tld   | 4 ++--
 test/webapp/jsp/generator/customtag-02.jsp | 4 ++--
 test/webapp/jsp/generator/try-catch-finally.jsp| 8 
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index ae2c8cd..0127f32 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -456,7 +456,7 @@ public class TestGenerator extends TomcatBaseTest {
 }
 }
 
-public static class TryCatchFinallyTag extends BodyTagSupport implements 
TryCatchFinally {
+public static class TryCatchFinallyBodyTag extends BodyTagSupport 
implements TryCatchFinally {
 
 private static final long serialVersionUID = 1L;
 
diff --git a/test/webapp/WEB-INF/bugs.tld b/test/webapp/WEB-INF/bugs.tld
index 6428e87..81d050e 100644
--- a/test/webapp/WEB-INF/bugs.tld
+++ b/test/webapp/WEB-INF/bugs.tld
@@ -85,8 +85,8 @@
 JSP
   
   
-TryCatchFinallyTag
-
org.apache.jasper.compiler.TestGenerator$TryCatchFinallyTag
+TryCatchFinallyBodyTag
+
org.apache.jasper.compiler.TestGenerator$TryCatchFinallyBodyTag
 JSP
   
   
diff --git a/test/webapp/jsp/generator/customtag-02.jsp 
b/test/webapp/jsp/generator/customtag-02.jsp
index 14e33eb..57cd254 100644
--- a/test/webapp/jsp/generator/customtag-02.jsp
+++ b/test/webapp/jsp/generator/customtag-02.jsp
@@ -16,8 +16,8 @@
 --%>
 <%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
 
-  
+  
 
 
-  
+  
 
\ No newline at end of file
diff --git a/test/webapp/jsp/generator/try-catch-finally.jsp 
b/test/webapp/jsp/generator/try-catch-finally.jsp
index 73ac9d8..d954046 100644
--- a/test/webapp/jsp/generator/try-catch-finally.jsp
+++ b/test/webapp/jsp/generator/try-catch-finally.jsp
@@ -15,7 +15,7 @@
   limitations under the License.
 --%>
 <%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
-
-  
-  
-
+
+  
+  
+

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated (dbb30f8 -> e706259)

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from dbb30f8  Fix BZ 65384 - Make test Locale independent
 new 7e1deb2  Fix BZ 65390 - revert code removal made in error
 new e706259  Back-port rename as newer tests depend on it

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/jasper/compiler/Generator.java|  4 
 test/org/apache/jasper/compiler/TestGenerator.java| 12 +++-
 test/webapp/WEB-INF/bugs.tld  |  4 ++--
 .../tags/bug65390.tag}|  3 ++-
 .../jsp/bug53574.jsp => bug6/bug65390-empty.jsp}  |  6 +-
 .../{bug5/bug55198.jsp => bug6/bug65390.jsp}  | 15 ++-
 test/webapp/jsp/generator/customtag-02.jsp|  4 ++--
 test/webapp/jsp/generator/try-catch-finally.jsp   |  8 
 webapps/docs/changelog.xml|  9 +
 9 files changed, 41 insertions(+), 24 deletions(-)
 copy test/webapp/{jsp/generator/break-el-interpreter.jsp => 
WEB-INF/tags/bug65390.tag} (88%)
 copy test/webapp/{WEB-INF/jsp/bug53574.jsp => bug6/bug65390-empty.jsp} 
(92%)
 copy test/webapp/{bug5/bug55198.jsp => bug6/bug65390.jsp} (82%)

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/02: Fix BZ 65390 - revert code removal made in error

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 7e1deb26d4c56979e8eb9b2dc00c8e1f3e18405d
Author: Mark Thomas 
AuthorDate: Fri Jun 18 16:54:45 2021 +0100

Fix BZ 65390 - revert code removal made in error

https://bz.apache.org/bugzilla/show_bug.cgi?id=65390
The code is required and should not have been removed.
Test case based one code provided by tk...@ai-ag.de
---
 java/org/apache/jasper/compiler/Generator.java |  4 
 test/org/apache/jasper/compiler/TestGenerator.java | 10 +
 test/webapp/WEB-INF/tags/bug65390.tag  | 20 ++
 test/webapp/bug6/bug65390-empty.jsp| 17 +++
 test/webapp/bug6/bug65390.jsp  | 24 ++
 webapps/docs/changelog.xml |  9 
 6 files changed, 84 insertions(+)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 8305f6a..2ff636f 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3299,6 +3299,10 @@ class Generator {
 boolean tmpIsFragment = isFragment;
 isFragment = true;
 String pushBodyCountVarSave = pushBodyCountVar;
+if (pushBodyCountVar != null) {
+// Use a fixed name for push body count, to simplify code gen
+pushBodyCountVar = "_jspx_push_body_count";
+}
 visitBody(n);
 out = outSave;
 parent = tmpParent;
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index 49c700d..4589b8a 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -887,6 +887,16 @@ public class TestGenerator extends TomcatBaseTest {
 Assert.assertEquals(body.toString(), 
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc);
 }
 
+@Test
+public void testBug65390() throws Exception {
+getTomcatInstanceTestWebapp(false, true);
+
+ByteChunk body = new ByteChunk();
+int rc = getUrl("http://localhost:"; + getPort() + 
"/test/bug6/bug65390.jsp", body, null);
+
+Assert.assertEquals(body.toString(), HttpServletResponse.SC_OK, rc);
+}
+
 private void doTestJsp(String jspName) throws Exception {
 doTestJsp(jspName, HttpServletResponse.SC_OK);
 }
diff --git a/test/webapp/WEB-INF/tags/bug65390.tag 
b/test/webapp/WEB-INF/tags/bug65390.tag
new file mode 100644
index 000..51d38c8
--- /dev/null
+++ b/test/webapp/WEB-INF/tags/bug65390.tag
@@ -0,0 +1,20 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless"%>
+<%
+getJspBody().invoke(null);
+%>
\ No newline at end of file
diff --git a/test/webapp/bug6/bug65390-empty.jsp 
b/test/webapp/bug6/bug65390-empty.jsp
new file mode 100644
index 000..2f7bb10
--- /dev/null
+++ b/test/webapp/bug6/bug65390-empty.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
\ No newline at end of file
diff --git a/test/webapp/bug6/bug65390.jsp 
b/test/webapp/bug6/bug65390.jsp
new file mode 100644
index 000

[Bug 65390] Problem in the code generated by jasper

2021-06-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #5 from Mark Thomas  ---
Thanks for the report and especially for the test case. A working test case
makes it so much easier to track down the root cause.

Fixed in:
- 10.1.x for 10.1.0-M2 onwards
- 10.0.x for 10.0.8 onwards
- 9.0.x for 9.0.49 onwards
- 8.5.x for 8.5.69 onwards

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



[tomcat] 02/02: Back-port rename as newer tests depend on it

2021-06-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e7062590b39bc7cd61972c32dbaadc17c38cc790
Author: Mark Thomas 
AuthorDate: Fri Jun 18 17:04:09 2021 +0100

Back-port rename as newer tests depend on it
---
 test/org/apache/jasper/compiler/TestGenerator.java | 2 +-
 test/webapp/WEB-INF/bugs.tld   | 4 ++--
 test/webapp/jsp/generator/customtag-02.jsp | 4 ++--
 test/webapp/jsp/generator/try-catch-finally.jsp| 8 
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index 4589b8a..4ce2af4 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -393,7 +393,7 @@ public class TestGenerator extends TomcatBaseTest {
 }
 }
 
-public static class TryCatchFinallyTag extends BodyTagSupport implements 
TryCatchFinally {
+public static class TryCatchFinallyBodyTag extends BodyTagSupport 
implements TryCatchFinally {
 
 private static final long serialVersionUID = 1L;
 
diff --git a/test/webapp/WEB-INF/bugs.tld b/test/webapp/WEB-INF/bugs.tld
index 6428e87..81d050e 100644
--- a/test/webapp/WEB-INF/bugs.tld
+++ b/test/webapp/WEB-INF/bugs.tld
@@ -85,8 +85,8 @@
 JSP
   
   
-TryCatchFinallyTag
-
org.apache.jasper.compiler.TestGenerator$TryCatchFinallyTag
+TryCatchFinallyBodyTag
+
org.apache.jasper.compiler.TestGenerator$TryCatchFinallyBodyTag
 JSP
   
   
diff --git a/test/webapp/jsp/generator/customtag-02.jsp 
b/test/webapp/jsp/generator/customtag-02.jsp
index 14e33eb..57cd254 100644
--- a/test/webapp/jsp/generator/customtag-02.jsp
+++ b/test/webapp/jsp/generator/customtag-02.jsp
@@ -16,8 +16,8 @@
 --%>
 <%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
 
-  
+  
 
 
-  
+  
 
\ No newline at end of file
diff --git a/test/webapp/jsp/generator/try-catch-finally.jsp 
b/test/webapp/jsp/generator/try-catch-finally.jsp
index 73ac9d8..d954046 100644
--- a/test/webapp/jsp/generator/try-catch-finally.jsp
+++ b/test/webapp/jsp/generator/try-catch-finally.jsp
@@ -15,7 +15,7 @@
   limitations under the License.
 --%>
 <%@ taglib uri="http://tomcat.apache.org/bugs"; prefix="bugs" %>
-
-  
-  
-
+
+  
+  
+

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [External] : Re: JDK 17 is now in Rampdown Phase One

2021-06-18 Thread Rick Hillegas

Hi Rory,

Derby builds and tests cleanly against Open JDK 17-ea+26-2439 after 
suppressing the deprecation warnings introduced by JEP 411. Our 
experience is documented in a security-...@openjdk.java.net email thread 
titled "blizzard of deprecation warnings related to JEP 411" and in 
comments dated between 2021-06-15 and 2021-06-18 on 
https://issues.apache.org/jira/browse/DERBY-7110.


On 6/14/21 11:20 AM, Rory O'Donnell wrote:

Hi Rick,

Excellent feedback , I suggest you send this information to the 
security-dev [1] mailing list to demonstrate the impact

it is having on you and others. Make sure to subscribe first.

Rgds,Rory

[1] security-...@openjdk.java.net 

On 14/06/2021 16:43, Rick Hillegas wrote:

Hi Rory,

Copying the Tomcat developer community since this issue probably 
affects them as well.


When I tried to build Derby with the Rampdown Phase One build of open 
JDK 17 (17-ea+26-2439), I saw many warnings related to the 
deprecation of Security Manager classes and methods, undoubtedly the 
consequence of JEP 411 (https://openjdk.java.net/jeps/411). Derby, 
like Tomcat, embraced the Security Manager early on. Permissions 
checks were rototilled across the whole code base. Our distributions 
ship with several template policy files, which we encourage users to 
customize for their environments. The "Configuring Java Security" 
section of our Security Guide explains how to do this 
(https://urldefense.com/v3/__https://db.apache.org/derby/docs/10.15/security/index.html__;!!GqivPVa7Brio!Ir7H5RCIuIIcRhganretmYcvHoP432X-jV4dVUNlqO1EmvYkTvkdZvEBdtBh9kcdocM$ 
).


My build only reported the first 100 warnings. It is likely that 
there are many more.


Having read the summary of JEP 411, I understand the motivation for 
this change. However, I don't understand how applications like Tomcat 
and Derby are supposed to respond to the new blizzard of deprecation 
warnings. For instance, is there a replacement for the deprecated 
AccessController.doPrivileged() method? Or are we supposed to simply 
disable this deprecation check? Is there some security expert whom we 
should contact about this change and how to mitigate its effects?


Thanks,
-Rick


On 6/14/21 2:18 AM, Rory O'Donnell wrote:


Hi Rick,
*
Per the JDK 17 schedule , we are in Rampdown Phase One [1].*

**Please advise if you find any issues while testing the latest 
Early Access builds**.**


 * Schedule:
 o *2021/06/10   Rampdown Phase One*
 o 2021/07/15    Rampdown Phase Two
 o 2021/08/05    Initial Release Candidate
 o 2021/08/19    Final Release Candidate
 o 2021/09/14    General Availability

The overall feature set is frozen. No further JEPs will be targeted 
to this release.


**

 * Important JEPs have been integrated – Attention Required!
 * *JEP 411: **Deprecate the Security Manager for
   Removal*
 o Deprecate, for removal, most Security Manager related classes
   and methods.
 o Warning message at startup if the Security Manager is enabled on
   the command line.
 o Warning message at run time if a Java application or library
   installs a Security Manager dynamically.
 o Deprecation is in concert with the legacy Applet API (JEP 398).
 * *JEP 407: **Remove RMI 
Activation*

 o Removal the Remote Method Invocation (RMI) Activation mechanism,
   while preserving the rest of RMI.
 o It was deprecated for removal by JEP
   385in Java SE 15.
 * *JEP 403: **Strongly Encapsulate JDK
   Internals*
 o Strongly encapsulate all internal elements of the JDK, except
   for critical internal APIs such as /sun.misc.Unsafe/.
 o It will no longer be possible to relax the strong encapsulation
   of internal elements via a single command-line option.

 * Other features integrated in JDK 17:
 o *JEP 306: **Restore Always-Strict Floating-Point
   Semantics*
 o JEP 356: Enhanced Pseudo-Random Number
   Generators
 o JEP 382: New macOS Rendering
   Pipeline
 o JEP 391: macOS/AArch64 Port
 o JEP 398: Deprecate the Applet API for
   Removal
 o *JEP 406: **Pattern Matching for switch
   (Preview)*
 o JEP 409: Sealed Classes
 o JEP 410: Remove the Experimental AOT and JIT
   Compiler
 o JEP 412: Foreign Function & Memory API
   (Incubator)
 o *JEP 414: **Vector API (Second
   Incubator)*
 o *JEP 415: **Context-Specific Deserialization
   Filters*

Re: [External] : Re: JDK 17 is now in Rampdown Phase One

2021-06-18 Thread Rory Odonnell
Many thanks Rick, glad to hear all is well again!

Reds,Rory

Get Outlook for iOS

From: Rick Hillegas 
Sent: Friday, June 18, 2021 7:19:09 PM
To: Rory Odonnell ; derby-...@db.apache.org 
; dev@tomcat.apache.org 
Cc: Dalibor Topic ; Balchandra Vaidya 
; Deepak Damodaran 
Subject: Re: [External] : Re: JDK 17 is now in Rampdown Phase One

Hi Rory,

Derby builds and tests cleanly against Open JDK 17-ea+26-2439 after
suppressing the deprecation warnings introduced by JEP 411. Our
experience is documented in a security-...@openjdk.java.net email thread
titled "blizzard of deprecation warnings related to JEP 411" and in
comments dated between 2021-06-15 and 2021-06-18 on
https://urldefense.com/v3/__https://issues.apache.org/jira/browse/DERBY-7110__;!!GqivPVa7Brio!McghnfCCxtVZFIPEzbD7Uxb10QRjioV2hX5tYh3mbMhBIjtXLOkYmBVY53aFPl8BDjs$
 .

On 6/14/21 11:20 AM, Rory O'Donnell wrote:
> Hi Rick,
>
> Excellent feedback , I suggest you send this information to the
> security-dev [1] mailing list to demonstrate the impact
> it is having on you and others. Make sure to subscribe first.
>
> Rgds,Rory
>
> [1] security-...@openjdk.java.net 
>
> On 14/06/2021 16:43, Rick Hillegas wrote:
>> Hi Rory,
>>
>> Copying the Tomcat developer community since this issue probably
>> affects them as well.
>>
>> When I tried to build Derby with the Rampdown Phase One build of open
>> JDK 17 (17-ea+26-2439), I saw many warnings related to the
>> deprecation of Security Manager classes and methods, undoubtedly the
>> consequence of JEP 411 (https://openjdk.java.net/jeps/411). Derby,
>> like Tomcat, embraced the Security Manager early on. Permissions
>> checks were rototilled across the whole code base. Our distributions
>> ship with several template policy files, which we encourage users to
>> customize for their environments. The "Configuring Java Security"
>> section of our Security Guide explains how to do this
>> (https://urldefense.com/v3/__https://db.apache.org/derby/docs/10.15/security/index.html__;!!GqivPVa7Brio!Ir7H5RCIuIIcRhganretmYcvHoP432X-jV4dVUNlqO1EmvYkTvkdZvEBdtBh9kcdocM$
>> ).
>>
>> My build only reported the first 100 warnings. It is likely that
>> there are many more.
>>
>> Having read the summary of JEP 411, I understand the motivation for
>> this change. However, I don't understand how applications like Tomcat
>> and Derby are supposed to respond to the new blizzard of deprecation
>> warnings. For instance, is there a replacement for the deprecated
>> AccessController.doPrivileged() method? Or are we supposed to simply
>> disable this deprecation check? Is there some security expert whom we
>> should contact about this change and how to mitigate its effects?
>>
>> Thanks,
>> -Rick
>>
>>
>> On 6/14/21 2:18 AM, Rory O'Donnell wrote:
>>>
>>> Hi Rick,
>>> *
>>> Per the JDK 17 schedule , we are in Rampdown Phase One [1].*
>>>
>>> **Please advise if you find any issues while testing the latest
>>> Early Access builds**.**
>>>
>>>  * Schedule:
>>>  o *2021/06/10   Rampdown Phase One*
>>>  o 2021/07/15Rampdown Phase Two
>>>  o 2021/08/05Initial Release Candidate
>>>  o 2021/08/19Final Release Candidate
>>>  o 2021/09/14General Availability
>>>
>>> The overall feature set is frozen. No further JEPs will be targeted
>>> to this release.
>>>
>>> **
>>>
>>>  * Important JEPs have been integrated – Attention Required!
>>>  * *JEP 411: **Deprecate the Security Manager for
>>>Removal*
>>>  o Deprecate, for removal, most Security Manager related classes
>>>and methods.
>>>  o Warning message at startup if the Security Manager is enabled on
>>>the command line.
>>>  o Warning message at run time if a Java application or library
>>>installs a Security Manager dynamically.
>>>  o Deprecation is in concert with the legacy Applet API (JEP 398).
>>>  * *JEP 407: **Remove RMI
>>> Activation*
>>>  o Removal the Remote Method Invocation (RMI) Activation mechanism,
>>>while preserving the rest of RMI.
>>>  o It was deprecated for removal by JEP
>>>385in Java SE 15.
>>>  * *JEP 403: **Strongly Encapsulate JDK
>>>Internals*
>>>  o Strongly encapsulate all internal elements of the JDK, except
>>>for critical internal APIs such as /sun.misc.Unsafe/.
>>>  o It will no longer be possible to relax the strong encapsulation
>>>of internal elements via a single command-line option.
>>>
>>>  * Other features integrated in JDK 17:
>>>  o *JEP 306: **Restore Always-Strict Floating-Point
>>>Semantics*
>>>  o JEP 356: Enhanced Pseudo-Random Number
>>>Generators
>>>  o JEP 382: New macOS Re

Re: [tomcat] branch main updated: Fix BZ 65390 - revert code removal made in error

2021-06-18 Thread Christopher Schultz

Mark,

s/Ctach/Catch/ig

-chris

On 6/18/21 11:55, ma...@apache.org wrote:

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
  new a65466f  Fix BZ 65390 - revert code removal made in error
a65466f is described below

commit a65466f13beed2fe65f5c569cd3b2f706406
Author: Mark Thomas 
AuthorDate: Fri Jun 18 16:54:45 2021 +0100

 Fix BZ 65390 - revert code removal made in error
 
 https://bz.apache.org/bugzilla/show_bug.cgi?id=65390

 The code is required and should not have been removed.
 Test case based one code provided by tk...@ai-ag.de
---
  java/org/apache/jasper/compiler/Generator.java |  4 
  test/org/apache/jasper/compiler/TestGenerator.java | 12 ++-
  test/webapp/WEB-INF/tags/bug65390.tag  | 20 ++
  test/webapp/bug6/bug65390-empty.jsp| 17 +++
  test/webapp/bug6/bug65390.jsp  | 24 ++
  webapps/docs/changelog.xml |  5 +
  6 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 66ff231..339de1f 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3322,6 +3322,10 @@ class Generator {
  boolean tmpIsFragment = isFragment;
  isFragment = true;
  String pushBodyCountVarSave = pushBodyCountVar;
+if (pushBodyCountVar != null) {
+// Use a fixed name for push body count, to simplify code gen
+pushBodyCountVar = "_jspx_push_body_count";
+}
  visitBody(n);
  out = outSave;
  parent = tmpParent;
diff --git a/test/org/apache/jasper/compiler/TestGenerator.java 
b/test/org/apache/jasper/compiler/TestGenerator.java
index c37451c..3b53bc1 100644
--- a/test/org/apache/jasper/compiler/TestGenerator.java
+++ b/test/org/apache/jasper/compiler/TestGenerator.java
@@ -435,7 +435,7 @@ public class TestGenerator extends TomcatBaseTest {
  }
  
  @Test

-public void testTryCtachFinally02 () throws Exception {
+public void testTryCtachFinally02() throws Exception {
  doTestJsp("try-catch-finally-02.jsp");
  }
  
@@ -970,6 +970,16 @@ public class TestGenerator extends TomcatBaseTest {

  Assert.assertEquals(body.toString(), 
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc);
  }
  
+@Test

+public void testBug65390() throws Exception {
+getTomcatInstanceTestWebapp(false, true);
+
+ByteChunk body = new ByteChunk();
+int rc = getUrl("http://localhost:"; + getPort() + 
"/test/bug6/bug65390.jsp", body, null);
+
+Assert.assertEquals(body.toString(), HttpServletResponse.SC_OK, rc);
+}
+
  private void doTestJsp(String jspName) throws Exception {
  doTestJsp(jspName, HttpServletResponse.SC_OK);
  }
diff --git a/test/webapp/WEB-INF/tags/bug65390.tag 
b/test/webapp/WEB-INF/tags/bug65390.tag
new file mode 100644
index 000..51d38c8
--- /dev/null
+++ b/test/webapp/WEB-INF/tags/bug65390.tag
@@ -0,0 +1,20 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless"%>
+<%
+getJspBody().invoke(null);
+%>
\ No newline at end of file
diff --git a/test/webapp/bug6/bug65390-empty.jsp 
b/test/webapp/bug6/bug65390-empty.jsp
new file mode 100644
index 000..2f7bb10
--- /dev/null
+++ b/test/webapp/bug6/bug65390-empty.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/lic

[GitHub] [tomcat] cklein05 opened a new pull request #428: Enhancement: Additional user attributes queried by (some) realms

2021-06-18 Thread GitBox


cklein05 opened a new pull request #428:
URL: https://github.com/apache/tomcat/pull/428


   
   This enhancement adds support for additional user attributes to be queried 
by MemoryRealm, UserDatabaseRealm, DataSourceRealm and JNDIRealm. That has 
already been discussed here
   
   
http://tomcat.10.x6.nabble.com/Getting-additional-attributes-for-logged-on-users-tt5110316.html
   
   and here
   
   
http://tomcat.10.x6.nabble.com/Enhancement-Additional-user-attributes-queried-by-some-realms-td5111884.html
   
   Bold sentences require your special attention (like questions, decisions, 
changes not related to the enhancement, etc).
   
   **That's still work in progress. There's no documentation and change log 
entries yet. Let's agree on the code first.**
   
   **Have a look at example at `/examples/jsp/security/protected/`. It has been 
modified to list all the Principal's attributes.**
   
   ### General implementation notes:
   
   - Interface `TomcatPrincipal` now supports an attributes map, accessible by 
methods
   
 `Object getAttribute(String name);`
 `Enumeration getAttributeNames();`
 `boolean isAttributesIgnoreCase();`
   
 Have a look at these method's Javadoc comments.
   
 Note, that it's not named _userAttributes_, but simply _attributes_. It 
uses that more generic name, since the Principal _IS_ (or at least represents) 
the user.
   
 With JNDIRealm, and, depending on the directory server used, attribute 
names may be _case-insensitive_ (if `
   javax.naming.directory.Attributes.isCaseIgnored()` returns `true`). If so, 
the Principal's attributes map uses case-insensitive names as well.
   
   - Class `GenericPrincipal`, which implements that interface, also adds 
serialization support for the attributes map.
   
   - Realm classes `MemoryRealm`, `UserDatabaseRealm`, `DataSourceRealm` and 
`JNDIRealm` now have a new configuration option `userAttributes`. It takes a 
delimiter separated list of attribute/field names to query from the _user 
table/entry_. These additional attributes are then provided through the 
Principal's attributes map.
   
 That option supports a wildcard character (*), which indicates to retrieve 
all available attributes/fields (except the _password_ field). Both the 
delimiter and the wildcard character are defined by a constant in class 
`RealmBase`.
   
   - Using the `userAttributes` option requires some preprocessing, depending 
on the Realm implementation (parsing, validating etc.). Its result is then 
cached in a Realm's private field.
   
 The preprocessing  may be quite expensive for some Realms. For example, 
DataSourceRealm must retrieve all the user table's field names to determine, 
which requested attributes are valid (if no wildcard character was specified).
   
 I decided not to use any JDBC- or JNDI connections prior to the first 
authentication attempt so, preprocessing is done lazily for some Realms. As 
Realms are used by concurrent threads, it uses _double-checked locking, DCL_ in 
order to be thread-safe (like in `UserDatabaseRealm.getDatabase()`). That, in 
particular, applies to `DataSourceRealm`.
   
 Since JNDI simply ignores requested non-existing attributes, it's much 
easier to use than JDBC and SQL. Together with the fact, that JNDIRealm anyway 
logs missing or invalid fields for every login attempt (in contrast to while 
preprocessing only), lazy initialization and the DCL is not needed with that 
Realm.
   
   - Preprocessing logs a warning to the container log for every unknown or 
invalid attribute requested. Except for `MemoryRealm`, warnings are logged on 
the first authentication attempt. `JNDIRealm` even logs warnings on every 
authentication attempt, since in a directory users may have different sets of 
attributes.
   
 - All Realms emit warning messages
   - `realmBase.userAttributeAccessDenied`, if an attribute containing the 
user's password is requested.
   - `realmBase.userAttributeNotFound`, if the attribute could not be found.
 - JNDIRealm emits warning messages
   - `jndiRealm.userAttributeAccessDenied`, if an attribute containing the 
user's password is requested.
   - `jndiRealm.userAttributeNotFound`, if the attribute could not be found.
 - JNDIRealm emits debug message
   - `jndiRealm.userAttributeNotRequested`, if a _related_ attribute was 
sent by the directory server, but was not explicitly requested
   
 **We may still agree on the log levels used.**
   
   - Realms (are encouraged to) use a LinkedHashMap to store user attributes, 
so insertion order is preserved. That is, `getAttributeNames()` returns names 
in the order specified in the `userAttributes` option (with invalid attributes 
removed).
   
   ### Realm-specific notes
   
   - `MemoryRealm`
 - Uses a fixed set of available user attributes, determined by its 
implementation:
   `username`
   `fullname`
   `roles`(comma separated list of roles like in the