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

Permissions effectively ignores latecomer UnresolvedPermissions

    XMLWordPrintable

    Details

      Description

      The Permissions class effectively ignores UnresolvedPermissions for a given class that are added after an actual instance of the class is added or passed to implies. Demonstrated with this test program:

      import java.security.*;

      public class Test {

          public static class FooPermission extends BasicPermission {
      public FooPermission(String name) {
      super(name);
      }
          }

          public static void main(String[] args) throws Exception {
      Permissions pc = new Permissions();
      pc.add(new FooPermission("foo"));
      pc.add(new UnresolvedPermission(FooPermission.class.getName(),
      "bar", null, null));
      if (!pc.implies(new FooPermission("bar"))) {
      System.out.println("first test failed");
      }
      pc = new Permissions();
      pc.add(new UnresolvedPermission(FooPermission.class.getName(),
      "foo", null, null));
      if (!pc.implies(new FooPermission("foo"))) {
      throw new RuntimeException("oops");
      }
      pc.add(new UnresolvedPermission(FooPermission.class.getName(),
      "bar", null, null));
      if (!pc.implies(new FooPermission("bar"))) {
      System.out.println("second test failed");
      }
          }

      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              weijun Weijun Wang
              Reporter:
              bscheiflsunw Bob Scheifler (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: