Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d29da907
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看板
提交
d29da907
编写于
4月 11, 2016
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
891c61ef
36a862ad
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
1376 addition
and
210 deletion
+1376
-210
.hgtags
.hgtags
+1
-0
make/CopyIntoClasses.gmk
make/CopyIntoClasses.gmk
+6
-2
src/share/back/invoker.c
src/share/back/invoker.c
+48
-0
src/share/classes/java/util/Hashtable.java
src/share/classes/java/util/Hashtable.java
+23
-12
src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java
...e/classes/java/util/concurrent/ConcurrentLinkedQueue.java
+17
-11
src/share/classes/sun/security/ssl/HandshakeMessage.java
src/share/classes/sun/security/ssl/HandshakeMessage.java
+19
-11
src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
+31
-11
src/windows/classes/sun/awt/windows/fontconfig.properties
src/windows/classes/sun/awt/windows/fontconfig.properties
+1
-1
src/windows/classes/sun/security/mscapi/KeyStore.java
src/windows/classes/sun/security/mscapi/KeyStore.java
+100
-118
src/windows/native/sun/security/mscapi/security.cpp
src/windows/native/sun/security/mscapi/security.cpp
+40
-41
test/TEST.ROOT
test/TEST.ROOT
+9
-2
test/com/sun/jdi/oom/@debuggeeVMOptions
test/com/sun/jdi/oom/@debuggeeVMOptions
+1
-0
test/com/sun/jdi/oom/OomDebugTest.java
test/com/sun/jdi/oom/OomDebugTest.java
+312
-0
test/com/sun/jdi/oom/OomDebugTestSetup.sh
test/com/sun/jdi/oom/OomDebugTestSetup.sh
+46
-0
test/com/sun/tools/attach/RunnerUtil.java
test/com/sun/tools/attach/RunnerUtil.java
+7
-0
test/com/sun/tools/attach/TempDirTest.java
test/com/sun/tools/attach/TempDirTest.java
+17
-1
test/java/awt/font/MonospacedGlyphWidth/MonospacedGlyphWidthTest.java
...t/font/MonospacedGlyphWidth/MonospacedGlyphWidthTest.java
+54
-0
test/java/util/Hashtable/DeserializedLength.java
test/java/util/Hashtable/DeserializedLength.java
+110
-0
test/java/util/concurrent/ConcurrentLinkedQueue/RemoveLeak.java
...ava/util/concurrent/ConcurrentLinkedQueue/RemoveLeak.java
+60
-0
test/javax/xml/bind/marshal/8134111/UnmarshalTest.java
test/javax/xml/bind/marshal/8134111/UnmarshalTest.java
+66
-0
test/javax/xml/bind/marshal/8134111/testTypes/ObjectFactory.java
...vax/xml/bind/marshal/8134111/testTypes/ObjectFactory.java
+61
-0
test/javax/xml/bind/marshal/8134111/testTypes/Root.java
test/javax/xml/bind/marshal/8134111/testTypes/Root.java
+70
-0
test/javax/xml/bind/marshal/8134111/testTypes/WhenType.java
test/javax/xml/bind/marshal/8134111/testTypes/WhenType.java
+70
-0
test/javax/xml/bind/marshal/8134111/testTypes/package-info.java
...avax/xml/bind/marshal/8134111/testTypes/package-info.java
+27
-0
test/sun/security/mscapi/CastError.java
test/sun/security/mscapi/CastError.java
+54
-0
test/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.sh
.../sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.sh
+100
-0
test/sun/security/mscapi/nonUniqueAliases/nonUniq1.pem
test/sun/security/mscapi/nonUniqueAliases/nonUniq1.pem
+13
-0
test/sun/security/mscapi/nonUniqueAliases/nonUniq2.pem
test/sun/security/mscapi/nonUniqueAliases/nonUniq2.pem
+13
-0
未找到文件。
.hgtags
浏览文件 @
d29da907
...
...
@@ -584,3 +584,4 @@ e057622070e5415c13b6d8511b97dce8bd2e398d jdk8u76-b04
fa5a91b29658aa9eb7aff54ae34898c149ff7149 jdk8u102-b00
fa5a91b29658aa9eb7aff54ae34898c149ff7149 jdk8u82-b00
569e105bed3c517a47f0f1ebce0abcaf776a8e89 jdk8u102-b01
5d5b55014d0da5bafb42366dc6d668ced4b8dec4 jdk8u102-b02
make/CopyIntoClasses.gmk
浏览文件 @
d29da907
#
# Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 201
6
, Oracle and/or its affiliates. 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
...
...
@@ -190,7 +190,11 @@ ifdef OPENJDK
SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
else
SRC_SERVICES_FILES := $(filter-out %sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), linux-sparc)
SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
else
SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
endif
endif
# The number of services files are relatively few. If the increase in numbers, then
...
...
src/share/back/invoker.c
浏览文件 @
d29da907
...
...
@@ -211,6 +211,47 @@ createGlobalRefs(JNIEnv *env, InvokeRequest *request)
return
error
;
}
/*
* Delete global references from the request which got put there before a
* invoke request was carried out. See fillInvokeRequest() and invoker invoke*()
* impls.
*/
static
void
deleteGlobalRefs
(
JNIEnv
*
env
,
InvokeRequest
*
request
)
{
void
*
cursor
;
jint
argIndex
=
0
;
jvalue
*
argument
=
request
->
arguments
;
jbyte
argumentTag
=
firstArgumentTypeTag
(
request
->
methodSignature
,
&
cursor
);
if
(
request
->
clazz
!=
NULL
)
{
tossGlobalRef
(
env
,
&
(
request
->
clazz
));
}
if
(
request
->
instance
!=
NULL
)
{
tossGlobalRef
(
env
,
&
(
request
->
instance
));
}
/* Delete global argument references */
while
(
argIndex
<
request
->
argumentCount
)
{
if
((
argumentTag
==
JDWP_TAG
(
OBJECT
))
||
(
argumentTag
==
JDWP_TAG
(
ARRAY
)))
{
if
(
argument
->
l
!=
NULL
)
{
tossGlobalRef
(
env
,
&
(
argument
->
l
));
}
}
argument
++
;
argIndex
++
;
argumentTag
=
nextArgumentTypeTag
(
&
cursor
);
}
/* Delete potentially saved return values */
if
((
request
->
invokeType
==
INVOKE_CONSTRUCTOR
)
||
(
returnTypeTag
(
request
->
methodSignature
)
==
JDWP_TAG
(
OBJECT
))
||
(
returnTypeTag
(
request
->
methodSignature
)
==
JDWP_TAG
(
ARRAY
)))
{
if
(
request
->
returnValue
.
l
!=
NULL
)
{
tossGlobalRef
(
env
,
&
(
request
->
returnValue
.
l
));
}
}
}
static
jvmtiError
fillInvokeRequest
(
JNIEnv
*
env
,
InvokeRequest
*
request
,
jbyte
invokeType
,
jbyte
options
,
jint
id
,
...
...
@@ -736,6 +777,13 @@ invoker_completeInvokeRequest(jthread thread)
(
void
)
outStream_writeObjectRef
(
env
,
&
out
,
exc
);
outStream_sendReply
(
&
out
);
}
/*
* At this time, there's no need to retain global references on
* arguments since the reply is processed. No one will deal with
* this request ID anymore, so we must call deleteGlobalRefs().
*/
deleteGlobalRefs
(
env
,
request
);
}
jboolean
...
...
src/share/classes/java/util/Hashtable.java
浏览文件 @
d29da907
...
...
@@ -1132,10 +1132,10 @@ public class Hashtable<K,V>
Entry
<
Object
,
Object
>
entryStack
=
null
;
synchronized
(
this
)
{
// Write out the
length, threshold, loadf
actor
// Write out the
threshold and loadF
actor
s
.
defaultWriteObject
();
// Write out
length,
count of elements
// Write out
the length and
count of elements
s
.
writeInt
(
table
.
length
);
s
.
writeInt
(
count
);
...
...
@@ -1165,22 +1165,33 @@ public class Hashtable<K,V>
private
void
readObject
(
java
.
io
.
ObjectInputStream
s
)
throws
IOException
,
ClassNotFoundException
{
// Read in the
length, threshold, and loadf
actor
// Read in the
threshold and loadF
actor
s
.
defaultReadObject
();
// Validate loadFactor (ignore threshold - it will be re-computed)
if
(
loadFactor
<=
0
||
Float
.
isNaN
(
loadFactor
))
throw
new
StreamCorruptedException
(
"Illegal Load: "
+
loadFactor
);
// Read the original length of the array and number of elements
int
origlength
=
s
.
readInt
();
int
elements
=
s
.
readInt
();
// Compute new size with a bit of room 5% to grow but
// no larger than the original size. Make the length
// Validate # of elements
if
(
elements
<
0
)
throw
new
StreamCorruptedException
(
"Illegal # of Elements: "
+
elements
);
// Clamp original length to be more than elements / loadFactor
// (this is the invariant enforced with auto-growth)
origlength
=
Math
.
max
(
origlength
,
(
int
)(
elements
/
loadFactor
)
+
1
);
// Compute new length with a bit of room 5% + 3 to grow but
// no larger than the clamped original length. Make the length
// odd if it's large enough, this helps distribute the entries.
// Guard against the length ending up zero, that's not valid.
int
length
=
(
int
)(
elements
*
loadFactor
)
+
(
elements
/
20
)
+
3
;
int
length
=
(
int
)(
(
elements
+
elements
/
20
)
/
loadFactor
)
+
3
;
if
(
length
>
elements
&&
(
length
&
1
)
==
0
)
length
--;
if
(
origlength
>
0
&&
length
>
origlength
)
length
=
origlength
;
length
=
Math
.
min
(
length
,
origlength
);
table
=
new
Entry
<?,?>[
length
];
threshold
=
(
int
)
Math
.
min
(
length
*
loadFactor
,
MAX_ARRAY_SIZE
+
1
);
count
=
0
;
...
...
@@ -1191,7 +1202,7 @@ public class Hashtable<K,V>
K
key
=
(
K
)
s
.
readObject
();
@SuppressWarnings
(
"unchecked"
)
V
value
=
(
V
)
s
.
readObject
();
// sync
h could be
eliminated for performance
// sync
is
eliminated for performance
reconstitutionPut
(
table
,
key
,
value
);
}
}
...
...
@@ -1203,9 +1214,9 @@ public class Hashtable<K,V>
*
* <p>This differs from the regular put method in several ways. No
* checking for rehashing is necessary since the number of elements
* initially in the table is known. The modCount is not incremented
*
because we are creating a new instance. Also, no return value
* is needed.
* initially in the table is known. The modCount is not incremented
and
*
there's no synchronization because we are creating a new instance.
*
Also, no return value
is needed.
*/
private
void
reconstitutionPut
(
Entry
<?,?>[]
tab
,
K
key
,
V
value
)
throws
StreamCorruptedException
...
...
src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java
浏览文件 @
d29da907
...
...
@@ -485,19 +485,25 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return {@code true} if this queue changed as a result of the call
*/
public
boolean
remove
(
Object
o
)
{
if
(
o
==
null
)
return
false
;
Node
<
E
>
pred
=
null
;
for
(
Node
<
E
>
p
=
first
();
p
!=
null
;
p
=
succ
(
p
))
{
E
item
=
p
.
item
;
if
(
item
!=
null
&&
o
.
equals
(
item
)
&&
p
.
casItem
(
item
,
null
))
{
Node
<
E
>
next
=
succ
(
p
);
if
(
pred
!=
null
&&
next
!=
null
)
if
(
o
!=
null
)
{
Node
<
E
>
next
,
pred
=
null
;
for
(
Node
<
E
>
p
=
first
();
p
!=
null
;
pred
=
p
,
p
=
next
)
{
boolean
removed
=
false
;
E
item
=
p
.
item
;
if
(
item
!=
null
)
{
if
(!
o
.
equals
(
item
))
{
next
=
succ
(
p
);
continue
;
}
removed
=
p
.
casItem
(
item
,
null
);
}
next
=
succ
(
p
);
if
(
pred
!=
null
&&
next
!=
null
)
// unlink
pred
.
casNext
(
p
,
next
);
return
true
;
if
(
removed
)
return
true
;
}
pred
=
p
;
}
return
false
;
}
...
...
src/share/classes/sun/security/ssl/HandshakeMessage.java
浏览文件 @
d29da907
...
...
@@ -812,8 +812,9 @@ class DH_ServerKeyExchange extends ServerKeyExchange
if
(!
localSupportedSignAlgs
.
contains
(
preferableSignatureAlgorithm
))
{
throw
new
SSLHandshakeException
(
"Unsupported SignatureAndHashAlgorithm in "
+
"ServerKeyExchange message"
);
"Unsupported SignatureAndHashAlgorithm in "
+
"ServerKeyExchange message: "
+
preferableSignatureAlgorithm
);
}
}
else
{
this
.
preferableSignatureAlgorithm
=
null
;
...
...
@@ -846,7 +847,8 @@ class DH_ServerKeyExchange extends ServerKeyExchange
sig
=
RSASignature
.
getInstance
();
break
;
default
:
throw
new
SSLKeyException
(
"neither an RSA or a DSA key"
);
throw
new
SSLKeyException
(
"neither an RSA or a DSA key: "
+
algorithm
);
}
}
...
...
@@ -1096,7 +1098,8 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
preferableSignatureAlgorithm
))
{
throw
new
SSLHandshakeException
(
"Unsupported SignatureAndHashAlgorithm in "
+
"ServerKeyExchange message"
);
"ServerKeyExchange message: "
+
preferableSignatureAlgorithm
);
}
}
...
...
@@ -1136,7 +1139,8 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
case
"RSA"
:
return
RSASignature
.
getInstance
();
default
:
throw
new
NoSuchAlgorithmException
(
"neither an RSA or a EC key"
);
throw
new
NoSuchAlgorithmException
(
"neither an RSA or a EC key : "
+
keyAlgorithm
);
}
}
...
...
@@ -1343,7 +1347,8 @@ class CertificateRequest extends HandshakeMessage
algorithmsLen
=
input
.
getInt16
();
if
(
algorithmsLen
<
2
)
{
throw
new
SSLProtocolException
(
"Invalid supported_signature_algorithms field"
);
"Invalid supported_signature_algorithms field: "
+
algorithmsLen
);
}
algorithms
=
new
ArrayList
<
SignatureAndHashAlgorithm
>();
...
...
@@ -1362,7 +1367,8 @@ class CertificateRequest extends HandshakeMessage
if
(
remains
!=
0
)
{
throw
new
SSLProtocolException
(
"Invalid supported_signature_algorithms field"
);
"Invalid supported_signature_algorithms field. remains: "
+
remains
);
}
}
else
{
algorithms
=
new
ArrayList
<
SignatureAndHashAlgorithm
>();
...
...
@@ -1379,7 +1385,8 @@ class CertificateRequest extends HandshakeMessage
}
if
(
len
!=
0
)
{
throw
new
SSLProtocolException
(
"Bad CertificateRequest DN length"
);
throw
new
SSLProtocolException
(
"Bad CertificateRequest DN length: "
+
len
);
}
authorities
=
v
.
toArray
(
new
DistinguishedName
[
v
.
size
()]);
...
...
@@ -1609,8 +1616,8 @@ static final class CertificateVerify extends HandshakeMessage {
if
(!
localSupportedSignAlgs
.
contains
(
preferableSignatureAlgorithm
))
{
throw
new
SSLHandshakeException
(
"Unsupported SignatureAndHashAlgorithm in "
+
"CertificateVerify message"
);
"Unsupported SignatureAndHashAlgorithm in "
+
"CertificateVerify message: "
+
preferableSignatureAlgorithm
);
}
}
...
...
@@ -1977,7 +1984,8 @@ static final class Finished extends HandshakeMessage {
SecretKey
prfKey
=
kg
.
generateKey
();
if
(
"RAW"
.
equals
(
prfKey
.
getFormat
())
==
false
)
{
throw
new
ProviderException
(
"Invalid PRF output, format must be RAW"
);
"Invalid PRF output, format must be RAW. "
+
"Format received: "
+
prfKey
.
getFormat
());
}
byte
[]
finished
=
prfKey
.
getEncoded
();
return
finished
;
...
...
src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
浏览文件 @
d29da907
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
6
, Oracle and/or its affiliates. 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
...
...
@@ -67,7 +67,8 @@ final class RSAClientKeyExchange extends HandshakeMessage {
ProtocolVersion
maxVersion
,
SecureRandom
generator
,
PublicKey
publicKey
)
throws
IOException
{
if
(
publicKey
.
getAlgorithm
().
equals
(
"RSA"
)
==
false
)
{
throw
new
SSLKeyException
(
"Public key not of type RSA"
);
throw
new
SSLKeyException
(
"Public key not of type RSA: "
+
publicKey
.
getAlgorithm
());
}
this
.
protocolVersion
=
protocolVersion
;
...
...
@@ -98,7 +99,8 @@ final class RSAClientKeyExchange extends HandshakeMessage {
int
messageSize
,
PrivateKey
privateKey
)
throws
IOException
{
if
(
privateKey
.
getAlgorithm
().
equals
(
"RSA"
)
==
false
)
{
throw
new
SSLKeyException
(
"Private key not of type RSA"
);
throw
new
SSLKeyException
(
"Private key not of type RSA: "
+
privateKey
.
getAlgorithm
());
}
if
(
currentVersion
.
v
>=
ProtocolVersion
.
TLS10
.
v
)
{
...
...
@@ -113,10 +115,31 @@ final class RSAClientKeyExchange extends HandshakeMessage {
byte
[]
encoded
=
null
;
try
{
boolean
needFailover
=
false
;
Cipher
cipher
=
JsseJce
.
getCipher
(
JsseJce
.
CIPHER_RSA_PKCS1
);
boolean
needFailover
=
!
KeyUtil
.
isOracleJCEProvider
(
cipher
.
getProvider
().
getName
());
try
{
// Try UNWRAP_MODE mode firstly.
cipher
.
init
(
Cipher
.
UNWRAP_MODE
,
privateKey
,
new
TlsRsaPremasterSecretParameterSpec
(
maxVersion
.
v
,
currentVersion
.
v
),
generator
);
// The provider selection can be delayed, please don't call
// any Cipher method before the call to Cipher.init().
needFailover
=
!
KeyUtil
.
isOracleJCEProvider
(
cipher
.
getProvider
().
getName
());
}
catch
(
InvalidKeyException
|
UnsupportedOperationException
iue
)
{
if
(
debug
!=
null
&&
Debug
.
isOn
(
"handshake"
))
{
System
.
out
.
println
(
"The Cipher provider "
+
cipher
.
getProvider
().
getName
()
+
" caused exception: "
+
iue
.
getMessage
());
}
needFailover
=
true
;
}
if
(
needFailover
)
{
// Use DECRYPT_MODE and dispose the previous initialization.
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
boolean
failed
=
false
;
try
{
...
...
@@ -132,17 +155,14 @@ final class RSAClientKeyExchange extends HandshakeMessage {
maxVersion
.
v
,
currentVersion
.
v
,
encoded
,
generator
);
}
else
{
cipher
.
init
(
Cipher
.
UNWRAP_MODE
,
privateKey
,
new
TlsRsaPremasterSecretParameterSpec
(
maxVersion
.
v
,
currentVersion
.
v
),
generator
);
// the cipher should have been initialized
preMaster
=
(
SecretKey
)
cipher
.
unwrap
(
encrypted
,
"TlsRsaPremasterSecret"
,
Cipher
.
SECRET_KEY
);
}
}
catch
(
InvalidKeyException
ibk
)
{
// the message is too big to process with RSA
throw
new
SSL
Protocol
Exception
(
"Unable to process PreMasterSecret
, may be too big"
);
throw
new
SSLException
(
"Unable to process PreMasterSecret
"
,
ibk
);
}
catch
(
Exception
e
)
{
// unlikely to happen, otherwise, must be a provider exception
if
(
debug
!=
null
&&
Debug
.
isOn
(
"handshake"
))
{
...
...
src/windows/classes/sun/awt/windows/fontconfig.properties
浏览文件 @
d29da907
...
...
@@ -242,7 +242,7 @@ sequence.fallback=lucida,\
# Exclusion Ranges
exclusion.alphabetic
=
0700-1e9f,1f00-20ab,20ad-f8ff
exclusion.alphabetic
=
0700-1e9f,1f00-20
17,2020-20
ab,20ad-f8ff
exclusion.chinese-gb18030
=
0390-03d6,2200-22ef,2701-27be
exclusion.hebrew
=
0041-005a,0060-007a,007f-00ff,20ac-20ac
...
...
src/windows/classes/sun/security/mscapi/KeyStore.java
浏览文件 @
d29da907
/*
* Copyright (c) 2005, 201
5
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
6
, Oracle and/or its affiliates. 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
...
...
@@ -189,8 +189,10 @@ abstract class KeyStore extends KeyStoreSpi {
/*
* The keystore entries.
* Keys in the map are unique aliases (thus can differ from
* KeyEntry.getAlias())
*/
private
Collection
<
KeyEntry
>
entries
=
new
ArrayList
<
KeyEntry
>();
private
Map
<
String
,
KeyEntry
>
entries
=
new
HashMap
<
>();
/*
* The keystore name.
...
...
@@ -250,13 +252,10 @@ abstract class KeyStore extends KeyStoreSpi {
if
(
engineIsKeyEntry
(
alias
)
==
false
)
return
null
;
for
(
KeyEntry
entry
:
entries
)
{
if
(
alias
.
equals
(
entry
.
getAlias
()))
{
return
entry
.
getPrivateKey
();
}
}
return
null
;
KeyEntry
entry
=
entries
.
get
(
alias
);
return
(
entry
==
null
)
?
null
:
entry
.
getPrivateKey
();
}
/**
...
...
@@ -276,15 +275,13 @@ abstract class KeyStore extends KeyStoreSpi {
return
null
;
}
for
(
KeyEntry
entry
:
entries
)
{
if
(
alias
.
equals
(
entry
.
getAlias
()))
{
X509Certificate
[]
certChain
=
entry
.
getCertificateChain
();
return
certChain
.
clone
();
}
}
return
null
;
KeyEntry
entry
=
entries
.
get
(
alias
);
X509Certificate
[]
certChain
=
(
entry
==
null
)
?
null
:
entry
.
getCertificateChain
();
return
(
certChain
==
null
)
?
null
:
certChain
.
clone
();
}
/**
...
...
@@ -308,15 +305,13 @@ abstract class KeyStore extends KeyStoreSpi {
return
null
;
}
for
(
KeyEntry
entry
:
entries
)
{
if
(
alias
.
equals
(
entry
.
getAlias
()))
{
X509Certificate
[]
certChain
=
entry
.
getCertificateChain
();
return
certChain
.
length
==
0
?
null
:
certChain
[
0
];
}
}
return
null
;
KeyEntry
entry
=
entries
.
get
(
alias
);
X509Certificate
[]
certChain
=
(
entry
==
null
)
?
null
:
entry
.
getCertificateChain
();
return
(
certChain
==
null
||
certChain
.
length
==
0
)
?
null
:
certChain
[
0
];
}
/**
...
...
@@ -380,29 +375,32 @@ abstract class KeyStore extends KeyStoreSpi {
if
(
key
instanceof
RSAPrivateCrtKey
)
{
KeyEntry
entry
=
null
;
boolean
found
=
false
;
KeyEntry
entry
=
entries
.
get
(
alias
);
for
(
KeyEntry
e
:
entries
)
{
if
(
alias
.
equals
(
e
.
getAlias
()))
{
found
=
true
;
entry
=
e
;
break
;
X509Certificate
[]
xchain
;
if
(
chain
!=
null
)
{
if
(
chain
instanceof
X509Certificate
[])
{
xchain
=
(
X509Certificate
[])
chain
;
}
else
{
xchain
=
new
X509Certificate
[
chain
.
length
];
System
.
arraycopy
(
chain
,
0
,
xchain
,
0
,
chain
.
length
);
}
}
else
{
xchain
=
null
;
}
if
(
!
found
)
{
if
(
entry
==
null
)
{
entry
=
//TODO new KeyEntry(alias, key, (X509Certificate[]) chain);
new
KeyEntry
(
alias
,
null
,
(
X509Certificate
[])
chain
);
entries
.
add
(
entry
);
new
KeyEntry
(
alias
,
null
,
x
chain
);
storeWithUniqueAlias
(
alias
,
entry
);
}
entry
.
setAlias
(
alias
);
try
{
entry
.
setPrivateKey
((
RSAPrivateCrtKey
)
key
);
entry
.
setCertificateChain
(
(
X509Certificate
[])
chain
);
entry
.
setCertificateChain
(
x
chain
);
}
catch
(
CertificateException
ce
)
{
throw
new
KeyStoreException
(
ce
);
...
...
@@ -474,23 +472,14 @@ abstract class KeyStore extends KeyStoreSpi {
// TODO - build CryptoAPI chain?
X509Certificate
[]
chain
=
new
X509Certificate
[]{
(
X509Certificate
)
cert
};
KeyEntry
entry
=
null
;
boolean
found
=
false
;
for
(
KeyEntry
e
:
entries
)
{
if
(
alias
.
equals
(
e
.
getAlias
()))
{
found
=
true
;
entry
=
e
;
break
;
}
}
KeyEntry
entry
=
entries
.
get
(
alias
);
if
(
!
found
)
{
if
(
entry
==
null
)
{
entry
=
new
KeyEntry
(
alias
,
null
,
chain
);
entries
.
add
(
entry
);
storeWithUniqueAlias
(
alias
,
entry
);
}
if
(
entry
.
getPrivateKey
()
==
null
)
{
// trusted-cert entry
entry
.
setAlias
(
alias
);
...
...
@@ -522,32 +511,26 @@ abstract class KeyStore extends KeyStoreSpi {
throw
new
KeyStoreException
(
"alias must not be null"
);
}
for
(
KeyEntry
entry
:
entries
)
{
if
(
alias
.
equals
(
entry
.
getAlias
()))
{
// Get end-entity certificate and remove from system cert store
X509Certificate
[]
certChain
=
entry
.
getCertificateChain
();
if
(
certChain
!=
null
)
{
KeyEntry
entry
=
entries
.
remove
(
alias
);
if
(
entry
!=
null
)
{
// Get end-entity certificate and remove from system cert store
X509Certificate
[]
certChain
=
entry
.
getCertificateChain
();
if
(
certChain
!=
null
)
{
try
{
try
{
byte
[]
encoding
=
certChain
[
0
].
getEncoded
();
removeCertificate
(
getName
(),
alias
,
encoding
,
byte
[]
encoding
=
certChain
[
0
].
getEncoded
();
removeCertificate
(
getName
(),
entry
.
getAlias
()
,
encoding
,
encoding
.
length
);
}
catch
(
CertificateException
e
)
{
throw
new
KeyStoreException
(
"Cannot remove entry: "
+
e
);
}
}
Key
privateKey
=
entry
.
getPrivateKey
();
if
(
privateKey
!=
null
)
{
destroyKeyContainer
(
Key
.
getContainerName
(
privateKey
.
getHCryptProvider
()));
}
catch
(
CertificateException
e
)
{
throw
new
KeyStoreException
(
"Cannot remove entry: "
,
e
);
}
entries
.
remove
(
entry
);
break
;
}
Key
privateKey
=
entry
.
getPrivateKey
();
if
(
privateKey
!=
null
)
{
destroyKeyContainer
(
Key
.
getContainerName
(
privateKey
.
getHCryptProvider
()));
}
}
}
...
...
@@ -558,8 +541,7 @@ abstract class KeyStore extends KeyStoreSpi {
* @return enumeration of the alias names
*/
public
Enumeration
<
String
>
engineAliases
()
{
final
Iterator
<
KeyEntry
>
iter
=
entries
.
iterator
();
final
Iterator
<
String
>
iter
=
entries
.
keySet
().
iterator
();
return
new
Enumeration
<
String
>()
{
...
...
@@ -570,8 +552,7 @@ abstract class KeyStore extends KeyStoreSpi {
public
String
nextElement
()
{
KeyEntry
entry
=
iter
.
next
();
return
entry
.
getAlias
();
return
iter
.
next
();
}
};
}
...
...
@@ -584,15 +565,7 @@ abstract class KeyStore extends KeyStoreSpi {
* @return true if the alias exists, false otherwise
*/
public
boolean
engineContainsAlias
(
String
alias
)
{
for
(
Enumeration
<
String
>
enumerator
=
engineAliases
();
enumerator
.
hasMoreElements
();)
{
String
a
=
enumerator
.
nextElement
();
if
(
a
.
equals
(
alias
))
return
true
;
}
return
false
;
return
entries
.
containsKey
(
alias
);
}
/**
...
...
@@ -617,13 +590,8 @@ abstract class KeyStore extends KeyStoreSpi {
return
false
;
}
for
(
KeyEntry
entry
:
entries
)
{
if
(
alias
.
equals
(
entry
.
getAlias
()))
{
return
entry
.
getPrivateKey
()
!=
null
;
}
}
return
false
;
KeyEntry
entry
=
entries
.
get
(
alias
);
return
entry
!=
null
&&
entry
.
getPrivateKey
()
!=
null
;
}
/**
...
...
@@ -633,15 +601,14 @@ abstract class KeyStore extends KeyStoreSpi {
* @return true if the entry identified by the given alias is a
* <i>trusted certificate entry</i>, false otherwise.
*/
public
boolean
engineIsCertificateEntry
(
String
alias
)
{
for
(
KeyEntry
entry
:
entries
)
{
if
(
alias
.
equals
(
entry
.
getAlias
()))
{
return
entry
.
getPrivateKey
()
==
null
;
}
public
boolean
engineIsCertificateEntry
(
String
alias
)
{
if
(
alias
==
null
)
{
return
false
;
}
return
false
;
KeyEntry
entry
=
entries
.
get
(
alias
);
return
entry
!=
null
&&
entry
.
getPrivateKey
()
==
null
;
}
/**
...
...
@@ -660,9 +627,10 @@ abstract class KeyStore extends KeyStoreSpi {
* @return the (alias) name of the first entry with matching certificate,
* or null if no such entry exists in this keystore.
*/
public
String
engineGetCertificateAlias
(
Certificate
cert
)
{
for
(
KeyEntry
entry
:
entries
)
{
public
String
engineGetCertificateAlias
(
Certificate
cert
)
{
for
(
Map
.
Entry
<
String
,
KeyEntry
>
mapEntry
:
entries
.
entrySet
())
{
KeyEntry
entry
=
mapEntry
.
getValue
();
if
(
entry
.
certChain
!=
null
&&
entry
.
certChain
[
0
].
equals
(
cert
))
{
return
entry
.
getAlias
();
}
...
...
@@ -755,20 +723,39 @@ abstract class KeyStore extends KeyStoreSpi {
try
{
// Load keys and/or certificate chains
loadKeysOrCertificateChains
(
getName
()
,
entries
);
loadKeysOrCertificateChains
(
getName
());
}
catch
(
KeyStoreException
e
)
{
throw
new
IOException
(
e
);
}
}
/**
* Stores the given entry into the map, making sure
* the alias, used as the key is unique.
* If the same alias already exists, it tries to append
* a suffix (1), (2), etc to it until it finds a unique
* value.
*/
private
void
storeWithUniqueAlias
(
String
alias
,
KeyEntry
entry
)
{
String
uniqAlias
=
alias
;
int
uniqNum
=
1
;
while
(
true
)
{
if
(
entries
.
putIfAbsent
(
uniqAlias
,
entry
)
==
null
)
{
break
;
}
uniqAlias
=
alias
+
" ("
+
(
uniqNum
++)
+
")"
;
}
}
/**
* Generates a certificate chain from the collection of
* certificates and stores the result into a key entry.
*/
private
void
generateCertificateChain
(
String
alias
,
Collection
<?
extends
Certificate
>
certCollection
,
Collection
<
KeyEntry
>
entries
)
Collection
<?
extends
Certificate
>
certCollection
)
{
try
{
...
...
@@ -782,10 +769,8 @@ abstract class KeyStore extends KeyStoreSpi {
certChain
[
i
]
=
(
X509Certificate
)
iter
.
next
();
}
KeyEntry
entry
=
new
KeyEntry
(
alias
,
null
,
certChain
);
// Add cert chain
entries
.
add
(
entry
);
storeWithUniqueAlias
(
alias
,
new
KeyEntry
(
alias
,
null
,
certChain
));
}
catch
(
Throwable
e
)
{
...
...
@@ -800,8 +785,7 @@ abstract class KeyStore extends KeyStoreSpi {
*/
private
void
generateRSAKeyAndCertificateChain
(
String
alias
,
long
hCryptProv
,
long
hCryptKey
,
int
keyLength
,
Collection
<?
extends
Certificate
>
certCollection
,
Collection
<
KeyEntry
>
entries
)
Collection
<?
extends
Certificate
>
certCollection
)
{
try
{
...
...
@@ -815,11 +799,9 @@ abstract class KeyStore extends KeyStoreSpi {
certChain
[
i
]
=
(
X509Certificate
)
iter
.
next
();
}
KeyEntry
entry
=
new
KeyEntry
(
alias
,
new
RSAPrivateKey
(
hCryptProv
,
hCryptKey
,
keyLength
),
certChain
);
// Add cert chain
entries
.
add
(
entry
);
storeWithUniqueAlias
(
alias
,
new
KeyEntry
(
alias
,
new
RSAPrivateKey
(
hCryptProv
,
hCryptKey
,
keyLength
),
certChain
));
}
catch
(
Throwable
e
)
{
...
...
@@ -876,8 +858,8 @@ abstract class KeyStore extends KeyStoreSpi {
* @param name Name of keystore.
* @param entries Collection of key/certificate.
*/
private
native
void
loadKeysOrCertificateChains
(
String
name
,
Collection
<
KeyEntry
>
entries
)
throws
KeyStoreException
;
private
native
void
loadKeysOrCertificateChains
(
String
name
)
throws
KeyStoreException
;
/**
* Stores a DER-encoded certificate into the certificate store
...
...
src/windows/native/sun/security/mscapi/security.cpp
浏览文件 @
d29da907
/*
* Copyright (c) 2005, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
6
, Oracle and/or its affiliates. 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
...
...
@@ -266,7 +266,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_PRNG_generateSeed
* Signature: (Ljava/lang/String;Ljava/util/Collection;)V
*/
JNIEXPORT
void
JNICALL
Java_sun_security_mscapi_KeyStore_loadKeysOrCertificateChains
(
JNIEnv
*
env
,
jobject
obj
,
jstring
jCertStoreName
,
jobject
jCollections
)
(
JNIEnv
*
env
,
jobject
obj
,
jstring
jCertStoreName
)
{
/**
* Certificate in cert store has enhanced key usage extension
...
...
@@ -325,7 +325,7 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_loadKeysOrCertificateCh
// Determine method ID to generate certificate chain
jmethodID
mGenCertChain
=
env
->
GetMethodID
(
clazzOfThis
,
"generateCertificateChain"
,
"(Ljava/lang/String;Ljava/util/Collection;
Ljava/util/Collection;
)V"
);
"(Ljava/lang/String;Ljava/util/Collection;)V"
);
if
(
mGenCertChain
==
NULL
)
{
__leave
;
}
...
...
@@ -333,7 +333,7 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_loadKeysOrCertificateCh
// Determine method ID to generate RSA certificate chain
jmethodID
mGenRSAKeyAndCertChain
=
env
->
GetMethodID
(
clazzOfThis
,
"generateRSAKeyAndCertificateChain"
,
"(Ljava/lang/String;JJILjava/util/Collection;
Ljava/util/Collection;
)V"
);
"(Ljava/lang/String;JJILjava/util/Collection;)V"
);
if
(
mGenRSAKeyAndCertChain
==
NULL
)
{
__leave
;
}
...
...
@@ -360,38 +360,37 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_loadKeysOrCertificateCh
}
else
{
// Private key is available
BOOL
bGetUserKey
=
::
CryptGetUserKey
(
hCryptProv
,
dwKeySpec
,
&
hUserKey
);
BOOL
bGetUserKey
=
::
CryptGetUserKey
(
hCryptProv
,
dwKeySpec
,
&
hUserKey
);
// Skip certificate if cannot find private key
if
(
bGetUserKey
==
FALSE
)
{
if
(
bCallerFreeProv
)
::
CryptReleaseContext
(
hCryptProv
,
NULL
);
// Skip certificate if cannot find private key
if
(
bGetUserKey
==
FALSE
)
{
if
(
bCallerFreeProv
)
::
CryptReleaseContext
(
hCryptProv
,
NULL
);
continue
;
}
continue
;
}
// Set cipher mode to ECB
DWORD
dwCipherMode
=
CRYPT_MODE_ECB
;
::
CryptSetKeyParam
(
hUserKey
,
KP_MODE
,
(
BYTE
*
)
&
dwCipherMode
,
NULL
);
// Set cipher mode to ECB
DWORD
dwCipherMode
=
CRYPT_MODE_ECB
;
::
CryptSetKeyParam
(
hUserKey
,
KP_MODE
,
(
BYTE
*
)
&
dwCipherMode
,
NULL
);
// If the private key is present in smart card, we may not be able to
// determine the key length by using the private key handle. However,
// since public/private key pairs must have the same length, we could
// determine the key length of the private key by using the public key
// in the certificate.
dwPublicKeyLength
=
::
CertGetPublicKeyLength
(
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
,
&
(
pCertContext
->
pCertInfo
->
SubjectPublicKeyInfo
));
// If the private key is present in smart card, we may not be able to
// determine the key length by using the private key handle. However,
// since public/private key pairs must have the same length, we could
// determine the key length of the private key by using the public key
// in the certificate.
dwPublicKeyLength
=
::
CertGetPublicKeyLength
(
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
,
&
(
pCertContext
->
pCertInfo
->
SubjectPublicKeyInfo
));
}
}
PCCERT_CHAIN_CONTEXT
pCertChainContext
=
NULL
;
// Build certificate chain by using system certificate store.
// Add cert chain into collection for any key usage.
//
if
(
GetCertificateChain
(
OID_EKU_ANY
,
pCertContext
,
&
pCertChainContext
))
if
(
GetCertificateChain
(
OID_EKU_ANY
,
pCertContext
,
&
pCertChainContext
))
{
for
(
unsigned
int
i
=
0
;
i
<
pCertChainContext
->
cChain
;
i
++
)
...
...
@@ -450,26 +449,26 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_loadKeysOrCertificateCh
// collection
env
->
CallVoidMethod
(
obj
,
mGenCertChain
,
env
->
NewStringUTF
(
pszNameString
),
jArrayList
,
jCollections
);
jArrayList
);
}
else
{
// Determine key type: RSA or DSA
DWORD
dwData
=
CALG_RSA_KEYX
;
DWORD
dwSize
=
sizeof
(
DWORD
);
::
CryptGetKeyParam
(
hUserKey
,
KP_ALGID
,
(
BYTE
*
)
&
dwData
,
&
dwSize
,
NULL
);
if
((
dwData
&
ALG_TYPE_RSA
)
==
ALG_TYPE_RSA
)
{
// Generate RSA certificate chain and store into cert
// chain collection
env
->
CallVoidMethod
(
obj
,
mGenRSAKeyAndCertChain
,
env
->
NewStringUTF
(
pszNameString
),
(
jlong
)
hCryptProv
,
(
jlong
)
hUserKey
,
dwPublicKeyLength
,
jArrayList
,
jCollections
);
// Determine key type: RSA or DSA
DWORD
dwData
=
CALG_RSA_KEYX
;
DWORD
dwSize
=
sizeof
(
DWORD
);
::
CryptGetKeyParam
(
hUserKey
,
KP_ALGID
,
(
BYTE
*
)
&
dwData
,
&
dwSize
,
NULL
);
if
((
dwData
&
ALG_TYPE_RSA
)
==
ALG_TYPE_RSA
)
{
// Generate RSA certificate chain and store into cert
// chain collection
env
->
CallVoidMethod
(
obj
,
mGenRSAKeyAndCertChain
,
env
->
NewStringUTF
(
pszNameString
),
(
jlong
)
hCryptProv
,
(
jlong
)
hUserKey
,
dwPublicKeyLength
,
jArrayList
);
}
}
}
}
// Free cert chain
...
...
test/TEST.ROOT
浏览文件 @
d29da907
# This file identifies the root of the test-suite hierarchy.
# It also contains test-suite configuration information.
# The list of keywords supported in the entire test suite
keys=2d dnd i18n
# The list of keywords supported in the entire test suite. The
# "intermittent" keyword marks tests known to fail intermittently.
# The "randomness" keyword marks tests using randomness with test
# cases differing from run to run. (A test using a fixed random seed
# would not count as "randomness" by this definition.) Extra care
# should be taken to handle test failures of intermittent or
# randomness tests.
keys=2d dnd i18n intermittent randomness
# Tests that must run in othervm mode
othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi
...
...
test/com/sun/jdi/oom/@debuggeeVMOptions
0 → 100644
浏览文件 @
d29da907
-Xmx40m
\ No newline at end of file
test/com/sun/jdi/oom/OomDebugTest.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016 Red Hat Inc.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4858370
* @summary JDWP: Memory Leak (global references not deleted after invokeMethod).
*
* @author Severin Gehwolf <sgehwolf@redhat.com>
*
* @library ..
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g OomDebugTest.java
* @run shell OomDebugTestSetup.sh
* @run main OomDebugTest OomDebugTestTarget test1
* @run main OomDebugTest OomDebugTestTarget test2
* @run main OomDebugTest OomDebugTestTarget test3
* @run main OomDebugTest OomDebugTestTarget test4
* @run main OomDebugTest OomDebugTestTarget test5
*/
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
com.sun.jdi.ArrayReference
;
import
com.sun.jdi.ArrayType
;
import
com.sun.jdi.ClassType
;
import
com.sun.jdi.Field
;
import
com.sun.jdi.InvocationException
;
import
com.sun.jdi.Method
;
import
com.sun.jdi.ObjectReference
;
import
com.sun.jdi.ReferenceType
;
import
com.sun.jdi.StackFrame
;
import
com.sun.jdi.VMOutOfMemoryException
;
import
com.sun.jdi.Value
;
import
com.sun.jdi.event.BreakpointEvent
;
/***************** Target program **********************/
class
OomDebugTestTarget
{
OomDebugTestTarget
()
{
System
.
out
.
println
(
"DEBUG: invoked constructor"
);
}
static
class
FooCls
{
@SuppressWarnings
(
"unused"
)
private
byte
[]
bytes
=
new
byte
[
3000000
];
};
FooCls
fooCls
=
new
FooCls
();
byte
[]
byteArray
=
new
byte
[
0
];
void
testMethod
(
FooCls
foo
)
{
System
.
out
.
println
(
"DEBUG: invoked 'void testMethod(FooCls)', foo == "
+
foo
);
}
void
testPrimitive
(
byte
[]
foo
)
{
System
.
out
.
println
(
"DEBUG: invoked 'void testPrimitive(byte[])', foo == "
+
foo
);
}
byte
[]
testPrimitiveArrRetval
()
{
System
.
out
.
println
(
"DEBUG: invoked 'byte[] testPrimitiveArrRetval()'"
);
return
new
byte
[
3000000
];
}
FooCls
testFooClsRetval
()
{
System
.
out
.
println
(
"DEBUG: invoked 'FooCls testFooClsRetval()'"
);
return
new
FooCls
();
}
public
void
entry
()
{}
public
static
void
main
(
String
[]
args
){
System
.
out
.
println
(
"DEBUG: OomDebugTestTarget.main"
);
new
OomDebugTestTarget
().
entry
();
}
}
/***************** Test program ************************/
public
class
OomDebugTest
extends
TestScaffold
{
private
static
final
int
TOTAL_TESTS
=
1
;
private
ReferenceType
targetClass
;
private
ObjectReference
thisObject
;
private
int
failedTests
;
private
final
String
testMethodName
;
public
OomDebugTest
(
String
[]
args
)
{
super
(
args
);
if
(
args
.
length
!=
2
)
{
throw
new
RuntimeException
(
"Test failed unexpectedly."
);
}
testMethodName
=
args
[
1
];
}
@Override
protected
void
runTests
()
throws
Exception
{
try
{
/*
* Get to the top of entry()
* to determine targetClass and mainThread
*/
BreakpointEvent
bpe
=
startTo
(
"OomDebugTestTarget"
,
"entry"
,
"()V"
);
targetClass
=
bpe
.
location
().
declaringType
();
mainThread
=
bpe
.
thread
();
StackFrame
frame
=
mainThread
.
frame
(
0
);
thisObject
=
frame
.
thisObject
();
java
.
lang
.
reflect
.
Method
m
=
findTestMethod
();
m
.
invoke
(
this
);
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
failure
();
}
catch
(
SecurityException
e
)
{
e
.
printStackTrace
();
failure
();
}
}
private
java
.
lang
.
reflect
.
Method
findTestMethod
()
throws
NoSuchMethodException
,
SecurityException
{
return
OomDebugTest
.
class
.
getDeclaredMethod
(
testMethodName
);
}
private
void
failure
()
{
failedTests
++;
}
/*
* Test case: Object reference as method parameter.
*/
@SuppressWarnings
(
"unused"
)
// called via reflection
private
void
test1
()
throws
Exception
{
System
.
out
.
println
(
"DEBUG: ------------> Running "
+
testMethodName
);
try
{
Field
field
=
targetClass
.
fieldByName
(
"fooCls"
);
ClassType
clsType
=
(
ClassType
)
field
.
type
();
Method
constructor
=
getConstructorForClass
(
clsType
);
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
ObjectReference
objRef
=
clsType
.
newInstance
(
mainThread
,
constructor
,
new
ArrayList
(
0
),
ObjectReference
.
INVOKE_NONVIRTUAL
);
invoke
(
"testMethod"
,
"(LOomDebugTestTarget$FooCls;)V"
,
objRef
);
}
}
catch
(
InvocationException
e
)
{
handleFailure
(
e
);
}
}
/*
* Test case: Array reference as method parameter.
*/
@SuppressWarnings
(
"unused"
)
// called via reflection
private
void
test2
()
throws
Exception
{
System
.
out
.
println
(
"DEBUG: ------------> Running "
+
testMethodName
);
try
{
Field
field
=
targetClass
.
fieldByName
(
"byteArray"
);
ArrayType
arrType
=
(
ArrayType
)
field
.
type
();
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
ArrayReference
byteArrayVal
=
arrType
.
newInstance
(
3000000
);
invoke
(
"testPrimitive"
,
"([B)V"
,
byteArrayVal
);
}
}
catch
(
VMOutOfMemoryException
e
)
{
defaultHandleOOMFailure
(
e
);
}
}
/*
* Test case: Array reference as return value.
*/
@SuppressWarnings
(
"unused"
)
// called via reflection
private
void
test3
()
throws
Exception
{
System
.
out
.
println
(
"DEBUG: ------------> Running "
+
testMethodName
);
try
{
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
invoke
(
"testPrimitiveArrRetval"
,
"()[B"
,
Collections
.
EMPTY_LIST
,
vm
().
mirrorOfVoid
());
}
}
catch
(
InvocationException
e
)
{
handleFailure
(
e
);
}
}
/*
* Test case: Object reference as return value.
*/
@SuppressWarnings
(
"unused"
)
// called via reflection
private
void
test4
()
throws
Exception
{
System
.
out
.
println
(
"DEBUG: ------------> Running "
+
testMethodName
);
try
{
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
invoke
(
"testFooClsRetval"
,
"()LOomDebugTestTarget$FooCls;"
,
Collections
.
EMPTY_LIST
,
vm
().
mirrorOfVoid
());
}
}
catch
(
InvocationException
e
)
{
handleFailure
(
e
);
}
}
/*
* Test case: Constructor
*/
@SuppressWarnings
({
"unused"
,
"unchecked"
,
"rawtypes"
})
// called via reflection
private
void
test5
()
throws
Exception
{
System
.
out
.
println
(
"DEBUG: ------------> Running "
+
testMethodName
);
try
{
ClassType
type
=
(
ClassType
)
thisObject
.
type
();
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
type
.
newInstance
(
mainThread
,
findMethod
(
targetClass
,
"<init>"
,
"()V"
),
new
ArrayList
(
0
),
ObjectReference
.
INVOKE_NONVIRTUAL
);
}
}
catch
(
InvocationException
e
)
{
handleFailure
(
e
);
}
}
private
Method
getConstructorForClass
(
ClassType
clsType
)
{
List
<
Method
>
methods
=
clsType
.
methodsByName
(
"<init>"
);
if
(
methods
.
size
()
!=
1
)
{
throw
new
RuntimeException
(
"FAIL. Expected only one, the default, constructor"
);
}
return
methods
.
get
(
0
);
}
private
void
handleFailure
(
InvocationException
e
)
{
// There is no good way to see the OOME diagnostic message in the target since the
// TestScaffold might throw an exception while trying to print the stack trace. I.e
// it might get a a VMDisconnectedException before the stack trace printing finishes.
System
.
err
.
println
(
"FAILURE: InvocationException caused by OOM"
);
defaultHandleOOMFailure
(
e
);
}
private
void
defaultHandleOOMFailure
(
Exception
e
)
{
e
.
printStackTrace
();
failure
();
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
void
invoke
(
String
methodName
,
String
methodSig
,
Value
value
)
throws
Exception
{
List
args
=
new
ArrayList
(
1
);
args
.
add
(
value
);
invoke
(
methodName
,
methodSig
,
args
,
value
);
}
void
invoke
(
String
methodName
,
String
methodSig
,
@SuppressWarnings
(
"rawtypes"
)
List
args
,
Value
value
)
throws
Exception
{
Method
method
=
findMethod
(
targetClass
,
methodName
,
methodSig
);
if
(
method
==
null
)
{
failure
(
"FAILED: Can't find method: "
+
methodName
+
" for class = "
+
targetClass
);
return
;
}
invoke
(
method
,
args
,
value
);
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
void
invoke
(
Method
method
,
List
args
,
Value
value
)
throws
Exception
{
thisObject
.
invokeMethod
(
mainThread
,
method
,
args
,
0
);
System
.
out
.
println
(
"DEBUG: Done invoking method via debugger."
);
}
Value
fieldValue
(
String
fieldName
)
{
Field
field
=
targetClass
.
fieldByName
(
fieldName
);
return
thisObject
.
getValue
(
field
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
OomDebugTest
oomTest
=
new
OomDebugTest
(
args
);
oomTest
.
startTests
();
if
(
oomTest
.
failedTests
>
0
)
{
throw
new
RuntimeException
(
oomTest
.
failedTests
+
" of "
+
TOTAL_TESTS
+
" test(s) failed."
);
}
System
.
out
.
println
(
"All "
+
TOTAL_TESTS
+
" tests passed."
);
}
}
test/com/sun/jdi/oom/OomDebugTestSetup.sh
0 → 100644
浏览文件 @
d29da907
#!/bin/sh
#
# Copyright (c) 2016 Red Hat Inc.
# 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
if
[
"
${
TESTSRC
}
"
=
""
]
then
echo
"TESTSRC not set. Test cannot execute. Failed."
exit
1
fi
echo
"TESTSRC=
${
TESTSRC
}
"
if
[
"
${
TESTJAVA
}
"
=
""
]
then
echo
"TESTJAVA not set. Test cannot execute. Failed."
exit
1
fi
echo
"TESTJAVA=
${
TESTJAVA
}
"
if
[
"
${
TESTCLASSES
}
"
=
""
]
then
echo
"TESTCLASSES not set. Test cannot execute. Failed."
exit
1
fi
cp
${
TESTSRC
}
/@debuggeeVMOptions
${
TESTCLASSES
}
/
test/com/sun/tools/attach/RunnerUtil.java
浏览文件 @
d29da907
...
...
@@ -139,12 +139,19 @@ public class RunnerUtil {
String
content
=
null
;
// Read file or wait for it to be created.
long
startTime
=
System
.
currentTimeMillis
();
long
lastWarningTime
=
0
;
while
(
true
)
{
content
=
readFile
(
file
);
if
(
content
!=
null
&&
content
.
indexOf
(
"done"
)
>=
0
)
{
break
;
}
Thread
.
sleep
(
100
);
long
elapsedTime
=
(
System
.
currentTimeMillis
()
-
startTime
)
/
1000
;
if
(
elapsedTime
>
lastWarningTime
)
{
lastWarningTime
=
elapsedTime
;
System
.
out
.
println
(
"Waited "
+
elapsedTime
+
" seconds for file."
);
}
}
ProcessInfo
info
=
new
ProcessInfo
();
...
...
test/com/sun/tools/attach/TempDirTest.java
浏览文件 @
d29da907
...
...
@@ -39,13 +39,22 @@ import jdk.testlibrary.ProcessThread;
* @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
* @library /lib/testlibrary
* @run build Application Shutdown RunnerUtil
* @run main/timeout=10 TempDirTest
* @run main/timeout=200 TempDirTest
*/
/*
* This test runs with an extra long timeout since it takes a really long time with -Xcomp
* when starting many processes.cd /
*/
public
class
TempDirTest
{
private
static
long
startTime
;
public
static
void
main
(
String
args
[])
throws
Throwable
{
startTime
=
System
.
currentTimeMillis
();
Path
clientTmpDir
=
Files
.
createTempDirectory
(
"TempDirTest-client"
);
clientTmpDir
.
toFile
().
deleteOnExit
();
Path
targetTmpDir
=
Files
.
createTempDirectory
(
"TempDirTest-target"
);
...
...
@@ -76,6 +85,9 @@ public class TempDirTest {
System
.
out
.
print
(
" target: "
+
(
targetTmpDir
==
null
?
"no"
:
"yes"
));
System
.
out
.
println
(
" ###"
);
long
elapsedTime
=
(
System
.
currentTimeMillis
()
-
startTime
)
/
1000
;
System
.
out
.
println
(
"Started after "
+
elapsedTime
+
"s"
);
final
String
pidFile
=
"TempDirTest.Application.pid-"
+
counter
++;
ProcessThread
processThread
=
null
;
RunnerUtil
.
ProcessInfo
info
=
null
;
...
...
@@ -95,6 +107,10 @@ public class TempDirTest {
// Make sure the Application process is stopped.
RunnerUtil
.
stopApplication
(
info
.
shutdownPort
,
processThread
);
}
elapsedTime
=
(
System
.
currentTimeMillis
()
-
startTime
)
/
1000
;
System
.
out
.
println
(
"Completed after "
+
elapsedTime
+
"s"
);
}
/**
...
...
test/java/awt/font/MonospacedGlyphWidth/MonospacedGlyphWidthTest.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 8073400
* @summary Some Monospaced logical fonts have a different width
* @author Dmitry Markov
* @run main MonospacedGlyphWidthTest
*/
import
java.awt.*
;
import
java.awt.font.FontRenderContext
;
public
class
MonospacedGlyphWidthTest
{
private
static
final
int
START_INDEX
=
0x2018
;
private
static
final
int
END_INDEX
=
0x201F
;
public
static
void
main
(
String
[]
args
)
{
Font
font
=
new
Font
(
Font
.
MONOSPACED
,
Font
.
PLAIN
,
12
);
double
width
=
getCharWidth
(
font
,
'a'
);
for
(
int
i
=
START_INDEX
;
i
<=
END_INDEX
;
i
++)
{
if
(
width
!=
getCharWidth
(
font
,
(
char
)
i
))
{
throw
new
RuntimeException
(
"Test Failed: characters have different width!"
);
}
}
System
.
out
.
println
(
"Test Passed!"
);
}
private
static
double
getCharWidth
(
Font
font
,
char
c
)
{
FontRenderContext
fontRenderContext
=
new
FontRenderContext
(
null
,
false
,
false
);
return
font
.
getStringBounds
(
new
char
[]
{
c
},
0
,
1
,
fontRenderContext
).
getWidth
();
}
}
test/java/util/Hashtable/DeserializedLength.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2014, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.io.*
;
import
java.lang.reflect.Field
;
import
java.util.Hashtable
;
/**
* @test
* @bug 8068427
* @summary Hashtable deserialization reconstitutes table with wrong capacity
*/
public
class
DeserializedLength
{
static
boolean
testDeserializedLength
(
int
elements
,
float
loadFactor
)
throws
Exception
{
// construct Hashtable with minimal initial capacity and given loadFactor
Hashtable
<
Integer
,
Integer
>
ht1
=
new
Hashtable
<>(
1
,
loadFactor
);
// add given number of unique elements
for
(
int
i
=
0
;
i
<
elements
;
i
++)
{
ht1
.
put
(
i
,
i
);
}
// serialize and deserialize into a deep clone
Hashtable
<
Integer
,
Integer
>
ht2
=
serialClone
(
ht1
);
// compare lengths of internal tables
Object
[]
table1
=
(
Object
[])
hashtableTableField
.
get
(
ht1
);
Object
[]
table2
=
(
Object
[])
hashtableTableField
.
get
(
ht2
);
assert
table1
!=
null
;
assert
table2
!=
null
;
int
minLength
=
(
int
)
(
ht1
.
size
()
/
loadFactor
)
+
1
;
int
maxLength
=
minLength
*
2
;
boolean
ok
=
(
table2
.
length
>=
minLength
&&
table2
.
length
<=
maxLength
);
System
.
out
.
printf
(
"%7d %5.2f %7d %7d %7d...%7d %s\n"
,
ht1
.
size
(),
loadFactor
,
table1
.
length
,
table2
.
length
,
minLength
,
maxLength
,
(
ok
?
"OK"
:
"NOT-OK"
)
);
return
ok
;
}
static
<
T
>
T
serialClone
(
T
o
)
throws
IOException
,
ClassNotFoundException
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
try
(
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
bos
))
{
oos
.
writeObject
(
o
);
}
@SuppressWarnings
(
"unchecked"
)
T
clone
=
(
T
)
new
ObjectInputStream
(
new
ByteArrayInputStream
(
bos
.
toByteArray
())).
readObject
();
return
clone
;
}
private
static
final
Field
hashtableTableField
;
static
{
try
{
hashtableTableField
=
Hashtable
.
class
.
getDeclaredField
(
"table"
);
hashtableTableField
.
setAccessible
(
true
);
}
catch
(
NoSuchFieldException
e
)
{
throw
new
Error
(
e
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
ok
=
true
;
System
.
out
.
printf
(
"Results:\n"
+
" ser. deser.\n"
+
" size load lentgh length valid range ok?\n"
+
"------- ----- ------- ------- ----------------- ------\n"
);
for
(
int
elements
:
new
int
[]{
10
,
50
,
500
,
5000
})
{
for
(
float
loadFactor
:
new
float
[]{
0.15f
,
0.5f
,
0.75f
,
1.0f
,
2.5f
})
{
ok
&=
testDeserializedLength
(
elements
,
loadFactor
);
}
}
if
(!
ok
)
{
throw
new
AssertionError
(
"Test failed."
);
}
}
}
test/java/util/concurrent/ConcurrentLinkedQueue/RemoveLeak.java
0 → 100644
浏览文件 @
d29da907
/*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file:
*
* Written by Martin Buchholz with assistance from members of JCP
* JSR-166 Expert Group and released to the public domain, as
* explained at http://creativecommons.org/publicdomain/zero/1.0/
*/
/*
* @test
* @bug 8054446 8137184 8137185
* @summary Regression test for memory leak in remove(Object)
* @run main/othervm -Xmx2200k RemoveLeak
*/
import
java.util.concurrent.ConcurrentLinkedQueue
;
public
class
RemoveLeak
{
public
static
void
main
(
String
[]
args
)
{
int
i
=
0
;
// Without bug fix, OutOfMemoryError was observed at iteration 65120
int
iterations
=
10
*
65120
;
try
{
ConcurrentLinkedQueue
<
Long
>
queue
=
new
ConcurrentLinkedQueue
<>();
queue
.
add
(
0L
);
while
(
i
++
<
iterations
)
{
queue
.
add
(
1L
);
queue
.
remove
(
1L
);
}
}
catch
(
Error
t
)
{
System
.
err
.
printf
(
"failed at iteration %d/%d%n"
,
i
,
iterations
);
throw
t
;
}
}
}
test/javax/xml/bind/marshal/8134111/UnmarshalTest.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8134111
* @summary test that elements without namespace is ignored by unmarshaller
* when elementFormDefault is set to QUALIFIED.
* @compile testTypes/package-info.java testTypes/Root.java
* testTypes/WhenType.java testTypes/ObjectFactory.java
* @run testng/othervm UnmarshalTest
*/
import
java.io.StringReader
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.Unmarshaller
;
import
org.testng.annotations.Test
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
org.xml.sax.InputSource
;
import
testTypes.Root
;
public
class
UnmarshalTest
{
@Test
public
void
unmarshalUnexpectedNsTest
()
throws
Exception
{
JAXBContext
context
;
Unmarshaller
unm
;
// Create JAXB context from testTypes package
context
=
JAXBContext
.
newInstance
(
"testTypes"
);
// Create unmarshaller from JAXB context
unm
=
context
.
createUnmarshaller
();
// Unmarshall xml document with unqualified dtime element
Root
r
=
(
Root
)
unm
.
unmarshal
(
new
InputSource
(
new
StringReader
(
DOC
)));
// Print dtime value and check if it is null
System
.
out
.
println
(
"dtime is:"
+
r
.
getWhen
().
getDtime
());
assertNull
(
r
.
getWhen
().
getDtime
());
}
//Xml document to unmarshall with unqualified dtime element
private
final
String
DOC
=
"<tns:root xmlns:tns=\"http://www.example.org/testNamespace/\">"
+
"<tns:when>"
+
"<dtime>2015-06-24T13:16:14.933-04:00</dtime>"
+
"</tns:when>"
+
"</tns:root>"
;
}
test/javax/xml/bind/marshal/8134111/testTypes/ObjectFactory.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
testTypes
;
import
javax.xml.bind.annotation.XmlRegistry
;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the testTypes package.
*
*/
@XmlRegistry
public
class
ObjectFactory
{
/**
* Create a new ObjectFactory that can be used to create
* new instances of schema derived classes for package: testTypes
*
*/
public
ObjectFactory
()
{
}
/**
* Create an instance of {@link Root }
*
*/
public
Root
createRoot
()
{
return
new
Root
();
}
/**
* Create an instance of {@link WhenType }
*
*/
public
WhenType
createWhenType
()
{
return
new
WhenType
();
}
}
test/javax/xml/bind/marshal/8134111/testTypes/Root.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
testTypes
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlType
;
/**
* <p>Java class for anonymous complex type.
*
*/
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlType
(
name
=
""
,
propOrder
=
{
"when"
})
@XmlRootElement
(
name
=
"root"
,
namespace
=
"http://www.example.org/testNamespace/"
)
public
class
Root
{
@XmlElement
(
required
=
true
,
namespace
=
"http://www.example.org/testNamespace/"
)
protected
WhenType
when
;
/**
* Gets the value of the when property.
*
* @return
* possible object is
* {@link WhenType }
*
*/
public
WhenType
getWhen
()
{
return
when
;
}
/**
* Sets the value of the when property.
*
* @param value
* allowed object is
* {@link WhenType }
*
*/
public
void
setWhen
(
WhenType
value
)
{
this
.
when
=
value
;
}
}
test/javax/xml/bind/marshal/8134111/testTypes/WhenType.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
testTypes
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlSchemaType
;
import
javax.xml.bind.annotation.XmlType
;
import
javax.xml.datatype.XMLGregorianCalendar
;
/**
* <p>Java class for WhenType complex type.
*
*/
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlType
(
name
=
"WhenType"
,
propOrder
=
{
"dtime"
})
public
class
WhenType
{
@XmlElement
(
required
=
true
)
@XmlSchemaType
(
name
=
"dateTime"
)
protected
XMLGregorianCalendar
dtime
;
/**
* Gets the value of the dtime property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public
XMLGregorianCalendar
getDtime
()
{
return
dtime
;
}
/**
* Sets the value of the dtime property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public
void
setDtime
(
XMLGregorianCalendar
value
)
{
this
.
dtime
=
value
;
}
}
test/javax/xml/bind/marshal/8134111/testTypes/package-info.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
@javax
.
xml
.
bind
.
annotation
.
XmlSchema
(
namespace
=
"http://www.example.org/testNamespace/"
,
elementFormDefault
=
javax
.
xml
.
bind
.
annotation
.
XmlNsForm
.
QUALIFIED
)
package
testTypes
;
test/sun/security/mscapi/CastError.java
0 → 100644
浏览文件 @
d29da907
/*
* Copyright (c) 2015 Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.security.KeyStore
;
import
java.security.PrivateKey
;
import
java.security.cert.Certificate
;
/**
* @test
* @bug 8143913
* @requires os.family == "windows"
* @summary MSCAPI keystore should accept Certificate[] in setEntry()
*/
public
class
CastError
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
KeyStore
ks
=
KeyStore
.
getInstance
(
"JKS"
);
FileInputStream
fis
=
new
FileInputStream
(
new
File
(
System
.
getProperty
(
"test.src"
),
"../tools/jarsigner/JarSigning.keystore"
));
ks
.
load
(
fis
,
"bbbbbb"
.
toCharArray
());
PrivateKey
pk
=
(
PrivateKey
)
ks
.
getKey
(
"c"
,
"bbbbbb"
.
toCharArray
());
Certificate
cert
=
ks
.
getCertificate
(
"c"
);
ks
=
KeyStore
.
getInstance
(
"Windows-MY"
);
ks
.
load
(
null
,
null
);
ks
.
setKeyEntry
(
"8143913"
,
pk
,
null
,
new
Certificate
[]{
cert
});
ks
.
deleteEntry
(
"8143913"
);
}
}
test/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.sh
0 → 100644
浏览文件 @
d29da907
#!/bin/sh
#
# Copyright (c) 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @ignore Uses certutil.exe that isn't guaranteed to be installed
# @bug 6483657
# @requires os.family == "windows"
# @run shell NonUniqueAliases.sh
# @summary Test "keytool -list" displays correcly same named certificates
# set a few environment variables so that the shell-script can run stand-alone
# in the source directory
if
[
"
${
TESTSRC
}
"
=
""
]
;
then
TESTSRC
=
"."
fi
if
[
"
${
TESTCLASSES
}
"
=
""
]
;
then
TESTCLASSES
=
"."
fi
if
[
"
${
TESTJAVA
}
"
=
""
]
;
then
echo
"TESTJAVA not set. Test cannot execute."
echo
"FAILED!!!"
exit
1
fi
OS
=
`
uname
-s
`
case
"
$OS
"
in
Windows
*
|
CYGWIN
*
)
# 'uname -m' does not give us enough information -
# should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk),
# but JTREG does not pass this env variable when executing a shell script.
#
# execute test program - rely on it to exit if platform unsupported
echo
"removing the alias NonUniqueName if it already exists"
certutil
-user
-delstore
MY NonUniqueName
echo
"Importing 1st certificate into MY keystore using certutil tool"
certutil
-user
-addstore
MY
${
TESTSRC
}
/nonUniq1.pem
echo
"Importing 2nd certificate into MY keystore using certutil tool"
certutil
-user
-addstore
MY
${
TESTSRC
}
/nonUniq2.pem
echo
"Listing certificates with keytool"
${
TESTJAVA
}
/bin/keytool
${
TESTTOOLVMOPTS
}
-list
-storetype
Windows-My
echo
"Counting expected entries"
count0
=
`
${
TESTJAVA
}
/bin/keytool
${
TESTTOOLVMOPTS
}
-list
-storetype
Windows-My |
grep
'NonUniqueName,'
|
wc
-l
`
if
[
!
$count0
=
1
]
;
then
echo
"error: unexpected number of entries (
$count0
) in the Windows-MY store"
certutil
-user
-delstore
MY NonUniqueName
exit
115
fi
echo
"Counting expected entries"
count1
=
`
${
TESTJAVA
}
/bin/keytool
${
TESTTOOLVMOPTS
}
-list
-storetype
Windows-My |
grep
'NonUniqueName (1),'
|
wc
-l
`
if
[
!
$count1
=
1
]
;
then
echo
"error: unexpected number of entries (
$count1
) in the Windows-MY store"
certutil
-user
-delstore
MY NonUniqueName
exit
116
fi
echo
"Cleaning up"
certutil
-user
-delstore
MY NonUniqueName
exit
0
;;
*
)
echo
"This test is not intended for '
$OS
' - passing test"
exit
0
;;
esac
test/sun/security/mscapi/nonUniqueAliases/nonUniq1.pem
0 → 100644
浏览文件 @
d29da907
-----BEGIN CERTIFICATE-----
MIIB/jCCAWegAwIBAgIJANy5XBGM4BSuMA0GCSqGSIb3DQEBCwUAMBgxFjAUBgNV
BAMMDU5vblVuaXF1ZU5hbWUwHhcNMTYwNDAxMTcyMjQ0WhcNMTYwNzEwMTcyMjQ0
WjAYMRYwFAYDVQQDDA1Ob25VbmlxdWVOYW1lMIGfMA0GCSqGSIb3DQEBAQUAA4GN
ADCBiQKBgQDI0hlED2YFVgTaVLKWvsqB9JN9EJpUWECkB97fJwb1x99dHf0TO2p6
HPPvkvjBiAMEZYbojCz+WpNhG1Ilu/UgKwPyHh1pL6kRcEhlS2G3i7p9SDLHWlk0
xfdhSZERgd6ROpDnY7eaj1CTdVCSyEATs4FFyNtN9Q39jyeCU++ksQIDAQABo1Aw
TjAdBgNVHQ4EFgQUpW/Wtw/OOTdnFTL7afIkNjuCVr8wHwYDVR0jBBgwFoAUpW/W
tw/OOTdnFTL7afIkNjuCVr8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOB
gQAWC+xX1cGNNp3F6dAb5tKKJGgQwsjfrjDP0/AirWc7Im1kTCpVPT61Ayt0bHgH
n3hGivKmO7ChQAI3QsDMDKWE98tF6afPltBOoWh2a9tPd65JSD1HfkG+Wc1IZ5gL
8rKp1tdKTEG2A+qXRN/e6DdtMsgDrK1iPfX+rer53TC+Yg==
-----END CERTIFICATE-----
test/sun/security/mscapi/nonUniqueAliases/nonUniq2.pem
0 → 100644
浏览文件 @
d29da907
-----BEGIN CERTIFICATE-----
MIIB/jCCAWegAwIBAgIJAPyQune5t/SZMA0GCSqGSIb3DQEBCwUAMBgxFjAUBgNV
BAMMDU5vblVuaXF1ZU5hbWUwHhcNMTYwNDAxMTcyMzI0WhcNMTYwNzEwMTcyMzI0
WjAYMRYwFAYDVQQDDA1Ob25VbmlxdWVOYW1lMIGfMA0GCSqGSIb3DQEBAQUAA4GN
ADCBiQKBgQDeSu/pPzL9hA1kjA2Rs13LpN2lNrisbYg/Vj/swGDMJnVCzS3IFQQy
71515mru+ngrHnfPSo4FKUhZPJzET2D7CruR65SzhQ96SHGoR8rhmL41KRBKELuR
3MoarLFziFzeIil4NZg55xp6TE/WCXRfi7HNdIgoKQGLoIhehVGN8QIDAQABo1Aw
TjAdBgNVHQ4EFgQUxFw79pLSf5Ul3zLqi/Mc6pSxEtswHwYDVR0jBBgwFoAUxFw7
9pLSf5Ul3zLqi/Mc6pSxEtswDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOB
gQDPilBcFpFrjwqb+lJxDxXK992KjNUS8yFLo1DQ/LBTaoHvy/U5zxzRq+nvSaaf
h+RIKqTwIbuBhSjrXVdJ/gzob/UlPC7IDo7FVbZwOHqTkqEum8jQEpX67hEevw9s
+reyqGhLsCtQK6uBTd2Nt9uOVCHrWNzWgQewkVYAUM5QpA==
-----END CERTIFICATE-----
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录