コード例 #1
0
ファイル: EventFormatter.java プロジェクト: chikoski/sqs
 /**
  * Formats an event using a given locale.
  *
  * @param event the event
  * @param locale the locale
  * @return the formatted message
  */
 public static String format(Event event, Locale locale) {
   ResourceBundle bundle = null;
   String groupID = event.getEventGroupID();
   if (groupID != null) {
     try {
       bundle =
           XMLResourceBundle.getXMLBundle(groupID, locale, EventFormatter.class.getClassLoader());
     } catch (MissingResourceException mre) {
       if (log.isTraceEnabled()) {
         log.trace("No XMLResourceBundle for " + groupID + " available.");
       }
     }
   }
   if (bundle == null) {
     bundle =
         XMLResourceBundle.getXMLBundle(
             EventFormatter.class.getName(), locale, EventFormatter.class.getClassLoader());
   }
   return format(event, bundle);
 }
コード例 #2
0
ファイル: EventFormatter.java プロジェクト: chikoski/sqs
 /**
  * Formats an event using the default locale.
  *
  * @param event the event
  * @return the formatted message
  */
 public static String format(Event event) {
   ResourceBundle bundle = null;
   String groupID = event.getEventGroupID();
   if (groupID != null) {
     try {
       bundle = XMLResourceBundle.getXMLBundle(groupID, EventFormatter.class.getClassLoader());
     } catch (MissingResourceException mre) {
       throw new IllegalStateException("No XMLResourceBundle for " + groupID + " available.");
     }
   }
   return format(event, bundle);
 }