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

Unspecified NPE in java.net.IDN methods

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • core-libs
    • None
    • behavioral
    • minimal
    • This is a doc-only change which updates the specification of java.net.IDN class to match its current implementation.
    • Java API
    • SE

      Summary

      The specification of java.net.IDN class will be updated to state that the methods of that class will throw a java.lang.NullPointerException if any of the arguments to the methods is null.

      Problem

      All the methods on (the final class) java.net.IDN currently throw a NullPointerException if any argument to the methods is null. However, this isn't specified in any of the methods.

      Solution

      The class level javadoc of IDN will be updated to specify that the methods will throw a NullPointerException if any argument is null.

      Specification

      diff --git a/src/java.base/share/classes/java/net/IDN.java b/src/java.base/share/classes/java/net/IDN.java
      index 6f11643264f8c..0aaac84076607 100644
      --- a/src/java.base/share/classes/java/net/IDN.java
      +++ b/src/java.base/share/classes/java/net/IDN.java
      @@ -66,6 +66,9 @@
      * Applications are responsible for taking adequate security measures when using
      * international domain names.
      *
      + * <p>Unless otherwise specified, passing a {@code null} argument to any method
      + * in this class will cause a {@link NullPointerException} to be thrown.
      + *
        ...
      public final class IDN {

            jpai Jaikiran Pai
            dmiltsov Dmitry Miltsov (Inactive)
            Chen Liang, Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: