otis 2002/06/09 13:47:22 Modified: src/java/org/apache/lucene/document DateField.java Log: - Added Javadoc for the class and two methods explaining issue with dates prior to 1.1.1970. Revision Changes Path 1.3 +19 -6 jakarta-lucene/src/java/org/apache/lucene/document/DateField.java Index: DateField.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/document/DateField.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DateField.java 25 Dec 2001 19:27:04 -0000 1.2 +++ DateField.java 9 Jun 2002 20:47:22 -0000 1.3 @@ -56,9 +56,14 @@ import java.util.Date; -/** Provides support for converting dates to strings and vice-versa. The - * strings are structured so that lexicographic sorting orders by date. This - * makes them suitable for use as field values and search terms. */ +/** + * Provides support for converting dates to strings and vice-versa. + * The strings are structured so that lexicographic sorting orders by date. + * This makes them suitable for use as field values and search terms. + * <P> + * Note: currenly dates before 1970 cannot be used, and therefore cannot be + * indexed. + */ public class DateField { private DateField() {} @@ -77,12 +82,20 @@ buffer[i] = c; return new String(buffer); } - - /** Converts a Date to a string suitable for indexing. */ + + /** + * Converts a Date to a string suitable for indexing. + * This method will throw a RuntimeException if the date specified in the + * method argument is before 1970. + */ public static String dateToString(Date date) { return timeToString(date.getTime()); } - /** Converts a millisecond time to a string suitable for indexing. */ + /** + * Converts a millisecond time to a string suitable for indexing. + * This method will throw a RuntimeException if the time specified in the + * method argument is negative, that is, before 1970. + */ public static String timeToString(long time) { if (time < 0) throw new RuntimeException("time too early");
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>