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

Specify what exceptions SocketPermission constructor can throw

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 14
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      The specification of the constructor java.net.SocketPermission(String, String) has to be updated to specify that it can throw NullPointerException or IllegalArgumentException.

      Problem

      Currently, the throws section of the constructor is completely omitted. On the other hand, constructors of other subclasses of java.security.Permission (for example, java.io.FilePermission, javax.smartcardio.CardPermission, java.net.URLPermission) do specify what exceptions they can throw.

      Solution

      The constructor SocketPermission(String, String) will be specified to throw IllegalArgumentException if format of the argument host is invalid or if the argument action is empty, malformed or contains unexpected values. It will also be specified that NullPointerException is thrown if any arguments are null.

      Specification

      +     *
      +     * @throws NullPointerException if any parameters are null
      +     * @throws IllegalArgumentException if the format of {@code host} is
      +     *         invalid, or if the {@code action} string is empty, malformed, or
      +     *         contains an action other than the specified possible actions
            */
           public SocketPermission(String host, String action) {

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igerasim Ivan Gerasimov
              Reporter:
              igerasim Ivan Gerasimov
              Reviewed By:
              Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: