Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
2ffa3bd2
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ffa3bd2
编写于
2月 05, 2010
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6921057: REGRESSION: persistence delegate issue on Windows and Linux against 5.u23b03/6u17b11
Reviewed-by: peterz, art
上级
d7ee29a0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
19 deletion
+29
-19
jdk/src/share/classes/java/beans/Introspector.java
jdk/src/share/classes/java/beans/Introspector.java
+13
-9
jdk/test/java/beans/Introspector/6380849/TestBeanInfo.java
jdk/test/java/beans/Introspector/6380849/TestBeanInfo.java
+5
-3
jdk/test/java/beans/Introspector/Test5102804.java
jdk/test/java/beans/Introspector/Test5102804.java
+2
-2
jdk/test/java/beans/XMLEncoder/Test4646747.java
jdk/test/java/beans/XMLEncoder/Test4646747.java
+9
-5
未找到文件。
jdk/src/share/classes/java/beans/Introspector.java
浏览文件 @
2ffa3bd2
/*
/*
* Copyright 1996-20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-20
10
Sun Microsystems, Inc. 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
com.sun.beans.finder.BeanInfoFinder
;
import
com.sun.beans.finder.BeanInfoFinder
;
import
com.sun.beans.finder.ClassFinder
;
import
com.sun.beans.finder.ClassFinder
;
import
java.lang.ref.Reference
;
import
java.lang.ref.SoftReference
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Modifier
;
...
@@ -39,6 +41,7 @@ import java.util.Iterator;
...
@@ -39,6 +41,7 @@ import java.util.Iterator;
import
java.util.EventListener
;
import
java.util.EventListener
;
import
java.util.List
;
import
java.util.List
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.WeakHashMap
;
import
sun.awt.AppContext
;
import
sun.awt.AppContext
;
import
sun.reflect.misc.ReflectUtil
;
import
sun.reflect.misc.ReflectUtil
;
...
@@ -155,11 +158,11 @@ public class Introspector {
...
@@ -155,11 +158,11 @@ public class Introspector {
return
(
new
Introspector
(
beanClass
,
null
,
USE_ALL_BEANINFO
)).
getBeanInfo
();
return
(
new
Introspector
(
beanClass
,
null
,
USE_ALL_BEANINFO
)).
getBeanInfo
();
}
}
synchronized
(
BEANINFO_CACHE
)
{
synchronized
(
BEANINFO_CACHE
)
{
WeakCache
<
Class
<?>,
BeanInfo
>
beanInfoCache
=
Map
<
Class
<?>,
BeanInfo
>
beanInfoCache
=
(
WeakCache
<
Class
<?>,
BeanInfo
>)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
(
Map
<
Class
<?>,
BeanInfo
>)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
if
(
beanInfoCache
==
null
)
{
if
(
beanInfoCache
==
null
)
{
beanInfoCache
=
new
Weak
Cache
<
Class
<?>,
BeanInfo
>();
beanInfoCache
=
new
Weak
HashMap
<
Class
<?>,
BeanInfo
>();
AppContext
.
getAppContext
().
put
(
BEANINFO_CACHE
,
beanInfoCache
);
AppContext
.
getAppContext
().
put
(
BEANINFO_CACHE
,
beanInfoCache
);
}
}
BeanInfo
beanInfo
=
beanInfoCache
.
get
(
beanClass
);
BeanInfo
beanInfo
=
beanInfoCache
.
get
(
beanClass
);
...
@@ -341,7 +344,7 @@ public class Introspector {
...
@@ -341,7 +344,7 @@ public class Introspector {
public
static
void
flushCaches
()
{
public
static
void
flushCaches
()
{
synchronized
(
BEANINFO_CACHE
)
{
synchronized
(
BEANINFO_CACHE
)
{
WeakCache
beanInfoCache
=
(
WeakCache
)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
Map
beanInfoCache
=
(
Map
)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
if
(
beanInfoCache
!=
null
)
{
if
(
beanInfoCache
!=
null
)
{
beanInfoCache
.
clear
();
beanInfoCache
.
clear
();
}
}
...
@@ -369,7 +372,7 @@ public class Introspector {
...
@@ -369,7 +372,7 @@ public class Introspector {
throw
new
NullPointerException
();
throw
new
NullPointerException
();
}
}
synchronized
(
BEANINFO_CACHE
)
{
synchronized
(
BEANINFO_CACHE
)
{
WeakCache
beanInfoCache
=
(
WeakCache
)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
Map
beanInfoCache
=
(
Map
)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
if
(
beanInfoCache
!=
null
)
{
if
(
beanInfoCache
!=
null
)
{
beanInfoCache
.
put
(
clz
,
null
);
beanInfoCache
.
put
(
clz
,
null
);
}
}
...
@@ -1458,7 +1461,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
...
@@ -1458,7 +1461,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
private
PropertyDescriptor
[]
properties
;
private
PropertyDescriptor
[]
properties
;
private
int
defaultProperty
;
private
int
defaultProperty
;
private
MethodDescriptor
[]
methods
;
private
MethodDescriptor
[]
methods
;
private
BeanInfo
targetBeanInfo
;
private
final
Reference
<
BeanInfo
>
targetBeanInfoRef
;
public
GenericBeanInfo
(
BeanDescriptor
beanDescriptor
,
public
GenericBeanInfo
(
BeanDescriptor
beanDescriptor
,
EventSetDescriptor
[]
events
,
int
defaultEvent
,
EventSetDescriptor
[]
events
,
int
defaultEvent
,
...
@@ -1470,7 +1473,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
...
@@ -1470,7 +1473,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
this
.
properties
=
properties
;
this
.
properties
=
properties
;
this
.
defaultProperty
=
defaultProperty
;
this
.
defaultProperty
=
defaultProperty
;
this
.
methods
=
methods
;
this
.
methods
=
methods
;
this
.
targetBeanInfo
=
targetBeanInfo
;
this
.
targetBeanInfo
Ref
=
new
SoftReference
<
BeanInfo
>(
targetBeanInfo
)
;
}
}
/**
/**
...
@@ -1509,7 +1512,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
...
@@ -1509,7 +1512,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
methods
[
i
]
=
new
MethodDescriptor
(
old
.
methods
[
i
]);
methods
[
i
]
=
new
MethodDescriptor
(
old
.
methods
[
i
]);
}
}
}
}
t
argetBeanInfo
=
old
.
targetBeanInfo
;
t
his
.
targetBeanInfoRef
=
old
.
targetBeanInfoRef
;
}
}
public
PropertyDescriptor
[]
getPropertyDescriptors
()
{
public
PropertyDescriptor
[]
getPropertyDescriptors
()
{
...
@@ -1537,6 +1540,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
...
@@ -1537,6 +1540,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
}
}
public
java
.
awt
.
Image
getIcon
(
int
iconKind
)
{
public
java
.
awt
.
Image
getIcon
(
int
iconKind
)
{
BeanInfo
targetBeanInfo
=
this
.
targetBeanInfoRef
.
get
();
if
(
targetBeanInfo
!=
null
)
{
if
(
targetBeanInfo
!=
null
)
{
return
targetBeanInfo
.
getIcon
(
iconKind
);
return
targetBeanInfo
.
getIcon
(
iconKind
);
}
}
...
...
jdk/test/java/beans/Introspector/6380849/TestBeanInfo.java
浏览文件 @
2ffa3bd2
/**
/**
* Copyright 20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 20
10
Sun Microsystems, Inc. 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
...
@@ -38,6 +38,7 @@ import infos.ThirdBeanBeanInfo;
...
@@ -38,6 +38,7 @@ import infos.ThirdBeanBeanInfo;
import
java.beans.BeanInfo
;
import
java.beans.BeanInfo
;
import
java.beans.Introspector
;
import
java.beans.Introspector
;
import
java.lang.ref.Reference
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
sun.awt.SunToolkit
;
import
sun.awt.SunToolkit
;
...
@@ -61,9 +62,10 @@ public class TestBeanInfo implements Runnable {
...
@@ -61,9 +62,10 @@ public class TestBeanInfo implements Runnable {
try
{
try
{
actual
=
Introspector
.
getBeanInfo
(
type
);
actual
=
Introspector
.
getBeanInfo
(
type
);
type
=
actual
.
getClass
();
type
=
actual
.
getClass
();
Field
field
=
type
.
getDeclaredField
(
"targetBeanInfo"
);
// NON-NLS: field name
Field
field
=
type
.
getDeclaredField
(
"targetBeanInfo
Ref
"
);
// NON-NLS: field name
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
actual
=
(
BeanInfo
)
field
.
get
(
actual
);
Reference
ref
=
(
Reference
)
field
.
get
(
actual
);
actual
=
(
BeanInfo
)
ref
.
get
();
}
}
catch
(
Exception
exception
)
{
catch
(
Exception
exception
)
{
throw
new
Error
(
"unexpected error"
,
exception
);
throw
new
Error
(
"unexpected error"
,
exception
);
...
...
jdk/test/java/beans/Introspector/Test5102804.java
浏览文件 @
2ffa3bd2
/*
/*
* Copyright 20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 20
10
Sun Microsystems, Inc. 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
...
@@ -24,9 +24,9 @@
...
@@ -24,9 +24,9 @@
/*
/*
* @test
* @test
* @bug 5102804
* @bug 5102804
* @ignore This test is not predictable with regards to GC
* @summary Tests memory leak
* @summary Tests memory leak
* @author Sergey Malenkov
* @author Sergey Malenkov
* @run main/othervm -ms16m -mx16m Test5102804
*/
*/
import
java.beans.BeanInfo
;
import
java.beans.BeanInfo
;
...
...
jdk/test/java/beans/XMLEncoder/Test4646747.java
浏览文件 @
2ffa3bd2
/*
/*
* Copyright 2004-20
07
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2004-20
10
Sun Microsystems, Inc. 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
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
* @bug 4646747
* @bug 4646747
* @summary Tests that persistence delegate is correct after memory stress
* @summary Tests that persistence delegate is correct after memory stress
* @author Mark Davidson
* @author Mark Davidson
* @run main/othervm -ms16m -mx16m Test4646747
*/
*/
import
java.beans.DefaultPersistenceDelegate
;
import
java.beans.DefaultPersistenceDelegate
;
...
@@ -41,11 +42,14 @@ public class Test4646747 {
...
@@ -41,11 +42,14 @@ public class Test4646747 {
encoder
.
setPersistenceDelegate
(
Test4646747
.
class
,
new
MyPersistenceDelegate
());
encoder
.
setPersistenceDelegate
(
Test4646747
.
class
,
new
MyPersistenceDelegate
());
// WARNING: This can eat up a lot of memory
// WARNING: This can eat up a lot of memory
Object
[]
obs
=
new
Object
[
10000
];
Object
[]
obs
=
new
Object
[
10000
];
for
(
int
i
=
0
;
i
<
obs
.
length
;
i
++)
{
while
(
obs
!=
null
)
{
obs
[
i
]
=
new
int
[
1000
];
try
{
obs
=
new
Object
[
obs
.
length
+
obs
.
length
/
3
];
}
catch
(
OutOfMemoryError
error
)
{
obs
=
null
;
}
}
}
System
.
gc
();
System
.
gc
();
PersistenceDelegate
pd
=
encoder
.
getPersistenceDelegate
(
Test4646747
.
class
);
PersistenceDelegate
pd
=
encoder
.
getPersistenceDelegate
(
Test4646747
.
class
);
if
(!(
pd
instanceof
MyPersistenceDelegate
))
if
(!(
pd
instanceof
MyPersistenceDelegate
))
throw
new
Error
(
"persistence delegate has been lost"
);
throw
new
Error
(
"persistence delegate has been lost"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录