src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 55,65 ****
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.datatransfer.DataTransferer;
import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
- import sun.security.util.SecurityConstants;
/**
* <p>
* The SunDropTargetContextPeer class is the generic class responsible for handling
* the interaction between a windowing systems DnD system and Java.
--- 55,64 ----
*** 237,253 ****
Long lFormat = null;
Transferable localTransferable = local;
if (localTransferable != null) {
return localTransferable.getTransferData(df);
- } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
- // Workaround to JDK-8024061: Exception thrown when drag and drop
- // between two components is executed quickly.
- // It is expected localTransferable is not null if javaJVMLocalObjectMimeType
- // is used. Executing further results in ClassCastException, so null is
- // returned here as no transfer data is available in this case.
- return null;
}
if (dropStatus != STATUS_ACCEPT || dropComplete) {
throw new InvalidDnDOperationException("No drop current");
}
--- 236,245 ----
*** 265,289 ****
currentDA != DnDConstants.ACTION_LINK) {
throw new InvalidDnDOperationException("only ACTION_LINK is permissable for transfer of java.rmi.Remote objects");
}
final long format = lFormat.longValue();
Object ret = getNativeData(format);
if (ret instanceof byte[]) {
try {
return DataTransferer.getInstance().
translateBytes((byte[])ret, df, format, this);
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
}
} else if (ret instanceof InputStream) {
try {
return DataTransferer.getInstance().
! translateStream((InputStream)ret, df, format, this);
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
}
} else {
throw new IOException("no native data was transfered");
}
}
--- 257,285 ----
currentDA != DnDConstants.ACTION_LINK) {
throw new InvalidDnDOperationException("only ACTION_LINK is permissable for transfer of java.rmi.Remote objects");
}
final long format = lFormat.longValue();
+
Object ret = getNativeData(format);
if (ret instanceof byte[]) {
try {
return DataTransferer.getInstance().
translateBytes((byte[])ret, df, format, this);
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
}
} else if (ret instanceof InputStream) {
+ InputStream inputStream = (InputStream)ret;
try {
return DataTransferer.getInstance().
! translateStream(inputStream, df, format, this);
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
+ } finally {
+ inputStream.close();
}
} else {
throw new IOException("no native data was transfered");
}
}