You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2008/08/17 21:52:49 UTC

svn commit: r686637 [10/16] - in /mina/ftpserver/trunk: core/src/main/java/org/apache/ftpserver/ core/src/main/java/org/apache/ftpserver/command/ core/src/main/java/org/apache/ftpserver/config/spring/ core/src/main/java/org/apache/ftpserver/filesystem/...

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/PropertiesUserManager.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/PropertiesUserManager.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/PropertiesUserManager.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/PropertiesUserManager.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.usermanager;
 
@@ -41,61 +41,69 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
- * Properties file based <code>UserManager</code> implementation. 
- * We use <code>user.properties</code> file to store user data.
+ * Properties file based <code>UserManager</code> implementation. We use
+ * <code>user.properties</code> file to store user data.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public
-class PropertiesUserManager extends AbstractUserManager {
+public class PropertiesUserManager extends AbstractUserManager {
+
+    private final Logger LOG = LoggerFactory
+            .getLogger(PropertiesUserManager.class);
 
-    private final Logger LOG = LoggerFactory.getLogger(PropertiesUserManager.class);
-    
-    private final static String DEPRECATED_PREFIX    = "FtpServer.user.";
-    private final static String PREFIX    = "ftpserver.user.";
+    private final static String DEPRECATED_PREFIX = "FtpServer.user.";
+
+    private final static String PREFIX = "ftpserver.user.";
 
     private BaseProperties userDataProp;
-    private File           userDataFile = new File("./res/user.gen");
-    private boolean        isPasswordEncrypt = true;
 
+    private File userDataFile = new File("./res/user.gen");
+
+    private boolean isPasswordEncrypt = true;
+
+    private boolean isConfigured = false;
 
-    private boolean isConfigured = false; 
-    
     /**
-     * Set the file used to store and read users. Must be set before 
+     * Set the file used to store and read users. Must be set before
      * {@link #configure()} is called.
-     * @param propFile A file containing users
+     * 
+     * @param propFile
+     *            A file containing users
      */
     public void setPropFile(File propFile) {
-        if(isConfigured) {
+        if (isConfigured) {
             throw new IllegalStateException("Must be called before configure()");
         }
-        
-        this.userDataFile = propFile; 
+
+        this.userDataFile = propFile;
     }
-  
+
     /**
-     * If true is returned, passwords will be stored as hashes rather 
-     * than in clear text. Default is true.
+     * If true is returned, passwords will be stored as hashes rather than in
+     * clear text. Default is true.
+     * 
      * @return True if passwords are stored as hashes.
      */
     public boolean isEncryptPassword() {
         return isPasswordEncrypt;
     }
-    
+
     /**
-     * If set to true, passwords will be stored as a 
-     * hash to ensure that it can not be retrived from the
-     * user file.
-     * Must be set before {@link #configure()} is called.
-     * @param encryptPassword True to store a hash of the passwords,
-     *      false to store the passwords in clear text.
+     * If set to true, passwords will be stored as a hash to ensure that it can
+     * not be retrived from the user file. Must be set before
+     * {@link #configure()} is called.
+     * 
+     * @param encryptPassword
+     *            True to store a hash of the passwords, false to store the
+     *            passwords in clear text.
      */
     public void setEncryptPasswords(boolean encryptPassword) {
-        if(isConfigured) {
+        if (isConfigured) {
             throw new IllegalStateException("Must be called before configure()");
         }
-        
+
         this.isPasswordEncrypt = encryptPassword;
     }
 
@@ -105,25 +113,25 @@
     public void setPropPasswordEncrypt(boolean encryptPassword) {
         setEncryptPasswords(encryptPassword);
     }
-    
+
     /**
      * Lazy init the user manager
      */
     private void lazyInit() {
-        if(!isConfigured) {
+        if (!isConfigured) {
             configure();
         }
     }
-    
+
     /**
      * Configure user manager.
      */
     public void configure() {
-        isConfigured  = true;
+        isConfigured = true;
         try {
             userDataProp = new BaseProperties();
-            
-            if(userDataFile != null && userDataFile.exists()) {
+
+            if (userDataFile != null && userDataFile.exists()) {
                 FileInputStream fis = null;
                 try {
                     fis = new FileInputStream(userDataFile);
@@ -133,91 +141,99 @@
                 }
             }
         } catch (IOException e) {
-            throw new FtpServerConfigurationException("Error loading user data file : " + userDataFile.getAbsolutePath(), e);
+            throw new FtpServerConfigurationException(
+                    "Error loading user data file : "
+                            + userDataFile.getAbsolutePath(), e);
         }
-        
+
         convertDeprecatedPropertyNames();
     }
-    
+
     private void convertDeprecatedPropertyNames() {
         Enumeration<?> keys = userDataProp.propertyNames();
-        
+
         boolean doSave = false;
-        
+
         while (keys.hasMoreElements()) {
             String key = (String) keys.nextElement();
-            
-            if(key.startsWith(DEPRECATED_PREFIX)) {
-                String newKey = PREFIX + key.substring(DEPRECATED_PREFIX.length());
+
+            if (key.startsWith(DEPRECATED_PREFIX)) {
+                String newKey = PREFIX
+                        + key.substring(DEPRECATED_PREFIX.length());
                 userDataProp.setProperty(newKey, userDataProp.getProperty(key));
                 userDataProp.remove(key);
-                
+
                 doSave = true;
             }
         }
-        
-        if(doSave) {
+
+        if (doSave) {
             try {
                 saveUserData();
             } catch (FtpException e) {
-                throw new FtpServerConfigurationException("Failed to save updated user data", e);
+                throw new FtpServerConfigurationException(
+                        "Failed to save updated user data", e);
             }
         }
     }
 
-    
     /**
      * Save user data. Store the properties.
      */
     public synchronized void save(User usr) throws FtpException {
         lazyInit();
-        
-       // null value check
-       if(usr.getName() == null) {
-           throw new NullPointerException("User name is null.");
-       }
-       String thisPrefix = PREFIX + usr.getName() + '.';
-       
-       // set other properties
-       userDataProp.setProperty(thisPrefix + ATTR_PASSWORD,          getPassword(usr));
-       
-       String home = usr.getHomeDirectory();
-       if(home == null) {
-           home = "/";
-       }
-       userDataProp.setProperty(thisPrefix + ATTR_HOME,              home);
-       userDataProp.setProperty(thisPrefix + ATTR_ENABLE,            usr.getEnabled());
-       userDataProp.setProperty(thisPrefix + ATTR_WRITE_PERM,        usr.authorize(new WriteRequest()) != null);
-       userDataProp.setProperty(thisPrefix + ATTR_MAX_IDLE_TIME,     usr.getMaxIdleTime());
-       
-       TransferRateRequest transferRateRequest = new TransferRateRequest();
-       transferRateRequest = (TransferRateRequest) usr.authorize(transferRateRequest);
-       
-       if(transferRateRequest != null) {
-           userDataProp.setProperty(thisPrefix + ATTR_MAX_UPLOAD_RATE,   
-                   transferRateRequest.getMaxUploadRate());
-           userDataProp.setProperty(thisPrefix + ATTR_MAX_DOWNLOAD_RATE, 
-                   transferRateRequest.getMaxDownloadRate());
-       } else {
-           userDataProp.remove(thisPrefix + ATTR_MAX_UPLOAD_RATE);
-           userDataProp.remove(thisPrefix + ATTR_MAX_DOWNLOAD_RATE);       
-       }
-       
-       // request that always will succeed
-       ConcurrentLoginRequest concurrentLoginRequest = new ConcurrentLoginRequest(0, 0);
-       concurrentLoginRequest = (ConcurrentLoginRequest) usr.authorize(concurrentLoginRequest);
-       
-       if(concurrentLoginRequest != null) {
-           userDataProp.setProperty(thisPrefix + ATTR_MAX_LOGIN_NUMBER, 
-                   concurrentLoginRequest.getMaxConcurrentLogins());
-           userDataProp.setProperty(thisPrefix + ATTR_MAX_LOGIN_PER_IP, 
-                   concurrentLoginRequest.getMaxConcurrentLoginsPerIP());
-       } else {
-           userDataProp.remove(thisPrefix + ATTR_MAX_LOGIN_NUMBER);
-           userDataProp.remove(thisPrefix + ATTR_MAX_LOGIN_PER_IP);   
-       }
-       
-       saveUserData();
+
+        // null value check
+        if (usr.getName() == null) {
+            throw new NullPointerException("User name is null.");
+        }
+        String thisPrefix = PREFIX + usr.getName() + '.';
+
+        // set other properties
+        userDataProp.setProperty(thisPrefix + ATTR_PASSWORD, getPassword(usr));
+
+        String home = usr.getHomeDirectory();
+        if (home == null) {
+            home = "/";
+        }
+        userDataProp.setProperty(thisPrefix + ATTR_HOME, home);
+        userDataProp.setProperty(thisPrefix + ATTR_ENABLE, usr.getEnabled());
+        userDataProp.setProperty(thisPrefix + ATTR_WRITE_PERM, usr
+                .authorize(new WriteRequest()) != null);
+        userDataProp.setProperty(thisPrefix + ATTR_MAX_IDLE_TIME, usr
+                .getMaxIdleTime());
+
+        TransferRateRequest transferRateRequest = new TransferRateRequest();
+        transferRateRequest = (TransferRateRequest) usr
+                .authorize(transferRateRequest);
+
+        if (transferRateRequest != null) {
+            userDataProp.setProperty(thisPrefix + ATTR_MAX_UPLOAD_RATE,
+                    transferRateRequest.getMaxUploadRate());
+            userDataProp.setProperty(thisPrefix + ATTR_MAX_DOWNLOAD_RATE,
+                    transferRateRequest.getMaxDownloadRate());
+        } else {
+            userDataProp.remove(thisPrefix + ATTR_MAX_UPLOAD_RATE);
+            userDataProp.remove(thisPrefix + ATTR_MAX_DOWNLOAD_RATE);
+        }
+
+        // request that always will succeed
+        ConcurrentLoginRequest concurrentLoginRequest = new ConcurrentLoginRequest(
+                0, 0);
+        concurrentLoginRequest = (ConcurrentLoginRequest) usr
+                .authorize(concurrentLoginRequest);
+
+        if (concurrentLoginRequest != null) {
+            userDataProp.setProperty(thisPrefix + ATTR_MAX_LOGIN_NUMBER,
+                    concurrentLoginRequest.getMaxConcurrentLogins());
+            userDataProp.setProperty(thisPrefix + ATTR_MAX_LOGIN_PER_IP,
+                    concurrentLoginRequest.getMaxConcurrentLoginsPerIP());
+        } else {
+            userDataProp.remove(thisPrefix + ATTR_MAX_LOGIN_NUMBER);
+            userDataProp.remove(thisPrefix + ATTR_MAX_LOGIN_PER_IP);
+        }
+
+        saveUserData();
     }
 
     /**
@@ -225,11 +241,12 @@
      */
     private void saveUserData() throws FtpException {
         File dir = userDataFile.getAbsoluteFile().getParentFile();
-        if(dir != null && !dir.exists() && !dir.mkdirs() ) {
+        if (dir != null && !dir.exists() && !dir.mkdirs()) {
             String dirName = dir.getAbsolutePath();
-            throw new FtpServerConfigurationException("Cannot create directory for user data file : " + dirName);
+            throw new FtpServerConfigurationException(
+                    "Cannot create directory for user data file : " + dirName);
         }
-        
+
         // save user data
         FileOutputStream fos = null;
         try {
@@ -242,21 +259,21 @@
             IoUtils.close(fos);
         }
     }
-     
+
     /**
-     * Delete an user. Removes all this user entries from the properties.
-     * After removing the corresponding from the properties, save the data.
+     * Delete an user. Removes all this user entries from the properties. After
+     * removing the corresponding from the properties, save the data.
      */
     public synchronized void delete(String usrName) throws FtpException {
         lazyInit();
-        
+
         // remove entries from properties
         String thisPrefix = PREFIX + usrName + '.';
         Enumeration<?> propNames = userDataProp.propertyNames();
         ArrayList<String> remKeys = new ArrayList<String>();
-        while(propNames.hasMoreElements()) {
+        while (propNames.hasMoreElements()) {
             String thisKey = propNames.nextElement().toString();
-            if(thisKey.startsWith(thisPrefix)) {
+            if (thisKey.startsWith(thisPrefix)) {
                 remKeys.add(thisKey);
             }
         }
@@ -264,12 +281,13 @@
         while (remKeysIt.hasNext()) {
             userDataProp.remove(remKeysIt.next());
         }
-        
+
         saveUserData();
     }
-    
+
     /**
      * Get user password. Returns the encrypted value.
+     * 
      * <pre>
      * If the password value is not null
      *    password = new password 
@@ -277,57 +295,55 @@
      *   if user does exist
      *     password = old password
      *   else 
-     *     password = ""
+     *     password = &quot;&quot;
      * </pre>
      */
     private String getPassword(User usr) {
         String name = usr.getName();
         String password = usr.getPassword();
-        
-        if(password != null) {
+
+        if (password != null) {
             if (isPasswordEncrypt) {
                 password = EncryptUtils.encryptMD5(password);
             }
-        }
-        else {
+        } else {
             String blankPassword = "";
-            if(isPasswordEncrypt) {
+            if (isPasswordEncrypt) {
                 blankPassword = EncryptUtils.encryptMD5("");
             }
-            
-            if( doesExist(name) ) {
+
+            if (doesExist(name)) {
                 String key = PREFIX + name + '.' + ATTR_PASSWORD;
                 password = userDataProp.getProperty(key, blankPassword);
-            }
-            else {
+            } else {
                 password = blankPassword;
             }
         }
         return password;
-    } 
-    
+    }
+
     /**
      * Get all user names.
      */
     public synchronized String[] getAllUserNames() {
         lazyInit();
-        
+
         // get all user names
         String suffix = '.' + ATTR_HOME;
         ArrayList<String> ulst = new ArrayList<String>();
         Enumeration<?> allKeys = userDataProp.propertyNames();
         int prefixlen = PREFIX.length();
         int suffixlen = suffix.length();
-        while(allKeys.hasMoreElements()) {
-            String key = (String)allKeys.nextElement();
-            if(key.endsWith(suffix)) {
+        while (allKeys.hasMoreElements()) {
+            String key = (String) allKeys.nextElement();
+            if (key.endsWith(suffix)) {
                 String name = key.substring(prefixlen);
                 int endIndex = name.length() - suffixlen;
                 name = name.substring(0, endIndex);
                 ulst.add(name);
             }
         }
-        
+
         Collections.sort(ulst);
         return ulst.toArray(new String[0]);
     }
@@ -337,91 +353,100 @@
      */
     public synchronized User getUserByName(String userName) {
         lazyInit();
-        
+
         if (!doesExist(userName)) {
             return null;
         }
-        
+
         String baseKey = PREFIX + userName + '.';
         BaseUser user = new BaseUser();
         user.setName(userName);
         user.setEnabled(userDataProp.getBoolean(baseKey + ATTR_ENABLE, true));
-        user.setHomeDirectory( userDataProp.getProperty(baseKey + ATTR_HOME, "/") );
-        
+        user.setHomeDirectory(userDataProp
+                .getProperty(baseKey + ATTR_HOME, "/"));
+
         List<Authority> authorities = new ArrayList<Authority>();
-        
-        if(userDataProp.getBoolean(baseKey + ATTR_WRITE_PERM, false)) {
+
+        if (userDataProp.getBoolean(baseKey + ATTR_WRITE_PERM, false)) {
             authorities.add(new WritePermission());
         }
-        
-        int maxLogin = userDataProp.getInteger(baseKey + ATTR_MAX_LOGIN_NUMBER, 0);
-        int maxLoginPerIP = userDataProp.getInteger(baseKey + ATTR_MAX_LOGIN_PER_IP, 0);
-        
+
+        int maxLogin = userDataProp.getInteger(baseKey + ATTR_MAX_LOGIN_NUMBER,
+                0);
+        int maxLoginPerIP = userDataProp.getInteger(baseKey
+                + ATTR_MAX_LOGIN_PER_IP, 0);
+
         authorities.add(new ConcurrentLoginPermission(maxLogin, maxLoginPerIP));
 
-        int uploadRate = userDataProp.getInteger(baseKey + ATTR_MAX_UPLOAD_RATE, 0);
-        int downloadRate = userDataProp.getInteger(baseKey + ATTR_MAX_DOWNLOAD_RATE, 0);
-        
+        int uploadRate = userDataProp.getInteger(
+                baseKey + ATTR_MAX_UPLOAD_RATE, 0);
+        int downloadRate = userDataProp.getInteger(baseKey
+                + ATTR_MAX_DOWNLOAD_RATE, 0);
+
         authorities.add(new TransferRatePermission(downloadRate, uploadRate));
-        
+
         user.setAuthorities(authorities.toArray(new Authority[0]));
-        
-        user.setMaxIdleTime(userDataProp.getInteger(baseKey + ATTR_MAX_IDLE_TIME, 0));
+
+        user.setMaxIdleTime(userDataProp.getInteger(baseKey
+                + ATTR_MAX_IDLE_TIME, 0));
 
         return user;
     }
-    
+
     /**
      * User existance check
      */
     public synchronized boolean doesExist(String name) {
         lazyInit();
-        
+
         String key = PREFIX + name + '.' + ATTR_HOME;
         return userDataProp.containsKey(key);
     }
-    
+
     /**
      * User authenticate method
      */
-    public synchronized User authenticate(Authentication authentication) throws AuthenticationFailedException {
+    public synchronized User authenticate(Authentication authentication)
+            throws AuthenticationFailedException {
         lazyInit();
-        
-        if(authentication instanceof UsernamePasswordAuthentication) {
+
+        if (authentication instanceof UsernamePasswordAuthentication) {
             UsernamePasswordAuthentication upauth = (UsernamePasswordAuthentication) authentication;
-            
-            String user = upauth.getUsername(); 
-            String password = upauth.getPassword(); 
-        
-            if(user == null) {
+
+            String user = upauth.getUsername();
+            String password = upauth.getPassword();
+
+            if (user == null) {
                 throw new AuthenticationFailedException("Authentication failed");
             }
-            
-            if(password == null) {
+
+            if (password == null) {
                 password = "";
             }
-            
-            String passVal = userDataProp.getProperty(PREFIX + user + '.' + ATTR_PASSWORD);
+
+            String passVal = userDataProp.getProperty(PREFIX + user + '.'
+                    + ATTR_PASSWORD);
             if (isPasswordEncrypt) {
                 password = EncryptUtils.encryptMD5(password);
             }
-            if(password.equals(passVal)) {
+            if (password.equals(passVal)) {
                 return getUserByName(user);
             } else {
                 throw new AuthenticationFailedException("Authentication failed");
             }
-            
-        } else if(authentication instanceof AnonymousAuthentication) {
-            if(doesExist("anonymous")) {
+
+        } else if (authentication instanceof AnonymousAuthentication) {
+            if (doesExist("anonymous")) {
                 return getUserByName("anonymous");
             } else {
                 throw new AuthenticationFailedException("Authentication failed");
             }
         } else {
-            throw new IllegalArgumentException("Authentication not supported by this user manager");
+            throw new IllegalArgumentException(
+                    "Authentication not supported by this user manager");
         }
     }
-        
+
     /**
      * Close the user manager - remove existing entries.
      */
@@ -432,4 +457,3 @@
         }
     }
 }
-

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRatePermission.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRatePermission.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRatePermission.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRatePermission.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.usermanager;
 
@@ -24,27 +24,31 @@
 
 /**
  * The max upload rate permission
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class TransferRatePermission implements Authority {
 
     private int maxDownloadRate;
+
     private int maxUploadRate;
 
     public TransferRatePermission(int maxDownloadRate, int maxUploadRate) {
         this.maxDownloadRate = maxDownloadRate;
         this.maxUploadRate = maxUploadRate;
     }
-    
+
     /**
      * @see Authority#authorize(AuthorizationRequest)
      */
     public AuthorizationRequest authorize(AuthorizationRequest request) {
         if (request instanceof TransferRateRequest) {
             TransferRateRequest transferRateRequest = (TransferRateRequest) request;
-            
+
             transferRateRequest.setMaxDownloadRate(maxDownloadRate);
             transferRateRequest.setMaxUploadRate(maxUploadRate);
-            
+
             return transferRateRequest;
         } else {
             return null;

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRateRequest.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRateRequest.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRateRequest.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/TransferRateRequest.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.usermanager;
 
@@ -23,36 +23,44 @@
 
 /**
  * Request for getting the maximum allowed transfer rates for a user
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class TransferRateRequest implements AuthorizationRequest {
 
     private int maxDownloadRate = 0;
+
     private int maxUploadRate = 0;
-    
+
     /**
      * @return the maxDownloadRate
      */
     public int getMaxDownloadRate() {
         return maxDownloadRate;
     }
+
     /**
-     * @param maxDownloadRate the maxDownloadRate to set
+     * @param maxDownloadRate
+     *            the maxDownloadRate to set
      */
     public void setMaxDownloadRate(int maxDownloadRate) {
         this.maxDownloadRate = maxDownloadRate;
     }
+
     /**
      * @return the maxUploadRate
      */
     public int getMaxUploadRate() {
         return maxUploadRate;
     }
+
     /**
-     * @param maxUploadRate the maxUploadRate to set
+     * @param maxUploadRate
+     *            the maxUploadRate to set
      */
     public void setMaxUploadRate(int maxUploadRate) {
         this.maxUploadRate = maxUploadRate;
     }
-    
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UserMetadata.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UserMetadata.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UserMetadata.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UserMetadata.java Sun Aug 17 12:52:42 2008
@@ -24,6 +24,9 @@
 
 /**
  * User metadata used during authentication
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class UserMetadata {
 
@@ -33,11 +36,12 @@
 
     /**
      * Retrive the certificate chain used for an SSL connection.
-     * @return The certificate chain, can be null if no peer certificate
-     *   is available (e.g. SSL not used)
+     * 
+     * @return The certificate chain, can be null if no peer certificate is
+     *         available (e.g. SSL not used)
      */
     public Certificate[] getCertificateChain() {
-        if(certificateChain != null) {
+        if (certificateChain != null) {
             return certificateChain.clone();
         } else {
             return null;
@@ -46,11 +50,12 @@
 
     /**
      * Set the certificate chain
+     * 
      * @param certificateChain
      *            The certificate chain to set
      */
     public void setCertificateChain(final Certificate[] certificateChain) {
-        if(certificateChain != null) {
+        if (certificateChain != null) {
             this.certificateChain = certificateChain.clone();
         } else {
             this.certificateChain = null;
@@ -59,6 +64,7 @@
 
     /**
      * Retrive the remote IP adress of the client
+     * 
      * @return The client IP adress
      */
     public InetAddress getInetAddress() {
@@ -67,6 +73,7 @@
 
     /**
      * Set the remote IP adress of the client
+     * 
      * @param inetAddress
      *            The client IP adress
      */

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UsernamePasswordAuthentication.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UsernamePasswordAuthentication.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UsernamePasswordAuthentication.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/UsernamePasswordAuthentication.java Sun Aug 17 12:52:42 2008
@@ -15,46 +15,60 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.usermanager;
 
 import org.apache.ftpserver.ftplet.Authentication;
 
 /**
- * Class representing a normal authentication attempt using
- * username and password
+ * Class representing a normal authentication attempt using username and
+ * password
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public
-class UsernamePasswordAuthentication implements Authentication {
+public class UsernamePasswordAuthentication implements Authentication {
 
     private String username;
+
     private String password;
+
     private UserMetadata userMetadata;
-    
+
     /**
      * Constructor with the minimal data for an authentication
-     * @param username The user name
-     * @param password The password, can be null
+     * 
+     * @param username
+     *            The user name
+     * @param password
+     *            The password, can be null
      */
-    public UsernamePasswordAuthentication(final String username, final String password) {
+    public UsernamePasswordAuthentication(final String username,
+            final String password) {
         this.username = username;
         this.password = password;
     }
-    
+
     /**
      * Constructor with an additonal parameter for user metadata
-     * @param username The user name
-     * @param password The password, can be null
-     * @param userMetadata The user metadata
+     * 
+     * @param username
+     *            The user name
+     * @param password
+     *            The password, can be null
+     * @param userMetadata
+     *            The user metadata
      */
-    public UsernamePasswordAuthentication(final String username, final String password, final UserMetadata userMetadata) {
+    public UsernamePasswordAuthentication(final String username,
+            final String password, final UserMetadata userMetadata) {
         this(username, password);
         this.userMetadata = userMetadata;
     }
 
     /**
      * Retrive the password
+     * 
      * @return The password
      */
     public String getPassword() {
@@ -63,6 +77,7 @@
 
     /**
      * Retrive the user name
+     * 
      * @return The user name
      */
     public String getUsername() {
@@ -71,6 +86,7 @@
 
     /**
      * Retrive the user metadata
+     * 
      * @return The user metadata
      */
     public UserMetadata getUserMetadata() {

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WritePermission.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WritePermission.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WritePermission.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WritePermission.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.usermanager;
 
@@ -24,6 +24,9 @@
 
 /**
  * Class representing a write permission
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class WritePermission implements Authority {
 
@@ -37,23 +40,26 @@
     }
 
     /**
-     * Construct a write permission for a file or directory relative to the user home directory
-     * @param permissionRoot The file or directory
+     * Construct a write permission for a file or directory relative to the user
+     * home directory
+     * 
+     * @param permissionRoot
+     *            The file or directory
      */
     public WritePermission(final String permissionRoot) {
         this.permissionRoot = permissionRoot;
     }
-    
+
     /**
      * @see Authority#authorize(AuthorizationRequest)
      */
     public AuthorizationRequest authorize(final AuthorizationRequest request) {
-        if(request instanceof WriteRequest) {
+        if (request instanceof WriteRequest) {
             WriteRequest writeRequest = (WriteRequest) request;
-            
+
             String requestFile = writeRequest.getFile();
 
-            if(requestFile.startsWith(permissionRoot)) {
+            if (requestFile.startsWith(permissionRoot)) {
                 return writeRequest;
             } else {
                 return null;
@@ -69,7 +75,5 @@
     public boolean canAuthorize(final AuthorizationRequest request) {
         return request instanceof WriteRequest;
     }
-   
 
-    
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WriteRequest.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WriteRequest.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WriteRequest.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/WriteRequest.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.usermanager;
 
@@ -23,21 +23,26 @@
 
 /**
  * Class representing a write request
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class WriteRequest implements AuthorizationRequest {
-   
+
     private String file;
-    
+
     /**
      * Request write access to the user home directory (/)
-     *
+     * 
      */
     public WriteRequest() {
         this("/");
     }
-    
+
     /**
-     * Request write access to a file or directory relative to the user home directory
+     * Request write access to a file or directory relative to the user home
+     * directory
+     * 
      * @param file
      */
     public WriteRequest(final String file) {
@@ -46,12 +51,11 @@
 
     /**
      * Get the file or directory to which write access is requested
+     * 
      * @return the file The file or directory
      */
     public String getFile() {
         return file;
     }
-    
-    
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/BaseProperties.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/BaseProperties.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/BaseProperties.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/BaseProperties.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
@@ -32,30 +32,32 @@
 import org.apache.ftpserver.ftplet.FtpException;
 
 /**
- * This class encapsulates <code>java.util.Properties</code> to
- * add java primitives and some other java classes.
+ * This class encapsulates <code>java.util.Properties</code> to add java
+ * primitives and some other java classes.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public
-class BaseProperties extends Properties {
-    
+public class BaseProperties extends Properties {
+
     private static final long serialVersionUID = 5572645129592131953L;
 
     /**
      * Default constructor.
      */
-    public BaseProperties()  {
+    public BaseProperties() {
     }
-    
+
     /**
      * Load existing property.
      */
-    public BaseProperties(final Properties prop)  {
+    public BaseProperties(final Properties prop) {
         super(prop);
     }
-    
-    //////////////////////////////////////////
-    ////////  Properties Get Methods  ////////
-    //////////////////////////////////////////
+
+    // ////////////////////////////////////////
+    // ////// Properties Get Methods ////////
+    // ////////////////////////////////////////
     /**
      * Get boolean value.
      */
@@ -68,7 +70,7 @@
         return prop.toLowerCase().equals("true");
     }
 
-    public boolean getBoolean(final String str, final boolean bol)  {
+    public boolean getBoolean(final String str, final boolean bol) {
         try {
             return getBoolean(str);
         } catch (FtpException ex) {
@@ -76,11 +78,10 @@
         }
     }
 
-
     /**
      * Get integer value.
      */
-    public int getInteger(final String str) throws FtpException  {
+    public int getInteger(final String str) throws FtpException {
         String value = getProperty(str);
         if (value == null) {
             throw new FtpException(str + " not found");
@@ -88,17 +89,15 @@
 
         try {
             return Integer.parseInt(value);
-        } 
-        catch (NumberFormatException ex) {
+        } catch (NumberFormatException ex) {
             throw new FtpException("BaseProperties.getInteger()", ex);
         }
     }
 
-    public int getInteger(final String str, final int intVal)  {
+    public int getInteger(final String str, final int intVal) {
         try {
             return getInteger(str);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return intVal;
         }
     }
@@ -114,91 +113,83 @@
 
         try {
             return Long.parseLong(value);
-        } 
-        catch (NumberFormatException ex) {
+        } catch (NumberFormatException ex) {
             throw new FtpException("BaseProperties.getLong()", ex);
         }
     }
 
-    public long getLong(final String str, final long val)  {
+    public long getLong(final String str, final long val) {
         try {
             return getLong(str);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return val;
         }
     }
 
-
     /**
      * Get double value.
      */
-    public double getDouble(final String str) throws FtpException  {
+    public double getDouble(final String str) throws FtpException {
         String value = getProperty(str);
         if (value == null) {
             throw new FtpException(str + " not found");
         }
 
         try {
-            return Double.parseDouble(value); 
-        } 
-        catch (NumberFormatException ex) {
+            return Double.parseDouble(value);
+        } catch (NumberFormatException ex) {
             throw new FtpException("BaseProperties.getDouble()", ex);
         }
     }
 
-    public double getDouble(final String str, final double doubleVal)  {
+    public double getDouble(final String str, final double doubleVal) {
         try {
             return getDouble(str);
-        } 
-        catch (FtpException ex) {
-            return doubleVal; 
+        } catch (FtpException ex) {
+            return doubleVal;
         }
-    } 
-    
+    }
+
     /**
      * Get <code>InetAddress</code>.
      */
     public InetAddress getInetAddress(final String str) throws FtpException {
         String value = getProperty(str);
-        if(value == null) {
+        if (value == null) {
             throw new FtpException(str + " not found");
         }
-        
+
         try {
             return InetAddress.getByName(value);
-        }
-        catch(UnknownHostException ex) {
+        } catch (UnknownHostException ex) {
             throw new FtpException("Host " + value + " not found");
         }
     }
-    
+
     public InetAddress getInetAddress(final String str, final InetAddress addr) {
         try {
             return getInetAddress(str);
-        }
-        catch(FtpException ex) {
+        } catch (FtpException ex) {
             return addr;
         }
     }
-    
+
     /**
      * Get <code>String</code>.
      */
     public String getString(final String str) throws FtpException {
         String value = getProperty(str);
-        if(value == null) {
+        if (value == null) {
             throw new FtpException(str + " not found");
         }
-        
+
         return value;
     }
-    
+
     public String getString(final String str, final String s) {
         try {
             return getString(str);
-        }
-        catch(FtpException ex) {
+        } catch (FtpException ex) {
             return s;
         }
     }
@@ -206,7 +197,7 @@
     /**
      * Get <code>File</code> object.
      */
-    public File getFile(final String str) throws FtpException  {
+    public File getFile(final String str) throws FtpException {
         String value = getProperty(str);
         if (value == null) {
             throw new FtpException(str + " not found");
@@ -214,20 +205,18 @@
         return new File(value);
     }
 
-    public File getFile(final String str, final File fl)  {
+    public File getFile(final String str, final File fl) {
         try {
             return getFile(str);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return fl;
         }
     }
 
-
     /**
      * Get <code>Class</code> object
      */
-    public Class<?> getClass(final String str) throws FtpException  {
+    public Class<?> getClass(final String str) throws FtpException {
         String value = getProperty(str);
         if (value == null) {
             throw new FtpException(str + " not found");
@@ -235,25 +224,23 @@
 
         try {
             return Class.forName(value);
-        } 
-        catch (ClassNotFoundException ex) {
+        } catch (ClassNotFoundException ex) {
             throw new FtpException("BaseProperties.getClass()", ex);
         }
     }
 
-    public Class<?> getClass(final String str, final Class<?> cls)  {
+    public Class<?> getClass(final String str, final Class<?> cls) {
         try {
             return getClass(str);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return cls;
         }
-    } 
+    }
 
     /**
      * Get <code>TimeZone</code>
      */
-    public TimeZone getTimeZone(final String str) throws FtpException  {
+    public TimeZone getTimeZone(final String str) throws FtpException {
         String value = getProperty(str);
         if (value == null) {
             throw new FtpException(str + " not found");
@@ -261,11 +248,10 @@
         return TimeZone.getTimeZone(value);
     }
 
-    public TimeZone getTimeZone(final String str, final TimeZone tz)  {
+    public TimeZone getTimeZone(final String str, final TimeZone tz) {
         try {
             return getTimeZone(str);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return tz;
         }
     }
@@ -273,32 +259,32 @@
     /**
      * Get <code>DateFormat</code> object.
      */
-    public SimpleDateFormat getDateFormat(final String str) throws FtpException  {
+    public SimpleDateFormat getDateFormat(final String str) throws FtpException {
         String value = getProperty(str);
         if (value == null) {
-            throw new FtpException(str +  " not found");
+            throw new FtpException(str + " not found");
         }
         try {
-        return new SimpleDateFormat(value);
-        } catch(IllegalArgumentException e) {
+            return new SimpleDateFormat(value);
+        } catch (IllegalArgumentException e) {
             throw new FtpException("Date format was incorrect: " + value, e);
         }
     }
 
-    public SimpleDateFormat getDateFormat(final String str, final SimpleDateFormat fmt)  {
+    public SimpleDateFormat getDateFormat(final String str,
+            final SimpleDateFormat fmt) {
         try {
             return getDateFormat(str);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return fmt;
         }
     }
 
-
     /**
      * Get <code>Date</code> object.
      */
-    public Date getDate(final String str, final DateFormat fmt) throws FtpException  {
+    public Date getDate(final String str, final DateFormat fmt)
+            throws FtpException {
         String value = getProperty(str);
         if (value == null) {
             throw new FtpException(str + " not found");
@@ -306,72 +292,68 @@
 
         try {
             return fmt.parse(value);
-        } 
-        catch (ParseException ex) {
+        } catch (ParseException ex) {
             throw new FtpException("BaseProperties.getdate()", ex);
         }
     }
 
-    public Date getDate(final String str, final DateFormat fmt, final Date dt)  {
+    public Date getDate(final String str, final DateFormat fmt, final Date dt) {
         try {
             return getDate(str, fmt);
-        } 
-        catch (FtpException ex) {
+        } catch (FtpException ex) {
             return dt;
         }
     }
 
-
-    //////////////////////////////////////////
-    ////////  Properties Set Methods  ////////
-    //////////////////////////////////////////
+    // ////////////////////////////////////////
+    // ////// Properties Set Methods ////////
+    // ////////////////////////////////////////
     /**
      * Set boolean value.
      */
-    public void setProperty(final String key, final boolean val)  {
+    public void setProperty(final String key, final boolean val) {
         setProperty(key, String.valueOf(val));
     }
 
     /**
      * Set integer value.
      */
-    public void setProperty(final String key, final int val)  {
+    public void setProperty(final String key, final int val) {
         setProperty(key, String.valueOf(val));
     }
 
-
     /**
      * Set double value.
      */
-    public void setProperty(final String key, final double val)  {
+    public void setProperty(final String key, final double val) {
         setProperty(key, String.valueOf(val));
     }
 
     /**
      * Set float value.
      */
-    public void setProperty(final String key, final float val)  {
+    public void setProperty(final String key, final float val) {
         setProperty(key, String.valueOf(val));
-    } 
+    }
 
     /**
      * Set long value.
      */
-    public void setProperty(final String key, final long val)  {
+    public void setProperty(final String key, final long val) {
         setProperty(key, String.valueOf(val));
     }
-    
+
     /**
      * Set <code>InetAddress</code>.
      */
     public void setInetAddress(final String key, final InetAddress val) {
         setProperty(key, val.getHostAddress());
     }
-     
+
     /**
      * Set <code>File</code> object.
      */
-    public void setProperty(final String key, final File val)  {
+    public void setProperty(final String key, final File val) {
         setProperty(key, val.getAbsolutePath());
     }
 
@@ -385,21 +367,22 @@
     /**
      * Set <code>TimeZone</code> object.
      */
-    public void setProperty(final String key, final TimeZone val)  {
+    public void setProperty(final String key, final TimeZone val) {
         setProperty(key, val.getID());
     }
 
     /**
      * Set <code>Date</code> object.
      */
-    public void setProperty(final String key, final Date val, final DateFormat fmt)  {
+    public void setProperty(final String key, final Date val,
+            final DateFormat fmt) {
         setProperty(key, fmt.format(val));
     }
 
     /**
      * Set <code>Class</code> object.
      */
-    public void setProperty(final String key, final Class<?> val)  {
+    public void setProperty(final String key, final Class<?> val) {
         setProperty(key, val.getName());
     }
 

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/ClassUtils.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/ClassUtils.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/ClassUtils.java Sun Aug 17 12:52:42 2008
@@ -15,31 +15,40 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
+/**
+ * 
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ *
+ */
 public class ClassUtils {
 
     /**
-     * Checks if a class is a subclass of a class with the specified name.
-     * Used as an instanceOf without having to load the class, useful when
-     * trying to check for classes that might not be available in the runtime
-     * JRE.
-     * @param clazz The class to check
-     * @param className The class name to look for in the super classes
+     * Checks if a class is a subclass of a class with the specified name. Used
+     * as an instanceOf without having to load the class, useful when trying to
+     * check for classes that might not be available in the runtime JRE.
+     * 
+     * @param clazz
+     *            The class to check
+     * @param className
+     *            The class name to look for in the super classes
      * @return true if the class extends a class by the specified name.
      */
     public static boolean extendsClass(final Class<?> clazz, String className) {
-    	Class<?> superClass = clazz.getSuperclass();
-    	
-    	while(superClass != null) {
-    		if(superClass.getName().equals(className)) {
-    			return true;
-    		}
-    		superClass = superClass.getSuperclass();
-    		
-    	}
-    	return false;
+        Class<?> superClass = clazz.getSuperclass();
+
+        while (superClass != null) {
+            if (superClass.getName().equals(className)) {
+                return true;
+            }
+            superClass = superClass.getSuperclass();
+
+        }
+        return false;
     }
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/DateUtils.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/DateUtils.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/DateUtils.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/DateUtils.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
@@ -24,25 +24,15 @@
 
 /**
  * Standard date related utility methods.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class DateUtils {
-    
-    private final static String[] MONTHS = {
-        "Jan",
-        "Feb",
-        "Mar",
-        "Apr",
-        "May",
-        "Jun",
-        "Jul",
-        "Aug",
-        "Sep",
-        "Oct",
-        "Nov",
-        "Dec"
-    };
-            
+public class DateUtils {
+
+    private final static String[] MONTHS = { "Jan", "Feb", "Mar", "Apr", "May",
+            "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
     /**
      * Get unix style date string.
      */
@@ -50,52 +40,51 @@
         if (millis < 0) {
             return "------------";
         }
-        
+
         StringBuffer sb = new StringBuffer(16);
         Calendar cal = new GregorianCalendar();
         cal.setTimeInMillis(millis);
-        
+
         // month
-        sb.append( MONTHS[cal.get(Calendar.MONTH)] );
+        sb.append(MONTHS[cal.get(Calendar.MONTH)]);
         sb.append(' ');
-        
+
         // day
         int day = cal.get(Calendar.DATE);
-        if(day < 10) {
+        if (day < 10) {
             sb.append(' ');
         }
         sb.append(day);
         sb.append(' ');
-        
-        long sixMonth = 15811200000L; //183L * 24L * 60L * 60L * 1000L;
+
+        long sixMonth = 15811200000L; // 183L * 24L * 60L * 60L * 1000L;
         long nowTime = System.currentTimeMillis();
-        if( Math.abs(nowTime - millis) > sixMonth) {
-            
+        if (Math.abs(nowTime - millis) > sixMonth) {
+
             // year
             int year = cal.get(Calendar.YEAR);
             sb.append(' ');
             sb.append(year);
-        }
-        else {
-            
+        } else {
+
             // hour
             int hh = cal.get(Calendar.HOUR_OF_DAY);
-            if(hh < 10) {
+            if (hh < 10) {
                 sb.append('0');
             }
             sb.append(hh);
             sb.append(':');
-            
+
             // minute
             int mm = cal.get(Calendar.MINUTE);
-            if(mm < 10) {
+            if (mm < 10) {
                 sb.append('0');
             }
             sb.append(mm);
         }
         return sb.toString();
     }
-    
+
     /**
      * Get ISO 8601 timestamp.
      */
@@ -103,53 +92,53 @@
         StringBuffer sb = new StringBuffer(19);
         Calendar cal = new GregorianCalendar();
         cal.setTimeInMillis(millis);
-        
+
         // year
         sb.append(cal.get(Calendar.YEAR));
-        
+
         // month
         sb.append('-');
         int month = cal.get(Calendar.MONTH) + 1;
-        if(month < 10) {
+        if (month < 10) {
             sb.append('0');
         }
         sb.append(month);
-        
+
         // date
         sb.append('-');
         int date = cal.get(Calendar.DATE);
-        if(date < 10) {
+        if (date < 10) {
             sb.append('0');
         }
         sb.append(date);
-        
+
         // hour
         sb.append('T');
         int hour = cal.get(Calendar.HOUR_OF_DAY);
-        if(hour < 10) {
+        if (hour < 10) {
             sb.append('0');
         }
         sb.append(hour);
-        
+
         // minute
         sb.append(':');
         int min = cal.get(Calendar.MINUTE);
-        if(min < 10) {
+        if (min < 10) {
             sb.append('0');
         }
         sb.append(min);
-        
+
         // second
         sb.append(':');
         int sec = cal.get(Calendar.SECOND);
-        if(sec < 10) {
+        if (sec < 10) {
             sb.append('0');
         }
         sb.append(sec);
-        
+
         return sb.toString();
-    } 
-    
+    }
+
     /**
      * Get FTP date.
      */
@@ -157,52 +146,52 @@
         StringBuffer sb = new StringBuffer(20);
         Calendar cal = new GregorianCalendar();
         cal.setTimeInMillis(millis);
-        
+
         // year
         sb.append(cal.get(Calendar.YEAR));
-        
+
         // month
         int month = cal.get(Calendar.MONTH) + 1;
-        if(month < 10) {
+        if (month < 10) {
             sb.append('0');
         }
         sb.append(month);
-        
+
         // date
         int date = cal.get(Calendar.DATE);
-        if(date < 10) {
+        if (date < 10) {
             sb.append('0');
         }
         sb.append(date);
-        
+
         // hour
         int hour = cal.get(Calendar.HOUR_OF_DAY);
-        if(hour < 10) {
+        if (hour < 10) {
             sb.append('0');
         }
         sb.append(hour);
-        
+
         // minute
         int min = cal.get(Calendar.MINUTE);
-        if(min < 10) {
+        if (min < 10) {
             sb.append('0');
         }
         sb.append(min);
-        
+
         // second
         int sec = cal.get(Calendar.SECOND);
-        if(sec < 10) {
+        if (sec < 10) {
             sb.append('0');
         }
         sb.append(sec);
-        
+
         // millisecond
         sb.append('.');
         int milli = cal.get(Calendar.MILLISECOND);
-        if(milli < 100) {
+        if (milli < 100) {
             sb.append('0');
         }
-        if(milli < 10) {
+        if (milli < 10) {
             sb.append('0');
         }
         sb.append(milli);

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/EncryptUtils.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/EncryptUtils.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/EncryptUtils.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/EncryptUtils.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
@@ -24,29 +24,32 @@
 
 /**
  * String encryption utility methods.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
+public class EncryptUtils {
 
-public
-class EncryptUtils {
-    
     /**
      * Encrypt byte array.
      */
-    public final static byte[] encrypt(byte[] source, String algorithm) throws NoSuchAlgorithmException {
+    public final static byte[] encrypt(byte[] source, String algorithm)
+            throws NoSuchAlgorithmException {
         MessageDigest md = MessageDigest.getInstance(algorithm);
         md.reset();
         md.update(source);
         return md.digest();
     }
-    
+
     /**
      * Encrypt string
      */
-    public final static String encrypt(String source, String algorithm) throws NoSuchAlgorithmException {
+    public final static String encrypt(String source, String algorithm)
+            throws NoSuchAlgorithmException {
         byte[] resByteArray = encrypt(source.getBytes(), algorithm);
         return StringUtils.toHexString(resByteArray);
     }
-    
+
     /**
      * Encrypt string using MD5 algorithm
      */
@@ -54,18 +57,17 @@
         if (source == null) {
             source = "";
         }
-    
+
         String result = "";
         try {
             result = encrypt(source, "MD5");
-        }
-        catch(NoSuchAlgorithmException ex) {
+        } catch (NoSuchAlgorithmException ex) {
             // this should never happen
             throw new RuntimeException(ex);
         }
         return result;
     }
-    
+
     /**
      * Encrypt string using SHA algorithm
      */
@@ -73,16 +75,15 @@
         if (source == null) {
             source = "";
         }
-    
+
         String result = "";
         try {
             result = encrypt(source, "SHA");
-        }
-        catch(NoSuchAlgorithmException ex) {
+        } catch (NoSuchAlgorithmException ex) {
             // this should never happen
             throw new RuntimeException(ex);
         }
         return result;
     }
-     
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FileRegularFilter.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FileRegularFilter.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FileRegularFilter.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FileRegularFilter.java Sun Aug 17 12:52:42 2008
@@ -15,39 +15,44 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
 import java.io.File;
 import java.io.FilenameFilter;
 
-
 /**
- * This is regular expression filename filter. 
+ * This is regular expression filename filter.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public
-class FileRegularFilter implements FilenameFilter {
-    
+public class FileRegularFilter implements FilenameFilter {
+
     private RegularExpr regularExpr = null;
-    
+
     /**
      * Constructor.
-     * @param pattern regular expression
+     * 
+     * @param pattern
+     *            regular expression
      */
     public FileRegularFilter(String pattern) {
         if ((pattern == null) || pattern.equals("") || pattern.equals("*")) {
             regularExpr = null;
-        }
-        else {
+        } else {
             regularExpr = new RegularExpr(pattern);
         }
     }
-    
+
     /**
      * Tests if a specified file should be included in a file list.
-     * @param dir - the directory in which the file was found
-     * @param name - the name of the file.
+     * 
+     * @param dir
+     *            - the directory in which the file was found
+     * @param name
+     *            - the name of the file.
      */
     public boolean accept(File dir, String name) {
         if (regularExpr == null) {
@@ -55,4 +60,4 @@
         }
         return regularExpr.isMatch(name);
     }
-}    
+}

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FtpReplyUtil.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FtpReplyUtil.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FtpReplyUtil.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/FtpReplyUtil.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
@@ -34,94 +34,131 @@
 
 /**
  * FTP reply translator.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public class FtpReplyUtil  {
-    
+public class FtpReplyUtil {
+
     public static final String CLIENT_ACCESS_TIME = "client.access.time";
-    public static final String CLIENT_CON_TIME    = "client.con.time";
-    public static final String CLIENT_DIR         = "client.dir";
-    public static final String CLIENT_HOME        = "client.home";
-    public static final String CLIENT_IP          = "client.ip";
-    public static final String CLIENT_LOGIN_NAME  = "client.login.name";
-    public static final String CLIENT_LOGIN_TIME  = "client.login.time";
+
+    public static final String CLIENT_CON_TIME = "client.con.time";
+
+    public static final String CLIENT_DIR = "client.dir";
+
+    public static final String CLIENT_HOME = "client.home";
+
+    public static final String CLIENT_IP = "client.ip";
+
+    public static final String CLIENT_LOGIN_NAME = "client.login.name";
+
+    public static final String CLIENT_LOGIN_TIME = "client.login.time";
+
     public static final String OUTPUT_CODE = "output.code";
-    public static final String OUTPUT_MSG  = "output.msg";
-    public static final String REQUEST_ARG  = "request.arg";
-    public static final String REQUEST_CMD  = "request.cmd";
+
+    public static final String OUTPUT_MSG = "output.msg";
+
+    public static final String REQUEST_ARG = "request.arg";
+
+    public static final String REQUEST_CMD = "request.cmd";
+
     public static final String REQUEST_LINE = "request.line";
-    ///////////////////////// All Server Vatiables /////////////////////////
-    public static final String SERVER_IP   = "server.ip";
+
+    // /////////////////////// All Server Vatiables /////////////////////////
+    public static final String SERVER_IP = "server.ip";
+
     public static final String SERVER_PORT = "server.port";
-    public static final String STAT_CON_CURR  = "stat.con.curr";
+
+    public static final String STAT_CON_CURR = "stat.con.curr";
+
     public static final String STAT_CON_TOTAL = "stat.con.total";
-    public static final String STAT_DIR_CREATE_COUNT  = "stat.dir.create.count";
-    public static final String STAT_DIR_DELETE_COUNT  = "stat.dir.delete.count";
+
+    public static final String STAT_DIR_CREATE_COUNT = "stat.dir.create.count";
+
+    public static final String STAT_DIR_DELETE_COUNT = "stat.dir.delete.count";
+
     public static final String STAT_FILE_DELETE_COUNT = "stat.file.delete.count";
+
     public static final String STAT_FILE_DOWNLOAD_BYTES = "stat.file.download.bytes";
+
     public static final String STAT_FILE_DOWNLOAD_COUNT = "stat.file.download.count";
+
     public static final String STAT_FILE_UPLOAD_BYTES = "stat.file.upload.bytes";
+
     public static final String STAT_FILE_UPLOAD_COUNT = "stat.file.upload.count";
-    public static final String STAT_LOGIN_ANON_CURR  = "stat.login.anon.curr";
+
+    public static final String STAT_LOGIN_ANON_CURR = "stat.login.anon.curr";
+
     public static final String STAT_LOGIN_ANON_TOTAL = "stat.login.anon.total";
-    public static final String STAT_LOGIN_CURR  = "stat.login.curr";
+
+    public static final String STAT_LOGIN_CURR = "stat.login.curr";
+
     public static final String STAT_LOGIN_TOTAL = "stat.login.total";
+
     public static final String STAT_START_TIME = "stat.start.time";
-    
-    public static FtpReply translate(FtpIoSession session, FtpRequest request, FtpServerContext context, int code, String subId, String basicMsg) {
-        String msg = translateMessage(session, request, context, code, subId, basicMsg);
-        
+
+    public static FtpReply translate(FtpIoSession session, FtpRequest request,
+            FtpServerContext context, int code, String subId, String basicMsg) {
+        String msg = translateMessage(session, request, context, code, subId,
+                basicMsg);
+
         return new DefaultFtpReply(code, msg);
     }
-    
-    private static String translateMessage(FtpIoSession session, FtpRequest request, FtpServerContext context, int code, String subId, String basicMsg) {
+
+    private static String translateMessage(FtpIoSession session,
+            FtpRequest request, FtpServerContext context, int code,
+            String subId, String basicMsg) {
         MessageResource resource = context.getMessageResource();
         String lang = session.getLanguage();
-        
+
         String msg = null;
-        if(resource != null ) {
+        if (resource != null) {
             msg = resource.getMessage(code, subId, lang);
         }
-        if(msg == null) {
+        if (msg == null) {
             msg = "";
         }
         msg = replaceVariables(session, request, context, code, basicMsg, msg);
-        
+
         return msg;
     }
-    
+
     /**
      * Replace server variables.
      */
-    private static String replaceVariables(FtpIoSession session, FtpRequest request, FtpServerContext context, int code, String basicMsg, String str) {
-        
+    private static String replaceVariables(FtpIoSession session,
+            FtpRequest request, FtpServerContext context, int code,
+            String basicMsg, String str) {
+
         int startIndex = 0;
         int openIndex = str.indexOf('{', startIndex);
         if (openIndex == -1) {
             return str;
         }
-        
+
         int closeIndex = str.indexOf('}', startIndex);
-        if( (closeIndex == -1) || (openIndex > closeIndex) ) {
+        if ((closeIndex == -1) || (openIndex > closeIndex)) {
             return str;
         }
-        
+
         StringBuffer sb = new StringBuffer(128);
         sb.append(str.substring(startIndex, openIndex));
-        while(true) {
-            String varName = str.substring(openIndex+1, closeIndex);
-            sb.append( getVariableValue(session, request, context, code, basicMsg, varName) );
-            
+        while (true) {
+            String varName = str.substring(openIndex + 1, closeIndex);
+            sb.append(getVariableValue(session, request, context, code,
+                    basicMsg, varName));
+
             startIndex = closeIndex + 1;
             openIndex = str.indexOf('{', startIndex);
             if (openIndex == -1) {
                 sb.append(str.substring(startIndex));
                 break;
             }
-            
+
             closeIndex = str.indexOf('}', startIndex);
-            if( (closeIndex == -1) || (openIndex > closeIndex) ) {
-               sb.append(str.substring(startIndex));
-               break;
+            if ((closeIndex == -1) || (openIndex > closeIndex)) {
+                sb.append(str.substring(startIndex));
+                break;
             }
             sb.append(str.substring(startIndex, openIndex));
         }
@@ -131,36 +168,38 @@
     /**
      * Get the variable value.
      */
-    private static String getVariableValue(FtpIoSession session, FtpRequest request, FtpServerContext context, int code, String basicMsg, String varName) {
-        
+    private static String getVariableValue(FtpIoSession session,
+            FtpRequest request, FtpServerContext context, int code,
+            String basicMsg, String varName) {
+
         String varVal = null;
-        
+
         // all output variables
-        if(varName.startsWith("output.")) {
+        if (varName.startsWith("output.")) {
             varVal = getOutputVariableValue(session, code, basicMsg, varName);
         }
-    
+
         // all server variables
-        else if(varName.startsWith("server.")) {
+        else if (varName.startsWith("server.")) {
             varVal = getServerVariableValue(session, varName);
         }
-        
+
         // all request variables
-        else if(varName.startsWith("request.")) {
+        else if (varName.startsWith("request.")) {
             varVal = getRequestVariableValue(session, request, varName);
         }
-        
+
         // all statistical variables
-        else if(varName.startsWith("stat.")) {
+        else if (varName.startsWith("stat.")) {
             varVal = getStatisticalVariableValue(session, context, varName);
         }
-                
+
         // all client variables
-        else if(varName.startsWith("client.")) {
+        else if (varName.startsWith("client.")) {
             varVal = getClientVariableValue(session, varName);
         }
-        
-        if(varVal == null) {
+
+        if (varVal == null) {
             varVal = "";
         }
         return varVal;
@@ -169,278 +208,290 @@
     /**
      * Get client variable value.
      */
-    private static String getClientVariableValue(FtpIoSession session, String varName) {
-        
+    private static String getClientVariableValue(FtpIoSession session,
+            String varName) {
+
         String varVal = null;
-        
+
         // client ip
-        if(varName.equals(CLIENT_IP)) {
-        	if(session.getRemoteAddress() instanceof InetSocketAddress) {
-        		InetSocketAddress remoteSocketAddress = (InetSocketAddress) session.getRemoteAddress();
-        		varVal = remoteSocketAddress.getAddress().getHostAddress();
-        	}
-        	
+        if (varName.equals(CLIENT_IP)) {
+            if (session.getRemoteAddress() instanceof InetSocketAddress) {
+                InetSocketAddress remoteSocketAddress = (InetSocketAddress) session
+                        .getRemoteAddress();
+                varVal = remoteSocketAddress.getAddress().getHostAddress();
+            }
+
         }
-        
+
         // client connection time
-        else if(varName.equals(CLIENT_CON_TIME)) {
+        else if (varName.equals(CLIENT_CON_TIME)) {
             varVal = DateUtils.getISO8601Date(session.getCreationTime());
         }
-        
+
         // client login name
-        else if(varName.equals(CLIENT_LOGIN_NAME)) {
-            if(session.getUser() != null) {
-            	varVal = session.getUser().getName();
+        else if (varName.equals(CLIENT_LOGIN_NAME)) {
+            if (session.getUser() != null) {
+                varVal = session.getUser().getName();
             }
         }
-        
+
         // client login time
-        else if(varName.equals(CLIENT_LOGIN_TIME)) {
+        else if (varName.equals(CLIENT_LOGIN_TIME)) {
             varVal = DateUtils.getISO8601Date(session.getLoginTime().getTime());
         }
-        
+
         // client last access time
-        else if(varName.equals(CLIENT_ACCESS_TIME)) {
-            varVal = DateUtils.getISO8601Date(session.getLastAccessTime().getTime());
+        else if (varName.equals(CLIENT_ACCESS_TIME)) {
+            varVal = DateUtils.getISO8601Date(session.getLastAccessTime()
+                    .getTime());
         }
-        
+
         // client home
-        else if(varName.equals(CLIENT_HOME)) {
+        else if (varName.equals(CLIENT_HOME)) {
             varVal = session.getUser().getHomeDirectory();
         }
-        
+
         // client directory
-        else if(varName.equals(CLIENT_DIR)) {
+        else if (varName.equals(CLIENT_DIR)) {
             FileSystemView fsView = session.getFileSystemView();
-            if(fsView != null) {
+            if (fsView != null) {
                 try {
                     varVal = fsView.getCurrentDirectory().getFullName();
-                }
-                catch(Exception ex) {
+                } catch (Exception ex) {
                     varVal = "";
                 }
             }
         }
-        return varVal; 
+        return varVal;
     }
 
     /**
      * Get output variable value.
      */
-    private static String getOutputVariableValue(FtpIoSession session, int code, String basicMsg, String varName) {
+    private static String getOutputVariableValue(FtpIoSession session,
+            int code, String basicMsg, String varName) {
         String varVal = null;
-        
+
         // output code
-        if(varName.equals(OUTPUT_CODE)) {
+        if (varName.equals(OUTPUT_CODE)) {
             varVal = String.valueOf(code);
         }
-        
+
         // output message
-        else if(varName.equals(OUTPUT_MSG)) {
+        else if (varName.equals(OUTPUT_MSG)) {
             varVal = basicMsg;
         }
-        
+
         return varVal;
     }
 
     /**
      * Get request variable value.
      */
-    private static String getRequestVariableValue(FtpIoSession session, FtpRequest request, String varName) {
-        
+    private static String getRequestVariableValue(FtpIoSession session,
+            FtpRequest request, String varName) {
+
         String varVal = null;
-        
-        if(request == null) {
+
+        if (request == null) {
             return "";
         }
-        
+
         // request line
-        if(varName.equals(REQUEST_LINE)) {
+        if (varName.equals(REQUEST_LINE)) {
             varVal = request.getRequestLine();
         }
-        
+
         // request command
-        else if(varName.equals(REQUEST_CMD)) {
+        else if (varName.equals(REQUEST_CMD)) {
             varVal = request.getCommand();
         }
-        
+
         // request argument
-        else if(varName.equals(REQUEST_ARG)) {
+        else if (varName.equals(REQUEST_ARG)) {
             varVal = request.getArgument();
         }
-        
+
         return varVal;
     }
 
     /**
      * Get server variable value.
      */
-    private static String getServerVariableValue(FtpIoSession session, String varName) {
-        
+    private static String getServerVariableValue(FtpIoSession session,
+            String varName) {
+
         String varVal = null;
 
         SocketAddress localSocketAddress = session.getLocalAddress();
-        
-        if(localSocketAddress instanceof InetSocketAddress) {
-        	InetSocketAddress localInetSocketAddress = (InetSocketAddress) localSocketAddress;
-        	// server address
-        	if(varName.equals(SERVER_IP)) {
-        		
-        		InetAddress addr = localInetSocketAddress.getAddress();
-        			
-        			if(addr != null) {
-        				varVal = addr.getHostAddress();
-        			}
-        	}
-        	
-        	// server port
-        	else if(varName.equals(SERVER_PORT)) {
-        		varVal = String.valueOf(localInetSocketAddress.getPort());
-        	}
+
+        if (localSocketAddress instanceof InetSocketAddress) {
+            InetSocketAddress localInetSocketAddress = (InetSocketAddress) localSocketAddress;
+            // server address
+            if (varName.equals(SERVER_IP)) {
+
+                InetAddress addr = localInetSocketAddress.getAddress();
+
+                if (addr != null) {
+                    varVal = addr.getHostAddress();
+                }
+            }
+
+            // server port
+            else if (varName.equals(SERVER_PORT)) {
+                varVal = String.valueOf(localInetSocketAddress.getPort());
+            }
         }
-        
+
         return varVal;
     }
 
     /**
      * Get statistical connection variable value.
      */
-    private static String getStatisticalConnectionVariableValue(FtpIoSession session, FtpServerContext context, String varName) {
+    private static String getStatisticalConnectionVariableValue(
+            FtpIoSession session, FtpServerContext context, String varName) {
         String varVal = null;
         FtpStatistics stat = context.getFtpStatistics();
-        
+
         // total connection number
-        if(varName.equals(STAT_CON_TOTAL)) {
+        if (varName.equals(STAT_CON_TOTAL)) {
             varVal = String.valueOf(stat.getTotalConnectionNumber());
         }
-        
+
         // current connection number
-        else if(varName.equals(STAT_CON_CURR)) {
+        else if (varName.equals(STAT_CON_CURR)) {
             varVal = String.valueOf(stat.getCurrentConnectionNumber());
         }
-        
+
         return varVal;
     }
 
     /**
      * Get statistical directory variable value.
      */
-    private static String getStatisticalDirectoryVariableValue(FtpIoSession session, FtpServerContext context, String varName) {
+    private static String getStatisticalDirectoryVariableValue(
+            FtpIoSession session, FtpServerContext context, String varName) {
         String varVal = null;
         FtpStatistics stat = context.getFtpStatistics();
-        
+
         // total directory created
-        if(varName.equals(STAT_DIR_CREATE_COUNT)) {
+        if (varName.equals(STAT_DIR_CREATE_COUNT)) {
             varVal = String.valueOf(stat.getTotalDirectoryCreated());
         }
-        
+
         // total directory removed
-        else if(varName.equals(STAT_DIR_DELETE_COUNT)) {
+        else if (varName.equals(STAT_DIR_DELETE_COUNT)) {
             varVal = String.valueOf(stat.getTotalDirectoryRemoved());
         }
-        
+
         return varVal;
     }
 
     /**
      * Get statistical file variable value.
      */
-    private static String getStatisticalFileVariableValue(FtpIoSession session, FtpServerContext context, String varName) {
+    private static String getStatisticalFileVariableValue(FtpIoSession session,
+            FtpServerContext context, String varName) {
         String varVal = null;
         FtpStatistics stat = context.getFtpStatistics();
-        
+
         // total number of file upload
-        if(varName.equals(STAT_FILE_UPLOAD_COUNT)) {
+        if (varName.equals(STAT_FILE_UPLOAD_COUNT)) {
             varVal = String.valueOf(stat.getTotalUploadNumber());
         }
-        
+
         // total bytes uploaded
-        else if(varName.equals(STAT_FILE_UPLOAD_BYTES)) {
+        else if (varName.equals(STAT_FILE_UPLOAD_BYTES)) {
             varVal = String.valueOf(stat.getTotalUploadSize());
         }
-        
+
         // total number of file download
-        else if(varName.equals(STAT_FILE_DOWNLOAD_COUNT)) {
+        else if (varName.equals(STAT_FILE_DOWNLOAD_COUNT)) {
             varVal = String.valueOf(stat.getTotalDownloadNumber());
         }
-        
+
         // total bytes downloaded
-        else if(varName.equals(STAT_FILE_DOWNLOAD_BYTES)) {
+        else if (varName.equals(STAT_FILE_DOWNLOAD_BYTES)) {
             varVal = String.valueOf(stat.getTotalDownloadSize());
         }
-        
+
         // total number of files deleted
-        else if(varName.equals(STAT_FILE_DELETE_COUNT)) {
+        else if (varName.equals(STAT_FILE_DELETE_COUNT)) {
             varVal = String.valueOf(stat.getTotalDeleteNumber());
         }
-        
+
         return varVal;
     }
 
     /**
      * Get statistical login variable value.
      */
-    private static String getStatisticalLoginVariableValue(FtpIoSession session, FtpServerContext context, String varName) {
+    private static String getStatisticalLoginVariableValue(
+            FtpIoSession session, FtpServerContext context, String varName) {
         String varVal = null;
         FtpStatistics stat = context.getFtpStatistics();
-        
+
         // total login number
-        if(varName.equals(STAT_LOGIN_TOTAL)) {
+        if (varName.equals(STAT_LOGIN_TOTAL)) {
             varVal = String.valueOf(stat.getTotalLoginNumber());
         }
-        
+
         // current login number
-        else if(varName.equals(STAT_LOGIN_CURR)) {
+        else if (varName.equals(STAT_LOGIN_CURR)) {
             varVal = String.valueOf(stat.getCurrentLoginNumber());
         }
-        
+
         // total anonymous login number
-        else if(varName.equals(STAT_LOGIN_ANON_TOTAL)) {
+        else if (varName.equals(STAT_LOGIN_ANON_TOTAL)) {
             varVal = String.valueOf(stat.getTotalAnonymousLoginNumber());
         }
-        
+
         // current anonymous login number
-        else if(varName.equals(STAT_LOGIN_ANON_CURR)) {
+        else if (varName.equals(STAT_LOGIN_ANON_CURR)) {
             varVal = String.valueOf(stat.getCurrentAnonymousLoginNumber());
         }
-        
-        return varVal; 
+
+        return varVal;
     }
 
     /**
-     * Get statistical variable value. 
+     * Get statistical variable value.
      */
-    private static String getStatisticalVariableValue(FtpIoSession session, FtpServerContext context, String varName) {
-    
+    private static String getStatisticalVariableValue(FtpIoSession session,
+            FtpServerContext context, String varName) {
+
         String varVal = null;
         FtpStatistics stat = context.getFtpStatistics();
-        
+
         // server start time
-        if(varName.equals(STAT_START_TIME)) {
+        if (varName.equals(STAT_START_TIME)) {
             varVal = DateUtils.getISO8601Date(stat.getStartTime().getTime());
         }
-        
+
         // connection statistical variables
-        else if(varName.startsWith("stat.con")) {
-            varVal = getStatisticalConnectionVariableValue(session, context, varName);
+        else if (varName.startsWith("stat.con")) {
+            varVal = getStatisticalConnectionVariableValue(session, context,
+                    varName);
         }
-        
+
         // login statistical variables
-        else if(varName.startsWith("stat.login.")) {
+        else if (varName.startsWith("stat.login.")) {
             varVal = getStatisticalLoginVariableValue(session, context, varName);
         }
-        
+
         // file statistical variable
-        else if(varName.startsWith("stat.file")) {
+        else if (varName.startsWith("stat.file")) {
             varVal = getStatisticalFileVariableValue(session, context, varName);
         }
-        
+
         // directory statistical variable
-        else if(varName.startsWith("stat.dir.")) {
-            varVal = getStatisticalDirectoryVariableValue(session, context, varName);
+        else if (varName.startsWith("stat.dir.")) {
+            varVal = getStatisticalDirectoryVariableValue(session, context,
+                    varName);
         }
-        
+
         return varVal;
     }
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalInetAddressException.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalInetAddressException.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalInetAddressException.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalInetAddressException.java Sun Aug 17 12:52:42 2008
@@ -15,12 +15,16 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
 /**
- * Thrown if the provided string representation does not match a valid IP address
+ * Thrown if the provided string representation does not match a valid IP
+ * address
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class IllegalInetAddressException extends IllegalArgumentException {
 

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalPortException.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalPortException.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalPortException.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/util/IllegalPortException.java Sun Aug 17 12:52:42 2008
@@ -15,12 +15,15 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- */  
+ */
 
 package org.apache.ftpserver.util;
 
 /**
  * Thrown if the provided string representation does not match a valid IP port
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
 public class IllegalPortException extends IllegalArgumentException {