changeset 25659:14764f69ed82

8050968: Extension class loader initialization fails on Win7 x64 zh_TW Reviewed-by: alanb, dholmes, sherman
author mchung
date Fri, 18 Jul 2014 10:40:55 -0700
parents 7a6a01c13279
children 01fa3ccedf50
files jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java	Fri Jul 18 08:54:28 2014 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java	Fri Jul 18 10:40:55 2014 -0700
@@ -1173,8 +1173,7 @@
         if (!sun.misc.VM.isBooted())
             return;
 
-        String map = AccessController.doPrivileged(
-            (PrivilegedAction<String>) () -> System.getProperty("sun.nio.cs.map"));
+        String map = getProperty("sun.nio.cs.map");
         boolean sjisIsMS932 = false;
         boolean iso2022jpIsMS50221 = false;
         boolean iso2022jpIsMS50220 = false;
@@ -1294,8 +1293,7 @@
 
             }
         }
-        String osName = AccessController.doPrivileged(
-            (PrivilegedAction<String>) () -> System.getProperty("os.name"));
+        String osName = getProperty("os.name");
         if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName)
                || osName.contains("OS X")) {
             charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
@@ -1308,6 +1306,18 @@
         initialized = true;
     }
 
+    private static String getProperty(String key) {
+        // this method may be called during initialization of
+        // system class loader and thus not using lambda
+        return AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override
+                public String run() {
+                    return System.getProperty(key);
+                }
+            });
+    }
+
     public static String[] aliasesFor(String charsetName) {
         if (instance == null)
             return null;