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

Behavior of null arguments not specified in Java Sound

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      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;

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: