Esempio n. 1
0
 protected String getResourceString(String nm) {
   String str;
   try {
     str = resources.getString(nm);
   } catch (MissingResourceException mre) {
     str = null;
   }
   return str;
 }
Esempio n. 2
0
 /**
  * getLocalizedMessage is used to localize the messages being used in exceptions with arguments
  * inserted appropriately.
  */
 public static String getLocalizedMessage(Logger logger, String key, Object[] args) {
   try {
     ResourceBundle rb = logger.getResourceBundle();
     String message = rb.getString(key);
     return MessageFormat.format(message, args);
   } catch (Exception ex) {
     logger.log(Level.FINE, "JTS:Error while localizing the log message");
     return key;
   }
 }
 private void formatrb(
     MLevel l,
     String srcClass,
     String srcMeth,
     String rbname,
     String msg,
     Object[] params,
     Throwable t) {
   ResourceBundle rb = ResourceBundle.getBundle(rbname);
   if (msg != null && rb != null) {
     String check = rb.getString(msg);
     if (check != null) msg = check;
   }
   format(l, srcClass, srcMeth, msg, params, t);
 }