Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
52ea57dc
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看板
提交
52ea57dc
编写于
2月 27, 2013
作者:
S
smarks
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8001040: Rework RMI model
Reviewed-by: alanb, ahgross, coffeys, dmocek
上级
7d6df670
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
125 addition
and
7 deletion
+125
-7
src/share/classes/sun/rmi/server/MarshalInputStream.java
src/share/classes/sun/rmi/server/MarshalInputStream.java
+10
-4
test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java
...ava/rmi/registry/classPathCodebase/ClassPathCodebase.java
+2
-1
test/java/rmi/registry/readTest/readTest.sh
test/java/rmi/registry/readTest/readTest.sh
+2
-1
test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java
...RMIClassLoader/downloadArrayClass/DownloadArrayClass.java
+4
-0
test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy
.../server/RMIClassLoader/downloadArrayClass/security.policy
+2
-0
test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java
...ver/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java
+2
-1
test/java/rmi/server/RMIClassLoader/useCodebaseOnlyDefault/UseCodebaseOnlyDefault.java
...Loader/useCodebaseOnlyDefault/UseCodebaseOnlyDefault.java
+100
-0
test/java/rmi/testlibrary/RMID.java
test/java/rmi/testlibrary/RMID.java
+3
-0
未找到文件。
src/share/classes/sun/rmi/server/MarshalInputStream.java
浏览文件 @
52ea57dc
...
...
@@ -55,13 +55,19 @@ import java.rmi.server.RMIClassLoader;
public
class
MarshalInputStream
extends
ObjectInputStream
{
/**
*
v
alue of "java.rmi.server.useCodebaseOnly" property,
*
V
alue of "java.rmi.server.useCodebaseOnly" property,
* as cached at class initialization time.
*
* The default value is true. That is, the value is true
* if the property is absent or is not equal to "false".
* The value is only false when the property is present
* and is equal to "false".
*/
private
static
final
boolean
useCodebaseOnlyProperty
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetBooleanAction
(
"java.rmi.server.useCodebaseOnly"
)).
booleanValue
();
!
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"java.rmi.server.useCodebaseOnly"
,
"true"
))
.
equalsIgnoreCase
(
"false"
);
/** table to hold sun classes to which access is explicitly permitted */
protected
static
Map
<
String
,
Class
<?>>
permittedSunClasses
...
...
test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java
浏览文件 @
52ea57dc
...
...
@@ -31,7 +31,8 @@
*
* @library ../../testlibrary
* @build TestLibrary Dummy
* @run main/othervm/policy=security.policy ClassPathCodebase
* @run main/othervm/policy=security.policy
* -Djava.rmi.server.useCodebaseOnly=false ClassPathCodebase
*/
import
java.io.*
;
...
...
test/java/rmi/registry/readTest/readTest.sh
浏览文件 @
52ea57dc
...
...
@@ -61,7 +61,8 @@ RMIREG_OUT=rmi.out
#start rmiregistry without any local classes on classpath
cd
rmi_tmp
# NOTE: This RMI Registry port must match TestLibrary.READTEST_REGISTRY_PORT
${
TESTJAVA
}${
FS
}
bin
${
FS
}
rmiregistry
${
TESTTOOLVMOPTS
}
64005
>
..
${
FS
}${
RMIREG_OUT
}
2>&1 &
${
TESTJAVA
}${
FS
}
bin
${
FS
}
rmiregistry
-J-Djava
.rmi.server.useCodebaseOnly
=
false
\
${
TESTTOOLVMOPTS
}
64005
>
..
${
FS
}${
RMIREG_OUT
}
2>&1 &
RMIREG_PID
=
$!
# allow some time to start
sleep
3
...
...
test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java
浏览文件 @
52ea57dc
...
...
@@ -64,6 +64,10 @@ public class DownloadArrayClass
TestLibrary
.
bomb
(
e
);
}
System
.
err
.
println
(
"Setting codebase property to: "
+
remoteCodebase
);
System
.
setProperty
(
"java.rmi.server.codebase"
,
remoteCodebase
.
toString
());
/*
* Load Foo from a non-RMI class loader so that it won't be already
* loaded by an RMI class loader in this VM (for whatever that's
...
...
test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy
浏览文件 @
52ea57dc
...
...
@@ -7,6 +7,8 @@ grant codeBase "file:${java.home}/lib/ext/*" {
};
grant {
permission java.util.PropertyPermission
"java.rmi.server.codebase", "read,write";
// permissions needed to move classes into separate codebase directories
permission java.io.FilePermission
...
...
test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java
浏览文件 @
52ea57dc
...
...
@@ -32,7 +32,8 @@
* @library ../../../testlibrary
* @build TestLibrary FnnClass FnnUnmarshal NonpublicInterface
* NonpublicInterface1 PublicInterface PublicInterface1
* @run main/othervm/policy=security.policy LoadProxyClasses
* @run main/othervm/policy=security.policy
* -Djava.rmi.server.useCodebaseOnly=false LoadProxyClasses
*/
import
java.rmi.server.RMIClassLoader
;
...
...
test/java/rmi/server/RMIClassLoader/useCodebaseOnlyDefault/UseCodebaseOnlyDefault.java
0 → 100644
浏览文件 @
52ea57dc
/*
* Copyright (c) 2013, 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
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8001040
* @summary Tests proper parsing and defaulting of the
* "java.rmi.server.useCodebaseOnly" property.
*
* @run main/othervm UseCodebaseOnlyDefault true
* @run main/othervm -Djava.rmi.server.useCodebaseOnly=xyzzy UseCodebaseOnlyDefault true
* @run main/othervm -Djava.rmi.server.useCodebaseOnly UseCodebaseOnlyDefault true
* @run main/othervm -Djava.rmi.server.useCodebaseOnly=true UseCodebaseOnlyDefault true
* @run main/othervm -Djava.rmi.server.useCodebaseOnly=false UseCodebaseOnlyDefault false
*/
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ObjectOutputStream
;
import
java.lang.reflect.Field
;
import
sun.rmi.server.MarshalInputStream
;
/**
* usage: UseCodebaseOnlyDefault expected
*
* 'expected' is the expected value of useCodebaseOnly, which
* must be "true" or "false".
*/
public
class
UseCodebaseOnlyDefault
{
static
final
String
USAGE
=
"usage: UseCodebaseOnlyDefault boolean"
;
static
final
String
PROPNAME
=
"java.rmi.server.useCodebaseOnly"
;
/**
* Gets the actual useCodebaseOnly value by creating an instance
* of MarshalInputStream and reflecting on the useCodebaseOnly field.
*/
static
boolean
getActualValue
()
throws
Exception
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
baos
);
oos
.
writeObject
(
"foo"
);
oos
.
close
();
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
baos
.
toByteArray
());
MarshalInputStream
mis
=
new
MarshalInputStream
(
bais
);
Field
f
=
MarshalInputStream
.
class
.
getDeclaredField
(
"useCodebaseOnly"
);
f
.
setAccessible
(
true
);
return
f
.
getBoolean
(
mis
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
args
.
length
!=
1
)
{
throw
new
IllegalArgumentException
(
USAGE
);
}
boolean
expected
;
if
(
args
[
0
].
equals
(
"true"
))
{
expected
=
true
;
}
else
if
(
args
[
0
].
equals
(
"false"
))
{
expected
=
false
;
}
else
{
throw
new
IllegalArgumentException
(
USAGE
);
}
System
.
out
.
println
(
"expected = "
+
expected
);
String
prop
=
System
.
getProperty
(
PROPNAME
);
System
.
out
.
print
(
"Property "
+
PROPNAME
);
if
(
prop
==
null
)
{
System
.
out
.
println
(
" is not set"
);
}
else
{
System
.
out
.
println
(
" = '"
+
prop
+
"'"
);
}
boolean
actual
=
getActualValue
();
System
.
out
.
println
(
"actual = "
+
actual
);
if
(
expected
!=
actual
)
throw
new
AssertionError
(
"actual does not match expected value"
);
}
}
test/java/rmi/testlibrary/RMID.java
浏览文件 @
52ea57dc
...
...
@@ -108,6 +108,9 @@ public class RMID extends JavaVM {
if
(!
TestParams
.
testClasses
.
equals
(
""
))
{
args
+=
" -C-Dtest.classes="
+
TestParams
.
testClasses
;
}
args
+=
" -C-Djava.rmi.server.useCodebaseOnly=false "
;
args
+=
" "
+
getCodeCoverageArgs
();
return
args
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录