--- a/jdk/make/copy/Copy-java.base.gmk Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/copy/Copy-java.base.gmk Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 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
@@ -98,6 +98,8 @@
JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
else
JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
+ # Allow override by ALT_JVMCFG_SRC if it exists
+ JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC))
endif
JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
JVMCFG := $(JVMCFG_DIR)/jvm.cfg
--- a/jdk/make/data/tzdata/VERSION Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/data/tzdata/VERSION Fri Apr 03 13:46:22 2015 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2015a
+tzdata2015b
--- a/jdk/make/data/tzdata/asia Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/data/tzdata/asia Fri Apr 03 13:46:22 2015 -0700
@@ -1927,6 +1927,13 @@
# was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
# this is almost surely wrong.
+# From Ganbold Tsagaankhuu (2015-03-10):
+# It seems like yesterday Mongolian Government meeting has concluded to use
+# daylight saving time in Mongolia.... Starting at 2:00AM of last Saturday of
+# March 2015, daylight saving time starts. And 00:00AM of last Saturday of
+# September daylight saving time ends. Source:
+# http://zasag.mn/news/view/8969
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S
Rule Mongol 1983 only - Oct 1 0:00 0 -
@@ -1947,6 +1954,8 @@
Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S
Rule Mongol 2001 2006 - Sep lastSat 2:00 0 -
Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Sep lastSat 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -2365,13 +2374,19 @@
# official source...:
# http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
-# From Paul Eggert (2013-09-24):
-# For future dates, guess the last Thursday in March at 24:00 through
-# the first Friday on or after September 21 at 00:00. This is consistent with
-# the predictions in today's editions of the following URLs,
-# which are for Gaza and Hebron respectively:
-# http://www.timeanddate.com/worldclock/timezone.html?n=702
-# http://www.timeanddate.com/worldclock/timezone.html?n=2364
+# From Steffen Thorsen (2015-03-03):
+# Sources such as http://www.alquds.com/news/article/view/id/548257
+# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# start DST on 2015-03-28 00:00 which is one day later than expected.
+#
+# From Paul Eggert (2015-03-03):
+# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# says that the fall 2014 transition was Oct 23 at 24:00.
+# For future dates, guess the last Friday in March at 24:00 through
+# the first Friday on or after October 21 at 00:00. This is consistent with
+# the predictions in today's editions of the following URLs:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -2397,9 +2412,11 @@
Rule Palestine 2011 only - Aug 1 0:00 0 -
Rule Palestine 2011 only - Aug 30 0:00 1:00 S
Rule Palestine 2011 only - Sep 30 0:00 0 -
-Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S
+Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
Rule Palestine 2012 only - Sep 21 1:00 0 -
-Rule Palestine 2013 max - Sep Fri>=21 0:00 0 -
+Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
+Rule Palestine 2014 max - Oct Fri>=21 0:00 0 -
+Rule Palestine 2015 max - Mar lastFri 24:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
--- a/jdk/make/data/tzdata/australasia Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/data/tzdata/australasia Fri Apr 03 13:46:22 2015 -0700
@@ -396,6 +396,7 @@
9:39:00 - LMT 1901 # Agana
10:00 - GST 2000 Dec 23 # Guam
10:00 - ChST # Chamorro Standard Time
+Link Pacific/Guam Pacific/Saipan # N Mariana Is
# Kiribati
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -411,12 +412,7 @@
14:00 - LINT
# N Mariana Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Pacific/Saipan -14:17:00 - LMT 1844 Dec 31
- 9:43:00 - LMT 1901
- 9:00 - MPT 1969 Oct # N Mariana Is Time
- 10:00 - MPT 2000 Dec 23
- 10:00 - ChST # Chamorro Standard Time
+# See Pacific/Guam.
# Marshall Is
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -586,6 +582,7 @@
-11:00 - NST 1967 Apr # N=Nome
-11:00 - BST 1983 Nov 30 # B=Bering
-11:00 - SST # S=Samoa
+Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
# Samoa (formerly and also known as Western Samoa)
@@ -767,23 +764,7 @@
# uninhabited
# Midway
-#
-# From Mark Brader (2005-01-23):
-# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
-# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
-# reproduced a Pan American Airways timetable from 1936, for their weekly
-# "Orient Express" flights between San Francisco and Manila, and connecting
-# flights to Chicago and the US East Coast. As it uses some time zone
-# designations that I've never seen before:....
-# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I. H.L.T. Ar. 5:30P Sun.
-# " 3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A "
-#
-Zone Pacific/Midway -11:49:28 - LMT 1901
- -11:00 - NST 1956 Jun 3
- -11:00 1:00 NDT 1956 Sep 2
- -11:00 - NST 1967 Apr # N=Nome
- -11:00 - BST 1983 Nov 30 # B=Bering
- -11:00 - SST # S=Samoa
+# See Pacific/Pago_Pago.
# Palmyra
# uninhabited since World War II; was probably like Pacific/Kiritimati
--- a/jdk/make/data/tzdata/europe Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/data/tzdata/europe Fri Apr 03 13:46:22 2015 -0700
@@ -2423,7 +2423,7 @@
4:00 Russia VOL%sT 1989 Mar 26 2:00s # Volgograd T
3:00 Russia VOL%sT 1991 Mar 31 2:00s
4:00 - VOLT 1992 Mar 29 2:00s
- 3:00 Russia MSK 2011 Mar 27 2:00s
+ 3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK 2014 Oct 26 2:00s
3:00 - MSK
--- a/jdk/make/data/tzdata/northamerica Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/data/tzdata/northamerica Fri Apr 03 13:46:22 2015 -0700
@@ -2335,8 +2335,24 @@
# "...the new time zone will come into effect at two o'clock on the first Sunday
# of February, when we will have to advance the clock one hour from its current
# time..."
+# Also, the new zone will not use DST.
#
-# Also, the new zone will not use DST.
+# From Carlos Raúl Perasso (2015-02-02):
+# The decree that modifies the Mexican Hour System Law has finally
+# been published at the Diario Oficial de la Federación
+# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
+# It establishes 5 zones for Mexico:
+# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
+# includes most of Mexico, excluding what's mentioned below.
+# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
+# states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
+# de Banderas which lies in Central Zone); Sinaloa and Sonora.
+# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
+# state of Baja California.
+# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
+# of Quintana Roo.
+# 5- The islands, reefs and keys shall take their timezone from the
+# longitude they are located at.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mexico 1939 only - Feb 5 0:00 1:00 D
@@ -2531,14 +2547,9 @@
###############################################################################
# Anguilla
+# Antigua and Barbuda
# See America/Port_of_Spain.
-# Antigua and Barbuda
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
- -5:00 - EST 1951
- -4:00 - AST
-
# Bahamas
#
# For 1899 Milne gives -5:09:29.5; round that.
@@ -2604,10 +2615,7 @@
-4:00 US A%sT
# Cayman Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
- -5:07:11 - KMT 1912 Feb # Kingston Mean Time
- -5:00 - EST
+# See America/Panama.
# Costa Rica
@@ -3130,6 +3138,7 @@
Zone America/Panama -5:18:08 - LMT 1890
-5:19:36 - CMT 1908 Apr 22 # Colón Mean Time
-5:00 - EST
+Link America/Panama America/Cayman
# Puerto Rico
# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
--- a/jdk/make/data/tzdata/southamerica Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/data/tzdata/southamerica Fri Apr 03 13:46:22 2015 -0700
@@ -1229,10 +1229,13 @@
# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
-# From Juan Correa (2015-01-28):
-# ... today the Ministry of Energy announced that Chile will drop DST, will keep
-# "summer time" (UTC -3 / UTC -5) all year round....
-# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+# From Eduardo Romero Urra (2015-03-03):
+# Today has been published officially that Chile will use the DST time
+# permanently until March 25 of 2017
+# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
+#
+# From Paul Eggert (2015-03-03):
+# For now, assume that the extension will persist indefinitely.
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
@@ -1291,7 +1294,7 @@
-3:00 - CLT
Zone Pacific/Easter -7:17:44 - LMT 1890
-7:17:28 - EMT 1932 Sep # Easter Mean Time
- -7:00 Chile EAS%sT 1982 Mar 13 3:00u # Easter Time
+ -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time
-6:00 Chile EAS%sT 2015 Apr 26 3:00u
-5:00 - EAST
#
@@ -1626,6 +1629,7 @@
# These all agree with Trinidad and Tobago since 1970.
Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Antigua
Link America/Port_of_Spain America/Dominica
Link America/Port_of_Spain America/Grenada
Link America/Port_of_Spain America/Guadeloupe
--- a/jdk/make/lib/Awt2dLibraries.gmk Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/lib/Awt2dLibraries.gmk Fri Apr 03 13:46:22 2015 -0700
@@ -236,10 +236,6 @@
LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
endif
-ifeq ($(MILESTONE), internal)
- LIBAWT_CFLAGS += -DINTERNAL_BUILD
-endif
-
LIBAWT_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt/mapfile-vers
ifeq ($(OPENJDK_TARGET_OS), linux)
LIBAWT_MAPFILE :=
@@ -347,10 +343,6 @@
endif
endif
- ifeq ($(MILESTONE), internal)
- LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
- endif
-
LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/jdk/make/lib/CoreLibraries.gmk Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/lib/CoreLibraries.gmk Fri Apr 03 13:46:22 2015 -0700
@@ -269,7 +269,7 @@
LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO))
ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c
+ LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c ergo_i586.c
BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
@@ -317,12 +317,7 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \
- parentheses, \
- DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
- int-conversion, \
- DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
- DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
+ DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -371,7 +366,6 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -392,8 +386,6 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
- int-conversion, \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
--- a/jdk/make/mapfiles/libjava/reorder-sparc Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/mapfiles/libjava/reorder-sparc Fri Apr 03 13:46:22 2015 -0700
@@ -1,7 +1,6 @@
data = R0x2000;
text = LOAD ?RXO;
# Test Null
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%JNI_OnLoad;
text: .text%Canonicalize;
text: .text%canonicalize;
@@ -38,10 +37,9 @@
text: .text%Java_java_lang_System_identityHashCode;
text: .text%Java_sun_misc_Signal_findSignal;
text: .text%Java_sun_misc_Signal_handle0;
-text: .text%Java_java_io_FileSystem_getFileSystem;
text: .text%JNU_NewObjectByName;
text: .text%Java_java_io_UnixFileSystem_initIDs;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
text: .text%JNU_GetStringPlatformChars;
text: .text%JNU_ReleaseStringPlatformChars;
text: .text%Java_java_io_FileInputStream_open0;
@@ -52,27 +50,25 @@
text: .text%Java_java_io_FileInputStream_close0;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%statMode: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
-text: .text%Java_java_lang_Compiler_registerNatives;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
text: .text%Java_java_io_UnixFileSystem_list;
text: .text%JNU_ClassString;
text: .text%JNU_CopyObjectArray;
text: .text%Java_java_lang_String_intern;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
text: .text%Java_java_lang_Throwable_fillInStackTrace;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
text: .text%Java_java_io_UnixFileSystem_getLength;
text: .text%Java_java_lang_ClassLoader_defineClass0;
text: .text%VerifyClassCodes;
# Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
# Test Hello
text: .text%Java_java_io_FileOutputStream_writeBytes;
text: .text%writeBytes;
@@ -91,9 +87,7 @@
text: .text%JNU_CallMethodByName;
text: .text%JNU_CallMethodByNameV;
text: .text%Java_java_io_UnixFileSystem_createDirectory;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
# Test LoadJFrame
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
text: .text%Java_java_lang_Class_isInstance;
--- a/jdk/make/mapfiles/libjava/reorder-sparcv9 Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/mapfiles/libjava/reorder-sparcv9 Fri Apr 03 13:46:22 2015 -0700
@@ -1,7 +1,6 @@
data = R0x2000;
text = LOAD ?RXO;
# Test Null
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%JNI_OnLoad;
text: .text%Canonicalize;
text: .text%canonicalize;
@@ -30,9 +29,9 @@
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
text: .text%VerifyClassCodes;
text: .text%Java_java_lang_Throwable_fillInStackTrace;
@@ -41,10 +40,9 @@
text: .text%Java_java_lang_System_identityHashCode;
text: .text%Java_sun_misc_Signal_findSignal;
text: .text%Java_sun_misc_Signal_handle0;
-text: .text%Java_java_io_FileSystem_getFileSystem;
text: .text%JNU_NewObjectByName;
text: .text%Java_java_io_UnixFileSystem_initIDs;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
text: .text%JNU_GetStringPlatformChars;
text: .text%JNU_ReleaseStringPlatformChars;
text: .text%Java_java_io_FileInputStream_open0;
@@ -53,13 +51,11 @@
text: .text%readBytes;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_io_FileInputStream_close0;
-text: .text%Java_java_lang_Compiler_registerNatives;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
text: .text%Java_java_io_UnixFileSystem_list;
text: .text%JNU_ClassString;
text: .text%JNU_CopyObjectArray;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%statMode: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
@@ -68,7 +64,7 @@
text: .text%Java_java_lang_Object_getClass;
text: .text%Java_java_lang_ClassLoader_defineClass0;
# Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
# Test Hello
text: .text%Java_java_io_FileOutputStream_writeBytes;
text: .text%writeBytes;
@@ -88,9 +84,7 @@
text: .text%JNU_CallMethodByNameV;
text: .text%Java_java_io_UnixFileSystem_createDirectory;
text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
# Test LoadJFrame
text: .text%Java_java_lang_Class_isAssignableFrom;
text: .text%Java_java_lang_Class_isInstance;
--- a/jdk/make/mapfiles/libjava/reorder-x86 Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/mapfiles/libjava/reorder-x86 Fri Apr 03 13:46:22 2015 -0700
@@ -2,7 +2,6 @@
text = LOAD ?RXO;
# Test Null
text: .text%_init;
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%JNI_OnLoad;
text: .text%Canonicalize;
text: .text%canonicalize;
@@ -36,8 +35,6 @@
text: .text%Java_java_lang_Throwable_fillInStackTrace;
text: .text%Java_java_lang_System_setOut0;
text: .text%Java_java_lang_System_setErr0;
-text: .text%Java_java_lang_Compiler_registerNatives;
-text: .text%Java_java_io_FileSystem_getFileSystem;
text: .text%JNU_NewObjectByName;
text: .text%Java_java_io_UnixFileSystem_initIDs;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
@@ -46,17 +43,17 @@
text: .text%JNU_ReleaseStringPlatformChars;
text: .text%JNU_ClassString;
text: .text%JNU_CopyObjectArray;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%cpchars: OUTPUTDIR/System.o;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
text: .text%Java_java_io_FileInputStream_open0;
text: .text%fileOpen;
text: .text%Java_java_io_UnixFileSystem_getLength;
@@ -67,7 +64,7 @@
text: .text%Java_java_lang_ClassLoader_defineClass0;
text: .text%VerifyClassCodes;
# Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
# Test Hello
text: .text%Java_java_io_FileOutputStream_writeBytes;
text: .text%writeBytes;
@@ -93,9 +90,7 @@
text: .text%Java_java_io_FileOutputStream_open0;
text: .text%Java_java_io_UnixFileSystem_createDirectory;
text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
text: .text%Java_java_io_FileOutputStream_close0;
text: .text%Java_java_util_logging_FileHandler_unlockFile;
# Test LoadJFrame
--- a/jdk/make/mapfiles/libzip/reorder-sparcv9 Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/mapfiles/libzip/reorder-sparcv9 Fri Apr 03 13:46:22 2015 -0700
@@ -12,7 +12,6 @@
text: .text%ZIP_FindEntry;
text: .text%ZIP_GetEntry;
text: .text%ZIP_Lock;
-text: .text%readLOC: OUTPUTDIR/zip_util.o;
text: .text%ZIP_Unlock;
text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
@@ -37,7 +36,6 @@
text: .text%inflate;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
-text: .text%huft_build: OUTPUTDIR/inftrees.o;
text: .text%zcfree;
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
text: .text%ZIP_ReadEntry;
--- a/jdk/make/mapfiles/libzip/reorder-x86 Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/make/mapfiles/libzip/reorder-x86 Fri Apr 03 13:46:22 2015 -0700
@@ -13,7 +13,6 @@
text: .text%ZIP_FindEntry;
text: .text%ZIP_GetEntry;
text: .text%ZIP_Lock;
-text: .text%readLOC: OUTPUTDIR/zip_util.o;
text: .text%ZIP_Unlock;
text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
@@ -38,7 +37,6 @@
text: .text%inflate;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
-text: .text%huft_build: OUTPUTDIR/inftrees.o;
text: .text%zcfree;
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
text: .text%ZIP_ReadEntry;
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c Fri Apr 03 13:46:22 2015 -0700
@@ -852,7 +852,7 @@
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
pthread_join(tid, &tmp);
- rslt = (int)tmp;
+ rslt = (int)(intptr_t)tmp;
} else {
/*
* Continue execution in current thread if for some reason (e.g. out of
--- a/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 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
@@ -478,7 +478,6 @@
if (prolepticYear < getMinimumYear() || prolepticYear > getMaximumYear()) {
return false;
}
- int epochMonth = yearToEpochMonth((int) prolepticYear);
int len = getYearLength((int) prolepticYear);
return (len > 354);
}
@@ -659,7 +658,7 @@
}
/**
- * Return the maximum supported Hijrah ear.
+ * Return the maximum supported Hijrah year.
*
* @return the minimum
*/
--- a/jdk/src/java.base/share/classes/java/util/Calendar.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Calendar.java Fri Apr 03 13:46:22 2015 -0700
@@ -2083,17 +2083,33 @@
return null;
}
+ String calendarType = getCalendarType();
+ int fieldValue = get(field);
// the standalone and narrow styles are supported only through CalendarDataProviders.
- if (isStandaloneStyle(style) || isNarrowStyle(style)) {
- return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
- field, get(field),
- style, locale);
+ if (isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+ String val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+ field, fieldValue,
+ style, locale);
+ // Perform fallback here to follow the CLDR rules
+ if (val == null) {
+ if (isNarrowFormatStyle(style)) {
+ val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+ field, fieldValue,
+ toStandaloneStyle(style),
+ locale);
+ } else if (isStandaloneStyle(style)) {
+ val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+ field, fieldValue,
+ getBaseStyle(style),
+ locale);
+ }
+ }
+ return val;
}
DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
String[] strings = getFieldStrings(field, style, symbols);
if (strings != null) {
- int fieldValue = get(field);
if (fieldValue < strings.length) {
return strings[fieldValue];
}
@@ -2155,10 +2171,26 @@
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
- if (style == ALL_STYLES || isStandaloneStyle(style)) {
- return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
+
+ String calendarType = getCalendarType();
+ if (style == ALL_STYLES || isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+ Map<String, Integer> map;
+ map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field, style, locale);
+
+ // Perform fallback here to follow the CLDR rules
+ if (map == null) {
+ if (isNarrowFormatStyle(style)) {
+ map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
+ toStandaloneStyle(style), locale);
+ } else if (style != ALL_STYLES) {
+ map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
+ getBaseStyle(style), locale);
+ }
+ }
+ return map;
}
- // SHORT, LONG, or NARROW
+
+ // SHORT or LONG
return getDisplayNamesImpl(field, style, locale);
}
@@ -2544,14 +2576,22 @@
return style & ~STANDALONE_MASK;
}
- boolean isStandaloneStyle(int style) {
+ private int toStandaloneStyle(int style) {
+ return style | STANDALONE_MASK;
+ }
+
+ private boolean isStandaloneStyle(int style) {
return (style & STANDALONE_MASK) != 0;
}
- boolean isNarrowStyle(int style) {
+ private boolean isNarrowStyle(int style) {
return style == NARROW_FORMAT || style == NARROW_STANDALONE;
}
+ private boolean isNarrowFormatStyle(int style) {
+ return style == NARROW_FORMAT;
+ }
+
/**
* Returns the pseudo-time-stamp for two fields, given their
* individual pseudo-time-stamps. If either of the fields
--- a/jdk/src/java.base/share/classes/java/util/HashMap.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/java/util/HashMap.java Fri Apr 03 13:46:22 2015 -0700
@@ -1082,6 +1082,16 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * mapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * mapping function modified this map
+ */
@Override
public V computeIfAbsent(K key,
Function<? super K, ? extends V> mappingFunction) {
@@ -1115,7 +1125,9 @@
return oldValue;
}
}
+ int mc = modCount;
V v = mappingFunction.apply(key);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (v == null) {
return null;
} else if (old != null) {
@@ -1130,12 +1142,23 @@
if (binCount >= TREEIFY_THRESHOLD - 1)
treeifyBin(tab, hash);
}
- ++modCount;
+ modCount = mc + 1;
++size;
afterNodeInsertion(true);
return v;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
+ @Override
public V computeIfPresent(K key,
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
if (remappingFunction == null)
@@ -1144,7 +1167,9 @@
int hash = hash(key);
if ((e = getNode(hash, key)) != null &&
(oldValue = e.value) != null) {
+ int mc = modCount;
V v = remappingFunction.apply(key, oldValue);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (v != null) {
e.value = v;
afterNodeAccess(e);
@@ -1156,6 +1181,16 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public V compute(K key,
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
@@ -1185,7 +1220,9 @@
}
}
V oldValue = (old == null) ? null : old.value;
+ int mc = modCount;
V v = remappingFunction.apply(key, oldValue);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (old != null) {
if (v != null) {
old.value = v;
@@ -1202,13 +1239,23 @@
if (binCount >= TREEIFY_THRESHOLD - 1)
treeifyBin(tab, hash);
}
- ++modCount;
+ modCount = mc + 1;
++size;
afterNodeInsertion(true);
}
return v;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public V merge(K key, V value,
BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
@@ -1241,10 +1288,15 @@
}
if (old != null) {
V v;
- if (old.value != null)
+ if (old.value != null) {
+ int mc = modCount;
v = remappingFunction.apply(old.value, value);
- else
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
+ } else {
v = value;
+ }
if (v != null) {
old.value = v;
afterNodeAccess(old);
--- a/jdk/src/java.base/share/classes/java/util/Hashtable.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Hashtable.java Fri Apr 03 13:46:22 2015 -0700
@@ -1000,6 +1000,16 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the mapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * mapping function modified this map
+ */
@Override
public synchronized V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
Objects.requireNonNull(mappingFunction);
@@ -1016,7 +1026,9 @@
}
}
+ int mc = modCount;
V newValue = mappingFunction.apply(key);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (newValue != null) {
addEntry(hash, key, newValue, index);
}
@@ -1024,6 +1036,16 @@
return newValue;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the remapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public synchronized V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1035,14 +1057,18 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash == hash && e.key.equals(key)) {
+ int mc = modCount;
V newValue = remappingFunction.apply(key, e.value);
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
if (newValue == null) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
- modCount++;
+ modCount = mc + 1;
count--;
} else {
e.value = newValue;
@@ -1052,7 +1078,16 @@
}
return null;
}
-
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the remapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public synchronized V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1064,14 +1099,18 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash == hash && Objects.equals(e.key, key)) {
+ int mc = modCount;
V newValue = remappingFunction.apply(key, e.value);
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
if (newValue == null) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
- modCount++;
+ modCount = mc + 1;
count--;
} else {
e.value = newValue;
@@ -1080,7 +1119,9 @@
}
}
+ int mc = modCount;
V newValue = remappingFunction.apply(key, null);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (newValue != null) {
addEntry(hash, key, newValue, index);
}
@@ -1088,6 +1129,16 @@
return newValue;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the remapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public synchronized V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1099,14 +1150,18 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash == hash && e.key.equals(key)) {
+ int mc = modCount;
V newValue = remappingFunction.apply(e.value, value);
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
if (newValue == null) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
- modCount++;
+ modCount = mc + 1;
count--;
} else {
e.value = newValue;
--- a/jdk/src/java.base/share/classes/java/util/Map.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Map.java Fri Apr 03 13:46:22 2015 -0700
@@ -894,8 +894,8 @@
* to {@code null}), attempts to compute its value using the given mapping
* function and enters it into this map unless {@code null}.
*
- * <p>If the function returns {@code null} no mapping is recorded. If
- * the function itself throws an (unchecked) exception, the
+ * <p>If the mapping function returns {@code null}, no mapping is recorded.
+ * If the mapping function itself throws an (unchecked) exception, the
* exception is rethrown, and no mapping is recorded. The most
* common usage is to construct a new object serving as an initial
* mapped value or memoized result, as in:
@@ -911,6 +911,7 @@
* map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);
* }</pre>
*
+ * <p>The mapping function should not modify this map during computation.
*
* @implSpec
* The default implementation is equivalent to the following steps for this
@@ -925,16 +926,27 @@
* }
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * mapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * mapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * mapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the mapping function is applied once atomically only if the value
+ * is not present.
*
* @param key key with which the specified value is to be associated
- * @param mappingFunction the function to compute a value
+ * @param mappingFunction the mapping function to compute a value
* @return the current (existing or computed) value associated with
* the specified key, or null if the computed value is null
* @throws NullPointerException if the specified key is null and
@@ -967,10 +979,12 @@
* If the value for the specified key is present and non-null, attempts to
* compute a new mapping given the key and its current mapped value.
*
- * <p>If the function returns {@code null}, the mapping is removed. If the
- * function itself throws an (unchecked) exception, the exception is
- * rethrown, and the current mapping is left unchanged.
- *
+ * <p>If the remapping function returns {@code null}, the mapping is removed.
+ * If the remapping function itself throws an (unchecked) exception, the
+ * exception is rethrown, and the current mapping is left unchanged.
+ *
+ * <p>The remapping function should not modify this map during computation.
+ *
* @implSpec
* The default implementation is equivalent to performing the following
* steps for this {@code map}, then returning the current value or
@@ -987,16 +1001,27 @@
* }
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * remapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * remapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the remapping function is applied once atomically only if the
+ * value is not present.
*
* @param key key with which the specified value is to be associated
- * @param remappingFunction the function to compute a value
+ * @param remappingFunction the remapping function to compute a value
* @return the new value associated with the specified key, or null if none
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the
@@ -1037,10 +1062,12 @@
* map.compute(key, (k, v) -> (v == null) ? msg : v.concat(msg))}</pre>
* (Method {@link #merge merge()} is often simpler to use for such purposes.)
*
- * <p>If the function returns {@code null}, the mapping is removed (or
- * remains absent if initially absent). If the function itself throws an
- * (unchecked) exception, the exception is rethrown, and the current mapping
- * is left unchanged.
+ * <p>If the remapping function returns {@code null}, the mapping is removed
+ * (or remains absent if initially absent). If the remapping function
+ * itself throws an (unchecked) exception, the exception is rethrown, and
+ * the current mapping is left unchanged.
+ *
+ * <p>The remapping function should not modify this map during computation.
*
* @implSpec
* The default implementation is equivalent to performing the following
@@ -1063,16 +1090,27 @@
* }
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * remapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * remapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the remapping function is applied once atomically only if the
+ * value is not present.
*
* @param key key with which the specified value is to be associated
- * @param remappingFunction the function to compute a value
+ * @param remappingFunction the remapping function to compute a value
* @return the new value associated with the specified key, or null if none
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the
@@ -1121,9 +1159,11 @@
* map.merge(key, msg, String::concat)
* }</pre>
*
- * <p>If the function returns {@code null} the mapping is removed. If the
- * function itself throws an (unchecked) exception, the exception is
- * rethrown, and the current mapping is left unchanged.
+ * <p>If the remapping function returns {@code null}, the mapping is removed.
+ * If the remapping function itself throws an (unchecked) exception, the
+ * exception is rethrown, and the current mapping is left unchanged.
+ *
+ * <p>The remapping function should not modify this map during computation.
*
* @implSpec
* The default implementation is equivalent to performing the following
@@ -1140,19 +1180,31 @@
* map.put(key, newValue);
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * remapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * remapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the remapping function is applied once atomically only if the
+ * value is not present.
*
* @param key key with which the resulting value is to be associated
* @param value the non-null value to be merged with the existing value
* associated with the key or, if no existing value or a null value
* is associated with the key, to be associated with the key
- * @param remappingFunction the function to recompute a value if present
+ * @param remappingFunction the remapping function to recompute a value if
+ * present
* @return the new value associated with the specified key, or null if no
* value is associated with the key
* @throws UnsupportedOperationException if the {@code put} operation
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java Fri Apr 03 13:46:22 2015 -0700
@@ -45,9 +45,4 @@
ReflectUtil.checkPackageAccess(cls);
return cls.getFields();
}
-
- public static Field[] getDeclaredFields(Class<?> cls) {
- ReflectUtil.checkPackageAccess(cls);
- return cls.getDeclaredFields();
- }
}
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Fri Apr 03 13:46:22 2015 -0700
@@ -625,6 +625,15 @@
params[2] = 5;
params[3] = 86400000;
}
+ // Additional check for startDayOfWeek=6 and starTime=86400000
+ // is needed for Asia/Amman; Asia/Gasa and Asia/Hebron
+ if (params[2] == 7 && params[3] == 0 &&
+ (zoneId.equals("Asia/Amman") ||
+ zoneId.equals("Asia/Gaza") ||
+ zoneId.equals("Asia/Hebron"))) {
+ params[2] = 6; // Friday
+ params[3] = 86400000; // 24h
+ }
//endDayOfWeek and endTime workaround
if (params[7] == 6 && params[8] == 0 &&
(zoneId.equals("Africa/Cairo"))) {
--- a/jdk/src/java.base/share/native/libjli/java.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/native/libjli/java.c Fri Apr 03 13:46:22 2015 -0700
@@ -730,7 +730,7 @@
static int
parse_size(const char *s, jlong *result) {
jlong n = 0;
- int args_read = sscanf(s, jlong_format_specifier(), &n);
+ int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
if (args_read != 1) {
return 0;
}
@@ -798,7 +798,7 @@
* overflow before the JVM startup code can check to make sure the stack
* is big enough.
*/
- if (threadStackSize < STACK_SIZE_MINIMUM) {
+ if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) {
threadStackSize = STACK_SIZE_MINIMUM;
}
}
--- a/jdk/src/java.base/share/native/libjli/java.h Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/native/libjli/java.h Fri Apr 03 13:46:22 2015 -0700
@@ -144,8 +144,6 @@
void JLI_ReportExceptionDescription(JNIEnv * env);
void PrintMachineDependentOptions();
-const char *jlong_format_specifier();
-
/*
* Block current thread and continue execution in new thread
*/
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -133,7 +133,7 @@
/** Reads count bytes from fd at position pos into given buffer. */
static jboolean
-readAt(int fd, jlong pos, size_t count, void *buf) {
+readAt(int fd, jlong pos, unsigned int count, void *buf) {
return (pos >= 0
&& JLI_Lseek(fd, pos, SEEK_SET) == pos
&& read(fd, buf, count) == (jlong) count);
@@ -249,7 +249,7 @@
*/
if ((pos = JLI_Lseek(fd, -ENDHDR, SEEK_END)) < (jlong)0)
return (-1);
- if ((bytes = read(fd, eb, ENDHDR)) < 0)
+ if (read(fd, eb, ENDHDR) < 0)
return (-1);
if (ENDSIG_AT(eb)) {
return find_positions64(fd, eb, pos, base_offset, censtart);
@@ -268,7 +268,13 @@
return (-1);
if ((buffer = malloc(END_MAXLEN)) == NULL)
return (-1);
- if ((bytes = read(fd, buffer, len)) < 0) {
+
+ /*
+ * read() on windows takes an unsigned int for count. Casting len
+ * to an unsigned int here is safe since it is guaranteed to be
+ * less than END_MAXLEN.
+ */
+ if ((bytes = read(fd, buffer, (unsigned int)len)) < 0) {
free(buffer);
return (-1);
}
@@ -591,7 +597,7 @@
info->jre_version = NULL;
info->jre_restrict_search = 0;
info->splashscreen_image_file_name = NULL;
- if (rc = find_file(fd, &entry, manifest_name) != 0) {
+ if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd);
return (-2);
}
@@ -692,7 +698,7 @@
return (-1);
}
- if (rc = find_file(fd, &entry, manifest_name) != 0) {
+ if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd);
return (-2);
}
--- a/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -61,11 +61,11 @@
#define INVOKEV(name) _INVOKE(name, ,;)
int DoSplashLoadMemory(void* pdata, int size) {
- INVOKE(SplashLoadMemory, NULL)(pdata, size);
+ INVOKE(SplashLoadMemory, 0)(pdata, size);
}
int DoSplashLoadFile(const char* filename) {
- INVOKE(SplashLoadFile, NULL)(filename);
+ INVOKE(SplashLoadFile, 0)(filename);
}
void DoSplashInit(void) {
@@ -87,4 +87,4 @@
char* DoSplashGetScaledImageName(const char* fileName, const char* jarName,
float* scaleFactor) {
INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
-}
\ No newline at end of file
+}
--- a/jdk/src/java.base/share/native/libjli/wildcard.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/share/native/libjli/wildcard.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -274,7 +274,7 @@
}
static void
-FileList_addSubstring(FileList fl, const char *beg, int len)
+FileList_addSubstring(FileList fl, const char *beg, size_t len)
{
char *filename = (char *) JLI_MemAlloc(len+1);
memcpy(filename, beg, len);
@@ -310,7 +310,7 @@
FileList_split(const char *path, char sep)
{
const char *p, *q;
- int len = (int)JLI_StrLen(path);
+ size_t len = JLI_StrLen(path);
int count;
FileList fl;
for (count = 1, p = path; p < path + len; p++)
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Fri Apr 03 13:46:22 2015 -0700
@@ -285,8 +285,6 @@
* 1 - fork(2) and exec(2)
* 2 - posix_spawn(3P)
* 3 - vfork(2) and exec(2)
- *
- * (4 - clone(2) and exec(2) - obsolete and currently disabled in native code)
* </pre>
* @param fds an array of three file descriptors.
* Indexes 0, 1, and 2 correspond to standard input,
--- a/jdk/src/java.base/unix/conf/arm/jvm.cfg Wed Mar 25 18:33:17 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright (c) 2011, 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-# List of JVMs that can be used as an option to java, javac, etc.
-# Order is important -- first in this list is the default JVM.
-# NOTE that this both this file and its format are UNSUPPORTED and
-# WILL GO AWAY in a future release.
-#
-# You may also select a JVM in an arbitrary location with the
-# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
-# and may not be available in a future release.
-#
--client IF_SERVER_CLASS -server
--server KNOWN
--minimal KNOWN
--- a/jdk/src/java.base/unix/conf/ppc/jvm.cfg Wed Mar 25 18:33:17 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright (c) 2011, 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-# List of JVMs that can be used as an option to java, javac, etc.
-# Order is important -- first in this list is the default JVM.
-# NOTE that this both this file and its format are UNSUPPORTED and
-# WILL GO AWAY in a future release.
-#
-# You may also select a JVM in an arbitrary location with the
-# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
-# and may not be available in a future release.
-#
--client KNOWN
--server KNOWN
--minimal KNOWN
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Fri Apr 03 13:46:22 2015 -0700
@@ -97,8 +97,7 @@
* address space temporarily, before launching the target command.
*
* Based on the above analysis, we are currently using vfork() on
- * Linux and spawn() on other Unix systems, but the code to use clone()
- * and fork() remains.
+ * Linux and posix_spawn() on other Unix systems.
*/
@@ -385,39 +384,13 @@
}
/**
- * We are unusually paranoid; use of clone/vfork is
+ * We are unusually paranoid; use of vfork is
* especially likely to tickle gcc/glibc bugs.
*/
#ifdef __attribute_noinline__ /* See: sys/cdefs.h */
__attribute_noinline__
#endif
-#define START_CHILD_USE_CLONE 0 /* clone() currently disabled; see above. */
-
-#ifdef START_CHILD_USE_CLONE
-static pid_t
-cloneChild(ChildStuff *c) {
-#ifdef __linux__
-#define START_CHILD_CLONE_STACK_SIZE (64 * 1024)
- /*
- * See clone(2).
- * Instead of worrying about which direction the stack grows, just
- * allocate twice as much and start the stack in the middle.
- */
- if ((c->clone_stack = malloc(2 * START_CHILD_CLONE_STACK_SIZE)) == NULL)
- /* errno will be set to ENOMEM */
- return -1;
- return clone(childProcess,
- c->clone_stack + START_CHILD_CLONE_STACK_SIZE,
- CLONE_VFORK | CLONE_VM | SIGCHLD, c);
-#else
-/* not available on Solaris / Mac */
- assert(0);
- return -1;
-#endif
-}
-#endif
-
static pid_t
vforkChild(ChildStuff *c) {
volatile pid_t resultPid;
@@ -590,12 +563,11 @@
c->argv = NULL;
c->envv = NULL;
c->pdir = NULL;
- c->clone_stack = NULL;
/* Convert prog + argBlock into a char ** argv.
* Add one word room for expansion of argv for use by
* execve_as_traditional_shell_script.
- * This word is also used when using spawn mode
+ * This word is also used when using posix_spawn mode
*/
assert(prog != NULL && argBlock != NULL);
if ((phelperpath = getBytes(env, helperpath)) == NULL) goto Catch;
@@ -654,7 +626,7 @@
throwIOException(env, errno, "fork failed");
break;
case MODE_POSIX_SPAWN:
- throwIOException(env, errno, "spawn failed");
+ throwIOException(env, errno, "posix_spawn failed");
break;
}
goto Catch;
@@ -677,8 +649,6 @@
fds[2] = (err[0] != -1) ? err[0] : -1;
Finally:
- free(c->clone_stack);
-
/* Always clean up the child's side of the pipes */
closeSafely(in [0]);
closeSafely(out[1]);
--- a/jdk/src/java.base/unix/native/libjava/childproc.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjava/childproc.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -304,7 +304,7 @@
}
/**
- * Child process after a successful fork() or clone().
+ * Child process after a successful fork().
* This function must not return, and must be prepared for either all
* of its address space to be shared with its parent, or to be a copy.
* It must not modify global variables such as "environ".
--- a/jdk/src/java.base/unix/native/libjava/childproc.h Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjava/childproc.h Fri Apr 03 13:46:22 2015 -0700
@@ -101,7 +101,6 @@
const char **envv;
const char *pdir;
int redirectErrorStream;
- void *clone_stack;
} ChildStuff;
/* following used in addition when mode is SPAWN */
--- a/jdk/src/java.base/unix/native/libjava/jni_util_md.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjava/jni_util_md.c Fri Apr 03 13:46:22 2015 -0700
@@ -55,10 +55,12 @@
size_t
getLastErrorString(char *buf, size_t len)
{
+ char *err;
+ size_t n;
if (errno == 0 || len < 1) return 0;
- const char *err = strerror(errno);
- size_t n = strlen(err);
+ err = strerror(errno);
+ n = strlen(err);
if (n >= len)
n = len - 1;
--- a/jdk/src/java.base/unix/native/libjli/java_md.h Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -43,6 +43,12 @@
#define MAXNAMELEN PATH_MAX
#endif
+#ifdef _LP64
+#define JLONG_FORMAT_SPECIFIER "%ld"
+#else
+#define JLONG_FORMAT_SPECIFIER "%lld"
+#endif
+
int UnsetEnv(char *name);
char *FindExecName(char *program);
const char *SetExecname(char **argv);
--- a/jdk/src/java.base/unix/native/libjli/java_md_common.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjli/java_md_common.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, 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
@@ -269,11 +269,6 @@
return(borrowed_unsetenv(name));
}
-const char *
-jlong_format_specifier() {
- return "%lld";
-}
-
jboolean
IsJavaw()
{
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -888,7 +888,7 @@
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
pthread_join(tid, &tmp);
- rslt = (int)tmp;
+ rslt = (int)(intptr_t)tmp;
} else {
/*
* Continue execution in current thread if for some reason (e.g. out of
@@ -906,7 +906,7 @@
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
void * tmp;
thr_join(tid, NULL, &tmp);
- rslt = (int)tmp;
+ rslt = (int)(intptr_t)tmp;
} else {
/* See above. Continue in current thread if thr_create() failed */
rslt = continuation(args);
--- a/jdk/src/java.base/windows/native/libjli/cmdtoargs.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/windows/native/libjli/cmdtoargs.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 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
@@ -77,7 +77,7 @@
USHORT ch = 0;
int i;
jboolean done = JNI_FALSE;
- int charLength;
+ ptrdiff_t charLength;
*wildcard = JNI_FALSE;
while (!done) {
@@ -208,10 +208,12 @@
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard;
- *arg = NULL;
+ *arg = '\0';
nargs++;
} while (src != NULL);
+ JLI_MemFree(arg);
+
stdargc = nargs;
stdargs = argv;
}
--- a/jdk/src/java.base/windows/native/libjli/java_md.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -107,7 +107,7 @@
* GetParamValue("theParam", "theParam=value") returns pointer to "value".
*/
const char * GetParamValue(const char *paramName, const char *arg) {
- int nameLen = JLI_StrLen(paramName);
+ size_t nameLen = JLI_StrLen(paramName);
if (JLI_StrNCmp(paramName, arg, nameLen) == 0) {
/* arg[nameLen] is valid (may contain final NULL) */
if (arg[nameLen] == '=') {
@@ -561,7 +561,7 @@
if (rc < 0) {
/* apply ansi semantics */
buffer[size - 1] = '\0';
- return size;
+ return (int)size;
} else if (rc == size) {
/* force a null terminator */
buffer[size - 1] = '\0';
@@ -728,11 +728,6 @@
}
}
-const char *
-jlong_format_specifier() {
- return "%I64d";
-}
-
/*
* Block current thread and continue execution in a new thread
*/
@@ -882,7 +877,7 @@
if (hPreloadAwt == NULL) {
/* awt.dll is not loaded yet */
char libraryPath[MAXPATHLEN];
- int jrePathLen = 0;
+ size_t jrePathLen = 0;
HMODULE hJava = NULL;
HMODULE hVerify = NULL;
@@ -1004,7 +999,8 @@
jobjectArray
CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
{
- int i, j, idx, tlen;
+ int i, j, idx;
+ size_t tlen;
jobjectArray outArray, inArray;
char *ostart, *astart, **nargv;
jboolean needs_expansion = JNI_FALSE;
--- a/jdk/src/java.base/windows/native/libjli/java_md.h Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.base/windows/native/libjli/java_md.h Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -39,6 +39,7 @@
#define MAXPATHLEN MAX_PATH
#define MAXNAMELEN MAX_PATH
+#define JLONG_FORMAT_SPECIFIER "%I64d"
/*
* Support for doing cheap, accurate interval timing.
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java Fri Apr 03 13:46:22 2015 -0700
@@ -44,7 +44,6 @@
import sun.lwawt.macosx.*;
public final class CFontManager extends SunFontManager {
- private FontConfigManager fcManager = null;
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
@Override
@@ -231,15 +230,6 @@
return font2D;
}
- /*
- public synchronized FontConfigManager getFontConfigManager() {
- if (fcManager == null) {
- fcManager = new FontConfigManager();
- }
- return fcManager;
- }
- */
-
protected void registerFontsInDir(String dirName, boolean useJavaRasterizer, int fontRank, boolean defer, boolean resolveSymLinks) {
loadNativeDirFonts(dirName);
super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeFont.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font;
+
+import java.awt.FontFormatException;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/*
+ * This class should never be invoked on the windows implementation
+ * So the constructor throws a FontFormatException, which is caught
+ * and the font is ignored.
+ */
+
+public class NativeFont extends PhysicalFont {
+
+ /**
+ * Verifies native font is accessible.
+ * @throws FontFormatException - if the font can't be located.
+ */
+ public NativeFont(String platName, boolean isBitmapDelegate)
+ throws FontFormatException {
+
+ throw new FontFormatException("NativeFont not used on OS X");
+ }
+
+ static boolean hasExternalBitmaps(String platName) {
+ return false;
+ }
+
+ public CharToGlyphMapper getMapper() {
+ return null;
+ }
+
+ PhysicalFont getDelegateFont() {
+ return null;
+ }
+
+ FontStrike createStrike(FontStrikeDesc desc) {
+ return null;
+ }
+
+ public Rectangle2D getMaxCharBounds(FontRenderContext frc) {
+ return null;
+ }
+
+ StrikeMetrics getFontMetrics(long pScalerContext) {
+ return null;
+ }
+
+ public GeneralPath getGlyphOutline(long pScalerContext,
+ int glyphCode,
+ float x, float y) {
+ return null;
+ }
+
+ public GeneralPath getGlyphVectorOutline(long pScalerContext,
+ int[] glyphs, int numGlyphs,
+ float x, float y) {
+ return null;
+ }
+
+
+ long getGlyphImage(long pScalerContext, int glyphCode) {
+ return 0L;
+ }
+
+
+ void getGlyphMetrics(long pScalerContext, int glyphCode,
+ Point2D.Float metrics) {
+ }
+
+
+ float getGlyphAdvance(long pScalerContext, int glyphCode) {
+ return 0f;
+ }
+
+ Rectangle2D.Float getGlyphOutlineBounds(long pScalerContext,
+ int glyphCode) {
+ return new Rectangle2D.Float(0f, 0f, 0f, 0f);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeStrike.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font;
+
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+
+public class NativeStrike extends PhysicalStrike {
+
+ NativeFont nativeFont;
+
+ NativeStrike(NativeFont nativeFont, FontStrikeDesc desc) {
+ super(nativeFont, desc);
+
+ throw new RuntimeException("NativeFont not used on OS X");
+ }
+
+ NativeStrike(NativeFont nativeFont, FontStrikeDesc desc,
+ boolean nocache) {
+ super(nativeFont, desc);
+
+ throw new RuntimeException("NativeFont not used on Windows");
+ }
+
+
+ void getGlyphImagePtrs(int[] glyphCodes, long[] images,int len) {
+ }
+
+ long getGlyphImagePtr(int glyphCode) {
+ return 0L;
+ }
+
+ long getGlyphImagePtrNoCache(int glyphCode) {
+ return 0L;
+ }
+
+ void getGlyphImageBounds(int glyphcode,
+ Point2D.Float pt,
+ Rectangle result) {
+ }
+
+ Point2D.Float getGlyphMetrics(int glyphCode) {
+ return null;
+ }
+
+ float getGlyphAdvance(int glyphCode) {
+ return 0f;
+ }
+
+ Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
+ return null;
+ }
+ GeneralPath getGlyphOutline(int glyphCode, float x, float y) {
+ return null;
+ }
+
+ GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) {
+ return null;
+ }
+
+}
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Fri Apr 03 13:46:22 2015 -0700
@@ -311,7 +311,10 @@
}
- (BOOL) performKeyEquivalent: (NSEvent *) event {
- [self deliverJavaKeyEventHelper: event];
+ // if IM is active key events should be ignored
+ if (![self hasMarkedText] && !fInPressAndHold) {
+ [self deliverJavaKeyEventHelper: event];
+ }
// Workaround for 8020209: special case for "Cmd =" and "Cmd ."
// because Cocoa calls performKeyEquivalent twice for these keystrokes
--- a/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m Fri Apr 03 13:46:22 2015 -0700
@@ -126,14 +126,28 @@
return buf;
}
+BOOL isSWTRunning() {
+ char envVar[80];
+ // If this property is present we are running SWT
+ snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+ return getenv(envVar) != NULL;
+}
+
char* SplashGetScaledImageName(const char* jar, const char* file,
float *scaleFactor) {
+ *scaleFactor = 1;
+
+ if(isSWTRunning()){
+ return nil;
+ }
+
NSAutoreleasePool *pool = [NSAutoreleasePool new];
- *scaleFactor = 1;
char* scaledFile = nil;
__block float screenScaleFactor = 1;
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+ // initialize NSApplication and AWT stuff
+ [NSApplicationAWT sharedApplication];
screenScaleFactor = [SplashNSScreen() backingScaleFactor];
}];
@@ -180,12 +194,8 @@
splash->screenFormat.byteOrder = 1 ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
splash->screenFormat.depthBytes = 4;
- // If this property is present we are running SWT and should not start a runLoop
- // Can't check if running SWT in webstart, so splash screen in webstart SWT
- // applications is not supported
- char envVar[80];
- snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
- if (getenv(envVar) == NULL) {
+ // If we are running SWT we should not start a runLoop
+ if (!isSWTRunning()) {
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
[NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
}];
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java Fri Apr 03 13:46:22 2015 -0700
@@ -225,7 +225,7 @@
}
public short readShort() throws IOException {
- if (read(byteBuf, 0, 2) < 0) {
+ if (read(byteBuf, 0, 2) != 2) {
throw new EOFException();
}
@@ -247,7 +247,7 @@
}
public int readInt() throws IOException {
- if (read(byteBuf, 0, 4) < 0) {
+ if (read(byteBuf, 0, 4) != 4) {
throw new EOFException();
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri Apr 03 13:46:22 2015 -0700
@@ -308,14 +308,14 @@
public Dimension getPreferredSize(JComponent c) {
recalculateIfInsetsChanged();
Dimension d = new Dimension(contentRect.width, contentRect.height);
+ Insets i = slider.getInsets();
if (slider.getOrientation() == JSlider.VERTICAL) {
d.height = 200;
+ d.height += i.top + i.bottom;
} else {
d.width = 200;
+ d.width += i.left + i.right;
}
- Insets i = slider.getInsets();
- d.width += i.left + i.right;
- d.height += i.top + i.bottom;
return d;
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java Fri Apr 03 13:46:22 2015 -0700
@@ -439,6 +439,26 @@
return tip;
}
+ /**
+ * Returns the preferred size of the table header.
+ * This is the size required to display the header and requested for
+ * the viewport.
+ * The returned {@code Dimension} {@code width} will always be calculated by
+ * the underlying TableHeaderUI, regardless of any width specified by
+ * {@link JComponent#setPreferredSize(java.awt.Dimension)}
+ *
+ * @return the size
+ */
+ @Override
+ public Dimension getPreferredSize() {
+ Dimension preferredSize = super.getPreferredSize();
+ if (isPreferredSizeSet() && ui != null) {
+ Dimension size = ui.getPreferredSize(this);
+ if (size != null) preferredSize.width = size.width;
+ }
+ return preferredSize;
+ }
+
//
// Managing TableHeaderUI
//
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Fri Apr 03 13:46:22 2015 -0700
@@ -368,9 +368,9 @@
if (length > CONV_BUFFER_SIZE-1)
{
length = CONV_BUFFER_SIZE-1;
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf(stderr, "Note: Detail is too long: %d chars\n", length);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
}
(*env)->GetStringUTFRegion(env, val, 0, length, convertionBuffer);
@@ -507,9 +507,9 @@
}
}
} else {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf(stderr, "Cannot load g_vfs_get_supported_uri_schemes\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
}
}
@@ -522,23 +522,23 @@
const char *gtk_version = fp_gtk_check_version(2, 14, 0);
if (gtk_version != NULL) {
// The gtk_show_uri is available from GTK+ 2.14
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf (stderr, "The version of GTK is %s. "
"The gtk_show_uri function is supported "
"since GTK+ 2.14.\n", gtk_version);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
} else {
// Loading symbols only if the GTK version is 2.14 and higher
fp_gtk_show_uri = dl_symbol("gtk_show_uri");
const char *dlsym_error = dlerror();
if (dlsym_error) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf (stderr, "Cannot load symbol: %s \n", dlsym_error);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
} else if (fp_gtk_show_uri == NULL) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
} else {
update_supported_actions(env);
success = TRUE;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -49,7 +49,7 @@
#include <X11/XKBlib.h>
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
static jmethodID lockIsHeldMID = NULL;
static void
@@ -2346,4 +2346,3 @@
(*env)->ReleaseIntArrayElements(env, bitmap, values, JNI_ABORT);
}
-
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -42,7 +42,7 @@
// we are trying to load the library without a version suffix
vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);
if (vfs_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not load libgnomevfs-2.so\n");
#endif
return FALSE;
@@ -51,13 +51,13 @@
dlerror(); /* Clear errors */
gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
if (gnome_vfs_init == NULL){
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
#endif
return FALSE;
}
if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
#endif
return FALSE;
@@ -69,7 +69,7 @@
if (gnome_handle == NULL) {
gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);
if (gnome_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not load libgnome-2.so\n");
#endif
return FALSE;
@@ -78,7 +78,7 @@
dlerror(); /* Clear errors */
gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not find symble gnome_url_show\n");
#endif
return FALSE;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt.h Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt.h Fri Apr 03 13:46:22 2015 -0700
@@ -228,7 +228,7 @@
/*
* checks if the current thread is/isn't the toolkit thread
*/
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
#define CHECK_IS_TOOLKIT_THREAD() \
if (GetCurrentThreadId() != AwtToolkit::MainThread()) \
{ JNU_ThrowInternalError(env,"Operation is not permitted on non-toolkit thread!\n"); }
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -31,6 +31,7 @@
import java.security.*;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import sun.misc.JavaAWTAccess;
import sun.misc.SharedSecrets;
@@ -579,7 +580,8 @@
// added in the user context.
class LoggerContext {
// Table of named Loggers that maps names to Loggers.
- private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
+ private final ConcurrentHashMap<String,LoggerWeakRef> namedLoggers =
+ new ConcurrentHashMap<>();
// Tree of named Loggers
private final LogNode root;
private LoggerContext() {
@@ -642,21 +644,44 @@
}
- synchronized Logger findLogger(String name) {
- // ensure that this context is properly initialized before
- // looking for loggers.
- ensureInitialized();
+ Logger findLogger(String name) {
+ // Attempt to find logger without locking.
LoggerWeakRef ref = namedLoggers.get(name);
- if (ref == null) {
- return null;
+ Logger logger = ref == null ? null : ref.get();
+
+ // if logger is not null, then we can return it right away.
+ // if name is "" or "global" and logger is null
+ // we need to fall through and check that this context is
+ // initialized.
+ // if ref is not null and logger is null we also need to
+ // fall through.
+ if (logger != null || (ref == null && !name.isEmpty()
+ && !name.equals(Logger.GLOBAL_LOGGER_NAME))) {
+ return logger;
}
- Logger logger = ref.get();
- if (logger == null) {
- // Hashtable holds stale weak reference
- // to a logger which has been GC-ed.
- ref.dispose();
+
+ // We either found a stale reference, or we were looking for
+ // "" or "global" and didn't find them.
+ // Make sure context is initialized (has the default loggers),
+ // and look up again, cleaning the stale reference if it hasn't
+ // been cleaned up in between. All this needs to be done inside
+ // a synchronized block.
+ synchronized(this) {
+ // ensure that this context is properly initialized before
+ // looking for loggers.
+ ensureInitialized();
+ ref = namedLoggers.get(name);
+ if (ref == null) {
+ return null;
+ }
+ logger = ref.get();
+ if (logger == null) {
+ // The namedLoggers map holds stale weak reference
+ // to a logger which has been GC-ed.
+ ref.dispose();
+ }
+ return logger;
}
- return logger;
}
// This method is called before adding a logger to the
@@ -752,7 +777,6 @@
final LogManager owner = getOwner();
logger.setLogManager(owner);
ref = owner.new LoggerWeakRef(logger);
- namedLoggers.put(name, ref);
// Apply any initial level defined for the new logger, unless
// the logger's level is already initialized
@@ -789,10 +813,17 @@
node.walkAndSetParent(logger);
// new LogNode is ready so tell the LoggerWeakRef about it
ref.setNode(node);
+
+ // Do not publish 'ref' in namedLoggers before the logger tree
+ // is fully updated - because the named logger will be visible as
+ // soon as it is published in namedLoggers (findLogger takes
+ // benefit of the ConcurrentHashMap implementation of namedLoggers
+ // to avoid synchronizing on retrieval when that is possible).
+ namedLoggers.put(name, ref);
return true;
}
- synchronized void removeLoggerRef(String name, LoggerWeakRef ref) {
+ void removeLoggerRef(String name, LoggerWeakRef ref) {
namedLoggers.remove(name, ref);
}
@@ -800,7 +831,7 @@
// ensure that this context is properly initialized before
// returning logger names.
ensureInitialized();
- return namedLoggers.keys();
+ return Collections.enumeration(namedLoggers.keySet());
}
// If logger.getUseParentHandlers() returns 'true' and any of the logger's
@@ -1379,7 +1410,19 @@
reset();
// Load the properties
- props.load(ins);
+ try {
+ props.load(ins);
+ } catch (IllegalArgumentException x) {
+ // props.load may throw an IllegalArgumentException if the stream
+ // contains malformed Unicode escape sequences.
+ // We wrap that in an IOException as readConfiguration is
+ // specified to throw IOException if there are problems reading
+ // from the stream.
+ // Note: new IOException(x.getMessage(), x) allow us to get a more
+ // concise error message than new IOException(x);
+ throw new IOException(x.getMessage(), x);
+ }
+
// Instantiate new configuration objects.
String names[] = parseClassNames("config");
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java Fri Apr 03 13:46:22 2015 -0700
@@ -90,6 +90,7 @@
// maximum number of active sessions during this invocation, for debugging
private int maxActiveSessions;
+ private Object maxActiveSessionsLock;
// flags to use in the C_OpenSession() call
private final long openSessionFlags;
@@ -113,6 +114,9 @@
this.token = token;
this.objSessions = new Pool(this);
this.opSessions = new Pool(this);
+ if (debug != null) {
+ maxActiveSessionsLock = new Object();
+ }
}
// returns whether only a fairly low number of sessions are
@@ -212,7 +216,7 @@
Session session = new Session(token, id);
activeSessions.incrementAndGet();
if (debug != null) {
- synchronized(this) {
+ synchronized(maxActiveSessionsLock) {
if (activeSessions.get() > maxActiveSessions) {
maxActiveSessions = activeSessions.get();
if (maxActiveSessions % 10 == 0) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.html Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6271849
+ @summary Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet ModalExcludedWindowClickTest.html
+ -->
+<head>
+<title>ModalExcludedWindowClickTest</title>
+</head>
+<body>
+
+<h1>ModalExcludedWindowClickTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ModalExcludedWindowClickTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6271849
+ @summary Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet ModalExcludedWindowClickTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class ModalExcludedWindowClickTest extends Applet {
+ Robot robot;
+ Frame frame = new Frame("Frame");
+ Window w = new Window(frame);
+ Dialog d = new Dialog ((Dialog)null, "NullParentDialog", true);
+ Button button = new Button("Button");
+ boolean actionPerformed = false;
+
+ public static void main (String args[]) {
+ ModalExcludedWindowClickTest app = new ModalExcludedWindowClickTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: unable to create robot", e);
+ }
+ // Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+ this.setLayout (new BorderLayout ());
+ Sysout.createDialogWithInstructions(new String[]
+ {"This is an AUTOMATIC test", "simply wait until it is done"});
+ }
+
+ public void start() {
+
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ Sysout.println("No testing on MToolkit.");
+ return;
+ }
+
+ button.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ actionPerformed = true;
+ Sysout.println(e.paramString());
+ }
+ });
+
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ frame.setSize(200, 200);
+ frame.setVisible(true);
+
+ w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+ w.add(button);
+ w.setSize(200, 200);
+ w.setLocation(230, 230);
+ w.setVisible(true);
+
+ d.setSize(200, 200);
+ d.setLocation(0, 230);
+ d.setVisible(true);
+
+ }
+ });
+
+ waitTillShown(d);
+
+ test();
+ }
+
+ void test() {
+ clickOn(button);
+ waitForIdle();
+ if (!actionPerformed) {
+ throw new RuntimeException("Test failed!");
+ }
+ Sysout.println("Test passed.");
+ }
+
+ void clickOn(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+
+ Sysout.println("Clicking " + c);
+
+ if (c instanceof Frame) {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+ } else {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+ }
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ waitForIdle();
+ }
+ void waitTillShown(Component c) {
+ while (true) {
+ try {
+ Thread.sleep(100);
+ c.getLocationOnScreen();
+ break;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalComponentStateException e) {}
+ }
+ }
+ void waitForIdle() {
+ try {
+ robot.waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ }
+
+ // wait longer...
+ robot.delay(200);
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6272324
+ @summary Modal excluded Window which decorated parent is blocked should be non-focusable.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet NonFocusableBlockedOwnerTest.html
+ -->
+<head>
+<title>NonFocusableBlockedOwnerTest</title>
+</head>
+<body>
+
+<h1>NonFocusableBlockedOwnerTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="NonFocusableBlockedOwnerTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6272324
+ @summary Modal excluded Window which decorated parent is blocked should be non-focusable.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet NonFocusableBlockedOwnerTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class NonFocusableBlockedOwnerTest extends Applet {
+ Robot robot;
+ Frame frame = new Frame("Modal Blocked Frame");
+ Dialog dialog = new Dialog(frame, "Modal Dialog", true);
+ Window excluded = new Window(frame);
+ Button button = new Button("button");
+
+ public static void main(String[] args) {
+ NonFocusableBlockedOwnerTest app = new NonFocusableBlockedOwnerTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: unable to create robot", e);
+ }
+ // Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+ this.setLayout (new BorderLayout ());
+ Sysout.createDialogWithInstructions(new String[]
+ {"This is an AUTOMATIC test", "simply wait until it is done"});
+ }
+
+ public void start() {
+
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ Sysout.println("No testing on MToolkit.");
+ return;
+ }
+
+ try {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ frame.setSize(300, 200);
+ frame.setVisible(true);
+
+ excluded.setSize(300, 200);
+ excluded.setLocation(0, 400);
+ excluded.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+ excluded.setLayout(new FlowLayout());
+ excluded.add(button);
+ excluded.setVisible(true);
+
+ dialog.setSize(200, 100);
+ dialog.setLocation(0, 250);
+ dialog.setVisible(true);
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ waitTillShown(dialog);
+ clickOn(button);
+ if (frame == KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()) {
+ throw new RuntimeException("Test failed!");
+ }
+ if (excluded == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()) {
+ throw new RuntimeException("Test failed!");
+ }
+ if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+ throw new RuntimeException("Test failed!");
+ }
+ Sysout.println("Test passed.");
+ }
+
+ void clickOn(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+
+ Sysout.println("Clicking " + c);
+
+ if (c instanceof Frame) {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+ } else {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+ }
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ waitForIdle();
+ }
+
+ void waitTillShown(Component c) {
+ while (true) {
+ try {
+ Thread.sleep(100);
+ c.getLocationOnScreen();
+ break;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalComponentStateException e) {}
+ }
+ }
+ void waitForIdle() {
+ try {
+ robot.waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ }
+
+ // wait longer...
+ robot.delay(200);
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6253913
+ @summary Tests that a Window shown before its owner is focusable.
+ @author anton.tarasov@sun.com: area=awt-focus
+ @run applet WindowUpdateFocusabilityTest.html
+ -->
+<head>
+<title>WindowUpdateFocusabilityTest</title>
+</head>
+<body>
+
+<h1>WindowUpdateFocusabilityTest<br>Bug ID: 6253913</h1>
+
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE=WindowUpdateFocusabilityTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6253913
+ @summary Tests that a Window shown before its owner is focusable.
+ @author anton.tarasov@sun.com: area=awt-focus
+ @run applet WindowUpdateFocusabilityTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.*;
+
+public class WindowUpdateFocusabilityTest extends Applet {
+ Robot robot;
+ boolean focusGained = false;
+ final Object monitor = new Object();
+ FocusListener listener = new FocusAdapter () {
+ public void focusGained(FocusEvent e) {
+ Sysout.println(e.toString());
+ synchronized (monitor) {
+ focusGained = true;
+ monitor.notifyAll();
+ }
+ }
+ };
+
+ public static void main(String[] args) {
+ WindowUpdateFocusabilityTest app = new WindowUpdateFocusabilityTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: couldn't create robot");
+ }
+ // Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+ this.setLayout (new BorderLayout ());
+ Sysout.createDialogWithInstructions(new String[]
+ {"This is an automatic test. Simply wait until it's done."});
+ }
+
+ public void start() {
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ Sysout.println("No testing on Motif.");
+ return;
+ }
+
+ test(new Frame("Frame owner"));
+ Frame dialog_owner = new Frame("dialog's owner");
+ test(new Dialog(dialog_owner));
+ test(new Dialog(dialog_owner, Dialog.ModalityType.DOCUMENT_MODAL));
+ test(new Dialog(dialog_owner, Dialog.ModalityType.APPLICATION_MODAL));
+ test(new Dialog(dialog_owner, Dialog.ModalityType.TOOLKIT_MODAL));
+ test(new Dialog((Window) null, Dialog.ModalityType.MODELESS));
+ test(new Dialog((Window) null, Dialog.ModalityType.DOCUMENT_MODAL));
+ test(new Dialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL));
+ test(new Dialog((Window) null, Dialog.ModalityType.TOOLKIT_MODAL));
+ dialog_owner.dispose();
+ }
+
+ private void test(final Window owner)
+ {
+ Window window0 = new Window(owner); // will not be shown
+ Window window1 = new Window(window0);
+ Window window2 = new Window(window1);
+ Button button1 = new Button("button1");
+ Button button2 = new Button("button2");
+ button1.addFocusListener(listener);
+ button2.addFocusListener(listener);
+
+ owner.setBounds(800, 0, 100, 100);
+ window1.setBounds(800, 300, 100, 100);
+ window2.setBounds(800, 150, 100, 100);
+
+ window1.add(button1);
+ window2.add(button2);
+
+ window2.setVisible(true);
+ window1.setVisible(true);
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ owner.setVisible(true);
+ }
+ });
+
+ try {
+ EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ // do nothing just wait until previous invokeLater will be executed
+ }
+ });
+ } catch (InterruptedException ie) {
+ throw new RuntimeException(ie);
+ } catch (InvocationTargetException ite) {
+ throw new RuntimeException(ite);
+ }
+
+ robot.delay(1000);
+
+ clickOn(button1);
+
+ if (!isFocusGained()) {
+ throw new RuntimeException("Test failed: window1 is not focusable!");
+ }
+
+ focusGained = false;
+ clickOn(button2);
+
+ if (!isFocusGained()) {
+ throw new RuntimeException("Test failed: window2 is not focusable!");
+ }
+
+ Sysout.println("Test for " + owner.getName() + " passed.");
+ owner.dispose();
+ }
+
+ void clickOn(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+
+ Sysout.println("Clicking " + c);
+
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ waitForIdle();
+ }
+
+ void waitForIdle() {
+ try {
+ robot.waitForIdle();
+ robot.delay(50);
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ }
+ }
+
+ boolean isFocusGained() {
+ synchronized (monitor) {
+ if (!focusGained) {
+ try {
+ monitor.wait(3000);
+ } catch (InterruptedException e) {
+ Sysout.println("Interrupted unexpectedly!");
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ return focusGained;
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -192,8 +192,7 @@
}
private void waitForIdle() {
try {
- Toolkit.getDefaultToolkit().sync();
- sun.awt.SunToolkit.flushPendingEvents();
+ robot.waitForIdle();
EventQueue.invokeAndWait( new Runnable() {
public void run() {
// dummy implementation
--- a/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -23,13 +23,16 @@
import java.awt.Color;
import java.awt.Dialog;
+import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.SplashScreen;
+import java.awt.TextField;
import java.awt.Window;
+import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
@@ -37,7 +40,7 @@
/**
* @test
- * @bug 8043869
+ * @bug 8043869 8075244
* @author Alexander Scherbatiy
* @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
* support
@@ -45,6 +48,7 @@
* @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
* @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
* @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
+ * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_FOCUS
*/
public class MultiResolutionSplashTest {
@@ -69,6 +73,9 @@
int index = Integer.parseInt(args[1]);
testSplash(tests[index]);
break;
+ case "TEST_FOCUS":
+ testFocus();
+ break;
default:
throw new RuntimeException("Unknown test: " + test);
}
@@ -92,12 +99,49 @@
float scaleFactor = getScaleFactor();
Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
- if (!testColor.equals(splashScreenColor)) {
+ if (!compare(testColor, splashScreenColor)) {
throw new RuntimeException(
"Image with wrong resolution is used for splash screen!");
}
}
+ static void testFocus() throws Exception {
+
+ System.out.println("Focus Test!");
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ Frame frame = new Frame();
+ frame.setSize(100, 100);
+ String test = "123";
+ TextField textField = new TextField(test);
+ frame.add(textField);
+ frame.setVisible(true);
+ robot.waitForIdle();
+
+ robot.keyPress(KeyEvent.VK_A);
+ robot.keyRelease(KeyEvent.VK_A);
+ robot.keyPress(KeyEvent.VK_B);
+ robot.keyRelease(KeyEvent.VK_B);
+ robot.waitForIdle();
+
+ frame.dispose();
+
+ if(!textField.getText().equals("ab")){
+ throw new RuntimeException("Focus is lost!");
+ }
+ }
+
+ static boolean compare(Color c1, Color c2){
+ return compare(c1.getRed(), c2.getRed())
+ && compare(c1.getGreen(), c2.getGreen())
+ && compare(c1.getBlue(), c2.getBlue());
+ }
+
+ static boolean compare(int n, int m){
+ return Math.abs(n - m) <= 50;
+ }
+
static float getScaleFactor() {
final Dialog dialog = new Dialog((Window) null);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,795 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 4632143
+ @summary Unit test for the RFE window/frame/dialog always on top
+ @author dom@sparc.spb.su: area=awt.toplevel
+ @run main AutoTestOnTop
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+import javax.swing.*;
+import java.util.Vector;
+
+/**
+ * @author tav@sparc.spb.su
+ * @author dom@sparc.spb.su
+ * Tests that always-on-top windows combine correctly with different kinds of window in different styles and conditions.
+ *
+ * !!! WARNING !!!
+ * The test fails sometimes because the toFront() method doesn't guarantee
+ * that after its invocation the frame will be placed above all other windows.
+ */
+public class AutoTestOnTop {
+ static Window topw;
+ static Frame parentw = new Frame();
+ static Window f;
+ static Frame parentf = new Frame();
+
+ static Object uncheckedSrc = new Object(); // used when no need to check event source
+ static Object eventSrc = uncheckedSrc;
+ static boolean dispatchedCond;
+
+ static Semaphore STATE_SEMA = new Semaphore();
+ static Semaphore VIS_SEMA = new Semaphore();
+ static Vector errors = new Vector();
+
+ static boolean isUnix = false;
+
+ static StringBuffer msgError = new StringBuffer();
+ static StringBuffer msgCase = new StringBuffer();
+ static StringBuffer msgAction = new StringBuffer();
+ static StringBuffer msgFunc = new StringBuffer();
+ static StringBuffer msgVisibility = new StringBuffer();
+
+ static volatile int stageNum;
+ static volatile int actNum;
+ static volatile int testResult = 0;
+
+ static volatile boolean doCheckEvents;
+ static volatile boolean eventsCheckPassed;
+ static boolean[] eventsCheckInitVals = new boolean[] { // Whether events are checked for abcence or precence
+ true, true, true, true, true, false, false, false, false
+ };
+ static String[] msgEventsChecks = new String[] {
+ null, null, null, null, null,
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ };
+
+ static final int stagesCount = 7;
+ static final int actionsCount = 9;
+
+ static Method[] preActions = new Method[actionsCount];
+ static Method[] postActions = new Method[actionsCount];
+ static Method[] isActionsAllowed = new Method[actionsCount];
+ static Method[] checksActionEvents = new Method[actionsCount];
+
+ static Robot robot;
+
+ static boolean doStartTest;
+ static String osName = System.getProperty("os.name");
+
+
+ public static void main(String[] args) {
+ checkTesting();
+
+ }
+
+ public static void performTesting() {
+ isUnix = osName.equals("Linux") || osName.equals("SunOS");
+
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ if (e.getID() == MouseEvent.MOUSE_CLICKED) {
+ if (eventSrc != null & eventSrc != uncheckedSrc && e.getSource() != eventSrc) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": " + msgError);
+ testResult = -1;
+ }
+ synchronized (eventSrc) {
+ dispatchedCond = true;
+ eventSrc.notify();
+ }
+ }
+
+ if (doCheckEvents && (e.getSource() == topw || e.getSource() == f)) {
+
+ //System.err.println("AWTEventListener: catched the event " + e);
+
+ try {
+ checksActionEvents[actNum].invoke(null, new Object[] {e});
+ } catch (InvocationTargetException ite) {
+ ite.printStackTrace();
+ } catch (IllegalAccessException iae) {
+ iae.printStackTrace();
+ }
+ return;
+ }
+ }
+ }, 0xffffffffffffffffL);
+
+ Method[] allMethods;
+
+ try {
+ allMethods = AutoTestOnTop.class.getDeclaredMethods();
+ } catch (SecurityException se) {
+ throw new RuntimeException(se);
+ }
+
+ for (int i = 0; i < allMethods.length; i++) {
+ String name = allMethods[i].getName();
+ if (name.startsWith("preAction")) {
+ preActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ } else if (name.startsWith("postAction")) {
+ postActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ } else if (name.startsWith("isActionAllowed")) {
+ isActionsAllowed[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ } else if (name.startsWith("checkActionEvents")) {
+ checksActionEvents[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ }
+ }
+
+ f = new Frame("Auxiliary Frame");
+ f.setBounds(50, 0, 400, 50);
+ f.setVisible(true);
+ waitTillShown(f);
+
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: unable to create robot", e);
+ }
+
+ mainTest();
+
+ if (testResult != 0) {
+ System.err.println("The following errors were encountered: ");
+ for (int i = 0; i < errors.size(); i++) {
+ System.err.println(errors.get(i).toString());
+ }
+ throw new RuntimeException("Test failed.");
+ } else {
+ System.err.println("Test PASSED.");
+ }
+ }
+
+ public static void mainTest() {
+// stageNum = 0;
+// for (int i = 0; i < 5; i++) {
+// actNum = 2;
+// System.err.println("************************* A C T I O N " + actNum + " *************************");
+// doStage(stageNum, actNum);
+// // pause(500);
+// actNum = 3;
+// System.err.println("************************* A C T I O N " + actNum + " *************************");
+// doStage(stageNum, actNum);
+// // pause(500);
+// }
+ for (stageNum = 0; stageNum < stagesCount; stageNum++) {
+ System.err.println("************************* S T A G E " + stageNum + " *************************");
+ for (actNum = 0; actNum < actionsCount; actNum++) {
+ System.err.println("************************* A C T I O N " + actNum + " *************************");
+ doStage(stageNum, actNum);
+ } // for thru actNum
+ } // fow thru stageNum
+
+ eventSrc = null;
+ }
+
+ private static void doStage(int stageNum, int actNum) {
+ try {
+
+ if (!((Boolean)isActionsAllowed[actNum].invoke(null, new Object[0])).booleanValue()) {
+ System.err.println("Action skipped due to a platform limitations");
+ return;
+ }
+
+ STATE_SEMA.reset();
+ createWindow(stageNum);
+
+ //*************************
+ // Set window always-on-top
+ //*************************
+
+ preActions[actNum].invoke(null, new Object[0]);
+ setAlwaysOnTop(topw, true);
+ waitForIdle(true);
+
+ if (!topw.isAlwaysOnTopSupported()) return;
+
+ postActions[actNum].invoke(null, new Object[0]);
+ waitForIdle(false);
+
+ STATE_SEMA.reset();
+
+ testForAlwaysOnTop();
+
+ //*****************************
+ // Set window not always-on-top
+ //*****************************
+
+ preActions[actNum].invoke(null, new Object[0]);
+ setAlwaysOnTop(topw, false);
+ waitForIdle(true);
+ postActions[actNum].invoke(null, new Object[0]);
+ waitForIdle(false);
+ STATE_SEMA.reset();
+
+ testForNotAlwaysOnTop();
+
+ } catch (InvocationTargetException ite) {
+ ite.printStackTrace();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private static void checkTesting() {
+ if (Toolkit.getDefaultToolkit().isAlwaysOnTopSupported()) {
+ performTesting();
+ }
+ }
+
+ public static void testForAlwaysOnTop() {
+ System.err.println("Checking for always-on-top " + topw);
+
+ ensureInitialWinPosition(topw);
+
+ // Check that always-on-top window is topmost.
+ // - Click on always-on-top window on the windows cross area.
+ clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+ " window (1) always-on-top didn't make it topmost");
+
+ // Check that we can't change z-order of always-on-top window.
+ // - a) Try to put the other window on the top.
+ f.toFront();
+ clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+ pause(300);
+
+ // - b) Click on always-on-top window on the windows cross area.
+ clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+ " window (1) always-on-top didn't make it such");
+
+ // Ask for always-on-top property
+ if (isAlwaysOnTop(topw) != true)
+ error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+ ": isAlwaysOnTop() returned 'false' for window (1) set always-on-top at state "
+ + msgVisibility);
+ }
+
+ public static void testForNotAlwaysOnTop() {
+ System.err.println("Checking for non always-on-top of " + topw);
+ ensureInitialWinPosition(topw);
+
+ if (msgVisibility.equals("visible") && actNum != 2) {
+ // Check that the window remains topmost.
+ // - click on the window on the windows cross area.
+ clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+ " window (1) not always-on-top didn't keep it topmost");
+ }
+
+ // Check that we can change z-order of not always-on-top window.
+ // - a) try to put the other window on the top.
+ f.toFront();
+ clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+ pause(300);
+
+ // - b) click on not always-on-top window on the windows cross area.
+ clickOn(f, f, 10, 30, "setting " + msgVisibility +
+ " window (1) not always-on-top didn't make it such");
+
+ // Ask for always-on-top property
+ if (isAlwaysOnTop(topw) != false)
+ error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+ ": isAlwaysOnTop() returned 'true' for window (1) set not always-on-top at state "
+ + msgVisibility);
+ }
+
+
+ private static void createWindow(int stageNum) {
+ // Free native resourses
+ if (topw != null && topw.isVisible()) {
+ topw.dispose();
+ }
+
+ switch (stageNum) {
+ case 0:
+ topw = new Frame("Top Frame");
+ msgCase.replace(0, msgCase.length(), "Frame (1) over Frame (2)");
+ break;
+ case 1:
+ topw = new JFrame("Top JFrame");
+ msgCase.replace(0, msgCase.length(), "JFrame (1) over Frame (2)");
+ break;
+ case 2:
+ topw = new Dialog(parentw, "Top Dialog");
+ msgCase.replace(0, msgCase.length(), "Dialog (1) over Frame (2)");
+ break;
+ case 3:
+ topw = new JDialog(parentw, "Top JDialog");
+ msgCase.replace(0, msgCase.length(), "JDialog (1) over Frame (2)");
+ break;
+ case 4:
+ topw = new Frame("Top Frame");
+ f.dispose();
+ f = new Dialog(parentf, "Auxiliary Dialog");
+ f.setBounds(50, 0, 250, 50);
+ f.setVisible(true);
+ waitTillShown(f);
+ msgCase.replace(0, msgCase.length(), "Frame (1) over Dialog (2)");
+ break;
+ case 5:
+ topw = new Window(parentw);
+ msgCase.replace(0, msgCase.length(), "Window (1) over Frame (2)");
+ break;
+ case 6:
+ topw = new JWindow(parentw);
+ msgCase.replace(0, msgCase.length(), "JWindow (1) over Frame (2)");
+ break;
+ }
+ topw.addWindowStateListener(new WindowAdapter() {
+ public void windowStateChanged(WindowEvent e) {
+ System.err.println("* " + e);
+ STATE_SEMA.raise();
+ }
+ });
+ topw.setSize(200, 50);
+ }
+
+ /**
+ * 0: setting always-on-top to invisible window
+ * 1: setting always-on-top to visible window
+ * 2: always-on-top on visible non-focusable window
+ * 3: always-on-top on visible, dragging topw after that
+ * 4: always-on-top on visible, dragging f after that
+ * 5: always-on-top on (visible, maximized), make normal after that
+ * 6: always-on-top on (visible, iconified), make normal after that
+ * 7: always-on-top on visible, iconify/deiconify after that
+ * 8: always-on-top on visible, maximize/restore after that
+ */
+ public static void preAction_0() {
+ topw.setVisible(false);
+ }
+ public static void postAction_0() {
+ if (topw.isShowing()) {
+ error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase +
+ ": no actions with windows: changing always-on-top property at window (1) state 'invisible' makes window (1) visible");
+ }
+ setWindowVisible("no actions with windows", "invisible");
+ }
+ public static boolean isActionAllowed_0() {
+ // Window on Linux is always always-on-top!
+ return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+ }
+ public static void checkActionEvents_0(AWTEvent e) {
+ System.err.println(e.toString());
+ }
+
+ public static void preAction_1() {
+ setWindowVisible("no actions with windows", "visible");
+ }
+ public static void postAction_1() {}
+ public static boolean isActionAllowed_1() {
+ return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount );
+ }
+ public static void checkActionEvents_1(AWTEvent e) {
+ System.err.println(e.toString());
+ if (e instanceof PaintEvent) {
+ return;
+ }
+ eventsCheckPassed = false;
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": unexpected event " + e + " was generated");
+ }
+
+ public static void preAction_2() {
+ setWindowVisible("when window (1) set not focusable", "visible");
+ topw.setFocusableWindowState(false);
+ f.toFront();
+ pause(300);
+ }
+ public static void postAction_2() {}
+ public static boolean isActionAllowed_2() {
+ return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+ }
+ public static void checkActionEvents_2(AWTEvent e) {
+ System.err.println(e.toString());
+ if ( (e.getID() >= FocusEvent.FOCUS_FIRST && e.getID() <= FocusEvent.FOCUS_LAST) ||
+ (e.getID() == WindowEvent.WINDOW_LOST_FOCUS && e.getID() == WindowEvent.WINDOW_GAINED_FOCUS)) {
+ eventsCheckPassed = false;
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " +
+ msgAction + ": after call " + msgFunc +
+ ": unexpected event " + e + " was generated");
+ }
+ }
+
+ public static void preAction_3() {
+ setWindowVisible("after dragging", "visible");
+ }
+ public static void postAction_3() {
+ Point p = topw.getLocationOnScreen();
+ int x = p.x + 40, y = p.y + 5;
+
+ try { // Take a pause to avoid double click
+ Thread.sleep(500); // when called one after another.
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ } catch (IllegalComponentStateException e) {
+ e.printStackTrace();
+ }
+
+ // Drag the window.
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseMove(200, 50);
+ robot.mouseMove(x, y);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ }
+ public static boolean isActionAllowed_3() {
+ return (stageNum < 5);
+ }
+ public static void checkActionEvents_3(AWTEvent e) {
+ System.err.println(e.toString());
+ }
+
+ public static void preAction_4() {
+ setWindowVisible("after dragging window (2)", "visible");
+ }
+ public static void postAction_4() {
+ Point p = f.getLocationOnScreen();
+ int x = p.x + 150, y = p.y + 5;
+
+ try { // Take a pause to avoid double click
+ Thread.sleep(500); // when called one after another.
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ } catch (IllegalComponentStateException e) {
+ e.printStackTrace();
+ }
+
+ // Drag the window.
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseMove(200, 50);
+ robot.mouseMove(x, y);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ ensureInitialWinPosition(f);
+ }
+ public static boolean isActionAllowed_4() {
+ return !((stageNum == 5 || stageNum == 6) && isUnix);
+ }
+ public static void checkActionEvents_4(AWTEvent e) {
+ System.err.println(e.toString());
+ }
+
+ // Metacity has a bug not allowing to set a window to NORMAL state!!!
+
+ public static void preAction_5() {
+ setWindowVisible("at state 'maximized'", "visible");
+ ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+ waitForStateChange();
+ }
+ public static void postAction_5() {
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ waitForStateChange();
+ }
+ public static boolean isActionAllowed_5() {
+ return (stageNum < 2);
+ }
+ public static void checkActionEvents_5(AWTEvent e) {
+ System.err.println("=" + e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ public static void preAction_6() {
+ setWindowVisible("at state 'iconified'", "visible");
+ System.err.println("Iconifying " + topw);
+ ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to ICONIFIED hasn't been generated");
+ }
+ }
+ public static void postAction_6() {
+ System.err.println("Restoring " + topw);
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to NORMAL hasn't been generated");
+ }
+ }
+ public static boolean isActionAllowed_6() {
+ return (stageNum < 2 );
+ }
+ public static void checkActionEvents_6(AWTEvent e) {
+ System.err.println("+" + e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ public static void preAction_7() {
+ setWindowVisible("before state 'iconified'", "visible");
+ }
+ public static void postAction_7() {
+ System.err.println("Setting iconified");
+ ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to ICONIFIED hasn't been generated");
+ }
+ System.err.println("Setting normal");
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to NORMAL hasn't been generated");
+ }
+ }
+ public static boolean isActionAllowed_7() {
+ return (stageNum < 2);
+ }
+ public static void checkActionEvents_7(AWTEvent e) {
+ System.err.println(e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ public static void preAction_8() {
+ setWindowVisible("before state 'maximized'", "visible");
+ }
+ public static void postAction_8() {
+ ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to MAXIMIZED hasn't been generated");
+ }
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to NORMAL hasn't been generated");
+ }
+ }
+ public static boolean isActionAllowed_8() {
+ return (stageNum < 2);
+ }
+ public static void checkActionEvents_8(AWTEvent e) {
+ System.err.println(e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ //***************************************************************************
+
+ private static void setWindowVisible(String mAction, String mVisibility) {
+ msgAction.replace(0, msgAction.length(), mAction);
+ msgVisibility.replace(0, msgVisibility.length(), mVisibility);
+
+ topw.setVisible(true);
+ pause(100); // Needs for Sawfish
+ topw.setLocation(0, 0);
+ waitTillShown(topw);
+ f.toFront();
+ pause(300);
+ }
+
+ private static void clickOn(Object src, Window relwin, int x, int y, String errorStr) {
+ Point p = relwin.getLocationOnScreen();
+ int counter = 10;
+ while (--counter > 0) {
+ eventSrc = src;
+ msgError.replace(0, msgError.length(), errorStr);
+
+ robot.mouseMove(p.x + x, p.y + y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ synchronized (eventSrc) {
+ if (!dispatchedCond) {
+ try {
+ eventSrc.wait(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ if (!dispatchedCond) {
+ //System.err.println("clickOn: MOUSE_CLICKED event losed, trying to generate it again...");
+ continue;
+ }
+ dispatchedCond = false;
+ }
+ break;
+ } // end while
+ if (counter <= 0) {
+ eventSrc = uncheckedSrc;
+ error("Test: internal error: could't catch MOUSE_CLICKED event. Skip testing this stage");
+ }
+ }
+
+ private static void setAlwaysOnTop(Window w, boolean value) {
+ System.err.println("Setting always on top on " + w + " to " + value);
+ robot.mouseMove(0, 100); // Move out of the window
+ msgFunc.replace(0, msgCase.length(), "setAlwaysOnTop()");
+ try {
+ w.setAlwaysOnTop(value);
+ } catch (Exception e) {
+ error("Test failed: stage#" + stageNum + "action #" + actNum + ": " + msgCase + ": " + msgAction +
+ ": setAlwaysOnTop(" + value + ") called at state " + msgVisibility +
+ " threw exeption " + e);
+ }
+ }
+
+ private static boolean isAlwaysOnTop(Window w) {
+ robot.mouseMove(0, 100); // Move out of the window
+ msgFunc.replace(0, msgCase.length(), "isAlwaysOnTop()");
+ boolean result = false;
+ try {
+ result = w.isAlwaysOnTop();
+ } catch (Exception e) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction +
+ ": isAlwaysOnTop() called at state " + msgVisibility +
+ " threw exeption " + e);
+ }
+ return result;
+ }
+
+ private static void waitTillShown(Component c) {
+ while (true) {
+ try {
+ Thread.sleep(100);
+ c.getLocationOnScreen();
+ break;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ }
+
+ private static void waitForIdle(boolean doCheck) {
+ try {
+ robot.waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ } );
+ } catch(InterruptedException ite) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ } catch(InvocationTargetException ine) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ine.printStackTrace();
+ }
+ doCheckEvents = doCheck;
+
+ if (doCheck) {
+ eventsCheckPassed = eventsCheckInitVals[actNum]; // Initialize
+ } else if (!eventsCheckPassed &&
+ msgEventsChecks[actNum] != null) {
+
+
+ // Some expected event hasn't been catched,
+ // so give it one more chance...
+ doCheckEvents = true;
+ pause(500);
+ doCheckEvents = false;
+
+ if (!eventsCheckPassed) {
+ testResult = -1;
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call "
+ + msgFunc + ": " + msgEventsChecks[actNum]);
+ }
+ }
+ }
+
+ private static boolean waitForStateChange() {
+ System.err.println("------- Waiting for state change");
+ try {
+ STATE_SEMA.doWait(3000);
+ } catch (InterruptedException ie) {
+ System.err.println("Wait interrupted: " + ie);
+ }
+ boolean state = STATE_SEMA.getState();
+ STATE_SEMA.reset();
+ return state;
+ }
+
+ private static void ensureInitialWinPosition(Window w) {
+ int counter = 30;
+ while (w.getLocationOnScreen().y != 0 && --counter > 0) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ if (counter <= 0) {
+ w.setLocation(0, 0);
+ pause(100);
+ System.err.println("Test: window set to initial position forcedly");
+ }
+ }
+
+ private static void pause(int mls) {
+ try {
+ Thread.sleep(mls);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void error(String msg) {
+ errors.add(msg);
+ System.err.println(msg);
+ }
+}
+
+class Semaphore {
+ boolean state = false;
+ int waiting = 0;
+ public Semaphore() {
+ }
+ public synchronized void doWait() throws InterruptedException {
+ if (state) {
+ return;
+ }
+ waiting++;
+ wait();
+ waiting--;
+ }
+ public synchronized void doWait(int timeout) throws InterruptedException {
+ if (state) {
+ return;
+ }
+ waiting++;
+ wait(timeout);
+ waiting--;
+ }
+ public synchronized void raise() {
+ state = true;
+ if (waiting > 0) {
+ notifyAll();
+ }
+ }
+
+ public synchronized void doNotify() {
+ notifyAll();
+ }
+ public synchronized boolean getState() {
+ return state;
+ }
+
+ public synchronized void reset() {
+ state = false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 4985250
+ @summary COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+ @author tav@sparc.spb.su
+ @run applet MovedResizedTardyEventTest.html
+ -->
+<head>
+<title>MovedResizedTardyEventTest</title>
+</head>
+<body>
+
+<h1>MovedResizedTardyEventTest<br>Bug ID: 4985250</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="MovedResizedTardyEventTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 4985250
+ @summary COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+ @author tav@sparc.spb.su
+ @run applet MovedResizedTardyEventTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.InvocationTargetException;
+
+public class MovedResizedTardyEventTest extends Applet {
+ Frame f1 = new Frame("F-1");
+ Frame f2 = new Frame("F-2");
+
+ boolean eventFlag = false;
+
+ public static void main(String[] args) {
+ Applet a = new MovedResizedTardyEventTest();
+ a.start();
+ }
+
+ public void start() {
+ f1.setVisible(true);
+ f2.setVisible(true);
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {}
+
+ f1.addComponentListener(new ComponentAdapter() {
+ public void componentMoved(ComponentEvent e) {
+ MovedResizedTardyEventTest.this.eventFlag = true;
+ System.err.println(e);
+ }
+ public void componentResized(ComponentEvent e) {
+ MovedResizedTardyEventTest.this.eventFlag = true;
+ System.err.println(e);
+ }
+ });
+
+ f1.toFront();
+
+ waitForIdle();
+
+ try { // wait more...
+ Thread.sleep(500);
+ } catch (InterruptedException e) {}
+
+ if (eventFlag) {
+ throw new RuntimeException("Test failed!");
+ }
+ }
+
+ void waitForIdle() {
+ try {
+ (new Robot()).waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ } catch(AWTException rex) {
+ rex.printStackTrace();
+ throw new RuntimeException("unexpected exception");
+ }
+ }
+}
--- a/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -29,8 +29,6 @@
@run main AltCharAcceleratorTest
*/
-import sun.awt.SunToolkit;
-
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
@@ -103,13 +101,12 @@
}
void test() throws Exception {
- ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+ Robot robot = new Robot();
+ robot.setAutoDelay(100);
+ robot.waitForIdle();
focusLatch.await(5, TimeUnit.SECONDS);
- Robot robot = new Robot();
- robot.setAutoDelay(100);
-
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_T);
robot.keyRelease(KeyEvent.VK_T);
@@ -133,4 +130,4 @@
AltCharAcceleratorTest t = new AltCharAcceleratorTest();
t.test();
}
-}
\ No newline at end of file
+}
--- a/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java Fri Apr 03 13:46:22 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,18 +24,14 @@
/*
@test
@bug 6799551
- @library ../../regtesthelpers
- @build Util Sysout
@summary Extended key codes for small letters undefined
@author Andrei Dmitriev: area=awt.keyboard
@run main EqualKeyCode
*/
-import sun.awt.*;
import java.awt.*;
-import test.java.awt.regtesthelpers.Util;
-import test.java.awt.regtesthelpers.Sysout;
+import java.awt.event.KeyEvent;
public class EqualKeyCode {
@@ -46,13 +42,13 @@
char cSmall = LETTERS.charAt(i);
char cLarge = Character.toUpperCase(cSmall);
- int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
- int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+ int iSmall = KeyEvent.getExtendedKeyCodeForChar(cSmall);
+ int iLarge = KeyEvent.getExtendedKeyCodeForChar(cLarge);
System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
System.out.println(" " + cLarge + " : " + iLarge);
- if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
- ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+ if (KeyEvent.getExtendedKeyCodeForChar(cSmall) !=
+ KeyEvent.getExtendedKeyCodeForChar(cLarge))
{
throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Calendar/Bug8075548.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8075548
+ * @summary Make sure that the format form of month names are produced when there are
+ * no stand-alone ones available.
+ */
+
+import java.text.*;
+import java.util.*;
+import static java.util.Calendar.*;
+
+public class Bug8075548 {
+ static int errors = 0;
+
+ public static void main(String[] args) throws Throwable {
+ Date date = new SimpleDateFormat("yyyy-MM-dd", Locale.US).parse("2010-09-15");
+ String[][] FORMAT_PAIRS = {
+ { "LLLL", "MMMM" },
+ { "LLL", "MMM" }
+ };
+ Locale[] LOCALES = {
+ Locale.ENGLISH, Locale.FRENCH, Locale.GERMAN, Locale.JAPANESE
+ };
+
+ for (Locale locale : LOCALES) {
+ for (String[] formats : FORMAT_PAIRS) {
+ String el = new SimpleDateFormat(formats[0], locale).format(date);
+ String em = new SimpleDateFormat(formats[1], locale).format(date);
+ if (!el.equals(em)) {
+ errors++;
+ System.err.println(locale + ": " +
+ formats[0] + " -> " + el + ", " +
+ formats[1] + " -> " + em);
+ }
+ }
+ }
+
+ // Test Calendar.getDisplayName() and .getDisplayNames().
+ for (Locale locale : LOCALES) {
+ testDisplayNames(locale, LONG_FORMAT, LONG_STANDALONE);
+ testDisplayNames(locale, SHORT_FORMAT, SHORT_STANDALONE);
+ testDisplayNames(locale, NARROW_FORMAT, NARROW_STANDALONE);
+ }
+
+ if (errors > 0) {
+ throw new RuntimeException("Failed");
+ }
+ }
+
+ private static void testDisplayNames(Locale locale, int formatStyle, int standaloneStyle) {
+ Map<String, Integer> map = new HashMap<>();
+ for (int month = JANUARY; month <= DECEMBER; month++) {
+ Calendar cal = new GregorianCalendar(2015, month, 1);
+ String format = cal.getDisplayName(MONTH, formatStyle, locale);
+ String standalone = cal.getDisplayName(MONTH, standaloneStyle, locale);
+ if (!format.equals(standalone)) {
+ System.err.println("Calendar.getDisplayName: " + (month+1) +
+ ", locale=" + locale +
+ ", format=" + format + ", standalone=" + standalone);
+ errors++;
+ }
+ if (standalone != null) {
+ map.put(standalone, month);
+ }
+ }
+ if (formatStyle == NARROW_FORMAT) {
+ // Narrow styles don't support unique names.
+ // (e.g., "J" for JANUARY, JUNE, and JULY)
+ return;
+ }
+ Calendar cal = new GregorianCalendar(2015, JANUARY, 1);
+ Map<String, Integer> mapStandalone = cal.getDisplayNames(MONTH, standaloneStyle, locale);
+ if (!map.equals(mapStandalone)) {
+ System.err.printf("Calendar.getDisplayNames: locale=%s%n map=%s%n mapStandalone=%s%n",
+ locale, map, mapStandalone);
+ errors++;
+ }
+ Map<String, Integer> mapAll = cal.getDisplayNames(MONTH, ALL_STYLES, locale);
+ if (!mapAll.entrySet().containsAll(map.entrySet())) {
+ System.err.printf("Calendar.getDisplayNames: locale=%s%n map=%s%n mapAll=%s%n",
+ locale, map, mapAll);
+ errors++;
+ }
+ }
+}
--- a/jdk/test/java/util/Calendar/NarrowNamesTest.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/java/util/Calendar/NarrowNamesTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -86,7 +86,19 @@
"\u6728",
"\u91d1",
"\u571f");
- testMap(THTH, MONTH, NARROW_FORMAT); // expect null
+ testMap(THTH, MONTH, NARROW_FORMAT,
+ "\u0e21.\u0e04.",
+ "\u0e01.\u0e1e.",
+ "\u0e21\u0e35.\u0e04.",
+ "\u0e40\u0e21.\u0e22.",
+ "\u0e1e.\u0e04.",
+ "\u0e21\u0e34.\u0e22", // no last dot
+ "\u0e01.\u0e04.",
+ "\u0e2a.\u0e04.",
+ "\u0e01.\u0e22.",
+ "\u0e15.\u0e04.",
+ "\u0e1e.\u0e22.",
+ "\u0e18.\u0e04.");
testMap(THTH, MONTH, NARROW_STANDALONE,
"\u0e21.\u0e04.",
"\u0e01.\u0e1e.",
@@ -146,7 +158,7 @@
Calendar cal = Calendar.getInstance(locale);
Map<String, Integer> got = cal.getDisplayNames(field, style, locale);
if (!(expectedMap == null && got == null)
- && !expectedMap.equals(got)) {
+ && !(expectedMap != null && expectedMap.equals(got))) {
System.err.printf("testMap: locale=%s, field=%d, style=%d, expected=%s, got=%s%n",
locale, field, style, expectedMap, got);
errors++;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Map/FunctionalCMEs.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Arrays;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+
+/**
+ * @test
+ * @bug 8071667
+ * @summary Ensure that ConcurrentModificationExceptions are thrown as specified from Map methods that accept Functions
+ * @author bchristi
+ * @build Defaults
+ * @run testng FunctionalCMEs
+ */
+public class FunctionalCMEs {
+ final static String KEY = "key";
+
+ @DataProvider(name = "Maps", parallel = true)
+ private static Iterator<Object[]> makeMaps() {
+ return Arrays.asList(
+ // Test maps that CME
+ new Object[]{new HashMap<>(), true},
+ new Object[]{new Hashtable<>(), true},
+ new Object[]{new LinkedHashMap<>(), true},
+ // Test default Map methods - no CME
+ new Object[]{new Defaults.ExtendsAbstractMap<>(), false}
+ ).iterator();
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testComputeIfAbsent(Map<String,String> map, boolean expectCME) {
+ checkCME(() -> {
+ map.computeIfAbsent(KEY, k -> {
+ putToForceRehash(map);
+ return "computedValue";
+ });
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testCompute(Map<String,String> map, boolean expectCME) {
+ checkCME(() -> {
+ map.compute(KEY, mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testComputeWithKeyMapped(Map<String,String> map, boolean expectCME) {
+ map.put(KEY, "firstValue");
+ checkCME(() -> {
+ map.compute(KEY, mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testComputeIfPresent(Map<String,String> map, boolean expectCME) {
+ map.put(KEY, "firstValue");
+ checkCME(() -> {
+ map.computeIfPresent(KEY, mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testMerge(Map<String,String> map, boolean expectCME) {
+ map.put(KEY, "firstValue");
+ checkCME(() -> {
+ map.merge(KEY, "nextValue", mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testForEach(Map<String,String> map, boolean ignored) {
+ checkCME(() -> {
+ map.put(KEY, "firstValue");
+ putToForceRehash(map);
+ map.forEach((k,v) -> {
+ map.remove(KEY);
+ });
+ }, true);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testReplaceAll(Map<String,String> map, boolean ignored) {
+ checkCME(() -> {
+ map.put(KEY, "firstValue");
+ putToForceRehash(map);
+ map.replaceAll((k,v) -> {
+ map.remove(KEY);
+ return "computedValue";
+ });
+ },true);
+ }
+
+ private static void checkCME(Runnable code, boolean expectCME) {
+ try {
+ code.run();
+ } catch (ConcurrentModificationException cme) {
+ if (expectCME) { return; } else { throw cme; }
+ }
+ if (expectCME) {
+ throw new RuntimeException("Expected CME, but wasn't thrown");
+ }
+ }
+
+ private static BiFunction<String,String,String> mkBiFunc(Map<String,String> map) {
+ return (k,v) -> {
+ putToForceRehash(map);
+ return "computedValue";
+ };
+ }
+
+ private static void putToForceRehash(Map<String,String> map) {
+ for (int i = 0; i < 64; ++i) {
+ map.put(i + "", "value");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/Configuration/InvalidEscapeConfigurationTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.logging.LogManager;
+
+
+/**
+ * @test
+ * @bug 8075810
+ * @run main/othervm InvalidEscapeConfigurationTest
+ * @author danielfuchs
+ */
+public class InvalidEscapeConfigurationTest {
+
+ public static void main(String[] args)
+ throws UnsupportedEncodingException, IOException {
+ String[] validEscapes = {
+ "com.f\\u006fo.level = INF\\u004f",
+ "com.f\\u006fo.level = INFO",
+ "com.foo.level = INF\\u004f"
+ };
+ String[] invalidEscapes = {
+ "com.fo\\u0O6f.level = INF\\u0O4f",
+ "com.fo\\u0O6f.level = INFO",
+ "com.foo.level = INF\\u0O4f"
+ };
+ for (String line : validEscapes) {
+ test(line, true);
+ }
+ for (String line : invalidEscapes) {
+ test(line, false);
+ }
+ try {
+ Properties props = new Properties();
+ props.load((InputStream)null);
+ throw new RuntimeException("Properties.load(null): "
+ + "NullPointerException exception not raised");
+ } catch (NullPointerException x) {
+ System.out.println("Properties.load(null): "
+ + "got expected exception: " + x);
+ }
+ try {
+ LogManager.getLogManager().readConfiguration(null);
+ throw new RuntimeException("LogManager.readConfiguration(null): "
+ + "NullPointerException exception not raised");
+ } catch (NullPointerException x) {
+ System.out.println("LogManager.readConfiguration(null): "
+ + "got expected exception: " + x);
+ }
+
+
+ }
+
+ public static void test(String line, boolean valid) throws IOException {
+ String test = (valid ? "valid" : "invalid")
+ + " line \"" +line + "\"";
+ System.out.println("Testing " + test);
+
+ // First verify that we get the expected result from Properties.load()
+ try {
+ ByteArrayInputStream bais =
+ new ByteArrayInputStream(line.getBytes("UTF-8"));
+ Properties props = new Properties();
+ props.load(bais);
+ if (!valid) {
+ throw new RuntimeException(test
+ + "\n\tProperties.load: expected exception not raised");
+ } else {
+ System.out.println("Properties.load passed for " + test);
+ }
+ } catch(IllegalArgumentException x) {
+ if (!valid) {
+ System.out.println(
+ "Properties.load: Got expected exception: "
+ + x + "\n\tfor " + test);
+ } else {
+ throw x;
+ }
+ }
+
+ // Then verify that we get the expected result from
+ // LogManager.readConfiguration
+ try {
+ String content = defaultConfiguration() + '\n' + line + '\n';
+ ByteArrayInputStream bais =
+ new ByteArrayInputStream(content.getBytes("UTF-8"));
+ LogManager.getLogManager().readConfiguration(bais);
+ if (!valid) {
+ throw new RuntimeException(test
+ + "\n\tLogManager.readConfiguration: "
+ + "expected exception not raised");
+ } else {
+ System.out.println("LogManager.readConfiguration passed for "
+ + test);
+ }
+ } catch(IOException x) {
+ if (!valid) {
+ System.out.println(
+ "LogManager.readConfiguration: Got expected exception: "
+ + x + "\n\tfor " + test);
+ } else {
+ throw x;
+ }
+ }
+ }
+
+ static String getConfigurationFileName() {
+ String fname = System.getProperty("java.util.logging.config.file");
+ if (fname == null) {
+ fname = System.getProperty("java.home");
+ if (fname == null) {
+ throw new Error("Can't find java.home ??");
+ }
+ fname = Paths.get(fname, "conf", "logging.properties")
+ .toAbsolutePath().normalize().toString();
+ }
+ return fname;
+ }
+
+ static String defaultConfiguration() throws IOException {
+ Properties props = new Properties();
+ String fileName = getConfigurationFileName();
+ if (Files.exists(Paths.get(fileName))) {
+ try (InputStream is = new FileInputStream(fileName);) {
+ props.load(is);
+ } catch(IOException x) {
+ throw new UncheckedIOException(x);
+ }
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ props.store(bos, null);
+ return bos.toString();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/TestLoggerNames.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.Semaphore;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+
+/**
+ * @test
+ * @bug 7113878
+ * @summary This is not a test that will check that 7113878 is fixed, but
+ * rather a test that will invoke the modified code & try to verify
+ * that fixing 7113878 has not introduced some big regression.
+ * This test should pass, whether 7113878 is there or not.
+ * @run main/othervm TestLoggerNames
+ * @author danielfuchs
+ */
+public class TestLoggerNames {
+
+ static final class TestLogger extends java.util.logging.Logger {
+
+ final Semaphore sem = new Semaphore(0);
+ final Semaphore wait = new Semaphore(0);
+
+ public TestLogger(String name, String resourceBundleName) {
+ super(name, resourceBundleName);
+ }
+
+ @Override
+ public Handler[] getHandlers() {
+ boolean found = false;
+ try {
+ System.out.println("Entering "+getName()+" getHandlers()");
+ for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
+ if (LogManager.class.getName().equals(ste.getClassName())
+ && "reset".equals(ste.getMethodName())) {
+ found = true;
+ System.out.println(getName()+" getHandlers() called by " + ste);
+ }
+ }
+ sem.release();
+ try {
+ System.out.println("TestLogger: Acquiring wait for "+getName());
+ wait.acquire();
+ try {
+ System.out.println("TestLogger: Acquired wait for "+getName());
+ return super.getHandlers();
+ } finally {
+ System.out.println("TestLogger: Releasing wait for "+getName());
+ wait.release();
+ }
+ } finally {
+ System.out.println("Unblocking "+getName());
+ sem.acquire();
+ System.out.println("Unblocked "+getName());
+ if (found) {
+ System.out.println("Reset will proceed...");
+ }
+ }
+ } catch (InterruptedException x) {
+ throw new IllegalStateException(x);
+ }
+ }
+ }
+
+ static volatile boolean stop;
+ static volatile Throwable resetFailed;
+ static volatile Throwable checkLoggerNamesFailed;
+ static volatile Phaser phaser = new Phaser(2);
+
+
+ static void checkLoggerNames(List<Logger> loggers) {
+ Enumeration<String> names = LogManager.getLogManager().getLoggerNames();
+ if (names instanceof Iterator) {
+ for (Iterator<?> it = Iterator.class.cast(names); it.hasNext(); ) {
+ try {
+ it.remove();
+ throw new RuntimeException("Iterator supports remove!");
+ } catch (UnsupportedOperationException x) {
+ System.out.println("OK: Iterator doesn't support remove.");
+ }
+ }
+ }
+ List<String> loggerNames = Collections.list(names);
+ if (!loggerNames.contains("")) {
+ throw new RuntimeException("\"\"" +
+ " not found in " + loggerNames);
+ }
+ if (!loggerNames.contains("global")) {
+ throw new RuntimeException("global" +
+ " not found in " + loggerNames);
+ }
+ for (Logger l : loggers) {
+ if (!loggerNames.contains(l.getName())) {
+ throw new RuntimeException(l.getName() +
+ " not found in " + loggerNames);
+ }
+ }
+ System.out.println("Got all expected logger names");
+ }
+
+
+ public static void main(String[] args) throws InterruptedException {
+ LogManager.getLogManager().addLogger(new TestLogger("com.foo.bar.zzz", null));
+ try {
+ Logger.getLogger(null);
+ throw new RuntimeException("Logger.getLogger(null) didn't throw expected NPE");
+ } catch (NullPointerException x) {
+ System.out.println("Got expected NullPointerException for Logger.getLogger(null)");
+ }
+ List<Logger> loggers = new CopyOnWriteArrayList<>();
+ loggers.add(Logger.getLogger("one.two.addMeAChild"));
+ loggers.add(Logger.getLogger("aaa.bbb.replaceMe"));
+ loggers.add(Logger.getLogger("bbb.aaa.addMeAChild"));
+ TestLogger test = (TestLogger)Logger.getLogger("com.foo.bar.zzz");
+ loggers.add(Logger.getLogger("ddd.aaa.addMeAChild"));
+
+ checkLoggerNames(loggers);
+
+ Thread loggerNamesThread = new Thread(() -> {
+ try {
+ while (!stop) {
+ checkLoggerNames(loggers);
+ Thread.sleep(10);
+ if (!stop) {
+ phaser.arriveAndAwaitAdvance();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace(System.err);
+ checkLoggerNamesFailed = t;
+ }
+ }, "loggerNames");
+
+ Thread resetThread = new Thread(() -> {
+ try {
+ System.out.println("Calling reset...");
+ LogManager.getLogManager().reset();
+ System.out.println("Reset done...");
+ System.out.println("Reset again...");
+ LogManager.getLogManager().reset();
+ System.out.println("Reset done...");
+ } catch(Throwable t) {
+ resetFailed = t;
+ System.err.println("Unexpected exception or error in reset Thread");
+ t.printStackTrace(System.err);
+ }
+ }, "reset");
+
+ resetThread.setDaemon(true);
+ resetThread.start();
+
+ System.out.println("Waiting for reset to get handlers");
+ test.sem.acquire();
+ try {
+ loggerNamesThread.start();
+ System.out.println("Reset has called getHandlers on " + test.getName());
+ int i = 0;
+ for (Enumeration<String> e = LogManager.getLogManager().getLoggerNames();
+ e.hasMoreElements();) {
+ String name = e.nextElement();
+ if (name.isEmpty()) continue;
+ if (name.endsWith(".addMeAChild")) {
+ Logger l = Logger.getLogger(name+".child");
+ loggers.add(l);
+ System.out.println("*** Added " + l.getName());
+ i++;
+ } else if (name.endsWith("replaceMe")) {
+ Logger l = Logger.getLogger(name);
+ loggers.remove(l);
+ l = Logger.getLogger(name.replace("replaceMe", "meReplaced"));
+ loggers.add(l);
+ System.gc();
+ if (LogManager.getLogManager().getLogger(name) == null) {
+ System.out.println("*** "+ name + " successfully replaced with " + l.getName());
+ }
+ i++;
+ } else {
+ System.out.println("Nothing to do for logger: " + name);
+ }
+ phaser.arriveAndAwaitAdvance();
+ if (i >= 3 && i++ == 3) {
+ System.out.println("Loggers are now: " +
+ Collections.list(LogManager.getLogManager().getLoggerNames()));
+ test.wait.release();
+ test.sem.release();
+ System.out.println("Joining " + resetThread);
+ resetThread.join();
+ }
+ }
+ } catch (RuntimeException | InterruptedException | Error x) {
+ test.wait.release();
+ test.sem.release();
+ throw x;
+ } finally {
+ stop = true;
+ phaser.arriveAndDeregister();
+ loggerNamesThread.join();
+ loggers.clear();
+ }
+
+
+ if (resetFailed != null || checkLoggerNamesFailed != null) {
+ RuntimeException r = new RuntimeException("Some of the concurrent threads failed");
+ if (resetFailed != null) r.addSuppressed(resetFailed);
+ if (checkLoggerNamesFailed != null) r.addSuppressed(checkLoggerNamesFailed);
+ throw r;
+ }
+
+ }
+
+}
--- a/jdk/test/java/util/zip/EntryCount64k.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/java/util/zip/EntryCount64k.java Fri Apr 03 13:46:22 2015 -0700
@@ -30,10 +30,19 @@
* @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k
*/
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.nio.file.Files;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.RandomAccessFile;
import java.nio.file.Paths;
-import java.util.*;
-import java.util.zip.*;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.ProcessTools;
@@ -41,11 +50,15 @@
public class EntryCount64k {
public static class Main {
public static void main(String[] args) {
- System.out.println("Main");
+ System.out.print("Main");
}
}
- static final String mainClass = "EntryCount64k$Main";
+ static final String MAIN_CLASS = "EntryCount64k$Main";
+ static final String THIS_CLASS = "EntryCount64k";
+ static final String[] SPECIAL_CLASSES = { MAIN_CLASS, THIS_CLASS };
+ // static final String[] SPECIAL_CLASSES = { MAIN_CLASS };
+ static final int SPECIAL_COUNT = 1 + SPECIAL_CLASSES.length;
public static void main(String[] args) throws Throwable {
for (int i = (1 << 16) - 3; i < (1 << 16) + 2; i++)
@@ -60,30 +73,27 @@
BufferedOutputStream bos = new BufferedOutputStream(fos);
ZipOutputStream zos = new ZipOutputStream(bos)) {
- // Add 2 special entries, manifest and main class,
- // to allow the zip file to be used with "java -jar"
- ZipEntry man = new ZipEntry("META-INF/MANIFEST.MF");
- zos.putNextEntry(man);
- zos.write("Manifest-Version: 1.0\n".getBytes("US-ASCII"));
- zos.write(("Main-Class: " + mainClass + "\n").getBytes("US-ASCII"));
+ // Add entries to allow the zip file to be used with "java -jar"
+ zos.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));
+ for (String line : new String[] {
+ "Manifest-Version: 1.0",
+ "Main-Class: " + MAIN_CLASS,
+ })
+ zos.write((line + "\n").getBytes("US-ASCII"));
zos.closeEntry();
- String mainName = mainClass + ".class";
- ZipEntry mainEntry = new ZipEntry(mainName);
String testClasses = System.getProperty("test.classes");
- File mainFile = new File(testClasses, mainName);
- zos.putNextEntry(mainEntry);
- try (FileInputStream fis = new FileInputStream(mainFile)) {
- byte[] buf = new byte[4096];
- int n;
- while ((n = fis.read(buf)) > 0)
- zos.write(buf, 0, n);
+ for (String className : SPECIAL_CLASSES) {
+ String baseName = className + ".class";
+ ZipEntry ze = new ZipEntry(baseName);
+ File file = new File(testClasses, baseName);
+ zos.putNextEntry(ze);
+ Files.copy(file.toPath(), zos);
+ zos.closeEntry();
}
- zos.closeEntry();
- for (int i = 2; i < entryCount; i++) {
- ZipEntry e = new ZipEntry(Integer.toString(i));
- zos.putNextEntry(e);
+ for (int i = SPECIAL_COUNT; i < entryCount; i++) {
+ zos.putNextEntry(new ZipEntry(Integer.toString(i)));
zos.closeEntry();
}
}
@@ -121,17 +131,14 @@
static void checkCanRead(File zipFile, int entryCount) throws Throwable {
// Check ZipInputStream API
- try (ZipInputStream zis =
- new ZipInputStream(
- new BufferedInputStream(
- new FileInputStream(zipFile)))) {
- // skip over first two entries
- for (int i = 0; i < 2; i++)
- zis.getNextEntry();
- for (int i = 2; i < entryCount; i++) {
+ try (FileInputStream fis = new FileInputStream(zipFile);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ ZipInputStream zis = new ZipInputStream(bis)) {
+ for (int i = 0; i < entryCount; i++) {
ZipEntry e = zis.getNextEntry();
- if (Integer.parseInt(e.getName()) != i)
- throw new AssertionError(e.getName());
+ if (i >= SPECIAL_COUNT) // skip special entries
+ if (Integer.parseInt(e.getName()) != i)
+ throw new AssertionError(e.getName());
}
if (zis.getNextEntry() != null)
throw new AssertionError();
@@ -140,13 +147,11 @@
// Check ZipFile API
try (ZipFile zf = new ZipFile(zipFile)) {
Enumeration<? extends ZipEntry> en = zf.entries();
- // skip over first two entries
- for (int i = 0; i < 2; i++)
- en.nextElement();
- for (int i = 2; i < entryCount; i++) {
+ for (int i = 0; i < entryCount; i++) {
ZipEntry e = en.nextElement();
- if (Integer.parseInt(e.getName()) != i)
- throw new AssertionError();
+ if (i >= SPECIAL_COUNT) // skip special entries
+ if (Integer.parseInt(e.getName()) != i)
+ throw new AssertionError();
}
if (en.hasMoreElements()
|| (zf.size() != entryCount)
@@ -162,7 +167,7 @@
ProcessBuilder pb = new ProcessBuilder(cmd);
OutputAnalyzer a = ProcessTools.executeProcess(pb);
a.shouldHaveExitValue(0);
- a.stdoutShouldMatch("\\AMain\n\\Z");
+ a.stdoutShouldMatch("\\AMain\\Z");
a.stderrShouldMatch("\\A\\Z");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/stream/ShortStreamTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8074954
+ * @summary Test verifies that an IOException is triggered if input stream
+ * does not contain enough data to read a multi-byte type.
+ *
+ * @run main ShortStreamTest
+ */
+
+import javax.imageio.ImageIO;
+import javax.imageio.stream.ImageInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+public class ShortStreamTest {
+ public static void main(String[] args) throws IOException {
+ TestCase[] tests = createTests();
+
+ for (TestCase t : tests) {
+ t.test();
+ }
+ }
+
+ private static abstract class TestCase {
+ abstract void testRead(ImageInputStream iis) throws IOException;
+
+ public void test() {
+ boolean gotException = false;
+
+ ImageInputStream iis = createShortStream();
+
+ try {
+ testRead(iis);
+ } catch (IOException e) {
+ e.printStackTrace(System.out);
+ gotException = true;
+ }
+
+ if (!gotException) {
+ throw new RuntimeException("Test failed.");
+ }
+ System.out.println("Test PASSED");
+ }
+ }
+
+
+ private static ImageInputStream createShortStream() {
+ try {
+ byte[] integerTestArray = new byte[] { 80 };
+ ByteArrayInputStream bais = new ByteArrayInputStream(integerTestArray);
+
+ return ImageIO.createImageInputStream(bais);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ private static TestCase[] createTests() {
+ return new TestCase[]{
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readInt();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readShort();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readDouble();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readFloat();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readLong();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readUnsignedInt();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readUnsignedShort();
+ }
+ }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 4473075
+ @summary JTable header rendering problem (after setting preferred size)
+ @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug4473075 {
+ public static final int USER_HEADER_HEIGHT = 40;
+ private static JTable table;
+ private static JScrollPane scpScroll;
+ private static Point point;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(20);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame = new JFrame();
+ frame.setUndecorated(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ table = new JTable();
+ String t = "a cell text";
+ table.setModel(new DefaultTableModel(
+ new Object[][]{new Object[]{t, t, t, t, t}},
+ new Object[]{t, t, t, t, t}));
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+ scpScroll = new JScrollPane(table);
+
+ // Manually set preferred size of header...
+ Dimension preferredSize = new Dimension(table.getSize().width,
+ USER_HEADER_HEIGHT);
+ table.getTableHeader().setPreferredSize(preferredSize);
+
+ frame.setContentPane(scpScroll);
+ frame.setSize(250, 480);
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ point = scpScroll.getHorizontalScrollBar()
+ .getLocationOnScreen();
+ }
+ });
+ robot.waitForIdle();
+
+ robot.mouseMove(point.x + 100, point.y + 5);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseMove(point.x + 150, point.y + 5);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ int headerH = table.getTableHeader().getHeight();
+ if (headerH != USER_HEADER_HEIGHT) {
+ throw new RuntimeException("TableHeader height was not set: "
+ + headerH + " !=" + USER_HEADER_HEIGHT);
+ }
+
+ double tableX = table.getX();
+ int headerX = table.getTableHeader().getX();
+ if (tableX != headerX) {
+ throw new RuntimeException("TableHeader X position is wrong: "
+ + tableX + " !=" + headerX);
+ }
+
+ double tableW = table.getWidth();
+ int headerW = table.getTableHeader().getWidth();
+ if (tableW != headerW) {
+ throw new RuntimeException("TableHeader width is wrong: "
+ + tableW + " !=" + headerW);
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ frame.dispose();
+ }
+ });
+ System.out.println("ok");
+ }
+}
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java Fri Apr 03 13:46:22 2015 -0700
@@ -28,8 +28,6 @@
@run main bug7123767
*/
-import sun.awt.SunToolkit;
-
import javax.swing.*;
import javax.swing.plaf.metal.MetalLookAndFeel;
import java.awt.*;
@@ -160,8 +158,10 @@
// Moves mouse pointer to the corners of every GraphicsConfiguration
private static void testToolTip() throws AWTException {
- SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
- toolkit.realSync();
+
+ robot = new Robot();
+ robot.setAutoDelay(20);
+ robot.waitForIdle();
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = environment.getScreenDevices();
@@ -169,28 +169,28 @@
GraphicsConfiguration[] configs = device.getConfigurations();
for (GraphicsConfiguration config : configs) {
Rectangle rect = config.getBounds();
- Insets insets = toolkit.getScreenInsets(config);
+ Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
adjustInsets(rect, insets);
// Upper left
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + MARGIN, rect.y + MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
// Lower left
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + MARGIN, rect.y + rect.height - MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
// Upper right
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + rect.width - MARGIN, rect.y + MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
// Lower right
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java Fri Apr 03 13:46:22 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8040328
+ @summary JSlider has wrong preferred size with Synth LAF
+ @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import java.awt.*;
+import java.io.ByteArrayInputStream;
+
+public class bug8040328 {
+ private static String synthXml = "<synth>" +
+ " <style id=\"all\">" +
+ " <font name=\"Segoe UI\" size=\"12\"/>" +
+ " </style>" +
+ " <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
+ " <style id=\"slider\">" +
+ " <insets top=\"10\" left=\"5\" bottom=\"10\" right=\"5\"/>" +
+ " </style>" +
+ " <bind style=\"slider\" type=\"region\" key=\"Slider\"/>" +
+ "</synth>";
+
+ public static void main(String[] args) throws Exception {
+ SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
+ lookAndFeel.load(new ByteArrayInputStream(synthXml.getBytes("UTF8")),
+ bug8040328.class);
+ UIManager.setLookAndFeel(lookAndFeel);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final JFrame frame = new JFrame();
+ try {
+ frame.setUndecorated(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setVisible(true);
+ test(frame);
+ } finally {
+ frame.dispose();
+ }
+ }
+ });
+ System.out.println("ok");
+ }
+
+ static void test(JFrame frame) {
+ JSlider hslider = new JSlider(JSlider.HORIZONTAL);
+ hslider.setBackground(Color.DARK_GRAY);
+ frame.getContentPane().add(hslider, BorderLayout.CENTER);
+ frame.getContentPane().setBackground(Color.CYAN);
+ frame.pack();
+ Insets insets = hslider.getInsets();
+ if (hslider.getWidth() != 200 + insets.left + insets.right) {
+ throw new RuntimeException(
+ "Horizontal slider width is wrong " + hslider.getWidth());
+ }
+ if (hslider.getHeight() != hslider.getMinimumSize().height) {
+ throw new RuntimeException(
+ "Horizontal slider height is wrong " + hslider.getHeight());
+ }
+ frame.getContentPane().remove(hslider);
+
+ JSlider vslider = new JSlider(JSlider.VERTICAL);
+ frame.getContentPane().add(vslider);
+ frame.pack();
+ insets = vslider.getInsets();
+ if (vslider.getWidth() != vslider.getMinimumSize().width) {
+ throw new RuntimeException(
+ "Verical slider width is wrong " + vslider.getWidth());
+ }
+ if (vslider.getHeight() != 200 + insets.top + insets.bottom) {
+ throw new RuntimeException(
+ "Verical slider height is wrong " + vslider.getHeight());
+ }
+ }
+}
--- a/jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java Fri Apr 03 13:46:22 2015 -0700
@@ -23,10 +23,11 @@
/**
* @test
- * @bug 8062923 8062924
+ * @bug 8062923 8062924 8074297 8076290
* @run testng XslSubstringTest
* @summary Test xsl substring function with negative, Inf and
- * NaN length and few other use cases
+ * NaN length and few other use cases. Also test proper
+ * processing of supplementary characters by substring function.
*/
import java.io.StringReader;
@@ -39,6 +40,7 @@
import javax.xml.transform.stream.StreamSource;
import static org.testng.Assert.assertEquals;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class XslSubstringTest {
@@ -50,6 +52,36 @@
+ "<xsl:template match='/'><t>";
final String xslPost = "</t></xsl:template></xsl:stylesheet>";
+ @DataProvider(name = "GeneralTestsData")
+ private Object[][] xmls() {
+ return new Object[][] {
+ { "|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|", "<t>|s|</t>"},
+ { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>"},
+ { "|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|", "<t>||</t>" },
+ { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>" },
+ // 8076290 bug test case
+ { "|<xsl:value-of select=\"substring('123', 0, 3)\"/>|", "<t>|12|</t>"},
+ };
+ }
+
+ @DataProvider(name = "SupplementaryCharactersTestData")
+ private Object[][] dataSupplementaryCharacters() {
+ return new Object[][] {
+ // 8074297 bug test cases
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3)\"/>|", "<t>|BC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3, 1)\"/>|", "<t>|B|</t>" },
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 2, 2)\"/>|", "<t>|AB|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3, 2)\"/>|", "<t>|BC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3, 4)\"/>|", "<t>|BC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 1, 1)\"/>|", "<t>|𠀋|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 2, 1)\"/>|", "<t>|A|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 1, 1 div 0)\"/>|", "<t>|𠀋ABC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', -10, 1 div 0)\"/>|", "<t>|𠀋ABC|</t>"},
+ // 8076290 bug test case
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 0, 2)\"/>|", "<t>|𠀋|</t>"},
+ };
+ }
+
private String testTransform(String xsl) throws Exception {
//Prepare sources for transormation
Source src = new StreamSource(new StringReader(xml));
@@ -78,27 +110,14 @@
"<t>||</t>");
}
- @Test
- public void testGeneral1() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|"),
- "<t>|s|</t>");
- }
-
- @Test
- public void testGeneral2() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|"),
- "<t>|sdf|</t>");
+ @Test(dataProvider = "GeneralTestsData")
+ public void testGeneralAll(String xsl, String result) throws Exception {
+ assertEquals(testTransform(xsl), result);
}
- @Test
- public void testGeneral3() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|"),
- "<t>||</t>");
+ @Test(dataProvider = "SupplementaryCharactersTestData")
+ public void testSupplementCharacters(String xsl, String result) throws Exception {
+ assertEquals(testTransform(xsl), result);
}
- @Test
- public void testGeneral4() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 0 div 0)\"/>|"),
- "<t>||</t>");
- }
}
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION Fri Apr 03 13:46:22 2015 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2015a
+tzdata2015b
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia Fri Apr 03 13:46:22 2015 -0700
@@ -1927,6 +1927,13 @@
# was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
# this is almost surely wrong.
+# From Ganbold Tsagaankhuu (2015-03-10):
+# It seems like yesterday Mongolian Government meeting has concluded to use
+# daylight saving time in Mongolia.... Starting at 2:00AM of last Saturday of
+# March 2015, daylight saving time starts. And 00:00AM of last Saturday of
+# September daylight saving time ends. Source:
+# http://zasag.mn/news/view/8969
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S
Rule Mongol 1983 only - Oct 1 0:00 0 -
@@ -1947,6 +1954,8 @@
Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S
Rule Mongol 2001 2006 - Sep lastSat 2:00 0 -
Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Sep lastSat 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -2365,13 +2374,19 @@
# official source...:
# http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
-# From Paul Eggert (2013-09-24):
-# For future dates, guess the last Thursday in March at 24:00 through
-# the first Friday on or after September 21 at 00:00. This is consistent with
-# the predictions in today's editions of the following URLs,
-# which are for Gaza and Hebron respectively:
-# http://www.timeanddate.com/worldclock/timezone.html?n=702
-# http://www.timeanddate.com/worldclock/timezone.html?n=2364
+# From Steffen Thorsen (2015-03-03):
+# Sources such as http://www.alquds.com/news/article/view/id/548257
+# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# start DST on 2015-03-28 00:00 which is one day later than expected.
+#
+# From Paul Eggert (2015-03-03):
+# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# says that the fall 2014 transition was Oct 23 at 24:00.
+# For future dates, guess the last Friday in March at 24:00 through
+# the first Friday on or after October 21 at 00:00. This is consistent with
+# the predictions in today's editions of the following URLs:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -2397,9 +2412,11 @@
Rule Palestine 2011 only - Aug 1 0:00 0 -
Rule Palestine 2011 only - Aug 30 0:00 1:00 S
Rule Palestine 2011 only - Sep 30 0:00 0 -
-Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S
+Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
Rule Palestine 2012 only - Sep 21 1:00 0 -
-Rule Palestine 2013 max - Sep Fri>=21 0:00 0 -
+Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
+Rule Palestine 2014 max - Oct Fri>=21 0:00 0 -
+Rule Palestine 2015 max - Mar lastFri 24:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia Fri Apr 03 13:46:22 2015 -0700
@@ -396,6 +396,7 @@
9:39:00 - LMT 1901 # Agana
10:00 - GST 2000 Dec 23 # Guam
10:00 - ChST # Chamorro Standard Time
+Link Pacific/Guam Pacific/Saipan # N Mariana Is
# Kiribati
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -411,12 +412,7 @@
14:00 - LINT
# N Mariana Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Pacific/Saipan -14:17:00 - LMT 1844 Dec 31
- 9:43:00 - LMT 1901
- 9:00 - MPT 1969 Oct # N Mariana Is Time
- 10:00 - MPT 2000 Dec 23
- 10:00 - ChST # Chamorro Standard Time
+# See Pacific/Guam.
# Marshall Is
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -586,6 +582,7 @@
-11:00 - NST 1967 Apr # N=Nome
-11:00 - BST 1983 Nov 30 # B=Bering
-11:00 - SST # S=Samoa
+Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
# Samoa (formerly and also known as Western Samoa)
@@ -767,23 +764,7 @@
# uninhabited
# Midway
-#
-# From Mark Brader (2005-01-23):
-# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
-# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
-# reproduced a Pan American Airways timetable from 1936, for their weekly
-# "Orient Express" flights between San Francisco and Manila, and connecting
-# flights to Chicago and the US East Coast. As it uses some time zone
-# designations that I've never seen before:....
-# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I. H.L.T. Ar. 5:30P Sun.
-# " 3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A "
-#
-Zone Pacific/Midway -11:49:28 - LMT 1901
- -11:00 - NST 1956 Jun 3
- -11:00 1:00 NDT 1956 Sep 2
- -11:00 - NST 1967 Apr # N=Nome
- -11:00 - BST 1983 Nov 30 # B=Bering
- -11:00 - SST # S=Samoa
+# See Pacific/Pago_Pago.
# Palmyra
# uninhabited since World War II; was probably like Pacific/Kiritimati
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe Fri Apr 03 13:46:22 2015 -0700
@@ -2423,7 +2423,7 @@
4:00 Russia VOL%sT 1989 Mar 26 2:00s # Volgograd T
3:00 Russia VOL%sT 1991 Mar 31 2:00s
4:00 - VOLT 1992 Mar 29 2:00s
- 3:00 Russia MSK 2011 Mar 27 2:00s
+ 3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK 2014 Oct 26 2:00s
3:00 - MSK
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica Fri Apr 03 13:46:22 2015 -0700
@@ -2335,8 +2335,24 @@
# "...the new time zone will come into effect at two o'clock on the first Sunday
# of February, when we will have to advance the clock one hour from its current
# time..."
+# Also, the new zone will not use DST.
#
-# Also, the new zone will not use DST.
+# From Carlos Raúl Perasso (2015-02-02):
+# The decree that modifies the Mexican Hour System Law has finally
+# been published at the Diario Oficial de la Federación
+# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
+# It establishes 5 zones for Mexico:
+# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
+# includes most of Mexico, excluding what's mentioned below.
+# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
+# states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
+# de Banderas which lies in Central Zone); Sinaloa and Sonora.
+# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
+# state of Baja California.
+# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
+# of Quintana Roo.
+# 5- The islands, reefs and keys shall take their timezone from the
+# longitude they are located at.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mexico 1939 only - Feb 5 0:00 1:00 D
@@ -2531,14 +2547,9 @@
###############################################################################
# Anguilla
+# Antigua and Barbuda
# See America/Port_of_Spain.
-# Antigua and Barbuda
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
- -5:00 - EST 1951
- -4:00 - AST
-
# Bahamas
#
# For 1899 Milne gives -5:09:29.5; round that.
@@ -2604,10 +2615,7 @@
-4:00 US A%sT
# Cayman Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
- -5:07:11 - KMT 1912 Feb # Kingston Mean Time
- -5:00 - EST
+# See America/Panama.
# Costa Rica
@@ -3130,6 +3138,7 @@
Zone America/Panama -5:18:08 - LMT 1890
-5:19:36 - CMT 1908 Apr 22 # Colón Mean Time
-5:00 - EST
+Link America/Panama America/Cayman
# Puerto Rico
# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica Wed Mar 25 18:33:17 2015 +0100
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica Fri Apr 03 13:46:22 2015 -0700
@@ -1229,10 +1229,13 @@
# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
-# From Juan Correa (2015-01-28):
-# ... today the Ministry of Energy announced that Chile will drop DST, will keep
-# "summer time" (UTC -3 / UTC -5) all year round....
-# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+# From Eduardo Romero Urra (2015-03-03):
+# Today has been published officially that Chile will use the DST time
+# permanently until March 25 of 2017
+# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
+#
+# From Paul Eggert (2015-03-03):
+# For now, assume that the extension will persist indefinitely.
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
@@ -1291,7 +1294,7 @@
-3:00 - CLT
Zone Pacific/Easter -7:17:44 - LMT 1890
-7:17:28 - EMT 1932 Sep # Easter Mean Time
- -7:00 Chile EAS%sT 1982 Mar 13 3:00u # Easter Time
+ -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time
-6:00 Chile EAS%sT 2015 Apr 26 3:00u
-5:00 - EAST
#
@@ -1626,6 +1629,7 @@
# These all agree with Trinidad and Tobago since 1970.
Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Antigua
Link America/Port_of_Spain America/Dominica
Link America/Port_of_Spain America/Grenada
Link America/Port_of_Spain America/Guadeloupe