The easiest solution would be this:

Index: 
/Users/eelcohillenius/Documents/workspace_wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
===================================================================
--- 
/Users/eelcohillenius/Documents/workspace_wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
    (revision
591166)
+++ 
/Users/eelcohillenius/Documents/workspace_wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
    (working
copy)
@@ -43,13 +43,6 @@
 {
        private static final Logger log =
LoggerFactory.getLogger(WicketMessageResolver.class);

-       /**
-        * If the key can't be resolved and the default is null, an
exception will be thrown. Instead,
-        * we default to a unique string and check against this later. Don't
just use an empty string
-        * here, as people might want to override wicket:messages to empty 
strings.
-        */
-       private static final String DEFAULT_VALUE =
"DEFAULT_WICKET_MESSAGE_RESOLVER_VALUE";
-
        static
        {
                // register "wicket:message"
@@ -74,7 +67,7 @@
         * @return true, if componentId was handle by the resolver. False, 
otherwise
         */
        public boolean resolve(final MarkupContainer container, final
MarkupStream markupStream,
-                       final ComponentTag tag)
+               final ComponentTag tag)
        {
                if (tag instanceof WicketTag)
                {
@@ -85,7 +78,7 @@
                                if ((messageKey == null) || 
(messageKey.trim().length() == 0))
                                {
                                        throw new MarkupException(
-                                                       "Wrong format of 
<wicket:message key='xxx'>: attribute 'key'
is missing");
+                                               "Wrong format of 
<wicket:message key='xxx'>: attribute 'key' is
missing");
                                }

                                final String id = "_message_" + 
container.getPage().getAutoIndex();
@@ -91,7 +84,7 @@
                                final String id = "_message_" + 
container.getPage().getAutoIndex();
                                MessageLabel label = new MessageLabel(id, 
messageKey);
                                
label.setRenderBodyOnly(container.getApplication().getMarkupSettings()
-                                               .getStripWicketTags());
+                                       .getStripWicketTags());
                                container.autoAdd(label, markupStream);

                                // Yes, we handled the tag
@@ -125,8 +118,8 @@
                protected void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
                {
                        final String key = getModelObjectAsString();
-                       final String value = getLocalizer().getString(key, 
getParent(),
DEFAULT_VALUE);
-                       if (value != null && !DEFAULT_VALUE.equals(value))
+                       final String value = getLocalizer().getString(key, 
getParent());
+                       if (value != null)
                        {
                                replaceComponentTagBody(markupStream, openTag, 
value.trim());
                        }


But that would produce a lousy error message:

WicketMessage: Exception in rendering component: [Component id =
_message_4, page = org.apache.wicket.examples.helloworld.HelloWorld,
path = 6:_message_4.WicketMessageResolver$MessageLabel, isVisible =
true, isVersioned = true]

Root cause:

java.util.MissingResourceException: Unable to find resource: test for
component:  [class=org.apache.wicket.examples.helloworld.HelloWorld]
     at org.apache.wicket.Localizer.getString(Localizer.java:261)
     at org.apache.wicket.Localizer.getString(Localizer.java:91)
     at 
org.apache.wicket.markup.resolver.WicketMessageResolver$MessageLabel.onComponentTagBody(WicketMessageResolver.java:128)
     at org.apache.wicket.Component.renderComponent(Component.java:2416)


Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to