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

Inet6Address doesn't support literals with named interfaces

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The documentation has examples of Inet6Address.ofLiteral with various named interfaces as scopes. https://docs.oracle.com/en/java/javase/25/docs/api//java.base/java/net/Inet6Address.html#input But, these examples actually just throw exceptions:

      $ jshell
      | Welcome to JShell -- Version 25.0.1
      | For an introduction type: /help intro

      jshell> Inet6Address.ofLiteral("fe80::1%en0")
      | Exception java.lang.IllegalArgumentException: Invalid IP address literal: fe80::1%en0
      | at IPAddressUtil.invalidIpAddressLiteral (IPAddressUtil.java:168)
      | at Inet6Address.ofLiteral (Inet6Address.java:536)
      | at (#1:1)

      jshell> Inet6Address.ofLiteral("[fe80::1%en0]")
      | Exception java.lang.IllegalArgumentException: Invalid IP address literal: [fe80::1%en0]
      | at IPAddressUtil.invalidIpAddressLiteral (IPAddressUtil.java:168)
      | at Inet6Address.ofLiteral (Inet6Address.java:536)
      | at (#2:1)




            pmtavare Patricia Tavares
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: