abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r548152 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Date Mon, 18 Jun 2007 01:00:47 GMT
Author: jmsnell
Date: Sun Jun 17 18:00:46 2007
New Revision: 548152

URL: http://svn.apache.org/viewvc?view=rev&rev=548152
Log:
Fix for https://issues.apache.org/jira/browse/ABDERA-49
As suggested by Ugo

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java?view=diff&rev=548152&r1=548151&r2=548152
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Sun Jun 17 18:00:46 2007
@@ -35,20 +35,32 @@
 
   @Override
   public int read() throws IOException {
-    int r = super.read();
-    if (r == -1) {
-      method.releaseConnection();
+    try {
+      int r = super.read();
+      if (r == -1) {
+        method.releaseConnection();
+      }
+      return r;
+    } catch (IOException e) {
+      if (method != null) 
+        method.releaseConnection();
+      throw e;
     }
-    return r;
   }
 
   @Override
   public int read(byte[] b, int off, int len) throws IOException {
-    int r= super.read(b, off, len);
-    if (r == -1) {
-      method.releaseConnection();
+    try {
+      int r= super.read(b, off, len);
+      if (r == -1) {
+        method.releaseConnection();
+      }
+      return r;
+    } catch (IOException e) {
+      if (method != null)
+        method.releaseConnection();
+      throw e;
     }
-    return r;
   }
   
 }



Mime
View raw message