hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r524771 - in /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http: impl/nio/ nio/ nio/protocol/
Date Mon, 02 Apr 2007 11:47:24 GMT
Author: olegk
Date: Mon Apr  2 04:47:23 2007
New Revision: 524771

URL: http://svn.apache.org/viewvc?view=rev&rev=524771
Log:
HTTPCORE-58: Changed NHTTP connections to throw checked ConnectionClosedException instead
of unchecked IllegalStateException when an attempt is made to perform an I/O operation on
a closed conection

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?view=diff&rev=524771&r1=524770&r2=524771
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
Mon Apr  2 04:47:23 2007
@@ -159,7 +159,7 @@
         }
     }
     
-    public void submitRequest(final HttpRequest request) throws HttpException {
+    public void submitRequest(final HttpRequest request) throws IOException, HttpException
{
         if (request == null) {
             throw new IllegalArgumentException("HTTP request may not be null");
         }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java?view=diff&rev=524771&r1=524770&r2=524771
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
Mon Apr  2 04:47:23 2007
@@ -157,7 +157,7 @@
         }
     }
     
-    public void submitResponse(final HttpResponse response) throws HttpException {
+    public void submitResponse(final HttpResponse response) throws IOException, HttpException
{
         if (response == null) {
             throw new IllegalArgumentException("HTTP response may not be null");
         }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?view=diff&rev=524771&r1=524770&r2=524771
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
Mon Apr  2 04:47:23 2007
@@ -36,6 +36,7 @@
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 
+import org.apache.http.ConnectionClosedException;
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
@@ -196,9 +197,9 @@
         return this.hasBufferedOutput;
     }
     
-    protected void assertNotClosed() {
+    protected void assertNotClosed() throws IOException {
         if (this.closed) {
-            throw new IllegalStateException("Connection is closed");
+            throw new ConnectionClosedException("Connection is closed");
         }
     }
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpClientConnection.java?view=diff&rev=524771&r1=524770&r2=524771
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpClientConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpClientConnection.java
Mon Apr  2 04:47:23 2007
@@ -31,6 +31,8 @@
 
 package org.apache.http.nio;
 
+import java.io.IOException;
+
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 
@@ -46,9 +48,10 @@
      * Submits the HTTP request to the target server.
      *  
      * @param request HTTP request
+     * @throws IOException if I/O error occurs while submitting the request
      * @throws HttpException if the HTTP request violates the HTTP protocol.
      */
-    void submitRequest(HttpRequest request) throws HttpException;
+    void submitRequest(HttpRequest request) throws IOException, HttpException;
 
     /**
      * Returns <tt>true</tt> if an HTTP request has been submitted to the 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpServerConnection.java?view=diff&rev=524771&r1=524770&r2=524771
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/NHttpServerConnection.java
Mon Apr  2 04:47:23 2007
@@ -31,6 +31,8 @@
 
 package org.apache.http.nio;
 
+import java.io.IOException;
+
 import org.apache.http.HttpException;
 import org.apache.http.HttpResponse;
 
@@ -47,9 +49,10 @@
      *  
      * @param response HTTP response
      * 
+     * @throws IOException if I/O error occurs while submitting the response
      * @throws HttpException if the HTTP response violates the HTTP protocol.
      */
-    void submitResponse(HttpResponse response) throws HttpException;
+    void submitResponse(HttpResponse response) throws IOException, HttpException;
 
     /**
      * Returns <tt>true</tt> if an HTTP response has been submitted to the 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java?view=diff&rev=524771&r1=524770&r2=524771
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
Mon Apr  2 04:47:23 2007
@@ -310,6 +310,11 @@
                     connState.notifyAll();
                 }
                 
+            } catch (IOException ex) {
+                shutdownConnection(conn);
+                if (eventListener != null) {
+                    eventListener.fatalIOException(ex);
+                }
             } catch (HttpException ex) {
                 shutdownConnection(conn);
                 if (eventListener != null) {



Mime
View raw message