< prev index next >

src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java

Print this page




 235         { "JST", "Asia/Tokyo" },
 236         { "MIT", "Pacific/Apia" },
 237         { "NET", "Asia/Yerevan" },
 238         { "NST", "Pacific/Auckland" },
 239         { "PLT", "Asia/Karachi" },
 240         { "PNT", "America/Phoenix" },
 241         { "PRT", "America/Puerto_Rico" },
 242         { "PST", "America/Los_Angeles" },
 243         { "SST", "Pacific/Guadalcanal" },
 244         { "VST", "Asia/Ho_Chi_Minh" },
 245     };
 246 
 247     static {
 248         String oldmapping = GetPropertyAction
 249                 .privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
 250                 .toLowerCase(Locale.ROOT);
 251         USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
 252         AccessController.doPrivileged(new PrivilegedAction<Void>() {
 253             public Void run() {
 254                 try {
 255                     String libDir = System.getProperty("java.home") + File.separator + "lib";




 256                     try (DataInputStream dis = new DataInputStream(
 257                              new BufferedInputStream(new FileInputStream(
 258                                  new File(libDir, "tzdb.dat"))))) {
 259                         load(dis);
 260                     }
 261                 } catch (Exception x) {
 262                     throw new Error(x);
 263                 }
 264                 return null;
 265             }
 266         });
 267     }
 268 
 269     private static void addOldMapping() {
 270         for (String[] alias : oldMappings) {
 271             aliases.put(alias[0], alias[1]);
 272         }
 273         if (USE_OLDMAPPING) {
 274             aliases.put("EST", "America/New_York");
 275             aliases.put("MST", "America/Denver");
 276             aliases.put("HST", "Pacific/Honolulu");
 277         } else {
 278             zones.put("EST", new ZoneInfo("EST", -18000000));




 235         { "JST", "Asia/Tokyo" },
 236         { "MIT", "Pacific/Apia" },
 237         { "NET", "Asia/Yerevan" },
 238         { "NST", "Pacific/Auckland" },
 239         { "PLT", "Asia/Karachi" },
 240         { "PNT", "America/Phoenix" },
 241         { "PRT", "America/Puerto_Rico" },
 242         { "PST", "America/Los_Angeles" },
 243         { "SST", "Pacific/Guadalcanal" },
 244         { "VST", "Asia/Ho_Chi_Minh" },
 245     };
 246 
 247     static {
 248         String oldmapping = GetPropertyAction
 249                 .privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
 250                 .toLowerCase(Locale.ROOT);
 251         USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
 252         AccessController.doPrivileged(new PrivilegedAction<Void>() {
 253             public Void run() {
 254                 try {
 255                     String pathToRules = System.getProperty("jdk.time.tzdbfile");
 256                     if (pathToRules == null) {
 257                         pathToRules = System.getProperty("java.home") + File.separator +
 258                             "lib" +  File.separator + "tzdb.dat";
 259             }
 260                     try (DataInputStream dis = new DataInputStream(
 261                              new BufferedInputStream(new FileInputStream(
 262                                  new File(pathToRules))))) {
 263                         load(dis);
 264                     }
 265                 } catch (Exception x) {
 266                     throw new Error(x);
 267                 }
 268                 return null;
 269             }
 270         });
 271     }
 272 
 273     private static void addOldMapping() {
 274         for (String[] alias : oldMappings) {
 275             aliases.put(alias[0], alias[1]);
 276         }
 277         if (USE_OLDMAPPING) {
 278             aliases.put("EST", "America/New_York");
 279             aliases.put("MST", "America/Denver");
 280             aliases.put("HST", "Pacific/Honolulu");
 281         } else {
 282             zones.put("EST", new ZoneInfo("EST", -18000000));


< prev index next >