kush2439p commented on code in PR #3408:
URL: https://github.com/apache/maven-surefire/pull/3408#discussion_r3775880825
##########
maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java:
##########
@@ -276,6 +276,90 @@ public void testAllFieldsSerialized() throws IOException {
tcb.getChild("system-err").getValue());
}
+ @Test
+ public void testInvalidXml10CharactersAreEscaped() throws Exception {
+ String supplementaryCharacter = new String(Character.toChars(0x1F600));
+ StackTraceWriter stackTraceWriter = new DeserializedStacktraceWriter(
+ "failure\uFFFF",
+ "trimmed " + supplementaryCharacter,
+ "stack trace\uFFFE\uFFFF " + supplementaryCharacter);
+
+ Utf8RecodingDeferredFileOutputStream stdOut = new
Utf8RecodingDeferredFileOutputStream("fds");
+ StringBuilder stdout = new
StringBuilder(Utf8RecodingDeferredFileOutputStream.CACHE_SIZE + 16);
+ for (int i = 0; i < Utf8RecodingDeferredFileOutputStream.CACHE_SIZE -
1; i++) {
+ stdout.append('a');
+ }
+ stdout.append('\uFFFF').append(" ]]> ");
+ stdOut.write(stdout.toString(), false, null);
Review Comment:
Addressed in f270ce775. Added a raw-byte regression test covering an invalid
leading byte, an invalid continuation across writes, a valid four-byte sequence
split across writes, and an incomplete sequence flushed by finish(). The test
parses the resulting XML and asserts the exact U+FFFD replacements. Local
verification: StatelessXmlReporterTest — 14 tests, 0 failures/errors/skips;
Checkstyle, Spotless, RAT, enforcer, compilation, and the prerequisite reactor
install also passed.
--
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]