Mercurial > hg > jdk9-shenandoah > jdk
changeset 12734:7c33312230ff
Merge
author | iveresov |
---|---|
date | Mon, 07 Sep 2015 13:28:41 -0700 |
parents | 3e04ae642449 (current diff) 4e631cc0c9e0 (diff) |
children | 040b1184f05f |
files | src/java.base/unix/classes/sun/nio/fs/GnomeFileTypeDetector.java src/java.base/unix/native/libnio/fs/GnomeFileTypeDetector.c |
diffstat | 191 files changed, 1840 insertions(+), 543 deletions(-) [+] |
line wrap: on
line diff
--- a/README Thu Sep 03 15:04:05 2015 -0700 +++ b/README Mon Sep 07 13:28:41 2015 -0700 @@ -25,5 +25,3 @@ 5. Construct the images: cd make && gnumake images The resulting JDK image should be found in build/*/j2sdk-image - -
--- a/make/lib/Awt2dLibraries.gmk Thu Sep 03 15:04:05 2015 -0700 +++ b/make/lib/Awt2dLibraries.gmk Mon Sep 07 13:28:41 2015 -0700 @@ -887,7 +887,8 @@ $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \ DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \ 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, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/make/lib/CoreLibraries.gmk Thu Sep 03 15:04:05 2015 -0700 +++ b/make/lib/CoreLibraries.gmk Mon Sep 07 13:28:41 2015 -0700 @@ -146,6 +146,7 @@ OPTIMIZATION := HIGH, \ CFLAGS := $(CFLAGS_JDKLIB) \ $(LIBJAVA_CFLAGS), \ + DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ @@ -307,7 +308,9 @@ EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \ OPTIMIZATION := HIGH, \ 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, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/NetworkingLibraries.gmk Thu Sep 03 15:04:05 2015 -0700 +++ b/make/lib/NetworkingLibraries.gmk Mon Sep 07 13:28:41 2015 -0700 @@ -35,6 +35,7 @@ DISABLED_WARNINGS_gcc := format-nonliteral, \ DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \ DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \ + DISABLED_WARNINGS_solstudio := E_ARG_INCOMPATIBLE_WITH_ARG_L, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/NioLibraries.gmk Thu Sep 03 15:04:05 2015 -0700 +++ b/make/lib/NioLibraries.gmk Mon Sep 07 13:28:41 2015 -0700 @@ -47,7 +47,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS) BUILD_LIBNIO_EXFILES += \ - GnomeFileTypeDetector.c \ + GioFileTypeDetector.c \ # endif
--- a/make/mapfiles/libnio/mapfile-linux Thu Sep 03 15:04:05 2015 -0700 +++ b/make/mapfiles/libnio/mapfile-linux Mon Sep 07 13:28:41 2015 -0700 @@ -135,8 +135,8 @@ Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0; Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs; Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect; - Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio; - Java_sun_nio_fs_GnomeFileTypeDetector_probeGio; + Java_sun_nio_fs_GioFileTypeDetector_initializeGio; + Java_sun_nio_fs_GioFileTypeDetector_probeGio; Java_sun_nio_fs_MagicFileTypeDetector_initialize0; Java_sun_nio_fs_MagicFileTypeDetector_probe0; Java_sun_nio_fs_LinuxWatchService_eventSize;
--- a/make/mapfiles/libnio/mapfile-solaris Thu Sep 03 15:04:05 2015 -0700 +++ b/make/mapfiles/libnio/mapfile-solaris Mon Sep 07 13:28:41 2015 -0700 @@ -130,8 +130,8 @@ Java_sun_nio_ch_SolarisEventPort_port_1get; Java_sun_nio_ch_SolarisEventPort_port_1getn; Java_sun_nio_ch_SolarisEventPort_port_1send; - Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio; - Java_sun_nio_fs_GnomeFileTypeDetector_probeGio; + Java_sun_nio_fs_GioFileTypeDetector_initializeGio; + Java_sun_nio_fs_GioFileTypeDetector_probeGio; Java_sun_nio_fs_UnixNativeDispatcher_init; Java_sun_nio_fs_UnixNativeDispatcher_getcwd; Java_sun_nio_fs_UnixNativeDispatcher_strerror;
--- a/make/netbeans/jdbc/build.properties Thu Sep 03 15:04:05 2015 -0700 +++ b/make/netbeans/jdbc/build.properties Mon Sep 07 13:28:41 2015 -0700 @@ -43,4 +43,4 @@ build.number = b00 jdbc.version = ${build.release}-${user.name}-${build.number} jdbc.args = -debug -javadoc.options=-J-Xmx256m -Xdoclint:none -keywords -quiet \ No newline at end of file +javadoc.options=-J-Xmx256m -Xdoclint:none -keywords -quiet
--- a/src/demo/share/applets/Fractal/example1.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/demo/share/applets/Fractal/example1.html Mon Sep 07 13:28:41 2015 -0700 @@ -23,5 +23,3 @@ <a href="CLSFractal.java">The source</a>. </body> </html> - -
--- a/src/demo/share/applets/MoleculeViewer/example1.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/demo/share/applets/MoleculeViewer/example1.html Mon Sep 07 13:28:41 2015 -0700 @@ -14,9 +14,3 @@ <a href="XYZApp.java">The source</a>. </body> </html> - - - - - -
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java Mon Sep 07 13:28:41 2015 -0700 @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,7 @@ new GetPropertyAction("user.home")), ".mime.types"); Path etcMimeTypes = Paths.get("/etc/mime.types"); - return chain(new GnomeFileTypeDetector(), + return chain(new GioFileTypeDetector(), new MimeTypesFileTypeDetector(userMimeTypes), new MimeTypesFileTypeDetector(etcMimeTypes), new MagicFileTypeDetector());
--- a/src/java.base/share/classes/java/security/KeyStore.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/share/classes/java/security/KeyStore.java Mon Sep 07 13:28:41 2015 -0700 @@ -1611,8 +1611,13 @@ * First the keystore type is determined by probing the specified file. * Then a keystore object is instantiated and loaded using the data from * 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> * This method traverses the list of registered security
--- a/src/java.base/share/native/libzip/Adler32.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/share/native/libzip/Adler32.c Mon Sep 07 13:28:41 2015 -0700 @@ -66,5 +66,3 @@ } return adler; } - -
--- a/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Mon Sep 07 13:28:41 2015 -0700 @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -89,7 +89,7 @@ new GetPropertyAction("user.home")), ".mime.types"); Path etcMimeTypes = Paths.get("/etc/mime.types"); - return chain(new GnomeFileTypeDetector(), + return chain(new GioFileTypeDetector(), new MimeTypesFileTypeDetector(userMimeTypes), new MimeTypesFileTypeDetector(etcMimeTypes)); }
--- a/src/java.base/unix/classes/sun/net/www/content-types.properties Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/unix/classes/sun/net/www/content-types.properties Mon Sep 07 13:28:41 2015 -0700 @@ -275,6 +275,3 @@ application/xml: \ description=XML document;\ file_extensions=.xml - - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/unix/classes/sun/nio/fs/GioFileTypeDetector.java Mon Sep 07 13:28:41 2015 -0700 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2008, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.nio.fs; + +import java.nio.file.Path; +import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * File type detector that uses the GNOME I/O library to guess the + * MIME type of a file. + */ + +public class GioFileTypeDetector + extends AbstractFileTypeDetector +{ + // true if GIO is available + private final boolean gioAvailable; + + public GioFileTypeDetector() { + gioAvailable = initializeGio(); + } + + @Override + public String implProbeContentType(Path obj) throws IOException { + if (!gioAvailable) + return null; + if (!(obj instanceof UnixPath)) + return null; + + UnixPath path = (UnixPath)obj; + NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls()); + try { + // GIO may access file so need permission check + path.checkRead(); + byte[] type = probeGio(buffer.address()); + return (type == null) ? null : Util.toString(type); + } finally { + buffer.release(); + } + + } + + // GIO + 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); + + static { + AccessController.doPrivileged(new PrivilegedAction<>() { + public Void run() { + System.loadLibrary("nio"); + return null; + }}); + } +}
--- a/src/java.base/unix/classes/sun/nio/fs/GnomeFileTypeDetector.java Thu Sep 03 15:04:05 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2008, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.fs; - -import java.nio.file.Path; -import java.io.IOException; -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * File type detector that uses the GNOME I/O library to guess the - * MIME type of a file. - */ - -public class GnomeFileTypeDetector - extends AbstractFileTypeDetector -{ - // true if GIO is available - private final boolean gioAvailable; - - public GnomeFileTypeDetector() { - gioAvailable = initializeGio(); - } - - @Override - public String implProbeContentType(Path obj) throws IOException { - if (!gioAvailable) - return null; - if (!(obj instanceof UnixPath)) - return null; - - UnixPath path = (UnixPath)obj; - NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls()); - try { - // GIO may access file so need permission check - path.checkRead(); - byte[] type = probeGio(buffer.address()); - return (type == null) ? null : Util.toString(type); - } finally { - buffer.release(); - } - - } - - // GIO - private static native boolean initializeGio(); - private static synchronized native byte[] probeGio(long pathAddress); - - static { - AccessController.doPrivileged(new PrivilegedAction<>() { - public Void run() { - System.loadLibrary("nio"); - return null; - }}); - } -}
--- a/src/java.base/unix/native/libjava/FileDescriptor_md.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/unix/native/libjava/FileDescriptor_md.c Mon Sep 07 13:28:41 2015 -0700 @@ -26,9 +26,11 @@ #include <unistd.h> #include <fcntl.h> +#include "jni.h" +#include "jni_util.h" #include "jvm.h" + #include "io_util_md.h" - #include "java_io_FileDescriptor.h" /*******************************************************************/ @@ -47,8 +49,8 @@ JNIEXPORT void JNICALL Java_java_io_FileDescriptor_initIDs(JNIEnv *env, jclass fdClass) { - IO_fd_fdID = (*env)->GetFieldID(env, fdClass, "fd", "I"); - IO_append_fdID = (*env)->GetFieldID(env, fdClass, "append", "Z"); + CHECK_NULL(IO_fd_fdID = (*env)->GetFieldID(env, fdClass, "fd", "I")); + CHECK_NULL(IO_append_fdID = (*env)->GetFieldID(env, fdClass, "append", "Z")); } /**************************************************************
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/unix/native/libnio/fs/GioFileTypeDetector.c Mon Sep 07 13:28:41 2015 -0700 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2008, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "jni.h" +#include "jni_util.h" +#include "jvm.h" +#include "jlong.h" + +#include <stdlib.h> +#include <dlfcn.h> + +#ifdef __solaris__ +#include <strings.h> +#endif + +#if defined(__linux__) +#include <string.h> +#endif + +/* + * For reference see for example the GFileInfo section at + * https://developer.gnome.org/gio/unstable/. + */ + +/* Definitions for GIO */ + +#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type" + +typedef void* gpointer; +typedef struct _GFile GFile; +typedef struct _GFileInfo GFileInfo; +typedef struct _GCancellable GCancellable; +typedef struct _GError GError; + +typedef enum { + G_FILE_QUERY_INFO_NONE = 0 +} GFileQueryInfoFlags; + +typedef void (*g_type_init_func)(void); +typedef void (*g_object_unref_func)(gpointer object); +typedef GFile* (*g_file_new_for_path_func)(const char* path); +typedef GFileInfo* (*g_file_query_info_func)(GFile *file, + const char *attributes, GFileQueryInfoFlags flags, + GCancellable *cancellable, GError **error); +typedef char* (*g_file_info_get_content_type_func)(GFileInfo *info); + +static g_type_init_func g_type_init; +static g_object_unref_func g_object_unref; +static g_file_new_for_path_func g_file_new_for_path; +static g_file_query_info_func g_file_query_info; +static g_file_info_get_content_type_func g_file_info_get_content_type; + + +#include "sun_nio_fs_GioFileTypeDetector.h" + + +JNIEXPORT jboolean JNICALL +Java_sun_nio_fs_GioFileTypeDetector_initializeGio + (JNIEnv* env, jclass this) +{ + void* gio_handle; + + gio_handle = dlopen("libgio-2.0.so", RTLD_LAZY); + if (gio_handle == NULL) { + gio_handle = dlopen("libgio-2.0.so.0", RTLD_LAZY); + if (gio_handle == NULL) { + return JNI_FALSE; + } + } + + g_type_init = (g_type_init_func)dlsym(gio_handle, "g_type_init"); + (*g_type_init)(); + + g_object_unref = (g_object_unref_func)dlsym(gio_handle, "g_object_unref"); + + g_file_new_for_path = + (g_file_new_for_path_func)dlsym(gio_handle, "g_file_new_for_path"); + + g_file_query_info = + (g_file_query_info_func)dlsym(gio_handle, "g_file_query_info"); + + g_file_info_get_content_type = (g_file_info_get_content_type_func) + dlsym(gio_handle, "g_file_info_get_content_type"); + + + if (g_type_init == NULL || + g_object_unref == NULL || + g_file_new_for_path == NULL || + g_file_query_info == NULL || + g_file_info_get_content_type == NULL) + { + dlclose(gio_handle); + return JNI_FALSE; + } + + (*g_type_init)(); + return JNI_TRUE; +} + +JNIEXPORT jbyteArray JNICALL +Java_sun_nio_fs_GioFileTypeDetector_probeGio + (JNIEnv* env, jclass this, jlong pathAddress) +{ + char* path = (char*)jlong_to_ptr(pathAddress); + GFile* gfile; + GFileInfo* gfileinfo; + jbyteArray result = NULL; + + gfile = (*g_file_new_for_path)(path); + gfileinfo = (*g_file_query_info)(gfile, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + G_FILE_QUERY_INFO_NONE, NULL, NULL); + if (gfileinfo != NULL) { + const char* mime = (*g_file_info_get_content_type)(gfileinfo); + if (mime != NULL) { + jsize len = strlen(mime); + result = (*env)->NewByteArray(env, len); + if (result != NULL) { + (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)mime); + } + } + (*g_object_unref)(gfileinfo); + } + (*g_object_unref)(gfile); + + return result; +}
--- a/src/java.base/unix/native/libnio/fs/GnomeFileTypeDetector.c Thu Sep 03 15:04:05 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2008, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni.h" -#include "jni_util.h" -#include "jvm.h" -#include "jlong.h" - -#include <stdlib.h> -#include <dlfcn.h> - -#ifdef __solaris__ -#include <strings.h> -#endif - -#if defined(__linux__) -#include <string.h> -#endif - -/* - * For reference see for example the GFileInfo section at - * https://developer.gnome.org/gio/unstable/. - */ - -/* Definitions for GIO */ - -#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type" - -typedef void* gpointer; -typedef struct _GFile GFile; -typedef struct _GFileInfo GFileInfo; -typedef struct _GCancellable GCancellable; -typedef struct _GError GError; - -typedef enum { - G_FILE_QUERY_INFO_NONE = 0 -} GFileQueryInfoFlags; - -typedef void (*g_type_init_func)(void); -typedef void (*g_object_unref_func)(gpointer object); -typedef GFile* (*g_file_new_for_path_func)(const char* path); -typedef GFileInfo* (*g_file_query_info_func)(GFile *file, - const char *attributes, GFileQueryInfoFlags flags, - GCancellable *cancellable, GError **error); -typedef char* (*g_file_info_get_content_type_func)(GFileInfo *info); - -static g_type_init_func g_type_init; -static g_object_unref_func g_object_unref; -static g_file_new_for_path_func g_file_new_for_path; -static g_file_query_info_func g_file_query_info; -static g_file_info_get_content_type_func g_file_info_get_content_type; - - -#include "sun_nio_fs_GnomeFileTypeDetector.h" - - -JNIEXPORT jboolean JNICALL -Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio - (JNIEnv* env, jclass this) -{ - void* gio_handle; - - gio_handle = dlopen("libgio-2.0.so", RTLD_LAZY); - if (gio_handle == NULL) { - gio_handle = dlopen("libgio-2.0.so.0", RTLD_LAZY); - if (gio_handle == NULL) { - return JNI_FALSE; - } - } - - g_type_init = (g_type_init_func)dlsym(gio_handle, "g_type_init"); - (*g_type_init)(); - - g_object_unref = (g_object_unref_func)dlsym(gio_handle, "g_object_unref"); - - g_file_new_for_path = - (g_file_new_for_path_func)dlsym(gio_handle, "g_file_new_for_path"); - - g_file_query_info = - (g_file_query_info_func)dlsym(gio_handle, "g_file_query_info"); - - g_file_info_get_content_type = (g_file_info_get_content_type_func) - dlsym(gio_handle, "g_file_info_get_content_type"); - - - if (g_type_init == NULL || - g_object_unref == NULL || - g_file_new_for_path == NULL || - g_file_query_info == NULL || - g_file_info_get_content_type == NULL) - { - dlclose(gio_handle); - return JNI_FALSE; - } - - (*g_type_init)(); - return JNI_TRUE; -} - -JNIEXPORT jbyteArray JNICALL -Java_sun_nio_fs_GnomeFileTypeDetector_probeGio - (JNIEnv* env, jclass this, jlong pathAddress) -{ - char* path = (char*)jlong_to_ptr(pathAddress); - GFile* gfile; - GFileInfo* gfileinfo; - jbyteArray result = NULL; - - gfile = (*g_file_new_for_path)(path); - gfileinfo = (*g_file_query_info)(gfile, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, - G_FILE_QUERY_INFO_NONE, NULL, NULL); - if (gfileinfo != NULL) { - const char* mime = (*g_file_info_get_content_type)(gfileinfo); - if (mime != NULL) { - jsize len = strlen(mime); - result = (*env)->NewByteArray(env, len); - if (result != NULL) { - (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)mime); - } - } - (*g_object_unref)(gfileinfo); - } - (*g_object_unref)(gfile); - - return result; -}
--- a/src/java.base/windows/classes/sun/net/www/content-types.properties Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.base/windows/classes/sun/net/www/content-types.properties Mon Sep 07 13:28:41 2015 -0700 @@ -272,5 +272,3 @@ application/xml: \ description=XML document;\ file_extensions=.xml - -
--- a/src/java.desktop/macosx/classes/com/apple/eawt/_OpenAppHandler.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/macosx/classes/com/apple/eawt/_OpenAppHandler.java Mon Sep 07 13:28:41 2015 -0700 @@ -27,4 +27,4 @@ interface _OpenAppHandler { void handleOpenApp(); -} \ No newline at end of file +}
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java Mon Sep 07 13:28:41 2015 -0700 @@ -1098,4 +1098,4 @@ }; table.putDefaults(uiDefaults); } -} \ No newline at end of file +}
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Mon Sep 07 13:28:41 2015 -0700 @@ -278,5 +278,3 @@ return false; } } - -
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Mon Sep 07 13:28:41 2015 -0700 @@ -1406,5 +1406,3 @@ return underMouse; } - -
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m Mon Sep 07 13:28:41 2015 -0700 @@ -289,4 +289,4 @@ JNF_COCOA_EXIT(env); return ret; -} \ No newline at end of file +}
--- a/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java Mon Sep 07 13:28:41 2015 -0700 @@ -183,4 +183,4 @@ return false; } } -} \ No newline at end of file +}
--- a/src/java.desktop/share/native/libfontmanager/layout/AnchorTables.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/AnchorTables.h Mon Sep 07 13:28:41 2015 -0700 @@ -80,5 +80,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/CharSubstitutionFilter.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/CharSubstitutionFilter.h Mon Sep 07 13:28:41 2015 -0700 @@ -104,5 +104,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.h Mon Sep 07 13:28:41 2015 -0700 @@ -63,5 +63,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/DeviceTables.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/DeviceTables.h Mon Sep 07 13:28:41 2015 -0700 @@ -61,5 +61,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/MPreFixups.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/MPreFixups.h Mon Sep 07 13:28:41 2015 -0700 @@ -63,5 +63,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/MarkArrays.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/MarkArrays.h Mon Sep 07 13:28:41 2015 -0700 @@ -62,5 +62,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/PairPositioningSubtables.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/PairPositioningSubtables.h Mon Sep 07 13:28:41 2015 -0700 @@ -109,5 +109,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/SinglePositioningSubtables.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/SinglePositioningSubtables.h Mon Sep 07 13:28:41 2015 -0700 @@ -71,5 +71,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.h Mon Sep 07 13:28:41 2015 -0700 @@ -68,5 +68,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/ThaiShaping.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/ThaiShaping.h Mon Sep 07 13:28:41 2015 -0700 @@ -129,5 +129,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/libfontmanager/layout/ValueRecords.h Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libfontmanager/layout/ValueRecords.h Mon Sep 07 13:28:41 2015 -0700 @@ -94,5 +94,3 @@ U_NAMESPACE_END #endif - -
--- a/src/java.desktop/share/native/liblcms/cmslut.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/liblcms/cmslut.c Mon Sep 07 13:28:41 2015 -0700 @@ -1836,5 +1836,3 @@ return TRUE; } - -
--- a/src/java.desktop/share/native/liblcms/cmsmtrx.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/liblcms/cmsmtrx.c Mon Sep 07 13:28:41 2015 -0700 @@ -201,5 +201,3 @@ 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]; } - -
--- a/src/java.desktop/share/native/liblcms/cmsplugin.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/liblcms/cmsplugin.c Mon Sep 07 13:28:41 2015 -0700 @@ -989,5 +989,3 @@ { return _cmsContextGetClientChunk(ContextID, UserPtr); } - -
--- a/src/java.desktop/share/native/liblcms/cmswtpnt.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/liblcms/cmswtpnt.c Mon Sep 07 13:28:41 2015 -0700 @@ -376,5 +376,3 @@ return TRUE; } - -
--- a/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c Mon Sep 07 13:28:41 2015 -0700 @@ -234,4 +234,4 @@ return 1; } return splash->scaleFactor; -} \ No newline at end of file +}
--- a/src/java.desktop/windows/native/libawt/windows/DllUtil.cpp Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/windows/native/libawt/windows/DllUtil.cpp Mon Sep 07 13:28:41 2015 -0700 @@ -84,5 +84,3 @@ } throw FunctionUnavailableException(); } - -
--- a/src/java.desktop/windows/native/libawt/windows/README.JNI Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.desktop/windows/native/libawt/windows/README.JNI Mon Sep 07 13:28:41 2015 -0700 @@ -131,5 +131,3 @@ 2. Handle exceptions properly. The current code lacks error checking and recovery. This leads to random runtime crashes. - -
--- a/src/java.logging/share/classes/java/util/logging/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.logging/share/classes/java/util/logging/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -126,8 +126,3 @@ </body> </html> - - - - -
--- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/DelegationPermission.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/DelegationPermission.java Mon Sep 07 13:28:41 2015 -0700 @@ -132,7 +132,9 @@ * Checks if this Kerberos delegation permission object "implies" the * specified permission. * <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. * * @return true if the specified permission is implied by this object,
--- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/ServicePermission.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/ServicePermission.java Mon Sep 07 13:28:41 2015 -0700 @@ -179,7 +179,16 @@ * Checks if this Kerberos service permission object "implies" the * specified permission. * <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. * * @return true if the specified permission is implied by this object,
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java Mon Sep 07 13:28:41 2015 -0700 @@ -4467,4 +4467,4 @@ static final long serialVersionUID = 4886719666485113312L; -} //end class \ No newline at end of file +} //end class
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetFactory.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetFactory.java Mon Sep 07 13:28:41 2015 -0700 @@ -96,4 +96,4 @@ */ public WebRowSet createWebRowSet() throws SQLException; -} \ No newline at end of file +}
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> algorithm factories. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> basic handlers for elements that can occur inside <CODE>ds:KeyValue</CODE>. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> basic handlers for elements that can occur inside <CODE>ds:KeyInfo</CODE>. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> basic handlers for elements that can occur inside <CODE>ds:X509Data</CODE>. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> implementations for retrieval of certificates and public keys from elements. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> the resolver framework for retrieval of certificates and public keys from elements. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> implementations of resolvers for retrieval for certificates and public keys from user-specified locations. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/package.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/package.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ <HTML><HEAD></HEAD><BODY><P> a resolver framework for certificates and public keys from user-specified locations. -</P></BODY></HTML> \ No newline at end of file +</P></BODY></HTML>
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformParam.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/TransformParam.java Mon Sep 07 13:28:41 2015 -0700 @@ -24,4 +24,4 @@ package com.sun.org.apache.xml.internal.security.transforms; public interface TransformParam { -} \ No newline at end of file +}
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Mon Sep 07 13:28:41 2015 -0700 @@ -65,8 +65,9 @@ // only support legacy JAR URL syntax jar:{uri}!/{entry} for now String spec = uri.getRawSchemeSpecificPart(); int sep = spec.indexOf("!/"); - if (sep != -1) + if (sep != -1) { spec = spec.substring(0, sep); + } return Paths.get(new URI(spec)).toAbsolutePath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage(), e); @@ -107,6 +108,9 @@ // assume NOT a zip/jar file throw new UnsupportedOperationException(); } + if (realPath == null) { // newly created + realPath = path.toRealPath(); + } filesystems.put(realPath, zipfs); return zipfs; } @@ -132,7 +136,6 @@ @Override public Path getPath(URI uri) { - String spec = uri.getSchemeSpecificPart(); int sep = spec.indexOf("!/"); if (sep == -1)
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Thu Sep 03 15:04:05 2015 -0700 +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Mon Sep 07 13:28:41 2015 -0700 @@ -32,10 +32,10 @@ import java.nio.file.DirectoryStream.Filter; import java.nio.file.attribute.*; import java.util.*; +import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.file.StandardOpenOption.*; import static java.nio.file.StandardCopyOption.*; - /** * * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal @@ -180,7 +180,7 @@ public URI toUri() { try { return new URI("jar", - zfs.getZipFile().toUri() + + decodeUri(zfs.getZipFile().toUri().toString()) + "!" + zfs.getString(toAbsolutePath().path), null); @@ -866,4 +866,57 @@ } } } + + private static int decode(char c) { + if ((c >= '0') && (c <= '9')) + return c - '0'; + if ((c >= 'a') && (c <= 'f')) + return c - 'a' + 10; + if ((c >= 'A') && (c <= 'F')) + return c - 'A' + 10; + assert false; + return -1; + } + + // to avoid double escape + static String decodeUri(String s) { + if (s == null) + return s; + int n = s.length(); + if (n == 0) + return s; + if (s.indexOf('%') < 0) + return s; + + StringBuilder sb = new StringBuilder(n); + byte[] bb = new byte[n]; + boolean betweenBrackets = false; + + for (int i = 0; i < n;) { + char c = s.charAt(i); + if (c == '[') { + betweenBrackets = true; + } else if (betweenBrackets && c == ']') { + betweenBrackets = false; + } + if (c != '%' || betweenBrackets ) { + sb.append(c); + i++; + continue; + } + int nb = 0; + while (c == '%') { + assert (n - i >= 2); + bb[nb++] = (byte)(((decode(s.charAt(++i)) & 0xf) << 4) | + (decode(s.charAt(++i)) & 0xf)); + if (++i >= n) { + break; + } + c = s.charAt(i); + } + sb.append(new String(bb, 0, nb, UTF_8)); + } + return sb.toString(); + } + }
--- a/src/sample/share/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml Thu Sep 03 15:04:05 2015 -0700 +++ b/src/sample/share/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml Mon Sep 07 13:28:41 2015 -0700 @@ -54,4 +54,4 @@ <value>4</value> </entry> </supportedModules> -</device> \ No newline at end of file +</device>
--- a/src/sample/share/annotations/index.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/sample/share/annotations/index.html Mon Sep 07 13:28:41 2015 -0700 @@ -64,4 +64,4 @@ Sources: <a href="Validator/src/">Validator/src/</a> </ul> </body> -</html> \ No newline at end of file +</html>
--- a/src/sample/share/lambda/BulkDataOperations/index.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/sample/share/lambda/BulkDataOperations/index.html Mon Sep 07 13:28:41 2015 -0700 @@ -46,4 +46,4 @@ Source: <a href="src/WC.java">src/WC.java</a> </ul> </body> -</html> \ No newline at end of file +</html>
--- a/src/sample/share/try-with-resources/index.html Thu Sep 03 15:04:05 2015 -0700 +++ b/src/sample/share/try-with-resources/index.html Mon Sep 07 13:28:41 2015 -0700 @@ -33,4 +33,4 @@ </ul> </body> -</html> \ No newline at end of file +</html>
--- a/test/ProblemList.txt Thu Sep 03 15:04:05 2015 -0700 +++ b/test/ProblemList.txt Mon Sep 07 13:28:41 2015 -0700 @@ -319,6 +319,9 @@ # jdk_time +# 8134979 +java/time/tck/java/time/chrono/TCKJapaneseChronology.java generic-all + ############################################################################ # jdk_tools @@ -384,6 +387,11 @@ # 6456333 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 sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
--- a/test/TEST.ROOT Thu Sep 03 15:04:05 2015 -0700 +++ b/test/TEST.ROOT Mon Sep 07 13:28:41 2015 -0700 @@ -18,7 +18,7 @@ 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 -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 groups=TEST.groups [closed/TEST.groups]
--- a/test/com/sun/awt/SecurityWarning/GetSizeShouldNotReturnZero.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/awt/SecurityWarning/GetSizeShouldNotReturnZero.java Mon Sep 07 13:28:41 2015 -0700 @@ -374,5 +374,3 @@ } }// TestDialog class - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/Blowfish/TestCipherBlowfish.java Mon Sep 07 13:28:41 2015 -0700 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/DES/TestCipherDES.java Mon Sep 07 13:28:41 2015 -0700 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/DES/TestCipherDESede.java Mon Sep 07 13:28:41 2015 -0700 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBE.java Mon Sep 07 13:28:41 2015 -0700 @@ -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; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/TestCipher.java Mon Sep 07 13:28:41 2015 -0700 @@ -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; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/TextLength/DESCipherWrapper.java Mon Sep 07 13:28:41 2015 -0700 @@ -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"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/TextLength/PBECipherWrapper.java Mon Sep 07 13:28:41 2015 -0700 @@ -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); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/crypto/provider/Cipher/TextLength/TestCipherTextLength.java Mon Sep 07 13:28:41 2015 -0700 @@ -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); + } + } +}
--- a/test/com/sun/crypto/provider/Mac/Utils.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/crypto/provider/Mac/Utils.java Mon Sep 07 13:28:41 2015 -0700 @@ -76,4 +76,4 @@ interface MacTest { void doTest(String alg) throws Exception; -} \ No newline at end of file +}
--- a/test/com/sun/jdi/InterfaceMethodsTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/jdi/InterfaceMethodsTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -442,6 +442,3 @@ } } } - - -
--- a/test/com/sun/jdi/ShellScaffold.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/jdi/ShellScaffold.sh Mon Sep 07 13:28:41 2015 -0700 @@ -1215,5 +1215,3 @@ # Don't know how this arises debuggeeFailIfPresent "Internal exception" } - -
--- a/test/com/sun/jmx/remote/NotificationMarshalVersions/Client/ConfigKey.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/jmx/remote/NotificationMarshalVersions/Client/ConfigKey.java Mon Sep 07 13:28:41 2015 -0700 @@ -23,4 +23,4 @@ public enum ConfigKey { CONSTANT3, CONSTANT2; -} \ No newline at end of file +}
--- a/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/ConfigKey.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/ConfigKey.java Mon Sep 07 13:28:41 2015 -0700 @@ -23,4 +23,4 @@ public enum ConfigKey { CONSTANT1, CONSTANT2; -} \ No newline at end of file +}
--- a/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Ste.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Ste.java Mon Sep 07 13:28:41 2015 -0700 @@ -29,4 +29,4 @@ public void foo() { sendNotification(new TestNotification("test", this, count++)); } -} \ No newline at end of file +}
--- a/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/SteMBean.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/SteMBean.java Mon Sep 07 13:28:41 2015 -0700 @@ -23,4 +23,4 @@ public interface SteMBean { public void foo(); -} \ No newline at end of file +}
--- a/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy Thu Sep 03 15:04:05 2015 -0700 +++ b/test/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy Mon Sep 07 13:28:41 2015 -0700 @@ -7,5 +7,3 @@ //permission java.net.SocketPermission "*:636", "connect"; //permission javax.security.auth.AuthPermission "modifyPrincipals"; }; - -
--- a/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java Mon Sep 07 13:28:41 2015 -0700 @@ -212,4 +212,4 @@ throw new RuntimeException(e); } } -} \ No newline at end of file +}
--- a/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java Mon Sep 07 13:28:41 2015 -0700 @@ -163,4 +163,4 @@ throw new RuntimeException(e); } } -} \ No newline at end of file +}
--- a/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java Mon Sep 07 13:28:41 2015 -0700 @@ -69,4 +69,4 @@ } }); } -} \ No newline at end of file +}
--- a/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html Mon Sep 07 13:28:41 2015 -0700 @@ -29,4 +29,4 @@ <applet CODE="MultiResolutionCursorTest.class" WIDTH=300 HEIGHT=100></applet> <p> See the dialog box (usually in upper left corner) for instructions</p> </body> -</html> \ No newline at end of file +</html>
--- a/test/java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -134,4 +134,4 @@ throw new RuntimeException("file chooser is underneath"); } } -} \ No newline at end of file +}
--- a/test/java/awt/Focus/6981400/Test3.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Focus/6981400/Test3.java Mon Sep 07 13:28:41 2015 -0700 @@ -135,5 +135,3 @@ } } } - -
--- a/test/java/awt/FontClass/LCDScale.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/FontClass/LCDScale.java Mon Sep 07 13:28:41 2015 -0700 @@ -79,5 +79,3 @@ } } } - -
--- a/test/java/awt/Frame/FramesGC/FramesGC.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Frame/FramesGC/FramesGC.java Mon Sep 07 13:28:41 2015 -0700 @@ -156,4 +156,4 @@ refs.add(new PhantomReference<Frame>(frame, que)); } -} \ No newline at end of file +}
--- a/test/java/awt/Frame/MaximizedToUnmaximized/MaximizedToUnmaximized.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Frame/MaximizedToUnmaximized/MaximizedToUnmaximized.java Mon Sep 07 13:28:41 2015 -0700 @@ -76,4 +76,4 @@ frame.dispose(); } } -} \ No newline at end of file +}
--- a/test/java/awt/MenuBar/RemoveHelpMenu/RemoveHelpMenu.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/MenuBar/RemoveHelpMenu/RemoveHelpMenu.java Mon Sep 07 13:28:41 2015 -0700 @@ -129,4 +129,4 @@ checkMenuCount(menuBar, 0); checkHelpMenu(helpMenu, false); } -} \ No newline at end of file +}
--- a/test/java/awt/Mixing/JButtonInGlassPane.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Mixing/JButtonInGlassPane.java Mon Sep 07 13:28:41 2015 -0700 @@ -426,5 +426,3 @@ } }// TestDialog class - -
--- a/test/java/awt/Mixing/LWComboBox.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Mixing/LWComboBox.java Mon Sep 07 13:28:41 2015 -0700 @@ -421,5 +421,3 @@ } }// TestDialog class - -
--- a/test/java/awt/Mixing/MixingInHwPanel.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Mixing/MixingInHwPanel.java Mon Sep 07 13:28:41 2015 -0700 @@ -424,5 +424,3 @@ } }// TestDialog class - -
--- a/test/java/awt/Mixing/MixingOnShrinkingHWButton.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Mixing/MixingOnShrinkingHWButton.java Mon Sep 07 13:28:41 2015 -0700 @@ -425,5 +425,3 @@ } }// TestDialog class - -
--- a/test/java/awt/Mixing/NonOpaqueInternalFrame.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Mixing/NonOpaqueInternalFrame.java Mon Sep 07 13:28:41 2015 -0700 @@ -430,5 +430,3 @@ } }// TestDialog class - -
--- a/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -100,4 +100,4 @@ frame.add(panel, BorderLayout.CENTER); frame.setVisible(true); } -} \ No newline at end of file +}
--- a/test/java/awt/MouseInfo/JContainerMousePositionTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/MouseInfo/JContainerMousePositionTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -144,5 +144,3 @@ frame1.setVisible(true); } } - -
--- a/test/java/awt/Robot/RobotWheelTest/RobotWheelTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Robot/RobotWheelTest/RobotWheelTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -80,4 +80,4 @@ } } } -} \ No newline at end of file +}
--- a/test/java/awt/ScrollPane/bug8077409Test.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/ScrollPane/bug8077409Test.java Mon Sep 07 13:28:41 2015 -0700 @@ -112,4 +112,4 @@ } } -} \ No newline at end of file +}
--- a/test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -148,4 +148,4 @@ "JPopupMenu shown and menu item selected using keyboard"); } -} \ No newline at end of file +}
--- a/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -59,4 +59,4 @@ window.setVisible(true); return window; } -} \ No newline at end of file +}
--- a/test/java/awt/applet/Applet/AppletFlipBuffer.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/applet/Applet/AppletFlipBuffer.java Mon Sep 07 13:28:41 2015 -0700 @@ -52,4 +52,4 @@ frame.dispose(); } } -} \ No newline at end of file +}
--- a/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/test.html Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/test.html Mon Sep 07 13:28:41 2015 -0700 @@ -41,4 +41,4 @@ <APPLET CODE="IOExceptionIfEncodedURLTest.class" WIDTH=200 HEIGHT=200></APPLET> </body> -</html> \ No newline at end of file +</html>
--- a/test/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -168,4 +168,4 @@ } } } -} \ No newline at end of file +}
--- a/test/java/awt/datatransfer/DataFlavor/XJavaUrlDataFlavorTest/XJavaUrlDataFlavorTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/datatransfer/DataFlavor/XJavaUrlDataFlavorTest/XJavaUrlDataFlavorTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -342,4 +342,4 @@ } } -}// TestDialog class \ No newline at end of file +}// TestDialog class
--- a/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MyTransferable.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MyTransferable.java Mon Sep 07 13:28:41 2015 -0700 @@ -59,4 +59,4 @@ throw new UnsupportedFlavorException(flavor); } } -} \ No newline at end of file +}
--- a/test/java/awt/event/MouseEvent/CTORRestrictions/CTORRestrictions_Disable.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/event/MouseEvent/CTORRestrictions/CTORRestrictions_Disable.java Mon Sep 07 13:28:41 2015 -0700 @@ -120,5 +120,3 @@ frame.dispatchEvent( ( AWTEvent )meOld ); } } - -
--- a/test/java/awt/im/4490692/bug4490692.html Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/im/4490692/bug4490692.html Mon Sep 07 13:28:41 2015 -0700 @@ -59,5 +59,3 @@ <APPLET CODE="bug4490692.class" WIDTH=0 HEIGHT=0></APPLET> </body> </html> - -
--- a/test/java/awt/im/4959409/bug4959409.html Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/awt/im/4959409/bug4959409.html Mon Sep 07 13:28:41 2015 -0700 @@ -45,5 +45,3 @@ <APPLET CODE="bug4959409.class" WIDTH=0 HEIGHT=0></APPLET> </body> </html> - -
--- a/test/java/beans/README Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/beans/README Mon Sep 07 13:28:41 2015 -0700 @@ -73,4 +73,4 @@ If this object is not null it will be encoded and decoded. Also the object updating will be tested in this case. The test() method has a boolean parameter, -which indicates that the test should be started in secure context. \ No newline at end of file +which indicates that the test should be started in secure context.
--- a/test/java/beans/SimpleBeanInfo/LoadingStandardIcons/java.policy Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/beans/SimpleBeanInfo/LoadingStandardIcons/java.policy Mon Sep 07 13:28:41 2015 -0700 @@ -1,1 +1,1 @@ -; \ No newline at end of file +;
--- a/test/java/io/Serializable/evolution/AddedSuperClass/README Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/io/Serializable/evolution/AddedSuperClass/README Mon Sep 07 13:28:41 2015 -0700 @@ -12,6 +12,3 @@ rm A.class AddedSuperClass.class javac ReadAddedSuperClass2.java java ReadAddedSuperClass2 - - -
--- a/test/java/lang/ClassLoader/getdotresource.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/lang/ClassLoader/getdotresource.sh Mon Sep 07 13:28:41 2015 -0700 @@ -44,5 +44,3 @@ # now start the test ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${PS}${TESTCLASSES} GetDotResource - -
--- a/test/java/lang/SecurityManager/RestrictedPackages.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/lang/SecurityManager/RestrictedPackages.java Mon Sep 07 13:28:41 2015 -0700 @@ -77,7 +77,8 @@ "jdk.nashorn.internal.", "jdk.nashorn.tools.", "jdk.tools.jimage.", - "com.sun.activation.registries." + "com.sun.activation.registries.", + "com.sun.java.accessibility.util.internal." }; /* @@ -126,6 +127,9 @@ if (OS_NAME.contains("OS X")) { pkgs.add("apple."); // add apple package for OS X } + if (OS_NAME.contains("Win")) { + pkgs.add("com.sun.java.accessibility.internal."); // add Win only package + } return pkgs; }
--- a/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh Mon Sep 07 13:28:41 2015 -0700 @@ -69,5 +69,3 @@ then echo "$failures test(s) failed"; else echo "All test(s) passed"; fi exit $failures - -
--- a/test/java/net/SocketPermission/policy Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/net/SocketPermission/policy Mon Sep 07 13:28:41 2015 -0700 @@ -1,3 +1,3 @@ grant { permission java.security.AllPermission; -}; \ No newline at end of file +};
--- a/test/java/nio/channels/SocketChannel/Open.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/nio/channels/SocketChannel/Open.sh Mon Sep 07 13:28:41 2015 -0700 @@ -33,6 +33,3 @@ * ) echo "unrecognized system: $OS" ;; esac - - -
--- a/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/README Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/README Mon Sep 07 13:28:41 2015 -0700 @@ -31,5 +31,3 @@ (c) Execute the make script :- Solaris: gnumake all Linux: gmake all - -
--- a/test/java/nio/file/Files/probeContentType/ParallelProbes.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/nio/file/Files/probeContentType/ParallelProbes.java Mon Sep 07 13:28:41 2015 -0700 @@ -21,17 +21,18 @@ * questions. */ -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; - /* @test * @summary Test probing content type simultaneously from multiple threads. * @requires (os.family == "linux") | (os.family == "solaris") * @build ParallelProbes SimpleFileTypeDetector * @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 { private static final int REPEATS = 1000;
--- a/test/java/rmi/registry/readTest/readTest.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/rmi/registry/readTest/readTest.sh Mon Sep 07 13:28:41 2015 -0700 @@ -125,5 +125,3 @@ fi rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp exit ${exitCode} - -
--- a/test/java/security/KeyStore/PKCS12/README Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/security/KeyStore/PKCS12/README Mon Sep 07 13:28:41 2015 -0700 @@ -25,4 +25,4 @@ 3. Import certificate <JAVA-HOME>/bin/keytool -import -alias pkcs12test -keystore ks-pkcs.data --storepass storepass -file pkcs12testCA.cer.data \ No newline at end of file +-storepass storepass -file pkcs12testCA.cer.data
--- a/test/java/security/SignedObject/Copy.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/security/SignedObject/Copy.java Mon Sep 07 13:28:41 2015 -0700 @@ -119,5 +119,3 @@ } } } - -
--- a/test/java/util/AbstractCollection/ToArrayTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/util/AbstractCollection/ToArrayTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -211,5 +211,3 @@ else {System.out.println(x + " not equal to " + y); fail(); } } } - -
--- a/test/java/util/Arrays/SetAllTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/util/Arrays/SetAllTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -278,4 +278,4 @@ // expected } } -} \ No newline at end of file +}
--- a/test/java/util/Locale/bug4123285.html Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/util/Locale/bug4123285.html Mon Sep 07 13:28:41 2015 -0700 @@ -1,1 +1,1 @@ -<APPLET CODE="bug4123285.class" CODEBASE="./" WIDTH="250" HEIGHT="325" ALIGN="TOP"></APPLET> \ No newline at end of file +<APPLET CODE="bug4123285.class" CODEBASE="./" WIDTH="250" HEIGHT="325" ALIGN="TOP"></APPLET>
--- a/test/java/util/concurrent/CompletableFuture/ThenComposeExceptionTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/util/concurrent/CompletableFuture/ThenComposeExceptionTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -120,4 +120,4 @@ Assert.assertTrue(eOnWhenComplete.get() instanceof CompletionException, "Incorrect exception passed to whenComplete: " + eOnWhenComplete.get()); } -} \ No newline at end of file +}
--- a/test/java/util/logging/LogManager/Configuration/TestConfigurationLock.properties Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/util/logging/LogManager/Configuration/TestConfigurationLock.properties Mon Sep 07 13:28:41 2015 -0700 @@ -18,5 +18,3 @@ foo.bar.l10.level = INFO foo.bar.l100.level = INFO foo.bar.l1000.level = INFO - -
--- a/test/java/util/stream/bootlib/java/util/stream/DefaultMethodStreams.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/java/util/stream/bootlib/java/util/stream/DefaultMethodStreams.java Mon Sep 07 13:28:41 2015 -0700 @@ -981,4 +981,4 @@ s.close(); } } -} \ No newline at end of file +}
--- a/test/javax/crypto/SecretKeyFactory/PBKDF2TranslateTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/crypto/SecretKeyFactory/PBKDF2TranslateTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -267,4 +267,4 @@ } } -} \ No newline at end of file +}
--- a/test/javax/imageio/plugins/shared/CanWriteSequence.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/imageio/plugins/shared/CanWriteSequence.java Mon Sep 07 13:28:41 2015 -0700 @@ -75,4 +75,4 @@ writer.dispose(); ios.close(); } -} \ No newline at end of file +}
--- a/test/javax/management/MustBeValidMBeanInfo/logging.properties Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/management/MustBeValidMBeanInfo/logging.properties Mon Sep 07 13:28:41 2015 -0700 @@ -11,4 +11,4 @@ java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -javax.management.misc.level = FINEST \ No newline at end of file +javax.management.misc.level = FINEST
--- a/test/javax/management/modelmbean/SimpleModelMBean/logging.properties Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/management/modelmbean/SimpleModelMBean/logging.properties Mon Sep 07 13:28:41 2015 -0700 @@ -11,4 +11,4 @@ java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -javax.management.misc.level = FINEST \ No newline at end of file +javax.management.misc.level = FINEST
--- a/test/javax/security/auth/Subject/doAs/policy.expect.ace Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/security/auth/Subject/doAs/policy.expect.ace Mon Sep 07 13:28:41 2015 -0700 @@ -24,4 +24,4 @@ grant codeBase "file:ReadPropertyNegativeAction.jar" Principal javax.security.auth.x500.X500Principal "cn=Duke" { permission java.security.AllPermission; -}; \ No newline at end of file +};
--- a/test/javax/security/auth/Subject/doAs/policy.one.principal Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/security/auth/Subject/doAs/policy.one.principal Mon Sep 07 13:28:41 2015 -0700 @@ -33,4 +33,4 @@ permission javax.security.auth.AuthPermission "getSubject"; permission javax.security.auth.AuthPermission "doAs"; permission java.util.PropertyPermission "java.class.path", "read"; -}; \ No newline at end of file +};
--- a/test/javax/security/auth/Subject/doAs/policy.two.principals Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/security/auth/Subject/doAs/policy.two.principals Mon Sep 07 13:28:41 2015 -0700 @@ -34,4 +34,4 @@ permission javax.security.auth.AuthPermission "getSubject"; permission javax.security.auth.AuthPermission "doAs"; permission java.util.PropertyPermission "java.class.path", "read"; -}; \ No newline at end of file +};
--- a/test/javax/security/auth/login/LoginContext/shared.config Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/security/auth/login/LoginContext/shared.config Mon Sep 07 13:28:41 2015 -0700 @@ -1,4 +1,4 @@ SharedState { SharedState$FirstModule required; SharedState$SecondModule required; -}; \ No newline at end of file +};
--- a/test/javax/sound/midi/Devices/InitializationHang.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/sound/midi/Devices/InitializationHang.java Mon Sep 07 13:28:41 2015 -0700 @@ -28,6 +28,7 @@ /** * @test * @bug 8068412 + * @key headful * @author Sergey Bylokhov */ public final class InitializationHang {
--- a/test/javax/sound/midi/Gervill/ModelStandardIndexedDirector/ModelStandardIndexedDirectorTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/sound/midi/Gervill/ModelStandardIndexedDirector/ModelStandardIndexedDirectorTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -184,5 +184,3 @@ } } - -
--- a/test/javax/swing/JColorChooser/8065098/bug8065098.html Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JColorChooser/8065098/bug8065098.html Mon Sep 07 13:28:41 2015 -0700 @@ -37,4 +37,4 @@ <applet width="500" height="1" code="bug8065098.class"> </applet> </body> -</html> \ No newline at end of file +</html>
--- a/test/javax/swing/JFileChooser/8062561/security2.policy Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JFileChooser/8062561/security2.policy Mon Sep 07 13:28:41 2015 -0700 @@ -1,1 +1,1 @@ -// Autogenerated file \ No newline at end of file +// Autogenerated file
--- a/test/javax/swing/JFileChooser/FileFilterDescription/FileFilterDescription.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JFileChooser/FileFilterDescription/FileFilterDescription.java Mon Sep 07 13:28:41 2015 -0700 @@ -82,4 +82,4 @@ return "CustomFileFilter"; } } -} \ No newline at end of file +}
--- a/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java Mon Sep 07 13:28:41 2015 -0700 @@ -195,4 +195,4 @@ } System.out.println("Test passed"); } -} \ No newline at end of file +}
--- a/test/javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JMenuBar/MisplacedBorder/MisplacedBorder.java Mon Sep 07 13:28:41 2015 -0700 @@ -132,4 +132,4 @@ throw new RuntimeException(e); } } -} \ No newline at end of file +}
--- a/test/javax/swing/JOptionPane/8081019/bug8081019.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JOptionPane/8081019/bug8081019.java Mon Sep 07 13:28:41 2015 -0700 @@ -103,4 +103,4 @@ throw new RuntimeException("Exception in the output!"); } } -} \ No newline at end of file +}
--- a/test/javax/swing/JTextArea/4697612/bug4697612.txt Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JTextArea/4697612/bug4697612.txt Mon Sep 07 13:28:41 2015 -0700 @@ -219,5 +219,3 @@ Copyright 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved. - -
--- a/test/javax/swing/JTree/8072676/TreeClipTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JTree/8072676/TreeClipTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -94,4 +94,4 @@ System.out.println("Passed."); } } -} \ No newline at end of file +}
--- a/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java Mon Sep 07 13:28:41 2015 -0700 @@ -381,4 +381,4 @@ return nodesFlavor.equals(flavor); } } -} \ No newline at end of file +}
--- a/test/javax/swing/UIDefaults/7180976/Pending.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/UIDefaults/7180976/Pending.java Mon Sep 07 13:28:41 2015 -0700 @@ -47,4 +47,4 @@ UIManager.get("foobar"); passed = true; } -} \ No newline at end of file +}
--- a/test/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java Mon Sep 07 13:28:41 2015 -0700 @@ -169,4 +169,4 @@ frame.setVisible(true); } -} \ No newline at end of file +}
--- a/test/javax/swing/text/View/8015853/bug8015853.txt Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/text/View/8015853/bug8015853.txt Mon Sep 07 13:28:41 2015 -0700 @@ -64,4 +64,4 @@ frame.add(editorPane); frame.setVisible(<b>true</b>); } -} \ No newline at end of file +}
--- a/test/javax/swing/text/html/8005391/bug8005391.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/text/html/8005391/bug8005391.java Mon Sep 07 13:28:41 2015 -0700 @@ -58,4 +58,4 @@ } } } -} \ No newline at end of file +}
--- a/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java Mon Sep 07 13:28:41 2015 -0700 @@ -109,5 +109,3 @@ frame.setVisible(true); } } - -
--- a/test/javax/xml/bind/xjc/8032884/optional-property-schema.xsd Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/bind/xjc/8032884/optional-property-schema.xsd Mon Sep 07 13:28:41 2015 -0700 @@ -11,4 +11,4 @@ <xs:element name="foo" type="xs:int" minOccurs="0"/> </xs:sequence> </xs:complexType> -</xs:schema> \ No newline at end of file +</xs:schema>
--- a/test/javax/xml/jaxp/testng/validation/jdk8036951/idc.xml Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/testng/validation/jdk8036951/idc.xml Mon Sep 07 13:28:41 2015 -0700 @@ -4,4 +4,4 @@ <item uniqueAttr="ONE">2</item> <item uniqueAttr="TWO">2</item> <itemRef>3</itemRef> -</itemList> \ No newline at end of file +</itemList>
--- a/test/javax/xml/jaxp/testng/validation/jdk8036951/idc.xsd Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/testng/validation/jdk8036951/idc.xsd Mon Sep 07 13:28:41 2015 -0700 @@ -38,4 +38,4 @@ </xsd:simpleContent> </xsd:complexType> -</xsd:schema> \ No newline at end of file +</xsd:schema>
--- a/test/javax/xml/jaxp/testng/validation/jdk8036951/simpleType.xml Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/testng/validation/jdk8036951/simpleType.xml Mon Sep 07 13:28:41 2015 -0700 @@ -1,2 +1,2 @@ <?xml version="1.0"?> -<S>-12345</S> \ No newline at end of file +<S>-12345</S>
--- a/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128_1.xml Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128_1.xml Mon Sep 07 13:28:41 2015 -0700 @@ -2,4 +2,4 @@ <A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <B /> <C xsi:type="X" /> -</A> \ No newline at end of file +</A>
--- a/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128_2.xml Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128_2.xml Mon Sep 07 13:28:41 2015 -0700 @@ -2,4 +2,4 @@ <A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <B xsi:type="X" /> <C /> -</A> \ No newline at end of file +</A>
--- a/test/javax/xml/jaxp/testng/validation/jdk8037819/unparsedEntity.dtd Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/testng/validation/jdk8037819/unparsedEntity.dtd Mon Sep 07 13:28:41 2015 -0700 @@ -1,2 +1,2 @@ <!NOTATION myNotation SYSTEM "somethingElse" > -<!ENTITY myUnparsedEntity SYSTEM "something" NDATA myNotation > \ No newline at end of file +<!ENTITY myUnparsedEntity SYSTEM "something" NDATA myNotation >
--- a/test/javax/xml/jaxp/transform/8004476/tokenize.xml Thu Sep 03 15:04:05 2015 -0700 +++ b/test/javax/xml/jaxp/transform/8004476/tokenize.xml Mon Sep 07 13:28:41 2015 -0700 @@ -4,4 +4,4 @@ <b>Is this EXSLT? No. no</b> <c>Is this EXSLT? No. no</c> </a> -</html> \ No newline at end of file +</html>
--- a/test/jdk/nio/zipfs/ZipFSTester.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/jdk/nio/zipfs/ZipFSTester.java Mon Sep 07 13:28:41 2015 -0700 @@ -26,6 +26,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.URI; +import java.net.URLDecoder; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.SeekableByteChannel; @@ -69,6 +70,7 @@ * @test * @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596 * 7157656 8002390 7012868 7012856 8015728 8038500 8040059 8069211 + * 8131067 * @summary Test Zip filesystem provider * @run main ZipFSTester * @run main/othervm/java.security.policy=test.policy ZipFSTester @@ -91,6 +93,7 @@ } testTime(jarFile); test8069211(); + test8131067(); } static void test0(FileSystem fs) @@ -441,11 +444,34 @@ } } + static void test8131067() throws Exception { + Map<String, Object> env = new HashMap<String, Object>(); + env.put("create", "true"); + + // file name with space character for URI to quote it + File tmp = File.createTempFile("test zipfs", "zip"); + tmp.delete(); // we need a clean path, no file + Path fsPath = tmp.toPath(); + try (FileSystem fs = newZipFileSystem(fsPath, env);) { + Files.write(fs.getPath("/foo"), "hello".getBytes()); + URI fooUri = fs.getPath("/foo").toUri(); + if (!Arrays.equals(Files.readAllBytes(Paths.get(fooUri)), + "hello".getBytes())) { + throw new RuntimeException("entry close() failed"); + } + } finally { + Files.delete(fsPath); + } + } + private static FileSystem newZipFileSystem(Path path, Map<String, ?> env) throws Exception { + // Use URLDecoder (for test only) to remove the double escaped space + // character return FileSystems.newFileSystem( - new URI("jar", path.toUri().toString(), null), env, null); + new URI("jar", URLDecoder.decode(path.toUri().toString(), "utf8"), + null), env, null); } private static Path getTempPath() throws IOException
--- a/test/sun/jvmstat/testlibrary/utils.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/jvmstat/testlibrary/utils.sh Mon Sep 07 13:28:41 2015 -0700 @@ -221,5 +221,3 @@ fi echo "${port1}" } - -
--- a/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -57,5 +57,3 @@ } } - -
--- a/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -61,5 +61,3 @@ test.runTest(args); } } - -
--- a/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Mon Sep 07 13:28:41 2015 -0700 @@ -186,4 +186,4 @@ private Properties getCounters() throws IOException, InterruptedException { return jcmd.perfCounters("sun\\.management\\.JMXConnectorServer\\..*"); } -} \ No newline at end of file +}
--- a/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt Mon Sep 07 13:28:41 2015 -0700 @@ -15,5 +15,3 @@ 6. connect jconsole to host2:50234 Make sure jconsole works Make sure only host2.50234 and host2.50235 appears in tcpdump output. - -
--- a/test/sun/management/windows/README Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/management/windows/README Mon Sep 07 13:28:41 2015 -0700 @@ -26,5 +26,3 @@ 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 versions of Windows (AMD64 and IA64). - -
--- a/test/sun/net/www/http/HttpClient/IsKeepingAlive.policy Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/net/www/http/HttpClient/IsKeepingAlive.policy Mon Sep 07 13:28:41 2015 -0700 @@ -45,5 +45,3 @@ permission java.util.PropertyPermission "java.vm.vendor", "read"; permission java.util.PropertyPermission "java.vm.name", "read"; }; - -
--- a/test/sun/net/www/http/HttpClient/OpenServer.policy Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/net/www/http/HttpClient/OpenServer.policy Mon Sep 07 13:28:41 2015 -0700 @@ -45,5 +45,3 @@ permission java.util.PropertyPermission "java.vm.vendor", "read"; permission java.util.PropertyPermission "java.vm.name", "read"; }; - -
--- a/test/sun/net/www/protocol/http/spnegoTest Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/net/www/protocol/http/spnegoTest Mon Sep 07 13:28:41 2015 -0700 @@ -205,4 +205,4 @@ rm err.log rm out.log -exit 0 \ No newline at end of file +exit 0
--- a/test/sun/security/ec/SignatureOffsets.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/ec/SignatureOffsets.java Mon Sep 07 13:28:41 2015 -0700 @@ -49,4 +49,4 @@ InvalidKeyException, SignatureException { Offsets.main(args); } -} \ No newline at end of file +}
--- a/test/sun/security/krb5/IPv6.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/krb5/IPv6.java Mon Sep 07 13:28:41 2015 -0700 @@ -127,5 +127,3 @@ } } } - -
--- a/test/sun/security/mscapi/KeytoolChangeAlias.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/mscapi/KeytoolChangeAlias.sh Mon Sep 07 13:28:41 2015 -0700 @@ -132,6 +132,3 @@ exit 0 ;; esac - - -
--- a/test/sun/security/mscapi/SignatureOffsets.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/mscapi/SignatureOffsets.java Mon Sep 07 13:28:41 2015 -0700 @@ -50,4 +50,4 @@ InvalidKeyException, SignatureException { Offsets.main(args); } -} \ No newline at end of file +}
--- a/test/sun/security/pkcs11/Provider/Absolute.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/pkcs11/Provider/Absolute.java Mon Sep 07 13:28:41 2015 -0700 @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -22,40 +22,31 @@ */ /** * @test - * @bug 7003952 + * @bug 7003952 7191662 + * @library .. * @summary load DLLs and launch executables using fully qualified path */ import java.security.*; -import java.lang.reflect.*; public class Absolute { 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 = System.getProperty("test.src", ".") + "/Absolute.cfg"; try { - Object obj = cons.newInstance(new Object[] {config}); - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - if (cause instanceof ProviderException) { - Throwable cause2 = cause.getCause(); - if ((cause2 == null) || - !cause2.getMessage().startsWith( - "Absolute path required for library value:")) { - // rethrow - throw (ProviderException) cause; - } - System.out.println("Caught expected Exception: \n" + cause2); + Provider p = PKCS11Test.getSunPKCS11(config); + if (p == null) { + System.out.println("Skipping test - no PKCS11 provider available"); + } + } catch (InvalidParameterException ipe) { + Throwable ex = ipe.getCause(); + if (ex.getMessage().indexOf( + "Absolute path required for library value:") != -1) { + System.out.println("Test Passed: expected exception thrown"); + } else { + // rethrow + throw ipe; } } }
--- a/test/sun/security/pkcs11/Provider/ConfigShortPath.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/pkcs11/Provider/ConfigShortPath.java Mon Sep 07 13:28:41 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -33,44 +33,52 @@ public class ConfigShortPath { - private static final String[] configNames = { - "csp.cfg", "cspPlus.cfg", "cspSpace.cfg", "cspQuotedPath.cfg" + private static final String[] winConfigNames = { + "csp.cfg", "cspSpace.cfg", "cspQuotedPath.cfg" + }; + private static final String[] solConfigNames = { + "cspPlus.cfg" }; public static void main(String[] args) throws Exception { - Constructor cons = null; - try { - Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11"); - cons = clazz.getConstructor(String.class); - } catch (Exception ex) { - System.out.println("Skipping test - no PKCS11 provider available"); - return; + Provider p = Security.getProvider("SunPKCS11"); + if (p == null) { + // re-try w/ SunPKCS11-Solaris + p = Security.getProvider("SunPKCS11-Solaris"); + if (p == null) { + System.out.println("Skipping test - no PKCS11 provider available"); + return; + } } + + String osInfo = System.getProperty("os.name", ""); + String[] configNames = (osInfo.contains("Windows")? + winConfigNames : solConfigNames); + String testSrc = System.getProperty("test.src", "."); for (int i = 0; i < configNames.length; i++) { String configFile = testSrc + File.separator + configNames[i]; System.out.println("Testing against " + configFile); try { - Object obj = cons.newInstance(configFile); - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - System.out.println(cause); - if (cause instanceof ProviderException) { - while ((cause = cause.getCause()) != null) { - System.out.println(cause); - String causeMsg = cause.getMessage(); - // Indicate failure if due to parsing config - if (causeMsg.indexOf("Unexpected") != -1) { - throw (ProviderException) cause; - } + p.configure(configFile); + } catch (InvalidParameterException ipe) { + ipe.printStackTrace(); + Throwable cause = ipe.getCause(); + // Indicate failure if due to parsing config + if (cause.getClass().getName().equals + ("sun.security.pkcs11.ConfigurationException")) { + // Error occurred during parsing + if (cause.getMessage().indexOf("Unexpected") != -1) { + throw (ProviderException) cause; } - // Consider the test passes if the exception is - // thrown after parsing, i.e. due to the absolute - // path requirement or the non-existent path. - } else { - // unexpected exception - throw new RuntimeException("Unexpected Exception", cause); + } + } catch (ProviderException pe) { + pe.printStackTrace(); + if (pe.getCause() instanceof IOException) { + // Thrown when the directory does not exist which is ok + System.out.println("Pass: config parsed ok"); + continue; } } }
--- a/test/sun/security/pkcs11/Provider/cspSpace.cfg Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/pkcs11/Provider/cspSpace.cfg Mon Sep 07 13:28:41 2015 -0700 @@ -1,5 +1,3 @@ showInfo = false name = test library = C:\pki DLL\x64\acpkcs211.dll - -
--- a/test/sun/security/rsa/SignatureOffsets.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/rsa/SignatureOffsets.java Mon Sep 07 13:28:41 2015 -0700 @@ -50,4 +50,4 @@ InvalidKeyException, SignatureException { Offsets.main(args); } -} \ No newline at end of file +}
--- a/test/sun/security/ssl/StatusStapling/TestCase.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/ssl/StatusStapling/TestCase.java Mon Sep 07 13:28:41 2015 -0700 @@ -28,5 +28,3 @@ public interface TestCase { Map.Entry<Boolean, String> runTest(); } - -
--- a/test/sun/security/ssl/StatusStapling/TestUtils.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/ssl/StatusStapling/TestUtils.java Mon Sep 07 13:28:41 2015 -0700 @@ -122,5 +122,3 @@ return resultBuf; } } - -
--- a/test/sun/security/ssl/rsa/SignatureOffsets.java Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/ssl/rsa/SignatureOffsets.java Mon Sep 07 13:28:41 2015 -0700 @@ -47,4 +47,4 @@ InvalidKeyException, SignatureException { Offsets.main(args); } -} \ No newline at end of file +}
--- a/test/sun/security/tools/jarsigner/collator.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/tools/jarsigner/collator.sh Mon Sep 07 13:28:41 2015 -0700 @@ -72,5 +72,3 @@ echo "ERR is $ERR" exit 1 fi - -
--- a/test/sun/security/tools/jarsigner/jvindex.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/tools/jarsigner/jvindex.sh Mon Sep 07 13:28:41 2015 -0700 @@ -72,5 +72,3 @@ echo "ERR is $ERR" exit 1 fi - -
--- a/test/sun/security/tools/jarsigner/warnings.sh Thu Sep 03 15:04:05 2015 -0700 +++ b/test/sun/security/tools/jarsigner/warnings.sh Mon Sep 07 13:28:41 2015 -0700 @@ -115,5 +115,3 @@ echo "ERR is $ERR" exit 1 fi - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/x509/X509CertImpl/V3Certificate.java Mon Sep 07 13:28:41 2015 -0700 @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import static java.lang.System.out; +import java.security.InvalidKeyException; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.Signature; +import java.security.SignatureException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; +import sun.misc.BASE64Encoder; +import sun.security.util.BitArray; +import sun.security.util.ObjectIdentifier; +import sun.security.x509.*; + +/** + * @test + * @bug 8049237 + * @modules java.base/sun.security.x509 + * java.base/sun.security.util + * java.base/sun.misc + * @summary This test generates V3 certificate with all the supported + * extensions. Writes back the generated certificate in to a file and checks for + * equality with the original certificate. + */ +public class V3Certificate { + + public static final String V3_FILE = "certV3"; + public static final String V3_B64_FILE = "certV3.b64"; + + public static void main(String[] args) throws IOException, + NoSuchAlgorithmException, InvalidKeyException, CertificateException, + NoSuchProviderException, SignatureException { + + boolean success = true; + + success &= test("RSA", "SHA256withRSA", 2048); + success &= test("DSA", "SHA256withDSA", 2048); + success &= test("EC", "SHA256withECDSA", 384); + + if (!success) { + throw new RuntimeException("At least one test case failed"); + } + } + + public static boolean test(String algorithm, String sigAlg, int keyLength) + throws IOException, + NoSuchAlgorithmException, + InvalidKeyException, + CertificateException, + NoSuchProviderException, + SignatureException { + + byte[] issuerId = {1, 2, 3, 4, 5}; + byte[] subjectId = {6, 7, 8, 9, 10}; + boolean testResult = true; + + // Subject and Issuer + X500Name subject = new X500Name("test", "Oracle", "Santa Clara", + "US"); + X500Name issuer = subject; + + // Generate keys and sign + KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algorithm); + keyGen.initialize(keyLength); + KeyPair pair = keyGen.generateKeyPair(); + PublicKey publicKey = pair.getPublic(); + PrivateKey privateKey = pair.getPrivate(); + MessageDigest md = MessageDigest.getInstance("SHA"); + byte[] keyId = md.digest(publicKey.getEncoded()); + + Signature signature = Signature.getInstance(sigAlg); + signature.initSign(privateKey); + + // Validity interval + Date firstDate = new Date(); + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST")); + cal.set(2014, 03, 10, 12, 30, 30); + Date lastDate = cal.getTime(); + CertificateValidity interval = new CertificateValidity(firstDate, + lastDate); + + // Certificate Info + X509CertInfo cert = new X509CertInfo(); + + cert.set(X509CertInfo.VERSION, + new CertificateVersion(CertificateVersion.V3)); + cert.set(X509CertInfo.SERIAL_NUMBER, + new CertificateSerialNumber((int) (firstDate.getTime() / 1000))); + cert.set(X509CertInfo.ALGORITHM_ID, + new CertificateAlgorithmId(AlgorithmId.get(sigAlg))); + cert.set(X509CertInfo.SUBJECT, subject); + cert.set(X509CertInfo.KEY, new CertificateX509Key(publicKey)); + cert.set(X509CertInfo.VALIDITY, interval); + cert.set(X509CertInfo.ISSUER, issuer); + + cert.set(X509CertInfo.ISSUER_ID, + new UniqueIdentity( + new BitArray(issuerId.length * 8 - 2, issuerId))); + cert.set(X509CertInfo.SUBJECT_ID, new UniqueIdentity(subjectId)); + + // Create Extensions + CertificateExtensions exts = new CertificateExtensions(); + + GeneralNameInterface mailInf = new RFC822Name("test@Oracle.com"); + GeneralName mail = new GeneralName(mailInf); + GeneralNameInterface dnsInf = new DNSName("Oracle.com"); + GeneralName dns = new GeneralName(dnsInf); + GeneralNameInterface uriInf = new URIName("http://www.Oracle.com"); + GeneralName uri = new GeneralName(uriInf); + + // localhost + byte[] address = new byte[]{127, 0, 0, 1}; + + GeneralNameInterface ipInf = new IPAddressName(address); + GeneralName ip = new GeneralName(ipInf); + int[] oidData = new int[]{1, 2, 3, 4}; + + GeneralNameInterface oidInf = new OIDName(new ObjectIdentifier(oidData)); + GeneralName oid = new GeneralName(oidInf); + + SubjectAlternativeNameExtension subjectName + = new SubjectAlternativeNameExtension(); + IssuerAlternativeNameExtension issuerName + = new IssuerAlternativeNameExtension(); + + GeneralNames subjectNames + = (GeneralNames) subjectName. + get(SubjectAlternativeNameExtension.SUBJECT_NAME); + + GeneralNames issuerNames + = (GeneralNames) issuerName. + get(IssuerAlternativeNameExtension.ISSUER_NAME); + + subjectNames.add(mail); + subjectNames.add(dns); + subjectNames.add(uri); + + issuerNames.add(ip); + issuerNames.add(oid); + + cal.set(2000, 11, 15, 12, 30, 30); + lastDate = cal.getTime(); + PrivateKeyUsageExtension pkusage + = new PrivateKeyUsageExtension(firstDate, lastDate); + + KeyUsageExtension usage = new KeyUsageExtension(); + usage.set(KeyUsageExtension.CRL_SIGN, true); + usage.set(KeyUsageExtension.DIGITAL_SIGNATURE, true); + usage.set(KeyUsageExtension.NON_REPUDIATION, true); + + KeyIdentifier kid = new KeyIdentifier(keyId); + SerialNumber sn = new SerialNumber(42); + AuthorityKeyIdentifierExtension aki + = new AuthorityKeyIdentifierExtension(kid, subjectNames, sn); + + SubjectKeyIdentifierExtension ski + = new SubjectKeyIdentifierExtension(keyId); + + BasicConstraintsExtension cons + = new BasicConstraintsExtension(true, 10); + + PolicyConstraintsExtension pce = new PolicyConstraintsExtension(2, 4); + + exts.set(SubjectAlternativeNameExtension.NAME, subjectName); + exts.set(IssuerAlternativeNameExtension.NAME, issuerName); + exts.set(PrivateKeyUsageExtension.NAME, pkusage); + exts.set(KeyUsageExtension.NAME, usage); + exts.set(AuthorityKeyIdentifierExtension.NAME, aki); + exts.set(SubjectKeyIdentifierExtension.NAME, ski); + exts.set(BasicConstraintsExtension.NAME, cons); + exts.set(PolicyConstraintsExtension.NAME, pce); + cert.set(X509CertInfo.EXTENSIONS, exts); + + // Generate and sign X509CertImpl + X509CertImpl crt = new X509CertImpl(cert); + crt.sign(privateKey, sigAlg); + crt.verify(publicKey); + + try (FileOutputStream fos = new FileOutputStream(new File(V3_FILE)); + FileOutputStream fos_b64 + = new FileOutputStream(new File(V3_B64_FILE)); + PrintWriter pw = new PrintWriter(fos_b64)) { + crt.encode((OutputStream) fos); + fos.flush(); + + // Certificate boundaries/ + pw.println("-----BEGIN CERTIFICATE-----"); + pw.flush(); + new BASE64Encoder().encodeBuffer(crt.getEncoded(), fos_b64); + fos_b64.flush(); + pw.println("-----END CERTIFICATE-----"); + } + + out.println("*** Certificate ***"); + out.println(crt); + out.println("*** End Certificate ***"); + + X509Certificate x2 = generateCertificate(V3_FILE); + if (!x2.equals(crt)) { + out.println("*** Certificate mismatch ***"); + testResult = false; + } + + X509Certificate x3 = generateCertificate(V3_B64_FILE); + if (!x3.equals(crt)) { + out.println("*** Certificate mismatch ***"); + testResult = false; + } + + return testResult; + } + + static X509Certificate generateCertificate(String certFile) { + try (InputStream inStrm = new FileInputStream(certFile)) { + CertificateFactory cf = CertificateFactory.getInstance("X509"); + X509Certificate x2 + = (X509Certificate) cf.generateCertificate(inStrm); + return x2; + } catch (CertificateException | IOException e) { + throw new RuntimeException("Exception while " + + "genrating certificate for " + certFile, e); + } + } +}