Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1b72cf45
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1b72cf45
编写于
12月 06, 2013
作者:
P
pchelko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8029565: java.awt.dnd.InvalidDnDOperationException: data translation failed on file drop
Reviewed-by: anthony, serb
上级
eefca52d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
516 addition
and
1 deletion
+516
-1
src/share/classes/sun/awt/datatransfer/DataTransferer.java
src/share/classes/sun/awt/datatransfer/DataTransferer.java
+24
-0
src/solaris/classes/sun/awt/X11/XDataTransferer.java
src/solaris/classes/sun/awt/X11/XDataTransferer.java
+2
-1
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/InterprocessMessages.java
...RIListToFileListBetweenJVMsTest/InterprocessMessages.java
+27
-0
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/SourceFileListFrame.java
...URIListToFileListBetweenJVMsTest/SourceFileListFrame.java
+100
-0
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/TargetFileListFrame.java
...URIListToFileListBetweenJVMsTest/TargetFileListFrame.java
+112
-0
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html
...ListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html
+48
-0
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java
...ListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java
+139
-0
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListTransferable.java
...URIListToFileListBetweenJVMsTest/URIListTransferable.java
+64
-0
未找到文件。
src/share/classes/sun/awt/datatransfer/DataTransferer.java
浏览文件 @
1b72cf45
...
...
@@ -1598,6 +1598,30 @@ search:
// Turn the list of Files into a List and return
theObject
=
Arrays
.
asList
(
files
);
// Source data is a URI list. Convert to DataFlavor.javaFileListFlavor
// where possible.
}
else
if
(
isURIListFormat
(
format
)
&&
DataFlavor
.
javaFileListFlavor
.
equals
(
flavor
))
{
try
(
ByteArrayInputStream
str
=
new
ByteArrayInputStream
(
bytes
))
{
URI
uris
[]
=
dragQueryURIs
(
str
,
format
,
localeTransferable
);
if
(
uris
==
null
)
{
return
null
;
}
List
<
File
>
files
=
new
ArrayList
<>();
for
(
URI
uri
:
uris
)
{
try
{
files
.
add
(
new
File
(
uri
));
}
catch
(
IllegalArgumentException
illegalArg
)
{
// When converting from URIs to less generic files,
// common practice (Wine, SWT) seems to be to
// silently drop the URIs that aren't local files.
}
}
theObject
=
files
;
}
// Target data is a String. Strip terminating NUL bytes. Decode bytes
// into characters. Search-and-replace EOLN.
}
else
if
(
String
.
class
.
equals
(
flavor
.
getRepresentationClass
())
&&
...
...
src/solaris/classes/sun/awt/X11/XDataTransferer.java
浏览文件 @
1b72cf45
...
...
@@ -242,6 +242,7 @@ public class XDataTransferer extends DataTransferer {
}
}
@Override
protected
String
[]
dragQueryFile
(
byte
[]
bytes
)
{
XToolkit
.
awtLock
();
try
{
...
...
@@ -252,8 +253,8 @@ public class XDataTransferer extends DataTransferer {
}
}
@Override
protected
URI
[]
dragQueryURIs
(
InputStream
stream
,
byte
[]
bytes
,
long
format
,
Transferable
localeTransferable
)
throws
IOException
{
...
...
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/InterprocessMessages.java
0 → 100644
浏览文件 @
1b72cf45
/*
* Copyright (c) 2007, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public
interface
InterprocessMessages
{
final
static
int
EXECUTION_IS_SUCCESSFULL
=
0
;
final
static
int
WRONG_FILES_NUMBER_ON_TARGET
=
212
;
}
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/SourceFileListFrame.java
0 → 100644
浏览文件 @
1b72cf45
/*
* Copyright (c) 2013, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
test.java.awt.regtesthelpers.Util
;
import
java.awt.*
;
import
java.awt.dnd.DnDConstants
;
import
java.awt.dnd.DragGestureEvent
;
import
java.awt.dnd.DragGestureListener
;
import
java.awt.dnd.DragSource
;
import
java.io.File
;
import
java.net.URI
;
import
java.util.Arrays
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
class
SourceFileListFrame
extends
Frame
implements
DragGestureListener
{
private
final
static
int
SOURCE_POINT_SHIFT
=
3
;
private
List
list
=
new
List
(
URIListToFileListBetweenJVMsTest
.
VISIBLE_RAWS_IN_LIST
);
private
File
[]
files
;
SourceFileListFrame
()
{
super
(
"Source File List Frame"
);
extractFilesFromTheWorkingDirectory
();
initList
();
initGUI
();
new
DragSource
().
createDefaultDragGestureRecognizer
(
list
,
DnDConstants
.
ACTION_COPY
,
this
);
}
private
void
extractFilesFromTheWorkingDirectory
()
{
files
=
new
File
(
System
.
getProperty
(
"java.home"
,
""
)).
listFiles
();
}
private
void
initList
()
{
for
(
File
currFile:
files
)
{
list
.
add
(
currFile
.
getName
());
}
}
private
void
initGUI
()
{
this
.
addWindowListener
(
Util
.
getClosingWindowAdapter
());
this
.
setLocation
(
300
,
250
);
this
.
add
(
new
Panel
().
add
(
list
));
this
.
pack
();
this
.
setVisible
(
true
);
}
int
getNextLocationX
()
{
return
getX
()+
getWidth
();
}
int
getNextLocationY
()
{
return
getY
();
}
int
getDragSourcePointX
()
{
return
(
int
)
list
.
getLocationOnScreen
().
getX
()+(
list
.
getWidth
()/
2
);
}
int
getDragSourcePointY
()
{
return
(
int
)
list
.
getLocationOnScreen
().
getY
()+
SOURCE_POINT_SHIFT
;
}
int
getSourceFilesNumber
()
{
return
files
.
length
;
}
public
void
dragGestureRecognized
(
DragGestureEvent
dge
)
{
java
.
util
.
List
<
URI
>
uriList
=
Stream
.
of
(
list
.
getItems
())
.
map
(
File:
:
new
)
.
map
(
File:
:
toURI
)
.
collect
(
Collectors
.
toList
());
dge
.
startDrag
(
null
,
new
URIListTransferable
(
uriList
));
}
}
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/TargetFileListFrame.java
0 → 100644
浏览文件 @
1b72cf45
/*
* Copyright (c) 2013, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.*
;
import
java.awt.datatransfer.DataFlavor
;
import
java.awt.datatransfer.UnsupportedFlavorException
;
import
java.awt.dnd.*
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.io.File
;
import
java.io.IOException
;
class
TargetFileListFrame
extends
Frame
implements
DropTargetListener
{
private
List
list
=
new
List
(
URIListToFileListBetweenJVMsTest
.
VISIBLE_RAWS_IN_LIST
);
private
int
expectationTransferredFilesNumber
;
TargetFileListFrame
(
Point
location
,
int
expectationTransferredFilesNumber
)
{
this
.
expectationTransferredFilesNumber
=
expectationTransferredFilesNumber
;
initGUI
(
location
);
setDropTarget
(
new
DropTarget
(
list
,
DnDConstants
.
ACTION_COPY
,
this
));
}
private
void
initGUI
(
Point
location
)
{
this
.
setLocation
(
location
);
this
.
addWindowListener
(
new
WindowAdapter
()
{
public
void
windowClosing
(
WindowEvent
e
)
{
TargetFileListFrame
.
this
.
dispose
();
}
});
this
.
add
(
new
Panel
().
add
(
list
));
this
.
pack
();
this
.
setVisible
(
true
);
}
public
void
dragEnter
(
DropTargetDragEvent
dtde
)
{
if
(
dtde
.
getCurrentDataFlavorsAsList
().
contains
(
DataFlavor
.
javaFileListFlavor
))
{
dtde
.
acceptDrag
(
DnDConstants
.
ACTION_COPY
);
}
}
public
void
dragOver
(
DropTargetDragEvent
dtde
)
{
if
(
dtde
.
getCurrentDataFlavorsAsList
().
contains
(
DataFlavor
.
javaFileListFlavor
))
{
dtde
.
acceptDrag
(
DnDConstants
.
ACTION_COPY
);
}
}
public
void
dropActionChanged
(
DropTargetDragEvent
dtde
)
{
if
(
dtde
.
getCurrentDataFlavorsAsList
().
contains
(
DataFlavor
.
javaFileListFlavor
))
{
dtde
.
acceptDrag
(
DnDConstants
.
ACTION_COPY
);
}
}
public
void
dragExit
(
DropTargetEvent
dte
)
{}
public
void
drop
(
DropTargetDropEvent
dtde
)
{
list
.
removeAll
();
dtde
.
acceptDrop
(
DnDConstants
.
ACTION_COPY
);
java
.
util
.
List
<
File
>
fileList
=
extractListOfFiles
(
dtde
);
for
(
File
file:
fileList
)
{
list
.
add
(
file
.
getName
());
}
if
(
fileList
.
size
()
!=
expectationTransferredFilesNumber
)
{
System
.
err
.
println
(
"ERROR: Expected file number:"
+
expectationTransferredFilesNumber
+
"; Received file number: "
+
fileList
.
size
());
TargetFileListFrame
.
this
.
dispose
();
System
.
exit
(
InterprocessMessages
.
WRONG_FILES_NUMBER_ON_TARGET
);
}
TargetFileListFrame
.
this
.
dispose
();
}
private
java
.
util
.
List
<
File
>
extractListOfFiles
(
DropTargetDropEvent
dtde
)
{
java
.
util
.
List
<
File
>
fileList
=
null
;
try
{
fileList
=
(
java
.
util
.
List
<
File
>)
dtde
.
getTransferable
().
getTransferData
(
DataFlavor
.
javaFileListFlavor
);
}
catch
(
UnsupportedFlavorException
|
IOException
e
)
{
e
.
printStackTrace
();
}
return
fileList
;
}
Point
getDropTargetPoint
()
{
return
new
Point
((
int
)
list
.
getLocationOnScreen
().
getX
()+(
list
.
getWidth
()/
2
),
(
int
)
list
.
getLocationOnScreen
().
getY
()+(
list
.
getHeight
()/
2
));
}
}
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html
0 → 100644
浏览文件 @
1b72cf45
<!--
Copyright (c) 2013, 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.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<!--
@test
@bug 8029565
@summary Conversion of a URI list to File list fails
@author Petr Pchelko <petr.pchelko@oracle.com>
@library ../../regtesthelpers
@library ../../regtesthelpers/process
@build Util
@build ProcessResults ProcessCommunicator
@run applet/othervm URIListToFileListBetweenJVMsTest.html
-->
<head>
<title>
DnD of File-List across JVM
</title>
</head>
<body>
<h1>
URIListToFileListBetweenJVMsTest
<br>
Bug ID: 5079469
</h1>
<p>
This is an AUTOMATIC test, simply wait for completion
</p>
<APPLET
CODE=
"URIListToFileListBetweenJVMsTest.class"
WIDTH=
200
HEIGHT=
200
></APPLET>
</body>
</html>
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java
0 → 100644
浏览文件 @
1b72cf45
/*
* Copyright (c) 2013, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
test
@bug 8029565
@summary Conversion of a URI list to File list fails
@author Petr Pchelko <petr.pchelko@oracle.com>
@library ../../regtesthelpers
@library ../../regtesthelpers/process
@build Util
@build ProcessResults ProcessCommunicator
@run applet/othervm URIListToFileListBetweenJVMsTest.html
*/
/**
* URIListToFileListBetweenJVMsTest.java
*
* summary: DnD of File-List across JVM adds two empty items to the list
*/
import
test.java.awt.regtesthelpers.Util
;
import
test.java.awt.regtesthelpers.process.ProcessCommunicator
;
import
test.java.awt.regtesthelpers.process.ProcessResults
;
import
java.applet.Applet
;
import
java.awt.*
;
import
java.awt.event.InputEvent
;
import
static
java
.
lang
.
Thread
.
sleep
;
public
class
URIListToFileListBetweenJVMsTest
extends
Applet
{
// information related to the test in common
static
int
VISIBLE_RAWS_IN_LIST
=
15
;
public
void
init
()
{
setLayout
(
new
BorderLayout
());
}
public
void
start
()
{
SourceFileListFrame
sourceFrame
=
new
SourceFileListFrame
();
Util
.
waitForIdle
(
null
);
String
[]
args
=
new
String
[]
{
String
.
valueOf
(
sourceFrame
.
getNextLocationX
()),
String
.
valueOf
(
sourceFrame
.
getNextLocationY
()),
String
.
valueOf
(
sourceFrame
.
getDragSourcePointX
()),
String
.
valueOf
(
sourceFrame
.
getDragSourcePointY
()),
String
.
valueOf
(
sourceFrame
.
getSourceFilesNumber
())
};
ProcessResults
processResults
=
ProcessCommunicator
.
executeChildProcess
(
this
.
getClass
(),
args
);
verifyTestResults
(
processResults
);
}
private
static
void
verifyTestResults
(
ProcessResults
processResults
)
{
if
(
InterprocessMessages
.
WRONG_FILES_NUMBER_ON_TARGET
==
processResults
.
getExitValue
())
{
processResults
.
printProcessErrorOutput
(
System
.
err
);
throw
new
RuntimeException
(
"TEST IS FAILED: Target has recieved wrong number of files."
);
}
processResults
.
verifyStdErr
(
System
.
err
);
processResults
.
verifyProcessExitValue
(
System
.
err
);
processResults
.
printProcessStandartOutput
(
System
.
out
);
}
//We cannot make an instance of the applet without the default constructor
public
URIListToFileListBetweenJVMsTest
()
{
super
();
}
//We need in this constructor to pass frame position between JVMs
public
URIListToFileListBetweenJVMsTest
(
Point
targetFrameLocation
,
Point
dragSourcePoint
,
int
transferredFilesNumber
)
throws
InterruptedException
{
TargetFileListFrame
targetFrame
=
new
TargetFileListFrame
(
targetFrameLocation
,
transferredFilesNumber
);
Util
.
waitForIdle
(
null
);
final
Robot
robot
=
Util
.
createRobot
();
robot
.
mouseMove
((
int
)
dragSourcePoint
.
getX
(),(
int
)
dragSourcePoint
.
getY
());
sleep
(
100
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
sleep
(
100
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
sleep
(
100
);
Util
.
drag
(
robot
,
dragSourcePoint
,
targetFrame
.
getDropTargetPoint
(),
InputEvent
.
BUTTON1_MASK
);
}
enum
InterprocessArguments
{
TARGET_FRAME_X_POSITION_ARGUMENT
,
TARGET_FRAME_Y_POSITION_ARGUMENT
,
DRAG_SOURCE_POINT_X_ARGUMENT
,
DRAG_SOURCE_POINT_Y_ARGUMENT
,
FILES_IN_THE_LIST_NUMBER_ARGUMENT
;
int
extract
(
String
[]
args
)
{
return
Integer
.
parseInt
(
args
[
this
.
ordinal
()]);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Point
dragSourcePoint
=
new
Point
(
InterprocessArguments
.
DRAG_SOURCE_POINT_X_ARGUMENT
.
extract
(
args
),
InterprocessArguments
.
DRAG_SOURCE_POINT_Y_ARGUMENT
.
extract
(
args
));
Point
targetFrameLocation
=
new
Point
(
InterprocessArguments
.
TARGET_FRAME_X_POSITION_ARGUMENT
.
extract
(
args
),
InterprocessArguments
.
TARGET_FRAME_Y_POSITION_ARGUMENT
.
extract
(
args
));
int
transferredFilesNumber
=
InterprocessArguments
.
FILES_IN_THE_LIST_NUMBER_ARGUMENT
.
extract
(
args
);
new
URIListToFileListBetweenJVMsTest
(
targetFrameLocation
,
dragSourcePoint
,
transferredFilesNumber
);
}
}
test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListTransferable.java
0 → 100644
浏览文件 @
1b72cf45
/*
* Copyright (c) 2013, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.datatransfer.DataFlavor
;
import
java.awt.datatransfer.Transferable
;
import
java.awt.datatransfer.UnsupportedFlavorException
;
import
java.io.IOException
;
import
java.net.URI
;
import
java.util.List
;
class
URIListTransferable
implements
Transferable
{
private
final
DataFlavor
supportedFlavor
;
private
List
<
URI
>
list
;
public
URIListTransferable
(
List
<
URI
>
list
)
{
try
{
this
.
supportedFlavor
=
new
DataFlavor
(
"text/uri-list;class=java.lang.String"
);
}
catch
(
ClassNotFoundException
e
)
{
throw
new
RuntimeException
(
"FAILED: could not create a DataFlavor"
);
}
this
.
list
=
list
;
}
public
DataFlavor
[]
getTransferDataFlavors
()
{
return
new
DataFlavor
[]
{
supportedFlavor
};
}
public
boolean
isDataFlavorSupported
(
DataFlavor
flavor
)
{
return
supportedFlavor
.
equals
(
flavor
);
}
public
Object
getTransferData
(
DataFlavor
flavor
)
throws
UnsupportedFlavorException
,
IOException
{
if
(
supportedFlavor
.
equals
(
flavor
))
{
return
list
.
stream
()
.
map
(
URI:
:
toASCIIString
)
.
collect
(
StringBuilder:
:
new
,
(
builder
,
uri
)->
{
builder
.
append
(
uri
).
append
(
"\r\n"
);
},
StringBuilder:
:
append
).
toString
();
}
throw
new
UnsupportedFlavorException
(
flavor
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录