HBASE-10038 Fix potential Resource Leak in ZNodeCleaner

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
eclark 2013-11-26 22:33:53 +00:00
parent 3874bc7f09
commit 67160a89f8
1 changed files with 8 additions and 4 deletions

View File

@ -94,10 +94,14 @@ public class ZNodeClearer {
throw new FileNotFoundException("No filename; set environment variable HBASE_ZNODE_FILE"); throw new FileNotFoundException("No filename; set environment variable HBASE_ZNODE_FILE");
} }
FileReader znodeFile = new FileReader(fileName); FileReader znodeFile = new FileReader(fileName);
BufferedReader br = new BufferedReader(znodeFile); BufferedReader br = null;
String file_content = br.readLine(); try {
br.close(); br = new BufferedReader(znodeFile);
return file_content; String file_content = br.readLine();
return file_content;
} finally {
if (br != null) br.close();
}
} }
/** /**