Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
82d12eca
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82d12eca
编写于
7月 07, 2011
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
36e719a1
9d2d3c79
变更
66
展开全部
隐藏空白更改
内联
并排
Showing
66 changed file
with
2457 addition
and
1380 deletion
+2457
-1380
make/common/Defs-embedded.gmk
make/common/Defs-embedded.gmk
+5
-0
make/common/shared/Defs.gmk
make/common/shared/Defs.gmk
+2
-2
make/docs/Makefile
make/docs/Makefile
+3
-0
make/java/nio/Makefile
make/java/nio/Makefile
+23
-6
src/share/classes/java/lang/Byte.java
src/share/classes/java/lang/Byte.java
+16
-11
src/share/classes/java/lang/Double.java
src/share/classes/java/lang/Double.java
+17
-13
src/share/classes/java/lang/Float.java
src/share/classes/java/lang/Float.java
+17
-12
src/share/classes/java/lang/Integer.java
src/share/classes/java/lang/Integer.java
+16
-11
src/share/classes/java/lang/Long.java
src/share/classes/java/lang/Long.java
+16
-11
src/share/classes/java/lang/Number.java
src/share/classes/java/lang/Number.java
+46
-34
src/share/classes/java/lang/Short.java
src/share/classes/java/lang/Short.java
+16
-11
src/share/classes/java/lang/annotation/IncompleteAnnotationException.java
...s/java/lang/annotation/IncompleteAnnotationException.java
+6
-4
src/share/classes/java/lang/reflect/GenericSignatureFormatError.java
...lasses/java/lang/reflect/GenericSignatureFormatError.java
+19
-1
src/share/classes/java/rmi/server/UID.java
src/share/classes/java/rmi/server/UID.java
+6
-4
src/share/classes/java/util/Random.java
src/share/classes/java/util/Random.java
+7
-1
src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
...re/classes/java/util/concurrent/atomic/AtomicInteger.java
+19
-0
src/share/classes/java/util/concurrent/atomic/AtomicLong.java
...share/classes/java/util/concurrent/atomic/AtomicLong.java
+19
-0
src/share/classes/java/util/logging/Logger.java
src/share/classes/java/util/logging/Logger.java
+25
-10
src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java
...ty/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java
+1
-1
src/share/classes/javax/security/auth/kerberos/KeyTab.java
src/share/classes/javax/security/auth/kerberos/KeyTab.java
+3
-3
src/share/classes/sun/launcher/resources/launcher.properties
src/share/classes/sun/launcher/resources/launcher.properties
+1
-1
src/share/classes/sun/misc/SharedSecrets.java
src/share/classes/sun/misc/SharedSecrets.java
+0
-14
src/share/classes/sun/security/jgss/krb5/Krb5Util.java
src/share/classes/sun/security/jgss/krb5/Krb5Util.java
+2
-2
src/share/classes/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java
...es/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java
+1
-1
src/share/classes/sun/security/krb5/KerberosSecrets.java
src/share/classes/sun/security/krb5/KerberosSecrets.java
+46
-0
src/share/classes/sun/security/tools/KeyTool.java
src/share/classes/sun/security/tools/KeyTool.java
+2
-6
src/share/classes/sun/security/x509/DistributionPoint.java
src/share/classes/sun/security/x509/DistributionPoint.java
+4
-11
src/share/classes/sun/security/x509/DistributionPointName.java
...hare/classes/sun/security/x509/DistributionPointName.java
+3
-10
src/windows/classes/sun/security/krb5/internal/tools/Klist.java
...ndows/classes/sun/security/krb5/internal/tools/Klist.java
+9
-6
test/Makefile
test/Makefile
+6
-2
test/ProblemList.txt
test/ProblemList.txt
+0
-72
test/com/sun/crypto/provider/Cipher/DES/Sealtest.java
test/com/sun/crypto/provider/Cipher/DES/Sealtest.java
+10
-8
test/com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java
test/com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java
+56
-54
test/com/sun/jndi/ldap/ReadTimeoutTest.java
test/com/sun/jndi/ldap/ReadTimeoutTest.java
+47
-38
test/com/sun/net/httpserver/bugs/B6373555.java
test/com/sun/net/httpserver/bugs/B6373555.java
+1
-21
test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
+1
-1
test/java/lang/Thread/ThreadStateTest.java
test/java/lang/Thread/ThreadStateTest.java
+57
-101
test/java/lang/annotation/TestIncompleteAnnotationExceptionNPE.java
...lang/annotation/TestIncompleteAnnotationExceptionNPE.java
+64
-0
test/java/lang/management/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java
...t/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java
+1
-1
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
+584
-564
test/java/security/BasicPermission/PermClass.java
test/java/security/BasicPermission/PermClass.java
+46
-39
test/java/security/BasicPermission/SerialVersion.java
test/java/security/BasicPermission/SerialVersion.java
+26
-22
test/java/security/KeyFactory/Failover.java
test/java/security/KeyFactory/Failover.java
+12
-2
test/java/security/KeyPairGenerator/Failover.java
test/java/security/KeyPairGenerator/Failover.java
+12
-2
test/java/security/Provider/ChangeProviders.java
test/java/security/Provider/ChangeProviders.java
+12
-2
test/java/security/Provider/GetInstance.java
test/java/security/Provider/GetInstance.java
+12
-2
test/java/security/Provider/RemoveProvider.java
test/java/security/Provider/RemoveProvider.java
+12
-2
test/java/security/Provider/Turkish.java
test/java/security/Provider/Turkish.java
+49
-45
test/java/security/SecureClassLoader/DefineClassByteBuffer.java
...ava/security/SecureClassLoader/DefineClassByteBuffer.java
+30
-7
test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
+5
-1
test/java/security/Security/NoInstalledProviders.java
test/java/security/Security/NoInstalledProviders.java
+12
-2
test/java/security/Security/SynchronizedAccess.java
test/java/security/Security/SynchronizedAccess.java
+13
-3
test/java/security/Security/removing/RemoveProviders.java
test/java/security/Security/removing/RemoveProviders.java
+12
-2
test/java/security/UnresolvedPermission/Equals.java
test/java/security/UnresolvedPermission/Equals.java
+2
-1
test/java/security/spec/EllipticCurveMatch.java
test/java/security/spec/EllipticCurveMatch.java
+2
-3
test/java/security/testlibrary/ProvidersSnapshot.java
test/java/security/testlibrary/ProvidersSnapshot.java
+48
-0
test/java/util/logging/LoggerResourceBundleRace.java
test/java/util/logging/LoggerResourceBundleRace.java
+203
-0
test/java/util/logging/LoggingDeadlock3.java
test/java/util/logging/LoggingDeadlock3.java
+1
-1
test/java/util/logging/RacingThreadsTest.java
test/java/util/logging/RacingThreadsTest.java
+687
-0
test/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java
...x/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java
+13
-3
test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java
test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java
+13
-3
test/sun/security/krb5/tools/ktmissing.sh
test/sun/security/krb5/tools/ktmissing.sh
+51
-0
test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
+2
-2
test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java
...m/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java
+0
-183
test/tools/launcher/ExecutionEnvironment.java
test/tools/launcher/ExecutionEnvironment.java
+4
-4
test/tools/launcher/VersionCheck.java
test/tools/launcher/VersionCheck.java
+1
-1
未找到文件。
make/common/Defs-embedded.gmk
浏览文件 @
82d12eca
...
...
@@ -60,5 +60,10 @@ ifeq ($(PLATFORM), linux)
endif
endif
# NIO Platform specific source file location
ifdef CROSS_COMPILE_ARCH
NIO_PLATFORM_CLASSES_ROOT_DIR = $(CLOSED_PLATFORM_SRC)/classes/
endif
endif # JAVASE_EMBEDDED
make/common/shared/Defs.gmk
浏览文件 @
82d12eca
...
...
@@ -195,8 +195,8 @@ ifndef JDK_MAJOR_VERSION
endif
ifndef JDK_MINOR_VERSION
JDK_MINOR_VERSION =
7
PREVIOUS_MINOR_VERSION =
6
JDK_MINOR_VERSION =
8
PREVIOUS_MINOR_VERSION =
7
endif
ifndef JDK_MICRO_VERSION
...
...
make/docs/Makefile
浏览文件 @
82d12eca
...
...
@@ -223,6 +223,9 @@ endif
ifeq
($(JDK_MINOR_VERSION),6)
JDK_IS_FCS
=
true
endif
ifeq
($(JDK_MINOR_VERSION),7)
JDK_IS_FCS
=
true
endif
ifeq
($(JDK_IS_FCS),false)
ifneq
($(MILESTONE), fcs)
DRAFT_HEADER
=
<br><strong>DRAFT 
;
$(MILESTONE)
-
$(BUILD_NUMBER)
</strong>
...
...
make/java/nio/Makefile
浏览文件 @
82d12eca
...
...
@@ -255,7 +255,7 @@ FILES_export += \
sun/nio/fs/LinuxWatchService.java
\
sun/nio/fs/UnixCopyFile.java
\
sun/nio/fs/UnixNativeDispatcher.java
FILES_gen
+=
\
sun/nio/fs/UnixConstants.java
endif
# PLATFORM = linux
...
...
@@ -771,7 +771,7 @@ $(CS_GEN)/CharsetEncoder.java: $(CHARSET_X_CODER_TEMPLATE) $(GEN_CODER_SH)
#
GEN_EX_SH
=
genExceptions.sh
GEN_EX_CMD
=
NAWK
=
"
$(NAWK)
"
SH
=
"
$(SH)
"
$(SH)
$(GEN_EX_SH)
$(CH_GEN)/%Exception.java
:
genExceptions.sh $(CH_SRC)/exceptions
...
...
@@ -820,14 +820,19 @@ $(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC)
$(GENSOR_EXE)
:
$(TEMPDIR)/$(GENSOR_SRC)
$
(
prep-target
)
(
$(CD)
$(TEMPDIR)
;
$(
HOST_
CC)
$(CPPFLAGS)
$(LDDFLAGS)
\
(
$(CD)
$(TEMPDIR)
;
$(CC)
$(CPPFLAGS)
$(LDDFLAGS)
\
-o
genSocketOptionRegistry
$(EXE_SUFFIX)
$(GENSOR_SRC)
)
ifdef
NIO_PLATFORM_CLASSES_ROOT_DIR
$(SCH_GEN)/SocketOptionRegistry.java
:
$(NIO_PLATFORM_CLASSES_ROOT_DIR)/sun/nio/ch/SocketOptionRegistry-$(PLATFORM)-$(ARCH).java
$
(
prep-target
)
$(CP)
$<
$@
else
$(SCH_GEN)/SocketOptionRegistry.java
:
$(GENSOR_EXE)
$
(
prep-target
)
NAWK
=
"
$(NAWK)
"
SH
=
"
$(SH)
"
$(SH)
-e
addNotices.sh
"
$(SOR_COPYRIGHT_YEARS)
"
>
$@
$(GENSOR_EXE)
>>
$@
endif
#
# Generated sun.nio.cs SingleByte classes
#
...
...
@@ -851,12 +856,18 @@ GENUC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENUC_SRC) | \
$(GENUC_EXE)
:
$(GENUC_SRC)
$
(
prep-target
)
$(
HOST_
CC)
$(CPPFLAGS)
-o
$@
$(GENUC_SRC)
$(CC)
$(CPPFLAGS)
-o
$@
$(GENUC_SRC)
ifdef
NIO_PLATFORM_CLASSES_ROOT_DIR
$(SFS_GEN)/UnixConstants.java
:
$(NIO_PLATFORM_CLASSES_ROOT_DIR)/sun/nio/fs/UnixConstants-$(PLATFORM)-$(ARCH).java
$
(
prep-target
)
$(CP)
$<
$@
else
$(SFS_GEN)/UnixConstants.java
:
$(GENUC_EXE)
$
(
prep-target
)
NAWK
=
"
$(NAWK)
"
SH
=
"
$(SH)
"
$(SH)
-e
addNotices.sh
"
$(GENUC_COPYRIGHT_YEARS)
"
>
$@
$(GENUC_EXE)
>>
$@
endif
GENSC_SRC
=
$(PLATFORM_SRC)
/native/sun/nio/fs/genSolarisConstants.c
...
...
@@ -867,11 +878,17 @@ GENSC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSC_SRC) | \
$(GENSC_EXE)
:
$(GENSC_SRC)
$
(
prep-target
)
$(
HOST_
CC)
$(CPPFLAGS)
-o
$@
$(GENSC_SRC)
$(CC)
$(CPPFLAGS)
-o
$@
$(GENSC_SRC)
ifdef
NIO_PLATFORM_CLASSES_ROOT_DIR
$(SFS_GEN)/SolarisConstants.java
:
$(NIO_PLATFORM_CLASSES_ROOT_DIR)/sun/nio/fs/SolarisConstants-$(PLATFORM)-$(ARCH).java
$
(
prep-target
)
$(CP)
$<
$@
else
$(SFS_GEN)/SolarisConstants.java
:
$(GENSC_EXE)
$
(
prep-target
)
NAWK
=
"
$(NAWK)
"
SH
=
"
$(SH)
"
$(SH)
-e
addNotices.sh
"
$(GENSC_COPYRIGHT_YEARS)
"
>
$@
$(GENSC_EXE)
>>
$@
endif
.PHONY
:
sources
src/share/classes/java/lang/Byte.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1996, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
11
, 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
...
...
@@ -324,40 +324,45 @@ public final class Byte extends Number implements Comparable<Byte> {
}
/**
* Returns the value of this {@code Byte} as a
* {@code short}.
* Returns the value of this {@code Byte} as a {@code short} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
short
shortValue
()
{
return
(
short
)
value
;
}
/**
* Returns the value of this {@code Byte} as an
* {@code int}.
* Returns the value of this {@code Byte} as an {@code int} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
int
intValue
()
{
return
(
int
)
value
;
}
/**
* Returns the value of this {@code Byte} as a
* {@code long}.
* Returns the value of this {@code Byte} as a {@code long} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
long
longValue
()
{
return
(
long
)
value
;
}
/**
* Returns the value of this {@code Byte} as a
* {@code float}.
* Returns the value of this {@code Byte} as a {@code float} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
float
floatValue
()
{
return
(
float
)
value
;
}
/**
* Returns the value of this {@code Byte} as a
* {@code double}.
* Returns the value of this {@code Byte} as a {@code double}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
value
;
...
...
src/share/classes/java/lang/Double.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1994, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
1
, 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
...
...
@@ -634,11 +634,12 @@ public final class Double extends Number implements Comparable<Double> {
}
/**
* Returns the value of this {@code Double} as a {@code byte}
(by
*
casting to a {@code byte})
.
* Returns the value of this {@code Double} as a {@code byte}
*
after a narrowing primitive conversion
.
*
* @return the {@code double} value represented by this object
* converted to type {@code byte}
* @jls 5.1.3 Narrowing Primitive Conversions
* @since JDK1.1
*/
public
byte
byteValue
()
{
...
...
@@ -646,11 +647,12 @@ public final class Double extends Number implements Comparable<Double> {
}
/**
* Returns the value of this {@code Double} as a
*
{@code short} (by casting to a {@code short})
.
* Returns the value of this {@code Double} as a
{@code short}
*
after a narrowing primitive conversion
.
*
* @return the {@code double} value represented by this object
* converted to type {@code short}
* @jls 5.1.3 Narrowing Primitive Conversions
* @since JDK1.1
*/
public
short
shortValue
()
{
...
...
@@ -658,8 +660,9 @@ public final class Double extends Number implements Comparable<Double> {
}
/**
* Returns the value of this {@code Double} as an
* {@code int} (by casting to type {@code int}).
* Returns the value of this {@code Double} as an {@code int}
* after a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*
* @return the {@code double} value represented by this object
* converted to type {@code int}
...
...
@@ -669,22 +672,24 @@ public final class Double extends Number implements Comparable<Double> {
}
/**
* Returns the value of this {@code Double} as a
*
{@code long} (by casting to type {@code long})
.
* Returns the value of this {@code Double} as a
{@code long}
*
after a narrowing primitive conversion
.
*
* @return the {@code double} value represented by this object
* converted to type {@code long}
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
long
longValue
()
{
return
(
long
)
value
;
}
/**
* Returns the
{@code float} value of this
*
{@code Double} object
.
* Returns the
value of this {@code Double} as a {@code float}
*
after a narrowing primitive conversion
.
*
* @return the {@code double} value represented by this object
* converted to type {@code float}
* @jls 5.1.3 Narrowing Primitive Conversions
* @since JDK1.0
*/
public
float
floatValue
()
{
...
...
@@ -692,8 +697,7 @@ public final class Double extends Number implements Comparable<Double> {
}
/**
* Returns the {@code double} value of this
* {@code Double} object.
* Returns the {@code double} value of this {@code Double} object.
*
* @return the {@code double} value represented by this object
*/
...
...
src/share/classes/java/lang/Float.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1994, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
1
, 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
...
...
@@ -556,22 +556,24 @@ public final class Float extends Number implements Comparable<Float> {
}
/**
* Returns the value of this {@code Float} as a {@code byte}
(by
*
casting to a {@code byte})
.
* Returns the value of this {@code Float} as a {@code byte}
after
*
a narrowing primitive conversion
.
*
* @return the {@code float} value represented by this object
* converted to type {@code byte}
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
byte
byteValue
()
{
return
(
byte
)
value
;
}
/**
* Returns the value of this {@code Float} as a {@code short}
(by
*
casting to a {@code short})
.
* Returns the value of this {@code Float} as a {@code short}
*
after a narrowing primitive conversion
.
*
* @return the {@code float} value represented by this object
* converted to type {@code short}
* @jls 5.1.3 Narrowing Primitive Conversions
* @since JDK1.1
*/
public
short
shortValue
()
{
...
...
@@ -579,22 +581,24 @@ public final class Float extends Number implements Comparable<Float> {
}
/**
* Returns the value of this {@code Float} as an {@code int}
(by
*
casting to type {@code int})
.
* Returns the value of this {@code Float} as an {@code int}
after
*
a narrowing primitive conversion
.
*
* @return the {@code float} value represented by this object
* converted to type {@code int}
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
int
intValue
()
{
return
(
int
)
value
;
}
/**
* Returns value of this {@code Float} as a {@code long}
(by
*
casting to type {@code long})
.
* Returns value of this {@code Float} as a {@code long}
after a
*
narrowing primitive conversion
.
*
* @return the {@code float} value represented by this object
* converted to type {@code long}
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
long
longValue
()
{
return
(
long
)
value
;
...
...
@@ -610,11 +614,12 @@ public final class Float extends Number implements Comparable<Float> {
}
/**
* Returns the {@code double} value of this {@code Float} object.
* Returns the value of this {@code Float} as a {@code double}
* after a widening primitive conversion.
*
* @return the {@code float} value represented by this
* object
is converted to type {@code double} and the
*
result of the conversion is returned.
* object
converted to type {@code double}
*
@jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
value
;
...
...
src/share/classes/java/lang/Integer.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1994, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
1
, 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
...
...
@@ -678,16 +678,18 @@ public final class Integer extends Number implements Comparable<Integer> {
}
/**
* Returns the value of this {@code Integer} as a
* {@code byte}.
* Returns the value of this {@code Integer} as a {@code byte}
* after a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
byte
byteValue
()
{
return
(
byte
)
value
;
}
/**
* Returns the value of this {@code Integer} as a
* {@code short}.
* Returns the value of this {@code Integer} as a {@code short}
* after a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
short
shortValue
()
{
return
(
short
)
value
;
...
...
@@ -702,24 +704,27 @@ public final class Integer extends Number implements Comparable<Integer> {
}
/**
* Returns the value of this {@code Integer} as a
* {@code long}.
* Returns the value of this {@code Integer} as a {@code long}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
long
longValue
()
{
return
(
long
)
value
;
}
/**
* Returns the value of this {@code Integer} as a
* {@code float}.
* Returns the value of this {@code Integer} as a {@code float}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
float
floatValue
()
{
return
(
float
)
value
;
}
/**
* Returns the value of this {@code Integer} as a
* {@code double}.
* Returns the value of this {@code Integer} as a {@code double}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
value
;
...
...
src/share/classes/java/lang/Long.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1994, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 20
11
, 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
...
...
@@ -703,24 +703,27 @@ public final class Long extends Number implements Comparable<Long> {
}
/**
* Returns the value of this {@code Long} as a
* {@code byte}.
* Returns the value of this {@code Long} as a {@code byte} after
* a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
byte
byteValue
()
{
return
(
byte
)
value
;
}
/**
* Returns the value of this {@code Long} as a
* {@code short}.
* Returns the value of this {@code Long} as a {@code short} after
* a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
short
shortValue
()
{
return
(
short
)
value
;
}
/**
* Returns the value of this {@code Long} as an
* {@code int}.
* Returns the value of this {@code Long} as an {@code int} after
* a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
int
intValue
()
{
return
(
int
)
value
;
...
...
@@ -735,16 +738,18 @@ public final class Long extends Number implements Comparable<Long> {
}
/**
* Returns the value of this {@code Long} as a
* {@code float}.
* Returns the value of this {@code Long} as a {@code float} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
float
floatValue
()
{
return
(
float
)
value
;
}
/**
* Returns the value of this {@code Long} as a
* {@code double}.
* Returns the value of this {@code Long} as a {@code double}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
value
;
...
...
src/share/classes/java/lang/Number.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1994, 20
0
1, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 20
1
1, 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
...
...
@@ -26,69 +26,78 @@
package
java.lang
;
/**
* The abstract class <code>Number</code> is the superclass of classes
* <code>BigDecimal</code>, <code>BigInteger</code>,
* <code>Byte</code>, <code>Double</code>, <code>Float</code>,
* <code>Integer</code>, <code>Long</code>, and <code>Short</code>.
* <p>
* Subclasses of <code>Number</code> must provide methods to convert
* the represented numeric value to <code>byte</code>, <code>double</code>,
* <code>float</code>, <code>int</code>, <code>long</code>, and
* <code>short</code>.
* The abstract class {@code Number} is the superclass of platform
* classes representing numeric values that are convertible to the
* primitive types {@code byte}, {@code double}, {@code float}, {@code
* int}, {@code long}, and {@code short}.
*
* The specific semantics of the conversion from the numeric value of
* a particular {@code Number} implementation to a given primitive
* type is defined by the {@code Number} implementation in question.
*
* For platform classes, the conversion is often analogous to a
* narrowing primitive conversion or a widening primitive conversion
* as defining in <cite>The Java™ Language Specification</cite>
* for converting between primitive types. Therefore, conversions may
* lose information about the overall magnitude of a numeric value, may
* lose precision, and may even return a result of a different sign
* than the input.
*
* See the documentation of a given {@code Number} implementation for
* conversion details.
*
* @author Lee Boynton
* @author Arthur van Hoff
* @see java.lang.Byte
* @see java.lang.Double
* @see java.lang.Float
* @see java.lang.Integer
* @see java.lang.Long
* @see java.lang.Short
* @jls 5.1.2 Widening Primitive Conversions
* @jls 5.1.3 Narrowing Primitive Conversions
* @since JDK1.0
*/
public
abstract
class
Number
implements
java
.
io
.
Serializable
{
/**
* Returns the value of the specified number as an
<code>int</code>.
*
This
may involve rounding or truncation.
* Returns the value of the specified number as an
{@code int},
*
which
may involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion
* to type
<code>int</code>
.
* to type
{@code int}
.
*/
public
abstract
int
intValue
();
/**
* Returns the value of the specified number as a
<code>long</code>.
*
This
may involve rounding or truncation.
* Returns the value of the specified number as a
{@code long},
*
which
may involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion
* to type
<code>long</code>
.
* to type
{@code long}
.
*/
public
abstract
long
longValue
();
/**
* Returns the value of the specified number as a
<code>float</code>.
*
This
may involve rounding.
* Returns the value of the specified number as a
{@code float},
*
which
may involve rounding.
*
* @return the numeric value represented by this object after conversion
* to type
<code>float</code>
.
* to type
{@code float}
.
*/
public
abstract
float
floatValue
();
/**
* Returns the value of the specified number as a
<code>double</code>.
*
This
may involve rounding.
* Returns the value of the specified number as a
{@code double},
*
which
may involve rounding.
*
* @return the numeric value represented by this object after conversion
* to type
<code>double</code>
.
* to type
{@code double}
.
*/
public
abstract
double
doubleValue
();
/**
* Returns the value of the specified number as a <code>byte</code>.
* This may involve rounding or truncation.
* Returns the value of the specified number as a {@code byte},
* which may involve rounding or truncation.
*
* <p>This implementation returns the result of {@link #intValue} cast
* to a {@code byte}.
*
* @return the numeric value represented by this object after conversion
* to type
<code>byte</code>
.
* to type
{@code byte}
.
* @since JDK1.1
*/
public
byte
byteValue
()
{
...
...
@@ -96,11 +105,14 @@ public abstract class Number implements java.io.Serializable {
}
/**
* Returns the value of the specified number as a <code>short</code>.
* This may involve rounding or truncation.
* Returns the value of the specified number as a {@code short},
* which may involve rounding or truncation.
*
* <p>This implementation returns the result of {@link #intValue} cast
* to a {@code short}.
*
* @return the numeric value represented by this object after conversion
* to type
<code>short</code>
.
* to type
{@code short}
.
* @since JDK1.1
*/
public
short
shortValue
()
{
...
...
src/share/classes/java/lang/Short.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1996, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
11
, 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
...
...
@@ -321,8 +321,9 @@ public final class Short extends Number implements Comparable<Short> {
}
/**
* Returns the value of this {@code Short} as a
* {@code byte}.
* Returns the value of this {@code Short} as a {@code byte} after
* a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
byte
byteValue
()
{
return
(
byte
)
value
;
...
...
@@ -337,32 +338,36 @@ public final class Short extends Number implements Comparable<Short> {
}
/**
* Returns the value of this {@code Short} as an
* {@code int}.
* Returns the value of this {@code Short} as an {@code int} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
int
intValue
()
{
return
(
int
)
value
;
}
/**
* Returns the value of this {@code Short} as a
* {@code long}.
* Returns the value of this {@code Short} as a {@code long} after
* a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
long
longValue
()
{
return
(
long
)
value
;
}
/**
* Returns the value of this {@code Short} as a
* {@code float}.
* Returns the value of this {@code Short} as a {@code float}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
float
floatValue
()
{
return
(
float
)
value
;
}
/**
* Returns the value of this {@code Short} as a
* {@code double}.
* Returns the value of this {@code Short} as a {@code double}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
value
;
...
...
src/share/classes/java/lang/annotation/IncompleteAnnotationException.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -41,21 +41,23 @@ package java.lang.annotation;
public
class
IncompleteAnnotationException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
8445097402741811912L
;
private
Class
annotationType
;
private
Class
<?
extends
Annotation
>
annotationType
;
private
String
elementName
;
/**
* Constructs an IncompleteAnnotationException to indicate that
* the named element was missing from the specified annotation type.
*
* @param annotationType the Class object for the annotation type
* @param elementName the name of the missing element
* @throws NullPointerException if either parameter is {@code null}
*/
public
IncompleteAnnotationException
(
Class
<?
extends
Annotation
>
annotationType
,
String
elementName
)
{
super
(
annotationType
.
getName
()
+
" missing element "
+
elementName
);
super
(
annotationType
.
getName
().
toString
()
+
" missing element "
+
elementName
.
toString
());
this
.
annotationType
=
annotationType
;
this
.
elementName
=
elementName
;
...
...
src/share/classes/java/lang/reflect/GenericSignatureFormatError.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -35,4 +35,22 @@ package java.lang.reflect;
*/
public
class
GenericSignatureFormatError
extends
ClassFormatError
{
private
static
final
long
serialVersionUID
=
6709919147137911034L
;
/**
* Constructs a new {@code GenericSignatureFormatError}.
*
*/
public
GenericSignatureFormatError
()
{
super
();
}
/**
* Constructs a new {@code GenericSignatureFormatError} with the
* specified message.
*
* @param message the detail message, may be {@code null}
*/
public
GenericSignatureFormatError
(
String
message
)
{
super
(
message
);
}
}
src/share/classes/java/rmi/server/UID.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1996, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
11
, 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
...
...
@@ -118,15 +118,17 @@ public final class UID implements Serializable {
boolean
done
=
false
;
while
(!
done
)
{
long
now
=
System
.
currentTimeMillis
();
if
(
now
<
=
lastTime
)
{
if
(
now
=
=
lastTime
)
{
// wait for time to change
try
{
Thread
.
currentThread
().
sleep
(
1
);
Thread
.
sleep
(
1
);
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
}
}
else
{
lastTime
=
now
;
// If system time has gone backwards increase
// original by 1ms to maintain uniqueness
lastTime
=
(
now
<
lastTime
)
?
lastTime
+
1
:
now
;
lastCount
=
Short
.
MIN_VALUE
;
done
=
true
;
}
...
...
src/share/classes/java/util/Random.java
浏览文件 @
82d12eca
...
...
@@ -118,7 +118,13 @@ class Random implements java.io.Serializable {
* @see #setSeed(long)
*/
public
Random
(
long
seed
)
{
this
.
seed
=
new
AtomicLong
(
initialScramble
(
seed
));
if
(
getClass
()
==
Random
.
class
)
this
.
seed
=
new
AtomicLong
(
initialScramble
(
seed
));
else
{
// subclass might have overriden setSeed
this
.
seed
=
new
AtomicLong
();
setSeed
(
seed
);
}
}
private
static
long
initialScramble
(
long
seed
)
{
...
...
src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
浏览文件 @
82d12eca
...
...
@@ -246,18 +246,37 @@ public class AtomicInteger extends Number implements java.io.Serializable {
}
/**
* Returns the value of this {@code AtomicInteger} as an
* {@code int}.
*/
public
int
intValue
()
{
return
get
();
}
/**
* Returns the value of this {@code AtomicInteger} as a {@code long}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
long
longValue
()
{
return
(
long
)
get
();
}
/**
* Returns the value of this {@code AtomicInteger} as a {@code float}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
float
floatValue
()
{
return
(
float
)
get
();
}
/**
* Returns the value of this {@code AtomicInteger} as a {@code double}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
get
();
}
...
...
src/share/classes/java/util/concurrent/atomic/AtomicLong.java
浏览文件 @
82d12eca
...
...
@@ -260,18 +260,37 @@ public class AtomicLong extends Number implements java.io.Serializable {
}
/**
* Returns the value of this {@code AtomicLong} as an {@code int}
* after a narrowing primitive conversion.
* @jls 5.1.3 Narrowing Primitive Conversions
*/
public
int
intValue
()
{
return
(
int
)
get
();
}
/**
* Returns the value of this {@code AtomicLong} as a {@code long}
* value.
*/
public
long
longValue
()
{
return
get
();
}
/**
* Returns the value of this {@code AtomicLong} as a {@code float}
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
float
floatValue
()
{
return
(
float
)
get
();
}
/**
* Returns the value of this {@code AtomicLong} as a {@code
* double} after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public
double
doubleValue
()
{
return
(
double
)
get
();
}
...
...
src/share/classes/java/util/logging/Logger.java
浏览文件 @
82d12eca
...
...
@@ -251,7 +251,10 @@ public class Logger {
protected
Logger
(
String
name
,
String
resourceBundleName
)
{
this
.
manager
=
LogManager
.
getLogManager
();
if
(
resourceBundleName
!=
null
)
{
// Note: we may get a MissingResourceException here.
// MissingResourceException or IllegalArgumentException can
// be thrown by setupResourceInfo(). Since this is the Logger
// constructor, the resourceBundleName field is null so
// IllegalArgumentException cannot happen here.
setupResourceInfo
(
resourceBundleName
);
}
this
.
name
=
name
;
...
...
@@ -374,13 +377,10 @@ public class Logger {
public
static
Logger
getLogger
(
String
name
,
String
resourceBundleName
)
{
LogManager
manager
=
LogManager
.
getLogManager
();
Logger
result
=
manager
.
demandLogger
(
name
);
if
(
result
.
resourceBundleName
==
null
)
{
// Note: we may get a MissingResourceException here.
result
.
setupResourceInfo
(
resourceBundleName
);
}
else
if
(!
result
.
resourceBundleName
.
equals
(
resourceBundleName
))
{
throw
new
IllegalArgumentException
(
result
.
resourceBundleName
+
" != "
+
resourceBundleName
);
}
// MissingResourceException or IllegalArgumentException can be
// thrown by setupResourceInfo().
result
.
setupResourceInfo
(
resourceBundleName
);
return
result
;
}
...
...
@@ -1353,14 +1353,29 @@ public class Logger {
}
// Private utility method to initialize our one entry
// resource bundle cache.
// resource bundle
name
cache.
// Note: for consistency reasons, we are careful to check
// that a suitable ResourceBundle exists before setting the
// ResourceBundleName.
// resourceBundleName field.
// Synchronized to prevent races in setting the field.
private
synchronized
void
setupResourceInfo
(
String
name
)
{
if
(
name
==
null
)
{
return
;
}
if
(
resourceBundleName
!=
null
)
{
// this Logger already has a ResourceBundle
if
(
resourceBundleName
.
equals
(
name
))
{
// the names match so there is nothing more to do
return
;
}
// cannot change ResourceBundles once they are set
throw
new
IllegalArgumentException
(
resourceBundleName
+
" != "
+
name
);
}
ResourceBundle
rb
=
findResourceBundle
(
name
);
if
(
rb
==
null
)
{
// We've failed to find an expected ResourceBundle.
...
...
src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java
浏览文件 @
82d12eca
...
...
@@ -25,7 +25,7 @@
package
javax.security.auth.kerberos
;
import
sun.
misc
.JavaxSecurityAuthKerberosAccess
;
import
sun.
security.krb5
.JavaxSecurityAuthKerberosAccess
;
import
sun.security.krb5.EncryptionKey
;
import
sun.security.krb5.PrincipalName
;
...
...
src/share/classes/javax/security/auth/kerberos/KeyTab.java
浏览文件 @
82d12eca
...
...
@@ -27,8 +27,8 @@ package javax.security.auth.kerberos;
import
java.io.File
;
import
java.util.Objects
;
import
sun.misc.SharedSecrets
;
import
sun.security.krb5.EncryptionKey
;
import
sun.security.krb5.KerberosSecrets
;
import
sun.security.krb5.PrincipalName
;
import
sun.security.krb5.RealmException
;
...
...
@@ -74,9 +74,9 @@ public final class KeyTab {
// is maintained in snapshot, this field is never "resolved".
private
final
File
file
;
// Set up JavaxSecurityAuthKerberosAccess in
Shared
Secrets
// Set up JavaxSecurityAuthKerberosAccess in
Kerberos
Secrets
static
{
Shared
Secrets
.
setJavaxSecurityAuthKerberosAccess
(
Kerberos
Secrets
.
setJavaxSecurityAuthKerberosAccess
(
new
JavaxSecurityAuthKerberosAccessImpl
());
}
...
...
src/share/classes/sun/launcher/resources/launcher.properties
浏览文件 @
82d12eca
...
...
@@ -43,7 +43,7 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
\
and ZIP archives to search for class files.
\n\
\
-D<name>=<value>
\n\
\
set a system property
\n\
\
-verbose
[:
class|gc|jni]
\n\
\
-verbose
:[
class|gc|jni]
\n\
\
enable verbose output
\n\
\
-version print product version and exit
\n\
\
-version:<value>
\n\
...
...
src/share/classes/sun/misc/SharedSecrets.java
浏览文件 @
82d12eca
...
...
@@ -29,7 +29,6 @@ import java.util.jar.JarFile;
import
java.io.Console
;
import
java.io.FileDescriptor
;
import
java.security.ProtectionDomain
;
import
javax.security.auth.kerberos.KeyTab
;
import
java.security.AccessController
;
...
...
@@ -52,7 +51,6 @@ public class SharedSecrets {
private
static
JavaIOFileDescriptorAccess
javaIOFileDescriptorAccess
;
private
static
JavaSecurityProtectionDomainAccess
javaSecurityProtectionDomainAccess
;
private
static
JavaSecurityAccess
javaSecurityAccess
;
private
static
JavaxSecurityAuthKerberosAccess
javaxSecurityAuthKerberosAccess
;
public
static
JavaUtilJarAccess
javaUtilJarAccess
()
{
if
(
javaUtilJarAccess
==
null
)
{
...
...
@@ -141,16 +139,4 @@ public class SharedSecrets {
}
return
javaSecurityAccess
;
}
public
static
void
setJavaxSecurityAuthKerberosAccess
(
JavaxSecurityAuthKerberosAccess
jsaka
)
{
javaxSecurityAuthKerberosAccess
=
jsaka
;
}
public
static
JavaxSecurityAuthKerberosAccess
getJavaxSecurityAuthKerberosAccess
()
{
if
(
javaxSecurityAuthKerberosAccess
==
null
)
unsafe
.
ensureClassInitialized
(
KeyTab
.
class
);
return
javaxSecurityAuthKerberosAccess
;
}
}
src/share/classes/sun/security/jgss/krb5/Krb5Util.java
浏览文件 @
82d12eca
...
...
@@ -44,7 +44,7 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Set
;
import
sun.
misc.Shared
Secrets
;
import
sun.
security.krb5.Kerberos
Secrets
;
import
sun.security.krb5.PrincipalName
;
/**
* Utilities for obtaining and converting Kerberos tickets.
...
...
@@ -378,7 +378,7 @@ public class Krb5Util {
*/
public
static
EncryptionKey
[]
keysFromJavaxKeyTab
(
KeyTab
ktab
,
PrincipalName
cname
)
{
return
Shared
Secrets
.
getJavaxSecurityAuthKerberosAccess
().
return
Kerberos
Secrets
.
getJavaxSecurityAuthKerberosAccess
().
keyTabGetEncryptionKeys
(
ktab
,
cname
);
}
...
...
src/share/classes/sun/
misc
/JavaxSecurityAuthKerberosAccess.java
→
src/share/classes/sun/
security/krb5
/JavaxSecurityAuthKerberosAccess.java
浏览文件 @
82d12eca
...
...
@@ -23,7 +23,7 @@
* questions.
*/
package
sun.
misc
;
package
sun.
security.krb5
;
import
javax.security.auth.kerberos.KeyTab
;
import
sun.security.krb5.EncryptionKey
;
...
...
src/share/classes/sun/security/krb5/KerberosSecrets.java
0 → 100644
浏览文件 @
82d12eca
/*
* Copyright (c) 2011, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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
sun.security.krb5
;
import
javax.security.auth.kerberos.KeyTab
;
import
sun.misc.Unsafe
;
public
class
KerberosSecrets
{
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
static
JavaxSecurityAuthKerberosAccess
javaxSecurityAuthKerberosAccess
;
public
static
void
setJavaxSecurityAuthKerberosAccess
(
JavaxSecurityAuthKerberosAccess
jsaka
)
{
javaxSecurityAuthKerberosAccess
=
jsaka
;
}
public
static
JavaxSecurityAuthKerberosAccess
getJavaxSecurityAuthKerberosAccess
()
{
if
(
javaxSecurityAuthKerberosAccess
==
null
)
unsafe
.
ensureClassInitialized
(
KeyTab
.
class
);
return
javaxSecurityAuthKerberosAccess
;
}
}
src/share/classes/sun/security/tools/KeyTool.java
浏览文件 @
82d12eca
...
...
@@ -4193,15 +4193,11 @@ class Pair<A, B> {
return
"Pair["
+
fst
+
","
+
snd
+
"]"
;
}
private
static
boolean
equals
(
Object
x
,
Object
y
)
{
return
(
x
==
null
&&
y
==
null
)
||
(
x
!=
null
&&
x
.
equals
(
y
));
}
public
boolean
equals
(
Object
other
)
{
return
other
instanceof
Pair
&&
equals
(
fst
,
((
Pair
)
other
).
fst
)
&&
equals
(
snd
,
((
Pair
)
other
).
snd
);
Objects
.
equals
(
fst
,
((
Pair
)
other
).
fst
)
&&
Objects
.
equals
(
snd
,
((
Pair
)
other
).
snd
);
}
public
int
hashCode
()
{
...
...
src/share/classes/sun/security/x509/DistributionPoint.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2002, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
11
, 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
...
...
@@ -318,13 +318,6 @@ public class DistributionPoint {
out
.
write
(
DerValue
.
tag_Sequence
,
tagged
);
}
/**
* Utility function for a.equals(b) where both a and b may be null.
*/
private
static
boolean
equals
(
Object
a
,
Object
b
)
{
return
(
a
==
null
)
?
(
b
==
null
)
:
a
.
equals
(
b
);
}
/**
* Compare an object to this DistributionPoint for equality.
*
...
...
@@ -340,9 +333,9 @@ public class DistributionPoint {
}
DistributionPoint
other
=
(
DistributionPoint
)
obj
;
boolean
equal
=
equals
(
this
.
fullName
,
other
.
fullName
)
&&
equals
(
this
.
relativeName
,
other
.
relativeName
)
&&
equals
(
this
.
crlIssuer
,
other
.
crlIssuer
)
boolean
equal
=
Objects
.
equals
(
this
.
fullName
,
other
.
fullName
)
&&
Objects
.
equals
(
this
.
relativeName
,
other
.
relativeName
)
&&
Objects
.
equals
(
this
.
crlIssuer
,
other
.
crlIssuer
)
&&
Arrays
.
equals
(
this
.
reasonFlags
,
other
.
reasonFlags
);
return
equal
;
}
...
...
src/share/classes/sun/security/x509/DistributionPointName.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005,
2011,
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
...
...
@@ -201,8 +201,8 @@ public class DistributionPointName {
}
DistributionPointName
other
=
(
DistributionPointName
)
obj
;
return
equals
(
this
.
fullName
,
other
.
fullName
)
&&
equals
(
this
.
relativeName
,
other
.
relativeName
);
return
Objects
.
equals
(
this
.
fullName
,
other
.
fullName
)
&&
Objects
.
equals
(
this
.
relativeName
,
other
.
relativeName
);
}
/**
...
...
@@ -239,11 +239,4 @@ public class DistributionPointName {
return
sb
.
toString
();
}
/*
* Utility function for a.equals(b) where both a and b may be null.
*/
private
static
boolean
equals
(
Object
a
,
Object
b
)
{
return
(
a
==
null
)
?
(
b
==
null
)
:
a
.
equals
(
b
);
}
}
src/windows/classes/sun/security/krb5/internal/tools/Klist.java
浏览文件 @
82d12eca
...
...
@@ -95,14 +95,17 @@ public class Klist {
}
break
;
case
'k'
:
try
{
KeyTab
ktab
=
KeyTab
.
getInstance
(
klist
.
name
);
klist
.
target
=
ktab
;
klist
.
name
=
ktab
.
tabName
();
}
catch
(
Exception
e
)
{
klist
.
displayMessage
(
"KeyTab"
);
KeyTab
ktab
=
KeyTab
.
getInstance
(
klist
.
name
);
if
(
ktab
.
isMissing
())
{
System
.
out
.
println
(
"KeyTab "
+
klist
.
name
+
" not found."
);
System
.
exit
(-
1
);
}
else
if
(!
ktab
.
isValid
())
{
System
.
out
.
println
(
"KeyTab "
+
klist
.
name
+
" format not supported."
);
System
.
exit
(-
1
);
}
klist
.
target
=
ktab
;
klist
.
name
=
ktab
.
tabName
();
klist
.
displayTab
();
break
;
default
:
...
...
test/Makefile
浏览文件 @
82d12eca
...
...
@@ -510,13 +510,17 @@ jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS
+=
jdk_nio3
jdk_nio3
:
$(call TestDirs
,
com/sun/nio
sun/nio)
jdk_nio3
:
$(call TestDirs
,
sun/nio)
$(
call
RunSamevmBatch
)
# All nio tests
jdk_nio
:
jdk_nio1 jdk_nio2 jdk_nio3
@
$(SummaryInfo)
# Stable samevm testruns (minus items from PROBLEM_LIST)
jdk_sctp
:
$(call TestDirs
,
com/sun/nio/sctp)
$(
call
RunSamevmBatch
)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS
+=
jdk_rmi
...
...
@@ -532,7 +536,7 @@ jdk_security1: $(call TestDirs, java/security)
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS
+=
jdk_security2
jdk_security2
:
$(call TestDirs
,
javax/crypto com/sun/crypto)
$(
call
Run
Other
vmBatch
)
$(
call
Run
Same
vmBatch
)
# Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests
...
...
test/ProblemList.txt
浏览文件 @
82d12eca
...
...
@@ -198,18 +198,6 @@ java/beans/XMLEncoder/6329581/Test6329581.java generic-all
# requires junit
java/lang/invoke/InvokeDynamicPrintArgs.java generic-all
# Times out on solaris 10 sparc
java/lang/ClassLoader/Assert.java generic-all
# Solaris sparc, samevm, java.lang.Exception: Read from closed pipe hangs
java/lang/Runtime/exec/SleepyCat.java generic-all
# Times out on solaris sparc -server
java/lang/ThreadLocal/MemoryLeak.java solaris-all
# Windows X64, RuntimeException: MyThread expected to have RUNNABLE but got WAITING
java/lang/Thread/ThreadStateTest.java generic-all
############################################################################
# jdk_management
...
...
@@ -296,7 +284,6 @@ javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all
# jdk_misc
# Need to be marked othervm, or changed to be samevm safe
com/sun/jndi/ldap/ReadTimeoutTest.java generic-all
com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all
# Need to be marked othervm, or changed to be samevm safe
...
...
@@ -380,30 +367,6 @@ java/io/File/MaxPathLength.java windows-all
# 6963118
java/nio/channels/Selector/Wakeup.java windows-all
# 6959891
com/sun/nio/sctp/SctpChannel/SocketOptionTests.java
# Fails with -ea -esa, Assertion error, but only on Solaris 10 machines?
com/sun/nio/sctp/SctpChannel/Send.java generic-all
com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all
# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses
# from a channel that is bound to the wildcard address
com/sun/nio/sctp/SctpChannel/Bind.java generic-all
# Failed on OpenSolaris, java.lang.AssertionError: Unknown event type
com/sun/nio/sctp/SctpChannel/Receive.java generic-all
# Solaris 11 gave assert error and "connection refused", samevm issues?
com/sun/nio/sctp/SctpServerChannel/NonBlockingAccept.java generic-all
# Fails with othervm on solaris 11 i586
com/sun/nio/sctp/SctpChannel/CommUp.java generic-all
com/sun/nio/sctp/SctpChannel/Connect.java generic-all
com/sun/nio/sctp/SctpMultiChannel/Branch.java generic-all
com/sun/nio/sctp/SctpMultiChannel/Send.java generic-all
com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java generic-all
############################################################################
# jdk_rmi
...
...
@@ -503,10 +466,6 @@ sun/security/pkcs11/ec/TestECDSA.java solaris-i586
sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586
sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586
# Unknown problem, could be a jtreg -samevm issue?
# Error while cleaning up threads after test
java/security/Security/SynchronizedAccess.java generic-all
# Failing on Solaris X64 (-d64 -server) with:
# GSSException: Failure unspecified at GSS-API level
# (Mechanism level: Specified version of key is not available (44))
...
...
@@ -592,37 +551,9 @@ sun/security/tools/jarsigner/oldsig.sh generic-all
# Various failures on Linux Fedora 9 X64, othervm mode
sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java generic-all
# Linux i586 -server, buffer too short to hold shared secret?
com/sun/crypto/provider/KeyAgreement/DHKeyAgreement2.java generic-all
# Solaris sparcv9: Failed to parse input emptysubject.jks: No such file or directory
sun/security/tools/keytool/emptysubject.sh generic-all
# Timeout on solaris-sparcv9 or exception thrown
com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java solaris-all
# Leaving file open: SerialVersion.current, windows samevm
java/security/BasicPermission/SerialVersion.java generic-all
# Solaris 11 i586, these all fail with samevm, need to be othervm???
java/security/BasicPermission/NullOrEmptyName.java generic-all
# Suspect missing close() on file PermClass.current, windows samevm cascade
java/security/BasicPermission/PermClass.java generic-all
# Solaris 11 i586, these all fail with samevm, need to be othervm???
java/security/KeyPairGenerator/Failover.java generic-all
java/security/Provider/DefaultPKCS11.java generic-all
java/security/SecureClassLoader/DefineClassByteBuffer.java generic-all
java/security/SecureRandom/GetAlgorithm.java generic-all
java/security/Security/removing/RemoveProviders.java generic-all
java/security/Signature/ByteBuffers.java generic-all
java/security/Signature/NONEwithRSA.java generic-all
java/security/Signature/SignWithOutputBuffer.java generic-all
java/security/Signature/TestInitSignWithMyOwnRandom.java generic-all
java/security/UnresolvedPermission/AccessorMethods.java generic-all
java/security/UnresolvedPermission/Equals.java generic-all
# Fails on OpenSolaris, missing classes, slow on Solaris sparc
sun/security/ec/TestEC.java generic-all
...
...
@@ -643,9 +574,6 @@ sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java generic-all
sun/security/rsa/TestKeyPairGeneratorLength.java solaris-all
sun/security/rsa/TestSignatures.java solaris-all
# Timeout on solaris-sparc and i586 and x64, -client and -server
sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java solaris-all
# Do not seem to run on windows machines? dll missing?
sun/security/tools/jarsigner/emptymanifest.sh windows-all
...
...
test/com/sun/crypto/provider/Cipher/DES/Sealtest.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1998, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
11
, 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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 0000000
* @bug 0000000
7055362
* @summary Sealtest
* @author Jan Luehe
*/
...
...
@@ -54,14 +54,16 @@ public class Sealtest {
SealedObject
sealed
=
new
SealedObject
(
kp
.
getPrivate
(),
c
);
// serialize
FileOutputStream
fos
=
new
FileOutputStream
(
"sealed"
);
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
fos
);
oos
.
writeObject
(
sealed
);
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
"sealed"
);
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
fos
))
{
oos
.
writeObject
(
sealed
);
}
// deserialize
FileInputStream
fis
=
new
FileInputStream
(
"sealed"
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
);
sealed
=
(
SealedObject
)
ois
.
readObject
();
try
(
FileInputStream
fis
=
new
FileInputStream
(
"sealed"
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
sealed
=
(
SealedObject
)
ois
.
readObject
();
}
System
.
out
.
println
(
sealed
.
getAlgorithm
());
...
...
test/com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4894151
* @bug 4894151
7055362
* @summary known answer test for OAEP encryption
* @author Andreas Sterbenz
*/
...
...
@@ -62,60 +62,62 @@ public class TestOAEP_KAT {
System
.
out
.
println
(
"Testing provider "
+
provider
.
getName
()
+
"..."
);
Cipher
c
=
Cipher
.
getInstance
(
"RSA/ECB/OAEPwithSHA1andMGF1Padding"
,
provider
);
KeyFactory
kf
=
KeyFactory
.
getInstance
(
"RSA"
,
kfProvider
);
InputStream
in
=
new
FileInputStream
(
new
File
(
BASE
,
"oaep-vect.txt"
));
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
in
,
"UTF8"
));
while
(
true
)
{
String
line
=
reader
.
readLine
();
if
(
line
==
null
)
{
break
;
}
line
=
line
.
trim
();
if
(
line
.
length
()
==
0
)
{
continue
;
}
if
(
line
.
equals
(
"# RSA modulus n:"
))
{
n
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# RSA public exponent e:"
))
{
e
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# RSA private exponent d:"
))
{
d
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# Prime p:"
))
{
p
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# Prime q:"
))
{
q
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# p's CRT exponent dP:"
))
{
pe
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# q's CRT exponent dQ:"
))
{
qe
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# CRT coefficient qInv:"
))
{
coeff
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# Message to be encrypted:"
))
{
plainText
=
parseBytes
(
reader
);
}
else
if
(
line
.
equals
(
"# Seed:"
))
{
seed
=
parseBytes
(
reader
);
}
else
if
(
line
.
equals
(
"# Encryption:"
))
{
cipherText
=
parseBytes
(
reader
);
// do encryption test first
KeySpec
pubSpec
=
new
RSAPublicKeySpec
(
n
,
e
);
PublicKey
pubKey
=
kf
.
generatePublic
(
pubSpec
);
c
.
init
(
Cipher
.
ENCRYPT_MODE
,
pubKey
,
new
MyRandom
(
seed
));
cipherText2
=
c
.
doFinal
(
plainText
);
if
(
Arrays
.
equals
(
cipherText2
,
cipherText
)
==
false
)
{
throw
new
Exception
(
"Encryption mismatch"
);
try
(
InputStream
in
=
new
FileInputStream
(
new
File
(
BASE
,
"oaep-vect.txt"
));
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
in
,
"UTF8"
)))
{
while
(
true
)
{
String
line
=
reader
.
readLine
();
if
(
line
==
null
)
{
break
;
}
line
=
line
.
trim
();
if
(
line
.
length
()
==
0
)
{
continue
;
}
// followed by decryption test
KeySpec
privSpec
=
new
RSAPrivateCrtKeySpec
(
n
,
e
,
d
,
p
,
q
,
pe
,
qe
,
coeff
);
PrivateKey
privKey
=
kf
.
generatePrivate
(
privSpec
);
c
.
init
(
Cipher
.
DECRYPT_MODE
,
privKey
);
byte
[]
dec
=
c
.
doFinal
(
cipherText
);
if
(
Arrays
.
equals
(
plainText
,
dec
)
==
false
)
{
throw
new
Exception
(
"Decryption mismatch"
);
if
(
line
.
equals
(
"# RSA modulus n:"
))
{
n
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# RSA public exponent e:"
))
{
e
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# RSA private exponent d:"
))
{
d
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# Prime p:"
))
{
p
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# Prime q:"
))
{
q
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# p's CRT exponent dP:"
))
{
pe
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# q's CRT exponent dQ:"
))
{
qe
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# CRT coefficient qInv:"
))
{
coeff
=
parseNumber
(
reader
);
}
else
if
(
line
.
equals
(
"# Message to be encrypted:"
))
{
plainText
=
parseBytes
(
reader
);
}
else
if
(
line
.
equals
(
"# Seed:"
))
{
seed
=
parseBytes
(
reader
);
}
else
if
(
line
.
equals
(
"# Encryption:"
))
{
cipherText
=
parseBytes
(
reader
);
// do encryption test first
KeySpec
pubSpec
=
new
RSAPublicKeySpec
(
n
,
e
);
PublicKey
pubKey
=
kf
.
generatePublic
(
pubSpec
);
c
.
init
(
Cipher
.
ENCRYPT_MODE
,
pubKey
,
new
MyRandom
(
seed
));
cipherText2
=
c
.
doFinal
(
plainText
);
if
(
Arrays
.
equals
(
cipherText2
,
cipherText
)
==
false
)
{
throw
new
Exception
(
"Encryption mismatch"
);
}
// followed by decryption test
KeySpec
privSpec
=
new
RSAPrivateCrtKeySpec
(
n
,
e
,
d
,
p
,
q
,
pe
,
qe
,
coeff
);
PrivateKey
privKey
=
kf
.
generatePrivate
(
privSpec
);
c
.
init
(
Cipher
.
DECRYPT_MODE
,
privKey
);
byte
[]
dec
=
c
.
doFinal
(
cipherText
);
if
(
Arrays
.
equals
(
plainText
,
dec
)
==
false
)
{
throw
new
Exception
(
"Decryption mismatch"
);
}
}
else
if
(
line
.
startsWith
(
"# ------------------------------"
))
{
// ignore, do not print
}
else
{
// unknown line (comment), print
System
.
out
.
println
(
": "
+
line
);
}
}
else
if
(
line
.
startsWith
(
"# ------------------------------"
))
{
// ignore, do not print
}
else
{
// unknown line (comment), print
System
.
out
.
println
(
": "
+
line
);
}
}
long
stop
=
System
.
currentTimeMillis
();
...
...
test/com/sun/jndi/ldap/ReadTimeoutTest.java
浏览文件 @
82d12eca
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 6176036
* @bug 6176036
7056489
* @summary Read-timeout specification for LDAP operations
*/
...
...
@@ -37,40 +37,37 @@ import java.util.Hashtable;
public
class
ReadTimeoutTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
passed
=
false
;
// Set up the environment for creating the initial context
Hashtable
env
=
new
Hashtable
(
11
);
env
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
env
.
put
(
"com.sun.jndi.ldap.read.timeout"
,
"1000"
);
env
.
put
(
Context
.
PROVIDER_URL
,
"ldap://localhost:2001"
);
Server
s
=
new
Server
();
try
{
// create the server
try
(
Server
server
=
Server
.
create
())
{
// Set up the environment for creating the initial context
Hashtable
<
String
,
Object
>
env
=
new
Hashtable
<>(
11
);
env
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
env
.
put
(
"com.sun.jndi.ldap.read.timeout"
,
"1000"
);
env
.
put
(
Context
.
PROVIDER_URL
,
"ldap://localhost:"
+
server
.
port
());
// start the server
s
.
start
();
// Create initial context
DirContext
ctx
=
new
InitialDirContext
(
env
);
System
.
out
.
println
(
"LDAP Client: Connected to the Server"
);
SearchControls
scl
=
new
SearchControls
();
scl
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
System
.
out
.
println
(
"Performing Search"
);
NamingEnumeration
answer
=
ctx
.
search
(
"ou=People,o=JNDITutorial"
,
"(objectClass=*)"
,
scl
);
// Close the context when we're done
ctx
.
close
();
try
{
System
.
out
.
println
(
"LDAP Client: Connected to the Server"
);
SearchControls
scl
=
new
SearchControls
();
scl
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
System
.
out
.
println
(
"Performing Search"
);
NamingEnumeration
<
SearchResult
>
answer
=
ctx
.
search
(
"ou=People,o=JNDITutorial"
,
"(objectClass=*)"
,
scl
);
}
finally
{
// Close the context when we're done
ctx
.
close
();
}
}
catch
(
NamingException
e
)
{
passed
=
true
;
e
.
printStackTrace
();
}
s
.
interrupt
();
if
(!
passed
)
{
throw
new
Exception
(
"Read timeout test failed,"
+
" read timeout exception not thrown"
);
...
...
@@ -78,27 +75,39 @@ public class ReadTimeoutTest {
System
.
out
.
println
(
"The test PASSED"
);
}
static
class
Server
extends
Thread
{
static
class
Server
implements
Runnable
,
Closeable
{
private
final
ServerSocket
ss
;
static
int
serverPort
=
2001
;
private
Server
(
ServerSocket
ss
)
{
this
.
ss
=
ss
;
}
Server
()
{
static
Server
create
()
throws
IOException
{
Server
server
=
new
Server
(
new
ServerSocket
(
0
));
new
Thread
(
server
).
start
();
return
server
;
}
int
port
()
{
return
ss
.
getLocalPort
();
}
public
void
run
()
{
try
{
ServerSocket
serverSock
=
new
ServerSocket
(
serverPort
);
Socket
socket
=
serverSock
.
accept
();
try
(
Socket
s
=
ss
.
accept
())
{
System
.
out
.
println
(
"Server: Connection accepted"
);
BufferedInputStream
bin
=
new
BufferedInputStream
(
socket
.
getInputStream
())
;
while
(
true
)
{
bin
.
read
(
);
}
BufferedInputStream
bis
=
new
BufferedInputStream
(
s
.
getInputStream
());
byte
[]
buf
=
new
byte
[
100
];
int
n
;
do
{
n
=
bis
.
read
(
buf
);
}
while
(
n
>
0
);
}
catch
(
IOException
e
)
{
// ignore
}
}
public
void
close
()
throws
IOException
{
ss
.
close
();
}
}
}
}
test/com/sun/net/httpserver/bugs/B6373555.java
浏览文件 @
82d12eca
...
...
@@ -43,14 +43,12 @@ public class B6373555 {
private
static
int
port
;
private
static
volatile
boolean
error
=
false
;
private
static
Object
lock
;
static
HttpServer
httpServer
;
static
ExecutorService
pool
,
execs
;
static
int
NUM
=
1000
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
lock
=
new
Object
();
if
(
args
.
length
>
0
)
{
NUM
=
Integer
.
parseInt
(
args
[
0
]);
}
...
...
@@ -117,12 +115,6 @@ public class B6373555 {
System
.
out
.
println
(
"Doesn't match"
);
error
=
true
;
}
synchronized
(
lock
)
{
++
received
;
if
((
received
%
1000
)
==
0
)
{
System
.
out
.
println
(
"Received="
+
received
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -150,18 +142,12 @@ public class B6373555 {
private
static
HttpServer
createHttpServer
(
ExecutorService
execs
)
throws
Exception
{
InetSocketAddress
inetAddress
=
new
InetSocketAddress
(
0
);
HttpServer
testServer
=
HttpServer
.
create
(
inetAddress
,
5
);
HttpServer
testServer
=
HttpServer
.
create
(
inetAddress
,
1
5
);
testServer
.
setExecutor
(
execs
);
HttpContext
context
=
testServer
.
createContext
(
"/test"
);
context
.
setHandler
(
new
HttpHandler
()
{
public
void
handle
(
HttpExchange
msg
)
{
try
{
synchronized
(
lock
)
{
++
s_received
;
if
((
s_received
%
1000
)
==
0
)
{
System
.
out
.
println
(
"Received="
+
s_received
);
}
}
String
method
=
msg
.
getRequestMethod
();
if
(
method
.
equals
(
"POST"
))
{
InputStream
is
=
msg
.
getRequestBody
();
...
...
@@ -172,12 +158,6 @@ public class B6373555 {
System
.
out
.
println
(
"****** METHOD not handled ***** "
+
method
);
System
.
out
.
println
(
"Received="
+
s_received
);
}
synchronized
(
lock
)
{
++
sent
;
if
((
sent
%
1000
)
==
0
)
{
System
.
out
.
println
(
"sent="
+
sent
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
浏览文件 @
82d12eca
...
...
@@ -25,7 +25,7 @@
# @summary (cl) ClassLoader.loadClass locks all instances in chain
# when delegating
#
# @run shell
/timeout=10
TestOneWayDelegate.sh
# @run shell TestOneWayDelegate.sh
# if running by hand on windows, change TESTSRC and TESTCLASSES to "."
if
[
"
${
TESTSRC
}
"
=
""
]
;
then
...
...
test/java/lang/Thread/ThreadStateTest.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004,
2011,
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
...
...
@@ -34,21 +34,16 @@
*/
import
java.util.concurrent.locks.LockSupport
;
import
java.util.concurrent.
Semaphore
;
import
java.util.concurrent.
Phaser
;
public
class
ThreadStateTest
{
// maximum number of retries when checking for thread state.
static
final
int
MAX_RETRY
=
500
;
private
static
boolean
testFailed
=
false
;
static
class
Lock
{
private
String
name
;
Lock
(
String
name
)
{
this
.
name
=
name
;
}
public
String
toString
()
{
return
name
;
}
}
private
static
Lock
globalLock
=
new
Lock
(
"my lock"
);
// used to achieve waiting states
static
final
Object
globalLock
=
new
Object
();
public
static
void
main
(
String
[]
argv
)
{
// Call Thread.getState to force all initialization done
...
...
@@ -102,13 +97,27 @@ public class ThreadStateTest {
System
.
out
.
println
(
"Unexpected exception."
);
testFailed
=
true
;
}
if
(
testFailed
)
throw
new
RuntimeException
(
"TEST FAILED."
);
System
.
out
.
println
(
"Test passed."
);
}
private
static
void
checkThreadState
(
Thread
t
,
Thread
.
State
expected
)
{
Thread
.
State
state
=
t
.
getState
();
// wait for the thread to transition to the expected state.
// There is a small window between the thread checking the state
// and the thread actual entering that state.
Thread
.
State
state
;
int
retryCount
=
0
;
while
((
state
=
t
.
getState
())
!=
expected
&&
retryCount
<
MAX_RETRY
)
{
if
(
state
!=
Thread
.
State
.
RUNNABLE
)
{
throw
new
RuntimeException
(
"Thread not in expected state yet,"
+
" but it should at least be RUNNABLE"
);
}
goSleep
(
10
);
retryCount
++;
}
System
.
out
.
println
(
"Checking thread state "
+
state
);
if
(
state
==
null
)
{
throw
new
RuntimeException
(
t
.
getName
()
+
" expected to have "
+
...
...
@@ -121,13 +130,6 @@ public class ThreadStateTest {
}
}
private
static
String
getLockName
(
Object
lock
)
{
if
(
lock
==
null
)
return
null
;
return
lock
.
getClass
().
getName
()
+
'@'
+
Integer
.
toHexString
(
System
.
identityHashCode
(
lock
));
}
private
static
void
goSleep
(
long
ms
)
{
try
{
Thread
.
sleep
(
ms
);
...
...
@@ -139,7 +141,9 @@ public class ThreadStateTest {
}
static
class
MyThread
extends
Thread
{
private
ThreadExecutionSynchronizer
thrsync
=
new
ThreadExecutionSynchronizer
();
// Phaser to sync between the main thread putting
// this thread into various states
private
Phaser
phaser
=
new
Phaser
(
2
);
MyThread
(
String
name
)
{
super
(
name
);
...
...
@@ -153,12 +157,14 @@ public class ThreadStateTest {
private
final
int
TIMED_PARKED
=
5
;
private
final
int
SLEEPING
=
6
;
private
final
int
TERMINATE
=
7
;
private
int
state
=
RUNNABLE
;
private
volatile
int
state
=
RUNNABLE
;
private
boolean
done
=
false
;
public
void
run
()
{
// Signal main thread to continue.
thrsync
.
signal
();
phaser
.
arriveAndAwaitAdvance
();
while
(!
done
)
{
switch
(
state
)
{
case
RUNNABLE:
{
...
...
@@ -172,7 +178,7 @@ public class ThreadStateTest {
}
case
BLOCKED:
{
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
System
.
out
.
println
(
" myThread is going to block."
);
synchronized
(
globalLock
)
{
// finish blocking
...
...
@@ -183,7 +189,7 @@ public class ThreadStateTest {
case
WAITING:
{
synchronized
(
globalLock
)
{
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
System
.
out
.
println
(
" myThread is going to wait."
);
try
{
globalLock
.
wait
();
...
...
@@ -196,7 +202,7 @@ public class ThreadStateTest {
case
TIMED_WAITING:
{
synchronized
(
globalLock
)
{
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
System
.
out
.
println
(
" myThread is going to timed wait."
);
try
{
globalLock
.
wait
(
10000
);
...
...
@@ -208,7 +214,7 @@ public class ThreadStateTest {
}
case
PARKED:
{
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
System
.
out
.
println
(
" myThread is going to park."
);
LockSupport
.
park
();
// give a chance for the main thread to block
...
...
@@ -217,7 +223,7 @@ public class ThreadStateTest {
}
case
TIMED_PARKED:
{
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
System
.
out
.
println
(
" myThread is going to timed park."
);
long
deadline
=
System
.
currentTimeMillis
()
+
10000
*
1000
;
LockSupport
.
parkUntil
(
deadline
);
...
...
@@ -228,20 +234,19 @@ public class ThreadStateTest {
}
case
SLEEPING:
{
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
System
.
out
.
println
(
" myThread is going to sleep."
);
try
{
Thread
.
sleep
(
1000000
);
}
catch
(
InterruptedException
e
)
{
// finish sleeping
interrupted
();
}
break
;
}
case
TERMINATE:
{
done
=
true
;
// signal main thread.
thrsync
.
signal
();
phaser
.
arrive
();
break
;
}
default
:
...
...
@@ -249,69 +254,66 @@ public class ThreadStateTest {
}
}
}
public
void
waitUntilStarted
()
{
// wait for MyThread.
thrsync
.
waitForSignal
();
goSleep
(
10
);
phaser
.
arriveAndAwaitAdvance
();
}
public
void
goBlocked
()
{
System
.
out
.
println
(
"Waiting myThread to go blocked."
);
setState
(
BLOCKED
);
// wait for MyThread to get blocked
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to a point just before being blocked
phaser
.
arriveAndAwaitAdvance
();
}
public
void
goWaiting
()
{
System
.
out
.
println
(
"Waiting myThread to go waiting."
);
setState
(
WAITING
);
// wait for MyThread to wait on object.
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to just before wait on object.
phaser
.
arriveAndAwaitAdvance
();
}
public
void
goTimedWaiting
()
{
System
.
out
.
println
(
"Waiting myThread to go timed waiting."
);
setState
(
TIMED_WAITING
);
// wait for MyThread timed wait call.
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to just before timed wait call.
phaser
.
arriveAndAwaitAdvance
();
}
public
void
goParked
()
{
System
.
out
.
println
(
"Waiting myThread to go parked."
);
setState
(
PARKED
);
// wait for MyThread state change to PARKED.
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to just before parked.
phaser
.
arriveAndAwaitAdvance
();
}
public
void
goTimedParked
()
{
System
.
out
.
println
(
"Waiting myThread to go timed parked."
);
setState
(
TIMED_PARKED
);
// wait for MyThread.
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to just before timed park.
phaser
.
arriveAndAwaitAdvance
();
}
public
void
goSleeping
()
{
System
.
out
.
println
(
"Waiting myThread to go sleeping."
);
setState
(
SLEEPING
);
// wait for MyThread.
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to just before sleeping
phaser
.
arriveAndAwaitAdvance
();
}
public
void
terminate
()
{
System
.
out
.
println
(
"Waiting myThread to terminate."
);
setState
(
TERMINATE
);
// wait for MyThread.
thrsync
.
waitForSignal
();
goSleep
(
20
);
// wait for MyThread to get to just before terminate
phaser
.
arriveAndAwaitAdvance
();
}
private
void
setState
(
int
newState
)
{
switch
(
state
)
{
case
BLOCKED:
while
(
state
==
BLOCKED
)
{
goSleep
(
2
0
);
goSleep
(
1
0
);
}
state
=
newState
;
break
;
...
...
@@ -337,50 +339,4 @@ public class ThreadStateTest {
}
}
}
static
class
ThreadExecutionSynchronizer
{
private
boolean
waiting
;
private
Semaphore
semaphore
;
public
ThreadExecutionSynchronizer
()
{
semaphore
=
new
Semaphore
(
1
);
waiting
=
false
;
}
// Synchronizes two threads execution points.
// Basically any thread could get scheduled to run and
// it is not possible to know which thread reaches expected
// execution point. So whichever thread reaches a execution
// point first wait for the second thread. When the second thread
// reaches the expected execution point will wake up
// the thread which is waiting here.
void
stopOrGo
()
{
semaphore
.
acquireUninterruptibly
();
// Thread can get blocked.
if
(!
waiting
)
{
waiting
=
true
;
// Wait for second thread to enter this method.
while
(!
semaphore
.
hasQueuedThreads
())
{
try
{
Thread
.
sleep
(
20
);
}
catch
(
InterruptedException
xx
)
{}
}
semaphore
.
release
();
}
else
{
waiting
=
false
;
semaphore
.
release
();
}
}
// Wrapper function just for code readability.
void
waitForSignal
()
{
stopOrGo
();
}
void
signal
()
{
stopOrGo
();
}
}
}
test/java/lang/annotation/TestIncompleteAnnotationExceptionNPE.java
0 → 100644
浏览文件 @
82d12eca
/*
* Copyright (c) 2011, 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 7021922
* @summary Test null handling of IncompleteAnnotationException constructor
* @author Joseph D. Darcy
*/
import
java.lang.annotation.*
;
public
class
TestIncompleteAnnotationExceptionNPE
{
public
static
void
main
(
String
...
args
)
{
int
errors
=
0
;
Class
<?
extends
Annotation
>
annotationType
=
Annotation
.
class
;
String
elementName
=
"name"
;
try
{
Object
o
=
new
IncompleteAnnotationException
(
null
,
null
);
errors
++;
}
catch
(
NullPointerException
npe
)
{
;
// Expected
}
try
{
Object
o
=
new
IncompleteAnnotationException
(
annotationType
,
null
);
errors
++;
}
catch
(
NullPointerException
npe
)
{
;
// Expected
}
try
{
Object
o
=
new
IncompleteAnnotationException
(
null
,
elementName
);
errors
++;
}
catch
(
NullPointerException
npe
)
{
;
// Expected
}
if
(
errors
!=
0
)
throw
new
RuntimeException
(
"Encountered "
+
errors
+
" error(s) during construction."
);
}
}
test/java/lang/management/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java
浏览文件 @
82d12eca
...
...
@@ -29,7 +29,7 @@
* @author Luis-Miguel Alventosa
* @run clean MBeanServerMXBeanUnsupportedTest
* @run build MBeanServerMXBeanUnsupportedTest
* @run main MBeanServerMXBeanUnsupportedTest
* @run main
/othervm
MBeanServerMXBeanUnsupportedTest
*/
import
java.lang.management.ManagementFactory
;
...
...
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
浏览文件 @
82d12eca
此差异已折叠。
点击以展开。
test/java/security/BasicPermission/PermClass.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001,
2011,
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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4511601
* @bug 4511601
7054918
* @summary BasicPermissionCollection does not set permClass
* during deserialization
*/
...
...
@@ -55,59 +55,66 @@ public class PermClass {
// read in a 1.2.1 BasicPermissionCollection
File
sFile
=
new
File
(
dir
,
"PermClass.1.2.1"
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
sFile
));
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.2.1 collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.2.1 test passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.2.1 test failed"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
sFile
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.2.1 collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.2.1 test passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.2.1 test failed"
);
}
}
// read in a 1.3.1 BasicPermissionCollection
sFile
=
new
File
(
dir
,
"PermClass.1.3.1"
);
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
sFile
));
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.3.1 collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.3.1 test passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.3.1 test failed"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
sFile
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.3.1 collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.3.1 test passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.3.1 test failed"
);
}
}
// read in a 1.4 BasicPermissionCollection
sFile
=
new
File
(
dir
,
"PermClass.1.4"
);
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
sFile
));
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.4 collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.4 test 1 passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.4 test 1 failed"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
sFile
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.4 collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.4 test 1 passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.4 test 1 failed"
);
}
}
// write out current BasicPermissionCollection
PermissionCollection
bpc
=
mp
.
newPermissionCollection
();
bpc
.
add
(
mp
);
sFile
=
new
File
(
dir
,
"PermClass.current"
);
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
new
FileOutputStream
(
"PermClass.current"
));
oos
.
writeObject
(
bpc
);
oos
.
close
();
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
"PermClass.current"
);
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
fos
))
{
oos
.
writeObject
(
bpc
);
}
// read in current BasicPermissionCollection
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
"PermClass.current"
));
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"current collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.4 test 2 passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.4 test 2 failed"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
"PermClass.current"
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"current collection = "
+
pc
);
if
(
pc
.
implies
(
mp
))
{
System
.
out
.
println
(
"JDK 1.4 test 2 passed"
);
}
else
{
throw
new
Exception
(
"JDK 1.4 test 2 failed"
);
}
}
}
}
...
...
test/java/security/BasicPermission/SerialVersion.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001,
2011,
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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4502729
* @bug 4502729
7054918
* @summary BasicPermissionCollection serial version UID incorrect
*/
...
...
@@ -36,40 +36,44 @@ public class SerialVersion {
String
dir
=
System
.
getProperty
(
"test.src"
);
File
sFile
=
new
File
(
dir
,
"SerialVersion.1.2.1"
);
// read in a 1.2.1 BasicPermissionCollection
ObjectInputStream
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
sFile
));
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.2.1 collection = "
+
pc
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
sFile
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.2.1 collection = "
+
pc
);
}
// read in a 1.3.1 BasicPermissionCollection
sFile
=
new
File
(
dir
,
"SerialVersion.1.3.1"
);
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
sFile
));
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.3.1 collection = "
+
pc
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
sFile
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.3.1 collection = "
+
pc
);
}
// read in a 1.4 BasicPermissionCollection
sFile
=
new
File
(
dir
,
"SerialVersion.1.4"
);
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
sFile
));
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.4 collection = "
+
pc
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
sFile
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"1.4 collection = "
+
pc
);
}
// write out current BasicPermissionCollection
MyPermission
mp
=
new
MyPermission
(
"SerialVersionTest"
);
PermissionCollection
bpc
=
mp
.
newPermissionCollection
();
sFile
=
new
File
(
dir
,
"SerialVersion.current"
);
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
new
FileOutputStream
(
"SerialVersion.current"
));
oos
.
writeObject
(
bpc
);
oos
.
close
();
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
"SerialVersion.current"
);
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
fos
))
{
oos
.
writeObject
(
bpc
);
}
// read in current BasicPermissionCollection
ois
=
new
ObjectInputStream
(
new
FileInputStream
(
"SerialVersion.current"
));
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"current collection = "
+
pc
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
"SerialVersion.current"
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
))
{
PermissionCollection
pc
=
(
PermissionCollection
)
ois
.
readObject
();
System
.
out
.
println
(
"current collection = "
+
pc
);
}
}
}
...
...
test/java/security/KeyFactory/Failover.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -23,7 +23,8 @@
/**
* @test
* @bug 4894125
* @bug 4894125 7054918
* @library ../testlibrary
* @summary test that failover for KeyFactory works
* @author Andreas Sterbenz
*/
...
...
@@ -37,6 +38,15 @@ import java.security.spec.*;
public
class
Failover
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
Security
.
insertProviderAt
(
new
ProviderFail
(),
1
);
Security
.
addProvider
(
new
ProviderPass
());
System
.
out
.
println
(
Arrays
.
asList
(
Security
.
getProviders
()));
...
...
test/java/security/KeyPairGenerator/Failover.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
2011,
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
...
...
@@ -23,7 +23,8 @@
/**
* @test
* @bug 4894125
* @bug 4894125 7054918
* @library ../testlibrary
* @summary test that failover for KeyPairGenerator works
* @author Andreas Sterbenz
*/
...
...
@@ -37,6 +38,15 @@ import java.security.spec.*;
public
class
Failover
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
Security
.
insertProviderAt
(
new
ProviderFail
(),
1
);
Security
.
addProvider
(
new
ProviderPass
());
System
.
out
.
println
(
Arrays
.
asList
(
Security
.
getProviders
()));
...
...
test/java/security/Provider/ChangeProviders.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
2011,
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
...
...
@@ -23,7 +23,8 @@
/*
* @test
* @bug 4856968
* @bug 4856968 7054918
* @library ../testlibrary
* @summary make sure add/insert/removeProvider() work correctly
* @author Andreas Sterbenz
*/
...
...
@@ -43,6 +44,15 @@ public class ChangeProviders extends Provider {
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
long
start
=
System
.
currentTimeMillis
();
Provider
p
=
new
ChangeProviders
();
...
...
test/java/security/Provider/GetInstance.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -23,7 +23,8 @@
/*
* @test
* @bug 4856968
* @bug 4856968 7054918
* @library ../testlibrary
* @summary make sure getInstance() works correctly, including failover
* and delayed provider selection for Signatures
* @author Andreas Sterbenz
...
...
@@ -43,6 +44,15 @@ public class GetInstance {
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
long
start
=
System
.
currentTimeMillis
();
Provider
foo
=
new
FooProvider
();
...
...
test/java/security/Provider/RemoveProvider.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
2011,
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
...
...
@@ -23,7 +23,8 @@
/*
* @test
* @bug 4190873
* @bug 4190873 7054918
* @library ../testlibrary
* @summary Make sure provider instance can be removed from list of registered
* providers, and "entrySet", "keySet", and "values" methods don't loop
* indefinitely.
...
...
@@ -34,6 +35,15 @@ import java.util.*;
public
class
RemoveProvider
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
// Add provider 1
Provider
p1
=
new
MyProvider
(
"name1"
,
1
,
""
);
...
...
test/java/security/Provider/Turkish.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2005, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
1
, 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
...
...
@@ -23,9 +23,8 @@
/**
* @test
* @bug 6220064
* @bug 6220064
7054918
* @summary make sure everything works ok in the Turkish local (dotted/dotless i problem)
* @run main/othervm Turkish
* @author Andreas Sterbenz
*/
...
...
@@ -41,54 +40,59 @@ public class Turkish {
Provider
p1
=
new
TProvider
(
"T1"
);
System
.
out
.
println
(
p1
.
getServices
());
// trigger service parsing
Locale
.
setDefault
(
new
Locale
(
"tr"
,
"TR"
));
Locale
loc
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
new
Locale
(
"tr"
,
"TR"
));
Provider
p2
=
new
TProvider
(
"T2"
);
System
.
out
.
println
(
p2
.
getServices
());
// trigger service parsing
Provider
p2
=
new
TProvider
(
"T2"
);
System
.
out
.
println
(
p2
.
getServices
());
// trigger service parsing
System
.
out
.
println
(
Signature
.
getInstance
(
"MD5withRSA"
));
System
.
out
.
println
(
Signature
.
getInstance
(
"md5withrsa"
));
System
.
out
.
println
(
Signature
.
getInstance
(
"MD5WITHRSA"
));
Service
s1
,
s2
;
s1
=
p1
.
getService
(
"Signature"
,
"MD5withRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p1
.
getService
(
"Signature"
,
"md5withrsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"MD5WITHRSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"MD5RSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"md5rsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"MD5rsa"
));
System
.
out
.
println
(
Signature
.
getInstance
(
"MD5withRSA"
));
System
.
out
.
println
(
Signature
.
getInstance
(
"md5withrsa"
));
System
.
out
.
println
(
Signature
.
getInstance
(
"MD5WITHRSA"
));
Service
s1
,
s2
;
s1
=
p1
.
getService
(
"Signature"
,
"MD5withRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p1
.
getService
(
"Signature"
,
"md5withrsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"MD5WITHRSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"MD5RSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"md5rsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"MD5rsa"
));
s1
=
p1
.
getService
(
"Signature"
,
"SHAwithRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p1
.
getService
(
"Signature"
,
"shawithrsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHAWITHRSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHARSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"sharsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHArsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHA1RSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"sha1rsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHA1rsa"
));
s1
=
p1
.
getService
(
"Signature"
,
"SHAwithRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p1
.
getService
(
"Signature"
,
"shawithrsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHAWITHRSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHARSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"sharsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHArsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHA1RSA"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"sha1rsa"
));
check
(
s1
,
p1
.
getService
(
"Signature"
,
"SHA1rsa"
));
s1
=
p2
.
getService
(
"Signature"
,
"MD5withRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p2
.
getService
(
"Signature"
,
"md5withrsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"MD5WITHRSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"MD5RSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"md5rsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"MD5rsa"
));
s1
=
p2
.
getService
(
"Signature"
,
"MD5withRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p2
.
getService
(
"Signature"
,
"md5withrsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"MD5WITHRSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"MD5RSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"md5rsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"MD5rsa"
));
s1
=
p2
.
getService
(
"Signature"
,
"SHAwithRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p2
.
getService
(
"Signature"
,
"shawithrsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHAWITHRSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHARSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"sharsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHArsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHA1RSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"sha1rsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHA1rsa"
));
s1
=
p2
.
getService
(
"Signature"
,
"SHAwithRSA"
);
check
(
s1
,
null
);
check
(
s1
,
p2
.
getService
(
"Signature"
,
"shawithrsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHAWITHRSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHARSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"sharsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHArsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHA1RSA"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"sha1rsa"
));
check
(
s1
,
p2
.
getService
(
"Signature"
,
"SHA1rsa"
));
System
.
out
.
println
(
"OK"
);
System
.
out
.
println
(
"OK"
);
}
finally
{
Locale
.
setDefault
(
loc
);
}
}
private
static
void
check
(
Service
s1
,
Service
s2
)
throws
Exception
{
...
...
test/java/security/SecureClassLoader/DefineClassByteBuffer.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
2011,
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
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4894899
* @bug 4894899
7054428
* @summary Test various cases of passing java.nio.ByteBuffers
* to defineClass().
*
...
...
@@ -46,6 +46,17 @@ public class DefineClassByteBuffer {
}
public
static
void
main
(
String
arg
[])
throws
Exception
{
// Rename the compiled TestClass.class file to something else,
// otherwise it would be loaded by the parent class loader and
// DummyClassLoader will never be used, especially in /othervm mode.
File
oldFile
=
new
File
(
System
.
getProperty
(
"test.classes"
,
"."
),
"TestClass.class"
);
File
newFile
=
new
File
(
System
.
getProperty
(
"test.classes"
,
"."
),
"CLAZZ"
);
oldFile
.
renameTo
(
newFile
);
ClassLoader
[]
cls
=
new
ClassLoader
[
DummyClassLoader
.
MAX_TYPE
];
for
(
int
i
=
0
;
i
<
cls
.
length
;
i
++)
{
cls
[
i
]
=
new
DummyClassLoader
(
i
);
...
...
@@ -54,7 +65,11 @@ public class DefineClassByteBuffer {
/* Create several instances of the class using different classloaders,
which are using different types of ByteBuffer. */
for
(
int
i
=
0
;
i
<
cls
.
length
;
i
++)
{
test
(
cls
[
i
]);
test
(
cls
[
i
]);
}
if
(
DummyClassLoader
.
count
!=
cls
.
length
)
{
throw
new
Exception
(
"DummyClassLoader not always used"
);
}
}
...
...
@@ -75,6 +90,8 @@ public class DefineClassByteBuffer {
int
loaderType
;
static
int
count
=
0
;
DummyClassLoader
(
int
loaderType
)
{
this
.
loaderType
=
loaderType
;
}
...
...
@@ -84,10 +101,11 @@ public class DefineClassByteBuffer {
static
ByteBuffer
readClassFile
(
String
name
)
{
try
{
File
f
=
new
File
(
System
.
getProperty
(
"test.classes"
,
"."
),
name
);
FileInputStream
fin
=
new
FileInputStream
(
f
);
FileChannel
fc
=
fin
.
getChannel
();
return
fc
.
map
(
FileChannel
.
MapMode
.
READ_ONLY
,
0
,
fc
.
size
());
"CLAZZ"
);
try
(
FileInputStream
fin
=
new
FileInputStream
(
f
);
FileChannel
fc
=
fin
.
getChannel
())
{
return
fc
.
map
(
FileChannel
.
MapMode
.
READ_ONLY
,
0
,
fc
.
size
());
}
}
catch
(
FileNotFoundException
e
)
{
throw
new
RuntimeException
(
"Can't open file: "
+
name
,
e
);
}
catch
(
IOException
e
)
{
...
...
@@ -101,12 +119,16 @@ public class DefineClassByteBuffer {
buffers. */
buffers
[
MAPPED_BUFFER
]
=
readClassFile
(
CLASS_NAME
+
".class"
);
byte
[]
array
=
new
byte
[
buffers
[
MAPPED_BUFFER
].
limit
()];
buffers
[
MAPPED_BUFFER
].
get
(
array
);
buffers
[
MAPPED_BUFFER
].
flip
();
buffers
[
DIRECT_BUFFER
]
=
ByteBuffer
.
allocateDirect
(
array
.
length
);
buffers
[
DIRECT_BUFFER
].
put
(
array
);
buffers
[
DIRECT_BUFFER
].
flip
();
buffers
[
ARRAY_BUFFER
]
=
ByteBuffer
.
allocate
(
array
.
length
);
buffers
[
ARRAY_BUFFER
].
put
(
array
);
buffers
[
ARRAY_BUFFER
].
flip
();
buffers
[
WRAPPED_BUFFER
]
=
ByteBuffer
.
wrap
(
array
);
...
...
@@ -121,6 +143,7 @@ public class DefineClassByteBuffer {
public
Class
findClass
(
String
name
)
{
CodeSource
cs
=
null
;
count
++;
return
defineClass
(
name
,
buffers
[
loaderType
],
cs
);
}
}
/* DummyClassLoader */
...
...
test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
浏览文件 @
82d12eca
#!/bin/sh
#
# Copyright (c) 2009, 201
0
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 201
1
, 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
...
...
@@ -58,6 +58,10 @@ case "$OS" in
PATHSEP
=
":"
FILESEP
=
"/"
;;
CYGWIN
*
)
PATHSEP
=
";"
FILESEP
=
"/"
;;
Windows
*
)
PATHSEP
=
";"
FILESEP
=
"
\\
"
...
...
test/java/security/Security/NoInstalledProviders.java
浏览文件 @
82d12eca
...
...
@@ -23,7 +23,8 @@
/*
* @test
* @bug 4273454 7052537
* @bug 4273454 7054918 7052537
* @library ../testlibrary
* @summary Make sure getProviders(filter) doesn't throw NPE
* @run main/othervm NoInstalledProviders
*/
...
...
@@ -32,7 +33,16 @@ import java.security.*;
public
class
NoInstalledProviders
{
public
static
void
main
(
String
[]
argv
)
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
Provider
[]
provs
=
Security
.
getProviders
();
// make sure there are no providers in the system
...
...
test/java/security/Security/SynchronizedAccess.java
浏览文件 @
82d12eca
/*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999,
2011,
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
...
...
@@ -23,7 +23,8 @@
/*
* @test
* @bug 4162583
* @bug 4162583 7054918
* @library ../testlibrary
* @summary Make sure Provider api implementations are synchronized properly
*/
...
...
@@ -31,7 +32,16 @@ import java.security.*;
public
class
SynchronizedAccess
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
AccessorThread
[]
acc
=
new
AccessorThread
[
200
];
for
(
int
i
=
0
;
i
<
acc
.
length
;
i
++)
acc
[
i
]
=
new
AccessorThread
(
"thread"
+
i
);
...
...
test/java/security/Security/removing/RemoveProviders.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
2011,
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
...
...
@@ -23,7 +23,8 @@
/**
* @test
* @bug 4963416
* @bug 4963416 7054918
* @library ../../testlibrary
* @summary make sure removeProvider() always works correctly
* @author Andreas Sterbenz
*/
...
...
@@ -35,6 +36,15 @@ import java.security.*;
public
class
RemoveProviders
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
Provider
[]
providers
=
Security
.
getProviders
();
System
.
out
.
println
(
"Providers: "
+
Arrays
.
asList
(
providers
));
...
...
test/java/security/UnresolvedPermission/Equals.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002,
2011,
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
...
...
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4513737
* @run main/othervm Equals
* @summary UnresolvedPermission.equals() throws NullPointerException
*/
...
...
test/java/security/spec/EllipticCurveMatch.java
浏览文件 @
82d12eca
...
...
@@ -25,13 +25,12 @@
* @test
* @bug 6738532
* @summary Check EllipticCurve.equals() does not compare seed value of curve.
* @run main/othervm EllipticCurveMatch
* @author Mike StJohns
*/
import
java.security.spec.*
;
import
java.math.BigInteger
;
import
java.
security.Secure
Random
;
import
java.
util.
Random
;
public
class
EllipticCurveMatch
{
static
String
primeP256
=
...
...
@@ -45,7 +44,7 @@ public class EllipticCurveMatch {
private
static
EllipticCurve
addSeedToCurve
(
EllipticCurve
curve
)
{
SecureRandom
rand
=
new
Secure
Random
();
Random
rand
=
new
Random
();
byte
[]
seed
=
new
byte
[
12
];
rand
.
nextBytes
(
seed
);
...
...
test/java/security/testlibrary/ProvidersSnapshot.java
0 → 100644
浏览文件 @
82d12eca
/*
* Copyright (c) 2011, 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.security.Provider
;
import
java.security.Security
;
public
class
ProvidersSnapshot
{
private
Provider
[]
oldProviders
;
private
ProvidersSnapshot
()
{
oldProviders
=
Security
.
getProviders
();
}
public
static
ProvidersSnapshot
create
()
{
return
new
ProvidersSnapshot
();
}
public
void
restore
()
{
Provider
[]
newProviders
=
Security
.
getProviders
();
for
(
Provider
p:
newProviders
)
{
Security
.
removeProvider
(
p
.
getName
());
}
for
(
Provider
p:
oldProviders
)
{
Security
.
addProvider
(
p
);
}
}
}
test/java/util/logging/LoggerResourceBundleRace.java
0 → 100644
浏览文件 @
82d12eca
/*
* Copyright (c) 2011, 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 7045594
* @summary ResourceBundle setting race in Logger.getLogger(name, rbName)
* @author Daniel D. Daugherty
* @build RacingThreadsTest LoggerResourceBundleRace
* @run main LoggerResourceBundleRace
*/
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.ListResourceBundle
;
import
java.util.logging.Logger
;
import
java.util.MissingResourceException
;
import
java.util.ResourceBundle
;
public
class
LoggerResourceBundleRace
extends
RacingThreadsTest
{
private
final
static
int
N_LOOPS
=
500000
;
// # of race loops
private
final
static
int
N_SECS
=
15
;
// # of secs to run test
// # of parallel threads; must match number of MyResources inner classes
private
final
static
int
N_THREADS
=
3
;
private
final
static
String
LOGGER_PREFIX
=
"myLogger-"
;
private
final
static
String
RESOURCE_PREFIX
=
"LoggerResourceBundleRace$MyResources"
;
// these counters are AtomicInteger since any worker thread can increment
private
final
static
AtomicInteger
iaeCnt
=
new
AtomicInteger
();
private
final
static
AtomicInteger
worksCnt
=
new
AtomicInteger
();
Logger
dummy
;
// dummy Logger
LoggerResourceBundleRace
(
String
name
,
int
n_threads
,
int
n_loops
,
int
n_secs
)
{
super
(
name
,
n_threads
,
n_loops
,
n_secs
);
}
// Main test driver
//
public
static
void
main
(
String
[]
args
)
{
LoggerResourceBundleRace
test
=
new
LoggerResourceBundleRace
(
"LoggerResourceBundleRace"
,
N_THREADS
,
N_LOOPS
,
N_SECS
);
test
.
setVerbose
(
Boolean
.
getBoolean
(
"LoggerResourceBundleRace.verbose"
));
DriverThread
driver
=
new
DriverThread
(
test
);
MyWorkerThread
[]
workers
=
new
MyWorkerThread
[
N_THREADS
];
for
(
int
i
=
0
;
i
<
workers
.
length
;
i
++)
{
workers
[
i
]
=
new
MyWorkerThread
(
i
,
test
);
}
test
.
runTest
(
driver
,
workers
);
}
public
void
oneTimeDriverInit
(
DriverThread
dt
)
{
super
.
oneTimeDriverInit
(
dt
);
dummy
=
null
;
}
public
void
perRaceDriverInit
(
DriverThread
dt
)
{
super
.
perRaceDriverInit
(
dt
);
// - allocate a new dummy Logger without a ResourceBundle;
// this gives the racing threads less to do
// - reset the counters
dummy
=
Logger
.
getLogger
(
LOGGER_PREFIX
+
getLoopCnt
());
iaeCnt
.
set
(
0
);
worksCnt
.
set
(
0
);
}
public
void
executeRace
(
WorkerThread
wt
)
{
super
.
executeRace
(
wt
);
Logger
myLogger
=
null
;
try
{
MyWorkerThread
mwt
=
(
MyWorkerThread
)
wt
;
// short hand
// Here is the race:
// - the target Logger object has already been created by
// the DriverThread without a ResourceBundle name
// - in parallel, each WorkerThread calls Logger.getLogger()
// with a different ResourceBundle name
// - Logger.getLogger() should only successfully set the
// ResourceBundle name for one WorkerThread; all other
// WorkerThread calls to Logger.getLogger() should throw
// IllegalArgumentException
myLogger
=
Logger
.
getLogger
(
LOGGER_PREFIX
+
getLoopCnt
(),
mwt
.
rbName
);
if
(
myLogger
.
getResourceBundleName
().
equals
(
mwt
.
rbName
))
{
// no exception and the ResourceBundle names match
worksCnt
.
incrementAndGet
();
// ignore return
}
else
{
System
.
err
.
println
(
wt
.
getName
()
+
": ERROR: expected ResourceBundleName '"
+
mwt
.
rbName
+
"' does not match actual '"
+
myLogger
.
getResourceBundleName
()
+
"'"
);
incAndGetFailCnt
();
// ignore return
}
}
catch
(
IllegalArgumentException
iae
)
{
iaeCnt
.
incrementAndGet
();
// ignore return
}
catch
(
MissingResourceException
mre
)
{
// This exception happens when N_THREADS above does not
// match the number of MyResources inner classes below.
// We exit since this is a coding error.
unexpectedException
(
wt
,
mre
);
System
.
exit
(
2
);
}
}
public
void
checkRaceResults
(
DriverThread
dt
)
{
super
.
checkRaceResults
(
dt
);
if
(
worksCnt
.
get
()
!=
1
)
{
System
.
err
.
println
(
dt
.
getName
()
+
": ERROR: worksCnt should be 1"
+
": loopCnt="
+
getLoopCnt
()
+
", worksCnt="
+
worksCnt
.
get
());
incAndGetFailCnt
();
// ignore return
}
else
if
(
iaeCnt
.
get
()
!=
N_THREADS
-
1
)
{
System
.
err
.
println
(
dt
.
getName
()
+
": ERROR: iaeCnt should be "
+
(
N_THREADS
-
1
)
+
": loopCnt="
+
getLoopCnt
()
+
", iaeCnt="
+
iaeCnt
.
get
());
incAndGetFailCnt
();
// ignore return
}
}
public
void
oneTimeDriverEpilog
(
DriverThread
dt
)
{
super
.
oneTimeDriverEpilog
(
dt
);
// Use the dummy Logger after the testing loop to make sure that
// dummy doesn't get optimized away in the testing loop.
dummy
.
info
(
"This is a test message."
);
}
// N_THREADS above must match number of MyResources inner classes
//
public
static
class
MyResources0
extends
ListResourceBundle
{
final
static
Object
[][]
contents
=
{
{
"sample1"
,
"translation #1 for sample1"
},
{
"sample2"
,
"translation #1 for sample2"
},
};
public
Object
[][]
getContents
()
{
return
contents
;
}
}
public
static
class
MyResources1
extends
ListResourceBundle
{
final
static
Object
[][]
contents
=
{
{
"sample1"
,
"translation #2 for sample1"
},
{
"sample2"
,
"translation #2 for sample2"
},
};
public
Object
[][]
getContents
()
{
return
contents
;
}
}
public
static
class
MyResources2
extends
ListResourceBundle
{
final
static
Object
[][]
contents
=
{
{
"sample1"
,
"translation #3 for sample1"
},
{
"sample2"
,
"translation #3 for sample2"
},
};
public
Object
[][]
getContents
()
{
return
contents
;
}
}
// WorkerThread with a thread specific ResourceBundle name
//
public
static
class
MyWorkerThread
extends
WorkerThread
{
public
final
String
rbName
;
// ResourceBundle name
MyWorkerThread
(
int
workerNum
,
RacingThreadsTest
test
)
{
super
(
workerNum
,
test
);
rbName
=
RESOURCE_PREFIX
+
workerNum
;
}
}
}
test/java/util/logging/LoggingDeadlock3.java
浏览文件 @
82d12eca
...
...
@@ -27,7 +27,7 @@
* @summary Calling LogManager.addLogger() and Logger.getLogger() cause deadlock
* @author Serguei Spitsyn
* @build LoggingDeadlock3
* @run main/timeout=
15
LoggingDeadlock3
* @run main/timeout=
80
LoggingDeadlock3
*/
import
java.io.*
;
...
...
test/java/util/logging/RacingThreadsTest.java
0 → 100644
浏览文件 @
82d12eca
此差异已折叠。
点击以展开。
test/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -23,7 +23,8 @@
/**
* @test
* @bug 4508341
* @bug 4508341 7055362
* @library ../../../java/security/testlibrary
* @summary Test the error conditions of
* EncryptedPrivateKeyInfo.getKeySpec(...) methods.
* @author Valerie Peng
...
...
@@ -97,7 +98,16 @@ public class GetKeySpecException {
}
}
public
static
void
main
(
String
[]
argv
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
if
((
GOOD_PARAMS
==
null
)
||
(
BAD_PARAMS
==
null
))
{
throw
new
Exception
(
"Static parameter generation failed"
);
}
...
...
test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2006, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 20
11
, 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
...
...
@@ -23,7 +23,8 @@
/*
* @test
* @bug 6377058
* @bug 6377058 7055362
* @library ../../../java/security/testlibrary
* @summary SunJCE depends on sun.security.provider.SignatureImpl
* behaviour, BC can't load into 1st slot.
* @author Brad R. Wetmore
...
...
@@ -35,7 +36,16 @@ import java.io.*;
public
class
SunJCE_BC_LoadOrdering
{
public
static
void
main
(
String
args
[])
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProvidersSnapshot
snapshot
=
ProvidersSnapshot
.
create
();
try
{
main0
(
args
);
}
finally
{
snapshot
.
restore
();
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
/*
* Generate a random key, and encrypt the data
*/
...
...
test/sun/security/krb5/tools/ktmissing.sh
0 → 100644
浏览文件 @
82d12eca
此差异已折叠。
点击以展开。
test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
浏览文件 @
82d12eca
/*
* Copyright (c) 2002, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
1
, 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
...
...
@@ -25,10 +25,10 @@
* @test
* @bug 6313675 6323647
* @summary Verify that all ciphersuites work in FIPS mode
* @library ..
* @ignore JSSE supported cipher suites are changed with CR 6916074,
* need to update this test case in JDK 7 soon
* @author Andreas Sterbenz
* @library ..
*/
import
java.security.*
;
...
...
test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java
已删除
100644 → 0
浏览文件 @
36e719a1
此差异已折叠。
点击以展开。
test/tools/launcher/ExecutionEnvironment.java
浏览文件 @
82d12eca
此差异已折叠。
点击以展开。
test/tools/launcher/VersionCheck.java
浏览文件 @
82d12eca
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录