Browse Source

Style

Submitted by: Larry Shatzer (larry dot shatzer at spirent dot com)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275272 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
962a59d64f
26 changed files with 129 additions and 139 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/PropertyHelper.java
  2. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/Exit.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Java.java
  4. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
  5. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
  6. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
  7. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java
  8. +29
    -29
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  10. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
  11. +9
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java
  12. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java
  13. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java
  14. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  15. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  16. +4
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
  17. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
  18. +5
    -5
      src/main/org/apache/tools/ant/types/Assertions.java
  19. +5
    -5
      src/main/org/apache/tools/ant/types/Commandline.java
  20. +13
    -13
      src/main/org/apache/tools/ant/types/CommandlineJava.java
  21. +8
    -11
      src/main/org/apache/tools/ant/types/optional/image/Scale.java
  22. +2
    -4
      src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java
  23. +1
    -1
      src/main/org/apache/tools/ant/types/selectors/MappingSelector.java
  24. +2
    -2
      src/main/org/apache/tools/ant/util/FileUtils.java
  25. +2
    -2
      src/main/org/apache/tools/ant/util/JAXPUtils.java
  26. +8
    -8
      src/main/org/apache/tools/bzip2/CBZip2OutputStream.java

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

@@ -156,7 +156,7 @@ public class PropertyHelper {
* *
* @return the project's property helper. * @return the project's property helper.
*/ */
public synchronized static
public static synchronized
PropertyHelper getPropertyHelper(Project project) { PropertyHelper getPropertyHelper(Project project) {
PropertyHelper helper PropertyHelper helper
= (PropertyHelper) project.getReference("ant.PropertyHelper"); = (PropertyHelper) project.getReference("ant.PropertyHelper");


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

@@ -117,24 +117,24 @@ public class Exit extends Task {
*/ */
public void execute() throws BuildException { public void execute() throws BuildException {
if (testIfCondition() && testUnlessCondition()) { if (testIfCondition() && testUnlessCondition()) {
String text=null;
String text = null;
if (message != null && message.length() > 0) { if (message != null && message.length() > 0) {
text=message;
text = message;
} else { } else {


if(getProject().getProperty(ifCondition) != null) {
text="if="+ifCondition;
if (getProject().getProperty(ifCondition) != null) {
text = "if=" + ifCondition;
} }
if (unlessCondition!=null && unlessCondition.length()>0
if (unlessCondition != null && unlessCondition.length() > 0
&& getProject().getProperty(unlessCondition) == null) { && getProject().getProperty(unlessCondition) == null) {
if (text == null) { if (text == null) {
text = ""; text = "";
} else { } else {
text+=" and ";
text += " and ";
} }
text+="unless="+unlessCondition;
text += "unless=" + unlessCondition;
} else { } else {
if(text==null) {
if (text == null) {
text = "No message"; text = "No message";
} }
} }


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

@@ -157,8 +157,8 @@ public class Java extends Task {
+ "not compatible with spawn"); + "not compatible with spawn");
} }
if (fork) { if (fork) {
if(perm != null) {
log("Permissions can not be set this way in forked mode.",Project.MSG_WARN);
if (perm != null) {
log("Permissions can not be set this way in forked mode.", Project.MSG_WARN);
} }
log(cmdl.describeCommand(), Project.MSG_VERBOSE); log(cmdl.describeCommand(), Project.MSG_VERBOSE);
} else { } else {


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

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,7 @@ public class RecorderEntry implements BuildLogger {
/** The output PrintStream to record to. */ /** The output PrintStream to record to. */
private PrintStream out = null; private PrintStream out = null;
/** The start time of the last know target. */ /** The start time of the last know target. */
private long targetStartTime = 0l;
private long targetStartTime = 0L;
/** Strip task banners if true. */ /** Strip task banners if true. */
private boolean emacsMode = false; private boolean emacsMode = false;




+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/condition/Socket.java View File

@@ -108,13 +108,11 @@ public class Socket extends ProjectComponent implements Condition {
s = new java.net.Socket(server, port); s = new java.net.Socket(server, port);
} catch (IOException e) { } catch (IOException e) {
return false; return false;
}
finally {
if (s != null){
} finally {
if (s != null) {
try { try {
s.close(); s.close();
}
catch (IOException ioe){
} catch (IOException ioe) {
// Intentionally left blank // Intentionally left blank
} }
} }


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

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


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

@@ -394,7 +394,7 @@ public abstract class DotnetCompile
*@return The Parameter to CSC *@return The Parameter to CSC
*/ */
protected String getIncludeDefaultReferencesParameter() { protected String getIncludeDefaultReferencesParameter() {
if(standardLib==null) {
if (standardLib == null) {
return "/nostdlib" + (includeDefaultReferences ? "-" : "+"); return "/nostdlib" + (includeDefaultReferences ? "-" : "+");
} else { } else {
return null; return null;
@@ -868,7 +868,7 @@ public abstract class DotnetCompile
if (outputFile != null && outputFile.isDirectory()) { if (outputFile != null && outputFile.isDirectory()) {
throw new BuildException("destFile cannot be a directory"); throw new BuildException("destFile cannot be a directory");
} }
if(getExecutable()==null) {
if (getExecutable() == null) {
throw new BuildException("There is no executable defined for this task"); throw new BuildException("There is no executable defined for this task");
} }
} }


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

@@ -105,7 +105,7 @@ public class Ildasm extends Task {
/** /**
* progress bar switch * progress bar switch
*/ */
private boolean progressBar=false;
private boolean progressBar = false;


/** /**
* what is our encoding * what is our encoding
@@ -116,45 +116,45 @@ public class Ildasm extends Task {
* /bytes flag for byte markup * /bytes flag for byte markup
*/ */


private boolean bytes=false;
private boolean bytes = false;


/** /**
* line numbers? /linenum * line numbers? /linenum
*/ */
private boolean linenumbers=false;
private boolean linenumbers = false;


/** /**
* /raweh flag for raw exception handling * /raweh flag for raw exception handling
*/ */
private boolean rawExceptionHandling=false;
private boolean rawExceptionHandling = false;


/** /**
* show the source; /source * show the source; /source
*/ */
private boolean showSource=false;
private boolean showSource = false;


/** /**
* /quoteallnames to quote all names * /quoteallnames to quote all names
*/ */
private boolean quoteallnames=false;
private boolean quoteallnames = false;


/** /**
* /header for header information * /header for header information
*/ */
private boolean header=false;
private boolean header = false;


/** /**
* when false, sets the /noil attribute * when false, sets the /noil attribute
* to suppress assembly info * to suppress assembly info
*/ */
private boolean assembler=true;
private boolean assembler = true;


/** /**
* include metadata * include metadata
* /tokens * /tokens
*/ */


private boolean metadata=false;
private boolean metadata = false;


/** /**
* what visibility do we want. * what visibility do we want.
@@ -171,7 +171,7 @@ public class Ildasm extends Task {
/** /**
* override for the executable * override for the executable
*/ */
private String executable="ildasm";
private String executable = "ildasm";


/** /**
* name of the directory for resources to be created. We cannot control * name of the directory for resources to be created. We cannot control
@@ -338,13 +338,13 @@ public class Ildasm extends Task {
* verify that source and dest are ok * verify that source and dest are ok
*/ */
private void validate() { private void validate() {
if(sourceFile==null || !sourceFile.exists() || !sourceFile.isFile()) {
if (sourceFile == null || !sourceFile.exists() || !sourceFile.isFile()) {
throw new BuildException("invalid source"); throw new BuildException("invalid source");
} }
if(destFile==null || destFile.isDirectory()) {
if (destFile == null || destFile.isDirectory()) {
throw new BuildException("invalid dest"); throw new BuildException("invalid dest");
} }
if(resourceDir!=null
if (resourceDir != null
&& (!resourceDir.exists() || !resourceDir.isDirectory())) { && (!resourceDir.exists() || !resourceDir.isDirectory())) {
throw new BuildException("invalid resource directory"); throw new BuildException("invalid resource directory");
} }
@@ -355,13 +355,13 @@ public class Ildasm extends Task {
* @return * @return
*/ */
private boolean isDisassemblyNeeded() { private boolean isDisassemblyNeeded() {
if(!destFile.exists()) {
if (!destFile.exists()) {
return true; return true;
} }
long sourceTime=sourceFile.lastModified();
long destTime=destFile.lastModified();
return sourceTime>(destTime+ FileUtils.newFileUtils().getFileTimestampGranularity());
long sourceTime = sourceFile.lastModified();
long destTime = destFile.lastModified();
return sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity());
} }
/** /**
* do the work * do the work
@@ -373,11 +373,11 @@ public class Ildasm extends Task {
command.setFailOnError(true); command.setFailOnError(true);
//fill in args //fill in args
command.addArgument("/text"); command.addArgument("/text");
command.addArgument("/out="+destFile.toString());
if(!progressBar) {
command.addArgument("/out=" + destFile.toString());
if (!progressBar) {
command.addArgument("/nobar"); command.addArgument("/nobar");
} }
if(linenumbers) {
if (linenumbers) {
command.addArgument("/linenum"); command.addArgument("/linenum");
} }
if (showSource) { if (showSource) {
@@ -395,7 +395,7 @@ public class Ildasm extends Task {
if (metadata) { if (metadata) {
command.addArgument("/tokens"); command.addArgument("/tokens");
} }
command.addArgument("/item:",item);
command.addArgument("/item:", item);
if (rawExceptionHandling) { if (rawExceptionHandling) {
command.addArgument("/raweh"); command.addArgument("/raweh");
} }
@@ -403,16 +403,16 @@ public class Ildasm extends Task {
if (bytes) { if (bytes) {
command.addArgument("/bytes"); command.addArgument("/bytes");
} }
command.addArgument("/vis:",visibility);
command.addArgument("/vis:", visibility);


//add the source file //add the source file
command.addArgument(sourceFile.getAbsolutePath()); command.addArgument(sourceFile.getAbsolutePath());


//determine directory: resourceDir if set, //determine directory: resourceDir if set,
//the dir of the destFile if not //the dir of the destFile if not
File execDir=resourceDir;
if(execDir==null) {
execDir=destFile.getParentFile();
File execDir = resourceDir;
if (execDir == null) {
execDir = destFile.getParentFile();
} }
command.setDirectory(execDir); command.setDirectory(execDir);


@@ -421,7 +421,7 @@ public class Ildasm extends Task {
command.runCommand(); command.runCommand();
} catch (BuildException e) { } catch (BuildException e) {
//forcibly delete the output file in case of trouble //forcibly delete the output file in case of trouble
if(destFile.exists()) {
if (destFile.exists()) {
destFile.delete(); destFile.delete();
} }
//then rethrow the exception //then rethrow the exception
@@ -434,7 +434,7 @@ public class Ildasm extends Task {
* encoding options; the default is ascii * encoding options; the default is ascii
*/ */
public static class EncodingTypes extends EnumeratedAttribute { public static class EncodingTypes extends EnumeratedAttribute {
public final static String UNICODE= "unicode";
public final static String UNICODE = "unicode";
public final static String UTF8 = "utf8"; public final static String UTF8 = "utf8";
public final static String ASCII = "ascii"; public final static String ASCII = "ascii";
public String[] getValues() { public String[] getValues() {
@@ -451,7 +451,7 @@ public class Ildasm extends Task {
* @return * @return
*/ */
public static String getEncodingOption(String enumValue) { public static String getEncodingOption(String enumValue) {
if(UNICODE.equals(enumValue)) {
if (UNICODE.equals(enumValue)) {
return "/unicode"; return "/unicode";
} }
if (UTF8.equals(enumValue)) { if (UTF8.equals(enumValue)) {


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

@@ -244,7 +244,7 @@ public class NetCommand {
} }
File dir = owner.getProject().getBaseDir(); File dir = owner.getProject().getBaseDir();
if (directory != null) { if (directory != null) {
dir=directory;
dir = directory;
} }


ExecuteStreamHandler handler = new LogStreamHandler(owner, ExecuteStreamHandler handler = new LogStreamHandler(owner,


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

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -99,8 +99,7 @@ public class AntResolver
final File dir = final File dir =
m_antfile.getParentFile().getCanonicalFile(); m_antfile.getParentFile().getCanonicalFile();
ant.setDir(dir); ant.setDir(dir);
}
catch (final IOException ioe) {
} catch (final IOException ioe) {
throw new BuildException(ioe.getMessage(), ioe); throw new BuildException(ioe.getMessage(), ioe);
} }




+ 9
- 6
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -101,9 +101,9 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool {
* @return A Path object representing the classpath to be used. * @return A Path object representing the classpath to be used.
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null)
if (classpath == null) {
classpath = new Path(task.getProject()); classpath = new Path(task.getProject());
}
return classpath.createPath(); return classpath.createPath();
} }


@@ -126,14 +126,17 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool {
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
*/ */
public void validateAttributes() throws BuildException { public void validateAttributes() throws BuildException {
if (task.getAction() == null)
if (task.getAction() == null) {
throw new BuildException("The \"action\" attribute must be set"); throw new BuildException("The \"action\" attribute must be set");
}


if (!isActionValid())
if (!isActionValid()) {
throw new BuildException("Invalid action \"" + task.getAction() + "\" passed"); throw new BuildException("Invalid action \"" + task.getAction() + "\" passed");
}


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


/** /**


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

@@ -144,8 +144,9 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool {
public void validateAttributes() throws BuildException { public void validateAttributes() throws BuildException {
super.validateAttributes(); super.validateAttributes();


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


/** /**


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java View File

@@ -73,7 +73,7 @@ import org.apache.tools.ant.util.JavaEnvUtils;
* *
* @author Jene Jasper <a href="mailto:jjasper@abz.nl">jjasper@abz.nl</a> * @author Jene Jasper <a href="mailto:jjasper@abz.nl">jjasper@abz.nl</a>
* @author thomas.haas@softwired-inc.com * @author thomas.haas@softwired-inc.com
* @author Michael Saunders
* @author Michael Saunders
* <a href="mailto:michael@amtec.com">michael@amtec.com</a> * <a href="mailto:michael@amtec.com">michael@amtec.com</a>
*/ */
public class JJDoc extends Task { public class JJDoc extends Task {
@@ -156,12 +156,12 @@ public class JJDoc extends Task {
} }


if (outputFile != null) { if (outputFile != null) {
cmdl.createArgument() .setValue("-" + OUTPUT_FILE + ":"
cmdl.createArgument() .setValue("-" + OUTPUT_FILE + ":"
+ outputFile.replace('\\', '/')); + outputFile.replace('\\', '/'));
} }


// use the directory containing the target as the output directory // use the directory containing the target as the output directory
File javaFile = new File(createOutputFileName(target, outputFile,
File javaFile = new File(createOutputFileName(target, outputFile,
plainText)); plainText));


if (javaFile.exists() if (javaFile.exists()
@@ -173,7 +173,7 @@ public class JJDoc extends Task {


cmdl.createArgument().setValue(target.getAbsolutePath()); cmdl.createArgument().setValue(target.getAbsolutePath());


cmdl.setClassname(JavaCC.getMainClass(javaccHome,
cmdl.setClassname(JavaCC.getMainClass(javaccHome,
JavaCC.TASKDEF_TYPE_JJDOC)); JavaCC.TASKDEF_TYPE_JJDOC));


final Path classpath = cmdl.createClasspath(getProject()); final Path classpath = cmdl.createClasspath(getProject());
@@ -205,7 +205,7 @@ public class JJDoc extends Task {
private String createOutputFileName(File target, String optionalOutputFile, private String createOutputFileName(File target, String optionalOutputFile,
boolean plainText) { boolean plainText) {
String suffix = DEFAULT_SUFFIX_HTML; String suffix = DEFAULT_SUFFIX_HTML;
String javaccFile = target.getAbsolutePath().replace('\\','/');
String javaccFile = target.getAbsolutePath().replace('\\', '/');


if (plainText) { if (plainText) {
suffix = DEFAULT_SUFFIX_TEXT; suffix = DEFAULT_SUFFIX_TEXT;
@@ -228,12 +228,12 @@ public class JJDoc extends Task {
if (currentSuffix.equals(suffix)) { if (currentSuffix.equals(suffix)) {
optionalOutputFile = javaccFile + suffix; optionalOutputFile = javaccFile + suffix;
} else { } else {
optionalOutputFile = javaccFile.substring(0, suffixPos)
optionalOutputFile = javaccFile.substring(0, suffixPos)
+ suffix; + suffix;
} }
} }
} else { } else {
optionalOutputFile = optionalOutputFile.replace('\\','/');
optionalOutputFile = optionalOutputFile.replace('\\', '/');
} }


return (getProject().getBaseDir() + "/" + optionalOutputFile) return (getProject().getBaseDir() + "/" + optionalOutputFile)


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -308,7 +308,7 @@ public class JJTree extends Task {
String outputDirectory) { String outputDirectory) {
optionalOutputFile = validateOutputFile(optionalOutputFile, optionalOutputFile = validateOutputFile(optionalOutputFile,
outputDirectory); outputDirectory);
String jjtreeFile = target.getAbsolutePath().replace('\\','/');
String jjtreeFile = target.getAbsolutePath().replace('\\', '/');


if ((optionalOutputFile == null) || optionalOutputFile.equals("")) { if ((optionalOutputFile == null) || optionalOutputFile.equals("")) {
int filePos = jjtreeFile.lastIndexOf("/"); int filePos = jjtreeFile.lastIndexOf("/");
@@ -340,7 +340,7 @@ public class JJTree extends Task {
return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/'); return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/');
} }


/*
/*
* Not used anymore * Not used anymore
private boolean isAbsolute(String fileName) { private boolean isAbsolute(String fileName) {
return (fileName.startsWith("/") || (new File(fileName).isAbsolute())); return (fileName.startsWith("/") || (new File(fileName).isAbsolute()));
@@ -357,8 +357,8 @@ public class JJTree extends Task {
* @return * @return
* @throws BuildException * @throws BuildException
*/ */
private String validateOutputFile(String outputFile,
String outputDirectory)
private String validateOutputFile(String outputFile,
String outputDirectory)
throws BuildException { throws BuildException {
if (outputFile == null) { if (outputFile == null) {
return null; return null;


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

@@ -318,16 +318,16 @@ public class JUnitTestRunner implements TestListener {
} }
perm = null; perm = null;
} else { } else {
if(perm != null) {
if (perm != null) {
perm.setSecurityManager(); perm.setSecurityManager();
} }
} }


try { try {
suite.run(res); suite.run(res);
} finally { } finally {
if(perm != null) {
if (perm != null) {
perm.restoreSecurityManager(); perm.restoreSecurityManager();
} }
if (savedOut != null) { if (savedOut != null) {
@@ -413,7 +413,7 @@ public class JUnitTestRunner implements TestListener {
res.stop(); res.stop();
} }
} }
/** /**
* Permissions for the test run. * Permissions for the test run.
* @since Ant 1.6 * @since Ant 1.6


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

@@ -301,17 +301,13 @@ public class SetProxy extends Task {
Method reset = c.getMethod("resetProperties", null); Method reset = c.getMethod("resetProperties", null);
reset.invoke(null, null); reset.invoke(null, null);
return true; return true;
}
catch (ClassNotFoundException cnfe) {
} catch (ClassNotFoundException cnfe) {
return false; return false;
}
catch (NoSuchMethodException e) {
} catch (NoSuchMethodException e) {
return false; return false;
}
catch (IllegalAccessException e) {
} catch (IllegalAccessException e) {
return false; return false;
}
catch (InvocationTargetException e) {
} catch (InvocationTargetException e) {
return false; return false;
} }
} }


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

@@ -136,9 +136,8 @@ public class P4Submit extends P4Base {
found = true; found = true;
} }
} }
}
// NumberFormatException or ArrayOutOfBondsException could happen here
catch (Exception e) {
// NumberFormatException or ArrayOutOfBondsException could happen here
} catch (Exception e) {
String msg = "Failed to parse " + line + "\n" String msg = "Failed to parse " + line + "\n"
+ " due to " + e.getMessage(); + " due to " + e.getMessage();
throw new BuildException(msg, e, getLocation()); throw new BuildException(msg, e, getLocation());


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

@@ -187,7 +187,7 @@ public class Assertions extends DataType {
* @return * @return
*/ */
private int getFinalSize() { private int getFinalSize() {
return assertionList.size()+ (enableSystemAssertions!=null?1:0);
return assertionList.size() + (enableSystemAssertions != null ? 1 : 0);
} }


/** /**
@@ -254,16 +254,16 @@ public class Assertions extends DataType {
* @throws CloneNotSupportedException * @throws CloneNotSupportedException
*/ */
protected Object clone() throws CloneNotSupportedException { protected Object clone() throws CloneNotSupportedException {
Assertions that=(Assertions) super.clone();
that.assertionList=(ArrayList) assertionList.clone();
return that;
Assertions that = (Assertions) super.clone();
that.assertionList = (ArrayList) assertionList.clone();
return that;
} }


/** /**
* base class for our assertion elements. * base class for our assertion elements.
*/ */


public static abstract class BaseAssertion {
public abstract static class BaseAssertion {
private String packageName; private String packageName;
private String className; private String className;




+ 5
- 5
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -303,11 +303,11 @@ public class Commandline implements Cloneable {
* Returns the executable and all defined arguments. * Returns the executable and all defined arguments.
*/ */
public String[] getCommandline() { public String[] getCommandline() {
List commands=new LinkedList();
List commands = new LinkedList();
ListIterator list = commands.listIterator(); ListIterator list = commands.listIterator();
addCommandToList(list); addCommandToList(list);
final String[] result = new String[commands.size()]; final String[] result = new String[commands.size()];
return (String[])commands.toArray(result);
return (String[]) commands.toArray(result);
} }


/** /**
@@ -316,7 +316,7 @@ public class Commandline implements Cloneable {
* @since Ant 1.6 * @since Ant 1.6
*/ */
public void addCommandToList(ListIterator list) { public void addCommandToList(ListIterator list) {
if(executable!=null) {
if (executable != null) {
list.add(executable); list.add(executable);
} }
addArgumentsToList(list); addArgumentsToList(list);
@@ -331,7 +331,7 @@ public class Commandline implements Cloneable {
List result = new ArrayList(arguments.size() * 2); List result = new ArrayList(arguments.size() * 2);
addArgumentsToList(result.listIterator()); addArgumentsToList(result.listIterator());
String [] res = new String[result.size()]; String [] res = new String[result.size()];
return (String[])result.toArray(res);
return (String[]) result.toArray(res);
} }


/** /**
@@ -374,7 +374,7 @@ public class Commandline implements Cloneable {
if (argument.indexOf("\"") > -1) { if (argument.indexOf("\"") > -1) {
if (argument.indexOf("\'") > -1) { if (argument.indexOf("\'") > -1) {
throw new BuildException("Can\'t handle single and double" throw new BuildException("Can\'t handle single and double"
+" quotes in same argument");
+ " quotes in same argument");
} else { } else {
return '\'' + argument + '\''; return '\'' + argument + '\'';
} }


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

@@ -96,13 +96,13 @@ public class CommandlineJava implements Cloneable {
/** /**
* any assertions to make? Currently only supported in forked JVMs * any assertions to make? Currently only supported in forked JVMs
*/ */
private Assertions assertions=null;
private Assertions assertions = null;


/** /**
* Indicate whether it will execute a jar file or not, in this case * Indicate whether it will execute a jar file or not, in this case
* the first vm option must be a -jar and the 'executable' is a jar file. * the first vm option must be a -jar and the 'executable' is a jar file.
*/ */
private boolean executeJar = false;
private boolean executeJar = false;


/** /**
* Specialized Environment class for System properties * Specialized Environment class for System properties
@@ -119,13 +119,13 @@ public class CommandlineJava implements Cloneable {
*/ */
public String[] getVariables() throws BuildException { public String[] getVariables() throws BuildException {


List definitions=new LinkedList();
ListIterator list=definitions.listIterator();
List definitions = new LinkedList();
ListIterator list = definitions.listIterator();
addDefinitionsToList(list); addDefinitionsToList(list);
if(definitions.size()==0) {
if (definitions.size() == 0) {
return null; return null;
} else { } else {
return (String[])definitions.toArray(new String[0]);
return (String[]) definitions.toArray(new String[0]);
} }
} }


@@ -135,8 +135,8 @@ public class CommandlineJava implements Cloneable {
*/ */
public void addDefinitionsToList(ListIterator listIt) { public void addDefinitionsToList(ListIterator listIt) {
String[] props = super.getVariables(); String[] props = super.getVariables();
if(props!=null) {
for (int i=0; i < props.length; i++) {
if (props != null) {
for (int i = 0; i < props.length; i++) {
listIt.add("-D" + props[i]); listIt.add("-D" + props[i]);
} }
} }
@@ -379,12 +379,12 @@ public class CommandlineJava implements Cloneable {
*/ */
public String[] getCommandline() { public String[] getCommandline() {
//create the list //create the list
List commands=new LinkedList();
List commands = new LinkedList();
final ListIterator listIterator = commands.listIterator(); final ListIterator listIterator = commands.listIterator();
//fill it //fill it
addCommandsToList(listIterator); addCommandsToList(listIterator);
//convert to an array //convert to an array
return (String[])commands.toArray(new String[0]);
return (String[]) commands.toArray(new String[0]);
} }


/** /**
@@ -503,8 +503,8 @@ public class CommandlineJava implements Cloneable {
size++; size++;
} }
//assertions take up space too //assertions take up space too
if(getAssertions()!=null) {
size+=getAssertions().size();
if (getAssertions() != null) {
size += getAssertions().size();
} }
return size; return size;
} }
@@ -582,7 +582,7 @@ public class CommandlineJava implements Cloneable {
if (bootclasspath != null) { if (bootclasspath != null) {
c.bootclasspath = (Path) bootclasspath.clone(); c.bootclasspath = (Path) bootclasspath.clone();
} }
if( assertions != null ) {
if (assertions != null) {
c.assertions = (Assertions) assertions.clone(); c.assertions = (Assertions) assertions.clone();
} }
return c; return c;


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

@@ -83,7 +83,7 @@ public class Scale extends TransformOperation implements DrawOperation {
/** /**
* Sets the behaviour regarding the image proportions. * Sets the behaviour regarding the image proportions.
*/ */
public void setProportions(ProportionsAttribute pa){
public void setProportions(ProportionsAttribute pa) {
proportions = pa.getValue(); proportions = pa.getValue();
} }


@@ -139,23 +139,20 @@ public class Scale extends TransformOperation implements DrawOperation {
y_fl = (y_fl / image.getHeight()); y_fl = (y_fl / image.getHeight());
} }


if("width".equals(proportions)){
if ("width".equals(proportions)) {
y_fl = x_fl; y_fl = x_fl;
}
else if("height".equals(proportions)){
} else if ("height".equals(proportions)) {
x_fl = y_fl; x_fl = y_fl;
}
else if("fit".equals(proportions)){
x_fl = y_fl = Math.min(x_fl,y_fl);
}
else if("cover".equals(proportions)){
x_fl = y_fl = Math.max(x_fl,y_fl);
} else if ("fit".equals(proportions)) {
x_fl = y_fl = Math.min(x_fl, y_fl);
} else if ("cover".equals(proportions)) {
x_fl = y_fl = Math.max(x_fl, y_fl);
} }


pb.add(new Float(x_fl)); pb.add(new Float(x_fl));
pb.add(new Float(y_fl)); pb.add(new Float(y_fl));


log("\tScaling to " + (x_fl*100) + "% x " + (y_fl*100)+ "%");
log("\tScaling to " + (x_fl * 100) + "% x " + (y_fl * 100) + "%");


return JAI.create("scale", pb); return JAI.create("scale", pb);
} }


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

@@ -145,11 +145,9 @@ public class ApacheCatalogResolver extends CatalogResolver {


try { try {
catalog.parseCatalog(file); catalog.parseCatalog(file);
}
catch (MalformedURLException ex) {
} catch (MalformedURLException ex) {
throw new BuildException(ex); throw new BuildException(ex);
}
catch (IOException ex) {
} catch (IOException ex) {
throw new BuildException(ex); throw new BuildException(ex);
} }
} }


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

@@ -78,7 +78,7 @@ public abstract class MappingSelector extends BaseSelector {
* *
*/ */
public MappingSelector() { public MappingSelector() {
granularity=(int) FileUtils.newFileUtils().getFileTimestampGranularity();
granularity = (int) FileUtils.newFileUtils().getFileTimestampGranularity();
} }






+ 2
- 2
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -114,7 +114,7 @@ public class FileUtils {
/** /**
* the granularity of timestamps under FAT * the granularity of timestamps under FAT
*/ */
public static final long FAT_FILE_TIMESTAMP_GRANULARITY=2000;
public static final long FAT_FILE_TIMESTAMP_GRANULARITY = 2000;




// stolen from FilePathToURI of the Xerces-J team // stolen from FilePathToURI of the Xerces-J team
@@ -1334,7 +1334,7 @@ public class FileUtils {
} }


public long getFileTimestampGranularity() { public long getFileTimestampGranularity() {
if(Os.isFamily("dos")) {
if (Os.isFamily("dos")) {
return FAT_FILE_TIMESTAMP_GRANULARITY; return FAT_FILE_TIMESTAMP_GRANULARITY;
} else { } else {
return 0; return 0;


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

@@ -106,7 +106,7 @@ public class JAXPUtils {
* *
* @since Ant 1.5 * @since Ant 1.5
*/ */
public synchronized static SAXParserFactory getParserFactory()
public static synchronized SAXParserFactory getParserFactory()
throws BuildException { throws BuildException {


if (parserFactory == null) { if (parserFactory == null) {
@@ -123,7 +123,7 @@ public class JAXPUtils {
* *
* @since Ant 1.6 * @since Ant 1.6
*/ */
public synchronized static SAXParserFactory getNSParserFactory()
public static synchronized SAXParserFactory getNSParserFactory()
throws BuildException { throws BuildException {


if (nsParserFactory == null) { if (nsParserFactory == null) {


+ 8
- 8
src/main/org/apache/tools/bzip2/CBZip2OutputStream.java View File

@@ -204,10 +204,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {


weight[nNodes] = ((weight[n1] & 0xffffff00) weight[nNodes] = ((weight[n1] & 0xffffff00)
+ (weight[n2] & 0xffffff00)) + (weight[n2] & 0xffffff00))
| (1 + (((weight[n1] & 0x000000ff) >
(weight[n2] & 0x000000ff)) ?
(weight[n1] & 0x000000ff) :
(weight[n2] & 0x000000ff)));
| (1 + (((weight[n1] & 0x000000ff)
> (weight[n2] & 0x000000ff))
? (weight[n1] & 0x000000ff)
: (weight[n2] & 0x000000ff)));


parent[nNodes] = -1; parent[nNodes] = -1;
nHeap++; nHeap++;
@@ -1246,8 +1246,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
vv = runningOrder[i]; vv = runningOrder[i];
j = i; j = i;
while ((ftab[((runningOrder[j - h]) + 1) << 8] while ((ftab[((runningOrder[j - h]) + 1) << 8]
- ftab[(runningOrder[j - h]) << 8]) >
(ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) {
- ftab[(runningOrder[j - h]) << 8])
> (ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) {
runningOrder[j] = runningOrder[j - h]; runningOrder[j] = runningOrder[j - h];
j = j - h; j = j - h;
if (j <= (h - 1)) { if (j <= (h - 1)) {
@@ -1535,9 +1535,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
because the number of elems to sort is because the number of elems to sort is
usually small, typically <= 20. usually small, typically <= 20.
*/ */
private int[] incs = { 1, 4, 13, 40, 121, 364, 1093, 3280,
private int[] incs = {1, 4, 13, 40, 121, 364, 1093, 3280,
9841, 29524, 88573, 265720, 9841, 29524, 88573, 265720,
797161, 2391484 };
797161, 2391484};


private void allocateCompressStructures () { private void allocateCompressStructures () {
int n = baseBlockSize * blockSize100k; int n = baseBlockSize * blockSize100k;


Loading…
Cancel
Save