< prev index next >
test/compiler/compilercontrol/share/processors/LogProcessor.java
Print this page
rev 11926 : 8166164: compiler/compilercontrol/share/processors/LogProcessor.java does not close Scanner
Reviewed-by: duke
@@ -72,11 +72,11 @@
@Override
public void accept(OutputAnalyzer outputAnalyzer) {
if (loggedMethods.isEmpty()) {
return;
}
- matchTasks(getScanner());
+ matchTasks();
}
/*
* Gets scanner for log file of the test case
*/
@@ -93,11 +93,12 @@
/*
* Parses for <task method='java.lang.String indexOf (I)I' >
* and finds if there is a compilation log for this task
*/
- private void matchTasks(Scanner scanner) {
+ private void matchTasks() {
+ try (Scanner scanner = getScanner()) {
String task = scanner.findWithinHorizon(TASK_ELEMENT, 0);
while (task != null) {
String element = scanner.findWithinHorizon(ANY_ELEMENT, 0);
if (Pattern.matches(TASK_DONE_ELEMENT, element)
|| Pattern.matches(TASK_END_ELEMENT, element)) {
@@ -108,10 +109,11 @@
+ "expected. Met: " + element);
}
task = scanner.findWithinHorizon(TASK_ELEMENT, 0);
}
}
+ }
// Check that input method should be logged
private boolean matchMethod(String input) {
Matcher matcher = METHOD_PATTERN.matcher(input);
Asserts.assertTrue(matcher.find(), "Wrong matcher or input");
< prev index next >