Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
72de5c13
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看板
提交
72de5c13
编写于
5月 20, 2013
作者:
A
alexsch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8013744: Better tabling for AWT
Reviewed-by: art, malenkov, skoivu
上级
828dfb25
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
19 deletion
+39
-19
src/share/classes/javax/swing/JTable.java
src/share/classes/javax/swing/JTable.java
+10
-6
src/share/classes/javax/swing/UIDefaults.java
src/share/classes/javax/swing/UIDefaults.java
+3
-9
src/share/classes/javax/swing/text/DefaultFormatter.java
src/share/classes/javax/swing/text/DefaultFormatter.java
+6
-2
src/share/classes/javax/swing/text/NumberFormatter.java
src/share/classes/javax/swing/text/NumberFormatter.java
+5
-1
src/share/classes/sun/swing/SwingLazyValue.java
src/share/classes/sun/swing/SwingLazyValue.java
+2
-1
src/share/classes/sun/swing/SwingUtilities2.java
src/share/classes/sun/swing/SwingUtilities2.java
+13
-0
未找到文件。
src/share/classes/javax/swing/JTable.java
浏览文件 @
72de5c13
...
...
@@ -52,6 +52,7 @@ import java.text.MessageFormat;
import
javax.print.attribute.*
;
import
javax.print.PrintService
;
import
sun.reflect.misc.ReflectUtil
;
import
sun.swing.SwingUtilities2
;
import
sun.swing.SwingUtilities2.Section
;
...
...
@@ -5462,14 +5463,15 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
// they have the option to replace the value with
// null or use escape to restore the original.
// For Strings, return "" for backward compatibility.
if
(
""
.
equals
(
s
))
{
if
(
constructor
.
getDeclaringClass
()
==
String
.
class
)
{
value
=
s
;
try
{
if
(
""
.
equals
(
s
))
{
if
(
constructor
.
getDeclaringClass
()
==
String
.
class
)
{
value
=
s
;
}
return
super
.
stopCellEditing
();
}
return
super
.
stopCellEditing
();
}
try
{
SwingUtilities2
.
checkAccess
(
constructor
.
getModifiers
());
value
=
constructor
.
newInstance
(
new
Object
[]{
s
});
}
catch
(
Exception
e
)
{
...
...
@@ -5493,6 +5495,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
if
(
type
==
Object
.
class
)
{
type
=
String
.
class
;
}
ReflectUtil
.
checkPackageAccess
(
type
);
SwingUtilities2
.
checkAccess
(
type
.
getModifiers
());
constructor
=
type
.
getConstructor
(
argTypes
);
}
catch
(
Exception
e
)
{
...
...
src/share/classes/javax/swing/UIDefaults.java
浏览文件 @
72de5c13
...
...
@@ -53,6 +53,7 @@ import java.security.PrivilegedAction;
import
sun.reflect.misc.MethodUtil
;
import
sun.reflect.misc.ReflectUtil
;
import
sun.swing.SwingUtilities2
;
import
sun.util.CoreResourceBundleControl
;
/**
...
...
@@ -1101,7 +1102,7 @@ public class UIDefaults extends Hashtable<Object,Object>
}
ReflectUtil
.
checkPackageAccess
(
className
);
c
=
Class
.
forName
(
className
,
true
,
(
ClassLoader
)
cl
);
checkAccess
(
c
.
getModifiers
());
SwingUtilities2
.
checkAccess
(
c
.
getModifiers
());
if
(
methodName
!=
null
)
{
Class
[]
types
=
getClassArray
(
args
);
Method
m
=
c
.
getMethod
(
methodName
,
types
);
...
...
@@ -1109,7 +1110,7 @@ public class UIDefaults extends Hashtable<Object,Object>
}
else
{
Class
[]
types
=
getClassArray
(
args
);
Constructor
constructor
=
c
.
getConstructor
(
types
);
checkAccess
(
constructor
.
getModifiers
());
SwingUtilities2
.
checkAccess
(
constructor
.
getModifiers
());
return
constructor
.
newInstance
(
args
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -1124,13 +1125,6 @@ public class UIDefaults extends Hashtable<Object,Object>
},
acc
);
}
private
void
checkAccess
(
int
modifiers
)
{
if
(
System
.
getSecurityManager
()
!=
null
&&
!
Modifier
.
isPublic
(
modifiers
))
{
throw
new
SecurityException
(
"Resource is not accessible"
);
}
}
/*
* Coerce the array of class types provided into one which
* looks the way the Reflection APIs expect. This is done
...
...
src/share/classes/javax/swing/text/DefaultFormatter.java
浏览文件 @
72de5c13
...
...
@@ -24,7 +24,8 @@
*/
package
javax.swing.text
;
import
sun.reflect.misc.ConstructorUtil
;
import
sun.reflect.misc.ReflectUtil
;
import
sun.swing.SwingUtilities2
;
import
java.io.Serializable
;
import
java.lang.reflect.*
;
...
...
@@ -247,7 +248,9 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
Constructor
cons
;
try
{
cons
=
ConstructorUtil
.
getConstructor
(
vc
,
new
Class
[]{
String
.
class
});
ReflectUtil
.
checkPackageAccess
(
vc
);
SwingUtilities2
.
checkAccess
(
vc
.
getModifiers
());
cons
=
vc
.
getConstructor
(
new
Class
[]{
String
.
class
});
}
catch
(
NoSuchMethodException
nsme
)
{
cons
=
null
;
...
...
@@ -255,6 +258,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
if
(
cons
!=
null
)
{
try
{
SwingUtilities2
.
checkAccess
(
cons
.
getModifiers
());
return
cons
.
newInstance
(
new
Object
[]
{
string
});
}
catch
(
Throwable
ex
)
{
throw
new
ParseException
(
"Error creating instance"
,
0
);
...
...
src/share/classes/javax/swing/text/NumberFormatter.java
浏览文件 @
72de5c13
...
...
@@ -27,6 +27,8 @@ package javax.swing.text;
import
java.lang.reflect.*
;
import
java.text.*
;
import
java.util.*
;
import
sun.reflect.misc.ReflectUtil
;
import
sun.swing.SwingUtilities2
;
/**
* <code>NumberFormatter</code> subclasses <code>InternationalFormatter</code>
...
...
@@ -427,10 +429,12 @@ public class NumberFormatter extends InternationalFormatter {
valueClass
=
value
.
getClass
();
}
try
{
ReflectUtil
.
checkPackageAccess
(
valueClass
);
SwingUtilities2
.
checkAccess
(
valueClass
.
getModifiers
());
Constructor
cons
=
valueClass
.
getConstructor
(
new
Class
[]
{
String
.
class
});
if
(
cons
!=
null
)
{
SwingUtilities2
.
checkAccess
(
cons
.
getModifiers
());
return
cons
.
newInstance
(
new
Object
[]{
string
});
}
}
catch
(
Throwable
ex
)
{
}
...
...
src/share/classes/sun/swing/SwingLazyValue.java
浏览文件 @
72de5c13
...
...
@@ -30,6 +30,7 @@ import java.lang.reflect.AccessibleObject;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
javax.swing.UIDefaults
;
import
sun.reflect.misc.ReflectUtil
;
/**
* SwingLazyValue is a copy of ProxyLazyValue that does not snapshot the
...
...
@@ -63,7 +64,7 @@ public class SwingLazyValue implements UIDefaults.LazyValue {
public
Object
createValue
(
final
UIDefaults
table
)
{
try
{
Object
cl
;
ReflectUtil
.
checkPackageAccess
(
className
)
;
Class
<?>
c
=
Class
.
forName
(
className
,
true
,
null
);
if
(
methodName
!=
null
)
{
Class
[]
types
=
getClassArray
(
args
);
...
...
src/share/classes/sun/swing/SwingUtilities2.java
浏览文件 @
72de5c13
...
...
@@ -1311,6 +1311,19 @@ public class SwingUtilities2 {
}
}
/**
* Utility method that throws SecurityException if SecurityManager is set
* and modifiers are not public
*
* @param modifiers a set of modifiers
*/
public
static
void
checkAccess
(
int
modifiers
)
{
if
(
System
.
getSecurityManager
()
!=
null
&&
!
Modifier
.
isPublic
(
modifiers
))
{
throw
new
SecurityException
(
"Resource is not accessible"
);
}
}
/**
* Returns true if EventQueue.getCurrentEvent() has the permissions to
* access the system clipboard and if it is allowed gesture (if
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录