Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5b92aa82
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看板
提交
5b92aa82
编写于
3月 12, 2010
作者:
O
ohair
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
fa07efc3
6cc49f11
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
306 addition
and
95 deletion
+306
-95
src/share/classes/java/net/SocketInputStream.java
src/share/classes/java/net/SocketInputStream.java
+6
-2
src/share/classes/java/net/SocksSocketImpl.java
src/share/classes/java/net/SocksSocketImpl.java
+59
-23
src/share/classes/java/util/zip/ZipFile.java
src/share/classes/java/util/zip/ZipFile.java
+16
-3
src/share/native/java/util/zip/ZipFile.c
src/share/native/java/util/zip/ZipFile.c
+3
-2
src/share/native/java/util/zip/zip_util.c
src/share/native/java/util/zip/zip_util.c
+81
-59
src/share/native/java/util/zip/zip_util.h
src/share/native/java/util/zip/zip_util.h
+5
-5
test/ProblemList.txt
test/ProblemList.txt
+0
-1
test/java/net/CookieHandler/CookieHandlerTest.java
test/java/net/CookieHandler/CookieHandlerTest.java
+4
-0
test/java/net/Socket/SocksConnectTimeout.java
test/java/net/Socket/SocksConnectTimeout.java
+132
-0
未找到文件。
src/share/classes/java/net/SocketInputStream.java
浏览文件 @
5b92aa82
...
@@ -118,6 +118,10 @@ class SocketInputStream extends FileInputStream
...
@@ -118,6 +118,10 @@ class SocketInputStream extends FileInputStream
* @exception IOException If an I/O error has occurred.
* @exception IOException If an I/O error has occurred.
*/
*/
public
int
read
(
byte
b
[],
int
off
,
int
length
)
throws
IOException
{
public
int
read
(
byte
b
[],
int
off
,
int
length
)
throws
IOException
{
return
read
(
b
,
off
,
length
,
impl
.
getTimeout
());
}
int
read
(
byte
b
[],
int
off
,
int
length
,
int
timeout
)
throws
IOException
{
int
n
;
int
n
;
// EOF already encountered
// EOF already encountered
...
@@ -143,7 +147,7 @@ class SocketInputStream extends FileInputStream
...
@@ -143,7 +147,7 @@ class SocketInputStream extends FileInputStream
// acquire file descriptor and do the read
// acquire file descriptor and do the read
FileDescriptor
fd
=
impl
.
acquireFD
();
FileDescriptor
fd
=
impl
.
acquireFD
();
try
{
try
{
n
=
socketRead0
(
fd
,
b
,
off
,
length
,
impl
.
getTimeout
()
);
n
=
socketRead0
(
fd
,
b
,
off
,
length
,
timeout
);
if
(
n
>
0
)
{
if
(
n
>
0
)
{
return
n
;
return
n
;
}
}
...
@@ -161,7 +165,7 @@ class SocketInputStream extends FileInputStream
...
@@ -161,7 +165,7 @@ class SocketInputStream extends FileInputStream
impl
.
setConnectionResetPending
();
impl
.
setConnectionResetPending
();
impl
.
acquireFD
();
impl
.
acquireFD
();
try
{
try
{
n
=
socketRead0
(
fd
,
b
,
off
,
length
,
impl
.
getTimeout
()
);
n
=
socketRead0
(
fd
,
b
,
off
,
length
,
timeout
);
if
(
n
>
0
)
{
if
(
n
>
0
)
{
return
n
;
return
n
;
}
}
...
...
src/share/classes/java/net/SocksSocketImpl.java
浏览文件 @
5b92aa82
...
@@ -98,11 +98,31 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -98,11 +98,31 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
super
.
connect
(
new
InetSocketAddress
(
host
,
port
),
timeout
);
super
.
connect
(
new
InetSocketAddress
(
host
,
port
),
timeout
);
}
}
private
static
int
remainingMillis
(
long
deadlineMillis
)
throws
IOException
{
if
(
deadlineMillis
==
0L
)
return
0
;
final
long
remaining
=
deadlineMillis
-
System
.
currentTimeMillis
();
if
(
remaining
>
0
)
return
(
int
)
remaining
;
throw
new
SocketTimeoutException
();
}
private
int
readSocksReply
(
InputStream
in
,
byte
[]
data
)
throws
IOException
{
private
int
readSocksReply
(
InputStream
in
,
byte
[]
data
)
throws
IOException
{
return
readSocksReply
(
in
,
data
,
0L
);
}
private
int
readSocksReply
(
InputStream
in
,
byte
[]
data
,
long
deadlineMillis
)
throws
IOException
{
int
len
=
data
.
length
;
int
len
=
data
.
length
;
int
received
=
0
;
int
received
=
0
;
for
(
int
attempts
=
0
;
received
<
len
&&
attempts
<
3
;
attempts
++)
{
for
(
int
attempts
=
0
;
received
<
len
&&
attempts
<
3
;
attempts
++)
{
int
count
=
in
.
read
(
data
,
received
,
len
-
received
);
int
count
;
try
{
count
=
((
SocketInputStream
)
in
).
read
(
data
,
received
,
len
-
received
,
remainingMillis
(
deadlineMillis
));
}
catch
(
SocketTimeoutException
e
)
{
throw
new
SocketTimeoutException
(
"Connect timed out"
);
}
if
(
count
<
0
)
if
(
count
<
0
)
throw
new
SocketException
(
"Malformed reply from SOCKS server"
);
throw
new
SocketException
(
"Malformed reply from SOCKS server"
);
received
+=
count
;
received
+=
count
;
...
@@ -115,6 +135,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -115,6 +135,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
*/
*/
private
boolean
authenticate
(
byte
method
,
InputStream
in
,
private
boolean
authenticate
(
byte
method
,
InputStream
in
,
BufferedOutputStream
out
)
throws
IOException
{
BufferedOutputStream
out
)
throws
IOException
{
return
authenticate
(
method
,
in
,
out
,
0L
);
}
private
boolean
authenticate
(
byte
method
,
InputStream
in
,
BufferedOutputStream
out
,
long
deadlineMillis
)
throws
IOException
{
// No Authentication required. We're done then!
// No Authentication required. We're done then!
if
(
method
==
NO_AUTH
)
if
(
method
==
NO_AUTH
)
return
true
;
return
true
;
...
@@ -162,7 +188,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -162,7 +188,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out
.
write
(
0
);
out
.
write
(
0
);
out
.
flush
();
out
.
flush
();
byte
[]
data
=
new
byte
[
2
];
byte
[]
data
=
new
byte
[
2
];
int
i
=
readSocksReply
(
in
,
data
);
int
i
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
i
!=
2
||
data
[
1
]
!=
0
)
{
if
(
i
!=
2
||
data
[
1
]
!=
0
)
{
/* RFC 1929 specifies that the connection MUST be closed if
/* RFC 1929 specifies that the connection MUST be closed if
authentication fails */
authentication fails */
...
@@ -201,18 +227,18 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -201,18 +227,18 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// out.write(outToken);
// out.write(outToken);
// out.flush();
// out.flush();
// data = new byte[2];
// data = new byte[2];
// i = readSocksReply(in, data);
// i = readSocksReply(in, data
, deadlineMillis
);
// if (i != 2 || data[1] == 0xff) {
// if (i != 2 || data[1] == 0xff) {
// in.close();
// in.close();
// out.close();
// out.close();
// return false;
// return false;
// }
// }
// i = readSocksReply(in, data);
// i = readSocksReply(in, data
, deadlineMillis
);
// int len = 0;
// int len = 0;
// len = ((int)data[0] & 0xff) << 8;
// len = ((int)data[0] & 0xff) << 8;
// len += data[1];
// len += data[1];
// data = new byte[len];
// data = new byte[len];
// i = readSocksReply(in, data);
// i = readSocksReply(in, data
, deadlineMillis
);
// if (i == len)
// if (i == len)
// return true;
// return true;
// in.close();
// in.close();
...
@@ -231,7 +257,8 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -231,7 +257,8 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
}
private
void
connectV4
(
InputStream
in
,
OutputStream
out
,
private
void
connectV4
(
InputStream
in
,
OutputStream
out
,
InetSocketAddress
endpoint
)
throws
IOException
{
InetSocketAddress
endpoint
,
long
deadlineMillis
)
throws
IOException
{
if
(!(
endpoint
.
getAddress
()
instanceof
Inet4Address
))
{
if
(!(
endpoint
.
getAddress
()
instanceof
Inet4Address
))
{
throw
new
SocketException
(
"SOCKS V4 requires IPv4 only addresses"
);
throw
new
SocketException
(
"SOCKS V4 requires IPv4 only addresses"
);
}
}
...
@@ -249,7 +276,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -249,7 +276,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out
.
write
(
0
);
out
.
write
(
0
);
out
.
flush
();
out
.
flush
();
byte
[]
data
=
new
byte
[
8
];
byte
[]
data
=
new
byte
[
8
];
int
n
=
readSocksReply
(
in
,
data
);
int
n
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
n
!=
8
)
if
(
n
!=
8
)
throw
new
SocketException
(
"Reply from SOCKS server has bad length: "
+
n
);
throw
new
SocketException
(
"Reply from SOCKS server has bad length: "
+
n
);
if
(
data
[
0
]
!=
0
&&
data
[
0
]
!=
4
)
if
(
data
[
0
]
!=
0
&&
data
[
0
]
!=
4
)
...
@@ -296,6 +323,15 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -296,6 +323,15 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
*/
*/
@Override
@Override
protected
void
connect
(
SocketAddress
endpoint
,
int
timeout
)
throws
IOException
{
protected
void
connect
(
SocketAddress
endpoint
,
int
timeout
)
throws
IOException
{
final
long
deadlineMillis
;
if
(
timeout
==
0
)
{
deadlineMillis
=
0L
;
}
else
{
long
finish
=
System
.
currentTimeMillis
()
+
timeout
;
deadlineMillis
=
finish
<
0
?
Long
.
MAX_VALUE
:
finish
;
}
SecurityManager
security
=
System
.
getSecurityManager
();
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
endpoint
==
null
||
!(
endpoint
instanceof
InetSocketAddress
))
if
(
endpoint
==
null
||
!(
endpoint
instanceof
InetSocketAddress
))
throw
new
IllegalArgumentException
(
"Unsupported address type"
);
throw
new
IllegalArgumentException
(
"Unsupported address type"
);
...
@@ -322,7 +358,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -322,7 +358,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
/*
/*
* No default proxySelector --> direct connection
* No default proxySelector --> direct connection
*/
*/
super
.
connect
(
epoint
,
timeout
);
super
.
connect
(
epoint
,
remainingMillis
(
deadlineMillis
)
);
return
;
return
;
}
}
URI
uri
;
URI
uri
;
...
@@ -345,13 +381,13 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -345,13 +381,13 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
java
.
util
.
Iterator
<
Proxy
>
iProxy
=
null
;
java
.
util
.
Iterator
<
Proxy
>
iProxy
=
null
;
iProxy
=
sel
.
select
(
uri
).
iterator
();
iProxy
=
sel
.
select
(
uri
).
iterator
();
if
(
iProxy
==
null
||
!(
iProxy
.
hasNext
()))
{
if
(
iProxy
==
null
||
!(
iProxy
.
hasNext
()))
{
super
.
connect
(
epoint
,
timeout
);
super
.
connect
(
epoint
,
remainingMillis
(
deadlineMillis
)
);
return
;
return
;
}
}
while
(
iProxy
.
hasNext
())
{
while
(
iProxy
.
hasNext
())
{
p
=
iProxy
.
next
();
p
=
iProxy
.
next
();
if
(
p
==
null
||
p
==
Proxy
.
NO_PROXY
)
{
if
(
p
==
null
||
p
==
Proxy
.
NO_PROXY
)
{
super
.
connect
(
epoint
,
timeout
);
super
.
connect
(
epoint
,
remainingMillis
(
deadlineMillis
)
);
return
;
return
;
}
}
if
(
p
.
type
()
!=
Proxy
.
Type
.
SOCKS
)
if
(
p
.
type
()
!=
Proxy
.
Type
.
SOCKS
)
...
@@ -364,7 +400,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -364,7 +400,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// Connects to the SOCKS server
// Connects to the SOCKS server
try
{
try
{
privilegedConnect
(
server
,
serverPort
,
timeout
);
privilegedConnect
(
server
,
serverPort
,
remainingMillis
(
deadlineMillis
)
);
// Worked, let's get outta here
// Worked, let's get outta here
break
;
break
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -388,7 +424,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -388,7 +424,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
else
{
}
else
{
// Connects to the SOCKS server
// Connects to the SOCKS server
try
{
try
{
privilegedConnect
(
server
,
serverPort
,
timeout
);
privilegedConnect
(
server
,
serverPort
,
remainingMillis
(
deadlineMillis
)
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
SocketException
(
e
.
getMessage
());
throw
new
SocketException
(
e
.
getMessage
());
}
}
...
@@ -403,7 +439,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -403,7 +439,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// DOMAIN type of addresses (unresolved addresses here)
// DOMAIN type of addresses (unresolved addresses here)
if
(
epoint
.
isUnresolved
())
if
(
epoint
.
isUnresolved
())
throw
new
UnknownHostException
(
epoint
.
toString
());
throw
new
UnknownHostException
(
epoint
.
toString
());
connectV4
(
in
,
out
,
epoint
);
connectV4
(
in
,
out
,
epoint
,
deadlineMillis
);
return
;
return
;
}
}
...
@@ -414,7 +450,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -414,7 +450,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out
.
write
(
USER_PASSW
);
out
.
write
(
USER_PASSW
);
out
.
flush
();
out
.
flush
();
byte
[]
data
=
new
byte
[
2
];
byte
[]
data
=
new
byte
[
2
];
int
i
=
readSocksReply
(
in
,
data
);
int
i
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
i
!=
2
||
((
int
)
data
[
0
])
!=
PROTO_VERS
)
{
if
(
i
!=
2
||
((
int
)
data
[
0
])
!=
PROTO_VERS
)
{
// Maybe it's not a V5 sever after all
// Maybe it's not a V5 sever after all
// Let's try V4 before we give up
// Let's try V4 before we give up
...
@@ -422,12 +458,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -422,12 +458,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// DOMAIN type of addresses (unresolved addresses here)
// DOMAIN type of addresses (unresolved addresses here)
if
(
epoint
.
isUnresolved
())
if
(
epoint
.
isUnresolved
())
throw
new
UnknownHostException
(
epoint
.
toString
());
throw
new
UnknownHostException
(
epoint
.
toString
());
connectV4
(
in
,
out
,
epoint
);
connectV4
(
in
,
out
,
epoint
,
deadlineMillis
);
return
;
return
;
}
}
if
(((
int
)
data
[
1
])
==
NO_METHODS
)
if
(((
int
)
data
[
1
])
==
NO_METHODS
)
throw
new
SocketException
(
"SOCKS : No acceptable methods"
);
throw
new
SocketException
(
"SOCKS : No acceptable methods"
);
if
(!
authenticate
(
data
[
1
],
in
,
out
))
{
if
(!
authenticate
(
data
[
1
],
in
,
out
,
deadlineMillis
))
{
throw
new
SocketException
(
"SOCKS : authentication failed"
);
throw
new
SocketException
(
"SOCKS : authentication failed"
);
}
}
out
.
write
(
PROTO_VERS
);
out
.
write
(
PROTO_VERS
);
...
@@ -457,7 +493,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -457,7 +493,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
}
out
.
flush
();
out
.
flush
();
data
=
new
byte
[
4
];
data
=
new
byte
[
4
];
i
=
readSocksReply
(
in
,
data
);
i
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
i
!=
4
)
if
(
i
!=
4
)
throw
new
SocketException
(
"Reply from SOCKS server has bad length"
);
throw
new
SocketException
(
"Reply from SOCKS server has bad length"
);
SocketException
ex
=
null
;
SocketException
ex
=
null
;
...
@@ -469,33 +505,33 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
...
@@ -469,33 +505,33 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
switch
(
data
[
3
])
{
switch
(
data
[
3
])
{
case
IPV4:
case
IPV4:
addr
=
new
byte
[
4
];
addr
=
new
byte
[
4
];
i
=
readSocksReply
(
in
,
addr
);
i
=
readSocksReply
(
in
,
addr
,
deadlineMillis
);
if
(
i
!=
4
)
if
(
i
!=
4
)
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
data
=
new
byte
[
2
];
data
=
new
byte
[
2
];
i
=
readSocksReply
(
in
,
data
);
i
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
i
!=
2
)
if
(
i
!=
2
)
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
break
;
break
;
case
DOMAIN_NAME:
case
DOMAIN_NAME:
len
=
data
[
1
];
len
=
data
[
1
];
byte
[]
host
=
new
byte
[
len
];
byte
[]
host
=
new
byte
[
len
];
i
=
readSocksReply
(
in
,
host
);
i
=
readSocksReply
(
in
,
host
,
deadlineMillis
);
if
(
i
!=
len
)
if
(
i
!=
len
)
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
data
=
new
byte
[
2
];
data
=
new
byte
[
2
];
i
=
readSocksReply
(
in
,
data
);
i
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
i
!=
2
)
if
(
i
!=
2
)
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
break
;
break
;
case
IPV6:
case
IPV6:
len
=
data
[
1
];
len
=
data
[
1
];
addr
=
new
byte
[
len
];
addr
=
new
byte
[
len
];
i
=
readSocksReply
(
in
,
addr
);
i
=
readSocksReply
(
in
,
addr
,
deadlineMillis
);
if
(
i
!=
len
)
if
(
i
!=
len
)
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
data
=
new
byte
[
2
];
data
=
new
byte
[
2
];
i
=
readSocksReply
(
in
,
data
);
i
=
readSocksReply
(
in
,
data
,
deadlineMillis
);
if
(
i
!=
2
)
if
(
i
!=
2
)
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
throw
new
SocketException
(
"Reply from SOCKS server badly formatted"
);
break
;
break
;
...
...
src/share/classes/java/util/zip/ZipFile.java
浏览文件 @
5b92aa82
...
@@ -36,6 +36,8 @@ import java.util.Enumeration;
...
@@ -36,6 +36,8 @@ import java.util.Enumeration;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.NoSuchElementException
;
import
java.util.NoSuchElementException
;
import
java.security.AccessController
;
import
sun.security.action.GetPropertyAction
;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
/**
/**
...
@@ -78,6 +80,17 @@ class ZipFile implements ZipConstants, Closeable {
...
@@ -78,6 +80,17 @@ class ZipFile implements ZipConstants, Closeable {
private
static
native
void
initIDs
();
private
static
native
void
initIDs
();
private
static
final
boolean
usemmap
;
static
{
// A system prpperty to disable mmap use to avoid vm crash when
// in-use zip file is accidently overwritten by others.
String
prop
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"sun.zip.disableMemoryMapping"
));
usemmap
=
(
prop
==
null
||
!(
prop
.
length
()
==
0
||
prop
.
equalsIgnoreCase
(
"true"
)));
}
/**
/**
* Opens a zip file for reading.
* Opens a zip file for reading.
*
*
...
@@ -196,7 +209,7 @@ class ZipFile implements ZipConstants, Closeable {
...
@@ -196,7 +209,7 @@ class ZipFile implements ZipConstants, Closeable {
throw
new
NullPointerException
(
"charset is null"
);
throw
new
NullPointerException
(
"charset is null"
);
this
.
zc
=
ZipCoder
.
get
(
charset
);
this
.
zc
=
ZipCoder
.
get
(
charset
);
long
t0
=
System
.
nanoTime
();
long
t0
=
System
.
nanoTime
();
jzfile
=
open
(
name
,
mode
,
file
.
lastModified
());
jzfile
=
open
(
name
,
mode
,
file
.
lastModified
()
,
usemmap
);
sun
.
misc
.
PerfCounter
.
getZipFileOpenTime
().
addElapsedTimeFrom
(
t0
);
sun
.
misc
.
PerfCounter
.
getZipFileOpenTime
().
addElapsedTimeFrom
(
t0
);
sun
.
misc
.
PerfCounter
.
getZipFileCount
().
increment
();
sun
.
misc
.
PerfCounter
.
getZipFileCount
().
increment
();
this
.
name
=
name
;
this
.
name
=
name
;
...
@@ -673,8 +686,8 @@ class ZipFile implements ZipConstants, Closeable {
...
@@ -673,8 +686,8 @@ class ZipFile implements ZipConstants, Closeable {
}
}
private
static
native
long
open
(
String
name
,
int
mode
,
long
lastModified
)
private
static
native
long
open
(
String
name
,
int
mode
,
long
lastModified
,
throws
IOException
;
boolean
usemmap
)
throws
IOException
;
private
static
native
int
getTotal
(
long
jzfile
);
private
static
native
int
getTotal
(
long
jzfile
);
private
static
native
int
read
(
long
jzfile
,
long
jzentry
,
private
static
native
int
read
(
long
jzfile
,
long
jzentry
,
long
pos
,
byte
[]
b
,
int
off
,
int
len
);
long
pos
,
byte
[]
b
,
int
off
,
int
len
);
...
...
src/share/native/java/util/zip/ZipFile.c
浏览文件 @
5b92aa82
...
@@ -81,7 +81,8 @@ ThrowZipException(JNIEnv *env, const char *msg)
...
@@ -81,7 +81,8 @@ ThrowZipException(JNIEnv *env, const char *msg)
JNIEXPORT
jlong
JNICALL
JNIEXPORT
jlong
JNICALL
Java_java_util_zip_ZipFile_open
(
JNIEnv
*
env
,
jclass
cls
,
jstring
name
,
Java_java_util_zip_ZipFile_open
(
JNIEnv
*
env
,
jclass
cls
,
jstring
name
,
jint
mode
,
jlong
lastModified
)
jint
mode
,
jlong
lastModified
,
jboolean
usemmap
)
{
{
const
char
*
path
=
JNU_GetStringPlatformChars
(
env
,
name
,
0
);
const
char
*
path
=
JNU_GetStringPlatformChars
(
env
,
name
,
0
);
char
*
msg
=
0
;
char
*
msg
=
0
;
...
@@ -109,7 +110,7 @@ Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
...
@@ -109,7 +110,7 @@ Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
goto
finally
;
goto
finally
;
}
}
#endif
#endif
zip
=
ZIP_Put_In_Cache
(
path
,
zfd
,
&
msg
,
lastModified
);
zip
=
ZIP_Put_In_Cache
0
(
path
,
zfd
,
&
msg
,
lastModified
,
usemmap
);
}
}
if
(
zip
!=
0
)
{
if
(
zip
!=
0
)
{
...
...
src/share/native/java/util/zip/zip_util.c
浏览文件 @
5b92aa82
...
@@ -251,11 +251,16 @@ freeZip(jzfile *zip)
...
@@ -251,11 +251,16 @@ freeZip(jzfile *zip)
if
(
zip
->
lock
!=
NULL
)
MDESTROY
(
zip
->
lock
);
if
(
zip
->
lock
!=
NULL
)
MDESTROY
(
zip
->
lock
);
free
(
zip
->
name
);
free
(
zip
->
name
);
freeCEN
(
zip
);
freeCEN
(
zip
);
#ifdef USE_MMAP
#ifdef USE_MMAP
if
(
zip
->
maddr
!=
NULL
)
munmap
((
char
*
)
zip
->
maddr
,
zip
->
mlen
);
if
(
zip
->
usemmap
)
{
#else
if
(
zip
->
maddr
!=
NULL
)
free
(
zip
->
cencache
.
data
);
munmap
((
char
*
)
zip
->
maddr
,
zip
->
mlen
);
}
else
#endif
#endif
{
free
(
zip
->
cencache
.
data
);
}
if
(
zip
->
comment
!=
NULL
)
if
(
zip
->
comment
!=
NULL
)
free
(
zip
->
comment
);
free
(
zip
->
comment
);
if
(
zip
->
zfd
!=
-
1
)
ZFILE_Close
(
zip
->
zfd
);
if
(
zip
->
zfd
!=
-
1
)
ZFILE_Close
(
zip
->
zfd
);
...
@@ -585,49 +590,53 @@ readCEN(jzfile *zip, jint knownTotal)
...
@@ -585,49 +590,53 @@ readCEN(jzfile *zip, jint knownTotal)
ZIP_FORMAT_ERROR
(
"invalid END header (bad central directory offset)"
);
ZIP_FORMAT_ERROR
(
"invalid END header (bad central directory offset)"
);
#ifdef USE_MMAP
#ifdef USE_MMAP
/* On Solaris & Linux prior to JDK 6, we used to mmap the whole jar file to
if
(
zip
->
usemmap
)
{
* read the jar file contents. However, this greatly increased the perceived
/* On Solaris & Linux prior to JDK 6, we used to mmap the whole jar file to
* footprint numbers because the mmap'ed pages were adding into the totals shown
* read the jar file contents. However, this greatly increased the perceived
* by 'ps' and 'top'. We switched to mmaping only the central directory of jar
* footprint numbers because the mmap'ed pages were adding into the totals shown
* file while calling 'read' to read the rest of jar file. Here are a list of
* by 'ps' and 'top'. We switched to mmaping only the central directory of jar
* reasons apart from above of why we are doing so:
* file while calling 'read' to read the rest of jar file. Here are a list of
* 1. Greatly reduces mmap overhead after startup complete;
* reasons apart from above of why we are doing so:
* 2. Avoids dual path code maintainance;
* 1. Greatly reduces mmap overhead after startup complete;
* 3. Greatly reduces risk of address space (not virtual memory) exhaustion.
* 2. Avoids dual path code maintainance;
*/
* 3. Greatly reduces risk of address space (not virtual memory) exhaustion.
if
(
pagesize
==
0
)
{
*/
pagesize
=
(
jlong
)
sysconf
(
_SC_PAGESIZE
);
if
(
pagesize
==
0
)
{
if
(
pagesize
==
0
)
goto
Catch
;
pagesize
=
(
jlong
)
sysconf
(
_SC_PAGESIZE
);
}
if
(
pagesize
==
0
)
goto
Catch
;
if
(
cenpos
>
pagesize
)
{
offset
=
cenpos
&
~
(
pagesize
-
1
);
}
else
{
offset
=
0
;
}
/* When we are not calling recursively, knownTotal is -1. */
if
(
knownTotal
==
-
1
)
{
void
*
mappedAddr
;
/* Mmap the CEN and END part only. We have to figure
out the page size in order to make offset to be multiples of
page size.
*/
zip
->
mlen
=
cenpos
-
offset
+
cenlen
+
endhdrlen
;
zip
->
offset
=
offset
;
mappedAddr
=
mmap64
(
0
,
zip
->
mlen
,
PROT_READ
,
MAP_SHARED
,
zip
->
zfd
,
(
off64_t
)
offset
);
zip
->
maddr
=
(
mappedAddr
==
(
void
*
)
MAP_FAILED
)
?
NULL
:
(
unsigned
char
*
)
mappedAddr
;
if
(
zip
->
maddr
==
NULL
)
{
jio_fprintf
(
stderr
,
"mmap failed for CEN and END part of zip file
\n
"
);
goto
Catch
;
}
}
}
if
(
cenpos
>
pagesize
)
{
cenbuf
=
zip
->
maddr
+
cenpos
-
offset
;
offset
=
cenpos
&
~
(
pagesize
-
1
);
#else
}
else
{
if
((
cenbuf
=
malloc
((
size_t
)
cenlen
))
==
NULL
||
offset
=
0
;
(
readFullyAt
(
zip
->
zfd
,
cenbuf
,
cenlen
,
cenpos
)
==
-
1
))
}
goto
Catch
;
/* When we are not calling recursively, knownTotal is -1. */
if
(
knownTotal
==
-
1
)
{
void
*
mappedAddr
;
/* Mmap the CEN and END part only. We have to figure
out the page size in order to make offset to be multiples of
page size.
*/
zip
->
mlen
=
cenpos
-
offset
+
cenlen
+
endhdrlen
;
zip
->
offset
=
offset
;
mappedAddr
=
mmap64
(
0
,
zip
->
mlen
,
PROT_READ
,
MAP_SHARED
,
zip
->
zfd
,
(
off64_t
)
offset
);
zip
->
maddr
=
(
mappedAddr
==
(
void
*
)
MAP_FAILED
)
?
NULL
:
(
unsigned
char
*
)
mappedAddr
;
if
(
zip
->
maddr
==
NULL
)
{
jio_fprintf
(
stderr
,
"mmap failed for CEN and END part of zip file
\n
"
);
goto
Catch
;
}
}
cenbuf
=
zip
->
maddr
+
cenpos
-
offset
;
}
else
#endif
#endif
{
if
((
cenbuf
=
malloc
((
size_t
)
cenlen
))
==
NULL
||
(
readFullyAt
(
zip
->
zfd
,
cenbuf
,
cenlen
,
cenpos
)
==
-
1
))
goto
Catch
;
}
cenend
=
cenbuf
+
cenlen
;
cenend
=
cenbuf
+
cenlen
;
/* Initialize zip file data structures based on the total number
/* Initialize zip file data structures based on the total number
...
@@ -700,9 +709,11 @@ readCEN(jzfile *zip, jint knownTotal)
...
@@ -700,9 +709,11 @@ readCEN(jzfile *zip, jint knownTotal)
cenpos
=
-
1
;
cenpos
=
-
1
;
Finally:
Finally:
#if
n
def USE_MMAP
#ifdef USE_MMAP
free
(
cenbuf
);
if
(
!
zip
->
usemmap
)
#endif
#endif
free
(
cenbuf
);
return
cenpos
;
return
cenpos
;
}
}
...
@@ -782,8 +793,16 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
...
@@ -782,8 +793,16 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
* If a zip error occurs, then *pmsg will be set to the error message text if
* If a zip error occurs, then *pmsg will be set to the error message text if
* pmsg != 0. Otherwise, *pmsg will be set to NULL.
* pmsg != 0. Otherwise, *pmsg will be set to NULL.
*/
*/
jzfile
*
jzfile
*
ZIP_Put_In_Cache
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
)
ZIP_Put_In_Cache
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
)
{
return
ZIP_Put_In_Cache0
(
name
,
zfd
,
pmsg
,
lastModified
,
JNI_TRUE
);
}
jzfile
*
ZIP_Put_In_Cache0
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
,
jboolean
usemmap
)
{
{
static
char
errbuf
[
256
];
static
char
errbuf
[
256
];
jlong
len
;
jlong
len
;
...
@@ -793,6 +812,9 @@ ZIP_Put_In_Cache(const char *name, ZFILE zfd, char **pmsg, jlong lastModified)
...
@@ -793,6 +812,9 @@ ZIP_Put_In_Cache(const char *name, ZFILE zfd, char **pmsg, jlong lastModified)
return
NULL
;
return
NULL
;
}
}
#ifdef USE_MMAP
zip
->
usemmap
=
usemmap
;
#endif
zip
->
refs
=
1
;
zip
->
refs
=
1
;
zip
->
lastModified
=
lastModified
;
zip
->
lastModified
=
lastModified
;
...
@@ -877,8 +899,6 @@ ZIP_Close(jzfile *zip)
...
@@ -877,8 +899,6 @@ ZIP_Close(jzfile *zip)
return
;
return
;
}
}
#ifndef USE_MMAP
/* Empirically, most CEN headers are smaller than this. */
/* Empirically, most CEN headers are smaller than this. */
#define AMPLE_CEN_HEADER_SIZE 160
#define AMPLE_CEN_HEADER_SIZE 160
...
@@ -928,7 +948,6 @@ sequentialAccessReadCENHeader(jzfile *zip, jlong cenpos)
...
@@ -928,7 +948,6 @@ sequentialAccessReadCENHeader(jzfile *zip, jlong cenpos)
cache
->
pos
=
cenpos
;
cache
->
pos
=
cenpos
;
return
cen
;
return
cen
;
}
}
#endif
/* not USE_MMAP */
typedef
enum
{
ACCESS_RANDOM
,
ACCESS_SEQUENTIAL
}
AccessHint
;
typedef
enum
{
ACCESS_RANDOM
,
ACCESS_SEQUENTIAL
}
AccessHint
;
...
@@ -953,14 +972,17 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
...
@@ -953,14 +972,17 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
ze
->
comment
=
NULL
;
ze
->
comment
=
NULL
;
#ifdef USE_MMAP
#ifdef USE_MMAP
cen
=
(
char
*
)
zip
->
maddr
+
zc
->
cenpos
-
zip
->
offset
;
if
(
zip
->
usemmap
)
{
#else
cen
=
(
char
*
)
zip
->
maddr
+
zc
->
cenpos
-
zip
->
offset
;
if
(
accessHint
==
ACCESS_RANDOM
)
}
else
cen
=
readCENHeader
(
zip
,
zc
->
cenpos
,
AMPLE_CEN_HEADER_SIZE
);
else
cen
=
sequentialAccessReadCENHeader
(
zip
,
zc
->
cenpos
);
if
(
cen
==
NULL
)
goto
Catch
;
#endif
#endif
{
if
(
accessHint
==
ACCESS_RANDOM
)
cen
=
readCENHeader
(
zip
,
zc
->
cenpos
,
AMPLE_CEN_HEADER_SIZE
);
else
cen
=
sequentialAccessReadCENHeader
(
zip
,
zc
->
cenpos
);
if
(
cen
==
NULL
)
goto
Catch
;
}
nlen
=
CENNAM
(
cen
);
nlen
=
CENNAM
(
cen
);
elen
=
CENEXT
(
cen
);
elen
=
CENEXT
(
cen
);
...
@@ -976,7 +998,6 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
...
@@ -976,7 +998,6 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
if
((
ze
->
name
=
malloc
(
nlen
+
1
))
==
NULL
)
goto
Catch
;
if
((
ze
->
name
=
malloc
(
nlen
+
1
))
==
NULL
)
goto
Catch
;
memcpy
(
ze
->
name
,
cen
+
CENHDR
,
nlen
);
memcpy
(
ze
->
name
,
cen
+
CENHDR
,
nlen
);
ze
->
name
[
nlen
]
=
'\0'
;
ze
->
name
[
nlen
]
=
'\0'
;
if
(
elen
>
0
)
{
if
(
elen
>
0
)
{
char
*
extra
=
cen
+
CENHDR
+
nlen
;
char
*
extra
=
cen
+
CENHDR
+
nlen
;
...
@@ -1037,9 +1058,10 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
...
@@ -1037,9 +1058,10 @@ newEntry(jzfile *zip, jzcell *zc, AccessHint accessHint)
ze
=
NULL
;
ze
=
NULL
;
Finally:
Finally:
#if
n
def USE_MMAP
#ifdef USE_MMAP
if
(
cen
!=
NULL
&&
accessHint
==
ACCESS_RANDOM
)
free
(
cen
);
if
(
!
zip
->
usemmap
)
#endif
#endif
if
(
cen
!=
NULL
&&
accessHint
==
ACCESS_RANDOM
)
free
(
cen
);
return
ze
;
return
ze
;
}
}
...
...
src/share/native/java/util/zip/zip_util.h
浏览文件 @
5b92aa82
...
@@ -45,9 +45,6 @@
...
@@ -45,9 +45,6 @@
* Header sizes including signatures
* Header sizes including signatures
*/
*/
#ifdef USE_MMAP
#define SIGSIZ 4
#endif
#define LOCHDR 30
#define LOCHDR 30
#define EXTHDR 16
#define EXTHDR 16
#define CENHDR 46
#define CENHDR 46
...
@@ -211,9 +208,9 @@ typedef struct jzfile { /* Zip file */
...
@@ -211,9 +208,9 @@ typedef struct jzfile { /* Zip file */
jlong
mlen
;
/* length (in bytes) mmaped */
jlong
mlen
;
/* length (in bytes) mmaped */
jlong
offset
;
/* offset of the mmapped region from the
jlong
offset
;
/* offset of the mmapped region from the
start of the file. */
start of the file. */
#else
jboolean
usemmap
;
/* if mmap is used. */
cencache
cencache
;
/* CEN header cache */
#endif
#endif
cencache
cencache
;
/* CEN header cache */
ZFILE
zfd
;
/* open file descriptor */
ZFILE
zfd
;
/* open file descriptor */
void
*
lock
;
/* read lock */
void
*
lock
;
/* read lock */
char
*
comment
;
/* zip file comment */
char
*
comment
;
/* zip file comment */
...
@@ -259,6 +256,9 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified);
...
@@ -259,6 +256,9 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified);
jzfile
*
jzfile
*
ZIP_Put_In_Cache
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
);
ZIP_Put_In_Cache
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
);
jzfile
*
ZIP_Put_In_Cache0
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
,
jboolean
usemmap
);
void
JNICALL
void
JNICALL
ZIP_Close
(
jzfile
*
zip
);
ZIP_Close
(
jzfile
*
zip
);
...
...
test/ProblemList.txt
浏览文件 @
5b92aa82
...
@@ -700,7 +700,6 @@ java/net/URLConnection/TimeoutTest.java generic-all
...
@@ -700,7 +700,6 @@ java/net/URLConnection/TimeoutTest.java generic-all
java/net/URLConnection/ZeroContentLength.java generic-all
java/net/URLConnection/ZeroContentLength.java generic-all
# Solaris 11 i586 fails with samevm, not sure why
# Solaris 11 i586 fails with samevm, not sure why
java/net/HttpURLConnection/HttpResponseCode.java generic-all
java/net/ResponseCache/B6181108.java generic-all
java/net/ResponseCache/B6181108.java generic-all
java/net/ResponseCache/ResponseCacheTest.java generic-all
java/net/ResponseCache/ResponseCacheTest.java generic-all
java/net/URL/GetContent.java generic-all
java/net/URL/GetContent.java generic-all
...
...
test/java/net/CookieHandler/CookieHandlerTest.java
浏览文件 @
5b92aa82
...
@@ -24,9 +24,13 @@
...
@@ -24,9 +24,13 @@
/* @test
/* @test
* @summary Unit test for java.net.CookieHandler
* @summary Unit test for java.net.CookieHandler
* @bug 4696506
* @bug 4696506
* @run main/othervm CookieHandlerTest
* @author Yingxian Wang
* @author Yingxian Wang
*/
*/
// Run in othervm since a default cookier handler is set and this
// can effect other HTTP related tests.
import
java.net.*
;
import
java.net.*
;
import
java.util.*
;
import
java.util.*
;
import
java.io.*
;
import
java.io.*
;
...
...
test/java/net/Socket/SocksConnectTimeout.java
0 → 100644
浏览文件 @
5b92aa82
/*
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6223635
* @summary Code hangs at connect call even when Timeout is specified
*/
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.net.Proxy
;
import
java.net.Socket
;
import
java.net.ServerSocket
;
import
java.net.SocketTimeoutException
;
import
java.io.IOException
;
import
java.io.Closeable
;
import
java.util.concurrent.Phaser
;
import
java.util.concurrent.TimeUnit
;
public
class
SocksConnectTimeout
{
static
ServerSocket
serverSocket
;
static
final
boolean
debug
=
true
;
static
final
Phaser
startPhaser
=
new
Phaser
(
2
);
static
final
Phaser
finishPhaser
=
new
Phaser
(
2
);
static
int
failed
,
passed
;
public
static
void
main
(
String
[]
args
)
{
try
{
serverSocket
=
new
ServerSocket
(
0
);
(
new
Thread
()
{
@Override
public
void
run
()
{
serve
();
}
}).
start
();
Proxy
socksProxy
=
new
Proxy
(
Proxy
.
Type
.
SOCKS
,
new
InetSocketAddress
(
InetAddress
.
getLocalHost
(),
serverSocket
.
getLocalPort
()));
test
(
socksProxy
);
}
catch
(
IOException
e
)
{
unexpected
(
e
);
}
finally
{
close
(
serverSocket
);
if
(
failed
>
0
)
throw
new
RuntimeException
(
"Test Failed: passed:"
+
passed
+
", failed:"
+
failed
);
}
}
static
void
test
(
Proxy
proxy
)
{
startPhaser
.
arriveAndAwaitAdvance
();
Socket
socket
=
null
;
try
{
socket
=
new
Socket
(
proxy
);
connectWithTimeout
(
socket
);
failed
(
"connected successfully!"
);
}
catch
(
SocketTimeoutException
socketTimeout
)
{
debug
(
"Passed: Received: "
+
socketTimeout
);
passed
();
}
catch
(
Exception
exception
)
{
failed
(
"Connect timeout test failed"
,
exception
);
}
finally
{
finishPhaser
.
arriveAndAwaitAdvance
();
close
(
socket
);
}
}
static
void
connectWithTimeout
(
Socket
socket
)
throws
IOException
{
socket
.
connect
(
new
InetSocketAddress
(
InetAddress
.
getLocalHost
(),
1234
),
500
);
}
static
void
serve
()
{
Socket
client
=
null
;
try
{
startPhaser
.
arriveAndAwaitAdvance
();
client
=
serverSocket
.
accept
();
finishPhaser
.
awaitAdvanceInterruptibly
(
finishPhaser
.
arrive
(),
5
,
TimeUnit
.
SECONDS
);
}
catch
(
Exception
e
)
{
unexpected
(
e
);
}
finally
{
close
(
client
);
}
}
static
void
debug
(
String
message
)
{
if
(
debug
)
System
.
out
.
println
(
message
);
}
static
void
unexpected
(
Exception
e
)
{
System
.
out
.
println
(
"Unexcepted Exception: "
+
e
);
}
static
void
close
(
Closeable
closeable
)
{
if
(
closeable
!=
null
)
try
{
closeable
.
close
();
}
catch
(
IOException
e
)
{
unexpected
(
e
);}
}
static
void
failed
(
String
message
)
{
System
.
out
.
println
(
message
);
failed
++;
}
static
void
failed
(
String
message
,
Exception
e
)
{
System
.
out
.
println
(
message
);
System
.
out
.
println
(
e
);
failed
++;
}
static
void
passed
()
{
passed
++;
};
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录