[ 
https://issues.apache.org/jira/browse/WICKET-3868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059577#comment-13059577
 ] 

Maarten Billemont commented on WICKET-3868:
-------------------------------------------

Alternatively, if we don't want to keep it simple, perhaps we should go down 
the road of renderers.  Where a renderer is a strategy to convert the feedback 
message to a String.  There would be a default renderer that does toString, and 
everybody that wants to use the feedback message should consistently go through 
the registered renderer for the feedback message object's type.  That would 
close this bug too, since then the message would be handled the same way 
everywhere.

> Feedback message should be handled the same way everywhere.
> -----------------------------------------------------------
>
>                 Key: WICKET-3868
>                 URL: https://issues.apache.org/jira/browse/WICKET-3868
>             Project: Wicket
>          Issue Type: Bug
>            Reporter: Maarten Billemont
>
> Feedback messages are Serializables.  While I personally don't agree with 
> that (since users want to see a String, not a Serializable object), it is the 
> way it is.  However, that means we should be careful that the feedback 
> message object is handled the same way everywhere.
> For instance, FeedbackPanel.newMessageDisplayComponent(String, 
> FeedbackMessage) does a toString() on it, while 
> AjaxEditableLabel.onError(AjaxRequestTarget) casts it to String if it's a 
> String and pretends it's not there if it's not.
> Presumably, the latter is not the intended way of using the message, and it 
> should be corrected to act like the former.
> I believe it raises the issue of danger with using the wrong type of object 
> very well, though.  It opens the road for bugs like this one, where your 
> feedback message that isn't a message isn't handled properly because the 
> framework assumes it's a message.  IMO, we should make it a String and the 
> user should put whatever their toString would generate in a feedback message, 
> instead of the object itself.  KISS.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to