hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1545875 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java
Date Tue, 26 Nov 2013 22:33:54 GMT
Author: eclark
Date: Tue Nov 26 22:33:53 2013
New Revision: 1545875

URL: http://svn.apache.org/r1545875
Log:
HBASE-10038 Fix potential Resource Leak in ZNodeCleaner

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java?rev=1545875&r1=1545874&r2=1545875&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java Tue Nov
26 22:33:53 2013
@@ -94,10 +94,14 @@ public class ZNodeClearer {
       throw new FileNotFoundException("No filename; set environment variable HBASE_ZNODE_FILE");
     }
     FileReader znodeFile = new FileReader(fileName);
-    BufferedReader br = new BufferedReader(znodeFile);
-    String file_content = br.readLine();
-    br.close();
-    return file_content;
+    BufferedReader br = null;
+    try {
+      br = new BufferedReader(znodeFile);
+      String file_content = br.readLine();
+      return file_content;
+    } finally {
+      if (br != null) br.close();
+    }
   }
 
   /**



Mime
View raw message