You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/09/30 12:11:27 UTC

DO NOT REPLY [Bug 10897] - PropertyMessageResources loading resources from the wrong ClassLoader

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10897>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10897

PropertyMessageResources loading resources from the wrong ClassLoader





------- Additional Comments From l.cotonea@cross-systems.com  2002-09-30 10:11 -------
So i think that it must be important that ResourceBundle can reload file. Why?
Because when i use <bean:message ... /> tag to internationalize my site, and i
make a modification in a propertie file, the modification isn't done in the site.

To reload ResourceBundle, there is no "clean" method. We must used reflection:

    Class klass =   
ResourceBundle.getBundle("mesProperties").getClass().getSuperclass();
    Field field = null;
    try {
      field = klass.getDeclaredField("cacheList");
    } catch (NoSuchFieldException noSuchFieldEx) {
      System.err.println(this.getClass().getName()+" : "
        +noSuchFieldEx.getMessage());
    }
    field.setAccessible(true);  // autoriser l'acc�s au cache
    SoftCache cache = null;
    try {
      cache = (SoftCache)field.get(null);
    } catch (IllegalAccessException illegalAccessEx) {
      System.err.println(this.getClass().getName()+" : "
        +illegalAccessEx.getMessage());
    }
    cache.clear();
    field.setAccessible(false);   // Ne pas oublier de refuser l'acc�s

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>