commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1416510 - in /commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2: example/ChangeLastModificationTime.java example/Shell.java example/ShowProperties.java libcheck/FtpCheck.java libcheck/SftpCheck.java
Date Mon, 03 Dec 2012 13:40:27 GMT
Author: ggregory
Date: Mon Dec  3 13:40:26 2012
New Revision: 1416510

URL: http://svn.apache.org/viewvc?rev=1416510&view=rev
Log:
Use final where possible.

Modified:
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
    commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java?rev=1416510&r1=1416509&r2=1416510&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
Mon Dec  3 13:40:26 2012
@@ -24,7 +24,7 @@ import org.apache.commons.vfs2.VFS;
  */
 public class ChangeLastModificationTime
 {
-    public static void main(String[] args) throws Exception
+    public static void main(final String[] args) throws Exception
     {
         if (args.length == 0)
         {
@@ -32,8 +32,8 @@ public class ChangeLastModificationTime
             return;
         }
 
-        FileObject fo = VFS.getManager().resolveFile(args[0]);
-        long setTo = System.currentTimeMillis();
+        final FileObject fo = VFS.getManager().resolveFile(args[0]);
+        final long setTo = System.currentTimeMillis();
         System.err.println("set to: " + setTo);
         fo.getContent().setLastModifiedTime(setTo);
         System.err.println("after set: " + fo.getContent().getLastModifiedTime());

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java?rev=1416510&r1=1416509&r2=1416510&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
Mon Dec  3 13:40:26 2012
@@ -41,7 +41,7 @@ public class Shell
     private static final String SVN_ID = "$Id$";
     private final FileSystemManager mgr;
     private FileObject cwd;
-    private BufferedReader reader;
+    private final BufferedReader reader;
 
     public static void main(final String[] args)
     {
@@ -49,7 +49,7 @@ public class Shell
         {
             (new Shell()).go();
         }
-        catch (Exception e)
+        catch (final Exception e)
         {
             e.printStackTrace();
             System.exit(1);
@@ -234,7 +234,7 @@ public class Shell
         }
 
         // Locate and validate the folder
-        FileObject tmp = mgr.resolveFile(cwd, path);
+        final FileObject tmp = mgr.resolveFile(cwd, path);
         if (tmp.exists())
         {
             cwd = tmp;

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java?rev=1416510&r1=1416509&r2=1416510&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
Mon Dec  3 13:40:26 2012
@@ -32,7 +32,7 @@ import org.apache.commons.vfs2.VFS;
 
 public class ShowProperties
 {
-    public static void main(String[] args)
+    public static void main(final String[] args)
     {
         if (args.length == 0)
         {
@@ -40,14 +40,14 @@ public class ShowProperties
             System.err.println("e.g. java org.apache.commons.vfs2.example.ShowProperties
LICENSE.txt");
             return;
         }
-        for (String arg : args)
+        for (final String arg : args)
         {
             try
             {
-                FileSystemManager mgr = VFS.getManager();
+                final FileSystemManager mgr = VFS.getManager();
                 System.out.println();
                 System.out.println("Parsing: " + arg);
-                FileObject file = mgr.resolveFile(arg);
+                final FileObject file = mgr.resolveFile(arg);
                 System.out.println("URL: " + file.getURL());
                 System.out.println("getName(): " + file.getName());
                 System.out.println("BaseName: " + file.getName().getBaseName());
@@ -70,7 +70,7 @@ public class ShowProperties
                     }
                     else if (file.getType().equals(FileType.FOLDER) && file.isReadable())
                     {
-                        FileObject[] children = file.getChildren();
+                        final FileObject[] children = file.getChildren();
                         System.out.println("Directory with " + children.length + " files");
                         for (int iterChildren = 0; iterChildren < children.length; iterChildren++)
                         {
@@ -90,7 +90,7 @@ public class ShowProperties
                 }
                 file.close();
             }
-            catch (FileSystemException ex)
+            catch (final FileSystemException ex)
             {
                 ex.printStackTrace();
             }

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java?rev=1416510&r1=1416509&r2=1416510&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
Mon Dec  3 13:40:26 2012
@@ -27,24 +27,24 @@ import org.apache.commons.net.ftp.FTPRep
  */
 public class FtpCheck
 {
-    public static void main(String[] args) throws Exception
+    public static void main(final String[] args) throws Exception
     {
         if (args.length < 3)
         {
             throw new IllegalArgumentException("Usage: FtpCheck user pass host dir");
         }
-        String user = args[0];
-        String pass = args[1];
-        String host = args[2];
+        final String user = args[0];
+        final String pass = args[1];
+        final String host = args[2];
         String dir = null;
         if (args.length == 4)
         {
             dir = args[3];
         }
 
-        FTPClient client = new FTPClient();
+        final FTPClient client = new FTPClient();
         client.connect(host);
-        int reply = client.getReplyCode();
+        final int reply = client.getReplyCode();
         if (!FTPReply.isPositiveCompletion(reply))
         {
             throw new IllegalArgumentException("cant connect: " + reply);
@@ -55,7 +55,7 @@ public class FtpCheck
         }
         client.enterLocalPassiveMode();
 
-        OutputStream os = client.storeFileStream(dir + "/test.txt");
+        final OutputStream os = client.storeFileStream(dir + "/test.txt");
         if (os == null)
         {
             throw new IllegalStateException(client.getReplyString());
@@ -74,10 +74,10 @@ public class FtpCheck
 
         System.err.println("System: " + client.getSystemType());
 
-        FTPFile[] files = client.listFiles();
+        final FTPFile[] files = client.listFiles();
         for (int i = 0; i < files.length; i++)
         {
-            FTPFile file = files[i];
+            final FTPFile file = files[i];
             if (file == null)
             {
                 System.err.println("#" + i + ": " + null);

Modified: commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java?rev=1416510&r1=1416509&r2=1416510&view=diff
==============================================================================
--- commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java
(original)
+++ commons/proper/vfs/trunk/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java
Mon Dec  3 13:40:26 2012
@@ -30,21 +30,21 @@ import com.jcraft.jsch.UserInfo;
  */
 public class SftpCheck
 {
-    public static void main(String[] args) throws Exception
+    public static void main(final String[] args) throws Exception
     {
         if (args.length != 4)
         {
             throw new IllegalArgumentException("Usage: SftpCheck user pass host dir");
         }
-        String user = args[0];
-        String pass = args[1];
-        String host = args[2];
-        String dir = args[3];
+        final String user = args[0];
+        final String pass = args[1];
+        final String host = args[2];
+        final String dir = args[3];
 
-        Properties props = new Properties();
+        final Properties props = new Properties();
         props.setProperty("StrictHostKeyChecking", "false");
-        JSch jsch = new JSch();
-        Session session = jsch.getSession(user, host, 22);
+        final JSch jsch = new JSch();
+        final Session session = jsch.getSession(user, host, 22);
         session.setUserInfo(new UserInfo()
         {
             public String getPassphrase()
@@ -57,31 +57,31 @@ public class SftpCheck
                 return null;
             }
 
-            public boolean promptPassword(String string)
+            public boolean promptPassword(final String string)
             {
                 return false;
             }
 
-            public boolean promptPassphrase(String string)
+            public boolean promptPassphrase(final String string)
             {
                 return false;
             }
 
-            public boolean promptYesNo(String string)
+            public boolean promptYesNo(final String string)
             {
                 return true;
             }
 
-            public void showMessage(String string)
+            public void showMessage(final String string)
             {
             }
         });
         session.setPassword(pass);
         session.connect();
-        ChannelSftp chan = (ChannelSftp) session.openChannel("sftp");
+        final ChannelSftp chan = (ChannelSftp) session.openChannel("sftp");
         chan.connect();
-        Vector<?> list = chan.ls(dir);
-        Iterator<?> iterList = list.iterator();
+        final Vector<?> list = chan.ls(dir);
+        final Iterator<?> iterList = list.iterator();
         while (iterList.hasNext())
         {
             System.err.println(iterList.next());



Mime
View raw message