提交 aab177bd 编写于 作者: D denis

6340263: Regression testcase java/awt/dnd/DnDClipboardDeadlockTest throughs...

6340263: Regression testcase java/awt/dnd/DnDClipboardDeadlockTest throughs IOException: Owner timed out
Reviewed-by: anthony, art
上级 eefa801e
...@@ -301,13 +301,8 @@ public final class XSelection { ...@@ -301,13 +301,8 @@ public final class XSelection {
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
if (!dataGetter.isExecuted()) {
throw new IOException("Owner timed out");
}
if (dataGetter.isDisposed()) { validateDataGetter(dataGetter);
throw new IOException("Owner failed to convert data");
}
// Handle incremental transfer. // Handle incremental transfer.
if (dataGetter.getActualType() == if (dataGetter.getActualType() ==
...@@ -380,14 +375,7 @@ public final class XSelection { ...@@ -380,14 +375,7 @@ public final class XSelection {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
// The owner didn't respond - terminate the transfer. validateDataGetter(dataGetter);
if (!incrDataGetter.isExecuted()) {
throw new IOException("Owner timed out");
}
if (incrDataGetter.isDisposed()) {
throw new IOException("Owner failed to convert data");
}
if (incrDataGetter.getActualFormat() != 8) { if (incrDataGetter.getActualFormat() != 8) {
throw new IOException("Unsupported data format: " + throw new IOException("Unsupported data format: " +
...@@ -445,6 +433,23 @@ public final class XSelection { ...@@ -445,6 +433,23 @@ public final class XSelection {
return data != null ? data : new byte[0]; return data != null ? data : new byte[0];
} }
void validateDataGetter(WindowPropertyGetter propertyGetter)
throws IOException
{
// The order of checks is important because a property getter
// has not been executed in case of timeout as well as in case of
// changed selection owner.
if (propertyGetter.isDisposed()) {
throw new IOException("Owner failed to convert data");
}
// The owner didn't respond - terminate the transfer.
if (!propertyGetter.isExecuted()) {
throw new IOException("Owner timed out");
}
}
// To be MT-safe this method should be called under awtLock. // To be MT-safe this method should be called under awtLock.
boolean isOwner() { boolean isOwner() {
return isOwner; return isOwner;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册