Browse Source

style

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274851 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 22 years ago
parent
commit
410129735b
89 changed files with 347 additions and 476 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/DemuxOutputStream.java
  2. +1
    -2
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  3. +4
    -4
      src/main/org/apache/tools/ant/Main.java
  4. +1
    -2
      src/main/org/apache/tools/ant/filters/TailFilter.java
  5. +1
    -1
      src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
  6. +4
    -4
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java
  7. +1
    -2
      src/main/org/apache/tools/ant/listener/MailLogger.java
  8. +14
    -14
      src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  10. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  12. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
  13. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Expand.java
  14. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  15. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Get.java
  16. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
  17. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  18. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Java.java
  19. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  20. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
  21. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
  22. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  23. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Replace.java
  24. +11
    -18
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  25. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Sequential.java
  26. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Tstamp.java
  27. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/WhichResource.java
  28. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  29. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
  30. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
  31. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
  32. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  33. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
  34. +10
    -11
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
  35. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java
  36. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java
  37. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java
  38. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  39. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java
  40. +5
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java
  41. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetDefine.java
  42. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/ImportTypelib.java
  43. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java
  44. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java
  45. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  46. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  47. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
  48. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java
  49. +12
    -24
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
  50. +5
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java
  51. +16
    -35
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
  52. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  53. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java
  54. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java
  55. +10
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java
  56. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  57. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
  58. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  59. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
  60. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  61. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
  62. +6
    -7
      src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
  63. +8
    -8
      src/main/org/apache/tools/ant/types/Assertions.java
  64. +17
    -17
      src/main/org/apache/tools/ant/types/CommandlineJava.java
  65. +22
    -23
      src/main/org/apache/tools/ant/types/DataType.java
  66. +6
    -6
      src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
  67. +6
    -12
      src/main/org/apache/tools/ant/types/FilterChain.java
  68. +1
    -1
      src/main/org/apache/tools/ant/types/Mapper.java
  69. +1
    -2
      src/main/org/apache/tools/ant/types/Path.java
  70. +3
    -6
      src/main/org/apache/tools/ant/types/PropertySet.java
  71. +10
    -20
      src/main/org/apache/tools/ant/types/XMLCatalog.java
  72. +11
    -23
      src/main/org/apache/tools/ant/types/optional/image/Draw.java
  73. +6
    -12
      src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java
  74. +10
    -21
      src/main/org/apache/tools/ant/types/optional/image/Rotate.java
  75. +2
    -4
      src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java
  76. +6
    -8
      src/main/org/apache/tools/ant/types/resolver/ApacheCatalog.java
  77. +13
    -14
      src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java
  78. +1
    -1
      src/main/org/apache/tools/ant/util/ClasspathUtils.java
  79. +5
    -5
      src/main/org/apache/tools/ant/util/CollectionUtils.java
  80. +4
    -6
      src/main/org/apache/tools/ant/util/DateUtils.java
  81. +1
    -1
      src/main/org/apache/tools/ant/util/JAXPUtils.java
  82. +1
    -1
      src/main/org/apache/tools/ant/util/JavaEnvUtils.java
  83. +1
    -1
      src/main/org/apache/tools/ant/util/KeepAliveOutputStream.java
  84. +4
    -4
      src/main/org/apache/tools/ant/util/LazyHashtable.java
  85. +5
    -5
      src/main/org/apache/tools/ant/util/StringUtils.java
  86. +7
    -14
      src/main/org/apache/tools/ant/util/TaskLogger.java
  87. +1
    -1
      src/main/org/apache/tools/ant/util/WeakishReference.java
  88. +7
    -10
      src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java
  89. +1
    -1
      src/main/org/apache/tools/mail/MailMessage.java

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

