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

Dialog's methods are unusable with FileDialog, leads to unpredictable behavior

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      As per the specification, FileDialog extends Dialog. But practically none of the parent class's methods are usable with FileDialog. For example, some of the behaviors are given below:

      1. Adding a component to FileDialog using add() method. This throws a NPE on Win32 platforms and works fine on Linux/Solaris. But on linux / solaris with XToolkit, component is getting added to some arbitrary location in file dialog. However this is not a supported operation and hence must either be restricted by throwing an UnsupportedOperationException or must be specified in the spec.
      Here is the exception:

      java.lang.NullPointerException: null pData
      at sun.awt.windows.WButtonPeer.create(Native Method)

      2. Calling FileDialog.setLayout() throws the same exception on Win32. Does not have any effect on Sol/Linux.

      3. Popping up another dialog with FileDialog as the parent throws an OutOfMemory error on win32. Works fine on Solaris/Linux.

      4. setSize() method in Dialog - this is ignored on win32 but honored on solaris/linux (xtoolkit) only for the second time. First time the dialog is shown with the default size of 400 x 400. Either the size must be honored consistently regardless of how many times the dialog is shown or calling this method should throw an UnsupportedOperationException. Or the specification must say that this an unsupported method for FileDialog.

      Likewise, there are many other methods that are inherited by the file dialog from it's parents but none of them work with FileDialog. We must clarify our spec to clearly say what is expected to work with FD and what is not. This way we can avoid some of the unpredictable behaviors explained above.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              prr Philip Race
              Reporter:
              pmohansunw Praveen Mohan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: