view patches/openjdk/7196533-timezone_bottleneck.patch @ 3018:7d370df4beac

Add dependencies of 8013196 and remove SharedSecrets fragment of 8013196 which causes a TCK regression. 2013-08-05 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (ICEDTEA_PATCHES): Add new patches. * patches/openjdk/6636331-appcontext_concurrentmodificationexception.patch, * patches/openjdk/6636370-appcontext_simplification.patch, * patches/openjdk/7196533-timezone_bottleneck.patch: Backport additional patches which relate to changes in 8013196. * patches/openjdk/8013196-TimeZone_getDefault_throws_exception.patch: Drop SharedSecrets changes which cause a TCK regression.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Thu, 29 Aug 2013 16:14:55 +0100
parents
children dfef77966f7c
line wrap: on
line source

diff -Nru openjdk.orig/jdk/src/share/classes/java/util/TimeZone.java openjdk/jdk/src/share/classes/java/util/TimeZone.java
--- openjdk.orig/jdk/src/share/classes/java/util/TimeZone.java	2012-10-26 19:25:53.000000000 +0100
+++ openjdk/jdk/src/share/classes/java/util/TimeZone.java	2013-08-05 14:46:18.022264343 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -646,9 +646,15 @@
      * Returns the default TimeZone in an AppContext if any AppContext
      * has ever used. null is returned if any AppContext hasn't been
      * used or if the AppContext doesn't have the default TimeZone.
+     *
+     * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
+     * been loaded. If so, it implies that AWTSecurityManager is not our
+     * SecurityManager and we can use a local static variable.
+     * This works around a build time issue.
      */
-    private synchronized static TimeZone getDefaultInAppContext() {
-        javaAWTAccess = SharedSecrets.getJavaAWTAccess();
+    private static TimeZone getDefaultInAppContext() {
+        // JavaAWTAccess provides access implementation-private methods without using reflection.
+        JavaAWTAccess javaAWTAccess = SharedSecrets.getJavaAWTAccess();
         if (javaAWTAccess == null) {
             return mainAppContextDefault;
         } else {
@@ -670,9 +676,15 @@
      * tz. null is handled special: do nothing if any AppContext
      * hasn't been used, remove the default TimeZone in the
      * AppContext otherwise.
+     *
+     * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
+     * been loaded. If so, it implies that AWTSecurityManager is not our
+     * SecurityManager and we can use a local static variable.
+     * This works around a build time issue.
      */
-    private synchronized static void setDefaultInAppContext(TimeZone tz) {
-        javaAWTAccess = SharedSecrets.getJavaAWTAccess();
+    private static void setDefaultInAppContext(TimeZone tz) {
+        // JavaAWTAccess provides access implementation-private methods without using reflection.
+        JavaAWTAccess javaAWTAccess = SharedSecrets.getJavaAWTAccess();
         if (javaAWTAccess == null) {
             mainAppContextDefault = tz;
         } else {
@@ -736,18 +748,8 @@
     static final String         GMT_ID        = "GMT";
     private static final int    GMT_ID_LENGTH = 3;
 
-    /*
-     * Provides access implementation-private methods without using reflection
-     *
-     * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't
-     * been loaded. If so, it implies that AWTSecurityManager is not our
-     * SecurityManager and we can use a local static variable.
-     * This works around a build time issue.
-     */
-    private static JavaAWTAccess javaAWTAccess;
-
     // a static TimeZone we can reference if no AppContext is in place
-    private static TimeZone mainAppContextDefault;
+    private static volatile TimeZone mainAppContextDefault;
 
 
     /**