avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1349497 - in /avro/trunk: CHANGES.txt lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java
Date Tue, 12 Jun 2012 19:48:33 GMT
Author: cutting
Date: Tue Jun 12 19:48:32 2012
New Revision: 1349497

URL: http://svn.apache.org/viewvc?rev=1349497&view=rev
Log:
AVRO-1069. Java: Fix HttpTransceiver to close streams.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1349497&r1=1349496&r2=1349497&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Tue Jun 12 19:48:32 2012
@@ -13,6 +13,8 @@ Avro 1.7.1 (unreleased)
 
     AVRO-1114. Java: Update license headers for new mapreduce code.  (cutting)
 
+    AVRO-1069. Java: Fix HttpTransceiver to close streams. (cutting)
+
 Avro 1.7.0 (11 June 2012)
 
   NEW FEATURES

Modified: avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java?rev=1349497&r1=1349496&r2=1349497&view=diff
==============================================================================
--- avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java (original)
+++ avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java Tue Jun
12 19:48:32 2012
@@ -51,7 +51,12 @@ public class HttpTransceiver extends Tra
   public String getRemoteName() { return this.url.toString(); }
     
   public synchronized List<ByteBuffer> readBuffers() throws IOException {
-    return readBuffers(connection.getInputStream());
+    InputStream in = connection.getInputStream();
+    try {
+      return readBuffers(in);
+    } finally {
+      in.close();
+    }
   }
 
   public synchronized void writeBuffers(List<ByteBuffer> buffers)
@@ -68,7 +73,13 @@ public class HttpTransceiver extends Tra
     connection.setDoOutput(true);
     connection.setReadTimeout(timeout);
     connection.setConnectTimeout(timeout);
-    writeBuffers(buffers, connection.getOutputStream());
+
+    OutputStream out = connection.getOutputStream();
+    try {
+      writeBuffers(buffers, out);
+    } finally {
+      out.close();
+    }
   }
 
   static int getLength(List<ByteBuffer> buffers) {



Mime
View raw message