Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0889428f
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看板
提交
0889428f
编写于
1月 03, 2020
作者:
A
andrew
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8138978: Examine usages of sun.misc.IOUtils
Reviewed-by: mbalao
上级
149b89c9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
50 addition
and
17 deletion
+50
-17
src/share/classes/com/sun/jndi/ldap/Connection.java
src/share/classes/com/sun/jndi/ldap/Connection.java
+26
-3
src/share/classes/java/util/jar/JarFile.java
src/share/classes/java/util/jar/JarFile.java
+6
-1
src/share/classes/sun/applet/AppletClassLoader.java
src/share/classes/sun/applet/AppletClassLoader.java
+4
-1
src/share/classes/sun/reflect/misc/MethodUtil.java
src/share/classes/sun/reflect/misc/MethodUtil.java
+7
-9
src/share/classes/sun/security/timestamp/HttpTimestamper.java
...share/classes/sun/security/timestamp/HttpTimestamper.java
+6
-2
test/sun/security/tools/jarsigner/TimestampCheck.java
test/sun/security/tools/jarsigner/TimestampCheck.java
+1
-1
未找到文件。
src/share/classes/com/sun/jndi/ldap/Connection.java
浏览文件 @
0889428f
...
...
@@ -47,8 +47,6 @@ import javax.naming.ldap.Control;
import
javax.net.ssl.SSLParameters
;
import
javax.net.ssl.SSLSocket
;
import
sun.misc.IOUtils
;
/**
* A thread that creates a connection to an LDAP server.
* After the connection, the thread reads from the connection.
...
...
@@ -886,7 +884,7 @@ public final class Connection implements Runnable {
}
// read in seqlen bytes
byte
[]
left
=
IOUtils
.
readFully
(
in
,
seqlen
,
false
);
byte
[]
left
=
readFully
(
in
,
seqlen
);
inbuf
=
Arrays
.
copyOf
(
inbuf
,
offset
+
left
.
length
);
System
.
arraycopy
(
left
,
0
,
inbuf
,
offset
,
left
.
length
);
offset
+=
left
.
length
;
...
...
@@ -981,6 +979,31 @@ System.err.println("bytesread: " + bytesread);
}
}
private
static
byte
[]
readFully
(
InputStream
is
,
int
length
)
throws
IOException
{
byte
[]
buf
=
new
byte
[
Math
.
min
(
length
,
8192
)];
int
nread
=
0
;
while
(
nread
<
length
)
{
int
bytesToRead
;
if
(
nread
>=
buf
.
length
)
{
// need to allocate a larger buffer
bytesToRead
=
Math
.
min
(
length
-
nread
,
buf
.
length
+
8192
);
if
(
buf
.
length
<
nread
+
bytesToRead
)
{
buf
=
Arrays
.
copyOf
(
buf
,
nread
+
bytesToRead
);
}
}
else
{
bytesToRead
=
buf
.
length
-
nread
;
}
int
count
=
is
.
read
(
buf
,
nread
,
bytesToRead
);
if
(
count
<
0
)
{
if
(
buf
.
length
!=
nread
)
buf
=
Arrays
.
copyOf
(
buf
,
nread
);
break
;
}
nread
+=
count
;
}
return
buf
;
}
// This code must be uncommented to run the LdapAbandonTest.
/*public void sendSearchReqs(String dn, int numReqs) {
...
...
src/share/classes/java/util/jar/JarFile.java
浏览文件 @
0889428f
...
...
@@ -422,7 +422,12 @@ class JarFile extends ZipFile {
*/
private
byte
[]
getBytes
(
ZipEntry
ze
)
throws
IOException
{
try
(
InputStream
is
=
super
.
getInputStream
(
ze
))
{
return
IOUtils
.
readFully
(
is
,
(
int
)
ze
.
getSize
(),
true
);
int
len
=
(
int
)
ze
.
getSize
();
byte
[]
b
=
IOUtils
.
readAllBytes
(
is
);
if
(
len
!=
-
1
&&
b
.
length
!=
len
)
throw
new
EOFException
(
"Expected:"
+
len
+
", read:"
+
b
.
length
);
return
b
;
}
}
...
...
src/share/classes/sun/applet/AppletClassLoader.java
浏览文件 @
0889428f
...
...
@@ -33,6 +33,7 @@ import java.net.URLConnection;
import
java.net.MalformedURLException
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.io.EOFException
;
import
java.io.File
;
import
java.io.FilePermission
;
import
java.io.IOException
;
...
...
@@ -333,7 +334,9 @@ public class AppletClassLoader extends URLClassLoader {
byte
[]
b
;
try
{
b
=
IOUtils
.
readFully
(
in
,
len
,
true
);
b
=
IOUtils
.
readAllBytes
(
in
);
if
(
len
!=
-
1
&&
b
.
length
!=
len
)
throw
new
EOFException
(
"Expected:"
+
len
+
", read:"
+
b
.
length
);
}
finally
{
in
.
close
();
}
...
...
src/share/classes/sun/reflect/misc/MethodUtil.java
浏览文件 @
0889428f
...
...
@@ -25,6 +25,7 @@
package
sun.reflect.misc
;
import
java.io.EOFException
;
import
java.security.AllPermission
;
import
java.security.AccessController
;
import
java.security.PermissionCollection
;
...
...
@@ -42,8 +43,8 @@ import java.lang.reflect.AccessibleObject;
import
java.lang.reflect.Modifier
;
import
java.util.HashMap
;
import
java.util.Map
;
import
sun.misc.IOUtils
;
import
sun.misc.IOUtils
;
class
Trampoline
{
static
{
...
...
@@ -382,15 +383,12 @@ public final class MethodUtil extends SecureClassLoader {
}
}
int
len
=
uc
.
getContentLength
();
InputStream
in
=
new
BufferedInputStream
(
uc
.
getInputStream
());
byte
[]
b
;
try
{
b
=
IOUtils
.
readFully
(
in
,
len
,
true
);
}
finally
{
in
.
close
();
try
(
InputStream
in
=
new
BufferedInputStream
(
uc
.
getInputStream
()))
{
byte
[]
b
=
IOUtils
.
readAllBytes
(
in
);
if
(
len
!=
-
1
&&
b
.
length
!=
len
)
throw
new
EOFException
(
"Expected:"
+
len
+
", read:"
+
b
.
length
);
return
b
;
}
return
b
;
}
...
...
src/share/classes/sun/security/timestamp/HttpTimestamper.java
浏览文件 @
0889428f
...
...
@@ -27,6 +27,7 @@ package sun.security.timestamp;
import
java.io.BufferedInputStream
;
import
java.io.DataOutputStream
;
import
java.io.EOFException
;
import
java.io.IOException
;
import
java.net.URI
;
import
java.net.URL
;
...
...
@@ -147,8 +148,11 @@ public class HttpTimestamper implements Timestamper {
}
verifyMimeType
(
connection
.
getContentType
());
int
contentLength
=
connection
.
getContentLength
();
replyBuffer
=
IOUtils
.
readFully
(
input
,
contentLength
,
false
);
int
clen
=
connection
.
getContentLength
();
replyBuffer
=
IOUtils
.
readAllBytes
(
input
);
if
(
clen
!=
-
1
&&
replyBuffer
.
length
!=
clen
)
throw
new
EOFException
(
"Expected:"
+
clen
+
", read:"
+
replyBuffer
.
length
);
if
(
debug
!=
null
)
{
debug
.
println
(
"received timestamp response (length="
+
...
...
test/sun/security/tools/jarsigner/TimestampCheck.java
浏览文件 @
0889428f
...
...
@@ -743,7 +743,7 @@ public class TimestampCheck {
try
(
JarFile
jf
=
new
JarFile
(
file
))
{
JarEntry
je
=
jf
.
getJarEntry
(
"META-INF/SIGNER.RSA"
);
try
(
InputStream
is
=
jf
.
getInputStream
(
je
))
{
byte
[]
content
=
IOUtils
.
read
Fully
(
is
,
-
1
,
true
);
byte
[]
content
=
IOUtils
.
read
AllBytes
(
is
);
PKCS7
p7
=
new
PKCS7
(
content
);
SignerInfo
[]
si
=
p7
.
getSignerInfos
();
if
(
si
==
null
||
si
.
length
==
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录