stevencaswell 2003/08/03 17:19:43
Modified: lang/src/java/org/apache/commons/lang/time DateUtils.java
Log:
Updated iterator method javadocs to specify valid values of the range style argument
Added throwing IllegalArgumentException in parseCVS method when "last x" is unknown type
Revision Changes Path
1.7 +16 -5 jakarta-commons/lang/src/java/org/apache/commons/lang/time/DateUtils.java
Index: DateUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/time/DateUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DateUtils.java 14 Jul 2003 22:25:05 -0000 1.6
+++ DateUtils.java 4 Aug 2003 00:19:43 -0000 1.7
@@ -516,6 +516,7 @@
now.add(Calendar.DATE, -7);
return now;
}
+ throw new IllegalArgumentException("We do not understand that last units");
} else if (value.equals("yesterday")) {
now.add(Calendar.DATE, -1);
return now;
@@ -550,9 +551,12 @@
* 2002 and ends with Saturday, August 3, 2002.
*
* @param focus the date to work with
- * @param rangeStyle the style constant to use
+ * @param rangeStyle the style constant to use. Must be one of the range
+ * styles listed for the {@link #iterator(Calendar, int) method.
+ *
* @return the date iterator
- * @throws IllegalArgumentException if the date is <code>null</code>
+ * @throws IllegalArgumentException if the date is <code>null</code> or
if
+ * the rangeStyle is not
*/
public static Iterator iterator(Date focus, int rangeStyle) {
if (focus == null) {
@@ -574,7 +578,13 @@
* 2002 and ends with Saturday, August 3, 2002.
*
* @param focus the date to work with
- * @param rangeStyle the style constant to use
+ * @param rangeStyle the style constant to use. Must be one of
+ * {@link DateUtils.RANGE_MONTH_SUNDAY},
+ * {@link DateUtils.RANGE_MONTH_MONDAY},
+ * {@link DateUtils.RANGE_WEEK_SUNDAY},
+ * {@link DateUtils.RANGE_WEEK_MONDAY},
+ * {@link DateUtils.RANGE_WEEK_RELATIVE},
+ * {@link DateUtils.RANGE_WEEK_CENTER}
* @return the date iterator
* @throws IllegalArgumentException if the date is <code>null</code>
*/
@@ -662,7 +672,8 @@
*
* @param focus the date to work with, either
* <code>Date</code> or <code>Calendar</code>
- * @param rangeStyle the style constant to use
+ * @param rangeStyle the style constant to use. Must be one of the range
+ * styles listed for the {@link #iterator(Calendar, int) method.
* @return the date iterator
* @throws IllegalArgumentException if the date
* is <code>null</code>
|