Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a35f373d
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看板
提交
a35f373d
编写于
7月 31, 2009
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6867101: Path.checkAccess fails with sharing violation on special files such as pagefile.sys
Reviewed-by: sherman
上级
3b00c5a7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
1 deletion
+57
-1
src/windows/classes/sun/nio/fs/WindowsConstants.java
src/windows/classes/sun/nio/fs/WindowsConstants.java
+1
-0
src/windows/classes/sun/nio/fs/WindowsFileAttributes.java
src/windows/classes/sun/nio/fs/WindowsFileAttributes.java
+33
-0
test/java/nio/file/Path/Misc.java
test/java/nio/file/Path/Misc.java
+23
-1
未找到文件。
src/windows/classes/sun/nio/fs/WindowsConstants.java
浏览文件 @
a35f373d
...
...
@@ -92,6 +92,7 @@ class WindowsConstants {
public
static
final
int
ERROR_INVALID_DATA
=
13
;
public
static
final
int
ERROR_NOT_SAME_DEVICE
=
17
;
public
static
final
int
ERROR_NOT_READY
=
21
;
public
static
final
int
ERROR_SHARING_VIOLATION
=
32
;
public
static
final
int
ERROR_FILE_EXISTS
=
80
;
public
static
final
int
ERROR_INVALID_PARAMATER
=
87
;
public
static
final
int
ERROR_DISK_FULL
=
112
;
...
...
src/windows/classes/sun/nio/fs/WindowsFileAttributes.java
浏览文件 @
a35f373d
...
...
@@ -299,6 +299,9 @@ class WindowsFileAttributes
throws
WindowsException
{
if
(!
ensureAccurateMetadata
)
{
WindowsException
firstException
=
null
;
// GetFileAttributesEx is the fastest way to read the attributes
NativeBuffer
buffer
=
NativeBuffers
.
getNativeBuffer
(
SIZEOF_FILE_ATTRIBUTE_DATA
);
try
{
...
...
@@ -310,9 +313,39 @@ class WindowsFileAttributes
.
getInt
(
address
+
OFFSETOF_FILE_ATTRIBUTE_DATA_ATTRIBUTES
);
if
((
fileAttrs
&
FILE_ATTRIBUTE_REPARSE_POINT
)
==
0
)
return
fromFileAttributeData
(
address
,
0
);
}
catch
(
WindowsException
x
)
{
if
(
x
.
lastError
()
!=
ERROR_SHARING_VIOLATION
)
throw
x
;
firstException
=
x
;
}
finally
{
buffer
.
release
();
}
// For sharing violations, fallback to FindFirstFile if the file
// is not a root directory.
if
(
firstException
!=
null
)
{
String
search
=
path
.
getPathForWin32Calls
();
char
last
=
search
.
charAt
(
search
.
length
()
-
1
);
if
(
last
==
':'
||
last
==
'\\'
)
throw
firstException
;
buffer
=
getBufferForFindData
();
try
{
long
handle
=
FindFirstFile
(
search
,
buffer
.
address
());
FindClose
(
handle
);
WindowsFileAttributes
attrs
=
fromFindData
(
buffer
.
address
());
// FindFirstFile does not follow sym links. Even if
// followLinks is false, there isn't sufficient information
// in the WIN32_FIND_DATA structure to know if the reparse
// point is a sym link.
if
(
attrs
.
isReparsePoint
())
throw
firstException
;
return
attrs
;
}
catch
(
WindowsException
ignore
)
{
throw
firstException
;
}
finally
{
buffer
.
release
();
}
}
}
// file is reparse point so need to open file to get attributes
...
...
test/java/nio/file/Path/Misc.java
浏览文件 @
a35f373d
...
...
@@ -22,7 +22,7 @@
*/
/* @test
* @bug 4313887 6838333
* @bug 4313887 6838333
6866804
* @summary Unit test for java.nio.file.Path for miscellenous methods not
* covered by other tests
* @library ..
...
...
@@ -106,6 +106,28 @@ public class Misc {
dir
.
checkAccess
(
AccessMode
.
WRITE
);
dir
.
checkAccess
(
AccessMode
.
READ
,
AccessMode
.
WRITE
);
/**
* Test: Check access to all files in all root directories.
* (A useful test on Windows for special files such as pagefile.sys)
*/
for
(
Path
root:
FileSystems
.
getDefault
().
getRootDirectories
())
{
DirectoryStream
<
Path
>
stream
;
try
{
stream
=
root
.
newDirectoryStream
();
}
catch
(
IOException
x
)
{
continue
;
// skip root directories that aren't accessible
}
try
{
for
(
Path
entry:
stream
)
{
try
{
entry
.
checkAccess
();
}
catch
(
AccessDeniedException
ignore
)
{
}
}
}
finally
{
stream
.
close
();
}
}
/**
* Test: File does not exist
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录