Bug 18521 - MessageTag body misuse
Summary: MessageTag body misuse
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: I18N Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 18523 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-31 14:42 UTC by Patrick Samson
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
MessageTag patch (1.44 KB, patch)
2004-06-02 15:02 UTC, Patrick Samson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Samson 2003-03-31 14:42:23 UTC
In this situation:
 <i18n:message key="exist">text</i18n:message>
 <i18n:message key="doesn't exist"/>
then the second tag shows the content of the first one.
This is because in the first step, a body is assigned
but not used (so not .clear() ), and in the second step
no body is assigned, but needed and one already exists.
Comment 1 Patrick Samson 2004-04-07 09:06:00 UTC
To fix this bug,
- Add this method in MessageTag.java
    /**
     *  If key is not found, use the body content as a default value.
     */
    public int doAfterBody() throws JspException
    {
        // if the value is null, use the body content
        if ( _value == null ) {
          _value = bodyContent.getString();
        }
        // cleanup
        bodyContent.clearBody();
    	return SKIP_BODY;
    }
- Remove this part from doEndTag() in MessageTag.java
            // if the value is null, use the body content
            if ( _value == null ) {
                _value = bodyContent.getString();
                bodyContent.clear();
            }
Comment 2 Martin Cooper 2004-04-07 18:48:04 UTC
Please supply patches created using 'cvs diff -u'. That makes it much simpler 
for us to apply them. Thanks.
Comment 3 Patrick Samson 2004-06-02 15:02:01 UTC
Created attachment 11729 [details]
MessageTag patch
Comment 4 Felipe Leme 2004-06-04 04:36:51 UTC
Applied changes to CVS, thanks for the patch.
Comment 5 Felipe Leme 2004-06-04 04:46:13 UTC
*** Bug 18523 has been marked as a duplicate of this bug. ***