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

Locale data loading fails silently when running with a security manager

XMLWordPrintable

    • b111
    • 9
    • b113
    • Verified

      This is a regression in jdk-9+111 that breaks Lucene, see this thread:

      http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-March/039730.html

      It is submitted to core-lib/java.util:i18n rather than java.text as it seems likely that sun.util.locale.provider.ResourceBundleProviderSupport will need changes.

      The issue can be duplicate with this Uwe provided test:

      import java.text. BreakIterator;
      import java.util.Locale;
      public class Test {
          public static void main(String[] args) throws Exception {
              BreakIterator proto = BreakIterator.getWordInstance(new Locale("th"));
              proto.setText("ภาษาไทย");
              System.out.println(proto.isBoundary(4));
          }
      }

      If run with -Djava.security.manager and -Djava.security.auth.debug set to debug permission denied then we see the following stack trace where RuntimePermission("getClassLoader") is denied:

      Stack trace
      at java.lang.Thread.dumpStack(java.base@9-internal/Thread.java:1391)
      at java.security.AccessControlContext.checkPermission(java.base@9-internal/AccessControlContext.java:458)
      at java.security.AccessController.checkPermission(java.base@9-internal/AccessController.java:894)
      at java.lang.SecurityManager.checkPermission(java.base@9-internal/SecurityManager.java:541)
      at java.lang.Class.forName(java.base@9-internal/Class.java:443)
      at sun.util.locale.provider.ResourceBundleProviderSupport.loadResourceBundle(java.base@9-internal/ResourceBundleProviderSupport.java:68)
      at sun.util.resources.provider.LocaleDataProvider.getBundle(jdk.localedata@9-internal/LocaleDataProvider.java:55)
      at sun.util.resources.Bundles$2.run(java.base@9-internal/Bundles.java:256)
      at sun.util.resources.Bundles$2.run(java.base@9-internal/Bundles.java:251)
      at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
      at sun.util.resources.Bundles.loadBundleFromProviders(java.base@9-internal/Bundles.java:250)
      at sun.util.resources.Bundles.findBundleOf(java.base@9-internal/Bundles.java:203)
      at sun.util.resources.Bundles.loadBundleOf(java.base@9-internal/Bundles.java:147)
      at sun.util.resources.Bundles.of(java.base@9-internal/Bundles.java:108)
      at sun.util.resources.LocaleData$1.run(java.base@9-internal/LocaleData.java:177)
      at sun.util.resources.LocaleData$1.run(java.base@9-internal/LocaleData.java:174)
      at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
      at sun.util.resources.LocaleData.getBundle(java.base@9-internal/LocaleData.java:174)
      at sun.util.resources.LocaleData.getBreakIteratorInfo(java.base@9-internal/LocaleData.java:122)
      at sun.util.locale.provider.LocaleResources.getBreakIteratorInfo(java.base@9-internal/LocaleResources.java:114)
      at sun.util.locale.provider.BreakIteratorProviderImpl.getBreakInstance(java.base@9-internal/BreakIteratorProviderImpl.java:162)
      at sun.util.locale.provider.BreakIteratorProviderImpl.getWordInstance(java.base@9-internal/BreakIteratorProviderImpl.java:86)
      at java.text.BreakIterator.createBreakInstance(java.base@9-internal/BreakIterator.java:568)
      at java.text.BreakIterator.createBreakInstance(java.base@9-internal/BreakIterator.java:553)
      at java.text.BreakIterator.getBreakInstance(java.base@9-internal/BreakIterator.java:544)
      at java.text.BreakIterator.getWordInstance(java.base@9-internal/BreakIterator.java:459)
      at Main.main(Main.java:20)

            okutsu Masayoshi Okutsu
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: