Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9c924c38
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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,发现更多精彩内容 >>
提交
9c924c38
编写于
6月 20, 2011
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7054428: test/java/security/SecureClassLoader/DefineClassByteBuffer.java error
Reviewed-by: alanb
上级
c2cd7724
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
8 deletion
+30
-8
test/ProblemList.txt
test/ProblemList.txt
+0
-1
test/java/security/SecureClassLoader/DefineClassByteBuffer.java
...ava/security/SecureClassLoader/DefineClassByteBuffer.java
+30
-7
未找到文件。
test/ProblemList.txt
浏览文件 @
9c924c38
...
...
@@ -612,7 +612,6 @@ java/security/BasicPermission/PermClass.java generic-all
# Solaris 11 i586, these all fail with samevm, need to be othervm???
java/security/KeyPairGenerator/Failover.java generic-all
java/security/Provider/DefaultPKCS11.java generic-all
java/security/SecureClassLoader/DefineClassByteBuffer.java generic-all
java/security/SecureRandom/GetAlgorithm.java generic-all
java/security/Security/removing/RemoveProviders.java generic-all
java/security/Signature/ByteBuffers.java generic-all
...
...
test/java/security/SecureClassLoader/DefineClassByteBuffer.java
浏览文件 @
9c924c38
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
2011,
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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4894899
* @bug 4894899
7054428
* @summary Test various cases of passing java.nio.ByteBuffers
* to defineClass().
*
...
...
@@ -46,6 +46,17 @@ public class DefineClassByteBuffer {
}
public
static
void
main
(
String
arg
[])
throws
Exception
{
// Rename the compiled TestClass.class file to something else,
// otherwise it would be loaded by the parent class loader and
// DummyClassLoader will never be used, especially in /othervm mode.
File
oldFile
=
new
File
(
System
.
getProperty
(
"test.classes"
,
"."
),
"TestClass.class"
);
File
newFile
=
new
File
(
System
.
getProperty
(
"test.classes"
,
"."
),
"CLAZZ"
);
oldFile
.
renameTo
(
newFile
);
ClassLoader
[]
cls
=
new
ClassLoader
[
DummyClassLoader
.
MAX_TYPE
];
for
(
int
i
=
0
;
i
<
cls
.
length
;
i
++)
{
cls
[
i
]
=
new
DummyClassLoader
(
i
);
...
...
@@ -54,7 +65,11 @@ public class DefineClassByteBuffer {
/* Create several instances of the class using different classloaders,
which are using different types of ByteBuffer. */
for
(
int
i
=
0
;
i
<
cls
.
length
;
i
++)
{
test
(
cls
[
i
]);
test
(
cls
[
i
]);
}
if
(
DummyClassLoader
.
count
!=
cls
.
length
)
{
throw
new
Exception
(
"DummyClassLoader not always used"
);
}
}
...
...
@@ -75,6 +90,8 @@ public class DefineClassByteBuffer {
int
loaderType
;
static
int
count
=
0
;
DummyClassLoader
(
int
loaderType
)
{
this
.
loaderType
=
loaderType
;
}
...
...
@@ -84,10 +101,11 @@ public class DefineClassByteBuffer {
static
ByteBuffer
readClassFile
(
String
name
)
{
try
{
File
f
=
new
File
(
System
.
getProperty
(
"test.classes"
,
"."
),
name
);
FileInputStream
fin
=
new
FileInputStream
(
f
);
FileChannel
fc
=
fin
.
getChannel
();
return
fc
.
map
(
FileChannel
.
MapMode
.
READ_ONLY
,
0
,
fc
.
size
());
"CLAZZ"
);
try
(
FileInputStream
fin
=
new
FileInputStream
(
f
);
FileChannel
fc
=
fin
.
getChannel
())
{
return
fc
.
map
(
FileChannel
.
MapMode
.
READ_ONLY
,
0
,
fc
.
size
());
}
}
catch
(
FileNotFoundException
e
)
{
throw
new
RuntimeException
(
"Can't open file: "
+
name
,
e
);
}
catch
(
IOException
e
)
{
...
...
@@ -101,12 +119,16 @@ public class DefineClassByteBuffer {
buffers. */
buffers
[
MAPPED_BUFFER
]
=
readClassFile
(
CLASS_NAME
+
".class"
);
byte
[]
array
=
new
byte
[
buffers
[
MAPPED_BUFFER
].
limit
()];
buffers
[
MAPPED_BUFFER
].
get
(
array
);
buffers
[
MAPPED_BUFFER
].
flip
();
buffers
[
DIRECT_BUFFER
]
=
ByteBuffer
.
allocateDirect
(
array
.
length
);
buffers
[
DIRECT_BUFFER
].
put
(
array
);
buffers
[
DIRECT_BUFFER
].
flip
();
buffers
[
ARRAY_BUFFER
]
=
ByteBuffer
.
allocate
(
array
.
length
);
buffers
[
ARRAY_BUFFER
].
put
(
array
);
buffers
[
ARRAY_BUFFER
].
flip
();
buffers
[
WRAPPED_BUFFER
]
=
ByteBuffer
.
wrap
(
array
);
...
...
@@ -121,6 +143,7 @@ public class DefineClassByteBuffer {
public
Class
findClass
(
String
name
)
{
CodeSource
cs
=
null
;
count
++;
return
defineClass
(
name
,
buffers
[
loaderType
],
cs
);
}
}
/* DummyClassLoader */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录