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:
parent
3874bc7f09
commit
67160a89f8
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue