Browse Source

Replace all different occurences of grabbing line separator with StringUtil.LINE_SEPARATOR

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270475 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
bc9dc4239a
30 changed files with 131 additions and 186 deletions
  1. +2
    -6
      proposal/myrmidon/src/java/org/apache/antlib/cvslib/CVSPass.java
  2. +3
    -4
      proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/Environment.java
  3. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  4. +0
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java
  5. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java
  6. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  7. +4
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  8. +4
    -5
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  9. +7
    -9
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java
  10. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  11. +3
    -14
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  12. +7
    -13
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java
  13. +9
    -9
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
  14. +8
    -11
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
  15. +6
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
  16. +3
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/util/DOMElementWriter.java
  17. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/AntStructure.java
  18. +0
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java
  19. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java
  20. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  21. +4
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  22. +4
    -5
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java
  23. +7
    -9
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ManifestFile.java
  24. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  25. +3
    -14
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  26. +7
    -13
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java
  27. +9
    -9
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
  28. +8
    -11
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
  29. +6
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
  30. +3
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/util/DOMElementWriter.java

+ 2
- 6
proposal/myrmidon/src/java/org/apache/antlib/cvslib/CVSPass.java View File

@@ -15,6 +15,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* CVSLogin Adds an new entry to a CVS password file * CVSLogin Adds an new entry to a CVS password file
@@ -25,11 +26,6 @@ import org.apache.myrmidon.api.TaskException;
public class CVSPass public class CVSPass
extends AbstractTask extends AbstractTask
{ {
/**
* End of line character
*/
private static final String EOL = System.getProperty( "line.separator" );

/** /**
* CVS Root * CVS Root
*/ */
@@ -141,7 +137,7 @@ public class CVSPass
{ {
if( !line.startsWith( m_cvsRoot ) ) if( !line.startsWith( m_cvsRoot ) )
{ {
sb.append( line + EOL );
sb.append( line + StringUtil.LINE_SEPARATOR );
} }
} }




+ 3
- 4
proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/Environment.java View File

@@ -18,6 +18,7 @@ import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Os; import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* This is the class that can be used to retrieve the environment * This is the class that can be used to retrieve the environment
@@ -29,8 +30,6 @@ import org.apache.tools.ant.taskdefs.exec.Execute;
*/ */
public final class Environment public final class Environment
{ {
private static final String LINE_SEP = System.getProperty( "line.separator" );

private static final String[] COMMAND_COM = new String[]{"command.com", "/c", "set"}; private static final String[] COMMAND_COM = new String[]{"command.com", "/c", "set"};
private static final String[] CMD_EXE = new String[]{"cmd", "/c", "set"}; private static final String[] CMD_EXE = new String[]{"cmd", "/c", "set"};


@@ -134,11 +133,11 @@ public final class Environment
// contain embedded new lines). // contain embedded new lines).
if( var == null ) if( var == null )
{ {
var = LINE_SEP + line;
var = StringUtil.LINE_SEPARATOR + line;
} }
else else
{ {
var += LINE_SEP + line;
var += StringUtil.LINE_SEPARATOR + line;
} }
} }
else else


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java View File

@@ -18,6 +18,7 @@ import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Creates a partial DTD for Ant from the currently known tasks. * Creates a partial DTD for Ant from the currently known tasks.
@@ -26,10 +27,9 @@ import org.apache.tools.ant.Task;
* @version $Revision$ * @version $Revision$
*/ */


public class AntStructure extends Task
public class AntStructure
extends Task
{ {
private final String lSep = System.getProperty( "line.separator" );

private final String BOOLEAN = "%boolean;"; private final String BOOLEAN = "%boolean;";
private final String TASKS = "%tasks;"; private final String TASKS = "%tasks;";
private final String TYPES = "%types;"; private final String TYPES = "%types;";


+ 0
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java View File

@@ -172,7 +172,6 @@ public class Available


if( eval() ) if( eval() )
{ {
String lSep = System.getProperty( "line.separator" );
if( null == getProject().getProperty( m_property ) ) if( null == getProject().getProperty( m_property ) )
{ {
setProperty( m_property, m_value ); setProperty( m_property, m_value );


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Replaces all occurrences of one or more string tokens with given values in * Replaces all occurrences of one or more string tokens with given values in
@@ -344,9 +345,8 @@ public class Replace extends MatchingTask
// line separators in values and tokens are "\n" // line separators in values and tokens are "\n"
// in order to compare with the file contents, replace them // in order to compare with the file contents, replace them
// as needed // as needed
String linesep = System.getProperty( "line.separator" );
String val = stringReplace( value.getText(), "\n", linesep );
String tok = stringReplace( token.getText(), "\n", linesep );
final String val = stringReplace( value.getText(), "\n", StringUtil.LINE_SEPARATOR );
final String tok = stringReplace( token.getText(), "\n", StringUtil.LINE_SEPARATOR );


// for each found token, replace with value // for each found token, replace with value
getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() ); getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() );


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -12,6 +12,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
@@ -34,7 +35,6 @@ public abstract class DefaultCompilerAdapter
extends AbstractLogEnabled extends AbstractLogEnabled
implements CompilerAdapter implements CompilerAdapter
{ {
protected static String LINE_SEP = System.getProperty( "line.separator" );
protected boolean m_debug; protected boolean m_debug;
protected boolean m_optimize; protected boolean m_optimize;
protected boolean m_deprecation; protected boolean m_deprecation;
@@ -429,13 +429,13 @@ public abstract class DefaultCompilerAdapter
} }
niceSourceList.append( " to be compiled:" ); niceSourceList.append( " to be compiled:" );


niceSourceList.append( LINE_SEP );
niceSourceList.append( StringUtil.LINE_SEPARATOR );


for( int i = 0; i < m_compileList.length; i++ ) for( int i = 0; i < m_compileList.length; i++ )
{ {
String arg = m_compileList[ i ].getAbsolutePath(); String arg = m_compileList[ i ].getAbsolutePath();
cmd.createArgument().setValue( arg ); cmd.createArgument().setValue( arg );
niceSourceList.append( " " + arg + LINE_SEP );
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR );
} }


getLogger().debug( niceSourceList.toString() ); getLogger().debug( niceSourceList.toString() );


+ 4
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java View File

@@ -23,6 +23,7 @@ import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnvironmentData; import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.EnvironmentVariable; import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Executes a given command if the os platform is appropriate. * Executes a given command if the os platform is appropriate.
@@ -33,10 +34,9 @@ import org.apache.tools.ant.types.EnvironmentVariable;
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
* @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a> * @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a>
*/ */
public class ExecTask extends Task
public class ExecTask
extends Task
{ {
private static String LINE_SEP = System.getProperty( "line.separator" );

private boolean m_newEnvironment; private boolean m_newEnvironment;
private Integer m_timeout; private Integer m_timeout;
private EnvironmentData m_env = new EnvironmentData(); private EnvironmentData m_env = new EnvironmentData();
@@ -241,7 +241,7 @@ public class ExecTask extends Task
{ {
if( val.length() != 0 ) if( val.length() != 0 )
{ {
val.append( LINE_SEP );
val.append( StringUtil.LINE_SEPARATOR );
} }
val.append( line ); val.append( line );
} }


+ 4
- 5
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -18,6 +18,7 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Task to generate JNI header files using javah. This task can take the * Task to generate JNI header files using javah. This task can take the
@@ -57,8 +58,6 @@ public class Javah extends Task
{ {


private final static String FAIL_MSG = "Compile failed, messages should have been provided."; private final static String FAIL_MSG = "Compile failed, messages should have been provided.";
//private Path extdirs;
private static String lSep = System.getProperty( "line.separator" );


private ArrayList classes = new ArrayList( 2 ); private ArrayList classes = new ArrayList( 2 );
private Path classpath = null; private Path classpath = null;
@@ -300,7 +299,7 @@ public class Javah extends Task
{ {
String aClass = tok.nextToken().trim(); String aClass = tok.nextToken().trim();
cmd.createArgument().setValue( aClass ); cmd.createArgument().setValue( aClass );
niceClassList.append( " " + aClass + lSep );
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR );
n++; n++;
} }
} }
@@ -311,7 +310,7 @@ public class Javah extends Task
ClassArgument arg = (ClassArgument)enum.next(); ClassArgument arg = (ClassArgument)enum.next();
String aClass = arg.getName(); String aClass = arg.getName();
cmd.createArgument().setValue( aClass ); cmd.createArgument().setValue( aClass );
niceClassList.append( " " + aClass + lSep );
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR );
n++; n++;
} }


@@ -321,7 +320,7 @@ public class Javah extends Task
prefix.append( "es" ); prefix.append( "es" );
} }
prefix.append( " to be compiled:" ); prefix.append( " to be compiled:" );
prefix.append( lSep );
prefix.append( StringUtil.LINE_SEPARATOR );


getLogger().debug( prefix.toString() + niceClassList.toString() ); getLogger().debug( prefix.toString() + niceClassList.toString() );
} }


