From: kkolinko Date: Sun, 9 Jan 2011 08:10:33 +0000 (+0000) Subject: Enable testcase for 50413#c6, now that the issue is fixed with r1056889. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2f5693f5a4d09609d654a65bcd6140a8f927b995;p=tomcat7.0 Enable testcase for 50413#c6, now that the issue is fixed with r1056889. Update changelog. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1056890 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/catalina/servlets/TestDefaultServlet.java b/test/org/apache/catalina/servlets/TestDefaultServlet.java index 112573764..42ec3c2b0 100644 --- a/test/org/apache/catalina/servlets/TestDefaultServlet.java +++ b/test/org/apache/catalina/servlets/TestDefaultServlet.java @@ -220,8 +220,47 @@ public class TestDefaultServlet extends TomcatBaseTest { client.connect(); client.processRequest(); assertTrue(client.isResponse404()); - // FIXME: The following currently fails - // assertEquals("It is 404.html", client.getResponseBody()); + assertEquals("It is 404.html", client.getResponseBody()); + } + + /** + * Test what happens if a custom 404 page is configured, + * but its file is actually missing. + */ + public void testCustomErrorPageMissing() throws Exception { + File appDir = new File(getTemporaryDirectory(), "MyApp"); + new File(appDir, "WEB-INF").mkdirs(); + Writer w = new OutputStreamWriter(new FileOutputStream(new File(appDir, + "WEB-INF/web.xml")), "UTF-8"); + try { + w.write("\n" + + "\n" + + "\n404\n" + + "/404-absent.html\n\n" + + "\n"); + w.flush(); + } finally { + w.close(); + } + + Tomcat tomcat = getTomcatInstance(); + String contextPath = "/MyApp"; + tomcat.addWebapp(null, contextPath, appDir.getAbsolutePath()); + tomcat.start(); + + TestCustomErrorClient client = new TestCustomErrorClient(); + client.setPort(getPort()); + + client.reset(); + client.setRequest(new String[] { "GET /MyApp/missing HTTP/1.0" + CRLF + + CRLF }); + client.connect(); + client.processRequest(); + assertTrue(client.isResponse404()); } public static int getUrl(String path, ByteChunk out, diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 90c92139e..ce8454e38 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -165,7 +165,7 @@ 50413: Ensure 304 responses are not returned when using - static files as error pages. (markt) + static files as error pages. (markt/kkolinko) 50448: Fix possible IllegalStateException