diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java index fbca31d3d..cf77d32ca 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java @@ -149,8 +149,8 @@ public class ProjectHelper2 extends ProjectHelper { // } else if (source instanceof URL) { // } else if (source instanceof InputSource) { } else { - throw new BuildException("Source " + source.getClass().getName() + - " not supported by this plugin"); + throw new BuildException("Source " + source.getClass().getName() + + " not supported by this plugin"); } FileInputStream inputStream = null; @@ -340,8 +340,8 @@ public class ProjectHelper2 extends ProjectHelper { public InputSource resolveEntity(String publicId, String systemId) { - context.getProject().log("resolving systemId: " + - systemId, Project.MSG_VERBOSE); + context.getProject().log("resolving systemId: " + + systemId, Project.MSG_VERBOSE); if (systemId.startsWith("file:")) { String path = fu.fromURI(systemId); @@ -356,8 +356,8 @@ public class ProjectHelper2 extends ProjectHelper { inputSource.setSystemId(fu.toURI(file.getAbsolutePath())); return inputSource; } catch (FileNotFoundException fne) { - context.getProject().log(file.getAbsolutePath() + - " could not be found", Project.MSG_WARN); + context.getProject().log(file.getAbsolutePath() + + " could not be found", Project.MSG_WARN); } } @@ -529,9 +529,9 @@ public class ProjectHelper2 extends ProjectHelper { File dupFile = new File(dup); if (context.isIgnoringProjectTag() && !dupFile.equals(context.getBuildFile())) { - project.log("Duplicated project name in import. Project " + - context.getCurrentProjectName() + " defined first in " + - dup + " and again in " + context.getBuildFile(), + project.log("Duplicated project name in import. Project " + + context.getCurrentProjectName() + " defined first in " + + dup + " and again in " + context.getBuildFile(), Project.MSG_WARN); } } diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java index a3785eaa7..61585ee8c 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java @@ -135,7 +135,7 @@ public class ProjectHelperImpl extends ProjectHelper { */ public void parse(Project project, Object source) throws BuildException { if (!(source instanceof File)) { - throw new BuildException("Only File source supported by " + throw new BuildException("Only File source supported by " + "default plugin"); } File buildFile = (File) source; @@ -490,7 +490,7 @@ public class ProjectHelperImpl extends ProjectHelper { if (name.equals("target")) { handleTarget(name, attrs); } else { - handleElement(helperImpl, this, helperImpl.implicitTarget, + handleElement(helperImpl, this, helperImpl.implicitTarget, name, attrs); } } @@ -661,7 +661,7 @@ public class ProjectHelperImpl extends ProjectHelper { * parser at the end of the element. * Must not be null. */ - public DescriptionHandler(ProjectHelperImpl helperImpl, + public DescriptionHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler) { super(helperImpl, parentHandler); } diff --git a/src/main/org/apache/tools/ant/input/DefaultInputHandler.java b/src/main/org/apache/tools/ant/input/DefaultInputHandler.java index 668f1541e..954af3150 100644 --- a/src/main/org/apache/tools/ant/input/DefaultInputHandler.java +++ b/src/main/org/apache/tools/ant/input/DefaultInputHandler.java @@ -68,7 +68,7 @@ import org.apache.tools.ant.BuildException; * @since Ant 1.5 */ public class DefaultInputHandler implements InputHandler { - + /** * Empty no-arg constructor */ @@ -108,7 +108,7 @@ public class DefaultInputHandler implements InputHandler { if (request instanceof MultipleChoiceInputRequest) { StringBuffer sb = new StringBuffer(prompt); sb.append("("); - Enumeration enum = + Enumeration enum = ((MultipleChoiceInputRequest) request).getChoices().elements(); boolean first = true; while (enum.hasMoreElements()) { diff --git a/src/main/org/apache/tools/ant/input/InputHandler.java b/src/main/org/apache/tools/ant/input/InputHandler.java index 83f9bef87..a9535daaf 100644 --- a/src/main/org/apache/tools/ant/input/InputHandler.java +++ b/src/main/org/apache/tools/ant/input/InputHandler.java @@ -72,6 +72,6 @@ public interface InputHandler { *

Postcondition: request.getInput will return a non-null * value, request.isInputValid will return true.

*/ - void handleInput(InputRequest request) + void handleInput(InputRequest request) throws org.apache.tools.ant.BuildException; } diff --git a/src/main/org/apache/tools/ant/input/InputRequest.java b/src/main/org/apache/tools/ant/input/InputRequest.java index 9a416f692..c5e36c62c 100644 --- a/src/main/org/apache/tools/ant/input/InputRequest.java +++ b/src/main/org/apache/tools/ant/input/InputRequest.java @@ -72,7 +72,7 @@ public class InputRequest { if (prompt == null) { throw new IllegalArgumentException("prompt must not be null"); } - + this.prompt = prompt; } @@ -89,7 +89,7 @@ public class InputRequest { public void setInput(String input) { this.input = input; } - + /** * Is the user input valid? */ diff --git a/src/main/org/apache/tools/ant/input/PropertyFileInputHandler.java b/src/main/org/apache/tools/ant/input/PropertyFileInputHandler.java index 1337f86ff..378d1e464 100644 --- a/src/main/org/apache/tools/ant/input/PropertyFileInputHandler.java +++ b/src/main/org/apache/tools/ant/input/PropertyFileInputHandler.java @@ -89,11 +89,11 @@ public class PropertyFileInputHandler implements InputHandler { */ public void handleInput(InputRequest request) throws BuildException { readProps(); - + Object o = props.get(request.getPrompt()); if (o == null) { throw new BuildException("Unable to find input for \'" - + request.getPrompt()+"\'"); + + request.getPrompt() + "\'"); } request.setInput(o.toString()); if (!request.isInputValid()) { @@ -114,9 +114,9 @@ public class PropertyFileInputHandler implements InputHandler { + " for PropertyFileInputHandler not" + " set"); } - + props = new Properties(); - + try { props.load(new FileInputStream(propsFile)); } catch (IOException e) { diff --git a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java index 34b35d3c5..83a317878 100644 --- a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java +++ b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java @@ -165,15 +165,15 @@ public final class AnsiColorLogger extends DefaultLogger { private static final char SEPARATOR = ';'; private static final String END_COLOR = PREFIX + SUFFIX; - private String errColor + private String errColor = PREFIX + ATTR_DIM + SEPARATOR + FG_RED + SUFFIX; - private String warnColor + private String warnColor = PREFIX + ATTR_DIM + SEPARATOR + FG_MAGENTA + SUFFIX; - private String infoColor + private String infoColor = PREFIX + ATTR_DIM + SEPARATOR + FG_CYAN + SUFFIX; - private String verboseColor + private String verboseColor = PREFIX + ATTR_DIM + SEPARATOR + FG_GREEN + SUFFIX; - private String debugColor + private String debugColor = PREFIX + ATTR_DIM + SEPARATOR + FG_BLUE + SUFFIX; private boolean colorsSet = false; diff --git a/src/main/org/apache/tools/ant/listener/Log4jListener.java b/src/main/org/apache/tools/ant/listener/Log4jListener.java index f04fdbb2e..cf60acc93 100644 --- a/src/main/org/apache/tools/ant/listener/Log4jListener.java +++ b/src/main/org/apache/tools/ant/listener/Log4jListener.java @@ -73,7 +73,7 @@ public class Log4jListener implements BuildListener { /** Indicates if the listener was initialized. */ private boolean initialized = false; - /** + /** * Construct the listener and make sure there is a valid appender. */ public Log4jListener() { @@ -131,7 +131,7 @@ public class Log4jListener implements BuildListener { if (event.getException() == null) { cat.info("Target \"" + targetName + "\" finished."); } else { - cat.error("Target \"" + targetName + cat.error("Target \"" + targetName + "\" finished with error.", event.getException()); } } @@ -158,7 +158,7 @@ public class Log4jListener implements BuildListener { if (event.getException() == null) { cat.info("Task \"" + task.getTaskName() + "\" finished."); } else { - cat.error("Task \"" + task.getTaskName() + cat.error("Task \"" + task.getTaskName() + "\" finished with error.", event.getException()); } } @@ -177,7 +177,7 @@ public class Log4jListener implements BuildListener { } } - Category cat + Category cat = Category.getInstance(categoryObject.getClass().getName()); switch (event.getPriority()) { case Project.MSG_ERR: diff --git a/src/main/org/apache/tools/ant/listener/MailLogger.java b/src/main/org/apache/tools/ant/listener/MailLogger.java index 5522eada1..363711e94 100644 --- a/src/main/org/apache/tools/ant/listener/MailLogger.java +++ b/src/main/org/apache/tools/ant/listener/MailLogger.java @@ -57,7 +57,11 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; -import java.util.*; +import java.util.Hashtable; +import java.util.Vector; +import java.util.Properties; +import java.util.Enumeration; +import java.util.StringTokenizer; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.DefaultLogger; @@ -154,20 +158,24 @@ public class MailLogger extends DefaultLogger { } String mailhost = getValue(properties, "mailhost", "localhost"); - int port = Integer.parseInt(getValue(properties,"port",String.valueOf(MailMessage.DEFAULT_PORT))); + int port = Integer.parseInt(getValue(properties, "port", + String.valueOf(MailMessage.DEFAULT_PORT))); String user = getValue(properties, "user", ""); String password = getValue(properties, "password", ""); boolean ssl = Project.toBoolean(getValue(properties, "ssl", "off")); String from = getValue(properties, "from", null); - String replytoList = getValue(properties,"replyto",""); + String replytoList = getValue(properties, "replyto", ""); String toList = getValue(properties, prefix + ".to", null); String subject = getValue(properties, prefix + ".subject", (success) ? "Build Success" : "Build Failure"); if (user.equals("") && password.equals("") && !ssl) { - sendMail(mailhost, port, from, replytoList, toList, subject, buffer.substring(0)); + sendMail(mailhost, port, from, replytoList, toList, + subject, buffer.substring(0)); } else { - sendMimeMail(event.getProject(), mailhost, port, user, password, ssl, from, replytoList, toList, subject, buffer.substring(0)); + sendMimeMail(event.getProject(), mailhost, port, user, + password, ssl, from, replytoList, toList, + subject, buffer.substring(0)); } } catch (Exception e) { System.out.println("MailLogger failed to send e-mail!"); @@ -274,7 +282,7 @@ public class MailLogger extends DefaultLogger { (Mailer) Class.forName("org.apache.tools.ant.taskdefs.email.MimeMailer") .newInstance(); } catch (Throwable e) { - log("Failed to initialise MIME mail: "+e.getMessage()); + log("Failed to initialise MIME mail: " + e.getMessage()); return; } Vector replyToList = vectorizeEmailAddresses(replyToString); diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java index 8fb34b953..64d71a1c2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java @@ -372,12 +372,16 @@ public abstract class AbstractCvsTask extends Task { if (outputStream != null) { try { outputStream.close(); - } catch (IOException e) {} + } catch (IOException e) { + //ignore + } } if (errorStream != null) { try { errorStream.close(); - } catch (IOException e) {} + } catch (IOException e) { + //ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java index 6606bb86f..5f8d7042d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java @@ -117,22 +117,30 @@ public class BUnzip2 extends Unpack { if (bis != null) { try { bis.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + // ignore + } } if (fis != null) { try { fis.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + // ignore + } } if (out != null) { try { out.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + // ignore + } } if (zIn != null) { try { zIn.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + // ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/BZip2.java b/src/main/org/apache/tools/ant/taskdefs/BZip2.java index a7195dc0b..219072f9e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BZip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BZip2.java @@ -90,7 +90,9 @@ public class BZip2 extends Pack { try { // close up zOut.close(); - } catch (IOException e) {} + } catch (IOException e) { + //ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Basename.java b/src/main/org/apache/tools/ant/taskdefs/Basename.java index 0d7d13c1d..1abae7979 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Basename.java +++ b/src/main/org/apache/tools/ant/taskdefs/Basename.java @@ -90,53 +90,53 @@ import org.apache.tools.ant.Task; */ public class Basename extends Task { - private File file; - private String property; - private String suffix; + private File file; + private String property; + private String suffix; - /** - * File or directory to get base name from. - */ - public void setFile(File file) { - this.file = file; - } + /** + * File or directory to get base name from. + */ + public void setFile(File file) { + this.file = file; + } - /** - * Property to set base name to. - */ - public void setProperty(String property) { - this.property = property ; - } + /** + * Property to set base name to. + */ + public void setProperty(String property) { + this.property = property; + } - /** - * Optional suffix to remove from base name. - */ - public void setSuffix(String suffix) { - this.suffix = suffix; - } + /** + * Optional suffix to remove from base name. + */ + public void setSuffix(String suffix) { + this.suffix = suffix; + } - // The method executing the task - public void execute() throws BuildException { - if (property == null) { - throw new BuildException("property attribute required", getLocation()); - } - if (file == null) { - throw new BuildException("file attribute required", getLocation()); - } - String value = file.getName(); - if (suffix != null && value.endsWith(suffix)) { - // if the suffix does not starts with a '.' and the - // char preceding the suffix is a '.', we assume the user - // wants to remove the '.' as well (see docs) - int pos = value.length() - suffix.length(); - if (pos > 0 && suffix.charAt(0) != '.' - && value.charAt(pos - 1) == '.') { - pos--; - } - value = value.substring(0, pos); - } - getProject().setNewProperty(property, value); - } + // The method executing the task + public void execute() throws BuildException { + if (property == null) { + throw new BuildException("property attribute required", getLocation()); + } + if (file == null) { + throw new BuildException("file attribute required", getLocation()); + } + String value = file.getName(); + if (suffix != null && value.endsWith(suffix)) { + // if the suffix does not starts with a '.' and the + // char preceding the suffix is a '.', we assume the user + // wants to remove the '.' as well (see docs) + int pos = value.length() - suffix.length(); + if (pos > 0 && suffix.charAt(0) != '.' + && value.charAt(pos - 1) == '.') { + pos--; + } + value = value.substring(0, pos); + } + getProject().setNewProperty(property, value); + } } diff --git a/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java b/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java index f36871197..90e7b0417 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java +++ b/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java @@ -107,7 +107,7 @@ public class BuildNumber */ public void execute() throws BuildException { - File savedFile = m_file;// may be altered in validate + File savedFile = m_file; // may be altered in validate validate(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/src/main/org/apache/tools/ant/taskdefs/Checksum.java index 6330fdb18..0c357722f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Checksum.java +++ b/src/main/org/apache/tools/ant/taskdefs/Checksum.java @@ -419,7 +419,7 @@ public class Checksum extends MatchingTask implements Condition { throw new BuildException("Couldn't read checksum file " + checksumFile, e); } byte[] digest = decodeHex(checksum.toCharArray()); - allDigests.put(file,digest ); + allDigests.put(file, digest); } } } else { @@ -478,7 +478,7 @@ public class Checksum extends MatchingTask implements Condition { fis = null; byte[] fileDigest = messageDigest.digest (); if (totalproperty != null) { - allDigests.put(src,fileDigest); + allDigests.put(src, fileDigest); } String checksum = createDigestString(fileDigest); //can either be a property name string or a file @@ -546,12 +546,16 @@ public class Checksum extends MatchingTask implements Condition { if (fis != null) { try { fis.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } if (fos != null) { try { fos.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } } return checksumMatches; diff --git a/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java b/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java index f73fc73a2..30f8671ec 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java @@ -86,7 +86,9 @@ public class ConditionTask extends ConditionBase { * * @since Ant 1.4 */ - public void setProperty(String p) {property = p;} + public void setProperty(String p) { + property = p; + } /** * The value for the property to set, if condition evaluates to true. @@ -94,7 +96,9 @@ public class ConditionTask extends ConditionBase { * * @since Ant 1.4 */ - public void setValue(String v) {value = v;} + public void setValue(String v) { + value = v; + } /** * See whether our nested condition holds and set the property. @@ -116,11 +120,11 @@ public class ConditionTask extends ConditionBase { Condition c = (Condition) getConditions().nextElement(); if (c.eval()) { - log("Condition true; setting "+property+" to "+value, + log("Condition true; setting " + property + " to " + value, Project.MSG_DEBUG); getProject().setNewProperty(property, value); } else { - log("Condition false; not setting "+property, + log("Condition false; not setting " + property, Project.MSG_DEBUG); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index dd7ffb9d8..5cd199cae 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -600,10 +600,9 @@ public class Copy extends Task { } if (count > 0) { - log("Copied " + count + - " empty director" + - (count == 1 ? "y" : "ies") + - " to " + destDir.getAbsolutePath()); + log("Copied " + count + " empty director" + + (count == 1 ? "y" : "ies") + + " to " + destDir.getAbsolutePath()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/DefaultExcludes.java b/src/main/org/apache/tools/ant/taskdefs/DefaultExcludes.java index b4a00db1b..ed7172caa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/DefaultExcludes.java +++ b/src/main/org/apache/tools/ant/taskdefs/DefaultExcludes.java @@ -84,10 +84,9 @@ public class DefaultExcludes extends Task { */ public void execute() throws BuildException { if (add.equals("") && remove.equals("") && (echo == false)) { - throw new BuildException(" task must set "+ - "at least one atribute (echo=\"false\""+ - " doesn't count since that is the "+ - "default"); + throw new BuildException(" task must set " + + "at least one atribute (echo=\"false\"" + + " doesn't count since that is the default"); } if (!add.equals("")) { DirectoryScanner.addDefaultExclude(add); @@ -96,10 +95,10 @@ public class DefaultExcludes extends Task { DirectoryScanner.removeDefaultExclude(remove); } if (echo == true) { - StringBuffer message = new StringBuffer("Current Default "+ - "Excludes:\n"); + StringBuffer message + = new StringBuffer("Current Default Excludes:\n"); String[] excludes = DirectoryScanner.getDefaultExcludes(); - for (int i=0;i 0) { - log("Deleted " + dirCount + " director" + - (dirCount == 1 ? "y" : "ies") + - " from " + d.getAbsolutePath()); + log("Deleted " + dirCount + " director" + + (dirCount == 1 ? "y" : "ies") + + " from " + d.getAbsolutePath()); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/DependSet.java b/src/main/org/apache/tools/ant/taskdefs/DependSet.java index 20b97813c..275a516e5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/DependSet.java +++ b/src/main/org/apache/tools/ant/taskdefs/DependSet.java @@ -283,8 +283,8 @@ public class DependSet extends MatchingTask { if (src.lastModified() > oldestTargetTime) { upToDate = false; - log(oldestTarget + " is out of date with respect to " + - sourceFiles[i], Project.MSG_VERBOSE); + log(oldestTarget + " is out of date with respect to " + + sourceFiles[i], Project.MSG_VERBOSE); } } } @@ -311,8 +311,8 @@ public class DependSet extends MatchingTask { if (src.lastModified() > oldestTargetTime) { upToDate = false; - log(oldestTarget + " is out of date with respect to " + - sourceFiles[i], Project.MSG_VERBOSE); + log(oldestTarget + " is out of date with respect to " + + sourceFiles[i], Project.MSG_VERBOSE); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index 4178cb9f6..2c040120e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -97,7 +97,9 @@ public class Echo extends Task { if (out != null) { try { out.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + //ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Exec.java b/src/main/org/apache/tools/ant/taskdefs/Exec.java index c98dfefb9..db90d0883 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exec.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exec.java @@ -185,7 +185,9 @@ public class Exec extends Task { } } catch (IOException ioe) { throw new BuildException("Error exec: " + command, ioe, getLocation()); - } catch (InterruptedException ex) {} + } catch (InterruptedException ex) { + //ignore + } return err; } @@ -256,9 +258,13 @@ public class Exec extends Task { pumpStream(); sleep(SLEEP_TIME); } - } catch (InterruptedException ie) {} + } catch (InterruptedException ie) { + //ignore + } din.close(); - } catch (IOException ioe) {} + } catch (IOException ioe) { + // ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index c0d9f7e2b..9e4bcabf7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -145,8 +145,8 @@ public class ExecTask extends Task { * @ant.attribute ignore="true" */ public void setCommand(Commandline cmdl) { - log("The command attribute is deprecated. " + - "Please use the executable attribute and nested arg elements.", + log("The command attribute is deprecated. " + + "Please use the executable attribute and nested arg elements.", Project.MSG_WARN); this.cmdl = cmdl; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Execute.java b/src/main/org/apache/tools/ant/taskdefs/Execute.java index 155751af5..8fba313d2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Execute.java +++ b/src/main/org/apache/tools/ant/taskdefs/Execute.java @@ -578,9 +578,8 @@ public class Execute { public Process exec(Project project, String[] cmd, String[] env) throws IOException { if (project != null) { - project.log("Execute:CommandLauncher: " + - Commandline.describeCommand(cmd), - Project.MSG_DEBUG); + project.log("Execute:CommandLauncher: " + + Commandline.describeCommand(cmd), Project.MSG_DEBUG); } return Runtime.getRuntime().exec(cmd, env); } @@ -625,9 +624,8 @@ public class Execute { newcmd[i] = Commandline.quoteArgument(cmd[i]); } if (project != null) { - project.log("Execute:Java11CommandLauncher: " + - Commandline.describeCommand(newcmd), - Project.MSG_DEBUG); + project.log("Execute:Java11CommandLauncher: " + + Commandline.describeCommand(newcmd), Project.MSG_DEBUG); } return Runtime.getRuntime().exec(newcmd, env); } @@ -653,11 +651,10 @@ public class Execute { File workingDir) throws IOException { try { if (project != null) { - project.log("Execute:Java13CommandLauncher: " + - Commandline.describeCommand(cmd), - Project.MSG_DEBUG); + project.log("Execute:Java13CommandLauncher: " + + Commandline.describeCommand(cmd), Project.MSG_DEBUG); } - Object[] arguments = { cmd, env, workingDir }; + Object[] arguments = {cmd, env, workingDir}; return (Process) _execWithCWD.invoke(Runtime.getRuntime(), arguments); } catch (InvocationTargetException exc) { diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java index d7e0c1620..d8a534e1f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java @@ -118,7 +118,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { this.timeout = timeout; } - public void execute(Project project) throws BuildException{ + public void execute(Project project) throws BuildException { final String classname = javaCommand.getExecutable(); AntClassLoader loader = null; @@ -127,7 +127,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { sysProperties.setSystem(); } - final Class[] param = { Class.forName("[Ljava.lang.String;") }; + final Class[] param = {Class.forName("[Ljava.lang.String;")}; Class target = null; if (classpath == null) { target = Class.forName(classname); @@ -166,7 +166,9 @@ public class ExecuteJava implements Runnable, TimeoutObserver { w.start(); try { wait(); - } catch (InterruptedException e) {} + } catch (InterruptedException e) { + // ignore + } if (timedOut) { project.log("Timeout: sub-process interrupted", Project.MSG_WARN); @@ -204,7 +206,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { * @since Ant 1.5 */ public void run() { - final Object[] argument = { javaCommand.getArguments() }; + final Object[] argument = {javaCommand.getArguments()}; try { main.invoke(null, argument); } catch (InvocationTargetException e) { diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index d6945e282..b93e428dd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -292,9 +292,9 @@ public class ExecuteOn extends ExecTask { if (fs instanceof DirSet) { if (!"dir".equals(type)) { log("Found a nested dirset but type is " + type + ". " - + "Temporarily switching to type=\"dir\" on the" + - " assumption that you really did mean" + - " not .", Project.MSG_DEBUG); + + "Temporarily switching to type=\"dir\" on the" + + " assumption that you really did mean" + + " not .", Project.MSG_DEBUG); currentType = "dir"; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java index 9f62ef383..255362d79 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java @@ -111,7 +111,7 @@ public class ExecuteWatchdog implements TimeoutObserver { * (1.4.x compatibility) */ public ExecuteWatchdog(int timeout) { - this((long)timeout); + this((long) timeout); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java index 10f7c30cb..40e90af10 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -127,8 +127,8 @@ public class Expand extends Task { if (source != null) { if (source.isDirectory()) { - throw new BuildException("Src must not be a directory." + - " Use nested filesets instead.", getLocation()); + throw new BuildException("Src must not be a directory." + + " Use nested filesets instead.", getLocation()); } else { expandFile(fileUtils, source, dest); } @@ -172,7 +172,9 @@ public class Expand extends Task { if (zf != null) { try { zf.close(); - } catch (IOException e) {} + } catch (IOException e) { + //ignore + } } } } @@ -247,7 +249,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(); } @@ -271,7 +273,9 @@ public class Expand extends Task { if (fos != null) { try { fos.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index f4567e775..d9c19da48 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -363,13 +363,13 @@ public class FixCRLF extends MatchingTask { } // log options used - log("options:" + - " eol=" + - (eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf") + - " tab=" + (tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove") + - " eof=" + (ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove") + - " tablength=" + tablength + - " encoding=" + (encoding == null ? "default" : encoding), + log("options:" + + " eol=" + + (eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf") + + " tab=" + (tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove") + + " eof=" + (ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove") + + " tablength=" + tablength + + " encoding=" + (encoding == null ? "default" : encoding), Project.MSG_VERBOSE); DirectoryScanner ds = super.getDirectoryScanner(srcDir); @@ -483,10 +483,9 @@ public class FixCRLF extends MatchingTask { endOfCharConst(line, terminator); while (line.getNext() < line.getLookahead()) { if (line.getNextCharInc() == '\t') { - line.setColumn(line.getColumn() + - tablength - - (line.getColumn() - % tablength)); + line.setColumn(line.getColumn() + + tablength + - (line.getColumn() % tablength)); } else { line.incColumn(); } @@ -559,9 +558,8 @@ public class FixCRLF extends MatchingTask { if (!fileUtils.contentEquals(destFile, tmpFile)) { log(destFile + " is being written", Project.MSG_DEBUG); } else { - log(destFile + - " is not written, as the contents are identical", - Project.MSG_DEBUG); + log(destFile + " is not written, as the contents " + + "are identical", Project.MSG_DEBUG); destIsWrong = false; } } @@ -736,12 +734,11 @@ public class FixCRLF extends MatchingTask { nextStop += tablength; } - for (; nextStop - placediff <= linestring.length() - ; nextStop += tablength) { + for (; nextStop - placediff <= linestring.length(); + nextStop += tablength) { for (tabCol = nextStop; --tabCol - placediff >= place - && linestring.charAt(tabCol - placediff) == ' ' - ;) { + && linestring.charAt(tabCol - placediff) == ' ';) { ; // Loop for the side-effects } // tabCol is column index of the last non-space character @@ -796,7 +793,7 @@ public class FixCRLF extends MatchingTask { (getReader(srcFile), INBUFLEN); nextLine(); } catch (IOException e) { - throw new BuildException(srcFile + ": "+ e.getMessage(), + throw new BuildException(srcFile + ": " + e.getMessage(), e, getLocation()); } } @@ -881,7 +878,7 @@ public class FixCRLF extends MatchingTask { } // end of if (eolcount == 0) } catch (IOException e) { - throw new BuildException(srcFile + ": "+ e.getMessage(), + throw new BuildException(srcFile + ": " + e.getMessage(), e, getLocation()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/GUnzip.java b/src/main/org/apache/tools/ant/taskdefs/GUnzip.java index 579a83db6..25617b157 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GUnzip.java +++ b/src/main/org/apache/tools/ant/taskdefs/GUnzip.java @@ -106,17 +106,23 @@ public class GUnzip extends Unpack { if (fis != null) { try { fis.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + //ignore + } } if (out != null) { try { out.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + //ignore + } } if (zIn != null) { try { zIn.close(); - } catch (IOException ioex) {} + } catch (IOException ioex) { + //ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java index a8d7cc5c6..e2a818c78 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java +++ b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java @@ -184,9 +184,8 @@ public class GenerateKey extends Task { + "specified once."); } if (null != dname) { - throw new BuildException("It is not possible to specify dname " + - " both " + - "as attribute and element."); + throw new BuildException("It is not possible to specify dname " + + " both as attribute and element."); } expandedDname = new DistinguishedName(); return expandedDname; @@ -199,9 +198,8 @@ public class GenerateKey extends Task { */ public void setDname(final String dname) { if (null != expandedDname) { - throw new BuildException("It is not possible to specify dname " + - " both " + - "as attribute and element."); + throw new BuildException("It is not possible to specify dname " + + " both as attribute and element."); } this.dname = dname; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index 33c087f43..42572557e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -178,9 +178,9 @@ public class Get extends Task { // test for 401 result (HTTP only) if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) { - String message="HTTP Authorization failure"; + String message = "HTTP Authorization failure"; if (ignoreErrors) { - log(message,Project.MSG_WARN); + log(message, Project.MSG_WARN); return; } else { throw new BuildException(message); @@ -196,7 +196,7 @@ public class Get extends Task { //course. InputStream is = null; - for (int i = 0; i < 3 ; i++) { + for (int i = 0; i < 3; i++) { try { is = connection.getInputStream(); break; diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index 5d06aad30..24f367cbb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -222,8 +222,8 @@ public class Jar extends Zip { */ public void setManifest(File manifestFile) { if (!manifestFile.exists()) { - throw new BuildException("Manifest file: " + manifestFile + - " does not exist.", getLocation()); + throw new BuildException("Manifest file: " + manifestFile + + " does not exist.", getLocation()); } this.manifestFile = manifestFile; @@ -328,7 +328,7 @@ public class Jar extends Zip { mergeManifestsMain = "merge".equals(config.getValue()); if (filesetManifestConfig != null - && ! filesetManifestConfig.getValue().equals("skip")) { + && !filesetManifestConfig.getValue().equals("skip")) { doubleFilePass = true; } @@ -348,7 +348,7 @@ public class Jar extends Zip { protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException { - if (! skipWriting) { + if (!skipWriting) { Manifest jarManifest = createManifest(); writeManifest(zOut, jarManifest); } @@ -489,7 +489,7 @@ public class Jar extends Zip { long lastModified, File fromArchive, int mode) throws IOException { if (MANIFEST_NAME.equalsIgnoreCase(vPath)) { - if (! doubleFilePass || (doubleFilePass && skipWriting)) { + if (!doubleFilePass || (doubleFilePass && skipWriting)) { filesetManifest(fromArchive, is); } } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { @@ -683,7 +683,7 @@ public class Jar extends Zip { super.cleanUp(); // we want to save this info if we are going to make another pass - if (! doubleFilePass || (doubleFilePass && ! skipWriting)) { + if (!doubleFilePass || (doubleFilePass && !skipWriting)) { manifest = null; configuredManifest = savedConfiguredManifest; filesetManifest = null; diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index b49eed0d3..f513bd144 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -245,9 +245,8 @@ public class Java extends Task { * @ant.attribute ignore="true" */ public void setArgs(String s) { - log("The args attribute is deprecated. " + - "Please use nested arg elements.", - Project.MSG_WARN); + log("The args attribute is deprecated. " + + "Please use nested arg elements.", Project.MSG_WARN); cmdl.createArgument().setLine(s); } @@ -290,9 +289,8 @@ public class Java extends Task { * Set the command line arguments for the JVM. */ public void setJvmargs(String s) { - log("The jvmargs attribute is deprecated. " + - "Please use nested jvmarg elements.", - Project.MSG_WARN); + log("The jvmargs attribute is deprecated. " + + "Please use nested jvmarg elements.", Project.MSG_WARN); cmdl.createVmArgument().setLine(s); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 4e68e27d0..47661fc0d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -861,7 +861,7 @@ public class Javac extends MatchingTask { if (listFiles) { for (int i = 0; i < compileList.length; i++) { String filename = compileList[i].getAbsolutePath(); - log(filename) ; + log(filename); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 860b67217..c908991b5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -1868,7 +1868,7 @@ public class Javadoc extends Task { } catch (IOException ioe) { throw new BuildException("Couldn't read " + " tag file from " - + tagDefFile.getAbsolutePath(), ioe ); + + tagDefFile.getAbsolutePath(), ioe); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Jikes.java b/src/main/org/apache/tools/ant/taskdefs/Jikes.java index 42b583d0d..51dcb767d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jikes.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jikes.java @@ -123,14 +123,18 @@ public class Jikes { out.println(args[i]); } out.flush(); - commandArray = new String[] { command, - "@" + tmpFile.getAbsolutePath()}; + commandArray = new String[] {command, + "@" + tmpFile.getAbsolutePath()}; } catch (IOException e) { throw new BuildException("Error creating temporary file", e); } finally { if (out != null) { - try {out.close();} catch (Throwable t) {} + try { + out.close(); + } catch (Throwable t) { + // ignore + } } } } else { diff --git a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java index d0ac301e9..a1fc361ac 100644 --- a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java +++ b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java @@ -86,12 +86,14 @@ public class JikesOutputParser implements ExecuteStreamHandler { /** * Ignore. */ - public void setProcessInputStream(OutputStream os) {} + public void setProcessInputStream(OutputStream os) { + } /** * Ignore. */ - public void setProcessErrorStream(InputStream is) {} + public void setProcessErrorStream(InputStream is) { + } /** * Set the inputstream @@ -110,7 +112,8 @@ public class JikesOutputParser implements ExecuteStreamHandler { /** * Ignore. */ - public void stop() {} + public void stop() { + } /** * Construct a new Parser object diff --git a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java index 1ea3f58b8..60fdfe3a7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java +++ b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java @@ -119,12 +119,16 @@ public class KeySubst extends Task { if (bw != null) { try { bw.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } if (bw != null) { try { br.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java index 4790843de..99e08ecc3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java @@ -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)); diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java index 703c1f46f..43eb94fb2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -741,7 +741,7 @@ public class Manifest { = new Manifest(new InputStreamReader(in, "UTF-8")); Attribute createdBy = new Attribute("Created-By", System.getProperty("java.vm.version") + " (" - + System.getProperty("java.vm.vendor") + ")" ); + + System.getProperty("java.vm.vendor") + ")"); defaultManifest.getMainSection().storeAttribute(createdBy); return defaultManifest; } catch (UnsupportedEncodingException e) { diff --git a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java index 277165901..c0acace81 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java @@ -204,7 +204,9 @@ public class ManifestTask extends Task { if (isr != null) { try { isr.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java b/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java index f7956cc65..389943b6b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -162,9 +162,8 @@ public abstract class MatchingTask extends Task implements SelectorContainer { * @param itemString the string containing the files to include. */ public void XsetItems(String itemString) { - log("The items attribute is deprecated. " + - "Please use the includes attribute.", - Project.MSG_WARN); + log("The items attribute is deprecated. " + + "Please use the includes attribute.", Project.MSG_WARN); if (itemString == null || itemString.equals("*") || itemString.equals(".")) { createInclude().setName("**"); @@ -196,9 +195,8 @@ public abstract class MatchingTask extends Task implements SelectorContainer { * @param ignoreString the string containing the files to ignore. */ public void XsetIgnore(String ignoreString) { - log("The ignore attribute is deprecated." + - "Please use the excludes attribute.", - Project.MSG_WARN); + log("The ignore attribute is deprecated." + + "Please use the excludes attribute.", Project.MSG_WARN); if (ignoreString != null && ignoreString.length() > 0) { StringTokenizer tok = new StringTokenizer(ignoreString, ", ", false); diff --git a/src/main/org/apache/tools/ant/taskdefs/Move.java b/src/main/org/apache/tools/ant/taskdefs/Move.java index cdca40153..2516ca991 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Move.java +++ b/src/main/org/apache/tools/ant/taskdefs/Move.java @@ -107,8 +107,8 @@ public class Move extends Copy { File fromDir = (File) e.nextElement(); File toDir = (File) completeDirMap.get(fromDir); try { - log("Attempting to rename dir: " + fromDir + - " to " + toDir, verbosity); + log("Attempting to rename dir: " + fromDir + + " to " + toDir, verbosity); renameFile(fromDir, toDir, filtering, forceOverwrite); } catch (IOException ioe) { String msg = "Failed to rename dir " + fromDir @@ -119,8 +119,8 @@ public class Move extends Copy { } } if (fileCopyMap.size() > 0) { // files to move - log("Moving " + fileCopyMap.size() + " files to " + - destDir.getAbsolutePath()); + log("Moving " + fileCopyMap.size() + " files to " + + destDir.getAbsolutePath()); Enumeration e = fileCopyMap.keys(); while (e.hasMoreElements()) { @@ -139,8 +139,8 @@ public class Move extends Copy { File d = new File(toFile); try { - log("Attempting to rename: " + fromFile + - " to " + toFile, verbosity); + log("Attempting to rename: " + fromFile + + " to " + toFile, verbosity); moved = renameFile(f, d, filtering, forceOverwrite); } catch (IOException ioe) { String msg = "Failed to rename " + fromFile diff --git a/src/main/org/apache/tools/ant/taskdefs/Pack.java b/src/main/org/apache/tools/ant/taskdefs/Pack.java index 10c04c472..673373199 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Pack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Pack.java @@ -111,8 +111,8 @@ public abstract class Pack extends Task { } if (zipFile.isDirectory()) { - throw new BuildException("zipfile attribute must not " + - "represent a directory!", getLocation()); + throw new BuildException("zipfile attribute must not " + + "represent a directory!", getLocation()); } if (source == null) { @@ -120,8 +120,8 @@ public abstract class Pack extends Task { } if (source.isDirectory()) { - throw new BuildException("Src attribute must not " + - "represent a directory!", getLocation()); + throw new BuildException("Src attribute must not " + + "represent a directory!", getLocation()); } } @@ -133,14 +133,14 @@ public abstract class Pack extends Task { validate(); if (!source.exists()) { - log("Nothing to do: " + source.getAbsolutePath() + - " doesn't exist."); + log("Nothing to do: " + source.getAbsolutePath() + + " doesn't exist."); } else if (zipFile.lastModified() < source.lastModified()) { log("Building: " + zipFile.getAbsolutePath()); pack(); } else { - log("Nothing to do: " + zipFile.getAbsolutePath() + - " is up to date."); + log("Nothing to do: " + zipFile.getAbsolutePath() + + " is up to date."); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Patch.java b/src/main/org/apache/tools/ant/taskdefs/Patch.java index 09ddbcf26..e5da07dcb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Patch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Patch.java @@ -214,5 +214,4 @@ public class Patch extends Task { throw new BuildException(e, getLocation()); } } - -}// Patch +} diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index 802b1a614..fe6c8db62 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -340,8 +340,8 @@ public class PathConvert extends Task { */ public void execute() throws BuildException { Path savedPath = path; - String savedPathSep = pathSep;// may be altered in validateSetup - String savedDirSep = dirSep;// may be altered in validateSetup + String savedPathSep = pathSep; // may be altered in validateSetup + String savedDirSep = dirSep; // may be altered in validateSetup try { // If we are a reference, create a Path from the reference @@ -372,7 +372,7 @@ public class PathConvert extends Task { } } - validateSetup();// validate our setup + validateSetup(); // validate our setup // Currently, we deal with only two path formats: Unix and Windows // And Unix is everything that is not Windows @@ -392,7 +392,7 @@ public class PathConvert extends Task { for (int i = 0; i < elems.length; i++) { String elem = elems[i]; - elem = mapElement(elem);// Apply the path prefix map + elem = mapElement(elem); // Apply the path prefix map // Now convert the path and file separator characters from the // current os to the target os. @@ -464,7 +464,7 @@ public class PathConvert extends Task { if (newElem != elem) { elem = newElem; - break;// We applied one, so we're done + break; // We applied one, so we're done } } } @@ -505,11 +505,13 @@ public class PathConvert extends Task { dsep = targetWindows ? "\\" : "/"; } - if (pathSep != null) {// override with pathsep= + if (pathSep != null) { + // override with pathsep= psep = pathSep; } - if (dirSep != null) {// override with dirsep= + if (dirSep != null) { + // override with dirsep= dsep = dirSep; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java index bee58ca3f..82203a52f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -493,7 +493,9 @@ public class Property extends Task { if (is != null) { try { is.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java index afbd61a3d..ee76fed82 100644 --- a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java +++ b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java @@ -184,10 +184,10 @@ public class RecorderEntry implements BuildLogger { for (int i = 0; i < size; i++) { buf.append(" "); - }// for + } buf.append(label); - }// if - }// if + } + } buf.append(event.getMessage()); log(buf.toString(), event.getPriority()); diff --git a/src/main/org/apache/tools/ant/taskdefs/Replace.java b/src/main/org/apache/tools/ant/taskdefs/Replace.java index 7dbcd4eca..79311411a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Replace.java +++ b/src/main/org/apache/tools/ant/taskdefs/Replace.java @@ -449,19 +449,23 @@ public class Replace extends MatchingTask { temp = null; } } catch (IOException ioe) { - throw new BuildException("IOException in " + src + " - " + - ioe.getClass().getName() + ":" - + ioe.getMessage(), ioe, getLocation()); + throw new BuildException("IOException in " + src + " - " + + ioe.getClass().getName() + ":" + + ioe.getMessage(), ioe, getLocation()); } finally { if (reader != null) { try { reader.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } if (writer != null) { try { writer.close(); - } catch (IOException e) {} + } catch (IOException e) { + // ignore + } } if (temp != null) { temp.delete(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/src/main/org/apache/tools/ant/taskdefs/Rmic.java index 12fe9b2a8..20d4c8124 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Rmic.java +++ b/src/main/org/apache/tools/ant/taskdefs/Rmic.java @@ -511,8 +511,8 @@ public class Rmic extends MatchingTask { int fileCount = compileList.size(); if (fileCount > 0) { - log("RMI Compiling " + fileCount + - " class" + (fileCount > 1 ? "es" : "") + " to " + baseDir, + log("RMI Compiling " + fileCount + + " class" + (fileCount > 1 ? "es" : "") + " to " + baseDir, Project.MSG_INFO); // finally, lets execute the compiler!! @@ -591,8 +591,8 @@ public class Rmic extends MatchingTask { } oldFile.delete(); } catch (IOException ioe) { - String msg = "Failed to copy " + oldFile + " to " + - newFile + " due to " + ioe.getMessage(); + String msg = "Failed to copy " + oldFile + " to " + + newFile + " due to " + ioe.getMessage(); throw new BuildException(msg, ioe, getLocation()); } } @@ -637,15 +637,15 @@ public class Rmic extends MatchingTask { } return isValidRmiRemote(testClass); } catch (ClassNotFoundException e) { - log("Unable to verify class " + classname + - ". It could not be found.", Project.MSG_WARN); + log("Unable to verify class " + classname + + ". It could not be found.", Project.MSG_WARN); } catch (NoClassDefFoundError e) { - log("Unable to verify class " + classname + - ". It is not defined.", Project.MSG_WARN); + log("Unable to verify class " + classname + + ". It is not defined.", Project.MSG_WARN); } catch (Throwable t) { - log("Unable to verify class " + classname + - ". Loading caused Exception: " + - t.getMessage(), Project.MSG_WARN); + log("Unable to verify class " + classname + + ". Loading caused Exception: " + + t.getMessage(), Project.MSG_WARN); } // we only get here if an exception has been thrown return false; diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 6286de1d0..d6799e244 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -375,7 +375,7 @@ public class SQLExec extends JDBCTask { String[] srcFiles = ds.getIncludedFiles(); // Make a transaction for each file - for (int j = 0 ; j < srcFiles.length ; j++) { + for (int j = 0; j < srcFiles.length; j++) { Transaction t = createTransaction(); t.setSrc(new File(srcDir, srcFiles[j])); } @@ -424,14 +424,18 @@ public class SQLExec extends JDBCTask { if (!isAutocommit() && conn != null && onError.equals("abort")) { try { conn.rollback(); - } catch (SQLException ex) {} + } catch (SQLException ex) { + // ignore + } } throw new BuildException(e, location); } catch (SQLException e) { if (!isAutocommit() && conn != null && onError.equals("abort")) { try { conn.rollback(); - } catch (SQLException ex) {} + } catch (SQLException ex) { + // ignore + } } throw new BuildException(e, location); } finally { @@ -442,11 +446,13 @@ public class SQLExec extends JDBCTask { if (conn != null) { conn.close(); } - } catch (SQLException e) {} + } catch (SQLException ex) { + // ignore + } } - log(goodSql + " of " + totalSql + - " SQL statements executed successfully"); + log(goodSql + " of " + totalSql + + " SQL statements executed successfully"); } finally { transactions = savedTransaction; sqlCommand = savedSqlCommand; diff --git a/src/main/org/apache/tools/ant/taskdefs/SignJar.java b/src/main/org/apache/tools/ant/taskdefs/SignJar.java index 435f29b3b..9e815bf03 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SignJar.java +++ b/src/main/org/apache/tools/ant/taskdefs/SignJar.java @@ -394,8 +394,8 @@ public class SignJar extends Task { } return false; } else { - return jarFile.getEntry(SIG_START + alias.toUpperCase() + - SIG_END) != null; + return jarFile.getEntry(SIG_START + alias.toUpperCase() + + SIG_END) != null; } } catch (IOException e) { return false; diff --git a/src/main/org/apache/tools/ant/taskdefs/Sync.java b/src/main/org/apache/tools/ant/taskdefs/Sync.java index 2ae613284..c62d8cc1a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Sync.java +++ b/src/main/org/apache/tools/ant/taskdefs/Sync.java @@ -326,14 +326,14 @@ public class Sync extends Task { /** * Subclass Copy in order to access it's file/dir maps. */ - public static class MyCopy - extends Copy { + public static class MyCopy extends Copy { // List of files that must be copied, irrelevant from the // fact that they are newer or not than the destination. private Hashtable _dest2src = new Hashtable(); - public MyCopy() {} + public MyCopy() { + } protected void buildMap(File fromDir, File toDir, String[] names, FileNameMapper mapper, Hashtable map) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java index 88ad55d56..520e958fd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -392,7 +392,7 @@ public class Tar extends MatchingTask { longWarningGiven = true; } } else if (longFileMode.isFailMode()) { - throw new BuildException( "Entry: " + vPath + throw new BuildException("Entry: " + vPath + " longer than " + TarConstants.NAMELEN + "characters.", getLocation()); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Touch.java b/src/main/org/apache/tools/ant/taskdefs/Touch.java index b7b73aefa..d978e62fa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Touch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Touch.java @@ -236,11 +236,11 @@ public class Touch extends Task { String[] srcFiles = ds.getIncludedFiles(); String[] srcDirs = ds.getIncludedDirectories(); - for (int j = 0; j < srcFiles.length ; j++) { + for (int j = 0; j < srcFiles.length; j++) { touch(new File(fromDir, srcFiles[j])); } - for (int j = 0; j < srcDirs.length ; j++) { + for (int j = 0; j < srcDirs.length; j++) { touch(new File(fromDir, srcDirs[j])); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Transform.java b/src/main/org/apache/tools/ant/taskdefs/Transform.java index 5235e8c56..9597e2839 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Transform.java +++ b/src/main/org/apache/tools/ant/taskdefs/Transform.java @@ -60,4 +60,5 @@ package org.apache.tools.ant.taskdefs; * @author Stefan Bodewig * @ant.task ignore="true" */ -public class Transform extends ExecuteOn {} +public class Transform extends ExecuteOn { +} diff --git a/src/main/org/apache/tools/ant/taskdefs/Untar.java b/src/main/org/apache/tools/ant/taskdefs/Untar.java index 352302661..c10e95496 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -211,7 +211,7 @@ public class Untar extends Expand { return new GZIPInputStream(istream); } else { if (BZIP2.equals(value)) { - final char[] magic = new char[] { 'B', 'Z' }; + final char[] magic = new char[] {'B', 'Z'}; for (int i = 0; i < magic.length; i++) { if (istream.read() != magic[i]) { throw new BuildException( diff --git a/src/main/org/apache/tools/ant/taskdefs/WhichResource.java b/src/main/org/apache/tools/ant/taskdefs/WhichResource.java index bd05e1b39..4c2d8b2e6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/WhichResource.java +++ b/src/main/org/apache/tools/ant/taskdefs/WhichResource.java @@ -120,11 +120,11 @@ public class WhichResource extends Task { * validate */ private void validate() { - int setcount=0; + int setcount = 0; if (classname != null) { setcount++; } - if (resource!=null) { + if (resource != null) { setcount++; } @@ -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"); } } @@ -148,10 +148,10 @@ public class WhichResource extends Task { */ public void execute() throws BuildException { validate(); - if (classpath!= null) { + if (classpath != null) { getProject().log("using user supplied classpath: " + classpath, Project.MSG_DEBUG); - classpath=classpath.concatSystemClasspath("ignore"); + classpath = classpath.concatSystemClasspath("ignore"); } else { classpath = new Path(getProject()); classpath = classpath.concatSystemClasspath("only"); @@ -161,23 +161,23 @@ public class WhichResource extends Task { loader = new AntClassLoader(getProject().getCoreLoader(), getProject(), classpath, false); - String location=null; - if (classname!=null) { + String location = null; + if (classname != null) { //convert a class name into a resource - classname= classname.replace('.', '/'); - resource="/"+ classname +".class"; + classname = classname.replace('.', '/'); + resource = "/" + classname + ".class"; } else { if (!resource.startsWith("/")) { - resource="/"+resource; + resource = "/" + resource; } } - log("Searching for "+resource,Project.MSG_VERBOSE); + log("Searching for " + resource, Project.MSG_VERBOSE); URL url; - url=loader.getResource(resource); - if (url!=null) { + url = loader.getResource(resource); + if (url != null) { //set the property location = url.toExternalForm(); - getProject().setNewProperty(property,location); + getProject().setNewProperty(property, location); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index cb75288f2..f8d092689 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -638,7 +638,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { * @return the parameter name * @exception BuildException if the name is not set. */ - public String getName() throws BuildException{ + public String getName() throws BuildException { if (name == null) { throw new BuildException("Name attribute is missing."); } @@ -651,7 +651,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { * @return the parameter expression * @exception BuildException if the expression is not set. */ - public String getExpression() throws BuildException{ + public String getExpression() throws BuildException { if (expression == null) { throw new BuildException("Expression attribute is missing."); } @@ -745,7 +745,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { liaison.addParam(p.getName(), p.getExpression()); } if (liaison instanceof TraXLiaison) { - configureTraXLiaison((TraXLiaison)liaison); + configureTraXLiaison((TraXLiaison) liaison); } } catch (Exception ex) { log("Failed to transform using stylesheet " + stylesheet, Project.MSG_INFO); @@ -767,7 +767,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { for (Enumeration attrs = factory.getAttributes(); attrs.hasMoreElements();) { Factory.Attribute attr = - (Factory.Attribute)attrs.nextElement(); + (Factory.Attribute) attrs.nextElement(); liaison.setAttribute(attr.getName(), attr.getValue()); } } @@ -781,7 +781,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { // configure output properties for (Enumeration props = outputProperties.elements(); props.hasMoreElements();) { - OutputProperty prop = (OutputProperty)props.nextElement(); + OutputProperty prop = (OutputProperty) props.nextElement(); liaison.setOutputProperty(prop.getName(), prop.getValue()); } } @@ -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 { diff --git a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java index 69b9bef8d..b4b244de5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java +++ b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java @@ -406,9 +406,8 @@ public class XmlProperty extends org.apache.tools.ant.Task { String nodeName = attributeNode.getNodeName(); String attributeValue = getAttributeValue(attributeNode); - Path containingPath = - (container != null && container instanceof Path - ? (Path) container : null ); + Path containingPath = (container != null + && container instanceof Path ? (Path) container : null); /* * The main conditional logic -- if the attribute @@ -501,7 +500,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { // when we read them, though (instead of keeping them // outside of the project and batch adding them at the end) // to allow other properties to reference them. - value = (String)addedAttributes.get(name) + "," + value; + value = (String) addedAttributes.get(name) + "," + value; getProject().setProperty(name, value); } else { getProject().setNewProperty(name, value); @@ -545,7 +544,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { * Return whether the provided attribute name is recognized or not. */ private static boolean isSemanticAttribute (String attributeName) { - for (int i=0;iA compiler adapter is an adapter that interprets the javac's * parameters in preperation to be passed off to the compier this @@ -67,7 +67,7 @@ import org.apache.tools.ant.taskdefs.Javac; * task, the execute command and a parameterless constructor (for * reflection).

* - * @author Jay Dickon Glanville + * @author Jay Dickon Glanville * jayglanville@home.com * @since Ant 1.3 */ diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java b/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java index 936e1cbde..a12c90e79 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java @@ -66,6 +66,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; * @since Ant 1.3 */ public class CompilerAdapterFactory { + private static final String MODERN_COMPILER = "com.sun.tools.javac.Main"; /** This is a singleton -- can't create instances!! */ private CompilerAdapterFactory() { @@ -95,7 +96,7 @@ public class CompilerAdapterFactory { * @throws BuildException if the compiler type could not be resolved into * a compiler adapter. */ - public static CompilerAdapter getCompiler(String compilerType, Task task) + public static CompilerAdapter getCompiler(String compilerType, Task task) throws BuildException { boolean isClassicCompilerSupported = true; //as new versions of java come out, add them to this test @@ -108,7 +109,7 @@ public class CompilerAdapterFactory { } if (compilerType.equalsIgnoreCase("extJavac")) { return new JavacExternal(); - } + } if (compilerType.equalsIgnoreCase("classic") || compilerType.equalsIgnoreCase("javac1.1") || compilerType.equalsIgnoreCase("javac1.2")) { @@ -119,7 +120,7 @@ public class CompilerAdapterFactory { + "not support the classic " + "compiler; upgrading to modern", Project.MSG_WARN); - compilerType="modern"; + compilerType = "modern"; } } //on java<=1.3 the modern falls back to classic if it is not found @@ -136,10 +137,10 @@ public class CompilerAdapterFactory { + "classic compiler", Project.MSG_WARN); return new Javac12(); } else { - throw new BuildException("Unable to find a javac " + throw new BuildException("Unable to find a javac " + "compiler;\n" - + "com.sun.tools.javac.Main " - + "is not on the " + + MODERN_COMPILER + + " is not on the " + "classpath.\n" + "Perhaps JAVA_HOME does not" + " point to the JDK"); @@ -167,21 +168,21 @@ public class CompilerAdapterFactory { /** * query for the Modern compiler existing * @return true iff classic os on the classpath - */ + */ private static boolean doesModernCompilerExist() { try { - Class.forName("com.sun.tools.javac.Main"); + Class.forName(MODERN_COMPILER); return true; } catch (ClassNotFoundException cnfe) { try { - CompilerAdapterFactory.class.getClassLoader().loadClass( "com.sun.tools.javac.Main" ); + CompilerAdapterFactory.class.getClassLoader().loadClass(MODERN_COMPILER); return true; } catch (ClassNotFoundException cnfe2) { } } return false; } - + /** * Tries to resolve the given classname into a compiler adapter. * Throws a fit if it can't. @@ -197,14 +198,14 @@ public class CompilerAdapterFactory { Object o = c.newInstance(); return (CompilerAdapter) o; } catch (ClassNotFoundException cnfe) { - throw new BuildException("Compiler Adapter '"+className + throw new BuildException("Compiler Adapter '" + className + "' can\'t be found.", cnfe); } catch (ClassCastException cce) { throw new BuildException(className + " isn\'t the classname of " + "a compiler adapter.", cce); } catch (Throwable t) { // for all other possibilities - throw new BuildException("Compiler Adapter "+className + throw new BuildException("Compiler Adapter " + className + " caused an interesting exception.", t); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 11032fed8..ef29ff780 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -74,7 +74,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; * Currently, this is a cut-and-paste of the original javac task. * * @author James Davidson duncan@x180.com - * @author Robin Green + * @author Robin Green * greenrd@hotmail.com * @author Stefan Bodewig * @author J D Glanville @@ -217,7 +217,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { if (memoryInitialSize != null) { if (!attributes.isForkedJavac()) { attributes.log("Since fork is false, ignoring " - + "memoryInitialSize setting.", + + "memoryInitialSize setting.", Project.MSG_WARN); } else { cmd.createArgument().setValue(memoryParameterPrefix @@ -435,7 +435,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { * POSIX seems to define a lower limit of 4k, so use a temporary * file if the total length of the command line exceeds this limit. */ - if (Commandline.toString(args).length() > 4096 + if (Commandline.toString(args).length() > 4096 && firstFileName >= 0) { PrintWriter out = null; try { @@ -459,11 +459,15 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { System.arraycopy(args, 0, commandArray, 0, firstFileName); commandArray[firstFileName] = "@" + tmpFile; } catch (IOException e) { - throw new BuildException("Error creating temporary file", + throw new BuildException("Error creating temporary file", e, location); } finally { if (out != null) { - try {out.close();} catch (Throwable t) {} + try { + out.close(); + } catch (Throwable t) { + // ignore + } } } } else { @@ -511,9 +515,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { */ protected boolean assumeJava11() { return "javac1.1".equals(attributes.getCompilerVersion()) || - ("classic".equals(attributes.getCompilerVersion()) + ("classic".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) || - ("extJavac".equals(attributes.getCompilerVersion()) + ("extJavac".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)); } @@ -523,9 +527,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { */ protected boolean assumeJava12() { return "javac1.2".equals(attributes.getCompilerVersion()) || - ("classic".equals(attributes.getCompilerVersion()) + ("classic".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) || - ("extJavac".equals(attributes.getCompilerVersion()) + ("extJavac".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)); } @@ -535,11 +539,11 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { */ protected boolean assumeJava13() { return "javac1.3".equals(attributes.getCompilerVersion()) || - ("classic".equals(attributes.getCompilerVersion()) + ("classic".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) || - ("modern".equals(attributes.getCompilerVersion()) + ("modern".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) || - ("extJavac".equals(attributes.getCompilerVersion()) + ("extJavac".equals(attributes.getCompilerVersion()) && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)); } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java index cad1e1d0a..da440566a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java @@ -80,7 +80,7 @@ public class Gcj extends DefaultCompilerAdapter { int firstFileName = cmd.size(); logAndAddFilesToCompile(cmd); - return + return executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } @@ -118,13 +118,13 @@ public class Gcj extends DefaultCompilerAdapter { if (destDir != null) { cmd.createArgument().setValue("-d"); cmd.createArgument().setFile(destDir); - + if (destDir.mkdirs()) { throw new BuildException("Can't make output directories. " + "Maybe permission is wrong. "); }; } - + cmd.createArgument().setValue("-classpath"); cmd.createArgument().setPath(classpath); diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java index 4997e013c..cc1fc494b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java @@ -69,7 +69,7 @@ import org.apache.tools.ant.types.Commandline; * was refactored. * * @author James Davidson duncan@x180.com - * @author Robin Green + * @author Robin Green * greenrd@hotmail.com * @author Stefan Bodewig * @author J D Glanville @@ -92,30 +92,30 @@ public class Javac12 extends DefaultCompilerAdapter { // Create an instance of the compiler, redirecting output to // the project log Class c = Class.forName("sun.tools.javac.Main"); - Constructor cons = - c.getConstructor(new Class[] { OutputStream.class, - String.class }); - Object compiler = cons.newInstance(new Object[] { logstr, - "javac" }); + Constructor cons = + c.getConstructor(new Class[] {OutputStream.class, + String.class}); + Object compiler + = cons.newInstance(new Object[] {logstr, "javac"}); // Call the compile() method - Method compile = c.getMethod("compile", - new Class [] { String[].class }); - Boolean ok = - (Boolean) compile.invoke(compiler, + Method compile = c.getMethod("compile", + new Class [] {String[].class}); + Boolean ok = + (Boolean) compile.invoke(compiler, new Object[] {cmd.getArguments()}); return ok.booleanValue(); } catch (ClassNotFoundException ex) { throw new BuildException("Cannot use classic compiler, as it is " + "not available. A common solution is " + "to set the environment variable" - + " JAVA_HOME to your jdk directory.", + + " JAVA_HOME to your jdk directory.", location); } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException) ex; } else { - throw new BuildException("Error starting classic compiler: ", + throw new BuildException("Error starting classic compiler: ", ex, location); } } finally { diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java index 3122fa585..0c6c3e707 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java @@ -66,9 +66,9 @@ import org.apache.tools.ant.types.Commandline; * was refactored. * * @author James Davidson duncan@x180.com - * @author Robin Green + * @author Robin Green * greenrd@hotmail.com - * @author Stefan Bodewig + * @author Stefan Bodewig * @author J D Glanville * * @since Ant 1.3 @@ -103,7 +103,7 @@ public class Javac13 extends DefaultCompilerAdapter { if (ex instanceof BuildException) { throw (BuildException) ex; } else { - throw new BuildException("Error starting modern compiler", + throw new BuildException("Error starting modern compiler", ex, location); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java index 2aa27e8ef..e82f1bfcb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java @@ -78,7 +78,7 @@ public class JavacExternal extends DefaultCompilerAdapter { int firstFileName = assumeJava11() ? -1 : cmd.size(); logAndAddFilesToCompile(cmd); - return + return executeExternalCompile(cmd.getCommandline(), firstFileName, true) == 0; diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java index 139f4612a..bf842a413 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java @@ -65,9 +65,9 @@ import org.apache.tools.ant.types.Path; * was refactored. * * @author James Davidson duncan@x180.com - * @author Robin Green + * @author Robin Green * greenrd@hotmail.com - * @author Stefan Bodewig + * @author Stefan Bodewig * @author J D Glanville * @since Ant 1.3 */ @@ -122,7 +122,7 @@ public class Jikes extends DefaultCompilerAdapter { if (jikesPath != null) { classpath.append(new Path(project, jikesPath)); } - + Commandline cmd = new Commandline(); String exec = getJavac().getExecutable(); cmd.setExecutable(exec == null ? "jikes" : exec); @@ -135,7 +135,7 @@ public class Jikes extends DefaultCompilerAdapter { cmd.createArgument().setValue("-d"); cmd.createArgument().setFile(destDir); } - + cmd.createArgument().setValue("-classpath"); cmd.createArgument().setPath(classpath); @@ -154,13 +154,13 @@ public class Jikes extends DefaultCompilerAdapter { } if (depend) { cmd.createArgument().setValue("-depend"); - } - + } + if (target != null) { cmd.createArgument().setValue("-target"); cmd.createArgument().setValue(target); } - + /** * XXX * Perhaps we shouldn't use properties for these @@ -185,7 +185,7 @@ public class Jikes extends DefaultCompilerAdapter { * that don't exist. As this is often the case, these * warning can be pretty annoying. */ - String warningsProperty = + String warningsProperty = project.getProperty("build.compiler.warnings"); if (warningsProperty != null) { attributes.log("!! the build.compiler.warnings property is " @@ -196,32 +196,32 @@ public class Jikes extends DefaultCompilerAdapter { cmd.createArgument().setValue("-nowarn"); } } if (attributes.getNowarn()) { - /* + /* * FIXME later * - * let the magic property win over the attribute for backwards + * let the magic property win over the attribute for backwards * compatibility */ cmd.createArgument().setValue("-nowarn"); } /** - * Jikes can issue pedantic warnings. + * Jikes can issue pedantic warnings. */ - String pedanticProperty = + String pedanticProperty = project.getProperty("build.compiler.pedantic"); if (pedanticProperty != null && Project.toBoolean(pedanticProperty)) { cmd.createArgument().setValue("+P"); } - + /** * Jikes supports something it calls "full dependency * checking", see the jikes documentation for differences * between -depend and +F. */ - String fullDependProperty = + String fullDependProperty = project.getProperty("build.compiler.fulldepend"); - if (fullDependProperty != null + if (fullDependProperty != null && Project.toBoolean(fullDependProperty)) { cmd.createArgument().setValue("+F"); } @@ -236,7 +236,7 @@ public class Jikes extends DefaultCompilerAdapter { int firstFileName = cmd.size(); logAndAddFilesToCompile(cmd); - return + return executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java index e5cbf4bb2..391da9ebb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java @@ -65,9 +65,9 @@ import org.apache.tools.ant.types.Path; * was refactored. * * @author James Davidson duncan@x180.com - * @author Robin Green + * @author Robin Green * greenrd@hotmail.com - * @author Stefan Bodewig + * @author Stefan Bodewig * @author J D Glanville * @since Ant 1.3 */ @@ -111,7 +111,7 @@ public class Jvc extends DefaultCompilerAdapter { cmd.createArgument().setValue("/d"); cmd.createArgument().setFile(destDir); } - + // Add the Classpath before the "internal" one. cmd.createArgument().setValue("/cp:p"); cmd.createArgument().setPath(classpath); @@ -147,7 +147,7 @@ public class Jvc extends DefaultCompilerAdapter { int firstFileName = cmd.size(); logAndAddFilesToCompile(cmd); - return + return executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java index 9b98e57d3..3fbe0f243 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java @@ -65,7 +65,7 @@ import org.apache.tools.ant.types.Path; * This is primarily a cut-and-paste from Jikes.java and * DefaultCompilerAdapter. * - * @author Takashi Okamoto + * @author Takashi Okamoto * @since Ant 1.4 */ public class Kjc extends DefaultCompilerAdapter { @@ -84,22 +84,22 @@ public class Kjc extends DefaultCompilerAdapter { // Call the compile() method Method compile = c.getMethod("compile", - new Class [] { String [].class }); - Boolean ok = - (Boolean) compile.invoke(null, + new Class [] {String [].class}); + Boolean ok = + (Boolean) compile.invoke(null, new Object[] {cmd.getArguments()}); return ok.booleanValue(); } catch (ClassNotFoundException ex) { throw new BuildException("Cannot use kjc compiler, as it is not " + "available. A common solution is to " + "set the environment variable CLASSPATH " - + "to your kjc archive (kjc.jar).", + + "to your kjc archive (kjc.jar).", location); } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException) ex; } else { - throw new BuildException("Error starting kjc compiler: ", + throw new BuildException("Error starting kjc compiler: ", ex, location); } } @@ -132,31 +132,31 @@ public class Kjc extends DefaultCompilerAdapter { if (bootclasspath != null) { cp.append(bootclasspath); } - + if (extdirs != null) { cp.addExtdirs(extdirs); } - + cp.append(classpath); if (compileSourcepath != null) { cp.append(compileSourcepath); } else { cp.append(src); - } + } cmd.createArgument().setPath(cp); - + // kjc-1.5A doesn't support -encoding option now. // but it will be supported near the feature. if (encoding != null) { cmd.createArgument().setValue("-encoding"); cmd.createArgument().setValue(encoding); } - + if (debug) { cmd.createArgument().setValue("-g"); } - + if (optimize) { cmd.createArgument().setValue("-O2"); } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java index bc41434a5..163854ca2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java @@ -61,7 +61,7 @@ import org.apache.tools.ant.types.Commandline; /** * The implementation of the sj compiler. * Uses the defaults for DefaultCompilerAdapter - * + * * @author Don Ferguson * @since Ant 1.4 */ @@ -79,7 +79,7 @@ public class Sj extends DefaultCompilerAdapter { int firstFileName = cmd.size() - compileList.length; - return + return executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; } diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/And.java b/src/main/org/apache/tools/ant/taskdefs/condition/And.java index dd6b85336..26bddb1a7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/And.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/And.java @@ -62,7 +62,7 @@ import org.apache.tools.ant.BuildException; * *

Iterates over all conditions and returns false as soon as one * evaluates to false.

- * + * * @author Stefan Bodewig * @since Ant 1.4 * @version $Revision$ diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Contains.java b/src/main/org/apache/tools/ant/taskdefs/condition/Contains.java index 3f45918bc..4c8f5338b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Contains.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Contains.java @@ -89,14 +89,14 @@ public class Contains implements Condition { /** * Whether to search ignoring case or not. - * + * * @since 1.1, Ant 1.5 */ public void setCasesensitive(boolean b) { caseSensitive = b; } - /** + /** * @since 1.1, Ant 1.5 */ public boolean eval() throws BuildException { @@ -105,7 +105,7 @@ public class Contains implements Condition { + "in contains"); } - return caseSensitive + return caseSensitive ? string.indexOf(subString) > -1 : string.toLowerCase().indexOf(subString.toLowerCase()) > -1; } diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java b/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java index df37b73bc..5e9ad66f1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java @@ -105,7 +105,7 @@ public class Equals implements Condition { arg1 = arg1.trim(); arg2 = arg2.trim(); } - + return caseSensitive ? arg1.equals(arg2) : arg1.equalsIgnoreCase(arg2); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Http.java b/src/main/org/apache/tools/ant/taskdefs/condition/Http.java index 1b9c41d0a..41f393880 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Http.java @@ -65,7 +65,7 @@ import org.apache.tools.ant.ProjectComponent; /** * Condition to wait for a HTTP request to succeed. Its attribute(s) are: * url - the URL of the request. - * errorsBeginAt - number at which errors begin at; default=400. + * errorsBeginAt - number at which errors begin at; default=400. * @author Denis Hennessy * @since Ant 1.5 */ @@ -76,12 +76,12 @@ public class Http extends ProjectComponent implements Condition { spec = url; } - private int errorsBeginAt=400; - + private int errorsBeginAt = 400; + public void setErrorsBeginAt(int errorsBeginAt) { - this.errorsBeginAt=errorsBeginAt; + this.errorsBeginAt = errorsBeginAt; } - + public boolean eval() throws BuildException { if (spec == null) { throw new BuildException("No url specified in http condition"); @@ -94,7 +94,7 @@ public class Http extends ProjectComponent implements Condition { if (conn instanceof HttpURLConnection) { HttpURLConnection http = (HttpURLConnection) conn; int code = http.getResponseCode(); - log("Result code for " + spec + " was " + code, + log("Result code for " + spec + " was " + code, Project.MSG_VERBOSE); if (code > 0 && code < errorsBeginAt) { return true; diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java b/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java index 22bd9f421..a4b8294c1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/IsFalse.java @@ -64,14 +64,14 @@ import org.apache.tools.ant.ProjectComponent; * @since Ant 1.5 */ public class IsFalse extends ProjectComponent implements Condition { - /** + /** * what we eval - */ - private Boolean value=null; + */ + private Boolean value = null; /** * set the value to be tested; let ant eval it to true/false - */ + */ public void setValue(boolean value) { this.value = new Boolean(value); } @@ -79,7 +79,7 @@ public class IsFalse extends ProjectComponent implements Condition { /** * return the inverted value; * @throws BuildException if someone forgot to spec a value - */ + */ public boolean eval() throws BuildException { if (value == null) { throw new BuildException("Nothing to test for falsehood"); diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java b/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java index c3c69d2c1..664df1e3f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java @@ -84,7 +84,7 @@ public class IsReference extends ProjectComponent implements Condition { throw new BuildException("No reference specified for isreference " + "condition"); } - + Object o = getProject().getReference(ref.getRefId()); if (o == null) { @@ -92,11 +92,11 @@ public class IsReference extends ProjectComponent implements Condition { } else if (type == null) { return true; } else { - Class typeClass = + Class typeClass = (Class) getProject().getDataTypeDefinitions().get(type); if (typeClass == null) { - typeClass = + typeClass = (Class) getProject().getTaskDefinitions().get(type); } diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java b/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java index 2f6231832..419d6c3c2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java @@ -67,14 +67,16 @@ import org.apache.tools.ant.ProjectComponent; public class IsSet extends ProjectComponent implements Condition { private String property; - public void setProperty(String p) {property = p;} + public void setProperty(String p) { + property = p; + } public boolean eval() throws BuildException { if (property == null) { throw new BuildException("No property specified for isset " + "condition"); } - + return getProject().getProperty(property) != null; } diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java b/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java index 3d0ce4b10..02a4c1127 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java @@ -64,14 +64,14 @@ import org.apache.tools.ant.ProjectComponent; * @since Ant 1.5 */ public class IsTrue extends ProjectComponent implements Condition { - /** + /** * what we eval - */ - private Boolean value=null; + */ + private Boolean value = null; /** * set the value to be tested; let ant eval it to true/false - */ + */ public void setValue(boolean value) { this.value = new Boolean(value); } @@ -79,7 +79,7 @@ public class IsTrue extends ProjectComponent implements Condition { /** * return the value; * @throws BuildException if someone forgot to spec a value - */ + */ public boolean eval() throws BuildException { if (value == null) { throw new BuildException("Nothing to test for truth"); diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Or.java b/src/main/org/apache/tools/ant/taskdefs/condition/Or.java index 35766b204..5e4f37e11 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Or.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Or.java @@ -62,7 +62,7 @@ import org.apache.tools.ant.BuildException; * *

Iterates over all conditions and returns true as soon as one * evaluates to true.

- * + * * @author Stefan Bodewig * @since Ant 1.4 * @version $Revision$ diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java index 46da4fccd..27c008e20 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java @@ -79,7 +79,8 @@ public class Os implements Condition { private String version; private String arch; - public Os() {} + public Os() { + } public Os(String family) { setFamily(family); @@ -103,7 +104,9 @@ public class Os implements Condition { *
  • os/400
  • * */ - public void setFamily(String f) {family = f.toLowerCase(Locale.US);} + public void setFamily(String f) { + family = f.toLowerCase(Locale.US); + } /** * Sets the desired OS name diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java b/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java index 78964da1d..9b063f8cd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java @@ -87,7 +87,7 @@ public class Socket extends ProjectComponent implements Condition { if (port == 0) { throw new BuildException("No port specified in socket condition"); } - log("Checking for listener at " + server + ":" + port, + log("Checking for listener at " + server + ":" + port, Project.MSG_VERBOSE); try { new java.net.Socket(server, port); diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java index ec3537894..7d146ba57 100644 --- a/src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java +++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java @@ -90,7 +90,7 @@ class CVSEntry { void setAuthor(final String author) { m_author = author; } - + String getAuthor() { return m_author; } @@ -104,7 +104,7 @@ class CVSEntry { } public String toString() { - return getAuthor() + "\n" + getDate() + "\n" + getFiles() + "\n" + return getAuthor() + "\n" + getDate() + "\n" + getFiles() + "\n" + getComment(); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java index 91d90677e..03952b7dc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java @@ -221,7 +221,7 @@ public class ChangeLogTask extends Task { * cvs command */ public void execute() throws BuildException { - File savedDir = m_dir;// may be altered in validate + File savedDir = m_dir; // may be altered in validate try { @@ -251,7 +251,7 @@ public class ChangeLogTask extends Task { // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); - // Supply '-d' as a separate argument - Bug# 14397 + // Supply '-d' as a separate argument - Bug# 14397 command.createArgument().setValue("-d"); command.createArgument().setValue(dateRange); } diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java index 49a43d2a6..9b49ffc2e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java +++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java @@ -66,10 +66,10 @@ import java.util.TimeZone; */ class ChangeLogWriter { /** output format for dates writtn to xml file */ - private static final SimpleDateFormat c_outputDate + private static final SimpleDateFormat c_outputDate = new SimpleDateFormat("yyyy-MM-dd"); /** output format for times writtn to xml file */ - private static final SimpleDateFormat c_outputTime + private static final SimpleDateFormat c_outputTime = new SimpleDateFormat("HH:mm"); static { @@ -107,11 +107,11 @@ class ChangeLogWriter { */ private void printEntry(final PrintWriter output, final CVSEntry entry) { output.println("\t"); - output.println("\t\t" + c_outputDate.format(entry.getDate()) + output.println("\t\t" + c_outputDate.format(entry.getDate()) + ""); - output.println("\t\t