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

Behavior of null arguments not specified in Java Sound

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 11
    • client-libs
    • None
    • minimal
    • Java API
    • SE

      Summary

      Most Java Sound methods and constructors do not specify the behavior when passing null as one or more of the arguments.

      Solution

      Java API's should, specify what can happens, if null is passed as argument.

      Specification

      src/java.desktop/share/classes/javax/sound/midi/package-info.java
      
      + * Please note: In the {@code javax.sound.midi} APIs, a {@code null} reference
      + * parameter to methods is incorrect unless explicitly documented on the method
      + * as having a meaningful interpretation. Usage to the contrary is incorrect
      + * coding and may result in a run time exception either immediately or at some
      + * later time. {@code NullPointerException} is an example of typical and
      + * acceptable run time exception for such cases.
        *
        * @since 1.3
        */
       package javax.sound.midi;

      .....

       src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java
      
       + * Please note: In the {@code javax.sound.midi.spi} APIs, a {@code null}
       + * reference parameter to methods is incorrect unless explicitly documented on
       + * the method as having a meaningful interpretation. Usage to the contrary is
       + * incorrect coding and may result in a run time exception either immediately or
       + * at some later time. {@code NullPointerException} is an example of typical and
       + * acceptable run time exception for such cases.
         *
         * @since 1.3
         */
        package javax.sound.midi.spi;

      ....

        src/java.desktop/share/classes/javax/sound/sampled/package-info.java
      
        + * Please note: In the {@code javax.sound.sampled} APIs, a {@code null}
        + * reference parameter to methods is incorrect unless explicitly documented on
        + * the method as having a meaningful interpretation. Usage to the contrary is
        + * incorrect coding and may result in a run time exception either immediately or
        + * at some later time. {@code NullPointerException} is an example of typical and
        + * acceptable run time exception for such cases.
          *
          * @since 1.3
          */
         package javax.sound.sampled;

      ....

         src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java
      
         + * Please note: In the {@code javax.sound.sampled.spi} APIs, a {@code null}
         + * reference parameter to methods is incorrect unless explicitly documented on
         + * the method as having a meaningful interpretation. Usage to the contrary is
         + * incorrect coding and may result in a run time exception either immediately or
         + * at some later time. {@code NullPointerException} is an example of typical and
         + * acceptable run time exception for such cases.
           *
           * @since 1.3
           */
          package javax.sound.sampled.spi;

            serb Sergey Bylokhov
            fbomerssunw Florian Bomers (Inactive)
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: