You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by le...@apache.org on 2016/09/16 18:54:22 UTC

gora git commit: GORA-493 Unclosed DataInputBuffer in IOUtils#deserialize()

Repository: gora
Updated Branches:
  refs/heads/master bb1a1ac01 -> 854899e5d


GORA-493 Unclosed DataInputBuffer in IOUtils#deserialize()


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/854899e5
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/854899e5
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/854899e5

Branch: refs/heads/master
Commit: 854899e5db38fa14e7be56c1f850c35387d4df06
Parents: bb1a1ac
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Fri Sep 16 12:01:58 2016 -0700
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Fri Sep 16 12:01:58 2016 -0700

----------------------------------------------------------------------
 gora-core/src/main/java/org/apache/gora/util/IOUtils.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/854899e5/gora-core/src/main/java/org/apache/gora/util/IOUtils.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/util/IOUtils.java b/gora-core/src/main/java/org/apache/gora/util/IOUtils.java
index 1e81e8d..2dd2467 100644
--- a/gora-core/src/main/java/org/apache/gora/util/IOUtils.java
+++ b/gora-core/src/main/java/org/apache/gora/util/IOUtils.java
@@ -248,9 +248,10 @@ public class IOUtils {
    * @throws ClassNotFoundException */
   public static<T> T deserialize(Configuration conf, byte[] in
       , T obj) throws IOException, ClassNotFoundException {
-    DataInputBuffer buffer = new DataInputBuffer();
-    buffer.reset(in, in.length);
-    return deserialize(conf, buffer, obj);
+    try (DataInputBuffer buffer = new DataInputBuffer()) {
+      buffer.reset(in, in.length);
+      return deserialize(conf, buffer, obj);
+    }
   }
 
   /**