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

StaticProxySelector.select should not throw NullPointerExceptions

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 22
    • core-libs
    • None
    • behavioral
    • low
    • Some users might observe a different exception types thrown from `select` call; `connectFailed` is not normally used from user code.
    • Java API
    • Implementation

      Summary

      Change the exception types thrown by ProxySelector instances returned by ProxySelector.of(InetSocketAddress) to match the exception specification.

      Problem

      ProxySelector methods select and connectFailed are documented to validate their parameters and throw an IllegalArgumentException when called with null arguments. The DefaultProxySelector class conforms to that specification, but the ProxySelector instances returned by ProxySelector.of do not (they either ignore null parameters or throw NullPointerException instead).

      Solution

      Modify the ProxySelector subclass used by ProxySelector.of to conform to the specification, i.e. modify select method to throw an IllegalArgumentException instead of a NullPointerException on null parameter, and modify connectFailed to throw an IllegalArgumentException on null parameter instead of ignoring the parameters.

      Specification

      No changes to specification.

            djelinski Daniel Jelinski
            djelinski Daniel Jelinski
            Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: