From: timw Date: Wed, 6 Oct 2010 08:36:20 +0000 (+0000) Subject: Making TomcatBaseTest.getUrl() work for get requests that return 404 responses X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1da052892c86e3c4452391804ac43b33feb64eb9;p=tomcat7.0 Making TomcatBaseTest.getUrl() work for get requests that return 404 responses git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1004927 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/catalina/startup/TomcatBaseTest.java b/test/org/apache/catalina/startup/TomcatBaseTest.java index 5c78c3e57..3ff74ef47 100644 --- a/test/org/apache/catalina/startup/TomcatBaseTest.java +++ b/test/org/apache/catalina/startup/TomcatBaseTest.java @@ -191,21 +191,23 @@ public abstract class TomcatBaseTest extends TestCase { Map> head = connection.getHeaderFields(); resHead.putAll(head); } - InputStream is = connection.getInputStream(); - BufferedInputStream bis = null; - try { - bis = new BufferedInputStream(is); - byte[] buf = new byte[2048]; - int rd = 0; - while((rd = bis.read(buf)) > 0) { - out.append(buf, 0, rd); - } - } finally { - if (bis != null) { - try { - bis.close(); - } catch (IOException e) { - // Ignore + if (rc == HttpServletResponse.SC_OK) { + InputStream is = connection.getInputStream(); + BufferedInputStream bis = null; + try { + bis = new BufferedInputStream(is); + byte[] buf = new byte[2048]; + int rd = 0; + while((rd = bis.read(buf)) > 0) { + out.append(buf, 0, rd); + } + } finally { + if (bis != null) { + try { + bis.close(); + } catch (IOException e) { + // Ignore + } } } }