8038451: Incorrect initialization order of static fields in sun.nio.cs.ext.JISAutoDetect$Decoder
authormchung
Thu, 27 Mar 2014 17:11:28 -0700
changeset 23587 55ccc7b19f84
parent 23586 bb12b5f40a86
child 23588 b0269b21e313
8038451: Incorrect initialization order of static fields in sun.nio.cs.ext.JISAutoDetect$Decoder Reviewed-by: alanb, sherman
jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java
--- a/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java	Thu Mar 27 13:42:39 2014 +0000
+++ b/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java	Thu Mar 27 17:11:28 2014 -0700
@@ -117,6 +117,8 @@
     }
 
     private static class Decoder extends CharsetDecoder {
+        private final static String osName = AccessController.doPrivileged(
+            (PrivilegedAction<String>) () -> System.getProperty("os.name"));
 
         private final static String SJISName = getSJISName();
         private final static String EUCJPName = getEUCJPName();
@@ -239,8 +241,6 @@
             return ((CharsetDecoder) detectedDecoder).charset();
         }
 
-        private static final String osName = AccessController.doPrivileged(
-            (PrivilegedAction<String>) () -> System.getProperty("os.name"));
 
         /**
          * Returned Shift_JIS Charset name is OS dependent