test/java/util/TimeZone/OldIDMappingTest.java

Print this page

        

@@ -49,21 +49,11 @@
             useOldMapping = true;
         } else {
             throw new RuntimeException("-old or -new must be specified; got " + arg);
         }
 
-        // Get a Field for TzIDOldMapping in sun.util.calendar.
-        Map<String, String> oldmap = null;
-        try {
-            Class<?> oldmapClass = Class.forName("sun.util.calendar.TzIDOldMapping");
-            Field map = oldmapClass.getDeclaredField("MAP");
-            map.setAccessible(true);
-            oldmap = (Map<String, String>) map.get(null);
-        } catch (Exception e) {
-            throw new RuntimeException("can't get TzIDOldMapping.MAP", e);
-        }
-
+        Map<String, String> oldmap = TzIDOldMapping.MAP;
         String prop = System.getProperty(MAPPING_PROPERTY_NAME);
         System.out.println(MAPPING_PROPERTY_NAME + "=" + prop);
 
         // Try the test multiple times with modifying TimeZones to
         // make sure TimeZone instances for the old mapping are