From 962a59d64f4793a2341196caac2356bd71e5ad4a Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Sun, 21 Sep 2003 20:20:03 +0000 Subject: [PATCH] Style Submitted by: Larry Shatzer (larry dot shatzer at spirent dot com) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275272 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/PropertyHelper.java | 2 +- .../org/apache/tools/ant/taskdefs/Exit.java | 16 ++--- .../org/apache/tools/ant/taskdefs/Java.java | 4 +- .../tools/ant/taskdefs/RecorderEntry.java | 4 +- .../tools/ant/taskdefs/condition/Socket.java | 8 +-- .../tools/ant/taskdefs/email/EmailTask.java | 3 +- .../optional/dotnet/DotnetCompile.java | 4 +- .../ant/taskdefs/optional/dotnet/Ildasm.java | 58 +++++++++---------- .../taskdefs/optional/dotnet/NetCommand.java | 2 +- .../extension/resolvers/AntResolver.java | 5 +- .../j2ee/AbstractHotDeploymentTool.java | 15 +++-- .../j2ee/GenericHotDeploymentTool.java | 3 +- .../ant/taskdefs/optional/javacc/JJDoc.java | 14 ++--- .../ant/taskdefs/optional/javacc/JJTree.java | 8 +-- .../optional/junit/JUnitTestRunner.java | 8 +-- .../ant/taskdefs/optional/net/SetProxy.java | 12 ++-- .../taskdefs/optional/perforce/P4Submit.java | 5 +- .../apache/tools/ant/types/Assertions.java | 10 ++-- .../apache/tools/ant/types/Commandline.java | 10 ++-- .../tools/ant/types/CommandlineJava.java | 26 ++++----- .../tools/ant/types/optional/image/Scale.java | 19 +++--- .../types/resolver/ApacheCatalogResolver.java | 6 +- .../ant/types/selectors/MappingSelector.java | 2 +- .../org/apache/tools/ant/util/FileUtils.java | 4 +- .../org/apache/tools/ant/util/JAXPUtils.java | 4 +- .../tools/bzip2/CBZip2OutputStream.java | 16 ++--- 26 files changed, 129 insertions(+), 139 deletions(-) diff --git a/src/main/org/apache/tools/ant/PropertyHelper.java b/src/main/org/apache/tools/ant/PropertyHelper.java index 5b8d956a3..1c4bb26cb 100644 --- a/src/main/org/apache/tools/ant/PropertyHelper.java +++ b/src/main/org/apache/tools/ant/PropertyHelper.java @@ -156,7 +156,7 @@ public class PropertyHelper { * * @return the project's property helper. */ - public synchronized static + public static synchronized PropertyHelper getPropertyHelper(Project project) { PropertyHelper helper = (PropertyHelper) project.getReference("ant.PropertyHelper"); diff --git a/src/main/org/apache/tools/ant/taskdefs/Exit.java b/src/main/org/apache/tools/ant/taskdefs/Exit.java index 0831f04a1..56d50088b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exit.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exit.java @@ -117,24 +117,24 @@ public class Exit extends Task { */ public void execute() throws BuildException { if (testIfCondition() && testUnlessCondition()) { - String text=null; + String text = null; if (message != null && message.length() > 0) { - text=message; + text = message; } else { - if(getProject().getProperty(ifCondition) != null) { - text="if="+ifCondition; + if (getProject().getProperty(ifCondition) != null) { + text = "if=" + ifCondition; } - if (unlessCondition!=null && unlessCondition.length()>0 + if (unlessCondition != null && unlessCondition.length() > 0 && getProject().getProperty(unlessCondition) == null) { if (text == null) { text = ""; } else { - text+=" and "; + text += " and "; } - text+="unless="+unlessCondition; + text += "unless=" + unlessCondition; } else { - if(text==null) { + if (text == null) { text = "No message"; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index 6cce7c262..7875bf085 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -157,8 +157,8 @@ public class Java extends Task { + "not compatible with spawn"); } if (fork) { - if(perm != null) { - log("Permissions can not be set this way in forked mode.",Project.MSG_WARN); + if (perm != null) { + log("Permissions can not be set this way in forked mode.", Project.MSG_WARN); } log(cmdl.describeCommand(), Project.MSG_VERBOSE); } else { diff --git a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java index ee76fed82..483e5eb3f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java +++ b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,7 +82,7 @@ public class RecorderEntry implements BuildLogger { /** The output PrintStream to record to. */ private PrintStream out = null; /** The start time of the last know target. */ - private long targetStartTime = 0l; + private long targetStartTime = 0L; /** Strip task banners if true. */ private boolean emacsMode = false; 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 bde08b8b2..8328cd4e2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java @@ -108,13 +108,11 @@ public class Socket extends ProjectComponent implements Condition { s = new java.net.Socket(server, port); } catch (IOException e) { return false; - } - finally { - if (s != null){ + } finally { + if (s != null) { try { s.close(); - } - catch (IOException ioe){ + } catch (IOException ioe) { // Intentionally left blank } } diff --git a/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java b/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java index 8f1a8e28d..2656d865a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java @@ -602,8 +602,7 @@ public class EmailTask if (failOnError) { throw e; } - } - catch (Exception e) { + } catch (Exception e) { log("Failed to send email", Project.MSG_WARN); if (failOnError) { throw new BuildException(e); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java index 33af922be..b4726de68 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java @@ -394,7 +394,7 @@ public abstract class DotnetCompile *@return The Parameter to CSC */ protected String getIncludeDefaultReferencesParameter() { - if(standardLib==null) { + if (standardLib == null) { return "/nostdlib" + (includeDefaultReferences ? "-" : "+"); } else { return null; @@ -868,7 +868,7 @@ public abstract class DotnetCompile if (outputFile != null && outputFile.isDirectory()) { throw new BuildException("destFile cannot be a directory"); } - if(getExecutable()==null) { + if (getExecutable() == null) { throw new BuildException("There is no executable defined for this task"); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java index 5f478e85b..dde841da8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ildasm.java @@ -105,7 +105,7 @@ public class Ildasm extends Task { /** * progress bar switch */ - private boolean progressBar=false; + private boolean progressBar = false; /** * what is our encoding @@ -116,45 +116,45 @@ public class Ildasm extends Task { * /bytes flag for byte markup */ - private boolean bytes=false; + private boolean bytes = false; /** * line numbers? /linenum */ - private boolean linenumbers=false; + private boolean linenumbers = false; /** * /raweh flag for raw exception handling */ - private boolean rawExceptionHandling=false; + private boolean rawExceptionHandling = false; /** * show the source; /source */ - private boolean showSource=false; + private boolean showSource = false; /** * /quoteallnames to quote all names */ - private boolean quoteallnames=false; + private boolean quoteallnames = false; /** * /header for header information */ - private boolean header=false; + private boolean header = false; /** * when false, sets the /noil attribute * to suppress assembly info */ - private boolean assembler=true; + private boolean assembler = true; /** * include metadata * /tokens */ - private boolean metadata=false; + private boolean metadata = false; /** * what visibility do we want. @@ -171,7 +171,7 @@ public class Ildasm extends Task { /** * override for the executable */ - private String executable="ildasm"; + private String executable = "ildasm"; /** * name of the directory for resources to be created. We cannot control @@ -338,13 +338,13 @@ public class Ildasm extends Task { * verify that source and dest are ok */ private void validate() { - if(sourceFile==null || !sourceFile.exists() || !sourceFile.isFile()) { + if (sourceFile == null || !sourceFile.exists() || !sourceFile.isFile()) { throw new BuildException("invalid source"); } - if(destFile==null || destFile.isDirectory()) { + if (destFile == null || destFile.isDirectory()) { throw new BuildException("invalid dest"); } - if(resourceDir!=null + if (resourceDir != null && (!resourceDir.exists() || !resourceDir.isDirectory())) { throw new BuildException("invalid resource directory"); } @@ -355,13 +355,13 @@ public class Ildasm extends Task { * @return */ private boolean isDisassemblyNeeded() { - if(!destFile.exists()) { + if (!destFile.exists()) { return true; } - long sourceTime=sourceFile.lastModified(); - long destTime=destFile.lastModified(); - return sourceTime>(destTime+ FileUtils.newFileUtils().getFileTimestampGranularity()); - + long sourceTime = sourceFile.lastModified(); + long destTime = destFile.lastModified(); + return sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity()); + } /** * do the work @@ -373,11 +373,11 @@ public class Ildasm extends Task { command.setFailOnError(true); //fill in args command.addArgument("/text"); - command.addArgument("/out="+destFile.toString()); - if(!progressBar) { + command.addArgument("/out=" + destFile.toString()); + if (!progressBar) { command.addArgument("/nobar"); } - if(linenumbers) { + if (linenumbers) { command.addArgument("/linenum"); } if (showSource) { @@ -395,7 +395,7 @@ public class Ildasm extends Task { if (metadata) { command.addArgument("/tokens"); } - command.addArgument("/item:",item); + command.addArgument("/item:", item); if (rawExceptionHandling) { command.addArgument("/raweh"); } @@ -403,16 +403,16 @@ public class Ildasm extends Task { if (bytes) { command.addArgument("/bytes"); } - command.addArgument("/vis:",visibility); + command.addArgument("/vis:", visibility); //add the source file command.addArgument(sourceFile.getAbsolutePath()); //determine directory: resourceDir if set, //the dir of the destFile if not - File execDir=resourceDir; - if(execDir==null) { - execDir=destFile.getParentFile(); + File execDir = resourceDir; + if (execDir == null) { + execDir = destFile.getParentFile(); } command.setDirectory(execDir); @@ -421,7 +421,7 @@ public class Ildasm extends Task { command.runCommand(); } catch (BuildException e) { //forcibly delete the output file in case of trouble - if(destFile.exists()) { + if (destFile.exists()) { destFile.delete(); } //then rethrow the exception @@ -434,7 +434,7 @@ public class Ildasm extends Task { * encoding options; the default is ascii */ public static class EncodingTypes extends EnumeratedAttribute { - public final static String UNICODE= "unicode"; + public final static String UNICODE = "unicode"; public final static String UTF8 = "utf8"; public final static String ASCII = "ascii"; public String[] getValues() { @@ -451,7 +451,7 @@ public class Ildasm extends Task { * @return */ public static String getEncodingOption(String enumValue) { - if(UNICODE.equals(enumValue)) { + if (UNICODE.equals(enumValue)) { return "/unicode"; } if (UTF8.equals(enumValue)) { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java index 9bdf8e0a5..64badbe35 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java @@ -244,7 +244,7 @@ public class NetCommand { } File dir = owner.getProject().getBaseDir(); if (directory != null) { - dir=directory; + dir = directory; } ExecuteStreamHandler handler = new LogStreamHandler(owner, diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java index e1e4bcdb9..771db37f6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,8 +99,7 @@ public class AntResolver final File dir = m_antfile.getParentFile().getCanonicalFile(); ant.setDir(dir); - } - catch (final IOException ioe) { + } catch (final IOException ioe) { throw new BuildException(ioe.getMessage(), ioe); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java index 8e05c92a4..23216cc84 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -101,9 +101,9 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool { * @return A Path object representing the classpath to be used. */ public Path createClasspath() { - if (classpath == null) + if (classpath == null) { classpath = new Path(task.getProject()); - + } return classpath.createPath(); } @@ -126,14 +126,17 @@ public abstract class AbstractHotDeploymentTool implements HotDeploymentTool { * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. */ public void validateAttributes() throws BuildException { - if (task.getAction() == null) + if (task.getAction() == null) { throw new BuildException("The \"action\" attribute must be set"); + } - if (!isActionValid()) + if (!isActionValid()) { throw new BuildException("Invalid action \"" + task.getAction() + "\" passed"); + } - if (classpath == null) + if (classpath == null) { throw new BuildException("The classpath attribute must be set"); + } } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java index bdf9821e8..9dc0ecd14 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java @@ -144,8 +144,9 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool { public void validateAttributes() throws BuildException { super.validateAttributes(); - if (className == null) + if (className == null) { throw new BuildException("The classname attribute must be set"); + } } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java index 3260bfd99..a23b962e8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java @@ -73,7 +73,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; * * @author Jene Jasper jjasper@abz.nl * @author thomas.haas@softwired-inc.com - * @author Michael Saunders + * @author Michael Saunders * michael@amtec.com */ public class JJDoc extends Task { @@ -156,12 +156,12 @@ public class JJDoc extends Task { } if (outputFile != null) { - cmdl.createArgument() .setValue("-" + OUTPUT_FILE + ":" + cmdl.createArgument() .setValue("-" + OUTPUT_FILE + ":" + outputFile.replace('\\', '/')); } // use the directory containing the target as the output directory - File javaFile = new File(createOutputFileName(target, outputFile, + File javaFile = new File(createOutputFileName(target, outputFile, plainText)); if (javaFile.exists() @@ -173,7 +173,7 @@ public class JJDoc extends Task { cmdl.createArgument().setValue(target.getAbsolutePath()); - cmdl.setClassname(JavaCC.getMainClass(javaccHome, + cmdl.setClassname(JavaCC.getMainClass(javaccHome, JavaCC.TASKDEF_TYPE_JJDOC)); final Path classpath = cmdl.createClasspath(getProject()); @@ -205,7 +205,7 @@ public class JJDoc extends Task { private String createOutputFileName(File target, String optionalOutputFile, boolean plainText) { String suffix = DEFAULT_SUFFIX_HTML; - String javaccFile = target.getAbsolutePath().replace('\\','/'); + String javaccFile = target.getAbsolutePath().replace('\\', '/'); if (plainText) { suffix = DEFAULT_SUFFIX_TEXT; @@ -228,12 +228,12 @@ public class JJDoc extends Task { if (currentSuffix.equals(suffix)) { optionalOutputFile = javaccFile + suffix; } else { - optionalOutputFile = javaccFile.substring(0, suffixPos) + optionalOutputFile = javaccFile.substring(0, suffixPos) + suffix; } } } else { - optionalOutputFile = optionalOutputFile.replace('\\','/'); + optionalOutputFile = optionalOutputFile.replace('\\', '/'); } return (getProject().getBaseDir() + "/" + optionalOutputFile) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java index 26e8c40c3..de73baaf5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java @@ -308,7 +308,7 @@ public class JJTree extends Task { String outputDirectory) { optionalOutputFile = validateOutputFile(optionalOutputFile, outputDirectory); - String jjtreeFile = target.getAbsolutePath().replace('\\','/'); + String jjtreeFile = target.getAbsolutePath().replace('\\', '/'); if ((optionalOutputFile == null) || optionalOutputFile.equals("")) { int filePos = jjtreeFile.lastIndexOf("/"); @@ -340,7 +340,7 @@ public class JJTree extends Task { return (outputDirectory + "/" + optionalOutputFile).replace('\\', '/'); } - /* + /* * Not used anymore private boolean isAbsolute(String fileName) { return (fileName.startsWith("/") || (new File(fileName).isAbsolute())); @@ -357,8 +357,8 @@ public class JJTree extends Task { * @return * @throws BuildException */ - private String validateOutputFile(String outputFile, - String outputDirectory) + private String validateOutputFile(String outputFile, + String outputDirectory) throws BuildException { if (outputFile == null) { return null; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java index 4174519ec..985dcbecb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java @@ -318,16 +318,16 @@ public class JUnitTestRunner implements TestListener { } perm = null; } else { - if(perm != null) { + if (perm != null) { perm.setSecurityManager(); } } - + try { suite.run(res); } finally { - if(perm != null) { + if (perm != null) { perm.restoreSecurityManager(); } if (savedOut != null) { @@ -413,7 +413,7 @@ public class JUnitTestRunner implements TestListener { res.stop(); } } - + /** * Permissions for the test run. * @since Ant 1.6 diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java index 08043f44f..38113915a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java @@ -301,17 +301,13 @@ public class SetProxy extends Task { Method reset = c.getMethod("resetProperties", null); reset.invoke(null, null); return true; - } - catch (ClassNotFoundException cnfe) { + } catch (ClassNotFoundException cnfe) { return false; - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { return false; - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { return false; - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { return false; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java index 69edd3def..3989b00ac 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java @@ -136,9 +136,8 @@ public class P4Submit extends P4Base { found = true; } } - } - // NumberFormatException or ArrayOutOfBondsException could happen here - catch (Exception e) { + // NumberFormatException or ArrayOutOfBondsException could happen here + } catch (Exception e) { String msg = "Failed to parse " + line + "\n" + " due to " + e.getMessage(); throw new BuildException(msg, e, getLocation()); diff --git a/src/main/org/apache/tools/ant/types/Assertions.java b/src/main/org/apache/tools/ant/types/Assertions.java index 75a46f72c..f2b9e7c57 100644 --- a/src/main/org/apache/tools/ant/types/Assertions.java +++ b/src/main/org/apache/tools/ant/types/Assertions.java @@ -187,7 +187,7 @@ public class Assertions extends DataType { * @return */ private int getFinalSize() { - return assertionList.size()+ (enableSystemAssertions!=null?1:0); + return assertionList.size() + (enableSystemAssertions != null ? 1 : 0); } /** @@ -254,16 +254,16 @@ public class Assertions extends DataType { * @throws CloneNotSupportedException */ protected Object clone() throws CloneNotSupportedException { - Assertions that=(Assertions) super.clone(); - that.assertionList=(ArrayList) assertionList.clone(); - return that; + Assertions that = (Assertions) super.clone(); + that.assertionList = (ArrayList) assertionList.clone(); + return that; } /** * base class for our assertion elements. */ - public static abstract class BaseAssertion { + public abstract static class BaseAssertion { private String packageName; private String className; diff --git a/src/main/org/apache/tools/ant/types/Commandline.java b/src/main/org/apache/tools/ant/types/Commandline.java index 9133be8de..eceb79a0e 100644 --- a/src/main/org/apache/tools/ant/types/Commandline.java +++ b/src/main/org/apache/tools/ant/types/Commandline.java @@ -303,11 +303,11 @@ public class Commandline implements Cloneable { * Returns the executable and all defined arguments. */ public String[] getCommandline() { - List commands=new LinkedList(); + List commands = new LinkedList(); ListIterator list = commands.listIterator(); addCommandToList(list); final String[] result = new String[commands.size()]; - return (String[])commands.toArray(result); + return (String[]) commands.toArray(result); } /** @@ -316,7 +316,7 @@ public class Commandline implements Cloneable { * @since Ant 1.6 */ public void addCommandToList(ListIterator list) { - if(executable!=null) { + if (executable != null) { list.add(executable); } addArgumentsToList(list); @@ -331,7 +331,7 @@ public class Commandline implements Cloneable { List result = new ArrayList(arguments.size() * 2); addArgumentsToList(result.listIterator()); String [] res = new String[result.size()]; - return (String[])result.toArray(res); + return (String[]) result.toArray(res); } /** @@ -374,7 +374,7 @@ public class Commandline implements Cloneable { if (argument.indexOf("\"") > -1) { if (argument.indexOf("\'") > -1) { throw new BuildException("Can\'t handle single and double" - +" quotes in same argument"); + + " quotes in same argument"); } else { return '\'' + argument + '\''; } diff --git a/src/main/org/apache/tools/ant/types/CommandlineJava.java b/src/main/org/apache/tools/ant/types/CommandlineJava.java index db7945369..3bd58fb6b 100644 --- a/src/main/org/apache/tools/ant/types/CommandlineJava.java +++ b/src/main/org/apache/tools/ant/types/CommandlineJava.java @@ -96,13 +96,13 @@ public class CommandlineJava implements Cloneable { /** * any assertions to make? Currently only supported in forked JVMs */ - private Assertions assertions=null; + private Assertions assertions = null; /** * Indicate whether it will execute a jar file or not, in this case * the first vm option must be a -jar and the 'executable' is a jar file. */ - private boolean executeJar = false; + private boolean executeJar = false; /** * Specialized Environment class for System properties @@ -119,13 +119,13 @@ public class CommandlineJava implements Cloneable { */ public String[] getVariables() throws BuildException { - List definitions=new LinkedList(); - ListIterator list=definitions.listIterator(); + List definitions = new LinkedList(); + ListIterator list = definitions.listIterator(); addDefinitionsToList(list); - if(definitions.size()==0) { + if (definitions.size() == 0) { return null; } else { - return (String[])definitions.toArray(new String[0]); + return (String[]) definitions.toArray(new String[0]); } } @@ -135,8 +135,8 @@ public class CommandlineJava implements Cloneable { */ public void addDefinitionsToList(ListIterator listIt) { String[] props = super.getVariables(); - if(props!=null) { - for (int i=0; i < props.length; i++) { + if (props != null) { + for (int i = 0; i < props.length; i++) { listIt.add("-D" + props[i]); } } @@ -379,12 +379,12 @@ public class CommandlineJava implements Cloneable { */ public String[] getCommandline() { //create the list - List commands=new LinkedList(); + List commands = new LinkedList(); final ListIterator listIterator = commands.listIterator(); //fill it addCommandsToList(listIterator); //convert to an array - return (String[])commands.toArray(new String[0]); + return (String[]) commands.toArray(new String[0]); } /** @@ -503,8 +503,8 @@ public class CommandlineJava implements Cloneable { size++; } //assertions take up space too - if(getAssertions()!=null) { - size+=getAssertions().size(); + if (getAssertions() != null) { + size += getAssertions().size(); } return size; } @@ -582,7 +582,7 @@ public class CommandlineJava implements Cloneable { if (bootclasspath != null) { c.bootclasspath = (Path) bootclasspath.clone(); } - if( assertions != null ) { + if (assertions != null) { c.assertions = (Assertions) assertions.clone(); } return c; diff --git a/src/main/org/apache/tools/ant/types/optional/image/Scale.java b/src/main/org/apache/tools/ant/types/optional/image/Scale.java index a7272ae64..d727d8068 100644 --- a/src/main/org/apache/tools/ant/types/optional/image/Scale.java +++ b/src/main/org/apache/tools/ant/types/optional/image/Scale.java @@ -83,7 +83,7 @@ public class Scale extends TransformOperation implements DrawOperation { /** * Sets the behaviour regarding the image proportions. */ - public void setProportions(ProportionsAttribute pa){ + public void setProportions(ProportionsAttribute pa) { proportions = pa.getValue(); } @@ -139,23 +139,20 @@ public class Scale extends TransformOperation implements DrawOperation { y_fl = (y_fl / image.getHeight()); } - if("width".equals(proportions)){ + if ("width".equals(proportions)) { y_fl = x_fl; - } - else if("height".equals(proportions)){ + } else if ("height".equals(proportions)) { x_fl = y_fl; - } - else if("fit".equals(proportions)){ - x_fl = y_fl = Math.min(x_fl,y_fl); - } - else if("cover".equals(proportions)){ - x_fl = y_fl = Math.max(x_fl,y_fl); + } else if ("fit".equals(proportions)) { + x_fl = y_fl = Math.min(x_fl, y_fl); + } else if ("cover".equals(proportions)) { + x_fl = y_fl = Math.max(x_fl, y_fl); } pb.add(new Float(x_fl)); pb.add(new Float(y_fl)); - log("\tScaling to " + (x_fl*100) + "% x " + (y_fl*100)+ "%"); + log("\tScaling to " + (x_fl * 100) + "% x " + (y_fl * 100) + "%"); return JAI.create("scale", pb); } diff --git a/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java b/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java index 255be613b..0ffcb8268 100644 --- a/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java +++ b/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java @@ -145,11 +145,9 @@ public class ApacheCatalogResolver extends CatalogResolver { try { catalog.parseCatalog(file); - } - catch (MalformedURLException ex) { + } catch (MalformedURLException ex) { throw new BuildException(ex); - } - catch (IOException ex) { + } catch (IOException ex) { throw new BuildException(ex); } } diff --git a/src/main/org/apache/tools/ant/types/selectors/MappingSelector.java b/src/main/org/apache/tools/ant/types/selectors/MappingSelector.java index c515a049b..11acbbce7 100644 --- a/src/main/org/apache/tools/ant/types/selectors/MappingSelector.java +++ b/src/main/org/apache/tools/ant/types/selectors/MappingSelector.java @@ -78,7 +78,7 @@ public abstract class MappingSelector extends BaseSelector { * */ public MappingSelector() { - granularity=(int) FileUtils.newFileUtils().getFileTimestampGranularity(); + granularity = (int) FileUtils.newFileUtils().getFileTimestampGranularity(); } diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index 00d8c9477..eada52f11 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -114,7 +114,7 @@ public class FileUtils { /** * the granularity of timestamps under FAT */ - public static final long FAT_FILE_TIMESTAMP_GRANULARITY=2000; + public static final long FAT_FILE_TIMESTAMP_GRANULARITY = 2000; // stolen from FilePathToURI of the Xerces-J team @@ -1334,7 +1334,7 @@ public class FileUtils { } public long getFileTimestampGranularity() { - if(Os.isFamily("dos")) { + if (Os.isFamily("dos")) { return FAT_FILE_TIMESTAMP_GRANULARITY; } else { return 0; diff --git a/src/main/org/apache/tools/ant/util/JAXPUtils.java b/src/main/org/apache/tools/ant/util/JAXPUtils.java index cae60cbf6..033ade3bf 100644 --- a/src/main/org/apache/tools/ant/util/JAXPUtils.java +++ b/src/main/org/apache/tools/ant/util/JAXPUtils.java @@ -106,7 +106,7 @@ public class JAXPUtils { * * @since Ant 1.5 */ - public synchronized static SAXParserFactory getParserFactory() + public static synchronized SAXParserFactory getParserFactory() throws BuildException { if (parserFactory == null) { @@ -123,7 +123,7 @@ public class JAXPUtils { * * @since Ant 1.6 */ - public synchronized static SAXParserFactory getNSParserFactory() + public static synchronized SAXParserFactory getNSParserFactory() throws BuildException { if (nsParserFactory == null) { diff --git a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java index cbeea7218..7882164f1 100644 --- a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java +++ b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java @@ -204,10 +204,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { weight[nNodes] = ((weight[n1] & 0xffffff00) + (weight[n2] & 0xffffff00)) - | (1 + (((weight[n1] & 0x000000ff) > - (weight[n2] & 0x000000ff)) ? - (weight[n1] & 0x000000ff) : - (weight[n2] & 0x000000ff))); + | (1 + (((weight[n1] & 0x000000ff) + > (weight[n2] & 0x000000ff)) + ? (weight[n1] & 0x000000ff) + : (weight[n2] & 0x000000ff))); parent[nNodes] = -1; nHeap++; @@ -1246,8 +1246,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { vv = runningOrder[i]; j = i; while ((ftab[((runningOrder[j - h]) + 1) << 8] - - ftab[(runningOrder[j - h]) << 8]) > - (ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) { + - ftab[(runningOrder[j - h]) << 8]) + > (ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) { runningOrder[j] = runningOrder[j - h]; j = j - h; if (j <= (h - 1)) { @@ -1535,9 +1535,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { because the number of elems to sort is usually small, typically <= 20. */ - private int[] incs = { 1, 4, 13, 40, 121, 364, 1093, 3280, + private int[] incs = {1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, - 797161, 2391484 }; + 797161, 2391484}; private void allocateCompressStructures () { int n = baseBlockSize * blockSize100k;