Skip to content

Commit

Permalink
issue #77 - finish cleanup tasks (#79)
Browse files Browse the repository at this point in the history
-- fixed indent issues with CalculatorDocLitTest searchForValue
-- fixed searchForValue to use try-with-resource notation

Signed-off-by: Brian Fitzpatrick <[email protected]>
  • Loading branch information
bfitzpat authored Sep 25, 2019
1 parent d395233 commit 08d43de
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,16 @@ public void testCalculatorNoServiceInWSDLAndJAXWSOverride() throws Exception {
}

private boolean searchForValue(String value, Path filePath) throws Exception {
Scanner kb = new Scanner(value);
try {
String name = kb.nextLine();

List<String> lines = Files.readAllLines(filePath);
for (String line : lines) {
if (line.contains(name)) {
return true;
}
}
} finally {
kb.close();
}
return false;
}
try (Scanner kb = new Scanner(value)) {
String name = kb.nextLine();

List<String> lines = Files.readAllLines(filePath);
for (String line : lines) {
if (line.contains(name)) {
return true;
}
}
}
return false;
}
}

0 comments on commit 08d43de

Please sign in to comment.