Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
01b6efab
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看板
提交
01b6efab
编写于
6月 15, 2012
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7162473: ConstructorFinder/FieldFinder/MethodFinder gives access to restricted classes
Reviewed-by: art, ahgross
上级
0070da84
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
6 deletion
+13
-6
src/share/classes/com/sun/beans/finder/ConstructorFinder.java
...share/classes/com/sun/beans/finder/ConstructorFinder.java
+4
-2
src/share/classes/com/sun/beans/finder/FieldFinder.java
src/share/classes/com/sun/beans/finder/FieldFinder.java
+5
-2
src/share/classes/com/sun/beans/finder/MethodFinder.java
src/share/classes/com/sun/beans/finder/MethodFinder.java
+4
-2
未找到文件。
src/share/classes/com/sun/beans/finder/ConstructorFinder.java
浏览文件 @
01b6efab
/*
/*
* Copyright (c) 2008, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -29,6 +29,8 @@ import com.sun.beans.WeakCache;
...
@@ -29,6 +29,8 @@ import com.sun.beans.WeakCache;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Modifier
;
import
static
sun
.
reflect
.
misc
.
ReflectUtil
.
isPackageAccessible
;
/**
/**
* This utility class provides {@code static} methods
* This utility class provides {@code static} methods
* to find a public constructor with specified parameter types
* to find a public constructor with specified parameter types
...
@@ -61,7 +63,7 @@ public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
...
@@ -61,7 +63,7 @@ public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
if
(
Modifier
.
isAbstract
(
type
.
getModifiers
()))
{
if
(
Modifier
.
isAbstract
(
type
.
getModifiers
()))
{
throw
new
NoSuchMethodException
(
"Abstract class cannot be instantiated"
);
throw
new
NoSuchMethodException
(
"Abstract class cannot be instantiated"
);
}
}
if
(!
Modifier
.
isPublic
(
type
.
getModifiers
()))
{
if
(!
Modifier
.
isPublic
(
type
.
getModifiers
())
||
!
isPackageAccessible
(
type
)
)
{
throw
new
NoSuchMethodException
(
"Class is not accessible"
);
throw
new
NoSuchMethodException
(
"Class is not accessible"
);
}
}
PrimitiveWrapperMap
.
replacePrimitivesWithWrappers
(
args
);
PrimitiveWrapperMap
.
replacePrimitivesWithWrappers
(
args
);
...
...
src/share/classes/com/sun/beans/finder/FieldFinder.java
浏览文件 @
01b6efab
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2012,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -27,6 +27,8 @@ package com.sun.beans.finder;
...
@@ -27,6 +27,8 @@ package com.sun.beans.finder;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Modifier
;
import
static
sun
.
reflect
.
misc
.
ReflectUtil
.
isPackageAccessible
;
/**
/**
* This utility class provides {@code static} methods
* This utility class provides {@code static} methods
* to find a public field with specified name
* to find a public field with specified name
...
@@ -56,7 +58,8 @@ public final class FieldFinder {
...
@@ -56,7 +58,8 @@ public final class FieldFinder {
if
(!
Modifier
.
isPublic
(
field
.
getModifiers
()))
{
if
(!
Modifier
.
isPublic
(
field
.
getModifiers
()))
{
throw
new
NoSuchFieldException
(
"Field '"
+
name
+
"' is not public"
);
throw
new
NoSuchFieldException
(
"Field '"
+
name
+
"' is not public"
);
}
}
if
(!
Modifier
.
isPublic
(
field
.
getDeclaringClass
().
getModifiers
()))
{
type
=
field
.
getDeclaringClass
();
if
(!
Modifier
.
isPublic
(
type
.
getModifiers
())
||
!
isPackageAccessible
(
type
))
{
throw
new
NoSuchFieldException
(
"Field '"
+
name
+
"' is not accessible"
);
throw
new
NoSuchFieldException
(
"Field '"
+
name
+
"' is not accessible"
);
}
}
return
field
;
return
field
;
...
...
src/share/classes/com/sun/beans/finder/MethodFinder.java
浏览文件 @
01b6efab
/*
/*
* Copyright (c) 2008, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,6 +33,8 @@ import java.lang.reflect.ParameterizedType;
...
@@ -33,6 +33,8 @@ import java.lang.reflect.ParameterizedType;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
static
sun
.
reflect
.
misc
.
ReflectUtil
.
isPackageAccessible
;
/**
/**
* This utility class provides {@code static} methods
* This utility class provides {@code static} methods
* to find a public method with specified name and parameter types
* to find a public method with specified name and parameter types
...
@@ -120,7 +122,7 @@ public final class MethodFinder extends AbstractFinder<Method> {
...
@@ -120,7 +122,7 @@ public final class MethodFinder extends AbstractFinder<Method> {
*/
*/
public
static
Method
findAccessibleMethod
(
Method
method
)
throws
NoSuchMethodException
{
public
static
Method
findAccessibleMethod
(
Method
method
)
throws
NoSuchMethodException
{
Class
<?>
type
=
method
.
getDeclaringClass
();
Class
<?>
type
=
method
.
getDeclaringClass
();
if
(
Modifier
.
isPublic
(
type
.
getModifiers
()))
{
if
(
Modifier
.
isPublic
(
type
.
getModifiers
())
&&
isPackageAccessible
(
type
)
)
{
return
method
;
return
method
;
}
}
if
(
Modifier
.
isStatic
(
method
.
getModifiers
()))
{
if
(
Modifier
.
isStatic
(
method
.
getModifiers
()))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录