I propose to define a date as valid if at least day and month are recognized. Without this, any input string is transformed in a valid date, and cases considered in parseDATE are never executed
Index: TimeUtil.java =================================================================== RCS file: /cvsroot/jdbforms/dbforms/src/org/dbforms/util/TimeUtil.java,v retrieving revision 1.19 diff -u -w -b -r1.19 TimeUtil.java --- TimeUtil.java 23 Mar 2004 11:07:10 -0000 1.19 +++ TimeUtil.java 25 Mar 2004 15:39:13 -0000 @@ -155,10 +155,13 @@ }
cal = format.getCalendar();
+ // at least match day and month
if (!cal.isSet(Calendar.DAY_OF_MONTH)
- && !cal.isSet(Calendar.MONTH)
- && !cal.isSet(Calendar.YEAR))
+ || !cal.isSet(Calendar.MONTH)
+ //&& !cal.isSet(Calendar.YEAR)
+ )
throw new NumberFormatException("wrong date format");
+ /*
if (!cal.isSet(Calendar.DAY_OF_MONTH)) {
cal.set(Calendar.DAY_OF_MONTH,
now.get(Calendar.DAY_OF_MONTH));
}
@@ -166,7 +169,7 @@
if (!cal.isSet(Calendar.MONTH)) {
cal.set(Calendar.MONTH, now.get(Calendar.MONTH));
}
-
+ */
if (!cal.isSet(Calendar.YEAR)) {
cal.set(Calendar.YEAR, now.get(Calendar.YEAR));
}------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ DbForms Mailing List
http://www.wap-force.net/dbforms