+ 7
- 9
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java View File

@@ -17,6 +17,7 @@ import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;


@@ -29,12 +30,9 @@ import org.apache.tools.ant.Task;
* </manifest> </target> </pre> * </manifest> </target> </pre>
* *
* @author Thomas Kerle * @author Thomas Kerle
* @version 1.0 2001-10-11
*/ */
public class ManifestFile extends Task public class ManifestFile extends Task
{ {

private final static String newLine = System.getProperty( "line.separator" );
private final static String keyValueSeparator = ":"; private final static String keyValueSeparator = ":";
private final static String UPDATE_ = "update"; private final static String UPDATE_ = "update";
private final static String REPLACEALL_ = "replaceAll"; private final static String REPLACEALL_ = "replaceAll";
@@ -101,7 +99,7 @@ public class ManifestFile extends Task
private StringTokenizer getLineTokens( StringBuffer buffer ) private StringTokenizer getLineTokens( StringBuffer buffer )
{ {
String manifests = buffer.toString(); String manifests = buffer.toString();
StringTokenizer strTokens = new StringTokenizer( manifests, newLine );
StringTokenizer strTokens = new StringTokenizer( manifests, StringUtil.LINE_SEPARATOR );
return strTokens; return strTokens;
} }


@@ -137,7 +135,7 @@ public class ManifestFile extends Task
String value = (String)entry.getValue(); String value = (String)entry.getValue();
String entry_string = key + keyValueSeparator + value; String entry_string = key + keyValueSeparator + value;


buffer.append( entry_string + this.newLine );
buffer.append( entry_string + StringUtil.LINE_SEPARATOR );
} }


