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

Missing doPriveleged() {} blocks in Configuration.java

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • None
    • None
    • embedded
    • dio
    • generic
    • generic

    Description

      When trying to open an UART instance, I got the following:

       java.security.AccessControlException: access denied ("java.util.PropertyPermission" "jdk.dio.uart.inputTimeout" "read")

      The problem is:

      UARTImpl.java, constructor is:

          UARTImpl(DeviceDescriptor<UART> dscr, int mode)
                                      throws DeviceNotFoundException, InvalidDeviceConfigException, UnsupportedAccessModeException{
      ...
              inputTimeout = Configuration.getNonNegativeIntProperty("jdk.dio.uart.inputTimeout", 2000);
      ...
      }

      ============

      And this call boils to the following one:

          public static int getIntProperty(String key, int def) {
              String value = System.getProperty(key);
              if (value != null) {
                  try {
                      return Integer.valueOf(value).intValue();
                  } catch (NumberFormatException e) {
                  }
              }
              return def;
          }
      =========================

      Having this code running in limited application security context
      (only declared permissions by the specification are granted to the application,
      and AllPermission is granted to dio classes), we observe a missing doPrigilegedBlock()
      to call System.getProperty() in.

      Attachments

        Activity

          People

            bkvartsk Boris Kvartskhava
            bkvartsk Boris Kvartskhava
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: