< 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,82 ****
@Override
public void accept(OutputAnalyzer outputAnalyzer) {
if (loggedMethods.isEmpty()) {
return;
}
! matchTasks(getScanner());
}
/*
* Gets scanner for log file of the test case
*/
--- 72,82 ----
@Override
public void accept(OutputAnalyzer outputAnalyzer) {
if (loggedMethods.isEmpty()) {
return;
}
! matchTasks();
}
/*
* Gets scanner for log file of the test case
*/
*** 93,103 ****
/*
* 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) {
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)) {
--- 93,104 ----
/*
* Parses for <task method='java.lang.String indexOf (I)I' >
* and finds if there is a compilation log for this task
*/
! 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,117 ****
--- 109,119 ----
+ "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 >