示例#1
0
 /**
  * For each Hijrah variant listed, create the HijrahChronology and register it. Exceptions during
  * initialization are logged but otherwise ignored.
  */
 private static void registerVariants() {
   for (String name : calendarProperties.stringPropertyNames()) {
     if (name.startsWith(PROP_PREFIX)) {
       String id = name.substring(PROP_PREFIX.length());
       if (id.indexOf('.') >= 0) {
         continue; // no name or not a simple name of a calendar
       }
       if (id.equals(INSTANCE.getId())) {
         continue; // do not duplicate the default
       }
       try {
         // Create and register the variant
         HijrahChronology chrono = new HijrahChronology(id);
         AbstractChronology.registerChrono(chrono);
       } catch (DateTimeException ex) {
         // Log error and continue
         PlatformLogger logger = PlatformLogger.getLogger("j86.java.time.chrono");
         logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
       }
     }
   }
 }