On Mon, 18 Sep 2023 17:07:34 GMT, Daniel Fuchs <[email protected]> wrote:

>>>      *     Inet4Address.ofLiteral("06.07.08.09")        ==>    /6.7.8.9
>> 
>> if we ignore octal encoding, we should document it explicitely.
>> 
>> Maybe 
>> 
>>> The loose IPv4 syntax of partial numbers or hex encoding ("10.0.258", 
>>> "0xA000102") is not supported and causes a parsing error. Octal (zero) 
>>> prefixes are ignored, i.e. interpreted decimal.
>> 
>> (However I would prefer to reject octal in this case)
>
> This method behaves like `InetAddress.getByName` in that regards.

I believe accepting leading 0 as an octal indicator would require a new API, 
yet to be defined. What we're proposing here is a method that behaves like 
`InetAddress.getByName` would except that it rejects what 
`InetAddress.getByName` would have identified as a hostname needing resolution. 
In other words it only accepts IP literals that `InetAddress.getByName` would 
accept as IP literals, and parses them as `InetAddress.getByName` would parse 
them, and rejects anything that would cause `InetAddress.getByName` to invoke 
the resolver.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1329055548

Reply via email to