JDK-8231805 : Specify what exceptions SocketPermission constructor can throw
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.net
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 14
  • Submitted: 2019-10-03
  • Updated: 2019-10-15
  • Resolved: 2019-10-15
Related Reports
CSR :  
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) {


Comments
Moving to Approved.
15-10-2019

Moving updated request back to Provisional.
05-10-2019

Moving to Provisional.
03-10-2019