ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1066963 - in /ant/core/trunk/src/main/org/apache/tools: ant/ ant/taskdefs/ ant/taskdefs/cvslib/ ant/taskdefs/email/ ant/taskdefs/optional/ ant/taskdefs/optional/depend/ ant/taskdefs/optional/depend/constantpool/ ant/taskdefs/optional/i18n/...
Date Thu, 03 Feb 2011 21:00:01 GMT
Author: bodewig
Date: Thu Feb  3 21:00:00 2011
New Revision: 1066963

URL: http://svn.apache.org/viewvc?rev=1066963&view=rev
Log:
microoptimizations.  PR 50716

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
    ant/core/trunk/src/main/org/apache/tools/ant/Main.java
    ant/core/trunk/src/main/org/apache/tools/ant/Target.java
    ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/Commandline.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/Description.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/IdentityStack.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
    ant/core/trunk/src/main/org/apache/tools/mail/MailMessage.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Thu Feb  3 21:00:00 2011
@@ -1585,7 +1585,8 @@ public final class IntrospectionHelper {
      */
     private void insertAddTypeMethod(Method method) {
         Class argClass = method.getParameterTypes()[0];
-        for (int c = 0; c < addTypeMethods.size(); ++c) {
+        final int size = addTypeMethods.size();
+        for (int c = 0; c < size; ++c) {
             Method current = (Method) addTypeMethods.get(c);
             if (current.getParameterTypes()[0].equals(argClass)) {
                 if (method.getName().equals("addConfigured")) {
@@ -1616,7 +1617,8 @@ public final class IntrospectionHelper {
         Class matchedClass = null;
         Method matchedMethod = null;
 
-        for (int i = 0; i < methods.size(); ++i) {
+        final int size = methods.size();
+        for (int i = 0; i < size; ++i) {
             Method method = (Method) methods.get(i);
             Class  methodClass = method.getParameterTypes()[0];
             if (methodClass.isAssignableFrom(paramClass)) {
@@ -1663,7 +1665,8 @@ public final class IntrospectionHelper {
             return null;
         }
         synchronized (definitions) {
-            for (int i = 0; i < definitions.size(); ++i) {
+            final int size = definitions.size();
+            for (int i = 0; i < size; ++i) {
                 AntTypeDefinition d = (AntTypeDefinition) definitions.get(i);
                 Class exposedClass = d.getExposedClass(helper.getProject());
                 if (exposedClass == null) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Main.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Main.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Main.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Main.java Thu Feb  3 21:00:00 2011
@@ -859,7 +859,8 @@ public class Main implements AntMain {
         // Add the default listener
         project.addBuildListener(createLogger());
 
-        for (int i = 0; i < listeners.size(); i++) {
+        final int count = listeners.size();
+        for (int i = 0; i < count; i++) {
             String className = (String) listeners.elementAt(i);
             BuildListener listener =
                     (BuildListener) ClasspathUtils.newInstance(className,
@@ -1152,8 +1153,9 @@ public class Main implements AntMain {
      * @return the correct place in the list for the given name
      */
     private static int findTargetPosition(Vector names, String name) {
-        int res = names.size();
-        for (int i = 0; i < names.size() && res == names.size(); i++) {
+        final int size = names.size();
+        int res = size;
+        for (int i = 0; i < size && res == size; i++) {
             if (name.compareTo((String) names.elementAt(i)) < 0) {
                 res = i;
             }
@@ -1197,7 +1199,8 @@ public class Main implements AntMain {
         }
         StringBuffer msg = new StringBuffer();
         msg.append(heading + lSep + lSep);
-        for (int i = 0; i < names.size(); i++) {
+        final int size = names.size();
+        for (int i = 0; i < size; i++) {
             msg.append(" ");
             msg.append(names.elementAt(i));
             if (descriptions != null) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Target.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Target.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Target.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Target.java Thu Feb  3 21:00:00 2011
@@ -383,7 +383,8 @@ public class Target implements TaskConta
         try {
             // use index-based approach to avoid ConcurrentModificationExceptions;
             // also account for growing target children
-            for (int i = 0; i < children.size(); i++) {
+            final int size = children.size();
+            for (int i = 0; i < size; i++) {
                 Object o = children.get(i);
                 if (o instanceof Task) {
                     Task task = (Task) o;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/UnknownElement.java Thu Feb  3 21:00:00 2011
@@ -622,16 +622,17 @@ public class UnknownElement extends Task
             return false;
         }
         // Are the sub elements the same ?
-        if (children == null || children.size() == 0) {
+        final int childrenSize = children == null ? 0 : children.size();
+        if (childrenSize == 0) {
             return other.children == null || other.children.size() == 0;
         }
         if (other.children == null) {
             return false;
         }
-        if (children.size() != other.children.size()) {
+        if (childrenSize != other.children.size()) {
             return false;
         }
-        for (int i = 0; i < children.size(); ++i) {
+        for (int i = 0; i < childrenSize; ++i) {
             UnknownElement child = (UnknownElement) children.get(i);
             if (!child.similar(other.children.get(i))) {
                 return false;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java Thu Feb  3 21:00:00 2011
@@ -404,7 +404,8 @@ public abstract class AbstractCvsTask ex
         }
 
         try {
-            for (int i = 0; i < vecCommandlines.size(); i++) {
+            final int size = vecCommandlines.size();
+            for (int i = 0; i < size; i++) {
                 this.runCommand((Commandline) vecCommandlines.elementAt(i));
             }
         } finally {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java Thu Feb  3 21:00:00 2011
@@ -464,7 +464,8 @@ public class Copy extends Task {
             HashMap dirsByBasedir = new HashMap();
             HashSet baseDirs = new HashSet();
             ArrayList nonFileResources = new ArrayList();
-            for (int i = 0; i < rcs.size(); i++) {
+            final int size = rcs.size();
+            for (int i = 0; i < size; i++) {
                 ResourceCollection rc = (ResourceCollection) rcs.elementAt(i);
 
                 // Step (1) - beware of the ZipFileSet

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java Thu Feb  3 21:00:00 2011
@@ -593,7 +593,8 @@ public class Delete extends MatchingTask
             filesets.add(implicit);
         }
 
-        for (int i = 0, size = filesets.size(); i < size; i++) {
+        final int size = filesets.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) filesets.get(i);
             if (fs.getProject() == null) {
                 log("Deleting fileset with no project specified;"

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java Thu Feb  3 21:00:00 2011
@@ -352,7 +352,8 @@ public class ExecuteOn extends ExecTask 
         try {
             Vector fileNames = new Vector();
             Vector baseDirs = new Vector();
-            for (int i = 0; i < filesets.size(); i++) {
+            final int size = filesets.size();
+            for (int i = 0; i < size; i++) {
                 String currentType = type;
                 AbstractFileSet fs = (AbstractFileSet) filesets.elementAt(i);
                 if (fs instanceof DirSet) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java Thu Feb  3 21:00:00 2011
@@ -258,7 +258,8 @@ public class Expand extends Task {
             boolean included = false;
             Set includePatterns = new HashSet();
             Set excludePatterns = new HashSet();
-            for (int v = 0, size = patternsets.size(); v < size; v++) {
+            final int size = patternsets.size();
+            for (int v = 0; v < size; v++) {
                 PatternSet p = (PatternSet) patternsets.elementAt(v);
                 String[] incls = p.getIncludePatterns(getProject());
                 if (incls == null || incls.length == 0) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java Thu Feb  3 21:00:00 2011
@@ -899,7 +899,8 @@ public class Java extends Task {
     protected void run(String classname, Vector args) throws BuildException {
         CommandlineJava cmdj = new CommandlineJava();
         cmdj.setClassname(classname);
-        for (int i = 0; i < args.size(); i++) {
+        final int size = args.size();
+        for (int i = 0; i < size; i++) {
             cmdj.createArgument().setValue((String) args.elementAt(i));
         }
         run(cmdj);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Thu Feb  3 21:00:00 2011
@@ -1509,7 +1509,8 @@ public class Javadoc extends Task {
          */
         public String getPackages() {
             StringBuffer p = new StringBuffer();
-            for (int i = 0; i < packages.size(); i++) {
+            final int size = packages.size();
+            for (int i = 0; i < size; i++) {
                 if (i > 0) {
                     p.append(":");
                 }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroDef.java Thu Feb  3 21:00:00 2011
@@ -161,10 +161,11 @@ public class MacroDef extends AntlibDefi
          * @return true if they are similar, false otherwise
          */
         public boolean similar(NestedSequential other) {
-            if (nested.size() != other.nested.size()) {
+            final int size = nested.size();
+            if (size != other.nested.size()) {
                 return false;
             }
-            for (int i = 0; i < nested.size(); ++i) {
+            for (int i = 0; i < size; ++i) {
                 UnknownElement me = (UnknownElement) nested.get(i);
                 UnknownElement o = (UnknownElement) other.nested.get(i);
                 if (!me.similar(o)) {
@@ -185,7 +186,8 @@ public class MacroDef extends AntlibDefi
         ret.setNamespace("");
         ret.setQName("sequential");
         new RuntimeConfigurable(ret, "sequential");
-        for (int i = 0; i < nestedSequential.getNested().size(); ++i) {
+        final int size = nestedSequential.getNested().size();
+        for (int i = 0; i < size; ++i) {
             UnknownElement e =
                 (UnknownElement) nestedSequential.getNested().get(i);
             ret.addChild(e);
@@ -259,7 +261,8 @@ public class MacroDef extends AntlibDefi
                 "the name \"" + attribute.getName()
                 + "\" has already been used by the text element");
         }
-        for (int i = 0; i < attributes.size(); ++i) {
+        final int size = attributes.size();
+        for (int i = 0; i < size; ++i) {
             Attribute att = (Attribute) attributes.get(i);
             if (att.getName().equals(attribute.getName())) {
                 throw new BuildException(

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java Thu Feb  3 21:00:00 2011
@@ -607,7 +607,8 @@ public class Replace extends MatchingTas
      */
     public void validateReplacefilters()
             throws BuildException {
-        for (int i = 0; i < replacefilters.size(); i++) {
+        final int size = replacefilters.size();
+        for (int i = 0; i < size; i++) {
             Replacefilter element =
                 (Replacefilter) replacefilters.get(i);
             element.validate();
@@ -727,7 +728,8 @@ public class Replace extends MatchingTas
      * Flushes all filters.
      */
     private void flushFilterChain() {
-        for (int i = 0; i < replacefilters.size(); i++) {
+        final int size = replacefilters.size();
+        for (int i = 0; i < size; i++) {
             Replacefilter filter = (Replacefilter) replacefilters.get(i);
             filter.flush();
         }
@@ -738,7 +740,8 @@ public class Replace extends MatchingTas
      * @return true if the filter chain produced new output.
      */
     private boolean processFilterChain() {
-        for (int i = 0; i < replacefilters.size(); i++) {
+        final int size = replacefilters.size();
+        for (int i = 0; i < size; i++) {
             Replacefilter filter = (Replacefilter) replacefilters.get(i);
             if (!filter.process()) {
                 return false;
@@ -755,7 +758,8 @@ public class Replace extends MatchingTas
      */
     private StringBuffer buildFilterChain(StringBuffer inputBuffer) {
         StringBuffer buf = inputBuffer;
-        for (int i = 0; i < replacefilters.size(); i++) {
+        final int size = replacefilters.size();
+        for (int i = 0; i < size; i++) {
             Replacefilter filter = (Replacefilter) replacefilters.get(i);
             filter.setInputBuffer(buf);
             buf = filter.getOutputBuffer();
@@ -768,7 +772,8 @@ public class Replace extends MatchingTas
      * @param filename <code>String</code>.
      */
     private void logFilterChain(String filename) {
-        for (int i = 0; i < replacefilters.size(); i++) {
+        final int size = replacefilters.size();
+        for (int i = 0; i < size; i++) {
             Replacefilter filter = (Replacefilter) replacefilters.get(i);
             log("Replacing in " + filename + ": " + filter.getToken()
                     + " --> " + filter.getReplaceValue(), Project.MSG_VERBOSE);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java Thu Feb  3 21:00:00 2011
@@ -293,7 +293,8 @@ public class SubAnt extends Task {
         ant = createAntTask(directory);
         String antfilename = file.getAbsolutePath();
         ant.setAntfile(antfilename);
-        for (int i = 0; i < targets.size(); i++) {
+        final int size = targets.size();
+        for (int i = 0; i < size; i++) {
             TargetElement targetElement = (TargetElement) targets.get(i);
             ant.addConfiguredTarget(targetElement);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java Thu Feb  3 21:00:00 2011
@@ -309,7 +309,8 @@ public class Touch extends Task {
         // deal with filesets in a special way since the task
         // originally also used the directories and Union won't return
         // them.
-        for (int i = 0; i < filesets.size(); i++) {
+        final int size = filesets.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) filesets.elementAt(i);
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
             File fromDir = fs.getDir(getProject());

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Thu Feb  3 21:00:00 2011
@@ -602,7 +602,8 @@ public class Zip extends MatchingTask {
             fs.setDir(baseDir);
             vfss.addElement(fs);
         }
-        for (int i = 0; i < resources.size(); i++) {
+        final int size = resources.size();
+        for (int i = 0; i < size; i++) {
             ResourceCollection rc = (ResourceCollection) resources.elementAt(i);
             vfss.addElement(rc);
         }
@@ -672,7 +673,8 @@ public class Zip extends MatchingTask {
                     oldFiles.setSrc(renamedFile);
                     oldFiles.setDefaultexcludes(false);
 
-                    for (int i = 0; i < addedFiles.size(); i++) {
+                    final int addSize = addedFiles.size();
+                    for (int i = 0; i < addSize; i++) {
                         PatternSet.NameEntry ne = oldFiles.createExclude();
                         ne.setName((String) addedFiles.elementAt(i));
                     }
@@ -823,7 +825,8 @@ public class Zip extends MatchingTask {
     /** Process groupfilesets */
     private void processGroupFilesets() {
         // Add the files found in groupfileset to fileset
-        for (int i = 0; i < groupfilesets.size(); i++) {
+        final int size = groupfilesets.size();
+        for (int i = 0; i < size; i++) {
 
             logWhenWriting("Processing groupfileset ", Project.MSG_VERBOSE);
             FileSet fs = (FileSet) groupfilesets.elementAt(i);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java Thu Feb  3 21:00:00 2011
@@ -241,7 +241,8 @@ public class ChangeLogTask extends Abstr
 
             loadUserlist(userList);
 
-            for (int i = 0, size = cvsUsers.size(); i < size; i++) {
+            final int size = cvsUsers.size();
+            for (int i = 0; i < size; i++) {
                 final CvsUser user = (CvsUser) cvsUsers.get(i);
                 user.validate();
                 userList.put(user.getUserID(), user.getDisplayname());

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java Thu Feb  3 21:00:00 2011
@@ -289,9 +289,10 @@ public class MimeMailer extends Mailer {
 
     private static InternetAddress[] internetAddresses(Vector list)
         throws AddressException, UnsupportedEncodingException {
-        InternetAddress[] addrs = new InternetAddress[list.size()];
+        final int size = list.size();
+        InternetAddress[] addrs = new InternetAddress[size];
 
-        for (int i = 0; i < list.size(); ++i) {
+        for (int i = 0; i < size; ++i) {
             EmailAddress addr = (EmailAddress) list.elementAt(i);
 
             String name = addr.getName();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java Thu Feb  3 21:00:00 2011
@@ -155,7 +155,8 @@ public class Cab extends MatchingTask {
      */
     protected boolean isUpToDate(Vector files) {
         boolean upToDate = true;
-        for (int i = 0; i < files.size() && upToDate; i++) {
+        final int size = files.size();
+        for (int i = 0; i < size && upToDate; i++) {
             String file = files.elementAt(i).toString();
             if (FILE_UTILS.resolveFile(baseDir, file).lastModified()
                     > cabFile.lastModified()) {
@@ -183,7 +184,7 @@ public class Cab extends MatchingTask {
         try {
             writer = new BufferedWriter(new FileWriter(listFile));
 
-            int size = files.size();
+            final int size = files.size();
             for (int i = 0; i < size; i++) {
                 writer.write('\"' + files.elementAt(i).toString() + '\"');
                 writer.newLine();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java Thu Feb  3 21:00:00 2011
@@ -407,7 +407,8 @@ public class EchoProperties extends Task
                 return result;
             }
         };
-        for (int i = 0; i < keyList.size(); i++) {
+        final int size = keyList.size();
+        for (int i = 0; i < size; i++) {
             String name = keyList.get(i).toString();
             String value = allProps.get(name).toString();
             props.setProperty(name, value);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java Thu Feb  3 21:00:00 2011
@@ -846,7 +846,8 @@ public class NetRexxC extends MatchingTa
         String eol = System.getProperty("line.separator");
         StringBuffer niceSourceList = new StringBuffer("Files to be compiled:" + eol);
 
-        for (int i = 0; i < compileList.size(); i++) {
+        final int size = compileList.size();
+        for (int i = 0; i < size; i++) {
             niceSourceList.append("    ");
             niceSourceList.append(compileList.elementAt(i).toString());
             niceSourceList.append(eol);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java Thu Feb  3 21:00:00 2011
@@ -323,7 +323,8 @@ public class TraXLiaison implements XSLT
         if (uriResolver != null) {
             transformer.setURIResolver(uriResolver);
         }
-        for (int i = 0; i < outputProperties.size(); i++) {
+        final int size = outputProperties.size();
+        for (int i = 0; i < size; i++) {
             final String[] pair = (String[]) outputProperties.elementAt(i);
             transformer.setOutputProperty(pair[0], pair[1]);
         }
@@ -419,7 +420,8 @@ public class TraXLiaison implements XSLT
         tfactory.setErrorListener(this);
 
         // specific attributes for the transformer
-        for (int i = 0; i < attributes.size(); i++) {
+        final int size = attributes.size();
+        for (int i = 0; i < size; i++) {
             final Object[] pair = (Object[]) attributes.elementAt(i);
             tfactory.setAttribute((String) pair[0], pair[1]);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java Thu Feb  3 21:00:00 2011
@@ -310,7 +310,8 @@ public class XMLValidateTask extends Tas
             }
         }
 
-        for (int i = 0; i < filesets.size(); i++) {
+        final int size = filesets.size();
+        for (int i = 0; i < size; i++) {
 
             FileSet fs = (FileSet) filesets.elementAt(i);
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
@@ -355,13 +356,15 @@ public class XMLValidateTask extends Tas
                 setFeature(XmlConstants.FEATURE_VALIDATION, true);
             }
             // set the feature from the attribute list
-            for (int i = 0; i < attributeList.size(); i++) {
+            final int attSize = attributeList.size();
+            for (int i = 0; i < attSize; i++) {
                 Attribute feature = (Attribute) attributeList.elementAt(i);
                 setFeature(feature.getName(), feature.getValue());
 
             }
             // Sets properties
-            for (int i = 0; i < propertyList.size(); i++) {
+            final int propSize = propertyList.size();
+            for (int i = 0; i < propSize; i++) {
                 final Property prop = (Property) propertyList.elementAt(i);
                 setProperty(prop.getName(), prop.getValue());
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java Thu Feb  3 21:00:00 2011
@@ -90,7 +90,8 @@ public class ClassFile {
 
         Vector classRefs = new Vector();
 
-        for (int i = 0; i < constantPool.size(); ++i) {
+        final int size = constantPool.size();
+        for (int i = 0; i < size; ++i) {
             ConstantPoolEntry entry = constantPool.getEntry(i);
 
             if (entry != null

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java Thu Feb  3 21:00:00 2011
@@ -165,7 +165,8 @@ public class ConstantPool {
     public int getClassEntry(String className) {
         int index = -1;
 
-        for (int i = 0; i < entries.size() && index == -1; ++i) {
+        final int size = entries.size();
+        for (int i = 0; i < size && index == -1; ++i) {
             Object element = entries.elementAt(i);
 
             if (element instanceof ClassCPInfo) {
@@ -191,7 +192,8 @@ public class ConstantPool {
     public int getConstantEntry(Object constantValue) {
         int index = -1;
 
-        for (int i = 0; i < entries.size() && index == -1; ++i) {
+        final int size = entries.size();
+        for (int i = 0; i < size && index == -1; ++i) {
             Object element = entries.elementAt(i);
 
             if (element instanceof ConstantCPInfo) {
@@ -221,7 +223,8 @@ public class ConstantPool {
                                  String methodType) {
         int index = -1;
 
-        for (int i = 0; i < entries.size() && index == -1; ++i) {
+        final int size = entries.size();
+        for (int i = 0; i < size && index == -1; ++i) {
             Object element = entries.elementAt(i);
 
             if (element instanceof MethodRefCPInfo) {
@@ -255,7 +258,8 @@ public class ConstantPool {
                                           String interfaceMethodType) {
         int index = -1;
 
-        for (int i = 0; i < entries.size() && index == -1; ++i) {
+        final int size = entries.size();
+        for (int i = 0; i < size && index == -1; ++i) {
             Object element = entries.elementAt(i);
 
             if (element instanceof InterfaceMethodRefCPInfo) {
@@ -291,7 +295,8 @@ public class ConstantPool {
                                 String fieldType) {
         int index = -1;
 
-        for (int i = 0; i < entries.size() && index == -1; ++i) {
+        final int size = entries.size();
+        for (int i = 0; i < size && index == -1; ++i) {
             Object element = entries.elementAt(i);
 
             if (element instanceof FieldRefCPInfo) {
@@ -320,7 +325,8 @@ public class ConstantPool {
     public int getNameAndTypeEntry(String name, String type) {
         int index = -1;
 
-        for (int i = 0; i < entries.size() && index == -1; ++i) {
+        final int size = entries.size();
+        for (int i = 0; i < size && index == -1; ++i) {
             Object element = entries.elementAt(i);
 
             if (element instanceof NameAndTypeCPInfo) {
@@ -344,7 +350,7 @@ public class ConstantPool {
      */
     public String toString() {
         StringBuffer sb = new StringBuffer("\n");
-        int size = entries.size();
+        final int size = entries.size();
 
         for (int i = 0; i < size; ++i) {
             sb.append("[" + i + "] = " + getEntry(i) + "\n");

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java Thu Feb  3 21:00:00 2011
@@ -495,7 +495,8 @@ public class Translate extends MatchingT
      */
     private void translate() throws BuildException {
         int filesProcessed = 0;
-        for (int i = 0; i < filesets.size(); i++) {
+        final int size = filesets.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) filesets.elementAt(i);
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
             String[] srcFiles = ds.getIncludedFiles();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java Thu Feb  3 21:00:00 2011
@@ -290,7 +290,8 @@ public class Image extends MatchingTask 
             try {
                 input = new FileSeekableStream(file);
                 image = JAI.create("stream", input);
-                for (int i = 0; i < instructions.size(); i++) {
+                final int size = instructions.size();
+                for (int i = 0; i < size; i++) {
                     Object instr = instructions.elementAt(i);
                     if (instr instanceof TransformOperation) {
                         image = ((TransformOperation) instr)
@@ -374,7 +375,8 @@ public class Image extends MatchingTask 
                 writeCount += processDir(srcDir, files, dest, mapper);
             }
             // deal with the filesets
-            for (int i = 0; i < filesets.size(); i++) {
+            final int size = filesets.size();
+            for (int i = 0; i < size; i++) {
                 final FileSet fs = (FileSet) filesets.elementAt(i);
                 final DirectoryScanner ds =
                     fs.getDirectoryScanner(getProject());

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java Thu Feb  3 21:00:00 2011
@@ -167,7 +167,8 @@ public class WLJspc extends MatchingTask
         this.scanDir(files);
         log("Compiling " + filesToDo.size() + " JSP files");
 
-        for (int i = 0; i < filesToDo.size(); i++) {
+        final int size = filesToDo.size();
+        for (int i = 0; i < size; i++) {
             //XXX
             // All this to get package according to weblogic standards
             // Can be written better... this is too hacky!

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java Thu Feb  3 21:00:00 2011
@@ -151,7 +151,8 @@ public class FailureRecorder extends Pro
         // check if already registered
         boolean alreadyRegistered = false;
         Vector allListeners = project.getBuildListeners();
-        for (int i = 0; i < allListeners.size(); i++) {
+        final int size = allListeners.size();
+        for (int i = 0; i < size; i++) {
             Object listener = allListeners.get(i);
             if (listener instanceof FailureRecorder) {
                 alreadyRegistered = true;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java Thu Feb  3 21:00:00 2011
@@ -352,7 +352,8 @@ public class JUnitTestRunner implements 
     public void run() {
         res = new TestResult();
         res.addListener(wrapListener(this));
-        for (int i = 0; i < formatters.size(); i++) {
+        final int size = formatters.size();
+        for (int i = 0; i < size; i++) {
             res.addListener(wrapListener((TestListener) formatters.elementAt(i)));
         }
 
@@ -506,7 +507,8 @@ public class JUnitTestRunner implements 
             fireStartTestSuite();
             startTestSuiteSuccess = true;
             if (exception != null) { // had an exception constructing suite
-                for (int i = 0; i < formatters.size(); i++) {
+                final int formatterSize = formatters.size();
+                for (int i = 0; i < formatterSize; i++) {
                     ((TestListener) formatters.elementAt(i))
                         .addError(null, exception);
                 }
@@ -705,7 +707,8 @@ public class JUnitTestRunner implements 
     }
 
     private void sendOutAndErr(String out, String err) {
-        for (int i = 0; i < formatters.size(); i++) {
+        final int size = formatters.size();
+        for (int i = 0; i < size; i++) {
             JUnitResultFormatter formatter =
                 ((JUnitResultFormatter) formatters.elementAt(i));
 
@@ -715,14 +718,16 @@ public class JUnitTestRunner implements 
     }
 
     private void fireStartTestSuite() {
-        for (int i = 0; i < formatters.size(); i++) {
+        final int size = formatters.size();
+        for (int i = 0; i < size; i++) {
             ((JUnitResultFormatter) formatters.elementAt(i))
                 .startTestSuite(junitTest);
         }
     }
 
     private void fireEndTestSuite() {
-        for (int i = 0; i < formatters.size(); i++) {
+        final int size = formatters.size();
+        for (int i = 0; i < size; i++) {
             ((JUnitResultFormatter) formatters.elementAt(i))
                 .endTestSuite(junitTest);
         }
@@ -946,7 +951,8 @@ public class JUnitTestRunner implements 
                 registerTestCase(JUnitVersionHelper.getTestCaseName(arg0));
             }
         });
-        for (int i = 0; i < fromCmdLine.size(); i++) {
+        final int size = fromCmdLine.size();
+        for (int i = 0; i < size; i++) {
             FormatterElement fe = (FormatterElement) fromCmdLine.elementAt(i);
             if (multipleTests && fe.getUseFile()) {
                 File destFile =

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Thu Feb  3 21:00:00 2011
@@ -820,7 +820,8 @@ public class FTP extends Task implements
                     throw new BuildException("could not change working dir to "
                                              + parent.curpwd);
                 }
-                for (int fcount = 0; fcount < pathElements.size() - 1; fcount++) {
+                final int size = pathElements.size();
+                for (int fcount = 0; fcount < size - 1; fcount++) {
                     String currentPathElement = (String) pathElements.elementAt(fcount);
                     try {
                         boolean result = this.client.changeWorkingDirectory(currentPathElement);
@@ -843,7 +844,7 @@ public class FTP extends Task implements
                     }
 
                 }
-                String lastpathelement = (String) pathElements.elementAt(pathElements.size() - 1);
+                String lastpathelement = (String) pathElements.elementAt(size - 1);
                 FTPFile [] theFiles = listFiles(this.curpwd);
                 this.ftpFile = getFile(theFiles, lastpathelement);
             }
@@ -946,7 +947,8 @@ public class FTP extends Task implements
                 Vector pathElements = SelectorUtils.tokenizePath(getAbsolutePath(), remoteFileSep);
                 Vector pathElements2 = SelectorUtils.tokenizePath(currentPath, remoteFileSep);
                 String relPath = currentRelativePath;
-                for (int pcount = pathElements2.size(); pcount < pathElements.size(); pcount++) {
+                final int size = pathElements.size();
+                for (int pcount = pathElements2.size(); pcount < size; pcount++) {
                     String currentElement = (String) pathElements.elementAt(pcount);
                     FTPFile[] theFiles = listFiles(currentPath);
                     FTPFile theFile = null;
@@ -1838,7 +1840,8 @@ public class FTP extends Task implements
             throw new BuildException("at least one fileset must be specified.");
         } else {
             // get files from filesets
-            for (int i = 0; i < filesets.size(); i++) {
+            final int size = filesets.size();
+            for (int i = 0; i < size; i++) {
                 FileSet fs = (FileSet) filesets.elementAt(i);
 
                 if (fs != null) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java Thu Feb  3 21:00:00 2011
@@ -722,7 +722,8 @@ public class FTPTaskMirrorImpl implement
                     throw new BuildException("could not change working dir to "
                                              + parent.curpwd);
                 }
-                for (int fcount = 0; fcount < pathElements.size() - 1; fcount++) {
+                final int size = pathElements.size();
+                for (int fcount = 0; fcount < size - 1; fcount++) {
                     String currentPathElement = (String) pathElements.elementAt(fcount);
                     try {
                         boolean result = this.client.changeWorkingDirectory(currentPathElement);
@@ -745,7 +746,7 @@ public class FTPTaskMirrorImpl implement
                     }
 
                 }
-                String lastpathelement = (String) pathElements.elementAt(pathElements.size() - 1);
+                String lastpathelement = (String) pathElements.elementAt(size - 1);
                 FTPFile [] theFiles = listFiles(this.curpwd);
                 this.ftpFile = getFile(theFiles, lastpathelement);
             }
@@ -850,7 +851,8 @@ public class FTPTaskMirrorImpl implement
                 Vector pathElements2 = SelectorUtils.tokenizePath(currentPath,
                                                                   task.getSeparator());
                 String relPath = currentRelativePath;
-                for (int pcount = pathElements2.size(); pcount < pathElements.size(); pcount++) {
+                final int size = pathElements.size();
+                for (int pcount = pathElements2.size(); pcount < size; pcount++) {
                     String currentElement = (String) pathElements.elementAt(pcount);
                     FTPFile[] theFiles = listFiles(currentPath);
                     FTPFile theFile = null;
@@ -1227,7 +1229,8 @@ public class FTPTaskMirrorImpl implement
             throw new BuildException("at least one fileset must be specified.");
         } else {
             // get files from filesets
-            for (int i = 0; i < task.getFilesets().size(); i++) {
+            final int size = task.getFilesets().size();
+            for (int i = 0; i < size; i++) {
                 FileSet fs = (FileSet) task.getFilesets().elementAt(i);
 
                 if (fs != null) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java Thu Feb  3 21:00:00 2011
@@ -112,7 +112,8 @@ public class P4Add extends P4Base {
 
         StringBuffer filelist = new StringBuffer();
 
-        for (int i = 0; i < filesets.size(); i++) {
+        final int size = filesets.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) filesets.elementAt(i);
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java Thu Feb  3 21:00:00 2011
@@ -129,7 +129,8 @@ public class P4Fstat extends P4Base {
 
         filelist = new StringBuffer();
 
-        for (int i = 0; i < filesets.size(); i++) {
+        final int size = filesets.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) filesets.elementAt(i);
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
 
@@ -181,7 +182,8 @@ public class P4Fstat extends P4Base {
 
     private void printRes(ArrayList ar, String header) {
         log(header, Project.MSG_INFO);
-        for (int i = 0; i < ar.size(); i++) {
+        final int size = ar.size();
+        for (int i = 0; i < size; i++) {
             log((String) ar.get(i), Project.MSG_INFO);
         }
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java Thu Feb  3 21:00:00 2011
@@ -119,7 +119,8 @@ public class P4Submit extends P4Base {
                     Vector myarray = new Vector();
                     util.split(myarray, line);
                     boolean found = false;
-                    for (int counter = 0; counter < myarray.size(); counter++) {
+                    final int size = myarray.size();
+                    for (int counter = 0; counter < size; counter++) {
                         if (found) {
                             String chnum = (String) myarray.elementAt(counter + 1);
                             int changenumber = Integer.parseInt(chnum);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java Thu Feb  3 21:00:00 2011
@@ -144,7 +144,8 @@ public class ScpFromMessageBySftp extend
             localFile.mkdirs();
         }
         java.util.Vector files = channel.ls(remoteFile);
-        for (int i = 0; i < files.size(); i++) {
+        final int size = files.size();
+        for (int i = 0; i < size; i++) {
             ChannelSftp.LsEntry le = (ChannelSftp.LsEntry) files.elementAt(i);
             String name = le.getFilename();
             if (le.getAttrs().isDir()) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java Thu Feb  3 21:00:00 2011
@@ -509,7 +509,8 @@ public class Symlink extends DispatchTas
      */
     private HashSet findLinks(Vector v) {
         HashSet result = new HashSet();
-        for (int i = 0; i < v.size(); i++) {
+        final int size = v.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) v.get(i);
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
             String[][] fnd = new String[][]
@@ -547,7 +548,8 @@ public class Symlink extends DispatchTas
     private Properties loadLinks(Vector v) {
         Properties finalList = new Properties();
         // loop through the supplied file sets:
-        for (int i = 0; i < v.size(); i++) {
+        final int size = v.size();
+        for (int i = 0; i < size; i++) {
             FileSet fs = (FileSet) v.elementAt(i);
             DirectoryScanner ds = new DirectoryScanner();
             fs.setupDirectoryScanner(ds, getProject());

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/Commandline.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/Commandline.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/Commandline.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/Commandline.java Thu Feb  3 21:00:00 2011
@@ -386,7 +386,8 @@ public class Commandline implements Clon
      * @since Ant 1.6
      */
     public void addArgumentsToList(ListIterator list) {
-        for (int i = 0; i < arguments.size(); i++) {
+        final int size = arguments.size();
+        for (int i = 0; i < size; i++) {
             Argument arg = (Argument) arguments.elementAt(i);
             String[] s = arg.getParts();
             if (s != null) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/Description.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/Description.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/Description.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/Description.java Thu Feb  3 21:00:00 2011
@@ -78,7 +78,8 @@ public class Description extends DataTyp
             return null;
         }
         StringBuffer description = new StringBuffer();
-        for (int i = 0; i < targets.size(); i++) {
+        final int size = targets.size();
+        for (int i = 0; i < size; i++) {
             Target t = (Target) targets.elementAt(i);
             concatDescriptions(project, t, description);
         }
@@ -94,7 +95,8 @@ public class Description extends DataTyp
         if (tasks == null) {
             return;
         }
-        for (int i = 0; i < tasks.size(); i++) {
+        final int size = tasks.size();
+        for (int i = 0; i < size; i++) {
             Task task = (Task) tasks.elementAt(i);
             if (!(task instanceof UnknownElement)) {
                 continue;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java Thu Feb  3 21:00:00 2011
@@ -223,7 +223,8 @@ public class FilterSet extends DataType 
         //silly hack to avoid stack overflow...
         if (!readingFiles) {
             readingFiles = true;
-            for (int i = 0, sz = filtersFiles.size(); i < sz; i++) {
+            final int size = filtersFiles.size();
+            for (int i = 0, sz = size; i < sz; i++) {
                 readFiltersFromFile((File) filtersFiles.get(i));
             }
             filtersFiles.clear();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java Thu Feb  3 21:00:00 2011
@@ -104,7 +104,8 @@ public class Arc extends BasicShape impl
         }
 
 
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 PlanarImage img = ((DrawOperation) instr).executeDrawOperation();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java Thu Feb  3 21:00:00 2011
@@ -78,7 +78,8 @@ public class Draw extends TransformOpera
         BufferedImage bi = image.getAsBufferedImage();
         Graphics2D graphics = (Graphics2D) bi.getGraphics();
 
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 PlanarImage op = ((DrawOperation) instr).executeDrawOperation();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java Thu Feb  3 21:00:00 2011
@@ -68,7 +68,8 @@ public class Ellipse extends BasicShape 
         }
 
 
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 PlanarImage img = ((DrawOperation) instr).executeDrawOperation();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java Thu Feb  3 21:00:00 2011
@@ -99,7 +99,8 @@ public class Rectangle extends BasicShap
         }
 
 
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 PlanarImage img = ((DrawOperation) instr).executeDrawOperation();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java Thu Feb  3 21:00:00 2011
@@ -70,7 +70,8 @@ public class Rotate extends TransformOpe
     public PlanarImage executeTransformOperation(PlanarImage image) {
         BufferedImage bi = null;
         Graphics2D graphics = null;
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 // If this TransformOperation has DrawOperation children
@@ -102,7 +103,8 @@ public class Rotate extends TransformOpe
      * @return the image.
      */
     public PlanarImage executeDrawOperation() {
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 // If this TransformOperation has DrawOperation children

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java Thu Feb  3 21:00:00 2011
@@ -146,7 +146,8 @@ public class Scale extends TransformOper
     /** {@inheritDoc}. */
     public PlanarImage executeTransformOperation(PlanarImage image) {
         BufferedImage bi = null;
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 return performScale(image);
@@ -163,7 +164,8 @@ public class Scale extends TransformOper
 
     /** {@inheritDoc}. */
     public PlanarImage executeDrawOperation() {
-        for (int i = 0; i < instructions.size(); i++) {
+        final int size = instructions.size();
+        for (int i = 0; i < size; i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
             if (instr instanceof DrawOperation) {
                 PlanarImage image = null;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/FileUtils.java Thu Feb  3 21:00:00 2011
@@ -753,7 +753,8 @@ public class FileUtils {
             }
         }
         StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < s.size(); i++) {
+        final int size = s.size();
+        for (int i = 0; i < size; i++) {
             if (i > 1) {
                 // not before the filesystem root and not after it, since root
                 // already contains one

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/IdentityStack.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/IdentityStack.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/IdentityStack.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/IdentityStack.java Thu Feb  3 21:00:00 2011
@@ -77,7 +77,8 @@ public class IdentityStack extends Stack
      * @see java.util.Vector#indexOf(Object, int)
      */
     public synchronized int indexOf(Object o, int pos) {
-        for (int i = pos; i < size(); i++) {
+        final int size = size();
+        for (int i = pos; i < size; i++) {
             if (get(i) == o) {
                 return i;
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java Thu Feb  3 21:00:00 2011
@@ -207,7 +207,8 @@ public class LayoutPreservingProperties 
             (LayoutPreservingProperties) super.clone();
         dolly.keyedPairLines = (HashMap) this.keyedPairLines.clone();
         dolly.logicalLines = (ArrayList) this.logicalLines.clone();
-        for (int j = 0; j < dolly.logicalLines.size(); j++) {
+        final int size = dolly.logicalLines.size();
+        for (int j = 0; j < size; j++) {
             LogicalLine line = (LogicalLine) dolly.logicalLines.get(j);
             if (line instanceof Pair) {
                 Pair p = (Pair) line;

Modified: ant/core/trunk/src/main/org/apache/tools/mail/MailMessage.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/mail/MailMessage.java?rev=1066963&r1=1066962&r2=1066963&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/mail/MailMessage.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/mail/MailMessage.java Thu Feb  3 21:00:00 2011
@@ -328,7 +328,8 @@ public class MailMessage {
     //   "Header fields are NOT required to occur in any particular order,
     //    except that the message body MUST occur AFTER the headers"
     // (the same section specifies a reccommended order, which we ignore)
-   for (int i = 0; i < headersKeys.size(); i++) {
+   final int size = headersKeys.size();
+   for (int i = 0; i < size; i++) {
       String name = (String) headersKeys.elementAt(i);
       String value = (String) headersValues.elementAt(i);
       out.println(name + ": " + value);



Mime
View raw message