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

DOC: Specification of File Dialog constructors needs to be fixed for parent-less case

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Some of the FileDialog constructors claim that they will throw an IllegalArgumentException when the 'parent' value is null. This is true till JDK 5.0. Since JDK 6, we now support parent-less dialogs and none of these constructors will throw an exception if parent value is null. Hence the API specification is mis-leading and not reflecting the new feature.

      Refer to the following constructors in java.awt.FileDialog in the API docs (http://download.java.net/jdk6/docs/api/) -

      public FileDialog(Dialog parent)
      public FileDialog(Dialog parent, String title)
      public FileDialog(Dialog parent, String title, int mode)

      All these have a 'throws' clause as follows -
      Throws:
      IllegalArgumentException - if parent is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true

      In reality, no such exception will be thrown if parent is null on JDK 6.

        Attachments

          Activity

            People

            Assignee:
            serb Sergey Bylokhov
            Reporter:
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: