ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [8/8] git commit: oops - make it compile under Java5 again
Date Fri, 04 Jul 2014 13:15:12 GMT
oops - make it compile under Java5 again

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/789422e1
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/789422e1
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/789422e1

Branch: refs/heads/master
Commit: 789422e131b6c2c003d94f394169a64297e986c6
Parents: 13f6d98
Author: Jan Matèrne <jhm@apache.org>
Authored: Fri Jul 4 15:05:12 2014 +0200
Committer: Jan Matèrne <jhm@apache.org>
Committed: Fri Jul 4 15:05:12 2014 +0200

----------------------------------------------------------------------
 .../tools/ant/filters/util/JavaClassHelper.java |   3 +-
 .../ant/listener/CommonsLoggingListener.java    |  70 ++++++-------
 .../tools/ant/listener/Log4jListener.java       |  39 +++----
 .../tools/ant/taskdefs/email/MimeMailer.java    |  80 ++++++++-------
 .../taskdefs/optional/Xalan2TraceSupport.java   |  12 +--
 .../optional/junit/XMLJUnitResultFormatter.java |  86 ++++++++--------
 .../optional/ssh/AbstractSshMessage.java        |  52 +++++-----
 .../ant/taskdefs/optional/ssh/SSHBase.java      |  31 +++---
 .../ant/taskdefs/optional/ssh/SSHExec.java      |   1 +
 .../ant/taskdefs/optional/ssh/SSHSession.java   |  87 ++++++++--------
 .../tools/ant/taskdefs/optional/ssh/Scp.java    |  81 +++++++--------
 .../taskdefs/optional/ssh/ScpFromMessage.java   | 102 ++++++++++---------
 .../optional/ssh/ScpFromMessageBySftp.java      |  73 ++++++-------
 .../ant/taskdefs/optional/ssh/ScpToMessage.java |  98 +++++++++---------
 .../optional/ssh/ScpToMessageBySftp.java        |  85 ++++++++--------
 .../tools/ant/types/resolver/ApacheCatalog.java |  23 +++--
 .../types/resolver/ApacheCatalogResolver.java   |  34 +++----
 .../ant/util/depend/bcel/DependencyVisitor.java |  42 ++++----
 .../ant/util/regexp/JakartaOroMatcher.java      |  30 +++---
 .../tools/ant/util/regexp/JakartaOroRegexp.java |  14 +--
 20 files changed, 536 insertions(+), 507 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
index 1b87b9c..e01c2df 100644
--- a/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
+++ b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 
 import com.sun.org.apache.bcel.internal.classfile.ClassParser;
 import com.sun.org.apache.bcel.internal.classfile.ConstantValue;
+import com.sun.org.apache.bcel.internal.classfile.Field;
 import com.sun.org.apache.bcel.internal.classfile.JavaClass;
 
 // CheckStyle:HideUtilityClassConstructorCheck OFF - bc
@@ -40,7 +41,7 @@ public final class JavaClassHelper {
      * @return a StringBuffer contains the name=value pairs
      * @exception IOException if an error occurs
      */
-    public static StringBuffer getConstants(byte[] bytes)
+    public static StringBuffer getConstants(final byte[] bytes)
         throws IOException {
         final StringBuffer sb = new StringBuffer();
         final ByteArrayInputStream bis = new ByteArrayInputStream(bytes);

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
index 57f53a9..32474ee 100644
--- a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
+++ b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
@@ -20,6 +20,7 @@ package org.apache.tools.ant.listener;
 
 import java.io.PrintStream;
 
+import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogConfigurationException;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tools.ant.BuildEvent;
@@ -29,7 +30,6 @@ import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.UnknownElement;
 
-import sun.rmi.runtime.Log;
 
 /**
  * Jakarta Commons Logging listener.
@@ -80,31 +80,31 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
             suffix = suffix.replace(' ', '-');
             cat = cat + "." + suffix;
         }
-        PrintStream tmpOut = System.out;
-        PrintStream tmpErr = System.err;
+        final PrintStream tmpOut = System.out;
+        final PrintStream tmpErr = System.err;
         System.setOut(out);
         System.setErr(err);
 
         if (!initialized) {
             try {
                 logFactory = LogFactory.getFactory();
-            } catch (LogConfigurationException e) {
+            } catch (final LogConfigurationException e) {
                 e.printStackTrace(System.err);
                 return null;
             }
         }
 
         initialized = true;
-        Log log = logFactory.getInstance(cat);
+        final Log log = logFactory.getInstance(cat);
         System.setOut(tmpOut);
         System.setErr(tmpErr);
         return log;
     }
 
     /** {@inheritDoc}. */
-    public void buildStarted(BuildEvent event) {
-        String categoryString = PROJECT_LOG;
-        Log log = getLog(categoryString, null);
+    public void buildStarted(final BuildEvent event) {
+        final String categoryString = PROJECT_LOG;
+        final Log log = getLog(categoryString, null);
 
         if (initialized) {
             realLog(log, "Build started.", Project.MSG_INFO, null);
@@ -112,10 +112,10 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
     }
 
     /** {@inheritDoc}. */
-    public void buildFinished(BuildEvent event) {
+    public void buildFinished(final BuildEvent event) {
         if (initialized) {
-            String categoryString = PROJECT_LOG;
-            Log log = getLog(categoryString, event.getProject().getName());
+            final String categoryString = PROJECT_LOG;
+            final Log log = getLog(categoryString, event.getProject().getName());
 
             if (event.getException() == null) {
                 realLog(log, "Build finished.", Project.MSG_INFO, null);
@@ -130,9 +130,9 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * @see BuildListener#targetStarted
      */
     /** {@inheritDoc}. */
-    public void targetStarted(BuildEvent event) {
+    public void targetStarted(final BuildEvent event) {
         if (initialized) {
-            Log log = getLog(TARGET_LOG,
+            final Log log = getLog(TARGET_LOG,
                     event.getTarget().getName());
             // Since task log category includes target, we don't really
             // need this message
@@ -145,10 +145,10 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * @see BuildListener#targetFinished
      */
     /** {@inheritDoc}. */
-    public void targetFinished(BuildEvent event) {
+    public void targetFinished(final BuildEvent event) {
         if (initialized) {
-            String targetName = event.getTarget().getName();
-            Log log = getLog(TARGET_LOG,
+            final String targetName = event.getTarget().getName();
+            final Log log = getLog(TARGET_LOG,
                     event.getTarget().getName());
             if (event.getException() == null) {
                 realLog(log, "Target end: " + targetName, Project.MSG_DEBUG, null);
@@ -164,17 +164,17 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * @see BuildListener#taskStarted
      */
     /** {@inheritDoc}. */
-    public void taskStarted(BuildEvent event) {
+    public void taskStarted(final BuildEvent event) {
         if (initialized) {
-            Task task = event.getTask();
+            final Task task = event.getTask();
             Object real = task;
             if (task instanceof UnknownElement) {
-                Object realObj = ((UnknownElement) task).getTask();
+                final Object realObj = ((UnknownElement) task).getTask();
                 if (realObj != null) {
                     real = realObj;
                 }
             }
-            Log log = getLog(real.getClass().getName(), null);
+            final Log log = getLog(real.getClass().getName(), null);
             if (log.isTraceEnabled()) {
                 realLog(log, "Task \"" + task.getTaskName() + "\" started ",
                         Project.MSG_VERBOSE, null);
@@ -186,17 +186,17 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * @see BuildListener#taskFinished
      */
     /** {@inheritDoc}. */
-    public void taskFinished(BuildEvent event) {
+    public void taskFinished(final BuildEvent event) {
         if (initialized) {
-            Task task = event.getTask();
+            final Task task = event.getTask();
             Object real = task;
             if (task instanceof UnknownElement) {
-                Object realObj = ((UnknownElement) task).getTask();
+                final Object realObj = ((UnknownElement) task).getTask();
                 if (realObj != null) {
                     real = realObj;
                 }
             }
-            Log log = getLog(real.getClass().getName(), null);
+            final Log log = getLog(real.getClass().getName(), null);
             if (event.getException() == null) {
                 if (log.isTraceEnabled()) {
                     realLog(log, "Task \"" + task.getTaskName() + "\" finished.",
@@ -215,7 +215,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * @see BuildListener#messageLogged
      */
     /** {@inheritDoc}. */
-    public void messageLogged(BuildEvent event) {
+    public void messageLogged(final BuildEvent event) {
         if (initialized) {
             Object categoryObject = event.getTask();
             String categoryString = null;
@@ -242,16 +242,16 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
 
             }
 
-            Log log = getLog(categoryString, categoryDetail);
-            int priority = event.getPriority();
-            String message = event.getMessage();
+            final Log log = getLog(categoryString, categoryDetail);
+            final int priority = event.getPriority();
+            final String message = event.getMessage();
             realLog(log, message, priority , null);
         }
     }
 
-    private void realLog(Log log, String message, int priority, Throwable t) {
-        PrintStream tmpOut = System.out;
-        PrintStream tmpErr = System.err;
+    private void realLog(final Log log, final String message, final int priority, final Throwable t) {
+        final PrintStream tmpOut = System.out;
+        final PrintStream tmpErr = System.err;
         System.setOut(out);
         System.setErr(err);
         switch (priority) {
@@ -300,7 +300,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * This is not used, the logger config is used instead.
      * @param level ignored
      */
-    public void setMessageOutputLevel(int level) {
+    public void setMessageOutputLevel(final int level) {
         // Use the logger config
     }
 
@@ -308,7 +308,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * Set the output print stream.
      * @param output the output stream
      */
-    public void setOutputPrintStream(PrintStream output) {
+    public void setOutputPrintStream(final PrintStream output) {
         this.out = output;
     }
 
@@ -317,7 +317,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * This is ignored.
      * @param emacsMode ignored
      */
-    public void setEmacsMode(boolean emacsMode) {
+    public void setEmacsMode(final boolean emacsMode) {
         // Doesn't make sense for c-l. Use the logger config
     }
 
@@ -325,7 +325,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
      * Set the error print stream.
      * @param err the error stream
      */
-    public void setErrorPrintStream(PrintStream err) {
+    public void setErrorPrintStream(final PrintStream err) {
         this.err = err;
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/listener/Log4jListener.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/listener/Log4jListener.java b/src/main/org/apache/tools/ant/listener/Log4jListener.java
index 5e8acaa..829f118 100644
--- a/src/main/org/apache/tools/ant/listener/Log4jListener.java
+++ b/src/main/org/apache/tools/ant/listener/Log4jListener.java
@@ -18,6 +18,7 @@
 
 package org.apache.tools.ant.listener;
 
+import org.apache.log4j.Logger;
 import org.apache.log4j.helpers.NullEnumeration;
 import org.apache.tools.ant.BuildEvent;
 import org.apache.tools.ant.BuildListener;
@@ -44,8 +45,8 @@ public class Log4jListener implements BuildListener {
      * Construct the listener and make sure there is a valid appender.
      */
     public Log4jListener() {
-        Logger log = Logger.getLogger(LOG_ANT);
-        Logger rootLog = Logger.getRootLogger();
+        final Logger log = Logger.getLogger(LOG_ANT);
+        final Logger rootLog = Logger.getRootLogger();
         initialized = !(rootLog.getAllAppenders() instanceof NullEnumeration);
         if (!initialized) {
             log.error("No log4j.properties in build area");
@@ -56,9 +57,9 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#buildStarted
      */
     /** {@inheritDoc}. */
-    public void buildStarted(BuildEvent event) {
+    public void buildStarted(final BuildEvent event) {
         if (initialized) {
-            Logger log = Logger.getLogger(Project.class.getName());
+            final Logger log = Logger.getLogger(Project.class.getName());
             log.info("Build started.");
         }
     }
@@ -67,9 +68,9 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#buildFinished
      */
     /** {@inheritDoc}. */
-    public void buildFinished(BuildEvent event) {
+    public void buildFinished(final BuildEvent event) {
         if (initialized) {
-            Logger log = Logger.getLogger(Project.class.getName());
+            final Logger log = Logger.getLogger(Project.class.getName());
             if (event.getException() == null) {
                 log.info("Build finished.");
             } else {
@@ -82,9 +83,9 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#targetStarted
      */
     /** {@inheritDoc}. */
-    public void targetStarted(BuildEvent event) {
+    public void targetStarted(final BuildEvent event) {
         if (initialized) {
-            Logger log = Logger.getLogger(Target.class.getName());
+            final Logger log = Logger.getLogger(Target.class.getName());
             log.info("Target \"" + event.getTarget().getName() + "\" started.");
         }
     }
@@ -93,10 +94,10 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#targetFinished
      */
     /** {@inheritDoc}. */
-    public void targetFinished(BuildEvent event) {
+    public void targetFinished(final BuildEvent event) {
         if (initialized) {
-            String targetName = event.getTarget().getName();
-            Logger cat = Logger.getLogger(Target.class.getName());
+            final String targetName = event.getTarget().getName();
+            final Logger cat = Logger.getLogger(Target.class.getName());
             if (event.getException() == null) {
                 cat.info("Target \"" + targetName + "\" finished.");
             } else {
@@ -110,10 +111,10 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#taskStarted
      */
     /** {@inheritDoc}. */
-    public void taskStarted(BuildEvent event) {
+    public void taskStarted(final BuildEvent event) {
         if (initialized) {
-            Task task = event.getTask();
-            Logger log = Logger.getLogger(task.getClass().getName());
+            final Task task = event.getTask();
+            final Logger log = Logger.getLogger(task.getClass().getName());
             log.info("Task \"" + task.getTaskName() + "\" started.");
         }
     }
@@ -122,10 +123,10 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#taskFinished
      */
     /** {@inheritDoc}. */
-    public void taskFinished(BuildEvent event) {
+    public void taskFinished(final BuildEvent event) {
         if (initialized) {
-            Task task = event.getTask();
-            Logger log = Logger.getLogger(task.getClass().getName());
+            final Task task = event.getTask();
+            final Logger log = Logger.getLogger(task.getClass().getName());
             if (event.getException() == null) {
                 log.info("Task \"" + task.getTaskName() + "\" finished.");
             } else {
@@ -139,7 +140,7 @@ public class Log4jListener implements BuildListener {
      * @see BuildListener#messageLogged
      */
     /** {@inheritDoc}. */
-    public void messageLogged(BuildEvent event) {
+    public void messageLogged(final BuildEvent event) {
         if (initialized) {
             Object categoryObject = event.getTask();
             if (categoryObject == null) {
@@ -149,7 +150,7 @@ public class Log4jListener implements BuildListener {
                 }
             }
 
-            Logger log
+            final Logger log
                 = Logger.getLogger(categoryObject.getClass().getName());
             switch (event.getPriority()) {
                 case Project.MSG_ERR:

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java b/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
index 4e4b86d..186d71e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
+++ b/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
@@ -25,7 +25,6 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
-import java.net.PasswordAuthentication;
 import java.security.Provider;
 import java.security.Security;
 import java.util.Enumeration;
@@ -37,19 +36,23 @@ import java.util.Vector;
 
 import javax.activation.DataHandler;
 import javax.activation.FileDataSource;
+import javax.mail.Address;
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
 import javax.mail.SendFailedException;
+import javax.mail.Session;
+import javax.mail.Transport;
 import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 
-import sun.rmi.transport.Transport;
-
-import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
-import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart;
-import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeMultipart;
 
 /**
  * Uses the JavaMail classes to send Mime format email.
@@ -83,7 +86,7 @@ public class MimeMailer extends Mailer {
                 throw new IOException("No data");
             }
             if (out != null) {
-                String encodedOut = out.toString(charset);
+                final String encodedOut = out.toString(charset);
                 data = (data != null) ? data.concat(encodedOut) : encodedOut;
                 out = null;
             }
@@ -95,7 +98,7 @@ public class MimeMailer extends Mailer {
             return out;
         }
 
-        public void setContentType(String type) {
+        public void setContentType(final String type) {
             this.type = type.toLowerCase(Locale.ENGLISH);
         }
 
@@ -113,7 +116,7 @@ public class MimeMailer extends Mailer {
             return "StringDataSource";
         }
 
-        public void setCharset(String charset) {
+        public void setCharset(final String charset) {
             this.charset = charset;
         }
 
@@ -129,7 +132,7 @@ public class MimeMailer extends Mailer {
      */
     public void send() {
         try {
-            Properties props = new Properties();
+            final Properties props = new Properties();
 
             props.put("mail.smtp.host", host);
             props.put("mail.smtp.port", String.valueOf(port));
@@ -141,10 +144,10 @@ public class MimeMailer extends Mailer {
             Authenticator auth = null;
             if (SSL) {
                 try {
-                    Provider p = (Provider) Class.forName(
+                    final Provider p = (Provider) Class.forName(
                         "com.sun.net.ssl.internal.ssl.Provider").newInstance();
                     Security.addProvider(p);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     throw new BuildException("could not instantiate ssl "
                         + "security provider, check that you have JSSE in "
                         + "your classpath");
@@ -169,8 +172,8 @@ public class MimeMailer extends Mailer {
             sesh = Session.getInstance(props, auth);
 
             //create the message
-            MimeMessage msg = new MimeMessage(sesh);
-            MimeMultipart attachments = new MimeMultipart();
+            final MimeMessage msg = new MimeMessage(sesh);
+            final MimeMultipart attachments = new MimeMultipart();
 
             //set the sender
             if (from.getName() == null) {
@@ -204,7 +207,7 @@ public class MimeMailer extends Mailer {
                 }
             }
             // Using javax.activation.DataSource paradigm
-            StringDataSource sds = new StringDataSource();
+            final StringDataSource sds = new StringDataSource();
             sds.setContentType(message.getMimeType());
             sds.setCharset(charset);
 
@@ -214,23 +217,23 @@ public class MimeMailer extends Mailer {
             msg.addHeader("Date", getDate());
 
             if (headers != null) {
-                for (Iterator iter = headers.iterator(); iter.hasNext();) {
-                    Header h = (Header) iter.next();
+                for (final Iterator iter = headers.iterator(); iter.hasNext();) {
+                    final Header h = (Header) iter.next();
                     msg.addHeader(h.getName(), h.getValue());
                 }
             }
-            PrintStream out = new PrintStream(sds.getOutputStream());
+            final PrintStream out = new PrintStream(sds.getOutputStream());
             message.print(out);
             out.close();
 
-            MimeBodyPart textbody = new MimeBodyPart();
+            final MimeBodyPart textbody = new MimeBodyPart();
             textbody.setDataHandler(new DataHandler(sds));
             attachments.addBodyPart(textbody);
 
-            Enumeration e = files.elements();
+            final Enumeration e = files.elements();
 
             while (e.hasMoreElements()) {
-                File file = (File) e.nextElement();
+                final File file = (File) e.nextElement();
 
                 MimeBodyPart body;
 
@@ -240,8 +243,8 @@ public class MimeMailer extends Mailer {
                          + "\" does not exist or is not "
                          + "readable.");
                 }
-                FileDataSource fileData = new FileDataSource(file);
-                DataHandler fileDataHandler = new DataHandler(fileData);
+                final FileDataSource fileData = new FileDataSource(file);
+                final DataHandler fileDataHandler = new DataHandler(fileData);
 
                 body.setDataHandler(fileDataHandler);
                 body.setFileName(file.getName());
@@ -250,10 +253,10 @@ public class MimeMailer extends Mailer {
             msg.setContent(attachments);
             try {
                 // Send the message using SMTP, or SMTPS if the host uses SSL
-                Transport transport = sesh.getTransport(SSL ? "smtps" : "smtp");
+                final Transport transport = sesh.getTransport(SSL ? "smtps" : "smtp");
                 transport.connect(host, user, password);
                 transport.sendMessage(msg, msg.getAllRecipients());
-            } catch (SendFailedException sfe) {
+            } catch (final SendFailedException sfe) {
                 if (!shouldIgnoreInvalidRecipients()) {
                     throw new BuildException(GENERIC_ERROR, sfe);
                 } else if (sfe.getValidSentAddresses() == null
@@ -277,22 +280,22 @@ public class MimeMailer extends Mailer {
                     }
                 }
             }
-        } catch (MessagingException e) {
+        } catch (final MessagingException e) {
             throw new BuildException(GENERIC_ERROR, e);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new BuildException(GENERIC_ERROR, e);
         }
     }
 
-    private static InternetAddress[] internetAddresses(Vector list)
+    private static InternetAddress[] internetAddresses(final Vector list)
         throws AddressException, UnsupportedEncodingException {
         final int size = list.size();
-        InternetAddress[] addrs = new InternetAddress[size];
+        final InternetAddress[] addrs = new InternetAddress[size];
 
         for (int i = 0; i < size; ++i) {
-            EmailAddress addr = (EmailAddress) list.elementAt(i);
+            final EmailAddress addr = (EmailAddress) list.elementAt(i);
 
-            String name = addr.getName();
+            final String name = addr.getName();
             addrs[i] = (name == null)
                 ? new InternetAddress(addr.getAddress())
                 : new InternetAddress(addr.getAddress(), name);
@@ -300,23 +303,23 @@ public class MimeMailer extends Mailer {
         return addrs;
     }
 
-    private String parseCharSetFromMimeType(String type) {
+    private String parseCharSetFromMimeType(final String type) {
         if (type == null) {
             return null;
         }
-        int pos = type.indexOf("charset");
+        final int pos = type.indexOf("charset");
         if (pos < 0) {
           return null;
         }
         // Assuming mime type in form "text/XXXX; charset=XXXXXX"
-        StringTokenizer token = new StringTokenizer(type.substring(pos), "=; ");
+        final StringTokenizer token = new StringTokenizer(type.substring(pos), "=; ");
         token.nextToken(); // Skip 'charset='
         return token.nextToken();
     }
 
-    private void didntReach(Address addr, String category,
-                            MessagingException ex) {
-        String msg = "Failed to send mail to " + category + " address "
+    private void didntReach(final Address addr, final String category,
+                            final MessagingException ex) {
+        final String msg = "Failed to send mail to " + category + " address "
             + addr + " because of " + ex.getMessage();
         if (task != null) {
             task.log(msg, Project.MSG_WARN);
@@ -328,12 +331,11 @@ public class MimeMailer extends Mailer {
     static class SimpleAuthenticator extends Authenticator {
         private String user = null;
         private String password = null;
-        public SimpleAuthenticator(String user, String password) {
+        public SimpleAuthenticator(final String user, final String password) {
             this.user = user;
             this.password = password;
         }
         public PasswordAuthentication getPasswordAuthentication() {
-
             return new PasswordAuthentication(user, password);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport.java b/src/main/org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport.java
index 96804e6..0553060 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport.java
@@ -26,8 +26,8 @@ import javax.xml.transform.Transformer;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.taskdefs.XSLTProcess;
 import org.apache.xalan.trace.PrintTraceListener;
+import org.apache.xalan.transformer.TransformerImpl;
 
-import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl;
 
 /**
  * Sets up trace support for a given transformer.
@@ -35,11 +35,11 @@ import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl;
  * @since Ant 1.8.0
  */
 public class Xalan2TraceSupport implements XSLTTraceSupport {
-    public void configureTrace(Transformer t,
-                               XSLTProcess.TraceConfiguration conf) {
+    public void configureTrace(final Transformer t,
+                               final XSLTProcess.TraceConfiguration conf) {
         if (t instanceof TransformerImpl && conf != null) {
-            PrintWriter w = new PrintWriter(conf.getOutputStream(), false);
-            PrintTraceListener tl = new PrintTraceListener(w);
+            final PrintWriter w = new PrintWriter(conf.getOutputStream(), false);
+            final PrintTraceListener tl = new PrintTraceListener(w);
             tl.m_traceElements = conf.getElements();
             tl.m_traceExtension = conf.getExtension();
             tl.m_traceGeneration = conf.getGeneration();
@@ -47,7 +47,7 @@ public class Xalan2TraceSupport implements XSLTTraceSupport {
             tl.m_traceTemplates = conf.getTemplates();
             try {
                 ((TransformerImpl) t).getTraceManager().addTraceListener(tl);
-            } catch (TooManyListenersException tml) {
+            } catch (final TooManyListenersException tml) {
                 throw new BuildException(tml);
             }
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
index 7b4ffbc..159026d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
@@ -61,7 +61,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
     private static DocumentBuilder getDocumentBuilder() {
         try {
             return DocumentBuilderFactory.newInstance().newDocumentBuilder();
-        } catch (Exception exc) {
+        } catch (final Exception exc) {
             throw new ExceptionInInitializerError(exc);
         }
     }
@@ -70,10 +70,12 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * The XML document.
      */
     private Document doc;
+
     /**
      * The wrapper for the whole testsuite.
      */
     private Element rootElement;
+
     /**
      * Element for the current test.
      *
@@ -82,23 +84,25 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * so we can't easily match Test objects without manually iterating over all keys and checking
      * individual fields.
      */
-    private Hashtable<String, Element> testElements = new Hashtable<String, Element>();
+    private final Hashtable<String, Element> testElements = new Hashtable<String, Element>();
+
     /**
      * tests that failed.
      */
-    private Hashtable failedTests = new Hashtable();
+    private final Hashtable failedTests = new Hashtable();
+
     /**
      * Tests that were skipped.
      */
-    private Hashtable<String, Test> skippedTests = new Hashtable<String, Test>();
+    private final Hashtable<String, Test> skippedTests = new Hashtable<String, Test>();
     /**
      * Tests that were ignored. See the note above about the key being a bit of a hack.
      */
-    private Hashtable<String, Test> ignoredTests = new Hashtable<String, Test>();
+    private final Hashtable<String, Test> ignoredTests = new Hashtable<String, Test>();
     /**
      * Timing helper.
      */
-    private Hashtable<String, Long> testStarts = new Hashtable<String, Long>();
+    private final Hashtable<String, Long> testStarts = new Hashtable<String, Long>();
     /**
      * Where to write the log to.
      */
@@ -109,17 +113,17 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
     }
 
     /** {@inheritDoc}. */
-	public void setOutput(OutputStream out) {
+	public void setOutput(final OutputStream out) {
         this.out = out;
     }
 
     /** {@inheritDoc}. */
-	public void setSystemOutput(String out) {
+	public void setSystemOutput(final String out) {
         formatOutput(SYSTEM_OUT, out);
     }
 
     /** {@inheritDoc}. */
-	public void setSystemError(String out) {
+	public void setSystemError(final String out) {
         formatOutput(SYSTEM_ERR, out);
     }
 
@@ -127,10 +131,10 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * The whole testsuite started.
      * @param suite the testsuite.
      */
-	public void startTestSuite(JUnitTest suite) {
+	public void startTestSuite(final JUnitTest suite) {
         doc = getDocumentBuilder().newDocument();
         rootElement = doc.createElement(TESTSUITE);
-        String n = suite.getName();
+        final String n = suite.getName();
         rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);
 
         //add the timestamp
@@ -141,14 +145,14 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
         rootElement.setAttribute(HOSTNAME, getHostname());
 
         // Output properties
-        Element propsElement = doc.createElement(PROPERTIES);
+        final Element propsElement = doc.createElement(PROPERTIES);
         rootElement.appendChild(propsElement);
-        Properties props = suite.getProperties();
+        final Properties props = suite.getProperties();
         if (props != null) {
-            Enumeration e = props.propertyNames();
+            final Enumeration e = props.propertyNames();
             while (e.hasMoreElements()) {
-                String name = (String) e.nextElement();
-                Element propElement = doc.createElement(PROPERTY);
+                final String name = (String) e.nextElement();
+                final Element propElement = doc.createElement(PROPERTY);
                 propElement.setAttribute(ATTR_NAME, name);
                 propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
                 propsElement.appendChild(propElement);
@@ -163,11 +167,11 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
     private String getHostname()  {
         String hostname = "localhost";
         try {
-            InetAddress localHost = InetAddress.getLocalHost();
+            final InetAddress localHost = InetAddress.getLocalHost();
             if (localHost != null) {
                 hostname = localHost.getHostName();
             }
-        } catch (UnknownHostException e) {
+        } catch (final UnknownHostException e) {
         	// fall back to default 'localhost'
         }
         return hostname;
@@ -178,7 +182,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * @param suite the testsuite.
      * @throws BuildException on error.
      */
-	public void endTestSuite(JUnitTest suite) throws BuildException {
+	public void endTestSuite(final JUnitTest suite) throws BuildException {
         rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount());
         rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount());
         rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount());
@@ -191,13 +195,13 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
                 wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
                 wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
                 (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
-            } catch (IOException exc) {
+            } catch (final IOException exc) {
                 throw new BuildException("Unable to write log file", exc);
             } finally {
                 if (wri != null) {
                     try {
                         wri.flush();
-                    } catch (IOException ex) {
+                    } catch (final IOException ex) {
                         // ignore
                     }
                 }
@@ -214,11 +218,11 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * <p>A new Test is started.
      * @param t the test.
      */
-	public void startTest(Test t) {
+	public void startTest(final Test t) {
         testStarts.put(createDescription(t), System.currentTimeMillis());
     }
 
-    private static String createDescription(Test test) throws BuildException {
+    private static String createDescription(final Test test) throws BuildException {
         return JUnitVersionHelper.getTestCaseName(test) + "(" + JUnitVersionHelper.getTestCaseClassName(test) + ")";
 	}
 
@@ -228,8 +232,8 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * <p>A Test is finished.
      * @param test the test.
      */
-	public void endTest(Test test) {
-        String testDescription = createDescription(test);
+	public void endTest(final Test test) {
+        final String testDescription = createDescription(test);
 
         // Fix for bug #5637 - if a junit.extensions.TestSetup is
         // used and throws an exception during setUp then startTest
@@ -240,7 +244,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
         Element currentTest;
         if (!failedTests.containsKey(test) && !skippedTests.containsKey(testDescription) && !ignoredTests.containsKey(testDescription)) {
             currentTest = doc.createElement(TESTCASE);
-            String n = JUnitVersionHelper.getTestCaseName(test);
+            final String n = JUnitVersionHelper.getTestCaseName(test);
             currentTest.setAttribute(ATTR_NAME,
                                      n == null ? UNKNOWN : n);
             // a TestSuite can contain Tests from multiple classes,
@@ -253,7 +257,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
             currentTest = testElements.get(testDescription);
         }
 
-        Long l = testStarts.get(createDescription(test));
+        final Long l = testStarts.get(createDescription(test));
         currentTest.setAttribute(ATTR_TIME,
             "" + ((System.currentTimeMillis() - l) / ONE_SECOND));
     }
@@ -265,7 +269,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * @param test the test.
      * @param t the exception.
      */
-    public void addFailure(Test test, Throwable t) {
+    public void addFailure(final Test test, final Throwable t) {
         formatError(FAILURE, test, t);
     }
 
@@ -276,7 +280,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * @param test the test.
      * @param t the assertion.
      */
-	public void addFailure(Test test, AssertionFailedError t) {
+	public void addFailure(final Test test, final AssertionFailedError t) {
         addFailure(test, (Throwable) t);
     }
 
@@ -287,17 +291,17 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
      * @param test the test.
      * @param t the error.
      */
-	public void addError(Test test, Throwable t) {
+	public void addError(final Test test, final Throwable t) {
         formatError(ERROR, test, t);
     }
 
-    private void formatError(String type, Test test, Throwable t) {
+    private void formatError(final String type, final Test test, final Throwable t) {
         if (test != null) {
             endTest(test);
             failedTests.put(test, test);
         }
 
-        Element nested = doc.createElement(type);
+        final Element nested = doc.createElement(type);
         Element currentTest;
         if (test != null) {
             currentTest = testElements.get(createDescription(test));
@@ -307,24 +311,24 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
 
         currentTest.appendChild(nested);
 
-        String message = t.getMessage();
+        final String message = t.getMessage();
         if (message != null && message.length() > 0) {
             nested.setAttribute(ATTR_MESSAGE, t.getMessage());
         }
         nested.setAttribute(ATTR_TYPE, t.getClass().getName());
 
-        String strace = JUnitTestRunner.getFilteredTrace(t);
-        Text trace = doc.createTextNode(strace);
+        final String strace = JUnitTestRunner.getFilteredTrace(t);
+        final Text trace = doc.createTextNode(strace);
         nested.appendChild(trace);
     }
 
-    private void formatOutput(String type, String output) {
-        Element nested = doc.createElement(type);
+    private void formatOutput(final String type, final String output) {
+        final Element nested = doc.createElement(type);
         rootElement.appendChild(nested);
         nested.appendChild(doc.createCDATASection(output));
     }
 
-	public void testIgnored(Test test) {
+	public void testIgnored(final Test test) {
         formatSkip(test, JUnitVersionHelper.getIgnoreMessage(test));
         if (test != null) {
             ignoredTests.put(createDescription(test), test);
@@ -332,12 +336,12 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
     }
 
 
-    public void formatSkip(Test test, String message) {
+    public void formatSkip(final Test test, final String message) {
         if (test != null) {
             endTest(test);
         }
 
-        Element nested = doc.createElement("skipped");
+        final Element nested = doc.createElement("skipped");
 
         if (message != null) {
             nested.setAttribute("message", message);
@@ -354,7 +358,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan
 
     }
 
-	public void testAssumptionFailure(Test test, Throwable failure) {
+	public void testAssumptionFailure(final Test test, final Throwable failure) {
         formatSkip(test, failure.getMessage());
         skippedTests.put(createDescription(test), test);
 

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
index c925fc6..9365e8c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
@@ -25,9 +25,11 @@ import java.text.NumberFormat;
 
 import org.apache.tools.ant.BuildException;
 
+import com.jcraft.jsch.Channel;
 import com.jcraft.jsch.ChannelExec;
 import com.jcraft.jsch.ChannelSftp;
 import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
 import com.jcraft.jsch.SftpProgressMonitor;
 
 /**
@@ -36,10 +38,10 @@ import com.jcraft.jsch.SftpProgressMonitor;
 public abstract class AbstractSshMessage {
     private static final double ONE_SECOND = 1000.0;
 
-    private Session session;
-    private boolean verbose;
+    private final Session session;
+    private final boolean verbose;
     private LogListener listener = new LogListener() {
-        public void log(String message) {
+        public void log(final String message) {
             // do nothing;
         }
     };
@@ -48,7 +50,7 @@ public abstract class AbstractSshMessage {
      * Constructor for AbstractSshMessage
      * @param session the ssh session to use
      */
-    public AbstractSshMessage(Session session) {
+    public AbstractSshMessage(final Session session) {
         this(false, session);
     }
 
@@ -58,7 +60,7 @@ public abstract class AbstractSshMessage {
      * @param session the ssh session to use
      * @since Ant 1.6.2
      */
-    public AbstractSshMessage(boolean verbose, Session session) {
+    public AbstractSshMessage(final boolean verbose, final Session session) {
         this.verbose = verbose;
         this.session = session;
     }
@@ -69,8 +71,8 @@ public abstract class AbstractSshMessage {
      * @return the channel
      * @throws JSchException on error
      */
-    protected Channel openExecChannel(String command) throws JSchException {
-        ChannelExec channel = (ChannelExec) session.openChannel("exec");
+    protected Channel openExecChannel(final String command) throws JSchException {
+        final ChannelExec channel = (ChannelExec) session.openChannel("exec");
         channel.setCommand(command);
 
         return channel;
@@ -82,7 +84,7 @@ public abstract class AbstractSshMessage {
      * @throws JSchException on error
      */
     protected ChannelSftp openSftpChannel() throws JSchException {
-        ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
+        final ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
 
         return channel;
     }
@@ -92,8 +94,8 @@ public abstract class AbstractSshMessage {
      * @param out the output stream to use
      * @throws IOException on error
      */
-    protected void sendAck(OutputStream out) throws IOException {
-        byte[] buf = new byte[1];
+    protected void sendAck(final OutputStream out) throws IOException {
+        final byte[] buf = new byte[1];
         buf[0] = 0;
         out.write(buf);
         out.flush();
@@ -106,9 +108,9 @@ public abstract class AbstractSshMessage {
      * @throws IOException on I/O error
      * @throws BuildException on other errors
      */
-    protected void waitForAck(InputStream in)
+    protected void waitForAck(final InputStream in)
         throws IOException, BuildException {
-        int b = in.read();
+        final int b = in.read();
 
         // b may be 0 for success,
         //          1 for error,
@@ -118,7 +120,7 @@ public abstract class AbstractSshMessage {
             // didn't receive any response
             throw new BuildException("No response from server");
         } else if (b != 0) {
-            StringBuffer sb = new StringBuffer();
+            final StringBuffer sb = new StringBuffer();
 
             int c = in.read();
             while (c > 0 && c != '\n') {
@@ -150,7 +152,7 @@ public abstract class AbstractSshMessage {
      * Set a log listener.
      * @param aListener the log listener
      */
-    public void setLogListener(LogListener aListener) {
+    public void setLogListener(final LogListener aListener) {
         listener = aListener;
     }
 
@@ -158,7 +160,7 @@ public abstract class AbstractSshMessage {
      * Log a message to the log listener.
      * @param message the message to log
      */
-    protected void log(String message) {
+    protected void log(final String message) {
         listener.log(message);
     }
 
@@ -168,11 +170,11 @@ public abstract class AbstractSshMessage {
      * @param timeEnded   the finishing time
      * @param totalLength the total length
      */
-    protected void logStats(long timeStarted,
-                             long timeEnded,
-                             long totalLength) {
-        double duration = (timeEnded - timeStarted) / ONE_SECOND;
-        NumberFormat format = NumberFormat.getNumberInstance();
+    protected void logStats(final long timeStarted,
+                             final long timeEnded,
+                             final long totalLength) {
+        final double duration = (timeEnded - timeStarted) / ONE_SECOND;
+        final NumberFormat format = NumberFormat.getNumberInstance();
         format.setMaximumFractionDigits(2);
         format.setMinimumFractionDigits(1);
         listener.log("File transfer time: " + format.format(duration)
@@ -197,11 +199,11 @@ public abstract class AbstractSshMessage {
      * @param percentTransmitted the current percent transmitted
      * @return the percent that the file is of the total
      */
-    protected final int trackProgress(long filesize, long totalLength,
-                                      int percentTransmitted) {
+    protected final int trackProgress(final long filesize, final long totalLength,
+                                      final int percentTransmitted) {
 
         // CheckStyle:MagicNumber OFF
-        int percent = (int) Math.round(Math.floor((totalLength
+        final int percent = (int) Math.round(Math.floor((totalLength
                                                    / (double) filesize) * 100));
 
         if (percent > percentTransmitted) {
@@ -246,13 +248,13 @@ public abstract class AbstractSshMessage {
         private long totalLength = 0;
         private int percentTransmitted = 0;
 
-        public void init(int op, String src, String dest, long max) {
+        public void init(final int op, final String src, final String dest, final long max) {
             initFileSize = max;
             totalLength = 0;
             percentTransmitted = 0;
         }
 
-        public boolean count(long len) {
+        public boolean count(final long len) {
             totalLength += len;
             percentTransmitted = trackProgress(initFileSize,
                                                totalLength,

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
index f36b134..bd98b3a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
@@ -24,6 +24,7 @@ import org.apache.tools.ant.Task;
 
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
 
 /**
  * Base class for Ant tasks using jsch.
@@ -40,7 +41,7 @@ public abstract class SSHBase extends Task implements LogListener {
     private int port = SSH_PORT;
     private boolean failOnError = true;
     private boolean verbose;
-    private SSHUserInfo userInfo;
+    private final SSHUserInfo userInfo;
 
     /**
      * Constructor for SSHBase.
@@ -55,7 +56,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param host  The new host value
      */
-    public void setHost(String host) {
+    public void setHost(final String host) {
         this.host = host;
     }
 
@@ -73,7 +74,7 @@ public abstract class SSHBase extends Task implements LogListener {
      * @param failure if true throw a build exception when a failure occuries,
      *                otherwise just log the failure and continue
      */
-    public void setFailonerror(boolean failure) {
+    public void setFailonerror(final boolean failure) {
         failOnError = failure;
     }
 
@@ -90,7 +91,7 @@ public abstract class SSHBase extends Task implements LogListener {
      * @param verbose if true output more verbose logging
      * @since Ant 1.6.2
      */
-    public void setVerbose(boolean verbose) {
+    public void setVerbose(final boolean verbose) {
         this.verbose = verbose;
     }
 
@@ -108,7 +109,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param username  The new username value
      */
-    public void setUsername(String username) {
+    public void setUsername(final String username) {
         userInfo.setName(username);
     }
 
@@ -118,7 +119,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param password  The new password value
      */
-    public void setPassword(String password) {
+    public void setPassword(final String password) {
         userInfo.setPassword(password);
     }
 
@@ -127,7 +128,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param keyfile  The new keyfile value
      */
-    public void setKeyfile(String keyfile) {
+    public void setKeyfile(final String keyfile) {
         userInfo.setKeyfile(keyfile);
     }
 
@@ -136,7 +137,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param passphrase  The new passphrase value
      */
-    public void setPassphrase(String passphrase) {
+    public void setPassphrase(final String passphrase) {
         userInfo.setPassphrase(passphrase);
     }
 
@@ -148,7 +149,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param knownHosts a path to the known hosts file.
      */
-    public void setKnownhosts(String knownHosts) {
+    public void setKnownhosts(final String knownHosts) {
         this.knownHosts = knownHosts;
     }
 
@@ -157,7 +158,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param yesOrNo if true trust the identity of unknown hosts.
      */
-    public void setTrust(boolean yesOrNo) {
+    public void setTrust(final boolean yesOrNo) {
         userInfo.setTrust(yesOrNo);
     }
 
@@ -166,7 +167,7 @@ public abstract class SSHBase extends Task implements LogListener {
      *
      * @param port port number of remote host.
      */
-    public void setPort(int port) {
+    public void setPort(final int port) {
         this.port = port;
     }
 
@@ -195,14 +196,14 @@ public abstract class SSHBase extends Task implements LogListener {
      * @throws JSchException on error
      */
     protected Session openSession() throws JSchException {
-        JSch jsch = new JSch();
+        final JSch jsch = new JSch();
         final SSHBase base = this;
         if(verbose) {
         	JSch.setLogger(new com.jcraft.jsch.Logger(){
-        		public boolean isEnabled(int level){
+        		public boolean isEnabled(final int level){
         			return true;
         		}
-        		public void log(int level, String message){
+        		public void log(final int level, final String message){
         			base.log(message, Project.MSG_INFO);
         		}
         	});
@@ -216,7 +217,7 @@ public abstract class SSHBase extends Task implements LogListener {
             jsch.setKnownHosts(knownHosts);
         }
 
-        Session session = jsch.getSession(userInfo.getName(), host, port);
+        final Session session = jsch.getSession(userInfo.getName(), host, port);
         session.setConfig("PreferredAuthentications",
                 "publickey,keyboard-interactive,password");
         session.setUserInfo(userInfo);

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
index 564d07d..0fd252e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
@@ -41,6 +41,7 @@ import org.apache.tools.ant.util.TeeOutputStream;
 
 import com.jcraft.jsch.ChannelExec;
 import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
 
 /**
  * Executes a command on a remote machine via ssh.

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java
index b39aa6b..15d7b7e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java
@@ -31,6 +31,8 @@ import org.apache.tools.ant.Task;
 import org.apache.tools.ant.TaskContainer;
 
 import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
 
 /**
  * Establishes an ssh session with a remote machine, optionally
@@ -43,10 +45,10 @@ public class SSHSession extends SSHBase {
     /** units are milliseconds, default is 0=infinite */
     private long maxwait = 0;
 
-    private Vector localTunnels = new Vector();
-    private Set localPortsUsed = new TreeSet();
-    private Vector remoteTunnels = new Vector();
-    private Set remotePortsUsed = new TreeSet();
+    private final Vector localTunnels = new Vector();
+    private final Set localPortsUsed = new TreeSet();
+    private final Vector remoteTunnels = new Vector();
+    private final Set remotePortsUsed = new TreeSet();
     private NestedSequential nestedSequential = null;
 
     private static final String TIMEOUT_MESSAGE =
@@ -54,7 +56,7 @@ public class SSHSession extends SSHBase {
 
 
     /** Optional Vector holding the nested tasks */
-    private Vector nestedTasks = new Vector();
+    private final Vector nestedTasks = new Vector();
 
     /**
      * Add a nested task to Sequential.
@@ -62,7 +64,7 @@ public class SSHSession extends SSHBase {
      * @param nestedTask        Nested task to execute Sequential
      * <p>
      */
-    public void addTask(Task nestedTask) {
+    public void addTask(final Task nestedTask) {
         nestedTasks.addElement(nestedTask);
     }
 
@@ -73,7 +75,7 @@ public class SSHSession extends SSHBase {
      *
      * @param timeout  The new timeout value in seconds
      */
-    public void setTimeout(long timeout) {
+    public void setTimeout(final long timeout) {
         maxwait = timeout;
     }
 
@@ -84,15 +86,15 @@ public class SSHSession extends SSHBase {
      * @param tunnels a comma-delimited list of lport:rhost:rport
      * tunnel specifications
      */
-    public void setLocaltunnels(String tunnels) {
-        String[] specs = tunnels.split(", ");
+    public void setLocaltunnels(final String tunnels) {
+        final String[] specs = tunnels.split(", ");
         for (int i = 0; i < specs.length; i++) {
             if (specs[i].length() > 0) {
-                String[] spec = specs[i].split(":", 3);
-                int lport = Integer.parseInt(spec[0]);
-                String rhost = spec[1];
-                int rport = Integer.parseInt(spec[2]);
-                LocalTunnel tunnel = createLocalTunnel();
+                final String[] spec = specs[i].split(":", 3);
+                final int lport = Integer.parseInt(spec[0]);
+                final String rhost = spec[1];
+                final int rport = Integer.parseInt(spec[2]);
+                final LocalTunnel tunnel = createLocalTunnel();
                 tunnel.setLPort(lport);
                 tunnel.setRHost(rhost);
                 tunnel.setRPort(rport);
@@ -107,15 +109,15 @@ public class SSHSession extends SSHBase {
      * @param tunnels a comma-delimited list of rport:lhost:lport
      * tunnel specifications
      */
-    public void setRemotetunnels(String tunnels) {
-        String[] specs = tunnels.split(", ");
+    public void setRemotetunnels(final String tunnels) {
+        final String[] specs = tunnels.split(", ");
         for (int i = 0; i < specs.length; i++) {
             if (specs[i].length() > 0) {
-                String[] spec = specs[i].split(":", 3);
-                int rport = Integer.parseInt(spec[0]);
-                String lhost = spec[1];
-                int lport = Integer.parseInt(spec[2]);
-                RemoteTunnel tunnel = createRemoteTunnel();
+                final String[] spec = specs[i].split(":", 3);
+                final int rport = Integer.parseInt(spec[0]);
+                final String lhost = spec[1];
+                final int lport = Integer.parseInt(spec[2]);
+                final RemoteTunnel tunnel = createRemoteTunnel();
                 tunnel.setRPort(rport);
                 tunnel.setLHost(lhost);
                 tunnel.setLPort(lport);
@@ -153,28 +155,28 @@ public class SSHSession extends SSHBase {
             session = openSession();
             session.setTimeout((int) maxwait);
 
-            for (Iterator i = localTunnels.iterator(); i.hasNext();) {
-                LocalTunnel tunnel = (LocalTunnel) i.next();
+            for (final Iterator i = localTunnels.iterator(); i.hasNext();) {
+                final LocalTunnel tunnel = (LocalTunnel) i.next();
                 session.setPortForwardingL(tunnel.getLPort(),
                                            tunnel.getRHost(),
                                            tunnel.getRPort());
             }
 
-            for (Iterator i = remoteTunnels.iterator(); i.hasNext();) {
-                RemoteTunnel tunnel = (RemoteTunnel) i.next();
+            for (final Iterator i = remoteTunnels.iterator(); i.hasNext();) {
+                final RemoteTunnel tunnel = (RemoteTunnel) i.next();
                 session.setPortForwardingR(tunnel.getRPort(),
                                            tunnel.getLHost(),
                                            tunnel.getLPort());
             }
 
-            for (Iterator i = nestedSequential.getNested().iterator();
+            for (final Iterator i = nestedSequential.getNested().iterator();
                  i.hasNext();) {
-                Task nestedTask = (Task) i.next();
+                final Task nestedTask = (Task) i.next();
                 nestedTask.perform();
             }
             // completed successfully
 
-        } catch (JSchException e) {
+        } catch (final JSchException e) {
             if (e.getMessage().indexOf("session is down") >= 0) {
                 if (getFailonerror()) {
                     throw new BuildException(TIMEOUT_MESSAGE, e);
@@ -189,10 +191,10 @@ public class SSHSession extends SSHBase {
                         Project.MSG_ERR);
                 }
             }
-        } catch (BuildException e) {
+        } catch (final BuildException e) {
             // avoid wrapping it into yet another BuildException further down
             throw e;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             if (getFailonerror()) {
                 throw new BuildException(e);
             } else {
@@ -206,13 +208,13 @@ public class SSHSession extends SSHBase {
     }
 
     public LocalTunnel createLocalTunnel() {
-        LocalTunnel tunnel = new LocalTunnel();
+        final LocalTunnel tunnel = new LocalTunnel();
         localTunnels.add(tunnel);
         return tunnel;
     }
 
     public RemoteTunnel createRemoteTunnel() {
-        RemoteTunnel tunnel = new RemoteTunnel();
+        final RemoteTunnel tunnel = new RemoteTunnel();
         remoteTunnels.add(tunnel);
         return tunnel;
     }
@@ -223,8 +225,8 @@ public class SSHSession extends SSHBase {
         int lport = 0;
         String rhost = null;
         int rport = 0;
-        public void setLPort(int lport) {
-            Integer portKey = new Integer(lport);
+        public void setLPort(final int lport) {
+            final Integer portKey = new Integer(lport);
             if (localPortsUsed.contains(portKey)) {
                 throw new BuildException("Multiple local tunnels defined to"
                                          + " use same local port " + lport);
@@ -232,8 +234,8 @@ public class SSHSession extends SSHBase {
             localPortsUsed.add(portKey);
             this.lport = lport;
         }
-        public void setRHost(String rhost) { this.rhost = rhost; }
-        public void setRPort(int rport) { this.rport = rport; }
+        public void setRHost(final String rhost) { this.rhost = rhost; }
+        public void setRPort(final int rport) { this.rport = rport; }
         public int getLPort() {
             if (lport == 0) {
             	throw new BuildException("lport is required for LocalTunnel.");
@@ -260,10 +262,10 @@ public class SSHSession extends SSHBase {
         int lport = 0;
         String lhost = null;
         int rport = 0;
-        public void setLPort(int lport) { this.lport = lport; }
-        public void setLHost(String lhost) { this.lhost = lhost; }
-        public void setRPort(int rport) {
-            Integer portKey = new Integer(rport);
+        public void setLPort(final int lport) { this.lport = lport; }
+        public void setLHost(final String lhost) { this.lhost = lhost; }
+        public void setRPort(final int rport) {
+            final Integer portKey = new Integer(rport);
 			if (remotePortsUsed.contains(portKey)) {
 				throw new BuildException("Multiple remote tunnels defined to"
 						+ " use same remote port " + rport);
@@ -309,15 +311,14 @@ public class SSHSession extends SSHBase {
      * This is a simple task container.
      */
     public static class NestedSequential implements TaskContainer {
-        private List<Task> nested = new ArrayList<Task>();
+        private final List<Task> nested = new ArrayList<Task>();
 
         /**
          * Add a task or type to the container.
          *
          * @param task an unknown element.
          */
-        @Override
-		public void addTask(Task task) {
+		public void addTask(final Task task) {
             nested.add(task);
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
index 74cd2c8..9676467 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
@@ -31,6 +31,7 @@ import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.FileSet;
 
 import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
 
 /**
  * Ant task for sending files to remote machine over ssh/scp.
@@ -61,7 +62,7 @@ public class Scp extends SSHBase {
      * <i>user:password@host:/directory/path/*</i><br>
      * @param aFromUri a string representing the file to transfer.
      */
-    public void setFile(String aFromUri) {
+    public void setFile(final String aFromUri) {
         setFromUri(aFromUri);
         this.isFromRemote = isRemoteUri(this.fromUri);
     }
@@ -75,7 +76,7 @@ public class Scp extends SSHBase {
 
      * @param aToUri a string representing the target of the copy.
      */
-    public void setTodir(String aToUri) {
+    public void setTodir(final String aToUri) {
         setToUri(aToUri);
         this.isToRemote = isRemoteUri(this.toUri);
     }
@@ -87,7 +88,7 @@ public class Scp extends SSHBase {
      * @param aFromUri a string representing the source of the copy.
      * @since Ant 1.6.2
      */
-    public void setLocalFile(String aFromUri) {
+    public void setLocalFile(final String aFromUri) {
         setFromUri(aFromUri);
         this.isFromRemote = false;
     }
@@ -98,7 +99,7 @@ public class Scp extends SSHBase {
      * @param aFromUri a string representing the source of the copy.
      * @since Ant 1.6.2
      */
-    public void setRemoteFile(String aFromUri) {
+    public void setRemoteFile(final String aFromUri) {
         validateRemoteUri("remoteFile", aFromUri);
         setFromUri(aFromUri);
         this.isFromRemote = true;
@@ -111,7 +112,7 @@ public class Scp extends SSHBase {
      * @param aToUri a string representing the target of the copy.
      * @since Ant 1.6.2
      */
-    public void setLocalTodir(String aToUri) {
+    public void setLocalTodir(final String aToUri) {
         setToUri(aToUri);
         this.isToRemote = false;
     }
@@ -121,7 +122,7 @@ public class Scp extends SSHBase {
      * remote system is to be preserved during copy.
      * @since Ant 1.8.0
      */
-    public void setPreservelastmodified(boolean yesOrNo) {
+    public void setPreservelastmodified(final boolean yesOrNo) {
     	this.preserveLastModified = yesOrNo;
     }
 
@@ -131,13 +132,13 @@ public class Scp extends SSHBase {
      * @param aToUri a string representing the target of the copy.
      * @since Ant 1.6.2
      */
-    public void setRemoteTodir(String aToUri) {
+    public void setRemoteTodir(final String aToUri) {
         validateRemoteUri("remoteToDir", aToUri);
         setToUri(aToUri);
         this.isToRemote = true;
     }
 
-    private static void validateRemoteUri(String type, String aToUri) {
+    private static void validateRemoteUri(final String type, final String aToUri) {
     	if (!isRemoteUri(aToUri)) {
             throw new BuildException(type + " '" + aToUri + "' is invalid. "
                                      + "The 'remoteToDir' attribute must "
@@ -153,7 +154,7 @@ public class Scp extends SSHBase {
      * @param aToUri a string representing the target of the copy.
      * @since Ant 1.6.2
      */
-    public void setLocalTofile(String aToUri) {
+    public void setLocalTofile(final String aToUri) {
         setToUri(aToUri);
         this.isToRemote = false;
     }
@@ -164,7 +165,7 @@ public class Scp extends SSHBase {
      * @param aToUri a string representing the target of the copy.
      * @since Ant 1.6.2
      */
-    public void setRemoteTofile(String aToUri) {
+    public void setRemoteTofile(final String aToUri) {
         validateRemoteUri("remoteToFile", aToUri);
         setToUri(aToUri);
         this.isToRemote = true;
@@ -175,7 +176,7 @@ public class Scp extends SSHBase {
      *
      * @param yesOrNo if true sftp protocol will be used.
      */
-    public void setSftp(boolean yesOrNo) {
+    public void setSftp(final boolean yesOrNo) {
         isSftp = yesOrNo;
     }
 
@@ -185,7 +186,7 @@ public class Scp extends SSHBase {
      *
      * @param set FileSet to send to remote host.
      */
-    public void addFileset(FileSet set) {
+    public void addFileset(final FileSet set) {
         if (fileSets == null) {
             fileSets = new LinkedList();
         }
@@ -233,10 +234,10 @@ public class Scp extends SSHBase {
                     + "must have syntax like the following: "
                     + "user:password@host:/path");
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             if (getFailonerror()) {
                 if(e instanceof BuildException) {
-                    BuildException be = (BuildException) e;
+                    final BuildException be = (BuildException) e;
                     if(be.getLocation() == null) {
                         be.setLocation(getLocation());
                     }
@@ -250,9 +251,9 @@ public class Scp extends SSHBase {
         }
     }
 
-    private void download(String fromSshUri, String toPath)
+    private void download(final String fromSshUri, final String toPath)
         throws JSchException, IOException {
-        String file = parseUri(fromSshUri);
+        final String file = parseUri(fromSshUri);
 
         Session session = null;
         try {
@@ -281,16 +282,16 @@ public class Scp extends SSHBase {
         }
     }
 
-    private void upload(List fileSet, String toSshUri)
+    private void upload(final List fileSet, final String toSshUri)
         throws IOException, JSchException {
-        String file = parseUri(toSshUri);
+        final String file = parseUri(toSshUri);
 
         Session session = null;
         try {
-            List list = new ArrayList(fileSet.size());
-            for (Iterator i = fileSet.iterator(); i.hasNext();) {
-                FileSet set = (FileSet) i.next();
-                Directory d = createDirectory(set);
+            final List list = new ArrayList(fileSet.size());
+            for (final Iterator i = fileSet.iterator(); i.hasNext();) {
+                final FileSet set = (FileSet) i.next();
+                final Directory d = createDirectory(set);
                 if (d != null) {
                     list.add(d);
                 }
@@ -315,9 +316,9 @@ public class Scp extends SSHBase {
         }
     }
 
-    private void upload(String fromPath, String toSshUri)
+    private void upload(final String fromPath, final String toSshUri)
         throws IOException, JSchException {
-        String file = parseUri(toSshUri);
+        final String file = parseUri(toSshUri);
 
         Session session = null;
         try {
@@ -342,17 +343,17 @@ public class Scp extends SSHBase {
         }
     }
 
-    private String parseUri(String uri) {
+    private String parseUri(final String uri) {
 
         int indexOfAt = uri.indexOf('@');
-        int indexOfColon = uri.indexOf(':');
+        final int indexOfColon = uri.indexOf(':');
 
         if (indexOfColon > -1 && indexOfColon < indexOfAt) {
             // user:password@host:/path notation
             // everything upto the last @ before the last : is considered
             // password. (so if the path contains an @ and a : it will not work)
             int indexOfCurrentAt = indexOfAt;
-            int indexOfLastColon = uri.lastIndexOf(':');
+            final int indexOfLastColon = uri.lastIndexOf(':');
             while (indexOfCurrentAt > -1 && indexOfCurrentAt < indexOfLastColon)
             {
                 indexOfAt = indexOfCurrentAt;
@@ -374,7 +375,7 @@ public class Scp extends SSHBase {
                                      + "given.  Can't authenticate.");
         }
 
-        int indexOfPath = uri.indexOf(':', indexOfAt + 1);
+        final int indexOfPath = uri.indexOf(':', indexOfAt + 1);
         if (indexOfPath == -1) {
             throw new BuildException("no remote path in " + uri);
         }
@@ -387,26 +388,26 @@ public class Scp extends SSHBase {
         return remotePath;
     }
 
-    private static boolean isRemoteUri(String uri) {
+    private static boolean isRemoteUri(final String uri) {
         boolean isRemote = true;
-        int indexOfAt = uri.indexOf('@');
+        final int indexOfAt = uri.indexOf('@');
         if (indexOfAt < 0) {
             isRemote = false;
         }
         return isRemote;
     }
 
-    private Directory createDirectory(FileSet set) {
-        DirectoryScanner scanner = set.getDirectoryScanner(getProject());
+    private Directory createDirectory(final FileSet set) {
+        final DirectoryScanner scanner = set.getDirectoryScanner(getProject());
         Directory root = new Directory(scanner.getBasedir());
-        String[] files = scanner.getIncludedFiles();
+        final String[] files = scanner.getIncludedFiles();
         if (files.length != 0) {
             for (int j = 0; j < files.length; j++) {
-                String[] path = Directory.getPath(files[j]);
+                final String[] path = Directory.getPath(files[j]);
                 Directory current = root;
                 File currentParent = scanner.getBasedir();
                 for (int i = 0; i < path.length; i++) {
-                    File file = new File(currentParent, path[i]);
+                    final File file = new File(currentParent, path[i]);
                     if (file.isDirectory()) {
                         current.addDirectory(new Directory(file));
                         current = current.getChild(file);
@@ -423,26 +424,26 @@ public class Scp extends SSHBase {
         return root;
     }
 
-    private void setFromUri(String fromUri) {
+    private void setFromUri(final String fromUri) {
         if (this.fromUri != null) {
             throw exactlyOne(FROM_ATTRS);
         }
         this.fromUri = fromUri;
     }
 
-    private void setToUri(String toUri) {
+    private void setToUri(final String toUri) {
         if (this.toUri != null) {
             throw exactlyOne(TO_ATTRS);
         }
         this.toUri = toUri;
     }
 
-    private BuildException exactlyOne(String[] attrs) {
+    private BuildException exactlyOne(final String[] attrs) {
         return exactlyOne(attrs, null);
     }
 
-    private BuildException exactlyOne(String[] attrs, String alt) {
-        StringBuffer buf = new StringBuffer("Exactly one of ").append(
+    private BuildException exactlyOne(final String[] attrs, final String alt) {
+        final StringBuffer buf = new StringBuffer("Exactly one of ").append(
                 '[').append(attrs[0]);
         for (int i = 1; i < attrs.length; i++) {
             buf.append('|').append(attrs[i]);

http://git-wip-us.apache.org/repos/asf/ant/blob/789422e1/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
index c6130f3..0cc9970 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
@@ -28,8 +28,10 @@ import java.io.OutputStream;
 
 import org.apache.tools.ant.util.FileUtils;
 
+import com.jcraft.jsch.Channel;
 import com.jcraft.jsch.ChannelSftp;
 import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
 import com.jcraft.jsch.SftpATTRS;
 import com.jcraft.jsch.SftpException;
 
@@ -51,7 +53,7 @@ public class ScpFromMessage extends AbstractSshMessage {
      * Constructor for ScpFromMessage
      * @param session the ssh session to use
      */
-    public ScpFromMessage(Session session) {
+    public ScpFromMessage(final Session session) {
         super(session);
     }
 
@@ -61,7 +63,7 @@ public class ScpFromMessage extends AbstractSshMessage {
      * @param session the ssh session to use
      * @since Ant 1.7
      */
-    public ScpFromMessage(boolean verbose, Session session) {
+    public ScpFromMessage(final boolean verbose, final Session session) {
         super(verbose, session);
     }
 
@@ -74,11 +76,11 @@ public class ScpFromMessage extends AbstractSshMessage {
      * @param recursive   if true use recursion (-r option to scp)
      * @since Ant 1.6.2
      */
-    public ScpFromMessage(boolean verbose,
-                          Session session,
-                          String aRemoteFile,
-                          File aLocalFile,
-                          boolean recursive) {
+    public ScpFromMessage(final boolean verbose,
+                          final Session session,
+                          final String aRemoteFile,
+                          final File aLocalFile,
+                          final boolean recursive) {
         this(false, session, aRemoteFile, aLocalFile, recursive, false);
     }
 
@@ -89,10 +91,10 @@ public class ScpFromMessage extends AbstractSshMessage {
      * @param aLocalFile  the local file
      * @param recursive   if true use recursion (-r option to scp)
      */
-    public ScpFromMessage(Session session,
-                           String aRemoteFile,
-                           File aLocalFile,
-                           boolean recursive) {
+    public ScpFromMessage(final Session session,
+                           final String aRemoteFile,
+                           final File aLocalFile,
+                           final boolean recursive) {
         this(false, session, aRemoteFile, aLocalFile, recursive);
     }
 
@@ -107,12 +109,12 @@ public class ScpFromMessage extends AbstractSshMessage {
      * modification times
      * @since Ant 1.8.0
      */
-    public ScpFromMessage(boolean verbose,
-                          Session session,
-                          String aRemoteFile,
-                          File aLocalFile,
-                          boolean recursive,
-                          boolean preserveLastModified) {
+    public ScpFromMessage(final boolean verbose,
+                          final Session session,
+                          final String aRemoteFile,
+                          final File aLocalFile,
+                          final boolean recursive,
+                          final boolean preserveLastModified) {
         super(verbose, session);
         this.remoteFile = aRemoteFile;
         this.localFile = aLocalFile;
@@ -131,11 +133,11 @@ public class ScpFromMessage extends AbstractSshMessage {
             command += "-r ";
         }
         command += remoteFile;
-        Channel channel = openExecChannel(command);
+        final Channel channel = openExecChannel(command);
         try {
             // get I/O streams for remote scp
-            OutputStream out = channel.getOutputStream();
-            InputStream in = channel.getInputStream();
+            final OutputStream out = channel.getOutputStream();
+            final InputStream in = channel.getInputStream();
 
             channel.connect();
 
@@ -153,18 +155,18 @@ public class ScpFromMessage extends AbstractSshMessage {
         return preserveLastModified;
     }
 
-    private void startRemoteCpProtocol(InputStream in,
-                                       OutputStream out,
-                                       File localFile)
+    private void startRemoteCpProtocol(final InputStream in,
+                                       final OutputStream out,
+                                       final File localFile)
         throws IOException, JSchException {
         File startFile = localFile;
         while (true) {
             // C0644 filesize filename - header for a regular file
             // T time 0 time 0\n - present if perserve time.
             // D directory - this is the header for a directory.
-            ByteArrayOutputStream stream = new ByteArrayOutputStream();
+            final ByteArrayOutputStream stream = new ByteArrayOutputStream();
             while (true) {
-                int read = in.read();
+                final int read = in.read();
                 if (read < 0) {
                     return;
                 }
@@ -173,7 +175,7 @@ public class ScpFromMessage extends AbstractSshMessage {
                 }
                 stream.write(read);
             }
-            String serverResponse = stream.toString("UTF-8");
+            final String serverResponse = stream.toString("UTF-8");
             if (serverResponse.charAt(0) == 'C') {
                 parseAndFetchFile(serverResponse, startFile, out, in);
             } else if (serverResponse.charAt(0) == 'D') {
@@ -191,14 +193,14 @@ public class ScpFromMessage extends AbstractSshMessage {
         }
     }
 
-    private File parseAndCreateDirectory(String serverResponse,
-                                         File localFile) {
+    private File parseAndCreateDirectory(final String serverResponse,
+                                         final File localFile) {
         int start = serverResponse.indexOf(" ");
         // appears that the next token is not used and it's zero.
         start = serverResponse.indexOf(" ", start + 1);
-        String directoryName = serverResponse.substring(start + 1);
+        final String directoryName = serverResponse.substring(start + 1);
         if (localFile.isDirectory()) {
-            File dir = new File(localFile, directoryName);
+            final File dir = new File(localFile, directoryName);
             dir.mkdir();
             log("Creating: " + dir);
             return dir;
@@ -206,19 +208,19 @@ public class ScpFromMessage extends AbstractSshMessage {
         return null;
     }
 
-    private void parseAndFetchFile(String serverResponse,
-                                   File localFile,
-                                   OutputStream out,
-                                   InputStream in)
+    private void parseAndFetchFile(final String serverResponse,
+                                   final File localFile,
+                                   final OutputStream out,
+                                   final InputStream in)
         throws IOException, JSchException  {
         int start = 0;
         int end = serverResponse.indexOf(" ", start + 1);
         start = end + 1;
         end = serverResponse.indexOf(" ", start + 1);
-        long filesize = Long.parseLong(serverResponse.substring(start, end));
-        String filename = serverResponse.substring(end + 1);
+        final long filesize = Long.parseLong(serverResponse.substring(start, end));
+        final String filename = serverResponse.substring(end + 1);
         log("Receiving: " + filename + " : " + filesize);
-        File transferFile = (localFile.isDirectory())
+        final File transferFile = (localFile.isDirectory())
                 ? new File(localFile, filename)
                 : localFile;
         fetchFile(transferFile, filesize, out, in);
@@ -226,25 +228,25 @@ public class ScpFromMessage extends AbstractSshMessage {
         sendAck(out);
     }
 
-    private void fetchFile(File localFile,
+    private void fetchFile(final File localFile,
                             long filesize,
-                            OutputStream out,
-                           InputStream in)
+                            final OutputStream out,
+                           final InputStream in)
         throws IOException, JSchException {
-        byte[] buf = new byte[BUFFER_SIZE];
+        final byte[] buf = new byte[BUFFER_SIZE];
         sendAck(out);
 
         // read a content of lfile
-        FileOutputStream fos = new FileOutputStream(localFile);
+        final FileOutputStream fos = new FileOutputStream(localFile);
         int length;
         long totalLength = 0;
-        long startTime = System.currentTimeMillis();
+        final long startTime = System.currentTimeMillis();
 
         // only track progress for files larger than 100kb in verbose mode
-        boolean trackProgress = getVerbose() && filesize > HUNDRED_KILOBYTES;
+        final boolean trackProgress = getVerbose() && filesize > HUNDRED_KILOBYTES;
         // since filesize keeps on decreasing we have to store the
         // initial filesize
-        long initFilesize = filesize;
+        final long initFilesize = filesize;
         int percentTransmitted = 0;
 
         try {
@@ -269,7 +271,7 @@ public class ScpFromMessage extends AbstractSshMessage {
                 }
             }
         } finally {
-            long endTime = System.currentTimeMillis();
+            final long endTime = System.currentTimeMillis();
             logStats(startTime, endTime, totalLength);
             fos.flush();
             fos.close();
@@ -280,14 +282,14 @@ public class ScpFromMessage extends AbstractSshMessage {
         }
     }
 
-    private void setLastModified(File localFile) throws JSchException {
+    private void setLastModified(final File localFile) throws JSchException {
         SftpATTRS fileAttributes = null;
-        ChannelSftp channel = openSftpChannel();
+        final ChannelSftp channel = openSftpChannel();
         channel.connect();
         try {
             fileAttributes = channel.lstat(remoteDir(remoteFile)
                                            + localFile.getName());
-        } catch (SftpException e) {
+        } catch (final SftpException e) {
             throw new JSchException("failed to stat remote file", e);
         }
         FileUtils.getFileUtils().setFileLastModified(localFile,
@@ -299,7 +301,7 @@ public class ScpFromMessage extends AbstractSshMessage {
     /**
      * returns the directory part of the remote file, if any.
      */
-    private static String remoteDir(String remoteFile) {
+    private static String remoteDir(final String remoteFile) {
         int index = remoteFile.lastIndexOf("/");
         if (index < 0) {
             index = remoteFile.lastIndexOf("\\");


Mime
View raw message