Skip to content

Commit 2076a8c

Browse files
committed
Fixed non-deterministic behavior in testFlushAtEndOfBatch() test
1 parent fe72f3a commit 2076a8c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ public void testFlushAtEndOfBatch() throws Exception {
8282
try (final BufferedReader reader = new BufferedReader(new FileReader(logFile))) {
8383
line1 = reader.readLine();
8484
line2 = reader.readLine();
85-
reader.readLine(); // ignore the empty line after the <Events> root
86-
line3 = reader.readLine();
85+
86+
String tmp;
87+
do {
88+
tmp = reader.readLine(); // ignore the empty lines after the <Events> root
89+
} while (tmp != null && tmp.trim().isEmpty());
90+
91+
line3 = tmp;
8792
line4 = reader.readLine();
8893
line5 = reader.readLine();
8994
} finally {

0 commit comments

Comments
 (0)