8277608: Address IP Addressing

Reviewed-by: dfuchs, rhalade, michaelm
This commit is contained in:
Aleksei Efimov 2022-02-08 12:16:02 +00:00 committed by Henry Jen
parent ec1d338e15
commit cdc1582d1d
4 changed files with 288 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -468,7 +468,7 @@ public final class SocketPermission extends Permission
if (!host.isEmpty()) {
// see if we are being initialized with an IP address.
char ch = host.charAt(0);
if (ch == ':' || Character.digit(ch, 16) != -1) {
if (ch == ':' || IPAddressUtil.digit(ch, 16) != -1) {
byte ip[] = IPAddressUtil.textToNumericFormatV4(host);
if (ip == null) {
ip = IPAddressUtil.textToNumericFormatV6(host);