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

SocketPermission and FilePermission action list allows leading comma

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • security-libs
    • b20
    • Verified

      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.

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

              Created:
              Updated:
              Resolved: