Julien Vermillard created SUREFIRE-996:
------------------------------------------
Summary: <system-out> and <system-err> content of junit xml report
are not escaped
Key: SUREFIRE-996
URL: https://jira.codehaus.org/browse/SUREFIRE-996
Project: Maven Surefire
Issue Type: Bug
Components: Junit 4.7+ (parallel) support
Affects Versions: 2.15
Environment: maven 3.0.4
surefire 2.15-SNAPSHOT (from apache snashot repo)
Reporter: Julien Vermillard
Priority: Blocker
Some of my junit xml report are not correctly generated :
{code}
<system-out>15:24:59.565 [pool-1-thread-5] INFO
c.s.a.i.c.s.api.PartnerServicesUtils - Profile <null>
</system-out>
{code}
The < and > in "<null>" are not escaped.
If I look at
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
code, I think the bug is here :
{code}
addOutputStreamElement( outputStreamWriter, fw, eos, ppw,
report.getStdout(), "system-out" );
addOutputStreamElement( outputStreamWriter, fw, eos, ppw,
report.getStdErr(), "system-err" );
ppw.endElement(); // test element
}
private void addOutputStreamElement( OutputStreamWriter outputStreamWriter,
OutputStream fw, EncodingOutputStream eos, XMLWriter xmlWriter,
DeferredFileOutputStream stdOut,
String name )
{
if ( stdOut != null && stdOut.getByteCount() > 0 )
{
xmlWriter.startElement( name );
try
{
xmlWriter.writeText( "" ); // Cheat sax to emit element
outputStreamWriter.flush();
stdOut.close();
stdOut.writeTo( eos );
eos.flush();
}
catch ( IOException e )
{
throw new ReporterException( "When writing xml report
stdout/stderr", e );
}
xmlWriter.endElement();
}
}
{code}
and probably introduced by this commit :
commit 33e110fc46aa43d10b38a93b3db74c09be6bc6d5
Author: Kristian Rosenvold <[email protected]>
Date: Thu May 2 20:53:27 2013 +0200
[SUREFIRE-938] Removed memory binding for stdout/stderr capture.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira