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 <ma...@apache.org> 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/bug6nnnn/bug65390-empty.jsp | 17 +++++++++++++++ test/webapp/bug6nnnn/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/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 510d2f4..b3b1a15 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -184,6 +184,11 @@ and restore the local definition of <code>out</code> for tags that implement <code>TryCatchFinally</code>. (markt) </fix> + <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"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org