Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
33565c22
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看板
提交
33565c22
编写于
7月 05, 2008
作者:
T
tbell
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
0622b53d
b22b0061
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
234 addition
and
28 deletion
+234
-28
src/share/back/eventFilter.c
src/share/back/eventFilter.c
+9
-6
src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
.../com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
+2
-2
src/share/classes/com/sun/tools/jdi/EventSetImpl.java
src/share/classes/com/sun/tools/jdi/EventSetImpl.java
+3
-2
test/com/sun/jdi/SourceNameFilterTest.java
test/com/sun/jdi/SourceNameFilterTest.java
+28
-7
test/javax/management/mxbean/ComparatorExceptionTest.java
test/javax/management/mxbean/ComparatorExceptionTest.java
+90
-0
test/javax/management/mxbean/MXBeanTest.java
test/javax/management/mxbean/MXBeanTest.java
+26
-11
test/javax/management/mxbean/SameObjectTwoNamesTest.java
test/javax/management/mxbean/SameObjectTwoNamesTest.java
+76
-0
未找到文件。
src/share/back/eventFilter.c
浏览文件 @
33565c22
...
...
@@ -492,14 +492,17 @@ eventFilterRestricted_passesFilter(JNIEnv *env,
char
*
sourceName
=
0
;
jvmtiError
error
=
JVMTI_FUNC_PTR
(
gdata
->
jvmti
,
GetSourceFileName
)
(
gdata
->
jvmti
,
clazz
,
&
sourceName
);
if
(
error
==
JVMTI_ERROR_NONE
)
{
if
(
sourceName
==
0
||
!
patternStringMatch
(
sourceName
,
desiredNamePattern
))
{
/* We have no match */
jvmtiDeallocate
(
sourceName
);
return
JNI_FALSE
;
}
if
(
error
==
JVMTI_ERROR_NONE
&&
sourceName
!=
0
&&
patternStringMatch
(
sourceName
,
desiredNamePattern
))
{
// got a hit - report the event
jvmtiDeallocate
(
sourceName
)
;
break
;
}
// We have no match, we have no source file name,
// or we got a JVM TI error. Don't report the event.
jvmtiDeallocate
(
sourceName
);
return
JNI_FALSE
;
}
break
;
}
...
...
src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
浏览文件 @
33565c22
...
...
@@ -686,7 +686,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final
String
msg
=
"Cannot convert SortedSet with non-null comparator: "
+
comparator
;
throw
new
OpenDataException
(
msg
);
throw
openDataException
(
msg
,
new
IllegalArgumentException
(
msg
)
);
}
}
final
Object
[]
openArray
=
(
Object
[])
...
...
@@ -800,7 +800,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final
String
msg
=
"Cannot convert SortedMap with non-null comparator: "
+
comparator
;
throw
new
OpenDataException
(
msg
);
throw
openDataException
(
msg
,
new
IllegalArgumentException
(
msg
)
);
}
}
final
TabularType
tabularType
=
(
TabularType
)
getOpenType
();
...
...
src/share/classes/com/sun/tools/jdi/EventSetImpl.java
浏览文件 @
33565c22
...
...
@@ -208,8 +208,9 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
}
public
String
toString
()
{
return
eventName
()
+
"@"
+
location
().
toString
()
+
" in thread "
+
thread
().
name
();
return
eventName
()
+
"@"
+
((
location
()
==
null
)
?
" null"
:
location
().
toString
())
+
" in thread "
+
thread
().
name
();
}
}
...
...
test/com/sun/jdi/SourceNameFilterTest.java
浏览文件 @
33565c22
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 4836939
* @bug 4836939
6646613
* @summary JDI add addSourceNameFilter to ClassPrepareRequest
*
* @author jjh
...
...
@@ -31,7 +31,11 @@
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g SourceNameFilterTest.java
* @run main SourceNameFilterTest
* @run compile -g:none SourceNameFilterTest.java
* @run main SourceNameFilterTest
*/
// The compile -g:none suppresses the lineNumber table to trigger bug 6646613.
import
com.sun.jdi.*
;
import
com.sun.jdi.event.*
;
import
com.sun.jdi.request.*
;
...
...
@@ -84,7 +88,6 @@ public class SourceNameFilterTest extends TestScaffold {
boolean
gotEvent1
=
false
;
boolean
gotEvent2
=
false
;
boolean
gotEvent3
=
false
;
ClassPrepareRequest
cpReq
;
boolean
shouldResume
=
false
;
SourceNameFilterTest
(
String
args
[])
{
...
...
@@ -151,6 +154,18 @@ public class SourceNameFilterTest extends TestScaffold {
*/
BreakpointEvent
bpe
=
startToMain
(
"SourceNameFilterTarg"
);
targetClass
=
bpe
.
location
().
declaringType
();
boolean
noSourceName
=
false
;
try
{
targetClass
.
sourceName
();
}
catch
(
AbsentInformationException
ee
)
{
noSourceName
=
true
;
}
if
(
noSourceName
)
{
println
(
"-- Running with no source names"
);
}
else
{
println
(
"-- Running with source names"
);
}
mainThread
=
bpe
.
thread
();
EventRequestManager
erm
=
vm
().
eventRequestManager
();
addListener
(
this
);
...
...
@@ -175,7 +190,9 @@ public class SourceNameFilterTest extends TestScaffold {
/*
* This should cause us to get a class prepare event for
* LoadedLater3
* LoadedLater3 except in the case where -g:none
* was used to compile so that there is no LineNumberTable
* and therefore, no source name for the class.
*/
cpReq
=
erm
.
createClassPrepareRequest
();
cpReq
.
addSourceNameFilter
(
"SourceNameFilterTest.java"
);
...
...
@@ -186,17 +203,21 @@ public class SourceNameFilterTest extends TestScaffold {
if
(!
gotEvent1
)
{
failure
(
"failure: Did not get a class prepare request "
+
"for Loaded
l
ater1"
);
"for Loaded
L
ater1"
);
}
if
(
gotEvent2
)
{
failure
(
"failure: Did get a class prepare request "
+
"for Loaded
l
ater2"
);
"for Loaded
L
ater2"
);
}
if
(!
gotEvent3
)
{
if
(
gotEvent3
&&
noSourceName
)
{
failure
(
"failure: Did get a class prepare request "
+
"for LoadedLater3"
);
}
else
if
(!
gotEvent3
&&
!
noSourceName
)
{
failure
(
"failure: Did not get a class prepare request "
+
"for Loaded
l
ater3"
);
"for Loaded
L
ater3"
);
}
/*
...
...
test/javax/management/mxbean/ComparatorExceptionTest.java
0 → 100644
浏览文件 @
33565c22
/*
* Copyright 2007 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.
*
* 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.
*/
/*
* @test
* @bug 6601652
* @summary Test exception when SortedMap or SortedSet has non-null Comparator
* @author Eamonn McManus
*/
import
java.util.SortedMap
;
import
java.util.SortedSet
;
import
java.util.TreeMap
;
import
java.util.TreeSet
;
import
javax.management.MBeanServer
;
import
javax.management.MBeanServerFactory
;
import
javax.management.ObjectName
;
public
class
ComparatorExceptionTest
{
public
static
interface
TestMXBean
{
public
SortedSet
<
String
>
getSortedSet
();
public
SortedMap
<
String
,
String
>
getSortedMap
();
}
public
static
class
TestImpl
implements
TestMXBean
{
public
SortedSet
<
String
>
getSortedSet
()
{
return
new
TreeSet
<
String
>(
String
.
CASE_INSENSITIVE_ORDER
);
}
public
SortedMap
<
String
,
String
>
getSortedMap
()
{
return
new
TreeMap
<
String
,
String
>(
String
.
CASE_INSENSITIVE_ORDER
);
}
}
private
static
String
failure
;
private
static
void
fail
(
String
why
)
{
failure
=
"FAILED: "
+
why
;
System
.
out
.
println
(
failure
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
MBeanServer
mbs
=
MBeanServerFactory
.
newMBeanServer
();
ObjectName
name
=
new
ObjectName
(
"a:b=c"
);
mbs
.
registerMBean
(
new
TestImpl
(),
name
);
for
(
String
attr
:
new
String
[]
{
"SortedSet"
,
"SortedMap"
})
{
try
{
Object
value
=
mbs
.
getAttribute
(
name
,
attr
);
fail
(
"get "
+
attr
+
" did not throw exception"
);
}
catch
(
Exception
e
)
{
Throwable
t
=
e
;
while
(!(
t
instanceof
IllegalArgumentException
))
{
if
(
t
==
null
)
break
;
t
=
t
.
getCause
();
}
if
(
t
!=
null
)
System
.
out
.
println
(
"Correct exception for "
+
attr
);
else
{
fail
(
"get "
+
attr
+
" got wrong exception"
);
e
.
printStackTrace
(
System
.
out
);
}
}
}
if
(
failure
!=
null
)
throw
new
Exception
(
failure
);
}
}
test/javax/management/mxbean/MXBeanTest.java
浏览文件 @
33565c22
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 6175517 6278707 6318827 6305746 6392303
* @bug 6175517 6278707 6318827 6305746 6392303
6600709
* @summary General MXBean test.
* @author Eamonn McManus
* @run clean MXBeanTest MerlinMXBean TigerMXBean
...
...
@@ -40,7 +40,8 @@ import java.util.Arrays;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
javax.management.Attribute
;
import
java.util.Map
;
import
java.util.SortedMap
;
import
javax.management.JMX
;
import
javax.management.MBeanAttributeInfo
;
import
javax.management.MBeanInfo
;
...
...
@@ -55,10 +56,6 @@ import javax.management.StandardMBean;
import
javax.management.openmbean.ArrayType
;
import
javax.management.openmbean.CompositeData
;
import
javax.management.openmbean.CompositeDataInvocationHandler
;
import
javax.management.openmbean.OpenMBeanAttributeInfo
;
import
javax.management.openmbean.OpenMBeanInfo
;
import
javax.management.openmbean.OpenMBeanOperationInfo
;
import
javax.management.openmbean.OpenMBeanParameterInfo
;
import
javax.management.openmbean.OpenType
;
import
javax.management.openmbean.SimpleType
;
import
javax.management.openmbean.TabularData
;
...
...
@@ -81,10 +78,8 @@ public class MXBeanTest {
if
(
failures
==
0
)
System
.
out
.
println
(
"Test passed"
);
else
{
System
.
out
.
println
(
"TEST FAILURES: "
+
failures
);
System
.
exit
(
1
);
}
else
throw
new
Exception
(
"TEST FAILURES: "
+
failures
);
}
private
static
int
failures
=
0
;
...
...
@@ -561,6 +556,11 @@ public class MXBeanTest {
return
false
;
return
deepEqual
(
o1
,
o2
,
namedMXBeans
);
}
if
(
o1
instanceof
Map
)
{
if
(!(
o2
instanceof
Map
))
return
false
;
return
equalMap
((
Map
)
o1
,
(
Map
)
o2
,
namedMXBeans
);
}
if
(
o1
instanceof
CompositeData
&&
o2
instanceof
CompositeData
)
{
return
compositeDataEqual
((
CompositeData
)
o1
,
(
CompositeData
)
o2
,
namedMXBeans
);
...
...
@@ -600,6 +600,21 @@ public class MXBeanTest {
return
true
;
}
private
static
boolean
equalMap
(
Map
<?,?>
m1
,
Map
<?,?>
m2
,
NamedMXBeans
namedMXBeans
)
{
if
(
m1
.
size
()
!=
m2
.
size
())
return
false
;
if
((
m1
instanceof
SortedMap
)
!=
(
m2
instanceof
SortedMap
))
return
false
;
for
(
Object
k1
:
m1
.
keySet
())
{
if
(!
m2
.
containsKey
(
k1
))
return
false
;
if
(!
equal
(
m1
.
get
(
k1
),
m2
.
get
(
k1
),
namedMXBeans
))
return
false
;
}
return
true
;
}
// This is needed to work around a bug (5095277)
// in CompositeDataSupport.equals
private
static
boolean
compositeDataEqual
(
CompositeData
cd1
,
...
...
@@ -655,7 +670,7 @@ public class MXBeanTest {
/* I wanted to call this method toString(Object), but oddly enough
this meant that I couldn't call it from the inner class
MXBeanImplInvocationHandler, because the inherited Object.toString()
prevented that.
Surprising behaviour.
*/
prevented that. */
static
String
string
(
Object
o
)
{
if
(
o
==
null
)
return
"null"
;
...
...
test/javax/management/mxbean/SameObjectTwoNamesTest.java
0 → 100644
浏览文件 @
33565c22
/*
* Copyright 2007 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.
*
* 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.
*/
/*
* @test SameObjectTwoNamesTest.java
* @bug 6283873
* @summary Check that registering the same MXBean under two different
* names produces an exception
* @author Alexander Shusherov
* @author Eamonn McManus
* @run main SameObjectTwoNamesTest
* @run main/othervm -Djmx.mxbean.multiname=true SameObjectTwoNamesTest
*/
import
javax.management.InstanceAlreadyExistsException
;
import
javax.management.MBeanServer
;
import
javax.management.MBeanServerFactory
;
import
javax.management.ObjectName
;
public
class
SameObjectTwoNamesTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
expectException
=
(
System
.
getProperty
(
"jmx.mxbean.multiname"
)
==
null
);
try
{
ObjectName
objectName1
=
new
ObjectName
(
"test:index=1"
);
ObjectName
objectName2
=
new
ObjectName
(
"test:index=2"
);
MBeanServer
mbs
=
MBeanServerFactory
.
createMBeanServer
();
MXBC_SimpleClass01
mxBeanObject
=
new
MXBC_SimpleClass01
();
mbs
.
registerMBean
(
mxBeanObject
,
objectName1
);
mbs
.
registerMBean
(
mxBeanObject
,
objectName2
);
if
(
expectException
)
{
throw
new
Exception
(
"TEST FAILED: "
+
"InstanceAlreadyExistsException was not thrown"
);
}
else
System
.
out
.
println
(
"Correctly got no exception with compat property"
);
}
catch
(
InstanceAlreadyExistsException
e
)
{
if
(
expectException
)
{
System
.
out
.
println
(
"Got expected InstanceAlreadyExistsException:"
);
e
.
printStackTrace
(
System
.
out
);
}
else
{
throw
new
Exception
(
"TEST FAILED: Got exception even though compat property set"
,
e
);
}
}
System
.
out
.
println
(
"TEST PASSED"
);
}
public
interface
MXBC_Simple01MXBean
{}
public
static
class
MXBC_SimpleClass01
implements
MXBC_Simple01MXBean
{}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录