From 8c77ba2b7a1f9b9853894a1ae85d7c48e01bc1b0 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 25 May 2010 14:20:16 +0000 Subject: [PATCH] Add a test case for https://issues.apache.org/bugzilla/show_bug.cgi?id=49196 Patch to follow shortly git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@948055 13f79535-47bb-0310-9956-ffa450edef68 --- test/javax/servlet/jsp/TestPageContext.java | 43 +++++++++++++++++++++++++++++ test/webapp-3.0/bug49196.jsp | 26 +++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 test/javax/servlet/jsp/TestPageContext.java create mode 100644 test/webapp-3.0/bug49196.jsp diff --git a/test/javax/servlet/jsp/TestPageContext.java b/test/javax/servlet/jsp/TestPageContext.java new file mode 100644 index 000000000..961234c96 --- /dev/null +++ b/test/javax/servlet/jsp/TestPageContext.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package javax.servlet.jsp; + +import java.io.File; + +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; + +public class TestPageContext extends TomcatBaseTest { + + public void testBug49196() 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 = getUrl("http://localhost:" + getPort() + + "/test/bug49196.jsp"); + + String result = res.toString(); + assertTrue(result.contains("OK")); + } +} diff --git a/test/webapp-3.0/bug49196.jsp b/test/webapp-3.0/bug49196.jsp new file mode 100644 index 000000000..4a0e9b049 --- /dev/null +++ b/test/webapp-3.0/bug49196.jsp @@ -0,0 +1,26 @@ +<%-- + 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. +--%> +<% +// As nonsensical as this is, in't shouldn't throw an NPE +pageContext.getErrorData(); +%> + + Bug 49196 test case + +

OK

+ + \ No newline at end of file -- 2.11.0