From: markt Date: Fri, 19 Nov 2010 18:21:29 +0000 (+0000) Subject: Additional fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=49297 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f4b41391fd8103ed4e49c166da56dd8660700153;p=tomcat7.0 Additional fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=49297 Handle tag directives in a similar manner to page directives git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1036969 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/jasper/compiler/Parser.java b/java/org/apache/jasper/compiler/Parser.java index c9ef2f5f4..d7be14c01 100644 --- a/java/org/apache/jasper/compiler/Parser.java +++ b/java/org/apache/jasper/compiler/Parser.java @@ -572,7 +572,7 @@ class Parser implements TagConstants { * Attribute)* */ private void parseTagDirective(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); + Attributes attrs = parseAttributes(true); Node.TagDirective n = new Node.TagDirective(attrs, start, parent); /* diff --git a/test/org/apache/jasper/compiler/TestParser.java b/test/org/apache/jasper/compiler/TestParser.java index 0c2fe3b77..87489157b 100644 --- a/test/org/apache/jasper/compiler/TestParser.java +++ b/test/org/apache/jasper/compiler/TestParser.java @@ -254,6 +254,25 @@ public class TestParser extends TomcatBaseTest { assertEquals(500, sc); } + public void testBug49297Tag() throws Exception { + + Tomcat tomcat = getTomcatInstance(); + + File appDir = new File("test/webapp-3.0"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = new ByteChunk(); + int sc = getUrl("http://localhost:" + getPort() + + "/test/bug49nnn/bug49297Tag.jsp", res, + new HashMap>()); + + assertEquals(200, sc); + assertEcho(res.toString(), "OK"); + } + /** Assertion for text printed by tags:echo */ private static void assertEcho(String result, String expected) { assertTrue(result.indexOf("

" + expected + "

") > 0); diff --git a/test/webapp-3.0/WEB-INF/tags/bug49297.tag b/test/webapp-3.0/WEB-INF/tags/bug49297.tag new file mode 100644 index 000000000..898073757 --- /dev/null +++ b/test/webapp-3.0/WEB-INF/tags/bug49297.tag @@ -0,0 +1,21 @@ +<%-- + 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 import="java.util.List" import="java.util.ArrayList"%><%@ +tag body-content="empty" %><% + // Make sure the imports above do work + List l = new ArrayList(); + l.add("OK"); + %>

<%=l.get(0)%>

\ No newline at end of file diff --git a/test/webapp-3.0/bug49nnn/bug49297Tag.jsp b/test/webapp-3.0/bug49nnn/bug49297Tag.jsp new file mode 100644 index 000000000..f8a836e20 --- /dev/null +++ b/test/webapp-3.0/bug49nnn/bug49297Tag.jsp @@ -0,0 +1,23 @@ +<%-- + 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 prefix="tags" tagdir="/WEB-INF/tags" %> + + Bug 49297 duplicate attribute test case + + + + \ No newline at end of file