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

Doc issue: inconsistency in java.awt.dnd.DropTarget

    XMLWordPrintable

Details

    • tiger
    • generic, sparc
    • generic, solaris_2.5
    • Verified

    Description

      Name: sdC67446 Date: 11/20/98


      There is inconsistency exists in java.awt.dnd.DropTarget:
      Methods
        dragEnter(DropTargetDragEvent evnt)
        dragOver(DropTargetDragEvent evnt)
        dragExit(DropTargetEvent evnt)
        dropActionChanged(DropTargetDragEvent evnt)
        drop(DropTargetDropEvent evnt)

      work on 'evnt'==null differently.
      Currently dragEnter, dragOver and dropActionChanged throw
      NullPointerException, dragExit and drop ignores null parameter.
      Should be fixed for consistency.

      The doc says:
      ------------------------------------------------------------
      public void dragEnter(DropTargetDragEvent dtde)
            The DropTarget intercepts dragEnter() notifications before
            the registered DropTargetListener gets them.

      public void dragOver(DropTargetDragEvent dtde)

            The DropTarget intercepts dragOver() notifications before the
            registered DropTargetListener gets them.

      public void dropActionChanged(DropTargetDragEvent dtde)

            The DropTarget intercepts dropActionChanged() notifications
            before the registered DropTargetListener gets them.

      public void dragExit(DropTargetEvent dte)

            The DropTarget intercepts dragExit() notifications before the
            registered DropTargetListener gets them.

      public void drop(DropTargetDropEvent dtde)

            The DropTarget intercepts drop() notifications before the
            registered DropTargetListener gets them.


      The test demonstrating the bug:
      -------------------------------------------------------------
      import java.awt.dnd.*;
      import java.awt.Button;

      public class Test implements DropTargetListener {

          public void dragEnter(DropTargetDragEvent dsde) {}

          public void dragOver(DropTargetDragEvent dsde) {}

          public void dropActionChanged(DropTargetDragEvent dsde) {}

          public void dragExit(DropTargetEvent dsde) {}

          public void drop(DropTargetDropEvent dsde) {}
          
          public static void main(String[] args) {
      DropTarget dt = new DropTarget(new Button(), new Test());

      try {
      dt.dragExit(null);
      System.out.println("dragExit: OK.");
      } catch (NullPointerException e) {
      System.out.println("drop: "+e);
      }

      try {
      dt.drop(null);
      System.out.println("drop: OK.");
      } catch (NullPointerException e) {
      System.out.println("drop: "+e);
      }

      try {
      dt.dropActionChanged(null);
      } catch (NullPointerException e) {
      System.out.println("dropActionChanged: "+e);
      }

      try {
      dt.dragEnter(null);
      } catch (NullPointerException e) {
      System.out.println("dragEnter: "+e);
      }

      try {
      dt.dragOver(null);
      } catch (NullPointerException e) {
      System.out.println("dragOver: "+e);
      }
          }
      }

      Test output:
      ------------------------------------------------------------
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
      dragExit: OK.
      drop: OK.
      dropActionChanged: java.lang.NullPointerException
      dragEnter: java.lang.NullPointerException
      dragOver: java.lang.NullPointerException
      ------------------------------------------------------------

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              agerasimsunw Alexander Gerasimov (Inactive)
              sdmitriesunw Sergei Dmitriev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: