jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java
changeset 11130 c7093e306a34
parent 9025 a72fc1fc4b71
child 11986 6f383069eb6d
--- a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Fri Dec 02 19:33:54 2011 -0500
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Sat Dec 03 10:58:19 2011 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -573,7 +573,7 @@
 
     synchronized static ZoneInfo addToCache(String id, ZoneInfo zi) {
         if (zoneInfoObjects == null) {
-            zoneInfoObjects = new HashMap<String, ZoneInfo>();
+            zoneInfoObjects = new HashMap<>();
         } else {
             ZoneInfo zone = zoneInfoObjects.get(id);
             if (zone != null) {
@@ -758,7 +758,7 @@
                 case TAG_ZoneIDs:
                     {
                         int n = (buf[index++] << 8) + (buf[index++] & 0xFF);
-                        ids = new ArrayList<String>(n);
+                        ids = new ArrayList<>(n);
 
                         for (int i = 0; i < n; i++) {
                             byte m = buf[index++];
@@ -777,7 +777,7 @@
             System.err.println("ZoneInfo: corrupted " + JAVAZM_FILE_NAME);
         }
 
-        zoneIDs = new SoftReference<List<String>>(ids);
+        zoneIDs = new SoftReference<>(ids);
         return ids;
     }
 
@@ -802,7 +802,7 @@
                 case TAG_ZoneAliases:
                     {
                         int n = (buf[index++] << 8) + (buf[index++] & 0xFF);
-                        aliases = new HashMap<String, String>(n);
+                        aliases = new HashMap<>(n);
                         for (int i = 0; i < n; i++) {
                             byte m = buf[index++];
                             String name = new String(buf, index, m, "UTF-8");
@@ -865,7 +865,7 @@
                 case TAG_ExcludedZones:
                     {
                         int n = (buf[index++] << 8) + (buf[index++] & 0xFF);
-                        excludeList = new ArrayList<String>();
+                        excludeList = new ArrayList<>();
                         for (int i = 0; i < n; i++) {
                             byte m = buf[index++];
                             String name = new String(buf, index, m, "UTF-8");
@@ -886,7 +886,7 @@
         }
 
         if (excludeList != null) {
-            excludedIDs = new SoftReference<List<String>>(excludeList);
+            excludedIDs = new SoftReference<>(excludeList);
         } else {
             hasNoExcludeList = true;
         }
@@ -935,7 +935,7 @@
             System.err.println("ZoneInfo: corrupted " + JAVAZM_FILE_NAME);
         }
 
-        rawOffsetIndices = new SoftReference<byte[]>(indices);
+        rawOffsetIndices = new SoftReference<>(indices);
         return indices;
     }
 
@@ -986,7 +986,7 @@
             System.err.println("ZoneInfo: corrupted " + JAVAZM_FILE_NAME);
         }
 
-        rawOffsets = new SoftReference<int[]>(offsets);
+        rawOffsets = new SoftReference<>(offsets);
         return offsets;
     }
 
@@ -1022,7 +1022,7 @@
             return null;
         }
 
-        zoneInfoMappings = new SoftReference<byte[]>(data);
+        zoneInfoMappings = new SoftReference<>(data);
         return data;
     }
 
@@ -1034,8 +1034,8 @@
         byte[] buffer = null;
 
         try {
-            buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
+            buffer = AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
+                public byte[] run() throws IOException {
                     File file = new File(ziDir, fileName);
                     if (!file.exists() || !file.isFile()) {
                         return null;
@@ -1068,4 +1068,7 @@
         }
         return buffer;
     }
+
+    private ZoneInfoFile() {
+    }
 }