Mercurial > hg > icedtea6-hg
changeset 3197:4c54ff50c546
Add backports from IcedTea 2.x & OpenJDK 8
Backports
- PR2488, CVE-2015-4000: Make jdk8 mode the default for jdk.tls.ephemeralDHKeySize
- S4890063, PR2306, RH1214835: HPROF: default text truncated when using doe=n option
- S6562614, PR2555: Compiler warnings for gettimeofday in Inet4/Inet6AddressImpl.c
- S6956398, PR2486: make ephemeral DH key match the length of the certificate key
- S6989466, PR2555: Miscellaneous compiler warnings in java/lang, java/util, java/io, sun/misc native code
- S6991580, PR2309: IPv6 Nameservers in resolv.conf throws NumberFormatException
- S6997561, PR2479: A request for better error handling in JNDI
- S7007905, PR2298: javazic produces wrong line numbers
- S7017176, PR2479: Several JNDI tests are mssing GPL header
- S7058708, PR2298: Eliminate JDK build tools build warnings
- S7069870, PR2298: Parts of the JDK erroneously rely on generic array initializers with diamond
- S7090844, PR2298: Support a timezone whose offset is changed more than once in the future
- S7094377, PR2479: Com.sun.jndi.ldap.read.timeout doesn't work with ldaps.
- S7133138, PR2298: Improve io performance around timezone lookups
- S7170638, PR2495: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field.
- S8000487, PR2479: Java JNDI connection library on ldap conn is not honoring configured timeout
- S8011709, PR2510: [parfait] False positive: memory leak in jdk/src/share/native/sun/font/layout/CanonShaping.cpp
- S8023052, PR2510: JVM crash in native layout
- S8039921, PR2468: SHA1WithDSA with key > 1024 bits not working
- S8041451, PR2480: com.sun.jndi.ldap.Connection:ReadTimeout should abandon ldap request
- S8042855, PR2510: [parfait] Potential null pointer dereference in IndicLayoutEngine.cpp
- S8042857, PR2479: 14 stuck threads waiting for notification on LDAPRequest
- S8065238, PR2479: javax.naming.NamingException after upgrade to JDK 8
- S8074761, PR2469: Empty optional parameters of LDAP query are not interpreted as empty
- S8078654, PR2334: CloseTTFontFileFunc callback should be removed
- S8078666, PR2327: JVM fastdebug build compiled with GCC 5 asserts with "widen increases"
- S8081315, PR2406: Avoid giflib interlacing workaround with giflib 5.0.0 on
- S8081475, PR2495: SystemTap does not work when JDK is compiled with GCC 5
- S8087120, RH1206656, PR2554: [GCC5] java.lang.StackOverflowError on Zero JVM initialization on non x86 platforms.
- PR2319: Checksum of policy JAR files changes on every build
- PR2460: Policy JAR files should be timestamped with the date of the policy file they hold
- PR2481, RH489586, RH1236619: OpenJDK can't handle spaces in zone names in /etc/sysconfig/clock
- PR2486: JSSE server is still limited to 768-bit DHE
line wrap: on
line diff
--- a/ChangeLog Thu Apr 16 03:37:09 2015 +0100 +++ b/ChangeLog Wed Jul 22 13:27:06 2015 +0100 @@ -1,3 +1,45 @@ +2015-07-22 Andrew John Hughes <gnu.andrew@redhat.com> + + * patches/hotspot/hs23/systemtap.patch: + Removed; replaced by backport of upstream version. + * Makefile.am: + (ICEDTEA_PATCHES): Add patches below. Swap + old SystemTap patch for a backport of 7170638. + * NEWS: Updated. + * patches/openjdk/4890063-hprof_truncation.patch, + * patches/openjdk/6562615-compiler_warnings.patch, + * patches/openjdk/6956398-ephemeraldhkeysize.patch, + * patches/openjdk/6989466-compiler_warnings.patch, + * patches/openjdk/6991580-ipv6_nameservers.patch, + * patches/openjdk/6997561-better_jndi_error_handling.patch, + * patches/openjdk/7007905-javazic_line_numbers.patch, + * patches/openjdk/7017176-missing_gpl_headers.patch, + * patches/openjdk/7058708-javazic_warnings.patch, + * patches/openjdk/7069870-generic_array_initializers.patch, + * patches/openjdk/7090844-support_multi_offset_change_timezones.patch, + * patches/openjdk/7094377-ldaps_timeout.patch, + * patches/openjdk/7133138-timezone_io_improvement.patch, + * patches/openjdk/7170638-systemtap.patch, + * patches/openjdk/8000487-jndi_connection_not_honouring_timeout.patch, + * patches/openjdk/8011709-canonshaping_memory_leak.patch, + * patches/openjdk/8023052-jvm_crash_in_native_layout.patch, + * patches/openjdk/8039921-sha1_1024plus.patch, + * patches/openjdk/8041451-ldap_read_timeout_abandon.patch, + * patches/openjdk/8042855-indiclayoutengine_null_dereference.patch, + * patches/openjdk/8042857-14_stuck_threads_on_ldaprequest.patch, + * patches/openjdk/8065238-ldap_namingexception_8041451_regression.patch, + * patches/openjdk/8074761-ldap_empty_optional_params.patch, + * patches/openjdk/8078654-closettfontfilefunc.patch, + * patches/openjdk/8078666-widen_increases.patch, + * patches/openjdk/8081315-giflib_interlacing.patch, + * patches/openjdk/8081475-systemtap-gcc5.patch, + * patches/openjdk/8087120-zero_gcc5.patch, + * patches/pr2319-policy_jar_checksum.patch, + * patches/pr2460-policy_jar_timestamp.patch, + * patches/pr2481_sysconfig_clock_spaces.patch, + * patches/pr2486-768_dh.patch, + * patches/pr2488-1024_dh.patch: Added. + 2015-04-16 Andrew John Hughes <gnu.andrew@redhat.com> * NEWS: Add 1.13.7 release notes.
--- a/Makefile.am Thu Apr 16 03:37:09 2015 +0100 +++ b/Makefile.am Wed Jul 22 13:27:06 2015 +0100 @@ -612,7 +612,38 @@ patches/pr2197-jhat_man_page_url.patch \ patches/pr2201-support_giflib_5.1.patch \ patches/pr2211-check_dgifclosefile_return.patch \ - patches/pr2226-support_future_giflib_6_and_up.patch + patches/pr2226-support_future_giflib_6_and_up.patch \ + patches/openjdk/4890063-hprof_truncation.patch \ + patches/openjdk/6562615-compiler_warnings.patch \ + patches/openjdk/6956398-ephemeraldhkeysize.patch \ + patches/openjdk/6989466-compiler_warnings.patch \ + patches/openjdk/6991580-ipv6_nameservers.patch \ + patches/openjdk/7007905-javazic_line_numbers.patch \ + patches/openjdk/7058708-javazic_warnings.patch \ + patches/openjdk/7069870-generic_array_initializers.patch \ + patches/openjdk/7090844-support_multi_offset_change_timezones.patch \ + patches/openjdk/7133138-timezone_io_improvement.patch \ + patches/openjdk/8011709-canonshaping_memory_leak.patch \ + patches/openjdk/8023052-jvm_crash_in_native_layout.patch \ + patches/openjdk/8039921-sha1_1024plus.patch \ + patches/openjdk/8041451-ldap_read_timeout_abandon.patch \ + patches/openjdk/8042855-indiclayoutengine_null_dereference.patch \ + patches/openjdk/7094377-ldaps_timeout.patch \ + patches/openjdk/6997561-better_jndi_error_handling.patch \ + patches/openjdk/7017176-missing_gpl_headers.patch \ + patches/openjdk/8000487-jndi_connection_not_honouring_timeout.patch \ + patches/openjdk/8042857-14_stuck_threads_on_ldaprequest.patch \ + patches/openjdk/8065238-ldap_namingexception_8041451_regression.patch \ + patches/openjdk/8074761-ldap_empty_optional_params.patch \ + patches/openjdk/8078654-closettfontfilefunc.patch \ + patches/openjdk/8078666-widen_increases.patch \ + patches/openjdk/8081315-giflib_interlacing.patch \ + patches/openjdk/8087120-zero_gcc5.patch \ + patches/pr2319-policy_jar_checksum.patch \ + patches/pr2460-policy_jar_timestamp.patch \ + patches/pr2481_sysconfig_clock_spaces.patch \ + patches/pr2486-768_dh.patch \ + patches/pr2488-1024_dh.patch if WITH_RHINO ICEDTEA_PATCHES += \ @@ -646,9 +677,10 @@ endif if ENABLE_SYSTEMTAP -ICEDTEA_PATCHES += patches/hotspot/hs23/systemtap.patch \ +ICEDTEA_PATCHES += patches/openjdk/7170638-systemtap.patch \ patches/hotspot/hs23/systemtap_gc.patch \ - patches/hotspot/hs23/systemtap-alloc-size-workaround.patch + patches/hotspot/hs23/systemtap-alloc-size-workaround.patch \ + patches/openjdk/8081475-systemtap-gcc5.patch endif if BUILD_JAMVM
--- a/NEWS Thu Apr 16 03:37:09 2015 +0100 +++ b/NEWS Wed Jul 22 13:27:06 2015 +0100 @@ -14,17 +14,51 @@ New in release 1.14.0 (201X-XX-XX): +* Security fixes + - PR2488, CVE-2015-4000: Make jdk8 mode the default for jdk.tls.ephemeralDHKeySize * Backports + - S4890063, PR2306, RH1214835: HPROF: default text truncated when using doe=n option + - S6562614, PR2555: Compiler warnings for gettimeofday in Inet4/Inet6AddressImpl.c - S6611637: NullPointerException in sun.font.GlyphLayout$EngineRecord.init - S6727719: Performance of TextLayout.getBounds() - S6745225: Memory leak while drawing Attributed String - S6904962: GlyphVector.getVisualBounds should not be affected by leading or trailing white space. + - S6956398, PR2486: make ephemeral DH key match the length of the certificate key + - S6989466, PR2555: Miscellaneous compiler warnings in java/lang, java/util, java/io, sun/misc native code + - S6991580, PR2309: IPv6 Nameservers in resolv.conf throws NumberFormatException + - S6997561, PR2479: A request for better error handling in JNDI + - S7007905, PR2298: javazic produces wrong line numbers + - S7017176, PR2479: Several JNDI tests are mssing GPL header + - S7058708, PR2298: Eliminate JDK build tools build warnings + - S7069870, PR2298: Parts of the JDK erroneously rely on generic array initializers with diamond + - S7090844, PR2298: Support a timezone whose offset is changed more than once in the future + - S7094377, PR2479: Com.sun.jndi.ldap.read.timeout doesn't work with ldaps. + - S7133138, PR2298: Improve io performance around timezone lookups - S7151089: PS NUMA: NUMA allocator should not attempt to free pages when using SHM large pages + - S7170638, PR2495: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field. + - S8000487, PR2479: Java JNDI connection library on ldap conn is not honoring configured timeout + - S8011709, PR2510: [parfait] False positive: memory leak in jdk/src/share/native/sun/font/layout/CanonShaping.cpp - S8013057: Detect mmap() commit failures in Linux and Solaris os::commit_memory() impls and call vm_exit_out_of_memory() + - S8023052, PR2510: JVM crash in native layout - S8026887: Make issues due to failed large pages allocations easier to debug + - S8039921, PR2468: SHA1WithDSA with key > 1024 bits not working + - S8041451, PR2480: com.sun.jndi.ldap.Connection:ReadTimeout should abandon ldap request + - S8042855, PR2510: [parfait] Potential null pointer dereference in IndicLayoutEngine.cpp + - S8042857, PR2479: 14 stuck threads waiting for notification on LDAPRequest + - S8065238, PR2479: javax.naming.NamingException after upgrade to JDK 8 + - S8074761, PR2469: Empty optional parameters of LDAP query are not interpreted as empty + - S8078654, PR2334: CloseTTFontFileFunc callback should be removed + - S8078666, PR2327: JVM fastdebug build compiled with GCC 5 asserts with "widen increases" + - S8081315, PR2406: Avoid giflib interlacing workaround with giflib 5.0.0 on + - S8081475, PR2495: SystemTap does not work when JDK is compiled with GCC 5 + - S8087120, RH1206656, PR2554: [GCC5] java.lang.StackOverflowError on Zero JVM initialization on non x86 platforms. * Bug fixes - PR1886: IcedTea does not checksum supplied tarballs - PR2083: Add support for building Zero on AArch64 + - PR2319: Checksum of policy JAR files changes on every build + - PR2460: Policy JAR files should be timestamped with the date of the policy file they hold + - PR2481, RH489586, RH1236619: OpenJDK can't handle spaces in zone names in /etc/sysconfig/clock + - PR2486: JSSE server is still limited to 768-bit DHE New in release 1.13.7 (2015-04-14):
--- a/patches/hotspot/hs23/systemtap.patch Thu Apr 16 03:37:09 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -diff -Nru openjdk.orig/hotspot/make/linux/makefiles/dtrace.make openjdk/hotspot/make/linux/makefiles/dtrace.make ---- openjdk.orig/hotspot/make/linux/makefiles/dtrace.make 2012-02-22 14:54:31.000000000 +0000 -+++ openjdk/hotspot/make/linux/makefiles/dtrace.make 2012-03-18 18:54:13.482968139 +0000 -@@ -25,3 +25,7 @@ - # Linux does not build jvm_db - LIBJVM_DB = - -+# But it does have a Systemtap dtrace compatible sys/sdt.h -+CFLAGS += -DDTRACE_ENABLED -+ -+# It doesn't support HAVE_DTRACE_H though. -diff -Nru openjdk.orig/hotspot/src/share/vm/prims/jni.cpp openjdk/hotspot/src/share/vm/prims/jni.cpp ---- openjdk.orig/hotspot/src/share/vm/prims/jni.cpp 2012-02-22 14:54:31.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/prims/jni.cpp 2012-03-18 18:54:13.502968466 +0000 -@@ -2818,10 +2818,7 @@ - JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \ - JNIWrapper("Set" XSTR(Result) "Field"); \ - \ -- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \ -- ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ -- HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \ -- ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ -+ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value),DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \ - \ - oop o = JNIHandles::resolve_non_null(obj); \ - klassOop k = o->klass(); \ -@@ -3128,10 +3125,7 @@ - \ - JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \ - JNIWrapper("SetStatic" XSTR(Result) "Field"); \ -- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\ -- ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ -- HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \ -- ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ -+ FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value),DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \ - \ - JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \ - assert(id->is_static_field_id(), "invalid static field id"); \ ---- openjdk.orig/hotspot/src/share/vm/utilities/dtrace.hpp 2012-02-22 15:54:31.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2012-03-27 13:12:15.857491730 +0200 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2009, 2012 Red Hat, Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -32,12 +33,15 @@ - #define DTRACE_ONLY(x) x - #define NOT_DTRACE(x) - -+#if defined(SOLARIS) - // Work around dtrace tail call bug 6672627 until it is fixed in solaris 10. - #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() \ - do { volatile size_t dtrace_workaround_tail_call_bug = 1; } while (0) - --#if defined(SOLARIS) - #define USDT1 1 -+#elif defined(LINUX) -+#define USDT1 1 -+#define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() - #elif defined(__APPLE__) - #define USDT2 1 - #include <sys/types.h> -@@ -63,6 +67,11 @@ - #define DTRACE_PROBE3(a,b,c,d,e) {;} - #define DTRACE_PROBE4(a,b,c,d,e,f) {;} - #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;} -+#define DTRACE_PROBE6(a,b,c,d,e,f,g,h) {;} -+#define DTRACE_PROBE7(a,b,c,d,e,f,g,h,i) {;} -+#define DTRACE_PROBE8(a,b,c,d,e,f,g,h,i,j) {;} -+#define DTRACE_PROBE9(a,b,c,d,e,f,g,h,i,j,k) {;} -+#define DTRACE_PROBE10(a,b,c,d,e,f,g,h,i,j,k,l) {;} - - #else /* USDT2 */ - -@@ -76,10 +85,19 @@ - #define HS_DTRACE_PROBE_FN(provider,name)\ - __dtrace_##provider##___##name - -+#ifdef SOLARIS -+// Solaris dtrace needs actual extern function decls. - #define HS_DTRACE_PROBE_DECL_N(provider,name,args) \ - DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args) - #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \ - DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args) -+#elif defined(LINUX) -+// Systemtap dtrace compatible probes on GNU/Linux don't. -+#define HS_DTRACE_PROBE_DECL_N(provider,name,args) -+#define HS_DTRACE_PROBE_CDECL_N(provider,name,args) -+#else -+#error "USDT1 enabled for unknown os" -+#endif - - /* Dtrace probe declarations */ - #define HS_DTRACE_PROBE_DECL(provider,name) \ -@@ -118,6 +136,8 @@ - uintptr_t,uintptr_t,uintptr_t)) - - /* Dtrace probe definitions */ -+#if defined(SOLARIS) -+// Solaris dtrace uses actual function calls. - #define HS_DTRACE_PROBE_N(provider,name, args) \ - DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args) - -@@ -153,6 +173,34 @@ - HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ - (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ - (uintptr_t)a8,(uintptr_t)a9)) -+#elif defined(LINUX) -+// Systemtap dtrace compatible probes on GNU/Linux use direct macros. -+#define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name) -+#define HS_DTRACE_PROBE0(provider,name)\ -+ DTRACE_PROBE(provider,name) -+#define HS_DTRACE_PROBE1(provider,name,a0)\ -+ DTRACE_PROBE1(provider,name,a0) -+#define HS_DTRACE_PROBE2(provider,name,a0,a1)\ -+ DTRACE_PROBE2(provider,name,a0,a1) -+#define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\ -+ DTRACE_PROBE3(provider,name,a0,a1,a2) -+#define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\ -+ DTRACE_PROBE4(provider,name,a0,a1,a2,a3) -+#define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\ -+ DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4) -+#define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\ -+ DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5) -+#define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\ -+ DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6) -+#define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\ -+ DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7) -+#define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ -+ DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) -+#define HS_DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ -+ DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) -+#else -+#error "USDT1 enabled for unknown os" -+#endif - - #endif /* !USDT2 */ -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/4890063-hprof_truncation.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,20 @@ +# HG changeset patch +# User andrew +# Date 1429893959 -3600 +# Fri Apr 24 17:45:59 2015 +0100 +# Node ID 4e3ea67d3b694f3a67c367b305820f5e14fae105 +# Parent 7014c4be418d9b64c6bae792f41eb788f1ad9ac1 +4890063, PR2306, RH1214835: HPROF: default text truncated when using doe=n option + +diff -r 7014c4be418d -r 4e3ea67d3b69 src/share/demo/jvmti/hprof/hprof_init.c +--- openjdk/jdk/src/share/demo/jvmti/hprof/hprof_init.c Wed Apr 15 00:49:12 2015 +0100 ++++ openjdk/jdk/src/share/demo/jvmti/hprof/hprof_init.c Fri Apr 24 17:45:59 2015 +0100 +@@ -1361,7 +1361,7 @@ + } rawMonitorExit(gdata->dump_lock); + + /* Dump everything if we need to */ +- if (gdata->dump_on_exit && need_to_dump) { ++ if (gdata->dump_on_exit || need_to_dump) { + + dump_all_data(env); + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6562615-compiler_warnings.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,33 @@ +# HG changeset patch +# User andrew +# Date 1247326988 -3600 +# Sat Jul 11 16:43:08 2009 +0100 +# Node ID 880896883a4757145a278ecb55e6b730124a2e47 +# Parent 6f26e2e5f4f3eb6722541d37007739b174de5142 +6562614, PR2555: Compiler warnings for gettimeofday in Inet4/Inet6AddressImpl.c +Summary: Add missing header to remove compiler warnings. +Reviewed-by: martin +Contributed-by: Matthew Flaschen <matthew.flaschen@gatech.edu> + +diff -r 6f26e2e5f4f3 -r 880896883a47 src/solaris/native/java/net/Inet4AddressImpl.c +--- openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c Fri Jul 10 17:27:13 2009 +0800 ++++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c Sat Jul 11 16:43:08 2009 +0100 +@@ -24,6 +24,7 @@ + */ + + #include <errno.h> ++#include <sys/time.h> + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in_systm.h> +diff -r 6f26e2e5f4f3 -r 880896883a47 src/solaris/native/java/net/Inet6AddressImpl.c +--- openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c Fri Jul 10 17:27:13 2009 +0800 ++++ openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c Sat Jul 11 16:43:08 2009 +0100 +@@ -24,6 +24,7 @@ + */ + + #include <errno.h> ++#include <sys/time.h> + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6956398-ephemeraldhkeysize.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,760 @@ +# HG changeset patch +# User xuelei +# Date 1428081992 -3600 +# Fri Apr 03 18:26:32 2015 +0100 +# Node ID e7690bee9a7722b20bde481fb2da0bb6b903a258 +# Parent bf4c2a6c354db2c6b6d036908749a27eef1c5968 +6956398, PR2486: make ephemeral DH key match the length of the certificate key +Reviewed-by: weijun + +diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java openjdk/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java +--- openjdk.orig/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java 2015-04-10 16:39:22.000000000 +0100 ++++ openjdk/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java 2015-07-22 02:13:30.458962919 +0100 +@@ -47,6 +47,8 @@ + + import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager; + ++import sun.security.util.KeyUtil; ++import sun.security.action.GetPropertyAction; + import sun.security.ssl.HandshakeMessage.*; + import sun.security.ssl.CipherSuite.*; + import static sun.security.ssl.CipherSuite.*; +@@ -97,6 +99,50 @@ + + private SupportedEllipticCurvesExtension supportedCurves; + ++ // Flag to use smart ephemeral DH key which size matches the corresponding ++ // authentication key ++ private static final boolean useSmartEphemeralDHKeys; ++ ++ // Flag to use legacy ephemeral DH key which size is 512 bits for ++ // exportable cipher suites, and 768 bits for others ++ private static final boolean useLegacyEphemeralDHKeys; ++ ++ // The customized ephemeral DH key size for non-exportable cipher suites. ++ private static final int customizedDHKeySize; ++ ++ static { ++ String property = AccessController.doPrivileged( ++ new GetPropertyAction("jdk.tls.ephemeralDHKeySize")); ++ if (property == null || property.length() == 0) { ++ useLegacyEphemeralDHKeys = false; ++ useSmartEphemeralDHKeys = false; ++ customizedDHKeySize = -1; ++ } else if ("matched".equals(property)) { ++ useLegacyEphemeralDHKeys = false; ++ useSmartEphemeralDHKeys = true; ++ customizedDHKeySize = -1; ++ } else if ("legacy".equals(property)) { ++ useLegacyEphemeralDHKeys = true; ++ useSmartEphemeralDHKeys = false; ++ customizedDHKeySize = -1; ++ } else { ++ useLegacyEphemeralDHKeys = false; ++ useSmartEphemeralDHKeys = false; ++ ++ try { ++ customizedDHKeySize = parseUnsignedInt(property); ++ if (customizedDHKeySize < 1024 || customizedDHKeySize > 2048) { ++ throw new IllegalArgumentException( ++ "Customized DH key size should be positive integer " + ++ "between 1024 and 2048 bits, inclusive"); ++ } ++ } catch (NumberFormatException nfe) { ++ throw new IllegalArgumentException( ++ "Invalid system property jdk.tls.ephemeralDHKeySize"); ++ } ++ } ++ } ++ + /* + * Constructor ... use the keys found in the auth context. + */ +@@ -875,7 +921,7 @@ + return false; + } + } else if (keyExchange == K_DHE_RSA) { +- setupEphemeralDHKeys(suite.exportable); ++ setupEphemeralDHKeys(suite.exportable, privateKey); + } else if (keyExchange == K_ECDHE_RSA) { + if (setupEphemeralECDHKeys() == false) { + return false; +@@ -887,7 +933,8 @@ + if (setupPrivateKeyAndChain("DSA") == false) { + return false; + } +- setupEphemeralDHKeys(suite.exportable); ++ ++ setupEphemeralDHKeys(suite.exportable, privateKey); + break; + case K_ECDHE_ECDSA: + // need EC cert signed using EC +@@ -921,7 +968,7 @@ + break; + case K_DH_ANON: + // no certs needed for anonymous +- setupEphemeralDHKeys(suite.exportable); ++ setupEphemeralDHKeys(suite.exportable, null); + break; + case K_ECDH_ANON: + // no certs needed for anonymous +@@ -962,15 +1009,70 @@ + * Acquire some "ephemeral" Diffie-Hellman keys for this handshake. + * We don't reuse these, for improved forward secrecy. + */ +- private void setupEphemeralDHKeys(boolean export) { ++ private void setupEphemeralDHKeys(boolean export, Key key) { + /* +- * Diffie-Hellman keys ... we use 768 bit private keys due +- * to the "use twice as many key bits as bits you want secret" +- * rule of thumb, assuming we want the same size premaster +- * secret with Diffie-Hellman and RSA key exchanges. Except +- * that exportable ciphers max out at 512 bits modulus values. ++ * 768 bits ephemeral DH private keys were used to be used in ++ * ServerKeyExchange except that exportable ciphers max out at 512 ++ * bits modulus values. We still adhere to this behavior in legacy ++ * mode (system property "jdk.tls.ephemeralDHKeySize" is defined ++ * as "legacy"). ++ * ++ * Old JDK (JDK 7 and previous) releases don't support DH keys bigger ++ * than 1024 bits. We have to consider the compatibility requirement. ++ * 1024 bits DH key is always used for non-exportable cipher suites ++ * in default mode (system property "jdk.tls.ephemeralDHKeySize" ++ * is not defined). ++ * ++ * However, if applications want more stronger strength, setting ++ * system property "jdk.tls.ephemeralDHKeySize" to "matched" ++ * is a workaround to use ephemeral DH key which size matches the ++ * corresponding authentication key. For example, if the public key ++ * size of an authentication certificate is 2048 bits, then the ++ * ephemeral DH key size should be 2048 bits accordingly unless ++ * the cipher suite is exportable. This key sizing scheme keeps ++ * the cryptographic strength consistent between authentication ++ * keys and key-exchange keys. ++ * ++ * Applications may also want to customize the ephemeral DH key size ++ * to a fixed length for non-exportable cipher suites. This can be ++ * approached by setting system property "jdk.tls.ephemeralDHKeySize" ++ * to a valid positive integer between 1024 and 2048 bits, inclusive. ++ * ++ * Note that the minimum acceptable key size is 1024 bits except ++ * exportable cipher suites or legacy mode. ++ * ++ * Note that the maximum acceptable key size is 2048 bits because ++ * DH keys bigger than 2048 are not always supported by underlying ++ * JCE providers. ++ * ++ * Note that per RFC 2246, the key size limit of DH is 512 bits for ++ * exportable cipher suites. Because of the weakness, exportable ++ * cipher suites are deprecated since TLS v1.1 and they are not ++ * enabled by default in Oracle provider. The legacy behavior is ++ * reserved and 512 bits DH key is always used for exportable ++ * cipher suites. + */ +- dh = new DHCrypt((export ? 512 : 768), sslContext.getSecureRandom()); ++ int keySize = export ? 512 : 1024; // default mode ++ if (!export) { ++ if (useLegacyEphemeralDHKeys) { // legacy mode ++ keySize = 768; ++ } else if (useSmartEphemeralDHKeys) { // matched mode ++ if (key != null) { ++ int ks = KeyUtil.getKeySize(key); ++ // Note that SunJCE provider only supports 2048 bits DH ++ // keys bigger than 1024. Please DON'T use value other ++ // than 1024 and 2048 at present. We may improve the ++ // underlying providers and key size here in the future. ++ // ++ // keySize = ks <= 1024 ? 1024 : (ks >= 2048 ? 2048 : ks); ++ keySize = ks <= 1024 ? 1024 : 2048; ++ } // Otherwise, anonymous cipher suites, 1024-bit is used. ++ } else if (customizedDHKeySize > 0) { // customized mode ++ keySize = customizedDHKeySize; ++ } ++ } ++ ++ dh = new DHCrypt(keySize, sslContext.getSecureRandom()); + } + + // Setup the ephemeral ECDH parameters. +@@ -1448,4 +1550,100 @@ + + session.setPeerCertificates(peerCerts); + } ++ ++ /** ++ * Parses the string argument as an unsigned integer in the radix ++ * specified by the second argument. An unsigned integer maps the ++ * values usually associated with negative numbers to positive ++ * numbers larger than {@code MAX_VALUE}. ++ * ++ * The characters in the string must all be digits of the ++ * specified radix (as determined by whether {@link ++ * java.lang.Character#digit(char, int)} returns a nonnegative ++ * value), except that the first character may be an ASCII plus ++ * sign {@code '+'} (<code>'\u002B'</code>). The resulting ++ * integer value is returned. ++ * ++ * <p>An exception of type {@code NumberFormatException} is ++ * thrown if any of the following situations occurs: ++ * <ul> ++ * <li>The first argument is {@code null} or is a string of ++ * length zero. ++ * ++ * <li>The radix is either smaller than ++ * {@link java.lang.Character#MIN_RADIX} or ++ * larger than {@link java.lang.Character#MAX_RADIX}. ++ * ++ * <li>Any character of the string is not a digit of the specified ++ * radix, except that the first character may be a plus sign ++ * {@code '+'} (<code>'\u002B'</code>) provided that the ++ * string is longer than length 1. ++ * ++ * <li>The value represented by the string is larger than the ++ * largest unsigned {@code int}, 2<sup>32</sup>-1. ++ * ++ * </ul> ++ * ++ * ++ * @param s the {@code String} containing the unsigned integer ++ * representation to be parsed ++ * @param radix the radix to be used while parsing {@code s}. ++ * @return the integer represented by the string argument in the ++ * specified radix. ++ * @throws NumberFormatException if the {@code String} ++ * does not contain a parsable {@code int}. ++ * @since 1.8 ++ */ ++ private static int parseUnsignedInt(String s, int radix) ++ throws NumberFormatException { ++ if (s == null) { ++ throw new NumberFormatException("null"); ++ } ++ ++ int len = s.length(); ++ if (len > 0) { ++ char firstChar = s.charAt(0); ++ if (firstChar == '-') { ++ throw new ++ NumberFormatException(String.format("Illegal leading minus sign " + ++ "on unsigned string %s.", s)); ++ } else { ++ if (len <= 5 || // Integer.MAX_VALUE in Character.MAX_RADIX is 6 digits ++ (radix == 10 && len <= 9) ) { // Integer.MAX_VALUE in base 10 is 10 digits ++ return Integer.parseInt(s, radix); ++ } else { ++ long ell = Long.parseLong(s, radix); ++ if ((ell & 0xffffffff00000000L) == 0) { ++ return (int) ell; ++ } else { ++ throw new ++ NumberFormatException(String.format("String value %s exceeds " + ++ "range of unsigned int.", s)); ++ } ++ } ++ } ++ } else { ++ throw new NumberFormatException("For input string: \"" + s + "\""); ++ } ++ } ++ ++ /** ++ * Parses the string argument as an unsigned decimal integer. The ++ * characters in the string must all be decimal digits, except ++ * that the first character may be an an ASCII plus sign {@code ++ * '+'} (<code>'\u002B'</code>). The resulting integer value ++ * is returned, exactly as if the argument and the radix 10 were ++ * given as arguments to the {@link ++ * #parseUnsignedInt(java.lang.String, int)} method. ++ * ++ * @param s a {@code String} containing the unsigned {@code int} ++ * representation to be parsed ++ * @return the unsigned integer value represented by the argument in decimal. ++ * @throws NumberFormatException if the string does not contain a ++ * parsable unsigned integer. ++ * @since 1.8 ++ */ ++ private static int parseUnsignedInt(String s) throws NumberFormatException { ++ return parseUnsignedInt(s, 10); ++ } + } +diff -Nru openjdk.orig/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java openjdk/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java +--- openjdk.orig/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java 1970-01-01 01:00:00.000000000 +0100 ++++ openjdk/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java 2015-07-22 02:10:13.262400236 +0100 +@@ -0,0 +1,477 @@ ++/* ++ * Copyright (c) 2013, 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. ++ */ ++ ++// ++// SunJSSE does not support dynamic system properties, no way to re-use ++// system properties in samevm/agentvm mode. ++// ++ ++/* ++ * @test ++ * @bug 6956398 ++ * @summary make ephemeral DH key match the length of the certificate key ++ * @run main/othervm ++ * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched ++ * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy ++ * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024 ++ * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75 ++ * ++ * @run main/othervm ++ * DHEKeySizing SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA true 292 75 ++ * ++ * @run main/othervm ++ * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1510 139 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy ++ * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1414 107 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched ++ * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1894 267 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024 ++ * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1510 139 ++ * ++ * @run main/othervm ++ * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 484 139 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy ++ * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 388 107 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched ++ * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 484 139 ++ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024 ++ * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 484 139 ++ */ ++ ++/* ++ * This is a simple hack to test key sizes of Diffie-Hellman key exchanging ++ * during SSL/TLS handshaking. ++ * ++ * The record length of DH ServerKeyExchange and ClientKeyExchange. ++ * ServerKeyExchange message are wrapped in ServerHello series messages, which ++ * contains ServerHello, Certificate and ServerKeyExchange message. ++ * ++ * struct { ++ * opaque dh_p<1..2^16-1>; ++ * opaque dh_g<1..2^16-1>; ++ * opaque dh_Ys<1..2^16-1>; ++ * } ServerDHParams; // Ephemeral DH parameters ++ * ++ * struct { ++ * select (PublicValueEncoding) { ++ * case implicit: struct { }; ++ * case explicit: opaque dh_Yc<1..2^16-1>; ++ * } dh_public; ++ * } ClientDiffieHellmanPublic; ++ * ++ * Fomr above structures, it is clear that if the DH key size increasing 128 ++ * bits (16 bytes), the ServerHello series messages increases 48 bytes ++ * (becuase dh_p, dh_g and dh_Ys each increase 16 bytes) and ClientKeyExchange ++ * increases 16 bytes (because of the size increasing of dh_Yc). ++ * ++ * Here is a summary of the record length in the test case. ++ * ++ * | ServerHello Series | ClientKeyExchange | ServerHello Anon ++ * 512-bit | 1318 bytes | 75 bytes | 292 bytes ++ * 768-bit | 1414 bytes | 107 bytes | 388 bytes ++ * 1024-bit | 1510 bytes | 139 bytes | 484 bytes ++ * 2048-bit | 1894 bytes | 267 bytes | 484 bytes ++ */ ++ ++import javax.net.ssl.*; ++import javax.net.ssl.SSLEngineResult.*; ++import java.io.*; ++import java.nio.*; ++import java.security.KeyStore; ++import java.security.KeyFactory; ++import java.security.cert.Certificate; ++import java.security.cert.CertificateFactory; ++import java.security.spec.PKCS8EncodedKeySpec; ++import java.security.spec.*; ++import java.security.interfaces.*; ++import java.util.Base64; ++ ++public class DHEKeySizing { ++ ++ private static boolean debug = true; ++ ++ private SSLContext sslc; ++ private SSLEngine ssle1; // client ++ private SSLEngine ssle2; // server ++ ++ private ByteBuffer appOut1; // write side of ssle1 ++ private ByteBuffer appIn1; // read side of ssle1 ++ private ByteBuffer appOut2; // write side of ssle2 ++ private ByteBuffer appIn2; // read side of ssle2 ++ ++ private ByteBuffer oneToTwo; // "reliable" transport ssle1->ssle2 ++ private ByteBuffer twoToOne; // "reliable" transport ssle2->ssle1 ++ ++ /* ++ * Where do we find the keystores? ++ */ ++ // Certificates and key used in the test. ++ static String trustedCertStr = ++ "-----BEGIN CERTIFICATE-----\n" + ++ "MIIC8jCCAdqgAwIBAgIEUjkuRzANBgkqhkiG9w0BAQUFADA7MR0wGwYDVQQLExRT\n" + ++ "dW5KU1NFIFRlc3QgU2VyaXZjZTENMAsGA1UEChMESmF2YTELMAkGA1UEBhMCVVMw\n" + ++ "HhcNMTMwOTE4MDQzODMxWhcNMTMxMjE3MDQzODMxWjA7MR0wGwYDVQQLExRTdW5K\n" + ++ "U1NFIFRlc3QgU2VyaXZjZTENMAsGA1UEChMESmF2YTELMAkGA1UEBhMCVVMwggEi\n" + ++ "MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCO+IGeaskJAvEcYc7pCl9neK3E\n" + ++ "a28fwWLtChufYNaC9hQfZlUdETWYjV7fZJVJKT/oLzdDNMWuVA0LKXArpI3thLNK\n" + ++ "QLXisdF9hKPlZRDazACL9kWUUtJ0FzpEySK4e8wW/z9FuU6e6iO19FbjxAfInJqk\n" + ++ "3EDiEhB5g73S2vtvPCxgq2DvWw9TDl/LIqdKG2JCS93koXCCaHmQ7MrIOqHPd+8r\n" + ++ "RbGpatXT9qyHKppUv9ATxVygO4rA794mgCFxpT+fkhz+NEB0twTkM65T1hnnOv5n\n" + ++ "ZIxkcjBggt85UlZtnP3b9P7SYxsWIa46Oc38Od2f3YejfVg6B+PqPgWNl3+/AgMB\n" + ++ "AAEwDQYJKoZIhvcNAQEFBQADggEBAAlrP6DFLRPSy0IgQhcI2i56tR/na8pezSte\n" + ++ "ZHcCdaCZPDy4UP8mpLJ9QCjEB5VJv8hPm4xdK7ULnKGOGHgYqDpV2ZHvQlhV1woQ\n" + ++ "TZGb/LM3c6kAs0j4j9KM2fq3iYUYexjIkS1KzsziflxMM6igS9BRMBR2LQyU+cYq\n" + ++ "YEsFzkF7Aj2ET4v/+tgot9mRr2NioJcaJkdsPDpMU3IKB1cczfu+OuLQ/GCG0Fqu\n" + ++ "6ijCeCqfnaAbemHbJeVZZ6Qgka3uC2YMntLBmLkhqEo1d9zGYLoh7oWL77y5ibQZ\n" + ++ "LK5/H/zikcu579TWjlDHcqL3arCwBcrtsjSaPrRSWMrWV/6c0qw=\n" + ++ "-----END CERTIFICATE-----"; ++ ++ // Private key in the format of PKCS#8 ++ static String targetPrivateKey = ++ "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCO+IGeaskJAvEc\n" + ++ "Yc7pCl9neK3Ea28fwWLtChufYNaC9hQfZlUdETWYjV7fZJVJKT/oLzdDNMWuVA0L\n" + ++ "KXArpI3thLNKQLXisdF9hKPlZRDazACL9kWUUtJ0FzpEySK4e8wW/z9FuU6e6iO1\n" + ++ "9FbjxAfInJqk3EDiEhB5g73S2vtvPCxgq2DvWw9TDl/LIqdKG2JCS93koXCCaHmQ\n" + ++ "7MrIOqHPd+8rRbGpatXT9qyHKppUv9ATxVygO4rA794mgCFxpT+fkhz+NEB0twTk\n" + ++ "M65T1hnnOv5nZIxkcjBggt85UlZtnP3b9P7SYxsWIa46Oc38Od2f3YejfVg6B+Pq\n" + ++ "PgWNl3+/AgMBAAECggEAPdb5Ycc4m4A9QBSCRcRpzbyiFLKPh0HDg1n65q4hOtYr\n" + ++ "kAVYTVFTSF/lqGS+Ob3w2YIKujQKSUQrvCc5UHdFuHXMgxKIWbymK0+DAMb9SlYw\n" + ++ "6lkkcWp9gx9E4dnJ/df2SAAxovvrKMuHlL1SFASHhVtPfH2URvSfUaANLDXxyYOs\n" + ++ "8BX0Nr6wazhWjLjXo9yIGnKSvFfB8XisYcA78kEgas43zhmIGCDPqaYyyffOfRbx\n" + ++ "pM1KNwGmlN86iWR1CbwA/wwhcMySWQueS+s7cHbpRqZIYJF9jEeELiwi0vxjealS\n" + ++ "EMuHYedIRFMWaDIq9XyjrvXamHb0Z25jlXBNZHaM0QKBgQDE9adl+zAezR/n79vw\n" + ++ "0XiX2Fx1UEo3ApZHuoA2Q/PcBk+rlKqqQ3IwTcy6Wo648wK7v6Nq7w5nEWcsf0dU\n" + ++ "QA2Ng/AJEev/IfF34x7sKGYxtk1gcE0EuSBA3R+ocEZxnNw1Ryd5nUU24s8d4jCP\n" + ++ "Mkothnyaim+zE2raDlEtVc0CaQKBgQC509av+02Uq5oMjzbQp5PBJfQFjATOQT15\n" + ++ "eefYnVYurkQ1kcVfixkrO2ORhg4SjmI2Z5hJDgGtXdwgidpzkad+R2epS5qLMyno\n" + ++ "lQVpY6bMpEZ7Mos0yQygxnm8uNohEcTExOe+nP5fNJVpzBsGmfeyYOhnPQlf6oqf\n" + ++ "0cHizedb5wKBgQC/l5LyMil6HOGHlhzmIm3jj7VI7QR0hJC5T6N+phVml8ESUDjA\n" + ++ "DYHbmSKouISTRtkG14FY+RiSjCxH7bvuKazFV2289PETquogTA/9e8MFYqfcQwG4\n" + ++ "sXi9gBxWlnj/9a2EKiYtOB5nKLR/BlNkSHA93tAA6N+FXEMZwMmYhxk42QKBgAuY\n" + ++ "HQgD3PZOsqDf+qKQIhbmAFCsSMx5o5VFtuJ8BpmJA/Z3ruHkMuDQpsi4nX4o5hXQ\n" + ++ "5t6AAjjH52kcUMXvK40kdWJJtk3DFnVNfvXxYsHX6hHbuHXFqYUKfSP6QJnZmvZP\n" + ++ "9smcz/4usLfWJUWHK740b6upUkFqx9Vq5/b3s9y3AoGAdM5TW7LkkOFsdMGVAUzR\n" + ++ "9iXmCWElHTK2Pcp/3yqDBHSfiQx6Yp5ANyPnE9NBM0yauCfOyBB2oxLO4Rdv3Rqk\n" + ++ "9V9kyR/YAGr7dJaPcQ7pZX0OpkzgueAOJYPrx5VUzPYUtklYV1ycFZTfKlpFCxT+\n" + ++ "Ei6KUo0NXSdUIcB4yib1J10="; ++ ++ static char passphrase[] = "passphrase".toCharArray(); ++ ++ /* ++ * Majority of the test case is here, setup is done below. ++ */ ++ ++ private void createSSLEngines() throws Exception { ++ ssle1 = sslc.createSSLEngine("client", 1); ++ ssle1.setUseClientMode(true); ++ ++ ssle2 = sslc.createSSLEngine("server", 2); ++ ssle2.setUseClientMode(false); ++ } ++ ++ private boolean isHandshaking(SSLEngine e) { ++ return (e.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING); ++ } ++ ++ private void checkResult(ByteBuffer bbIn, ByteBuffer bbOut, ++ SSLEngineResult result, ++ Status status, HandshakeStatus hsStatus, ++ int consumed, int produced) ++ throws Exception { ++ ++ if ((status != null) && (result.getStatus() != status)) { ++ throw new Exception("Unexpected Status: need = " + status + ++ " got = " + result.getStatus()); ++ } ++ ++ if ((hsStatus != null) && (result.getHandshakeStatus() != hsStatus)) { ++ throw new Exception("Unexpected hsStatus: need = " + hsStatus + ++ " got = " + result.getHandshakeStatus()); ++ } ++ ++ if ((consumed != -1) && (consumed != result.bytesConsumed())) { ++ throw new Exception("Unexpected consumed: need = " + consumed + ++ " got = " + result.bytesConsumed()); ++ } ++ ++ if ((produced != -1) && (produced != result.bytesProduced())) { ++ throw new Exception("Unexpected produced: need = " + produced + ++ " got = " + result.bytesProduced()); ++ } ++ ++ if ((consumed != -1) && (bbIn.position() != result.bytesConsumed())) { ++ throw new Exception("Consumed " + bbIn.position() + ++ " != " + consumed); ++ } ++ ++ if ((produced != -1) && (bbOut.position() != result.bytesProduced())) { ++ throw new Exception("produced " + bbOut.position() + ++ " != " + produced); ++ } ++ } ++ ++ private void test(String cipherSuite, boolean exportable, ++ int lenServerKeyEx, int lenClientKeyEx) throws Exception { ++ ++ createSSLEngines(); ++ createBuffers(); ++ ++ SSLEngineResult result1; // ssle1's results from last operation ++ SSLEngineResult result2; // ssle2's results from last operation ++ ++ String[] suites = new String [] {cipherSuite}; ++ ++ ssle1.setEnabledCipherSuites(suites); ++ ssle2.setEnabledCipherSuites(suites); ++ ++ log("======================================"); ++ log("==================="); ++ log("client hello"); ++ result1 = ssle1.wrap(appOut1, oneToTwo); ++ checkResult(appOut1, oneToTwo, result1, ++ Status.OK, HandshakeStatus.NEED_UNWRAP, 0, -1); ++ oneToTwo.flip(); ++ ++ result2 = ssle2.unwrap(oneToTwo, appIn2); ++ checkResult(oneToTwo, appIn2, result2, ++ Status.OK, HandshakeStatus.NEED_TASK, result1.bytesProduced(), 0); ++ runDelegatedTasks(ssle2); ++ oneToTwo.compact(); ++ ++ log("==================="); ++ log("ServerHello"); ++ result2 = ssle2.wrap(appOut2, twoToOne); ++ checkResult(appOut2, twoToOne, result2, ++ Status.OK, HandshakeStatus.NEED_UNWRAP, 0, -1); ++ twoToOne.flip(); ++ ++ log("Message length of ServerHello series: " + twoToOne.remaining()); ++ if (lenServerKeyEx != twoToOne.remaining()) { ++ throw new Exception( ++ "Expected to generate ServerHello series messages of " + ++ lenServerKeyEx + " bytes, but not " + twoToOne.remaining()); ++ } ++ ++ result1 = ssle1.unwrap(twoToOne, appIn1); ++ checkResult(twoToOne, appIn1, result1, ++ Status.OK, HandshakeStatus.NEED_TASK, result2.bytesProduced(), 0); ++ runDelegatedTasks(ssle1); ++ twoToOne.compact(); ++ ++ log("==================="); ++ log("Key Exchange"); ++ result1 = ssle1.wrap(appOut1, oneToTwo); ++ checkResult(appOut1, oneToTwo, result1, ++ Status.OK, HandshakeStatus.NEED_WRAP, 0, -1); ++ oneToTwo.flip(); ++ ++ log("Message length of ClientKeyExchange: " + oneToTwo.remaining()); ++ if (lenClientKeyEx != oneToTwo.remaining()) { ++ throw new Exception( ++ "Expected to generate ClientKeyExchange message of " + ++ lenClientKeyEx + " bytes, but not " + oneToTwo.remaining()); ++ } ++ result2 = ssle2.unwrap(oneToTwo, appIn2); ++ checkResult(oneToTwo, appIn2, result2, ++ Status.OK, HandshakeStatus.NEED_TASK, result1.bytesProduced(), 0); ++ runDelegatedTasks(ssle2); ++ oneToTwo.compact(); ++ ++ log("==================="); ++ log("Client CCS"); ++ result1 = ssle1.wrap(appOut1, oneToTwo); ++ checkResult(appOut1, oneToTwo, result1, ++ Status.OK, HandshakeStatus.NEED_WRAP, 0, -1); ++ oneToTwo.flip(); ++ ++ result2 = ssle2.unwrap(oneToTwo, appIn2); ++ checkResult(oneToTwo, appIn2, result2, ++ Status.OK, HandshakeStatus.NEED_UNWRAP, ++ result1.bytesProduced(), 0); ++ oneToTwo.compact(); ++ ++ log("==================="); ++ log("Client Finished"); ++ result1 = ssle1.wrap(appOut1, oneToTwo); ++ checkResult(appOut1, oneToTwo, result1, ++ Status.OK, HandshakeStatus.NEED_UNWRAP, 0, -1); ++ oneToTwo.flip(); ++ ++ result2 = ssle2.unwrap(oneToTwo, appIn2); ++ checkResult(oneToTwo, appIn2, result2, ++ Status.OK, HandshakeStatus.NEED_WRAP, ++ result1.bytesProduced(), 0); ++ oneToTwo.compact(); ++ ++ log("==================="); ++ log("Server CCS"); ++ result2 = ssle2.wrap(appOut2, twoToOne); ++ checkResult(appOut2, twoToOne, result2, ++ Status.OK, HandshakeStatus.NEED_WRAP, 0, -1); ++ twoToOne.flip(); ++ ++ result1 = ssle1.unwrap(twoToOne, appIn1); ++ checkResult(twoToOne, appIn1, result1, ++ Status.OK, HandshakeStatus.NEED_UNWRAP, result2.bytesProduced(), 0); ++ twoToOne.compact(); ++ ++ log("==================="); ++ log("Server Finished"); ++ result2 = ssle2.wrap(appOut2, twoToOne); ++ checkResult(appOut2, twoToOne, result2, ++ Status.OK, HandshakeStatus.FINISHED, 0, -1); ++ twoToOne.flip(); ++ ++ result1 = ssle1.unwrap(twoToOne, appIn1); ++ checkResult(twoToOne, appIn1, result1, ++ Status.OK, HandshakeStatus.FINISHED, result2.bytesProduced(), 0); ++ twoToOne.compact(); ++ ++ log("==================="); ++ log("Check Session/Ciphers"); ++ String cs = ssle1.getSession().getCipherSuite(); ++ if (!cs.equals(suites[0])) { ++ throw new Exception("suites not equal: " + cs + "/" + suites[0]); ++ } ++ ++ cs = ssle2.getSession().getCipherSuite(); ++ if (!cs.equals(suites[0])) { ++ throw new Exception("suites not equal: " + cs + "/" + suites[0]); ++ } ++ ++ log("==================="); ++ log("Done with SSL/TLS handshaking"); ++ } ++ ++ public static void main(String args[]) throws Exception { ++ if (args.length != 4) { ++ System.out.println( ++ "Usage: java DHEKeySizing cipher-suite " + ++ "exportable(true|false)\n" + ++ " size-of-server-hello-record size-of-client-key-exchange"); ++ throw new Exception("Incorrect usage!"); ++ } ++ ++ (new DHEKeySizing()).test(args[0], ++ Boolean.parseBoolean(args[1]), ++ Integer.parseInt(args[2]), ++ Integer.parseInt(args[3])); ++ System.out.println("Test Passed."); ++ } ++ ++ /* ++ * ********************************************************** ++ * Majority of the test case is above, below is just setup stuff ++ * ********************************************************** ++ */ ++ ++ public DHEKeySizing() throws Exception { ++ sslc = getSSLContext(); ++ } ++ ++ /* ++ * Create an initialized SSLContext to use for this test. ++ */ ++ private SSLContext getSSLContext() throws Exception { ++ ++ // generate certificate from cert string ++ CertificateFactory cf = CertificateFactory.getInstance("X.509"); ++ ++ // create a key store ++ KeyStore ts = KeyStore.getInstance("JKS"); ++ KeyStore ks = KeyStore.getInstance("JKS"); ++ ts.load(null, null); ++ ks.load(null, null); ++ ++ // import the trused cert ++ ByteArrayInputStream is = ++ new ByteArrayInputStream(trustedCertStr.getBytes()); ++ Certificate trusedCert = cf.generateCertificate(is); ++ is.close(); ++ ts.setCertificateEntry("rsa-trusted-2048", trusedCert); ++ ++ // generate the private key. ++ String keySpecStr = targetPrivateKey; ++ PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( ++ Base64.getMimeDecoder().decode(keySpecStr)); ++ KeyFactory kf = KeyFactory.getInstance("RSA"); ++ RSAPrivateKey priKey = (RSAPrivateKey)kf.generatePrivate(priKeySpec); ++ ++ Certificate[] chain = new Certificate[1]; ++ chain[0] = trusedCert; ++ ++ // import the key entry. ++ ks.setKeyEntry("rsa-key-2048", priKey, passphrase, chain); ++ ++ // create SSL context ++ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); ++ kmf.init(ks, passphrase); ++ ++ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); ++ tmf.init(ts); ++ ++ SSLContext sslCtx = SSLContext.getInstance("TLS"); ++ sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); ++ ++ return sslCtx; ++ } ++ ++ private void createBuffers() { ++ // Size the buffers as appropriate. ++ ++ SSLSession session = ssle1.getSession(); ++ int appBufferMax = session.getApplicationBufferSize(); ++ int netBufferMax = session.getPacketBufferSize(); ++ ++ appIn1 = ByteBuffer.allocateDirect(appBufferMax + 50); ++ appIn2 = ByteBuffer.allocateDirect(appBufferMax + 50); ++ ++ oneToTwo = ByteBuffer.allocateDirect(netBufferMax); ++ twoToOne = ByteBuffer.allocateDirect(netBufferMax); ++ ++ appOut1 = ByteBuffer.wrap("Hi Engine2, I'm SSLEngine1".getBytes()); ++ appOut2 = ByteBuffer.wrap("Hello Engine1, I'm SSLEngine2".getBytes()); ++ ++ log("AppOut1 = " + appOut1); ++ log("AppOut2 = " + appOut2); ++ log(""); ++ } ++ ++ private static void runDelegatedTasks(SSLEngine engine) throws Exception { ++ ++ Runnable runnable; ++ while ((runnable = engine.getDelegatedTask()) != null) { ++ log("running delegated task..."); ++ runnable.run(); ++ } ++ } ++ ++ private static void log(String str) { ++ if (debug) { ++ System.out.println(str); ++ } ++ } ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6989466-compiler_warnings.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,405 @@ +# HG changeset patch +# User alanb +# Date 1286458577 -3600 +# Thu Oct 07 14:36:17 2010 +0100 +# Node ID 871cffb21423dee3d1692af8bd209d1ff4366031 +# Parent a2b1ef1294c57cadeffe012e30c353d491fa853f +6989466, PR2555: Miscellaneous compiler warnings in java/lang, java/util, java/io, sun/misc native code +Reviewed-by: andrew, mchung, ohair + +diff -Nru openjdk.orig/jdk/src/share/native/common/jni_util.c openjdk/jdk/src/share/native/common/jni_util.c +--- openjdk.orig/jdk/src/share/native/common/jni_util.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/native/common/jni_util.c 2015-07-22 02:17:04.999223287 +0100 +@@ -433,7 +433,7 @@ + for (i=0; i<len; i++) { + jchar unicode = str[i]; + if (unicode <= 0x00ff) +- result[i] = unicode; ++ result[i] = (char)unicode; + else + result[i] = '?'; + } +@@ -498,7 +498,7 @@ + for (i=0; i<len; i++) { + jchar unicode = str[i]; + if (unicode <= 0x007f ) +- result[i] = unicode; ++ result[i] = (char)unicode; + else + result[i] = '?'; + } +@@ -569,7 +569,7 @@ + for (i=0; i<len; i++) { + jchar c = str[i]; + if (c < 256) +- result[i] = c; ++ result[i] = (char)c; + else switch(c) { + case 0x20AC: result[i] = (char)0x80; break; + case 0x201A: result[i] = (char)0x82; break; +diff -Nru openjdk.orig/jdk/src/share/native/java/lang/Class.c openjdk/jdk/src/share/native/java/lang/Class.c +--- openjdk.orig/jdk/src/share/native/java/lang/Class.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/native/java/lang/Class.c 2015-07-22 02:17:04.999223287 +0100 +@@ -102,8 +102,8 @@ + char *clname; + jclass cls = 0; + char buf[128]; +- int len; +- int unicode_len; ++ jsize len; ++ jsize unicode_len; + + if (classname == NULL) { + JNU_ThrowNullPointerException(env, 0); +@@ -112,7 +112,7 @@ + + len = (*env)->GetStringUTFLength(env, classname); + unicode_len = (*env)->GetStringLength(env, classname); +- if (len >= sizeof(buf)) { ++ if (len >= (jsize)sizeof(buf)) { + clname = malloc(len + 1); + if (clname == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); +diff -Nru openjdk.orig/jdk/src/share/native/java/lang/ClassLoader.c openjdk/jdk/src/share/native/java/lang/ClassLoader.c +--- openjdk.orig/jdk/src/share/native/java/lang/ClassLoader.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/native/java/lang/ClassLoader.c 2015-07-22 02:17:04.999223287 +0100 +@@ -330,7 +330,7 @@ + if (handle) { + const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS; + JNI_OnLoad_t JNI_OnLoad; +- int i; ++ unsigned int i; + for (i = 0; i < sizeof(onLoadSymbols) / sizeof(char *); i++) { + JNI_OnLoad = (JNI_OnLoad_t) + JVM_FindLibraryEntry(handle, onLoadSymbols[i]); +@@ -368,7 +368,7 @@ + cause = (*env)->ExceptionOccurred(env); + if (cause) { + (*env)->ExceptionClear(env); +- (*env)->SetLongField(env, this, handleID, (jlong)NULL); ++ (*env)->SetLongField(env, this, handleID, (jlong)0); + (*env)->Throw(env, cause); + } + goto done; +@@ -391,7 +391,7 @@ + const char *onUnloadSymbols[] = JNI_ONUNLOAD_SYMBOLS; + void *handle; + JNI_OnUnload_t JNI_OnUnload; +- int i; ++ unsigned int i; + + if (!initIDs(env)) + return; +diff -Nru openjdk.orig/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h openjdk/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h +--- openjdk.orig/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h 2015-07-22 02:17:04.999223287 +0100 +@@ -47,11 +47,13 @@ + #define __LOp(x) *(1+(int*)x) + #endif + ++#ifndef __P + #ifdef __STDC__ + #define __P(p) p + #else + #define __P(p) () + #endif ++#endif + + /* + * ANSI/POSIX +diff -Nru openjdk.orig/jdk/src/share/native/java/lang/reflect/Proxy.c openjdk/jdk/src/share/native/java/lang/reflect/Proxy.c +--- openjdk.orig/jdk/src/share/native/java/lang/reflect/Proxy.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/native/java/lang/reflect/Proxy.c 2015-07-22 02:17:04.999223287 +0100 +@@ -82,9 +82,9 @@ + goto free_body; + + if (name != NULL) { +- int len = (*env)->GetStringUTFLength(env, name); +- int unicode_len = (*env)->GetStringLength(env, name); +- if (len >= sizeof(buf)) { ++ jsize len = (*env)->GetStringUTFLength(env, name); ++ jsize unicode_len = (*env)->GetStringLength(env, name); ++ if (len >= (jsize)sizeof(buf)) { + utfName = malloc(len + 1); + if (utfName == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); +diff -Nru openjdk.orig/jdk/src/share/native/java/nio/Bits.c openjdk/jdk/src/share/native/java/nio/Bits.c +--- openjdk.orig/jdk/src/share/native/java/nio/Bits.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/native/java/nio/Bits.c 2015-07-22 02:17:04.999223287 +0100 +@@ -111,7 +111,7 @@ + jlong srcPos, jlong dstAddr, jlong length) + { + jbyte *bytes; +- size_t i, size; ++ size_t size; + jshort *srcShort, *dstShort, *endShort; + jshort tmpShort; + +@@ -122,7 +122,7 @@ + if (length > MBYTE) + size = MBYTE; + else +- size = length; ++ size = (size_t)length; + + GETCRITICAL(bytes, env, src); + +@@ -146,7 +146,7 @@ + jobject dst, jlong dstPos, jlong length) + { + jbyte *bytes; +- size_t i, size; ++ size_t size; + jshort *srcShort, *dstShort, *endShort; + jshort tmpShort; + +@@ -157,7 +157,7 @@ + if (length > MBYTE) + size = MBYTE; + else +- size = length; ++ size = (size_t)length; + + GETCRITICAL(bytes, env, dst); + +@@ -181,7 +181,7 @@ + jlong srcPos, jlong dstAddr, jlong length) + { + jbyte *bytes; +- size_t i, size; ++ size_t size; + jint *srcInt, *dstInt, *endInt; + jint tmpInt; + +@@ -192,7 +192,7 @@ + if (length > MBYTE) + size = MBYTE; + else +- size = length; ++ size = (size_t)length; + + GETCRITICAL(bytes, env, src); + +@@ -216,7 +216,7 @@ + jobject dst, jlong dstPos, jlong length) + { + jbyte *bytes; +- size_t i, size; ++ size_t size; + jint *srcInt, *dstInt, *endInt; + jint tmpInt; + +@@ -227,7 +227,7 @@ + if (length > MBYTE) + size = MBYTE; + else +- size = length; ++ size = (size_t)length; + + GETCRITICAL(bytes, env, dst); + +@@ -251,7 +251,7 @@ + jlong srcPos, jlong dstAddr, jlong length) + { + jbyte *bytes; +- size_t i, size; ++ size_t size; + jlong *srcLong, *dstLong, *endLong; + jlong tmpLong; + +@@ -262,7 +262,7 @@ + if (length > MBYTE) + size = MBYTE; + else +- size = length; ++ size = (size_t)length; + + GETCRITICAL(bytes, env, src); + +@@ -286,7 +286,7 @@ + jobject dst, jlong dstPos, jlong length) + { + jbyte *bytes; +- size_t i, size; ++ size_t size; + jlong *srcLong, *dstLong, *endLong; + jlong tmpLong; + +@@ -297,7 +297,7 @@ + if (length > MBYTE) + size = MBYTE; + else +- size = length; ++ size = (size_t)length; + + GETCRITICAL(bytes, env, dst); + +diff -Nru openjdk.orig/jdk/src/share/native/sun/management/Flag.c openjdk/jdk/src/share/native/sun/management/Flag.c +--- openjdk.orig/jdk/src/share/native/sun/management/Flag.c 2015-04-10 16:39:21.000000000 +0100 ++++ openjdk/jdk/src/share/native/sun/management/Flag.c 2015-07-22 02:17:04.999223287 +0100 +@@ -25,6 +25,7 @@ + + #include <stdlib.h> + #include <stdio.h> ++#include <string.h> + #include <jni.h> + #include "management.h" + #include "sun_management_Flag.h" +diff -Nru openjdk.orig/jdk/src/share/native/sun/misc/VM.c openjdk/jdk/src/share/native/sun/misc/VM.c +--- openjdk.orig/jdk/src/share/native/sun/misc/VM.c 2015-04-10 16:39:21.000000000 +0100 ++++ openjdk/jdk/src/share/native/sun/misc/VM.c 2015-07-22 02:23:29.104527979 +0100 +@@ -23,6 +23,8 @@ + * questions. + */ + ++#include <string.h> ++ + #include "jni.h" + #include "jni_util.h" + #include "jlong.h" +@@ -111,8 +113,6 @@ + + JNIEXPORT void JNICALL + Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) { +- char errmsg[128]; +- + if (!JDK_InitJvmHandle()) { + JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup"); + } +diff -Nru openjdk.orig/jdk/src/share/native/sun/misc/VMSupport.c openjdk/jdk/src/share/native/sun/misc/VMSupport.c +--- openjdk.orig/jdk/src/share/native/sun/misc/VMSupport.c 2015-04-10 16:39:21.000000000 +0100 ++++ openjdk/jdk/src/share/native/sun/misc/VMSupport.c 2015-07-22 02:17:04.999223287 +0100 +@@ -38,8 +38,6 @@ + JNIEXPORT jobject JNICALL + Java_sun_misc_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props) + { +- char errmsg[128]; +- + if (InitAgentProperties_fp == NULL) { + if (!JDK_InitJvmHandle()) { + JNU_ThrowInternalError(env, +diff -Nru openjdk.orig/jdk/src/solaris/native/java/io/canonicalize_md.c openjdk/jdk/src/solaris/native/java/io/canonicalize_md.c +--- openjdk.orig/jdk/src/solaris/native/java/io/canonicalize_md.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/solaris/native/java/io/canonicalize_md.c 2015-07-22 02:17:05.003223216 +0100 +@@ -246,7 +246,7 @@ + if (r != NULL) { + /* Append unresolved subpath to resolved subpath */ + int rn = strlen(r); +- if (rn + strlen(p) >= len) { ++ if (rn + (int)strlen(p) >= len) { + /* Buffer overflow */ + errno = ENAMETOOLONG; + return -1; +diff -Nru openjdk.orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c +--- openjdk.orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2015-07-22 02:17:05.003223216 +0100 +@@ -191,7 +191,7 @@ + jobject file, jint a) + { + jboolean rv = JNI_FALSE; +- int mode; ++ int mode = 0; + switch (a) { + case java_io_FileSystem_ACCESS_READ: + mode = R_OK; +@@ -223,7 +223,8 @@ + jboolean rv = JNI_FALSE; + + WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) { +- int amode, mode; ++ int amode = 0; ++ int mode; + switch (access) { + case java_io_FileSystem_ACCESS_READ: + if (owneronly) +diff -Nru openjdk.orig/jdk/src/solaris/native/java/lang/java_props_md.c openjdk/jdk/src/solaris/native/java/lang/java_props_md.c +--- openjdk.orig/jdk/src/solaris/native/java/lang/java_props_md.c 2015-07-22 02:15:53.772464834 +0100 ++++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c 2015-07-22 02:17:05.003223216 +0100 +@@ -46,7 +46,9 @@ + #include "java_props.h" + + #ifdef __linux__ +-#define CODESET _NL_CTYPE_CODESET_NAME ++ #ifndef CODESET ++ #define CODESET _NL_CTYPE_CODESET_NAME ++ #endif + #else + #ifdef ALT_CODESET_KEY + #define CODESET ALT_CODESET_KEY +@@ -121,7 +123,7 @@ + java_props_t * + GetJavaProperties(JNIEnv *env) + { +- static java_props_t sprops = {0}; ++ static java_props_t sprops; + char *v; /* tmp var */ + + if (sprops.user_dir) { +diff -Nru openjdk.orig/jdk/src/windows/native/java/lang/java_props_md.c openjdk/jdk/src/windows/native/java/lang/java_props_md.c +--- openjdk.orig/jdk/src/windows/native/java/lang/java_props_md.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/windows/native/java/lang/java_props_md.c 2015-07-22 02:17:14.903050654 +0100 +@@ -800,7 +800,7 @@ + break; + } + sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion); +- sprops.os_version = strdup(buf); ++ sprops.os_version = _strdup(buf); + #if _M_IA64 + sprops.os_arch = "ia64"; + #elif _M_AMD64 +@@ -811,7 +811,7 @@ + sprops.os_arch = "unknown"; + #endif + +- sprops.patch_level = strdup(ver.szCSDVersion); ++ sprops.patch_level = _strdup(ver.szCSDVersion); + + sprops.desktop = "windows"; + } +diff -Nru openjdk.orig/jdk/src/windows/native/java/util/TimeZone_md.c openjdk/jdk/src/windows/native/java/util/TimeZone_md.c +--- openjdk.orig/jdk/src/windows/native/java/util/TimeZone_md.c 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/windows/native/java/util/TimeZone_md.c 2015-07-22 02:17:14.903050654 +0100 +@@ -26,6 +26,7 @@ + #include <windows.h> + #include <stdio.h> + #include <stdlib.h> ++#include "jvm.h" + #include "TimeZone_md.h" + + #define VALUE_UNKNOWN 0 +@@ -463,7 +464,7 @@ + /* + * Found the time zone in the mapping table. + */ +- javaTZName = strdup(items[TZ_JAVA_NAME]); ++ javaTZName = _strdup(items[TZ_JAVA_NAME]); + break; + } + /* +@@ -473,7 +474,7 @@ + strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR); + } else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) { + if (value_type == VALUE_MAPID) { +- javaTZName = strdup(items[TZ_JAVA_NAME]); ++ javaTZName = _strdup(items[TZ_JAVA_NAME]); + break; + } + strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR); +@@ -490,7 +491,7 @@ + fclose(fp); + + if (javaTZName == NULL && bestMatch[0] != '\0') { +- javaTZName = strdup(bestMatch); ++ javaTZName = _strdup(bestMatch); + } + return javaTZName; + +@@ -515,7 +516,7 @@ + + if (result != VALUE_UNKNOWN) { + if (result == VALUE_GMTOFFSET) { +- std_timezone = strdup(winZoneName); ++ std_timezone = _strdup(winZoneName); + } else { + std_timezone = matchJavaTZ(java_home_dir, result, + winZoneName, winMapID, country);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6991580-ipv6_nameservers.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,137 @@ +# HG changeset patch +# User robm +# Date 1430151427 -3600 +# Mon Apr 27 17:17:07 2015 +0100 +# Node ID 871094d6431aa9f277169e824a5694f27a01f0c0 +# Parent 4d9d165a8e7ce711b14a294b9e801af0c38970ac +6991580, PR2309: IPv6 Nameservers in resolv.conf throws NumberFormatException +Reviewed-by: michaelm, andrew, alanb, rriggs +Contributed-by: sgehwolf@redhat.com + +diff -r 4d9d165a8e7c -r 871094d6431a src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java +--- openjdk/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java Fri May 01 01:27:36 2015 +0100 ++++ openjdk/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java Mon Apr 27 17:17:07 2015 +0100 +@@ -85,6 +85,15 @@ + if (val.charAt(0) == '#' || val.charAt(0) == ';') { + break; + } ++ if ("nameserver".equals(keyword)) { ++ if (val.indexOf(':') >= 0 && ++ val.indexOf('.') < 0 && // skip for IPv4 literals with port ++ val.indexOf('[') < 0 && ++ val.indexOf(']') < 0 ) { ++ // IPv6 literal, in non-BSD-style. ++ val = "[" + val + "]"; ++ } ++ } + ll.add(val); + if (--maxvalues == 0) { + break; +diff -r 4d9d165a8e7c -r 871094d6431a test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ openjdk/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java Mon Apr 27 17:17:07 2015 +0100 +@@ -0,0 +1,104 @@ ++/* ++ * Copyright (c) 2015, Red Hat, Inc. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++import java.lang.reflect.Field; ++import java.util.Hashtable; ++ ++import javax.naming.Context; ++import javax.naming.NamingException; ++import javax.naming.spi.NamingManager; ++ ++import com.sun.jndi.dns.DnsContext; ++ ++/** ++ * @test ++ * @bug 6991580 ++ * @summary IPv6 Nameservers in resolv.conf throws NumberFormatException ++ * @run main/manual IPv6NameserverPlatformParsingTest ++ * ++ * In order to run this test be sure to place, for example, the following ++ * snippet into your platform's {@code /etc/resolv.conf}: ++ * <pre> ++ * nameserver 127.0.0.1 ++ * nameserver 2001:4860:4860::8888 ++ * nameserver [::1]:5353 ++ * nameserver 127.0.0.1:5353 ++ * </pre> ++ * ++ * Then, run this test as manual jtreg test. ++ * ++ * @author Severin Gehwolf ++ * ++ */ ++public class IPv6NameserverPlatformParsingTest { ++ ++ private static boolean foundIPv6 = false; ++ ++ public static void main(String[] args) { ++ Hashtable<String, String> env = new Hashtable<>(); ++ env.put(Context.INITIAL_CONTEXT_FACTORY, com.sun.jndi.dns.DnsContextFactory.class.getName()); ++ ++ String[] servers; ++ try { ++ Context ctx = NamingManager.getInitialContext(env); ++ if (!com.sun.jndi.dns.DnsContextFactory.platformServersAvailable()) { ++ throw new RuntimeException("FAIL: no platform servers available, test does not make sense"); ++ } ++ DnsContext context = (DnsContext)ctx; ++ servers = getServersFromContext(context); ++ } catch (NamingException e) { ++ throw new RuntimeException(e); ++ } ++ for (String server: servers) { ++ System.out.println("DEBUG: 'nameserver = " + server + "'"); ++ if (server.indexOf(':') >= 0 && server.indexOf('.') < 0) { ++ System.out.println("DEBUG: ==> Found IPv6 address in servers list: " + server); ++ foundIPv6 = true; ++ } ++ } ++ try { ++ new com.sun.jndi.dns.DnsClient(servers, 100, 1); ++ } catch (NumberFormatException e) { ++ throw new RuntimeException("FAIL: Tried to parse non-[]-encapsulated IPv6 address.", e); ++ } catch (Exception e) { ++ throw new RuntimeException("ERROR: Something unexpected happened."); ++ } ++ if (!foundIPv6) { ++ // This is a manual test, since it requires changing /etc/resolv.conf on Linux/Unix ++ // platforms. See comment as to how to run this test. ++ throw new RuntimeException("ERROR: No IPv6 address returned from platform."); ++ } ++ System.out.println("PASS: Found IPv6 address and DnsClient parsed it correctly."); ++ } ++ ++ private static String[] getServersFromContext(DnsContext context) { ++ try { ++ Field serversField = DnsContext.class.getDeclaredField("servers"); ++ serversField.setAccessible(true); ++ return (String[])serversField.get(context); ++ } catch (Exception e) { ++ throw new RuntimeException(e); ++ } ++ } ++ ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6997561-better_jndi_error_handling.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,143 @@ +# HG changeset patch +# User vinnie +# Date 1296760145 0 +# Thu Feb 03 19:09:05 2011 +0000 +# Node ID 515512634eb4370baead5f160ddc6d3e2bdf3a2b +# Parent e2a182adb30fe11dbe2bdf0797f6e68390797328 +6997561, PR2479: A request for better error handling in JNDI +Reviewed-by: robm + +diff -r e2a182adb30f -r 515512634eb4 src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Thu Feb 03 13:37:42 2011 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Thu Feb 03 19:09:05 2011 +0000 +@@ -143,7 +143,7 @@ + e.setRemainingName(remainingName); + e.setResolvedObj(resolvedObj); + +- if (starter == null) ++ if (starter == null || starter.isEmpty()) + e.setResolvedName(null); + else if (remainingName == null) + e.setResolvedName(starter); +diff -r e2a182adb30f -r 515512634eb4 test/com/sun/jndi/ldap/LdapName/EmptyNameSearch.java +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapName/EmptyNameSearch.java Thu Feb 03 19:09:05 2011 +0000 +@@ -0,0 +1,118 @@ ++/** ++ * @test ++ * @bug 6997561 ++ * @summary A request for better error handling in JNDI ++ */ ++ ++import java.net.Socket; ++import java.net.ServerSocket; ++import java.io.*; ++import javax.naming.*; ++import javax.naming.directory.*; ++import javax.naming.ldap.*; ++import java.util.Collections; ++import java.util.Hashtable; ++ ++public class EmptyNameSearch { ++ ++ public static void main(String[] args) throws Exception { ++ ++ // Start the LDAP server ++ Server s = new Server(); ++ s.start(); ++ Thread.sleep(3000); ++ ++ // Setup JNDI parameters ++ Hashtable env = new Hashtable(); ++ env.put(Context.INITIAL_CONTEXT_FACTORY, ++ "com.sun.jndi.ldap.LdapCtxFactory"); ++ env.put(Context.PROVIDER_URL, "ldap://localhost:" + s.getPortNumber()); ++ ++ try { ++ ++ // Create initial context ++ System.out.println("Client: connecting..."); ++ DirContext ctx = new InitialDirContext(env); ++ ++ System.out.println("Client: performing search..."); ++ ctx.search(new LdapName(Collections.EMPTY_LIST), "cn=*", null); ++ ctx.close(); ++ ++ // Exit ++ throw new RuntimeException(); ++ ++ } catch (NamingException e) { ++ System.err.println("Passed: caught the expected Exception - " + e); ++ ++ } catch (Exception e) { ++ System.err.println("Failed: caught an unexpected Exception - " + e); ++ throw e; ++ } ++ } ++ ++ static class Server extends Thread { ++ ++ private int serverPort = 0; ++ private byte[] bindResponse = { ++ 0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A, ++ 0x01, 0x00, 0x04, 0x00, 0x04, 0x00 ++ }; ++ private byte[] searchResponse = { ++ 0x30, 0x0C, 0x02, 0x01, 0x02, 0x65, 0x07, 0x0A, ++ 0x01, 0x02, 0x04, 0x00, 0x04, 0x00 ++ }; ++ ++ Server() { ++ } ++ ++ public int getPortNumber() { ++ return serverPort; ++ } ++ ++ public void run() { ++ try { ++ ServerSocket serverSock = new ServerSocket(0); ++ serverPort = serverSock.getLocalPort(); ++ System.out.println("Server: listening on port " + serverPort); ++ ++ Socket socket = serverSock.accept(); ++ System.out.println("Server: connection accepted"); ++ ++ InputStream in = socket.getInputStream(); ++ OutputStream out = socket.getOutputStream(); ++ ++ // Read the LDAP BindRequest ++ System.out.println("Server: reading request..."); ++ while (in.read() != -1) { ++ in.skip(in.available()); ++ break; ++ } ++ ++ // Write an LDAP BindResponse ++ System.out.println("Server: writing response..."); ++ out.write(bindResponse); ++ out.flush(); ++ ++ // Read the LDAP SearchRequest ++ System.out.println("Server: reading request..."); ++ while (in.read() != -1) { ++ in.skip(in.available()); ++ break; ++ } ++ ++ // Write an LDAP SearchResponse ++ System.out.println("Server: writing response..."); ++ out.write(searchResponse); ++ out.flush(); ++ ++ in.close(); ++ out.close(); ++ socket.close(); ++ serverSock.close(); ++ ++ } catch (IOException e) { ++ // ignore ++ } ++ } ++ } ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7007905-javazic_line_numbers.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,20 @@ +# HG changeset patch +# User okutsu +# Date 1292898032 -32400 +# Tue Dec 21 11:20:32 2010 +0900 +# Node ID 8da79c7d137ef3fb2f51973f53485fc56da33c54 +# Parent 89d065844fb6c9be02c85d4c63ad45f224ccb3dd +7007905, PR2298: javazic produces wrong line numbers +Reviewed-by: peytoia + +diff -r 89d065844fb6 -r 8da79c7d137e make/tools/src/build/tools/javazic/Zoneinfo.java +--- openjdk/jdk/make/tools/src/build/tools/javazic/Zoneinfo.java Tue Dec 21 10:58:23 2010 +0900 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Zoneinfo.java Tue Dec 21 11:20:32 2010 +0900 +@@ -222,6 +222,7 @@ + boolean continued = false; + Zone zone = null; + String l; ++ lineNum = 0; + + try { + while ((line = in.readLine()) != null) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7017176-missing_gpl_headers.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,129 @@ +# HG changeset patch +# User vinnie +# Date 1296813157 0 +# Fri Feb 04 09:52:37 2011 +0000 +# Node ID 78fe1b7a9a1a51c0517e4be49c980ef6a2594f30 +# Parent fed61c2f4d14de7c88f044681331df79cb6be4da +7017176, PR2479: Several JNDI tests are mssing GPL header +Reviewed-by: alanb + +diff -r fed61c2f4d14 -r 78fe1b7a9a1a test/com/sun/jndi/ldap/LdapName/Case.java +--- openjdk/jdk/test/com/sun/jndi/ldap/LdapName/Case.java Fri Feb 04 00:33:58 2011 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapName/Case.java Fri Feb 04 09:52:37 2011 +0000 +@@ -1,3 +1,26 @@ ++/* ++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ + /* + * @test + * @bug 4278094 +diff -r fed61c2f4d14 -r 78fe1b7a9a1a test/com/sun/jndi/ldap/LdapName/EmptyNameSearch.java +--- openjdk/jdk/test/com/sun/jndi/ldap/LdapName/EmptyNameSearch.java Fri Feb 04 00:33:58 2011 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapName/EmptyNameSearch.java Fri Feb 04 09:52:37 2011 +0000 +@@ -1,3 +1,26 @@ ++/* ++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ + /** + * @test + * @bug 6997561 +diff -r fed61c2f4d14 -r 78fe1b7a9a1a test/com/sun/jndi/ldap/LdapName/UnescapeTest.java +--- openjdk/jdk/test/com/sun/jndi/ldap/LdapName/UnescapeTest.java Fri Feb 04 00:33:58 2011 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapName/UnescapeTest.java Fri Feb 04 09:52:37 2011 +0000 +@@ -1,3 +1,26 @@ ++/* ++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ + /* + * @test + * @bug 4892070 +diff -r fed61c2f4d14 -r 78fe1b7a9a1a test/com/sun/jndi/ldap/ReadTimeoutTest.java +--- openjdk/jdk/test/com/sun/jndi/ldap/ReadTimeoutTest.java Fri Feb 04 00:33:58 2011 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/ReadTimeoutTest.java Fri Feb 04 09:52:37 2011 +0000 +@@ -1,3 +1,26 @@ ++/* ++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ + /** + * @test + * @bug 6176036
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7058708-javazic_warnings.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,2586 @@ +# HG changeset patch +# User jjg +# Date 1309481953 25200 +# Thu Jun 30 17:59:13 2011 -0700 +# Node ID 91781ef3032e7557e8e661caf33f07c9fefb5d27 +# Parent 483d8dacfbd886badc6fd60e151b798c15b29e26 +7058708, PR2298: Eliminate JDK build tools build warnings +Reviewed-by: ohair, jjg +Contributed-by: alexandre.boulgakov@oracle.com + +diff -Nru openjdk.orig/jdk/make/tools/Makefile openjdk/jdk/make/tools/Makefile +--- openjdk.orig/jdk/make/tools/Makefile 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/Makefile 2015-07-22 02:28:56.362823566 +0100 +@@ -28,6 +28,8 @@ + # + + BUILDDIR = .. ++ ++SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true + include $(BUILDDIR)/common/Defs.gmk + + SUBDIRS = \ +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java openjdk/jdk/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java +--- openjdk.orig/jdk/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -114,8 +114,8 @@ + */ + + out.println(jmi.getJarFileKind().getMarkerChar() + " " + filename); +- for (Iterator<String> iter = index.iterator(); iter.hasNext(); ) { +- out.println(iter.next()); ++ for (String entry : index) { ++ out.println(entry); + } + + } +@@ -171,8 +171,7 @@ + * A hashmap contains a mapping from the prefix string to + * a hashset which contains a set of the second level of prefix string. + */ +- private HashMap<String, HashSet<String>> knownPrefixMap = new +- HashMap<String, HashSet<String>>(); ++ private HashMap<String, HashSet<String>> knownPrefixMap = new HashMap<String, HashSet<String>>(); + + /* + * We add maximum 5 second level entries to "sun", "java" and +@@ -196,11 +195,11 @@ + synchronized(this) { + if (indexSet == null) { + indexSet = new HashSet<String>(); +- Enumeration entries = jar.entries(); ++ Enumeration<JarEntry> entries = jar.entries(); + boolean containsOnlyClass = true; + boolean containsOnlyResource = true; + while (entries.hasMoreElements()) { +- JarEntry entry = (JarEntry) entries.nextElement(); ++ JarEntry entry = entries.nextElement(); + String name = entry.getName(); + /* We only look at the non-directory entry. + MANIFEST file is also skipped. */ +@@ -338,9 +337,7 @@ + /* Iterate through the hash map, add the second level package names + * to the indexSet if has any. + */ +- for (Iterator<String> keysIterator = knownPrefixMap.keySet().iterator(); +- keysIterator.hasNext();) { +- String key = keysIterator.next(); ++ for (String key : knownPrefixMap.keySet()) { + HashSet<String> pkgSetStartsWithKey = knownPrefixMap.get(key); + int setSize = pkgSetStartsWithKey.size(); + +@@ -353,9 +350,8 @@ + /* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add + * them to the indexSet of the MetaIndex object. + */ +- for (Iterator<String> secondPkgElements = pkgSetStartsWithKey.iterator(); +- secondPkgElements.hasNext();) { +- indexSet.add(key + "/" + secondPkgElements.next()); ++ for (String secondPkgElement : pkgSetStartsWithKey) { ++ indexSet.add(key + "/" + secondPkgElement); + } + } + } // end the outer "for" +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/compileproperties/CompileProperties.java openjdk/jdk/make/tools/src/build/tools/compileproperties/CompileProperties.java +--- openjdk.orig/jdk/make/tools/src/build/tools/compileproperties/CompileProperties.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/compileproperties/CompileProperties.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -36,7 +36,6 @@ + import java.text.MessageFormat; + import java.util.ArrayList; + import java.util.Collections; +-import java.util.Iterator; + import java.util.List; + import java.util.Properties; + +@@ -228,13 +227,11 @@ + sortedKeys.add((String)key); + } + Collections.sort(sortedKeys); +- Iterator keys = sortedKeys.iterator(); + + StringBuffer data = new StringBuffer(); + +- while (keys.hasNext()) { +- Object key = keys.next(); +- data.append(" { \"" + escape((String)key) + "\", \"" + ++ for (String key : sortedKeys) { ++ data.append(" { \"" + escape(key) + "\", \"" + + escape((String)p.get(key)) + "\" },\n"); + } + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/dirdiff/DirDiff.java openjdk/jdk/make/tools/src/build/tools/dirdiff/DirDiff.java +--- openjdk.orig/jdk/make/tools/src/build/tools/dirdiff/DirDiff.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/dirdiff/DirDiff.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -164,7 +164,7 @@ + } + + File[] currentGoldenDirs = null; +- TreeSet goldDirSet = new TreeSet(); ++ TreeSet<String> goldDirSet = new TreeSet<String>(); + if (goldenDir != null) { + currentGoldenDirs = goldenDir.listFiles(); + for (int i=0; i<currentGoldenDirs.length; i++) { +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java openjdk/jdk/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java +--- openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -63,9 +63,9 @@ + static PublicMapping mapping = null; + + // Hash from name to Integer +- private Hashtable namesHash = new Hashtable(); ++ private Hashtable<String, Integer> namesHash = new Hashtable<String, Integer>(); + // Vector of all names +- private Vector namesVector = new Vector(); ++ private Vector<String> namesVector = new Vector<String>(); + + /** + * Create a new DTD. +@@ -87,15 +87,15 @@ + int numNames = namesVector.size(); + out.writeShort((short) (namesVector.size())); + for (int i = 0; i < namesVector.size(); i++) { +- String nm = (String) namesVector.elementAt(i); ++ String nm = namesVector.elementAt(i); + out.writeUTF(nm); + } + + saveEntities(out); + + out.writeShort((short) (elements.size())); +- for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) { +- saveElement(out, (Element)e.nextElement()); ++ for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) { ++ saveElement(out, e.nextElement()); + } + + if (namesVector.size() != numNames) { +@@ -106,21 +106,21 @@ + } + + private void buildNamesTable() { +- for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) { +- Entity ent = (Entity) e.nextElement(); ++ for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) { ++ Entity ent = e.nextElement(); + // Do even if not isGeneral(). That way, exclusions and inclusions + // will definitely have their element. + getNameId(ent.getName()); + } +- for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) { +- Element el = (Element) e.nextElement(); ++ for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) { ++ Element el = e.nextElement(); + getNameId(el.getName()); + for (AttributeList atts = el.getAttributes() ; atts != null ; atts = atts.getNext()) { + getNameId(atts.getName()); + if (atts.getValue() != null) { + getNameId(atts.getValue()); + } +- Enumeration vals = atts.getValues(); ++ Enumeration<?> vals = atts.getValues(); + while (vals != null && vals.hasMoreElements()) { + String s = (String) vals.nextElement(); + getNameId(s); +@@ -133,9 +133,9 @@ + // The the id of a name from the list of names + // + private short getNameId(String name) { +- Object o = namesHash.get(name); ++ Integer o = namesHash.get(name); + if (o != null) { +- return (short) ((Integer) o).intValue(); ++ return (short) o.intValue(); + } + int i = namesVector.size(); + namesVector.addElement(name); +@@ -149,16 +149,16 @@ + */ + void saveEntities(DataOutputStream out) throws IOException { + int num = 0; +- for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) { +- Entity ent = (Entity) e.nextElement(); ++ for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) { ++ Entity ent = e.nextElement(); + if (ent.isGeneral()) { + num++; + } + } + + out.writeShort((short) num); +- for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) { +- Entity ent = (Entity) e.nextElement(); ++ for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) { ++ Entity ent = e.nextElement(); + if (ent.isGeneral()) { + out.writeShort(getNameId(ent.getName())); + out.writeByte(ent.getType() & ~GENERAL); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java openjdk/jdk/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java +--- openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -48,7 +48,7 @@ + public final + class DTDInputStream extends FilterReader implements DTDConstants { + public DTD dtd; +- public Stack stack = new Stack(); ++ public Stack<Object> stack = new Stack<Object>(); + public char str[] = new char[64]; + public int replace = 0; + public int ln = 1; +@@ -105,6 +105,7 @@ + * parameter entities. + * [60] 350:22 + */ ++ @SuppressWarnings("fallthrough") + public int read() throws IOException { + switch (ch) { + case '%': { +@@ -134,6 +135,7 @@ + switch (ch) { + case '\r': + ln++; ++ /* fall through */ + case ';': + ch = in.read(); + break; +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/DTDParser.java openjdk/jdk/make/tools/src/build/tools/dtdbuilder/DTDParser.java +--- openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/DTDParser.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/dtdbuilder/DTDParser.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -87,7 +87,7 @@ + return null; + } + +- return MessageFormat.format(prop, args); ++ return MessageFormat.format(prop, (Object[])args); + } + + /** +@@ -201,6 +201,7 @@ + * Parse identifier. Uppercase characters are automatically + * folded to lowercase. Returns falsed if no identifier is found. + */ ++ @SuppressWarnings("fallthrough") + boolean parseIdentifier(boolean lower) throws IOException { + switch (ch) { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': +@@ -211,6 +212,7 @@ + if (lower) { + ch = 'a' + (ch - 'A'); + } ++ /* fall through */ + + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': +@@ -233,6 +235,7 @@ + * Parses name token. If <code>lower</code> is true, upper case letters + * are folded to lower case. Returns falsed if no token is found. + */ ++ @SuppressWarnings("fallthrough") + boolean parseNameToken(boolean lower) throws IOException { + boolean first = true; + +@@ -246,6 +249,7 @@ + if (lower) { + ch = 'a' + (ch - 'A'); + } ++ /* fall through */ + + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': +@@ -271,8 +275,8 @@ + /** + * Parse a list of identifiers. + */ +- Vector parseIdentifierList(boolean lower) throws IOException { +- Vector elems = new Vector(); ++ Vector<String> parseIdentifierList(boolean lower) throws IOException { ++ Vector<String> elems = new Vector<String>(); + skipSpace(); + switch (ch) { + case '(': +@@ -507,7 +511,7 @@ + * [116] 405:6 + */ + void parseElementDeclaration() throws IOException { +- Vector elems = parseIdentifierList(true); ++ Vector<String> elems = parseIdentifierList(true); + BitSet inclusions = null; + BitSet exclusions = null; + boolean omitStart = false; +@@ -544,26 +548,26 @@ + if ((type == MODEL) || (type == ANY)) { + if (ch == '-') { + ch = in.read(); +- Vector v = parseIdentifierList(true); ++ Vector<String> v = parseIdentifierList(true); + exclusions = new BitSet(); +- for (Enumeration e = v.elements() ; e.hasMoreElements() ;) { +- exclusions.set(dtd.getElement((String)e.nextElement()).getIndex()); ++ for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) { ++ exclusions.set(dtd.getElement(e.nextElement()).getIndex()); + } + } + if (ch == '+') { + ch = in.read(); +- Vector v = parseIdentifierList(true); ++ Vector<String> v = parseIdentifierList(true); + inclusions = new BitSet(); +- for (Enumeration e = v.elements() ; e.hasMoreElements() ;) { +- inclusions.set(dtd.getElement((String)e.nextElement()).getIndex()); ++ for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) { ++ inclusions.set(dtd.getElement(e.nextElement()).getIndex()); + } + } + } + expect('>'); + + if (in.replace == 0) { +- for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) { +- dtd.defineElement((String)e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null); ++ for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) { ++ dtd.defineElement(e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null); + } + } + } +@@ -582,7 +586,7 @@ + error("invalid", "attribute value"); + return; + } +- atts.type = atts.name2type(getString(0)); ++ atts.type = AttributeList.name2type(getString(0)); + skipParameterSpace(); + if (atts.type == NOTATION) { + atts.values = parseIdentifierList(true); +@@ -593,6 +597,7 @@ + * Parse an attribute value specification. + * [33] 331:1 + */ ++ @SuppressWarnings("fallthrough") + String parseAttributeValueSpecification() throws IOException { + int delim = -1; + switch (ch) { +@@ -627,6 +632,7 @@ + ch = in.read(); + return getString(0); + } ++ /* fall through */ + + default: + addString(ch & 0xFF); +@@ -648,7 +654,7 @@ + return; + } + skipParameterSpace(); +- atts.modifier = atts.name2type(getString(0)); ++ atts.modifier = AttributeList.name2type(getString(0)); + if (atts.modifier != FIXED) { + return; + } +@@ -663,7 +669,7 @@ + * REMIND: associated notation name + */ + void parseAttlistDeclaration() throws IOException { +- Vector elems = parseIdentifierList(true); ++ Vector<String> elems = parseIdentifierList(true); + AttributeList attlist = null, atts = null; + + while (parseIdentifier(true)) { +@@ -685,8 +691,8 @@ + expect('>'); + + if (in.replace == 0) { +- for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) { +- dtd.defineAttributes((String)e.nextElement(), attlist); ++ for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) { ++ dtd.defineAttributes(e.nextElement(), attlist); + } + } + } +@@ -810,6 +816,7 @@ + /** + * Parse a section of the input upto EOF or ']'. + */ ++ @SuppressWarnings("fallthrough") + void parseSection() throws IOException { + while (true) { + switch (ch) { +@@ -883,6 +890,7 @@ + default: + char str[] = {(char)ch}; + error("invalid.arg", "character", "'" + new String(str) + "' / " + ch); ++ /* fall through */ + + case ' ': + case '\t': +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/PublicMapping.java openjdk/jdk/make/tools/src/build/tools/dtdbuilder/PublicMapping.java +--- openjdk.orig/jdk/make/tools/src/build/tools/dtdbuilder/PublicMapping.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/dtdbuilder/PublicMapping.java 2015-07-22 02:28:32.243243992 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -44,7 +44,7 @@ + final class PublicMapping { + + String baseStr; +- Hashtable tab = new Hashtable(); ++ Hashtable<String, String> tab = new Hashtable<String, String>(); + + /** + * Create a mapping. +@@ -103,6 +103,6 @@ + */ + public String get(String id) { + // System.err.println(" id = "+id); +- return (String) tab.get(id); ++ return tab.get(id); + } + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -66,7 +66,7 @@ + * A cache which is used to speed up parseString() whenever it is + * used to parse a description that has been parsed before + */ +- private static Hashtable expressionCache = null; ++ private static Hashtable<String, CharSet> expressionCache = null; + + /** + * Builds a CharSet based on a textual description. For the syntax of +@@ -79,7 +79,7 @@ + // if "s" is in the expression cache, pull the result out + // of the expresison cache + if (expressionCache != null) { +- result = (CharSet)expressionCache.get(s); ++ result = expressionCache.get(s); + } + + // otherwise, use doParseString() to actually parse the string, +@@ -87,7 +87,7 @@ + if (result == null) { + result = doParseString(s); + if (expressionCache == null) { +- expressionCache = new Hashtable(); ++ expressionCache = new Hashtable<String, CharSet>(); + } + expressionCache.put(s, result); + } +@@ -336,8 +336,8 @@ + * Returns a copy of CharSet's expression cache and sets CharSet's + * expression cache to empty. + */ +- public static Hashtable releaseExpressionCache() { +- Hashtable result = expressionCache; ++ public static Hashtable<String, CharSet> releaseExpressionCache() { ++ Hashtable<String, CharSet> result = expressionCache; + expressionCache = null; + return result; + } +@@ -778,7 +778,7 @@ + * An Enumeration that can be used to extract the character ranges + * from a CharSet one at a time + */ +- public class Enumeration implements java.util.Enumeration { ++ public class Enumeration implements java.util.Enumeration<int[]> { + /** + * Initializes a CharSet.Enumeration + */ +@@ -798,7 +798,7 @@ + /** + * Returns the next range in the CarSet + */ +- public Object nextElement() { ++ public int[] nextElement() { + int[] result = new int[2]; + result[0] = chars[p++]; + result[1] = chars[p++]; +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -78,12 +78,12 @@ + * contains "true" for every character category that includes a dictionary + * character. + */ +- protected void buildCharCategories(Vector tempRuleList) { ++ protected void buildCharCategories(Vector<String> tempRuleList) { + super.buildCharCategories(tempRuleList); + + categoryFlags = new boolean[categories.size()]; + for (int i = 0; i < categories.size(); i++) { +- CharSet cs = (CharSet)categories.elementAt(i); ++ CharSet cs = categories.elementAt(i); + if (!(cs.intersection(dictionaryChars).empty())) { + categoryFlags[i] = true; + } +@@ -95,7 +95,7 @@ + // the function above. This gives us a way to create a separate character + // category for the dictionary characters even when + // RuleBasedBreakIteratorBuilder isn't making a distinction. +- protected void mungeExpressionList(Hashtable expressions) { ++ protected void mungeExpressionList(Hashtable<String, Object> expressions) { + expressions.put(dictionaryExpression, dictionaryChars); + } + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java 2015-07-22 02:27:27.340375309 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -91,9 +91,9 @@ + try { + info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance(); + +- Enumeration keys = info.getKeys(); ++ Enumeration<String> keys = info.getKeys(); + while (keys.hasMoreElements()) { +- String key = (String)keys.nextElement(); ++ String key = keys.nextElement(); + + if (key.equals("CharacterData")) { + generateDataFile(info.getString(key), +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -110,13 +110,13 @@ + * A temporary holding place used for calculating the character categories. + * This object contains CharSet objects. + */ +- protected Vector categories = null; ++ protected Vector<CharSet> categories = null; + + /** + * A table used to map parts of regexp text to lists of character + * categories, rather than having to figure them out from scratch each time + */ +- protected Hashtable expressions = null; ++ protected Hashtable<String, Object> expressions = null; + + /** + * A temporary holding place for the list of ignore characters +@@ -126,32 +126,32 @@ + /** + * A temporary holding place where the forward state table is built + */ +- protected Vector tempStateTable = null; ++ protected Vector<short[]> tempStateTable = null; + + /** + * A list of all the states that have to be filled in with transitions to + * the next state that is created. Used when building the state table from + * the regular expressions. + */ +- protected Vector decisionPointList = null; ++ protected Vector<Integer> decisionPointList = null; + + /** + * A stack for holding decision point lists. This is used to handle nested + * parentheses and braces in regexps. + */ +- protected Stack decisionPointStack = null; ++ protected Stack<Vector<Integer>> decisionPointStack = null; + + /** + * A list of states that loop back on themselves. Used to handle .*? + */ +- protected Vector loopingStates = null; ++ protected Vector<Integer> loopingStates = null; + + /** + * Looping states actually have to be backfilled later in the process + * than everything else. This is where a the list of states to backfill + * is accumulated. This is also used to handle .*? + */ +- protected Vector statesToBackfill = null; ++ protected Vector<Integer> statesToBackfill = null; + + /** + * A list mapping pairs of state numbers for states that are to be combined +@@ -159,7 +159,7 @@ + * in the process of making the state table deterministic to prevent + * infinite recursion. + */ +- protected Vector mergeList = null; ++ protected Vector<int[]> mergeList = null; + + /** + * A flag that is used to indicate when the list of looping states can +@@ -198,7 +198,7 @@ + * just vectors different parts of the job off to other functions. + */ + public RuleBasedBreakIteratorBuilder(String description) { +- Vector tempRuleList = buildRuleList(description); ++ Vector<String> tempRuleList = buildRuleList(description); + buildCharCategories(tempRuleList); + buildStateTable(tempRuleList); + buildBackwardsStateTable(tempRuleList); +@@ -213,7 +213,7 @@ + * variable names) + * </ul> + */ +- private Vector buildRuleList(String description) { ++ private Vector<String> buildRuleList(String description) { + // invariants: + // - parentheses must be balanced: ()[]{}<> + // - nothing can be nested inside <> +@@ -240,8 +240,8 @@ + // set up a vector to contain the broken-up description (each entry in the + // vector is a separate rule) and a stack for keeping track of opening + // punctuation +- Vector tempRuleList = new Vector(); +- Stack parenStack = new Stack(); ++ Vector<String> tempRuleList = new Vector<String>(); ++ Stack<Character> parenStack = new Stack<Character>(); + + int p = 0; + int ruleStart = 0; +@@ -326,7 +326,7 @@ + } + parenStack.pop(); + if (!parenStack.empty()) { +- lastOpen = ((Character)(parenStack.peek())).charValue(); ++ lastOpen = parenStack.peek().charValue(); + } + else { + lastOpen = '\u0000'; +@@ -552,7 +552,8 @@ + * character category numbers everywhere a literal character or a [] expression + * originally occurred. + */ +- protected void buildCharCategories(Vector tempRuleList) { ++ @SuppressWarnings("fallthrough") ++ protected void buildCharCategories(Vector<String> tempRuleList) { + int bracketLevel = 0; + int p = 0; + int lineNum = 0; +@@ -560,9 +561,9 @@ + // build hash table of every literal character or [] expression in the rule list + // and use CharSet.parseString() to derive a CharSet object representing the + // characters each refers to +- expressions = new Hashtable(); ++ expressions = new Hashtable<String, Object>(); + while (lineNum < tempRuleList.size()) { +- String line = (String)(tempRuleList.elementAt(lineNum)); ++ String line = tempRuleList.elementAt(lineNum); + p = 0; + while (p < line.length()) { + int c = line.codePointAt(p); +@@ -618,7 +619,7 @@ + CharSet.releaseExpressionCache(); + + // create the temporary category table (which is a vector of CharSet objects) +- categories = new Vector(); ++ categories = new Vector<CharSet>(); + if (ignoreChars != null) { + categories.addElement(ignoreChars); + } +@@ -643,8 +644,7 @@ + // At no time should a character ever occur in more than one character category. + + // for each expression in the expressions list, do... +- Enumeration iter = expressions.elements(); +- while (iter.hasMoreElements()) { ++ for (Enumeration<Object> iter = expressions.elements(); iter.hasMoreElements(); ) { + // initialize the working char set to the chars in the current expression + CharSet e = (CharSet)iter.nextElement(); + +@@ -653,7 +653,7 @@ + + // if there's overlap between the current working set of chars + // and the current category... +- CharSet that = (CharSet)(categories.elementAt(j)); ++ CharSet that = categories.elementAt(j); + if (!that.intersection(e).empty()) { + + // add a new category for the characters that were in the +@@ -686,9 +686,9 @@ + // up in some other category + CharSet allChars = new CharSet(); + for (int i = 1; i < categories.size(); i++) { +- allChars = allChars.union((CharSet)(categories.elementAt(i))); ++ allChars = allChars.union(categories.elementAt(i)); + } +- CharSet ignoreChars = (CharSet)(categories.elementAt(0)); ++ CharSet ignoreChars = categories.elementAt(0); + ignoreChars = ignoreChars.difference(allChars); + categories.setElementAt(ignoreChars, 0); + +@@ -697,9 +697,9 @@ + // character categories that expression refers to. The String is encoded: each + // character is a character category number (plus 0x100 to avoid confusing them + // with syntax characters in the rule grammar) +- iter = expressions.keys(); +- while (iter.hasMoreElements()) { +- String key = (String)iter.nextElement(); ++ ++ for (Enumeration<String> iter = expressions.keys(); iter.hasMoreElements(); ) { ++ String key = iter.nextElement(); + CharSet cs = (CharSet)expressions.get(key); + StringBuffer cats = new StringBuffer(); + +@@ -707,7 +707,7 @@ + for (int j = 0; j < categories.size(); j++) { + + // if the current expression contains characters in that category... +- CharSet temp = cs.intersection((CharSet)(categories.elementAt(j))); ++ CharSet temp = cs.intersection(categories.elementAt(j)); + if (!temp.empty()) { + + // then add the encoded category number to the String for this +@@ -732,12 +732,12 @@ + + // for each category... + for (int i = 0; i < categories.size(); i++) { +- CharSet chars = (CharSet)(categories.elementAt(i)); ++ CharSet chars = categories.elementAt(i); + + // go through the character ranges in the category one by one... +- Enumeration enum_ = chars.getChars(); ++ Enumeration<int[]> enum_ = chars.getChars(); + while (enum_.hasMoreElements()) { +- int[] range = (int[])(enum_.nextElement()); ++ int[] range = enum_.nextElement(); + + // and set the corresponding elements in the CompactArray accordingly + if (i != 0) { +@@ -782,7 +782,7 @@ + numCategories = categories.size(); + } + +- protected void mungeExpressionList(Hashtable expressions) { ++ protected void mungeExpressionList(Hashtable<String, Object> expressions) { + // empty in the parent class. This function provides a hook for subclasses + // to mess with the character category table. + } +@@ -792,19 +792,19 @@ + * work is done in parseRule(), which is called once for each rule in the + * description. + */ +- private void buildStateTable(Vector tempRuleList) { ++ private void buildStateTable(Vector<String> tempRuleList) { + // initialize our temporary state table, and fill it with two states: + // state 0 is a dummy state that allows state 1 to be the starting state + // and 0 to represent "stop". State 1 is added here to seed things + // before we start parsing +- tempStateTable = new Vector(); ++ tempStateTable = new Vector<short[]>(); + tempStateTable.addElement(new short[numCategories + 1]); + tempStateTable.addElement(new short[numCategories + 1]); + + // call parseRule() for every rule in the rule list (except those which + // start with !, which are actually backwards-iteration rules) + for (int i = 0; i < tempRuleList.size(); i++) { +- String rule = (String)tempRuleList.elementAt(i); ++ String rule = tempRuleList.elementAt(i); + if (rule.charAt(0) != '!') { + parseRule(rule, true); + } +@@ -891,10 +891,10 @@ + int lastState = currentState; + String pendingChars = ""; + +- decisionPointStack = new Stack(); +- decisionPointList = new Vector(); +- loopingStates = new Vector(); +- statesToBackfill = new Vector(); ++ decisionPointStack = new Stack<Vector<Integer>>(); ++ decisionPointList = new Vector<Integer>(); ++ loopingStates = new Vector<Integer>(); ++ statesToBackfill = new Vector<Integer>(); + + short[] state; + boolean sawEarlyBreak = false; +@@ -972,8 +972,8 @@ + + // if the character we're on is a period, we end up down here + else { +- int rowNum = ((Integer)decisionPointList.lastElement()).intValue(); +- state = (short[])tempStateTable.elementAt(rowNum); ++ int rowNum = decisionPointList.lastElement().intValue(); ++ state = tempStateTable.elementAt(rowNum); + + // if the period is followed by an asterisk, then just set the current + // state to loop back on itself +@@ -1001,7 +1001,9 @@ + // of the current desicion point list onto the stack (this is + // the same thing we do on an opening brace) + if (p + 1 < rule.length() && rule.charAt(p + 1) == '*') { +- decisionPointStack.push(decisionPointList.clone()); ++ @SuppressWarnings("unchecked") ++ Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone(); ++ decisionPointStack.push(clone); + } + + // create a new state, add it to the list of states to backfill +@@ -1040,7 +1042,9 @@ + // it, preventing it from being affected by whatever's inside the parentheses. + // This decision point list is restored when a } is encountered. + else if (c == '{') { +- decisionPointStack.push(decisionPointList.clone()); ++ @SuppressWarnings("unchecked") ++ Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone(); ++ decisionPointStack.push(clone); + } + + // a } marks the end of an optional run of characters. Pop the last decision +@@ -1053,7 +1057,7 @@ + // on the character categories that caused us to enter this state + if (c == '*') { + for (int i = lastState + 1; i < tempStateTable.size(); i++) { +- Vector temp = new Vector(); ++ Vector<Integer> temp = new Vector<Integer>(); + temp.addElement(new Integer(i)); + updateStateTable(temp, pendingChars, (short)(lastState + 1)); + } +@@ -1063,7 +1067,7 @@ + // it with the current decision point list (this causes the divergent + // paths through the state table to come together again on the next + // new state) +- Vector temp = (Vector)decisionPointStack.pop(); ++ Vector<Integer> temp = decisionPointStack.pop(); + for (int i = 0; i < decisionPointList.size(); i++) + temp.addElement(decisionPointList.elementAt(i)); + decisionPointList = temp; +@@ -1123,8 +1127,10 @@ + // stack (this keeps track of the active decision point list before + // the () expression), followed by an empty decision point list + // (this will hold the exit points) +- decisionPointStack.push(decisionPointList.clone()); +- decisionPointStack.push(new Vector()); ++ @SuppressWarnings("unchecked") ++ Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone(); ++ decisionPointStack.push(clone); ++ decisionPointStack.push(new Vector<Integer>()); + } + + // a | separates alternative character sequences in a () expression. When +@@ -1133,8 +1139,8 @@ + else if (c == '|') { + + // pick out the top two decision point lists on the stack +- Vector oneDown = (Vector)decisionPointStack.pop(); +- Vector twoDown = (Vector)decisionPointStack.peek(); ++ Vector<Integer> oneDown = decisionPointStack.pop(); ++ Vector<Integer> twoDown = decisionPointStack.peek(); + decisionPointStack.push(oneDown); + + // append the current decision point list to the list below it +@@ -1142,7 +1148,9 @@ + // current decision point list to its state before the () expression + for (int i = 0; i < decisionPointList.size(); i++) + oneDown.addElement(decisionPointList.elementAt(i)); +- decisionPointList = (Vector)twoDown.clone(); ++ @SuppressWarnings("unchecked") ++ Vector<Integer> clone = (Vector<Integer>)twoDown.clone(); ++ decisionPointList = clone; + } + + // a ) marks the end of a sequence of characters. We do one of two things +@@ -1160,7 +1168,7 @@ + // pull the exit point list off the stack, merge it with the current + // decision point list, and make the merged version the current + // decision point list +- Vector exitPoints = (Vector)decisionPointStack.pop(); ++ Vector<Integer> exitPoints = decisionPointStack.pop(); + for (int i = 0; i < decisionPointList.size(); i++) + exitPoints.addElement(decisionPointList.elementAt(i)); + decisionPointList = exitPoints; +@@ -1176,16 +1184,18 @@ + + // now exitPoints and decisionPointList have to point to equivalent + // vectors, but not the SAME vector +- exitPoints = (Vector)decisionPointList.clone(); ++ @SuppressWarnings("unchecked") ++ Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone(); ++ exitPoints = clone; + + // pop the original decision point list off the stack +- Vector temp = (Vector)decisionPointStack.pop(); ++ Vector<Integer> temp = decisionPointStack.pop(); + + // we squirreled away the row number of our entry point list + // at the beginning of the original decision point list. Fish + // that state number out and retrieve the entry point list +- int tempStateNum = ((Integer)temp.firstElement()).intValue(); +- short[] tempState = (short[])tempStateTable.elementAt(tempStateNum); ++ int tempStateNum = temp.firstElement().intValue(); ++ short[] tempState = tempStateTable.elementAt(tempStateNum); + + // merge the original decision point list with the current + // decision point list +@@ -1217,8 +1227,8 @@ + else if (c == '/') { + sawEarlyBreak = true; + for (int i = 0; i < decisionPointList.size(); i++) { +- state = (short[])tempStateTable.elementAt(((Integer)decisionPointList. +- elementAt(i)).intValue()); ++ state = tempStateTable.elementAt(decisionPointList. ++ elementAt(i).intValue()); + state[numCategories] |= LOOKAHEAD_STATE_FLAG; + } + } +@@ -1261,8 +1271,8 @@ + // signals that these states cause the break position to be updated to the + // position of the slash rather than the current break position. + for (int i = 0; i < decisionPointList.size(); i++) { +- int rowNum = ((Integer)decisionPointList.elementAt(i)).intValue(); +- state = (short[])tempStateTable.elementAt(rowNum); ++ int rowNum = decisionPointList.elementAt(i).intValue(); ++ state = tempStateTable.elementAt(rowNum); + state[numCategories] |= END_STATE_FLAG; + if (sawEarlyBreak) { + state[numCategories] |= LOOKAHEAD_STATE_FLAG; +@@ -1279,7 +1289,7 @@ + * list of the columns that need updating. + * @param newValue Update the cells specfied above to contain this value + */ +- private void updateStateTable(Vector rows, ++ private void updateStateTable(Vector<Integer> rows, + String pendingChars, + short newValue) { + // create a dummy state that has the specified row number (newValue) in +@@ -1292,7 +1302,7 @@ + // go through the list of rows to update, and update them by calling + // mergeStates() to merge them the the dummy state we created + for (int i = 0; i < rows.size(); i++) { +- mergeStates(((Integer)rows.elementAt(i)).intValue(), newValues, rows); ++ mergeStates(rows.elementAt(i).intValue(), newValues, rows); + } + } + +@@ -1318,8 +1328,8 @@ + */ + private void mergeStates(int rowNum, + short[] newValues, +- Vector rowsBeingUpdated) { +- short[] oldValues = (short[])(tempStateTable.elementAt(rowNum)); ++ Vector<Integer> rowsBeingUpdated) { ++ short[] oldValues = tempStateTable.elementAt(rowNum); + boolean isLoopingState = loopingStates.contains(new Integer(rowNum)); + + // for each of the cells in the rows we're reconciling, do... +@@ -1375,7 +1385,7 @@ + // add this pair of row numbers to the merge list (create it first + // if we haven't created the merge list yet) + if (mergeList == null) { +- mergeList = new Vector(); ++ mergeList = new Vector<int[]>(); + } + mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum }); + +@@ -1384,7 +1394,7 @@ + // state table and update the original row (oldValues) to point + // to the new, merged, state + short[] newRow = new short[numCategories + 1]; +- short[] oldRow = (short[])(tempStateTable.elementAt(oldRowNum)); ++ short[] oldRow = tempStateTable.elementAt(oldRowNum); + System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1); + tempStateTable.addElement(newRow); + oldValues[i] = (short)combinedRowNum; +@@ -1408,7 +1418,7 @@ + // now (groan) do the same thing for all the entries on the + // decision point stack + for (int k = 0; k < decisionPointStack.size(); k++) { +- Vector dpl = (Vector)decisionPointStack.elementAt(k); ++ Vector<Integer> dpl = decisionPointStack.elementAt(k); + if ((dpl.contains(new Integer(oldRowNum)) + || dpl.contains(new Integer(newRowNum))) + && !dpl.contains(new Integer(combinedRowNum)) +@@ -1420,8 +1430,8 @@ + // FINALLY (puff puff puff), call mergeStates() recursively to copy + // the row referred to by newValues into the new row and resolve any + // conflicts that come up at that level +- mergeStates(combinedRowNum, (short[])(tempStateTable.elementAt( +- newValues[i])), rowsBeingUpdated); ++ mergeStates(combinedRowNum, tempStateTable.elementAt( ++ newValues[i]), rowsBeingUpdated); + } + } + } +@@ -1445,7 +1455,7 @@ + else { + int[] entry; + for (int i = 0; i < mergeList.size(); i++) { +- entry = (int[])(mergeList.elementAt(i)); ++ entry = mergeList.elementAt(i); + + // we have a hit if the two row numbers match the two row numbers + // in the beginning of the entry (the two that combine), in either +@@ -1477,20 +1487,21 @@ + * @param endStates The list of states to treat as end states (states that + * can exit the loop). + */ +- private void setLoopingStates(Vector newLoopingStates, Vector endStates) { ++ private void setLoopingStates(Vector<Integer> newLoopingStates, ++ Vector<Integer> endStates) { + + // if the current list of looping states isn't empty, we have to backfill + // values from the looping states into the states that are waiting to be + // backfilled + if (!loopingStates.isEmpty()) { +- int loopingState = ((Integer)loopingStates.lastElement()).intValue(); ++ int loopingState = loopingStates.lastElement().intValue(); + int rowNum; + + // don't backfill into an end state OR any state reachable from an end state + // (since the search for reachable states is recursive, it's split out into + // a separate function, eliminateBackfillStates(), below) + for (int i = 0; i < endStates.size(); i++) { +- eliminateBackfillStates(((Integer)endStates.elementAt(i)).intValue()); ++ eliminateBackfillStates(endStates.elementAt(i).intValue()); + } + + // we DON'T actually backfill the states that need to be backfilled here. +@@ -1501,8 +1512,8 @@ + // for backfilling by putting the row number of the state to copy from + // into the flag cell at the end of the row + for (int i = 0; i < statesToBackfill.size(); i++) { +- rowNum = ((Integer)statesToBackfill.elementAt(i)).intValue(); +- short[] state = (short[])tempStateTable.elementAt(rowNum); ++ rowNum = statesToBackfill.elementAt(i).intValue(); ++ short[] state = tempStateTable.elementAt(rowNum); + state[numCategories] = + (short)((state[numCategories] & ALL_FLAGS) | loopingState); + } +@@ -1511,7 +1522,9 @@ + } + + if (newLoopingStates != null) { +- loopingStates = (Vector)newLoopingStates.clone(); ++ @SuppressWarnings("unchecked") ++ Vector<Integer> clone = (Vector<Integer>)newLoopingStates.clone(); ++ loopingStates = clone; + } + } + +@@ -1530,7 +1543,7 @@ + + // then go through and recursively call this function for every + // state that the base state points to +- short[] state = (short[])tempStateTable.elementAt(baseState); ++ short[] state = tempStateTable.elementAt(baseState); + for (int i = 0; i < numCategories; i++) { + if (state[i] != 0) { + eliminateBackfillStates(state[i]); +@@ -1551,7 +1564,7 @@ + + // for each state in the state table... + for (int i = 0; i < tempStateTable.size(); i++) { +- state = (short[])tempStateTable.elementAt(i); ++ state = tempStateTable.elementAt(i); + + // check the state's flag word to see if it's marked for backfilling + // (it's marked for backfilling if any bits other than the two high-order +@@ -1563,7 +1576,7 @@ + // load up the state to copy from (if we haven't already) + if (fromState != loopingStateRowNum) { + loopingStateRowNum = fromState; +- loopingState = (short[])tempStateTable.elementAt(loopingStateRowNum); ++ loopingState = tempStateTable.elementAt(loopingStateRowNum); + } + + // clear out the backfill part of the flag word +@@ -1594,7 +1607,7 @@ + backfillLoopingStates(); + + int[] rowNumMap = new int[tempStateTable.size()]; +- Stack rowsToFollow = new Stack(); ++ Stack<Integer> rowsToFollow = new Stack<Integer>(); + rowsToFollow.push(new Integer(1)); + rowNumMap[1] = 1; + +@@ -1602,8 +1615,8 @@ + // (the reachable states will have their row numbers in the row number + // map, and the nonreachable states will have zero in the row number map) + while (rowsToFollow.size() != 0) { +- int rowNum = ((Integer)rowsToFollow.pop()).intValue(); +- short[] row = (short[])(tempStateTable.elementAt(rowNum)); ++ int rowNum = rowsToFollow.pop().intValue(); ++ short[] row = tempStateTable.elementAt(rowNum); + + for (int i = 0; i < numCategories; i++) { + if (row[i] != 0) { +@@ -1632,7 +1645,7 @@ + if (rowNumMap[i] == 0) { + continue; + } +- state1 = (short[])tempStateTable.elementAt(i); ++ state1 = tempStateTable.elementAt(i); + for (int j = 0; j < numCategories; j++) { + if (state1[j] != 0) { + ++stateClasses[i]; +@@ -1663,10 +1676,10 @@ + for (int i = 0; i < stateClasses.length; i++) { + if (stateClasses[i] == currentClass) { + if (state1 == null) { +- state1 = (short[])tempStateTable.elementAt(i); ++ state1 = tempStateTable.elementAt(i); + } + else { +- state2 = (short[])tempStateTable.elementAt(i); ++ state2 = tempStateTable.elementAt(i); + for (int j = 0; j < state2.length; j++) { + if ((j == numCategories && state1[j] != state2[j] && forward) + || (j != numCategories && stateClasses[state1[j]] +@@ -1733,7 +1746,7 @@ + int p = 0; + int p2 = 0; + for (int i = 0; i < tempStateTable.size(); i++) { +- short[] row = (short[])(tempStateTable.elementAt(i)); ++ short[] row = tempStateTable.elementAt(i); + if (row == null) { + continue; + } +@@ -1752,7 +1765,7 @@ + backwardsStateTable = new short[newRowNum * numCategories]; + int p = 0; + for (int i = 0; i < tempStateTable.size(); i++) { +- short[] row = (short[])(tempStateTable.elementAt(i)); ++ short[] row = tempStateTable.elementAt(i); + if (row == null) { + continue; + } +@@ -1769,12 +1782,12 @@ + * table and any additional rules (identified by the ! on the front) + * supplied in the description + */ +- private void buildBackwardsStateTable(Vector tempRuleList) { ++ private void buildBackwardsStateTable(Vector<String> tempRuleList) { + + // create the temporary state table and seed it with two rows (row 0 + // isn't used for anything, and we have to create row 1 (the initial + // state) before we can do anything else +- tempStateTable = new Vector(); ++ tempStateTable = new Vector<short[]>(); + tempStateTable.addElement(new short[numCategories + 1]); + tempStateTable.addElement(new short[numCategories + 1]); + +@@ -1786,7 +1799,7 @@ + // the same syntax as the normal break rules, but begin with '!' to distinguish + // them from normal break rules + for (int i = 0; i < tempRuleList.size(); i++) { +- String rule = (String)tempRuleList.elementAt(i); ++ String rule = tempRuleList.elementAt(i); + if (rule.charAt(0) == '!') { + parseRule(rule.substring(1), false); + } +@@ -1831,7 +1844,7 @@ + for (int i = 0; i < numCategories + 1; i++) + tempStateTable.addElement(new short[numCategories + 1]); + +- short[] state = (short[])tempStateTable.elementAt(backTableOffset - 1); ++ short[] state = tempStateTable.elementAt(backTableOffset - 1); + for (int i = 0; i < numCategories; i++) + state[i] = (short)(i + backTableOffset); + +@@ -1855,7 +1868,7 @@ + for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) { + int cellValue = lookupState(nextRow, nextColumn); + if (cellValue != 0) { +- state = (short[])tempStateTable.elementAt(nextColumn + ++ state = tempStateTable.elementAt(nextColumn + + backTableOffset); + state[column] = (short)(column + backTableOffset); + } +@@ -1876,9 +1889,9 @@ + // populated that is also populated in row 1 of the rule-based + // sub-table, copy the value from row 1 over the value in the + // auto-generated sub-table +- state = (short[])tempStateTable.elementAt(1); ++ state = tempStateTable.elementAt(1); + for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) { +- short[] state2 = (short[])tempStateTable.elementAt(i); ++ short[] state2 = tempStateTable.elementAt(i); + for (int j = 0; j < numCategories; j++) { + if (state[j] != 0 && state2[j] != 0) { + state2[j] = state[j]; +@@ -1890,9 +1903,9 @@ + // an end state, fill in all unpopulated cells with the values + // of the corresponding cells in the first row of the auto- + // generated sub-table. +- state = (short[])tempStateTable.elementAt(backTableOffset - 1); ++ state = tempStateTable.elementAt(backTableOffset - 1); + for (int i = 1; i < backTableOffset - 1; i++) { +- short[] state2 = (short[])tempStateTable.elementAt(i); ++ short[] state2 = tempStateTable.elementAt(i); + if ((state2[numCategories] & END_STATE_FLAG) == 0) { + for (int j = 0; j < numCategories; j++) { + if (state2[j] == 0) { +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -128,7 +128,7 @@ + int new_index = 0; + int loop_count = dataCount - 1; + long data = tempTable[old_index]; +- int start = (int)((long)(data>>32)) & CODEPOINT_MASK; ++ int start = (int)(data>>32) & CODEPOINT_MASK; + int end = (int)(data>>8) & CODEPOINT_MASK; + + /* +@@ -142,7 +142,7 @@ + newTempTable[new_index++] = composeEntry(start, (int)data); + for (int i = 0; i < loop_count; i++) { + data = tempTable[++old_index]; +- int nextStart = (int)((long)(data>>32)) & CODEPOINT_MASK; ++ int nextStart = (int)(data>>32) & CODEPOINT_MASK; + + /* + * If the previous end code point is not equal to the previous start +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java openjdk/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java 2015-07-22 02:32:36.406987994 +0100 +@@ -1,6 +1,6 @@ + + /* +- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -1234,7 +1234,7 @@ + else if (bits == 32 || bits < 8) + result.append(hex8((int)val)); + else { +- result.append(hex16((long)val)); ++ result.append(hex16(val)); + if (!Csyntax) + result.append("L"); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java openjdk/jdk/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -39,7 +39,7 @@ + * <p> + * @author John O'Conner + */ +-public class SpecialCaseMap implements Comparable { ++public class SpecialCaseMap implements Comparable<SpecialCaseMap> { + + SpecialCaseMap() { + chSource = 0xFFFF; +@@ -55,7 +55,7 @@ + */ + + public static SpecialCaseMap[] readSpecFile(File file, int plane) throws FileNotFoundException { +- ArrayList caseMaps = new ArrayList(150); ++ ArrayList<SpecialCaseMap> caseMaps = new ArrayList<SpecialCaseMap>(150); + int count = 0; + BufferedReader f = new BufferedReader(new FileReader(file)); + String line = null; +@@ -69,7 +69,7 @@ + SpecialCaseMap item = parse(line.trim()); + if (item != null) { + if(item.getCharSource() >> 16 < plane) continue; +- if((int)(item.getCharSource() >> 16) > plane) break; ++ if(item.getCharSource() >> 16 > plane) break; + caseMaps.add(item); + ++count; + } +@@ -83,7 +83,7 @@ + + } + +- /** ++ /** + * Given one line of a Unicode special casing data file as a String, parse the line + * and return a SpecialCaseMap object that contains the case mapping. + * +@@ -177,25 +177,25 @@ + else return -1; + } + +- /* ++ /* + * Extracts and returns the high surrogate value from a UTF-32 code point. + * If argument is a BMP character, then it is converted to a char and returned; + * otherwise the high surrogate value is extracted. + * @param codePoint a UTF-32 codePoint with value greater than 0xFFFF. + * @return the high surrogate value that helps create <code>codePoint</code>; else + * the char representation of <code>codePoint</code> if it is a BMP character. +- * @since 1.5 ++ * @since 1.5 + */ +- static char getHighSurrogate(int codePoint) { +- char high = (char)codePoint; +- if (codePoint > 0xFFFF) { +- high = (char)((codePoint - 0x10000)/0x0400 + 0xD800); +- } +- return high; ++ static char getHighSurrogate(int codePoint) { ++ char high = (char)codePoint; ++ if (codePoint > 0xFFFF) { ++ high = (char)((codePoint - 0x10000)/0x0400 + 0xD800); + } ++ return high; ++ } + + +- /* ++ /* + * Extracts and returns the low surrogate value from a UTF-32 code point. + * If argument is a BMP character, then it is converted to a char and returned; + * otherwise the high surrogate value is extracted. +@@ -204,29 +204,28 @@ + * the char representation of <code>codePoint</code> if it is a BMP character. + * @since 1.5 + */ +- static char getLowSurrogate(int codePoint) { +- char low = (char)codePoint; +- if(codePoint > 0xFFFF) { +- low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00); +- } +- return low; ++ static char getLowSurrogate(int codePoint) { ++ char low = (char)codePoint; ++ if(codePoint > 0xFFFF) { ++ low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00); + } ++ return low; ++ } + +- static String hex6(int n) { +- String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase(); +- return "000000".substring(Math.min(6, str.length())) + str; +- +- } ++ static String hex6(int n) { ++ String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase(); ++ return "000000".substring(Math.min(6, str.length())) + str; ++ } + +- static String hex6(char[] map){ +- StringBuffer buff = new StringBuffer(); +- int x=0; +- buff.append(hex6(map[x++])); +- while(x<map.length) { +- buff.append(" " + hex6(map[x++])); +- } +- return buff.toString(); ++ static String hex6(char[] map){ ++ StringBuffer buff = new StringBuffer(); ++ int x=0; ++ buff.append(hex6(map[x++])); ++ while(x<map.length) { ++ buff.append(" " + hex6(map[x++])); + } ++ return buff.toString(); ++ } + + void setCharSource(int ch) { + chSource = ch; +@@ -302,56 +301,62 @@ + static String CONTEXT_MODERN = "MODERN"; + static String CONTEXT_NONMODERN = "NON_MODERN"; + +- public int compareTo(Object otherObject) { +- SpecialCaseMap other = (SpecialCaseMap)otherObject; +- if (chSource < other.chSource) { ++ public int compareTo(SpecialCaseMap otherObject) { ++ if (chSource < otherObject.chSource) { + return -1; + } +- else if (chSource > other.chSource) { ++ else if (chSource > otherObject.chSource) { + return 1; + } + else return 0; + } + + public boolean equals(Object o1) { +- boolean bEqual = false; +- if (0 == compareTo(o1)) { +- bEqual = true; +- } ++ if (this == o1) { ++ return true; ++ } ++ if (o1 == null || !(o1 instanceof SpecialCaseMap)) { ++ return false; ++ } ++ SpecialCaseMap other = (SpecialCaseMap)o1; ++ boolean bEqual = false; ++ if (0 == compareTo(other)) { ++ bEqual = true; ++ } + return bEqual; + } + +- public String toString() { +- StringBuffer buff = new StringBuffer(); +- buff.append(hex6(getCharSource())); +- buff.append("|" + hex6(lowerCaseMap)); +- buff.append("|" + hex6(upperCaseMap)); +- buff.append("|" + hex6(titleCaseMap)); +- buff.append("|" + context); +- return buff.toString(); +- } +- +- public int hashCode() { +- return (int)chSource; +- } +- +- public static void main(String[] args) { +- SpecialCaseMap[] spec = null; +- if (args.length == 2 ) { +- try { +- File file = new File(args[0]); +- int plane = Integer.parseInt(args[1]); +- spec = SpecialCaseMap.readSpecFile(file, plane); +- System.out.println("SpecialCaseMap[" + spec.length + "]:"); +- for (int x=0; x<spec.length; x++) { +- System.out.println(spec[x].toString()); +- } +- } +- catch(Exception e) { +- e.printStackTrace(); +- } +- } ++ public String toString() { ++ StringBuffer buff = new StringBuffer(); ++ buff.append(hex6(getCharSource())); ++ buff.append("|" + hex6(lowerCaseMap)); ++ buff.append("|" + hex6(upperCaseMap)); ++ buff.append("|" + hex6(titleCaseMap)); ++ buff.append("|" + context); ++ return buff.toString(); ++ } ++ ++ public int hashCode() { ++ return chSource; ++ } + ++ public static void main(String[] args) { ++ SpecialCaseMap[] spec = null; ++ if (args.length == 2 ) { ++ try { ++ File file = new File(args[0]); ++ int plane = Integer.parseInt(args[1]); ++ spec = SpecialCaseMap.readSpecFile(file, plane); ++ System.out.println("SpecialCaseMap[" + spec.length + "]:"); ++ for (int x=0; x<spec.length; x++) { ++ System.out.println(spec[x].toString()); ++ } ++ } ++ catch(Exception e) { ++ e.printStackTrace(); ++ } + } + ++ } ++ + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java openjdk/jdk/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -391,31 +391,31 @@ + */ + + public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException { +- ArrayList list = new ArrayList(3000); ++ ArrayList<UnicodeSpec> list = new ArrayList<UnicodeSpec>(3000); + UnicodeSpec[] result = null; + int count = 0; + BufferedReader f = new BufferedReader(new FileReader(file)); +- String line = null; ++ String line = null; + loop: + while(true) { + try { + line = f.readLine(); + } + catch (IOException e) { +- break loop; +- } ++ break loop; ++ } + if (line == null) break loop; + UnicodeSpec item = parse(line.trim()); +- int specPlane = (int)(item.getCodePoint() >>> 16); +- if (specPlane < plane) continue; +- if (specPlane > plane) break; ++ int specPlane = item.getCodePoint() >>> 16; ++ if (specPlane < plane) continue; ++ if (specPlane > plane) break; + + if (item != null) { +- list.add(item); ++ list.add(item); + } + } +- result = new UnicodeSpec[list.size()]; +- list.toArray(result); ++ result = new UnicodeSpec[list.size()]; ++ list.toArray(result); + return result; + } + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java openjdk/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java +--- openjdk.orig/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java 2015-07-22 02:32:14.647367285 +0100 +@@ -250,10 +250,10 @@ + return Integer.parseInt(numericCode); + } + +- static HashMap specialCaseMap = new HashMap(); ++ static HashMap<String, Integer> specialCaseMap = new HashMap<String, Integer>(); + + private static int makeSpecialCaseEntry(String currencyInfo) throws Exception { +- Integer oldEntry = (Integer) specialCaseMap.get(currencyInfo); ++ Integer oldEntry = specialCaseMap.get(currencyInfo); + if (oldEntry != null) { + return oldEntry.intValue(); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/hasher/Hasher.java openjdk/jdk/make/tools/src/build/tools/hasher/Hasher.java +--- openjdk.orig/jdk/make/tools/src/build/tools/hasher/Hasher.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/hasher/Hasher.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -51,15 +51,15 @@ + + boolean verbose = false; + +- List keys = new ArrayList(); // Key strings +- List values = new ArrayList(); // Value expressions +- String pkg = null; // Package prefix for generated class +- String cln = null; // Name of generated class +- String vtype = "String"; // Value type +- int maxBits = 11; // lg table size +- int maxDepth = 3; // Max chain depth +- boolean inner = false; // Generating an inner class? +- boolean empty = false; // Generating an empty table? ++ List<String> keys = new ArrayList<String>(); // Key strings ++ List<String> values = new ArrayList<String>(); // Value expressions ++ String pkg = null; // Package prefix for generated class ++ String cln = null; // Name of generated class ++ String vtype = "String"; // Value type ++ int maxBits = 11; // lg table size ++ int maxDepth = 3; // Max chain depth ++ boolean inner = false; // Generating an inner class? ++ boolean empty = false; // Generating an empty table? + + void usage() { + err.println("usage: java Hasher [options] [[pkgName.]ClassName]"); +@@ -76,9 +76,9 @@ + } + + Hasher(String[] args) { +- List as = Arrays.asList(args); +- for (Iterator i = as.iterator(); i.hasNext();) { +- String a = (String)i.next(); ++ List<String> as = Arrays.asList(args); ++ for (Iterator<String> i = as.iterator(); i.hasNext();) { ++ String a = i.next(); + if (a.equals("-e")) { + empty = true; + } else if (a.equals("-i")) { +@@ -88,15 +88,15 @@ + } else if (a.equals("-md")) { + if (!i.hasNext()) + usage(); +- maxDepth = Integer.parseInt((String)i.next()); ++ maxDepth = Integer.parseInt(i.next()); + } else if (a.equals("-mb")) { + if (!i.hasNext()) + usage(); +- maxBits = Integer.parseInt((String)i.next()); ++ maxBits = Integer.parseInt(i.next()); + } else if (a.equals("-t")) { + if (!i.hasNext()) + usage(); +- vtype = (String)i.next(); ++ vtype = i.next(); + } else if (a.startsWith("-")) { + usage(); + } else { +@@ -153,8 +153,8 @@ + int nw = keys.size(); + + for (int i = 0; i < nw; i++) { +- String w = (String)keys.get(i); +- String v = (String)values.get(i); ++ String w = keys.get(i); ++ String v = values.get(i); + int h = hash(w); + if (ht[h] == null) + ht[h] = new Object[] { w, v }; +@@ -217,7 +217,7 @@ + if (verbose) + err.println(); + for (int i = 0, n = keys.size(); i < n; i++) { +- String w = (String)keys.get(i); ++ String w = keys.get(i); + String v = get(w); + if (verbose) + err.println(hash(w) + "\t" + w); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jarsplit/JarSplit.java openjdk/jdk/make/tools/src/build/tools/jarsplit/JarSplit.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jarsplit/JarSplit.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jarsplit/JarSplit.java 2015-07-22 02:28:32.247243923 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -43,7 +43,8 @@ + /* classlist[0] contains class file list + * classlist[1] contains non-class file list + */ +- private static Vector<String>[] classlist = (Vector<String>[])(new Vector[2]); ++ @SuppressWarnings("unchecked") ++ private static Vector<String>[] classlist = new Vector<String>[2]; + + /* The 2 class list name passed as arguments. */ + private static String[] fileNamelist = new String[2]; +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/GenDoc.java openjdk/jdk/make/tools/src/build/tools/javazic/GenDoc.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/GenDoc.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/GenDoc.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -31,12 +31,8 @@ + import java.io.FileReader; + import java.io.FileWriter; + import java.io.IOException; +-import java.util.ArrayList; +-import java.util.Calendar; + import java.util.Date; + import java.util.HashMap; +-import java.util.Iterator; +-import java.util.LinkedList; + import java.util.List; + import java.util.Map; + import java.util.Set; +@@ -189,7 +185,7 @@ + + out.write(header1 + new Date() + header3 + zonename + header4); + out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>"); +- LatitudeAndLongitude location = (LatitudeAndLongitude)mapList.get(zonename); ++ LatitudeAndLongitude location = mapList.get(zonename); + if (location != null) { + int deg, min, sec; + +@@ -608,12 +604,12 @@ + "<BR>\n\n" + "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n" + + "<TR>\n<TD NOWRAP>\n"); + +- Set aliasSet = a.keySet(); ++ Set<String> aliasSet = a.keySet(); + len = aliasSet.size(); +- Object aliasNames[] = aliasSet.toArray(); ++ String aliasNames[] = aliasSet.toArray(new String[0]); + for (int i = 0; i < len; i++) { +- displayNameList.put(transform((String)aliasNames[i]), +- (String)aliasNames[i]); ++ displayNameList.put(transform(aliasNames[i]), ++ aliasNames[i]); + } + + o = displayNameList.keySet().toArray(); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Gen.java openjdk/jdk/make/tools/src/build/tools/javazic/Gen.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Gen.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Gen.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -30,14 +30,9 @@ + import java.io.FileOutputStream; + import java.io.DataOutputStream; + import java.io.RandomAccessFile; +-import java.util.ArrayList; +-import java.util.Iterator; +-import java.util.LinkedList; + import java.util.List; + import java.util.Map; + import java.util.Set; +-import java.util.TreeMap; +-import java.util.TreeSet; + import sun.util.calendar.ZoneInfoFile; + + /** +@@ -105,14 +100,13 @@ + /* if DST offset is 0, this means DST isn't used. + * (NOT: offset's index is 0.) + */ +- if ((dstoffset = +- ((Integer)dstOffsets.get(i)).intValue()) == -1) { ++ if ((dstoffset = dstOffsets.get(i).intValue()) == -1) { + dstoffset = 0; + } + +- dos.writeLong((((Long)transitions.get(i)).longValue() << 12) ++ dos.writeLong((transitions.get(i).longValue() << 12) + | (dstoffset << 4) +- | ((Integer)offsets.get(i)).intValue()); ++ | offsets.get(i).intValue()); + + } + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Main.java openjdk/jdk/make/tools/src/build/tools/javazic/Main.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Main.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Main.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -26,7 +26,6 @@ + package build.tools.javazic; + + import java.util.ArrayList; +-import java.util.Iterator; + import java.util.List; + + /** +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Mappings.java openjdk/jdk/make/tools/src/build/tools/javazic/Mappings.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Mappings.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Mappings.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -26,9 +26,6 @@ + package build.tools.javazic; + + import java.util.ArrayList; +-import java.util.HashMap; +-import java.util.HashSet; +-import java.util.Iterator; + import java.util.LinkedList; + import java.util.List; + import java.util.Map; +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Simple.java openjdk/jdk/make/tools/src/build/tools/javazic/Simple.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Simple.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Simple.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -29,10 +29,7 @@ + import java.io.File; + import java.io.FileWriter; + import java.io.IOException; +-import java.util.ArrayList; + import java.util.HashMap; +-import java.util.Iterator; +-import java.util.LinkedList; + import java.util.List; + import java.util.Map; + import java.util.Set; +@@ -51,22 +48,19 @@ + /** + * Zone records which are applied for given year. + */ +- private static Map<String,ZoneRec> lastZoneRecs +- = new HashMap<String,ZoneRec>(); ++ private static Map<String,ZoneRec> lastZoneRecs = new HashMap<String,ZoneRec>(); + + /** + * Rule records which are applied for given year. + */ +- private static Map<String,List<RuleRec>> lastRules +- = new TreeMap<String,List<RuleRec>>(); ++ private static Map<String,List<RuleRec>> lastRules = new TreeMap<String,List<RuleRec>>(); + + /** + * zone IDs sorted by their GMT offsets. If zone's GMT + * offset will change in the future, its last known offset is + * used. + */ +- private SortedMap<Integer, Set<String>> zonesByOffset +- = new TreeMap<Integer, Set<String>>(); ++ private SortedMap<Integer, Set<String>> zonesByOffset = new TreeMap<Integer, Set<String>>(); + + /** + * Sets last Rule records and Zone records for given timezone to +@@ -101,16 +95,11 @@ + */ + int generateSrc(Mappings map) { + try { +- String outputDir = Main.getOutputDir(); +- File outD = new File(outputDir); +- +- if (!outputDir.endsWith(File.separator)) { +- outputDir += outD.separator; +- } ++ File outD = new File(Main.getOutputDir()); + outD.mkdirs(); + + FileWriter fw = +- new FileWriter(outputDir + "TimeZoneData.java", false); ++ new FileWriter(new File(outD, "TimeZoneData.java"), false); + BufferedWriter out = new BufferedWriter(fw); + + out.write("import java.util.SimpleTimeZone;\n\n"); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Time.java openjdk/jdk/make/tools/src/build/tools/javazic/Time.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Time.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Time.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -268,16 +268,16 @@ + if (index < time.length()) { + char c = time.charAt(index++); + if (c == 's') { +- tm.setType(tm.STD); ++ tm.setType(Time.STD); + } else if (c == 'u' || c == 'g' || c == 'z') { +- tm.setType(tm.UTC); ++ tm.setType(Time.UTC); + } else if (c == 'w') { +- tm.setType(tm.WALL); ++ tm.setType(Time.WALL); + } else { + Main.panic("unknown time mode: "+c); + } + } else { +- tm.setType(tm.WALL); ++ tm.setType(Time.WALL); + } + return tm; + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Zoneinfo.java openjdk/jdk/make/tools/src/build/tools/javazic/Zoneinfo.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Zoneinfo.java 2015-07-22 02:27:29.380339751 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Zoneinfo.java 2015-07-22 02:31:07.088544897 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -29,9 +29,7 @@ + import java.io.FileReader; + import java.io.FileNotFoundException; + import java.io.IOException; +-import java.util.ArrayList; + import java.util.HashMap; +-import java.util.Iterator; + import java.util.List; + import java.util.Map; + import java.util.StringTokenizer; +@@ -407,9 +405,9 @@ + if (!zrec.hasUntil()) { + if (tz.getNTransitions() > 0) { + if (stdOffset == 0) { +- tz.setDSTType(tz.X_DST); ++ tz.setDSTType(Timezone.X_DST); + } else { +- tz.setDSTType(tz.LAST_DST); ++ tz.setDSTType(Timezone.LAST_DST); + } + long time = Time.getLocalTime(maxYear, + Month.JANUARY, 1, 0); +@@ -419,7 +417,7 @@ + tz.getDstOffsetIndex(stdOffset)); + tz.addUsedRec(zrec); + } else { +- tz.setDSTType(tz.NO_DST); ++ tz.setDSTType(Timezone.NO_DST); + } + break; + } +@@ -527,7 +525,7 @@ + if (year == endYear && !zrec.hasUntil()) { + if (tz.getNTransitions() > 0) { + // Assume that this Zone stopped DST +- tz.setDSTType(tz.X_DST); ++ tz.setDSTType(Timezone.X_DST); + long time = Time.getLocalTime(maxYear, Month.JANUARY, + 1, 0); + time -= zrec.getGmtOffset(); +@@ -536,7 +534,7 @@ + tz.getDstOffsetIndex(0)); + usedZone = true; + } else { +- tz.setDSTType(tz.NO_DST); ++ tz.setDSTType(Timezone.NO_DST); + } + } + } +@@ -552,8 +550,8 @@ + } + } + +- if (tz.getDSTType() == tz.UNDEF_DST) { +- tz.setDSTType(tz.DST); ++ if (tz.getDSTType() == Timezone.UNDEF_DST) { ++ tz.setDSTType(Timezone.DST); + } + tz.optimize(); + tz.checksum(); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,7 +25,6 @@ + + package build.tools.jdwpgen; + +-import java.util.*; + import java.io.*; + + class AbstractCommandNode extends AbstractNamedNode { +@@ -35,8 +34,8 @@ + " Command</a> (" + nameNode.value() + ")</h5>"); + writer.println(comment()); + writer.println("<dl>"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + writer.println("</dl>"); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,14 +25,13 @@ + + package build.tools.jdwpgen; + +-import java.util.*; + import java.io.*; + + abstract class AbstractGroupNode extends AbstractTypeListNode { + + void document(PrintWriter writer) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + } + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -38,10 +38,10 @@ + } + + void prune() { +- Iterator it = components.iterator(); ++ Iterator<Node> it = components.iterator(); + + if (it.hasNext()) { +- Node nameNode = (Node)it.next(); ++ Node nameNode = it.next(); + + if (nameNode instanceof NameNode) { + this.nameNode = (NameNode)nameNode; +@@ -64,8 +64,8 @@ + void document(PrintWriter writer) { + writer.println("<h4><a name=" + name + ">" + name + + " Command Set</a></h4>"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + } + +@@ -90,8 +90,8 @@ + writer.print("class " + javaClassName()); + writer.println(javaClassImplements() + " {"); + genJavaClassSpecifics(writer, depth+1); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).genJava(writer, depth+1); ++ for (Node node : components) { ++ node.genJava(writer, depth+1); + } + indent(writer, depth); + writer.println("}"); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -40,7 +40,7 @@ + + void document(PrintWriter writer) { + writer.println("<dt>" + name() + " Data"); +- if (components.size() == 0) { ++ if (components.isEmpty()) { + writer.println("<dd>(None)"); + } else { + writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"); +@@ -49,24 +49,24 @@ + } + writer.println("<th width=\"15%\"><th width=\"65%\">"); + writer.println(""); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + writer.println("</table>"); + } + } + + void genJavaClassBodyComponents(PrintWriter writer, int depth) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + + tn.genJavaDeclaration(writer, depth); + } + } + + void genJavaReads(PrintWriter writer, int depth) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + tn.genJavaRead(writer, depth, tn.name()); + } + } +@@ -88,7 +88,7 @@ + + String javaParams() { + StringBuffer sb = new StringBuffer(); +- for (Iterator it = components.iterator(); it.hasNext();) { ++ for (Iterator<Node> it = components.iterator(); it.hasNext();) { + TypeNode tn = (TypeNode)it.next(); + sb.append(tn.javaParam()); + if (it.hasNext()) { +@@ -99,8 +99,8 @@ + } + + void genJavaWrites(PrintWriter writer, int depth) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + tn.genJavaWrite(writer, depth, tn.name()); + } + } +@@ -111,8 +111,8 @@ + writer.println(); + indent(writer, depth); + writer.println(className + "(" + javaParams() + ") {"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + indent(writer, depth+1); + writer.println("this." + tn.name() + " = " + tn.name() + ";"); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AltNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/AltNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/AltNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/AltNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -100,7 +100,7 @@ + indent(writer, depth+1); + writer.print("return new " + select.name() + "("); + writer.print("ALT_ID, new " + javaClassName() + "("); +- for (Iterator it = components.iterator(); it.hasNext();) { ++ for (Iterator<Node> it = components.iterator(); it.hasNext();) { + TypeNode tn = (TypeNode)it.next(); + writer.print(tn.name()); + if (it.hasNext()) { +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/CommandSetNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/CommandSetNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/CommandSetNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/CommandSetNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,7 +25,6 @@ + + package build.tools.jdwpgen; + +-import java.util.*; + import java.io.*; + + class CommandSetNode extends AbstractNamedNode { +@@ -43,8 +42,8 @@ + " Command Set</a> (" + + nameNode.value() + ")</h4>"); + writer.println(comment()); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + } + +@@ -53,8 +52,8 @@ + writer.println(name() + "</a> Command Set (" + + nameNode.value() + ")"); + writer.println("<ul>"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).documentIndex(writer); ++ for (Node node : components) { ++ node.documentIndex(writer); + } + writer.println("</ul>"); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java 2015-07-22 02:30:45.232925861 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -44,8 +44,8 @@ + void prune() { + List<Node> addons = new ArrayList<Node>(); + +- for (Iterator it = components.iterator(); it.hasNext(); ) { +- Node node = (Node)it.next(); ++ for (Iterator<Node> it = components.iterator(); it.hasNext(); ) { ++ Node node = it.next(); + } + if (!addons.isEmpty()) { + components.addAll(addons); +@@ -69,8 +69,8 @@ + writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"); + writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">"); + ConstantNode n; +- for (Iterator it = components.iterator(); it.hasNext();) { +- n = ((ConstantNode)it.next()); ++ for (Node node : components) { ++ n = (ConstantNode)node; + writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>"); + n.document(writer); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,7 +25,6 @@ + + package build.tools.jdwpgen; + +-import java.util.*; + import java.io.*; + + class ErrorSetNode extends AbstractSimpleNode { +@@ -41,12 +40,12 @@ + void document(PrintWriter writer) { + + writer.println("<dt>" + "Error Data"); +- if (components.size() == 0) { ++ if (components.isEmpty()) { + writer.println("<dd>(None)"); + } else { + writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + writer.println("</table>"); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/Node.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/Node.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/Node.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/Node.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -50,8 +50,8 @@ + } + + void parentAndExtractComments() { +- for (Iterator it = components.iterator(); it.hasNext();) { +- Node node = (Node)it.next(); ++ for (Iterator<Node> it = components.iterator(); it.hasNext();) { ++ Node node = it.next(); + if (node instanceof CommentNode) { + it.remove(); + commentList.add(((CommentNode)node).text()); +@@ -63,16 +63,14 @@ + } + + void prune() { +- for (Iterator it = components.iterator(); it.hasNext();) { +- Node node = (Node)it.next(); ++ for (Node node : components) { + node.prune(); + } + } + + void constrain(Context ctx) { + context = ctx; +- for (Iterator it = components.iterator(); it.hasNext();) { +- Node node = (Node)it.next(); ++ for (Node node : components) { + constrainComponent(ctx, node); + } + } +@@ -109,9 +107,9 @@ + if (commentList.size() > 0) { + indent(writer, depth); + writer.println("/**"); +- for (Iterator it = commentList.iterator(); it.hasNext();) { ++ for (String comment : commentList) { + indent(writer, depth); +- writer.println(" * " + (String)it.next()); ++ writer.println(" * " + comment); + } + indent(writer, depth); + writer.println(" */"); +@@ -123,15 +121,13 @@ + } + + void genJava(PrintWriter writer, int depth) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- Node node = (Node)it.next(); ++ for (Node node : components) { + node.genJava(writer, depth); + } + } + + void genCInclude(PrintWriter writer) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- Node node = (Node)it.next(); ++ for (Node node : components) { + node.genCInclude(writer); + } + } +@@ -184,8 +180,7 @@ + } + + void genJavaPreDef(PrintWriter writer, int depth) { +- for (Iterator it = components.iterator(); it.hasNext();) { +- Node node = (Node)it.next(); ++ for (Node node : components) { + node.genJavaPreDef(writer, depth); + } + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/OutNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/OutNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/OutNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/OutNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -48,8 +48,8 @@ + indent(writer, depth); + writer.print( + "static " + cmdName + " process(VirtualMachineImpl vm"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + writer.println(", "); + indent(writer, depth+5); + writer.print(tn.javaParam()); +@@ -59,8 +59,8 @@ + writer.println("throws JDWPException {"); + indent(writer, depth+1); + writer.print("PacketStream ps = enqueueCommand(vm"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + writer.print(", "); + writer.print(tn.name()); + } +@@ -76,8 +76,8 @@ + indent(writer, depth); + writer.print( + "static PacketStream enqueueCommand(VirtualMachineImpl vm"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- TypeNode tn = (TypeNode)it.next(); ++ for (Node node : components) { ++ TypeNode tn = (TypeNode)node; + writer.println(", "); + indent(writer, depth+5); + writer.print(tn.javaParam()); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/RootNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/RootNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/RootNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/RootNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -42,11 +42,11 @@ + void document(PrintWriter writer) { + writer.println("<html><head><title>" + comment() + "</title></head>"); + writer.println("<body bgcolor=\"white\">"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).documentIndex(writer); ++ for (Node node : components) { ++ node.documentIndex(writer); + } +- for (Iterator it = components.iterator(); it.hasNext();) { +- ((Node)it.next()).document(writer); ++ for (Node node : components) { ++ node.document(writer); + } + writer.println("</body></html>"); + } +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/SelectNode.java openjdk/jdk/make/tools/src/build/tools/jdwpgen/SelectNode.java +--- openjdk.orig/jdk/make/tools/src/build/tools/jdwpgen/SelectNode.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/jdwpgen/SelectNode.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -34,10 +34,10 @@ + + void prune() { + super.prune(); +- Iterator it = components.iterator(); ++ Iterator<Node> it = components.iterator(); + + if (it.hasNext()) { +- Node typeNode = (Node)it.next(); ++ Node typeNode = it.next(); + + if (typeNode instanceof ByteTypeNode || + typeNode instanceof IntTypeNode) { +@@ -131,8 +131,8 @@ + typeNode.genJavaRead(writer, depth, typeNode.name()); + indent(writer, depth); + writer.println("switch (" + typeNode.name() + ") {"); +- for (Iterator it = components.iterator(); it.hasNext();) { +- AltNode alt = (AltNode)it.next(); ++ for (Node node : components) { ++ AltNode alt = (AltNode)node; + alt.genJavaReadsSelectCase(writer, depth+1, commonVar()); + } + indent(writer, depth); +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/makeclasslist/MakeClasslist.java openjdk/jdk/make/tools/src/build/tools/makeclasslist/MakeClasslist.java +--- openjdk.orig/jdk/make/tools/src/build/tools/makeclasslist/MakeClasslist.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/makeclasslist/MakeClasslist.java 2015-07-22 02:28:32.251243853 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -38,7 +38,7 @@ + + public class MakeClasslist { + public static void main(String[] args) throws IOException { +- List/*<String>*/ classes = new ArrayList(); ++ List<String> classes = new ArrayList<String>(); + String origJavaHome = System.getProperty("java.home"); + String javaHome = origJavaHome.toLowerCase(); + if (javaHome.endsWith("jre")) { +@@ -84,10 +84,9 @@ + } + } + +- Set/*<String>*/ seenClasses = new HashSet(); ++ Set<String> seenClasses = new HashSet<String>(); + +- for (Iterator iter = classes.iterator(); iter.hasNext(); ) { +- String str = (String) iter.next(); ++ for (String str : seenClasses) { + if (seenClasses.add(str)) { + System.out.println(str); + } +@@ -109,13 +108,13 @@ + // completePackage(seenClasses, rtJar, "java/lang"); + } + +- private static void completePackage(Set seenClasses, ++ private static void completePackage(Set<String> seenClasses, + JarFile jar, + String packageName) { + int len = packageName.length(); +- Enumeration entries = jar.entries(); ++ Enumeration<JarEntry> entries = jar.entries(); + while (entries.hasMoreElements()) { +- JarEntry entry = (JarEntry) entries.nextElement(); ++ JarEntry entry = entries.nextElement(); + String name = entry.getName(); + if (name.startsWith(packageName) && + name.endsWith(".class") && +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/stripproperties/StripProperties.java openjdk/jdk/make/tools/src/build/tools/stripproperties/StripProperties.java +--- openjdk.orig/jdk/make/tools/src/build/tools/stripproperties/StripProperties.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/stripproperties/StripProperties.java 2015-07-22 02:28:32.255243784 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -246,7 +246,7 @@ + throws IOException { + BufferedWriter awriter; + awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1")); +- for (Enumeration e = properties.keys(); e.hasMoreElements();) { ++ for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) { + String key = (String)e.nextElement(); + String val = (String)properties.get(key); + key = saveConvert(key, true);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7069870-generic_array_initializers.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,24 @@ +# HG changeset patch +# User jjg +# Date 1311636039 25200 +# Mon Jul 25 16:20:39 2011 -0700 +# Node ID 9cf5ed6b45d6c7499d90a7268e69d3d7faa42d15 +# Parent 32e5be69954d983fac2d8d579531c2fa0f5f4b63 +7069870, PR2298: Parts of the JDK erroneously rely on generic array initializers with diamond +Reviewed-by: ksrini, mcimadamore +Contributed-by: alexandre.boulgakov@oracle.com + +diff -r 32e5be69954d -r 9cf5ed6b45d6 make/tools/src/build/tools/jarsplit/JarSplit.java +--- openjdk/jdk/make/tools/src/build/tools/jarsplit/JarSplit.java Fri Jul 08 10:25:57 2011 -0700 ++++ openjdk/jdk/make/tools/src/build/tools/jarsplit/JarSplit.java Mon Jul 25 16:20:39 2011 -0700 +@@ -43,8 +43,8 @@ + /* classlist[0] contains class file list + * classlist[1] contains non-class file list + */ +- @SuppressWarnings("unchecked") +- private static Vector<String>[] classlist = new Vector<String>[2]; ++ @SuppressWarnings({ "unchecked", "rawtypes" }) ++ private static Vector<String>[] classlist = new Vector[2]; + + /* The 2 class list name passed as arguments. */ + private static String[] fileNamelist = new String[2];
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7090844-support_multi_offset_change_timezones.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,50 @@ +# HG changeset patch +# User peytoia +# Date 1316069726 -32400 +# Thu Sep 15 15:55:26 2011 +0900 +# Node ID 48eafb721da1c1412935dc629ff8e1bd311c4be7 +# Parent d17cd240b3848fb1e831a58b36fc0ecba6b0cb3a +7090844, PR2298: Support a timezone whose offset is changed more than once in the future +Reviewed-by: okutsu + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Mappings.java openjdk/jdk/make/tools/src/build/tools/javazic/Mappings.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Mappings.java 2015-07-22 02:43:26.831650496 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Mappings.java 2015-07-22 02:45:35.313410942 +0100 +@@ -72,17 +72,20 @@ + Zone zone = zones.get(zoneName); + String zonename = zone.getName(); + int rawOffset = zone.get(zone.size()-1).getGmtOffset(); ++ + // If the GMT offset of this Zone will change in some + // future time, this Zone is added to the exclude list. +- if (zone.size() > 1) { +- ZoneRec zrec = zone.get(zone.size()-2); ++ boolean isExcluded = false; ++ for (int i = 0; i < zone.size(); i++) { ++ ZoneRec zrec = zone.get(i); + if ((zrec.getGmtOffset() != rawOffset) + && (zrec.getUntilTime(0) > Time.getCurrentTime())) { + if (excludeList == null) { + excludeList = new ArrayList<String>(); + } + excludeList.add(zone.getName()); +- continue; ++ isExcluded = true; ++ break; + } + } + +@@ -98,9 +101,11 @@ + rawOffsetsIndex.add(i, rawOffset); + + Set<String> perRawOffset = new TreeSet<String>(); +- perRawOffset.add(zonename); ++ if (!isExcluded) { ++ perRawOffset.add(zonename); ++ } + rawOffsetsIndexTable.add(i, perRawOffset); +- } else { ++ } else if (!isExcluded) { + int i = rawOffsetsIndex.indexOf(new Integer(rawOffset)); + Set<String> perRawOffset = rawOffsetsIndexTable.get(i); + perRawOffset.add(zonename);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7094377-ldaps_timeout.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,162 @@ +# HG changeset patch +# User vinnie +# Date 1317993113 -3600 +# Fri Oct 07 14:11:53 2011 +0100 +# Node ID dd2689b97d969e8b49ee3aedfd5e5805bb55cc2f +# Parent 35de232af8bea2529b0744e899e14ac9e474429a +7094377, PR2479: Com.sun.jndi.ldap.read.timeout doesn't work with ldaps. +Reviewed-by: chegar + +diff -r 35de232af8be -r dd2689b97d96 src/share/classes/com/sun/jndi/ldap/Connection.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Mon Sep 05 11:22:27 2011 +0800 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri Oct 07 14:11:53 2011 +0100 +@@ -32,6 +32,7 @@ + import java.io.OutputStream; + import java.io.InputStream; + import java.net.Socket; ++import javax.net.ssl.SSLSocket; + + import javax.naming.CommunicationException; + import javax.naming.ServiceUnavailableException; +@@ -366,6 +367,19 @@ + } + } + ++ // For LDAP connect timeouts on LDAP over SSL connections must treat ++ // the SSL handshake following socket connection as part of the timeout. ++ // So explicitly set a socket read timeout, trigger the SSL handshake, ++ // then reset the timeout. ++ if (connectTimeout > 0 && socket instanceof SSLSocket) { ++ SSLSocket sslSocket = (SSLSocket) socket; ++ int socketTimeout = sslSocket.getSoTimeout(); ++ ++ sslSocket.setSoTimeout(connectTimeout); // reuse full timeout value ++ sslSocket.startHandshake(); ++ sslSocket.setSoTimeout(socketTimeout); ++ } ++ + return socket; + } + +diff -r 35de232af8be -r dd2689b97d96 test/com/sun/jndi/ldap/LdapsReadTimeoutTest.java +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapsReadTimeoutTest.java Fri Oct 07 14:11:53 2011 +0100 +@@ -0,0 +1,118 @@ ++/* ++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++/** ++ * @test ++ * @bug 7094377 ++ * @summary Com.sun.jndi.ldap.read.timeout doesn't work with ldaps. ++ */ ++ ++import java.net.Socket; ++import java.net.ServerSocket; ++import java.io.*; ++import javax.naming.*; ++import javax.naming.directory.*; ++import java.util.Hashtable; ++ ++public class LdapsReadTimeoutTest { ++ ++ public static void main(String[] args) throws Exception { ++ boolean passed = false; ++ ++ // create the server ++ try (Server server = Server.create()) { ++ // Set up the environment for creating the initial context ++ Hashtable<String,Object> env = new Hashtable<>(11); ++ env.put(Context.INITIAL_CONTEXT_FACTORY, ++ "com.sun.jndi.ldap.LdapCtxFactory"); ++ env.put("com.sun.jndi.ldap.connect.timeout", "1000"); ++ env.put("com.sun.jndi.ldap.read.timeout", "1000"); ++ env.put(Context.PROVIDER_URL, "ldaps://localhost:" + server.port()); ++ ++ ++ // Create initial context ++ DirContext ctx = new InitialDirContext(env); ++ try { ++ System.out.println("LDAP Client: Connected to the Server"); ++ ++ SearchControls scl = new SearchControls(); ++ scl.setSearchScope(SearchControls.SUBTREE_SCOPE); ++ System.out.println("Performing Search"); ++ NamingEnumeration<SearchResult> answer = ++ ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); ++ } finally { ++ // Close the context when we're done ++ ctx.close(); ++ } ++ } catch (NamingException e) { ++ passed = true; ++ e.printStackTrace(); ++ } ++ ++ if (!passed) { ++ throw new Exception("Read timeout test failed," + ++ " read timeout exception not thrown"); ++ } ++ System.out.println("The test PASSED"); ++ } ++ ++ static class Server implements Runnable, Closeable { ++ private final ServerSocket ss; ++ private Socket sref; ++ ++ private Server(ServerSocket ss) { ++ this.ss = ss; ++ } ++ ++ static Server create() throws IOException { ++ Server server = new Server(new ServerSocket(0)); ++ new Thread(server).start(); ++ return server; ++ } ++ ++ int port() { ++ return ss.getLocalPort(); ++ } ++ ++ public void run() { ++ try (Socket s = ss.accept()) { ++ sref = s; ++ System.out.println("Server: Connection accepted"); ++ BufferedInputStream bis = ++ new BufferedInputStream(s.getInputStream()); ++ byte[] buf = new byte[100]; ++ int n; ++ do { ++ n = bis.read(buf); ++ } while (n > 0); ++ } catch (IOException e) { ++ // ignore ++ } ++ } ++ ++ public void close() throws IOException { ++ ss.close(); ++ sref.close(); ++ } ++ } ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7133138-timezone_io_improvement.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,205 @@ +# HG changeset patch +# User coffeys +# Date 1331819128 0 +# Thu Mar 15 13:45:28 2012 +0000 +# Node ID 11c1617c57bf122d8467fdea12f779725165ba2f +# Parent cb04b01f447a6759b454836d3869b0602b305612 +7133138, PR2298: Improve io performance around timezone lookups +Reviewed-by: okutsu + +diff -Nru openjdk.orig/jdk/make/tools/src/build/tools/javazic/Mappings.java openjdk/jdk/make/tools/src/build/tools/javazic/Mappings.java +--- openjdk.orig/jdk/make/tools/src/build/tools/javazic/Mappings.java 2015-07-22 02:47:07.639801608 +0100 ++++ openjdk/jdk/make/tools/src/build/tools/javazic/Mappings.java 2015-07-22 02:47:47.703103268 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -26,6 +26,7 @@ + package build.tools.javazic; + + import java.util.ArrayList; ++import java.util.HashMap; + import java.util.LinkedList; + import java.util.List; + import java.util.Map; +@@ -162,6 +163,20 @@ + for (String key : toBeRemoved) { + aliases.remove(key); + } ++ // Eliminate any alias-to-alias mappings. For example, if ++ // there are A->B and B->C, A->B is changed to A->C. ++ Map<String, String> newMap = new HashMap<String, String>(); ++ for (String key : aliases.keySet()) { ++ String realid = aliases.get(key); ++ String leaf = realid; ++ while (aliases.get(leaf) != null) { ++ leaf = aliases.get(leaf); ++ } ++ if (!realid.equals(leaf)) { ++ newMap.put(key, leaf); ++ } ++ } ++ aliases.putAll(newMap); + } + + Map<String,String> getAliases() { +diff -Nru openjdk.orig/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java +--- openjdk.orig/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2015-07-22 02:47:03.783868821 +0100 ++++ openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2015-07-22 02:49:30.453312238 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2012, 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 +@@ -474,6 +474,7 @@ + public static final byte TAG_ExcludedZones = 69; + + private static Map<String, ZoneInfo> zoneInfoObjects = null; ++ private static final ZoneInfo GMT = new ZoneInfo("GMT", 0); + + private static final String ziDir; + +@@ -589,8 +590,15 @@ + * id. + */ + public static ZoneInfo getZoneInfo(String id) { ++ //treat GMT zone as special ++ if ("GMT".equals(id)) ++ return (ZoneInfo) GMT.clone(); + ZoneInfo zi = getFromCache(id); + if (zi == null) { ++ Map<String, String> aliases = ZoneInfo.getCachedAliasTable(); ++ if (aliases != null && aliases.get(id) != null) { ++ return null; ++ } + zi = createZoneInfo(id); + if (zi == null) { + return null; +@@ -1067,30 +1075,26 @@ + * @return the buffer, or null if any I/O error occurred. + */ + private static byte[] readZoneInfoFile(final String fileName) { ++ if (fileName.indexOf("..") >= 0) { ++ return null; ++ } + byte[] buffer = null; + + try { + buffer = AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() { + public byte[] run() throws IOException { + File file = new File(ziDir, fileName); +- if (!file.exists() || !file.isFile()) { +- return null; +- } +- file = file.getCanonicalFile(); +- String path = file.getCanonicalPath(); + byte[] buf = null; +- if (path != null && path.startsWith(ziDir)) { +- int filesize = (int)file.length(); +- if (filesize > 0) { +- FileInputStream fis = new FileInputStream(file); +- buf = new byte[filesize]; +- try { +- if (fis.read(buf) != filesize) { +- throw new IOException("read error on " + fileName); +- } +- } finally { +- fis.close(); ++ int filesize = (int)file.length(); ++ if (filesize > 0) { ++ FileInputStream fis = new FileInputStream(file); ++ buf = new byte[filesize]; ++ try { ++ if (fis.read(buf) != filesize) { ++ throw new IOException("read error on " + fileName); + } ++ } finally { ++ fis.close(); + } + } + return buf; +diff -Nru openjdk.orig/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java +--- openjdk.orig/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java 2015-07-22 02:48:02.190850734 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2012, 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 +@@ -80,13 +80,18 @@ + private static final int TRANSITION_NSHIFT = 12; + + // Flag for supporting JDK backward compatible IDs, such as "EST". +- private static final boolean USE_OLDMAPPING; ++ static final boolean USE_OLDMAPPING; + static { + String oldmapping = AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("sun.timezone.ids.oldmapping", "false")).toLowerCase(Locale.ROOT); + USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true")); + } + ++ // IDs having conflicting data between Olson and JDK 1.1 ++ static final String[] conflictingIDs = { ++ "EST", "MST", "HST" ++ }; ++ + private static final CalendarSystem gcal = CalendarSystem.getGregorianCalendar(); + + /** +@@ -771,7 +776,17 @@ + return (checksum == ((ZoneInfo)other).checksum); + } + +- private static SoftReference<Map> aliasTable; ++ private static SoftReference<Map<String, String>> aliasTable; ++ ++ static Map<String, String> getCachedAliasTable() { ++ Map<String, String> aliases = null; ++ ++ SoftReference<Map<String, String>> cache = aliasTable; ++ if (cache != null) { ++ aliases = cache.get(); ++ } ++ return aliases; ++ } + + /** + * Returns a Map from alias time zone IDs to their standard +@@ -782,20 +797,19 @@ + * <code>ZoneInfoMappings</code> file is not available. + */ + public synchronized static Map<String, String> getAliasTable() { +- Map<String, String> aliases = null; +- +- SoftReference<Map> cache = aliasTable; +- if (cache != null) { +- aliases = cache.get(); ++ Map<String, String> aliases = getCachedAliasTable(); ++ if (aliases == null) { ++ aliases = ZoneInfoFile.getZoneAliases(); + if (aliases != null) { +- return aliases; ++ if (!USE_OLDMAPPING) { ++ // Remove the conflicting IDs from the alias table. ++ for (String key : conflictingIDs) { ++ aliases.remove(key); ++ } ++ } ++ aliasTable = new SoftReference<Map<String, String>>(aliases); + } + } +- +- aliases = ZoneInfoFile.getZoneAliases(); +- if (aliases != null) { +- aliasTable = new SoftReference<Map>(aliases); +- } + return aliases; + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7170638-systemtap.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,292 @@ +# HG changeset patch +# User coleenp +# Date 1349702334 14400 +# Mon Oct 08 09:18:54 2012 -0400 +# Node ID c707a5af0d71958eb3f4e9512c7d3a71c06450e0 +# Parent 9e00e448460e8bf3a4c0b7a7894c073907997c1e +7170638, PR2495: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field. +Summary: Don't use HS_DTRACE_PROBE_CDECL_N and HS_DTRACE_PROBE_N directly. +Reviewed-by: coleenp, kamg, dholmes, sspitsyn +Contributed-by: Mark Wielaard <mjw@redhat.com> + +diff -Nru openjdk.orig/hotspot/make/bsd/makefiles/buildtree.make openjdk/hotspot/make/bsd/makefiles/buildtree.make +--- openjdk.orig/hotspot/make/bsd/makefiles/buildtree.make 2015-04-09 02:20:24.000000000 +0100 ++++ openjdk/hotspot/make/bsd/makefiles/buildtree.make 2015-07-22 03:46:03.362170724 +0100 +@@ -162,6 +162,13 @@ + endif + endif + ++# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK ++ifndef OPENJDK ++ ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) ++ OPENJDK=true ++ endif ++endif ++ + BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) + + BUILDTREE = \ +@@ -204,6 +211,7 @@ + echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ + echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ + echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ ++ echo "OPENJDK = $(OPENJDK)"; \ + echo; \ + echo "# Used for platform dispatching"; \ + echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/buildtree.make openjdk/hotspot/make/linux/makefiles/buildtree.make +--- openjdk.orig/hotspot/make/linux/makefiles/buildtree.make 2015-07-22 03:45:38.710600424 +0100 ++++ openjdk/hotspot/make/linux/makefiles/buildtree.make 2015-07-22 03:46:19.929881934 +0100 +@@ -155,6 +155,13 @@ + endif + endif + ++# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK ++ifndef OPENJDK ++ ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) ++ OPENJDK=true ++ endif ++endif ++ + BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) + + BUILDTREE = \ +@@ -197,6 +204,7 @@ + echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ + echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ + echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ ++ echo "OPENJDK = $(OPENJDK)"; \ + echo "DERIVATIVE_ID = $(DERIVATIVE_ID)"; \ + echo "DISTRIBUTION_ID = $(DISTRIBUTION_ID)"; \ + echo; \ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/dtrace.make openjdk/hotspot/make/linux/makefiles/dtrace.make +--- openjdk.orig/hotspot/make/linux/makefiles/dtrace.make 2015-04-09 02:20:11.000000000 +0100 ++++ openjdk/hotspot/make/linux/makefiles/dtrace.make 2015-07-22 03:46:03.362170724 +0100 +@@ -1,5 +1,6 @@ + # +-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2012 Red Hat, Inc. + # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + # + # This code is free software; you can redistribute it and/or modify it +@@ -25,3 +26,40 @@ + # Linux does not build jvm_db + LIBJVM_DB = + ++# Only OPENJDK builds test and support SDT probes currently. ++ifndef OPENJDK ++REASON = "This JDK does not support SDT probes" ++else ++ ++# We need a recent GCC for the default ++ifeq "$(shell expr \( $(CC_VER_MAJOR) \>= 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) )" "0" ++REASON = "gcc version is too old" ++else ++ ++# But it does have a SystemTap dtrace compatible sys/sdt.h ++ifneq ($(ALT_SDT_H),) ++ SDT_H_FILE = $(ALT_SDT_H) ++else ++ SDT_H_FILE = /usr/include/sys/sdt.h ++endif ++DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE)) ++REASON = "$(SDT_H_FILE) not found" ++ ++ifneq ($(DTRACE_ENABLED),) ++ CFLAGS += -DDTRACE_ENABLED ++endif ++ ++endif ++endif ++ ++# Phony target used in vm.make build target to check whether enabled. ++.PHONY: dtraceCheck ++ifeq ($(DTRACE_ENABLED),) ++dtraceCheck: ++ $(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)" ++else ++dtraceCheck: ++endif ++ ++# It doesn't support HAVE_DTRACE_H though. ++ +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/vm.make openjdk/hotspot/make/linux/makefiles/vm.make +--- openjdk.orig/hotspot/make/linux/makefiles/vm.make 2015-07-22 03:45:38.714600354 +0100 ++++ openjdk/hotspot/make/linux/makefiles/vm.make 2015-07-22 03:46:42.457489257 +0100 +@@ -394,7 +394,7 @@ + + #---------------------------------------------------------------------- + +-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) ++build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck + + install: install_jvm install_jsig install_saproc + +diff -Nru openjdk.orig/hotspot/make/solaris/makefiles/buildtree.make openjdk/hotspot/make/solaris/makefiles/buildtree.make +--- openjdk.orig/hotspot/make/solaris/makefiles/buildtree.make 2015-04-09 02:20:13.000000000 +0100 ++++ openjdk/hotspot/make/solaris/makefiles/buildtree.make 2015-07-22 03:46:03.362170724 +0100 +@@ -147,6 +147,13 @@ + endif + endif + ++# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK ++ifndef OPENJDK ++ ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) ++ OPENJDK=true ++ endif ++endif ++ + BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) + + BUILDTREE = \ +@@ -189,6 +196,7 @@ + echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \ + echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ + echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ ++ echo "OPENJDK = $(OPENJDK)"; \ + echo "$(LP64_SETTING/$(DATA_MODE))"; \ + echo; \ + echo "# Used for platform dispatching"; \ +diff -Nru openjdk.orig/hotspot/src/share/vm/prims/jni.cpp openjdk/hotspot/src/share/vm/prims/jni.cpp +--- openjdk.orig/hotspot/src/share/vm/prims/jni.cpp 2015-04-09 02:20:26.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/prims/jni.cpp 2015-07-22 03:46:03.366170655 +0100 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2012 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -2819,10 +2820,9 @@ + JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \ + JNIWrapper("Set" XSTR(Result) "Field"); \ + \ +- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \ +- ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ +- HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \ +- ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ ++ FP_SELECT_##Result( \ ++ DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value), \ ++ DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \ + \ + oop o = JNIHandles::resolve_non_null(obj); \ + klassOop k = o->klass(); \ +@@ -3129,10 +3129,9 @@ + \ + JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \ + JNIWrapper("SetStatic" XSTR(Result) "Field"); \ +- HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\ +- ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ +- HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \ +- ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \ ++ FP_SELECT_##Result( \ ++ DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value), \ ++ DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \ + \ + JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \ + assert(id->is_static_field_id(), "invalid static field id"); \ +diff -Nru openjdk.orig/hotspot/src/share/vm/utilities/dtrace.hpp openjdk/hotspot/src/share/vm/utilities/dtrace.hpp +--- openjdk.orig/hotspot/src/share/vm/utilities/dtrace.hpp 2015-04-09 02:20:21.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/utilities/dtrace.hpp 2015-07-22 03:46:03.366170655 +0100 +@@ -1,5 +1,6 @@ + /* +- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2009, 2012 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -32,13 +33,17 @@ + #define DTRACE_ONLY(x) x + #define NOT_DTRACE(x) + ++#if defined(SOLARIS) + // Work around dtrace tail call bug 6672627 until it is fixed in solaris 10. + #define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() \ + do { volatile size_t dtrace_workaround_tail_call_bug = 1; } while (0) + +-#if defined(SOLARIS) ++#define USDT1 1 ++#elif defined(LINUX) ++#define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() + #define USDT1 1 + #elif defined(__APPLE__) ++#define HS_DTRACE_WORKAROUND_TAIL_CALL_BUG() + #define USDT2 1 + #include <sys/types.h> + #include "dtracefiles/hotspot.h" +@@ -63,6 +68,11 @@ + #define DTRACE_PROBE3(a,b,c,d,e) {;} + #define DTRACE_PROBE4(a,b,c,d,e,f) {;} + #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;} ++#define DTRACE_PROBE6(a,b,c,d,e,f,g,h) {;} ++#define DTRACE_PROBE7(a,b,c,d,e,f,g,h,i) {;} ++#define DTRACE_PROBE8(a,b,c,d,e,f,g,h,i,j) {;} ++#define DTRACE_PROBE9(a,b,c,d,e,f,g,h,i,j,k) {;} ++#define DTRACE_PROBE10(a,b,c,d,e,f,g,h,i,j,k,l) {;} + + #else /* USDT2 */ + +@@ -76,10 +86,18 @@ + #define HS_DTRACE_PROBE_FN(provider,name)\ + __dtrace_##provider##___##name + ++#ifdef SOLARIS ++// Solaris dtrace needs actual extern function decls. + #define HS_DTRACE_PROBE_DECL_N(provider,name,args) \ + DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args) + #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \ + DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args) ++#else ++// Systemtap dtrace compatible probes on GNU/Linux don't. ++// If dtrace is disabled this macro becomes NULL ++#define HS_DTRACE_PROBE_DECL_N(provider,name,args) ++#define HS_DTRACE_PROBE_CDECL_N(provider,name,args) ++#endif + + /* Dtrace probe declarations */ + #define HS_DTRACE_PROBE_DECL(provider,name) \ +@@ -118,6 +136,8 @@ + uintptr_t,uintptr_t,uintptr_t)) + + /* Dtrace probe definitions */ ++#if defined(SOLARIS) ++// Solaris dtrace uses actual function calls. + #define HS_DTRACE_PROBE_N(provider,name, args) \ + DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args) + +@@ -153,6 +173,33 @@ + HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\ + (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\ + (uintptr_t)a8,(uintptr_t)a9)) ++#else ++// Systemtap dtrace compatible probes on GNU/Linux use direct macros. ++// If dtrace is disabled this macro becomes NULL ++#define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name) ++#define HS_DTRACE_PROBE0(provider,name)\ ++ DTRACE_PROBE(provider,name) ++#define HS_DTRACE_PROBE1(provider,name,a0)\ ++ DTRACE_PROBE1(provider,name,a0) ++#define HS_DTRACE_PROBE2(provider,name,a0,a1)\ ++ DTRACE_PROBE2(provider,name,a0,a1) ++#define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\ ++ DTRACE_PROBE3(provider,name,a0,a1,a2) ++#define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\ ++ DTRACE_PROBE4(provider,name,a0,a1,a2,a3) ++#define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\ ++ DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4) ++#define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\ ++ DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5) ++#define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\ ++ DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6) ++#define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\ ++ DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7) ++#define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\ ++ DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8) ++#define HS_DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9)\ ++ DTRACE_PROBE10(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9) ++#endif + + #endif /* !USDT2 */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8000487-jndi_connection_not_honouring_timeout.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,720 @@ +# HG changeset patch +# User robm +# Date 1350655502 -3600 +# Fri Oct 19 15:05:02 2012 +0100 +# Node ID 58522e691f9dd9ecc908a6e81726c78b45ca222e +# Parent eb23e6bd0d714439e64a99b7c2863d31b974e615 +8000487, PR2479: Java JNDI connection library on ldap conn is not honoring configured timeout +Reviewed-by: vinnie + +diff -r eb23e6bd0d71 -r 58522e691f9d src/share/classes/com/sun/jndi/ldap/Connection.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Thu Apr 12 10:43:04 2012 -0700 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri Oct 19 15:05:02 2012 +0100 +@@ -157,7 +157,8 @@ + volatile IOException closureReason = null; + volatile boolean useable = true; // is Connection still useable + +- private int readTimeout; ++ int readTimeout; ++ int connectTimeout; + + // true means v3; false means v2 + // Called in LdapClient.authenticate() (which is synchronized) +@@ -187,6 +188,7 @@ + this.port = port; + this.parent = parent; + this.readTimeout = readTimeout; ++ this.connectTimeout = connectTimeout; + + if (trace != null) { + traceFile = trace; +diff -r eb23e6bd0d71 -r 58522e691f9d src/share/classes/com/sun/jndi/ldap/LdapClient.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java Thu Apr 12 10:43:04 2012 -0700 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java Fri Oct 19 15:05:02 2012 +0100 +@@ -149,149 +149,155 @@ + String authMechanism, Control[] ctls, Hashtable env) + throws NamingException { + +- authenticateCalled = true; ++ int readTimeout = conn.readTimeout; ++ conn.readTimeout = conn.connectTimeout; ++ LdapResult res = null; + + try { +- ensureOpen(); +- } catch (IOException e) { +- NamingException ne = new CommunicationException(); +- ne.setRootCause(e); +- throw ne; +- } ++ authenticateCalled = true; + +- switch (version) { +- case LDAP_VERSION3_VERSION2: +- case LDAP_VERSION3: +- isLdapv3 = true; +- break; +- case LDAP_VERSION2: +- isLdapv3 = false; +- break; +- default: +- throw new CommunicationException("Protocol version " + version + +- " not supported"); +- } ++ try { ++ ensureOpen(); ++ } catch (IOException e) { ++ NamingException ne = new CommunicationException(); ++ ne.setRootCause(e); ++ throw ne; ++ } + +- LdapResult res = null; ++ switch (version) { ++ case LDAP_VERSION3_VERSION2: ++ case LDAP_VERSION3: ++ isLdapv3 = true; ++ break; ++ case LDAP_VERSION2: ++ isLdapv3 = false; ++ break; ++ default: ++ throw new CommunicationException("Protocol version " + version + ++ " not supported"); ++ } + +- if (authMechanism.equalsIgnoreCase("none") || +- authMechanism.equalsIgnoreCase("anonymous")) { ++ if (authMechanism.equalsIgnoreCase("none") || ++ authMechanism.equalsIgnoreCase("anonymous")) { + +- // Perform LDAP bind if we are reauthenticating, using LDAPv2, +- // supporting failover to LDAPv2, or controls have been supplied. +- if (!initial || +- (version == LDAP_VERSION2) || +- (version == LDAP_VERSION3_VERSION2) || +- ((ctls != null) && (ctls.length > 0))) { ++ // Perform LDAP bind if we are reauthenticating, using LDAPv2, ++ // supporting failover to LDAPv2, or controls have been supplied. ++ if (!initial || ++ (version == LDAP_VERSION2) || ++ (version == LDAP_VERSION3_VERSION2) || ++ ((ctls != null) && (ctls.length > 0))) { ++ try { ++ // anonymous bind; update name/pw for LDAPv2 retry ++ res = ldapBind(name=null, (byte[])(pw=null), ctls, null, ++ false); ++ if (res.status == LdapClient.LDAP_SUCCESS) { ++ conn.setBound(); ++ } ++ } catch (IOException e) { ++ NamingException ne = ++ new CommunicationException("anonymous bind failed: " + ++ conn.host + ":" + conn.port); ++ ne.setRootCause(e); ++ throw ne; ++ } ++ } else { ++ // Skip LDAP bind for LDAPv3 anonymous bind ++ res = new LdapResult(); ++ res.status = LdapClient.LDAP_SUCCESS; ++ } ++ } else if (authMechanism.equalsIgnoreCase("simple")) { ++ // simple authentication ++ byte[] encodedPw = null; + try { +- // anonymous bind; update name/pw for LDAPv2 retry +- res = ldapBind(name=null, (byte[])(pw=null), ctls, null, +- false); ++ encodedPw = encodePassword(pw, isLdapv3); ++ res = ldapBind(name, encodedPw, ctls, null, false); + if (res.status == LdapClient.LDAP_SUCCESS) { + conn.setBound(); + } + } catch (IOException e) { + NamingException ne = +- new CommunicationException("anonymous bind failed: " + ++ new CommunicationException("simple bind failed: " + ++ conn.host + ":" + conn.port); ++ ne.setRootCause(e); ++ throw ne; ++ } finally { ++ // If pw was copied to a new array, clear that array as ++ // a security precaution. ++ if (encodedPw != pw && encodedPw != null) { ++ for (int i = 0; i < encodedPw.length; i++) { ++ encodedPw[i] = 0; ++ } ++ } ++ } ++ } else if (isLdapv3) { ++ // SASL authentication ++ try { ++ res = LdapSasl.saslBind(this, conn, conn.host, name, pw, ++ authMechanism, env, ctls); ++ if (res.status == LdapClient.LDAP_SUCCESS) { ++ conn.setBound(); ++ } ++ } catch (IOException e) { ++ NamingException ne = ++ new CommunicationException("SASL bind failed: " + + conn.host + ":" + conn.port); + ne.setRootCause(e); + throw ne; + } + } else { +- // Skip LDAP bind for LDAPv3 anonymous bind +- res = new LdapResult(); +- res.status = LdapClient.LDAP_SUCCESS; ++ throw new AuthenticationNotSupportedException(authMechanism); + } +- } else if (authMechanism.equalsIgnoreCase("simple")) { +- // simple authentication +- byte[] encodedPw = null; +- try { +- encodedPw = encodePassword(pw, isLdapv3); +- res = ldapBind(name, encodedPw, ctls, null, false); +- if (res.status == LdapClient.LDAP_SUCCESS) { +- conn.setBound(); +- } +- } catch (IOException e) { +- NamingException ne = +- new CommunicationException("simple bind failed: " + +- conn.host + ":" + conn.port); +- ne.setRootCause(e); +- throw ne; +- } finally { +- // If pw was copied to a new array, clear that array as +- // a security precaution. +- if (encodedPw != pw && encodedPw != null) { +- for (int i = 0; i < encodedPw.length; i++) { +- encodedPw[i] = 0; ++ ++ // ++ // re-try login using v2 if failing over ++ // ++ if (initial && ++ (res.status == LdapClient.LDAP_PROTOCOL_ERROR) && ++ (version == LdapClient.LDAP_VERSION3_VERSION2) && ++ (authMechanism.equalsIgnoreCase("none") || ++ authMechanism.equalsIgnoreCase("anonymous") || ++ authMechanism.equalsIgnoreCase("simple"))) { ++ ++ byte[] encodedPw = null; ++ try { ++ isLdapv3 = false; ++ encodedPw = encodePassword(pw, false); ++ res = ldapBind(name, encodedPw, ctls, null, false); ++ if (res.status == LdapClient.LDAP_SUCCESS) { ++ conn.setBound(); ++ } ++ } catch (IOException e) { ++ NamingException ne = ++ new CommunicationException(authMechanism + ":" + ++ conn.host + ":" + conn.port); ++ ne.setRootCause(e); ++ throw ne; ++ } finally { ++ // If pw was copied to a new array, clear that array as ++ // a security precaution. ++ if (encodedPw != pw && encodedPw != null) { ++ for (int i = 0; i < encodedPw.length; i++) { ++ encodedPw[i] = 0; ++ } + } + } + } +- } else if (isLdapv3) { +- // SASL authentication +- try { +- res = LdapSasl.saslBind(this, conn, conn.host, name, pw, +- authMechanism, env, ctls); +- if (res.status == LdapClient.LDAP_SUCCESS) { +- conn.setBound(); +- } +- } catch (IOException e) { +- NamingException ne = +- new CommunicationException("SASL bind failed: " + +- conn.host + ":" + conn.port); +- ne.setRootCause(e); +- throw ne; ++ ++ // principal name not found ++ // (map NameNotFoundException to AuthenticationException) ++ // %%% This is a workaround for Netscape servers returning ++ // %%% no such object when the principal name is not found ++ // %%% Note that when this workaround is applied, it does not allow ++ // %%% response controls to be recorded by the calling context ++ if (res.status == LdapClient.LDAP_NO_SUCH_OBJECT) { ++ throw new AuthenticationException( ++ getErrorMessage(res.status, res.errorMessage)); + } +- } else { +- throw new AuthenticationNotSupportedException(authMechanism); ++ conn.setV3(isLdapv3); ++ return res; ++ } finally { ++ conn.readTimeout = readTimeout; + } +- +- // +- // re-try login using v2 if failing over +- // +- if (initial && +- (res.status == LdapClient.LDAP_PROTOCOL_ERROR) && +- (version == LdapClient.LDAP_VERSION3_VERSION2) && +- (authMechanism.equalsIgnoreCase("none") || +- authMechanism.equalsIgnoreCase("anonymous") || +- authMechanism.equalsIgnoreCase("simple"))) { +- +- byte[] encodedPw = null; +- try { +- isLdapv3 = false; +- encodedPw = encodePassword(pw, false); +- res = ldapBind(name, encodedPw, ctls, null, false); +- if (res.status == LdapClient.LDAP_SUCCESS) { +- conn.setBound(); +- } +- } catch (IOException e) { +- NamingException ne = +- new CommunicationException(authMechanism + ":" + +- conn.host + ":" + conn.port); +- ne.setRootCause(e); +- throw ne; +- } finally { +- // If pw was copied to a new array, clear that array as +- // a security precaution. +- if (encodedPw != pw && encodedPw != null) { +- for (int i = 0; i < encodedPw.length; i++) { +- encodedPw[i] = 0; +- } +- } +- } +- } +- +- // principal name not found +- // (map NameNotFoundException to AuthenticationException) +- // %%% This is a workaround for Netscape servers returning +- // %%% no such object when the principal name is not found +- // %%% Note that when this workaround is applied, it does not allow +- // %%% response controls to be recorded by the calling context +- if (res.status == LdapClient.LDAP_NO_SUCH_OBJECT) { +- throw new AuthenticationException( +- getErrorMessage(res.status, res.errorMessage)); +- } +- conn.setV3(isLdapv3); +- return res; + } + + /** +diff -r eb23e6bd0d71 -r 58522e691f9d test/com/sun/jndi/ldap/LdapTimeoutTest.java +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri Oct 19 15:05:02 2012 +0100 +@@ -0,0 +1,177 @@ ++/* ++ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++/** ++ * @test ++ * @bug 7094377 8000487 6176036 7056489 ++ * @summary Timeout tests for ldap ++ */ ++ ++import java.net.Socket; ++import java.net.ServerSocket; ++import java.net.SocketTimeoutException; ++import java.io.*; ++import javax.naming.*; ++import javax.naming.directory.*; ++import java.util.Hashtable; ++import java.util.concurrent.Callable; ++import java.util.concurrent.Executors; ++import java.util.concurrent.ScheduledExecutorService; ++import java.util.concurrent.ScheduledFuture; ++import java.util.concurrent.TimeUnit; ++ ++public class LdapTimeoutTest { ++ private static final ScheduledExecutorService pool = ++ Executors.newScheduledThreadPool(1); ++ static volatile int passed = 0, failed = 0; ++ static void pass() {passed++;} ++ static void fail() {failed++; Thread.dumpStack();} ++ ++ public static void main(String[] args) throws Exception { ++ ServerSocket serverSock = new ServerSocket(0); ++ Server s = new Server(serverSock); ++ s.start(); ++ Thread.sleep(200); ++ ++ Hashtable env = new Hashtable(11); ++ env.put(Context.INITIAL_CONTEXT_FACTORY, ++ "com.sun.jndi.ldap.LdapCtxFactory"); ++ env.put(Context.PROVIDER_URL, "ldap://localhost:" + ++ serverSock.getLocalPort()); ++ ++ env.put(Context.SECURITY_AUTHENTICATION,"simple"); ++ ++ env.put(Context.SECURITY_PRINCIPAL, "user"); ++ env.put(Context.SECURITY_CREDENTIALS, "password"); ++ ++ env.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ env.put("com.sun.jndi.ldap.read.timeout", "3000"); ++ ++ InitialContext ctx = null; ++ try { ++ new LdapTimeoutTest().ldapReadTimeoutTest(env, false); ++ new LdapTimeoutTest().ldapReadTimeoutTest(env, true); ++ new LdapTimeoutTest().simpleAuthConnectTest(env); ++ } finally { ++ s.interrupt(); ++ LdapTimeoutTest.pool.shutdown(); ++ } ++ ++ System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); ++ if (failed > 0) throw new AssertionError("Some tests failed"); ++ } ++ ++ void ldapReadTimeoutTest(Hashtable env, boolean ssl) { ++ InitialContext ctx = null; ++ if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl"); ++ ScheduledFuture killer = killSwitch(); ++ long start = System.nanoTime(); ++ try { ++ ctx = new InitialDirContext(env); ++ SearchControls scl = new SearchControls(); ++ scl.setSearchScope(SearchControls.SUBTREE_SCOPE); ++ NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx) ++ .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); ++ // shouldn't reach here ++ fail(); ++ } catch (NamingException e) { ++ if (ssl) { ++ if (e.getCause() instanceof SocketTimeoutException) { ++ pass(); ++ } else if (e.getCause() instanceof InterruptedIOException) { ++ Thread.interrupted(); ++ fail(); ++ } ++ } else { ++ pass(); ++ } ++ } finally { ++ if (!shutItDown(killer, ctx)) fail(); ++ } ++ } ++ ++ void simpleAuthConnectTest(Hashtable env) { ++ InitialContext ctx = null; ++ ScheduledFuture killer = killSwitch(); ++ long start = System.nanoTime(); ++ try { ++ ctx = new InitialDirContext(env); ++ // shouldn't reach here ++ System.err.println("Fail: InitialDirContext succeeded"); ++ fail(); ++ } catch (NamingException e) { ++ long end = System.nanoTime(); ++ if (e.getCause() instanceof SocketTimeoutException) { ++ if (TimeUnit.NANOSECONDS.toMillis(end - start) < 2900) { ++ pass(); ++ } else { ++ System.err.println("Fail: Waited too long"); ++ fail(); ++ } ++ } else if (e.getCause() instanceof InterruptedIOException) { ++ Thread.interrupted(); ++ fail(); ++ } else { ++ fail(); ++ } ++ } finally { ++ if (!shutItDown(killer, ctx)) fail(); ++ } ++ } ++ ++ boolean shutItDown(ScheduledFuture killer, InitialContext ctx) { ++ killer.cancel(true); ++ try { ++ if (ctx != null) ctx.close(); ++ return true; ++ } catch (NamingException ex) { ++ return false; ++ } ++ } ++ ++ ScheduledFuture killSwitch() { ++ final Thread current = Thread.currentThread(); ++ return LdapTimeoutTest.pool.schedule(new Callable<Void>() { ++ public Void call() throws Exception { ++ System.err.println("Fail: killSwitch()"); ++ current.interrupt(); ++ return null; ++ } ++ }, 5000, TimeUnit.MILLISECONDS); ++ } ++ ++ static class Server extends Thread { ++ final ServerSocket serverSock; ++ ++ Server(ServerSocket serverSock) { ++ this.serverSock = serverSock; ++ } ++ ++ public void run() { ++ try { ++ Socket socket = serverSock.accept(); ++ } catch (IOException e) {} ++ } ++ } ++} ++ +diff -r eb23e6bd0d71 -r 58522e691f9d test/com/sun/jndi/ldap/LdapsReadTimeoutTest.java +--- openjdk/jdk/test/com/sun/jndi/ldap/LdapsReadTimeoutTest.java Thu Apr 12 10:43:04 2012 -0700 ++++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +@@ -1,118 +0,0 @@ +-/* +- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- */ +- +-/** +- * @test +- * @bug 7094377 +- * @summary Com.sun.jndi.ldap.read.timeout doesn't work with ldaps. +- */ +- +-import java.net.Socket; +-import java.net.ServerSocket; +-import java.io.*; +-import javax.naming.*; +-import javax.naming.directory.*; +-import java.util.Hashtable; +- +-public class LdapsReadTimeoutTest { +- +- public static void main(String[] args) throws Exception { +- boolean passed = false; +- +- // create the server +- try (Server server = Server.create()) { +- // Set up the environment for creating the initial context +- Hashtable<String,Object> env = new Hashtable<>(11); +- env.put(Context.INITIAL_CONTEXT_FACTORY, +- "com.sun.jndi.ldap.LdapCtxFactory"); +- env.put("com.sun.jndi.ldap.connect.timeout", "1000"); +- env.put("com.sun.jndi.ldap.read.timeout", "1000"); +- env.put(Context.PROVIDER_URL, "ldaps://localhost:" + server.port()); +- +- +- // Create initial context +- DirContext ctx = new InitialDirContext(env); +- try { +- System.out.println("LDAP Client: Connected to the Server"); +- +- SearchControls scl = new SearchControls(); +- scl.setSearchScope(SearchControls.SUBTREE_SCOPE); +- System.out.println("Performing Search"); +- NamingEnumeration<SearchResult> answer = +- ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); +- } finally { +- // Close the context when we're done +- ctx.close(); +- } +- } catch (NamingException e) { +- passed = true; +- e.printStackTrace(); +- } +- +- if (!passed) { +- throw new Exception("Read timeout test failed," + +- " read timeout exception not thrown"); +- } +- System.out.println("The test PASSED"); +- } +- +- static class Server implements Runnable, Closeable { +- private final ServerSocket ss; +- private Socket sref; +- +- private Server(ServerSocket ss) { +- this.ss = ss; +- } +- +- static Server create() throws IOException { +- Server server = new Server(new ServerSocket(0)); +- new Thread(server).start(); +- return server; +- } +- +- int port() { +- return ss.getLocalPort(); +- } +- +- public void run() { +- try (Socket s = ss.accept()) { +- sref = s; +- System.out.println("Server: Connection accepted"); +- BufferedInputStream bis = +- new BufferedInputStream(s.getInputStream()); +- byte[] buf = new byte[100]; +- int n; +- do { +- n = bis.read(buf); +- } while (n > 0); +- } catch (IOException e) { +- // ignore +- } +- } +- +- public void close() throws IOException { +- ss.close(); +- sref.close(); +- } +- } +-} +diff -r eb23e6bd0d71 -r 58522e691f9d test/com/sun/jndi/ldap/ReadTimeoutTest.java +--- openjdk/jdk/test/com/sun/jndi/ldap/ReadTimeoutTest.java Thu Apr 12 10:43:04 2012 -0700 ++++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +@@ -1,104 +0,0 @@ +-/* +- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +- * or visit www.oracle.com if you need additional information or have any +- * questions. +- */ +- +-/** +- * @test +- * @bug 6176036 +- * @summary Read-timeout specification for LDAP operations +- */ +- +-import java.net.Socket; +-import java.net.ServerSocket; +-import java.io.*; +-import javax.naming.*; +-import javax.naming.directory.*; +-import java.util.Hashtable; +- +-public class ReadTimeoutTest { +- +- public static void main(String[] args) throws Exception { +- +- boolean passed = false; +- +- // Set up the environment for creating the initial context +- Hashtable env = new Hashtable(11); +- env.put(Context.INITIAL_CONTEXT_FACTORY, +- "com.sun.jndi.ldap.LdapCtxFactory"); +- env.put("com.sun.jndi.ldap.read.timeout", "1000"); +- env.put(Context.PROVIDER_URL, "ldap://localhost:2001"); +- +- Server s = new Server(); +- +- try { +- +- // start the server +- s.start(); +- +- // Create initial context +- DirContext ctx = new InitialDirContext(env); +- System.out.println("LDAP Client: Connected to the Server"); +- +- SearchControls scl = new SearchControls(); +- scl.setSearchScope(SearchControls.SUBTREE_SCOPE); +- System.out.println("Performing Search"); +- NamingEnumeration answer = +- ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); +- +- // Close the context when we're done +- ctx.close(); +- } catch (NamingException e) { +- passed = true; +- e.printStackTrace(); +- } +- s.interrupt(); +- if (!passed) { +- throw new Exception("Read timeout test failed," + +- " read timeout exception not thrown"); +- } +- System.out.println("The test PASSED"); +- } +- +- static class Server extends Thread { +- +- static int serverPort = 2001; +- +- Server() { +- } +- +- public void run() { +- try { +- ServerSocket serverSock = new ServerSocket(serverPort); +- Socket socket = serverSock.accept(); +- System.out.println("Server: Connection accepted"); +- +- BufferedInputStream bin = new BufferedInputStream(socket. +- getInputStream()); +- while (true) { +- bin.read(); +- } +- } catch (IOException e) { +- // ignore +- } +- } +-} +-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8011709-canonshaping_memory_leak.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,29 @@ +# HG changeset patch +# User jchen +# Date 1374694826 25200 +# Wed Jul 24 12:40:26 2013 -0700 +# Node ID db2e3a686cf3576f963238e4af224d8d950accde +# Parent 784589c7bc552e2530745a0427831538e86b806f +8011709, PR2510: [parfait] False positive: memory leak in jdk/src/share/native/sun/font/layout/CanonShaping.cpp +Reviewed-by: jgodinez, prr + +diff -r 784589c7bc55 -r db2e3a686cf3 src/share/native/sun/font/layout/CanonShaping.cpp +--- openjdk/jdk/src/share/native/sun/font/layout/CanonShaping.cpp Wed Jul 24 13:38:17 2013 +0400 ++++ openjdk/jdk/src/share/native/sun/font/layout/CanonShaping.cpp Wed Jul 24 12:40:26 2013 -0700 +@@ -66,6 +66,16 @@ + le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount); + le_int32 i; + ++ if (combiningClasses == NULL || indices == NULL) { ++ if (combiningClasses != NULL) { ++ LE_DELETE_ARRAY(combiningClasses); ++ } ++ if (indices != NULL) { ++ LE_DELETE_ARRAY(indices); ++ } ++ return; ++ } ++ + for (i = 0; i < charCount; i += 1) { + combiningClasses[i] = classTable->getGlyphClass(classTable, (LEGlyphID) inChars[i], success); + indices[i] = i;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8023052-jvm_crash_in_native_layout.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,23 @@ +# HG changeset patch +# User vadim +# Date 1377252818 -14400 +# Fri Aug 23 14:13:38 2013 +0400 +# Node ID 12ac08d79c9b72efb06873194caf26b4d5789854 +# Parent 0c950b2be7ab894d253c136d6dec07698dbb9c46 +8023052, PR2510: JVM crash in native layout +Reviewed-by: bae, prr + +diff -r 0c950b2be7ab -r 12ac08d79c9b src/share/native/sun/font/layout/SunLayoutEngine.cpp +--- openjdk/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp Mon Aug 19 11:21:19 2013 -0700 ++++ openjdk/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp Fri Aug 23 14:13:38 2013 +0400 +@@ -179,6 +179,10 @@ + FontInstanceAdapter fia(env, font2d, strike, mat, 72, 72, (le_int32) upem, (TTLayoutTableCache *) layoutTables); + LEErrorCode success = LE_NO_ERROR; + LayoutEngine *engine = LayoutEngine::layoutEngineFactory(&fia, script, lang, typo_flags & TYPO_MASK, success); ++ if (engine == NULL) { ++ env->SetIntField(gvdata, gvdCountFID, -1); // flag failure ++ return; ++ } + + if (min < 0) min = 0; if (max < min) max = min; /* defensive coding */ + // have to copy, yuck, since code does upcalls now. this will be soooo slow
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8039921-sha1_1024plus.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,87 @@ +# HG changeset patch +# User andrew +# Date 1436281867 -3600 +# Tue Jul 07 16:11:07 2015 +0100 +# Node ID 38e2f59188166b2dcc2c7655a4c4d6ad948c4c59 +# Parent 67d5d1b652e7c475140d9eabe687681c6e55b0af +8039921, PR2468: SHA1WithDSA with key > 1024 bits not working +Summary: Removed the key size limits for all SHAXXXWithDSA signatures +Reviewed-by: weijun + +diff -r 67d5d1b652e7 -r 38e2f5918816 src/share/classes/sun/security/provider/DSA.java +--- openjdk/jdk/src/share/classes/sun/security/provider/DSA.java Tue Jul 07 16:05:01 2015 +0100 ++++ openjdk/jdk/src/share/classes/sun/security/provider/DSA.java Tue Jul 07 16:11:07 2015 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 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 +@@ -117,7 +117,6 @@ + if (params == null) { + throw new InvalidKeyException("DSA private key lacks parameters"); + } +- checkKey(params); + + this.params = params; + this.presetX = priv.getX(); +@@ -149,7 +148,6 @@ + if (params == null) { + throw new InvalidKeyException("DSA public key lacks parameters"); + } +- checkKey(params); + + this.params = params; + this.presetY = pub.getY(); +@@ -291,16 +289,6 @@ + return null; + } + +- protected void checkKey(DSAParams params) throws InvalidKeyException { +- // FIPS186-3 states in sec4.2 that a hash function which provides +- // a lower security strength than the (L, N) pair ordinarily should +- // not be used. +- int valueN = params.getQ().bitLength(); +- if (valueN > md.getDigestLength()*8) { +- throw new InvalidKeyException("Key is too strong for this signature algorithm"); +- } +- } +- + private BigInteger generateR(BigInteger p, BigInteger q, BigInteger g, + BigInteger k) { + BigInteger temp = g.modPow(k, p); +@@ -480,14 +468,6 @@ + } + } + +- @Override +- protected void checkKey(DSAParams params) throws InvalidKeyException { +- int valueL = params.getP().bitLength(); +- if (valueL > 1024) { +- throw new InvalidKeyException("Key is too long for this algorithm"); +- } +- } +- + /* + * Please read bug report 4044247 for an alternative, faster, + * NON-FIPS approved method to generate K +diff -r 67d5d1b652e7 -r 38e2f5918816 test/sun/security/provider/DSA/TestDSA2.java +--- openjdk/jdk/test/sun/security/provider/DSA/TestDSA2.java Tue Jul 07 16:05:01 2015 +0100 ++++ openjdk/jdk/test/sun/security/provider/DSA/TestDSA2.java Tue Jul 07 16:11:07 2015 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2012, 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 +@@ -50,7 +50,7 @@ + public static void main(String[] args) throws Exception { + boolean[] expectedToPass = { true, true, true }; + test(1024, expectedToPass); +- boolean[] expectedToPass2 = { false, true, true }; ++ boolean[] expectedToPass2 = { true, true, true }; + test(2048, expectedToPass2); + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8041451-ldap_read_timeout_abandon.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,21 @@ +# HG changeset patch +# User robm +# Date 1400870536 -3600 +# Fri May 23 19:42:16 2014 +0100 +# Node ID 44be5963aee520ebb0f3d71580a52d5cf81deb0f +# Parent e8a342b73ad03697c28de4ded2bfe556158f1645 +8041451, PR2480: com.sun.jndi.ldap.Connection:ReadTimeout should abandon ldap request +Reviewed-by: vinnie + +diff -r e8a342b73ad0 -r 44be5963aee5 src/share/classes/com/sun/jndi/ldap/Connection.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Sun Jul 13 22:42:00 2014 +0400 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri May 23 19:42:16 2014 +0100 +@@ -479,7 +479,7 @@ + } + + if ((rber == null) && waited) { +- removeRequest(ldr); ++ abandonRequest(ldr, null); + throw new NamingException("LDAP response read timed out, timeout used:" + + readTimeout + "ms." ); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8042855-indiclayoutengine_null_dereference.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,51 @@ +# HG changeset patch +# User prr +# Date 1400800681 25200 +# Thu May 22 16:18:01 2014 -0700 +# Node ID 545facd764ecb3a0f3c328815a5c9b985bb69f90 +# Parent d6a1969c7922f7987ce00462c5f68b1e070fc4e8 +8042855, PR2510: [parfait] Potential null pointer dereference in IndicLayoutEngine.cpp +Reviewed-by: bae, srl, jgodinez + +diff -r d6a1969c7922 -r 545facd764ec src/share/native/sun/font/layout/IndicLayoutEngine.cpp +--- openjdk/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp Thu May 22 16:17:28 2014 -0700 ++++ openjdk/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp Thu May 22 16:18:01 2014 -0700 +@@ -151,7 +151,7 @@ + le_int32 outCharCount; + if (fVersion2) { + _LETRACE("v2process"); +- outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage); ++ outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage, success); + } else { + _LETRACE("reorder"); + outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups, success); +diff -r d6a1969c7922 -r 545facd764ec src/share/native/sun/font/layout/IndicReordering.cpp +--- openjdk/jdk/src/share/native/sun/font/layout/IndicReordering.cpp Thu May 22 16:17:28 2014 -0700 ++++ openjdk/jdk/src/share/native/sun/font/layout/IndicReordering.cpp Thu May 22 16:18:01 2014 -0700 +@@ -1096,9 +1096,13 @@ + + + le_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode, +- LEUnicode *outChars, LEGlyphStorage &glyphStorage) ++ LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success) + { + const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode); ++ if (classTable == NULL) { ++ success = LE_MEMORY_ALLOCATION_ERROR; ++ return 0; ++ } + + DynamicProperties dynProps[INDIC_BLOCK_SIZE]; + IndicReordering::getDynamicProperties(dynProps,classTable); +diff -r d6a1969c7922 -r 545facd764ec src/share/native/sun/font/layout/IndicReordering.h +--- openjdk/jdk/src/share/native/sun/font/layout/IndicReordering.h Thu May 22 16:17:28 2014 -0700 ++++ openjdk/jdk/src/share/native/sun/font/layout/IndicReordering.h Thu May 22 16:18:01 2014 -0700 +@@ -181,7 +181,7 @@ + static void adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success); + + static le_int32 v2process(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode, +- LEUnicode *outChars, LEGlyphStorage &glyphStorage); ++ LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success); + + static const FeatureMap *getFeatureMap(le_int32 &count); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8042857-14_stuck_threads_on_ldaprequest.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,127 @@ +# HG changeset patch +# User robm +# Date 1401472456 -3600 +# Fri May 30 18:54:16 2014 +0100 +# Node ID 3cbe4f93fc13c180f25665d2ad9a55973b087f32 +# Parent 5115a03b96b812337d65cecbe373062058d3c148 +8042857, PR2479: 14 stuck threads waiting for notification on LDAPRequest +Reviewed-by: vinnie + +diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java +--- openjdk.orig/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java 2015-07-22 03:12:51.336893552 +0100 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java 2015-07-22 03:13:34.716137412 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -458,10 +458,10 @@ + // will be woken up before readTimeout only if reply is + // available + ldr.wait(readTimeout); +- waited = true; + } else { + ldr.wait(15 * 1000); // 15 second timeout + } ++ waited = true; + } else { + break; + } +diff -Nru openjdk.orig/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java openjdk/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java +--- openjdk.orig/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java 2015-07-22 03:12:51.336893552 +0100 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java 2015-07-22 03:13:20.232389877 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -64,11 +64,12 @@ + env.put(Context.SECURITY_PRINCIPAL, "user"); + env.put(Context.SECURITY_CREDENTIALS, "password"); + +- env.put("com.sun.jndi.ldap.connect.timeout", "10"); +- env.put("com.sun.jndi.ldap.read.timeout", "3000"); +- + InitialContext ctx = null; + try { ++ new LdapTimeoutTest().deadServerNoTimeout(env); ++ ++ env.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ env.put("com.sun.jndi.ldap.read.timeout", "3000"); + new LdapTimeoutTest().ldapReadTimeoutTest(env, false); + new LdapTimeoutTest().ldapReadTimeoutTest(env, true); + new LdapTimeoutTest().simpleAuthConnectTest(env); +@@ -84,7 +85,7 @@ + void ldapReadTimeoutTest(Hashtable env, boolean ssl) { + InitialContext ctx = null; + if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl"); +- ScheduledFuture killer = killSwitch(); ++ ScheduledFuture killer = killSwitch(5000); + long start = System.nanoTime(); + try { + ctx = new InitialDirContext(env); +@@ -112,7 +113,7 @@ + + void simpleAuthConnectTest(Hashtable env) { + InitialContext ctx = null; +- ScheduledFuture killer = killSwitch(); ++ ScheduledFuture killer = killSwitch(5000); + long start = System.nanoTime(); + try { + ctx = new InitialDirContext(env); +@@ -139,6 +140,32 @@ + } + } + ++ void deadServerNoTimeout(Hashtable env) { ++ InitialContext ctx = null; ++ ScheduledFuture killer = killSwitch(30000); ++ long start = System.nanoTime(); ++ try { ++ ctx = new InitialDirContext(env); ++ SearchControls scl = new SearchControls(); ++ scl.setSearchScope(SearchControls.SUBTREE_SCOPE); ++ NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx) ++ .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); ++ // shouldn't reach here ++ fail(); ++ } catch (NamingException e) { ++ long end = System.nanoTime(); ++ if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) { ++ System.err.println("fail: timeout should be at least 15 seconds, actual time: " ++ + TimeUnit.NANOSECONDS.toMillis(end - start)); ++ fail(); ++ } else { ++ pass(); ++ } ++ } finally { ++ if (!shutItDown(killer, ctx)) fail(); ++ } ++ } ++ + boolean shutItDown(ScheduledFuture killer, InitialContext ctx) { + killer.cancel(true); + try { +@@ -149,15 +176,15 @@ + } + } + +- ScheduledFuture killSwitch() { ++ ScheduledFuture killSwitch(int ms) { + final Thread current = Thread.currentThread(); + return LdapTimeoutTest.pool.schedule(new Callable<Void>() { + public Void call() throws Exception { + System.err.println("Fail: killSwitch()"); +- current.interrupt(); ++ System.exit(0); + return null; + } +- }, 5000, TimeUnit.MILLISECONDS); ++ }, ms, TimeUnit.MILLISECONDS); + } + + static class Server extends Thread {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8065238-ldap_namingexception_8041451_regression.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,611 @@ +# HG changeset patch +# User robm +# Date 1422380814 0 +# Tue Jan 27 17:46:54 2015 +0000 +# Node ID 53a8f35dbe1792da00660d385c70470c0ce1a9e5 +# Parent d63b4806622e1a35c31c4be660358b2c4a1b281e +8065238, PR2479: javax.naming.NamingException after upgrade to JDK 8 +Reviewed-by: vinnie + +diff -r d63b4806622e -r 53a8f35dbe17 src/share/classes/com/sun/jndi/ldap/Connection.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Tue Jan 27 15:04:31 2015 +0300 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Tue Jan 27 17:46:54 2015 +0000 +@@ -460,14 +460,16 @@ + rber = ldr.getReplyBer(); + if (rber == null) { + if (readTimeout > 0) { // Socket read timeout is specified +- + // will be woken up before readTimeout only if reply is + // available + ldr.wait(readTimeout); ++ waited = true; + } else { +- ldr.wait(15 * 1000); // 15 second timeout ++ // no timeout is set so we wait infinitely until ++ // a response is received ++ // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP ++ ldr.wait(); + } +- waited = true; + } else { + break; + } +diff -r d63b4806622e -r 53a8f35dbe17 test/com/sun/jndi/ldap/LdapTimeoutTest.java +--- openjdk/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Tue Jan 27 15:04:31 2015 +0300 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Tue Jan 27 17:46:54 2015 +0000 +@@ -23,6 +23,7 @@ + + /** + * @test ++ * @run main/othervm LdapTimeoutTest + * @bug 7094377 8000487 6176036 7056489 + * @summary Timeout tests for ldap + */ +@@ -33,141 +34,56 @@ + import java.io.*; + import javax.naming.*; + import javax.naming.directory.*; ++import java.util.List; + import java.util.Hashtable; ++import java.util.ArrayList; + import java.util.concurrent.Callable; ++import java.util.concurrent.ExecutionException; + import java.util.concurrent.Executors; ++import java.util.concurrent.ExecutorService; ++import java.util.concurrent.Future; + import java.util.concurrent.ScheduledExecutorService; + import java.util.concurrent.ScheduledFuture; ++import java.util.concurrent.TimeoutException; + import java.util.concurrent.TimeUnit; + +-public class LdapTimeoutTest { +- private static final ScheduledExecutorService pool = +- Executors.newScheduledThreadPool(1); +- static volatile int passed = 0, failed = 0; +- static void pass() {passed++;} +- static void fail() {failed++; Thread.dumpStack();} ++import static java.util.concurrent.TimeUnit.MILLISECONDS; ++import static java.util.concurrent.TimeUnit.NANOSECONDS; + +- public static void main(String[] args) throws Exception { +- ServerSocket serverSock = new ServerSocket(0); +- Server s = new Server(serverSock); +- s.start(); +- Thread.sleep(200); + +- Hashtable env = new Hashtable(11); +- env.put(Context.INITIAL_CONTEXT_FACTORY, +- "com.sun.jndi.ldap.LdapCtxFactory"); +- env.put(Context.PROVIDER_URL, "ldap://localhost:" + +- serverSock.getLocalPort()); ++abstract class LdapTest implements Callable { + +- env.put(Context.SECURITY_AUTHENTICATION,"simple"); ++ Hashtable env; ++ TestServer server; ++ ScheduledExecutorService killSwitchPool; ++ boolean passed = false; ++ private int HANGING_TEST_TIMEOUT = 20_000; + +- env.put(Context.SECURITY_PRINCIPAL, "user"); +- env.put(Context.SECURITY_CREDENTIALS, "password"); +- +- InitialContext ctx = null; +- try { +- new LdapTimeoutTest().deadServerNoTimeout(env); +- +- env.put("com.sun.jndi.ldap.connect.timeout", "10"); +- env.put("com.sun.jndi.ldap.read.timeout", "3000"); +- new LdapTimeoutTest().ldapReadTimeoutTest(env, false); +- new LdapTimeoutTest().ldapReadTimeoutTest(env, true); +- new LdapTimeoutTest().simpleAuthConnectTest(env); +- } finally { +- s.interrupt(); +- LdapTimeoutTest.pool.shutdown(); +- } +- +- System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); +- if (failed > 0) throw new AssertionError("Some tests failed"); ++ public LdapTest (TestServer server, Hashtable env) { ++ this.server = server; ++ this.env = env; + } + +- void ldapReadTimeoutTest(Hashtable env, boolean ssl) { +- InitialContext ctx = null; +- if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl"); +- ScheduledFuture killer = killSwitch(5000); +- long start = System.nanoTime(); +- try { +- ctx = new InitialDirContext(env); +- SearchControls scl = new SearchControls(); +- scl.setSearchScope(SearchControls.SUBTREE_SCOPE); +- NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx) +- .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); +- // shouldn't reach here +- fail(); +- } catch (NamingException e) { +- if (ssl) { +- if (e.getCause() instanceof SocketTimeoutException) { +- pass(); +- } else if (e.getCause() instanceof InterruptedIOException) { +- Thread.interrupted(); +- fail(); +- } +- } else { +- pass(); +- } +- } finally { +- if (!shutItDown(killer, ctx)) fail(); +- } ++ public LdapTest(TestServer server, Hashtable env, ++ ScheduledExecutorService killSwitchPool) ++ { ++ this(server, env); ++ this.killSwitchPool = killSwitchPool; + } + +- void simpleAuthConnectTest(Hashtable env) { +- InitialContext ctx = null; +- ScheduledFuture killer = killSwitch(5000); +- long start = System.nanoTime(); +- try { +- ctx = new InitialDirContext(env); +- // shouldn't reach here +- System.err.println("Fail: InitialDirContext succeeded"); +- fail(); +- } catch (NamingException e) { +- long end = System.nanoTime(); +- if (e.getCause() instanceof SocketTimeoutException) { +- if (TimeUnit.NANOSECONDS.toMillis(end - start) < 2900) { +- pass(); +- } else { +- System.err.println("Fail: Waited too long"); +- fail(); +- } +- } else if (e.getCause() instanceof InterruptedIOException) { +- Thread.interrupted(); +- fail(); +- } else { +- fail(); +- } +- } finally { +- if (!shutItDown(killer, ctx)) fail(); +- } ++ public abstract void performOp(InitialContext ctx) throws NamingException; ++ public abstract void handleNamingException( ++ NamingException e, long start, long end); ++ ++ public void pass() { ++ this.passed = true; + } + +- void deadServerNoTimeout(Hashtable env) { +- InitialContext ctx = null; +- ScheduledFuture killer = killSwitch(30000); +- long start = System.nanoTime(); +- try { +- ctx = new InitialDirContext(env); +- SearchControls scl = new SearchControls(); +- scl.setSearchScope(SearchControls.SUBTREE_SCOPE); +- NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx) +- .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); +- // shouldn't reach here +- fail(); +- } catch (NamingException e) { +- long end = System.nanoTime(); +- if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) { +- System.err.println("fail: timeout should be at least 15 seconds, actual time: " +- + TimeUnit.NANOSECONDS.toMillis(end - start)); +- fail(); +- } else { +- pass(); +- } +- } finally { +- if (!shutItDown(killer, ctx)) fail(); +- } ++ public void fail() { ++ throw new RuntimeException("Test failed"); + } + +- boolean shutItDown(ScheduledFuture killer, InitialContext ctx) { +- killer.cancel(true); ++ boolean shutItDown(InitialContext ctx) { + try { + if (ctx != null) ctx.close(); + return true; +@@ -176,29 +92,376 @@ + } + } + +- ScheduledFuture killSwitch(int ms) { +- final Thread current = Thread.currentThread(); +- return LdapTimeoutTest.pool.schedule(new Callable<Void>() { +- public Void call() throws Exception { +- System.err.println("Fail: killSwitch()"); +- System.exit(0); +- return null; ++ public Boolean call() { ++ InitialContext ctx = null; ++ ScheduledFuture killer = null; ++ long start = System.nanoTime(); ++ ++ try { ++ while(!server.accepting()) ++ Thread.sleep(200); // allow the server to start up ++ Thread.sleep(200); // to be sure ++ ++ // if this is a hanging test, scheduled a thread to ++ // interrupt after a certain time ++ if (killSwitchPool != null) { ++ final Thread current = Thread.currentThread(); ++ killer = killSwitchPool.schedule( ++ new Callable<Void>() { ++ public Void call() throws Exception { ++ current.interrupt(); ++ return null; ++ } ++ }, HANGING_TEST_TIMEOUT, MILLISECONDS); + } +- }, ms, TimeUnit.MILLISECONDS); +- } + +- static class Server extends Thread { +- final ServerSocket serverSock; ++ env.put(Context.PROVIDER_URL, "ldap://localhost:" + ++ server.getLocalPort()); + +- Server(ServerSocket serverSock) { +- this.serverSock = serverSock; +- } +- +- public void run() { + try { +- Socket socket = serverSock.accept(); +- } catch (IOException e) {} ++ ctx = new InitialDirContext(env); ++ performOp(ctx); ++ fail(); ++ } catch (NamingException e) { ++ long end = System.nanoTime(); ++ System.out.println(this.getClass().toString() + " - elapsed: " ++ + NANOSECONDS.toMillis(end - start)); ++ handleNamingException(e, start, end); ++ } finally { ++ if (killer != null && !killer.isDone()) ++ killer.cancel(true); ++ shutItDown(ctx); ++ server.close(); ++ } ++ return passed; ++ } catch (IOException|InterruptedException e) { ++ throw new RuntimeException(e); + } + } + } + ++abstract class ReadServerTest extends LdapTest { ++ ++ public ReadServerTest(Hashtable env) throws IOException { ++ super(new BindableServer(), env); ++ } ++ ++ public ReadServerTest(Hashtable env, ++ ScheduledExecutorService killSwitchPool) ++ throws IOException ++ { ++ super(new BindableServer(), env, killSwitchPool); ++ } ++ ++ public void performOp(InitialContext ctx) throws NamingException { ++ SearchControls scl = new SearchControls(); ++ scl.setSearchScope(SearchControls.SUBTREE_SCOPE); ++ NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx) ++ .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); ++ } ++} ++ ++abstract class DeadServerTest extends LdapTest { ++ ++ public DeadServerTest(Hashtable env) throws IOException { ++ super(new DeadServer(), env); ++ } ++ ++ public DeadServerTest(Hashtable env, ++ ScheduledExecutorService killSwitchPool) ++ throws IOException ++ { ++ super(new DeadServer(), env, killSwitchPool); ++ } ++ ++ public void performOp(InitialContext ctx) throws NamingException {} ++} ++ ++class DeadServerNoTimeoutTest extends DeadServerTest { ++ ++ public DeadServerNoTimeoutTest(Hashtable env, ++ ScheduledExecutorService killSwitchPool) ++ throws IOException ++ { ++ super(env, killSwitchPool); ++ } ++ ++ public void handleNamingException(NamingException e, long start, long end) { ++ if (e instanceof InterruptedNamingException) Thread.interrupted(); ++ ++ if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) { ++ System.err.printf("DeadServerNoTimeoutTest fail: timeout should be " + ++ "at least %s ms, actual time is %s ms%n", ++ LdapTimeoutTest.MIN_TIMEOUT, ++ NANOSECONDS.toMillis(end - start)); ++ fail(); ++ } else { ++ pass(); ++ } ++ } ++} ++ ++class DeadServerTimeoutTest extends DeadServerTest { ++ ++ public DeadServerTimeoutTest(Hashtable env) throws IOException { ++ super(env); ++ } ++ ++ public void handleNamingException(NamingException e, long start, long end) ++ { ++ // non SSL connect will timeout via readReply using connectTimeout ++ if (NANOSECONDS.toMillis(end - start) < 2_900) { ++ pass(); ++ } else { ++ System.err.println("Fail: Waited too long"); ++ fail(); ++ } ++ } ++} ++ ++class DeadServerTimeoutSSLTest extends DeadServerTest { ++ ++ public DeadServerTimeoutSSLTest(Hashtable env) throws IOException { ++ super(env); ++ } ++ ++ public void handleNamingException(NamingException e, long start, long end) { ++ if (e.getCause() instanceof SocketTimeoutException) { ++ // SSL connect will timeout via readReply using ++ // SocketTimeoutException ++ pass(); ++ } else { ++ fail(); ++ } ++ } ++} ++ ++ ++class ReadServerNoTimeoutTest extends ReadServerTest { ++ ++ public ReadServerNoTimeoutTest(Hashtable env, ++ ScheduledExecutorService killSwitchPool) ++ throws IOException ++ { ++ super(env, killSwitchPool); ++ } ++ ++ public void handleNamingException(NamingException e, long start, long end) { ++ if (e instanceof InterruptedNamingException) Thread.interrupted(); ++ ++ if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) { ++ System.err.printf("ReadServerNoTimeoutTest fail: timeout should be " + ++ "at least %s ms, actual time is %s ms%n", ++ LdapTimeoutTest.MIN_TIMEOUT, ++ NANOSECONDS.toMillis(end - start)); ++ fail(); ++ } else { ++ pass(); ++ } ++ } ++} ++ ++class ReadServerTimeoutTest extends ReadServerTest { ++ ++ public ReadServerTimeoutTest(Hashtable env) throws IOException { ++ super(env); ++ } ++ ++ public void handleNamingException(NamingException e, long start, long end) { ++ if (NANOSECONDS.toMillis(end - start) < 2_900) { ++ fail(); ++ } else { ++ pass(); ++ } ++ } ++} ++ ++class TestServer extends Thread { ++ ServerSocket serverSock; ++ boolean accepting = false; ++ ++ public TestServer() throws IOException { ++ this.serverSock = new ServerSocket(0); ++ start(); ++ } ++ ++ public int getLocalPort() { ++ return serverSock.getLocalPort(); ++ } ++ ++ public boolean accepting() { ++ return accepting; ++ } ++ ++ public void close() throws IOException { ++ serverSock.close(); ++ } ++} ++ ++class BindableServer extends TestServer { ++ ++ public BindableServer() throws IOException { ++ super(); ++ } ++ ++ private byte[] bindResponse = { ++ 0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A, ++ 0x01, 0x00, 0x04, 0x00, 0x04, 0x00 ++ }; ++ ++ public void run() { ++ try { ++ accepting = true; ++ Socket socket = serverSock.accept(); ++ InputStream in = socket.getInputStream(); ++ OutputStream out = socket.getOutputStream(); ++ ++ // Read the LDAP BindRequest ++ while (in.read() != -1) { ++ in.skip(in.available()); ++ break; ++ } ++ ++ // Write an LDAP BindResponse ++ out.write(bindResponse); ++ out.flush(); ++ } catch (IOException e) { ++ // ignore ++ } ++ } ++} ++ ++class DeadServer extends TestServer { ++ ++ public DeadServer() throws IOException { ++ super(); ++ } ++ ++ public void run() { ++ while(true) { ++ try { ++ accepting = true; ++ Socket socket = serverSock.accept(); ++ } catch (Exception e) { ++ break; ++ } ++ } ++ } ++} ++ ++public class LdapTimeoutTest { ++ ++ private static final ExecutorService testPool = ++ Executors.newFixedThreadPool(3); ++ private static final ScheduledExecutorService killSwitchPool = ++ Executors.newScheduledThreadPool(3); ++ public static int MIN_TIMEOUT = 18_000; ++ ++ static Hashtable createEnv() { ++ Hashtable env = new Hashtable(11); ++ env.put(Context.INITIAL_CONTEXT_FACTORY, ++ "com.sun.jndi.ldap.LdapCtxFactory"); ++ return env; ++ } ++ ++ public static void main(String[] args) throws Exception { ++ ++ InitialContext ctx = null; ++ List<Future> results = new ArrayList<>(); ++ ++ try { ++ // run the DeadServerTest with no timeouts set ++ // this should get stuck indefinitely, so we need to kill ++ // it after a timeout ++ System.out.println("Running connect timeout test with 20s kill switch"); ++ Hashtable env = createEnv(); ++ results.add( ++ testPool.submit(new DeadServerNoTimeoutTest(env, killSwitchPool))); ++ ++ // run the ReadServerTest with connect timeout set ++ // this should get stuck indefinitely so we need to kill ++ // it after a timeout ++ System.out.println("Running read timeout test with 10ms connect timeout & 20s kill switch"); ++ Hashtable env1 = createEnv(); ++ env1.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ results.add(testPool.submit( ++ new ReadServerNoTimeoutTest(env1, killSwitchPool))); ++ ++ // run the ReadServerTest with no timeouts set ++ // this should get stuck indefinitely, so we need to kill ++ // it after a timeout ++ System.out.println("Running read timeout test with 20s kill switch"); ++ Hashtable env2 = createEnv(); ++ results.add(testPool.submit( ++ new ReadServerNoTimeoutTest(env2, killSwitchPool))); ++ ++ // run the DeadServerTest with connect / read timeouts set ++ // this should exit after the connect timeout expires ++ System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout"); ++ Hashtable env3 = createEnv(); ++ env3.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ env3.put("com.sun.jndi.ldap.read.timeout", "3000"); ++ results.add(testPool.submit(new DeadServerTimeoutTest(env3))); ++ ++ ++ // run the ReadServerTest with connect / read timeouts set ++ // this should exit after the connect timeout expires ++ System.out.println("Running read timeout test with 10ms connect timeout, 3000ms read timeout"); ++ Hashtable env4 = createEnv(); ++ env4.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ env4.put("com.sun.jndi.ldap.read.timeout", "3000"); ++ results.add(testPool.submit(new ReadServerTimeoutTest(env4))); ++ ++ // run the DeadServerTest with connect timeout set ++ // this should exit after the connect timeout expires ++ System.out.println("Running connect timeout test with 10ms connect timeout"); ++ Hashtable env5 = createEnv(); ++ env5.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ results.add(testPool.submit(new DeadServerTimeoutTest(env5))); ++ ++ // 8000487: Java JNDI connection library on ldap conn is ++ // not honoring configured timeout ++ System.out.println("Running simple auth connection test"); ++ Hashtable env6 = createEnv(); ++ env6.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ env6.put("com.sun.jndi.ldap.read.timeout", "3000"); ++ env6.put(Context.SECURITY_AUTHENTICATION, "simple"); ++ env6.put(Context.SECURITY_PRINCIPAL, "user"); ++ env6.put(Context.SECURITY_CREDENTIALS, "password"); ++ results.add(testPool.submit(new DeadServerTimeoutTest(env6))); ++ ++ boolean testFailed = false; ++ for (Future test : results) { ++ while (!test.isDone()) { ++ if ((Boolean) test.get() == false) ++ testFailed = true; ++ } ++ } ++ ++ // ++ // Running this test serially as it seems to tickle a problem ++ // on older kernels ++ // ++ // run the DeadServerTest with connect / read timeouts set ++ // and ssl enabled ++ // this should exit with a SocketTimeoutException as the root cause ++ // it should also use the connect timeout instead of the read timeout ++ System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL"); ++ Hashtable sslenv = createEnv(); ++ sslenv.put("com.sun.jndi.ldap.connect.timeout", "10"); ++ sslenv.put("com.sun.jndi.ldap.read.timeout", "3000"); ++ sslenv.put(Context.SECURITY_PROTOCOL, "ssl"); ++ testFailed = (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true; ++ ++ if (testFailed) { ++ throw new AssertionError("some tests failed"); ++ } ++ ++ } finally { ++ LdapTimeoutTest.killSwitchPool.shutdown(); ++ LdapTimeoutTest.testPool.shutdown(); ++ } ++ } ++ ++} ++
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8074761-ldap_empty_optional_params.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,168 @@ +# HG changeset patch +# User omajid +# Date 1429811282 14400 +# Thu Apr 23 13:48:02 2015 -0400 +# Node ID db440b7618ee0d2bf6bf69a1e22653a5818cb41a +# Parent 2940b1683e2273626d57879c01a97dc9989713f6 +8074761, PR2469: Empty optional parameters of LDAP query are not interpreted as empty +Reviewed-by: vinnie +Contributed-by: Stanislav Baiduzhyi <sbaiduzh@redhat.com> + +diff -r 2940b1683e22 -r db440b7618ee src/share/classes/com/sun/jndi/ldap/LdapURL.java +--- openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapURL.java Tue Jul 07 18:26:59 2015 +0100 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapURL.java Thu Apr 23 13:48:02 2015 -0400 +@@ -26,9 +26,6 @@ + package com.sun.jndi.ldap; + + import javax.naming.*; +-import javax.naming.directory.*; +-import javax.naming.spi.*; +-import java.net.URL; + import java.net.MalformedURLException; + import java.io.UnsupportedEncodingException; + import java.util.StringTokenizer; +@@ -211,43 +208,52 @@ + + // query begins with a '?' or is null + +- if (query == null) { ++ if (query == null || query.length() < 2) { + return; + } + +- int qmark2 = query.indexOf('?', 1); ++ int currentIndex = 1; ++ int nextQmark; ++ int endIndex; + +- if (qmark2 < 0) { +- attributes = query.substring(1); ++ // attributes: ++ nextQmark = query.indexOf('?', currentIndex); ++ endIndex = nextQmark == -1 ? query.length() : nextQmark; ++ if (endIndex - currentIndex > 0) { ++ attributes = query.substring(currentIndex, endIndex); ++ } ++ currentIndex = endIndex + 1; ++ if (currentIndex >= query.length()) { + return; +- } else if (qmark2 != 1) { +- attributes = query.substring(1, qmark2); + } + +- int qmark3 = query.indexOf('?', qmark2 + 1); +- +- if (qmark3 < 0) { +- scope = query.substring(qmark2 + 1); ++ // scope: ++ nextQmark = query.indexOf('?', currentIndex); ++ endIndex = nextQmark == -1 ? query.length() : nextQmark; ++ if (endIndex - currentIndex > 0) { ++ scope = query.substring(currentIndex, endIndex); ++ } ++ currentIndex = endIndex + 1; ++ if (currentIndex >= query.length()) { + return; +- } else if (qmark3 != qmark2 + 1) { +- scope = query.substring(qmark2 + 1, qmark3); + } + +- int qmark4 = query.indexOf('?', qmark3 + 1); ++ // filter: ++ nextQmark = query.indexOf('?', currentIndex); ++ endIndex = nextQmark == -1 ? query.length() : nextQmark; ++ if (endIndex - currentIndex > 0) { ++ filter = query.substring(currentIndex, endIndex); ++ filter = UrlUtil.decode(filter, "UTF8"); ++ } ++ currentIndex = endIndex + 1; ++ if (currentIndex >= query.length()) { ++ return; ++ } + +- if (qmark4 < 0) { +- filter = query.substring(qmark3 + 1); +- } else { +- if (qmark4 != qmark3 + 1) { +- filter = query.substring(qmark3 + 1, qmark4); +- } +- extensions = query.substring(qmark4 + 1); +- if (extensions.length() > 0) { +- extensions = UrlUtil.decode(extensions, "UTF8"); +- } +- } +- if (filter != null && filter.length() > 0) { +- filter = UrlUtil.decode(filter, "UTF8"); ++ // extensions: ++ if (query.length() - currentIndex > 0) { ++ extensions = query.substring(currentIndex); ++ extensions = UrlUtil.decode(extensions, "UTF8"); + } + } + +diff -r 2940b1683e22 -r db440b7618ee test/com/sun/jndi/ldap/LdapURLOptionalFields.java +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ openjdk/jdk/test/com/sun/jndi/ldap/LdapURLOptionalFields.java Thu Apr 23 13:48:02 2015 -0400 +@@ -0,0 +1,62 @@ ++/* ++ * Copyright (c) 2015, Red Hat, Inc. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++/** ++ * @test ++ * @bug 8074761 ++ * @summary RFC-2255 allows attribute, scope and filter to be empty. ++ */ ++ ++import com.sun.jndi.ldap.LdapURL; ++ ++public class LdapURLOptionalFields { ++ ++ private static final String[] TEST_URLS = { ++ "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com", ++ "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com?", ++ "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com??", ++ "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com???", ++ "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com????" ++ }; ++ ++ public static void main(String[] args) throws Exception { ++ for (int i = 0; i < TEST_URLS.length; i++) { ++ String url = TEST_URLS[i]; ++ checkEmptyAttributes(url); ++ } ++ } ++ ++ private static void checkEmptyAttributes(String urlString) throws Exception { ++ LdapURL url = new LdapURL(urlString); ++ if (url.getAttributes() != null) { ++ throw new Exception("Expected null attributes for url: '" + urlString + "'"); ++ } ++ if (url.getScope() != null) { ++ throw new Exception("Expected null scope for url: '" + urlString + "'"); ++ } ++ if (url.getFilter() != null) { ++ throw new Exception("Expected null filter for url: '" + urlString + "'"); ++ } ++ } ++ ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8078654-closettfontfilefunc.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,42 @@ +# HG changeset patch +# User prr +# Date 1433343160 -3600 +# Wed Jun 03 15:52:40 2015 +0100 +# Node ID 78da0280399f25f7cec8a8354f2be5e813db2acc +# Parent 871094d6431aa9f277169e824a5694f27a01f0c0 +8078654, PR2334: CloseTTFontFileFunc callback should be removed +Reviewed-by: prr, martin + +diff -r 871094d6431a -r 78da0280399f src/share/native/sun/font/freetypeScaler.c +--- openjdk/jdk/src/share/native/sun/font/freetypeScaler.c Mon Apr 27 17:17:07 2015 +0100 ++++ openjdk/jdk/src/share/native/sun/font/freetypeScaler.c Wed Jun 03 15:52:40 2015 +0100 +@@ -151,20 +151,6 @@ + + #define FILEDATACACHESIZE 1024 + +-/* NB: is it ever called? */ +-static void CloseTTFontFileFunc(FT_Stream stream) { +- FTScalerInfo *scalerInfo = (FTScalerInfo *) stream->pathname.pointer; +- JNIEnv* env = scalerInfo->env; +- jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont"); +- jfieldID platNameField = +- (*env)->GetFieldID(env, tmpClass, "platName", "Ljava/lang/String;"); +- jstring platName = (*env)->GetObjectField(env, +- scalerInfo->font2D, +- platNameField); +- const char *name = JNU_GetStringPlatformChars(env, platName, NULL); +- JNU_ReleaseStringPlatformChars(env, platName, name); +-} +- + static unsigned long ReadTTFontFileFunc(FT_Stream stream, + unsigned long offset, + unsigned char* destBuffer, +@@ -309,7 +295,7 @@ + ftstream->size = filesize; + ftstream->pos = 0; + ftstream->read = (FT_Stream_IoFunc) ReadTTFontFileFunc; +- ftstream->close = (FT_Stream_CloseFunc) CloseTTFontFileFunc; ++ ftstream->close = NULL; + ftstream->pathname.pointer = (void *) scalerInfo; + + memset(&ft_open_args, 0, sizeof(FT_Open_Args));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8078666-widen_increases.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,45 @@ +# HG changeset patch +# User sgehwolf +# Date 1430335428 25200 +# Wed Apr 29 12:23:48 2015 -0700 +# Node ID 1628564d58261aada17d5291f7b21d1b5cdf04bd +# Parent 2f4cec4539aac96c4ee3b30483bb050180d040a0 +8078666, PR2327: JVM fastdebug build compiled with GCC 5 asserts with "widen increases" +Summary: do the math on the unsigned type where overflows are well defined +Reviewed-by: kvn, aph + +diff -r 2f4cec4539aa -r 1628564d5826 src/share/vm/opto/type.cpp +--- openjdk/hotspot/src/share/vm/opto/type.cpp Fri Apr 03 17:22:23 2015 +0100 ++++ openjdk/hotspot/src/share/vm/opto/type.cpp Wed Apr 29 12:23:48 2015 -0700 +@@ -1077,11 +1077,11 @@ + // Certain normalizations keep us sane when comparing types. + // The 'SMALLINT' covers constants and also CC and its relatives. + if (lo <= hi) { +- if ((juint)(hi - lo) <= SMALLINT) w = Type::WidenMin; +- if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT ++ if (((juint)hi - lo) <= SMALLINT) w = Type::WidenMin; ++ if (((juint)hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT + } else { +- if ((juint)(lo - hi) <= SMALLINT) w = Type::WidenMin; +- if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT ++ if (((juint)lo - hi) <= SMALLINT) w = Type::WidenMin; ++ if (((juint)lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT + } + return w; + } +@@ -1332,11 +1332,11 @@ + // Certain normalizations keep us sane when comparing types. + // The 'SMALLINT' covers constants. + if (lo <= hi) { +- if ((julong)(hi - lo) <= SMALLINT) w = Type::WidenMin; +- if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG ++ if (((julong)hi - lo) <= SMALLINT) w = Type::WidenMin; ++ if (((julong)hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG + } else { +- if ((julong)(lo - hi) <= SMALLINT) w = Type::WidenMin; +- if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG ++ if (((julong)lo - hi) <= SMALLINT) w = Type::WidenMin; ++ if (((julong)lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG + } + return w; + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8081315-giflib_interlacing.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,72 @@ +# HG changeset patch +# User andrew +# Date 1436281501 -3600 +# Tue Jul 07 16:05:01 2015 +0100 +# Node ID 67d5d1b652e7c475140d9eabe687681c6e55b0af +# Parent 660aa5687b95d9084714b3270c053af09c5bf51a +S8081315, PR2406: Avoid giflib interlacing workaround with giflib 5.0.0 on +Summary: Sync with version of splashscreen_gif.c in OpenJDK 8 post-8081315. + +diff -Nru openjdk.orig/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c +--- openjdk.orig/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c 2015-07-22 03:15:18.106335225 +0100 ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c 2015-07-22 03:16:09.965431275 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2005, 2013, 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 +@@ -212,16 +212,16 @@ + byte_t *pSrc = image->RasterBits; + ImageFormat srcFormat; + ImageRect srcRect, dstRect; +- int pass, npass; ++ int pass = 4, npass = 5; + ++#if GIFLIB_MAJOR < 5 ++ /* Interlaced gif support is broken in giflib < 5 ++ so we need to work around this */ + if (desc->Interlace) { + pass = 0; + npass = 4; + } +- else { +- pass = 4; +- npass = 5; +- } ++#endif + + srcFormat.colorMap = colorMapBuf; + srcFormat.depthBytes = 1; +@@ -312,8 +312,9 @@ + free(pOldBitmapBits); + + #if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) +- if (DGifCloseFile(gif, NULL) == GIF_ERROR) ++ if (DGifCloseFile(gif, NULL) == GIF_ERROR) { + return 0; ++ } + #else + DGifCloseFile(gif); + #endif +@@ -325,17 +326,12 @@ + SplashDecodeGifStream(Splash * splash, SplashStream * stream) + { + #if GIFLIB_MAJOR >= 5 +- int error = 0; +- GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, &error); +- +- if (error) +- return 0; ++ GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL); + #else + GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc); ++#endif + + if (!gif) + return 0; +-#endif +- + return SplashDecodeGif(splash, gif); + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8081475-systemtap-gcc5.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,24 @@ +# HG changeset patch +# User ysuenaga +# Date 1432906184 -32400 +# Fri May 29 22:29:44 2015 +0900 +# Node ID 42f30231d979516785eb6cca84399be2797449b3 +# Parent cf23177e21ca6f49bdfcecaf2020db81d8d659a1 +8081475, PR2495: SystemTap does not work when JDK is compiled with GCC 5 +Summary: libjvm.so which is generated by GCC 5 does not have .note.stapsdt section as dtrace was disabled due to incorrect version check +Reviewed-by: dholmes, coleenp + +diff -r cf23177e21ca -r 42f30231d979 make/linux/makefiles/dtrace.make +--- openjdk/hotspot/make/linux/makefiles/dtrace.make Wed Jul 01 18:36:36 2015 +0100 ++++ openjdk/hotspot/make/linux/makefiles/dtrace.make Fri May 29 22:29:44 2015 +0900 +@@ -31,8 +31,8 @@ + REASON = "This JDK does not support SDT probes" + else + +-# We need a recent GCC for the default +-ifeq "$(shell expr \( $(CC_VER_MAJOR) \>= 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) )" "0" ++# We need a recent GCC for the default (4.4 or later) ++ifeq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) \) \| \( $(CC_VER_MAJOR) \>= 5 \) )" "0" + REASON = "gcc version is too old" + else +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8087120-zero_gcc5.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,24 @@ +# HG changeset patch +# User sgehwolf +# Date 1434121785 -3600 +# Fri Jun 12 16:09:45 2015 +0100 +# Node ID b19bc5aeaa099ac73ee8341e337a007180409593 +# Parent 4ce44f68d86dcf88b27142e5ec031dec29d47d6f +8087120, RH1206656, PR2554: [GCC5] java.lang.StackOverflowError on Zero JVM initialization on non x86 platforms. +Summary: Use __builtin_frame_address(0) rather than returning address of local variable. +Reviewed-by: dholmes + +diff -r 4ce44f68d86d -r b19bc5aeaa09 src/os_cpu/linux_zero/vm/os_linux_zero.cpp +--- openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Sun Jul 19 18:19:32 2015 +0100 ++++ openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Fri Jun 12 16:09:45 2015 +0100 +@@ -61,8 +61,8 @@ + #endif + + address os::current_stack_pointer() { +- address dummy = (address) &dummy; +- return dummy; ++ // return the address of the current function ++ return (address)__builtin_frame_address(0); + } + + frame os::get_sender_for_C_frame(frame* fr) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2319-policy_jar_checksum.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,103 @@ +# HG changeset patch +# User andrew +# Date 1411090681 -3600 +# Fri Sep 19 02:38:01 2014 +0100 +# Node ID d5d2aed90aa8bc68632698585d2fa18cf35da232 +# Parent 930f4626048e3bdc1044580d82b477ad9794720c +PR2319: Checksum of policy JAR files changes on every build + +diff -Nru openjdk.orig/jdk/make/javax/crypto/Makefile openjdk/jdk/make/javax/crypto/Makefile +--- openjdk.orig/jdk/make/javax/crypto/Makefile 2015-04-10 16:39:20.000000000 +0100 ++++ openjdk/jdk/make/javax/crypto/Makefile 2015-07-22 03:23:52.477369268 +0100 +@@ -258,6 +258,8 @@ + + POLICY_DESTDIR = $(LIBDIR)/security + UNSIGNED_POLICY_BUILDDIR = $(UNSIGNED_DIR)/policy ++TEMPDIR_UNLIMITED = $(TEMPDIR)/unlimited ++TEMPDIR_LIMITED = $(TEMPDIR)/limited + + build-policy: unlimited limited + +@@ -270,21 +272,37 @@ + + $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar: \ + policy/unlimited/default_US_export.policy \ +- policy/unlimited/UNLIMITED ++ $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF + $(prep-target) +- $(BOOT_JAR_CMD) cmf policy/unlimited/UNLIMITED $@ \ +- -C policy/unlimited default_US_export.policy \ +- $(JAR_JFLAGS) +- @$(java-vm-cleanup) ++ $(CP) policy/unlimited/default_US_export.policy \ ++ $(TEMPDIR_UNLIMITED) ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF \ ++ $(TEMPDIR_UNLIMITED)/default_US_export.policy ++ ( $(CD) $(TEMPDIR_UNLIMITED) && $(ZIPEXE) -Xr $@ META-INF \ ++ default_US_export.policy ) + + $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar: \ + policy/unlimited/default_local.policy \ ++ $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF ++ $(prep-target) ++ $(CP) policy/unlimited/default_local.policy \ ++ $(TEMPDIR_UNLIMITED) ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF \ ++ $(TEMPDIR_UNLIMITED)/default_local.policy ++ ( $(CD) $(TEMPDIR_UNLIMITED) && $(ZIPEXE) -Xr $@ META-INF \ ++ default_local.policy ) ++ ++$(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF: \ + policy/unlimited/UNLIMITED + $(prep-target) +- $(BOOT_JAR_CMD) cmf policy/unlimited/UNLIMITED $@ \ +- -C policy/unlimited default_local.policy \ +- $(JAR_JFLAGS) +- @$(java-vm-cleanup) ++ $(MKDIR) -p $(TEMPDIR_UNLIMITED)/META-INF ++ $(ECHO) "Manifest-Version: 1.0" > \ ++ $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF ++ $(CAT) policy/unlimited/UNLIMITED >> \ ++ $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF ++ $(TOUCH) -t 198001010000 $(TEMPDIR_UNLIMITED)/META-INF ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF \ ++ $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF + + # + # Build the unsigned limited policy files. +@@ -303,13 +321,30 @@ + $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \ + policy/limited/default_local.policy \ + policy/limited/exempt_local.policy \ ++ $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF ++ $(prep-target) ++ $(CP) policy/limited/default_local.policy \ ++ $(TEMPDIR_LIMITED) ++ $(CP) policy/limited/exempt_local.policy \ ++ $(TEMPDIR_LIMITED) ++ $(TOUCH) -r $(TEMPDIR_LIMITED)/META-INF \ ++ $(TEMPDIR_LIMITED)/default_local.policy ++ $(TOUCH) -r $(TEMPDIR_LIMITED)/META-INF \ ++ $(TEMPDIR_LIMITED)/exempt_local.policy ++ ( $(CD) $(TEMPDIR_UNLIMITED) && $(ZIPEXE) -Xr $@ META-INF \ ++ default_local.policy exempt_local.policy ) ++ ++$(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF: \ + policy/limited/LIMITED + $(prep-target) +- $(BOOT_JAR_CMD) cmf policy/limited/LIMITED $@ \ +- -C policy/limited default_local.policy \ +- -C policy/limited exempt_local.policy \ +- $(JAR_JFLAGS) +- @$(java-vm-cleanup) ++ $(MKDIR) -p $(TEMPDIR_LIMITED)/META-INF ++ $(ECHO) "Manifest-Version: 1.0" > \ ++ $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF ++ $(CAT) policy/limited/LIMITED >> \ ++ $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF ++ $(TOUCH) -t 198001010000 $(TEMPDIR_LIMITED)/META-INF ++ $(TOUCH) -r $(TEMPDIR_LIMITED)/META-INF \ ++ $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF + + UNSIGNED_POLICY_FILES = \ + $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2460-policy_jar_timestamp.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,108 @@ +# HG changeset patch +# User andrew +# Date 1436290019 -3600 +# Tue Jul 07 18:26:59 2015 +0100 +# Node ID 2940b1683e2273626d57879c01a97dc9989713f6 +# Parent 38e2f59188166b2dcc2c7655a4c4d6ad948c4c59 +PR2460: Policy JAR files should be timestamped with the date of the policy file they hold +Summary: Retain timestamps across copies, touch the final JAR file with the date and use last policy change date (2007/12/01) + +diff -Nru openjdk.orig/jdk/make/javax/crypto/Makefile openjdk/jdk/make/javax/crypto/Makefile +--- openjdk.orig/jdk/make/javax/crypto/Makefile 2015-07-22 03:26:28.454650441 +0100 ++++ openjdk/jdk/make/javax/crypto/Makefile 2015-07-22 03:27:45.521307098 +0100 +@@ -274,23 +274,25 @@ + policy/unlimited/default_US_export.policy \ + $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF + $(prep-target) +- $(CP) policy/unlimited/default_US_export.policy \ ++ $(CP) -p policy/unlimited/default_US_export.policy \ + $(TEMPDIR_UNLIMITED) + $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF \ + $(TEMPDIR_UNLIMITED)/default_US_export.policy + ( $(CD) $(TEMPDIR_UNLIMITED) && $(ZIPEXE) -Xr $@ META-INF \ + default_US_export.policy ) ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF $@ + + $(UNSIGNED_POLICY_BUILDDIR)/unlimited/local_policy.jar: \ + policy/unlimited/default_local.policy \ + $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF + $(prep-target) +- $(CP) policy/unlimited/default_local.policy \ ++ $(CP) -p policy/unlimited/default_local.policy \ + $(TEMPDIR_UNLIMITED) + $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF \ + $(TEMPDIR_UNLIMITED)/default_local.policy + ( $(CD) $(TEMPDIR_UNLIMITED) && $(ZIPEXE) -Xr $@ META-INF \ + default_local.policy ) ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF $@ + + $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF: \ + policy/unlimited/UNLIMITED +@@ -300,7 +302,7 @@ + $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF + $(CAT) policy/unlimited/UNLIMITED >> \ + $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF +- $(TOUCH) -t 198001010000 $(TEMPDIR_UNLIMITED)/META-INF ++ $(TOUCH) -t 200712010000 $(TEMPDIR_UNLIMITED)/META-INF + $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF \ + $(TEMPDIR_UNLIMITED)/META-INF/MANIFEST.MF + +@@ -316,16 +318,17 @@ + + $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \ + $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar +- $(install-file) ++ $(prep-target) ++ $(CP) -p $< $@ + + $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \ + policy/limited/default_local.policy \ + policy/limited/exempt_local.policy \ + $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF + $(prep-target) +- $(CP) policy/limited/default_local.policy \ ++ $(CP) -p policy/limited/default_local.policy \ + $(TEMPDIR_LIMITED) +- $(CP) policy/limited/exempt_local.policy \ ++ $(CP) -p policy/limited/exempt_local.policy \ + $(TEMPDIR_LIMITED) + $(TOUCH) -r $(TEMPDIR_LIMITED)/META-INF \ + $(TEMPDIR_LIMITED)/default_local.policy +@@ -333,6 +336,7 @@ + $(TEMPDIR_LIMITED)/exempt_local.policy + ( $(CD) $(TEMPDIR_UNLIMITED) && $(ZIPEXE) -Xr $@ META-INF \ + default_local.policy exempt_local.policy ) ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF $@ + + $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF: \ + policy/limited/LIMITED +@@ -342,9 +346,10 @@ + $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF + $(CAT) policy/limited/LIMITED >> \ + $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF +- $(TOUCH) -t 198001010000 $(TEMPDIR_LIMITED)/META-INF ++ $(TOUCH) -t 200712010000 $(TEMPDIR_LIMITED)/META-INF + $(TOUCH) -r $(TEMPDIR_LIMITED)/META-INF \ + $(TEMPDIR_LIMITED)/META-INF/MANIFEST.MF ++ $(TOUCH) -r $(TEMPDIR_UNLIMITED)/META-INF $@ + + UNSIGNED_POLICY_FILES = \ + $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar \ +@@ -472,7 +477,7 @@ + $(RM) \ + $(POLICY_DESTDIR)/US_export_policy.jar \ + $(POLICY_DESTDIR)/local_policy.jar +- $(CP) $^ $(POLICY_DESTDIR) ++ $(CP) -p $^ $(POLICY_DESTDIR) + ifndef OPENJDK + $(release-warning) + endif +@@ -484,7 +489,7 @@ + $(RM) \ + $(POLICY_DESTDIR)/US_export_policy.jar \ + $(POLICY_DESTDIR)/local_policy.jar +- $(CP) $^ $(POLICY_DESTDIR) ++ $(CP) -p $^ $(POLICY_DESTDIR) + ifndef OPENJDK + $(release-warning) + endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2481_sysconfig_clock_spaces.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,67 @@ +# HG changeset patch +# User andrew +# Date 1436295959 -3600 +# Tue Jul 07 20:05:59 2015 +0100 +# Node ID 014438c072c8bcb593e80dba4f6c703a3e9abc5b +# Parent db440b7618ee0d2bf6bf69a1e22653a5818cb41a +PR2481, RH489586, RH1236619: OpenJDK can't handle spaces in zone names in /etc/sysconfig/clock +Summary: Replace ' ' with '_' in zone name, as RHEL tools do. + +diff -Nrub openjdk.orig/jdk/src/solaris/native/java/util/TimeZone_md.c openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c +--- openjdk.orig/jdk/src/solaris/native/java/util/TimeZone_md.c 2015-07-22 03:29:30.915469980 +0100 ++++ openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c 2015-07-22 03:35:53.944793428 +0100 +@@ -52,7 +52,6 @@ + #ifdef __linux__ + + static const char *ETC_TIMEZONE_FILE = "/etc/timezone"; +-static const char *REDHAT_RELEASE_FILE = "/etc/redhat-release"; + static const char *SYSCONFIG_CLOCK_FILE = "/etc/sysconfig/clock"; + static const char *ZONEINFO_DIR = "/usr/share/zoneinfo"; + static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime"; +@@ -229,13 +228,6 @@ + /* + * Next, try the ZONE entry in /etc/sysconfig/clock. + */ +- if ((fp = fopen(REDHAT_RELEASE_FILE, "r")) != NULL) { +- char id[7]; +- +- /* Avoid this file on Fedora as may be buggy; RH489586 */ +- if (fgets(id, sizeof (id), fp) != NULL && +- strncmp(id, "Fedora", 6) != 0) { +- (void) fclose(fp); + if ((fp = fopen(SYSCONFIG_CLOCK_FILE, "r")) != NULL) { + char line[256]; + +@@ -266,8 +258,11 @@ + break; + } + } +- for (s = p; *s && *s != '"'; s++) +- ; ++ for (s = p; *s && *s != '"'; s++) { ++ /* Old files may contain spaces; RH489586 */ ++ if (*s == ' ') ++ *s = '_'; ++ } + if (*s != '"') { + /* this ZONE entry is broken. */ + break; +@@ -276,13 +271,16 @@ + tz = strdup(p); + break; + } ++ ++ if (fp != NULL) { + (void) fclose(fp); ++ fp = NULL; ++ } + if (tz != NULL) { + return tz; + } + } +- } +- } ++ + + /* + * Next, try /etc/localtime to find the zone ID.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2486-768_dh.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,52 @@ +# HG changeset patch +# User andrew +# Date 1428077961 -3600 +# Fri Apr 03 17:19:21 2015 +0100 +# Node ID 25ae097ee625609d0ca677afbcb4fa7669fd5ea4 +# Parent e7690bee9a7722b20bde481fb2da0bb6b903a258 +PR2486: JSSE server is still limited to 768-bit DHE +Summary: Alter 6956398 so that legacy mode is default and 1024-bit keys come with "jdk8" mode. + +diff -r e7690bee9a77 -r 25ae097ee625 src/share/classes/sun/security/ssl/ServerHandshaker.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Fri Apr 03 18:26:32 2015 +0100 ++++ openjdk/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Fri Apr 03 17:19:21 2015 +0100 +@@ -111,15 +111,15 @@ + String property = AccessController.doPrivileged( + new GetPropertyAction("jdk.tls.ephemeralDHKeySize")); + if (property == null || property.length() == 0) { +- useLegacyEphemeralDHKeys = false; ++ useLegacyEphemeralDHKeys = true; + useSmartEphemeralDHKeys = false; + customizedDHKeySize = -1; + } else if ("matched".equals(property)) { + useLegacyEphemeralDHKeys = false; + useSmartEphemeralDHKeys = true; + customizedDHKeySize = -1; +- } else if ("legacy".equals(property)) { +- useLegacyEphemeralDHKeys = true; ++ } else if ("jdk8".equals(property)) { ++ useLegacyEphemeralDHKeys = false; + useSmartEphemeralDHKeys = false; + customizedDHKeySize = -1; + } else { +@@ -1230,14 +1230,13 @@ + * 768 bits ephemeral DH private keys were used to be used in + * ServerKeyExchange except that exportable ciphers max out at 512 + * bits modulus values. We still adhere to this behavior in legacy +- * mode (system property "jdk.tls.ephemeralDHKeySize" is defined +- * as "legacy"). ++ * mode (system property "jdk.tls.ephemeralDHKeySize" ++ * is not defined). + * +- * Old JDK (JDK 7 and previous) releases don't support DH keys bigger +- * than 1024 bits. We have to consider the compatibility requirement. +- * 1024 bits DH key is always used for non-exportable cipher suites +- * in default mode (system property "jdk.tls.ephemeralDHKeySize" +- * is not defined). ++ * New JDK (JDK 8 and later) releases use a 1024 bit DH key for ++ * non-exportable cipher suites in default mode and this can ++ * be enabled when the system property "jdk.tls.ephemeralDHKeySize" ++ * is defined as "jdk8". + * + * However, if applications want more stronger strength, setting + * system property "jdk.tls.ephemeralDHKeySize" to "matched"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2488-1024_dh.patch Wed Jul 22 13:27:06 2015 +0100 @@ -0,0 +1,53 @@ +# HG changeset patch +# User andrew +# Date 1437347486 -3600 +# Mon Jul 20 00:11:26 2015 +0100 +# Node ID c1787ebf3df9ed96cd93bbd533ccf066418ade8a +# Parent ff3cd846027abce97fe5e7cc5a1df16fa6e5afc8 +PR2488: Make jdk8 mode the default for jdk.tls.ephemeralDHKeySize +Summary: Backout 45680a70921daf8a5929b890de22c2fa5d117d82 + +diff -r ff3cd846027a -r c1787ebf3df9 src/share/classes/sun/security/ssl/ServerHandshaker.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Sun Jul 19 18:19:29 2015 +0100 ++++ openjdk/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Mon Jul 20 00:11:26 2015 +0100 +@@ -120,15 +120,15 @@ + String property = AccessController.doPrivileged( + new GetPropertyAction("jdk.tls.ephemeralDHKeySize")); + if (property == null || property.length() == 0) { +- useLegacyEphemeralDHKeys = true; ++ useLegacyEphemeralDHKeys = false; + useSmartEphemeralDHKeys = false; + customizedDHKeySize = -1; + } else if ("matched".equals(property)) { + useLegacyEphemeralDHKeys = false; + useSmartEphemeralDHKeys = true; + customizedDHKeySize = -1; +- } else if ("jdk8".equals(property)) { +- useLegacyEphemeralDHKeys = false; ++ } else if ("legacy".equals(property)) { ++ useLegacyEphemeralDHKeys = true; + useSmartEphemeralDHKeys = false; + customizedDHKeySize = -1; + } else { +@@ -1253,14 +1253,15 @@ + * 768 bits ephemeral DH private keys were used to be used in + * ServerKeyExchange except that exportable ciphers max out at 512 + * bits modulus values. We still adhere to this behavior in legacy +- * mode (system property "jdk.tls.ephemeralDHKeySize" ++ * mode (system property "jdk.tls.ephemeralDHKeySize" is defined ++ * as "legacy"). ++ * ++ * Older versions of OpenJDK don't support DH keys bigger ++ * than 1024 bits. We have to consider the compatibility requirement. ++ * 1024 bits DH key is always used for non-exportable cipher suites ++ * in default mode (system property "jdk.tls.ephemeralDHKeySize" + * is not defined). + * +- * New JDK (JDK 8 and later) releases use a 1024 bit DH key for +- * non-exportable cipher suites in default mode and this can +- * be enabled when the system property "jdk.tls.ephemeralDHKeySize" +- * is defined as "jdk8". +- * + * However, if applications want more stronger strength, setting + * system property "jdk.tls.ephemeralDHKeySize" to "matched" + * is a workaround to use ephemeral DH key which size matches the