You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2016/10/02 09:13:17 UTC
[3/4] maven-surefire git commit: [SUREFIRE] refactoring
[SUREFIRE] refactoring
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/e563566b
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/e563566b
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/e563566b
Branch: refs/heads/master
Commit: e563566b4d3713cc1277771c31a86defbeb7ddbe
Parents: 4f3f59e
Author: Tibor17 <ti...@lycos.com>
Authored: Sun Oct 2 11:08:09 2016 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sun Oct 2 11:12:38 2016 +0200
----------------------------------------------------------------------
.../surefire/report/StatelessXmlReporter.java | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e563566b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index f30e54f..8ebeb96 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -45,7 +45,7 @@ import java.util.StringTokenizer;
import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType;
import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
-import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
+import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
// CHECKSTYLE_OFF: LineLength
/**
@@ -321,9 +321,8 @@ public class StatelessXmlReporter
private static File getReportFile( ReportEntry report, File reportsDirectory, String reportNameSuffix )
{
String reportName = "TEST-" + report.getName();
- String reportFileName =
- isNotBlank( reportNameSuffix ) ? reportName + "-" + reportNameSuffix + ".xml" : reportName + ".xml";
- return new File( reportsDirectory, stripIllegalFilenameChars( reportFileName ) );
+ String customizedReportName = isBlank( reportNameSuffix ) ? reportName : reportName + "-" + reportNameSuffix;
+ return new File( reportsDirectory, stripIllegalFilenameChars( customizedReportName + ".xml" ) );
}
private static void startTestElement( XMLWriter ppw, WrappedReportEntry report, String reportNameSuffix,
@@ -490,7 +489,6 @@ public class StatelessXmlReporter
xmlWriter.addAttribute( "value", extraEscape( value, true ) );
xmlWriter.endElement();
-
}
}
xmlWriter.endElement();
@@ -506,14 +504,10 @@ public class StatelessXmlReporter
private static String extraEscape( String message, boolean attribute )
{
// Someday convert to xml 1.1 which handles everything but 0 inside string
- if ( !containsEscapesIllegalnXml10( message ) )
- {
- return message;
- }
- return escapeXml( message, attribute );
+ return containsEscapesIllegalXml10( message ) ? escapeXml( message, attribute ) : message;
}
- private static class EncodingOutputStream
+ private static final class EncodingOutputStream
extends FilterOutputStream
{
private int c1;
@@ -563,7 +557,7 @@ public class StatelessXmlReporter
}
}
- private static boolean containsEscapesIllegalnXml10( String message )
+ private static boolean containsEscapesIllegalXml10( String message )
{
int size = message.length();
for ( int i = 0; i < size; i++ )
@@ -611,7 +605,7 @@ public class StatelessXmlReporter
return sb.toString();
}
- private static class ByteConstantsHolder
+ private static final class ByteConstantsHolder
{
private static final byte[] CDATA_START_BYTES;