You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2017/12/18 04:35:00 UTC

[jira] [Commented] (WICKET-6502) o.a.w.Localizer and o.a.w.markup.resolver.WicketMessageResolver changed behaviour

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

Sven Meier commented on WICKET-6502:
------------------------------------

Actually DEFAULT_VALUE = "DEFAULT_WICKET_MESSAGE_RESOLVER_VALUE" is defined in WicketMessageResolver, which uses the value to detect undefined resource keys.

I don't see a change in that code recently, so please provide a test case showing the difference between 7.x and 8.x

> o.a.w.Localizer and o.a.w.markup.resolver.WicketMessageResolver changed behaviour
> ---------------------------------------------------------------------------------
>
>                 Key: WICKET-6502
>                 URL: https://issues.apache.org/jira/browse/WICKET-6502
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 8.0.0-M8
>            Reporter: Ingo Renner
>            Priority: Minor
>
> Hi,
> I did not know about Application.get().getResourceSettings().getThrowExceptionOnMissingResource() before I implement a Localizer which returns [key] when key could not be resolved. 
> In another project I use a modified localizer to resolve messages from a database and when the key does not exist, the key is written into an other database to start the process of creating the messages with their needed translations.  This worked with wicket 7.x quite well.
> In my play project (where I test the wicket 8M8 upgrade), I just found out that in wicket 8M8 
> the localizer method 
> public String getString(String key, Component component, IModel<?> model, Locale locale, String style, IModel<String> defaultValue)
> returns "DEFAULT_WICKET_MESSAGE_RESOLVER_VALUE" instead of the exception, when the key could not be resolved. This creates an exception in WicketMessageResolver
> public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
> This  is for wicket:message as far as I can see by now.
> I fixed my Localizer variant, no big deal, but I wonder if this is a good design decision.  The getString methods are defined to throw a  MissingResourceException if they can't resolve the key  in this method,. But the exception is not thrown, but instead provokes a WicketRuntimeException in another class. I think we should stick with the old behavior and throw the exception in the localizer class as defined in the method declaration. 
> If you think the new behavior is better, than please give me some explanation to make me understand this design decision.
> Best regards,
>     Ingo



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)