Hi Clint,
That is there to make the exception more informative in case someone
catches it and interrogates it for the value that caused it.

-Igor


On Sat, Mar 26, 2011 at 3:28 PM, Clint Checketts <checke...@gmail.com> wrote:
> I'm really enjoying Igor's Wicket
> Cookbook<https://www.packtpub.com/apache-wicket-cookbook/book>(hooray
> for ebooks and instant delivery!)
>
> Instead of asking Igor directly, I figure this mailing list is a better
> forum.
>
> There is an example (page 30) like the following:
>
>        ConversionException e = new ConversionException(
>                "Error converting value: " + value + " to an instance of: "
>                        + Time.class.getName());
>        *e.setSourceValue(value);*
>        e.setVariable("inputPiece", value);
>        e.setResourceKey(getClass().getSimpleName() + "." + errorKey);
>
> My question is the purpose of 'setSourceValue()' call. I suspected it was to
> leverage the converted value in validation messages, but ${input} already
> has that value. Next I figured it could be used for the sub piece of a
> conversion, like in parsing a time of day (11:15am) then is the minute
> section was wrong (11:99am) the it would expose that specific value, but
> setVariable() meets that need:
>
> e.setVariable("inputPiece", value);
>
> The previous line makes ${inputPiece} available in Validation messages.
>
> So what does setSourceValue() do?
>
> -Clint
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to