Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f42e9730
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f42e9730
编写于
5月 28, 2013
作者:
E
ewang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8009258: TEST_BUG:java/io/pathNames/GeneralWin32.java fails intermittently
Reviewed-by: dxu, alanb Contributed-by: yiming.wang@oracle.com
上级
5eb0cb85
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
62 addition
and
32 deletion
+62
-32
test/java/io/pathNames/General.java
test/java/io/pathNames/General.java
+10
-7
test/java/io/pathNames/GeneralWin32.java
test/java/io/pathNames/GeneralWin32.java
+52
-25
未找到文件。
test/java/io/pathNames/General.java
浏览文件 @
f42e9730
/*
* Copyright (c) 1998, 20
00
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
13
, 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
...
...
@@ -40,7 +40,7 @@ public class General {
/* Generate a filename unique to this run */
pr
ivate
static
String
gensym
()
{
pr
otected
static
String
gensym
()
{
return
"x."
+
++
gensymCounter
;
}
...
...
@@ -127,9 +127,9 @@ public class General {
}
for
(
int
i
=
0
;
i
<
dl
.
length
;
i
++)
{
File
f
=
new
File
(
d
,
dl
[
i
]);
if
(
f
.
isDirectory
()
&&
f
.
canRead
()
)
{
if
(
f
.
isDirectory
())
{
String
[]
dl2
=
f
.
list
();
if
(
dl2
.
length
>=
250
)
{
if
(
dl2
==
null
||
dl2
.
length
>=
250
)
{
/* Heuristic to avoid scanning huge directories */
continue
;
}
...
...
@@ -277,8 +277,8 @@ public class General {
{
check
(
ans
,
ask
+
slash
);
checkNames
(
depth
,
create
,
ans
.
endsWith
(
File
.
separator
)
?
ans
:
ans
+
File
.
separator
,
ask
+
slash
);
ans
,
ask
);
}
...
...
@@ -308,13 +308,16 @@ public class General {
String
ans
,
String
ask
)
throws
Exception
{
ans
=
ans
.
endsWith
(
File
.
separator
)
?
ans
:
ans
+
File
.
separator
;
ask
=
ask
.
endsWith
(
File
.
separator
)
?
ask
:
ask
+
File
.
separator
;
int
d
=
depth
-
1
;
File
f
=
new
File
(
ans
);
String
n
;
/* Normal name */
if
(
f
.
exists
())
{
if
(
f
.
isDirectory
()
&&
f
.
canRead
()
)
{
if
(
f
.
isDirectory
()
&&
f
.
list
()
!=
null
)
{
if
((
n
=
findSomeFile
(
ans
,
create
))
!=
null
)
checkSlashes
(
d
,
create
,
ans
+
n
,
ask
+
n
);
if
((
n
=
findSomeDir
(
ans
,
create
))
!=
null
)
...
...
test/java/io/pathNames/GeneralWin32.java
浏览文件 @
f42e9730
/*
* Copyright (c) 1998, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
3
, 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
...
...
@@ -22,7 +22,7 @@
*/
/* @test
@bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520
@bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520
8009258
@summary General exhaustive test of win32 pathname handling
@author Mark Reinhold
...
...
@@ -31,8 +31,6 @@
*/
import
java.io.*
;
import
java.util.*
;
public
class
GeneralWin32
extends
General
{
...
...
@@ -49,25 +47,29 @@ public class GeneralWin32 extends General {
private
static
final
String
EXISTENT_UNC_SHARE
=
"pcdist"
;
private
static
final
String
NONEXISTENT_UNC_HOST
=
"non-existent-unc-host"
;
private
static
final
String
NONEXISTENT_UNC_SHARE
=
"bogus-share"
;
private
static
final
int
DEPTH
=
2
;
private
static
String
baseDir
=
null
;
private
static
String
userDir
=
null
;
/* Pathnames relative to working directory */
private
static
void
checkCaseLookup
(
String
ud
)
throws
IOException
{
private
static
void
checkCaseLookup
()
throws
IOException
{
/* Use long names here to avoid 8.3 format, which Samba servers often
force to lowercase */
File
d
=
new
File
(
"XyZzY0123"
,
"FOO_bar_BAZ"
);
File
f
=
new
File
(
d
,
"GLORPified"
);
String
relative
=
baseDir
.
substring
(
userDir
.
length
()
+
1
);
File
d1
=
new
File
(
relative
,
"XyZzY0123"
);
File
d2
=
new
File
(
d1
,
"FOO_bar_BAZ"
);
File
f
=
new
File
(
d2
,
"GLORPified"
);
if
(!
f
.
exists
())
{
if
(!
d
.
exists
())
{
if
(!
d
.
mkdirs
())
{
throw
new
RuntimeException
(
"Can't create directory "
+
d
);
if
(!
d
2
.
exists
())
{
if
(!
d
2
.
mkdirs
())
{
throw
new
RuntimeException
(
"Can't create directory "
+
d
2
);
}
}
OutputStream
o
=
new
FileOutputStream
(
f
);
o
.
close
();
}
File
f2
=
new
File
(
d
.
getParent
(),
"mumble"
);
/* For later ud tests */
File
f2
=
new
File
(
d
2
.
getParent
(),
"mumble"
);
/* For later ud tests */
if
(!
f2
.
exists
())
{
OutputStream
o
=
new
FileOutputStream
(
f2
);
o
.
close
();
...
...
@@ -75,11 +77,11 @@ public class GeneralWin32 extends General {
/* Computing the canonical path of a Win32 file should expose the true
case of filenames, rather than just using the input case */
File
y
=
new
File
(
u
d
,
f
.
getPath
());
File
y
=
new
File
(
u
serDir
,
f
.
getPath
());
String
ans
=
y
.
getPath
();
check
(
ans
,
"XyZzY0123\\FOO_bar_BAZ\\GLORPified"
);
check
(
ans
,
"xyzzy0123\\foo_bar_baz\\glorpified"
);
check
(
ans
,
"XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED"
);
check
(
ans
,
relative
+
"\\"
+
"XyZzY0123\\FOO_bar_BAZ\\GLORPified"
);
check
(
ans
,
relative
+
"\\"
+
"xyzzy0123\\foo_bar_baz\\glorpified"
);
check
(
ans
,
relative
+
"\\"
+
"XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED"
);
}
private
static
void
checkWild
(
File
f
)
throws
Exception
{
...
...
@@ -91,18 +93,18 @@ public class GeneralWin32 extends General {
throw
new
Exception
(
"Wildcard path not rejected: "
+
f
);
}
private
static
void
checkWildCards
(
String
ud
)
throws
Exception
{
File
d
=
new
File
(
ud
).
getCanonicalFile
();
private
static
void
checkWildCards
()
throws
Exception
{
File
d
=
new
File
(
baseDir
).
getCanonicalFile
();
checkWild
(
new
File
(
d
,
"*.*"
));
checkWild
(
new
File
(
d
,
"*.???"
));
checkWild
(
new
File
(
new
File
(
d
,
"*.*"
),
"foo"
));
}
private
static
void
checkRelativePaths
()
throws
Exception
{
String
ud
=
System
.
getProperty
(
"user.dir"
).
replace
(
'/'
,
'\\'
);
check
CaseLookup
(
ud
);
checkWildCards
(
ud
);
checkNames
(
3
,
true
,
ud
+
"\\"
,
""
);
checkCaseLookup
(
);
check
WildCards
(
);
String
relative
=
baseDir
.
substring
(
userDir
.
length
()
+
1
);
checkNames
(
3
,
true
,
baseDir
.
toString
(),
relative
);
}
...
...
@@ -134,7 +136,8 @@ public class GeneralWin32 extends General {
String
ans
=
exists
?
df
.
getAbsolutePath
()
:
d
;
if
(!
ans
.
endsWith
(
"\\"
))
ans
=
ans
+
"\\"
;
checkNames
(
depth
,
false
,
ans
,
d
);
String
relative
=
baseDir
.
substring
(
userDir
.
length
()
+
1
);
checkNames
(
depth
,
false
,
ans
+
relative
,
d
+
relative
);
}
private
static
void
checkDrivePaths
()
throws
Exception
{
...
...
@@ -149,7 +152,7 @@ public class GeneralWin32 extends General {
String
s
=
(
"\\\\"
+
NONEXISTENT_UNC_HOST
+
"\\"
+
NONEXISTENT_UNC_SHARE
);
ensureNon
(
s
);
checkSlashes
(
2
,
false
,
s
,
s
);
checkSlashes
(
DEPTH
,
false
,
s
,
s
);
s
=
"\\\\"
+
EXISTENT_UNC_HOST
+
"\\"
+
EXISTENT_UNC_SHARE
;
if
(!(
new
File
(
s
)).
exists
())
{
...
...
@@ -158,7 +161,7 @@ public class GeneralWin32 extends General {
return
;
}
checkSlashes
(
2
,
false
,
s
,
s
);
checkSlashes
(
DEPTH
,
false
,
s
,
s
);
}
...
...
@@ -168,9 +171,33 @@ public class GeneralWin32 extends General {
return
;
}
if
(
args
.
length
>
0
)
debug
=
true
;
userDir
=
System
.
getProperty
(
"user.dir"
);
baseDir
=
initTestData
(
6
);
checkRelativePaths
();
checkDrivePaths
();
checkUncPaths
();
}
private
static
String
initTestData
(
int
maxDepth
)
throws
IOException
{
File
parent
=
new
File
(
System
.
getProperty
(
"user.dir"
));
String
baseDir
=
null
;
maxDepth
=
maxDepth
<
DEPTH
+
2
?
DEPTH
+
2
:
maxDepth
;
for
(
int
i
=
0
;
i
<
maxDepth
;
i
++)
{
File
dir1
=
new
File
(
parent
,
gensym
());
dir1
.
mkdir
();
if
(
i
!=
0
)
{
File
dir2
=
new
File
(
parent
,
gensym
());
dir2
.
mkdir
();
File
f1
=
new
File
(
parent
,
gensym
());
f1
.
createNewFile
();
File
f2
=
new
File
(
parent
,
gensym
());
f2
.
createNewFile
();
}
if
(
i
==
DEPTH
+
1
)
{
baseDir
=
dir1
.
getAbsolutePath
();
}
parent
=
dir1
;
}
return
baseDir
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录