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 2015/07/07 21:17:22 UTC
maven-surefire git commit: [SUREFIRE] refactoring
Repository: maven-surefire
Updated Branches:
refs/heads/master 789252c9f -> e8f0de332
[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/e8f0de33
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/e8f0de33
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/e8f0de33
Branch: refs/heads/master
Commit: e8f0de332a82340205befb86a25f33c95f205d9e
Parents: 789252c
Author: Tibor17 <ti...@lycos.com>
Authored: Tue Jul 7 21:14:57 2015 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Tue Jul 7 21:14:57 2015 +0200
----------------------------------------------------------------------
.../surefire/report/PrettyPrintXMLWriter.java | 279 -------------------
.../plugin/surefire/report/ReportEntryType.java | 2 +-
2 files changed, 1 insertion(+), 280 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e8f0de33/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
deleted file mode 100644
index 551b54e..0000000
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package org.apache.maven.plugin.surefire.report;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.PrintWriter;
-import java.util.LinkedList;
-
-import org.apache.maven.shared.utils.xml.XMLWriter;
-
-/**
- * A pretty printing XML writer
- *
- */
-public class PrettyPrintXMLWriter
- implements XMLWriter
-{
- private final PrintWriter writer;
-
- private final LinkedList<String> elementStack = new LinkedList<String>();
-
- private boolean tagInProgress;
-
- private int depth;
-
- private final String lineIndenter;
-
- private final String encoding;
-
- private final String docType;
-
- private boolean readyForNewLine;
-
- private boolean tagIsEmpty;
-
- public PrettyPrintXMLWriter( PrintWriter writer )
- {
- this( writer, null, null );
- }
-
- private PrettyPrintXMLWriter( PrintWriter writer, String lineIndenter, String encoding, String doctype )
- {
- this.writer = writer;
-
- this.lineIndenter = lineIndenter;
-
- this.encoding = encoding;
-
- this.docType = doctype;
-
- if ( docType != null || encoding != null )
- {
- writeDocumentHeaders();
- }
- }
-
- public void setEncoding( String encoding )
- {
- throw new RuntimeException( "Not Implemented" );
- }
-
- public void setDocType( String docType )
- {
- throw new RuntimeException( "Not Implemented" );
- }
-
- private PrettyPrintXMLWriter( PrintWriter writer, String encoding, String doctype )
- {
- this( writer, " ", encoding, doctype );
- }
-
- public void startElement( String name )
- {
- tagIsEmpty = false;
-
- finishTag();
-
- write( "<" );
-
- write( name );
-
- elementStack.addLast( name );
-
- tagInProgress = true;
-
- depth++;
-
- readyForNewLine = true;
-
- tagIsEmpty = true;
- }
-
- public void writeText( String text )
- {
- writeText( text, true );
- }
-
- public void writeMarkup( String text )
- {
- writeText( text, false );
- }
-
- private void writeText( String text, boolean escapeXml )
- {
- readyForNewLine = false;
-
- tagIsEmpty = false;
-
- finishTag();
-
- if ( escapeXml )
- {
- text = escapeXml( text );
- }
-
- write( text );
- }
-
- private static String escapeXml( String text )
- {
- StringBuffer sb = new StringBuffer( text.length() * 2 );
- for ( int i = 0; i < text.length(); i++ )
- {
- char c = text.charAt( i );
- if ( c < 32 )
- {
- if ( c == '\n' || c == '\r' || c == '\t' )
- {
- sb.append( c );
- }
- else
- {
- // uh-oh! This character is illegal in XML 1.0!
- // http://www.w3.org/TR/1998/REC-xml-19980210#charsets
- // we're going to deliberately doubly-XML escape it...
- // there's nothing better we can do! :-(
- // SUREFIRE-456
- sb.append( "&#" ).append( (int) c ).append( ';' );
- }
- }
- else if ( c == '<' )
- {
- sb.append( "<" );
- }
- else if ( c == '>' )
- {
- sb.append( ">" );
- }
- else if ( c == '&' )
- {
- sb.append( "&" );
- }
- else if ( c == '"' )
- {
- sb.append( """ );
- }
- else if ( c == '\'' )
- {
- sb.append( "'" );
- }
- else
- {
- sb.append( c );
- }
- }
- return sb.toString();
- }
-
- public void addAttribute( String key, String value )
- {
- write( " " );
-
- write( key );
-
- write( "=\"" );
-
- write( escapeXml( value ) );
-
- write( "\"" );
- }
-
- public void endElement()
- {
- depth--;
-
- if ( tagIsEmpty )
- {
- write( "/" );
-
- readyForNewLine = false;
-
- finishTag();
-
- elementStack.removeLast();
- }
- else
- {
- finishTag();
-
- write( "</" + elementStack.removeLast() + ">" );
- }
-
- readyForNewLine = true;
- }
-
- private void write( String str )
- {
- writer.write( str );
- }
-
- private void finishTag()
- {
- if ( tagInProgress )
- {
- write( ">" );
- }
-
- tagInProgress = false;
-
- if ( readyForNewLine )
- {
- endOfLine();
- }
- readyForNewLine = false;
-
- tagIsEmpty = false;
- }
-
- protected void endOfLine()
- {
- write( "\n" );
-
- for ( int i = 0; i < depth; i++ )
- {
- write( lineIndenter );
- }
- }
-
- private void writeDocumentHeaders()
- {
- write( "<?xml version=\"1.0\"" );
-
- if ( encoding != null )
- {
- write( " encoding=\"" + encoding + "\"" );
- }
-
- write( "?>" );
-
- endOfLine();
-
- if ( docType != null )
- {
- write( "<!DOCTYPE " );
-
- write( docType );
-
- write( ">" );
-
- endOfLine();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e8f0de33/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
index 863672a..ffdb706 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
@@ -37,7 +37,7 @@ public enum ReportEntryType
private final String rerunXmlTag;
- private ReportEntryType( String xmlTag, String flakyXmlTag, String rerunXmlTag )
+ ReportEntryType( String xmlTag, String flakyXmlTag, String rerunXmlTag )
{
this.xmlTag = xmlTag;
this.flakyXmlTag = flakyXmlTag;