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");
}
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();
}
}
/**