Browse Source

Removed Project.toBoolean method where appropriate and removed a number of tabs.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268233 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
c9928eaad1
10 changed files with 1541 additions and 1520 deletions
  1. +5
    -6
      src/main/org/apache/tools/ant/taskdefs/Copydir.java
  2. +3
    -4
      src/main/org/apache/tools/ant/taskdefs/Copyfile.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  4. +80
    -77
      src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  5. +47
    -47
      src/main/org/apache/tools/ant/taskdefs/Get.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Replace.java
  7. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/SignJar.java
  8. +67
    -66
      src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  9. +17
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
  10. +1312
    -1302
      src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java

+ 5
- 6
src/main/org/apache/tools/ant/taskdefs/Copydir.java View File

@@ -54,10 +54,9 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.*;

import java.io.*;
import java.util.*;
import org.apache.tools.ant.*;

/**
* Copies a directory.
@@ -84,16 +83,16 @@ public class Copydir extends MatchingTask {
destDir = dest;
}

public void setFiltering(String filter) {
filtering = Project.toBoolean(filter);
public void setFiltering(boolean filter) {
filtering = filter;
}

public void setFlatten(boolean flatten) {
this.flatten = flatten;
}

public void setForceoverwrite(String force) {
forceOverwrite = Project.toBoolean(force);
public void setForceoverwrite(boolean force) {
forceOverwrite = force;
}

public void execute() throws BuildException {


+ 3
- 4
src/main/org/apache/tools/ant/taskdefs/Copyfile.java View File

@@ -54,10 +54,9 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.*;

import java.io.*;
import java.util.*;
import org.apache.tools.ant.*;

/**
* Copies a file.
@@ -78,8 +77,8 @@ public class Copyfile extends Task {
srcFile = src;
}

public void setForceoverwrite(String force) {
forceOverwrite = Project.toBoolean(force);
public void setForceoverwrite(boolean force) {
forceOverwrite = force;
}

public void setDest(File dest) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -182,8 +182,8 @@ public class Exec extends Task {
this.out = out;
}

public void setFailonerror(String fail) {
failOnError = Project.toBoolean(fail);
public void setFailonerror(boolean fail) {
failOnError = fail;
}

protected void outputLog(String line, int messageLevel) {


+ 80
- 77
src/main/org/apache/tools/ant/taskdefs/GenerateKey.java View File

@@ -53,15 +53,15 @@
*/
package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.*;
import org.apache.tools.ant.types.Commandline;
import java.util.Enumeration;
import java.util.Vector;
import org.apache.tools.ant.*;
import org.apache.tools.ant.types.Commandline;

/**
* Generates a key.
*
* @author Peter Donald <a href="mailto:donaldp@mad.scientist.com">donaldp@mad.scientist.com</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public class GenerateKey extends Task {

@@ -104,46 +104,46 @@ public class GenerateKey extends Task {
}

public String toString() {
final int size = params.size();
final StringBuffer sb = new StringBuffer();
boolean firstPass = true;
for( int i = 0; i < size; i++ ) {
if( !firstPass ) {
sb.append(" ,");
}
firstPass = false;
final DnameParam param = (DnameParam)params.elementAt( i );
sb.append( encode( param.getName() ) );
sb.append( '=' );
sb.append( encode( param.getValue() ) );
}
return sb.toString();
final int size = params.size();
final StringBuffer sb = new StringBuffer();
boolean firstPass = true;
for( int i = 0; i < size; i++ ) {
if( !firstPass ) {
sb.append(" ,");
}
firstPass = false;
final DnameParam param = (DnameParam)params.elementAt( i );
sb.append( encode( param.getName() ) );
sb.append( '=' );
sb.append( encode( param.getValue() ) );
}
return sb.toString();
}

public String encode( final String string ) {
int end = string.indexOf(',');
if( -1 == end ) return string;
final StringBuffer sb = new StringBuffer();
int start = 0;
while( -1 != end )
{
sb.append( string.substring( start, end ) );
sb.append( "\\," );
start = end + 1;
end = string.indexOf( ',', start );
}
sb.append( string.substring( start ) );
return sb.toString();
}
public String encode( final String string ) {
int end = string.indexOf(',');
if( -1 == end ) return string;
final StringBuffer sb = new StringBuffer();
int start = 0;
while( -1 != end )
{
sb.append( string.substring( start, end ) );
sb.append( "\\," );
start = end + 1;
end = string.indexOf( ',', start );
}
sb.append( string.substring( start ) );
return sb.toString();
}
}

/**
@@ -168,20 +168,22 @@ public class GenerateKey extends Task {
protected boolean verbose;

public DistinguishedName createDname() throws BuildException {
if( null != expandedDname ) {
throw new BuildException("DName sub-element can only be specified once.");
}
if( null != dname ) {
throw new BuildException("It is not possible to specify dname both as attribute and element.");
}
expandedDname = new DistinguishedName();
return expandedDname;
if( null != expandedDname ) {
throw new BuildException( "DName sub-element can only be specified once." );
}
if( null != dname ) {
throw new BuildException( "It is not possible to specify dname both " +
"as attribute and element." );
}
expandedDname = new DistinguishedName();
return expandedDname;
}
public void setDname(final String dname) {
if( null != expandedDname ) {
throw new BuildException("It is not possible to specify dname both as attribute and element.");
}
if( null != expandedDname ) {
throw new BuildException( "It is not possible to specify dname both " +
"as attribute and element." );
}
this.dname = dname;
}

@@ -214,40 +216,41 @@ public class GenerateKey extends Task {
}

public void setKeysize(final String keysize) throws BuildException {
try { this.keysize = Integer.parseInt(keysize); }
catch(final NumberFormatException nfe)
{
throw new BuildException( "KeySize attribute should be a integer" );
}
try { this.keysize = Integer.parseInt(keysize); }
catch(final NumberFormatException nfe)
{
throw new BuildException( "KeySize attribute should be a integer" );
}
}

public void setValidity(final String validity) throws BuildException {
try { this.validity = Integer.parseInt(validity); }
catch(final NumberFormatException nfe)
{
throw new BuildException( "Validity attribute should be a integer" );
}
try { this.validity = Integer.parseInt(validity); }
catch(final NumberFormatException nfe)
{
throw new BuildException( "Validity attribute should be a integer" );
}
}

public void setVerbose(final String verbose) {
this.verbose = project.toBoolean(verbose);
public void setVerbose(final boolean verbose) {
this.verbose = verbose;
}

public void execute() throws BuildException {
if (project.getJavaVersion().equals(Project.JAVA_1_1)) {
throw new BuildException("The genkey task is only available on JDK versions 1.2 or greater");
throw new BuildException( "The genkey task is only available on JDK" +
" versions 1.2 or greater" );
}

if (null == alias) {
throw new BuildException("alias attribute must be set");
throw new BuildException( "alias attribute must be set" );
}

if (null == storepass) {
throw new BuildException("storepass attribute must be set");
throw new BuildException( "storepass attribute must be set" );
}

if (null == dname && null == expandedDname) {
throw new BuildException("dname must be set");
throw new BuildException( "dname must be set" );
}

final StringBuffer sb = new StringBuffer();
@@ -258,9 +261,9 @@ public class GenerateKey extends Task {
sb.append("-v ");
}

sb.append("-alias \"");
sb.append(alias);
sb.append("\" ");
sb.append("-alias \"");
sb.append(alias);
sb.append("\" ");

if (null != dname) {
sb.append("-dname \"");
@@ -275,9 +278,9 @@ public class GenerateKey extends Task {
}

if (null != keystore) {
sb.append("-keystore \"");
sb.append("-keystore \"");
sb.append(keystore);
sb.append("\" ");
sb.append("\" ");
}

if (null != storepass) {
@@ -292,14 +295,14 @@ public class GenerateKey extends Task {
sb.append("\" ");
}

sb.append("-keypass \"");
sb.append("-keypass \"");
if (null != keypass) {
sb.append(keypass);
}
else {
else {
sb.append(storepass);
}
sb.append("\" ");
}
sb.append("\" ");

if (null != sigalg) {
sb.append("-sigalg \"");


+ 47
- 47
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -54,10 +54,10 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.*;
import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.tools.ant.*;

/**
* Get a particular file from a URL source.
@@ -100,14 +100,14 @@ public class Get extends Task {

try {

log("Getting: " + source);
log("Getting: " + source);

//set the timestamp to the file date.
long timestamp=0;
//set the timestamp to the file date.
long timestamp=0;

boolean hasTimestamp=false;
if(useTimestamp && dest.exists()) {
timestamp=dest.lastModified();
if(useTimestamp && dest.exists()) {
timestamp=dest.lastModified();
if (verbose) {
Date t=new Date(timestamp);
log("local file date : "+t.toString());
@@ -115,7 +115,7 @@ public class Get extends Task {
hasTimestamp=true;
}
//set up the URL connection
URLConnection connection=source.openConnection();
//modify the headers
@@ -128,7 +128,7 @@ public class Get extends Task {
connection.connect();
//next test for a 304 result (HTTP only)
if(connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection=(HttpURLConnection)connection;
HttpURLConnection httpConnection=(HttpURLConnection)connection;
if(httpConnection.getResponseCode()==HttpURLConnection.HTTP_NOT_MODIFIED) {
//not modified so no file download. just return instead
//and trace out something so the user doesn't think that the
@@ -141,45 +141,45 @@ public class Get extends Task {
//REVISIT: at this point even non HTTP connections may support the if-modified-since
//behaviour -we just check the date of the content and skip the write if it is not
//newer. Some protocols (FTP) dont include dates, of course.
FileOutputStream fos = new FileOutputStream(dest);
FileOutputStream fos = new FileOutputStream(dest);

InputStream is=null;
for( int i=0; i< 3 ; i++ ) {
try {
is = connection.getInputStream();
break;
} catch( IOException ex ) {
log( "Error opening connection " + ex );
}
}
if( is==null ) {
log( "Can't get " + source + " to " + dest);
if(ignoreErrors)
InputStream is=null;
for( int i=0; i< 3 ; i++ ) {
try {
is = connection.getInputStream();
break;
} catch( IOException ex ) {
log( "Error opening connection " + ex );
}
}
if( is==null ) {
log( "Can't get " + source + " to " + dest);
if(ignoreErrors)
return;
throw new BuildException( "Can't get " + source + " to " + dest,
throw new BuildException( "Can't get " + source + " to " + dest,
location);
}
byte[] buffer = new byte[100 * 1024];
int length;
while ((length = is.read(buffer)) >= 0) {
fos.write(buffer, 0, length);
if (verbose) System.out.print(".");
}
if(verbose) System.out.println();
fos.close();
is.close();
}
byte[] buffer = new byte[100 * 1024];
int length;
while ((length = is.read(buffer)) >= 0) {
fos.write(buffer, 0, length);
if (verbose) System.out.print(".");
}
if(verbose) System.out.println();
fos.close();
is.close();
//if (and only if) the use file time option is set, then the
//saved file now has its timestamp set to that of the downloaded file
if(useTimestamp) {
long remoteTimestamp=connection.getLastModified();
long remoteTimestamp=connection.getLastModified();
if (verbose) {
Date t=new Date(remoteTimestamp);
log("last modified = "+t.toString()
+((remoteTimestamp==0)?" - using current time instead":""));
+((remoteTimestamp==0)?" - using current time instead":""));
}
if(remoteTimestamp!=0)
touchFile(dest,remoteTimestamp);
@@ -187,12 +187,12 @@ public class Get extends Task {


} catch (IOException ioe) {
log("Error getting " + source + " to " + dest );
if(ignoreErrors)
} catch (IOException ioe) {
log("Error getting " + source + " to " + dest );
if(ignoreErrors)
return;
throw new BuildException(ioe, location);
}
throw new BuildException(ioe, location);
}
}
/**
@@ -221,7 +221,7 @@ public class Get extends Task {
} else {
return false;
}
}
}

/**
* Set the URL.
@@ -229,7 +229,7 @@ public class Get extends Task {
* @param u URL for the file.
*/
public void setSrc(URL u) {
this.source = u;
this.source = u;
}

/**
@@ -238,7 +238,7 @@ public class Get extends Task {
* @param dest Path to file.
*/
public void setDest(File dest) {
this.dest = dest;
this.dest = dest;
}

/**
@@ -247,7 +247,7 @@ public class Get extends Task {
* @param v if "true" then be verbose
*/
public void setVerbose(boolean v) {
verbose = v;
verbose = v;
}

/**
@@ -256,7 +256,7 @@ public class Get extends Task {
* @param v if "true" then don't report download errors up to ant
*/
public void setIgnoreErrors(boolean v) {
ignoreErrors = v;
ignoreErrors = v;
}

/**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -110,7 +110,7 @@ public class Replace extends MatchingTask {
}
if (dir != null) {
DirectoryScanner ds = super.getDirectoryScanner(dir);
DirectoryScanner ds = super.getDirectoryScanner(dir);
String[] srcs = ds.getIncludedFiles();

for(int i=0; i<srcs.length; i++) {


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -53,9 +53,9 @@
*/
package org.apache.tools.ant.taskdefs;

import java.io.File;
import org.apache.tools.ant.*;
import org.apache.tools.ant.types.Commandline;
import java.io.File;

/**
* Sign a archive.
@@ -119,16 +119,16 @@ public class SignJar extends Task {
this.signedjar = signedjar;
}

public void setVerbose(final String verbose) {
this.verbose = project.toBoolean(verbose);
public void setVerbose(final boolean verbose) {
this.verbose = verbose;
}

public void setInternalsf(final String internalsf) {
this.internalsf = project.toBoolean(internalsf);
public void setInternalsf(final boolean internalsf) {
this.internalsf = internalsf;
}

public void setSectionsonly(final String sectionsonly) {
this.sectionsonly = project.toBoolean(sectionsonly);
public void setSectionsonly(final boolean sectionsonly) {
this.sectionsonly = sectionsonly;
}

public void execute() throws BuildException {


+ 67
- 66
src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java View File

@@ -54,14 +54,12 @@

package org.apache.tools.ant.taskdefs.optional;

import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;

import netrexx.lang.Rexx;

import java.io.*;
import java.lang.reflect.*;
import java.util.*;
import netrexx.lang.Rexx;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;

/**
* Task to compile NetRexx source files. This task can take the following
@@ -154,8 +152,8 @@ public class NetRexxC extends MatchingTask {
/**
* Set whether literals are treated as binary, rather than NetRexx types
*/
public void setBinary(String binary) {
this.binary = Project.toBoolean(binary);
public void setBinary(boolean binary) {
this.binary = binary;
}

/**
@@ -170,17 +168,17 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false
*/
public void setComments(String comments) {
this.comments = Project.toBoolean(comments);
public void setComments(boolean comments) {
this.comments = comments;
}

/**
/**
* Set whether error messages come out in compact or verbose format.
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false
*/
public void setCompact(String compact) {
this.compact = Project.toBoolean(compact);
public void setCompact(boolean compact) {
this.compact = compact;
}

/**
@@ -189,8 +187,8 @@ public class NetRexxC extends MatchingTask {
* The default value is true.
* Setting this flag to false, will automatically set the keep flag to true.
*/
public void setCompile(String compile) {
this.compile = Project.toBoolean(compile);
public void setCompile(boolean compile) {
this.compile = compile;
if (!this.compile && !this.keep) this.keep = true;
}

@@ -199,15 +197,15 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is true.
*/
public void setConsole(String console) {
this.console = Project.toBoolean(console);
public void setConsole(boolean console) {
this.console = console;
}

/**
* Whether variable cross references are generated
*/
public void setCrossref(String crossref) {
this.crossref = Project.toBoolean(crossref);
public void setCrossref(boolean crossref) {
this.crossref = crossref;
}

/**
@@ -216,8 +214,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is true.
*/
public void setDecimal(String decimal) {
this.decimal = Project.toBoolean(decimal);
public void setDecimal(boolean decimal) {
this.decimal = decimal;
}

/**
@@ -231,8 +229,8 @@ public class NetRexxC extends MatchingTask {
/**
* Whether diagnostic information about the compile is generated
*/
public void setDiag(String diag) {
this.diag = Project.toBoolean(diag);
public void setDiag(boolean diag) {
this.diag = diag;
}

/**
@@ -240,16 +238,16 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setExplicit(String explicit) {
this.explicit = Project.toBoolean(explicit);
public void setExplicit(boolean explicit) {
this.explicit = explicit;
}

/**
* Whether the generated java code is formatted nicely or left to match NetRexx
* line numbers for call stack debugging
*/
public void setFormat(String format) {
this.format = Project.toBoolean(format);
public void setFormat(boolean format) {
this.format = format;
}

/**
@@ -257,8 +255,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setJava(String java) {
this.java = Project.toBoolean(java);
public void setJava(boolean java) {
this.java = java;
}


@@ -268,24 +266,24 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setKeep(String keep) {
this.keep = Project.toBoolean(keep);
public void setKeep(boolean keep) {
this.keep = keep;
}

/**
* Whether the compiler text logo is displayed when compiling
*/
public void setLogo(String logo) {
this.logo = Project.toBoolean(logo);
public void setLogo(boolean logo) {
this.logo = logo;
}

/**
/**
* Whether the generated .java file should be replaced when compiling
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setReplace(String replace) {
this.replace = Project.toBoolean(replace);
public void setReplace(boolean replace) {
this.replace = replace;
}

/**
@@ -294,8 +292,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setSavelog(String savelog) {
this.savelog = Project.toBoolean(savelog);
public void setSavelog(boolean savelog) {
this.savelog = savelog;
}

/**
@@ -304,8 +302,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is true.
*/
public void setSourcedir(String sourcedir) {
this.sourcedir = Project.toBoolean(sourcedir);
public void setSourcedir(boolean sourcedir) {
this.sourcedir = sourcedir;
}

/**
@@ -322,22 +320,22 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setStrictargs(String strictargs) {
this.strictargs = Project.toBoolean(strictargs);
public void setStrictargs(boolean strictargs) {
this.strictargs = strictargs;
}

/**
* Tells the NetRexx compile that assignments must match exactly on type
*/
public void setStrictassign(String strictassign) {
this.strictassign = Project.toBoolean(strictassign);
public void setStrictassign(boolean strictassign) {
this.strictassign = strictassign;
}

/**
* Specifies whether the NetRexx compiler should be case sensitive or not
*/
public void setStrictcase(String strictcase) {
this.strictcase = Project.toBoolean(strictcase);
public void setStrictcase(boolean strictcase) {
this.strictcase = strictcase;
}

/**
@@ -347,8 +345,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setStrictimport(String strictimport) {
this.strictimport = Project.toBoolean(strictimport);
public void setStrictimport(boolean strictimport) {
this.strictimport = strictimport;
}

/**
@@ -356,16 +354,16 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setStrictprops(String strictprops) {
this.strictprops = Project.toBoolean(strictprops);
public void setStrictprops(boolean strictprops) {
this.strictprops = strictprops;
}


/**
* Whether the compiler should force catching of exceptions by explicitly named types
*/
public void setStrictsignal(String strictsignal) {
this.strictsignal = Project.toBoolean(strictsignal);
public void setStrictsignal(boolean strictsignal) {
this.strictsignal = strictsignal;
}

/**
@@ -373,8 +371,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setSymbols(String symbols) {
this.symbols = Project.toBoolean(symbols);
public void setSymbols(boolean symbols) {
this.symbols = symbols;
}

/**
@@ -382,8 +380,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setTime(String time) {
this.time = Project.toBoolean(time);
public void setTime(boolean time) {
this.time = time;
}

/**
@@ -393,9 +391,9 @@ public class NetRexxC extends MatchingTask {
*/
public void setTrace(String trace) {
if (trace.equalsIgnoreCase("trace")
|| trace.equalsIgnoreCase("trace1")
|| trace.equalsIgnoreCase("trace2")
|| trace.equalsIgnoreCase("notrace")) {
|| trace.equalsIgnoreCase("trace1")
|| trace.equalsIgnoreCase("trace2")
|| trace.equalsIgnoreCase("notrace")) {
this.trace = trace;
} else {
throw new BuildException("Unknown trace value specified: '" + trace + "'");
@@ -407,8 +405,8 @@ public class NetRexxC extends MatchingTask {
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
public void setUtf8(String utf8) {
this.utf8 = Project.toBoolean(utf8);
public void setUtf8(boolean utf8) {
this.utf8 = utf8;
}

/**
@@ -463,7 +461,10 @@ public class NetRexxC extends MatchingTask {
// if it's a source file, see if the destination class file
// needs to be recreated via compilation
if (filename.toLowerCase().endsWith(".nrx")) {
File classFile = new File(destDir, filename.substring(0, filename.lastIndexOf('.')) + ".class");
File classFile =
new File(destDir,
filename.substring(0, filename.lastIndexOf('.')) + ".class");

if (!compile || srcFile.lastModified() > classFile.lastModified()) {
filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
compileList.addElement(destFile.getAbsolutePath());
@@ -492,7 +493,7 @@ public class NetRexxC extends MatchingTask {
project.copyFile(fromFile, toFile);
} catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile
+ " due to " + ioe.getMessage();
+ " due to " + ioe.getMessage();
throw new BuildException(msg, ioe);
}
}
@@ -554,8 +555,8 @@ public class NetRexxC extends MatchingTask {

try {
StringWriter out = new StringWriter();
int rc = COM.ibm.netrexx.process.NetRexxC.main(
new Rexx(compileArgs), new PrintWriter(out));
int rc = COM.ibm.netrexx.process.NetRexxC.
main(new Rexx(compileArgs), new PrintWriter(out));

if (rc > 1) { // 1 is warnings from real NetRexxC
log(out.toString(), Project.MSG_ERR);
@@ -644,7 +645,7 @@ public class NetRexxC extends MatchingTask {
*/
private void addExistingToClasspath(StringBuffer target,String source) {
StringTokenizer tok = new StringTokenizer(source,
System.getProperty("path.separator"), false);
System.getProperty("path.separator"), false);
while (tok.hasMoreTokens()) {
File f = project.resolveFile(tok.nextToken());

@@ -653,7 +654,7 @@ public class NetRexxC extends MatchingTask {
target.append(f.getAbsolutePath());
} else {
log("Dropping from classpath: "+
f.getAbsolutePath(), Project.MSG_VERBOSE);
f.getAbsolutePath(), Project.MSG_VERBOSE);
}
}



+ 17
- 8
src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java View File

@@ -101,8 +101,8 @@ public class RenameExtensions extends MatchingTask {
* store replace attribute - this determines whether the target file
* should be overwritten if present
*/
public void setReplace(String replaceString) {
replace = Project.toBoolean(replaceString);
public void setReplace(boolean replace) {
this.replace = replace;
}

/**
@@ -119,7 +119,8 @@ public class RenameExtensions extends MatchingTask {

// first off, make sure that we've got a from and to extension
if (fromExtension == null || toExtension == null || srcDir == null) {
throw new BuildException("srcDir, fromExtension and toExtension attributes must be set!");
throw new BuildException( "srcDir, fromExtension and toExtension " +
"attributes must be set!" );
}

// scan source and dest dirs to build up rename list
@@ -136,7 +137,10 @@ public class RenameExtensions extends MatchingTask {
fromFile = (File)e.nextElement();
toFile = (File)renameList.get(fromFile);
if (toFile.exists() && replace) toFile.delete();
if (!fromFile.renameTo(toFile)) throw new BuildException("Rename from: '" + fromFile + "' to '" + toFile + "' failed.");
if (!fromFile.renameTo(toFile)) {
throw new BuildException( "Rename from: '" + fromFile + "' to '" +
toFile + "' failed." );
}
}

}
@@ -147,17 +151,22 @@ public class RenameExtensions extends MatchingTask {
String filename = files[i];
// if it's a file that ends in the fromExtension, copy to the rename list
if (filename.toLowerCase().endsWith(fromExtension)) {
File destFile = new File(srcDir, filename.substring(0, filename.lastIndexOf(fromExtension)) + toExtension);
File destFile =
new File( srcDir,
filename.substring(0, filename.lastIndexOf(fromExtension)) +
toExtension );

if (replace || !destFile.exists()) {
list.put(srcFile, destFile);
} else {
log("Rejecting file: '" + srcFile + "' for rename as replace is false and file exists", Project.MSG_VERBOSE);
log( "Rejecting file: '" + srcFile + "' for rename as " +
"replace is false and file exists", Project.MSG_VERBOSE );
}
} else {
log("File '"+ filename + "' doesn't match fromExtension: '" + fromExtension + "'", Project.MSG_VERBOSE);
log( "File '"+ filename + "' doesn't match fromExtension: '" +
fromExtension + "'", Project.MSG_VERBOSE );
}
}
return list;
}

}

+ 1312
- 1302
src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
File diff suppressed because it is too large
View File


Loading…
Cancel
Save