JDK-4414739 : getDropSuccess returns wrong value
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-02-13
  • Updated: 2003-04-12
  • Resolved: 2002-08-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Description

Name: boT120536			Date: 02/13/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

your requested more information for the bug 115857 (internal code).

I created a small jar-file (29526 Bytes) which contains all sources,
classes and icons. I could mail the archive to you.

Here are the steps to the problem:

The jar-file bug115857.jar contains all *.java and *.class files and some icons.

Steps to follow:

1. Start the program in a windows-nt console with
    java -classpath bug115857.jar
com.gugel.fractal.application.gui.ImageOverviewFrame

2. A JFrame with a toolbar will open.
   Click the rightmost button to select a directory.

   Maybe you have to resize the window in order to update the
   overview panel. You should see all files in the chosen directory.

3. Open the windows explorer. Place the windows console so you can
   see the debug messages.

4. Try to move (not copy) a file form the java application
   in the windows explorer.
   The console will show something like:

   drag gesture recognized
   dragEnter (ds listener)
   dragExit
   drop end
   drop failure

The file got successfully moved, but getDropSuccess returns false.

This bug does not occur under windows 98.


yours

alex gugel
(Review ID: 116104) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis mantis-b02 FIXED IN: mantis mantis-b02 INTEGRATED IN: mantis mantis-b02 VERIFIED IN: mantis
24-08-2004

PUBLIC COMMENTS .
24-08-2004

SUGGESTED FIX Name: agR10216 Date: 08/01/2002 Implement IDataObject::SetData() so that data in the CFSTR_PERFORMEDDROPEFFECT format could be set by the Windows shell. Use the drop effect set in SetData() if one supplied from DoDragDrop() is none. ---------------------------------------------------------------------------- --- awt_DnDDS.h Tue Jul 30 13:03:05 2002 *************** *** 233,238 **** --- 233,240 ---- POINT m_dropPoint; BOOL m_fNC; + DWORD m_dwPerformedDropEffect; + // static's ... static jclass dSCClazz; ---------------------------------------------------------------------------- --- awt_DnDDS.cpp Wed Jul 31 14:40:01 2002 *************** *** 83,88 **** --- 83,93 ---- &effects ); + if (effects == DROPEFFECT_NONE && dragSource->m_dwPerformedDropEffect != DROPEFFECT_NONE) { + effects = dragSource->m_dwPerformedDropEffect; + } + dragSource->m_dwPerformedDropEffect = DROPEFFECT_NONE; + call_dSCddfinished(env, peer, res == DRAGDROP_S_DROP && effects != DROPEFFECT_NONE, convertDROPEFFECTToActions(effects), dragSource->m_dragPoint.x, dragSource->m_dragPoint.y); *************** *** 132,137 **** --- 137,144 ---- m_dropPoint.x = 0; m_dropPoint.y = 0; + m_dwPerformedDropEffect = DROPEFFECT_NONE; + LoadCache(formats); AddRef(); *************** *** 846,852 **** */ HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) { ! return E_NOTIMPL; } /** --- 853,869 ---- */ HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) { ! static CLIPFORMAT CF_PERFORMEDDROPEFFECT = ::RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT); ! ! if (pFormatEtc->cfFormat == CF_PERFORMEDDROPEFFECT && pmedium->tymed == TYMED_HGLOBAL) { ! m_dwPerformedDropEffect = *(DWORD*)::GlobalLock(pmedium->hGlobal); ! ::GlobalUnlock(pmedium->hGlobal); ! if (fRelease) { ! ::ReleaseStgMedium(pmedium); ! } ! return S_OK; ! } ! return E_UNEXPECTED; } /** ###@###.### 2002-07-31 ======================================================================
31-07-2002

EVALUATION Name: agR10216 Date: 07/29/2002 I reproduced the bug with the build 1.4.1-rc-b18 with the following test case. ---------------------------------------------------------------------------- import java.awt.*; import java.awt.event.*; import java.awt.datatransfer.*; import java.awt.dnd.*; import java.io.*; public class FileDropTest { private Frame frame = new Frame(); FileDropTest() { final DragSourceListener dsl = new DragSourceAdapter() { public void dragDropEnd(DragSourceDropEvent e) { System.err.println("drop success=" + e.getDropSuccess()); } }; DragGestureListener dgl = new DragGestureListener() { public void dragGestureRecognized(DragGestureEvent dge) { dge.startDrag(null, new FileListSelection(), dsl); } }; new DragSource().createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_MOVE, dgl); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); frame.setSize(100, 100); frame.setVisible(true); } public static void main(String[] args) { new FileDropTest(); } } class FileListSelection implements Transferable { private static final int FL = 0; private static final DataFlavor[] flavors = new DataFlavor[] { DataFlavor.javaFileListFlavor }; private java.util.List data; public FileListSelection(java.util.List data) { this.data = data; } public FileListSelection() { data = new java.util.ArrayList(); File file = new File("data.txt"); data.add(file); } public DataFlavor[] getTransferDataFlavors() { return (DataFlavor[])flavors.clone(); } public boolean isDataFlavorSupported(DataFlavor flavor) { for (int i = 0; i < flavors.length; i++) { if (flavor.equals(flavors[i])) { return true; } } return false; } public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, java.io.IOException { if (flavor.equals(flavors[FL])) { return (Object)data; } else { throw new UnsupportedFlavorException(flavor); } } } ---------------------------------------------------------------------------- DoDragDrop() supplies IDropSource with the drop effect, which indicates how the drag-and-drop operation affected the source data. In our current implementation the drop success is determined by comparing the drop effect with DROPEFFECT_NONE. The Windows shell normally uses an optimized move to move files, so there is no need for the source to delete the original file. The protocol of the optimized move differs from one of the ordinary unoptimized move; particularly, some value other than DROPEFFECT_MOVE (typically DROPEFFECT_NONE) is passed to the drag source. ###@###.### 2002-07-29 ======================================================================
29-07-2002