src/share/classes/sun/rmi/rmic/newrmic/Resources.java

Print this page




  52         try {
  53             resourcesExt =
  54                 ResourceBundle.getBundle("sun.rmi.rmic.resources.rmicext");
  55         } catch (MissingResourceException e) {
  56             // OK if this isn't found
  57         }
  58     }
  59 
  60     private Resources() { throw new AssertionError(); }
  61 
  62     /**
  63      * Returns the text of the rmic resource for the specified key
  64      * formatted with the specified arguments.
  65      **/
  66     public static String getText(String key, String... args) {
  67         String format = getString(key);
  68         if (format == null) {
  69             format = "missing resource key: key = \"" + key + "\", " +
  70                 "arguments = \"{0}\", \"{1}\", \"{2}\"";
  71         }
  72         return MessageFormat.format(format, args);
  73     }
  74 
  75     /**
  76      * Returns the rmic resource string for the specified key.
  77      **/
  78     private static String getString(String key) {
  79         if (resourcesExt != null) {
  80             try {
  81                 return resourcesExt.getString(key);
  82             } catch (MissingResourceException e) {
  83             }
  84         }
  85         if (resources != null) {
  86             try {
  87                 return resources.getString(key);
  88             } catch (MissingResourceException e) {
  89                 return null;
  90             }
  91         }
  92         return "missing resource bundle: key = \"" + key + "\", " +


  52         try {
  53             resourcesExt =
  54                 ResourceBundle.getBundle("sun.rmi.rmic.resources.rmicext");
  55         } catch (MissingResourceException e) {
  56             // OK if this isn't found
  57         }
  58     }
  59 
  60     private Resources() { throw new AssertionError(); }
  61 
  62     /**
  63      * Returns the text of the rmic resource for the specified key
  64      * formatted with the specified arguments.
  65      **/
  66     public static String getText(String key, String... args) {
  67         String format = getString(key);
  68         if (format == null) {
  69             format = "missing resource key: key = \"" + key + "\", " +
  70                 "arguments = \"{0}\", \"{1}\", \"{2}\"";
  71         }
  72         return MessageFormat.format(format, (Object[]) args);
  73     }
  74 
  75     /**
  76      * Returns the rmic resource string for the specified key.
  77      **/
  78     private static String getString(String key) {
  79         if (resourcesExt != null) {
  80             try {
  81                 return resourcesExt.getString(key);
  82             } catch (MissingResourceException e) {
  83             }
  84         }
  85         if (resources != null) {
  86             try {
  87                 return resources.getString(key);
  88             } catch (MissingResourceException e) {
  89                 return null;
  90             }
  91         }
  92         return "missing resource bundle: key = \"" + key + "\", " +