Skip to content

Commit c05241d

Browse files
Nargeshdbanoopsjohn
authored andcommitted
HBASE-25626 Possible Resource Leak in HeterogeneousRegionCountCostFunction
Signed-off-by Anoop Sam John <[email protected]> Signed-off-by shahrs87 <[email protected]>
1 parent b05cc42 commit c05241d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,14 @@ private List<String> readFileFromLocalFS(final String filename) throws IOExcepti
221221

222222
private List<String> readLines(BufferedReader reader) throws IOException {
223223
final List<String> records = new ArrayList<>();
224-
String line;
225-
while ((line = reader.readLine()) != null) {
226-
records.add(line);
224+
try {
225+
String line;
226+
while ((line = reader.readLine()) != null) {
227+
records.add(line);
228+
}
229+
} finally {
230+
reader.close();
227231
}
228-
reader.close();
229232
return records;
230233
}
231234

0 commit comments

Comments
 (0)