From cde53cc18b234cc1115a66e5e51b0202266ec2b6 Mon Sep 17 00:00:00 2001 From: duncanmcqueen Date: Wed, 14 Oct 2026 15:06:57 -0500 Subject: [PATCH] DropTargetContext.getCurrentDataFlavors(): return the flavors getCurrentDataFlavors() called the peer but did not return its result, so it always returned null. Thus DropTargetDragEvent and DropTargetDropEvent did not show the offered data flavors, and isDataFlavorSupported() was always false. Return the peer's flavors. Without a peer, or if the peer returns null (as the GTK peer does), return an empty array, so that getCurrentDataFlavorsAsList() and isDataFlavorSupported() do not throw NullPointerException. Co-Authored-By: Claude Opus 5.5 Signed-off-by: duncanmcqueen --- java/awt/dnd/DropTargetContext.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/awt/dnd/DropTargetContext.java b/java/awt/dnd/DropTargetContext.java index 4c21a6e8ad..26ec304c3c 100644 --- a/java/awt/dnd/DropTargetContext.java +++ b/java/awt/dnd/DropTargetContext.java @@ -161,9 +161,10 @@ protected void rejectDrop () protected DataFlavor[] getCurrentDataFlavors () { + DataFlavor[] flavors = null; if (dtcp != null) - dtcp.getTransferDataFlavors(); - return null; + flavors = dtcp.getTransferDataFlavors(); + return flavors != null ? flavors : new DataFlavor[0]; } protected List getCurrentDataFlavorsAsList ()