@@ -259,7 +259,7 @@ public class DemuxOutputStream extends OutputStream {
if (blockLength > 0) {
bufferInfo.buffer.write(b, blockStartOffset, blockLength);
}
while(remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) {
while (remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) {
write(b[offset]);
offset++;
remaining--;


+ 1
- 2
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -417,8 +417,7 @@ public class IntrospectionHelper implements BuildListener {
*
* @return a helper for the specified class
*/
public static synchronized IntrospectionHelper getHelper(Project p, Class c)
{
public static synchronized IntrospectionHelper getHelper(Project p, Class c) {
IntrospectionHelper ih = (IntrospectionHelper) helpers.get(c);
if (ih == null) {
ih = new IntrospectionHelper(c);


+ 4
- 4
src/main/org/apache/tools/ant/Main.java View File

@@ -309,7 +309,7 @@ public class Main implements AntMain {
} else if (arg.equals("-version")) {
printVersion();
return;
} else if (arg.equals("-diagnostics")){
} else if (arg.equals("-diagnostics")) {
Diagnostics.doReport(System.out);
return;
} else if (arg.equals("-quiet") || arg.equals("-q")) {
@@ -482,7 +482,7 @@ public class Main implements AntMain {
if (fis != null) {
try {
fis.close();
} catch (IOException e){
} catch (IOException e) {
}
}
}
@@ -606,7 +606,7 @@ public class Main implements AntMain {
// only in JDK > 1.1
SecurityManager oldsm = null;
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_0) &&
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)){
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
oldsm = System.getSecurityManager();

//SecurityManager can not be installed here for backwards
@@ -660,7 +660,7 @@ public class Main implements AntMain {
} finally {
// put back the original security manager
//The following will never eval to true. (PD)
if (oldsm != null){
if (oldsm != null) {
System.setSecurityManager(oldsm);
}



+ 1
- 2
src/main/org/apache/tools/ant/filters/TailFilter.java View File

@@ -252,8 +252,7 @@ public final class TailFilter
if (lineList.size() > skip) {
return (String) lineList.removeFirst();
}
}
else {
} else {
long linesToKeep = lines + (skip > 0 ? skip : 0);
if (linesToKeep < lineList.size()) {
lineList.removeFirst();


+ 1
- 1
src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java View File

@@ -194,7 +194,7 @@ public final class ChainReaderHelper {
break;
}
}
if ( !consPresent ) {
if ( !consPresent) {
throw new BuildException( className +
" does not define a public constructor" +
" that takes in a Reader as its single argument.");


+ 4
- 4
src/main/org/apache/tools/ant/helper/ProjectHelper2.java View File

@@ -145,9 +145,9 @@ public class ProjectHelper2 extends ProjectHelper {

if (source instanceof File) {
buildFile = (File) source;
// } else if (source instanceof InputStream ) {
// } else if (source instanceof URL ) {
// } else if (source instanceof InputSource ) {
// } else if (source instanceof InputStream) {
// } else if (source instanceof URL) {
// } else if (source instanceof InputSource) {
} else {
throw new BuildException("Source " + source.getClass().getName() +
" not supported by this plugin");
@@ -432,7 +432,7 @@ public class ProjectHelper2 extends ProjectHelper {
if (qname.equals("project")) {
return ProjectHelper2.projectHandler;
} else {
// if (context.importlevel > 0 ) {
// if (context.importlevel > 0) {
// // we are in an imported file. Allow top-level <target>.
// if (qname.equals( "target" ) )
// return ProjectHelper2.targetHandler;


+ 1
- 2
src/main/org/apache/tools/ant/listener/MailLogger.java View File

@@ -166,8 +166,7 @@ public class MailLogger extends DefaultLogger {
(success) ? "Build Success" : "Build Failure");
if (user.equals("") && password.equals("") && !ssl) {
sendMail(mailhost, port, from, replytoList, toList, subject, buffer.substring(0));
}
else {
} else {
sendMimeMail(event.getProject(), mailhost, port, user, password, ssl, from, replytoList, toList, subject, buffer.substring(0));
}
} catch (Exception e) {


+ 14
- 14
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java View File

@@ -283,7 +283,7 @@ public abstract class AbstractCvsTask extends Task {
System.getProperty("user.home"))
+ File.separatorChar + ".cvspass");

if(defaultPassFile.exists()) {
if (defaultPassFile.exists()) {
this.setPassfile(defaultPassFile);
}
}
@@ -411,7 +411,7 @@ public abstract class AbstractCvsTask extends Task {
}
}

private String executeToString(Execute execute){
private String executeToString(Execute execute) {

StringBuffer stringBuffer =
new StringBuffer(Commandline.describeCommand(execute
@@ -425,7 +425,7 @@ public abstract class AbstractCvsTask extends Task {
stringBuffer.append(newLine);
stringBuffer.append("environment:");
stringBuffer.append(newLine);
for (int z = 0; z < variableArray.length; z++){
for (int z = 0; z < variableArray.length; z++) {
stringBuffer.append(newLine);
stringBuffer.append("\t");
stringBuffer.append(variableArray[z]);
@@ -452,7 +452,7 @@ public abstract class AbstractCvsTask extends Task {
this.cvsRoot = root;
}

public String getCvsRoot(){
public String getCvsRoot() {

return this.cvsRoot;
}
@@ -473,7 +473,7 @@ public abstract class AbstractCvsTask extends Task {
this.cvsRsh = rsh;
}

public String getCvsRsh(){
public String getCvsRsh() {

return this.cvsRsh;
}
@@ -483,11 +483,11 @@ public abstract class AbstractCvsTask extends Task {
*
* @param port
*/
public void setPort(int port){
public void setPort(int port) {
this.port = port;
}

public int getPort(){
public int getPort() {

return this.port;
}
@@ -497,11 +497,11 @@ public abstract class AbstractCvsTask extends Task {
*
* @param passFile
*/
public void setPassfile(File passFile){
public void setPassfile(File passFile) {
this.passFile = passFile;
}

public File getPassFile(){
public File getPassFile() {

return this.passFile;
}
@@ -515,7 +515,7 @@ public abstract class AbstractCvsTask extends Task {
this.dest = dest;
}

public File getDest(){
public File getDest() {

return this.dest;
}
@@ -529,7 +529,7 @@ public abstract class AbstractCvsTask extends Task {
this.cvsPackage = p;
}

public String getPackage(){
public String getPackage() {

return this.cvsPackage;
}
@@ -550,11 +550,11 @@ public abstract class AbstractCvsTask extends Task {
* This needs to be public to allow configuration
* of commands externally.
*/
public void addCommandArgument(String arg){
public void addCommandArgument(String arg) {
this.addCommandArgument(cmd, arg);
}

public void addCommandArgument(Commandline c, String arg){
public void addCommandArgument(Commandline c, String arg) {
c.createArgument().setValue(arg);
}

@@ -619,7 +619,7 @@ public abstract class AbstractCvsTask extends Task {
* Whether to append output/error when redirecting to a file.
* @param value
*/
public void setAppend(boolean value){
public void setAppend(boolean value) {
this.append = value;
}



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

@@ -542,7 +542,7 @@ public class Ant extends Task {

String value = props.get(key).toString();
// don't re-set user properties, avoid the warning message
if (newProject.getProperty(key) == null){
if (newProject.getProperty(key) == null) {
// no user property
newProject.setNewProperty(key, value);
}


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

@@ -106,7 +106,7 @@ public class Exec extends Task {
// test if os match
String myos = System.getProperty("os.name");
log("Myos = " + myos, Project.MSG_VERBOSE);
if ((os != null) && (os.indexOf(myos) < 0)){
if ((os != null) && (os.indexOf(myos) < 0)) {
// this command will be executed only on the specified OS
log("Not found in " + os, Project.MSG_VERBOSE);
return 0;


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

@@ -359,7 +359,7 @@ public class ExecTask extends Task {
// test if os match
String myos = System.getProperty("os.name");
log("Current OS is " + myos, Project.MSG_VERBOSE);
if ((os != null) && (os.indexOf(myos) < 0)){
if ((os != null) && (os.indexOf(myos) < 0)) {
// this command will be executed only on the specified OS
log("This OS, " + myos
+ " was not found in the specified list of valid OSes: " + os,


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

@@ -66,7 +66,7 @@ import org.apache.tools.ant.util.Watchdog;
* Execute exec = new Execute(myloghandler, watchdog);
* exec.setCommandLine(mycmdline);
* int exitvalue = exec.execute();
* if (exitvalue != SUCCESS && watchdog.killedProcess()){
* if (exitvalue != SUCCESS && watchdog.killedProcess()) {
* // it was killed on purpose by the watchdog
* }
* </pre>
@@ -156,7 +156,7 @@ public class ExecuteWatchdog implements TimeoutObserver {
} catch (IllegalThreadStateException itse) {
// the process is not terminated, if this is really
// a timeout and not a manual stop then kill it.
if (watch){
if (watch) {
killedProcess = true;
process.destroy();
}
@@ -196,7 +196,7 @@ public class ExecuteWatchdog implements TimeoutObserver {
* @return <tt>true</tt> if the process is still running, otherwise
* <tt>false</tt>.
*/
public boolean isWatching(){
public boolean isWatching() {
return watch;
}

@@ -205,7 +205,7 @@ public class ExecuteWatchdog implements TimeoutObserver {
* @return <tt>true</tt> if the process was killed otherwise
* <tt>false</tt>.
*/
public boolean killedProcess(){
public boolean killedProcess() {
return killedProcess;
}
}


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

@@ -247,7 +247,7 @@ public class Expand extends Task {
Project.MSG_VERBOSE);
// create intermediary directories - sometimes zip don't add them
File dirF = fileUtils.getParentFile(f);
if ( dirF != null ) {
if ( dirF != null) {
dirF.mkdirs();
}



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

@@ -528,7 +528,7 @@ public class FixCRLF extends MatchingTask {
// Handle CTRLZ
if (ctrlz == ASIS) {
outWriter.write(lines.getEofStr());
} else if (ctrlz == ADD){
} else if (ctrlz == ADD) {
outWriter.write(CTRLZ);
}
} catch (IOException e) {


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

@@ -179,7 +179,7 @@ public class Get extends Task {
if (httpConnection.getResponseCode()
== HttpURLConnection.HTTP_UNAUTHORIZED) {
String message="HTTP Authorization failure";
if(ignoreErrors) {
if (ignoreErrors) {
log(message,Project.MSG_WARN);
return;
} else {


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

@@ -90,7 +90,7 @@ public class SQLExampleTask extends JDBCTask {
Connection conn = getConnection();
Statement stmt=null;
try {
if (tableName == null ) {
if (tableName == null) {
throw new BuildException("TableName must be specified",location);
}
String sql = "SELECT * FROM "+tableName;
@@ -103,10 +103,10 @@ public class SQLExampleTask extends JDBCTask {

} finally {
if (stmt != null) {
try {stmt.close();}catch (SQLException ingore){}
try {stmt.close();}catch (SQLException ingore) {}
}
if (conn != null) {
try {conn.close();}catch (SQLException ingore){}
try {conn.close();}catch (SQLException ingore) {}
}
}
}


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

@@ -184,7 +184,7 @@ public class Jar extends Zip {
* Set whether or not to create an index list for classes.
* This may speed up classloading in some cases.
*/
public void setIndex(boolean flag){
public void setIndex(boolean flag) {
index = flag;
}

@@ -456,7 +456,7 @@ public class Jar extends Zip {
// @fixme do we need to check for directories starting by ./ ?
dir = dir.replace('\\', '/');
int pos = dir.lastIndexOf('/');
if (pos != -1){
if (pos != -1) {
dir = dir.substring(0, pos);
}



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

@@ -127,7 +127,7 @@ public class Java extends Task {
throw new BuildException("Classname must not be null.");
}

if (!fork && cmdl.getJar() != null){
if (!fork && cmdl.getJar() != null) {
throw new BuildException("Cannot execute a jar in non-forked mode."
+ " Please set fork='true'. ");
}
@@ -221,7 +221,7 @@ public class Java extends Task {
* The location of the JAR file to execute.
*/
public void setJar(File jarfile) throws BuildException {
if (cmdl.getClassname() != null){
if (cmdl.getClassname() != null) {
throw new BuildException("Cannot use 'jar' and 'classname' "
+ "attributes in same command.");
}
@@ -232,7 +232,7 @@ public class Java extends Task {
* Sets the Java class to execute.
*/
public void setClassname(String s) throws BuildException {
if (cmdl.getJar() != null){
if (cmdl.getJar() != null) {
throw new BuildException("Cannot use 'jar' and 'classname' "
+ "attributes in same command");
}
@@ -403,7 +403,7 @@ public class Java extends Task {
/**
* Corresponds to -mx or -Xmx depending on VM version.
*/
public void setMaxmemory(String max){
public void setMaxmemory(String max) {
cmdl.setMaxmemory(max);
}



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

@@ -512,7 +512,7 @@ public class Javadoc extends Task {
* @param max a string indicating the maximum memory according to the
* JVM conventions (e.g. 128m is 128 Megabytes)
*/
public void setMaxmemory(String max){
public void setMaxmemory(String max) {
if (javadoc1) {
cmd.createArgument().setValue("-J-mx" + max);
} else {
@@ -525,7 +525,7 @@ public class Javadoc extends Task {
*
* @param add the additional command line parameter for the javadoc task.
*/
public void setAdditionalparam(String add){
public void setAdditionalparam(String add) {
cmd.createArgument().setLine(add);
}



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

@@ -168,7 +168,7 @@ public final class LoadProperties extends Task {
}

ByteArrayInputStream tis = null;
if ( encoding == null ) {
if ( encoding == null) {
tis = new ByteArrayInputStream(text.getBytes());
} else {
tis = new ByteArrayInputStream(text.getBytes(encoding));


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

@@ -177,7 +177,7 @@ public class LogOutputStream extends OutputStream {
if (blockLength > 0) {
buffer.write(b, blockStartOffset, blockLength);
}
while(remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) {
while (remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) {
write(b[offset]);
offset++;
remaining--;


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

@@ -419,12 +419,12 @@ public class PathConvert extends Task {
// Place the result into the specified property,
// unless setonempty == false
String value = rslt.toString();
if(setonempty) {
if (setonempty) {
log("Set property " + property + " = " + value,
Project.MSG_VERBOSE);
getProject().setNewProperty(property, value);
} else {
if(rslt.length() > 0) {
if (rslt.length() > 0) {
log("Set property " + property + " = " + value,
Project.MSG_VERBOSE);
getProject().setNewProperty(property, value);


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

@@ -263,7 +263,7 @@ public class Replace extends MatchingTask {
if (replaceFilterFile != null) {
Properties props = getProperties(replaceFilterFile);
Enumeration enum = props.keys();
while (enum.hasMoreElements()){
while (enum.hasMoreElements()) {
String token = enum.nextElement().toString();
Replacefilter replaceFilter = createReplacefilter();
replaceFilter.setToken(token);


+ 11
- 18
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -420,14 +420,14 @@ public class SQLExec extends JDBCTask {
out.close();
}
}
} catch (IOException e){
} catch (IOException e) {
if (!isAutocommit() && conn != null && onError.equals("abort")) {
try {
conn.rollback();
} catch (SQLException ex) {}
}
throw new BuildException(e, location);
} catch (SQLException e){
} catch (SQLException e) {
if (!isAutocommit() && conn != null && onError.equals("abort")) {
try {
conn.rollback();
@@ -463,7 +463,7 @@ public class SQLExec extends JDBCTask {

BufferedReader in = new BufferedReader(reader);

while ((line = in.readLine()) != null){
while ((line = in.readLine()) != null) {
if (!keepformat) {
line = line.trim();
}
@@ -509,7 +509,7 @@ public class SQLExec extends JDBCTask {
}
}
// Catch any statements not followed by ;
if (!sql.equals("")){
if (!sql.equals("")) {
execSQL(sql.toString(), out);
}
}
@@ -535,19 +535,13 @@ public class SQLExec extends JDBCTask {
ret = statement.execute(sql);
updateCount = statement.getUpdateCount();
resultSet = statement.getResultSet();
do
{
if (!ret)
{
if (updateCount != -1)
{
do {
if (!ret) {
if (updateCount != -1) {
updateCountTotal += updateCount;
}
}
else
{
if (print)
{
} else {
if (print) {
printResults(out);
}
}
@@ -559,15 +553,14 @@ public class SQLExec extends JDBCTask {
log(updateCountTotal + " rows affected",
Project.MSG_VERBOSE);

if (print)
{
if (print) {
StringBuffer line = new StringBuffer();
line.append(updateCountTotal + " rows affected");
out.println(line);
}

SQLWarning warning = conn.getWarnings();
while (warning != null){
while (warning != null) {
log(warning + " sql warning", Project.MSG_VERBOSE);
warning = warning.getNextWarning();
}


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

@@ -64,8 +64,7 @@ import org.apache.tools.ant.TaskContainer;
/**
* Sequential is a container task - it can contain other Ant tasks. The nested
* tasks are simply executed in sequence. Sequential's primary use is to support
* the sequential execution of a subset of tasks within the
{@link Parallel Parallel Task}
* the sequential execution of a subset of tasks within the {@link Parallel Parallel Task}

* <p>
* The sequential task has no attributes and does not support any nested


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

@@ -227,7 +227,7 @@ public class Tstamp extends Task {
* @param id
* @see java.util.TimeZone
*/
public void setTimezone(String id){
public void setTimezone(String id) {
timeZone = TimeZone.getTimeZone(id);
}

@@ -308,7 +308,7 @@ public class Tstamp extends Task {
calendar.add(field, offset);
date = calendar.getTime();
}
if (timeZone != null){
if (timeZone != null) {
sdf.setTimeZone(timeZone);
}
Tstamp.this.setProperty(propertyName, sdf.format(date));


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

@@ -121,15 +121,15 @@ public class WhichResource extends Task {
*/
private void validate() {
int setcount=0;
if(classname != null) {
if (classname != null) {
setcount++;
}
if(resource!=null) {
if (resource!=null) {
setcount++;
}


if(setcount == 0) {
if (setcount == 0) {
throw new BuildException(
"One of classname or resource must be specified");
}
@@ -137,7 +137,7 @@ public class WhichResource extends Task {
throw new BuildException(
"Only one of classname or resource can be specified");
}
if(property==null) {
if (property==null) {
throw new BuildException("No property defined");
}
}
@@ -162,19 +162,19 @@ public class WhichResource extends Task {
getProject(),
classpath, false);
String location=null;
if(classname!=null) {
if (classname!=null) {
//convert a class name into a resource
classname= classname.replace('.', '/');
resource="/"+ classname +".class";
} else {
if(!resource.startsWith("/")) {
if (!resource.startsWith("/")) {
resource="/"+resource;
}
}
log("Searching for "+resource,Project.MSG_VERBOSE);
URL url;
url=loader.getResource(resource);
if(url!=null) {
if (url!=null) {
//set the property
location = url.toExternalForm();
getProject().setNewProperty(property,location);


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

@@ -266,7 +266,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
if (performDirectoryScan) {
// Process all the directories marked for styling
dirs = scanner.getIncludedDirectories();
for (int j = 0; j < dirs.length; ++j){
for (int j = 0; j < dirs.length; ++j) {
list = new File(baseDir, dirs[j]).list();
for (int i = 0; i < list.length; ++i) {
process(baseDir, list[i], destDir, stylesheet);
@@ -432,7 +432,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param outFile the output File instance.
*/
public void setOut(File outFile){
public void setOut(File outFile) {
this.outFile = outFile;
}

@@ -442,7 +442,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param inFile the input file
*/
public void setIn(File inFile){
public void setIn(File inFile) {
this.inFile = inFile;
}

@@ -618,7 +618,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param name the name of the parameter.
*/
public void setName(String name){
public void setName(String name) {
this.name = name;
}

@@ -628,7 +628,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param expression the XSL expression representing the
* parameter's value.
*/
public void setExpression(String expression){
public void setExpression(String expression) {
this.expression = expression;
}

@@ -759,7 +759,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* like the exact copy of JAXP interface..
* @param liaison the TRaXLiaison to configure.
*/
protected void configureTraXLiaison(TraXLiaison liaison){
protected void configureTraXLiaison(TraXLiaison liaison) {
if (factory != null) {
liaison.setFactory(factory.getName());

@@ -887,7 +887,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
// a value must be of a given type
// say boolean|integer|string that are mostly used.
if ("true".equalsIgnoreCase(value)
|| "false".equalsIgnoreCase(value) ){
|| "false".equalsIgnoreCase(value) ) {
this.value = new Boolean(value);
} else {
try {


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

@@ -262,11 +262,11 @@ class ChangeLogParser {
return null;
}
}
/**
* reset all internal attributes except status.
*/
private void reset(){
private void reset() {
m_file = null;
m_date = null;
m_author = null;


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java View File

@@ -103,8 +103,7 @@ public class EmailTask
* @return a list of valid entries
*/
public String[] getValues() {
return new String[]
{AUTO, MIME, UU, PLAIN};
return new String[] {AUTO, MIME, UU, PLAIN};
}
}

@@ -605,7 +604,7 @@ public class EmailTask
throw e;
}
}
catch(Exception e){
catch (Exception e) {
log("Failed to send email", Project.MSG_WARN);
if (failOnError) {
throw new BuildException(e);


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

@@ -273,7 +273,7 @@ public class EchoProperties extends Task {
Properties props = new Properties();
props.load(in);
CollectionUtils.putAll(allProps, props);
} catch(FileNotFoundException fnfe) {
} catch (FileNotFoundException fnfe) {
String message =
"Could not find file " + inFile.getAbsolutePath();
if (failonerror) {
@@ -282,7 +282,7 @@ public class EchoProperties extends Task {
log(message, Project.MSG_WARN);
}
return;
} catch(IOException ioe) {
} catch (IOException ioe) {
String message =
"Could not read file " + inFile.getAbsolutePath();
if (failonerror) {
@@ -293,10 +293,10 @@ public class EchoProperties extends Task {
return;
} finally {
try {
if(null != in) {
if (null != in) {
in.close();
}
} catch(IOException ioe) {}
} catch (IOException ioe) {}
}
}

@@ -389,7 +389,7 @@ public class EchoProperties extends Task {
// output properties
String name;
Enumeration e = props.propertyNames();
while(e.hasMoreElements()) {
while (e.hasMoreElements()) {
name = (String)e.nextElement();
Element propElement = doc.createElement(PROPERTY);
propElement.setAttribute(ATTR_NAME, name);
@@ -403,10 +403,10 @@ public class EchoProperties extends Task {
wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
(new DOMElementWriter()).write(rootElement, wri, 0, "\t");
wri.flush();
} catch(IOException ioe) {
} catch (IOException ioe) {
throw new BuildException("Unable to write XML file", ioe);
} finally {
if(wri != null) {
if (wri != null) {
wri.close();
}
}
@@ -476,7 +476,7 @@ public class EchoProperties extends Task {
private static DocumentBuilder getDocumentBuilder() {
try {
return DocumentBuilderFactory.newInstance().newDocumentBuilder();
} catch(Exception e) {
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
}


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

@@ -344,7 +344,7 @@ public class Javah extends Task {
try {
// first search for the "old" javah class in 1.4.2 tools.jar
javahMainClass = Class.forName("com.sun.tools.javah.oldjavah.Main");
} catch(ClassNotFoundException cnfe) {
} catch (ClassNotFoundException cnfe) {
// assume older than 1.4.2 tools.jar
javahMainClass = Class.forName("com.sun.tools.javah.Main");
}


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java View File

@@ -371,8 +371,7 @@ public class ReplaceRegExp extends Task {
// first CR in this line
hasCR = true;
}
}
else if (c == '\n') {
} else if (c == '\n') {
// LF -> EOL
line = linebuf.toString();
res = doReplace(regex, subs, line, options);


+ 10
- 11
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java View File

@@ -74,7 +74,7 @@ public class CCMCheck extends Continuus {
private File file = null;
private String comment = null;
private String task = null;
protected Vector filesets = new Vector();

public CCMCheck() {
@@ -158,16 +158,16 @@ public class CCMCheck extends Continuus {
if (file != null && file.exists() && file.isDirectory()) {
throw new BuildException("CCMCheck cannot be generated for directories");
}
if (file != null && filesets.size() > 0) {
throw new BuildException("Choose between file and fileset !");
}

if ( getFile() !=null ) {
if ( getFile() !=null) {
doit();
return ;
}
int sizeofFileSet = filesets.size();
for (int i = 0; i < sizeofFileSet; i++) {
FileSet fs = (FileSet) filesets.elementAt(i);
@@ -180,12 +180,11 @@ public class CCMCheck extends Continuus {
}
}
}
/**
* check the file given by getFile().
*/
private void doit()
{
private void doit() {
Commandline commandLine = new Commandline();

// build the command line from what we got the format is
@@ -194,9 +193,9 @@ public class CCMCheck extends Continuus {

commandLine.setExecutable(getCcmCommand());
commandLine.createArgument().setValue(getCcmAction());
checkOptions(commandLine);
int result = run(commandLine);
if (result != 0) {
String msg = "Failed executing: " + commandLine.toString();
@@ -217,11 +216,11 @@ public class CCMCheck extends Continuus {
if (getTask() != null) {
cmd.createArgument().setValue(FLAG_TASK);
cmd.createArgument().setValue(getTask());
}
}

if (getFile() != null) {
cmd.createArgument().setValue(file.getAbsolutePath());
}
}
}

/**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java View File

@@ -150,7 +150,7 @@ public class CCMklabel extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if ( result != 0 ) {
if ( result != 0) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java View File

@@ -152,7 +152,7 @@ public class CCMklbtype extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if ( result != 0 ) {
if ( result != 0) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java View File

@@ -150,7 +150,7 @@ public class CCRmtype extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if ( result != 0 ) {
if ( result != 0) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java View File

@@ -392,7 +392,7 @@ public class CSharp extends DotnetCompile {
protected String getDefinitionsParameter() {
String predecessors=super.getDefinitionsParameter();
if (notEmpty(definitions)) {
if(predecessors==null) {
if (predecessors==null) {
predecessors= "/define:";
}
return predecessors+ definitions;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java View File

@@ -134,7 +134,7 @@ public class DotnetBaseMatchingTask extends MatchingTask {
protected int buildFileList(NetCommand command, Hashtable filesToBuild, long outputTimestamp) {
int filesOutOfDate=0;
boolean scanImplicitFileset=getSrcDir()!=null || filesets.size()==0;
if(scanImplicitFileset) {
if (scanImplicitFileset) {
//scan for an implicit fileset if there was a srcdir set
//or there was no srcDir set but the @
if (getSrcDir() == null) {


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

@@ -168,8 +168,7 @@ public abstract class DotnetCompile
* need to reference mscorlib.dll, cos it is always there
*/

protected static final String[] DEFAULT_REFERENCE_LIST_DOTNET_10 =
{"Accessibility.dll",
protected static final String[] DEFAULT_REFERENCE_LIST_DOTNET_10 = {"Accessibility.dll",
"cscompmgd.dll",
"CustomMarshalers.dll",
"Mscorcfg.dll",
@@ -712,13 +711,13 @@ public abstract class DotnetCompile
while (defEnum.hasMoreElements()) {
//loop through all definitions
DotnetDefine define = (DotnetDefine) defEnum.nextElement();
if(define.isSet(this)) {
if (define.isSet(this)) {
//add those that are set, and a delimiter
defines.append(define.getValue(this));
defines.append(getDefinitionsDelimiter());
}
}
if(defines.length()==0) {
if (defines.length()==0) {
return null;
} else {
return "/D:"+defines;
@@ -937,7 +936,7 @@ public abstract class DotnetCompile
outputTimestamp);
}
//bail out early if there were no files
if(filesToBuild.size()==0) {
if (filesToBuild.size()==0) {
return 0;
}
StringBuffer referenceList= new StringBuffer(REFERENCE_OPTION);
@@ -945,7 +944,7 @@ public abstract class DotnetCompile
Enumeration files = filesToBuild.elements();
while (files.hasMoreElements()) {
File file = (File) files.nextElement();
if(isFileManagedBinary(file)) {
if (isFileManagedBinary(file)) {
referenceList.append(file.toString());
referenceList.append(getReferenceDelimiter());
} else {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetDefine.java View File

@@ -106,11 +106,11 @@ public class DotnetDefine {
* @throws BuildException
*/
public String getValue(Task owner) throws BuildException {
if(name==null) {
if (name==null) {
throw new BuildException("No name provided for the define element",
owner.getLocation());
}
if(!isSet(owner)) {
if (!isSet(owner)) {
return null;
}
return name;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/ImportTypelib.java View File

@@ -170,7 +170,7 @@ public class ImportTypelib extends Task {
throw new BuildException(
"source file is a directory");
}
if(namespace==null) {
if (namespace==null) {
throw new BuildException("No namespace");
}
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java View File

@@ -364,7 +364,7 @@ public class VisualBasicCompile extends DotnetCompile {
protected void validate()
throws BuildException {
super.validate();
if(getDestFile()==null) {
if (getDestFile()==null) {
throw new BuildException("DestFile was not specified");
}
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java View File

@@ -239,7 +239,7 @@ public class WsdlToDotnet extends Task {

//set source and rebuild options
boolean rebuild = true;
if(srcFile!=null) {
if (srcFile!=null) {
command.addArgument(srcFile.toString());
//rebuild unless the dest file is newer than the source file
if (srcFile.exists() && destFile.exists() &&


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -106,8 +106,7 @@ import org.apache.tools.ant.types.Path;
* @author <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Moussaud</a>
*
*/
public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler
{
public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler {
public static final String PUBLICID_BORLAND_EJB
= "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN";

@@ -295,7 +294,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe
verifyBorlandJarV4(sourceJar);
return ;
}
if ( version == BES ) {
if ( version == BES) {
verifyBorlandJarV5(sourceJar);
return;
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java View File

@@ -246,7 +246,7 @@ public class BorlandGenerateClient extends Task {
if ( version == BorlandDeploymentTool.BAS) {
executeForkV4();
}
if ( version == BorlandDeploymentTool.BES ) {
if ( version == BorlandDeploymentTool.BES) {
executeForkV5();
}
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java View File

@@ -505,7 +505,7 @@ public class EjbJar extends MatchingTask {
* Initially, only the JBoss implementation does something specific for CMP 2.0.<br/>
* @since ant 1.6
*/
public void setCmpversion( CMPVersion version ) {
public void setCmpversion( CMPVersion version) {
this.cmpVersion = version.getValue();
}



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java View File

@@ -97,7 +97,7 @@ public class JbossDeploymentTool extends GenericDeploymentTool {
return;
}
String descriptorFileName = JBOSS_CMP10D;
if ( EjbJar.CMPVersion.CMP2_0.equals( getParent().getCmpversion() ) ) {
if ( EjbJar.CMPVersion.CMP2_0.equals( getParent().getCmpversion() )) {
descriptorFileName = JBOSS_CMP20D;
}
File jbossCMPD = new File(getConfig().descriptorDir, ddPrefix + descriptorFileName);


+ 12
- 24
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java View File

@@ -69,50 +69,42 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
* @version $Revision$ $Date$
*/
public class AntResolver
implements ExtensionResolver
{
implements ExtensionResolver {
private File m_antfile;
private File m_destfile;
private String m_target;

public void setAntfile( File antfile )
{
public void setAntfile( File antfile) {
m_antfile = antfile;
}

public void setDestfile( File destfile )
{
public void setDestfile( File destfile) {
m_destfile = destfile;
}

public void setTarget( final String target )
{
public void setTarget( final String target) {
m_target = target;
}

public File resolve( final Extension extension,
final Project project )
throws BuildException
{
throws BuildException {
validate();

final Ant ant = (Ant)project.createTask( "ant" );
ant.setInheritAll( false );
ant.setAntfile( m_antfile.getName() );

try
{
try {
final File dir =
m_antfile.getParentFile().getCanonicalFile();
ant.setDir( dir );
}
catch( final IOException ioe )
{
catch ( final IOException ioe) {
throw new BuildException( ioe.getMessage(), ioe );
}

if( null != m_target )
{
if (null != m_target) {
ant.setTarget( m_target );
}

@@ -121,23 +113,19 @@ public class AntResolver
return m_destfile;
}

private void validate()
{
if( null == m_antfile )
{
private void validate() {
if (null == m_antfile) {
final String message = "Must specify Buildfile";
throw new BuildException( message );
}

if( null == m_destfile )
{
if (null == m_destfile) {
final String message = "Must specify destination file";
throw new BuildException( message );
}
}

public String toString()
{
public String toString() {
return "Ant[" + m_antfile + "==>" + m_destfile + "]";
}
}

+ 5
- 10
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java View File

@@ -67,21 +67,17 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
* @version $Revision$ $Date$
*/
public class LocationResolver
implements ExtensionResolver
{
implements ExtensionResolver {
private String m_location;

public void setLocation( final String location )
{
public void setLocation( final String location) {
m_location = location;
}

public File resolve( final Extension extension,
final Project project )
throws BuildException
{
if( null == m_location )
{
throws BuildException {
if (null == m_location) {
final String message = "No location specified for resolver";
throw new BuildException( message );
}
@@ -89,8 +85,7 @@ public class LocationResolver
return project.resolveFile( m_location );
}

public String toString()
{
public String toString() {
return "Location[" + m_location + "]";
}
}

+ 16
- 35
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java View File

@@ -69,31 +69,26 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
* @version $Revision$ $Date$
*/
public class URLResolver
implements ExtensionResolver
{
implements ExtensionResolver {
private File m_destfile;
private File m_destdir;
private URL m_url;

public void setUrl( final URL url )
{
public void setUrl( final URL url) {
m_url = url;
}

public void setDestfile( final File destfile )
{
public void setDestfile( final File destfile) {
m_destfile = destfile;
}

public void setDestdir( final File destdir )
{
public void setDestdir( final File destdir) {
m_destdir = destdir;
}

public File resolve( final Extension extension,
final Project project )
throws BuildException
{
throws BuildException {
validate();

final File file = getDest();
@@ -106,25 +101,17 @@ public class URLResolver
return file;
}

private File getDest()
{
if( null != m_destfile )
{
private File getDest() {
if (null != m_destfile) {
return m_destfile;
}
else
{
} else {
final String file = m_url.getFile();
String filename = null;
if( null == file || file.length() <= 1 )
{
if (null == file || file.length() <= 1) {
filename = "default.file";
}
else
{
} else {
int index = file.lastIndexOf( '/' );
if( -1 == index )
{
if (-1 == index) {
index = 0;
}
filename = file.substring( index );
@@ -134,28 +121,22 @@ public class URLResolver
}
}

private void validate()
{
if( null == m_url )
{
private void validate() {
if (null == m_url) {
final String message = "Must specify URL";
throw new BuildException( message );
}

if( null == m_destdir && null == m_destfile )
{
if (null == m_destdir && null == m_destfile) {
final String message = "Must specify destination file or directory";
throw new BuildException( message );
}
else if( null != m_destdir && null != m_destfile )
{
} else if (null != m_destdir && null != m_destfile) {
final String message = "Must not specify both destination file or directory";
throw new BuildException( message );
}
}

public String toString()
{
public String toString() {
return "URL[" + m_url + "]";
}
}

+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java View File

@@ -548,8 +548,7 @@ public class Translate extends MatchingTask {
// If there is a white space or = or :, then
// it isn't to be treated as a valid key.
boolean validToken = true;
for (int k = 0; k < token.length() && validToken; k++)
{
for (int k = 0; k < token.length() && validToken; k++) {
char c = token.charAt(k);
if (c == ':' || c == '='
|| Character.isSpaceChar(c)) {


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java View File

@@ -88,8 +88,7 @@ import org.apache.tools.ant.DirectoryScanner;
class VAJWorkspaceScanner extends DirectoryScanner {

// Patterns that should be excluded by default.
private static final String[] DEFAULTEXCLUDES =
{
private static final String[] DEFAULTEXCLUDES = {
"IBM*/**",
"Java class libraries/**",
"Sun class libraries*/**",


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java View File

@@ -89,8 +89,7 @@ public class JonasHotDeploymentTool extends GenericHotDeploymentTool implements
/**
* All the valid actions that weblogic.deploy permits *
*/
private static final String[] VALID_ACTIONS =
{ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE};
private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE};

/**
* Description of the Field


+ 10
- 12
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java View File

@@ -72,14 +72,12 @@ import org.apache.tools.ant.taskdefs.Java;
* @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool
* @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy
*/
public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool implements HotDeploymentTool
{
public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool implements HotDeploymentTool {
/** The classname of the tool to run **/
private static final String WEBLOGIC_DEPLOY_CLASS_NAME = "weblogic.deploy";

/** All the valid actions that weblogic.deploy permits **/
private static final String[] VALID_ACTIONS =
{ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE};
private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE};

/** Represents the "-debug" flag from weblogic.deploy **/
private boolean debug;
@@ -126,21 +124,21 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme
throw new BuildException("The password attribute must be set.");

// check for missing application on deploy & update
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE))
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE))
&& application == null)
throw new BuildException("The application attribute must be set "
throw new BuildException("The application attribute must be set "
+ "if action = " + action);

// check for missing source on deploy & update
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE))
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE))
&& getTask().getSource() == null)
throw new BuildException("The source attribute must be set if "
throw new BuildException("The source attribute must be set if "
+ "action = " + action);

// check for missing application on delete & undeploy
if ((action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY))
if ((action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY))
&& application == null)
throw new BuildException("The application attribute must be set if "
throw new BuildException("The application attribute must be set if "
+ "action = " + action);
}

@@ -221,7 +219,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme
if (component != null) {
args = "-component " + component + " " + args;
}
return args;
}

@@ -268,7 +266,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme
* It is in the form <code>&lt;component&gt;:&lt;target1&gt;,&lt;target2&gt;...</code>
* Where component is the archive name (minus the .jar, .ear, .war
* extension). Targets are the servers where the components will be deployed
* @param component A String representing the value of the "-component"
* argument of the weblogic.deploy command line argument.
*/


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java View File

@@ -421,7 +421,7 @@ public class JspC extends MatchingTask {
getProject().createClassLoader(compilerClasspath));

//if we are a webapp, hand off to the compiler, which had better handle it
if(webApp!=null) {
if (webApp!=null) {
doCompilation(compiler);
return;
}
@@ -537,7 +537,7 @@ public class JspC extends MatchingTask {
String filename = files[i];
File srcFile = new File(srcDir, filename);
File javaFile = mapToJavaFile(mangler, srcFile, srcDir, dest);
if(javaFile==null) {
if (javaFile==null) {
continue;
}



+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java View File

@@ -182,8 +182,7 @@ public class FormatterElement {
* used if the property has been set, otherwise it won't.
* @param ifProperty name of property
*/
public void setIf(String ifProperty)
{
public void setIf(String ifProperty) {
this.ifProperty = ifProperty;
}

@@ -193,8 +192,7 @@ public class FormatterElement {
* will be used.
* @param unlessProperty name of property
*/
public void setUnless(String unlessProperty)
{
public void setUnless(String unlessProperty) {
this.unlessProperty = unlessProperty;
}



+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -664,7 +664,7 @@ public class JUnitTask extends Task {
final FormatterElement[] feArray = mergeFormatters(test);
for (int i = 0; i < feArray.length; i++) {
FormatterElement fe = feArray[i];
if(fe.shouldUse(this)) {
if (fe.shouldUse(this)) {
formatterArg.append("formatter=");
formatterArg.append(fe.getClassname());
File outFile = getOutput(fe, test);
@@ -881,7 +881,7 @@ public class JUnitTask extends Task {
final FormatterElement[] feArray = mergeFormatters(test);
for (int i = 0; i < feArray.length; i++) {
FormatterElement fe = feArray[i];
if(fe.shouldUse(this)) {
if (fe.shouldUse(this)) {
File outFile = getOutput(fe, test);
if (outFile != null) {
fe.setOutfile(outFile);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java View File

@@ -229,7 +229,7 @@ public class SetProxy extends Task {
sysprops.put("https.nonProxyHosts", nonProxyHosts);
sysprops.put("ftp.nonProxyHosts", nonProxyHosts);
}
if(proxyUser!=null) {
if (proxyUser!=null) {
sysprops.put("http.proxyUser", proxyUser);
sysprops.put("http.proxyPassword", proxyPassword);
}


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -258,8 +258,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
commandLine.clearArgs();
commandLine.setExecutable(getExecutable(GET_EXE));

if(getConfig() != null && getConfig().length()>0)
{
if (getConfig() != null && getConfig().length()>0) {
commandLine.createArgument().setValue("-c" + getConfig());
}



+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -250,7 +250,7 @@ public class Symlink extends Task {

// fill up a Properties object with link and resource
// names
while(eachlink.hasMoreElements()) {
while (eachlink.hasMoreElements()) {
File alink = (File) eachlink.nextElement();
try {
linksToStore.put(alink.getName(),
@@ -269,8 +269,7 @@ public class Symlink extends Task {
writePropertyFile(linksToStore, writeTo,
"Symlinks from " + writeTo.getParent());
}
}
else {
} else {
handleError("Invalid action specified in symlink");
}
} finally {


+ 6
- 7
src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java View File

@@ -77,19 +77,18 @@ public class SunRmic extends DefaultRmicAdapter {

// Create an instance of the rmic, redirecting output to
// the project log
LogOutputStream logstr = new LogOutputStream(getRmic(),
LogOutputStream logstr = new LogOutputStream(getRmic(),
Project.MSG_WARN);

try {
Class c = Class.forName("sun.rmi.rmic.Main");
Constructor cons = c.getConstructor(new Class[]
{ OutputStream.class, String.class });
Constructor cons = c.getConstructor(new Class[] { OutputStream.class, String.class });
Object rmic = cons.newInstance(new Object[] { logstr, "rmic" });

Method doRmic = c.getMethod("compile",
Method doRmic = c.getMethod("compile",
new Class [] { String[].class });
Boolean ok =
(Boolean) doRmic.invoke(rmic,
Boolean ok =
(Boolean) doRmic.invoke(rmic,
(new Object[] {cmd.getArguments()}));
return ok.booleanValue();
} catch (ClassNotFoundException ex) {
@@ -102,7 +101,7 @@ public class SunRmic extends DefaultRmicAdapter {
if (ex instanceof BuildException) {
throw (BuildException) ex;
} else {
throw new BuildException("Error starting SUN rmic: ",
throw new BuildException("Error starting SUN rmic: ",
ex, getRmic().getLocation());
}
} finally {


+ 8
- 8
src/main/org/apache/tools/ant/types/Assertions.java View File

@@ -150,7 +150,7 @@ public class Assertions extends DataType {
* <code>super.setRefid</code>.</p>
*/
public void setRefid(Reference ref) {
if(assertionList.size()>0 || enableSystemAssertions!=null) {
if (assertionList.size()>0 || enableSystemAssertions!=null) {
throw tooManyAttributes();
}
super.setRefid(ref);
@@ -161,11 +161,11 @@ public class Assertions extends DataType {
* @return the object that contains the assertion info
*/
private Assertions getFinalReference() {
if(getRefid()==null) {
if (getRefid()==null) {
return this;
} else {
Object o = getRefid().getReferencedObject(getProject());
if(!(o instanceof Assertions)) {
if (!(o instanceof Assertions)) {
throw new BuildException("reference is of wrong type");
}
return (Assertions)o;
@@ -179,7 +179,7 @@ public class Assertions extends DataType {
public void applyAssertions(CommandlineJava command) {
Assertions clause=getFinalReference();
//do the system assertions
if(Boolean.TRUE.equals(clause.enableSystemAssertions)) {
if (Boolean.TRUE.equals(clause.enableSystemAssertions)) {
addVmArgument(command,"-enablesystemassertions");
} else if (Boolean.FALSE.equals(clause.enableSystemAssertions)) {
addVmArgument(command, "-disablesystemassertions");
@@ -260,20 +260,20 @@ public class Assertions extends DataType {
*/
public String toCommand() {
//catch invalidness
if(getPackageName()!=null && getClassName()!=null) {
if (getPackageName()!=null && getClassName()!=null) {
throw new BuildException("Both package and class have been set");
}
StringBuffer command=new StringBuffer(getCommandPrefix());
//see if it is a package or a class
if(getPackageName() != null) {
if (getPackageName() != null) {
//packages get a ... prefix
command.append(':');
command.append(getPackageName());
if(!command.toString().endsWith("...")) {
if (!command.toString().endsWith("...")) {
//append the ... suffix if not there already
command.append("...");
}
} else if(getClassName()!=null) {
} else if (getClassName()!=null) {
//classes just get the classname
command.append(':');
command.append(getClassName());


+ 17
- 17
src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -63,8 +63,8 @@ import org.apache.tools.ant.util.JavaEnvUtils;

/**
* A representation of a Java command line that is nothing more
* than a composite of 2 <tt>Commandline</tt>. One is used for the
* vm/options and one for the classname/arguments. It provides
* than a composite of 2 <tt>Commandline</tt>. One is used for the
* vm/options and one for the classname/arguments. It provides
* specific methods for a java command line.
*
* @author thomas.haas@softwired-inc.com
@@ -105,7 +105,7 @@ public class CommandlineJava implements Cloneable {
public String[] getVariables() throws BuildException {
String[] props = super.getVariables();
Properties p = mergePropertySets();
if (props == null) {
if (p.size() == 0) {
return null;
@@ -124,7 +124,7 @@ public class CommandlineJava implements Cloneable {
String value = p.getProperty(key);
result[i++] = "-D" + key + "=" + value;
}
return result;
}

@@ -182,7 +182,7 @@ public class CommandlineJava implements Cloneable {

private Properties mergePropertySets() {
Properties p = new Properties();
for (Enumeration e = propertySets.elements();
for (Enumeration e = propertySets.elements();
e.hasMoreElements();) {
PropertySet ps = (PropertySet) e.nextElement();
p.putAll(ps.getProperties());
@@ -227,7 +227,7 @@ public class CommandlineJava implements Cloneable {
* set a jar file to execute via the -jar option.
* @param jarpathname the pathname of the jar to execute
*/
public void setJar(String jarpathname){
public void setJar(String jarpathname) {
javaCommand.setExecutable(jarpathname);
executeJar = true;
}
@@ -237,8 +237,8 @@ public class CommandlineJava implements Cloneable {
* or <tt>null</tt> if there is no jar to run.
* @see #getClassname()
*/
public String getJar(){
if (executeJar){
public String getJar() {
if (executeJar) {
return javaCommand.getExecutable();
}
return null;
@@ -309,7 +309,7 @@ public class CommandlineJava implements Cloneable {

if (haveClasspath()) {
result[pos++] = "-classpath";
result[pos++] =
result[pos++] =
classpath.concatSystemClasspath("ignore").toString();
}

@@ -317,13 +317,13 @@ public class CommandlineJava implements Cloneable {
// a bug in JDK < 1.4 that forces the jvm type to be specified as the first
// option, it is appended here as specified in the docs even though there is
// in fact no order.
if (executeJar){
if (executeJar) {
result[pos++] = "-jar";
}

// this is the classname to run as well as its arguments.
// in case of 'executeJar', the executable is a jar file.
System.arraycopy(javaCommand.getCommandline(), 0,
System.arraycopy(javaCommand.getCommandline(), 0,
result, pos, javaCommand.size());

return result;
@@ -333,7 +333,7 @@ public class CommandlineJava implements Cloneable {
* Specify max memory of the JVM
* -mx or -Xmx depending on VM version
*/
public void setMaxmemory(String max){
public void setMaxmemory(String max) {
this.maxMemory = max;
}

@@ -379,7 +379,7 @@ public class CommandlineJava implements Cloneable {
}
}
return actualVMCommand;
}
}

/**
* The size of the java command line.
@@ -397,7 +397,7 @@ public class CommandlineJava implements Cloneable {
size++;
}
// jar execution requires an additional -jar option
if (executeJar){
if (executeJar) {
size++ ;
}
return size;
@@ -467,9 +467,9 @@ public class CommandlineJava implements Cloneable {
* @since Ant 1.6
*/
private boolean haveClasspath() {
Path fullClasspath = classpath != null
Path fullClasspath = classpath != null
? classpath.concatSystemClasspath("ignore") : null;
return fullClasspath != null
return fullClasspath != null
&& fullClasspath.toString().trim().length() > 0;
}

@@ -484,7 +484,7 @@ public class CommandlineJava implements Cloneable {
* @since Ant 1.6
*/
private boolean haveBootclasspath(boolean log) {
if (bootclasspath != null
if (bootclasspath != null
&& bootclasspath.toString().trim().length() > 0) {

/*


+ 22
- 23
src/main/org/apache/tools/ant/types/DataType.java View File

@@ -62,7 +62,7 @@ import org.apache.tools.ant.ProjectComponent;

/**
* Base class for those classes that can appear inside the build file
* as stand alone data types.
* as stand alone data types.
*
* <p>This class handles the common description attribute and provides
* a default implementation for reference handling and checking for
@@ -70,7 +70,7 @@ import org.apache.tools.ant.ProjectComponent;
* nested inside elements of the same type (i.e. &lt;patternset&gt;
* but not &lt;path&gt;).</p>
*
* @author Stefan Bodewig
* @author Stefan Bodewig
*/
public abstract class DataType extends ProjectComponent {
/**
@@ -103,12 +103,12 @@ public abstract class DataType extends ProjectComponent {
* {@link #isChecked} instead.
*/
protected boolean checked = true;
/**
/**
* Sets a description of the current data type. It will be useful
* in commenting what we are doing.
* in commenting what we are doing.
*/
public void setDescription( final String desc ) {
public void setDescription( final String desc) {
description = desc;
}

@@ -132,9 +132,9 @@ public abstract class DataType extends ProjectComponent {
* <p>Subclasses may need to check whether any other attributes
* have been set as well or child elements have been created and
* thus override this method. if they do the must call
* <code>super.setRefid</code>.</p>
* <code>super.setRefid</code>.</p>
*/
public void setRefid( final Reference ref ) {
public void setRefid( final Reference ref) {
this.ref = ref;
checked = false;
}
@@ -149,11 +149,11 @@ public abstract class DataType extends ProjectComponent {
* #circularReference circularReference}.</p>
*
* <p>This implementation is appropriate only for a DataType that
* cannot hold other DataTypes as children.</p>
* cannot hold other DataTypes as children.</p>
*
* <p>The general contract of this method is that it shouldn't do
* anything if {@link #checked <code>checked</code>} is true and
* set it to true on exit.</p>
* set it to true on exit.</p>
*/
protected void dieOnCircularReference( final Stack stack,
final Project project )
@@ -163,7 +163,7 @@ public abstract class DataType extends ProjectComponent {
return;
}
Object o = ref.getReferencedObject(project);
if (o instanceof DataType) {
if (stack.contains(o)) {
throw circularReference();
@@ -178,16 +178,16 @@ public abstract class DataType extends ProjectComponent {

/**
* Performs the check for circular references and returns the
* referenced object.
* referenced object.
*/
protected Object getCheckedRef( final Class requiredClass,
final String dataTypeName ) {
final String dataTypeName) {
if (!checked) {
Stack stk = new Stack();
stk.push(this);
dieOnCircularReference(stk, getProject());
}
Object o = ref.getReferencedObject(getProject());
if (!(requiredClass.isAssignableFrom(o.getClass()))) {
String msg = ref.getRefId() + " doesn\'t denote a " + dataTypeName;
@@ -199,28 +199,28 @@ public abstract class DataType extends ProjectComponent {

/**
* Creates an exception that indicates that refid has to be the
* only attribute if it is set.
* only attribute if it is set.
*/
protected BuildException tooManyAttributes() {
return new BuildException("You must not specify more than one "
return new BuildException("You must not specify more than one "
+ "attribute when using refid");
}

/**
* Creates an exception that indicates that this XML element must
* not have child elements if the refid attribute is set.
* not have child elements if the refid attribute is set.
*/
protected BuildException noChildrenAllowed() {
return new BuildException("You must not specify nested elements "
return new BuildException("You must not specify nested elements "
+ "when using refid");
}

/**
* Creates an exception that indicates the user has generated a
* loop of data types referencing each other.
* loop of data types referencing each other.
*/
protected BuildException circularReference() {
return new BuildException("This data type contains a circular "
return new BuildException("This data type contains a circular "
+ "reference.");
}

@@ -228,7 +228,7 @@ public abstract class DataType extends ProjectComponent {
return checked;
}

protected void setChecked( final boolean checked ) {
protected void setChecked( final boolean checked) {
this.checked = checked;
}

@@ -236,8 +236,7 @@ public abstract class DataType extends ProjectComponent {
* get the reference set on this object
* @return the reference or null
*/
protected Reference getRefid()
{
protected Reference getRefid() {
return ref;
}



+ 6
- 6
src/main/org/apache/tools/ant/types/EnumeratedAttribute.java View File

@@ -63,7 +63,7 @@ import org.apache.tools.ant.BuildException;
* <p>See {@link org.apache.tools.ant.taskdefs.FixCRLF FixCRLF} for an
* example.
*
* @author Stefan Bodewig
* @author Stefan Bodewig
*/
public abstract class EnumeratedAttribute {

@@ -87,7 +87,7 @@ public abstract class EnumeratedAttribute {
public abstract String[] getValues();

/** bean constructor */
protected EnumeratedAttribute(){
protected EnumeratedAttribute() {
}

/**
@@ -116,13 +116,13 @@ public abstract class EnumeratedAttribute {
* or -1 if it cannot be found.
* @see #getValues()
*/
public final int indexOfValue(String value){
public final int indexOfValue(String value) {
String[] values = getValues();
if (values == null || value == null) {
return -1;
}
for (int i = 0; i < values.length; i++){
if (value.equals(values[i])){
for (int i = 0; i < values.length; i++) {
if (value.equals(values[i])) {
return i;
}
}
@@ -149,7 +149,7 @@ public abstract class EnumeratedAttribute {
* Convert the value to its string form.
*
* @return the string form of the value.
*/
*/
public String toString() {
return getValue();
}


+ 6
- 12
src/main/org/apache/tools/ant/types/FilterChain.java View File

@@ -79,8 +79,7 @@ import org.apache.tools.ant.filters.TokenFilter;
* @author Magesh Umasankar
*/
public final class FilterChain extends DataType
implements Cloneable
{
implements Cloneable {

private Vector filterReaders = new Vector();

@@ -170,8 +169,7 @@ public final class FilterChain extends DataType
* containsregex
* @since Ant 1.6
*/
public void addContainsRegex(TokenFilter.ContainsRegex filter)
{
public void addContainsRegex(TokenFilter.ContainsRegex filter) {
filterReaders.addElement(filter);
}

@@ -179,8 +177,7 @@ public final class FilterChain extends DataType
* replaceregex
* @since Ant 1.6
*/
public void addReplaceRegex(TokenFilter.ReplaceRegex filter)
{
public void addReplaceRegex(TokenFilter.ReplaceRegex filter) {
filterReaders.addElement(filter);
}

@@ -188,8 +185,7 @@ public final class FilterChain extends DataType
* trim
* @since Ant 1.6
*/
public void addTrim(TokenFilter.Trim filter)
{
public void addTrim(TokenFilter.Trim filter) {
filterReaders.addElement(filter);
}

@@ -198,8 +194,7 @@ public final class FilterChain extends DataType
* @since Ant 1.6
*/
public void addReplaceString(
TokenFilter.ReplaceString filter)
{
TokenFilter.ReplaceString filter) {
filterReaders.addElement(filter);
}

@@ -208,8 +203,7 @@ public final class FilterChain extends DataType
* @since Ant 1.6
*/
public void addIgnoreBlank(
TokenFilter.IgnoreBlank filter)
{
TokenFilter.IgnoreBlank filter) {
filterReaders.addElement(filter);
}



+ 1
- 1
src/main/org/apache/tools/ant/types/Mapper.java View File

@@ -204,7 +204,7 @@ public class Mapper extends DataType implements Cloneable {

FileNameMapper m = (FileNameMapper) c.newInstance();
final Project project = getProject();
if ( project != null ) {
if ( project != null) {
project.setProjectReference( m );
}
m.setFrom(from);


+ 1
- 2
src/main/org/apache/tools/ant/types/Path.java View File

@@ -654,8 +654,7 @@ public class Path extends DataType implements Cloneable {

// IBM's 1.4 has rt.jar split into 4 smaller jars and a combined
// JCE/JSSE in security.jar.
String[] ibmJars =
{ "core", "graphics", "security", "server", "xml" };
String[] ibmJars = { "core", "graphics", "security", "server", "xml" };
for (int i = 0; i < ibmJars.length; i++) {
addExisting(new Path(null,
System.getProperty("java.home")


+ 3
- 6
src/main/org/apache/tools/ant/types/PropertySet.java View File

@@ -206,8 +206,7 @@ public class PropertySet extends DataType {
if (!getDynamic()) {
cachedNames = names;
}
}
else {
} else {
names = cachedNames;
}

@@ -247,16 +246,14 @@ public class PropertySet extends DataType {
if (prj.getProperty(ref.name) != null) {
names.addElement(ref.name);
}
}
else if (ref.prefix != null) {
} else if (ref.prefix != null) {
for (Enumeration p = properties.keys(); p.hasMoreElements();) {
String name = (String) p.nextElement();
if (name.startsWith(ref.prefix)) {
names.addElement(name);
}
}
}
else if (ref.regex != null) {
} else if (ref.regex != null) {
RegexpMatcherFactory matchMaker = new RegexpMatcherFactory();
RegexpMatcher matcher = matchMaker.newRegexpMatcher();
matcher.setPattern(ref.regex);


+ 10
- 20
src/main/org/apache/tools/ant/types/XMLCatalog.java View File

@@ -927,23 +927,19 @@ public class XMLCatalog extends DataType
try {
setXMLCatalog =
resolverImplClass.getMethod("setXMLCatalog",
new Class[]
{XMLCatalog.class});
new Class[] {XMLCatalog.class});

parseCatalog =
resolverImplClass.getMethod("parseCatalog",
new Class[]
{String.class});
new Class[] {String.class});

resolveEntity =
resolverImplClass.getMethod("resolveEntity",
new Class[]
{String.class, String.class});
new Class[] {String.class, String.class});

resolve =
resolverImplClass.getMethod("resolve",
new Class[]
{String.class, String.class});
new Class[] {String.class, String.class});
} catch (NoSuchMethodException ex) {
throw new BuildException(ex);
}
@@ -977,8 +973,7 @@ public class XMLCatalog extends DataType
try {
result =
(InputSource) resolveEntity.invoke(resolverImpl,
new Object[]
{publicId, systemId});
new Object[] {publicId, systemId});
} catch (Exception ex) {
throw new BuildException(ex);
}
@@ -995,8 +990,7 @@ public class XMLCatalog extends DataType
try {
result =
(InputSource) resolveEntity.invoke(resolverImpl,
new Object[]
{publicId, systemId});
new Object[] {publicId, systemId});
} catch (Exception ex) {
throw new BuildException(ex);
}
@@ -1059,8 +1053,7 @@ public class XMLCatalog extends DataType
try {
result =
(SAXSource) resolve.invoke(resolverImpl,
new Object[]
{href, base});
new Object[] {href, base});
} catch (Exception ex) {
throw new BuildException(ex);
}
@@ -1077,8 +1070,7 @@ public class XMLCatalog extends DataType
try {
result =
(SAXSource) resolve.invoke(resolverImpl,
new Object[]
{href, base});
new Object[] {href, base});
} catch (Exception ex) {
throw new BuildException(ex);
}
@@ -1099,8 +1091,7 @@ public class XMLCatalog extends DataType

try {
setXMLCatalog.invoke(resolverImpl,
new Object[]
{XMLCatalog.this});
new Object[] {XMLCatalog.this});
} catch (Exception ex) {
throw new BuildException(ex);
}
@@ -1117,8 +1108,7 @@ public class XMLCatalog extends DataType
log("Parsing " + catFile, Project.MSG_DEBUG);
try {
parseCatalog.invoke(resolverImpl,
new Object[]
{catFile.getPath()});
new Object[] {catFile.getPath()});
} catch (Exception ex) {
throw new BuildException(ex);
}


+ 11
- 23
src/main/org/apache/tools/ant/types/optional/image/Draw.java View File

@@ -62,58 +62,46 @@ import java.awt.image.BufferedImage;
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a>
* @see org.apache.tools.ant.tasks.optional.image.Image
*/
public class Draw extends TransformOperation
{
public class Draw extends TransformOperation {
protected int xloc = 0;
protected int yloc = 0;

public void setXloc(int x)
{
public void setXloc(int x) {
xloc = x;
}

public void setYloc(int y)
{
public void setYloc(int y) {
yloc = y;
}

public void addRectangle(Rectangle rect)
{
public void addRectangle(Rectangle rect) {
instructions.add(rect);
}

public void addText(Text text)
{
public void addText(Text text) {
instructions.add(text);
}

public void addEllipse(Ellipse elip)
{
public void addEllipse(Ellipse elip) {
instructions.add(elip);
}

public void addArc(Arc arc)
{
public void addArc(Arc arc) {
instructions.add(arc);
}


public PlanarImage executeTransformOperation(PlanarImage image)
{
public PlanarImage executeTransformOperation(PlanarImage image) {
BufferedImage bi = image.getAsBufferedImage();
Graphics2D graphics = (Graphics2D)bi.getGraphics();

for (int i=0; i<instructions.size(); i++)
{
for (int i=0; i<instructions.size(); i++) {
ImageOperation instr = ((ImageOperation)instructions.elementAt(i));
if (instr instanceof DrawOperation)
{
if (instr instanceof DrawOperation) {
PlanarImage op = ((DrawOperation)instr).executeDrawOperation();
log("\tDrawing to x=" + xloc + " y=" + yloc);
graphics.drawImage(op.getAsBufferedImage(),null,xloc,yloc);
}
else if (instr instanceof TransformOperation)
{
} else if (instr instanceof TransformOperation) {
PlanarImage op = ((TransformOperation)instr).executeTransformOperation(null);
BufferedImage child = op.getAsBufferedImage();
log("\tDrawing to x=" + xloc + " y=" + yloc);


+ 6
- 12
src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java View File

@@ -61,32 +61,26 @@ import java.util.Vector;
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a>
* @see org.apache.tools.ant.tasks.optional.image.Image
*/
public abstract class ImageOperation extends DataType
{
public abstract class ImageOperation extends DataType {
protected Vector instructions = new Vector();

public void addRotate(Rotate instr)
{
public void addRotate(Rotate instr) {
instructions.add(instr);
}

public void addDraw(Draw instr)
{
public void addDraw(Draw instr) {
instructions.add(instr);
}

public void addRectangle(Rectangle instr)
{
public void addRectangle(Rectangle instr) {
instructions.add(instr);
}

public void addText(Text instr)
{
public void addText(Text instr) {
instructions.add(instr);
}

public void addScale(Scale instr)
{
public void addScale(Scale instr) {
instructions.add(instr);
}
}

+ 10
- 21
src/main/org/apache/tools/ant/types/optional/image/Rotate.java View File

@@ -66,22 +66,19 @@ import java.awt.*;
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a>
* @see org.apache.tools.ant.tasks.optional.image.Image
*/
public class Rotate extends TransformOperation implements DrawOperation
{
public class Rotate extends TransformOperation implements DrawOperation {
protected float angle = 0.0F;

/**
* Sets the angle of rotation in degrees.
* @param ang The angle at which to rotate the image
*/
public void setAngle(String ang)
{
public void setAngle(String ang) {
angle = Float.parseFloat(ang);
}


public PlanarImage performRotate(PlanarImage image)
{
public PlanarImage performRotate(PlanarImage image) {
float t_angle = (float) (angle * (Math.PI / 180.0F));
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
@@ -97,24 +94,19 @@ public class Rotate extends TransformOperation implements DrawOperation
* Performs the image rotation when being handled as a TransformOperation.
* @param image The image to perform the transformation on.
*/
public PlanarImage executeTransformOperation(PlanarImage image)
{
public PlanarImage executeTransformOperation(PlanarImage image) {
BufferedImage bi = null;
Graphics2D graphics = null;
for (int i = 0; i < instructions.size(); i++)
{
for (int i = 0; i < instructions.size(); i++) {
ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
if (instr instanceof DrawOperation)
{
if (instr instanceof DrawOperation) {
// If this TransformOperation has DrawOperation children
// then Rotate the first child and return.
System.out.println("Execing Draws");
PlanarImage op = ((DrawOperation) instr).executeDrawOperation();
image = performRotate(op);
return image;
}
else if (instr instanceof TransformOperation)
{
} else if (instr instanceof TransformOperation) {
bi = image.getAsBufferedImage();
graphics = (Graphics2D) bi.getGraphics();
System.out.println("Execing Transforms");
@@ -135,13 +127,10 @@ public class Rotate extends TransformOperation implements DrawOperation
* ONE image.
* @param image The image to perform the transformation on.
*/
public PlanarImage executeDrawOperation()
{
for (int i = 0; i < instructions.size(); i++)
{
public PlanarImage executeDrawOperation() {
for (int i = 0; i < instructions.size(); i++) {
ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
if (instr instanceof DrawOperation)
{
if (instr instanceof DrawOperation) {
// If this TransformOperation has DrawOperation children
// then Rotate the first child and return.
PlanarImage op = ((DrawOperation) instr).executeDrawOperation();


+ 2
- 4
src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java View File

@@ -59,12 +59,10 @@ import javax.media.jai.PlanarImage;
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a>
* @see org.apache.tools.ant.tasks.optional.image.Image
*/
public abstract class TransformOperation extends ImageOperation
{
public abstract class TransformOperation extends ImageOperation {
public abstract PlanarImage executeTransformOperation(PlanarImage img);

public void addRectangle(Rectangle instr)
{
public void addRectangle(Rectangle instr) {
instructions.add(instr);
}



+ 6
- 8
src/main/org/apache/tools/ant/types/resolver/ApacheCatalog.java View File

@@ -96,12 +96,12 @@ public class ApacheCatalog extends Catalog {
cat.setResolver(resolver);
return cat;
}
/** Set the resolver object to callback. */
public void setResolver(ApacheCatalogResolver resolver) {
this.resolver = resolver;
}
/**
* <p>This method overrides the superclass method of the same name
* in order to add catalog entries back to the controlling
@@ -131,26 +131,24 @@ public class ApacheCatalog extends Catalog {
if (resolver == null) {
catalogManager.debug
.message(1, "Internal Error: null ApacheCatalogResolver");
}
else {
} else {
resolver.addPublicEntry(publicid, systemid, base);
}

} else if (type == URI) {
String uri = normalizeURI(entry.getEntryArg(0));
String altURI = normalizeURI(entry.getEntryArg(1));

if (resolver == null) {
catalogManager.debug
.message(1, "Internal Error: null ApacheCatalogResolver");
}
else {
} else {
resolver.addURIEntry(uri, altURI, base);
}

}
super.addEntry(entry);
}



+ 13
- 14
src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java View File

@@ -75,7 +75,7 @@ import org.apache.xml.resolver.tools.CatalogResolver;
* class. XMLCatalog calls methods in this class using Reflection in
* order to avoid requiring the xml-commons resolver library in the
* path.</p>
*
*
* <p>The {@link org.apache.tools.ant.types.resolver.ApacheCatalog
* ApacheCatalog} class is used to parse external catalog files, which
* can be in either <a
@@ -83,7 +83,7 @@ import org.apache.xml.resolver.tools.CatalogResolver;
* plain text format</a> or <a
* href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">
* XML format</a>.</p>
*
*
* <p>For each entry found in an external catalog file, if any, an
* instance of {@link org.apache.tools.ant.types.ResourceLocation
* ResourceLocation} is created and added to the controlling
@@ -102,9 +102,8 @@ public class ApacheCatalogResolver extends CatalogResolver {

/** The XMLCatalog object to callback. */
private XMLCatalog xmlCatalog = null;
static
{

static {
//
// If you don't do this, you get all sorts of annoying
// warnings about a missing properties file. However, it
@@ -133,7 +132,7 @@ public class ApacheCatalogResolver extends CatalogResolver {
this.xmlCatalog = xmlCatalog;
}

/**
/**
* XMLCatalog calls this to add an external catalog file for each
* file within a <code>&lt;catalogfiles&gt;</code> fileset.
*/
@@ -147,10 +146,10 @@ public class ApacheCatalogResolver extends CatalogResolver {
try {
catalog.parseCatalog(file);
}
catch(MalformedURLException ex) {
catch (MalformedURLException ex) {
throw new BuildException(ex);
}
catch(IOException ex) {
catch (IOException ex) {
throw new BuildException(ex);
}
}
@@ -166,9 +165,9 @@ public class ApacheCatalogResolver extends CatalogResolver {
* specifies a relative URL/pathname, it is resolved using the
* base. The default base for an external catalog file is the
* directory in which the catalog is located.
*
*
*/
public void addPublicEntry(String publicid,
public void addPublicEntry(String publicid,
String systemid,
URL base) {

@@ -176,7 +175,7 @@ public class ApacheCatalogResolver extends CatalogResolver {
dtd.setBase(base);
dtd.setPublicId(publicid);
dtd.setLocation(systemid);
xmlCatalog.addDTD(dtd);
}

@@ -192,9 +191,9 @@ public class ApacheCatalogResolver extends CatalogResolver {
* specifies a relative URL/pathname, it is resolved using the
* base. The default base for an external catalog file is the
* directory in which the catalog is located.
*
*
*/
public void addURIEntry(String uri,
public void addURIEntry(String uri,
String altURI,
URL base) {

@@ -202,7 +201,7 @@ public class ApacheCatalogResolver extends CatalogResolver {
entity.setBase(base);
entity.setPublicId(uri);
entity.setLocation(altURI);
xmlCatalog.addEntity(entity);
}



+ 1
- 1
src/main/org/apache/tools/ant/util/ClasspathUtils.java View File

@@ -73,7 +73,7 @@ import org.apache.tools.ant.types.Reference;
* <pre><code>
* ClasspathUtils.Delegate cpDelegate;
*
* public void init(){
* public void init() {
* this.cpDelegate = ClasspathUtils.getDelegate(this);
* super.init();
* }


+ 5
- 5
src/main/org/apache/tools/ant/util/CollectionUtils.java View File

@@ -77,7 +77,7 @@ public class CollectionUtils {
if (v1 == v2) {
return true;
}
if (v1 == null || v2 == null) {
return false;
}
@@ -93,7 +93,7 @@ public class CollectionUtils {
return false;
}
}
// don't need to check e2.hasMoreElements as the Vectors have
// same size.

@@ -111,7 +111,7 @@ public class CollectionUtils {
if (d1 == d2) {
return true;
}
if (d1 == null || d2 == null) {
return false;
}
@@ -129,7 +129,7 @@ public class CollectionUtils {
return false;
}
}
// don't need the opposite check as the Dictionaries have the
// same size, so we've also covered all keys of d2 already.

@@ -142,7 +142,7 @@ public class CollectionUtils {
* @since Ant 1.6
*/
public static void putAll(Dictionary m1, Dictionary m2) {
for(Enumeration it = m2.keys(); it.hasMoreElements();) {
for (Enumeration it = m2.keys(); it.hasMoreElements();) {
Object key = it.nextElement();
m1.put(key, m2.get(key));
}


+ 4
- 6
src/main/org/apache/tools/ant/util/DateUtils.java View File

@@ -71,7 +71,7 @@ import java.util.TimeZone;
* @author Stefan Bodewig
*
* @since Ant 1.5
*
*
* @version $Revision$
*/
public final class DateUtils {
@@ -108,11 +108,9 @@ public final class DateUtils {

private static final double[] LIMITS = {0, 1, 2};

private static final String[] MINUTES_PART =
{"", "1 minute ", "{0,number} minutes "};
private static final String[] MINUTES_PART = {"", "1 minute ", "{0,number} minutes "};

private static final String[] SECONDS_PART =
{"0 seconds", "1 second", "{1,number} seconds"};
private static final String[] SECONDS_PART = {"0 seconds", "1 second", "{1,number} seconds"};

private static final ChoiceFormat MINUTES_FORMAT =
new ChoiceFormat(LIMITS, MINUTES_PART);
@@ -236,7 +234,7 @@ public final class DateUtils {
public static String getDateForHeader() {
Calendar cal = Calendar.getInstance();
TimeZone tz = cal.getTimeZone();
int offset = tz.getOffset(cal.get(Calendar.ERA),
int offset = tz.getOffset(cal.get(Calendar.ERA),
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH),


+ 1
- 1
src/main/org/apache/tools/ant/util/JAXPUtils.java View File

@@ -205,7 +205,7 @@ public class JAXPUtils {
* @return the systemid corresponding to the given file.
* @since Ant 1.5.2
*/
public static String getSystemId(File file){
public static String getSystemId(File file) {
return fu.toURI(file.getAbsolutePath());
}



+ 1
- 1
src/main/org/apache/tools/ant/util/JavaEnvUtils.java View File

@@ -358,7 +358,7 @@ public class JavaEnvUtils {
* @return list of packages
*/
public static Vector getJrePackages() {
if(jrePackages==null) {
if (jrePackages==null) {
buildJrePackages();
}
return jrePackages;


+ 1
- 1
src/main/org/apache/tools/ant/util/KeepAliveOutputStream.java View File

@@ -64,7 +64,7 @@ import java.io.OutputStream;
* <p>
* In code-language it means that it is not necessary to do:
* <pre>
* if (out != System.out && out!= System.err){
* if (out != System.out && out!= System.err) {
* out.close();
* }
* </pre>


+ 4
- 4
src/main/org/apache/tools/ant/util/LazyHashtable.java View File

@@ -75,8 +75,8 @@ public class LazyHashtable extends Hashtable {
* we delay it until we do need _all_ tasks. Otherwise we
* just get the tasks that we need, and avoid costly init.
*/
protected void initAll( ) {
if( initAllDone ) return;
protected void initAll() {
if (initAllDone ) return;
initAllDone=true;
}

@@ -96,7 +96,7 @@ public class LazyHashtable extends Hashtable {
return super.size();
}

public boolean contains( Object value ) {
public boolean contains( Object value) {
initAll();
return super.contains(value);
}
@@ -109,7 +109,7 @@ public class LazyHashtable extends Hashtable {
/**
* Delegates to {@link #contains contains}.
*/
public boolean containsValue( Object value ) {
public boolean containsValue( Object value) {
return contains(value);
}



+ 5
- 5
src/main/org/apache/tools/ant/util/StringUtils.java View File

@@ -73,7 +73,7 @@ public final class StringUtils {
* @param data the string to split up into lines.
* @return the list of lines available in the string.
*/
public static Vector lineSplit(String data){
public static Vector lineSplit(String data) {
return split(data, '\n');
}

@@ -84,11 +84,11 @@ public final class StringUtils {
* @param ch the separator character.
* @return the list of elements.
*/
public static Vector split(String data, int ch){
public static Vector split(String data, int ch) {
Vector elems = new Vector();
int pos = -1;
int i = 0;
while ((pos = data.indexOf(ch, i)) != -1){
while ((pos = data.indexOf(ch, i)) != -1) {
String elem = data.substring(i, pos);
elems.addElement(elem);
i = pos + 1;
@@ -104,11 +104,11 @@ public final class StringUtils {
* @param to the occurrence to be used as a replacement.
* @return the new string with replaced occurrences.
*/
public static String replace(String data, String from, String to){
public static String replace(String data, String from, String to) {
StringBuffer buf = new StringBuffer(data.length());
int pos = -1;
int i = 0;
while ((pos = data.indexOf(from, i)) != -1){
while ((pos = data.indexOf(from, i)) != -1) {
buf.append(data.substring(i, pos)).append(to);
i = pos + from.length();
}


+ 7
- 14
src/main/org/apache/tools/ant/util/TaskLogger.java View File

@@ -62,40 +62,33 @@ import org.apache.tools.ant.Task;
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Revision$ $Date$
*/
public final class TaskLogger
{
public final class TaskLogger {
/**
* Task to use to do logging.
*/
private Task m_task;

public TaskLogger( final Task task )
{
public TaskLogger( final Task task) {
this.m_task = task;
}

public void info( final String message )
{
public void info( final String message) {
m_task.log( message, Project.MSG_INFO );
}

public void error( final String message )
{
public void error( final String message) {
m_task.log( message, Project.MSG_ERR );
}

public void warning( final String message )
{
public void warning( final String message) {
m_task.log( message, Project.MSG_WARN );
}

public void verbose( final String message )
{
public void verbose( final String message) {
m_task.log( message, Project.MSG_VERBOSE );
}

public void debug( final String message )
{
public void debug( final String message) {
m_task.log( message, Project.MSG_DEBUG );
}
}

+ 1
- 1
src/main/org/apache/tools/ant/util/WeakishReference.java View File

@@ -76,7 +76,7 @@ public abstract class WeakishReference {
* @return reference to the Object.
*/
public static WeakishReference createReference(Object object) {
if(referenceConstructor==null) {
if (referenceConstructor==null) {
createReferenceConstructor();
}
try {


+ 7
- 10
src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java View File

@@ -125,7 +125,7 @@ public class DependencyVisitor extends EmptyVisitor {
&& name.startsWith("class$")) {
String classname = name.substring(6).replace('$', '.');
// does the class have a package structure
int index = classname.lastIndexOf(".");
int index = classname.lastIndexOf(".");
if (index > 0) {
char start;
// check if the package structure is more than 1 level deep
@@ -133,8 +133,7 @@ public class DependencyVisitor extends EmptyVisitor {
if (index2 != -1) {
// class name has more than 1 package level 'com.company.Class'
start = classname.charAt(index2 + 1);
}
else {
} else {
// class name has only 1 package level 'package.Class'
start = classname.charAt(0);
}
@@ -143,15 +142,13 @@ public class DependencyVisitor extends EmptyVisitor {
// first letter of the previous segment of the class name 'Class'
// is upper case ascii. so according to the spec it's an inner class
classname = classname.substring(0, index) + "$" +
classname.substring(index + 1);
classname.substring(index + 1);
addClass(classname);
}
else {
// Add the class in dotted notation 'com.company.Class'
} else {
// Add the class in dotted notation 'com.company.Class'
addClass(classname);
}
}
else {
}
} else {
// Add a class with no package 'Class'
addClass(classname);
}


+ 1
- 1
src/main/org/apache/tools/mail/MailMessage.java View File

@@ -207,7 +207,7 @@ public class MailMessage {
* @param port the port to use for connection.
* @see #DEFAULT_PORT
*/
public void setPort(int port){
public void setPort(int port) {
this.port = port;
}



Loading…
Cancel
Save