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

Add isGranted method to SecurityManager

XMLWordPrintable

      There are quite a few places in the JDK that call SecurityManager.checkPermission, catch the SecurityException, and then do something other than propagating the SecurityException, ex:

      try {
          sm.checkPermission(...);
          return true;
      } catch (SecurityException e) {}
          return false;
      }

      For cases like this, to avoid the overhead of throwing and catching the exception, it would be better to have a different checkPermission method that returns a boolean, ex:

      public boolean isGranted(Permission perm)

            mullan Sean Mullan
            mullan Sean Mullan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: