[ 
https://issues.apache.org/jira/browse/WICKET-863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eelco Hillenius resolved WICKET-863.
------------------------------------

    Resolution: Fixed

> don't throw exceptions when missing keys for var substitution when 
> throwExceptionOnMissingResource setting is false
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-863
>                 URL: https://issues.apache.org/jira/browse/WICKET-863
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta1, 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>            Priority: Critical
>             Fix For: 1.3.0-beta3
>
>
> I'm not sure how long we've had this, but I bumped my head against the fact 
> that if you provide invalid keys (or missing) for variable substitution you 
> get a big fat error page. That is fine for development but absolutely not 
> fine for production/ when resource setting throwExceptionOnMissingResource is 
> false. Even though the name of this setting does not cover missing/ wrong 
> keys, it has the same goal: when true, it fails fast so that when you're 
> developing you'll have to fix it if you want to go on, but when in 
> production, such errors *should never* cause the application to stop 
> functioning.
> It looks to me like
> Index: 
> /Users/eelcohillenius/Documents/workspace_wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
> ===================================================================
> --- 
> /Users/eelcohillenius/Documents/workspace_wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
>  (revision 567432)
> +++ 
> /Users/eelcohillenius/Documents/workspace_wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
>  (working copy)
> @@ -26,6 +26,7 @@
>  import java.util.Locale;
>  import java.util.Map;
>  
> +import org.apache.wicket.Application;
>  import org.apache.wicket.Component;
>  import org.apache.wicket.Localizer;
>  import org.apache.wicket.MarkupContainer;
> @@ -196,7 +197,8 @@
>                */
>               public String substitute(String string, Map vars) throws 
> IllegalStateException
>               {
> -                     return new MapVariableInterpolator(string, 
> addDefaultVars(vars), true).toString();
> +                     return new MapVariableInterpolator(string, 
> addDefaultVars(vars), Application.get()
> +                                     
> .getResourceSettings().getThrowExceptionOnMissingResource()).toString();
>               }
>  
>               /**
> is the best fix.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to