maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject maven-surefire git commit: [SUREFIRE-1084] Surefire-report stack traces appear on a single line.
Date Tue, 09 Jun 2015 23:26:44 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master 27d476150 -> 8a2cd06aa


[SUREFIRE-1084] Surefire-report stack traces appear on a single line.


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/8a2cd06a
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/8a2cd06a
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/8a2cd06a

Branch: refs/heads/master
Commit: 8a2cd06aae749ed63d62541842b58f8983c71a0b
Parents: 27d4761
Author: Tibor17 <tibor17@lycos.com>
Authored: Wed Jun 10 01:25:09 2015 +0200
Committer: Tibor17 <tibor17@lycos.com>
Committed: Wed Jun 10 01:25:09 2015 +0200

----------------------------------------------------------------------
 .../report/SurefireReportGenerator.java         |  2 +-
 .../surefire/report/TestSuiteXmlParser.java     | 47 +++++++++-----------
 2 files changed, 23 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8a2cd06a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
index 8df26fa..0fbed99 100644
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
@@ -532,7 +532,7 @@ public class SurefireReportGenerator
                 sink.verbatim( null );
                 for ( String line : detail )
                 {
-                    sink.text( line );
+                    sink.text( line + "\n" );
                     sink.lineBreak();
                 }
                 sink.verbatim_();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8a2cd06a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
index 7723245..8b6a549 100644
--- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
+++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
@@ -19,10 +19,12 @@ package org.apache.maven.plugins.surefire.report;
  * under the License.
  */
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.StringReader;
 import java.text.NumberFormat;
 import java.text.ParseException;
 import java.util.ArrayList;
@@ -30,12 +32,12 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.StringTokenizer;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.apache.maven.shared.utils.StringUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -278,41 +280,36 @@ public class TestSuiteXmlParser
     public void characters( char[] ch, int start, int length )
         throws SAXException
     {
-        if ( !valid )
+        if ( valid )
         {
-            return;
-        }
-        String s = new String( ch, start, length );
+            final String s = new String( ch, start, length );
 
-        if ( !"".equals( s.trim() ) )
-        {
-            currentElement.append( s );
+            if ( StringUtils.isNotBlank( s ) )
+            {
+                currentElement.append( s );
+            }
         }
     }
 
+    @SuppressWarnings( "checkstyle:innerassignment" )
     private List<String> parseCause( String detail )
+        throws SAXException
     {
-        String fullName = testCase.getFullName();
-        String name = fullName.substring( fullName.lastIndexOf( "." ) + 1 );
-        return parseCause( detail, name );
-    }
-
-    private List<String> parseCause( String detail, String compareTo )
-    {
-        StringTokenizer stringTokenizer = new StringTokenizer( detail, "\n" );
-        List<String> parsedDetail = new ArrayList<String>( stringTokenizer.countTokens()
);
-
-        while ( stringTokenizer.hasMoreTokens() )
+        List<String> parsedDetail = new ArrayList<String>();
+        try
         {
-            String lineString = stringTokenizer.nextToken().trim();
-            parsedDetail.add( lineString );
-            if ( lineString.contains( compareTo ) )
+            BufferedReader lines = new BufferedReader( new StringReader( detail ) );
+            for ( String line; ( line = lines.readLine() ) != null; )
             {
-                break;
+                parsedDetail.add( line );
             }
-        }
 
-        return parsedDetail;
+            return parsedDetail;
+        }
+        catch ( IOException e )
+        {
+            throw new SAXException( e );
+        }
     }
 
     public boolean isValid()


Mime
View raw message