Is "0" a valid XML duration?

Cantor, Scott cantor.2 at osu.edu
Sat Feb 15 13:55:40 EST 2014


On 2/15/14, 9:46 AM, "Rod Widdowson" <rdw at steadingsoftware.com> wrote:
>
>Amongst all the "aggravating but benign" exceptions it throws I saw one
>from
>DurationToLongConverter: "Durations must start with 'P'".
>
>And this was because we have  idp.session.slop = 0 in idp.properties.
>
>In fact this is just another "benign but aggravating" exception because
>the
>built-in spring converters then do the right thing.
>
>I am just idly wondering
>
>1) whether "0" is a valid duration and regardless of whether it is or not
>2) whether it is worthwhile to teach DurationToLongConverter to understand
>"0".

It's definitely not valid, but I think you're right that we should try and
avoid the error. I'm not sure of the best option here. Conditional
converters can't tell what the value will be when they tell Spring whether
to let them run (at least I don't think so). So it can't check for the P
first. Once it runs, it has to convert or throw.

So probably what we could do is fall back to just having it process the
value as a Long if there's no P.

-- Scott




More information about the dev mailing list