Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv17522/src/com/meterware/httpunit
Modified Files:
HttpWebResponse.java
Log Message:
from Jessica Sant: fixed handling of error status under JDK 1.3.1-03
Index: HttpWebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpWebResponse.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- HttpWebResponse.java 9 May 2002 20:02:46 -0000 1.22
+++ HttpWebResponse.java 18 Jun 2002 16:37:03 -0000 1.23
@@ -22,6 +22,7 @@
import java.io.BufferedInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -53,7 +54,9 @@
/** make sure that any IO exception for HTML received page happens here, not later. **/
if (_responseCode < HttpURLConnection.HTTP_BAD_REQUEST || !throwExceptionOnError) {
- defineRawInputStream( new BufferedInputStream( connection.getInputStream() ) );
+ InputStream stream = (_responseCode < HttpURLConnection.HTTP_BAD_REQUEST) ? connection.getInputStream()
+ : ((HttpURLConnection) connection).getErrorStream();
+ defineRawInputStream( new BufferedInputStream( stream ) );
if (getContentType().startsWith( "text" )) loadResponseText();
}
}
|