Beispiel #1
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);
 }
Beispiel #3
0
 protected String getResourceString(String nm) {
   String str;
   try {
     str = resources.getString(nm);
   } catch (MissingResourceException mre) {
     str = null;
   }
   return str;
 }
Beispiel #4
0
 static {
   try {
     properties = new Properties();
     properties.load(Notepad.class.getResourceAsStream("resources/NotepadSystem.properties"));
     resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault());
   } catch (MissingResourceException | IOException e) {
     System.err.println(
         "resources/Notepad.properties " + "or resources/NotepadSystem.properties not found");
     System.exit(1);
   }
 }