Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Regexp validation problem

$
0
0
This looks to be a bug, but I can't find any good documentation, so I
thought I'd bring it here first.

I through a really quick and simple regexp together to validate time
entries. It's goal was to be quick, and to verify that the values
entered look like 24 hour time. 35:99 would validate, 5:5 wouldn't, and
neither would 5:15 AM. I'm going to rework to be a bit more elegant in
value checks. I was just surprised when it didn't parse.

The problem is using a range of values throws an exception. Looks like
the code (5.3.7) is expecting a letter, and the 2nd value causes a parse
error:

Render queue error in BeginRender[manage/CreateEvent:textfield_3]:
Failure reading parameter 'validate' of component
manage/CreateEvent:textfield_3: Unexpected character '2' at position 23
of input string: required,regexp=^\d{1,2}:\d{2}$

Change the {1,2} to {2} or any other single value and it works.

Stack trace:

org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.parseError(FieldValidatorSourceImpl.java:423)
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.parse(FieldValidatorSourceImpl.java:315)
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.toValidatorSpecifications(FieldValidatorSourceImpl.java:200)
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.createValidators(FieldValidatorSourceImpl.java:183)
org.apache.tapestry5.internal.bindings.ValidateBindingFactory$1.get(ValidateBindingFactory.java:64)

Viewing all articles
Browse latest Browse all 5648

Trending Articles