billbarker    2004/05/09 13:02:08

  Modified:    util/java/org/apache/tomcat/util/res StringManager.java
  Log:
  Change to use MessageFormat.setLocale, instead of the JDK 1.4 constructor.
  
  This has the additional benefit of setting the Locale of the error message correctly 
all the way back to JDK 1.1.6 :).
  
  Revision  Changes    Path
  1.6       +6 -5      
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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StringManager.java        8 May 2004 22:05:11 -0000       1.5
  +++ StringManager.java        9 May 2004 20:02:08 -0000       1.6
  @@ -22,8 +22,6 @@
   import java.util.MissingResourceException;
   import java.util.ResourceBundle;
   
  -import org.apache.tomcat.util.compat.JdkCompat;
  -
   /**
    * An internationalization / localization helper class which reduces
    * the bother of handling ResourceBundles and takes care of the
  @@ -53,12 +51,12 @@
   
   public class StringManager {
   
  -    private static JdkCompat jdkcompat = JdkCompat.getJdkCompat();
       /**
        * The ResourceBundle for this StringManager.
        */
   
       private ResourceBundle bundle;
  +    private Locale locale;
   
       /**
        * Creates a new StringManager for a given package. This is a
  @@ -74,10 +72,12 @@
       }
   
       private StringManager(String packageName,Locale loc) {
  +        locale = loc;
           String bundleName = packageName + ".LocalStrings";
           try {
               bundle = ResourceBundle.getBundle(bundleName,loc);
           } catch( MissingResourceException ex ) {
  +            locale = Locale.US;
               bundle= ResourceBundle.getBundle( bundleName, Locale.US);
           }
       }
  @@ -157,7 +157,8 @@
                   }
               }
               if( value==null ) value=key;
  -         MessageFormat mf = jdkcompat.getMessageFormat(value, bundle.getLocale());
  +         MessageFormat mf = new MessageFormat(value);
  +            mf.setLocale(locale);
               iString = mf.format(nonNullArgs, new StringBuffer(), null).toString();
           } catch (IllegalArgumentException iae) {
               StringBuffer buf = new StringBuffer();
  
  
  

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

Reply via email to