return buffer; return buffer;
@@ -208,9 +206,9 @@ public class ManifestFile extends Task
} }
fis.close(); fis.close();
StringTokenizer lineTokens = getLineTokens( buffer ); StringTokenizer lineTokens = getLineTokens( buffer );
while( lineTokens.hasNext() )
while( lineTokens.hasMoreElements() )
{ {
String currentLine = (String)lineTokens.next();
String currentLine = (String)lineTokens.nextElement();
addLine( currentLine ); addLine( currentLine );
} }
} }
@@ -351,8 +349,8 @@ public class ManifestFile extends Task
private void split() private void split()
{ {
StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator ); StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator );
key = (String)st.next();
val = (String)st.next();
key = (String)st.nextElement();
val = (String)st.nextElement();
} }


} }


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java View File

@@ -18,6 +18,7 @@ import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import netrexx.lang.Rexx; import netrexx.lang.Rexx;
import org.apache.avalon.excalibur.io.FileUtil; import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -675,14 +676,13 @@ public class NetRexxC extends MatchingTask
} }
getLogger().debug( compileOptions.toString() ); getLogger().debug( compileOptions.toString() );


String eol = System.getProperty( "line.separator" );
StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + eol );
StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + StringUtil.LINE_SEPARATOR );


for( int i = 0; i < compileList.size(); i++ ) for( int i = 0; i < compileList.size(); i++ )
{ {
niceSourceList.append( " " ); niceSourceList.append( " " );
niceSourceList.append( compileList.get( i ).toString() ); niceSourceList.append( compileList.get( i ).toString() );
niceSourceList.append( eol );
niceSourceList.append( StringUtil.LINE_SEPARATOR );
} }


getLogger().debug( niceSourceList.toString() ); getLogger().debug( niceSourceList.toString() );


+ 3
- 14
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java View File

