Author: rwinston Date: Sat Mar 8 09:21:55 2008 New Revision: 635022 URL: http://svn.apache.org/viewvc?rev=635022&view=rev Log: NET-198
Modified: commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java Modified: commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java?rev=635022&r1=635021&r2=635022&view=diff ============================================================================== --- commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java (original) +++ commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java Sat Mar 8 09:21:55 2008 @@ -63,17 +63,36 @@ * If the recentDateFormat member has been defined, try to parse the * supplied string with that. If that parse fails, or if the recentDateFormat * member has not been defined, attempt to parse with the defaultDateFormat - * member. If that fails, throw a ParseException. + * member. If that fails, throw a ParseException. * - * @see org.apache.commons.net.ftp.parser.FTPTimestampParser#parseTimestamp(java.lang.String) - */ - /* (non-Javadoc) + * This method allows a [EMAIL PROTECTED] Calendar} instance to be passed in which represents the + * current (system) time. * + * @see org.apache.commons.net.ftp.parser.FTPTimestampParser#parseTimestamp(java.lang.String) + * + * @param timestampStr The timestamp to be parsed */ public Calendar parseTimestamp(String timestampStr) throws ParseException { Calendar now = Calendar.getInstance(); now.setTimeZone(this.getServerTimeZone()); - + return parseTimestamp(timestampStr, now); + } + + /** + * Implements the one [EMAIL PROTECTED] FTPTimestampParser#parseTimestamp(String) method} + * in the [EMAIL PROTECTED] FTPTimestampParser FTPTimestampParser} interface + * according to this algorithm: + * + * If the recentDateFormat member has been defined, try to parse the + * supplied string with that. If that parse fails, or if the recentDateFormat + * member has not been defined, attempt to parse with the defaultDateFormat + * member. If that fails, throw a ParseException. + * + * @see org.apache.commons.net.ftp.parser.FTPTimestampParser#parseTimestamp(java.lang.String) + * @param timestampStr The timestamp to be parsed + * @param now The current time + */ + public Calendar parseTimestamp(String timestampStr, Calendar now) throws ParseException { Calendar working = Calendar.getInstance(); working.setTimeZone(getServerTimeZone()); ParsePosition pp = new ParsePosition(0);