Chad-- Hey; I got around to committing this change today. :) Any chance you've got a test that verifies that it works? Could just be vanilla JUnit that calls the appropriate methods.
Eddie ---------- Forwarded message ---------- From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Nov 10, 2005 3:38 PM Subject: svn commit: r332391 - /beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java To: [email protected] Author: ekoneil Date: Thu Nov 10 14:38:05 2005 New Revision: 332391 URL: http://svn.apache.org/viewcvs?rev=332391&view=rev Log: Implement better error reporting for date parsing in the AnnotationConstraintValidator. BB: self Test: Controls pass Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java?rev=332391&r1=332390&r2=332391&view=diff ============================================================================== --- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java (original) +++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java Thu Nov 10 14:38:05 2005 @@ -332,14 +332,19 @@ return; if (!(value instanceof String)) - error("The value, " + value + ", assigned to a date property must be of type java.lang.String."); + error("The value, " + + value + + ", assigned to a date property must be of type java.lang.String."); String format = a.format(); Date date = null; try { date = parseDate(format , (String)value); } catch (ParseException pe) { - error("Value assigned to a date property is not in the specified format of: " + format); + error("The value, " + + value + + ", assigned to a date property is not in the specified format of: " + + format); } String minValue = a.minValue(); @@ -349,11 +354,14 @@ try { minDate = parseDate(format, a.minValue()); } catch (ParseException pe) { - error("Value assigned to minValue date constraint property is not in the specified format of: " + format); + error("The value, " + + value + + ", assigned to minValue date constraint property is not in the specified format of: " + + format); } if (minDate.compareTo(date) > 0) { - error("The date, " + error("The value, " + value + ", assigned to a date property is earlier than the earliest date allowed: " + minValue); @@ -367,7 +375,10 @@ try { maxDate = parseDate(format, a.maxValue()); } catch (ParseException pe) { - error("Value assigned to maxValue date constraint property is not in the specified format of: " + format); + error("The value, " + + value + + ", assigned to maxValue date constraint property is not in the specified format of: " + + format); } if (maxDate.compareTo(date) < 0) { @@ -402,7 +413,9 @@ use the parse position to detect this case. */ if (d == null || pp.getIndex() < value.length()) - throw new ParseException("Parse failed.", pp.getIndex()); + throw new ParseException("Parsing date value, " + + value + + ", failed at index " + pp.getIndex(), pp.getIndex()); else return d; }
