Add a test case for https://issues.apache.org/bugzilla/show_bug.cgi?id=49196
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 25 May 2010 14:20:16 +0000 (14:20 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 25 May 2010 14:20:16 +0000 (14:20 +0000)
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 [new file with mode: 0644]
test/webapp-3.0/bug49196.jsp [new file with mode: 0644]

diff --git a/test/javax/servlet/jsp/TestPageContext.java b/test/javax/servlet/jsp/TestPageContext.java
new file mode 100644 (file)
index 0000000..961234c
--- /dev/null
@@ -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 (file)
index 0000000..4a0e9b0
--- /dev/null
@@ -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();
+%>
+<html>
+  <head><title>Bug 49196 test case</title></head>
+  <body>
+    <p>OK</p>
+  </body>
+</html>
\ No newline at end of file