You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/12/03 15:18:32 UTC
svn commit: r1416534 -
/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
Author: markt
Date: Mon Dec 3 14:18:31 2012
New Revision: 1416534
URL: http://svn.apache.org/viewvc?rev=1416534&view=rev
Log:
If the status code is an error but there was no response body, the error input stream will be null. Handle this.
Modified:
tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1416534&r1=1416533&r2=1416534&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Mon Dec 3 14:18:31 2012
@@ -255,20 +255,22 @@ public abstract class TomcatBaseTest ext
} else {
is = connection.getErrorStream();
}
- 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 (is != null) {
+ 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
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org