Harmony
  1. Harmony
  2. HARMONY-6475

[classlib][nio] - Selector.open() throw AccessControlException when SecurityManager is installed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M13
    • Fix Version/s: 5.0M15
    • Component/s: Classlib
    • Labels:
      None

      Description

      test:
      SecurityManager manager = new SecurityManager();
      System.setSecurityManager(manager);
      Selector selector = Selector.open();

      got error:

      Uncaught exception in main:
      java.lang.ExceptionInInitializerError
      at java.lang.ClassLoader.getResources(ClassLoader.java:236)
      at java.nio.channels.spi.SelectorProvider.loadProviderByJar(SelectorProvider.java:120)
      at java.nio.channels.spi.SelectorProvider.provider(SelectorProvider.java:93)
      at java.nio.channels.Selector.open(Selector.java:48)
      at Test.main(Test.java:138)
      Caused by: java.security.AccessControlException: Permission check failed (java.util.PropertyPermission vm.boot.class.path read)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:132)
      at java.security.AccessController.checkPermission(AccessController.java:194)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:862)
      at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:450)
      at java.lang.System.getProperty(System.java:159)
      at java.lang.ClassLoader$BootstrapLoader.<clinit>(ClassLoader.java:758)
      at java.lang.ClassLoader.getResources(ClassLoader.java:236)
      ... 4 more

        Activity

        Hide
        Regis Xu added a comment -

        It looks like some code should be run in privileges mode:

        at java.lang.ClassLoader$BootstrapLoader.<clinit>(ClassLoader.java:758)

        at java.lang.ClassLoader$BootstrapLoader.findResources(ClassLoader.java:781)

        at java.lang.ClassLoader.<init>(ClassLoader.java:136)

        at org.apache.harmony.nio.internal.PipeImpl$SinkChannelImpl.finishConnect(PipeImpl.java:164)

        Show
        Regis Xu added a comment - It looks like some code should be run in privileges mode: at java.lang.ClassLoader$BootstrapLoader.<clinit>(ClassLoader.java:758) at java.lang.ClassLoader$BootstrapLoader.findResources(ClassLoader.java:781) at java.lang.ClassLoader.<init>(ClassLoader.java:136) at org.apache.harmony.nio.internal.PipeImpl$SinkChannelImpl.finishConnect(PipeImpl.java:164)
        Hide
        Regis Xu added a comment -

        The patch run some code in privileged mode, and also fix SocketChannelImpl.SocketAdapter.isConnected() to test supper's isConnected(), because channel and socket's status may not be consistent.

        Show
        Regis Xu added a comment - The patch run some code in privileged mode, and also fix SocketChannelImpl.SocketAdapter.isConnected() to test supper's isConnected(), because channel and socket's status may not be consistent.
        Hide
        Regis Xu added a comment -

        Applied the fix and test case at r981356.

        Show
        Regis Xu added a comment - Applied the fix and test case at r981356.
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #913 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/913/)
        Fix for HARMONY-6475: [classlib][nio] - Selector.open() throw AccessControlException when SecurityManager is installed

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #913 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/913/ ) Fix for HARMONY-6475 : [classlib] [nio] - Selector.open() throw AccessControlException when SecurityManager is installed
        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #79 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/79/)
        Fix for HARMONY-6475: [classlib][nio] - Selector.open() throw AccessControlException when SecurityManager is installed

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #79 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/79/ ) Fix for HARMONY-6475 : [classlib] [nio] - Selector.open() throw AccessControlException when SecurityManager is installed

          People

          • Assignee:
            Regis Xu
            Reporter:
            Regis Xu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development