[ 
https://jira.codehaus.org/browse/SUREFIRE-996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=328792#comment-328792
 ] 

Todor Todorov commented on SUREFIRE-996:
----------------------------------------

Since this issue has already been closed, I am not sure what to do?! Should I 
open another issue like "Wrong XML illegal characters escape in <system-out> 
and <system-err> content", or there is a way to reopen it. The patch I 
submitted is based on the last development version. Please let me know if you 
need patch based on version 2.15.
                
> <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
>            Assignee: Kristian Rosenvold
>            Priority: Blocker
>             Fix For: 2.15
>
>         Attachments: 0001-added-test-case-for-SUREFIRE-996.patch, 
> extended-test-case-for-SUREFIRE-996.patch
>
>
> 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 <krosenv...@apache.org>
> 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

Reply via email to