incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: incubator-ftpserver/src/java/org/apache/ftpserver/command MDTM.java
Date Fri, 09 Sep 2005 11:23:10 GMT
rana_b      2005/09/09 04:23:10

  Modified:    src/java/org/apache/ftpserver/command MDTM.java
  Log:
  removed unnecessary methods and added method to get ftp date
  
  Revision  Changes    Path
  1.2       +5 -64     incubator-ftpserver/src/java/org/apache/ftpserver/command/MDTM.java
  
  Index: MDTM.java
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/command/MDTM.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MDTM.java	7 Sep 2005 05:06:22 -0000	1.1
  +++ MDTM.java	9 Sep 2005 11:23:09 -0000	1.2
  @@ -16,16 +16,15 @@
    */
   package org.apache.ftpserver.command;
   
  +import java.io.IOException;
  +
   import org.apache.ftpserver.Command;
   import org.apache.ftpserver.FtpRequestImpl;
   import org.apache.ftpserver.FtpWriter;
   import org.apache.ftpserver.RequestHandler;
   import org.apache.ftpserver.ftplet.FileObject;
   import org.apache.ftpserver.ftplet.FtpException;
  -
  -import java.io.IOException;
  -import java.util.Calendar;
  -import java.util.GregorianCalendar;
  +import org.apache.ftpserver.util.DateUtils;
   
   /**
    * <code>MDTM &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
  @@ -69,69 +68,11 @@
           // now print date
           fileName = file.getFullName();
           if(file.doesExist()) {
  -            String dateStr = getTimeString( file.getLastModified() );
  +            String dateStr = DateUtils.getFtpDate( file.getLastModified() );
               out.send(213, "MDTM", dateStr);
           }
           else {
               out.send(550, "MDTM", fileName);
           }
       } 
  -
  -    /**
  -     * Get time string.
  -     */
  -    private String getTimeString(long time) {
  -        StringBuffer sb = new StringBuffer(18);
  -        Calendar cal = new GregorianCalendar();
  -        cal.setTimeInMillis(time);
  -        
  -        // year
  -        sb.append(cal.get(Calendar.YEAR));
  -        
  -        // month
  -        int month = cal.get(Calendar.MONTH) + 1;
  -        if(month < 10) {
  -            sb.append('0');
  -        }
  -        sb.append(month);
  -        
  -        // date
  -        int date = cal.get(Calendar.DATE);
  -        if(date < 10) {
  -            sb.append('0');
  -        }
  -        sb.append(date);
  -        
  -        // hour
  -        int hour = cal.get(Calendar.HOUR_OF_DAY);
  -        if(hour < 10) {
  -            sb.append('0');
  -        }
  -        sb.append(hour);
  -        
  -        // minute
  -        int min = cal.get(Calendar.MINUTE);
  -        if(min < 10) {
  -            sb.append('0');
  -        }
  -        sb.append(min);
  -        
  -        // second
  -        int sec = cal.get(Calendar.SECOND);
  -        if(sec < 10) {
  -            sb.append('0');
  -        }
  -        sb.append(sec);
  -        
  -        // millisecond
  -        int milli = cal.get(Calendar.MILLISECOND);
  -        if(milli < 100) {
  -            sb.append('0');
  -        }
  -        if(milli < 10) {
  -            sb.append('0');
  -        }
  -        sb.append(milli);
  -        return sb.toString();
  -    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message