Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7152690

Initialization error with charset SJIS_0213 when security manager is enabled

XMLWordPrintable

    • b17
    • x86
    • windows_7
    • Verified

        FULL PRODUCT VERSION :
        java version "1.7.0_03"
        Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
        Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Java security manager is enabled.

        -Djava.security.manager

        A DESCRIPTION OF THE PROBLEM :
        Charset "x-SJIS_0213" (or "SJIS_0213") fails in its initialization code and throws java.lang.ExceptionInInitializerError when Java security manager is enabled. It looks the implementation tries to load SJIS_0213.dat, but fails to open the resource.

        This issue is not reproducible on

         - Java 6 or earlier releases
         - When security manager is disabled

        REGRESSION. Last worked in version 7


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at sun.nio.cs.AbstractCharsetProvider.lookup(AbstractCharsetProvider.java:142)
        at sun.nio.cs.AbstractCharsetProvider.charsetForName(AbstractCharsetProvider.java:161)
        at java.nio.charset.Charset.lookupExtendedCharset(Charset.java:462)
        at java.nio.charset.Charset.lookup2(Charset.java:487)
        at java.nio.charset.Charset.lookup(Charset.java:475)
        at java.nio.charset.Charset.forName(Charset.java:540)
        at com.ibm.icu.test.CharsetTest.test3(CharsetTest.java:34)
        at com.ibm.icu.test.CharsetTest.main(CharsetTest.java:11)
        Caused by: java.lang.NullPointerException
        at sun.nio.cs.CharsetMapping.load(CharsetMapping.java:308)
        at sun.nio.cs.CharsetMapping$1.run(CharsetMapping.java:140)
        at sun.nio.cs.CharsetMapping$1.run(CharsetMapping.java:138)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.nio.cs.CharsetMapping.get(CharsetMapping.java:138)
        at sun.nio.cs.ext.SJIS_0213.<clinit>(SJIS_0213.java:76)
        ... 10 more

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        Example 1

        byte[] data = {0x41, 0x42};
        String s = new String(data, "x-SJIS_0213");

        Example 2

        Charset cs = Charset.forName("x-SJIS_0213");
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        For some reasons, if I insert a code -

        SortedMap<String, Charset> availableCharset = Charset.availableCharsets();

        before the code causing the issue, the problem is disappeared.

              coffeys Sean Coffey
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: