Copilot commented on code in PR #692:
URL: https://github.com/apache/maven-surefire/pull/692#discussion_r4707864161
##########
surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java:
##########
@@ -171,6 +171,11 @@ public void startElement(String uri, String localName,
String qName, Attributes
testCase.setError(attributes.getValue("message"),
attributes.getValue("type"));
currentSuite.incrementNumberOfErrors();
break;
+ case "system-out":
+ case "system-err":
+ currentElement = new StringBuilder();
+ parseContent = true;
Review Comment:
Console output now goes through `characters()`, which discards
whitespace-only SAX chunks via `isNotBlank`. Consequently, output consisting
only of spaces/newlines becomes an empty string, and blank lines or indentation
delivered in separate callbacks disappear. Please preserve every character
chunk inside `system-out` and `system-err` so the captured logs do not depend
on how SAX splits the text.
##########
surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java:
##########
@@ -210,6 +215,12 @@ public void endElement(String uri, String localName,
String qName) throws SAXExc
testCase.setFailureDetail(currentElement.toString())
.setFailureErrorLine(parseErrorLine(currentElement,
testCase.getFullClassName()));
break;
+ case "system-out":
+ testCase.setSystemOut(currentElement.toString());
+ break;
+ case "system-err":
+ testCase.setSystemErr(currentElement.toString());
Review Comment:
These setters do not check the XML parent: suite-level logs overwrite the
last testcase's output (or dereference null if none exists), and logs inside
`rerunFailure`/`rerunError` overwrite the original attempt's output. Retry logs
then no longer match the stored failure details. Track element scope and
populate these fields only from direct children of an active `testcase`,
ignoring or separately storing suite and retry output.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]