Skip to content

Commit

Permalink
use try-with-resources in KyuubiCommands
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 committed Aug 1, 2023
1 parent a54a97f commit 2497069
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ private boolean sourceFile(String cmd) {
}

private boolean sourceFileInternal(File sourceFile) throws IOException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(sourceFile));
String lines = null, extra;
try (BufferedReader reader = new BufferedReader(new FileReader(sourceFile))) {
String lines = null;
String extra;
while ((extra = reader.readLine()) != null) {
if (beeLine.isComment(extra)) {
continue;
Expand All @@ -107,10 +106,6 @@ private boolean sourceFileInternal(File sourceFile) throws IOException {
return false;
}
}
} finally {
if (reader != null) {
reader.close();
}
}
return true;
}
Expand Down

0 comments on commit 2497069

Please sign in to comment.