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

SocketPermission and FilePermission action list allows leading comma

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 14
    • Fix Version/s: 14
    • Component/s: security-libs
    • Labels:
    • Resolved In Build:
      b20
    • Verification:
      Verified

      Description

      The constructor of SocketPermission(String host, String action) expects the action argument to be a comma-separated list of possible actions, like connect, accept, listen, resolve.
      The string must contain at least one action and is allowed to contain white spaces, which are ignored.

      It turns out that if the string is immediately started with a comma, the argument is parsed Okay.

      new SocketPermission("localhost", " , connect, accept"); <<-- throws IllegalArgumentException: invalid permission: , connect, accept

      new SocketPermission("localhost", ", connect, accept"); <<-- does not throw

      It would be better to make parsing more consistent.

      Also, it may be a good idea to update the javadoc and specify the possible exceptions to be thrown.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igerasim Ivan Gerasimov
              Reporter:
              igerasim Ivan Gerasimov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: