commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r962835 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/finger/FingerClient.java
Date Sat, 10 Jul 2010 12:48:07 GMT
Author: sebb
Date: Sat Jul 10 12:48:07 2010
New Revision: 962835

URL: http://svn.apache.org/viewvc?rev=962835&view=rev
Log:
Ensure input is closed on IOError

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/finger/FingerClient.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/finger/FingerClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/finger/FingerClient.java?rev=962835&r1=962834&r2=962835&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/finger/FingerClient.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/finger/FingerClient.java
Sat Jul 10 12:48:07 2010
@@ -92,16 +92,18 @@ public class FingerClient extends Socket
             new BufferedReader(new InputStreamReader(getInputStream(longOutput,
                                username)));
 
-        while (true)
-        {
-            read = input.read(__buffer, 0, __buffer.length);
-            if (read <= 0)
-                break;
-            result.append(__buffer, 0, read);
+        try {
+            while (true)
+            {
+                read = input.read(__buffer, 0, __buffer.length);
+                if (read <= 0)
+                    break;
+                result.append(__buffer, 0, read);
+            }
+        } finally {
+            input.close();
         }
 
-        input.close();
-
         return result.toString();
     }
 



Mime
View raw message