Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c8465694
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看板
提交
c8465694
编写于
10月 05, 2009
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6854954: Eliminate static dependency on java.awt.AWTPermission
Reviewed-by: mullan, mchung, anthony
上级
7e6594f2
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
207 addition
and
59 deletion
+207
-59
src/share/classes/java/awt/Dialog.java
src/share/classes/java/awt/Dialog.java
+1
-1
src/share/classes/java/awt/MouseInfo.java
src/share/classes/java/awt/MouseInfo.java
+1
-1
src/share/classes/java/awt/Robot.java
src/share/classes/java/awt/Robot.java
+2
-2
src/share/classes/java/awt/SystemTray.java
src/share/classes/java/awt/SystemTray.java
+1
-1
src/share/classes/java/awt/Toolkit.java
src/share/classes/java/awt/Toolkit.java
+4
-4
src/share/classes/java/awt/Window.java
src/share/classes/java/awt/Window.java
+2
-2
src/share/classes/java/lang/SecurityManager.java
src/share/classes/java/lang/SecurityManager.java
+3
-3
src/share/classes/javax/swing/JPopupMenu.java
src/share/classes/javax/swing/JPopupMenu.java
+1
-1
src/share/classes/sun/awt/AWTPermissionFactory.java
src/share/classes/sun/awt/AWTPermissionFactory.java
+42
-0
src/share/classes/sun/security/provider/PolicyFile.java
src/share/classes/sun/security/provider/PolicyFile.java
+0
-3
src/share/classes/sun/security/util/PermissionFactory.java
src/share/classes/sun/security/util/PermissionFactory.java
+36
-0
src/share/classes/sun/security/util/SecurityConstants.java
src/share/classes/sun/security/util/SecurityConstants.java
+114
-41
未找到文件。
src/share/classes/java/awt/Dialog.java
浏览文件 @
c8465694
...
...
@@ -856,7 +856,7 @@ public class Dialog extends Window {
if
(
type
==
ModalityType
.
TOOLKIT_MODAL
)
{
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
sm
.
checkPermission
(
SecurityConstants
.
TOOLKIT_MODALITY_PERMISSION
);
sm
.
checkPermission
(
SecurityConstants
.
AWT
.
TOOLKIT_MODALITY_PERMISSION
);
}
}
modalityType
=
type
;
...
...
src/share/classes/java/awt/MouseInfo.java
浏览文件 @
c8465694
...
...
@@ -76,7 +76,7 @@ public class MouseInfo {
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
WATCH_MOUSE_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
AWT
.
WATCH_MOUSE_PERMISSION
);
}
Point
point
=
new
Point
(
0
,
0
);
...
...
src/share/classes/java/awt/Robot.java
浏览文件 @
c8465694
...
...
@@ -167,7 +167,7 @@ public class Robot {
private
void
checkRobotAllowed
()
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
CREATE_ROBOT_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
AWT
.
CREATE_ROBOT_PERMISSION
);
}
}
...
...
@@ -466,7 +466,7 @@ public class Robot {
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
READ_DISPLAY_PIXELS_PERMISSION
);
SecurityConstants
.
AWT
.
READ_DISPLAY_PIXELS_PERMISSION
);
}
}
...
...
src/share/classes/java/awt/SystemTray.java
浏览文件 @
c8465694
...
...
@@ -490,7 +490,7 @@ public class SystemTray {
static
void
checkSystemTrayAllowed
()
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
ACCESS_SYSTEM_TRAY_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
A
WT
.
A
CCESS_SYSTEM_TRAY_PERMISSION
);
}
}
...
...
src/share/classes/java/awt/Toolkit.java
浏览文件 @
c8465694
...
...
@@ -2025,7 +2025,7 @@ public abstract class Toolkit {
}
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
ALL_AWT_EVENTS_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
A
WT
.
A
LL_AWT_EVENTS_PERMISSION
);
}
synchronized
(
this
)
{
SelectiveAWTEventListener
selectiveListener
=
...
...
@@ -2094,7 +2094,7 @@ public abstract class Toolkit {
}
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
ALL_AWT_EVENTS_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
A
WT
.
A
LL_AWT_EVENTS_PERMISSION
);
}
synchronized
(
this
)
{
...
...
@@ -2165,7 +2165,7 @@ public abstract class Toolkit {
public
AWTEventListener
[]
getAWTEventListeners
()
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
ALL_AWT_EVENTS_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
A
WT
.
A
LL_AWT_EVENTS_PERMISSION
);
}
synchronized
(
this
)
{
EventListener
[]
la
=
ToolkitEventMulticaster
.
getListeners
(
eventListener
,
AWTEventListener
.
class
);
...
...
@@ -2217,7 +2217,7 @@ public abstract class Toolkit {
public
AWTEventListener
[]
getAWTEventListeners
(
long
eventMask
)
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
ALL_AWT_EVENTS_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
A
WT
.
A
LL_AWT_EVENTS_PERMISSION
);
}
synchronized
(
this
)
{
EventListener
[]
la
=
ToolkitEventMulticaster
.
getListeners
(
eventListener
,
AWTEventListener
.
class
);
...
...
src/share/classes/java/awt/Window.java
浏览文件 @
c8465694
...
...
@@ -1581,7 +1581,7 @@ public class Window extends Container implements Accessible {
if
(
exclusionType
==
Dialog
.
ModalExclusionType
.
TOOLKIT_EXCLUDE
)
{
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
sm
.
checkPermission
(
SecurityConstants
.
TOOLKIT_MODALITY_PERMISSION
);
sm
.
checkPermission
(
SecurityConstants
.
AWT
.
TOOLKIT_MODALITY_PERMISSION
);
}
}
modalExclusionType
=
exclusionType
;
...
...
@@ -2129,7 +2129,7 @@ public class Window extends Container implements Accessible {
public
final
void
setAlwaysOnTop
(
boolean
alwaysOnTop
)
throws
SecurityException
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkPermission
(
SecurityConstants
.
SET_WINDOW_ALWAYS_ON_TOP_PERMISSION
);
security
.
checkPermission
(
SecurityConstants
.
AWT
.
SET_WINDOW_ALWAYS_ON_TOP_PERMISSION
);
}
boolean
oldAlwaysOnTop
;
...
...
src/share/classes/java/lang/SecurityManager.java
浏览文件 @
c8465694
...
...
@@ -1341,7 +1341,7 @@ class SecurityManager {
throw
new
NullPointerException
(
"window can't be null"
);
}
try
{
checkPermission
(
SecurityConstants
.
TOPLEVEL_WINDOW_PERMISSION
);
checkPermission
(
SecurityConstants
.
AWT
.
TOPLEVEL_WINDOW_PERMISSION
);
return
true
;
}
catch
(
SecurityException
se
)
{
// just return false
...
...
@@ -1391,7 +1391,7 @@ class SecurityManager {
* @see #checkPermission(java.security.Permission) checkPermission
*/
public
void
checkSystemClipboardAccess
()
{
checkPermission
(
SecurityConstants
.
ACCESS_CLIPBOARD_PERMISSION
);
checkPermission
(
SecurityConstants
.
A
WT
.
A
CCESS_CLIPBOARD_PERMISSION
);
}
/**
...
...
@@ -1412,7 +1412,7 @@ class SecurityManager {
* @see #checkPermission(java.security.Permission) checkPermission
*/
public
void
checkAwtEventQueueAccess
()
{
checkPermission
(
SecurityConstants
.
CHECK_AWT_EVENTQUEUE_PERMISSION
);
checkPermission
(
SecurityConstants
.
AWT
.
CHECK_AWT_EVENTQUEUE_PERMISSION
);
}
/*
...
...
src/share/classes/javax/swing/JPopupMenu.java
浏览文件 @
c8465694
...
...
@@ -412,7 +412,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
sm
.
checkPermission
(
SecurityConstants
.
SET_WINDOW_ALWAYS_ON_TOP_PERMISSION
);
SecurityConstants
.
AWT
.
SET_WINDOW_ALWAYS_ON_TOP_PERMISSION
);
}
}
catch
(
SecurityException
se
)
{
// There is no permission to show popups over the task bar
...
...
src/share/classes/sun/awt/AWTPermissionFactory.java
0 → 100644
浏览文件 @
c8465694
/*
* Copyright 2009 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* 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.
*/
package
sun.awt
;
import
java.awt.AWTPermission
;
import
sun.security.util.PermissionFactory
;
/**
* A factory object for AWTPermission objects.
*/
public
class
AWTPermissionFactory
implements
PermissionFactory
<
AWTPermission
>
{
@Override
public
AWTPermission
newPermission
(
String
name
)
{
return
new
AWTPermission
(
name
);
}
}
src/share/classes/sun/security/provider/PolicyFile.java
浏览文件 @
c8465694
...
...
@@ -54,7 +54,6 @@ import java.net.SocketPermission;
import
java.net.NetPermission
;
import
java.util.PropertyPermission
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.awt.AWTPermission
;
/*
import javax.security.auth.AuthPermission;
import javax.security.auth.kerberos.ServicePermission;
...
...
@@ -1023,8 +1022,6 @@ public class PolicyFile extends java.security.Policy {
return
new
NetPermission
(
name
,
actions
);
}
else
if
(
claz
.
equals
(
AllPermission
.
class
))
{
return
SecurityConstants
.
ALL_PERMISSION
;
}
else
if
(
claz
.
equals
(
AWTPermission
.
class
))
{
return
new
AWTPermission
(
name
,
actions
);
/*
} else if (claz.equals(ReflectPermission.class)) {
return new ReflectPermission(name, actions);
...
...
src/share/classes/sun/security/util/PermissionFactory.java
0 → 100644
浏览文件 @
c8465694
/*
* Copyright 2009 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* 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.
*/
package
sun.security.util
;
import
java.security.Permission
;
/**
* A factory object that creates Permission objects.
*/
public
interface
PermissionFactory
<
T
extends
Permission
>
{
T
newPermission
(
String
name
);
}
src/share/classes/sun/security/util/SecurityConstants.java
浏览文件 @
c8465694
...
...
@@ -25,12 +25,12 @@
package
sun.security.util
;
import
java.io.FilePermission
;
import
java.awt.AWTPermission
;
import
java.util.PropertyPermission
;
import
java.lang.RuntimePermission
;
import
java.net.SocketPermission
;
import
java.net.NetPermission
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.Permission
;
import
java.security.BasicPermission
;
import
java.security.SecurityPermission
;
import
java.security.AllPermission
;
import
javax.security.auth.AuthPermission
;
...
...
@@ -71,45 +71,118 @@ public final class SecurityConstants {
// sun.security.provider.PolicyFile
public
static
final
AllPermission
ALL_PERMISSION
=
new
AllPermission
();
// java.lang.SecurityManager
public
static
final
AWTPermission
TOPLEVEL_WINDOW_PERMISSION
=
new
AWTPermission
(
"showWindowWithoutWarningBanner"
);
// java.lang.SecurityManager
public
static
final
AWTPermission
ACCESS_CLIPBOARD_PERMISSION
=
new
AWTPermission
(
"accessClipboard"
);
// java.lang.SecurityManager
public
static
final
AWTPermission
CHECK_AWT_EVENTQUEUE_PERMISSION
=
new
AWTPermission
(
"accessEventQueue"
);
// java.awt.Dialog
public
static
final
AWTPermission
TOOLKIT_MODALITY_PERMISSION
=
new
AWTPermission
(
"toolkitModality"
);
// java.awt.Robot
public
static
final
AWTPermission
READ_DISPLAY_PIXELS_PERMISSION
=
new
AWTPermission
(
"readDisplayPixels"
);
// java.awt.Robot
public
static
final
AWTPermission
CREATE_ROBOT_PERMISSION
=
new
AWTPermission
(
"createRobot"
);
// java.awt.MouseInfo
public
static
final
AWTPermission
WATCH_MOUSE_PERMISSION
=
new
AWTPermission
(
"watchMousePointer"
);
// java.awt.Window
public
static
final
AWTPermission
SET_WINDOW_ALWAYS_ON_TOP_PERMISSION
=
new
AWTPermission
(
"setWindowAlwaysOnTop"
);
/**
* Permission type used when AWT is not present.
*/
private
static
class
FakeAWTPermission
extends
BasicPermission
{
private
static
final
long
serialVersionUID
=
-
1L
;
public
FakeAWTPermission
(
String
name
)
{
super
(
name
);
}
public
String
toString
()
{
return
"(\"java.awt.AWTPermission\" \""
+
getName
()
+
"\")"
;
}
}
// java.awt.Toolkit
public
static
final
AWTPermission
ALL_AWT_EVENTS_PERMISSION
=
new
AWTPermission
(
"listenToAllAWTEvents"
);
/**
* Permission factory used when AWT is not present.
*/
private
static
class
FakeAWTPermissionFactory
implements
PermissionFactory
<
FakeAWTPermission
>
{
@Override
public
FakeAWTPermission
newPermission
(
String
name
)
{
return
new
FakeAWTPermission
(
name
);
}
}
// java.awt.SystemTray
public
static
final
AWTPermission
ACCESS_SYSTEM_TRAY_PERMISSION
=
new
AWTPermission
(
"accessSystemTray"
);
/**
* AWT Permissions used in the JDK.
*/
public
static
class
AWT
{
private
AWT
()
{
}
/**
* The class name of the factory to create java.awt.AWTPermission objects.
*/
private
static
final
String
AWTFactory
=
"sun.awt.AWTPermissionFactory"
;
/**
* The PermissionFactory to create AWT permissions (or fake permissions
* if AWT is not present).
*/
private
static
final
PermissionFactory
<?>
factory
=
permissionFactory
();
private
static
PermissionFactory
<?>
permissionFactory
()
{
Class
<?>
c
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Class
<?>>()
{
public
Class
<?>
run
()
{
try
{
return
Class
.
forName
(
AWTFactory
,
true
,
null
);
}
catch
(
ClassNotFoundException
e
)
{
// not available
return
null
;
}
}});
if
(
c
!=
null
)
{
// AWT present
try
{
return
(
PermissionFactory
<?>)
c
.
newInstance
();
}
catch
(
InstantiationException
x
)
{
throw
new
InternalError
(
x
.
getMessage
());
}
catch
(
IllegalAccessException
x
)
{
throw
new
InternalError
(
x
.
getMessage
());
}
}
else
{
// AWT not present
return
new
FakeAWTPermissionFactory
();
}
}
private
static
Permission
newAWTPermission
(
String
name
)
{
return
factory
.
newPermission
(
name
);
}
// java.lang.SecurityManager
public
static
final
Permission
TOPLEVEL_WINDOW_PERMISSION
=
newAWTPermission
(
"showWindowWithoutWarningBanner"
);
// java.lang.SecurityManager
public
static
final
Permission
ACCESS_CLIPBOARD_PERMISSION
=
newAWTPermission
(
"accessClipboard"
);
// java.lang.SecurityManager
public
static
final
Permission
CHECK_AWT_EVENTQUEUE_PERMISSION
=
newAWTPermission
(
"accessEventQueue"
);
// java.awt.Dialog
public
static
final
Permission
TOOLKIT_MODALITY_PERMISSION
=
newAWTPermission
(
"toolkitModality"
);
// java.awt.Robot
public
static
final
Permission
READ_DISPLAY_PIXELS_PERMISSION
=
newAWTPermission
(
"readDisplayPixels"
);
// java.awt.Robot
public
static
final
Permission
CREATE_ROBOT_PERMISSION
=
newAWTPermission
(
"createRobot"
);
// java.awt.MouseInfo
public
static
final
Permission
WATCH_MOUSE_PERMISSION
=
newAWTPermission
(
"watchMousePointer"
);
// java.awt.Window
public
static
final
Permission
SET_WINDOW_ALWAYS_ON_TOP_PERMISSION
=
newAWTPermission
(
"setWindowAlwaysOnTop"
);
// java.awt.Toolkit
public
static
final
Permission
ALL_AWT_EVENTS_PERMISSION
=
newAWTPermission
(
"listenToAllAWTEvents"
);
// java.awt.SystemTray
public
static
final
Permission
ACCESS_SYSTEM_TRAY_PERMISSION
=
newAWTPermission
(
"accessSystemTray"
);
}
// java.net.URL
public
static
final
NetPermission
SPECIFY_HANDLER_PERMISSION
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录