Summary: | BundleTag keep the first Locale found for subsequent sessions | ||
---|---|---|---|
Product: | Taglibs | Reporter: | Patrick Samson <p_samson> |
Component: | I18N Taglib | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | johann.uhrmann |
Priority: | P3 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | BundleTag patch |
Description
Patrick Samson
2003-03-31 15:01:51 UTC
I've experienced the same problem. It's caused by tag pooling (we're using tomcat 4.1, it doesn't happen in tomcat 3.3), the bundle tag does not reset its state at the end of a request, keeping the _locale set to the value it had at the end of the first request. I fixed it for us by adding a call to the release() method at the end of the doEndTag() method. Thanks Gareth for your comments. Even if it works, I don't believe that a call to release() is the correct design. As I suggested in my report, I'm convinced that _locale should not be set in findBundle(). My implemented and working fix in findBundle() is : // Add a local variable to keep _locale unchanged. // Replace any further reference to _locale by this new variable // in this method. Locale locale = _locale; Additional note: I had to create my own version of the i18n library to fix this bug. I don't want to blame anyone but I expected an action and there is none, more than 2 months after the opening. It's the same for my other bugs #18521, 18523 and 18524. Just wonder if anybody is taking care of this library. tdawson seems dead. Please inform the community :) Additional fix: Because of the reuse mecanism, any internal member variable has to be initialized. So add this code at the very beginning of doStartTag() in BundleTag.java // initialize internal member variables _bundle = null; This will fix a MissingResourceException on a MessageTag after a session time-out. Note: to confirm my previous fix, member variables associated with attributes (such as _locale) must be read-only in the tag processing. Only the JSP container is allowed to write them through setXXX() methods. Created attachment 11730 [details]
BundleTag patch
Patrick, >I don't want to blame anyone but I expected an action and there is none, more >than 2 months after the opening. It's the same for my other bugs #18521, 18523 >and 18524. >Just wonder if anybody is taking care of this library. tdawson seems dead. The I18N is not "dead", but most of its features were made obsolete by JSTL's Format taglib. >Please inform the community :) Yes, we might be creating a new category for obsolete taglibs. Anyway, I have applied your fixes. Thanks. |