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 <[email protected]>
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 [email protected]
---
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/bug6nnnn/bug65390-empty.jsp | 17 +++++++++++++++
test/webapp/bug6nnnn/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/bug6nnnn/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 0000000..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/bug6nnnn/bug65390-empty.jsp
b/test/webapp/bug6nnnn/bug65390-empty.jsp
new file mode 100644
index 0000000..2f7bb10
--- /dev/null
+++ b/test/webapp/bug6nnnn/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/bug6nnnn/bug65390.jsp
b/test/webapp/bug6nnnn/bug65390.jsp
new file mode 100644
index 0000000..59317ec
--- /dev/null
+++ b/test/webapp/bug6nnnn/bug65390.jsp
@@ -0,0 +1,24 @@
+<%--
+ 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.
+--%>
+<%@ include file="bug65390-empty.jsp" %>
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+
+<bugs:TryCatchFinallyBodyTag>
+ <tags:bug65390>
+ <tags:bug65390>qqq</tags:bug65390>
+ </tags:bug65390>
+</bugs:TryCatchFinallyBodyTag>
\ No newline at end of file
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8fc330a..598969e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -177,6 +177,15 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <bug>65390</bug>: Correct a regression in the fix for <bug>65124</bug>
+ and restore code that was removed in error leading to JSP compilation
+ failures in some circumstances. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Web applications">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]