RFR: 8169068: Add a new method: java.net.Authenticator.getDefault()

Chris Hegarty chris.hegarty at oracle.com
Thu Nov 3 14:40:34 UTC 2016


Daniel,

On 03/11/16 10:20, Daniel Fuchs wrote:
> Hi,
>
> Please find below a patch for:
>
> RFR: 8169068: Add a new method: java.net.Authenticator.getDefault()
> https://bugs.openjdk.java.net/browse/JDK-8169068
 >
> The method implementation itself is trivial.
> The API documentation is derived from that of Authenticator::setDefault
>
> The method checks for the existing
>   NetPermission("requestPasswordAuthentication")
> rather than introducing a new "getDefaultAuthenticator" permission,
> because getting the authenticator actually grants you the possibilty
> to request passwords - so it's better that the permission check
> makes it explicit.
>
> http://cr.openjdk.java.net/~dfuchs/webrev_8169068/webrev.00/

I am happy to see this being proposed. Just a few minor comments:

  1) "Get the ... " -> "GetS the ..."  (personal preference)

  2) The wording with respect to the permission check is little odd,
     but it is consistent with elsewhere in this class, so that's
     fine.

  3) trailing ';' on L34 of the test ;-)

  4) 'count' seems to be unused in the test. If you need it maybe make
     it volatile rather than locking on the instance in getCount().

  5) It might be a little less obscure to just print the value of the
     defaultAuth rather then using a reachability fence?

-Chris.


More information about the net-dev mailing list