Author: medined
Date: Thu Aug 23 03:25:22 2012
New Revision: 1376356

URL: http://svn.apache.org/viewvc?rev=1376356&view=rev
Log:
ACCUMULO-737: The PrintInfo.printMetaBlockInfo method does not close a 
BCFile.Reader

Modified:
    
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java

Modified: 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java?rev=1376356&r1=1376355&r2=1376356&view=diff
==============================================================================
--- 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
 (original)
+++ 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/PrintInfo.java
 Thu Aug 23 03:25:22 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.core.file.rfile.bcfile;
 
+import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -29,9 +30,11 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
 public class PrintInfo {
-  public static void printMetaBlockInfo(Configuration conf, FileSystem fs, 
Path path) throws Exception {
+  public static void printMetaBlockInfo(Configuration conf, FileSystem fs, 
Path path) throws IOException {
     FSDataInputStream fsin = fs.open(path);
-    BCFile.Reader bcfr = new BCFile.Reader(fsin, 
fs.getFileStatus(path).getLen(), conf);
+    BCFile.Reader bcfr = null;
+    try {
+    bcfr = new BCFile.Reader(fsin, fs.getFileStatus(path).getLen(), conf);
     
     Set<Entry<String,MetaIndexEntry>> es = bcfr.metaIndex.index.entrySet();
     
@@ -43,6 +46,11 @@ public class PrintInfo {
       out.println("      Compression type     : " + 
entry.getValue().getCompressionAlgorithm().getName());
       out.println();
     }
+    } finally {
+       if (bcfr != null) {
+               bcfr.close();
+       }
+    }
   }
   
   public static void main(String[] args) throws Exception {


Reply via email to