Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
b5cc567e
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看板
提交
b5cc567e
编写于
3月 19, 2008
作者:
M
mchung
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
a9e04bc6
c922d69b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
87 addition
and
4 deletion
+87
-4
src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
...asses/javax/management/modelmbean/RequiredModelMBean.java
+6
-4
test/javax/management/modelmbean/LoggingExceptionTest.java
test/javax/management/modelmbean/LoggingExceptionTest.java
+81
-0
未找到文件。
src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
浏览文件 @
b5cc567e
...
...
@@ -48,6 +48,7 @@ import java.util.logging.Level;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Vector
;
import
javax.management.Attribute
;
import
javax.management.AttributeChangeNotification
;
import
javax.management.AttributeChangeNotificationFilter
;
...
...
@@ -132,8 +133,6 @@ public class RequiredModelMBean
* and operations will be executed */
private
Object
managedResource
=
null
;
private
static
final
String
currClass
=
"RequiredModelMBean"
;
/* records the registering in MBeanServer */
private
boolean
registered
=
false
;
private
transient
MBeanServer
server
=
null
;
...
...
@@ -2488,10 +2487,13 @@ public class RequiredModelMBean
}
if
(
MODELMBEAN_LOGGER
.
isLoggable
(
Level
.
FINER
))
{
Vector
<
String
>
enabledAttrs
=
currFilter
.
getEnabledAttributes
();
String
s
=
(
enabledAttrs
.
size
()
>
1
)
?
"["
+
enabledAttrs
.
firstElement
()
+
", ...]"
:
enabledAttrs
.
toString
();
MODELMBEAN_LOGGER
.
logp
(
Level
.
FINER
,
RequiredModelMBean
.
class
.
getName
(),
mth
,
"Set attribute change filter to "
+
currFilter
.
getEnabledAttributes
().
firstElement
());
"Set attribute change filter to "
+
s
);
}
attributeBroadcaster
.
addNotificationListener
(
inlistener
,
currFilter
,
...
...
test/javax/management/modelmbean/LoggingExceptionTest.java
0 → 100644
浏览文件 @
b5cc567e
/*
* @test
* @bug 6471865 6675768
* @summary DescriptorSupport constructors throw IAE when traces are enabled;
* RequiredModelMBean.addAttributeChangeNotificationListener throws exception
* when traces enabled and no attributes.
* @author Luis-Miguel Alventosa
* @author Paul Cheeseman
*/
import
java.util.logging.ConsoleHandler
;
import
java.util.logging.Handler
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.management.Notification
;
import
javax.management.NotificationListener
;
import
javax.management.modelmbean.DescriptorSupport
;
import
javax.management.modelmbean.RequiredModelMBean
;
public
class
LoggingExceptionTest
{
private
static
final
String
tests
[]
=
new
String
[]
{
"DescriptorSupport()"
,
"DescriptorSupport(int)"
,
"DescriptorSupport(String)"
,
"DescriptorSupport(String...)"
,
"DescriptorSupport(String[], Object[])"
,
"DescriptorSupport(DescriptorSupport)"
,
"RequiredModelMBean.addAttributeChangeNotificationListener"
,
};
public
static
void
main
(
String
[]
args
)
{
Handler
handler
=
new
ConsoleHandler
();
Logger
logger
=
Logger
.
getLogger
(
"javax.management.modelmbean"
);
logger
.
addHandler
(
handler
);
logger
.
setLevel
(
Level
.
FINEST
);
try
{
for
(
int
i
=
0
;
i
<
tests
.
length
;
i
++)
{
System
.
out
.
println
(
">>> DescriptorSupportLoggingTest: Test Case "
+
i
);
DescriptorSupport
ds
;
String
msg
=
"Instantiate "
+
tests
[
i
];
System
.
out
.
println
(
msg
);
switch
(
i
)
{
case
0
:
ds
=
new
DescriptorSupport
();
break
;
case
1
:
ds
=
new
DescriptorSupport
(
10
);
break
;
case
2
:
ds
=
new
DescriptorSupport
(
new
DescriptorSupport
().
toXMLString
());
break
;
case
3
:
ds
=
new
DescriptorSupport
(
"name1=value1"
,
"name2=value2"
);
break
;
case
4
:
ds
=
new
DescriptorSupport
(
new
String
[]
{
"name"
},
new
Object
[]
{
"value"
});
break
;
case
5
:
ds
=
new
DescriptorSupport
(
new
DescriptorSupport
());
break
;
case
6
:
RequiredModelMBean
mbean
=
new
RequiredModelMBean
();
NotificationListener
nl
=
new
NotificationListener
()
{
public
void
handleNotification
(
Notification
notification
,
Object
handback
)
{}
};
mbean
.
addAttributeChangeNotificationListener
(
nl
,
null
,
null
);
break
;
default
:
throw
new
AssertionError
();
}
System
.
out
.
println
(
msg
+
" OK"
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Got unexpected exception = "
+
e
);
String
msg
=
"Test FAILED!"
;
System
.
out
.
println
(
msg
);
throw
new
IllegalArgumentException
(
msg
);
}
System
.
out
.
println
(
"Test PASSED!"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录