Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
bb5a81a3
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看板
提交
bb5a81a3
编写于
9月 28, 2012
作者:
D
dxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6950237: Test java/nio/file/Path/CopyAndMove.java does not work correctly when test dir in on VFAT
Reviewed-by: alanb
上级
cefa29b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
6 deletion
+25
-6
src/solaris/classes/sun/nio/fs/LinuxFileStore.java
src/solaris/classes/sun/nio/fs/LinuxFileStore.java
+4
-1
test/java/nio/file/Files/CopyAndMove.java
test/java/nio/file/Files/CopyAndMove.java
+21
-5
未找到文件。
src/solaris/classes/sun/nio/fs/LinuxFileStore.java
浏览文件 @
bb5a81a3
/*
/*
* Copyright (c) 2008, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -145,6 +145,9 @@ class LinuxFileStore
...
@@ -145,6 +145,9 @@ class LinuxFileStore
}
}
return
xattrEnabled
;
return
xattrEnabled
;
}
}
// POSIX attributes not supported on FAT
if
(
type
==
PosixFileAttributeView
.
class
&&
entry
().
fstype
().
equals
(
"vfat"
))
return
false
;
return
super
.
supportsFileAttributeView
(
type
);
return
super
.
supportsFileAttributeView
(
type
);
}
}
...
...
test/java/nio/file/Files/CopyAndMove.java
浏览文件 @
bb5a81a3
/*
/*
* Copyright (c) 2008, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
*/
*/
/* @test
/* @test
* @bug 4313887 6838333 6917021 7006126
* @bug 4313887 6838333 6917021 7006126
6950237
* @summary Unit test for java.nio.file.Files copy and move methods
* @summary Unit test for java.nio.file.Files copy and move methods
* @library ..
* @library ..
* @build CopyAndMove PassThroughFileSystem
* @build CopyAndMove PassThroughFileSystem
...
@@ -41,12 +41,14 @@ import java.util.*;
...
@@ -41,12 +41,14 @@ import java.util.*;
public
class
CopyAndMove
{
public
class
CopyAndMove
{
static
final
Random
rand
=
new
Random
();
static
final
Random
rand
=
new
Random
();
static
boolean
heads
()
{
return
rand
.
nextBoolean
();
}
static
boolean
heads
()
{
return
rand
.
nextBoolean
();
}
private
static
boolean
testPosixAttributes
=
false
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Path
dir1
=
TestUtil
.
createTemporaryDirectory
();
Path
dir1
=
TestUtil
.
createTemporaryDirectory
();
try
{
try
{
// Same directory
// Same directory
testPosixAttributes
=
getFileStore
(
dir1
).
supportsFileAttributeView
(
"posix"
);
testCopyFileToFile
(
dir1
,
dir1
,
TestUtil
.
supportsLinks
(
dir1
));
testCopyFileToFile
(
dir1
,
dir1
,
TestUtil
.
supportsLinks
(
dir1
));
testMove
(
dir1
,
dir1
,
TestUtil
.
supportsLinks
(
dir1
));
testMove
(
dir1
,
dir1
,
TestUtil
.
supportsLinks
(
dir1
));
...
@@ -57,6 +59,8 @@ public class CopyAndMove {
...
@@ -57,6 +59,8 @@ public class CopyAndMove {
try
{
try
{
boolean
testSymbolicLinks
=
boolean
testSymbolicLinks
=
TestUtil
.
supportsLinks
(
dir1
)
&&
TestUtil
.
supportsLinks
(
dir2
);
TestUtil
.
supportsLinks
(
dir1
)
&&
TestUtil
.
supportsLinks
(
dir2
);
testPosixAttributes
=
getFileStore
(
dir1
).
supportsFileAttributeView
(
"posix"
)
&&
getFileStore
(
dir2
).
supportsFileAttributeView
(
"posix"
);
testCopyFileToFile
(
dir1
,
dir2
,
testSymbolicLinks
);
testCopyFileToFile
(
dir1
,
dir2
,
testSymbolicLinks
);
testMove
(
dir1
,
dir2
,
testSymbolicLinks
);
testMove
(
dir1
,
dir2
,
testSymbolicLinks
);
}
finally
{
}
finally
{
...
@@ -65,6 +69,8 @@ public class CopyAndMove {
...
@@ -65,6 +69,8 @@ public class CopyAndMove {
// Target is location associated with custom provider
// Target is location associated with custom provider
Path
dir3
=
PassThroughFileSystem
.
create
().
getPath
(
dir1
.
toString
());
Path
dir3
=
PassThroughFileSystem
.
create
().
getPath
(
dir1
.
toString
());
testPosixAttributes
=
getFileStore
(
dir1
).
supportsFileAttributeView
(
"posix"
)
&&
getFileStore
(
dir3
).
supportsFileAttributeView
(
"posix"
);
testCopyFileToFile
(
dir1
,
dir3
,
false
);
testCopyFileToFile
(
dir1
,
dir3
,
false
);
testMove
(
dir1
,
dir3
,
false
);
testMove
(
dir1
,
dir3
,
false
);
...
@@ -90,7 +96,12 @@ public class CopyAndMove {
...
@@ -90,7 +96,12 @@ public class CopyAndMove {
if
(!
attrs1
.
isSymbolicLink
())
{
if
(!
attrs1
.
isSymbolicLink
())
{
long
time1
=
attrs1
.
lastModifiedTime
().
toMillis
();
long
time1
=
attrs1
.
lastModifiedTime
().
toMillis
();
long
time2
=
attrs2
.
lastModifiedTime
().
toMillis
();
long
time2
=
attrs2
.
lastModifiedTime
().
toMillis
();
assertTrue
(
time1
==
time2
);
if
(
time1
!=
time2
)
{
System
.
err
.
format
(
"File time for %s is %s\n"
,
attrs1
.
fileKey
(),
attrs1
.
lastModifiedTime
());
System
.
err
.
format
(
"File time for %s is %s\n"
,
attrs2
.
fileKey
(),
attrs2
.
lastModifiedTime
());
assertTrue
(
false
);
}
}
}
// check size
// check size
...
@@ -207,7 +218,10 @@ public class CopyAndMove {
...
@@ -207,7 +218,10 @@ public class CopyAndMove {
if
(
source
.
getFileSystem
().
provider
()
==
target
.
getFileSystem
().
provider
())
{
if
(
source
.
getFileSystem
().
provider
()
==
target
.
getFileSystem
().
provider
())
{
// verify POSIX attributes
// verify POSIX attributes
if
(
posixAttributes
!=
null
&&
!
basicAttributes
.
isSymbolicLink
())
{
if
(
posixAttributes
!=
null
&&
!
basicAttributes
.
isSymbolicLink
()
&&
testPosixAttributes
)
{
checkPosixAttributes
(
posixAttributes
,
checkPosixAttributes
(
posixAttributes
,
readAttributes
(
target
,
PosixFileAttributes
.
class
,
NOFOLLOW_LINKS
));
readAttributes
(
target
,
PosixFileAttributes
.
class
,
NOFOLLOW_LINKS
));
}
}
...
@@ -636,7 +650,9 @@ public class CopyAndMove {
...
@@ -636,7 +650,9 @@ public class CopyAndMove {
// check POSIX attributes are copied
// check POSIX attributes are copied
String
os
=
System
.
getProperty
(
"os.name"
);
String
os
=
System
.
getProperty
(
"os.name"
);
if
(
os
.
equals
(
"SunOS"
)
||
os
.
equals
(
"Linux"
))
{
if
((
os
.
equals
(
"SunOS"
)
||
os
.
equals
(
"Linux"
))
&&
testPosixAttributes
)
{
checkPosixAttributes
(
checkPosixAttributes
(
readAttributes
(
source
,
PosixFileAttributes
.
class
,
linkOptions
),
readAttributes
(
source
,
PosixFileAttributes
.
class
,
linkOptions
),
readAttributes
(
target
,
PosixFileAttributes
.
class
,
linkOptions
));
readAttributes
(
target
,
PosixFileAttributes
.
class
,
linkOptions
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录