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

URLPermission not handling empty method lists correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • core-libs
    • b125
    • Verified

      URLPermission p1 = new URLPermission("wss://www.foo.com/-", ":X-Foo");
      URLPermission p2 = new URLPermission("wss://www.foo.com/", "");
      System.out.println(p1.implies(p2));

      results in:

      $ java Test
      Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.rangeCheck(ArrayList.java:658)
      at java.util.ArrayList.get(ArrayList.java:431)
      at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
      at java.net.URLPermission.implies(URLPermission.java:267)
      at Test.main(Test.java:9)

      It's not expecting an empty list of methods in the policy permission (p1 in the example).

      An empty list in the policy to be consistent with the spec should only imply a permission with an empty list.

            vtewari Vyom Tewari
            michaelm Michael McMahon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: