Merge
This commit is contained in:
commit
da29ed2a94
1
.hgtags
1
.hgtags
@ -322,3 +322,4 @@ eeea9adfd1e3d075ef82148c00a4847a1aab4d26 jdk9-b76
|
|||||||
c25e882cee9622ec75c4e9d60633539a2f0a8809 jdk9-b77
|
c25e882cee9622ec75c4e9d60633539a2f0a8809 jdk9-b77
|
||||||
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
|
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
|
||||||
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
|
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
|
||||||
|
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
|
||||||
|
@ -322,3 +322,4 @@ d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
|
|||||||
7972dc8f2a47f0c4cd8f02fa5662af41f028aa14 jdk9-b77
|
7972dc8f2a47f0c4cd8f02fa5662af41f028aa14 jdk9-b77
|
||||||
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
|
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
|
||||||
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
|
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
|
||||||
|
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
|
||||||
|
@ -41,5 +41,19 @@ RCDIR=`mktemp -dt jdk-build-logger.tmp.XXXXXX` || exit $?
|
|||||||
trap "rm -rf \"$RCDIR\"" EXIT
|
trap "rm -rf \"$RCDIR\"" EXIT
|
||||||
LOGFILE=$1
|
LOGFILE=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
# We need to handle command likes like "VAR1=val1 /usr/bin/cmd VAR2=val2".
|
||||||
|
# Do this by shifting away prepended variable assignments, and export them
|
||||||
|
# instead.
|
||||||
|
is_prefix=true
|
||||||
|
for opt; do
|
||||||
|
if [[ "$is_prefix" = true && "$opt" =~ ^.*=.*$ ]]; then
|
||||||
|
export $opt
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
is_prefix=false
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
|
(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
|
||||||
exit `cat "$RCDIR/rc"`
|
exit `cat "$RCDIR/rc"`
|
||||||
|
@ -322,3 +322,4 @@ d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
|
|||||||
8bb2441c0fec8b28f7bf11a0ca3ec1642e7ef457 jdk9-b77
|
8bb2441c0fec8b28f7bf11a0ca3ec1642e7ef457 jdk9-b77
|
||||||
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
|
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
|
||||||
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
|
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
|
||||||
|
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
|
||||||
|
@ -482,3 +482,4 @@ fff6b54e9770ac4c12c2fb4cab5aa7672affa4bd jdk9-b74
|
|||||||
e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
|
e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
|
||||||
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
|
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
|
||||||
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
|
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
|
||||||
|
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
|
||||||
|
@ -322,3 +322,4 @@ eadcb2b55cd1daf77625813aad0f6f3967b1528a jdk9-b74
|
|||||||
be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
|
be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
|
||||||
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
|
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
|
||||||
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
|
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
|
||||||
|
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
|
||||||
|
@ -325,3 +325,4 @@ f5911c6155c29ac24b6f9068273207e5ebd3a3df jdk9-b69
|
|||||||
bd6ece68cf8aca34c8d992569892060c82cfd3f1 jdk9-b77
|
bd6ece68cf8aca34c8d992569892060c82cfd3f1 jdk9-b77
|
||||||
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
|
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
|
||||||
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
|
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
|
||||||
|
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
|
||||||
|
@ -322,3 +322,4 @@ f376824d4940f45719d91838f3f6249f873440db jdk9-b72
|
|||||||
7fd081100f48828431e7c1bff65c906ee759069b jdk9-b77
|
7fd081100f48828431e7c1bff65c906ee759069b jdk9-b77
|
||||||
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
|
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
|
||||||
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
|
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
|
||||||
|
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
|
||||||
|
@ -25,5 +25,3 @@ Simple Build Instructions:
|
|||||||
5. Construct the images:
|
5. Construct the images:
|
||||||
cd make && gnumake images
|
cd make && gnumake images
|
||||||
The resulting JDK image should be found in build/*/j2sdk-image
|
The resulting JDK image should be found in build/*/j2sdk-image
|
||||||
|
|
||||||
|
|
||||||
|
@ -887,7 +887,8 @@ ifndef BUILD_HEADLESS_ONLY
|
|||||||
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
|
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
|
||||||
DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
|
DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
|
||||||
DISABLED_WARNINGS_clang := incompatible-pointer-types, \
|
DISABLED_WARNINGS_clang := incompatible-pointer-types, \
|
||||||
DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE, \
|
DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
|
||||||
|
E_STATEMENT_NOT_REACHED, \
|
||||||
DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
|
DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
|
||||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
|
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
|
||||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
|
@ -146,6 +146,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
|
|||||||
OPTIMIZATION := HIGH, \
|
OPTIMIZATION := HIGH, \
|
||||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||||
$(LIBJAVA_CFLAGS), \
|
$(LIBJAVA_CFLAGS), \
|
||||||
|
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
|
||||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
|
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
|
||||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||||
@ -307,7 +308,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
|
|||||||
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
|
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
|
||||||
OPTIMIZATION := HIGH, \
|
OPTIMIZATION := HIGH, \
|
||||||
CFLAGS := $(LIBJLI_CFLAGS), \
|
CFLAGS := $(LIBJLI_CFLAGS), \
|
||||||
DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
|
DISABLED_WARNINGS_solstudio := \
|
||||||
|
E_ASM_DISABLES_OPTIMIZATION \
|
||||||
|
E_STATEMENT_NOT_REACHED, \
|
||||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
|
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
|
||||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||||
|
@ -35,6 +35,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
|
|||||||
DISABLED_WARNINGS_gcc := format-nonliteral, \
|
DISABLED_WARNINGS_gcc := format-nonliteral, \
|
||||||
DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
|
DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
|
||||||
DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
|
DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
|
||||||
|
DISABLED_WARNINGS_solstudio := E_ARG_INCOMPATIBLE_WITH_ARG_L, \
|
||||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
|
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
|
||||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||||
|
@ -47,7 +47,7 @@ endif
|
|||||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||||
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
|
BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
|
||||||
BUILD_LIBNIO_EXFILES += \
|
BUILD_LIBNIO_EXFILES += \
|
||||||
GnomeFileTypeDetector.c \
|
GioFileTypeDetector.c \
|
||||||
#
|
#
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ SUNWprivate_1.1 {
|
|||||||
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
|
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
|
||||||
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
|
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
|
||||||
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
|
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
|
||||||
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
|
Java_sun_nio_fs_GioFileTypeDetector_initializeGio;
|
||||||
Java_sun_nio_fs_GnomeFileTypeDetector_probeGio;
|
Java_sun_nio_fs_GioFileTypeDetector_probeGio;
|
||||||
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
|
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
|
||||||
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
|
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
|
||||||
Java_sun_nio_fs_LinuxWatchService_eventSize;
|
Java_sun_nio_fs_LinuxWatchService_eventSize;
|
||||||
|
@ -130,8 +130,8 @@ SUNWprivate_1.1 {
|
|||||||
Java_sun_nio_ch_SolarisEventPort_port_1get;
|
Java_sun_nio_ch_SolarisEventPort_port_1get;
|
||||||
Java_sun_nio_ch_SolarisEventPort_port_1getn;
|
Java_sun_nio_ch_SolarisEventPort_port_1getn;
|
||||||
Java_sun_nio_ch_SolarisEventPort_port_1send;
|
Java_sun_nio_ch_SolarisEventPort_port_1send;
|
||||||
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
|
Java_sun_nio_fs_GioFileTypeDetector_initializeGio;
|
||||||
Java_sun_nio_fs_GnomeFileTypeDetector_probeGio;
|
Java_sun_nio_fs_GioFileTypeDetector_probeGio;
|
||||||
Java_sun_nio_fs_UnixNativeDispatcher_init;
|
Java_sun_nio_fs_UnixNativeDispatcher_init;
|
||||||
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
|
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
|
||||||
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
|
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
|
||||||
|
@ -23,5 +23,3 @@
|
|||||||
<a href="CLSFractal.java">The source</a>.
|
<a href="CLSFractal.java">The source</a>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,9 +14,3 @@
|
|||||||
<a href="XYZApp.java">The source</a>.
|
<a href="XYZApp.java">The source</a>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -106,7 +106,7 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider {
|
|||||||
new GetPropertyAction("user.home")), ".mime.types");
|
new GetPropertyAction("user.home")), ".mime.types");
|
||||||
Path etcMimeTypes = Paths.get("/etc/mime.types");
|
Path etcMimeTypes = Paths.get("/etc/mime.types");
|
||||||
|
|
||||||
return chain(new GnomeFileTypeDetector(),
|
return chain(new GioFileTypeDetector(),
|
||||||
new MimeTypesFileTypeDetector(userMimeTypes),
|
new MimeTypesFileTypeDetector(userMimeTypes),
|
||||||
new MimeTypesFileTypeDetector(etcMimeTypes),
|
new MimeTypesFileTypeDetector(etcMimeTypes),
|
||||||
new MagicFileTypeDetector());
|
new MagicFileTypeDetector());
|
||||||
|
@ -1611,8 +1611,13 @@ public class KeyStore {
|
|||||||
* First the keystore type is determined by probing the specified file.
|
* First the keystore type is determined by probing the specified file.
|
||||||
* Then a keystore object is instantiated and loaded using the data from
|
* Then a keystore object is instantiated and loaded using the data from
|
||||||
* that file.
|
* that file.
|
||||||
* A password may be supplied to unlock the keystore data or perform an
|
*
|
||||||
* integrity check.
|
* <p>
|
||||||
|
* A password may be given to unlock the keystore
|
||||||
|
* (e.g. the keystore resides on a hardware token device),
|
||||||
|
* or to check the integrity of the keystore data.
|
||||||
|
* If a password is not given for integrity checking,
|
||||||
|
* then integrity checking is not performed.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method traverses the list of registered security
|
* This method traverses the list of registered security
|
||||||
|
@ -60,8 +60,8 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
|
|||||||
\ -dsa | -disablesystemassertions\n\
|
\ -dsa | -disablesystemassertions\n\
|
||||||
\ disable system assertions\n\
|
\ disable system assertions\n\
|
||||||
\ -agentlib:<libname>[=<options>]\n\
|
\ -agentlib:<libname>[=<options>]\n\
|
||||||
\ load native agent library <libname>, e.g. -agentlib:hprof\n\
|
\ load native agent library <libname>, e.g. -agentlib:jdwp\n\
|
||||||
\ see also, -agentlib:jdwp=help and -agentlib:hprof=help\n\
|
\ see also -agentlib:jdwp=help\n\
|
||||||
\ -agentpath:<pathname>[=<options>]\n\
|
\ -agentpath:<pathname>[=<options>]\n\
|
||||||
\ load native agent library by full pathname\n\
|
\ load native agent library by full pathname\n\
|
||||||
\ -javaagent:<jarpath>[=<options>]\n\
|
\ -javaagent:<jarpath>[=<options>]\n\
|
||||||
|
@ -66,5 +66,3 @@ Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
|
|||||||
}
|
}
|
||||||
return adler;
|
return adler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -89,7 +89,7 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider {
|
|||||||
new GetPropertyAction("user.home")), ".mime.types");
|
new GetPropertyAction("user.home")), ".mime.types");
|
||||||
Path etcMimeTypes = Paths.get("/etc/mime.types");
|
Path etcMimeTypes = Paths.get("/etc/mime.types");
|
||||||
|
|
||||||
return chain(new GnomeFileTypeDetector(),
|
return chain(new GioFileTypeDetector(),
|
||||||
new MimeTypesFileTypeDetector(userMimeTypes),
|
new MimeTypesFileTypeDetector(userMimeTypes),
|
||||||
new MimeTypesFileTypeDetector(etcMimeTypes));
|
new MimeTypesFileTypeDetector(etcMimeTypes));
|
||||||
}
|
}
|
||||||
|
@ -275,6 +275,3 @@ message/rfc822: \
|
|||||||
application/xml: \
|
application/xml: \
|
||||||
description=XML document;\
|
description=XML document;\
|
||||||
file_extensions=.xml
|
file_extensions=.xml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ import java.security.PrivilegedAction;
|
|||||||
* MIME type of a file.
|
* MIME type of a file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class GnomeFileTypeDetector
|
public class GioFileTypeDetector
|
||||||
extends AbstractFileTypeDetector
|
extends AbstractFileTypeDetector
|
||||||
{
|
{
|
||||||
// true if GIO is available
|
// true if GIO is available
|
||||||
private final boolean gioAvailable;
|
private final boolean gioAvailable;
|
||||||
|
|
||||||
public GnomeFileTypeDetector() {
|
public GioFileTypeDetector() {
|
||||||
gioAvailable = initializeGio();
|
gioAvailable = initializeGio();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +67,10 @@ public class GnomeFileTypeDetector
|
|||||||
|
|
||||||
// GIO
|
// GIO
|
||||||
private static native boolean initializeGio();
|
private static native boolean initializeGio();
|
||||||
|
//
|
||||||
|
// The probeGIO() method is synchronized to avert potential problems
|
||||||
|
// such as crashes due to a suspected lack of thread safety in GIO.
|
||||||
|
//
|
||||||
private static synchronized native byte[] probeGio(long pathAddress);
|
private static synchronized native byte[] probeGio(long pathAddress);
|
||||||
|
|
||||||
static {
|
static {
|
@ -26,9 +26,11 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
#include "jni_util.h"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "io_util_md.h"
|
|
||||||
|
|
||||||
|
#include "io_util_md.h"
|
||||||
#include "java_io_FileDescriptor.h"
|
#include "java_io_FileDescriptor.h"
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@ -47,8 +49,8 @@ jfieldID IO_append_fdID;
|
|||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_java_io_FileDescriptor_initIDs(JNIEnv *env, jclass fdClass) {
|
Java_java_io_FileDescriptor_initIDs(JNIEnv *env, jclass fdClass) {
|
||||||
IO_fd_fdID = (*env)->GetFieldID(env, fdClass, "fd", "I");
|
CHECK_NULL(IO_fd_fdID = (*env)->GetFieldID(env, fdClass, "fd", "I"));
|
||||||
IO_append_fdID = (*env)->GetFieldID(env, fdClass, "append", "Z");
|
CHECK_NULL(IO_append_fdID = (*env)->GetFieldID(env, fdClass, "append", "Z"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
|
@ -73,11 +73,11 @@ static g_file_query_info_func g_file_query_info;
|
|||||||
static g_file_info_get_content_type_func g_file_info_get_content_type;
|
static g_file_info_get_content_type_func g_file_info_get_content_type;
|
||||||
|
|
||||||
|
|
||||||
#include "sun_nio_fs_GnomeFileTypeDetector.h"
|
#include "sun_nio_fs_GioFileTypeDetector.h"
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio
|
Java_sun_nio_fs_GioFileTypeDetector_initializeGio
|
||||||
(JNIEnv* env, jclass this)
|
(JNIEnv* env, jclass this)
|
||||||
{
|
{
|
||||||
void* gio_handle;
|
void* gio_handle;
|
||||||
@ -120,7 +120,7 @@ Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jbyteArray JNICALL
|
JNIEXPORT jbyteArray JNICALL
|
||||||
Java_sun_nio_fs_GnomeFileTypeDetector_probeGio
|
Java_sun_nio_fs_GioFileTypeDetector_probeGio
|
||||||
(JNIEnv* env, jclass this, jlong pathAddress)
|
(JNIEnv* env, jclass this, jlong pathAddress)
|
||||||
{
|
{
|
||||||
char* path = (char*)jlong_to_ptr(pathAddress);
|
char* path = (char*)jlong_to_ptr(pathAddress);
|
@ -272,5 +272,3 @@ message/rfc822: \
|
|||||||
application/xml: \
|
application/xml: \
|
||||||
description=XML document;\
|
description=XML document;\
|
||||||
file_extensions=.xml
|
file_extensions=.xml
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,5 +278,3 @@ public class CDataTransferer extends DataTransferer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1406,5 +1406,3 @@ JNF_COCOA_EXIT(env);
|
|||||||
|
|
||||||
return underMouse;
|
return underMouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,5 +80,3 @@ struct Format3AnchorTable : AnchorTable
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,5 +104,3 @@ public:
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,5 +63,3 @@ LE_VAR_ARRAY(CursiveAttachmentSubtable, entryExitRecords)
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,5 +61,3 @@ LE_VAR_ARRAY(DeviceTable, deltaValues)
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,5 +63,3 @@ private:
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,5 +62,3 @@ LE_VAR_ARRAY(MarkArray, markRecordArray)
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,5 +109,3 @@ LE_VAR_ARRAY(PairPositioningFormat2Subtable, class1RecordArray)
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,5 +71,3 @@ LE_VAR_ARRAY(SinglePositioningFormat2Subtable, valueRecordArray)
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,5 +68,3 @@ LE_VAR_ARRAY(SingleSubstitutionFormat2Subtable, substituteArray)
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,5 +129,3 @@ inline ThaiShaping::StateTransition ThaiShaping::getTransition(le_uint8 state, l
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,5 +94,3 @@ enum ValueFormatBits
|
|||||||
|
|
||||||
U_NAMESPACE_END
|
U_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1836,5 +1836,3 @@ cmsBool CMSEXPORT cmsPipelineEvalReverseFloat(cmsFloat32Number Target[],
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,5 +201,3 @@ void CMSEXPORT _cmsMAT3eval(cmsVEC3* r, const cmsMAT3* a, const cmsVEC3* v)
|
|||||||
r->n[VY] = a->v[1].n[VX]*v->n[VX] + a->v[1].n[VY]*v->n[VY] + a->v[1].n[VZ]*v->n[VZ];
|
r->n[VY] = a->v[1].n[VX]*v->n[VX] + a->v[1].n[VY]*v->n[VY] + a->v[1].n[VZ]*v->n[VZ];
|
||||||
r->n[VZ] = a->v[2].n[VX]*v->n[VX] + a->v[2].n[VY]*v->n[VY] + a->v[2].n[VZ]*v->n[VZ];
|
r->n[VZ] = a->v[2].n[VX]*v->n[VX] + a->v[2].n[VY]*v->n[VY] + a->v[2].n[VZ]*v->n[VZ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -989,5 +989,3 @@ void* CMSEXPORT cmsGetContextUserData(cmsContext ContextID)
|
|||||||
{
|
{
|
||||||
return _cmsContextGetClientChunk(ContextID, UserPtr);
|
return _cmsContextGetClientChunk(ContextID, UserPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,5 +376,3 @@ cmsBool CMSEXPORT cmsAdaptToIlluminant(cmsCIEXYZ* Result,
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,5 +84,3 @@ HRESULT DwmAPI::DwmGetWindowAttribute(HWND hwnd, DWORD dwAttribute,
|
|||||||
}
|
}
|
||||||
throw FunctionUnavailableException();
|
throw FunctionUnavailableException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,5 +131,3 @@ THINGS TO DO:
|
|||||||
|
|
||||||
2. Handle exceptions properly. The current code lacks error checking
|
2. Handle exceptions properly. The current code lacks error checking
|
||||||
and recovery. This leads to random runtime crashes.
|
and recovery. This leads to random runtime crashes.
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,8 +126,3 @@ Java Logging Overview</a>.
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -218,9 +218,19 @@ import java.util.Map;
|
|||||||
* <p>The <b>serialVersionUID</b> of this class is <code>1081892073854801359L</code>.
|
* <p>The <b>serialVersionUID</b> of this class is <code>1081892073854801359L</code>.
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
|
*
|
||||||
|
* @implNote The maximum allowed length of the domain name in this implementation
|
||||||
|
* is {@code Integer.MAX_VALUE/4}
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial") // don't complain serialVersionUID not constant
|
@SuppressWarnings("serial") // don't complain serialVersionUID not constant
|
||||||
public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
||||||
|
private static final int DOMAIN_PATTERN = 0x8000_0000;
|
||||||
|
private static final int PROPLIST_PATTERN = 0x4000_0000;
|
||||||
|
private static final int PROPVAL_PATTERN = 0x2000_0000;
|
||||||
|
|
||||||
|
private static final int FLAG_MASK = DOMAIN_PATTERN | PROPLIST_PATTERN |
|
||||||
|
PROPVAL_PATTERN;
|
||||||
|
private static final int DOMAIN_LENGTH_MASK = ~FLAG_MASK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A structure recording property structure and
|
* A structure recording property structure and
|
||||||
@ -364,12 +374,6 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
private transient Property[] _ca_array;
|
private transient Property[] _ca_array;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The length of the domain part of built objectname
|
|
||||||
*/
|
|
||||||
private transient int _domain_length = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The propertyList of built object name. Initialized lazily.
|
* The propertyList of built object name. Initialized lazily.
|
||||||
* Table that contains all the pairs (key,value) for this ObjectName.
|
* Table that contains all the pairs (key,value) for this ObjectName.
|
||||||
@ -377,21 +381,19 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
private transient Map<String,String> _propertyList;
|
private transient Map<String,String> _propertyList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* boolean that declares if this ObjectName domain part is a pattern
|
* This field encodes _domain_pattern, _property_list_pattern and
|
||||||
|
* _property_value_pattern booleans and _domain_length integer.
|
||||||
|
* <p>
|
||||||
|
* The following masks can be used to extract the value:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@linkplain ObjectName#DOMAIN_PATTERN}</li>
|
||||||
|
* <li>{@linkplain ObjectName#PROPLIST_PATTERN}</li>
|
||||||
|
* <li>{@linkplain ObjectName#PROPVAL_PATTERN}</li>
|
||||||
|
* <li>{@linkplain ObjectName#DOMAIN_LENGTH_MASK}</li>
|
||||||
|
* </ul>
|
||||||
|
* </p>.
|
||||||
*/
|
*/
|
||||||
private transient boolean _domain_pattern = false;
|
private transient int _compressed_storage = 0x0;
|
||||||
|
|
||||||
/**
|
|
||||||
* boolean that declares if this ObjectName contains a pattern on the
|
|
||||||
* key property list
|
|
||||||
*/
|
|
||||||
private transient boolean _property_list_pattern = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* boolean that declares if this ObjectName contains a pattern on the
|
|
||||||
* value of at least one key property
|
|
||||||
*/
|
|
||||||
private transient boolean _property_value_pattern = false;
|
|
||||||
|
|
||||||
// Instance private fields <=======================================
|
// Instance private fields <=======================================
|
||||||
|
|
||||||
@ -426,11 +428,11 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
_canonicalName = "*:*";
|
_canonicalName = "*:*";
|
||||||
_kp_array = _Empty_property_array;
|
_kp_array = _Empty_property_array;
|
||||||
_ca_array = _Empty_property_array;
|
_ca_array = _Empty_property_array;
|
||||||
_domain_length = 1;
|
setDomainLength(1);
|
||||||
_propertyList = null;
|
_propertyList = null;
|
||||||
_domain_pattern = true;
|
setDomainPattern(true);
|
||||||
_property_list_pattern = true;
|
setPropertyListPattern(true);
|
||||||
_property_value_pattern = false;
|
setPropertyValuePattern(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +450,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
while (index < len) {
|
while (index < len) {
|
||||||
switch (name_chars[index]) {
|
switch (name_chars[index]) {
|
||||||
case ':' :
|
case ':' :
|
||||||
_domain_length = index++;
|
setDomainLength(index++);
|
||||||
break domain_parsing;
|
break domain_parsing;
|
||||||
case '=' :
|
case '=' :
|
||||||
// ":" omission check.
|
// ":" omission check.
|
||||||
@ -469,7 +471,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
"Invalid character '\\n' in domain name");
|
"Invalid character '\\n' in domain name");
|
||||||
case '*' :
|
case '*' :
|
||||||
case '?' :
|
case '?' :
|
||||||
_domain_pattern = true;
|
setDomainPattern(true);
|
||||||
index++;
|
index++;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
@ -484,6 +486,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
"Key properties cannot be empty");
|
"Key properties cannot be empty");
|
||||||
|
|
||||||
// we have got the domain part, begins building of _canonicalName
|
// we have got the domain part, begins building of _canonicalName
|
||||||
|
int _domain_length = getDomainLength();
|
||||||
System.arraycopy(name_chars, 0, canonical_chars, 0, _domain_length);
|
System.arraycopy(name_chars, 0, canonical_chars, 0, _domain_length);
|
||||||
canonical_chars[_domain_length] = ':';
|
canonical_chars[_domain_length] = ':';
|
||||||
cname_index = _domain_length + 1;
|
cname_index = _domain_length + 1;
|
||||||
@ -500,20 +503,20 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
|
|
||||||
keys = new String[10];
|
keys = new String[10];
|
||||||
_kp_array = new Property[10];
|
_kp_array = new Property[10];
|
||||||
_property_list_pattern = false;
|
setPropertyListPattern(false);
|
||||||
_property_value_pattern = false;
|
setPropertyValuePattern(false);
|
||||||
|
|
||||||
while (index < len) {
|
while (index < len) {
|
||||||
c = name_chars[index];
|
c = name_chars[index];
|
||||||
|
|
||||||
// case of pattern properties
|
// case of pattern properties
|
||||||
if (c == '*') {
|
if (c == '*') {
|
||||||
if (_property_list_pattern)
|
if (isPropertyListPattern())
|
||||||
throw new MalformedObjectNameException(
|
throw new MalformedObjectNameException(
|
||||||
"Cannot have several '*' characters in pattern " +
|
"Cannot have several '*' characters in pattern " +
|
||||||
"property list");
|
"property list");
|
||||||
else {
|
else {
|
||||||
_property_list_pattern = true;
|
setPropertyListPattern(true);
|
||||||
if ((++index < len ) && (name_chars[index] != ','))
|
if ((++index < len ) && (name_chars[index] != ','))
|
||||||
throw new MalformedObjectNameException(
|
throw new MalformedObjectNameException(
|
||||||
"Invalid character found after '*': end of " +
|
"Invalid character found after '*': end of " +
|
||||||
@ -639,7 +642,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
if (!value_pattern) {
|
if (!value_pattern) {
|
||||||
prop = new Property(key_index, key_length, value_length);
|
prop = new Property(key_index, key_length, value_length);
|
||||||
} else {
|
} else {
|
||||||
_property_value_pattern = true;
|
setPropertyValuePattern(true);
|
||||||
prop = new PatternProperty(key_index, key_length, value_length);
|
prop = new PatternProperty(key_index, key_length, value_length);
|
||||||
}
|
}
|
||||||
key_name = name.substring(key_index, key_index + key_length);
|
key_name = name.substring(key_index, key_index + key_length);
|
||||||
@ -670,7 +673,8 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @exception MalformedObjectNameException The <code>domain</code>
|
* @exception MalformedObjectNameException The <code>domain</code>
|
||||||
* contains an illegal character, or one of the keys or values in
|
* contains an illegal character, or one of the keys or values in
|
||||||
* <code>table</code> contains an illegal character, or one of the
|
* <code>table</code> contains an illegal character, or one of the
|
||||||
* values in <code>table</code> does not follow the rules for quoting.
|
* values in <code>table</code> does not follow the rules for quoting,
|
||||||
|
* or the domain's length exceeds the maximum allowed length.
|
||||||
* @exception NullPointerException One of the parameters is null.
|
* @exception NullPointerException One of the parameters is null.
|
||||||
*/
|
*/
|
||||||
private void construct(String domain, Map<String,String> props)
|
private void construct(String domain, Map<String,String> props)
|
||||||
@ -696,7 +700,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
// init canonicalname
|
// init canonicalname
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append(domain).append(':');
|
sb.append(domain).append(':');
|
||||||
_domain_length = domain.length();
|
setDomainLength(domain.length());
|
||||||
|
|
||||||
// allocates the property array
|
// allocates the property array
|
||||||
int nb_props = props.size();
|
int nb_props = props.size();
|
||||||
@ -729,7 +733,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
key.length(),
|
key.length(),
|
||||||
value.length());
|
value.length());
|
||||||
} else {
|
} else {
|
||||||
_property_value_pattern = true;
|
setPropertyValuePattern(true);
|
||||||
prop = new PatternProperty(key_index,
|
prop = new PatternProperty(key_index,
|
||||||
key.length(),
|
key.length(),
|
||||||
value.length());
|
value.length());
|
||||||
@ -743,10 +747,10 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
char[] initial_chars = new char[len];
|
char[] initial_chars = new char[len];
|
||||||
sb.getChars(0, len, initial_chars, 0);
|
sb.getChars(0, len, initial_chars, 0);
|
||||||
char[] canonical_chars = new char[len];
|
char[] canonical_chars = new char[len];
|
||||||
System.arraycopy(initial_chars, 0, canonical_chars, 0,
|
int copyLen = getDomainLength() + 1;
|
||||||
_domain_length + 1);
|
System.arraycopy(initial_chars, 0, canonical_chars, 0, copyLen);
|
||||||
setCanonicalName(initial_chars, canonical_chars, keys, keys_map,
|
setCanonicalName(initial_chars, canonical_chars, keys, keys_map,
|
||||||
_domain_length + 1, _kp_array.length);
|
copyLen, _kp_array.length);
|
||||||
}
|
}
|
||||||
// Category : Instance construction <==============================
|
// Category : Instance construction <==============================
|
||||||
|
|
||||||
@ -822,7 +826,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// terminate canonicalname with '*' in case of pattern
|
// terminate canonicalname with '*' in case of pattern
|
||||||
if (_property_list_pattern) {
|
if (isPropertyListPattern()) {
|
||||||
if (_kp_array != _Empty_property_array)
|
if (_kp_array != _Empty_property_array)
|
||||||
canonical_chars[prop_index++] = ',';
|
canonical_chars[prop_index++] = ',';
|
||||||
canonical_chars[prop_index++] = '*';
|
canonical_chars[prop_index++] = '*';
|
||||||
@ -1051,13 +1055,32 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
return false;
|
return false;
|
||||||
case '*' :
|
case '*' :
|
||||||
case '?' :
|
case '?' :
|
||||||
_domain_pattern = true;
|
setDomainPattern(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getDomainLength() {
|
||||||
|
return _compressed_storage & DOMAIN_LENGTH_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates and sets the domain length
|
||||||
|
* @param length The domain length
|
||||||
|
* @throws MalformedObjectNameException
|
||||||
|
* When the given domain length exceeds the maximum allowed length
|
||||||
|
*/
|
||||||
|
private void setDomainLength(int length) throws MalformedObjectNameException {
|
||||||
|
if ((length & FLAG_MASK) != 0 ) {
|
||||||
|
throw new MalformedObjectNameException(
|
||||||
|
"Domain name too long. Maximum allowed domain name length is:" +
|
||||||
|
DOMAIN_LENGTH_MASK);
|
||||||
|
}
|
||||||
|
_compressed_storage = (_compressed_storage & FLAG_MASK) | length;
|
||||||
|
}
|
||||||
|
|
||||||
// Category : Internal accessors <==============================
|
// Category : Internal accessors <==============================
|
||||||
|
|
||||||
// Category : Serialization ----------------------------------->
|
// Category : Serialization ----------------------------------->
|
||||||
@ -1225,12 +1248,12 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
// Serializes this instance in the old serial form
|
// Serializes this instance in the old serial form
|
||||||
// Read CR 6441274 before making any changes to this code
|
// Read CR 6441274 before making any changes to this code
|
||||||
ObjectOutputStream.PutField fields = out.putFields();
|
ObjectOutputStream.PutField fields = out.putFields();
|
||||||
fields.put("domain", _canonicalName.substring(0, _domain_length));
|
fields.put("domain", _canonicalName.substring(0, getDomainLength()));
|
||||||
fields.put("propertyList", getKeyPropertyList());
|
fields.put("propertyList", getKeyPropertyList());
|
||||||
fields.put("propertyListString", getKeyPropertyListString());
|
fields.put("propertyListString", getKeyPropertyListString());
|
||||||
fields.put("canonicalName", _canonicalName);
|
fields.put("canonicalName", _canonicalName);
|
||||||
fields.put("pattern", (_domain_pattern || _property_list_pattern));
|
fields.put("pattern", (_compressed_storage & (DOMAIN_PATTERN | PROPLIST_PATTERN)) != 0);
|
||||||
fields.put("propertyPattern", _property_list_pattern);
|
fields.put("propertyPattern", isPropertyListPattern());
|
||||||
out.writeFields();
|
out.writeFields();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1291,7 +1314,8 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @exception MalformedObjectNameException The
|
* @exception MalformedObjectNameException The
|
||||||
* <code>domain</code>, <code>key</code>, or <code>value</code>
|
* <code>domain</code>, <code>key</code>, or <code>value</code>
|
||||||
* contains an illegal character, or <code>value</code> does not
|
* contains an illegal character, or <code>value</code> does not
|
||||||
* follow the rules for quoting.
|
* follow the rules for quoting, or the domain's length exceeds
|
||||||
|
* the maximum allowed length.
|
||||||
* @exception NullPointerException One of the parameters is null.
|
* @exception NullPointerException One of the parameters is null.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1322,7 +1346,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* contains an illegal character, or one of the keys or values in
|
* contains an illegal character, or one of the keys or values in
|
||||||
* <code>table</code> contains an illegal character, or one of the
|
* <code>table</code> contains an illegal character, or one of the
|
||||||
* values in <code>table</code> does not follow the rules for
|
* values in <code>table</code> does not follow the rules for
|
||||||
* quoting.
|
* quoting, or the domain's length exceeds the maximum allowed length.
|
||||||
* @exception NullPointerException One of the parameters is null.
|
* @exception NullPointerException One of the parameters is null.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1392,7 +1416,8 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @exception MalformedObjectNameException The
|
* @exception MalformedObjectNameException The
|
||||||
* <code>domain</code>, <code>key</code>, or <code>value</code>
|
* <code>domain</code>, <code>key</code>, or <code>value</code>
|
||||||
* contains an illegal character, or <code>value</code> does not
|
* contains an illegal character, or <code>value</code> does not
|
||||||
* follow the rules for quoting.
|
* follow the rules for quoting, or the domain's length exceeds
|
||||||
|
* the maximum allowed length.
|
||||||
* @exception NullPointerException One of the parameters is null.
|
* @exception NullPointerException One of the parameters is null.
|
||||||
*/
|
*/
|
||||||
public ObjectName(String domain, String key, String value)
|
public ObjectName(String domain, String key, String value)
|
||||||
@ -1417,7 +1442,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* contains an illegal character, or one of the keys or values in
|
* contains an illegal character, or one of the keys or values in
|
||||||
* <code>table</code> contains an illegal character, or one of the
|
* <code>table</code> contains an illegal character, or one of the
|
||||||
* values in <code>table</code> does not follow the rules for
|
* values in <code>table</code> does not follow the rules for
|
||||||
* quoting.
|
* quoting, or the domain's length exceeds the maximum allowed length.
|
||||||
* @exception NullPointerException One of the parameters is null.
|
* @exception NullPointerException One of the parameters is null.
|
||||||
*/
|
*/
|
||||||
public ObjectName(String domain, Hashtable<String,String> table)
|
public ObjectName(String domain, Hashtable<String,String> table)
|
||||||
@ -1443,9 +1468,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @return True if the name is a pattern, otherwise false.
|
* @return True if the name is a pattern, otherwise false.
|
||||||
*/
|
*/
|
||||||
public boolean isPattern() {
|
public boolean isPattern() {
|
||||||
return (_domain_pattern ||
|
return (_compressed_storage & FLAG_MASK) != 0;
|
||||||
_property_list_pattern ||
|
|
||||||
_property_value_pattern);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1455,7 +1478,20 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public boolean isDomainPattern() {
|
public boolean isDomainPattern() {
|
||||||
return _domain_pattern;
|
return (_compressed_storage & DOMAIN_PATTERN) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the object name as representing a pattern on the domain part.
|
||||||
|
* @param value {@code true} if the domain name is a pattern,
|
||||||
|
* {@code false} otherwise
|
||||||
|
*/
|
||||||
|
private void setDomainPattern(boolean value) {
|
||||||
|
if (value) {
|
||||||
|
_compressed_storage |= DOMAIN_PATTERN;
|
||||||
|
} else {
|
||||||
|
_compressed_storage &= ~DOMAIN_PATTERN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1468,7 +1504,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @return True if the name is a property pattern, otherwise false.
|
* @return True if the name is a property pattern, otherwise false.
|
||||||
*/
|
*/
|
||||||
public boolean isPropertyPattern() {
|
public boolean isPropertyPattern() {
|
||||||
return _property_list_pattern || _property_value_pattern;
|
return (_compressed_storage & (PROPVAL_PATTERN | PROPLIST_PATTERN)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1482,7 +1518,20 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public boolean isPropertyListPattern() {
|
public boolean isPropertyListPattern() {
|
||||||
return _property_list_pattern;
|
return (_compressed_storage & PROPLIST_PATTERN) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the object name as representing a pattern on the key property list.
|
||||||
|
* @param value {@code true} if the key property list is a pattern,
|
||||||
|
* {@code false} otherwise
|
||||||
|
*/
|
||||||
|
private void setPropertyListPattern(boolean value) {
|
||||||
|
if (value) {
|
||||||
|
_compressed_storage |= PROPLIST_PATTERN;
|
||||||
|
} else {
|
||||||
|
_compressed_storage &= ~PROPLIST_PATTERN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1497,7 +1546,20 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public boolean isPropertyValuePattern() {
|
public boolean isPropertyValuePattern() {
|
||||||
return _property_value_pattern;
|
return (_compressed_storage & PROPVAL_PATTERN) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the object name as representing a pattern on the value part.
|
||||||
|
* @param value {@code true} if the value part of at least one of the
|
||||||
|
* key properties is a pattern, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
private void setPropertyValuePattern(boolean value) {
|
||||||
|
if (value) {
|
||||||
|
_compressed_storage |= PROPVAL_PATTERN;
|
||||||
|
} else {
|
||||||
|
_compressed_storage &= ~PROPVAL_PATTERN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1563,7 +1625,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
* @return The domain.
|
* @return The domain.
|
||||||
*/
|
*/
|
||||||
public String getDomain() {
|
public String getDomain() {
|
||||||
return _canonicalName.substring(0, _domain_length);
|
return _canonicalName.substring(0, getDomainLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1640,8 +1702,8 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
|
|
||||||
// the size of the string is the canonical one minus domain
|
// the size of the string is the canonical one minus domain
|
||||||
// part and pattern part
|
// part and pattern part
|
||||||
final int total_size = _canonicalName.length() - _domain_length - 1
|
final int total_size = _canonicalName.length() - getDomainLength() - 1
|
||||||
- (_property_list_pattern?2:0);
|
- (isPropertyListPattern()?2:0);
|
||||||
|
|
||||||
final char[] dest_chars = new char[total_size];
|
final char[] dest_chars = new char[total_size];
|
||||||
final char[] value = _canonicalName.toCharArray();
|
final char[] value = _canonicalName.toCharArray();
|
||||||
@ -1665,7 +1727,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
final int total_size = _canonicalName.length();
|
final int total_size = _canonicalName.length();
|
||||||
final char[] dest_chars = new char[total_size];
|
final char[] dest_chars = new char[total_size];
|
||||||
final char[] value = _canonicalName.toCharArray();
|
final char[] value = _canonicalName.toCharArray();
|
||||||
final int offset = _domain_length+1;
|
final int offset = getDomainLength() + 1;
|
||||||
|
|
||||||
// copy "domain:" into dest_chars
|
// copy "domain:" into dest_chars
|
||||||
//
|
//
|
||||||
@ -1675,7 +1737,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
final int end = writeKeyPropertyListString(value,dest_chars,offset);
|
final int end = writeKeyPropertyListString(value,dest_chars,offset);
|
||||||
|
|
||||||
// Add ",*" if necessary
|
// Add ",*" if necessary
|
||||||
if (_property_list_pattern) {
|
if (isPropertyListPattern()) {
|
||||||
if (end == offset) {
|
if (end == offset) {
|
||||||
// Property list string is empty.
|
// Property list string is empty.
|
||||||
dest_chars[end] = '*';
|
dest_chars[end] = '*';
|
||||||
@ -1737,8 +1799,8 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
if (_ca_array.length == 0) return "";
|
if (_ca_array.length == 0) return "";
|
||||||
|
|
||||||
int len = _canonicalName.length();
|
int len = _canonicalName.length();
|
||||||
if (_property_list_pattern) len -= 2;
|
if (isPropertyListPattern()) len -= 2;
|
||||||
return _canonicalName.substring(_domain_length +1, len);
|
return _canonicalName.substring(getDomainLength() + 1, len);
|
||||||
}
|
}
|
||||||
// Category : Getter methods <===================================
|
// Category : Getter methods <===================================
|
||||||
|
|
||||||
@ -1944,22 +2006,18 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
|
|
||||||
if (name == null) throw new NullPointerException();
|
if (name == null) throw new NullPointerException();
|
||||||
|
|
||||||
if (name._domain_pattern ||
|
if (name.isPattern())
|
||||||
name._property_list_pattern ||
|
|
||||||
name._property_value_pattern)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// No pattern
|
// No pattern
|
||||||
if (!_domain_pattern &&
|
if (!isPattern())
|
||||||
!_property_list_pattern &&
|
|
||||||
!_property_value_pattern)
|
|
||||||
return _canonicalName.equals(name._canonicalName);
|
return _canonicalName.equals(name._canonicalName);
|
||||||
|
|
||||||
return matchDomains(name) && matchKeys(name);
|
return matchDomains(name) && matchKeys(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final boolean matchDomains(ObjectName name) {
|
private final boolean matchDomains(ObjectName name) {
|
||||||
if (_domain_pattern) {
|
if (isDomainPattern()) {
|
||||||
// wildmatch domains
|
// wildmatch domains
|
||||||
// This ObjectName is the pattern
|
// This ObjectName is the pattern
|
||||||
// The other ObjectName is the string.
|
// The other ObjectName is the string.
|
||||||
@ -1972,15 +2030,15 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
// If key property value pattern but not key property list
|
// If key property value pattern but not key property list
|
||||||
// pattern, then the number of key properties must be equal
|
// pattern, then the number of key properties must be equal
|
||||||
//
|
//
|
||||||
if (_property_value_pattern &&
|
if (isPropertyValuePattern() &&
|
||||||
!_property_list_pattern &&
|
!isPropertyListPattern() &&
|
||||||
(name._ca_array.length != _ca_array.length))
|
(name._ca_array.length != _ca_array.length))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If key property value pattern or key property list pattern,
|
// If key property value pattern or key property list pattern,
|
||||||
// then every property inside pattern should exist in name
|
// then every property inside pattern should exist in name
|
||||||
//
|
//
|
||||||
if (_property_value_pattern || _property_list_pattern) {
|
if (isPropertyPattern()) {
|
||||||
final Map<String,String> nameProps = name._getKeyPropertyList();
|
final Map<String,String> nameProps = name._getKeyPropertyList();
|
||||||
final Property[] props = _ca_array;
|
final Property[] props = _ca_array;
|
||||||
final String cn = _canonicalName;
|
final String cn = _canonicalName;
|
||||||
@ -1996,7 +2054,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
|||||||
if (v == null) return false;
|
if (v == null) return false;
|
||||||
// If this property is ok (same key, same value), go to next
|
// If this property is ok (same key, same value), go to next
|
||||||
//
|
//
|
||||||
if (_property_value_pattern && (p instanceof PatternProperty)) {
|
if (isPropertyValuePattern() && (p instanceof PatternProperty)) {
|
||||||
// wildmatch key property values
|
// wildmatch key property values
|
||||||
// p is the property pattern, v is the string
|
// p is the property pattern, v is the string
|
||||||
if (Util.wildmatch(v,p.getValueString(cn)))
|
if (Util.wildmatch(v,p.getValueString(cn)))
|
||||||
|
@ -132,7 +132,9 @@ public final class DelegationPermission extends BasicPermission
|
|||||||
* Checks if this Kerberos delegation permission object "implies" the
|
* Checks if this Kerberos delegation permission object "implies" the
|
||||||
* specified permission.
|
* specified permission.
|
||||||
* <P>
|
* <P>
|
||||||
* If none of the above are true, {@code implies} returns false.
|
* This method returns true if this {@code DelegationPermission}
|
||||||
|
* is equal to {@code p}, and returns false otherwise.
|
||||||
|
*
|
||||||
* @param p the permission to check against.
|
* @param p the permission to check against.
|
||||||
*
|
*
|
||||||
* @return true if the specified permission is implied by this object,
|
* @return true if the specified permission is implied by this object,
|
||||||
|
@ -179,7 +179,16 @@ public final class ServicePermission extends Permission
|
|||||||
* Checks if this Kerberos service permission object "implies" the
|
* Checks if this Kerberos service permission object "implies" the
|
||||||
* specified permission.
|
* specified permission.
|
||||||
* <P>
|
* <P>
|
||||||
* If none of the above are true, {@code implies} returns false.
|
* More specifically, this method returns true if all of the following
|
||||||
|
* are true (and returns false if any of them are not):
|
||||||
|
* <ul>
|
||||||
|
* <li> <i>p</i> is an instanceof {@code ServicePermission},
|
||||||
|
* <li> <i>p</i>'s actions are a proper subset of this
|
||||||
|
* {@code ServicePermission}'s actions,
|
||||||
|
* <li> <i>p</i>'s name is equal to this {@code ServicePermission}'s name
|
||||||
|
* or this {@code ServicePermission}'s name is "*".
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
* @param p the permission to check against.
|
* @param p the permission to check against.
|
||||||
*
|
*
|
||||||
* @return true if the specified permission is implied by this object,
|
* @return true if the specified permission is implied by this object,
|
||||||
|
@ -77,14 +77,17 @@ static void next_line(FILE *f) {
|
|||||||
static int get_totalticks(int which, ticks *pticks) {
|
static int get_totalticks(int which, ticks *pticks) {
|
||||||
FILE *fh;
|
FILE *fh;
|
||||||
uint64_t userTicks, niceTicks, systemTicks, idleTicks;
|
uint64_t userTicks, niceTicks, systemTicks, idleTicks;
|
||||||
|
uint64_t iowTicks = 0, irqTicks = 0, sirqTicks= 0;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if((fh = fopen("/proc/stat", "r")) == NULL) {
|
if((fh = fopen("/proc/stat", "r")) == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = fscanf(fh, "cpu " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64,
|
n = fscanf(fh, "cpu " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64 " "
|
||||||
&userTicks, &niceTicks, &systemTicks, &idleTicks);
|
DEC_64 " " DEC_64,
|
||||||
|
&userTicks, &niceTicks, &systemTicks, &idleTicks,
|
||||||
|
&iowTicks, &irqTicks, &sirqTicks);
|
||||||
|
|
||||||
// Move to next line
|
// Move to next line
|
||||||
next_line(fh);
|
next_line(fh);
|
||||||
@ -93,24 +96,30 @@ static int get_totalticks(int which, ticks *pticks) {
|
|||||||
if (which != -1) {
|
if (which != -1) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < which; i++) {
|
for (i = 0; i < which; i++) {
|
||||||
if (fscanf(fh, "cpu%*d " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64, &userTicks, &niceTicks, &systemTicks, &idleTicks) != 4) {
|
if (fscanf(fh, "cpu%*d " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64 " "
|
||||||
|
DEC_64 " " DEC_64 " " DEC_64,
|
||||||
|
&userTicks, &niceTicks, &systemTicks, &idleTicks,
|
||||||
|
&iowTicks, &irqTicks, &sirqTicks) < 4) {
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
next_line(fh);
|
next_line(fh);
|
||||||
}
|
}
|
||||||
n = fscanf(fh, "cpu%*d " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64 "\n",
|
n = fscanf(fh, "cpu%*d " DEC_64 " " DEC_64 " " DEC_64 " " DEC_64 " "
|
||||||
&userTicks, &niceTicks, &systemTicks, &idleTicks);
|
DEC_64 " " DEC_64 " " DEC_64 "\n",
|
||||||
|
&userTicks, &niceTicks, &systemTicks, &idleTicks,
|
||||||
|
&iowTicks, &irqTicks, &sirqTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
if (n != 4) {
|
if (n < 4) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
pticks->used = userTicks + niceTicks;
|
pticks->used = userTicks + niceTicks;
|
||||||
pticks->usedKernel = systemTicks;
|
pticks->usedKernel = systemTicks + irqTicks + sirqTicks;
|
||||||
pticks->total = userTicks + niceTicks + systemTicks + idleTicks;
|
pticks->total = userTicks + niceTicks + systemTicks + idleTicks +
|
||||||
|
iowTicks + irqTicks + sirqTicks;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -319,6 +319,9 @@ javax/sound/midi/Gervill/SoftProvider/GetDevice.java generic-all
|
|||||||
|
|
||||||
# jdk_time
|
# jdk_time
|
||||||
|
|
||||||
|
# 8134979
|
||||||
|
java/time/tck/java/time/chrono/TCKJapaneseChronology.java generic-all
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# jdk_tools
|
# jdk_tools
|
||||||
@ -384,6 +387,11 @@ sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all
|
|||||||
# 6456333
|
# 6456333
|
||||||
sun/tools/jps/TestJpsJarRelative.java generic-all
|
sun/tools/jps/TestJpsJarRelative.java generic-all
|
||||||
|
|
||||||
|
# 8134420
|
||||||
|
sun/tools/jps/TestJpsClass.java generic-all
|
||||||
|
sun/tools/jps/TestJpsJar.java generic-all
|
||||||
|
sun/tools/jps/TestJpsSanity.java generic-all
|
||||||
|
|
||||||
# 6734748
|
# 6734748
|
||||||
sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
|
sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ keys=2d dnd i18n intermittent randomness headful
|
|||||||
othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation java/lang/ProcessHandle
|
othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation java/lang/ProcessHandle
|
||||||
|
|
||||||
# Tests that cannot run concurrently
|
# Tests that cannot run concurrently
|
||||||
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi sun/tools/jps
|
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi
|
||||||
|
|
||||||
# Group definitions
|
# Group definitions
|
||||||
groups=TEST.groups [closed/TEST.groups]
|
groups=TEST.groups [closed/TEST.groups]
|
||||||
|
@ -374,5 +374,3 @@ class TestDialog extends Dialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}// TestDialog class
|
}// TestDialog class
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8048601
|
||||||
|
* @library ../
|
||||||
|
* @summary Test Blowfish cipher with different MODES and padding
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestCipherBlowfish extends TestCipher {
|
||||||
|
|
||||||
|
TestCipherBlowfish() throws NoSuchAlgorithmException {
|
||||||
|
super("Blowfish",
|
||||||
|
new String[]{"CBC", "CTR", "CTS", "ECB", "PCBC",
|
||||||
|
//CFBx
|
||||||
|
"CFB", "CFB8", "CFB16", "CFB24", "CFB32", "CFB40", "CFB48", "CFB56",
|
||||||
|
"CFB64",
|
||||||
|
//OFBx
|
||||||
|
"OFB", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40", "OFB48", "OFB56",
|
||||||
|
"OFB64"},
|
||||||
|
new String[]{"NoPaDDing", "PKCS5Padding"},
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
new TestCipherBlowfish().runAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8048601
|
||||||
|
* @library ../
|
||||||
|
* @summary Test DES/DESede cipher with different MODES and padding
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestCipherDES extends TestCipher {
|
||||||
|
|
||||||
|
TestCipherDES() {
|
||||||
|
super("DES",
|
||||||
|
new String[]{"CBC", "CTR", "CTS", "ECB", "PCBC",
|
||||||
|
//CFBx
|
||||||
|
"CFB", "CFB8", "CFB16", "CFB24", "CFB32", "CFB40", "CFB48", "CFB56",
|
||||||
|
"CFB64",
|
||||||
|
//OFBx
|
||||||
|
"OFB", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40", "OFB48", "OFB56",
|
||||||
|
"OFB64"},
|
||||||
|
new String[]{"NoPaDDing", "PKCS5Padding"});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
new TestCipherDES().runAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8048601
|
||||||
|
* @library ../
|
||||||
|
* @summary Test DES/DESede cipher with different MODES and padding
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestCipherDESede extends TestCipher {
|
||||||
|
|
||||||
|
TestCipherDESede() {
|
||||||
|
super("DESede",
|
||||||
|
new String[]{"CBC", "CTR", "CTS", "ECB", "PCBC",
|
||||||
|
//CFBx
|
||||||
|
"CFB", "CFB8", "CFB16", "CFB24", "CFB32", "CFB40", "CFB48", "CFB56",
|
||||||
|
"CFB64",
|
||||||
|
//OFBx
|
||||||
|
"OFB", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40", "OFB48", "OFB56",
|
||||||
|
"OFB64"},
|
||||||
|
new String[]{"NoPaDDing", "PKCS5Padding"});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
new TestCipherDESede().runAll();
|
||||||
|
}
|
||||||
|
}
|
128
jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBE.java
Normal file
128
jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBE.java
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.SecretKeyFactory;
|
||||||
|
import javax.crypto.ShortBufferException;
|
||||||
|
import javax.crypto.spec.PBEKeySpec;
|
||||||
|
import javax.crypto.spec.PBEParameterSpec;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8048601
|
||||||
|
* @summary Tests for PBE ciphers
|
||||||
|
*/
|
||||||
|
public class TestCipherPBE {
|
||||||
|
|
||||||
|
private static final String[] ALGORITHMS = {"PBEWithMD5AndDES",
|
||||||
|
"PBEWithMD5AndDES/CBC/PKCS5Padding", "PBEWithMD5AndTripleDES",
|
||||||
|
"PBEWithMD5AndTripleDES/CBC/PKCS5Padding"};
|
||||||
|
|
||||||
|
private static final String KEY_ALGO = "pbeWithMD5ANDdes";
|
||||||
|
private final byte[] SALT;
|
||||||
|
private final byte[] PLAIN_TEXT;
|
||||||
|
|
||||||
|
public TestCipherPBE() {
|
||||||
|
SALT = generateBytes(8);
|
||||||
|
PLAIN_TEXT = generateBytes(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
new TestCipherPBE().runAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runAll() throws Exception {
|
||||||
|
for (String algorithm : ALGORITHMS) {
|
||||||
|
runTest(algorithm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runTest(String algorithm)
|
||||||
|
throws InvalidKeySpecException, NoSuchAlgorithmException,
|
||||||
|
InvalidAlgorithmParameterException, ShortBufferException,
|
||||||
|
NoSuchPaddingException, IllegalBlockSizeException,
|
||||||
|
BadPaddingException, InvalidKeyException {
|
||||||
|
|
||||||
|
out.println("=> Testing: " + algorithm);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Initialization
|
||||||
|
AlgorithmParameterSpec algoParamSpec
|
||||||
|
= new PBEParameterSpec(SALT, 6);
|
||||||
|
|
||||||
|
SecretKey secretKey
|
||||||
|
= SecretKeyFactory.getInstance(KEY_ALGO).generateSecret(
|
||||||
|
new PBEKeySpec(("Secret Key Value").toCharArray()));
|
||||||
|
|
||||||
|
Cipher ci = Cipher.getInstance(algorithm);
|
||||||
|
ci.init(Cipher.ENCRYPT_MODE, secretKey, algoParamSpec);
|
||||||
|
|
||||||
|
// Encryption
|
||||||
|
byte[] cipherText = ci.doFinal(PLAIN_TEXT);
|
||||||
|
|
||||||
|
// Decryption
|
||||||
|
ci.init(Cipher.DECRYPT_MODE, secretKey, algoParamSpec);
|
||||||
|
byte[] recoveredText = ci.doFinal(cipherText);
|
||||||
|
|
||||||
|
if (algorithm.contains("TripleDES")) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Expected InvalidKeyException exception uncaugh");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comparison
|
||||||
|
if (!Arrays.equals(PLAIN_TEXT, recoveredText)) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Test failed: plainText is not equal to recoveredText");
|
||||||
|
}
|
||||||
|
out.println("Test Passed.");
|
||||||
|
} catch (InvalidKeyException ex) {
|
||||||
|
if (algorithm.contains("TripleDES")) {
|
||||||
|
out.println("Expected InvalidKeyException raised");
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] generateBytes(int length) {
|
||||||
|
byte[] bytes = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
bytes[i] = (byte) (i & 0xff);
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
}
|
220
jdk/test/com/sun/crypto/provider/Cipher/TestCipher.java
Normal file
220
jdk/test/com/sun/crypto/provider/Cipher/TestCipher.java
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.NoSuchProviderException;
|
||||||
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
|
|
||||||
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import javax.crypto.KeyGenerator;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.ShortBufferException;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a abstract class used to test various ciphers
|
||||||
|
*/
|
||||||
|
public abstract class TestCipher {
|
||||||
|
|
||||||
|
private final String SUNJCE = "SunJCE";
|
||||||
|
private final String ALGORITHM;
|
||||||
|
private final String[] MODES;
|
||||||
|
private final String[] PADDINGS;
|
||||||
|
|
||||||
|
/* Used to test cipher with different key strengths
|
||||||
|
Key size tested is increment of KEYCUTTER from MINIMUM_KEY_SIZE to
|
||||||
|
maximum allowed keysize.
|
||||||
|
DES/DESede/Blowfish work with currently selected key sizes.
|
||||||
|
*/
|
||||||
|
private final int variousKeySize;
|
||||||
|
private final int KEYCUTTER = 8;
|
||||||
|
private final int MINIMUM_KEY_SIZE = 32;
|
||||||
|
|
||||||
|
// Used to assert that Encryption/Decryption works with same buffer
|
||||||
|
// TEXT_LEN is multiple of blocks in order to work against ciphers w/ NoPadding
|
||||||
|
private final int TEXT_LEN = 800;
|
||||||
|
private final int ENC_OFFSET = 6;
|
||||||
|
private final int STORAGE_OFFSET = 3;
|
||||||
|
private final int PAD_BYTES = 16;
|
||||||
|
|
||||||
|
private final byte[] IV;
|
||||||
|
private final byte[] INPUT_TEXT;
|
||||||
|
|
||||||
|
TestCipher(String algo, String[] modes, String[] paddings,
|
||||||
|
boolean keyStrength) throws NoSuchAlgorithmException {
|
||||||
|
ALGORITHM = algo;
|
||||||
|
MODES = modes;
|
||||||
|
PADDINGS = paddings;
|
||||||
|
this.variousKeySize
|
||||||
|
= keyStrength ? Cipher.getMaxAllowedKeyLength(ALGORITHM) : 0;
|
||||||
|
|
||||||
|
IV = generateBytes(8);
|
||||||
|
INPUT_TEXT = generateBytes(TEXT_LEN + PAD_BYTES + ENC_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
TestCipher(String algo, String[] modes, String[] paddings) {
|
||||||
|
ALGORITHM = algo;
|
||||||
|
MODES = modes;
|
||||||
|
PADDINGS = paddings;
|
||||||
|
variousKeySize = 0;
|
||||||
|
|
||||||
|
IV = generateBytes(8);
|
||||||
|
INPUT_TEXT = generateBytes(TEXT_LEN + PAD_BYTES + ENC_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] generateBytes(int length) {
|
||||||
|
byte[] bytes = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
bytes[i] = (byte) (i & 0xff);
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isKeyStrenthSupported() {
|
||||||
|
return (variousKeySize != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runAll() throws InvalidKeyException,
|
||||||
|
NoSuchPaddingException, InvalidAlgorithmParameterException,
|
||||||
|
ShortBufferException, IllegalBlockSizeException,
|
||||||
|
BadPaddingException, NoSuchAlgorithmException,
|
||||||
|
NoSuchProviderException {
|
||||||
|
|
||||||
|
for (String mode : MODES) {
|
||||||
|
for (String padding : PADDINGS) {
|
||||||
|
if (!isKeyStrenthSupported()) {
|
||||||
|
runTest(mode, padding, 0);
|
||||||
|
} else {
|
||||||
|
int keySize = variousKeySize;
|
||||||
|
while (keySize >= MINIMUM_KEY_SIZE) {
|
||||||
|
out.println("With Key Strength: " + keySize);
|
||||||
|
runTest(mode, padding, keySize);
|
||||||
|
keySize -= KEYCUTTER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runTest(String mo, String pad, int keySize)
|
||||||
|
throws NoSuchPaddingException, BadPaddingException,
|
||||||
|
ShortBufferException, IllegalBlockSizeException,
|
||||||
|
InvalidAlgorithmParameterException, InvalidKeyException,
|
||||||
|
NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
|
||||||
|
String TRANSFORMATION = ALGORITHM + "/" + mo + "/" + pad;
|
||||||
|
out.println("Testing: " + TRANSFORMATION);
|
||||||
|
|
||||||
|
// Initialization
|
||||||
|
Cipher ci = Cipher.getInstance(TRANSFORMATION, SUNJCE);
|
||||||
|
KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM, SUNJCE);
|
||||||
|
if (keySize != 0) {
|
||||||
|
kg.init(keySize);
|
||||||
|
}
|
||||||
|
SecretKey key = kg.generateKey();
|
||||||
|
SecretKeySpec skeySpec = new SecretKeySpec(key.getEncoded(), ALGORITHM);
|
||||||
|
|
||||||
|
AlgorithmParameterSpec aps = new IvParameterSpec(IV);
|
||||||
|
if (mo.equalsIgnoreCase("ECB")) {
|
||||||
|
ci.init(Cipher.ENCRYPT_MODE, key);
|
||||||
|
} else {
|
||||||
|
ci.init(Cipher.ENCRYPT_MODE, key, aps);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encryption
|
||||||
|
int PAD_LEN = 0;
|
||||||
|
if (pad.equalsIgnoreCase("PKCS5Padding")) {
|
||||||
|
// Need to consider pad bytes
|
||||||
|
PAD_LEN = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] plainText = INPUT_TEXT.clone();
|
||||||
|
|
||||||
|
// Generate cipher and save to separate buffer
|
||||||
|
byte[] cipherText = ci.doFinal(INPUT_TEXT, ENC_OFFSET, TEXT_LEN);
|
||||||
|
|
||||||
|
// Generate cipher and save to same buffer
|
||||||
|
int offset = ci.update(
|
||||||
|
INPUT_TEXT, ENC_OFFSET, TEXT_LEN, INPUT_TEXT, STORAGE_OFFSET);
|
||||||
|
ci.doFinal(INPUT_TEXT, offset + STORAGE_OFFSET);
|
||||||
|
|
||||||
|
if (!equalsBlock(
|
||||||
|
INPUT_TEXT, STORAGE_OFFSET, cipherText, 0, cipherText.length)) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Different ciphers generated with same buffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decryption
|
||||||
|
if (mo.equalsIgnoreCase("ECB")) {
|
||||||
|
ci.init(Cipher.DECRYPT_MODE, skeySpec);
|
||||||
|
} else {
|
||||||
|
ci.init(Cipher.DECRYPT_MODE, skeySpec, aps);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover text from cipher and save to separate buffer
|
||||||
|
byte[] recoveredText = ci.doFinal(cipherText, 0, cipherText.length);
|
||||||
|
|
||||||
|
if (!equalsBlock(
|
||||||
|
plainText, ENC_OFFSET, recoveredText, 0,
|
||||||
|
recoveredText.length)) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Recovered text not same as plain text");
|
||||||
|
} else {
|
||||||
|
out.println("Recovered and plain text are same");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover text from cipher and save to same buffer
|
||||||
|
ci.update(INPUT_TEXT, STORAGE_OFFSET, TEXT_LEN + PAD_LEN, INPUT_TEXT,
|
||||||
|
ENC_OFFSET);
|
||||||
|
ci.doFinal(INPUT_TEXT, ENC_OFFSET);
|
||||||
|
|
||||||
|
if (!equalsBlock(
|
||||||
|
plainText, ENC_OFFSET, recoveredText, 0,
|
||||||
|
recoveredText.length)) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Recovered text not same as plain text with same buffer");
|
||||||
|
} else {
|
||||||
|
out.println("Recovered and plain text are same with same buffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
out.println("Test Passed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean equalsBlock(byte[] b1, int off1, byte[] b2, int off2,
|
||||||
|
int len) {
|
||||||
|
for (int i = off1, j = off2, k = 0; k < len; i++, j++, k++) {
|
||||||
|
if (b1[i] != b2[j]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.ShortBufferException;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.KeyGenerator;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class to test a given DES algorithm.
|
||||||
|
*/
|
||||||
|
public class DESCipherWrapper {
|
||||||
|
|
||||||
|
private final Cipher ci;
|
||||||
|
private final byte[] iv;
|
||||||
|
private final SecretKey key;
|
||||||
|
private final String algo;
|
||||||
|
private final String mode;
|
||||||
|
private final String pad;
|
||||||
|
private final int keyStrength;
|
||||||
|
private byte[] resultText = null;
|
||||||
|
|
||||||
|
public DESCipherWrapper(String algo, String mode, String pad)
|
||||||
|
throws NoSuchAlgorithmException, NoSuchPaddingException {
|
||||||
|
ci = Cipher.getInstance(algo + "/" + mode + "/" + pad);
|
||||||
|
|
||||||
|
iv = new byte[8];
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
iv[i] = (byte) (i & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyGenerator kg = KeyGenerator.getInstance(algo);
|
||||||
|
key = kg.generateKey();
|
||||||
|
keyStrength = algo.equalsIgnoreCase("DESede") ? 112
|
||||||
|
: key.getEncoded().length * 8;
|
||||||
|
|
||||||
|
this.algo = algo;
|
||||||
|
this.mode = mode;
|
||||||
|
this.pad = pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getResult() {
|
||||||
|
return resultText.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(int edMode, byte[] inputText)
|
||||||
|
throws InvalidKeyException, InvalidAlgorithmParameterException,
|
||||||
|
IllegalBlockSizeException, BadPaddingException,
|
||||||
|
ShortBufferException, NoSuchAlgorithmException {
|
||||||
|
AlgorithmParameterSpec aps = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!mode.equalsIgnoreCase("ECB")) {
|
||||||
|
aps = new IvParameterSpec(iv);
|
||||||
|
}
|
||||||
|
ci.init(edMode, key, aps);
|
||||||
|
|
||||||
|
// Generate a resultText using a single-part enc/dec
|
||||||
|
resultText = ci.doFinal(inputText);
|
||||||
|
|
||||||
|
// Generate outputText for each multi-part en/de-cryption
|
||||||
|
/* Combination #1:
|
||||||
|
update(byte[], int, int)
|
||||||
|
doFinal(byte[], int, int)
|
||||||
|
*/
|
||||||
|
byte[] part11 = ci.update(inputText, 0, inputText.length);
|
||||||
|
byte[] part12 = ci.doFinal();
|
||||||
|
byte[] outputText1 = new byte[part11.length + part12.length];
|
||||||
|
System.arraycopy(part11, 0, outputText1, 0, part11.length);
|
||||||
|
System.arraycopy(part12, 0, outputText1, part11.length,
|
||||||
|
part12.length);
|
||||||
|
|
||||||
|
List<byte[]> outputTexts = new ArrayList<>(4);
|
||||||
|
outputTexts.add(outputText1);
|
||||||
|
|
||||||
|
/* Combination #2:
|
||||||
|
update(byte[], int, int)
|
||||||
|
doFinal(byte[], int, int, byte[], int)
|
||||||
|
*/
|
||||||
|
byte[] part21 = ci.update(inputText, 0, inputText.length - 5);
|
||||||
|
byte[] part22 = new byte[ci.getOutputSize(inputText.length)];
|
||||||
|
int len2 = ci
|
||||||
|
.doFinal(inputText, inputText.length - 5, 5, part22, 0);
|
||||||
|
byte[] outputText2 = new byte[part21.length + len2];
|
||||||
|
System.arraycopy(part21, 0, outputText2, 0, part21.length);
|
||||||
|
System.arraycopy(part22, 0, outputText2, part21.length, len2);
|
||||||
|
|
||||||
|
outputTexts.add(outputText2);
|
||||||
|
|
||||||
|
/* Combination #3:
|
||||||
|
update(byte[], int, int, byte[], int)
|
||||||
|
doFinal(byte[], int, int)
|
||||||
|
*/
|
||||||
|
byte[] part31 = new byte[ci.getOutputSize(inputText.length)];
|
||||||
|
int len3 = ci.update(inputText, 0, inputText.length - 8, part31, 0);
|
||||||
|
byte[] part32 = ci.doFinal(inputText, inputText.length - 8, 8);
|
||||||
|
byte[] outputText3 = new byte[len3 + part32.length];
|
||||||
|
System.arraycopy(part31, 0, outputText3, 0, len3);
|
||||||
|
System.arraycopy(part32, 0, outputText3, len3, part32.length);
|
||||||
|
|
||||||
|
outputTexts.add(outputText3);
|
||||||
|
|
||||||
|
/* Combination #4:
|
||||||
|
update(byte[], int, int, byte[], int)
|
||||||
|
doFinal(byte[], int, int, byte[], int)
|
||||||
|
*/
|
||||||
|
byte[] part41 = new byte[ci.getOutputSize(inputText.length)];
|
||||||
|
int len4 = ci.update(inputText, 0, inputText.length - 8, part41, 0);
|
||||||
|
int rest4 = ci.doFinal(inputText, inputText.length - 8, 8, part41,
|
||||||
|
len4);
|
||||||
|
byte[] outputText4 = new byte[len4 + rest4];
|
||||||
|
System.arraycopy(part41, 0, outputText4, 0, outputText4.length);
|
||||||
|
|
||||||
|
outputTexts.add(outputText4);
|
||||||
|
|
||||||
|
// Compare results
|
||||||
|
for (int k = 0; k < outputTexts.size(); k++) {
|
||||||
|
if (!Arrays.equals(resultText, outputTexts.get(k))) {
|
||||||
|
out.println(" Testing: " + algo + "/" + mode + "/" + pad);
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Compare value of resultText and combination " + k
|
||||||
|
+ " are not same. Test failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keyStrength > Cipher.getMaxAllowedKeyLength(algo)) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Expected exception uncaught, keyStrength "
|
||||||
|
+ keyStrength);
|
||||||
|
}
|
||||||
|
} catch (InvalidKeyException ex) {
|
||||||
|
if (keyStrength <= Cipher.getMaxAllowedKeyLength(algo)) {
|
||||||
|
out.println("Unexpected exception in " + algo + "/" + mode
|
||||||
|
+ "/" + pad + " , KeySize " + keyStrength);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
out.println("Caught InvalidKeyException as expected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,258 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.security.AlgorithmParameters;
|
||||||
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.SecretKeyFactory;
|
||||||
|
import javax.crypto.ShortBufferException;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.PBEKeySpec;
|
||||||
|
import javax.crypto.spec.PBEParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PBECipherWrapper is the abstract class for all concrete PBE Cipher wrappers.
|
||||||
|
*/
|
||||||
|
public abstract class PBECipherWrapper {
|
||||||
|
|
||||||
|
public static final int ITERATION_COUNT = 1000;
|
||||||
|
private final String algorithm;
|
||||||
|
private final byte[] salt;
|
||||||
|
protected SecretKey key;
|
||||||
|
protected Cipher ci;
|
||||||
|
protected String baseAlgo;
|
||||||
|
protected byte[] resultText = null;
|
||||||
|
protected AlgorithmParameterSpec aps = null;
|
||||||
|
|
||||||
|
public PBECipherWrapper(String algorithm, int saltSize) {
|
||||||
|
this.algorithm = algorithm;
|
||||||
|
baseAlgo = algorithm.split("/")[0].toUpperCase();
|
||||||
|
salt = generateSalt(saltSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void initCipher(int mode) throws InvalidKeyException,
|
||||||
|
InvalidAlgorithmParameterException, InvalidParameterSpecException;
|
||||||
|
|
||||||
|
public void execute(int edMode, byte[] inputText)
|
||||||
|
throws InvalidAlgorithmParameterException,
|
||||||
|
InvalidParameterSpecException, IllegalBlockSizeException,
|
||||||
|
BadPaddingException, ShortBufferException, InvalidKeyException {
|
||||||
|
// Initialize
|
||||||
|
initCipher(edMode);
|
||||||
|
|
||||||
|
// Generate a resultText using a single-part enc/dec
|
||||||
|
resultText = ci.doFinal(inputText);
|
||||||
|
|
||||||
|
// Generate outputText for each multi-part en/de-cryption
|
||||||
|
/* Combination #1:
|
||||||
|
update(byte[], int, int)
|
||||||
|
doFinal(byte[], int, int)
|
||||||
|
*/
|
||||||
|
byte[] part11 = ci.update(inputText, 0, inputText.length);
|
||||||
|
byte[] part12 = ci.doFinal();
|
||||||
|
byte[] outputText1 = new byte[part11.length + part12.length];
|
||||||
|
System.arraycopy(part11, 0, outputText1, 0, part11.length);
|
||||||
|
System.arraycopy(part12, 0, outputText1, part11.length, part12.length);
|
||||||
|
|
||||||
|
List<byte[]> outputTexts = new ArrayList<>(4);
|
||||||
|
outputTexts.add(outputText1);
|
||||||
|
|
||||||
|
/* Combination #2:
|
||||||
|
update(byte[], int, int)
|
||||||
|
doFinal(byte[], int, int, byte[], int)
|
||||||
|
*/
|
||||||
|
byte[] part21 = ci.update(inputText, 0, inputText.length - 5);
|
||||||
|
byte[] part22 = new byte[ci.getOutputSize(inputText.length)];
|
||||||
|
int len2 = ci.doFinal(inputText, inputText.length - 5, 5, part22, 0);
|
||||||
|
byte[] outputText2 = new byte[part21.length + len2];
|
||||||
|
System.arraycopy(part21, 0, outputText2, 0, part21.length);
|
||||||
|
System.arraycopy(part22, 0, outputText2, part21.length, len2);
|
||||||
|
|
||||||
|
outputTexts.add(outputText2);
|
||||||
|
|
||||||
|
/* Combination #3:
|
||||||
|
update(byte[], int, int, byte[], int)
|
||||||
|
doFinal(byte[], int, int)
|
||||||
|
*/
|
||||||
|
byte[] part31 = new byte[ci.getOutputSize(inputText.length)];
|
||||||
|
int len3 = ci.update(inputText, 0, inputText.length - 8, part31, 0);
|
||||||
|
byte[] part32 = ci.doFinal(inputText, inputText.length - 8, 8);
|
||||||
|
byte[] outputText3 = new byte[len3 + part32.length];
|
||||||
|
System.arraycopy(part31, 0, outputText3, 0, len3);
|
||||||
|
System.arraycopy(part32, 0, outputText3, len3, part32.length);
|
||||||
|
|
||||||
|
outputTexts.add(outputText3);
|
||||||
|
|
||||||
|
/* Combination #4:
|
||||||
|
update(byte[], int, int, byte[], int)
|
||||||
|
doFinal(byte[], int, int, byte[], int)
|
||||||
|
*/
|
||||||
|
byte[] part41 = new byte[ci.getOutputSize(inputText.length)];
|
||||||
|
int len4 = ci.update(inputText, 0, inputText.length - 8, part41, 0);
|
||||||
|
int rest4 = ci
|
||||||
|
.doFinal(inputText, inputText.length - 8, 8, part41, len4);
|
||||||
|
byte[] outputText4 = new byte[len4 + rest4];
|
||||||
|
System.arraycopy(part41, 0, outputText4, 0, outputText4.length);
|
||||||
|
|
||||||
|
outputTexts.add(outputText4);
|
||||||
|
|
||||||
|
// Compare results
|
||||||
|
for (int k = 0; k < outputTexts.size(); k++) {
|
||||||
|
if (!Arrays.equals(resultText, outputTexts.get(k))) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Compare value of resultText and combination " + k
|
||||||
|
+ " are not same. Test failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public final byte[] generateSalt(int numberOfBytes) {
|
||||||
|
byte[] aSalt = new byte[numberOfBytes];
|
||||||
|
for (int i = 0; i < numberOfBytes; i++) {
|
||||||
|
aSalt[i] = (byte) (i & 0xff);
|
||||||
|
}
|
||||||
|
return aSalt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getResult() {
|
||||||
|
return resultText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlgorithm() {
|
||||||
|
return algorithm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getSalt() {
|
||||||
|
return salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class to test a given SecretKeyFactory.PBKDF2 algorithm.
|
||||||
|
*/
|
||||||
|
public static class PBKDF2 extends PBECipherWrapper {
|
||||||
|
|
||||||
|
private static final int PBKDF2_SALT_SIZE = 64;
|
||||||
|
private static final int CIPHER_KEY_SIZE = 128;
|
||||||
|
private static final String CIPHER_TRANSFORMATION = "AES/CBC/PKCS5Padding";
|
||||||
|
private static final String KEY_ALGORITHM = "AES";
|
||||||
|
private byte[] iv = null;
|
||||||
|
|
||||||
|
public PBKDF2(String algo, String passwd)
|
||||||
|
throws InvalidKeySpecException, NoSuchAlgorithmException,
|
||||||
|
NoSuchPaddingException {
|
||||||
|
super(algo, PBKDF2_SALT_SIZE);
|
||||||
|
|
||||||
|
ci = Cipher.getInstance(CIPHER_TRANSFORMATION);
|
||||||
|
|
||||||
|
PBEKeySpec pbeKeySpec = new PBEKeySpec(passwd.toCharArray(), getSalt(),
|
||||||
|
ITERATION_COUNT, CIPHER_KEY_SIZE);
|
||||||
|
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(algo);
|
||||||
|
key = keyFactory.generateSecret(pbeKeySpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initCipher(int mode) throws InvalidKeyException,
|
||||||
|
InvalidAlgorithmParameterException, InvalidParameterSpecException {
|
||||||
|
if (Cipher.ENCRYPT_MODE == mode) {
|
||||||
|
ci.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getEncoded(),
|
||||||
|
KEY_ALGORITHM));
|
||||||
|
iv = ci.getParameters().getParameterSpec(IvParameterSpec.class)
|
||||||
|
.getIV();
|
||||||
|
} else {
|
||||||
|
ci.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key.getEncoded(),
|
||||||
|
KEY_ALGORITHM), new IvParameterSpec(iv));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class to test a given AES-based PBE algorithm.
|
||||||
|
*/
|
||||||
|
public static class AES extends PBECipherWrapper {
|
||||||
|
|
||||||
|
private AlgorithmParameters pbeParams;
|
||||||
|
|
||||||
|
public AES(String algo, String passwd)
|
||||||
|
throws NoSuchAlgorithmException, NoSuchPaddingException,
|
||||||
|
InvalidKeySpecException {
|
||||||
|
super(algo, 0);
|
||||||
|
|
||||||
|
ci = Cipher.getInstance(algo);
|
||||||
|
|
||||||
|
SecretKeyFactory skf = SecretKeyFactory.getInstance(algo);
|
||||||
|
key = skf.generateSecret(new PBEKeySpec(passwd.toCharArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initCipher(int mode) throws InvalidKeyException,
|
||||||
|
InvalidAlgorithmParameterException, InvalidParameterSpecException {
|
||||||
|
if (Cipher.ENCRYPT_MODE == mode) {
|
||||||
|
ci.init(Cipher.ENCRYPT_MODE, key);
|
||||||
|
pbeParams = ci.getParameters();
|
||||||
|
} else {
|
||||||
|
ci.init(Cipher.DECRYPT_MODE, key, pbeParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class to test a given PBE algorithm.
|
||||||
|
*/
|
||||||
|
public static class Legacy extends PBECipherWrapper {
|
||||||
|
|
||||||
|
private static final int PBE_SALT_SIZE = 8;
|
||||||
|
|
||||||
|
public Legacy(String algo, String passwd)
|
||||||
|
throws NoSuchAlgorithmException, NoSuchPaddingException,
|
||||||
|
InvalidKeySpecException {
|
||||||
|
super(algo, PBE_SALT_SIZE);
|
||||||
|
|
||||||
|
SecretKeyFactory skf = SecretKeyFactory.getInstance(algo.split("/")[0]);
|
||||||
|
key = skf.generateSecret(new PBEKeySpec(passwd.toCharArray()));
|
||||||
|
|
||||||
|
aps = new PBEParameterSpec(getSalt(), ITERATION_COUNT);
|
||||||
|
|
||||||
|
ci = Cipher.getInstance(algo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initCipher(int mode) throws InvalidKeyException,
|
||||||
|
InvalidAlgorithmParameterException, InvalidParameterSpecException {
|
||||||
|
ci.init(mode, key, aps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8048601
|
||||||
|
* @summary Performs multiple-part encryption/decryption depending on the
|
||||||
|
* specified encryption mode and check if the results obtained by
|
||||||
|
* different ways are the same.
|
||||||
|
*/
|
||||||
|
public class TestCipherTextLength {
|
||||||
|
|
||||||
|
/* Algorithms tested by DESCipherWrapper */
|
||||||
|
private static final String[] DES_ALGORITHMS = {"DES", "DESede",
|
||||||
|
"Blowfish"};
|
||||||
|
private static final String[] DES_MODES = {"ECB", "CBC", "PCBC"};
|
||||||
|
private static final String[] DES_PADDING = {"PKCS5Padding"};
|
||||||
|
|
||||||
|
/* Algorithms tested by PBECipherWrapper */
|
||||||
|
private static final String[] PBE_ALGORITHMS = {"PBEWithMD5AndDES",
|
||||||
|
"PBEWithMD5AndDES/CBC/PKCS5Padding", "PBEWithMD5ANDTripleDES",
|
||||||
|
"PBEWithMD5AndTripleDES/CBC/PKCS5Padding", "PBEwithSHA1AndDESede",
|
||||||
|
"PBEwithSHA1AndDESede/CBC/PKCS5Padding", "PBEwithSHA1AndRC2_40",
|
||||||
|
"PBEwithSHA1Andrc2_40/CBC/PKCS5Padding", "PBEWithSHA1AndRC2_128",
|
||||||
|
"PBEWithSHA1andRC2_128/CBC/PKCS5Padding", "PBEWithSHA1AndRC4_40",
|
||||||
|
"PBEWithsha1AndRC4_40/ECB/NoPadding", "PBEWithSHA1AndRC4_128",
|
||||||
|
"PBEWithSHA1AndRC4_128/ECB/NoPadding", "PBEWithHmacSHA1AndAES_128",
|
||||||
|
"PBEWithHmacSHA224AndAES_128", "PBEWithHmacSHA256AndAES_128",
|
||||||
|
"PBEWithHmacSHA384AndAES_128", "PBEWithHmacSHA512AndAES_128",
|
||||||
|
"PBEWithHmacSHA1AndAES_256", "PBEWithHmacSHA224AndAES_256",
|
||||||
|
"PBEWithHmacSHA256AndAES_256", "PBEWithHmacSHA384AndAES_256",
|
||||||
|
"PBEWithHmacSHA512AndAES_256", "PBKDF2WithHmacSHA1",
|
||||||
|
"PBKDF2WithHmacSHA224", "PBKDF2WithHmacSHA256",
|
||||||
|
"PBKDF2WithHmacSHA384", "PBKDF2WithHmacSHA512"};
|
||||||
|
private static final String PBE_PASSWORD = "Hush, it's a secret!!";
|
||||||
|
|
||||||
|
// Algorithm tested by PBKDF2Wrappter
|
||||||
|
private static final String PBKDF2 = "PBKDF2";
|
||||||
|
|
||||||
|
// Algorithm tested by AESPBEWrapper
|
||||||
|
private static final String AES = "AES";
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
byte[] plainText = new byte[64];
|
||||||
|
for (int i = 0; i < 64; i++) {
|
||||||
|
plainText[i] = (byte) (i & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
new TestCipherTextLength().runAll(plainText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runAll(byte[] plainText) throws Exception {
|
||||||
|
|
||||||
|
// Testing DES/Blowfish Cipher
|
||||||
|
for (String algorithm : DES_ALGORITHMS) {
|
||||||
|
for (String desMode : DES_MODES) {
|
||||||
|
for (String padding : DES_PADDING) {
|
||||||
|
out.println("=>Testing: " + algorithm + "/" + desMode
|
||||||
|
+ "/" + padding);
|
||||||
|
DESCipherWrapper desCi = new DESCipherWrapper(algorithm,
|
||||||
|
desMode, padding);
|
||||||
|
desCi.execute(Cipher.ENCRYPT_MODE, plainText);
|
||||||
|
desCi.execute(Cipher.DECRYPT_MODE, desCi.getResult());
|
||||||
|
if (!Arrays.equals(plainText, desCi.getResult())) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Plain and recovered texts are not same for:"
|
||||||
|
+ algorithm + "/" + desMode + "/"
|
||||||
|
+ padding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Testing PBE Cipher
|
||||||
|
for (String algorithm : PBE_ALGORITHMS) {
|
||||||
|
int maxKeyLen = Cipher.getMaxAllowedKeyLength(algorithm);
|
||||||
|
boolean isUnlimited = maxKeyLen == Integer.MAX_VALUE;
|
||||||
|
if (!isUnlimited
|
||||||
|
&& (algorithm.contains("TripleDES") || algorithm
|
||||||
|
.contains("AES_256"))) {
|
||||||
|
out.println("Test " + algorithm + " will be ignored");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
out.println("=>Testing: " + algorithm);
|
||||||
|
PBECipherWrapper pbeCi = createWrapper(algorithm, PBE_PASSWORD);
|
||||||
|
pbeCi.execute(Cipher.ENCRYPT_MODE, plainText);
|
||||||
|
pbeCi.execute(Cipher.DECRYPT_MODE, pbeCi.getResult());
|
||||||
|
if (!Arrays.equals(plainText, pbeCi.getResult())) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Plain and recovered texts are not same for:"
|
||||||
|
+ algorithm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PBECipherWrapper createWrapper(String algo, String passwd)
|
||||||
|
throws InvalidKeySpecException, NoSuchAlgorithmException,
|
||||||
|
NoSuchPaddingException {
|
||||||
|
if (algo.contains(PBKDF2)) {
|
||||||
|
return new PBECipherWrapper.PBKDF2(algo, passwd);
|
||||||
|
} else if (algo.contains(AES)) {
|
||||||
|
return new PBECipherWrapper.AES(algo, passwd);
|
||||||
|
} else {
|
||||||
|
return new PBECipherWrapper.Legacy(algo, passwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -442,6 +442,3 @@ public class InterfaceMethodsTest extends TestScaffold {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1215,5 +1215,3 @@ runit()
|
|||||||
# Don't know how this arises
|
# Don't know how this arises
|
||||||
debuggeeFailIfPresent "Internal exception"
|
debuggeeFailIfPresent "Internal exception"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,5 +7,3 @@ grant {
|
|||||||
//permission java.net.SocketPermission "*:636", "connect";
|
//permission java.net.SocketPermission "*:636", "connect";
|
||||||
//permission javax.security.auth.AuthPermission "modifyPrincipals";
|
//permission javax.security.auth.AuthPermission "modifyPrincipals";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,5 +135,3 @@ public class Test3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,5 +79,3 @@ public class LCDScale extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -426,5 +426,3 @@ class TestDialog extends Dialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}// TestDialog class
|
}// TestDialog class
|
||||||
|
|
||||||
|
|
||||||
|
@ -421,5 +421,3 @@ class TestDialog extends Dialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}// TestDialog class
|
}// TestDialog class
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,5 +424,3 @@ class TestDialog extends Dialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}// TestDialog class
|
}// TestDialog class
|
||||||
|
|
||||||
|
|
||||||
|
@ -425,5 +425,3 @@ class TestDialog extends Dialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}// TestDialog class
|
}// TestDialog class
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,5 +430,3 @@ class TestDialog extends Dialog
|
|||||||
}
|
}
|
||||||
|
|
||||||
}// TestDialog class
|
}// TestDialog class
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,5 +144,3 @@ public class JContainerMousePositionTest {
|
|||||||
frame1.setVisible(true);
|
frame1.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,5 +120,3 @@ public class CTORRestrictions_Disable {
|
|||||||
frame.dispatchEvent( ( AWTEvent )meOld );
|
frame.dispatchEvent( ( AWTEvent )meOld );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,5 +59,3 @@ Confirm the following two behaviors:
|
|||||||
<APPLET CODE="bug4490692.class" WIDTH=0 HEIGHT=0></APPLET>
|
<APPLET CODE="bug4490692.class" WIDTH=0 HEIGHT=0></APPLET>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,5 +45,3 @@ Confirm the following behavior:
|
|||||||
<APPLET CODE="bug4959409.class" WIDTH=0 HEIGHT=0></APPLET>
|
<APPLET CODE="bug4959409.class" WIDTH=0 HEIGHT=0></APPLET>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,3 @@ java WriteAddedSuperClass
|
|||||||
rm A.class AddedSuperClass.class
|
rm A.class AddedSuperClass.class
|
||||||
javac ReadAddedSuperClass2.java
|
javac ReadAddedSuperClass2.java
|
||||||
java ReadAddedSuperClass2
|
java ReadAddedSuperClass2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,5 +44,3 @@ esac
|
|||||||
|
|
||||||
# now start the test
|
# now start the test
|
||||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${PS}${TESTCLASSES} GetDotResource
|
${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${PS}${TESTCLASSES} GetDotResource
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,5 +69,3 @@ if [ $failures -gt 0 ];
|
|||||||
then echo "$failures test(s) failed";
|
then echo "$failures test(s) failed";
|
||||||
else echo "All test(s) passed"; fi
|
else echo "All test(s) passed"; fi
|
||||||
exit $failures
|
exit $failures
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,6 +33,3 @@
|
|||||||
* )
|
* )
|
||||||
echo "unrecognized system: $OS" ;;
|
echo "unrecognized system: $OS" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,5 +31,3 @@ For step 4 (re-building libLauncher.so) the following environment is required:
|
|||||||
(c) Execute the make script :-
|
(c) Execute the make script :-
|
||||||
Solaris: gnumake all
|
Solaris: gnumake all
|
||||||
Linux: gmake all
|
Linux: gmake all
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,17 +21,18 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/* @test
|
/* @test
|
||||||
* @summary Test probing content type simultaneously from multiple threads.
|
* @summary Test probing content type simultaneously from multiple threads.
|
||||||
* @requires (os.family == "linux") | (os.family == "solaris")
|
* @requires (os.family == "linux") | (os.family == "solaris")
|
||||||
* @build ParallelProbes SimpleFileTypeDetector
|
* @build ParallelProbes SimpleFileTypeDetector
|
||||||
* @run main/othervm ParallelProbes 10
|
* @run main/othervm ParallelProbes 10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ParallelProbes {
|
public class ParallelProbes {
|
||||||
|
|
||||||
private static final int REPEATS = 1000;
|
private static final int REPEATS = 1000;
|
||||||
|
@ -125,5 +125,3 @@ else
|
|||||||
fi
|
fi
|
||||||
rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp
|
rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp
|
||||||
exit ${exitCode}
|
exit ${exitCode}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,5 +119,3 @@ public class Copy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,5 +211,3 @@ public class ToArrayTest {
|
|||||||
else {System.out.println(x + " not equal to " + y); fail(); }
|
else {System.out.println(x + " not equal to " + y); fail(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,5 +18,3 @@ blah.level = FINE
|
|||||||
foo.bar.l10.level = INFO
|
foo.bar.l10.level = INFO
|
||||||
foo.bar.l100.level = INFO
|
foo.bar.l100.level = INFO
|
||||||
foo.bar.l1000.level = INFO
|
foo.bar.l1000.level = INFO
|
||||||
|
|
||||||
|
|
||||||
|
231
jdk/test/javax/management/ObjectName/CompressedStorageTest.java
Normal file
231
jdk/test/javax/management/ObjectName/CompressedStorageTest.java
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8041565
|
||||||
|
* @summary Tests the limits imposed on the domain name part of an
|
||||||
|
* ObjectName instance
|
||||||
|
* @author Jaroslav Bachorik
|
||||||
|
* @modules java.management
|
||||||
|
* @run main CompressedStorageTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import javax.management.MalformedObjectNameException;
|
||||||
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
|
public class CompressedStorageTest {
|
||||||
|
private static Method setDomainLengthM;
|
||||||
|
private static Field compressedStorageFld;
|
||||||
|
|
||||||
|
private static int DOMAIN_PATTERN;
|
||||||
|
private static int PROPLIST_PATTERN;
|
||||||
|
private static int PROPVAL_PATTERN;
|
||||||
|
|
||||||
|
private static Method setDomainPattern;
|
||||||
|
private static Method setPropertyListPattern;
|
||||||
|
private static Method setPropertyValuePattern;
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Class<?> clz = ObjectName.class;
|
||||||
|
setDomainLengthM = clz.getDeclaredMethod("setDomainLength", int.class);
|
||||||
|
setDomainLengthM.setAccessible(true);
|
||||||
|
|
||||||
|
compressedStorageFld = clz.getDeclaredField("_compressed_storage");
|
||||||
|
compressedStorageFld.setAccessible(true);
|
||||||
|
|
||||||
|
setDomainPattern = clz.getDeclaredMethod("setDomainPattern", boolean.class);
|
||||||
|
setDomainPattern.setAccessible(true);
|
||||||
|
setPropertyListPattern = clz.getDeclaredMethod("setPropertyListPattern", boolean.class);
|
||||||
|
setPropertyListPattern.setAccessible(true);
|
||||||
|
setPropertyValuePattern = clz.getDeclaredMethod("setPropertyValuePattern", boolean.class);
|
||||||
|
setPropertyValuePattern.setAccessible(true);
|
||||||
|
|
||||||
|
DOMAIN_PATTERN = getStaticIntFld("DOMAIN_PATTERN");
|
||||||
|
PROPLIST_PATTERN = getStaticIntFld("PROPLIST_PATTERN");
|
||||||
|
PROPVAL_PATTERN = getStaticIntFld("PROPVAL_PATTERN");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
testZeroLength();
|
||||||
|
testNegativeLength();
|
||||||
|
testMaxLength();
|
||||||
|
|
||||||
|
testSetDomainPattern();
|
||||||
|
testSetPropertyListPattern();
|
||||||
|
testSetPropertyValuePattern();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ObjectName getObjectName()
|
||||||
|
throws MalformedObjectNameException {
|
||||||
|
return new ObjectName("domain", "key", "value");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for accepting 0 being passed as argument to
|
||||||
|
* {@linkplain ObjectName#setDomainLength(int)}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static void testZeroLength() throws Exception {
|
||||||
|
setDomainNameLength(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for rejecting negative value being passed as argument to
|
||||||
|
* {@linkplain ObjectName#setDomainLength(int)}.
|
||||||
|
*/
|
||||||
|
private static void testNegativeLength() throws Exception {
|
||||||
|
try {
|
||||||
|
setDomainNameLength(-1);
|
||||||
|
} catch (MalformedObjectNameException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fail("Allowing negative domain name length");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for rejecting value exceeding the maximum allowed length
|
||||||
|
* being passed as argument to {@linkplain ObjectName#setDomainLength(int)}.
|
||||||
|
*/
|
||||||
|
private static void testMaxLength() throws Exception {
|
||||||
|
try {
|
||||||
|
setDomainNameLength(Integer.MAX_VALUE / 4 + 1);
|
||||||
|
} catch (MalformedObjectNameException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fail("Maximum domain name length is not respected");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that calling {@linkplain ObjectName#setDomainPattern(boolean)}
|
||||||
|
* results in setting correct bits in {@linkplain ObjectName#_compressed_storage}.
|
||||||
|
*/
|
||||||
|
private static void testSetDomainPattern() throws Exception {
|
||||||
|
ObjectName on = getObjectName();
|
||||||
|
|
||||||
|
checkMask(DOMAIN_PATTERN, setDomainPattern, on);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that calling {@linkplain ObjectName#setPropertyListPattern(boolean)}
|
||||||
|
* results in setting correct bits in {@linkplain ObjectName#_compressed_storage}.
|
||||||
|
*/
|
||||||
|
private static void testSetPropertyListPattern() throws Exception {
|
||||||
|
ObjectName on = getObjectName();
|
||||||
|
|
||||||
|
checkMask(PROPLIST_PATTERN, setPropertyListPattern, on);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that calling {@linkplain ObjectName#setPropertyValuePattern(boolean)}
|
||||||
|
* results in setting correct bits in {@linkplain ObjectName#_compressed_storage}.
|
||||||
|
*/
|
||||||
|
private static void testSetPropertyValuePattern() throws Exception {
|
||||||
|
ObjectName on = getObjectName();
|
||||||
|
|
||||||
|
checkMask(PROPVAL_PATTERN, setPropertyValuePattern, on);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to call {@linkplain ObjectName#setDomainLength(int)}
|
||||||
|
* method via reflection.
|
||||||
|
* @param len The domain name length
|
||||||
|
* @throws MalformedObjectNameException Propagated from
|
||||||
|
* {@linkplain ObjectName#setDomainLength(int)} invocation.
|
||||||
|
*/
|
||||||
|
private static void setDomainNameLength(int len)
|
||||||
|
throws MalformedObjectNameException {
|
||||||
|
try {
|
||||||
|
setDomainLengthM.invoke(getObjectName(), len);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
Throwable cause = e.getCause();
|
||||||
|
if (cause instanceof MalformedObjectNameException) {
|
||||||
|
throw (MalformedObjectNameException)cause;
|
||||||
|
}
|
||||||
|
throw new Error(cause);
|
||||||
|
} catch (IllegalAccessException | IllegalArgumentException e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to assert that a particular boolean setter affects only
|
||||||
|
* a particular bit in the {@linkplain ObjectName#_compressed_storage} field.
|
||||||
|
* @param mask bitmask for storing the boolean value
|
||||||
|
* @param setter setter method reference
|
||||||
|
* @param on {@linkplain ObjectName} instance
|
||||||
|
*/
|
||||||
|
private static void checkMask(int mask, Method setter, ObjectName on)
|
||||||
|
throws Exception {
|
||||||
|
int valBefore = compressedStorageFld.getInt(on);
|
||||||
|
setter.invoke(on, true);
|
||||||
|
int valAfter = compressedStorageFld.getInt(on);
|
||||||
|
|
||||||
|
checkMask(mask, valAfter ^ valBefore);
|
||||||
|
|
||||||
|
valBefore = valAfter;
|
||||||
|
setter.invoke(on, false);
|
||||||
|
valAfter = compressedStorageFld.getInt(on);
|
||||||
|
|
||||||
|
checkMask(mask, valAfter ^ valBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the changed bits with the given mask.
|
||||||
|
* @param mask bitmask
|
||||||
|
* @param val the changed bits; may be 0 if there was no change
|
||||||
|
*/
|
||||||
|
private static void checkMask(int mask, int val) {
|
||||||
|
if (val != 0 && val != mask) {
|
||||||
|
fail("Invalid mask: expecting '" +
|
||||||
|
Integer.toBinaryString(mask) + "' , received '" +
|
||||||
|
Integer.toBinaryString(val) + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to obtain the value of a static field via reflection.
|
||||||
|
* @param name static field name
|
||||||
|
* @return static field value
|
||||||
|
*/
|
||||||
|
private static int getStaticIntFld(String name) throws Exception {
|
||||||
|
Field fld = ObjectName.class.getDeclaredField(name);
|
||||||
|
fld.setAccessible(true);
|
||||||
|
|
||||||
|
return fld.getInt(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fail(String msg) {
|
||||||
|
throw new Error(msg);
|
||||||
|
}
|
||||||
|
}
|
@ -184,5 +184,3 @@ public class ModelStandardIndexedDirectorTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,5 +219,3 @@ Inc. This product includes code licensed from RSA Security.
|
|||||||
|
|
||||||
Copyright 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
Copyright 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
California 95054, U.S.A. All rights reserved.
|
California 95054, U.S.A. All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,5 +109,3 @@ public class bug8058120 {
|
|||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,5 +221,3 @@ freePort()
|
|||||||
fi
|
fi
|
||||||
echo "${port1}"
|
echo "${port1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,5 +57,3 @@ public class PasswordFilePermissionTest extends AbstractFilePermissionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,5 +61,3 @@ public class SSLConfigFilePermissionTest extends AbstractFilePermissionTest {
|
|||||||
test.runTest(args);
|
test.runTest(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,5 +15,3 @@
|
|||||||
6. connect jconsole to host2:50234
|
6. connect jconsole to host2:50234
|
||||||
Make sure jconsole works
|
Make sure jconsole works
|
||||||
Make sure only host2.50234 and host2.50235 appears in tcpdump output.
|
Make sure only host2.50234 and host2.50235 appears in tcpdump output.
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,5 +26,3 @@ This will generate revokeall.exe.
|
|||||||
Note that a 32-bit version of revokeall.exe is checked into SCCS
|
Note that a 32-bit version of revokeall.exe is checked into SCCS
|
||||||
- this 32-bit application is also used when running on 64-bit
|
- this 32-bit application is also used when running on 64-bit
|
||||||
versions of Windows (AMD64 and IA64).
|
versions of Windows (AMD64 and IA64).
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,5 +45,3 @@ grant {
|
|||||||
permission java.util.PropertyPermission "java.vm.vendor", "read";
|
permission java.util.PropertyPermission "java.vm.vendor", "read";
|
||||||
permission java.util.PropertyPermission "java.vm.name", "read";
|
permission java.util.PropertyPermission "java.vm.name", "read";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,5 +45,3 @@ grant {
|
|||||||
permission java.util.PropertyPermission "java.vm.vendor", "read";
|
permission java.util.PropertyPermission "java.vm.vendor", "read";
|
||||||
permission java.util.PropertyPermission "java.vm.name", "read";
|
permission java.util.PropertyPermission "java.vm.name", "read";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,5 +127,3 @@ public class IPv6 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,6 +132,3 @@ case "$OS" in
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,40 +22,31 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 7003952
|
* @bug 7003952 7191662
|
||||||
|
* @library ..
|
||||||
* @summary load DLLs and launch executables using fully qualified path
|
* @summary load DLLs and launch executables using fully qualified path
|
||||||
*/
|
*/
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.lang.reflect.*;
|
|
||||||
|
|
||||||
public class Absolute {
|
public class Absolute {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Constructor cons;
|
|
||||||
try {
|
|
||||||
Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11");
|
|
||||||
cons = clazz.getConstructor(new Class[] {String.class});
|
|
||||||
} catch (Exception ex) {
|
|
||||||
System.out.println("Skipping test - no PKCS11 provider available");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String config =
|
String config =
|
||||||
System.getProperty("test.src", ".") + "/Absolute.cfg";
|
System.getProperty("test.src", ".") + "/Absolute.cfg";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object obj = cons.newInstance(new Object[] {config});
|
Provider p = PKCS11Test.getSunPKCS11(config);
|
||||||
} catch (InvocationTargetException ite) {
|
if (p == null) {
|
||||||
Throwable cause = ite.getCause();
|
System.out.println("Skipping test - no PKCS11 provider available");
|
||||||
if (cause instanceof ProviderException) {
|
}
|
||||||
Throwable cause2 = cause.getCause();
|
} catch (InvalidParameterException ipe) {
|
||||||
if ((cause2 == null) ||
|
Throwable ex = ipe.getCause();
|
||||||
!cause2.getMessage().startsWith(
|
if (ex.getMessage().indexOf(
|
||||||
"Absolute path required for library value:")) {
|
"Absolute path required for library value:") != -1) {
|
||||||
// rethrow
|
System.out.println("Test Passed: expected exception thrown");
|
||||||
throw (ProviderException) cause;
|
} else {
|
||||||
}
|
// rethrow
|
||||||
System.out.println("Caught expected Exception: \n" + cause2);
|
throw ipe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user