@@ -29,6 +29,7 @@ import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* PropertyFile task uses java.util.Properties to modify integer, String and * PropertyFile task uses java.util.Properties to modify integer, String and
@@ -128,23 +129,11 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
* @author Jeremy Mawson <a href="mailto:jem@loftinspace.com.au"> * @author Jeremy Mawson <a href="mailto:jem@loftinspace.com.au">
* jem@loftinspace.com.au</a> * jem@loftinspace.com.au</a>
*/ */
public class PropertyFile extends Task
public class PropertyFile
extends Task
{ {

/*
* ========================================================================
*
* Static variables.
*/
private final static String NEWLINE = System.getProperty( "line.separator" );

private ArrayList entries = new ArrayList(); private ArrayList entries = new ArrayList();


/*
* ========================================================================
*
* Instance variables.
*/
// Use this to prepend a message to the properties file // Use this to prepend a message to the properties file
private String m_comment; private String m_comment;




+ 7
- 13
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java View File

@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC; import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


@@ -23,23 +24,16 @@ public abstract class DefaultCompilerAdapter
extends AbstractLogEnabled extends AbstractLogEnabled
implements CompilerAdapter implements CompilerAdapter
{ {
/*
* ------------------------------------------------------------
*/
private static String lSep = System.getProperty( "line.separator" );
/*
* ------------------------------------------------------------
*/
protected JspC attributes;
private JspC m_attributes;


public void setJspc( JspC attributes )
public void setJspc( final JspC attributes )
{ {
this.attributes = attributes;
this.m_attributes = attributes;
} }


public JspC getJspc() public JspC getJspc()
{ {
return attributes;
return m_attributes;
} }


/* /*
@@ -66,14 +60,14 @@ public abstract class DefaultCompilerAdapter
} }
niceSourceList.append( " to be compiled:" ); niceSourceList.append( " to be compiled:" );


niceSourceList.append( lSep );
niceSourceList.append( StringUtil.LINE_SEPARATOR );


Iterator enum = compileList.iterator(); Iterator enum = compileList.iterator();
while( enum.hasNext() ) while( enum.hasNext() )
{ {
String arg = (String)enum.next(); String arg = (String)enum.next();
cmd.createArgument().setValue( arg ); cmd.createArgument().setValue( arg );
niceSourceList.append( " " + arg + lSep );
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR );
} }


getLogger().debug( niceSourceList.toString() ); getLogger().debug( niceSourceList.toString() );


+ 9
- 9
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java View File

@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Prints plain text output of the test to a specified Writer. Inspired by the * Prints plain text output of the test to a specified Writer. Inspired by the
@@ -139,10 +140,9 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter
public void endTestSuite( JUnitTest suite ) public void endTestSuite( JUnitTest suite )
throws TaskException throws TaskException
{ {
String newLine = System.getProperty( "line.separator" );
StringBuffer sb = new StringBuffer( "Testsuite: " );
final StringBuffer sb = new StringBuffer( "Testsuite: " );
sb.append( suite.getName() ); sb.append( suite.getName() );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );
sb.append( "Tests run: " ); sb.append( "Tests run: " );
sb.append( suite.runCount() ); sb.append( suite.runCount() );
sb.append( ", Failures: " ); sb.append( ", Failures: " );
@@ -152,26 +152,26 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter
sb.append( ", Time elapsed: " ); sb.append( ", Time elapsed: " );
sb.append( m_numberFormat.format( suite.getRunTime() / 1000.0 ) ); sb.append( m_numberFormat.format( suite.getRunTime() / 1000.0 ) );
sb.append( " sec" ); sb.append( " sec" );
sb.append( newLine );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );
sb.append( StringUtil.LINE_SEPARATOR );


// append the err and output streams to the log // append the err and output streams to the log
if( systemOutput != null && systemOutput.length() > 0 ) if( systemOutput != null && systemOutput.length() > 0 )
{ {
sb.append( "------------- Standard Output ---------------" ) sb.append( "------------- Standard Output ---------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemOutput ) .append( systemOutput )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


if( systemError != null && systemError.length() > 0 ) if( systemError != null && systemError.length() > 0 )
{ {
sb.append( "------------- Standard Error -----------------" ) sb.append( "------------- Standard Error -----------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemError ) .append( systemError )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


if( output() != null ) if( output() != null )


+ 8
- 11
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java View File

@@ -16,6 +16,7 @@ import java.util.Hashtable;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;


/** /**
@@ -142,17 +143,13 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter


/** /**
* The whole testsuite ended. * The whole testsuite ended.
*
* @param suite Description of Parameter
* @exception TaskException Description of Exception
*/ */
public void endTestSuite( JUnitTest suite ) public void endTestSuite( JUnitTest suite )
throws TaskException throws TaskException
{ {
String newLine = System.getProperty( "line.separator" );
StringBuffer sb = new StringBuffer( "Testsuite: " ); StringBuffer sb = new StringBuffer( "Testsuite: " );
sb.append( suite.getName() ); sb.append( suite.getName() );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );
sb.append( "Tests run: " ); sb.append( "Tests run: " );
sb.append( suite.runCount() ); sb.append( suite.runCount() );
sb.append( ", Failures: " ); sb.append( ", Failures: " );
@@ -162,28 +159,28 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter
sb.append( ", Time elapsed: " ); sb.append( ", Time elapsed: " );
sb.append( nf.format( suite.getRunTime() / 1000.0 ) ); sb.append( nf.format( suite.getRunTime() / 1000.0 ) );
sb.append( " sec" ); sb.append( " sec" );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );


// append the err and output streams to the log // append the err and output streams to the log
if( systemOutput != null && systemOutput.length() > 0 ) if( systemOutput != null && systemOutput.length() > 0 )
{ {
sb.append( "------------- Standard Output ---------------" ) sb.append( "------------- Standard Output ---------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemOutput ) .append( systemOutput )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


if( systemError != null && systemError.length() > 0 ) if( systemError != null && systemError.length() > 0 )
{ {
sb.append( "------------- Standard Error -----------------" ) sb.append( "------------- Standard Error -----------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemError ) .append( systemError )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );


if( out != null ) if( out != null )
{ {


+ 6
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java View File

@@ -13,6 +13,7 @@ import java.text.NumberFormat;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Prints short summary output of the test to Ant's logging system. * Prints short summary output of the test to Ant's logging system.
@@ -119,7 +120,6 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter
public void endTestSuite( JUnitTest suite ) public void endTestSuite( JUnitTest suite )
throws TaskException throws TaskException
{ {
String newLine = System.getProperty( "line.separator" );
StringBuffer sb = new StringBuffer( "Tests run: " ); StringBuffer sb = new StringBuffer( "Tests run: " );
sb.append( suite.runCount() ); sb.append( suite.runCount() );
sb.append( ", Failures: " ); sb.append( ", Failures: " );
@@ -129,20 +129,20 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter
sb.append( ", Time elapsed: " ); sb.append( ", Time elapsed: " );
sb.append( nf.format( suite.getRunTime() / 1000.0 ) ); sb.append( nf.format( suite.getRunTime() / 1000.0 ) );
sb.append( " sec" ); sb.append( " sec" );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );


if( withOutAndErr ) if( withOutAndErr )
{ {
if( systemOutput != null && systemOutput.length() > 0 ) if( systemOutput != null && systemOutput.length() > 0 )
{ {
sb.append( "Output:" ).append( newLine ).append( systemOutput )
.append( newLine );
sb.append( "Output:" ).append( StringUtil.LINE_SEPARATOR ).append( systemOutput )
.append( StringUtil.LINE_SEPARATOR );
} }


if( systemError != null && systemError.length() > 0 ) if( systemError != null && systemError.length() > 0 )
{ {
sb.append( "Error: " ).append( newLine ).append( systemError )
.append( newLine );
sb.append( "Error: " ).append( StringUtil.LINE_SEPARATOR ).append( systemError )
.append( StringUtil.LINE_SEPARATOR );
} }
} }




+ 3
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/util/DOMElementWriter.java View File

@@ -9,6 +9,7 @@ package org.apache.tools.ant.util;


import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import org.apache.avalon.excalibur.util.StringUtil;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
@@ -29,8 +30,6 @@ import org.w3c.dom.Text;
*/ */
public class DOMElementWriter public class DOMElementWriter
{ {

private static String lSep = System.getProperty( "line.separator" );
private StringBuffer sb = new StringBuffer(); private StringBuffer sb = new StringBuffer();


/** /**
@@ -187,7 +186,7 @@ public class DOMElementWriter
case Node.ELEMENT_NODE: case Node.ELEMENT_NODE:
if( !hasChildren ) if( !hasChildren )
{ {
out.write( lSep );
out.write( StringUtil.LINE_SEPARATOR );
hasChildren = true; hasChildren = true;
} }
write( (Element)child, out, indent + 1, indentWith ); write( (Element)child, out, indent + 1, indentWith );
@@ -234,7 +233,7 @@ public class DOMElementWriter
out.write( "</" ); out.write( "</" );
out.write( element.getTagName() ); out.write( element.getTagName() );
out.write( ">" ); out.write( ">" );
out.write( lSep );
out.write( StringUtil.LINE_SEPARATOR );
out.flush(); out.flush();
} }
} }

+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/AntStructure.java View File

@@ -18,6 +18,7 @@ import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Creates a partial DTD for Ant from the currently known tasks. * Creates a partial DTD for Ant from the currently known tasks.
@@ -26,10 +27,9 @@ import org.apache.tools.ant.Task;
* @version $Revision$ * @version $Revision$
*/ */


public class AntStructure extends Task
public class AntStructure
extends Task
{ {
private final String lSep = System.getProperty( "line.separator" );

private final String BOOLEAN = "%boolean;"; private final String BOOLEAN = "%boolean;";
private final String TASKS = "%tasks;"; private final String TASKS = "%tasks;";
private final String TYPES = "%types;"; private final String TYPES = "%types;";


+ 0
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java View File

@@ -172,7 +172,6 @@ public class Available


if( eval() ) if( eval() )
{ {
String lSep = System.getProperty( "line.separator" );
if( null == getProject().getProperty( m_property ) ) if( null == getProject().getProperty( m_property ) )
{ {
setProperty( m_property, m_value ); setProperty( m_property, m_value );


+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Replaces all occurrences of one or more string tokens with given values in * Replaces all occurrences of one or more string tokens with given values in
@@ -344,9 +345,8 @@ public class Replace extends MatchingTask
// line separators in values and tokens are "\n" // line separators in values and tokens are "\n"
// in order to compare with the file contents, replace them // in order to compare with the file contents, replace them
// as needed // as needed
String linesep = System.getProperty( "line.separator" );
String val = stringReplace( value.getText(), "\n", linesep );
String tok = stringReplace( token.getText(), "\n", linesep );
final String val = stringReplace( value.getText(), "\n", StringUtil.LINE_SEPARATOR );
final String tok = stringReplace( token.getText(), "\n", StringUtil.LINE_SEPARATOR );


// for each found token, replace with value // for each found token, replace with value
getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() ); getLogger().debug( "Replacing in " + src.getPath() + ": " + token.getText() + " --> " + value.getText() );


+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -12,6 +12,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
@@ -34,7 +35,6 @@ public abstract class DefaultCompilerAdapter
extends AbstractLogEnabled extends AbstractLogEnabled
implements CompilerAdapter implements CompilerAdapter
{ {
protected static String LINE_SEP = System.getProperty( "line.separator" );
protected boolean m_debug; protected boolean m_debug;
protected boolean m_optimize; protected boolean m_optimize;
protected boolean m_deprecation; protected boolean m_deprecation;
@@ -429,13 +429,13 @@ public abstract class DefaultCompilerAdapter
} }
niceSourceList.append( " to be compiled:" ); niceSourceList.append( " to be compiled:" );


niceSourceList.append( LINE_SEP );
niceSourceList.append( StringUtil.LINE_SEPARATOR );


for( int i = 0; i < m_compileList.length; i++ ) for( int i = 0; i < m_compileList.length; i++ )
{ {
String arg = m_compileList[ i ].getAbsolutePath(); String arg = m_compileList[ i ].getAbsolutePath();
cmd.createArgument().setValue( arg ); cmd.createArgument().setValue( arg );
niceSourceList.append( " " + arg + LINE_SEP );
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR );
} }


getLogger().debug( niceSourceList.toString() ); getLogger().debug( niceSourceList.toString() );


+ 4
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecTask.java View File

@@ -23,6 +23,7 @@ import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnvironmentData; import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.EnvironmentVariable; import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Executes a given command if the os platform is appropriate. * Executes a given command if the os platform is appropriate.
@@ -33,10 +34,9 @@ import org.apache.tools.ant.types.EnvironmentVariable;
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
* @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a> * @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a>
*/ */
public class ExecTask extends Task
public class ExecTask
extends Task
{ {
private static String LINE_SEP = System.getProperty( "line.separator" );

private boolean m_newEnvironment; private boolean m_newEnvironment;
private Integer m_timeout; private Integer m_timeout;
private EnvironmentData m_env = new EnvironmentData(); private EnvironmentData m_env = new EnvironmentData();
@@ -241,7 +241,7 @@ public class ExecTask extends Task
{ {
if( val.length() != 0 ) if( val.length() != 0 )
{ {
val.append( LINE_SEP );
val.append( StringUtil.LINE_SEPARATOR );
} }
val.append( line ); val.append( line );
} }


+ 4
- 5
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -18,6 +18,7 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Task to generate JNI header files using javah. This task can take the * Task to generate JNI header files using javah. This task can take the
@@ -57,8 +58,6 @@ public class Javah extends Task
{ {


private final static String FAIL_MSG = "Compile failed, messages should have been provided."; private final static String FAIL_MSG = "Compile failed, messages should have been provided.";
//private Path extdirs;
private static String lSep = System.getProperty( "line.separator" );


private ArrayList classes = new ArrayList( 2 ); private ArrayList classes = new ArrayList( 2 );
private Path classpath = null; private Path classpath = null;
@@ -300,7 +299,7 @@ public class Javah extends Task
{ {
String aClass = tok.nextToken().trim(); String aClass = tok.nextToken().trim();
cmd.createArgument().setValue( aClass ); cmd.createArgument().setValue( aClass );
niceClassList.append( " " + aClass + lSep );
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR );
n++; n++;
} }
} }
@@ -311,7 +310,7 @@ public class Javah extends Task
ClassArgument arg = (ClassArgument)enum.next(); ClassArgument arg = (ClassArgument)enum.next();
String aClass = arg.getName(); String aClass = arg.getName();
cmd.createArgument().setValue( aClass ); cmd.createArgument().setValue( aClass );
niceClassList.append( " " + aClass + lSep );
niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR );
n++; n++;
} }


@@ -321,7 +320,7 @@ public class Javah extends Task
prefix.append( "es" ); prefix.append( "es" );
} }
prefix.append( " to be compiled:" ); prefix.append( " to be compiled:" );
prefix.append( lSep );
prefix.append( StringUtil.LINE_SEPARATOR );


getLogger().debug( prefix.toString() + niceClassList.toString() ); getLogger().debug( prefix.toString() + niceClassList.toString() );
} }


+ 7
- 9
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ManifestFile.java View File

@@ -17,6 +17,7 @@ import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;


@@ -29,12 +30,9 @@ import org.apache.tools.ant.Task;
* </manifest> </target> </pre> * </manifest> </target> </pre>
* *
* @author Thomas Kerle * @author Thomas Kerle
* @version 1.0 2001-10-11
*/ */
public class ManifestFile extends Task public class ManifestFile extends Task
{ {

private final static String newLine = System.getProperty( "line.separator" );
private final static String keyValueSeparator = ":"; private final static String keyValueSeparator = ":";
private final static String UPDATE_ = "update"; private final static String UPDATE_ = "update";
private final static String REPLACEALL_ = "replaceAll"; private final static String REPLACEALL_ = "replaceAll";
@@ -101,7 +99,7 @@ public class ManifestFile extends Task
private StringTokenizer getLineTokens( StringBuffer buffer ) private StringTokenizer getLineTokens( StringBuffer buffer )
{ {
String manifests = buffer.toString(); String manifests = buffer.toString();
StringTokenizer strTokens = new StringTokenizer( manifests, newLine );
StringTokenizer strTokens = new StringTokenizer( manifests, StringUtil.LINE_SEPARATOR );
return strTokens; return strTokens;
} }


@@ -137,7 +135,7 @@ public class ManifestFile extends Task
String value = (String)entry.getValue(); String value = (String)entry.getValue();
String entry_string = key + keyValueSeparator + value; String entry_string = key + keyValueSeparator + value;


buffer.append( entry_string + this.newLine );
buffer.append( entry_string + StringUtil.LINE_SEPARATOR );
} }


return buffer; return buffer;
@@ -208,9 +206,9 @@ public class ManifestFile extends Task
} }
fis.close(); fis.close();
StringTokenizer lineTokens = getLineTokens( buffer ); StringTokenizer lineTokens = getLineTokens( buffer );
while( lineTokens.hasNext() )
while( lineTokens.hasMoreElements() )
{ {
String currentLine = (String)lineTokens.next();
String currentLine = (String)lineTokens.nextElement();
addLine( currentLine ); addLine( currentLine );
} }
} }
@@ -351,8 +349,8 @@ public class ManifestFile extends Task
private void split() private void split()
{ {
StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator ); StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator );
key = (String)st.next();
val = (String)st.next();
key = (String)st.nextElement();
val = (String)st.nextElement();
} }


} }


+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java View File

@@ -18,6 +18,7 @@ import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import netrexx.lang.Rexx; import netrexx.lang.Rexx;
import org.apache.avalon.excalibur.io.FileUtil; import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -675,14 +676,13 @@ public class NetRexxC extends MatchingTask
} }
getLogger().debug( compileOptions.toString() ); getLogger().debug( compileOptions.toString() );


String eol = System.getProperty( "line.separator" );
StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + eol );
StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + StringUtil.LINE_SEPARATOR );


for( int i = 0; i < compileList.size(); i++ ) for( int i = 0; i < compileList.size(); i++ )
{ {
niceSourceList.append( " " ); niceSourceList.append( " " );
niceSourceList.append( compileList.get( i ).toString() ); niceSourceList.append( compileList.get( i ).toString() );
niceSourceList.append( eol );
niceSourceList.append( StringUtil.LINE_SEPARATOR );
} }


getLogger().debug( niceSourceList.toString() ); getLogger().debug( niceSourceList.toString() );


+ 3
- 14
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/PropertyFile.java View File

@@ -29,6 +29,7 @@ import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* PropertyFile task uses java.util.Properties to modify integer, String and * PropertyFile task uses java.util.Properties to modify integer, String and
@@ -128,23 +129,11 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
* @author Jeremy Mawson <a href="mailto:jem@loftinspace.com.au"> * @author Jeremy Mawson <a href="mailto:jem@loftinspace.com.au">
* jem@loftinspace.com.au</a> * jem@loftinspace.com.au</a>
*/ */
public class PropertyFile extends Task
public class PropertyFile
extends Task
{ {

/*
* ========================================================================
*
* Static variables.
*/
private final static String NEWLINE = System.getProperty( "line.separator" );

private ArrayList entries = new ArrayList(); private ArrayList entries = new ArrayList();


/*
* ========================================================================
*
* Instance variables.
*/
// Use this to prepend a message to the properties file // Use this to prepend a message to the properties file
private String m_comment; private String m_comment;




+ 7
- 13
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java View File

@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC; import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


@@ -23,23 +24,16 @@ public abstract class DefaultCompilerAdapter
extends AbstractLogEnabled extends AbstractLogEnabled
implements CompilerAdapter implements CompilerAdapter
{ {
/*
* ------------------------------------------------------------
*/
private static String lSep = System.getProperty( "line.separator" );
/*
* ------------------------------------------------------------
*/
protected JspC attributes;
private JspC m_attributes;


public void setJspc( JspC attributes )
public void setJspc( final JspC attributes )
{ {
this.attributes = attributes;
this.m_attributes = attributes;
} }


public JspC getJspc() public JspC getJspc()
{ {
return attributes;
return m_attributes;
} }


/* /*
@@ -66,14 +60,14 @@ public abstract class DefaultCompilerAdapter
} }
niceSourceList.append( " to be compiled:" ); niceSourceList.append( " to be compiled:" );


niceSourceList.append( lSep );
niceSourceList.append( StringUtil.LINE_SEPARATOR );


Iterator enum = compileList.iterator(); Iterator enum = compileList.iterator();
while( enum.hasNext() ) while( enum.hasNext() )
{ {
String arg = (String)enum.next(); String arg = (String)enum.next();
cmd.createArgument().setValue( arg ); cmd.createArgument().setValue( arg );
niceSourceList.append( " " + arg + lSep );
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR );
} }


getLogger().debug( niceSourceList.toString() ); getLogger().debug( niceSourceList.toString() );


+ 9
- 9
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java View File

@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Prints plain text output of the test to a specified Writer. Inspired by the * Prints plain text output of the test to a specified Writer. Inspired by the
@@ -139,10 +140,9 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter
public void endTestSuite( JUnitTest suite ) public void endTestSuite( JUnitTest suite )
throws TaskException throws TaskException
{ {
String newLine = System.getProperty( "line.separator" );
StringBuffer sb = new StringBuffer( "Testsuite: " );
final StringBuffer sb = new StringBuffer( "Testsuite: " );
sb.append( suite.getName() ); sb.append( suite.getName() );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );
sb.append( "Tests run: " ); sb.append( "Tests run: " );
sb.append( suite.runCount() ); sb.append( suite.runCount() );
sb.append( ", Failures: " ); sb.append( ", Failures: " );
@@ -152,26 +152,26 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter
sb.append( ", Time elapsed: " ); sb.append( ", Time elapsed: " );
sb.append( m_numberFormat.format( suite.getRunTime() / 1000.0 ) ); sb.append( m_numberFormat.format( suite.getRunTime() / 1000.0 ) );
sb.append( " sec" ); sb.append( " sec" );
sb.append( newLine );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );
sb.append( StringUtil.LINE_SEPARATOR );


// append the err and output streams to the log // append the err and output streams to the log
if( systemOutput != null && systemOutput.length() > 0 ) if( systemOutput != null && systemOutput.length() > 0 )
{ {
sb.append( "------------- Standard Output ---------------" ) sb.append( "------------- Standard Output ---------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemOutput ) .append( systemOutput )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


if( systemError != null && systemError.length() > 0 ) if( systemError != null && systemError.length() > 0 )
{ {
sb.append( "------------- Standard Error -----------------" ) sb.append( "------------- Standard Error -----------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemError ) .append( systemError )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


if( output() != null ) if( output() != null )


+ 8
- 11
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java View File

@@ -16,6 +16,7 @@ import java.util.Hashtable;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;


/** /**
@@ -142,17 +143,13 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter


/** /**
* The whole testsuite ended. * The whole testsuite ended.
*
* @param suite Description of Parameter
* @exception TaskException Description of Exception
*/ */
public void endTestSuite( JUnitTest suite ) public void endTestSuite( JUnitTest suite )
throws TaskException throws TaskException
{ {
String newLine = System.getProperty( "line.separator" );
StringBuffer sb = new StringBuffer( "Testsuite: " ); StringBuffer sb = new StringBuffer( "Testsuite: " );
sb.append( suite.getName() ); sb.append( suite.getName() );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );
sb.append( "Tests run: " ); sb.append( "Tests run: " );
sb.append( suite.runCount() ); sb.append( suite.runCount() );
sb.append( ", Failures: " ); sb.append( ", Failures: " );
@@ -162,28 +159,28 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter
sb.append( ", Time elapsed: " ); sb.append( ", Time elapsed: " );
sb.append( nf.format( suite.getRunTime() / 1000.0 ) ); sb.append( nf.format( suite.getRunTime() / 1000.0 ) );
sb.append( " sec" ); sb.append( " sec" );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );


// append the err and output streams to the log // append the err and output streams to the log
if( systemOutput != null && systemOutput.length() > 0 ) if( systemOutput != null && systemOutput.length() > 0 )
{ {
sb.append( "------------- Standard Output ---------------" ) sb.append( "------------- Standard Output ---------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemOutput ) .append( systemOutput )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


if( systemError != null && systemError.length() > 0 ) if( systemError != null && systemError.length() > 0 )
{ {
sb.append( "------------- Standard Error -----------------" ) sb.append( "------------- Standard Error -----------------" )
.append( newLine )
.append( StringUtil.LINE_SEPARATOR )
.append( systemError ) .append( systemError )
.append( "------------- ---------------- ---------------" ) .append( "------------- ---------------- ---------------" )
.append( newLine );
.append( StringUtil.LINE_SEPARATOR );
} }


sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );


if( out != null ) if( out != null )
{ {


+ 6
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java View File

@@ -13,6 +13,7 @@ import java.text.NumberFormat;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.avalon.excalibur.util.StringUtil;


/** /**
* Prints short summary output of the test to Ant's logging system. * Prints short summary output of the test to Ant's logging system.
@@ -119,7 +120,6 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter
public void endTestSuite( JUnitTest suite ) public void endTestSuite( JUnitTest suite )
throws TaskException throws TaskException
{ {
String newLine = System.getProperty( "line.separator" );
StringBuffer sb = new StringBuffer( "Tests run: " ); StringBuffer sb = new StringBuffer( "Tests run: " );
sb.append( suite.runCount() ); sb.append( suite.runCount() );
sb.append( ", Failures: " ); sb.append( ", Failures: " );
@@ -129,20 +129,20 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter
sb.append( ", Time elapsed: " ); sb.append( ", Time elapsed: " );
sb.append( nf.format( suite.getRunTime() / 1000.0 ) ); sb.append( nf.format( suite.getRunTime() / 1000.0 ) );
sb.append( " sec" ); sb.append( " sec" );
sb.append( newLine );
sb.append( StringUtil.LINE_SEPARATOR );


if( withOutAndErr ) if( withOutAndErr )
{ {
if( systemOutput != null && systemOutput.length() > 0 ) if( systemOutput != null && systemOutput.length() > 0 )
{ {
sb.append( "Output:" ).append( newLine ).append( systemOutput )
.append( newLine );
sb.append( "Output:" ).append( StringUtil.LINE_SEPARATOR ).append( systemOutput )
.append( StringUtil.LINE_SEPARATOR );
} }


if( systemError != null && systemError.length() > 0 ) if( systemError != null && systemError.length() > 0 )
{ {
sb.append( "Error: " ).append( newLine ).append( systemError )
.append( newLine );
sb.append( "Error: " ).append( StringUtil.LINE_SEPARATOR ).append( systemError )
.append( StringUtil.LINE_SEPARATOR );
} }
} }




+ 3
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/util/DOMElementWriter.java View File

@@ -9,6 +9,7 @@ package org.apache.tools.ant.util;


import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import org.apache.avalon.excalibur.util.StringUtil;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
@@ -29,8 +30,6 @@ import org.w3c.dom.Text;
*/ */
public class DOMElementWriter public class DOMElementWriter
{ {

private static String lSep = System.getProperty( "line.separator" );
private StringBuffer sb = new StringBuffer(); private StringBuffer sb = new StringBuffer();


/** /**
@@ -187,7 +186,7 @@ public class DOMElementWriter
case Node.ELEMENT_NODE: case Node.ELEMENT_NODE:
if( !hasChildren ) if( !hasChildren )
{ {
out.write( lSep );
out.write( StringUtil.LINE_SEPARATOR );
hasChildren = true; hasChildren = true;
} }
write( (Element)child, out, indent + 1, indentWith ); write( (Element)child, out, indent + 1, indentWith );
@@ -234,7 +233,7 @@ public class DOMElementWriter
out.write( "</" ); out.write( "</" );
out.write( element.getTagName() ); out.write( element.getTagName() );
out.write( ">" ); out.write( ">" );
out.write( lSep );
out.write( StringUtil.LINE_SEPARATOR );
out.flush(); out.flush();
} }
} }

Loading…
Cancel
Save