azotcsit commented on a change in pull request #175:
URL: https://github.com/apache/ant/pull/175#discussion_r789921289



##########
File path: 
src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java
##########
@@ -298,8 +298,9 @@ private void writeFailed(final XMLStreamWriter writer, 
final TestIdentifier test
                     writeAttribute(writer, ATTR_MESSAGE, message);
                 }
                 writeAttribute(writer, ATTR_TYPE, t.getClass().getName());
-                // write out the stacktrace
-                writer.writeCData(StringUtils.getStackTrace(t));
+                // write out the stacktrace, replacing any CDATA endings by 
splitting them into multiple CDATA segments
+                // See https://bz.apache.org/bugzilla/show_bug.cgi?id=65833
+                
writer.writeCData(StringUtils.getStackTrace(t).replaceAll("]]>", 
"]]]]><![CDATA[>"));

Review comment:
       Currently there is `encode` method which seems to be intended for 
handling special character. So this logic probably would fit there better. 
   
   PS:
   I'm not a project maintainer and `ant` expert, just sharing my ideas since 
I've been recently exploring this code.




-- 
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: dev-unsubscr...@ant.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to