luehe       2004/05/11 15:11:01

  Modified:    util/java/org/apache/tomcat/util/res StringManager.java
  Log:
  - Need to determine the *actual* locale by calling getLocale() on the
    resource bundle that was retrieved. This locale may be different from the
    locale that was requested. In the "worst" case (ie., if
    "LocalStrings.properties" was the best match for the requested locale,
    getLocale() will return the empty locale.
  
  - The try/catch (for MissingResourceException) seems to be redundant, as
    "LocalStrings.properties" will be matched in the "worst" case.
  
  Revision  Changes    Path
  1.7       +6 -9      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/res/StringManager.java
  
  Index: StringManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/res/StringManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StringManager.java        9 May 2004 20:02:08 -0000       1.6
  +++ StringManager.java        11 May 2004 22:11:01 -0000      1.7
  @@ -71,20 +71,17 @@
        this( packageName, Locale.getDefault() );
       }
   
  -    private StringManager(String packageName,Locale loc) {
  -        locale = loc;
  +    private StringManager(String packageName, Locale loc) {
           String bundleName = packageName + ".LocalStrings";
  -        try {
  -            bundle = ResourceBundle.getBundle(bundleName,loc);
  -        } catch( MissingResourceException ex ) {
  -            locale = Locale.US;
  -            bundle= ResourceBundle.getBundle( bundleName, Locale.US);
  -        }
  +        bundle = ResourceBundle.getBundle(bundleName, loc);
  +        // Get the actual locale, which may be different from the requested one
  +        locale = bundle.getLocale();
       }
   
       private StringManager(ResourceBundle bundle )
       {
        this.bundle=bundle;
  +        locale = bundle.getLocale();
       }
   
       /**
  
  
  

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

Reply via email to