Mercurial > hg > icedtea7-forest > jdk
changeset 9192:5af12d99fb1e icedtea-2.7.0pre12
Merge jdk7u141-b02
line wrap: on
line diff
--- a/.hgtags Thu Apr 27 03:09:54 2017 +0100 +++ b/.hgtags Fri Jul 14 00:56:29 2017 +0100 @@ -649,3 +649,5 @@ 86d0df91308912e45e1b00f8699e0b157a8857af jdk7u131-b00 d6392d3c3e8dedd968c8301d2dfa4dc98c39e353 icedtea-2.7.0pre10 e14bbf59343de7bfbc5927499983d34ce588ac79 icedtea-2.7.0pre11 +e890a6aef6223d428376aac846c1d1f3e40dbda7 jdk7u141-b00 +a319566e15f5611bae9cfda2696e8217020a9269 jdk7u141-b01
--- a/make/java/java/Makefile Thu Apr 27 03:09:54 2017 +0100 +++ b/make/java/java/Makefile Fri Jul 14 00:56:29 2017 +0100 @@ -216,7 +216,7 @@ ifeq ($(PLATFORM),windows) OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \ -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib \ - shell32.lib delayimp.lib /DELAYLOAD:shell32.dll + shell32.lib delayimp.lib /DELAYLOAD:shell32.dll version.lib else OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) $(LIBSCF) $(LIBDL) \ -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
--- a/make/sun/javazic/tzdata/VERSION Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/VERSION Fri Jul 14 00:56:29 2017 +0100 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2016i +tzdata2017a
--- a/make/sun/javazic/tzdata/africa Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/africa Fri Jul 14 00:56:29 2017 +0100 @@ -29,15 +29,15 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2014-10-31): +# From Paul Eggert (2017-02-20): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). # Unfortunately this book contains many errors and cites no sources. # -# Gwillim Law writes that a good source -# for recent time zone data is the International Air Transport +# Many years ago Gwillim Law wrote that a good source +# for time zone data was the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. Except where otherwise noted, @@ -54,39 +54,33 @@ # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). # +# European-style abbreviations are commonly used along the Mediterranean. +# For sub-Saharan Africa abbreviations were less standardized. # Previous editions of this database used WAT, CAT, SAT, and EAT -# for +0:00 through +3:00, respectively, -# but Mark R V Murray reports that -# 'SAST' is the official abbreviation for +2:00 in the country of South Africa, -# 'CAT' is commonly used for +2:00 in countries north of South Africa, and -# 'WAT' is probably the best name for +1:00, as the common phrase for +# for UT +00 through +03, respectively, +# but in 1997 Mark R V Murray reported that +# 'SAST' is the official abbreviation for +02 in the country of South Africa, +# 'CAT' is commonly used for +02 in countries north of South Africa, and +# 'WAT' is probably the best name for +01, as the common phrase for # the area that includes Nigeria is "West Africa". -# He has heard of "Western Sahara Time" for +0:00 but can find no reference. # -# To make things confusing, 'WAT' seems to have been used for -1:00 long ago; -# I'd guess that this was because people needed _some_ name for -1:00, -# and at the time, far west Africa was the only major land area in -1:00. -# This usage is now obsolete, as the last use of -1:00 on the African -# mainland seems to have been 1976 in Western Sahara. -# -# To summarize, the following abbreviations seem to have some currency: -# -1:00 WAT West Africa Time (no longer used) -# 0:00 GMT Greenwich Mean Time -# 2:00 CAT Central Africa Time -# 2:00 SAST South Africa Standard Time -# and Murray suggests the following abbreviation: -# 1:00 WAT West Africa Time -# I realize that this leads to 'WAT' being used for both -1:00 and 1:00 -# for times before 1976, but this is the best I can think of -# until we get more information. +# To summarize, the following abbreviations seemed to have some currency: +# +00 GMT Greenwich Mean Time +# +02 CAT Central Africa Time +# +02 SAST South Africa Standard Time +# and Murray suggested the following abbreviation: +# +01 WAT West Africa Time +# Murray's suggestion seems to have caught on in news reports and the like. +# I vaguely recall 'WAT' also being used for -01 in the past but +# cannot now come up with solid citations. # # I invented the following abbreviations; corrections are welcome! -# 2:00 WAST West Africa Summer Time -# 2:30 BEAT British East Africa Time (no longer used) -# 2:45 BEAUT British East Africa Unified Time (no longer used) -# 3:00 CAST Central Africa Summer Time (no longer used) -# 3:00 SAST South Africa Summer Time (no longer used) -# 3:00 EAT East Africa Time +# +02 WAST West Africa Summer Time +# +03 CAST Central Africa Summer Time (no longer used) +# +03 SAST South Africa Summer Time (no longer used) +# +03 EAT East Africa Time +# 'EAT' also seems to have caught on; the others are rare but are paired +# with better-attested non-DST abbreviations. # Algeria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -142,19 +136,19 @@ # Cameroon # See Africa/Lagos. -# Cape Verde +# Cape Verde / Cabo Verde # -# Shanks gives 1907 for the transition to CVT. +# Shanks gives 1907 for the transition to +02. # Perhaps the 1911-05-26 Portuguese decree -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf +# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf # merely made it official? # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia - -2:00 - CVT 1942 Sep - -2:00 1:00 CVST 1945 Oct 15 - -2:00 - CVT 1975 Nov 25 2:00 - -1:00 - CVT + -2:00 - -02 1942 Sep + -2:00 1:00 -01 1945 Oct 15 + -2:00 - -02 1975 Nov 25 2:00 + -1:00 - -01 # Central African Republic # See Africa/Lagos. @@ -411,7 +405,7 @@ Rule Ghana 1920 1942 - Dec 31 0:00 0 GMT # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Accra -0:00:52 - LMT 1918 - 0:00 Ghana %s + 0:00 Ghana GMT/+0020 # Guinea # See Africa/Abidjan. @@ -420,20 +414,20 @@ # # Shanks gives 1911-05-26 for the transition to WAT, # evidently confusing the date of the Portuguese decree -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf +# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf # with the date that it took effect, namely 1912-01-01. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 - -1:00 - WAT 1975 + -1:00 - -01 1975 0:00 - GMT # Kenya # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Nairobi 2:27:16 - LMT 1928 Jul 3:00 - EAT 1930 - 2:30 - BEAT 1940 - 2:45 - BEAUT 1960 + 2:30 - +0230 1940 + 2:45 - +0245 1960 3:00 - EAT Link Africa/Nairobi Africa/Addis_Ababa # Ethiopia Link Africa/Nairobi Africa/Asmara # Eritrea @@ -460,7 +454,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Monrovia -0:43:08 - LMT 1882 -0:43:08 - MMT 1919 Mar # Monrovia Mean Time - -0:44:30 - LRT 1972 May # Liberia Time + -0:44:30 - -004430 1972 May 0:00 - GMT ############################################################################### @@ -619,7 +613,7 @@ Rule Mauritius 2009 only - Mar lastSun 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis - 4:00 Mauritius MU%sT # Mauritius Time + 4:00 Mauritius +04/+05 # Agalega Is, Rodriguez # no information; probably like Indian/Mauritius @@ -938,14 +932,14 @@ # since most of it was then controlled by Morocco. Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún - -1:00 - WAT 1976 Apr 14 + -1:00 - -01 1976 Apr 14 0:00 Morocco WE%sT # Mozambique # # Shanks gives 1903-03-01 for the transition to CAT. # Perhaps the 1911-05-26 Portuguese decree -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf +# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf # merely made it official? # # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -972,16 +966,19 @@ # the country are close to 40 minutes earlier in sunrise than the rest # of the country. # -# From Paul Eggert (2007-03-31): -# Apparently the Caprivi Strip informally observes Botswana time, but -# we have no details. In the meantime people there can use Africa/Gaborone. +# From Paul Eggert (2017-02-22): +# Although the Zambezi Region (formerly known as Caprivi) informally +# observes Botswana time, we have no details about historical practice. +# In the meantime people there can use Africa/Gaborone. +# See: Immanuel S. The Namibian. 2017-02-23. +# http://www.namibian.com.na/51480/read/Time-change-divides-lawmakers # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S Rule Namibia 1995 max - Apr Sun>=1 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 - 1:30 - SWAT 1903 Mar # SW Africa Time + 1:30 - +0130 1903 Mar 2:00 - SAST 1942 Sep 20 2:00 2:00 1:00 SAST 1943 Mar 21 2:00 2:00 - SAST 1990 Mar 21 # independence @@ -1008,7 +1005,7 @@ # Réunion # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis - 4:00 - RET # Réunion Time + 4:00 - +04 # # Crozet Islands also observes Réunion time; see the 'antarctica' file. # @@ -1043,7 +1040,7 @@ # Seychelles # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria - 4:00 - SCT # Seychelles Time + 4:00 - +04 # From Paul Eggert (2001-05-30): # Aldabra, Farquhar, and Desroches, originally dependencies of the # Seychelles, were transferred to the British Indian Ocean Territory
--- a/make/sun/javazic/tzdata/antarctica Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/antarctica Fri Jul 14 00:56:29 2017 +0100 @@ -133,7 +133,8 @@ # O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02 # Prat, -6230-05941 # Villa Las Estrellas (a town), around the Frei base, since 1984-04-09 -# These locations have always used Santiago time; use TZ='America/Santiago'. +# These locations employ Region of Magallanes time; use +# TZ='America/Punta_Arenas'. # China - year-round bases # Great Wall, King George Island, -6213-05858, since 1985-02-20
--- a/make/sun/javazic/tzdata/asia Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/asia Fri Jul 14 00:56:29 2017 +0100 @@ -29,15 +29,15 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2015-08-08): +# From Paul Eggert (2017-01-13): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). # Unfortunately this book contains many errors and cites no sources. # -# Gwillim Law writes that a good source -# for recent time zone data is the International Air Transport +# Many years ago Gwillim Law wrote that a good source +# for time zone data was the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. Except where otherwise noted, @@ -58,29 +58,24 @@ # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). # -# I invented the abbreviations marked '*' in the following table; -# the rest are from earlier versions of this file, or from other sources. -# Corrections are welcome! +# The following alphabetic abbreviations appear in these tables: # std dst # LMT Local Mean Time # 2:00 EET EEST Eastern European Time # 2:00 IST IDT Israel -# 3:00 AST ADT Arabia* -# 3:30 IRST IRDT Iran* -# 4:00 GST Gulf* # 5:30 IST India -# 7:00 ICT Indochina, most times and locations* # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China -# 8:00 IDT Indochina, 1943-45, 1947-55, 1960-75 (some locations)* -# 8:00 JWST Western Standard Time (Japan, 1896/1937)* -# 8:30 KST KDT Korea when at +0830* -# 9:00 JCST Central Standard Time (Japan, 1896/1937) +# 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time +# Otherwise, these tables typically use numeric abbreviations like +03 +# and +0330 for integer hour and minute UTC offsets. Although earlier +# editions invented alphabetic time zone abbreviations for every +# offset, this did not reflect common practice. # # See the 'europe' file for Russia and Turkey in Asia. @@ -88,7 +83,7 @@ # Incorporates data for Singapore from Robert Elz' asia 1.1, as well as # additional information from Tom Yap, Sun Microsystems Intercontinental # Technical Support (including a page from the Official Airline Guide - -# Worldwide Edition). The names for time zones are guesses. +# Worldwide Edition). ############################################################################### @@ -109,8 +104,8 @@ # Afghanistan # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kabul 4:36:48 - LMT 1890 - 4:00 - AFT 1945 - 4:30 - AFT + 4:00 - +04 1945 + 4:30 - +0430 # Armenia # From Paul Eggert (2006-03-22): @@ -253,18 +248,17 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Dhaka 6:01:40 - LMT 1890 5:53:20 - HMT 1941 Oct # Howrah Mean Time? - 6:30 - BURT 1942 May 15 # Burma Time - 5:30 - IST 1942 Sep - 6:30 - BURT 1951 Sep 30 - 6:00 - DACT 1971 Mar 26 # Dacca Time - 6:00 - BDT 2009 - 6:00 Dhaka BD%sT + 6:30 - +0630 1942 May 15 + 5:30 - +0530 1942 Sep + 6:30 - +0630 1951 Sep 30 + 6:00 - +06 2009 + 6:00 Dhaka +06/+07 # Bhutan # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Thimphu 5:58:36 - LMT 1947 Aug 15 # or Thimbu - 5:30 - IST 1987 Oct - 6:00 - BTT # Bhutan Time + 5:30 - +0530 1987 Oct + 6:00 - +06 # British Indian Ocean Territory # Whitman and the 1995 CIA time zone map say 5:00, but the @@ -274,14 +268,14 @@ # then contained the Chagos Archipelago). # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Chagos 4:49:40 - LMT 1907 - 5:00 - IOT 1996 # BIOT Time - 6:00 - IOT + 5:00 - +05 1996 + 6:00 - +06 # Brunei # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan - 7:30 - BNT 1933 - 8:00 - BNT + 7:30 - +0730 1933 + 8:00 - +08 # Burma / Myanmar @@ -290,9 +284,9 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Yangon 6:24:40 - LMT 1880 # or Rangoon 6:24:40 - RMT 1920 # Rangoon Mean Time? - 6:30 - BURT 1942 May # Burma Time - 9:00 - JST 1945 May 3 - 6:30 - MMT # Myanmar Time + 6:30 - +0630 1942 May + 9:00 - +09 1945 May 3 + 6:30 - +0630 # Cambodia # See Asia/Bangkok. @@ -355,7 +349,7 @@ # (could be true), for the moment I am assuming that those two # counties are mistakes in the astro.com data. -# From Paul Eggert (2014-06-30): +# From Paul Eggert (2017-01-05): # Alois Treindl kindly sent me translations of the following two sources: # # (1) @@ -413,28 +407,26 @@ # mainly observed in coastal areas), the five zones were: # # Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30 -# Asia/Harbin (currently a link to Asia/Shanghai) +# Now part of Asia/Shanghai; its pre-1970 times are not recorded here. # Heilongjiang (except Mohe county), Jilin # # Zhongyuan Time ("Central plain Time") UT +08 -# Asia/Shanghai +# Now part of Asia/Shanghai. # most of China -# This currently represents most other zones as well, -# as apparently these regions have been the same since 1970. # Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest. # Guo says Shanghai switched to UT +08 "from the end of the 19th century". # -# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07 -# Asia/Chongqing (currently a link to Asia/Shanghai) +# Long-shu Time (probably as Long and Shu were two names of the area) UT +07 +# Now part of Asia/Shanghai; its pre-1970 times are not recorded here. # Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan; -# most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong +# most of Gansu; west Inner Mongolia; east Qinghai; and the Guangdong # counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing, # Yangchun, Yangjiang, Yu'nan, and Yunfu. # # Xin-zang Time ("Xinjiang-Tibet Time") UT +06 -# Asia/Urumqi -# This currently represents Kunlun Time as well, -# as apparently the two regions have been the same since 1970. +# This region is now part of either Asia/Urumqi or Asia/Shanghai with +# current boundaries uncertain; times before 1970 for areas that +# disagree with Ürümqi or Shanghai are not recorded here. # The Gansu counties Aksay, Anxi, Dunhuang, Subei; west Qinghai; # the Guangdong counties Xuwen, Haikang, Suixi, Lianjiang, # Zhanjiang, Wuchuan, Huazhou, Gaozhou, Maoming, Dianbai, and Xinyi; @@ -445,7 +437,7 @@ # Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan. # # Kunlun Time UT +05:30 -# Asia/Kashgar (currently a link to Asia/Urumqi) +# This region is now in the same status as Xin-zang Time (see above). # West Tibet, including Pulan, Aheqi, Shufu, Shule; # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke, # Zhaosu, Tekesi, Gongliu, Chabuchaer, Huocheng, Bole, Pishan, Suiding, @@ -546,7 +538,7 @@ # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) Zone Asia/Urumqi 5:50:20 - LMT 1928 - 6:00 - XJT + 6:00 - +06 # Hong Kong (Xianggang) @@ -765,30 +757,29 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Taipei or Taibei or T'ai-pei Zone Asia/Taipei 8:06:00 - LMT 1896 Jan 1 - 8:00 - JWST 1937 Oct 1 + 8:00 - CST 1937 Oct 1 9:00 - JST 1945 Sep 21 1:00 8:00 Taiwan C%sT # Macau (Macao, Aomen) # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Macau 1961 1962 - Mar Sun>=16 3:30 1:00 S -Rule Macau 1961 1964 - Nov Sun>=1 3:30 0 - -Rule Macau 1963 only - Mar Sun>=16 0:00 1:00 S -Rule Macau 1964 only - Mar Sun>=16 3:30 1:00 S -Rule Macau 1965 only - Mar Sun>=16 0:00 1:00 S -Rule Macau 1965 only - Oct 31 0:00 0 - -Rule Macau 1966 1971 - Apr Sun>=16 3:30 1:00 S -Rule Macau 1966 1971 - Oct Sun>=16 3:30 0 - -Rule Macau 1972 1974 - Apr Sun>=15 0:00 1:00 S -Rule Macau 1972 1973 - Oct Sun>=15 0:00 0 - -Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 - -Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 S -Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 S -Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 - +Rule Macau 1961 1962 - Mar Sun>=16 3:30 1:00 D +Rule Macau 1961 1964 - Nov Sun>=1 3:30 0 S +Rule Macau 1963 only - Mar Sun>=16 0:00 1:00 D +Rule Macau 1964 only - Mar Sun>=16 3:30 1:00 D +Rule Macau 1965 only - Mar Sun>=16 0:00 1:00 D +Rule Macau 1965 only - Oct 31 0:00 0 S +Rule Macau 1966 1971 - Apr Sun>=16 3:30 1:00 D +Rule Macau 1966 1971 - Oct Sun>=16 3:30 0 S +Rule Macau 1972 1974 - Apr Sun>=15 0:00 1:00 D +Rule Macau 1972 1973 - Oct Sun>=15 0:00 0 S +Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S +Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D +Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D +Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 - 8:00 Macau MO%sT 1999 Dec 20 # return to China - 8:00 PRC C%sT + 8:00 Macau C%sT ############################################################################### @@ -904,11 +895,10 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Dili 8:22:20 - LMT 1912 Jan 1 - 8:00 - TLT 1942 Feb 21 23:00 # E Timor Time - 9:00 - JST 1945 Sep 23 - 9:00 - TLT 1976 May 3 - 8:00 - WITA 2000 Sep 17 0:00 - 9:00 - TLT + 8:00 - +08 1942 Feb 21 23:00 + 9:00 - +09 1976 May 3 + 8:00 - +08 2000 Sep 17 0:00 + 9:00 - +09 # India @@ -923,9 +913,9 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata 5:53:20 - HMT 1941 Oct # Howrah Mean Time? - 6:30 - BURT 1942 May 15 # Burma Time + 6:30 - +0630 1942 May 15 5:30 - IST 1942 Sep - 5:30 1:00 IST 1945 Oct 15 + 5:30 1:00 +0630 1945 Oct 15 5:30 - IST # The following are like Asia/Kolkata: # Andaman Is @@ -976,33 +966,33 @@ # Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13, # but this must be a typo. 7:07:12 - BMT 1923 Dec 31 23:47:12 # Batavia - 7:20 - JAVT 1932 Nov # Java Time - 7:30 - WIB 1942 Mar 23 - 9:00 - JST 1945 Sep 23 - 7:30 - WIB 1948 May - 8:00 - WIB 1950 May - 7:30 - WIB 1964 + 7:20 - +0720 1932 Nov + 7:30 - +0730 1942 Mar 23 + 9:00 - +09 1945 Sep 23 + 7:30 - +0730 1948 May + 8:00 - +08 1950 May + 7:30 - +0730 1964 7:00 - WIB # west and central Borneo Zone Asia/Pontianak 7:17:20 - LMT 1908 May 7:17:20 - PMT 1932 Nov # Pontianak MT - 7:30 - WIB 1942 Jan 29 - 9:00 - JST 1945 Sep 23 - 7:30 - WIB 1948 May - 8:00 - WIB 1950 May - 7:30 - WIB 1964 + 7:30 - +0730 1942 Jan 29 + 9:00 - +09 1945 Sep 23 + 7:30 - +0730 1948 May + 8:00 - +08 1950 May + 7:30 - +0730 1964 8:00 - WITA 1988 Jan 1 7:00 - WIB # Sulawesi, Lesser Sundas, east and south Borneo Zone Asia/Makassar 7:57:36 - LMT 1920 7:57:36 - MMT 1932 Nov # Macassar MT - 8:00 - WITA 1942 Feb 9 - 9:00 - JST 1945 Sep 23 + 8:00 - +08 1942 Feb 9 + 9:00 - +09 1945 Sep 23 8:00 - WITA # Maluku Islands, West Papua, Papua Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov - 9:00 - WIT 1944 Sep 1 - 9:30 - ACST 1964 + 9:00 - +09 1944 Sep 1 + 9:30 - +0930 1964 9:00 - WIT # Iran @@ -1034,8 +1024,6 @@ # for at least the last 5 years. Before that, for a few years, the # date used was the first Thursday night of Farvardin and the last # Thursday night of Shahrivar, but I can't give exact dates.... -# I have also changed the abbreviations to what is considered correct -# here in Iran, IRST for regular time and IRDT for daylight saving time. # # From Roozbeh Pournader (2005-04-05): # The text of the Iranian law, in effect since 1925, clearly mentions @@ -1142,9 +1130,9 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 3:25:44 - TMT 1946 # Tehran Mean Time - 3:30 - IRST 1977 Nov - 4:00 Iran IR%sT 1979 - 3:30 Iran IR%sT + 3:30 - +0330 1977 Nov + 4:00 Iran +04/+05 1979 + 3:30 Iran +0330/+0430 # Iraq @@ -1187,8 +1175,8 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 2:57:36 - BMT 1918 # Baghdad Mean Time? - 3:00 - AST 1982 May - 3:00 Iraq A%sT + 3:00 - +03 1982 May + 3:00 Iraq +03/+04 ############################################################################### @@ -1487,8 +1475,6 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u - 9:00 - JST 1896 Jan 1 - 9:00 - JCST 1937 Oct 1 9:00 Japan J%sT # Since 1938, all Japanese possessions have been like Asia/Tokyo. @@ -1606,12 +1592,12 @@ # was "blended" with the Central zone. Therefore, Kazakhstan now has # two time zones, and difference between them is one hour. The zone # closer to UTC is the former Western zone (probably still called the -# same), encompassing four provinces in the west: Aqtobe, Atyrau, -# Mangghystau, and West Kazakhstan. The other zone encompasses +# same), encompassing four provinces in the west: Aqtöbe, Atyraū, +# Mangghystaū, and West Kazakhstan. The other zone encompasses # everything else.... I guess that would make Kazakhstan time zones # de jure UTC+5 and UTC+6 respectively. -# From Stepan Golosunov (2016-03-27) ([*] means see later comments below): +# From Stepan Golosunov (2016-03-27): # Review of the linked documents from http://adilet.zan.kz/ # produced the following data for post-1991 Kazakhstan: # @@ -1657,7 +1643,7 @@ # # This implies that on 1991-03-31 Asia/Oral remained on +04/+05 while # the rest of Kazakhstan switched from +06/+07 to +05/06 or from +05/06 -# to +04/+05. It's unclear how Kzyl-Orda oblast moved into the fifth +# to +04/+05. It's unclear how Qyzylorda oblast moved into the fifth # time belt. (By switching from +04/+05 to +05/+06 on 1991-09-29?) ... # # 1. Act of the Cabinet of Ministers of the Republic of Kazakhstan @@ -1670,25 +1656,25 @@ # on the whole territory of Kazakhstan 1 hour forward on 1992-01-19 at # 2:00, specified DST rules. It acknowledged that Kazakhstan was # located in the fourth and the fifth time belts and specified the -# border between them to be located east of Kustanay and Aktyubinsk -# oblasts (notably including Turgai and Kzyl-Orda oblasts into the fifth +# border between them to be located east of Qostanay and Aktyubinsk +# oblasts (notably including Turgai and Qyzylorda oblasts into the fifth # time belt). # # This means switch on 1992-01-19 at 2:00 from +04/+05 to +05/+06 for -# Asia/Aqtau, Asia/Aqtobe, Asia/Oral, Atyrau and Kustanay oblasts; from -# +05/+06 to +06/+07 for Asia/Almaty and Asia/Qyzylorda (and Arkalyk) [*].... +# Asia/Aqtau, Asia/Aqtobe, Asia/Oral, Atyraū and Qostanay oblasts; from +# +05/+06 to +06/+07 for Asia/Almaty and Asia/Qyzylorda (and Arkalyk).... # # 2. Act of the Cabinet of Ministers of the Republic of Kazakhstan # from 1992-03-27 No. 284 # http://adilet.zan.kz/rus/docs/P920000284_ -# cancels extra hour ("decree time") for Uralsk and Kzyl-Orda oblasts +# cancels extra hour ("decree time") for Uralsk and Qyzylorda oblasts # since the last Sunday of March 1992, while keeping them in the fourth # and the fifth time belts respectively. # # 3. Order of the Prime Minister of the Republic of Kazakhstan # from 1994-09-23 No. 384 # http://adilet.zan.kz/rus/docs/R940000384_ -# cancels the extra hour ("decree time") on the territory of Mangystau +# cancels the extra hour ("decree time") on the territory of Mangghystaū # oblast since the last Sunday of September 1994 (saying that time on # the territory would correspond to the third time belt as a # result).... @@ -1702,14 +1688,11 @@ # 5. Act of the Government of the Republic of Kazakhstan # from 1999-03-26 No. 305 # http://adilet.zan.kz/rus/docs/P990000305_ -# cancels the extra hour ("decree time") for Atyrau oblast since the +# cancels the extra hour ("decree time") for Atyraū oblast since the # last Sunday of March 1999 while retaining the oblast in the fourth # time belt. # -# This means change from +05/+06 to +04/+05. -# -# There is no zone for Atyrau currently (listed under Asia/Aqtau in -# zone1970.tab).[*] +# This means change from +05/+06 to +04/+05.... # # 6. Act of the Government of the Republic of Kazakhstan # from 2000-11-23 No. 1749 @@ -1719,10 +1702,10 @@ # The only changes I noticed are in definition of the border between the # fourth and the fifth time belts. They account for changes in spelling # and administrative division (splitting of Turgai oblast in 1997 -# probably changed time in territories incorporated into Kostanay oblast -# (including Arkalyk) from +06/+07 to +05/+06) and move Kyzylorda oblast +# probably changed time in territories incorporated into Qostanay oblast +# (including Arkalyk) from +06/+07 to +05/+06) and move Qyzylorda oblast # from being in the fifth time belt and not using decree time into the -# fourth time belt (no change in practice).[*] +# fourth time belt (no change in practice). # # 7. Act of the Government of the Republic of Kazakhstan # from 2003-12-29 No. 1342 @@ -1732,7 +1715,7 @@ # 8. Act of the Government of the Republic of Kazakhstan # from 2004-07-20 No. 775 # http://adilet.zan.kz/rus/archive/docs/P040000775_/20.07.2004 -# modified the 2000-11-23 act to move Kostanay and Kyzylorda oblasts into +# modified the 2000-11-23 act to move Qostanay and Qyzylorda oblasts into # the fifth time belt and add Aktobe oblast to the list of regions not # using extra hour ("decree time"), leaving Kazakhstan with only 2 time # zones (+04/+05 and +06/+07). The changes were to be implemented @@ -1744,14 +1727,14 @@ # http://adilet.zan.kz/rus/docs/P040001059_ # modified the 2000-11-23 act to remove exceptions from the "decree time" # (leaving Kazakhstan in +05/+06 and +06/+07 zones), amended the -# 2004-07-20 act to implement changes for Atyrau, West Kazakhstan, -# Kostanay, Kyzylorda and Mangystau oblasts by not moving clocks -# during the 2014 transition to "winter" time. +# 2004-07-20 act to implement changes for Atyraū, West Kazakhstan, +# Qostanay, Qyzylorda and Mangghystaū oblasts by not moving clocks +# during the 2004 transition to "winter" time. # -# This means transition from +04/+05 to +05/+06 for Atyrau oblast (no +# This means transition from +04/+05 to +05/+06 for Atyraū oblast (no # zone currently), Asia/Oral, Asia/Aqtau and transition from +05/+06 to -# +06/+07 for Kostanay oblast (Kostanay and Arkalyk, no zones currently) -# and Asia/Qyzylorda on 2004-10-31 at 3:00....[*] +# +06/+07 for Qostanay oblast (Qostanay and Arkalyk, no zones currently) +# and Asia/Qyzylorda on 2004-10-31 at 3:00.... # # 10. Act of the Government of the Republic of Kazakhstan # from 2005-03-15 No. 231 @@ -1767,14 +1750,25 @@ # Kazakh 1992-01-13 act appears to provide the same rules and 1992-03-27 # act was to be enacted on the last Sunday of March 1992. -# From Paul Eggert (2016-04-15): -# The tables below should reflect Stepan Golosunov's remarks above, -# except for the items marked "[*]" which I haven't gotten to yet. -# It looks like we will need new zones Asia/Atyrau and Asia/Qostanay -# to handle changes from 1992 through 2004 that we did not previously -# know about. +# From Stepan Golosunov (2016-11-08): +# Turgai reorganization should affect only southern part of Qostanay +# oblast. Which should probably be separated into Asia/Arkalyk zone. +# (There were also 1970, 1988 and 1990 Turgai oblast reorganizations +# according to wikipedia.) +# +# [For Qostanay] http://www.ng.kz/gazeta/195/hranit/ +# suggests that clocks were to be moved 40 minutes backwards on +# 1920-01-01 to the fourth time belt. But I do not understand +# how that could happen.... +# +# [For Atyrau and Oral] 1919 decree +# (http://www.worldtimezone.com/dst_news/dst_news_russia-1919-02-08.html +# and in Byalokoz) lists Ural river (plus 10 versts on its left bank) in +# the third time belt (before 1930 this means +03). -# +# From Paul Eggert (2016-12-06): +# The tables below reflect Golosunov's remarks, with exceptions as noted. + # Zone NAME GMTOFF RULES FORMAT [UNTIL] # # Almaty (formerly Alma-Ata), representing most locations in Kazakhstan @@ -1787,6 +1781,8 @@ 6:00 RussiaAsia +06/+07 2004 Oct 31 2:00s 6:00 - +06 # Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) (KZ-KZY) +# This currently includes Qostanay (aka Kostanay, Kustanay) (KZ-KUS); +# see comments below. Zone Asia/Qyzylorda 4:21:52 - LMT 1924 May 2 4:00 - +04 1930 Jun 21 5:00 - +05 1981 Apr 1 @@ -1798,7 +1794,21 @@ 6:00 RussiaAsia +06/+07 1992 Mar 29 2:00s 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s 6:00 - +06 -# Aqtobe (aka Aktobe, formerly Aktyubinsk) (KZ-AKT) +# The following zone is like Asia/Qyzylorda except for being one +# hour earlier from 1991-09-29 to 1992-03-29. The 1991/2 rules for +# Qostanay are unclear partly because of the 1997 Turgai +# reorganization, so this zone is commented out for now. +#Zone Asia/Qostanay 4:14:20 - LMT 1924 May 2 +# 4:00 - +04 1930 Jun 21 +# 5:00 - +05 1981 Apr 1 +# 5:00 1:00 +06 1981 Oct 1 +# 6:00 - +06 1982 Apr 1 +# 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s +# 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s +# 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s +# 6:00 - +06 +# +# Aqtöbe (aka Aktobe, formerly Aktyubinsk) (KZ-AKT) Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2 4:00 - +04 1930 Jun 21 5:00 - +05 1981 Apr 1 @@ -1808,14 +1818,11 @@ 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s 5:00 - +05 -# Qostanay (KZ-KUS) - -# Mangghystau (KZ-MAN) +# Mangghystaū (KZ-MAN) # Aqtau was not founded until 1963, but it represents an inhabited region, # so include time stamps before 1963. Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2 4:00 - +04 1930 Jun 21 - 5:00 - +05 1963 5:00 - +05 1981 Oct 1 6:00 - +06 1982 Apr 1 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s @@ -1823,12 +1830,22 @@ 5:00 RussiaAsia +05/+06 1994 Sep 25 2:00s 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s 5:00 - +05 - +# Atyraū (KZ-ATY) is like Mangghystaū except it switched from +# +04/+05 to +05/+06 in spring 1999, not fall 1994. +Zone Asia/Atyrau 3:27:44 - LMT 1924 May 2 + 3:00 - +03 1930 Jun 21 + 5:00 - +05 1981 Oct 1 + 6:00 - +06 1982 Apr 1 + 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s + 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s + 5:00 RussiaAsia +05/+06 1999 Mar 28 2:00s + 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s + 5:00 - +05 # West Kazakhstan (KZ-ZAP) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk - 4:00 - +04 1930 Jun 21 + 3:00 - +03 1930 Jun 21 5:00 - +05 1981 Apr 1 5:00 1:00 +06 1981 Oct 1 6:00 - +06 1982 Apr 1 @@ -1934,14 +1951,12 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 8:30 - KST 1912 Jan 1 - 9:00 - JCST 1937 Oct 1 9:00 - JST 1945 Sep 8 9:00 - KST 1954 Mar 21 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 8:30 - KST 1912 Jan 1 - 9:00 - JCST 1937 Oct 1 9:00 - JST 1945 Aug 24 9:00 - KST 2015 Aug 15 00:00 8:30 - KST @@ -1996,30 +2011,29 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kuala_Lumpur 6:46:46 - LMT 1901 Jan 1 6:55:25 - SMT 1905 Jun 1 # Singapore M.T. - 7:00 - MALT 1933 Jan 1 # Malaya Time - 7:00 0:20 MALST 1936 Jan 1 - 7:20 - MALT 1941 Sep 1 - 7:30 - MALT 1942 Feb 16 - 9:00 - JST 1945 Sep 12 - 7:30 - MALT 1982 Jan 1 - 8:00 - MYT # Malaysia Time + 7:00 - +07 1933 Jan 1 + 7:00 0:20 +0720 1936 Jan 1 + 7:20 - +0720 1941 Sep 1 + 7:30 - +0730 1942 Feb 16 + 9:00 - +09 1945 Sep 12 + 7:30 - +0730 1982 Jan 1 + 8:00 - +08 # Sabah & Sarawak # From Paul Eggert (2014-08-12): # The data entries here are mostly from Shanks & Pottenger, but the 1942, 1945 # and 1982 transition dates are from Mok Ly Yng. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kuching 7:21:20 - LMT 1926 Mar - 7:30 - BORT 1933 # Borneo Time - 8:00 NBorneo BOR%sT 1942 Feb 16 - 9:00 - JST 1945 Sep 12 - 8:00 - BORT 1982 Jan 1 - 8:00 - MYT + 7:30 - +0730 1933 + 8:00 NBorneo +08/+0820 1942 Feb 16 + 9:00 - +09 1945 Sep 12 + 8:00 - +08 # Maldives # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Maldives 4:54:00 - LMT 1880 # Male 4:54:00 - MMT 1960 # Male Mean Time - 5:00 - MVT # Maldives Time + 5:00 - +05 # Mongolia @@ -2146,37 +2160,41 @@ # correction of 02:00 (in the previous edition) not being done correctly # in the latest edition; so ignore it for now. +# From Ganbold Tsagaankhuu (2017-02-09): +# Mongolian Government meeting has concluded today to cancel daylight +# saving time adoption in Mongolia. Source: http://zasag.mn/news/view/16192 + Rule Mongol 1985 1998 - Mar lastSun 0:00 1:00 S Rule Mongol 1984 1998 - Sep lastSun 0:00 0 - # IATA SSIM (1999-09) says Mongolia no longer observes DST. 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 - +Rule Mongol 2015 2016 - Mar lastSat 2:00 1:00 S +Rule Mongol 2015 2016 - Sep lastSat 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta Zone Asia/Hovd 6:06:36 - LMT 1905 Aug - 6:00 - HOVT 1978 # Hovd Time - 7:00 Mongol HOV%sT + 6:00 - +06 1978 + 7:00 Mongol +07/+08 # Ulaanbaatar, a.k.a. Ulan Bataar, Ulan Bator, Urga Zone Asia/Ulaanbaatar 7:07:32 - LMT 1905 Aug - 7:00 - ULAT 1978 # Ulaanbaatar Time - 8:00 Mongol ULA%sT + 7:00 - +07 1978 + 8:00 Mongol +08/+09 # Choibalsan, a.k.a. Bajan Tümen, Bajan Tumen, Chojbalsan, # Choybalsan, Sanbejse, Tchoibalsan Zone Asia/Choibalsan 7:38:00 - LMT 1905 Aug - 7:00 - ULAT 1978 - 8:00 - ULAT 1983 Apr - 9:00 Mongol CHO%sT 2008 Mar 31 # Choibalsan Time - 8:00 Mongol CHO%sT + 7:00 - +07 1978 + 8:00 - +08 1983 Apr + 9:00 Mongol +09/+10 2008 Mar 31 + 8:00 Mongol +08/+09 # Nepal # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kathmandu 5:41:16 - LMT 1920 - 5:30 - IST 1986 - 5:45 - NPT # Nepal Time + 5:30 - +0530 1986 + 5:45 - +0545 # Oman # See Asia/Dubai. @@ -2325,10 +2343,10 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Karachi 4:28:12 - LMT 1907 - 5:30 - IST 1942 Sep - 5:30 1:00 IST 1945 Oct 15 - 5:30 - IST 1951 Sep 30 - 5:00 - KART 1971 Mar 26 # Karachi Time + 5:30 - +0530 1942 Sep + 5:30 1:00 +0630 1945 Oct 15 + 5:30 - +0530 1951 Sep 30 + 5:00 - +05 1971 Mar 26 5:00 Pakistan PK%sT # Pakistan Time # Palestine @@ -2639,7 +2657,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct - 2:00 Zion EET 1948 May 15 + 2:00 Zion EET/EEST 1948 May 15 2:00 EgyptAsia EE%sT 1967 Jun 5 2:00 Zion I%sT 1996 2:00 Jordan EE%sT 1999 @@ -2652,7 +2670,7 @@ 2:00 Palestine EE%sT Zone Asia/Hebron 2:20:23 - LMT 1900 Oct - 2:00 Zion EET 1948 May 15 + 2:00 Zion EET/EEST 1948 May 15 2:00 EgyptAsia EE%sT 1967 Jun 5 2:00 Zion I%sT 1996 2:00 Jordan EE%sT 1999 @@ -2693,15 +2711,15 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 8:04:00 - LMT 1899 May 11 - 8:00 Phil PH%sT 1942 May - 9:00 - JST 1944 Nov - 8:00 Phil PH%sT + 8:00 Phil +08/+09 1942 May + 9:00 - +09 1944 Nov + 8:00 Phil +08/+09 # Qatar # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Qatar 3:26:08 - LMT 1920 # Al Dawhah / Doha - 4:00 - GST 1972 Jun - 3:00 - AST + 4:00 - +04 1972 Jun + 3:00 - +03 Link Asia/Qatar Asia/Bahrain # Saudi Arabia @@ -2728,7 +2746,7 @@ # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14 - 3:00 - AST + 3:00 - +03 Link Asia/Riyadh Asia/Aden # Yemen Link Asia/Riyadh Asia/Kuwait @@ -2738,14 +2756,13 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1 6:55:25 - SMT 1905 Jun 1 # Singapore M.T. - 7:00 - MALT 1933 Jan 1 # Malaya Time - 7:00 0:20 MALST 1936 Jan 1 - 7:20 - MALT 1941 Sep 1 - 7:30 - MALT 1942 Feb 16 - 9:00 - JST 1945 Sep 12 - 7:30 - MALT 1965 Aug 9 # independence - 7:30 - SGT 1982 Jan 1 # Singapore Time - 8:00 - SGT + 7:00 - +07 1933 Jan 1 + 7:00 0:20 +0720 1936 Jan 1 + 7:20 - +0720 1941 Sep 1 + 7:30 - +0730 1942 Feb 16 + 9:00 - +09 1945 Sep 12 + 7:30 - +0730 1982 Jan 1 + 8:00 - +08 # Spratly Is # no information @@ -2804,8 +2821,8 @@ Zone Asia/Colombo 5:19:24 - LMT 1880 5:19:32 - MMT 1906 # Moratuwa Mean Time 5:30 - +0530 1942 Jan 5 - 5:30 0:30 +0530/+06 1942 Sep - 5:30 1:00 +0530/+0630 1945 Oct 16 2:00 + 5:30 0:30 +06 1942 Sep + 5:30 1:00 +0630 1945 Oct 16 2:00 5:30 - +0530 1996 May 25 0:00 6:30 - +0630 1996 Oct 26 0:30 6:00 - +06 2006 Apr 15 0:30 @@ -2987,7 +3004,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Bangkok 6:42:04 - LMT 1880 6:42:04 - BMT 1920 Apr # Bangkok Mean Time - 7:00 - ICT + 7:00 - +07 Link Asia/Bangkok Asia/Phnom_Penh # Cambodia Link Asia/Bangkok Asia/Vientiane # Laos @@ -3003,7 +3020,7 @@ # United Arab Emirates # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Dubai 3:41:12 - LMT 1920 - 4:00 - GST + 4:00 - +04 Link Asia/Dubai Asia/Muscat # Oman # Uzbekistan @@ -3076,15 +3093,15 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jul 1 - 7:06:30 - PLMT 1911 May 1 - 7:00 - ICT 1942 Dec 31 23:00 - 8:00 - IDT 1945 Mar 14 23:00 - 9:00 - JST 1945 Sep 2 - 7:00 - ICT 1947 Apr 1 - 8:00 - IDT 1955 Jul 1 - 7:00 - ICT 1959 Dec 31 23:00 - 8:00 - IDT 1975 Jun 13 - 7:00 - ICT + 7:06:30 - PLMT 1911 May 1 # Phù Liễn MT + 7:00 - +07 1942 Dec 31 23:00 + 8:00 - +08 1945 Mar 14 23:00 + 9:00 - +09 1945 Sep 2 + 7:00 - +07 1947 Apr 1 + 8:00 - +08 1955 Jul 1 + 7:00 - +07 1959 Dec 31 23:00 + 8:00 - +08 1975 Jun 13 + 7:00 - +07 # Yemen # See Asia/Riyadh.
--- a/make/sun/javazic/tzdata/australasia Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/australasia Fri Jul 14 00:56:29 2017 +0100 @@ -67,8 +67,8 @@ 8:00 Aus AW%sT 1943 Jul 8:00 AW AW%sT Zone Australia/Eucla 8:35:28 - LMT 1895 Dec - 8:45 Aus ACW%sT 1943 Jul - 8:45 AW ACW%sT + 8:45 Aus +0845/+0945 1943 Jul + 8:45 AW +0845/+0945 # Queensland # @@ -235,7 +235,8 @@ Rule LH 2008 max - Oct Sun>=1 2:00 0:30 D Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb 10:00 - AEST 1981 Mar - 10:30 LH LH%sT + 10:30 LH +1030/+1130 1985 Jul + 10:30 LH +1030/+11 # Australian miscellany # @@ -273,19 +274,19 @@ 0 - -00 1948 Mar 25 10:00 Aus AE%sT 1967 10:00 AT AE%sT 2010 Apr 4 3:00 - 11:00 - MIST # Macquarie I Standard Time + 11:00 - +11 # Christmas # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Christmas 7:02:52 - LMT 1895 Feb - 7:00 - CXT # Christmas Island Time + 7:00 - +07 # Cocos (Keeling) Is # These islands were ruled by the Ross family from about 1830 to 1978. # We don't know when standard time was introduced; for now, we guess 1900. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Indian/Cocos 6:27:40 - LMT 1900 - 6:30 - CCT # Cocos Islands Time + 6:30 - +0630 # Fiji @@ -398,16 +399,16 @@ Rule Fiji 2015 max - Jan Sun>=15 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva - 12:00 Fiji FJ%sT # Fiji Time + 12:00 Fiji +12/+13 # French Polynesia # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Gambier -8:59:48 - LMT 1912 Oct # Rikitea - -9:00 - GAMT # Gambier Time + -9:00 - -09 Zone Pacific/Marquesas -9:18:00 - LMT 1912 Oct - -9:30 - MART # Marquesas Time + -9:30 - -0930 Zone Pacific/Tahiti -9:58:16 - LMT 1912 Oct # Papeete - -10:00 - TAHT # Tahiti Time + -10:00 - -10 # Clipperton (near North America) is administered from French Polynesia; # it is uninhabited. @@ -422,15 +423,15 @@ # Kiribati # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki - 12:00 - GILT # Gilbert Is Time + 12:00 - +12 Zone Pacific/Enderbury -11:24:20 - LMT 1901 - -12:00 - PHOT 1979 Oct # Phoenix Is Time - -11:00 - PHOT 1995 - 13:00 - PHOT + -12:00 - -12 1979 Oct + -11:00 - -11 1995 + 13:00 - +13 Zone Pacific/Kiritimati -10:29:20 - LMT 1901 - -10:40 - LINT 1979 Oct # Line Is Time - -10:00 - LINT 1995 - 14:00 - LINT + -10:40 - -1040 1979 Oct + -10:00 - -10 1995 + 14:00 - +14 # N Mariana Is # See Pacific/Guam. @@ -438,31 +439,31 @@ # Marshall Is # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Majuro 11:24:48 - LMT 1901 - 11:00 - MHT 1969 Oct # Marshall Islands Time - 12:00 - MHT + 11:00 - +11 1969 Oct + 12:00 - +12 Zone Pacific/Kwajalein 11:09:20 - LMT 1901 - 11:00 - MHT 1969 Oct - -12:00 - KWAT 1993 Aug 20 # Kwajalein Time - 12:00 - MHT + 11:00 - +11 1969 Oct + -12:00 - -12 1993 Aug 20 + 12:00 - +12 # Micronesia # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Chuuk 10:07:08 - LMT 1901 - 10:00 - CHUT # Chuuk Time + 10:00 - +10 Zone Pacific/Pohnpei 10:32:52 - LMT 1901 # Kolonia - 11:00 - PONT # Pohnpei Time + 11:00 - +11 Zone Pacific/Kosrae 10:51:56 - LMT 1901 - 11:00 - KOST 1969 Oct # Kosrae Time - 12:00 - KOST 1999 - 11:00 - KOST + 11:00 - +11 1969 Oct + 12:00 - +12 1999 + 11:00 - +11 # Nauru # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe - 11:30 - NRT 1942 Mar 15 # Nauru Time - 9:00 - JST 1944 Aug 15 - 11:30 - NRT 1979 May - 12:00 - NRT + 11:30 - +1130 1942 Mar 15 + 9:00 - +09 1944 Aug 15 + 11:30 - +1130 1979 May + 12:00 - +12 # New Caledonia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -473,7 +474,7 @@ Rule NC 1997 only - Mar 2 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Noumea 11:05:48 - LMT 1912 Jan 13 # Nouméa - 11:00 NC NC%sT + 11:00 NC +11/+12 ############################################################################### @@ -514,8 +515,8 @@ 11:30 NZ NZ%sT 1946 Jan 1 12:00 NZ NZ%sT Zone Pacific/Chatham 12:13:48 - LMT 1868 Nov 2 - 12:15 - CHAST 1946 Jan 1 - 12:45 Chatham CHA%sT + 12:15 - +1215 1946 Jan 1 + 12:45 Chatham +1245/+1345 Link Pacific/Auckland Antarctica/McMurdo @@ -537,8 +538,8 @@ Rule Cook 1979 1990 - Oct lastSun 0:00 0:30 HS # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Rarotonga -10:39:04 - LMT 1901 # Avarua - -10:30 - CKT 1978 Nov 12 # Cook Is Time - -10:00 Cook CK%sT + -10:30 - -1030 1978 Nov 12 + -10:00 Cook -10/-0930 ############################################################################### @@ -546,29 +547,29 @@ # Niue # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Niue -11:19:40 - LMT 1901 # Alofi - -11:20 - NUT 1951 # Niue Time - -11:30 - NUT 1978 Oct 1 - -11:00 - NUT + -11:20 - -1120 1951 + -11:30 - -1130 1978 Oct 1 + -11:00 - -11 # Norfolk # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Norfolk 11:11:52 - LMT 1901 # Kingston - 11:12 - NMT 1951 # Norfolk Mean Time - 11:30 - NFT 1974 Oct 27 02:00 # Norfolk T. - 11:30 1:00 NFST 1975 Mar 2 02:00 - 11:30 - NFT 2015 Oct 4 02:00 - 11:00 - NFT + 11:12 - +1112 1951 + 11:30 - +1130 1974 Oct 27 02:00 + 11:30 1:00 +1230 1975 Mar 2 02:00 + 11:30 - +1130 2015 Oct 4 02:00 + 11:00 - +11 # Palau (Belau) # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Palau 8:57:56 - LMT 1901 # Koror - 9:00 - PWT # Palau Time + 9:00 - +09 # Papua New Guinea # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Port_Moresby 9:48:40 - LMT 1880 9:48:32 - PMMT 1895 # Port Moresby Mean Time - 10:00 - PGT # Papua New Guinea Time + 10:00 - +10 # # From Paul Eggert (2014-10-13): # Base the Bougainville entry on the Arawa-Kieta region, which appears to have @@ -583,28 +584,26 @@ # and seem to have controlled it until their 1945-08-21 surrender. # # The Autonomous Region of Bougainville switched from UT +10 to +11 -# on 2014-12-28 at 02:00. They call +11 "Bougainville Standard Time"; -# abbreviate this as BST. See: +# on 2014-12-28 at 02:00. They call +11 "Bougainville Standard Time". +# See: # http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/ # Zone Pacific/Bougainville 10:22:16 - LMT 1880 9:48:32 - PMMT 1895 - 10:00 - PGT 1942 Jul - 9:00 - JST 1945 Aug 21 - 10:00 - PGT 2014 Dec 28 2:00 - 11:00 - BST + 10:00 - +10 1942 Jul + 9:00 - +09 1945 Aug 21 + 10:00 - +10 2014 Dec 28 2:00 + 11:00 - +11 # Pitcairn # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Pitcairn -8:40:20 - LMT 1901 # Adamstown - -8:30 - PNT 1998 Apr 27 0:00 - -8:00 - PST # Pitcairn Standard Time + -8:30 - -0830 1998 Apr 27 0:00 + -8:00 - -08 # American Samoa Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5 -11:22:48 - LMT 1911 - -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 @@ -685,17 +684,17 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5 -11:26:56 - LMT 1911 - -11:30 - WSST 1950 - -11:00 WS S%sT 2011 Dec 29 24:00 # S=Samoa - 13:00 WS WS%sT + -11:30 - -1130 1950 + -11:00 WS -11/-10 2011 Dec 29 24:00 + 13:00 WS +13/+14 # Solomon Is # excludes Bougainville, for which see Papua New Guinea # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Honiara - 11:00 - SBT # Solomon Is Time + 11:00 - +11 -# Tokelau Is +# Tokelau # # From Gwillim Law (2011-12-29) # A correspondent informed me that Tokelau, like Samoa, will be skipping @@ -716,8 +715,8 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fakaofo -11:24:56 - LMT 1901 - -11:00 - TKT 2011 Dec 30 # Tokelau Time - 13:00 - TKT + -11:00 - -11 2011 Dec 30 + 13:00 - +13 # Tonga # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -736,7 +735,7 @@ # Tuvalu # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Funafuti 11:56:52 - LMT 1901 - 12:00 - TVT # Tuvalu Time + 12:00 - +12 # US minor outlying islands @@ -760,10 +759,11 @@ # Johnston # -# From Paul Eggert (2014-03-11): +# From Paul Eggert (2017-02-10): # Sometimes Johnston kept Hawaii time, and sometimes it was an hour behind. # Details are uncertain. We have no data for Johnston after 1970, so -# treat it like Hawaii for now. +# treat it like Hawaii for now. Since Johnston is now uninhabited, +# its link to Pacific/Honolulu is in the 'backward' file. # # In his memoirs of June 6th to October 4, 1945 # <http://www.315bw.org/Herb_Bach.htm> (2005), Herbert C. Bach writes, @@ -783,8 +783,6 @@ # See the table on page 4 where he lists GMT and local times for the tests; a # footnote for the JI tests reads that local time is "JI time = Hawaii Time # Minus One Hour". -# -# See 'northamerica' for Pacific/Johnston. # Kingman # uninhabited @@ -798,7 +796,7 @@ # Wake # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Wake 11:06:28 - LMT 1901 - 12:00 - WAKT # Wake Time + 12:00 - +12 # Vanuatu @@ -811,12 +809,12 @@ Rule Vanuatu 1992 only - Oct Sun>=23 0:00 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila - 11:00 Vanuatu VU%sT # Vanuatu Time + 11:00 Vanuatu +11/+12 # Wallis and Futuna # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Wallis 12:15:20 - LMT 1901 - 12:00 - WFT # Wallis & Futuna Time + 12:00 - +12 ############################################################################### @@ -827,15 +825,15 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2014-10-31): +# From Paul Eggert (2017-02-10): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). # Unfortunately this book contains many errors and cites no sources. # -# Gwillim Law writes that a good source -# for recent time zone data is the International Air Transport +# Many years ago Gwillim Law wrote that a good source +# for time zone data was the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. Except where otherwise noted, @@ -852,28 +850,19 @@ # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). # -# I invented the abbreviations marked '*' in the following table; -# the rest are from earlier versions of this file, or from other sources. +# The following abbreviations are from other sources. # Corrections are welcome! # std dst # LMT Local Mean Time # 8:00 AWST AWDT Western Australia -# 8:45 ACWST ACWDT Central Western Australia* -# 9:00 JST Japan # 9:30 ACST ACDT Central Australia # 10:00 AEST AEDT Eastern Australia +# 10:00 GST Guam through 2000 # 10:00 ChST Chamorro -# 10:30 LHST LHDT Lord Howe* -# 11:00 BST Bougainville* # 11:30 NZMT NZST New Zealand through 1945 # 12:00 NZST NZDT New Zealand 1946-present -# 12:15 CHAST Chatham through 1945* -# 12:45 CHAST CHADT Chatham 1946-present* -# 13:00 WSST WSDT (western) Samoa 2011-present* -# -11:30 WSST Western Samoa through 1950* # -11:00 SST Samoa # -10:00 HST Hawaii -# - 8:00 PST Pitcairn* # # See the 'northamerica' file for Hawaii. # See the 'southamerica' file for Easter I and the Galápagos Is.
--- a/make/sun/javazic/tzdata/backward Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/backward Fri Jul 14 00:56:29 2017 +0100 @@ -119,6 +119,7 @@ Link Pacific/Chatham NZ-CHAT Link America/Denver Navajo Link Asia/Shanghai PRC +Link Pacific/Honolulu Pacific/Johnston Link Pacific/Pohnpei Pacific/Ponape Link Pacific/Pago_Pago Pacific/Samoa Link Pacific/Chuuk Pacific/Truk
--- a/make/sun/javazic/tzdata/europe Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/europe Fri Jul 14 00:56:29 2017 +0100 @@ -29,15 +29,15 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2014-10-31): +# From Paul Eggert (2017-02-10): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). # Unfortunately this book contains many errors and cites no sources. # -# Gwillim Law writes that a good source -# for recent time zone data is the International Air Transport +# Many years ago Gwillim Law wrote that a good source +# for time zone data was the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. Except where otherwise noted, @@ -79,26 +79,23 @@ # History of Summer Time # <http://pcdsh01.on.br/HISTHV.htm> # (1998-09-21, in Portuguese) - # # I invented the abbreviations marked '*' in the following table; -# the rest are from earlier versions of this file, or from other sources. -# Corrections are welcome! -# std dst 2dst -# LMT Local Mean Time -# -4:00 AST ADT Atlantic -# -3:00 WGT WGST Western Greenland* -# -1:00 EGT EGST Eastern Greenland* -# 0:00 GMT BST BDST Greenwich, British Summer -# 0:00 GMT IST Greenwich, Irish Summer -# 0:00 WET WEST WEMT Western Europe -# 0:19:32.13 AMT NST Amsterdam, Netherlands Summer (1835-1937)* -# 0:20 NET NEST Netherlands (1937-1940)* -# 1:00 BST British Standard (1968-1971) -# 1:00 CET CEST CEMT Central Europe -# 1:00:14 SET Swedish (1879-1899)* -# 2:00 EET EEST Eastern Europe -# 3:00 MSK MSD Moscow +# the rest are variants of the "xMT" pattern for a city's mean time, +# or are from other sources. Corrections are welcome! +# std dst 2dst +# LMT Local Mean Time +# -4:00 AST ADT Atlantic +# 0:00 GMT BST BDST Greenwich, British Summer +# 0:00 GMT IST Greenwich, Irish Summer +# 0:00 WET WEST WEMT Western Europe +# 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937) +# 1:00 BST British Standard (1968-1971) +# 1:00 CET CEST CEMT Central Europe +# 1:00:14 SET Swedish (1879-1899) +# 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)* +# 2:00 EET EEST Eastern Europe +# 3:00 MSK MSD MDST* Moscow # From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, @@ -498,7 +495,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 - -0:25:21 - DMT 1916 May 21 2:00 + -0:25:21 - DMT 1916 May 21 2:00 # Dublin MT -0:25:21 1:00 IST 1916 Oct 1 2:00s 0:00 GB-Eire %s 1921 Dec 6 # independence 0:00 GB-Eire GMT/IST 1940 Feb 25 2:00 @@ -924,7 +921,7 @@ # Cyprus # Please see the 'asia' file for Asia/Nicosia. -# Czech Republic +# Czech Republic / Czechia # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Czech 1945 only - Apr 8 2:00s 1:00 S Rule Czech 1945 only - Nov 18 2:00s 0 - @@ -1087,16 +1084,16 @@ # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Danmarkshavn -1:14:40 - LMT 1916 Jul 28 - -3:00 - WGT 1980 Apr 6 2:00 - -3:00 EU WG%sT 1996 + -3:00 - -03 1980 Apr 6 2:00 + -3:00 EU -03/-02 1996 0:00 - GMT Zone America/Scoresbysund -1:27:52 - LMT 1916 Jul 28 # Ittoqqortoormiit - -2:00 - CGT 1980 Apr 6 2:00 - -2:00 C-Eur CG%sT 1981 Mar 29 - -1:00 EU EG%sT + -2:00 - -02 1980 Apr 6 2:00 + -2:00 C-Eur -02/-01 1981 Mar 29 + -1:00 EU -01/+00 Zone America/Godthab -3:26:56 - LMT 1916 Jul 28 # Nuuk - -3:00 - WGT 1980 Apr 6 2:00 - -3:00 EU WG%sT + -3:00 - -03 1980 Apr 6 2:00 + -3:00 EU -03/-02 Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik air base -4:00 Thule A%sT @@ -1511,7 +1508,7 @@ Rule Iceland 1967 only - Oct 29 1:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Atlantic/Reykjavik -1:28 - LMT 1908 - -1:00 Iceland IS%sT 1968 Apr 7 1:00s + -1:00 Iceland -01/+00 1968 Apr 7 1:00s 0:00 - GMT # Italy @@ -1975,7 +1972,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Amsterdam 0:19:32 - LMT 1835 0:19:32 Neth %s 1937 Jul 1 - 0:20 Neth NE%sT 1940 May 16 0:00 # Dutch Time + 0:20 Neth +0020/+0120 1940 May 16 0:00 1:00 C-Eur CE%sT 1945 Apr 2 2:00 1:00 Neth CE%sT 1977 1:00 EU CE%sT @@ -2192,16 +2189,34 @@ 0:00 W-Eur WE%sT 1992 Sep 27 1:00s 1:00 EU CE%sT 1996 Mar 31 1:00u 0:00 EU WE%sT +# This Zone can be simplified once we assume zic %z. Zone Atlantic/Azores -1:42:40 - LMT 1884 # Ponta Delgada -1:54:32 - HMT 1912 Jan 1 # Horta Mean Time - -2:00 Port AZO%sT 1966 Apr 3 2:00 # Azores Time - -1:00 Port AZO%sT 1983 Sep 25 1:00s - -1:00 W-Eur AZO%sT 1992 Sep 27 1:00s + -2:00 Port -02/-01 1942 Apr 25 22:00s + -2:00 Port +00 1942 Aug 15 22:00s + -2:00 Port -02/-01 1943 Apr 17 22:00s + -2:00 Port +00 1943 Aug 28 22:00s + -2:00 Port -02/-01 1944 Apr 22 22:00s + -2:00 Port +00 1944 Aug 26 22:00s + -2:00 Port -02/-01 1945 Apr 21 22:00s + -2:00 Port +00 1945 Aug 25 22:00s + -2:00 Port -02/-01 1966 Apr 3 2:00 + -1:00 Port -01/+00 1983 Sep 25 1:00s + -1:00 W-Eur -01/+00 1992 Sep 27 1:00s 0:00 EU WE%sT 1993 Mar 28 1:00u - -1:00 EU AZO%sT + -1:00 EU -01/+00 +# This Zone can be simplified once we assume zic %z. Zone Atlantic/Madeira -1:07:36 - LMT 1884 # Funchal -1:07:36 - FMT 1912 Jan 1 # Funchal Mean Time - -1:00 Port MAD%sT 1966 Apr 3 2:00 # Madeira Time + -1:00 Port -01/+00 1942 Apr 25 22:00s + -1:00 Port +01 1942 Aug 15 22:00s + -1:00 Port -01/+00 1943 Apr 17 22:00s + -1:00 Port +01 1943 Aug 28 22:00s + -1:00 Port -01/+00 1944 Apr 22 22:00s + -1:00 Port +01 1944 Aug 26 22:00s + -1:00 Port -01/+00 1945 Apr 21 22:00s + -1:00 Port +01 1945 Aug 25 22:00s + -1:00 Port -01/+00 1966 Apr 3 2:00 0:00 Port WE%sT 1983 Sep 25 1:00s 0:00 EU WE%sT @@ -2559,10 +2574,8 @@ 3:00 - MSK -# From Tim Parenti (2014-07-03): -# Europe/Simferopol covers... -# ** **** Crimea, Republic of -# ** **** Sevastopol +# From Paul Eggert (2016-12-06): +# Europe/Simferopol covers Crimea. Zone Europe/Simferopol 2:16:24 - LMT 1880 2:16 - SMT 1924 May 2 # Simferopol Mean T @@ -2624,10 +2637,9 @@ 3:00 - +03 2016 Mar 27 2:00s 4:00 - +04 -# From Paul Eggert (2016-03-18): +# From Paul Eggert (2016-11-11): # Europe/Volgograd covers: # 34 RU-VGG Volgograd Oblast -# 64 RU-SAR Saratov Oblast # The 1988 transition is from USSR act No. 5 (1988-01-04). Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3 @@ -2640,6 +2652,27 @@ 4:00 - +04 2014 Oct 26 2:00s 3:00 - +03 +# From Paul Eggert (2016-11-11): +# Europe/Saratov covers: +# 64 RU-SAR Saratov Oblast + +# From Yuri Konotopov (2016-11-11): +# Dec 4, 2016 02:00 UTC+3.... Saratov Region's local time will be ... UTC+4. +# From Stepan Golosunov (2016-11-11): +# ... Byalokoz listed Saratov on 03:04:18. +# From Stepan Golosunov (2016-11-22): +# http://publication.pravo.gov.ru/Document/View/0001201611220031 + +Zone Europe/Saratov 3:04:18 - LMT 1919 Jul 1 0:00u + 3:00 - +03 1930 Jun 21 + 4:00 Russia +04/+05 1988 Mar 27 2:00s + 3:00 Russia +03/+04 1991 Mar 31 2:00s + 4:00 - +04 1992 Mar 29 2:00s + 3:00 Russia +03/+04 2011 Mar 27 2:00s + 4:00 - +04 2014 Oct 26 2:00s + 3:00 - +03 2016 Dec 4 2:00s + 4:00 - +04 + # From Paul Eggert (2016-03-18): # Europe/Kirov covers: # 43 RU-KIR Kirov Oblast @@ -3235,46 +3268,77 @@ # See Europe/Belgrade. # Spain +# +# From Paul Eggert (2016-12-14): +# +# The source for Europe/Madrid before 2013 is: +# Planesas P. La hora oficial en España y sus cambios. +# Anuario del Observatorio Astronómico de Madrid (2013, in Spanish). +# http://astronomia.ign.es/rknowsys-theme/images/webAstro/paginas/documentos/Anuario/lahoraoficialenespana.pdf +# As this source says that historical time in the Canaries is obscure, +# and it does not discuss Ceuta, stick with Shanks for now for that data. +# +# In the 1918 and 1919 fallback transitions in Spain, the clock for +# the hour-longer day officially kept going after midnight, so that +# the repeated instances of that day's 00:00 hour were 24 hours apart, +# with a fallback transition from the second occurrence of 00:59... to +# the next day's 00:00. Our data format cannot represent this +# directly, and instead repeats the first hour of the next day, with a +# fallback transition from the next day's 00:59... to 00:00. + +# From Michael Deckers (2016-12-15): +# The Royal Decree of 1900-06-26 quoted by Planesas, online at +# https://www.boe.es/datos/pdfs/BOE//1900/209/A00383-00384.pdf +# says in its article 5 (my translation): +# These dispositions will enter into force beginning with the +# instant at which, according to the time indicated in article 1, +# the 1st day of January of 1901 will begin. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -# For 1917-1919 Whitman gives Apr Sat>=1 - Oct Sat>=1; -# go with Shanks & Pottenger. -Rule Spain 1917 only - May 5 23:00s 1:00 S -Rule Spain 1917 1919 - Oct 6 23:00s 0 - -Rule Spain 1918 only - Apr 15 23:00s 1:00 S -Rule Spain 1919 only - Apr 5 23:00s 1:00 S -# Whitman gives 1921 Feb 28 - Oct 14; go with Shanks & Pottenger. -Rule Spain 1924 only - Apr 16 23:00s 1:00 S -# Whitman gives 1924 Oct 14; go with Shanks & Pottenger. -Rule Spain 1924 only - Oct 4 23:00s 0 - -Rule Spain 1926 only - Apr 17 23:00s 1:00 S -# Whitman says no DST in 1929; go with Shanks & Pottenger. -Rule Spain 1926 1929 - Oct Sat>=1 23:00s 0 - -Rule Spain 1927 only - Apr 9 23:00s 1:00 S -Rule Spain 1928 only - Apr 14 23:00s 1:00 S -Rule Spain 1929 only - Apr 20 23:00s 1:00 S -# Whitman gives 1937 Jun 16, 1938 Apr 16, 1940 Apr 13; -# go with Shanks & Pottenger. -Rule Spain 1937 only - May 22 23:00s 1:00 S -Rule Spain 1937 1939 - Oct Sat>=1 23:00s 0 - -Rule Spain 1938 only - Mar 22 23:00s 1:00 S -Rule Spain 1939 only - Apr 15 23:00s 1:00 S -Rule Spain 1940 only - Mar 16 23:00s 1:00 S -# Whitman says no DST 1942-1945; go with Shanks & Pottenger. -Rule Spain 1942 only - May 2 22:00s 2:00 M # Midsummer -Rule Spain 1942 only - Sep 1 22:00s 1:00 S -Rule Spain 1943 1946 - Apr Sat>=13 22:00s 2:00 M -Rule Spain 1943 only - Oct 3 22:00s 1:00 S -Rule Spain 1944 only - Oct 10 22:00s 1:00 S -Rule Spain 1945 only - Sep 30 1:00 1:00 S -Rule Spain 1946 only - Sep 30 0:00 0 - +Rule Spain 1918 only - Apr 15 23:00 1:00 S +Rule Spain 1918 1919 - Oct 6 24:00s 0 - +Rule Spain 1919 only - Apr 6 23:00 1:00 S +Rule Spain 1924 only - Apr 16 23:00 1:00 S +Rule Spain 1924 only - Oct 4 24:00s 0 - +Rule Spain 1926 only - Apr 17 23:00 1:00 S +Rule Spain 1926 1929 - Oct Sat>=1 24:00s 0 - +Rule Spain 1927 only - Apr 9 23:00 1:00 S +Rule Spain 1928 only - Apr 15 0:00 1:00 S +Rule Spain 1929 only - Apr 20 23:00 1:00 S +# Republican Spain during the civil war; it controlled Madrid until 1939-03-28. +Rule Spain 1937 only - Jun 16 23:00 1:00 S +Rule Spain 1937 only - Oct 2 24:00s 0 - +Rule Spain 1938 only - Apr 2 23:00 1:00 S +Rule Spain 1938 only - Apr 30 23:00 2:00 M +Rule Spain 1938 only - Oct 2 24:00 1:00 S +# The following rules are for unified Spain again. +# +# Planesas does not say what happened in Madrid between its fall on +# 1939-03-28 and the Nationalist spring-forward transition on +# 1939-04-15. For lack of better info, assume Madrid's clocks did not +# change during that period. +# +# The first rule is commented out, as it is redundant for Republican Spain. +#Rule Spain 1939 only - Apr 15 23:00 1:00 S +Rule Spain 1939 only - Oct 7 24:00s 0 - +Rule Spain 1942 only - May 2 23:00 1:00 S +Rule Spain 1942 only - Sep 1 1:00 0 - +Rule Spain 1943 1946 - Apr Sat>=13 23:00 1:00 S +Rule Spain 1943 1944 - Oct Sun>=1 1:00 0 - +Rule Spain 1945 1946 - Sep lastSun 1:00 0 - Rule Spain 1949 only - Apr 30 23:00 1:00 S -Rule Spain 1949 only - Sep 30 1:00 0 - -Rule Spain 1974 1975 - Apr Sat>=13 23:00 1:00 S +Rule Spain 1949 only - Oct 2 1:00 0 - +Rule Spain 1974 1975 - Apr Sat>=12 23:00 1:00 S Rule Spain 1974 1975 - Oct Sun>=1 1:00 0 - Rule Spain 1976 only - Mar 27 23:00 1:00 S Rule Spain 1976 1977 - Sep lastSun 1:00 0 - -Rule Spain 1977 1978 - Apr 2 23:00 1:00 S -Rule Spain 1978 only - Oct 1 1:00 0 - +Rule Spain 1977 only - Apr 2 23:00 1:00 S +Rule Spain 1978 only - Apr 2 2:00s 1:00 S +Rule Spain 1978 only - Oct 1 2:00s 0 - +# Nationalist Spain during the civil war +#Rule NatSpain 1937 only - May 22 23:00 1:00 S +#Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 - +#Rule NatSpain 1938 only - Mar 26 23:00 1:00 S # The following rules are copied from Morocco from 1967 through 1978. Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S Rule SpainAfrica 1967 only - Oct 1 0:00 0 - @@ -3286,11 +3350,11 @@ Rule SpainAfrica 1978 only - Jun 1 0:00 1:00 S Rule SpainAfrica 1978 only - Aug 4 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Europe/Madrid -0:14:44 - LMT 1901 Jan 1 0:00s - 0:00 Spain WE%sT 1946 Sep 30 +Zone Europe/Madrid -0:14:44 - LMT 1900 Dec 31 23:45:16 + 0:00 Spain WE%sT 1940 Mar 16 23:00 1:00 Spain CE%sT 1979 1:00 EU CE%sT -Zone Africa/Ceuta -0:21:16 - LMT 1901 +Zone Africa/Ceuta -0:21:16 - LMT 1900 Dec 31 23:38:44 0:00 - WET 1918 May 6 23:00 0:00 1:00 WEST 1918 Oct 7 23:00 0:00 - WET 1924 @@ -3299,7 +3363,7 @@ 1:00 - CET 1986 1:00 EU CE%sT Zone Atlantic/Canary -1:01:36 - LMT 1922 Mar # Las Palmas de Gran C. - -1:00 - CANT 1946 Sep 30 1:00 # Canaries T + -1:00 - -01 1946 Sep 30 1:00 0:00 - WET 1980 Apr 6 0:00s 0:00 1:00 WEST 1980 Sep 28 1:00u 0:00 EU WE%sT @@ -3712,7 +3776,7 @@ # spelling, except omit the apostrophe as it is not allowed in # portable Posix file names. Zone Europe/Zaporozhye 2:20:40 - LMT 1880 - 2:20 - CUT 1924 May 2 # Central Ukraine T + 2:20 - +0220 1924 May 2 2:00 - EET 1930 Jun 21 3:00 - MSK 1941 Aug 25 1:00 C-Eur CE%sT 1943 Oct 25
--- a/make/sun/javazic/tzdata/iso3166.tab Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/iso3166.tab Fri Jul 14 00:56:29 2017 +0100 @@ -98,7 +98,7 @@ CR Costa Rica CU Cuba CV Cape Verde -CW Curacao +CW Curaçao CX Christmas Island CY Cyprus CZ Czech Republic
--- a/make/sun/javazic/tzdata/leapseconds Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/leapseconds Fri Jul 14 00:56:29 2017 +0100 @@ -81,5 +81,5 @@ Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S -# Updated through IERS Bulletin C52 -# File expires on: 28 June 2017 +# Updated through IERS Bulletin C53 +# File expires on: 28 December 2017
--- a/make/sun/javazic/tzdata/northamerica Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/northamerica Fri Jul 14 00:56:29 2017 +0100 @@ -201,22 +201,6 @@ Zone MST7MDT -7:00 US M%sT Zone PST8PDT -8:00 US P%sT -# From Bob Devine (1988-01-28): -# ...Alaska (and Hawaii) had the timezone names changed in 1967. -# old new -# Pacific Standard Time(PST) -same- -# Yukon Standard Time(YST) -same- -# Central Alaska S.T. (CAT) Alaska-Hawaii St[an]dard Time (AHST) -# Nome Standard Time (NT) Bering Standard Time (BST) -# -# ...Alaska's timezone lines were redrawn in 1983 to give only 2 tz. -# The YST zone now covers nearly all of the state, AHST just part -# of the Aleutian islands. No DST. - -# From Paul Eggert (1995-12-19): -# The tables below use 'NST', not 'NT', for Nome Standard Time. -# I invented 'CAWT' for Central Alaska War Time. - # From U. S. Naval Observatory (1989-01-19): # USA EASTERN 5 H BEHIND UTC NEW YORK, WASHINGTON # USA EASTERN 4 H BEHIND UTC APR 3 - OCT 30 @@ -273,6 +257,21 @@ # Samoa standard time # The law doesn't give abbreviations. # +# From Paul Eggert (2016-12-19): +# Here are URLs for the 1918 and 1966 legislation: +# http://uscode.house.gov/statviewer.htm?volume=40&page=451 +# http://uscode.house.gov/statviewer.htm?volume=80&page=108 +# Although the 1918 names were officially "United States Standard +# Eastern Time" and similarly for "Central", "Mountain", "Pacific", +# and "Alaska", in practice "Standard" was placed just before "Time", +# as codified in 1966. In practice, Alaska time was abbreviated "AST" +# before 1968. Summarizing the 1967 name changes: +# 1918 names 1967 names +# -08 Standard Pacific Time (PST) Pacific standard time (PST) +# -09 (unofficial) Yukon (YST) Yukon standard time (YST) +# -10 Standard Alaska Time (AST) Alaska-Hawaii standard time (AHST) +# -11 (unofficial) Nome (NST) Bering standard time (BST) +# # From Paul Eggert (2000-01-08), following a heads-up from Rives McDow: # Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time" # for time in Guam and the Northern Marianas. See the file "australasia". @@ -328,6 +327,15 @@ # Roberts, city administrator in Phenix City. as saying "We are in the Central # time zone, but we do go by the Eastern time zone because so many people work # in Columbus." +# +# From Paul Eggert (2017-02-22): +# Four cities are involved. The two not mentioned above are Smiths Station +# and Valley. Barbara Brooks, Valley's assistant treasurer, heard it started +# because West Point Pepperell textile mills were in Alabama while the +# corporate office was in Georgia, and residents voted to keep Eastern +# time even after the mills closed. See: Kazek K. Did you know which +# Alabama towns are in a different time zone? al.com 2017-02-06. +# http://www.al.com/living/index.ssf/2017/02/do_you_know_which_alabama_town.html # From Paul Eggert (2014-09-06): # Monthly Notices of the Royal Astronomical Society 44, 4 (1884-02-08), 208 @@ -505,7 +513,7 @@ -8:00 US P%sT # Alaska -# AK%sT is the modern abbreviation for -9:00 per USNO. +# AK%sT is the modern abbreviation for -09 per USNO. # # From Paul Eggert (2001-05-30): # Howse writes that Alaska switched from the Julian to the Gregorian calendar, @@ -611,10 +619,8 @@ -9:00 US AK%sT Zone America/Anchorage 14:00:24 - LMT 1867 Oct 18 -9:59:36 - LMT 1900 Aug 20 12:00 - -10:00 - CAT 1942 - -10:00 US CAT/CAWT 1945 Aug 14 23:00u - -10:00 US CAT/CAPT 1946 # Peace - -10:00 - CAT 1967 Apr + -10:00 - AST 1942 + -10:00 US A%sT 1967 Apr -10:00 - AHST 1969 -10:00 US AH%sT 1983 Oct 30 2:00 -9:00 US Y%sT 1983 Nov 30 @@ -703,7 +709,6 @@ -10:30 1:00 HDT 1945 Sep 30 2:00 -10:30 - HST 1947 Jun 8 2:00 -10:00 - HST -Link Pacific/Honolulu Pacific/Johnston # Now we turn to US areas that have diverged from the consensus since 1970. @@ -1091,15 +1096,15 @@ ################################################################################ -# From Paul Eggert (2014-10-31): +# From Paul Eggert (2017-02-10): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). # Unfortunately this book contains many errors and cites no sources. # -# Gwillim Law writes that a good source -# for recent time zone data is the International Air Transport +# Many years ago Gwillim Law wrote that a good source +# for time zone data was the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. Except where otherwise noted, @@ -2757,15 +2762,15 @@ # Belize # Whitman entirely disagrees with Shanks; go with Shanks & Pottenger. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Belize 1918 1942 - Oct Sun>=2 0:00 0:30 HD -Rule Belize 1919 1943 - Feb Sun>=9 0:00 0 S -Rule Belize 1973 only - Dec 5 0:00 1:00 D -Rule Belize 1974 only - Feb 9 0:00 0 S -Rule Belize 1982 only - Dec 18 0:00 1:00 D -Rule Belize 1983 only - Feb 12 0:00 0 S +Rule Belize 1918 1942 - Oct Sun>=2 0:00 0:30 -0530 +Rule Belize 1919 1943 - Feb Sun>=9 0:00 0 CST +Rule Belize 1973 only - Dec 5 0:00 1:00 CDT +Rule Belize 1974 only - Feb 9 0:00 0 CST +Rule Belize 1982 only - Dec 18 0:00 1:00 CDT +Rule Belize 1983 only - Feb 12 0:00 0 CST # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Belize -5:52:48 - LMT 1912 Apr - -6:00 Belize C%sT + -6:00 Belize %s # Bermuda @@ -3037,16 +3042,16 @@ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule DR 1966 only - Oct 30 0:00 1:00 D -Rule DR 1967 only - Feb 28 0:00 0 S -Rule DR 1969 1973 - Oct lastSun 0:00 0:30 HD -Rule DR 1970 only - Feb 21 0:00 0 S -Rule DR 1971 only - Jan 20 0:00 0 S -Rule DR 1972 1974 - Jan 21 0:00 0 S +Rule DR 1966 only - Oct 30 0:00 1:00 EDT +Rule DR 1967 only - Feb 28 0:00 0 EST +Rule DR 1969 1973 - Oct lastSun 0:00 0:30 -0430 +Rule DR 1970 only - Feb 21 0:00 0 EST +Rule DR 1971 only - Jan 20 0:00 0 EST +Rule DR 1972 1974 - Jan 21 0:00 0 EST # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Santo_Domingo -4:39:36 - LMT 1890 -4:40 - SDMT 1933 Apr 1 12:00 # S. Dom. MT - -5:00 DR E%sT 1974 Oct 27 + -5:00 DR %s 1974 Oct 27 -4:00 - AST 2000 Oct 29 2:00 -5:00 US E%sT 2000 Dec 3 1:00 -4:00 - AST @@ -3336,8 +3341,8 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre -4:00 - AST 1980 May - -3:00 - PMST 1987 # Pierre & Miquelon Time - -3:00 Canada PM%sT + -3:00 - -03 1987 + -3:00 Canada -03/-02 # St Vincent and the Grenadines # See America/Port_of_Spain.
--- a/make/sun/javazic/tzdata/southamerica Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/southamerica Fri Jul 14 00:56:29 2017 +0100 @@ -29,15 +29,15 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2014-10-31): +# From Paul Eggert (2016-12-05): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), # San Diego: ACS Publications, Inc. (2003). # Unfortunately this book contains many errors and cites no sources. # -# Gwillim Law writes that a good source -# for recent time zone data is the International Air Transport +# Many years ago Gwillim Law wrote that a good source +# for time zone data was the International Air Transport # Association's Standard Schedules Information Manual (IATA SSIM), # published semiannually. Law sent in several helpful summaries # of the IATA's data after 1990. Except where otherwise noted, @@ -47,32 +47,10 @@ # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. # http://www.jstor.org/stable/1774359 # -# Earlier editions of these tables used the North American style (e.g. ARST and -# ARDT for Argentine Standard and Daylight Time), but the following quote -# suggests that it's better to use European style (e.g. ART and ARST). -# I suggest the use of _Summer time_ instead of the more cumbersome -# _daylight-saving time_. _Summer time_ seems to be in general use -# in Europe and South America. -# -- E O Cutler, _New York Times_ (1937-02-14), quoted in -# H L Mencken, _The American Language: Supplement I_ (1960), p 466 -# -# Earlier editions of these tables also used the North American style -# for time zones in Brazil, but this was incorrect, as Brazilians say -# "summer time". Reinaldo Goulart, a São Paulo businessman active in -# the railroad sector, writes (1999-07-06): -# The subject of time zones is currently a matter of discussion/debate in -# Brazil. Let's say that "the BrasÃlia time" is considered the -# "official time" because BrasÃlia is the capital city. -# The other three time zones are called "BrasÃlia time "minus one" or -# "plus one" or "plus two". As far as I know there is no such -# name/designation as "Eastern Time" or "Central Time". -# So I invented the following (English-language) abbreviations for now. -# Corrections are welcome! -# std dst -# -2:00 FNT FNST Fernando de Noronha -# -3:00 BRT BRST BrasÃlia -# -4:00 AMT AMST Amazon -# -5:00 ACT ACST Acre +# These tables use numeric abbreviations like -03 and -0330 for +# integer hour and minute UTC offsets. Although earlier editions used +# alphabetic time zone abbreviations, these abbreviations were +# invented and did not reflect common practice. ############################################################################### @@ -407,12 +385,6 @@ # # So I guess a new set of rules, besides "Arg", must be made and the last # America/Argentina/San_Luis entries should change to use these... -# -# I'm enclosing a patch that does what I say... regretfully, the San Luis -# timezone must be called "WART/WARST" even when most of the time (like, -# right now) WARST == ART... that is, since last Sunday, all the country -# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest -# of the country calls it "ART". # ... # From Alexander Krivenyshev (2010-04-09): @@ -451,11 +423,11 @@ # Buenos Aires (BA), Capital Federal (CF), Zone America/Argentina/Buenos_Aires -3:53:48 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May # Córdoba Mean Time - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 Arg AR%sT + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 Arg -03/-02 # # Córdoba (CB), Santa Fe (SF), Entre RÃos (ER), Corrientes (CN), Misiones (MN), # Chaco (CC), Formosa (FM), Santiago del Estero (SE) @@ -469,113 +441,113 @@ # Zone America/Argentina/Cordoba -4:16:48 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1991 Mar 3 - -4:00 - WART 1991 Oct 20 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 Arg AR%sT + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1991 Mar 3 + -4:00 - -04 1991 Oct 20 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 Arg -03/-02 # # Salta (SA), La Pampa (LP), Neuquén (NQ), Rio Negro (RN) Zone America/Argentina/Salta -4:21:40 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1991 Mar 3 - -4:00 - WART 1991 Oct 20 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1991 Mar 3 + -4:00 - -04 1991 Oct 20 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # Tucumán (TM) Zone America/Argentina/Tucuman -4:20:52 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1991 Mar 3 - -4:00 - WART 1991 Oct 20 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 Jun 1 - -4:00 - WART 2004 Jun 13 - -3:00 Arg AR%sT + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1991 Mar 3 + -4:00 - -04 1991 Oct 20 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 Jun 1 + -4:00 - -04 2004 Jun 13 + -3:00 Arg -03/-02 # # La Rioja (LR) Zone America/Argentina/La_Rioja -4:27:24 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1991 Mar 1 - -4:00 - WART 1991 May 7 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 Jun 1 - -4:00 - WART 2004 Jun 20 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1991 Mar 1 + -4:00 - -04 1991 May 7 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 Jun 1 + -4:00 - -04 2004 Jun 20 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # San Juan (SJ) Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1991 Mar 1 - -4:00 - WART 1991 May 7 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 May 31 - -4:00 - WART 2004 Jul 25 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1991 Mar 1 + -4:00 - -04 1991 May 7 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 May 31 + -4:00 - -04 2004 Jul 25 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # Jujuy (JY) Zone America/Argentina/Jujuy -4:21:12 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1990 Mar 4 - -4:00 - WART 1990 Oct 28 - -4:00 1:00 WARST 1991 Mar 17 - -4:00 - WART 1991 Oct 6 - -3:00 1:00 ARST 1992 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1990 Mar 4 + -4:00 - -04 1990 Oct 28 + -4:00 1:00 -03 1991 Mar 17 + -4:00 - -04 1991 Oct 6 + -3:00 1:00 -02 1992 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # Catamarca (CT), Chubut (CH) Zone America/Argentina/Catamarca -4:23:08 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1991 Mar 3 - -4:00 - WART 1991 Oct 20 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 Jun 1 - -4:00 - WART 2004 Jun 20 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1991 Mar 3 + -4:00 - -04 1991 Oct 20 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 Jun 1 + -4:00 - -04 2004 Jun 20 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # Mendoza (MZ) Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1990 Mar 4 - -4:00 - WART 1990 Oct 15 - -4:00 1:00 WARST 1991 Mar 1 - -4:00 - WART 1991 Oct 15 - -4:00 1:00 WARST 1992 Mar 1 - -4:00 - WART 1992 Oct 18 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 May 23 - -4:00 - WART 2004 Sep 26 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1990 Mar 4 + -4:00 - -04 1990 Oct 15 + -4:00 1:00 -03 1991 Mar 1 + -4:00 - -04 1991 Oct 15 + -4:00 1:00 -03 1992 Mar 1 + -4:00 - -04 1992 Oct 18 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 May 23 + -4:00 - -04 2004 Sep 26 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # San Luis (SL) @@ -584,44 +556,44 @@ Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1990 - -3:00 1:00 ARST 1990 Mar 14 - -4:00 - WART 1990 Oct 15 - -4:00 1:00 WARST 1991 Mar 1 - -4:00 - WART 1991 Jun 1 - -3:00 - ART 1999 Oct 3 - -4:00 1:00 WARST 2000 Mar 3 - -3:00 - ART 2004 May 31 - -4:00 - WART 2004 Jul 25 - -3:00 Arg AR%sT 2008 Jan 21 - -4:00 SanLuis WAR%sT 2009 Oct 11 - -3:00 - ART + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1990 + -3:00 1:00 -02 1990 Mar 14 + -4:00 - -04 1990 Oct 15 + -4:00 1:00 -03 1991 Mar 1 + -4:00 - -04 1991 Jun 1 + -3:00 - -03 1999 Oct 3 + -4:00 1:00 -03 2000 Mar 3 + -3:00 - -03 2004 May 31 + -4:00 - -04 2004 Jul 25 + -3:00 Arg -03/-02 2008 Jan 21 + -4:00 SanLuis -04/-03 2009 Oct 11 + -3:00 - -03 # # Santa Cruz (SC) Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31 - -4:16:48 - CMT 1920 May # Córdoba Mean Time - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 Jun 1 - -4:00 - WART 2004 Jun 20 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:16:48 - CMT 1920 May + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 Jun 1 + -4:00 - -04 2004 Jun 20 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # # Tierra del Fuego, Antártida e Islas del Atlántico Sur (TF) Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31 - -4:16:48 - CMT 1920 May # Córdoba Mean Time - -4:00 - ART 1930 Dec - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1999 Oct 3 - -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 May 30 - -4:00 - WART 2004 Jun 20 - -3:00 Arg AR%sT 2008 Oct 18 - -3:00 - ART + -4:16:48 - CMT 1920 May + -4:00 - -04 1930 Dec + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1999 Oct 3 + -4:00 Arg -04/-03 2000 Mar 3 + -3:00 - -03 2004 May 30 + -4:00 - -04 2004 Jun 20 + -3:00 Arg -03/-02 2008 Oct 18 + -3:00 - -03 # Aruba Link America/Curacao America/Aruba @@ -631,7 +603,7 @@ Zone America/La_Paz -4:32:36 - LMT 1890 -4:32:36 - CMT 1931 Oct 15 # Calamarca MT -4:32:36 1:00 BOST 1932 Mar 21 # Bolivia ST - -4:00 - BOT # Bolivia Time + -4:00 - -04 # Brazil @@ -983,12 +955,12 @@ # # Fernando de Noronha (administratively part of PE) Zone America/Noronha -2:09:40 - LMT 1914 - -2:00 Brazil FN%sT 1990 Sep 17 - -2:00 - FNT 1999 Sep 30 - -2:00 Brazil FN%sT 2000 Oct 15 - -2:00 - FNT 2001 Sep 13 - -2:00 Brazil FN%sT 2002 Oct 1 - -2:00 - FNT + -2:00 Brazil -02/-01 1990 Sep 17 + -2:00 - -02 1999 Sep 30 + -2:00 Brazil -02/-01 2000 Oct 15 + -2:00 - -02 2001 Sep 13 + -2:00 Brazil -02/-01 2002 Oct 1 + -2:00 - -02 # Other Atlantic islands have no permanent settlement. # These include Trindade and Martim Vaz (administratively part of ES), # Rocas Atoll (RN), and the St Peter and St Paul Archipelago (PE). @@ -1001,119 +973,119 @@ # In the north a very small part from the river Javary (now Jari I guess, # the border with Amapá) to the Amazon, then to the Xingu. Zone America/Belem -3:13:56 - LMT 1914 - -3:00 Brazil BR%sT 1988 Sep 12 - -3:00 - BRT + -3:00 Brazil -03/-02 1988 Sep 12 + -3:00 - -03 # # west Pará (PA) # West Pará includes Altamira, Óbidos, Prainha, Oriximiná, and Santarém. Zone America/Santarem -3:38:48 - LMT 1914 - -4:00 Brazil AM%sT 1988 Sep 12 - -4:00 - AMT 2008 Jun 24 0:00 - -3:00 - BRT + -4:00 Brazil -04/-03 1988 Sep 12 + -4:00 - -04 2008 Jun 24 0:00 + -3:00 - -03 # # Maranhão (MA), Piauà (PI), Ceará (CE), Rio Grande do Norte (RN), # ParaÃba (PB) Zone America/Fortaleza -2:34:00 - LMT 1914 - -3:00 Brazil BR%sT 1990 Sep 17 - -3:00 - BRT 1999 Sep 30 - -3:00 Brazil BR%sT 2000 Oct 22 - -3:00 - BRT 2001 Sep 13 - -3:00 Brazil BR%sT 2002 Oct 1 - -3:00 - BRT + -3:00 Brazil -03/-02 1990 Sep 17 + -3:00 - -03 1999 Sep 30 + -3:00 Brazil -03/-02 2000 Oct 22 + -3:00 - -03 2001 Sep 13 + -3:00 Brazil -03/-02 2002 Oct 1 + -3:00 - -03 # # Pernambuco (PE) (except Atlantic islands) Zone America/Recife -2:19:36 - LMT 1914 - -3:00 Brazil BR%sT 1990 Sep 17 - -3:00 - BRT 1999 Sep 30 - -3:00 Brazil BR%sT 2000 Oct 15 - -3:00 - BRT 2001 Sep 13 - -3:00 Brazil BR%sT 2002 Oct 1 - -3:00 - BRT + -3:00 Brazil -03/-02 1990 Sep 17 + -3:00 - -03 1999 Sep 30 + -3:00 Brazil -03/-02 2000 Oct 15 + -3:00 - -03 2001 Sep 13 + -3:00 Brazil -03/-02 2002 Oct 1 + -3:00 - -03 # # Tocantins (TO) Zone America/Araguaina -3:12:48 - LMT 1914 - -3:00 Brazil BR%sT 1990 Sep 17 - -3:00 - BRT 1995 Sep 14 - -3:00 Brazil BR%sT 2003 Sep 24 - -3:00 - BRT 2012 Oct 21 - -3:00 Brazil BR%sT 2013 Sep - -3:00 - BRT + -3:00 Brazil -03/-02 1990 Sep 17 + -3:00 - -03 1995 Sep 14 + -3:00 Brazil -03/-02 2003 Sep 24 + -3:00 - -03 2012 Oct 21 + -3:00 Brazil -03/-02 2013 Sep + -3:00 - -03 # # Alagoas (AL), Sergipe (SE) Zone America/Maceio -2:22:52 - LMT 1914 - -3:00 Brazil BR%sT 1990 Sep 17 - -3:00 - BRT 1995 Oct 13 - -3:00 Brazil BR%sT 1996 Sep 4 - -3:00 - BRT 1999 Sep 30 - -3:00 Brazil BR%sT 2000 Oct 22 - -3:00 - BRT 2001 Sep 13 - -3:00 Brazil BR%sT 2002 Oct 1 - -3:00 - BRT + -3:00 Brazil -03/-02 1990 Sep 17 + -3:00 - -03 1995 Oct 13 + -3:00 Brazil -03/-02 1996 Sep 4 + -3:00 - -03 1999 Sep 30 + -3:00 Brazil -03/-02 2000 Oct 22 + -3:00 - -03 2001 Sep 13 + -3:00 Brazil -03/-02 2002 Oct 1 + -3:00 - -03 # # Bahia (BA) # There are too many Salvadors elsewhere, so use America/Bahia instead # of America/Salvador. Zone America/Bahia -2:34:04 - LMT 1914 - -3:00 Brazil BR%sT 2003 Sep 24 - -3:00 - BRT 2011 Oct 16 - -3:00 Brazil BR%sT 2012 Oct 21 - -3:00 - BRT + -3:00 Brazil -03/-02 2003 Sep 24 + -3:00 - -03 2011 Oct 16 + -3:00 Brazil -03/-02 2012 Oct 21 + -3:00 - -03 # # Goiás (GO), Distrito Federal (DF), Minas Gerais (MG), # EspÃrito Santo (ES), Rio de Janeiro (RJ), São Paulo (SP), Paraná (PR), # Santa Catarina (SC), Rio Grande do Sul (RS) Zone America/Sao_Paulo -3:06:28 - LMT 1914 - -3:00 Brazil BR%sT 1963 Oct 23 0:00 - -3:00 1:00 BRST 1964 - -3:00 Brazil BR%sT + -3:00 Brazil -03/-02 1963 Oct 23 0:00 + -3:00 1:00 -02 1964 + -3:00 Brazil -03/-02 # # Mato Grosso do Sul (MS) Zone America/Campo_Grande -3:38:28 - LMT 1914 - -4:00 Brazil AM%sT + -4:00 Brazil -04/-03 # # Mato Grosso (MT) Zone America/Cuiaba -3:44:20 - LMT 1914 - -4:00 Brazil AM%sT 2003 Sep 24 - -4:00 - AMT 2004 Oct 1 - -4:00 Brazil AM%sT + -4:00 Brazil -04/-03 2003 Sep 24 + -4:00 - -04 2004 Oct 1 + -4:00 Brazil -04/-03 # # Rondônia (RO) Zone America/Porto_Velho -4:15:36 - LMT 1914 - -4:00 Brazil AM%sT 1988 Sep 12 - -4:00 - AMT + -4:00 Brazil -04/-03 1988 Sep 12 + -4:00 - -04 # # Roraima (RR) Zone America/Boa_Vista -4:02:40 - LMT 1914 - -4:00 Brazil AM%sT 1988 Sep 12 - -4:00 - AMT 1999 Sep 30 - -4:00 Brazil AM%sT 2000 Oct 15 - -4:00 - AMT + -4:00 Brazil -04/-03 1988 Sep 12 + -4:00 - -04 1999 Sep 30 + -4:00 Brazil -04/-03 2000 Oct 15 + -4:00 - -04 # # east Amazonas (AM): Boca do Acre, JutaÃ, Manaus, Floriano Peixoto # The great circle line from Tabatinga to Porto Acre divides # east from west Amazonas. Zone America/Manaus -4:00:04 - LMT 1914 - -4:00 Brazil AM%sT 1988 Sep 12 - -4:00 - AMT 1993 Sep 28 - -4:00 Brazil AM%sT 1994 Sep 22 - -4:00 - AMT + -4:00 Brazil -04/-03 1988 Sep 12 + -4:00 - -04 1993 Sep 28 + -4:00 Brazil -04/-03 1994 Sep 22 + -4:00 - -04 # # west Amazonas (AM): Atalaia do Norte, Boca do Maoco, Benjamin Constant, # Eirunepé, Envira, Ipixuna Zone America/Eirunepe -4:39:28 - LMT 1914 - -5:00 Brazil AC%sT 1988 Sep 12 - -5:00 - ACT 1993 Sep 28 - -5:00 Brazil AC%sT 1994 Sep 22 - -5:00 - ACT 2008 Jun 24 0:00 - -4:00 - AMT 2013 Nov 10 - -5:00 - ACT + -5:00 Brazil -05/-04 1988 Sep 12 + -5:00 - -05 1993 Sep 28 + -5:00 Brazil -05/-04 1994 Sep 22 + -5:00 - -05 2008 Jun 24 0:00 + -4:00 - -04 2013 Nov 10 + -5:00 - -05 # # Acre (AC) Zone America/Rio_Branco -4:31:12 - LMT 1914 - -5:00 Brazil AC%sT 1988 Sep 12 - -5:00 - ACT 2008 Jun 24 0:00 - -4:00 - AMT 2013 Nov 10 - -5:00 - ACT + -5:00 Brazil -05/-04 1988 Sep 12 + -5:00 - -05 2008 Jun 24 0:00 + -4:00 - -04 2013 Nov 10 + -5:00 - -05 # Chile @@ -1258,6 +1230,18 @@ # to mean 24:00 mainland time, not 24:00 local time, so that Easter # Island is always two hours behind the mainland. +# From Juan Correa (2016-12-04): +# Magallanes region ... will keep DST (UTC -3) all year round.... +# http://www.soychile.cl/Santiago/Sociedad/2016/12/04/433428/Bachelet-firmo-el-decreto-para-establecer-un-horario-unico-para-la-Region-de-Magallanes.aspx +# +# From Deborah Goldsmith (2017-01-19): +# http://www.diariooficial.interior.gob.cl/publicaciones/2017/01/17/41660/01/1169626.pdf +# From Paul Eggert (2017-01-19): +# The above says the Magallanes change expires 2019-05-11 at 24:00, +# so in theory, they will revert to -04/-03 after that, which means +# they will switch from -03 to -04 one hour after Santiago does that day. +# For now, assume that they will not revert. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Chile 1927 1931 - Sep 1 0:00 1:00 S Rule Chile 1928 1932 - Apr 1 0:00 0 - @@ -1298,22 +1282,35 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:46 - LMT 1890 -4:42:46 - SMT 1910 Jan 10 # Santiago Mean Time - -5:00 - CLT 1916 Jul 1 # Chile Time + -5:00 - -05 1916 Jul 1 -4:42:46 - SMT 1918 Sep 10 - -4:00 - CLT 1919 Jul 1 + -4:00 - -04 1919 Jul 1 -4:42:46 - SMT 1927 Sep 1 - -5:00 Chile CL%sT 1932 Sep 1 - -4:00 - CLT 1942 Jun 1 - -5:00 - CLT 1942 Aug 1 - -4:00 - CLT 1946 Jul 15 - -4:00 1:00 CLST 1946 Sep 1 # central Chile - -4:00 - CLT 1947 Apr 1 - -5:00 - CLT 1947 May 21 23:00 - -4:00 Chile CL%sT + -5:00 Chile -05/-04 1932 Sep 1 + -4:00 - -04 1942 Jun 1 + -5:00 - -05 1942 Aug 1 + -4:00 - -04 1946 Jul 15 + -4:00 1:00 -03 1946 Sep 1 # central Chile + -4:00 - -04 1947 Apr 1 + -5:00 - -05 1947 May 21 23:00 + -4:00 Chile -04/-03 +Zone America/Punta_Arenas -4:43:40 - LMT 1890 + -4:42:46 - SMT 1910 Jan 10 + -5:00 - -05 1916 Jul 1 + -4:42:46 - SMT 1918 Sep 10 + -4:00 - -04 1919 Jul 1 + -4:42:46 - SMT 1927 Sep 1 + -5:00 Chile -05/-04 1932 Sep 1 + -4:00 - -04 1942 Jun 1 + -5:00 - -05 1942 Aug 1 + -4:00 - -04 1947 Apr 1 + -5:00 - -05 1947 May 21 23:00 + -4:00 Chile -04/-03 2016 Dec 4 + -3:00 - -03 Zone Pacific/Easter -7:17:28 - LMT 1890 -7:17:28 - EMT 1932 Sep # Easter Mean Time - -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time - -6:00 Chile EAS%sT + -7:00 Chile -07/-06 1982 Mar 14 3:00u # Easter Time + -6:00 Chile -06/-05 # # Salas y Gómez Island is uninhabited. # Other Chilean locations, including Juan Fernández Is, Desventuradas Is, @@ -1333,9 +1330,10 @@ # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Antarctica/Palmer 0 - -00 1965 - -4:00 Arg AR%sT 1969 Oct 5 - -3:00 Arg AR%sT 1982 May - -4:00 Chile CL%sT + -4:00 Arg -04/-03 1969 Oct 5 + -3:00 Arg -03/-02 1982 May + -4:00 Chile -04/-03 2016 Dec 4 + -3:00 - -03 # Colombia @@ -1348,7 +1346,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Bogota -4:56:16 - LMT 1884 Mar 13 -4:56:16 - BMT 1914 Nov 23 # Bogotá Mean Time - -5:00 CO CO%sT # Colombia Time + -5:00 CO -05/-04 # Malpelo, Providencia, San Andres # no information; probably like America/Bogota @@ -1372,7 +1370,7 @@ # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Curacao -4:35:47 - LMT 1912 Feb 12 # Willemstad - -4:30 - ANT 1965 # Netherlands Antilles Time + -4:30 - -0430 1965 -4:00 - AST # From Arthur David Olson (2011-06-15): @@ -1387,19 +1385,32 @@ # # Milne says the Central and South American Telegraph Company used -5:24:15. # -# From Paul Eggert (2007-03-04): -# Apparently Ecuador had a failed experiment with DST in 1992. -# <http://midena.gov.ec/content/view/1261/208/> (2007-02-27) and -# <http://www.hoy.com.ec/NoticiaNue.asp?row_id=249856> (2006-11-06) both -# talk about "hora Sixto". Leave this alone for now, as we have no data. +# From Alois Treindl (2016-12-15): +# http://www.elcomercio.com/actualidad/hora-sixto-1993.html +# ... Whether the law applied also to Galápagos, I do not know. +# From Paul Eggert (2016-12-15): +# http://www.elcomercio.com/afull/modificacion-husohorario-ecuador-presidentes-decreto.html +# This says President Sixto Durán Ballén signed decree No. 285, which +# established DST from 1992-11-28 to 1993-02-05; it does not give transition +# times. The people called it "hora de Sixto" ("Sixto hour"). The change did +# not go over well; a popular song "Qué hora es" by Jaime Guevara had lyrics +# that included "AmanecÃa en mitad de la noche, los guaguas iban a clase sin +# sol" ("It was dawning in the middle of the night, the buses went to class +# without sun"). Although Ballén's campaign slogan was "Ni un paso atrás" +# (Not one step back), the clocks went back in 1993 and the experiment was not +# repeated. For now, assume transitions were at 00:00 local time country-wide. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Ecuador 1992 only - Nov 28 0:00 1:00 S +Rule Ecuador 1993 only - Feb 5 0:00 0 - # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Guayaquil -5:19:20 - LMT 1890 -5:14:00 - QMT 1931 # Quito Mean Time - -5:00 - ECT # Ecuador Time + -5:00 Ecuador -05/-04 Zone Pacific/Galapagos -5:58:24 - LMT 1931 # Puerto Baquerizo Moreno - -5:00 - ECT 1986 - -6:00 - GALT # Galápagos Time + -5:00 - -05 1986 + -6:00 Ecuador -06/-05 # Falklands @@ -1499,25 +1510,24 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Atlantic/Stanley -3:51:24 - LMT 1890 -3:51:24 - SMT 1912 Mar 12 # Stanley Mean Time - -4:00 Falk FK%sT 1983 May # Falkland Is Time - -3:00 Falk FK%sT 1985 Sep 15 - -4:00 Falk FK%sT 2010 Sep 5 2:00 - -3:00 - FKST + -4:00 Falk -04/-03 1983 May + -3:00 Falk -03/-02 1985 Sep 15 + -4:00 Falk -04/-03 2010 Sep 5 2:00 + -3:00 - -03 # French Guiana # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Cayenne -3:29:20 - LMT 1911 Jul - -4:00 - GFT 1967 Oct # French Guiana Time - -3:00 - GFT + -4:00 - -04 1967 Oct + -3:00 - -03 # Guyana # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Guyana -3:52:40 - LMT 1915 Mar # Georgetown - -3:45 - GBGT 1966 May 26 # Br Guiana Time - -3:45 - GYT 1975 Jul 31 # Guyana Time - -3:00 - GYT 1991 + -3:45 - -0345 1975 Jul 31 + -3:00 - -03 1991 # IATA SSIM (1996-06) says -4:00. Assume a 1991 switch. - -4:00 - GYT + -4:00 - -04 # Paraguay # @@ -1609,9 +1619,9 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890 -3:50:40 - AMT 1931 Oct 10 # Asunción Mean Time - -4:00 - PYT 1972 Oct # Paraguay Time - -3:00 - PYT 1974 Apr - -4:00 Para PY%sT + -4:00 - -04 1972 Oct + -3:00 - -03 1974 Apr + -4:00 Para -04/-03 # Peru # @@ -1638,12 +1648,12 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Lima -5:08:12 - LMT 1890 -5:08:36 - LMT 1908 Jul 28 # Lima Mean Time? - -5:00 Peru PE%sT # Peru Time + -5:00 Peru -05/-04 # South Georgia # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Atlantic/South_Georgia -2:26:08 - LMT 1890 # Grytviken - -2:00 - GST # South Georgia Time + -2:00 - -02 # South Sandwich Is # uninhabited; scientific personnel have wintered @@ -1653,9 +1663,8 @@ Zone America/Paramaribo -3:40:40 - LMT 1911 -3:40:52 - PMT 1935 # Paramaribo Mean Time -3:40:36 - PMT 1945 Oct # The capital moved? - -3:30 - NEGT 1975 Nov 20 # Dutch Guiana Time - -3:30 - SRT 1984 Oct # Suriname Time - -3:00 - SRT + -3:30 - -0330 1984 Oct + -3:00 - -03 # Trinidad and Tobago # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -1758,11 +1767,16 @@ # [dated 2015-06-29; repeals Decree 311/006 dated 2006-09-04] Rule Uruguay 2006 2014 - Oct Sun>=1 2:00 1:00 S Rule Uruguay 2007 2015 - Mar Sun>=8 2:00 0 - -# Zone NAME GMTOFF RULES FORMAT [UNTIL] + +# This Zone can be simplified once we assume zic %z. Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28 -3:44:44 - MMT 1920 May 1 # Montevideo MT - -3:30 Uruguay UY%sT 1942 Dec 14 # Uruguay Time - -3:00 Uruguay UY%sT + -3:30 Uruguay -0330/-03 1942 Dec 14 + -3:00 Uruguay -03/-02 1968 + -3:00 Uruguay -03/-0230 1971 + -3:00 Uruguay -03/-02 1974 + -3:00 Uruguay -03/-0230 1974 Dec 22 + -3:00 Uruguay -03/-02 # Venezuela # @@ -1796,7 +1810,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Caracas -4:27:44 - LMT 1890 -4:27:40 - CMT 1912 Feb 12 # Caracas Mean Time? - -4:30 - VET 1965 Jan 1 0:00 # Venezuela T. - -4:00 - VET 2007 Dec 9 3:00 - -4:30 - VET 2016 May 1 2:30 - -4:00 - VET + -4:30 - -0430 1965 Jan 1 0:00 + -4:00 - -04 2007 Dec 9 3:00 + -4:30 - -0430 2016 May 1 2:30 + -4:00 - -04
--- a/make/sun/javazic/tzdata/zone.tab Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/javazic/tzdata/zone.tab Fri Jul 14 00:56:29 2017 +0100 @@ -165,6 +165,7 @@ CI +0519-00402 Africa/Abidjan CK -2114-15946 Pacific/Rarotonga CL -3327-07040 America/Santiago Chile (most areas) +CL -5309-07055 America/Punta_Arenas Region of Magallanes CL -2709-10926 Pacific/Easter Easter Island CM +0403+00942 Africa/Douala CN +3114+12128 Asia/Shanghai Beijing Time @@ -262,7 +263,8 @@ KZ +4315+07657 Asia/Almaty Kazakhstan (most areas) KZ +4448+06528 Asia/Qyzylorda Qyzylorda/Kyzylorda/Kzyl-Orda KZ +5017+05710 Asia/Aqtobe Aqtobe/Aktobe -KZ +4431+05016 Asia/Aqtau Atyrau/Atirau/Gur'yev, Mangghystau/Mankistau +KZ +4431+05016 Asia/Aqtau Mangghystau/Mankistau +KZ +4707+05156 Asia/Atyrau Atyrau/Atirau/Gur'yev KZ +5113+05121 Asia/Oral West Kazakhstan LA +1758+10236 Asia/Vientiane LB +3353+03530 Asia/Beirut @@ -353,14 +355,15 @@ RU +5443+02030 Europe/Kaliningrad MSK-01 - Kaliningrad RU +554521+0373704 Europe/Moscow MSK+00 - Moscow area RU +4457+03406 Europe/Simferopol MSK+00 - Crimea -RU +4844+04425 Europe/Volgograd MSK+00 - Volgograd, Saratov +RU +4844+04425 Europe/Volgograd MSK+00 - Volgograd RU +5836+04939 Europe/Kirov MSK+00 - Kirov RU +4621+04803 Europe/Astrakhan MSK+01 - Astrakhan +RU +5134+04602 Europe/Saratov MSK+01 - Saratov +RU +5420+04824 Europe/Ulyanovsk MSK+01 - Ulyanovsk RU +5312+05009 Europe/Samara MSK+01 - Samara, Udmurtia -RU +5420+04824 Europe/Ulyanovsk MSK+01 - Ulyanovsk RU +5651+06036 Asia/Yekaterinburg MSK+02 - Urals RU +5500+07324 Asia/Omsk MSK+03 - Omsk -RU +5502+08255 Asia/Novosibirsk MSK+03 - Novosibirsk +RU +5502+08255 Asia/Novosibirsk MSK+04 - Novosibirsk RU +5322+08345 Asia/Barnaul MSK+04 - Altai RU +5630+08458 Asia/Tomsk MSK+04 - Tomsk RU +5345+08707 Asia/Novokuznetsk MSK+04 - Kemerovo @@ -418,7 +421,6 @@ UA +4837+02218 Europe/Uzhgorod Ruthenia UA +4750+03510 Europe/Zaporozhye Zaporozh'ye/Zaporizhia; Lugansk/Luhansk (east) UG +0019+03225 Africa/Kampala -UM +1645-16931 Pacific/Johnston Johnston Atoll UM +2813-17722 Pacific/Midway Midway Islands UM +1917+16637 Pacific/Wake Wake Island US +404251-0740023 America/New_York Eastern (most areas)
--- a/make/sun/lwawt/FILES_export_macosx.gmk Thu Apr 27 03:09:54 2017 +0100 +++ b/make/sun/lwawt/FILES_export_macosx.gmk Fri Jul 14 00:56:29 2017 +0100 @@ -109,7 +109,6 @@ sun/lwawt/LWToolkit.java \ sun/lwawt/LWWindowPeer.java \ sun/lwawt/PlatformWindow.java \ - sun/lwawt/SelectionClearListener.java \ sun/lwawt/macosx/CPrinterDevice.java \ sun/lwawt/macosx/CPrinterDialog.java \ sun/lwawt/macosx/CPrinterDialogPeer.java \ @@ -122,7 +121,6 @@ sun/lwawt/macosx/CTextPipe.java \ sun/lwawt/macosx/CDesktopPeer.java \ sun/java2d/CRenderer.java \ - sun/lwawt/macosx/EventDispatchAccess.java \ sun/lwawt/macosx/NSPrintInfo.java \ sun/lwawt/macosx/CAccessibility.java \ sun/lwawt/macosx/CAccessible.java \
--- a/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java Fri Jul 14 00:56:29 2017 +0100 @@ -72,8 +72,12 @@ public void setDockIconImage(final Image image) { try { final CImage cImage = getCImageCreator().createFromImage(image); - final long nsImagePtr = getNSImagePtrFrom(cImage); - nativeSetDockIconImage(nsImagePtr); + cImage.execute(new CFRetainedResource.CFNativeAction() { + @Override + public void run(long ptr) { + _AppDockIconHandler.nativeSetDockIconImage(ptr); + } + }); } catch (final Throwable e) { throw new RuntimeException(e); } @@ -102,16 +106,4 @@ throw new RuntimeException(e); } } - - static long getNSImagePtrFrom(final CImage cImage) { - if (cImage == null) return 0; - - try { - final Field cImagePtrField = CFRetainedResource.class.getDeclaredField("ptr"); - cImagePtrField.setAccessible(true); - return cImagePtrField.getLong(cImage); - } catch (final Throwable e) { - throw new RuntimeException(e); - } - } }
--- a/src/macosx/classes/com/apple/laf/AquaIcon.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/com/apple/laf/AquaIcon.java Fri Jul 14 00:56:29 2017 +0100 @@ -295,7 +295,14 @@ } Image createImage() { - return AquaUtils.getCImageCreator().createSystemImageFromSelector(selector, getIconWidth(), getIconHeight()); + int w = getIconWidth(); + int h = getIconHeight(); + return new AquaImageFactory.MultiResolutionIconImage( + AquaUtils.getCImageCreator().createSystemImageFromSelector( + selector, w, h), + AquaUtils.getCImageCreator().createSystemImageFromSelector( + selector, 2 * w, 2 * h) + ); } } }
--- a/src/macosx/classes/com/apple/laf/AquaImageFactory.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/com/apple/laf/AquaImageFactory.java Fri Jul 14 00:56:29 2017 +0100 @@ -46,6 +46,10 @@ import com.apple.laf.AquaIcon.SystemIcon; import com.apple.laf.AquaUtils.RecyclableObject; import com.apple.laf.AquaUtils.RecyclableSingleton; +import java.util.Arrays; +import java.util.List; +import sun.awt.image.MultiResolutionBufferedImage; +import sun.awt.image.MultiResolutionImage; public class AquaImageFactory { public static IconUIResource getConfirmImageIcon() { @@ -120,28 +124,48 @@ private static final int kAlertIconSize = 64; static IconUIResource getAppIconCompositedOn(final Image background) { - final double scaleFactor = 1.0; // revise for HiDPI + + final BufferedImage iconImage = getAppIconImageCompositedOn(background, 1); + + if (background instanceof MultiResolutionIconImage) { + BufferedImage background2x + = ((MultiResolutionIconImage) background).resolutionVariant; + BufferedImage icon2xImage = getAppIconImageCompositedOn(background2x, 2); + + return new IconUIResource(new ImageIcon( + new MultiResolutionIconImage(iconImage, icon2xImage))); + } + return new IconUIResource(new ImageIcon(iconImage)); + } + + static BufferedImage getAppIconImageCompositedOn(final Image background, int scaleFactor) { - final int kAlertSubIconSize = (int)(kAlertIconSize * 0.5 * scaleFactor); - final int kAlertSubIconInset = (int)(kAlertIconSize * scaleFactor) - kAlertSubIconSize; - final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(kAlertSubIconSize, kAlertSubIconSize) { - Image createImage() { - return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize); - } - }; + final int scaledAlertIconSize = kAlertIconSize * scaleFactor; + final int kAlertSubIconSize = (int) (scaledAlertIconSize * 0.5); + final int kAlertSubIconInset = scaledAlertIconSize - kAlertSubIconSize; + final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon( + kAlertSubIconSize, kAlertSubIconSize) { + Image createImage() { + return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize); + } + }; - final BufferedImage image = new BufferedImage(kAlertIconSize, kAlertIconSize, BufferedImage.TYPE_INT_ARGB); + final BufferedImage image = new BufferedImage(scaledAlertIconSize, + scaledAlertIconSize, BufferedImage.TYPE_INT_ARGB); final Graphics g = image.getGraphics(); - g.drawImage(background, 0, 0, (int)(kAlertIconSize * scaleFactor), (int)(kAlertIconSize * scaleFactor), null); + g.drawImage(background, 0, 0, + scaledAlertIconSize, scaledAlertIconSize, null); if (g instanceof Graphics2D) { // improves icon rendering quality in Quartz - ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING, + RenderingHints.VALUE_RENDER_QUALITY); } - smallAppIconScaled.paintIcon(null, g, kAlertSubIconInset, kAlertSubIconInset); + smallAppIconScaled.paintIcon(null, g, + kAlertSubIconInset, kAlertSubIconInset); g.dispose(); - return new IconUIResource(new ImageIcon(image)); + return image; } public static IconUIResource getTreeFolderIcon() { @@ -207,7 +231,7 @@ @Override protected Image getInstance() { - return Toolkit.getDefaultToolkit().getImage("NSImage://" + namedImage); + return getNSIcon(namedImage); } } @@ -271,11 +295,27 @@ } public static Icon getMenuItemCheckIcon() { - return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuItemSelection"), 25)); + return new InvertableImageIcon(AquaUtils.generateLightenedImage( + getNSIcon("NSMenuItemSelection"), 25)); } public static Icon getMenuItemDashIcon() { - return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuMixedState"), 25)); + return new InvertableImageIcon(AquaUtils.generateLightenedImage( + getNSIcon("NSMenuMixedState"), 25)); + } + + private static Image getNSIcon(String imageName) { + Image icon = Toolkit.getDefaultToolkit() + .getImage("NSImage://" + imageName); + + if (icon instanceof MultiResolutionImage) { + return icon; + } + + Image icon2x = AquaUtils.getCImageCreator().createImageFromName( + imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null)); + return new MultiResolutionBufferedImage( + BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x); } public static class NineSliceMetrics { @@ -484,4 +524,29 @@ public static Color getSelectionInactiveForegroundColorUIResource() { return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR)); } + + static class MultiResolutionIconImage extends BufferedImage + implements MultiResolutionImage { + + BufferedImage resolutionVariant; + + public MultiResolutionIconImage(BufferedImage image, BufferedImage resolutionVariant) { + super(image.getWidth(), image.getHeight(), image.getType()); + this.resolutionVariant = resolutionVariant; + Graphics g = getGraphics(); + g.drawImage(image, 0, 0, null); + g.dispose(); + } + + @Override + public Image getResolutionVariant(int width, int height) { + return ((width <= getWidth() && height <= getHeight())) + ? this : resolutionVariant; + } + + @Override + public List<Image> getResolutionVariants() { + return Arrays.asList((Image) this, resolutionVariant); + } + } }
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/com/apple/laf/AquaUtils.java Fri Jul 14 00:56:29 2017 +0100 @@ -48,6 +48,7 @@ import sun.swing.SwingUtilities2; import com.apple.laf.AquaImageFactory.SlicedImageControl; +import sun.awt.image.MultiResolutionBufferedImage; final class AquaUtils { @@ -123,6 +124,17 @@ static Image generateLightenedImage(final Image image, final int percent) { final GrayFilter filter = new GrayFilter(true, percent); + return (image instanceof MultiResolutionBufferedImage) + ? ((MultiResolutionBufferedImage) image).map(new MultiResolutionBufferedImage.ImageMapper() { + @Override + public Image mapImage(Image rv) { + return generateLightenedImage(rv, filter); + } + }) + : generateLightenedImage(image, filter); + } + + static Image generateLightenedImage(Image image, ImageFilter filter) { final ImageProducer prod = new FilteredImageSource(image.getSource(), filter); return Toolkit.getDefaultToolkit().createImage(prod); } @@ -452,4 +464,3 @@ } } } -
--- a/src/macosx/classes/com/apple/laf/resources/aqua_de.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/com/apple/laf/resources/aqua_de.properties Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2017, 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 @@ -46,7 +46,7 @@ FileChooser.openButton.textAndMnemonic=\u00D6ffnen FileChooser.saveDialogTitle.textAndMnemonic=Speichern FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen -FileChooser.updateButton.textAndMnemonic=Updaten +FileChooser.updateButton.textAndMnemonic=Aktualisieren FileChooser.helpButton.textAndMnemonic=Hilfe FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen @@ -124,9 +124,9 @@ # The following string will be formatted by a MessageFormat # and {0} will be replaced by page number being printed -PrintingDialog.contentProgress.textAndMnemonic=Seite {0} wurde gedruckt ... +PrintingDialog.contentProgress.textAndMnemonic=Seite {0} wurde gedruckt... -PrintingDialog.contentAborting.textAndMnemonic=Druckvorgang wird abgebrochen ... +PrintingDialog.contentAborting.textAndMnemonic=Druckvorgang wird abgebrochen... PrintingDialog.abortButton.textAndMnemonic=&Abbruch PrintingDialog.abortButtonToolTip.textAndMnemonic=Druckvorgang abbrechen @@ -149,7 +149,7 @@ # Used for html forms FormView.submitButton.textAndMnemonic=Abfrage weiterleiten FormView.resetButton.textAndMnemonic=Zur\u00FCcksetzen -FormView.browseFileButton.textAndMnemonic=Durchsuchen ... +FormView.browseFileButton.textAndMnemonic=Durchsuchen... ############ Abstract Document Strings ############ AbstractDocument.styleChange.textAndMnemonic=Formatvorlagen\u00E4nderung @@ -169,7 +169,7 @@ ComboBox.togglePopup.textAndMnemonic=togglePopup ############ Progress Monitor Strings ############ -ProgressMonitor.progress.textAndMnemonic=Fortschritt ... +ProgressMonitor.progress.textAndMnemonic=Fortschritt... ############ Split Pane Strings ############ SplitPane.leftButton.textAndMnemonic=linke Schaltfl\u00E4che
--- a/src/macosx/classes/com/apple/laf/resources/aqua_sv.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/com/apple/laf/resources/aqua_sv.properties Fri Jul 14 00:56:29 2017 +0100 @@ -173,7 +173,7 @@ ############ Split Pane Strings ############ SplitPane.leftButton.textAndMnemonic=v\u00E4nsterknapp -SplitPane.rightButton.textAndMnemonic=h\u00F6ger knapp +SplitPane.rightButton.textAndMnemonic=h\u00F6gerknapp # Used for Isindex IsindexView.prompt=Detta \u00E4r ett s\u00F6kbart index. Ange s\u00F6kord:
--- a/src/macosx/classes/sun/awt/CGraphicsConfig.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/awt/CGraphicsConfig.java Fri Jul 14 00:56:29 2017 +0100 @@ -31,13 +31,16 @@ import sun.java2d.SurfaceData; import sun.java2d.opengl.CGLLayer; +import sun.lwawt.LWGraphicsConfig; import sun.lwawt.macosx.CPlatformView; -public class CGraphicsConfig extends GraphicsConfiguration { +public abstract class CGraphicsConfig extends GraphicsConfiguration + implements LWGraphicsConfig { + private final CGraphicsDevice device; private ColorModel colorModel; - public CGraphicsConfig(CGraphicsDevice device) { + protected CGraphicsConfig(CGraphicsDevice device) { this.device = device; } @@ -84,88 +87,20 @@ return new AffineTransform(xscale, 0.0, 0.0, yscale, 0.0, 0.0); } - - /** - * The following methods are invoked from CToolkit.java and - * LWWindowPeer.java rather than having the native - * implementations hardcoded in those classes. This way the appropriate - * actions are taken based on the peer's GraphicsConfig, whether it is - * an CGLGraphicsConfig or something else. - */ - /** * Creates a new SurfaceData that will be associated with the given * LWWindowPeer. */ - public SurfaceData createSurfaceData(CPlatformView pView) { - throw new UnsupportedOperationException("not implemented"); - } + public abstract SurfaceData createSurfaceData(CPlatformView pView); /** * Creates a new SurfaceData that will be associated with the given * CGLLayer. */ - public SurfaceData createSurfaceData(CGLLayer layer) { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * Creates a new hidden-acceleration image of the given width and height - * that is associated with the target Component. - */ - public Image createAcceleratedImage(Component target, - int width, int height) - { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * The following methods correspond to the multibuffering methods in - * LWWindowPeer.java... - */ - - /** - * Attempts to create a native backbuffer for the given peer. If - * the requested configuration is not natively supported, an AWTException - * is thrown. Otherwise, if the backbuffer creation is successful, a - * handle to the native backbuffer is returned. - */ - public long createBackBuffer(CPlatformView pView, - int numBuffers, BufferCapabilities caps) - throws AWTException - { - throw new UnsupportedOperationException("not implemented"); - } - - public void destroyBackBuffer(long backBuffer) - throws AWTException - { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * Creates a VolatileImage that essentially wraps the target Component's - * backbuffer, using the provided backbuffer handle. - */ - public VolatileImage createBackBufferImage(Component target, - long backBuffer) - { - throw new UnsupportedOperationException("not implemented"); - } - - /** - * Performs the native flip operation for the given target Component. - */ - public void flip(CPlatformView delegate, - Component target, VolatileImage xBackBuffer, - int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - throw new UnsupportedOperationException("not implemented"); - } + public abstract SurfaceData createSurfaceData(CGLLayer layer); @Override - public boolean isTranslucencyCapable() { + public final boolean isTranslucencyCapable() { //we know for sure we have capable config :) return true; }
--- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Fri Jul 14 00:56:29 2017 +0100 @@ -27,7 +27,6 @@ import java.awt.AWTException; import java.awt.BufferCapabilities; -import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; @@ -48,13 +47,10 @@ import sun.awt.CGraphicsConfig; import sun.awt.CGraphicsDevice; -import sun.awt.TextureSizeConstraining; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; -import sun.awt.image.SurfaceManager; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; -import sun.java2d.SunGraphics2D; import sun.java2d.Surface; import sun.java2d.SurfaceData; import sun.java2d.opengl.OGLContext.OGLContextCaps; @@ -63,18 +59,19 @@ import sun.java2d.pipe.hw.ContextCapabilities; import static sun.java2d.opengl.OGLSurfaceData.*; import static sun.java2d.opengl.OGLContext.OGLContextCaps.*; -import sun.java2d.opengl.CGLSurfaceData.CGLVSyncOffScreenSurfaceData; import sun.java2d.pipe.hw.AccelDeviceEventListener; import sun.java2d.pipe.hw.AccelDeviceEventNotifier; +import sun.lwawt.LWComponentPeer; import sun.lwawt.macosx.CPlatformView; -public class CGLGraphicsConfig extends CGraphicsConfig - implements OGLGraphicsConfig, TextureSizeConstraining +public final class CGLGraphicsConfig extends CGraphicsConfig + implements OGLGraphicsConfig { - //private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; + //private static final int kOpenGLSwapInterval = + // RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; private static final int kOpenGLSwapInterval = 0; // TODO - protected static boolean cglAvailable; + private static boolean cglAvailable; private static ImageCapabilities imageCaps = new CGLImageCaps(); private int pixfmt; @@ -82,7 +79,7 @@ private long pConfigInfo; private ContextCapabilities oglCaps; private OGLContext context; - private Object disposerReferent = new Object(); + private final Object disposerReferent = new Object(); private final int cachedMaxTextureSize; private static native boolean initCGL(); @@ -95,7 +92,7 @@ cglAvailable = initCGL(); } - protected CGLGraphicsConfig(CGraphicsDevice device, int pixfmt, + private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt, long configInfo, ContextCapabilities oglCaps) { super(device); @@ -176,11 +173,13 @@ * Returns true if the provided capability bit is present for this config. * See OGLContext.java for a list of supported capabilities. */ - public final boolean isCapPresent(int cap) { + @Override + public boolean isCapPresent(int cap) { return ((oglCaps.getCaps() & cap) != 0); } - public final long getNativeConfigInfo() { + @Override + public long getNativeConfigInfo() { return pConfigInfo; } @@ -189,7 +188,8 @@ * * @see sun.java2d.pipe.hw.BufferedContextProvider#getContext */ - public final OGLContext getContext() { + @Override + public OGLContext getContext() { return context; } @@ -263,145 +263,83 @@ return ("CGLGraphicsConfig[dev="+displayID+",pixfmt="+pixfmt+"]"); } - - /** - * The following methods are invoked from ComponentModel.java rather - * than having the Mac OS X-dependent implementations hardcoded in that - * class. This way the appropriate actions are taken based on the peer's - * GraphicsConfig, whether it is a CGraphicsConfig or a - * CGLGraphicsConfig. - */ - - /** - * Creates a new SurfaceData that will be associated with the given - * LWWindowPeer. - */ @Override public SurfaceData createSurfaceData(CPlatformView pView) { return CGLSurfaceData.createData(pView); } - /** - * Creates a new SurfaceData that will be associated with the given - * CGLLayer. - */ @Override public SurfaceData createSurfaceData(CGLLayer layer) { return CGLSurfaceData.createData(layer); } - /** - * Creates a new hidden-acceleration image of the given width and height - * that is associated with the target Component. - */ @Override public Image createAcceleratedImage(Component target, int width, int height) { ColorModel model = getColorModel(Transparency.OPAQUE); - WritableRaster wr = - model.createCompatibleWritableRaster(width, height); + WritableRaster wr = model.createCompatibleWritableRaster(width, height); return new OffScreenImage(target, model, wr, model.isAlphaPremultiplied()); } - /** - * The following methods correspond to the multibuffering methods in - * CWindowPeer.java... - */ - - /** - * Attempts to create a OGL-based backbuffer for the given peer. If - * the requested configuration is not natively supported, an AWTException - * is thrown. Otherwise, if the backbuffer creation is successful, a - * value of 1 is returned. - */ @Override - public long createBackBuffer(CPlatformView pView, - int numBuffers, BufferCapabilities caps) - throws AWTException - { - if (numBuffers > 2) { - throw new AWTException( - "Only double or single buffering is supported"); + public void assertOperationSupported(final int numBuffers, + final BufferCapabilities caps) + throws AWTException { + // Assume this method is never called with numBuffers != 2, as 0 is + // unsupported, and 1 corresponds to a SingleBufferStrategy which + // doesn't depend on the peer. Screen is considered as a separate + // "buffer". + if (numBuffers != 2) { + throw new AWTException("Only double buffering is supported"); } - BufferCapabilities configCaps = getBufferCapabilities(); + final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } - - // non-zero return value means backbuffer creation was successful - // (checked in CPlatformWindow.flip(), etc.) - return 1; } - /** - * Destroys the backbuffer object represented by the given handle value. - */ @Override - public void destroyBackBuffer(long backBuffer) { - } - - /** - * Creates a VolatileImage that essentially wraps the target Component's - * backbuffer (the provided backbuffer handle is essentially ignored). - */ - @Override - public VolatileImage createBackBufferImage(Component target, - long backBuffer) - { - return new SunVolatileImage(target, - target.getWidth(), target.getHeight(), - Boolean.TRUE); + public Image createBackBuffer(final LWComponentPeer<?, ?> peer) { + final Rectangle r = peer.getBounds(); + // It is possible for the component to have size 0x0, adjust it to + // be at least 1x1 to avoid IAE + final int w = Math.max(1, r.width); + final int h = Math.max(1, r.height); + final int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT + : Transparency.OPAQUE; + return new SunVolatileImage(this, w, h, transparency, null); } - /** - * Performs the native OGL flip operation for the given target Component. - */ @Override - public void flip(CPlatformView pView, - Component target, VolatileImage xBackBuffer, - int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - if (flipAction == BufferCapabilities.FlipContents.COPIED) { - SurfaceManager vsm = SurfaceManager.getManager(xBackBuffer); - SurfaceData sd = vsm.getPrimarySurfaceData(); + public void destroyBackBuffer(final Image backBuffer) { + if (backBuffer != null) { + backBuffer.flush(); + } + } - if (sd instanceof CGLVSyncOffScreenSurfaceData) { - CGLVSyncOffScreenSurfaceData vsd = - (CGLVSyncOffScreenSurfaceData)sd; - SurfaceData bbsd = vsd.getFlipSurface(); - Graphics2D bbg = - new SunGraphics2D(bbsd, Color.black, Color.white, null); - try { - bbg.drawImage(xBackBuffer, 0, 0, null); - } finally { - bbg.dispose(); - } - } else { - pView.drawImageOnPeer(xBackBuffer, x1, y1, x2, y2); - return; - } - } else if (flipAction == BufferCapabilities.FlipContents.PRIOR) { - // not supported by CGL... - return; + @Override + public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, + final int x1, final int y1, final int x2, final int y2, + final BufferCapabilities.FlipContents flipAction) { + final Graphics g = peer.getGraphics(); + try { + g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); + } finally { + g.dispose(); } - - OGLSurfaceData.swapBuffers(pView.getAWTView()); - if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { - Graphics g = xBackBuffer.getGraphics(); + final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { - g.setColor(target.getBackground()); - g.fillRect(0, 0, - xBackBuffer.getWidth(), - xBackBuffer.getHeight()); + bg.setBackground(peer.getBackground()); + bg.clearRect(0, 0, backBuffer.getWidth(null), + backBuffer.getHeight(null)); } finally { - g.dispose(); + bg.dispose(); } } } @@ -435,15 +373,10 @@ return imageCaps; } - /** - * {@inheritDoc} - * - * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage - */ - public VolatileImage - createCompatibleVolatileImage(int width, int height, - int transparency, int type) - { + @Override + public VolatileImage createCompatibleVolatileImage(int width, int height, + int transparency, + int type) { if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || transparency == Transparency.BITMASK) { @@ -479,15 +412,18 @@ * * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities */ + @Override public ContextCapabilities getContextCapabilities() { return oglCaps; } + @Override public void addDeviceEventListener(AccelDeviceEventListener l) { int displayID = getDevice().getCGDisplayID(); AccelDeviceEventNotifier.addListener(l, displayID); } + @Override public void removeDeviceEventListener(AccelDeviceEventListener l) { AccelDeviceEventNotifier.removeListener(l); }
--- a/src/macosx/classes/sun/java2d/opengl/CGLLayer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java Fri Jul 14 00:56:29 2017 +0100 @@ -108,7 +108,12 @@ OGLRenderQueue rq = OGLRenderQueue.getInstance(); rq.lock(); try { - validate(getPointer(), cglsd); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + validate(ptr, cglsd); + } + }); } finally { rq.unlock(); } @@ -124,7 +129,12 @@ private void setScale(final int _scale) { if (scale != _scale) { scale = _scale; - nativeSetScale(getPointer(), scale); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetScale(ptr, scale); + } + }); } } @@ -138,7 +148,12 @@ OGLRenderQueue rq = OGLRenderQueue.getInstance(); rq.lock(); try { - blitTexture(getPointer()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + blitTexture(ptr); + } + }); } finally { rq.unlock(); }
--- a/src/macosx/classes/sun/lwawt/LWButtonPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWButtonPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -33,6 +33,10 @@ import javax.swing.JButton; +/** + * Lightweight implementation of {@link ButtonPeer}. Delegates most of the work + * to the {@link JButton}. + */ final class LWButtonPeer extends LWComponentPeer<Button, JButton> implements ButtonPeer, ActionListener { @@ -42,7 +46,7 @@ } @Override - protected JButton createDelegate() { + JButton createDelegate() { return new JButtonDelegate(); } @@ -74,6 +78,7 @@ return true; } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class JButtonDelegate extends JButton { // Empty non private constructor was added because access to this
--- a/src/macosx/classes/sun/lwawt/LWCanvasPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWCanvasPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -26,94 +26,38 @@ package sun.lwawt; -import sun.awt.CGraphicsConfig; - -import java.awt.BufferCapabilities; -import java.awt.BufferCapabilities.FlipContents; -import java.awt.Canvas; import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.Dimension; import java.awt.GraphicsConfiguration; -import java.awt.Image; -import java.awt.image.VolatileImage; import java.awt.peer.CanvasPeer; import javax.swing.JComponent; -final class LWCanvasPeer extends LWComponentPeer<Component, JComponent> - implements CanvasPeer { +/** + * Lightweight implementation of {@link CanvasPeer}. This peer is empty, because + * all the components in lwawt use graphic object from the top level window. + */ +class LWCanvasPeer<T extends Component, D extends JComponent> + extends LWComponentPeer<T, D> implements CanvasPeer { - /** - * The back buffer provide user with a BufferStrategy. - */ - private VolatileImage backBuffer; - - LWCanvasPeer(final Canvas target, - final PlatformComponent platformComponent) { + LWCanvasPeer(final T target, final PlatformComponent platformComponent) { super(target, platformComponent); } @Override - public void createBuffers(final int numBuffers, - final BufferCapabilities caps) { - //TODO parameters should be used. - final CGraphicsConfig gc = (CGraphicsConfig) getGraphicsConfiguration(); - final VolatileImage buffer = gc.createBackBufferImage(getTarget(), 0); - synchronized (getStateLock()) { - backBuffer = buffer; - } - } - - @Override - public Image getBackBuffer() { - synchronized (getStateLock()) { - return backBuffer; - } + public final GraphicsConfiguration getAppropriateGraphicsConfiguration( + final GraphicsConfiguration gc) { + // TODO + return gc; } @Override - public void flip(final int x1, final int y1, final int x2, final int y2, - final FlipContents flipAction) { - final VolatileImage buffer = (VolatileImage) getBackBuffer(); - if (buffer == null) { - throw new IllegalStateException("Buffers have not been created"); - } - final Graphics g = getGraphics(); - try { - g.drawImage(buffer, x1, y1, x2, y2, x1, y1, x2, y2, null); - } finally { - g.dispose(); - } - if (flipAction == FlipContents.BACKGROUND) { - final Graphics2D bg = (Graphics2D) buffer.getGraphics(); - try { - bg.setBackground(getBackground()); - bg.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); - } finally { - bg.dispose(); - } - } + public final Dimension getPreferredSize() { + return getMinimumSize(); } @Override - public void destroyBuffers() { - final Image buffer = getBackBuffer(); - if (buffer != null) { - synchronized (getStateLock()) { - if (buffer == backBuffer) { - backBuffer = null; - } - } - buffer.flush(); - } - } - - @Override - public GraphicsConfiguration getAppropriateGraphicsConfiguration( - GraphicsConfiguration gc) - { - // TODO - return gc; + public final Dimension getMinimumSize() { + return getBounds().getSize(); } }
--- a/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -41,6 +41,11 @@ import javax.swing.JToggleButton; import javax.swing.SwingUtilities; +/** + * Lightweight implementation of {@link CheckboxPeer}. Delegates most of the + * work to the {@link JCheckBox} and {@link JRadioButton}, which are placed + * inside an empty {@link JComponent}. + */ final class LWCheckboxPeer extends LWComponentPeer<Checkbox, LWCheckboxPeer.CheckboxDelegate> implements CheckboxPeer, ItemListener { @@ -51,12 +56,12 @@ } @Override - protected CheckboxDelegate createDelegate() { + CheckboxDelegate createDelegate() { return new CheckboxDelegate(); } @Override - protected Component getDelegateFocusOwner() { + Component getDelegateFocusOwner() { return getDelegate().getCurrentButton(); } @@ -137,6 +142,7 @@ return true; } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. final class CheckboxDelegate extends JComponent { private final JCheckBox cb; @@ -186,6 +192,11 @@ } @Override + public Dimension getPreferredSize() { + return getCurrentButton().getPreferredSize(); + } + + @Override @Transient public Dimension getMinimumSize() { return getCurrentButton().getMinimumSize();
--- a/src/macosx/classes/sun/lwawt/LWChoicePeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWChoicePeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -34,6 +34,10 @@ import javax.accessibility.Accessible; import javax.swing.*; +/** + * Lightweight implementation of {@link ChoicePeer}. Delegates most of the work + * to the {@link JComboBox}. + */ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>> implements ChoicePeer, ItemListener { @@ -50,7 +54,7 @@ } @Override - protected JComboBox<String> createDelegate() { + JComboBox<String> createDelegate() { return new JComboBoxDelegate(); } @@ -128,6 +132,7 @@ return true; } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class JComboBoxDelegate extends JComboBox<String> { // Empty non private constructor was added because access to this
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -72,19 +72,23 @@ { private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer"); - // State lock is to be used for modifications to this - // peer's fields (e.g. bounds, background, font, etc.) - // It should be the last lock in the lock chain - private final Object stateLock = - new StringBuilder("LWComponentPeer.stateLock"); + /** + * State lock is to be used for modifications to this peer's fields (e.g. + * bounds, background, font, etc.) It should be the last lock in the lock + * chain + */ + private final Object stateLock = new Object(); - // The lock to operate with the peers hierarchy. AWT tree - // lock is not used as there are many peers related ops - // to be done on the toolkit thread, and we don't want to - // depend on a public lock on this thread - private static final Object peerTreeLock = - new StringBuilder("LWComponentPeer.peerTreeLock"); + /** + * The lock to operate with the peers hierarchy. AWT tree lock is not used + * as there are many peers related ops to be done on the toolkit thread, and + * we don't want to depend on a public lock on this thread + */ + private static final Object peerTreeLock = new Object(); + /** + * The associated AWT object. + */ private final T target; // Container peer. It may not be the peer of the target's direct @@ -93,7 +97,7 @@ // the container peer is not null, which might also be false if // addNotify() is called for a component outside of the hierarchy. // The exception is LWWindowPeers: their parents are always null - private LWContainerPeer containerPeer; + private LWContainerPeer<?, ?> containerPeer; // Handy reference to the top-level window peer. Window peer is // borrowed from the containerPeer in constructor, and should also @@ -123,7 +127,7 @@ // private volatile boolean paintPending; private volatile boolean isLayouting; - private D delegate = null; + private final D delegate; private Container delegateContainer; private Component delegateDropTarget; private final Object dropTargetLock = new Object(); @@ -133,11 +137,28 @@ private final PlatformComponent platformComponent; + /** + * Character with reasonable value between the minimum width and maximum. + */ + static final char WIDE_CHAR = '0'; + + /** + * The back buffer provide user with a BufferStrategy. + */ + private Image backBuffer; + + /** + * All Swing delegates use delegateContainer as a parent. This container + * intentionally do not use parent of the peer. + */ + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class DelegateContainer extends Container { { enableEvents(0xFFFFFFFF); } + // Empty non private constructor was added because access to this + // class shouldn't be emulated by a synthetic accessor method. DelegateContainer() { super(); } @@ -168,7 +189,7 @@ } } - public LWComponentPeer(T target, PlatformComponent platformComponent) { + LWComponentPeer(final T target, final PlatformComponent platformComponent) { targetPaintArea = new LWRepaintArea(); this.target = target; this.platformComponent = platformComponent; @@ -262,17 +283,18 @@ * This method is called under getDelegateLock(). * Overridden in subclasses. */ - protected D createDelegate() { + D createDelegate() { return null; } - protected final D getDelegate() { - synchronized (getStateLock()) { - return delegate; - } + final D getDelegate() { + return delegate; } - protected Component getDelegateFocusOwner() { + /** + * This method should be called under getDelegateLock(). + */ + Component getDelegateFocusOwner() { return getDelegate(); } @@ -293,6 +315,8 @@ * subclasses to initialize specific peers properties. */ void initializeImpl() { + // note that these methods can be overridden by the user and + // can return some strange values like null. setBackground(target.getBackground()); setForeground(target.getForeground()); setFont(target.getFont()); @@ -344,7 +368,7 @@ } // Just a helper method - protected final LWContainerPeer getContainerPeer() { + protected final LWContainerPeer<?, ?> getContainerPeer() { return containerPeer; } @@ -386,7 +410,8 @@ } protected void disposeImpl() { - LWContainerPeer cp = getContainerPeer(); + destroyBuffers(); + LWContainerPeer<?, ?> cp = getContainerPeer(); if (cp != null) { cp.removeChildPeer(this); } @@ -412,6 +437,12 @@ return getWindowPeer().getGraphicsConfiguration(); } + + // Just a helper method + public final LWGraphicsConfig getLWGC() { + return (LWGraphicsConfig) getGraphicsConfiguration(); + } + /* * Overridden in LWWindowPeer to replace its surface * data and back buffer. @@ -452,12 +483,13 @@ sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion()); } - public Region getVisibleRegion() { + Region getVisibleRegion() { return computeVisibleRect(this, getRegion()); } - static final Region computeVisibleRect(LWComponentPeer c, Region region) { - final LWContainerPeer p = c.getContainerPeer(); + static final Region computeVisibleRect(final LWComponentPeer<?, ?> c, + Region region) { + final LWContainerPeer<?, ?> p = c.getContainerPeer(); if (p != null) { final Rectangle r = c.getBounds(); region = region.getTranslatedRegion(r.x, r.y); @@ -476,31 +508,45 @@ return getGraphicsConfiguration().getColorModel(); } - @Override - public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException { - throw new AWTException("Back buffers are only supported for " + - "Window or Canvas components."); + public boolean isTranslucent() { + // Translucent windows of the top level are supported only + return false; } - /* - * To be overridden in LWWindowPeer and LWCanvasPeer. - */ @Override - public Image getBackBuffer() { - // Return null or throw AWTException? - return null; + public final void createBuffers(int numBuffers, BufferCapabilities caps) + throws AWTException { + getLWGC().assertOperationSupported(numBuffers, caps); + final Image buffer = getLWGC().createBackBuffer(this); + synchronized (getStateLock()) { + backBuffer = buffer; + } } @Override - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) { - // Skip silently or throw AWTException? + public final Image getBackBuffer() { + synchronized (getStateLock()) { + if (backBuffer != null) { + return backBuffer; + } + } + throw new IllegalStateException("Buffers have not been created"); } @Override - public void destroyBuffers() { - // Do nothing + public final void flip(int x1, int y1, int x2, int y2, + BufferCapabilities.FlipContents flipAction) { + getLWGC().flip(this, getBackBuffer(), x1, y1, x2, y2, flipAction); + } + + @Override + public final void destroyBuffers() { + final Image oldBB; + synchronized (getStateLock()) { + oldBB = backBuffer; + backBuffer = null; + } + getLWGC().destroyBackBuffer(oldBB); } // Helper method @@ -588,7 +634,7 @@ * @param p Point relative to the peer. * @return Cursor of the peer or null if default cursor should be used. */ - protected Cursor getCursor(final Point p) { + Cursor getCursor(final Point p) { return getTarget().getCursor(); } @@ -612,7 +658,7 @@ } } - protected final Color getBackground() { + public final Color getBackground() { synchronized (getStateLock()) { return background; } @@ -671,32 +717,29 @@ } @Override - public FontMetrics getFontMetrics(Font f) { + public FontMetrics getFontMetrics(final Font f) { // Borrow the metrics from the top-level window // return getWindowPeer().getFontMetrics(f); // Obtain the metrics from the offscreen window where this peer is // mostly drawn to. // TODO: check for "use platform metrics" settings - Graphics g = getWindowPeer().getGraphics(); - try { - if (g != null) { + final Graphics g = getOnscreenGraphics(); + if (g != null) { + try { return g.getFontMetrics(f); - } else { - synchronized (getDelegateLock()) { - return delegateContainer.getFontMetrics(f); - } - } - } finally { - if (g != null) { + } finally { g.dispose(); } } + synchronized (getDelegateLock()) { + return delegateContainer.getFontMetrics(f); + } } @Override public void setEnabled(final boolean e) { boolean status = e; - final LWComponentPeer cp = getContainerPeer(); + final LWComponentPeer<?, ?> cp = getContainerPeer(); if (cp != null) { status &= cp.isEnabled(); } @@ -781,12 +824,12 @@ } @Override - public void setZOrder(ComponentPeer above) { - LWContainerPeer cp = getContainerPeer(); + public void setZOrder(final ComponentPeer above) { + LWContainerPeer<?, ?> cp = getContainerPeer(); // Don't check containerPeer for null as it can only happen // for windows, but this method is overridden in // LWWindowPeer and doesn't call super() - cp.setChildPeerZOrder(this, (LWComponentPeer) above); + cp.setChildPeerZOrder(this, (LWComponentPeer<?, ?>) above); } @Override @@ -820,31 +863,46 @@ } /** - * Should be overridden in subclasses to forward the request - * to the Swing helper component, if required. + * Determines the preferred size of the component. By default forwards the + * request to the Swing helper component. Should be overridden in subclasses + * if required. */ @Override public Dimension getPreferredSize() { - // It looks like a default implementation for all toolkits - return getMinimumSize(); + final Dimension size; + synchronized (getDelegateLock()) { + size = getDelegate().getPreferredSize(); + } + return validateSize(size); } - /* - * Should be overridden in subclasses to forward the request - * to the Swing helper component. + /** + * Determines the minimum size of the component. By default forwards the + * request to the Swing helper component. Should be overridden in subclasses + * if required. */ @Override public Dimension getMinimumSize() { - D delegate = getDelegate(); + final Dimension size; + synchronized (getDelegateLock()) { + size = getDelegate().getMinimumSize(); + } + return validateSize(size); + } - if (delegate == null) { - // Is it a correct default value? - return getBounds().getSize(); - } else { - synchronized (getDelegateLock()) { - return delegate.getMinimumSize(); - } + /** + * In some situations delegates can return empty minimum/preferred size. + * (For example: empty JLabel, etc), but awt components never should be + * empty. In the XPeers or WPeers we use some magic constants, but here we + * try to use something more useful, + */ + private Dimension validateSize(final Dimension size) { + if (size.width == 0 || size.height == 0) { + final FontMetrics fm = getFontMetrics(getFont()); + size.width = fm.charWidth(WIDE_CHAR); + size.height = fm.getHeight(); } + return size; } @Override @@ -887,7 +945,9 @@ LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } - LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer(); + final LWWindowPeer parentPeer = + (LWWindowPeer) AWTAccessor.getComponentAccessor() + .getPeer(parentWindow); if (parentPeer == null) { focusLog.fine("request rejected, parentPeer is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); @@ -940,19 +1000,17 @@ } @Override - public Image createImage(ImageProducer producer) { + public final Image createImage(final ImageProducer producer) { return new ToolkitImage(producer); } @Override - public Image createImage(int w, int h) { - CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration(); - return gc.createAcceleratedImage(getTarget(), w, h); + public final Image createImage(final int width, final int height) { + return getLWGC().createAcceleratedImage(getTarget(), width, height); } @Override - public VolatileImage createVolatileImage(int w, int h) { - // TODO: is it a right/complete implementation? + public final VolatileImage createVolatileImage(final int w, final int h) { return new SunVolatileImage(getTarget(), w, h); } @@ -1063,8 +1121,6 @@ * of target.setLocation() or as a result of user actions (window is * dragged with mouse). * - * To be overridden in LWWindowPeer to update its GraphicsConfig. - * * This method could be called on the toolkit thread. */ protected final void handleMove(final int x, final int y, @@ -1080,13 +1136,19 @@ * Called when this peer's size has been changed either as a result of * target.setSize() or as a result of user actions (window is resized). * - * To be overridden in LWWindowPeer to update its SurfaceData and - * GraphicsConfig. - * * This method could be called on the toolkit thread. */ protected final void handleResize(final int w, final int h, final boolean updateTarget) { + Image oldBB = null; + synchronized (getStateLock()) { + if (backBuffer != null) { + oldBB = backBuffer; + backBuffer = getLWGC().createBackBuffer(this); + } + } + getLWGC().destroyBackBuffer(oldBB); + if (updateTarget) { AWTAccessor.getComponentAccessor().setSize(getTarget(), w, h); } @@ -1100,7 +1162,7 @@ } protected final void repaintParent(final Rectangle oldB) { - final LWContainerPeer cp = getContainerPeer(); + final LWContainerPeer<?, ?> cp = getContainerPeer(); if (cp != null) { // Repaint unobscured part of the parent cp.repaintPeer(cp.getContentSize().intersection(oldB)); @@ -1238,7 +1300,7 @@ /** * Handler for FocusEvents. */ - protected void handleJavaFocusEvent(FocusEvent e) { + void handleJavaFocusEvent(final FocusEvent e) { // Note that the peer receives all the FocusEvents from // its lightweight children as well KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); @@ -1274,7 +1336,7 @@ * Finds a top-most visible component for the given point. The location is * specified relative to the peer's parent. */ - public LWComponentPeer findPeerAt(final int x, final int y) { + LWComponentPeer<?, ?> findPeerAt(final int x, final int y) { final Rectangle r = getBounds(); final Region sh = getRegion(); final boolean found = isVisible() && sh.contains(x - r.x, y - r.y); @@ -1291,7 +1353,7 @@ } public Point windowToLocal(Point p, LWWindowPeer wp) { - LWComponentPeer cp = this; + LWComponentPeer<?, ?> cp = this; while (cp != wp) { Rectangle cpb = cp.getBounds(); p.x -= cpb.x; @@ -1312,7 +1374,7 @@ } public Point localToWindow(Point p) { - LWComponentPeer cp = getContainerPeer(); + LWComponentPeer<?, ?> cp = getContainerPeer(); Rectangle r = getBounds(); while (cp != null) { p.x += r.x; @@ -1333,7 +1395,7 @@ repaintPeer(getSize()); } - public void repaintPeer(final Rectangle r) { + void repaintPeer(final Rectangle r) { final Rectangle toPaint = getSize().intersection(r); if (!isShowing() || toPaint.isEmpty()) { return; @@ -1352,7 +1414,7 @@ protected final boolean isShowing() { synchronized (getPeerTreeLock()) { if (isVisible()) { - final LWContainerPeer container = getContainerPeer(); + final LWContainerPeer<?, ?> container = getContainerPeer(); return (container == null) || container.isShowing(); } } @@ -1360,8 +1422,7 @@ } /** - * Paints the peer. Overridden in subclasses to delegate the actual painting - * to Swing components. + * Paints the peer. Delegate the actual painting to Swing components. */ protected final void paintPeer(final Graphics g) { final D delegate = getDelegate();
--- a/src/macosx/classes/sun/lwawt/LWContainerPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWContainerPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -41,32 +41,25 @@ import javax.swing.JComponent; abstract class LWContainerPeer<T extends Container, D extends JComponent> - extends LWComponentPeer<T, D> - implements ContainerPeer -{ - // List of child peers sorted by z-order from bottom-most - // to top-most - private List<LWComponentPeer> childPeers = - new LinkedList<LWComponentPeer>(); + extends LWCanvasPeer<T, D> implements ContainerPeer { - LWContainerPeer(T target, PlatformComponent platformComponent) { + /** + * List of child peers sorted by z-order from bottom-most to top-most. + */ + private final List<LWComponentPeer<?, ?>> childPeers = new LinkedList<>(); + + LWContainerPeer(final T target, final PlatformComponent platformComponent) { super(target, platformComponent); } - void addChildPeer(LWComponentPeer child) { + final void addChildPeer(final LWComponentPeer<?, ?> child) { synchronized (getPeerTreeLock()) { - addChildPeer(child, childPeers.size()); + childPeers.add(childPeers.size(), child); + // TODO: repaint } } - void addChildPeer(LWComponentPeer child, int index) { - synchronized (getPeerTreeLock()) { - childPeers.add(index, child); - } - // TODO: repaint - } - - void removeChildPeer(LWComponentPeer child) { + final void removeChildPeer(final LWComponentPeer<?, ?> child) { synchronized (getPeerTreeLock()) { childPeers.remove(child); } @@ -74,7 +67,8 @@ } // Used by LWComponentPeer.setZOrder() - void setChildPeerZOrder(LWComponentPeer peer, LWComponentPeer above) { + final void setChildPeerZOrder(final LWComponentPeer<?, ?> peer, + final LWComponentPeer<?, ?> above) { synchronized (getPeerTreeLock()) { childPeers.remove(peer); int index = (above != null) ? childPeers.indexOf(above) : childPeers.size(); @@ -98,25 +92,27 @@ } @Override - public void beginValidate() { - // TODO: it seems that begin/endValidate() is only useful - // for heavyweight windows, when a batch movement for - // child windows occurs. That's why no-op - } - @Override - public void endValidate() { + public final void beginValidate() { // TODO: it seems that begin/endValidate() is only useful // for heavyweight windows, when a batch movement for // child windows occurs. That's why no-op } @Override - public void beginLayout() { + public final void endValidate() { + // TODO: it seems that begin/endValidate() is only useful + // for heavyweight windows, when a batch movement for + // child windows occurs. That's why no-op + } + + @Override + public final void beginLayout() { // Skip all painting till endLayout() setLayouting(true); } + @Override - public void endLayout() { + public final void endLayout() { setLayouting(false); // Post an empty event to flush all the pending target paints @@ -125,18 +121,19 @@ // ---- PEER NOTIFICATIONS ---- // - /* + /** * Returns a copy of the childPeer collection. */ - protected List<LWComponentPeer> getChildren() { + @SuppressWarnings("unchecked") + final List<LWComponentPeer<?, ?>> getChildren() { synchronized (getPeerTreeLock()) { - Object copy = ((LinkedList)childPeers).clone(); - return (List<LWComponentPeer>)copy; + Object copy = ((LinkedList<?>) childPeers).clone(); + return (List<LWComponentPeer<?, ?>>) copy; } } @Override - public final Region getVisibleRegion() { + final Region getVisibleRegion() { return cutChildren(super.getVisibleRegion(), null); } @@ -144,9 +141,9 @@ * Removes bounds of children above specific child from the region. If above * is null removes all bounds of children. */ - protected final Region cutChildren(Region r, final LWComponentPeer above) { + final Region cutChildren(Region r, final LWComponentPeer<?, ?> above) { boolean aboveFound = above == null; - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer<?, ?> child : getChildren()) { if (!aboveFound && child == above) { aboveFound = true; continue; @@ -170,8 +167,8 @@ * specified relative to the peer's parent. */ @Override - public final LWComponentPeer findPeerAt(int x, int y) { - LWComponentPeer peer = super.findPeerAt(x, y); + final LWComponentPeer<?, ?> findPeerAt(int x, int y) { + LWComponentPeer<?, ?> peer = super.findPeerAt(x, y); final Rectangle r = getBounds(); // Translate to this container's coordinates to pass to children x -= r.x; @@ -179,7 +176,7 @@ if (peer != null && getContentSize().contains(x, y)) { synchronized (getPeerTreeLock()) { for (int i = childPeers.size() - 1; i >= 0; --i) { - LWComponentPeer p = childPeers.get(i).findPeerAt(x, y); + LWComponentPeer<?, ?> p = childPeers.get(i).findPeerAt(x, y); if (p != null) { peer = p; break; @@ -195,7 +192,7 @@ * peers should be repainted */ @Override - public final void repaintPeer(final Rectangle r) { + final void repaintPeer(final Rectangle r) { final Rectangle toPaint = getSize().intersection(r); if (!isShowing() || toPaint.isEmpty()) { return; @@ -208,13 +205,13 @@ repaintChildren(toPaint); } - /* - * Paints all the child peers in the straight z-order, so the - * bottom-most ones are painted first. - */ + /** + * Paints all the child peers in the straight z-order, so the + * bottom-most ones are painted first. + */ private void repaintChildren(final Rectangle r) { final Rectangle content = getContentSize(); - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer<?, ?> child : getChildren()) { final Rectangle childBounds = child.getBounds(); Rectangle toPaint = r.intersection(childBounds); toPaint = toPaint.intersection(content); @@ -223,21 +220,21 @@ } } - protected Rectangle getContentSize() { + Rectangle getContentSize() { return getSize(); } @Override public void setEnabled(final boolean e) { super.setEnabled(e); - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer<?, ?> child : getChildren()) { child.setEnabled(e && child.getTarget().isEnabled()); } } @Override public void setBackground(final Color c) { - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer<?, ?> child : getChildren()) { if (!child.getTarget().isBackgroundSet()) { child.setBackground(c); } @@ -247,7 +244,7 @@ @Override public void setForeground(final Color c) { - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer<?, ?> child : getChildren()) { if (!child.getTarget().isForegroundSet()) { child.setForeground(c); } @@ -257,7 +254,7 @@ @Override public void setFont(final Font f) { - for (final LWComponentPeer child : getChildren()) { + for (final LWComponentPeer<?, ?> child : getChildren()) { if (!child.getTarget().isFontSet()) { child.setFont(f); }
--- a/src/macosx/classes/sun/lwawt/LWCursorManager.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWCursorManager.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicBoolean; +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; public abstract class LWCursorManager { @@ -109,7 +110,8 @@ cursorPos.y - p.y); } while (c != null) { - if (c.isVisible() && c.isEnabled() && (c.getPeer() != null)) { + final Object p = AWTAccessor.getComponentAccessor().getPeer(c); + if (c.isVisible() && c.isEnabled() && p != null) { break; } c = c.getParent();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/macosx/classes/sun/lwawt/LWGraphicsConfig.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.lwawt; + +import java.awt.AWTException; +import java.awt.BufferCapabilities; +import java.awt.Component; +import java.awt.Image; + +/** + * As lwawt can be used on different platforms with different graphic + * configurations, the general set of methods is necessary. This interface + * collects the methods that should be provided by GraphicsConfiguration, + * simplifying use by the LWAWT. + * + * @author Sergey Bylokhov + */ +public interface LWGraphicsConfig { + + /* + * A GraphicsConfiguration must implements following methods to indicate + * that it imposes certain limitations on the maximum size of supported + * textures. + */ + + /** + * Returns the maximum width of any texture image. By default return {@code + * Integer.MAX_VALUE}. + */ + int getMaxTextureWidth(); + + /** + * Returns the maximum height of any texture image. By default return {@code + * Integer.MAX_VALUE}. + */ + int getMaxTextureHeight(); + + /* + * The following methods correspond to the multi-buffering methods in + * LWComponentPeer.java. + */ + + /** + * Checks that the requested configuration is natively supported; if not, an + * AWTException is thrown. + */ + void assertOperationSupported(int numBuffers, BufferCapabilities caps) + throws AWTException; + + /** + * Creates a back buffer for the given peer and returns the image wrapper. + */ + Image createBackBuffer(LWComponentPeer<?, ?> peer); + + /** + * Destroys the back buffer object. + */ + void destroyBackBuffer(Image backBuffer); + + /** + * Performs the native flip operation for the given target Component. Our + * flip is implemented through normal drawImage() to the graphic object, + * because of our components uses a graphic object of the container(in this + * case we also apply necessary constrains) + */ + void flip(LWComponentPeer<?, ?> peer, Image backBuffer, int x1, int y1, + int x2, int y2, BufferCapabilities.FlipContents flipAction); + + /** + * Creates a new hidden-acceleration image of the given width and height + * that is associated with the target Component. + */ + Image createAcceleratedImage(Component target, int width, int height); +}
--- a/src/macosx/classes/sun/lwawt/LWLabelPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWLabelPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -26,8 +26,6 @@ package sun.lwawt; -import java.awt.Dimension; -import java.awt.FontMetrics; import java.awt.Label; import java.awt.peer.LabelPeer; @@ -41,18 +39,13 @@ final class LWLabelPeer extends LWComponentPeer<Label, JLabel> implements LabelPeer { - private static final int TEXT_XPAD = 5; - private static final int TEXT_YPAD = 1; - LWLabelPeer(final Label target, final PlatformComponent platformComponent) { super(target, platformComponent); } @Override - protected JLabel createDelegate() { - final JLabel label = new JLabel(); - label.setVerticalAlignment(SwingConstants.TOP); - return label; + JLabel createDelegate() { + return new JLabel(); } @Override @@ -76,24 +69,6 @@ } } - @Override - public Dimension getMinimumSize() { - int w = TEXT_XPAD; - int h = TEXT_YPAD; - final FontMetrics fm = getFontMetrics(getFont()); - if (fm != null) { - final String text; - synchronized (getDelegateLock()) { - text = getDelegate().getText(); - } - if (text != null) { - w += fm.stringWidth(text); - } - h += fm.getHeight(); - } - return new Dimension(w, h); - } - /** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment.
--- a/src/macosx/classes/sun/lwawt/LWListPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWListPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -32,10 +32,23 @@ import java.awt.peer.ListPeer; import java.util.Arrays; -final class LWListPeer - extends LWComponentPeer<List, LWListPeer.ScrollableJList> +/** + * Lightweight implementation of {@link ListPeer}. Delegates most of the work to + * the {@link JList}, which is placed inside {@link JScrollPane}. + */ +final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList> implements ListPeer { + /** + * The default number of visible rows. + */ + private static final int DEFAULT_VISIBLE_ROWS = 4; // From java.awt.List, + + /** + * This text is used for cell bounds calculation. + */ + private static final String TEXT = "0123456789abcde"; + LWListPeer(final List target, final PlatformComponent platformComponent) { super(target, platformComponent); if (!getTarget().isBackgroundSet()) { @@ -44,7 +57,7 @@ } @Override - protected ScrollableJList createDelegate() { + ScrollableJList createDelegate() { return new ScrollableJList(); } @@ -66,7 +79,7 @@ } @Override - protected Component getDelegateFocusOwner() { + Component getDelegateFocusOwner() { return getDelegate().getView(); } @@ -135,6 +148,16 @@ } @Override + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + @Override + public Dimension getMinimumSize() { + return getMinimumSize(DEFAULT_VISIBLE_ROWS); + } + + @Override public Dimension getPreferredSize(final int rows) { return getMinimumSize(rows); } @@ -142,16 +165,26 @@ @Override public Dimension getMinimumSize(final int rows) { synchronized (getDelegateLock()) { - final int margin = 2; - final int space = 1; + final Dimension size = getCellSize(); + size.height *= rows; + // Always take vertical scrollbar into account. + final JScrollBar vbar = getDelegate().getVerticalScrollBar(); + size.width += vbar != null ? vbar.getMinimumSize().width : 0; + // JScrollPane and JList insets + final Insets pi = getDelegate().getInsets(); + final Insets vi = getDelegate().getView().getInsets(); + size.width += pi.left + pi.right + vi.left + vi.right; + size.height += pi.top + pi.bottom + vi.top + vi.bottom; + return size; + } + } - // TODO: count ScrollPane's scrolling elements if any. - final FontMetrics fm = getFontMetrics(getFont()); - final int itemHeight = (fm.getHeight() - fm.getLeading()) + (2 * space); - - return new Dimension(20 + (fm == null ? 10 * 15 : fm.stringWidth("0123456789abcde")), - (fm == null ? 10 : itemHeight) * rows + (2 * margin)); - } + private Dimension getCellSize() { + final JList<String> jList = getDelegate().getView(); + final ListCellRenderer<? super String> cr = jList.getCellRenderer(); + final Component cell = cr.getListCellRendererComponent(jList, TEXT, 0, + false, false); + return cell.getPreferredSize(); } private void revalidate() { @@ -161,14 +194,15 @@ } } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. final class ScrollableJList extends JScrollPane implements ListSelectionListener { private boolean skipStateChangedEvent; - private DefaultListModel<Object> model = - new DefaultListModel<Object>() { + private final DefaultListModel<String> model = + new DefaultListModel<String>() { @Override - public void add(final int index, final Object element) { + public void add(final int index, final String element) { if (index == -1) { addElement(element); } else { @@ -181,7 +215,7 @@ ScrollableJList() { getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - final JList<Object> list = new JListDelegate(); + final JList<String> list = new JListDelegate(); list.addListSelectionListener(this); getViewport().setView(list); @@ -202,9 +236,10 @@ } @Override + @SuppressWarnings("unchecked") public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting() && !isSkipStateChangedEvent()) { - final JList source = (JList) e.getSource(); + final JList<?> source = (JList<?>) e.getSource(); for(int i = 0 ; i < source.getModel().getSize(); i++) { final boolean wasSelected = Arrays.binarySearch(oldSelectedIndices, i) >= 0; @@ -223,11 +258,12 @@ } } - public JList getView() { - return (JList) getViewport().getView(); + @SuppressWarnings("unchecked") + public JList<String> getView() { + return (JList<String>) getViewport().getView(); } - public DefaultListModel<Object> getModel() { + public DefaultListModel<String> getModel() { return model; } @@ -254,10 +290,10 @@ } } - private final class JListDelegate extends JList<Object> { + private final class JListDelegate extends JList<String> { JListDelegate() { - super(ScrollableJList.this.model); + super(model); } @Override @@ -272,7 +308,7 @@ final int index = locationToIndex(e.getPoint()); if (0 <= index && index < getModel().getSize()) { LWListPeer.this.postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED, - getModel().getElementAt(index).toString(), e.getWhen(), e.getModifiers())); + getModel().getElementAt(index), e.getWhen(), e.getModifiers())); } } } @@ -281,10 +317,10 @@ protected void processKeyEvent(final KeyEvent e) { super.processKeyEvent(e); if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ENTER) { - final Object selectedValue = getSelectedValue(); + final String selectedValue = getSelectedValue(); if(selectedValue != null){ LWListPeer.this.postEvent(new ActionEvent(getTarget(), ActionEvent.ACTION_PERFORMED, - selectedValue.toString(), e.getWhen(), e.getModifiers())); + selectedValue, e.getWhen(), e.getModifiers())); } } }
--- a/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -30,10 +30,9 @@ import java.awt.peer.MouseInfoPeer; -public class LWMouseInfoPeer implements MouseInfoPeer { +import sun.awt.AWTAccessor; - public LWMouseInfoPeer() { - } +public class LWMouseInfoPeer implements MouseInfoPeer { @Override public int fillPointWithCoords(Point point) { @@ -52,8 +51,12 @@ return false; } - LWWindowPeer windowPeer = (LWWindowPeer)w.getPeer(); - return LWWindowPeer.getWindowUnderCursor() == windowPeer; + LWWindowPeer windowPeer = (LWWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); + if (windowPeer == null) { + return false; + } + + return LWToolkit.getLWToolkit().getPlatformWindowUnderMouse() == windowPeer.getPlatformWindow(); } }
--- a/src/macosx/classes/sun/lwawt/LWPanelPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWPanelPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -26,12 +26,15 @@ package sun.lwawt; -import java.awt.Dimension; import java.awt.Panel; import java.awt.peer.PanelPeer; import javax.swing.JPanel; +/** + * Lightweight implementation of {@link PanelPeer}. Delegates most of the work + * to the {@link JPanel}. + */ final class LWPanelPeer extends LWContainerPeer<Panel, JPanel> implements PanelPeer { @@ -40,12 +43,7 @@ } @Override - public JPanel createDelegate() { + JPanel createDelegate() { return new JPanel(); } - - @Override - public Dimension getMinimumSize() { - return getBounds().getSize(); - } }
--- a/src/macosx/classes/sun/lwawt/LWRepaintArea.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWRepaintArea.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -26,39 +26,38 @@ package sun.lwawt; -import sun.awt.RepaintArea; - import java.awt.Component; import java.awt.Graphics; +import sun.awt.AWTAccessor; +import sun.awt.RepaintArea; + /** + * Emulates appearance of heavyweight components before call of the user code. + * * @author Sergey Bylokhov */ final class LWRepaintArea extends RepaintArea { @Override protected void updateComponent(final Component comp, final Graphics g) { + // We shouldn't paint native component as a result of UPDATE events, + // just flush onscreen back-buffer. if (comp != null) { super.updateComponent(comp, g); - flushBuffers((LWComponentPeer) comp.getPeer()); + LWComponentPeer.flushOnscreenGraphics(); } } @Override protected void paintComponent(final Component comp, final Graphics g) { if (comp != null) { - final LWComponentPeer peer = (LWComponentPeer) comp.getPeer(); + Object peer = AWTAccessor.getComponentAccessor().getPeer(comp); if (peer != null) { - peer.paintPeer(g); + ((LWComponentPeer<?, ?>) peer).paintPeer(g); } super.paintComponent(comp, g); - flushBuffers(peer); - } - } - - private static void flushBuffers(final LWComponentPeer peer) { - if (peer != null) { - peer.flushOnscreenGraphics(); + LWComponentPeer.flushOnscreenGraphics(); } } }
--- a/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -27,7 +27,6 @@ package sun.lwawt; import java.awt.Adjustable; -import java.awt.Dimension; import java.awt.Scrollbar; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; @@ -35,10 +34,14 @@ import javax.swing.JScrollBar; +/** + * Lightweight implementation of {@link ScrollbarPeer}. Delegates most of the + * work to the {@link JScrollBar}. + */ final class LWScrollBarPeer extends LWComponentPeer<Scrollbar, JScrollBar> implements ScrollbarPeer, AdjustmentListener { - //JScrollBar fires two changes with firePropertyChange (one for old value + // JScrollBar fires two changes with firePropertyChange (one for old value // and one for new one. // We save the last value and don't fire event if not changed. private int currentValue; @@ -49,7 +52,7 @@ } @Override - protected JScrollBar createDelegate() { + JScrollBar createDelegate() { return new JScrollBar(); } @@ -95,13 +98,6 @@ } } - @Override - public Dimension getPreferredSize() { - synchronized (getDelegateLock()) { - return getDelegate().getPreferredSize(); - } - } - // Peer also registered as a listener for ComponentDelegate component @Override public void adjustmentValueChanged(final AdjustmentEvent e) {
--- a/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -33,6 +33,10 @@ import java.awt.peer.ScrollPanePeer; import java.util.List; +/** + * Lightweight implementation of {@link ScrollPanePeer}. Delegates most of the + * work to the {@link JScrollPane}. + */ final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane> implements ScrollPanePeer, ChangeListener { @@ -41,7 +45,8 @@ super(target, platformComponent); } - protected JScrollPane createDelegate() { + @Override + JScrollPane createDelegate() { final JScrollPane sp = new JScrollPane(); final JPanel panel = new JPanel(); panel.setOpaque(false); @@ -72,7 +77,7 @@ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - final LWComponentPeer viewPeer = getViewPeer(); + final LWComponentPeer<?, ?> viewPeer = getViewPeer(); if (viewPeer != null) { final Rectangle r; synchronized (getDelegateLock()) { @@ -96,14 +101,13 @@ } } - LWComponentPeer getViewPeer() { - List<LWComponentPeer> peerList = getChildren(); + LWComponentPeer<?, ?> getViewPeer() { + final List<LWComponentPeer<?, ?>> peerList = getChildren(); return peerList.isEmpty() ? null : peerList.get(0); } - @Override - protected Rectangle getContentSize() { + Rectangle getContentSize() { Rectangle viewRect = getDelegate().getViewport().getViewRect(); return new Rectangle(viewRect.width, viewRect.height); } @@ -112,7 +116,7 @@ public void layout() { super.layout(); synchronized (getDelegateLock()) { - LWComponentPeer viewPeer = getViewPeer(); + final LWComponentPeer<?, ?> viewPeer = getViewPeer(); if (viewPeer != null) { Component view = getDelegate().getViewport().getView(); view.setBounds(viewPeer.getBounds());
--- a/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -29,6 +29,7 @@ import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Insets; import java.awt.Point; import java.awt.TextArea; import java.awt.event.TextEvent; @@ -41,11 +42,22 @@ import javax.swing.text.Document; import javax.swing.text.JTextComponent; +/** + * Lightweight implementation of {@link TextAreaPeer}. Delegates most of the + * work to the {@link JTextArea} inside {@link JScrollPane}. + */ final class LWTextAreaPeer extends LWTextComponentPeer<TextArea, LWTextAreaPeer.ScrollableJTextArea> implements TextAreaPeer { + /** + * The default number of visible columns. + */ private static final int DEFAULT_COLUMNS = 60; + + /** + * The default number of visible rows. + */ private static final int DEFAULT_ROWS = 10; LWTextAreaPeer(final TextArea target, @@ -54,7 +66,7 @@ } @Override - protected ScrollableJTextArea createDelegate() { + ScrollableJTextArea createDelegate() { return new ScrollableJTextArea(); } @@ -73,7 +85,7 @@ } @Override - protected Cursor getCursor(final Point p) { + Cursor getCursor(final Point p) { final boolean isContains; synchronized (getDelegateLock()) { isContains = getDelegate().getViewport().getBounds().contains(p); @@ -82,31 +94,46 @@ } @Override - protected Component getDelegateFocusOwner() { + Component getDelegateFocusOwner() { return getTextComponent(); } @Override + public Dimension getPreferredSize() { + return getMinimumSize(); + } + + @Override public Dimension getMinimumSize() { return getMinimumSize(DEFAULT_ROWS, DEFAULT_COLUMNS); } @Override - public Dimension getMinimumSize(final int rows, final int columns) { - return getPreferredSize(rows, columns); + public Dimension getPreferredSize(final int rows, final int columns) { + return getMinimumSize(rows, columns); } @Override - public Dimension getPreferredSize(final int rows, final int columns) { - final Dimension size = super.getPreferredSize(rows, columns); + public Dimension getMinimumSize(final int rows, final int columns) { + final Dimension size = super.getMinimumSize(rows, columns); synchronized (getDelegateLock()) { - final JScrollBar vbar = getDelegate().getVerticalScrollBar(); - final JScrollBar hbar = getDelegate().getHorizontalScrollBar(); - final int scrollbarW = vbar != null ? vbar.getWidth() : 0; - final int scrollbarH = hbar != null ? hbar.getHeight() : 0; - return new Dimension(size.width + scrollbarW, - size.height + scrollbarH); + // JScrollPane insets + final Insets pi = getDelegate().getInsets(); + size.width += pi.left + pi.right; + size.height += pi.top + pi.bottom; + // Take scrollbars into account. + final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy(); + if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) { + final JScrollBar vbar = getDelegate().getVerticalScrollBar(); + size.width += vbar != null ? vbar.getMinimumSize().width : 0; + } + final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy(); + if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) { + final JScrollBar hbar = getDelegate().getHorizontalScrollBar(); + size.height += hbar != null ? hbar.getMinimumSize().height : 0; + } } + return size; } @Override @@ -173,7 +200,7 @@ } } - @SuppressWarnings("serial") + @SuppressWarnings("serial")// Safe: outer class is non-serializable. final class ScrollableJTextArea extends JScrollPane { ScrollableJTextArea() { @@ -191,7 +218,6 @@ super.setEnabled(enabled); } - @SuppressWarnings("serial") private final class JTextAreaDelegate extends JTextArea { // Empty non private constructor was added because access to this
--- a/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -44,14 +44,14 @@ import javax.swing.text.Document; import javax.swing.text.JTextComponent; +/** + * Lightweight implementation of {@link TextComponentPeer}. Provides useful + * methods for {@link LWTextAreaPeer} and {@link LWTextFieldPeer} + */ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent> extends LWComponentPeer<T, D> implements DocumentListener, TextComponentPeer, InputMethodListener { - /** - * Character with reasonable value between the minimum width and maximum. - */ - protected static final char WIDE_CHAR = 'w'; private volatile boolean firstChangeSkipped; LWTextComponentPeer(final T target, @@ -95,18 +95,16 @@ */ abstract JTextComponent getTextComponent(); - public Dimension getPreferredSize(final int rows, final int columns) { + public Dimension getMinimumSize(final int rows, final int columns) { final Insets insets; synchronized (getDelegateLock()) { - insets = getDelegate().getInsets(); + insets = getTextComponent().getInsets(); } final int borderHeight = insets.top + insets.bottom; final int borderWidth = insets.left + insets.right; final FontMetrics fm = getFontMetrics(getFont()); - final int charWidth = (fm != null) ? fm.charWidth(WIDE_CHAR) : 10; - final int itemHeight = (fm != null) ? fm.getHeight() : 10; - return new Dimension(columns * charWidth + borderWidth, - rows * itemHeight + borderHeight); + return new Dimension(fm.charWidth(WIDE_CHAR) * columns + borderWidth, + fm.getHeight() * rows + borderHeight); } @Override @@ -187,6 +185,7 @@ } } + //TODO IN XAWT we just return true.. @Override public final boolean isFocusable() { return getTarget().isFocusable(); @@ -222,14 +221,14 @@ } @Override - public void inputMethodTextChanged(InputMethodEvent event) { + public void inputMethodTextChanged(final InputMethodEvent event) { synchronized (getDelegateLock()) { AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event); } } @Override - public void caretPositionChanged(InputMethodEvent event) { + public void caretPositionChanged(final InputMethodEvent event) { synchronized (getDelegateLock()) { AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event); }
--- a/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -37,19 +37,21 @@ import javax.swing.*; import javax.swing.text.JTextComponent; +/** + * Lightweight implementation of {@link TextFieldPeer}. Delegates most of the + * work to the {@link JPasswordField}. + */ final class LWTextFieldPeer extends LWTextComponentPeer<TextField, JPasswordField> implements TextFieldPeer, ActionListener { - private static final int DEFAULT_COLUMNS = 1; - LWTextFieldPeer(final TextField target, final PlatformComponent platformComponent) { super(target, platformComponent); } @Override - protected JPasswordField createDelegate() { + JPasswordField createDelegate() { return new JPasswordFieldDelegate(); } @@ -88,17 +90,12 @@ @Override public Dimension getPreferredSize(final int columns) { - return getPreferredSize(1, columns); + return getMinimumSize(columns); } @Override public Dimension getMinimumSize(final int columns) { - return getPreferredSize(columns); - } - - @Override - public Dimension getMinimumSize() { - return getMinimumSize(DEFAULT_COLUMNS); + return getMinimumSize(1, columns); } @Override @@ -114,7 +111,7 @@ * @param e the focus event */ @Override - protected void handleJavaFocusEvent(final FocusEvent e) { + void handleJavaFocusEvent(final FocusEvent e) { if (e.getID() == FocusEvent.FOCUS_LOST) { // In order to de-select the selection setCaretPosition(0); @@ -122,6 +119,7 @@ super.handleJavaFocusEvent(e); } + @SuppressWarnings("serial")// Safe: outer class is non-serializable. private final class JPasswordFieldDelegate extends JPasswordField { // Empty non private constructor was added because access to this
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWToolkit.java Fri Jul 14 00:56:29 2017 +0100 @@ -313,7 +313,7 @@ @Override public CanvasPeer createCanvas(Canvas target) { PlatformComponent platformComponent = createPlatformComponent(); - LWCanvasPeer peer = new LWCanvasPeer(target, platformComponent); + LWCanvasPeer<?, ?> peer = new LWCanvasPeer<>(target, platformComponent); targetCreatedPeer(target, peer); peer.initialize(); return peer; @@ -384,6 +384,8 @@ return peer; } + protected abstract PlatformWindow getPlatformWindowUnderMouse(); + @Override public TextFieldPeer createTextField(TextField target) { PlatformComponent platformComponent = createPlatformComponent(); @@ -528,16 +530,18 @@ } @Override - public void grab(Window w) { - if (w.getPeer() != null) { - ((LWWindowPeer)w.getPeer()).grab(); + public void grab(final Window w) { + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((LWWindowPeer) peer).grab(); } } @Override - public void ungrab(Window w) { - if (w.getPeer() != null) { - ((LWWindowPeer)w.getPeer()).ungrab(false); + public void ungrab(final Window w) { + final Object peer = AWTAccessor.getComponentAccessor().getPeer(w); + if (peer != null) { + ((LWWindowPeer) peer).ungrab(false); } } }
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -27,7 +27,6 @@ import java.awt.*; import java.awt.event.*; -import java.awt.image.BufferedImage; import java.awt.peer.*; import java.util.List; @@ -44,7 +43,7 @@ extends LWContainerPeer<Window, JComponent> implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener, PlatformEventNotifier { - public static enum PeerType { + public enum PeerType { SIMPLEWINDOW, FRAME, DIALOG, @@ -76,32 +75,21 @@ private SurfaceData surfaceData; private final Object surfaceDataLock = new Object(); - private int backBufferCount; - private BufferCapabilities backBufferCaps; - - // The back buffer is used for two purposes: - // 1. To render all the lightweight peers - // 2. To provide user with a BufferStrategy - // Need to check if a single back buffer can be used for both -// TODO: VolatileImage -// private VolatileImage backBuffer; - private volatile BufferedImage backBuffer; - private volatile int windowState = Frame.NORMAL; // check that the mouse is over the window private volatile boolean isMouseOver = false; // A peer where the last mouse event came to. Used by cursor manager to // find the component under cursor - private static volatile LWComponentPeer lastCommonMouseEventPeer = null; + private static volatile LWComponentPeer<?, ?> lastCommonMouseEventPeer; // A peer where the last mouse event came to. Used to generate // MOUSE_ENTERED/EXITED notifications - private volatile LWComponentPeer lastMouseEventPeer; + private volatile LWComponentPeer<?, ?> lastMouseEventPeer; // Peers where all dragged/released events should come to, // depending on what mouse button is being dragged according to Cocoa - private static LWComponentPeer mouseDownTarget[] = new LWComponentPeer[3]; + private static final LWComponentPeer<?, ?>[] mouseDownTarget = new LWComponentPeer<?, ?>[3]; // A bitmask that indicates what mouse buttons produce MOUSE_CLICKED events // on MOUSE_RELEASE. Click events are only generated if there were no drag @@ -139,7 +127,8 @@ this.peerType = peerType; Window owner = target.getOwner(); - LWWindowPeer ownerPeer = (owner != null) ? (LWWindowPeer)owner.getPeer() : null; + LWWindowPeer ownerPeer = owner == null ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); PlatformWindow ownerDelegate = (ownerPeer != null) ? ownerPeer.getPlatformWindow() : null; // The delegate.initialize() needs a non-null GC on X11. @@ -173,10 +162,10 @@ // Init warning window(for applets) SecurityWarningWindow warn = null; - if (((Window)target).getWarningString() != null) { + if (target.getWarningString() != null) { // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip // and TrayIcon balloon windows without a warning window. - if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) { + if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) { LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit(); warn = toolkit.createSecurityWarning(target, this); } @@ -218,6 +207,7 @@ } // Just a helper method + @Override public PlatformWindow getPlatformWindow() { return platformWindow; } @@ -250,7 +240,6 @@ if (warningWindow != null) { warningWindow.dispose(); } - destroyBuffers(); platformWindow.dispose(); super.disposeImpl(); } @@ -284,8 +273,10 @@ } @Override - public GraphicsConfiguration getGraphicsConfiguration() { - return graphicsConfig; + public final GraphicsConfiguration getGraphicsConfiguration() { + synchronized (getStateLock()) { + return graphicsConfig; + } } @Override @@ -311,66 +302,6 @@ } @Override - public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException - { - try { - // Assume this method is never called with numBuffers <= 1, as 0 is - // unsupported, and 1 corresponds to a SingleBufferStrategy which - // doesn't depend on the peer. Screen is considered as a separate - // "buffer", that's why numBuffers - 1 - assert numBuffers > 1; - - replaceSurfaceData(numBuffers - 1, caps, false); - } catch (InvalidPipeException z) { - throw new AWTException(z.toString()); - } - } - - @Override - public final Image getBackBuffer() { - synchronized (getStateLock()) { - return backBuffer; - } - } - - @Override - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction) - { - final BufferedImage buffer = (BufferedImage)getBackBuffer(); - if (buffer == null) { - throw new IllegalStateException("Buffers have not been created"); - } - final Graphics g = getGraphics(); - try { - g.drawImage(buffer, x1, y1, x2, y2, x1, y1, x2, y2, null); - } finally { - g.dispose(); - } - if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { - final Graphics2D bg = (Graphics2D) buffer.getGraphics(); - try { - bg.setBackground(getBackground()); - bg.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); - } finally { - bg.dispose(); - } - } - } - - @Override - public final void destroyBuffers() { - final Image oldBB = getBackBuffer(); - synchronized (getStateLock()) { - backBuffer = null; - } - if (oldBB != null) { - oldBB.flush(); - } - } - - @Override public void setBounds(int x, int y, int w, int h, int op) { if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) { @@ -408,16 +339,14 @@ h = MINIMUM_HEIGHT; } - if (graphicsConfig instanceof TextureSizeConstraining) { - final int maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth(); - final int maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight(); + final int maxW = getLWGC().getMaxTextureWidth(); + final int maxH = getLWGC().getMaxTextureHeight(); - if (w > maxW) { - w = maxW; - } - if (h > maxH) { - h = maxH; - } + if (w > maxW) { + w = maxW; + } + if (h > maxH) { + h = maxH; } return new Rectangle(x, y, w, h); @@ -495,21 +424,14 @@ min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT); } - final int maxW, maxH; - if (graphicsConfig instanceof TextureSizeConstraining) { - maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth(); - maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight(); - } else { - maxW = maxH = Integer.MAX_VALUE; - } - final Dimension max; if (getTarget().isMaximumSizeSet()) { max = getTarget().getMaximumSize(); - max.width = Math.min(max.width, maxW); - max.height = Math.min(max.height, maxH); + max.width = Math.min(max.width, getLWGC().getMaxTextureWidth()); + max.height = Math.min(max.height, getLWGC().getMaxTextureHeight()); } else { - max = new Dimension(maxW, maxH); + max = new Dimension(getLWGC().getMaxTextureWidth(), + getLWGC().getMaxTextureHeight()); } platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height); @@ -521,6 +443,12 @@ } @Override + public void setBackground(final Color c) { + super.setBackground(c); + updateOpaque(); + } + + @Override public void setOpacity(float opacity) { getPlatformWindow().setOpacity(opacity); repaintPeer(); @@ -631,7 +559,8 @@ public void blockWindows(List<Window> windows) { //TODO: LWX will probably need some collectJavaToplevels to speed this up for (Window w : windows) { - WindowPeer wp = (WindowPeer)w.getPeer(); + WindowPeer wp = + (WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w); if (wp != null) { wp.setModalBlocked((Dialog)getTarget(), true); } @@ -788,7 +717,7 @@ // TODO: fill "bdata" member of AWTEvent Rectangle r = getBounds(); // findPeerAt() expects parent coordinates - LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y); + LWComponentPeer<?, ?> targetPeer = findPeerAt(r.x + x, r.y + y); if (id == MouseEvent.MOUSE_EXITED) { isMouseOver = false; @@ -823,8 +752,7 @@ lastMouseEventPeer = targetPeer; } } else { - PlatformWindow topmostPlatformWindow = - platformWindow.getTopmostPlatformWindowUnderMouse(); + PlatformWindow topmostPlatformWindow = LWToolkit.getLWToolkit().getPlatformWindowUnderMouse(); LWWindowPeer topmostWindowPeer = topmostPlatformWindow != null ? topmostPlatformWindow.getPeer() : null; @@ -838,8 +766,7 @@ screenX, screenY, modifiers, clickCount, popupTrigger, targetPeer); } else { - LWComponentPeer topmostTargetPeer = - topmostWindowPeer != null ? topmostWindowPeer.findPeerAt(r.x + x, r.y + y) : null; + LWComponentPeer<?, ?> topmostTargetPeer = topmostWindowPeer.findPeerAt(r.x + x, r.y + y); topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y, screenX, screenY, modifiers, clickCount, popupTrigger, topmostTargetPeer); @@ -934,7 +861,7 @@ private void generateMouseEnterExitEventsForComponents(long when, int button, int x, int y, int screenX, int screenY, int modifiers, int clickCount, boolean popupTriger, - LWComponentPeer targetPeer) { + final LWComponentPeer<?, ?> targetPeer) { if (!isMouseOver || targetPeer == lastMouseEventPeer) { return; } @@ -978,7 +905,7 @@ // TODO: could we just use the last mouse event target here? Rectangle r = getBounds(); // findPeerAt() expects parent coordinates - final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y); + final LWComponentPeer<?, ?> targetPeer = findPeerAt(r.x + x, r.y + y); if (targetPeer == null || !targetPeer.isEnabled()) { return; } @@ -1132,21 +1059,10 @@ replaceSurfaceData(true); } - private void replaceSurfaceData(boolean blit) { - replaceSurfaceData(backBufferCount, backBufferCaps, blit); - } - - private void replaceSurfaceData(int newBackBufferCount, - BufferCapabilities newBackBufferCaps, - boolean blit) { + private void replaceSurfaceData(final boolean blit) { synchronized (surfaceDataLock) { final SurfaceData oldData = getSurfaceData(); surfaceData = platformWindow.replaceSurfaceData(); - // TODO: volatile image - // VolatileImage oldBB = backBuffer; - BufferedImage oldBB = backBuffer; - backBufferCount = newBackBufferCount; - backBufferCaps = newBackBufferCaps; final Rectangle size = getSize(); if (getSurfaceData() != null && oldData != getSurfaceData()) { clearBackground(size.width, size.height); @@ -1161,35 +1077,6 @@ // This can only happen when this peer is being created oldData.flush(); } - - // TODO: volatile image - // backBuffer = (VolatileImage)delegate.createBackBuffer(); - backBuffer = (BufferedImage) platformWindow.createBackBuffer(); - if (backBuffer != null) { - Graphics g = backBuffer.getGraphics(); - try { - Rectangle r = getBounds(); - if (g instanceof Graphics2D) { - ((Graphics2D) g).setComposite(AlphaComposite.Src); - } - g.setColor(nonOpaqueBackground); - g.fillRect(0, 0, r.width, r.height); - if (g instanceof SunGraphics2D) { - ((SunGraphics2D) g).constrain(0, 0, r.width, r.height, getRegion()); - } - if (!isTextured()) { - g.setColor(getBackground()); - g.fillRect(0, 0, r.width, r.height); - } - if (oldBB != null) { - // Draw the old back buffer to the new one - g.drawImage(oldBB, 0, 0, null); - oldBB.flush(); - } - } finally { - g.dispose(); - } - } } flushOnscreenGraphics(); } @@ -1212,14 +1099,6 @@ } } - public int getBackBufferCount() { - return backBufferCount; - } - - public BufferCapabilities getBackBufferCaps() { - return backBufferCaps; - } - /** * Request the window insets from the delegate and compares it with the * current one. This method is mostly called by the delegate, e.g. when the @@ -1279,8 +1158,9 @@ if (focusLog.isLoggable(PlatformLogger.Level.FINE)) { focusLog.fine("requesting native focus to the owner " + owner); } - LWWindowPeer currentActivePeer = (currentActive != null ? - (LWWindowPeer)currentActive.getPeer() : null); + LWWindowPeer currentActivePeer = currentActive == null ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer( + currentActive); // Ensure the opposite is natively active and suppress sending events. if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) { @@ -1403,7 +1283,8 @@ while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); } - return owner != null ? (LWWindowPeer)owner.getPeer() : null; + return owner == null ? null : + (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); } /** @@ -1422,11 +1303,13 @@ } } + @Override public void enterFullScreenMode() { platformWindow.enterFullScreenMode(); updateSecurityWarningVisibility(); } + @Override public void exitFullScreenMode() { platformWindow.exitFullScreenMode(); updateSecurityWarningVisibility();
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java Fri Jul 14 00:56:29 2017 +0100 @@ -97,17 +97,6 @@ */ public SurfaceData replaceSurfaceData(); - /* - * Creates a new image to serve as a back buffer. - */ - public Image createBackBuffer(); - - /* - * Move the given part of the back buffer to the front buffer. - */ - public void flip(int x1, int y1, int x2, int y2, - BufferCapabilities.FlipContents flipAction); - public void setModalBlocked(boolean blocked); public void toFront(); @@ -118,8 +107,6 @@ public void setAlwaysOnTop(boolean value); - public PlatformWindow getTopmostPlatformWindowUnderMouse(); - public void updateFocusableWindowState(); public boolean rejectFocusRequest(CausedFocusEvent.Cause cause);
--- a/src/macosx/classes/sun/lwawt/SelectionClearListener.java Thu Apr 27 03:09:54 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. 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.lwawt; - -/* - * Every time the TextField (or TextArea) change selection, every other text components - * must immediately clear their selections. - */ -interface SelectionClearListener { - void clearSelection(); -}
--- a/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java Fri Jul 14 00:56:29 2017 +0100 @@ -38,6 +38,8 @@ Image fImage; Point fHotspot; + int fWidth; + int fHeight; public CCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException { super(name); @@ -50,6 +52,7 @@ // Make sure image is fully loaded. final Component c = new Canvas(); // for its imageUpdate method final MediaTracker tracker = new MediaTracker(c); + // MediaTracker loads resolution variants from MultiResolution Toolkit image tracker.addImage(fImage, 0); try { tracker.waitForAll(); @@ -67,15 +70,15 @@ width = height = 1; fImage = createTransparentImage(width, height); } else { - // Scale image to nearest supported size + // Get the nearest supported cursor size final Dimension nativeSize = toolkit.getBestCursorSize(width, height); - if (nativeSize.width != width || nativeSize.height != height) { - fImage = fImage.getScaledInstance(nativeSize.width, nativeSize.height, Image.SCALE_DEFAULT); - width = nativeSize.width; - height = nativeSize.height; - } + width = nativeSize.width; + height = nativeSize.height; } + fWidth = width; + fHeight = height; + // NOTE: this was removed for 3169146, but in 1.5 the JCK tests for an exception and fails if one isn't thrown. // See what JBuilder does. // Verify that the hotspot is within cursor bounds. @@ -138,6 +141,7 @@ // failed to do its job. Return null to keep the cursor unchanged. return 0L; } else { + fCImage.resizeRepresentations(fWidth, fHeight); return fCImage.ptr; } } catch (IllegalArgumentException iae) {
--- a/src/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ package sun.lwawt.macosx; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + /** * Safely holds and disposes of native AppKit resources, using the * correct AppKit threading and Objective-C GC semantics. @@ -36,6 +40,10 @@ // TODO this pointer should be private and accessed via CFNativeAction class protected volatile long ptr; + private final ReadWriteLock lock = new ReentrantReadWriteLock(); + private final Lock writeLock = lock.writeLock(); + private final Lock readLock = lock.readLock(); + /** * @param ptr CFRetained native object pointer * @param disposeOnAppKitThread is the object needs to be CFReleased on the main thread @@ -50,21 +58,31 @@ * @param ptr CFRetained native object pointer */ protected void setPtr(final long ptr) { - synchronized (this) { - if (this.ptr != 0) dispose(); + writeLock.lock(); + try { + if (this.ptr != 0) { + dispose(); + } this.ptr = ptr; + } finally { + writeLock.unlock(); } } /** - * Manually CFReleases the native resource + * Manually CFReleases the native resource. */ protected void dispose() { long oldPtr = 0L; - synchronized (this) { - if (ptr == 0) return; + writeLock.lock(); + try { + if (ptr == 0) { + return; + } oldPtr = ptr; ptr = 0; + } finally { + writeLock.unlock(); } nativeCFRelease(oldPtr, disposeOnAppKitThread); // perform outside of the synchronized block @@ -109,9 +127,14 @@ * * @param action The native operation */ - public final synchronized void execute(final CFNativeAction action) { - if (ptr != 0) { - action.run(ptr); + public final void execute(final CFNativeAction action) { + readLock.lock(); + try { + if (ptr != 0) { + action.run(ptr); + } + } finally { + readLock.unlock(); } } @@ -127,9 +150,14 @@ * @return result of the native operation, usually the native pointer to * some other data */ - final synchronized long executeGet(final CFNativeActionGet action) { - if (ptr != 0) { - return action.run(ptr); + final long executeGet(final CFNativeActionGet action) { + readLock.lock(); + try { + if (ptr != 0) { + return action.run(ptr); + } + } finally { + readLock.unlock(); } return 0; }
--- a/src/macosx/classes/sun/lwawt/macosx/CImage.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CImage.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,17 +29,26 @@ import java.awt.geom.Dimension2D; import java.awt.image.*; +import java.util.Arrays; +import java.util.List; +import sun.awt.image.MultiResolutionImage; +import sun.awt.image.MultiResolutionBufferedImage; +import java.util.concurrent.atomic.AtomicReference; + import sun.awt.image.SunWritableRaster; public class CImage extends CFRetainedResource { private static native long nativeCreateNSImageFromArray(int[] buffer, int w, int h); + private static native long nativeCreateNSImageFromArrays(int[][] buffers, int w[], int h[]); private static native long nativeCreateNSImageFromFileContents(String file); private static native long nativeCreateNSImageOfFileFromLaunchServices(String file); private static native long nativeCreateNSImageFromImageName(String name); private static native long nativeCreateNSImageFromIconSelector(int selector); - private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int w, int h); + private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int sw, int sh, int dw, int dh); private static native Dimension2D nativeGetNSImageSize(long image); private static native void nativeSetNSImageSize(long image, double w, double h); + private static native void nativeResizeNSImageRepresentations(long image, double w, double h); + private static native Dimension2D[] nativeGetNSImageRepresentationSizes(long image, double w, double h); static Creator creator = new Creator(); static Creator getCreator() { @@ -141,6 +150,12 @@ // This is used to create a CImage from a Image public CImage createFromImage(final Image image) { + if (image instanceof MultiResolutionImage) { + List<Image> resolutionVariants + = ((MultiResolutionImage) image).getResolutionVariants(); + return createFromImages(resolutionVariants); + } + int[] buffer = imageToArray(image, true); if (buffer == null) { return null; @@ -148,6 +163,40 @@ return new CImage(nativeCreateNSImageFromArray(buffer, image.getWidth(null), image.getHeight(null))); } + public CImage createFromImages(List<Image> images) { + if (images == null || images.isEmpty()) { + return null; + } + + int num = images.size(); + + int[][] buffers = new int[num][]; + int[] w = new int[num]; + int[] h = new int[num]; + + num = 0; + + for (Image img : images) { + buffers[num] = imageToArray(img, true); + if (buffers[num] == null) { + // Unable to process the image + continue; + } + w[num] = img.getWidth(null); + h[num] = img.getHeight(null); + num++; + } + + if (num == 0) { + return null; + } + + return new CImage(nativeCreateNSImageFromArrays( + Arrays.copyOf(buffers, num), + Arrays.copyOf(w, num), + Arrays.copyOf(h, num))); + } + static int getSelectorAsInt(final String fromString) { final byte[] b = fromString.getBytes(); final int len = Math.min(b.length, 4); @@ -164,25 +213,86 @@ super(nsImagePtr, true); } - /** @return A BufferedImage created from nsImagePtr, or null. */ - public BufferedImage toImage() { - if (ptr == 0) return null; + /** @return A MultiResolution image created from nsImagePtr, or null. */ + private BufferedImage toImage() { + if (ptr == 0) { + return null; + } - final Dimension2D size = nativeGetNSImageSize(ptr); + final AtomicReference<Dimension2D> sizeRef = new AtomicReference<>(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + sizeRef.set(nativeGetNSImageSize(ptr)); + } + }); + final Dimension2D size = sizeRef.get(); + if (size == null) { + return null; + } final int w = (int)size.getWidth(); final int h = (int)size.getHeight(); + final AtomicReference<Dimension2D[]> repRef = new AtomicReference<>(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(), + size.getHeight())); + } + }); + Dimension2D[] sizes = repRef.get(); - final BufferedImage bimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE); + if (sizes == null || sizes.length < 2) { + return toImage(w, h, w, h); + } + + BufferedImage[] images = new BufferedImage[sizes.length]; + int currentImageIndex = 0; + + for (int i = 0; i < sizes.length; i++) { + int imageRepWidth = (int) sizes[i].getWidth(); + int imageRepHeight = (int) sizes[i].getHeight(); + + if(imageRepHeight <= w && imageRepHeight <= h){ + currentImageIndex = i; + } + images[i] = toImage(w, h, imageRepWidth, imageRepHeight); + } + return new MultiResolutionBufferedImage(BufferedImage.TYPE_INT_ARGB_PRE, + currentImageIndex, images); + } + + private BufferedImage toImage(final int srcWidth, final int srcHeight, final int dstWidth, final int dstHeight) { + final BufferedImage bimg = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB_PRE); final DataBufferInt dbi = (DataBufferInt)bimg.getRaster().getDataBuffer(); final int[] buffer = SunWritableRaster.stealData(dbi, 0); - nativeCopyNSImageIntoArray(ptr, buffer, w, h); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeCopyNSImageIntoArray(ptr, buffer, srcWidth, srcHeight, dstWidth, dstHeight); + } + }); SunWritableRaster.markDirty(dbi); return bimg; } /** If nsImagePtr != 0 then scale this NSImage. @return *this* */ CImage resize(final double w, final double h) { - if (ptr != 0) nativeSetNSImageSize(ptr, w, h); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSImageSize(ptr, w, h); + } + }); return this; } + + void resizeRepresentations(final double w, final double h) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeResizeNSImageRepresentations(ptr, w, h); + } + }); + } }
--- a/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java Fri Jul 14 00:56:29 2017 +0100 @@ -124,11 +124,20 @@ public final void setImage(final java.awt.Image img) { final CImage cimg = CImage.getCreator().createFromImage(img); execute(new CFNativeAction() { - @Override - public void run(long ptr) { - nativeSetImage(ptr, cimg == null ? 0L : cimg.ptr); + @Override + public void run(final long ptr) { + if (cimg == null) { + nativeSetImage(ptr, 0L); + } else { + cimg.execute(new CFNativeAction() { + @Override + public void run(long imgPtr) { + nativeSetImage(ptr, imgPtr); + } + }); } - }); + } + }); } /**
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformComponent.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformComponent.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,9 @@ super(0, true); } + /** + * Used by JAWT. + */ public long getPointer() { return ptr; } @@ -61,7 +64,12 @@ // translates values from the coordinate system of the top-level window // to the coordinate system of the content view final Insets insets = platformWindow.getPeer().getInsets(); - nativeSetBounds(getPointer(), x - insets.left, y - insets.top, w, h); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetBounds(ptr, x - insets.left, y - insets.top, w, h); + } + }); } @Override
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Fri Jul 14 00:56:29 2017 +0100 @@ -31,12 +31,9 @@ import sun.java2d.opengl.CGLLayer; import sun.java2d.SurfaceData; -import sun.awt.CGraphicsConfig; -import sun.awt.CGraphicsDevice; import sun.awt.CausedFocusEvent; import java.awt.*; -import java.awt.BufferCapabilities.FlipContents; import sun.util.logging.PlatformLogger; @@ -113,22 +110,6 @@ } @Override - public Image createBackBuffer() { - Rectangle r = peer.getBounds(); - Image im = null; - if (!r.isEmpty()) { - int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT : Transparency.OPAQUE; - im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); - } - return im; - } - - @Override - public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { - throw new RuntimeException("Not implemented"); - } - - @Override public void setVisible(boolean visible) {} @Override @@ -151,11 +132,6 @@ @Override public void setAlwaysOnTop(boolean value) {} - // This method should be properly implemented for applets. - // It returns null just as a stub. - @Override - public PlatformWindow getTopmostPlatformWindowUnderMouse() { return null; } - @Override public void updateFocusableWindowState() {}
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -28,7 +28,9 @@ import java.awt.*; import java.awt.event.*; import java.awt.geom.Rectangle2D; -import java.awt.image.VolatileImage; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import sun.awt.CGraphicsConfig; import sun.awt.CGraphicsEnvironment; @@ -80,8 +82,13 @@ * All coordinates passed to the method should be based on the origin being in the bottom-left corner (standard * Cocoa coordinates). */ - public void setBounds(int x, int y, int width, int height) { - CWrapper.NSView.setFrame(ptr, x, y, width, height); + public void setBounds(final int x, final int y, final int width, final int height) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSView.setFrame(ptr, x, y, width, height); + } + }); } // REMIND: CGLSurfaceData expects top-level's size @@ -93,33 +100,18 @@ return peer; } - public void setToolTip(String msg) { - CWrapper.NSView.setToolTip(ptr, msg); + public void setToolTip(final String msg) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSView.setToolTip(ptr, msg); + } + }); } // ---------------------------------------------------------------------- // PAINTING METHODS // ---------------------------------------------------------------------- - - public void drawImageOnPeer(VolatileImage xBackBuffer, int x1, int y1, int x2, int y2) { - Graphics g = peer.getGraphics(); - try { - g.drawImage(xBackBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); - } finally { - g.dispose(); - } - } - - public Image createBackBuffer() { - Rectangle r = getBounds(); - Image im = null; - if (!r.isEmpty()) { - int transparency = (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); - im = getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); - } - return im; - } - public SurfaceData replaceSurfaceData() { if (!LWCToolkit.getSunAwtDisableCALayers()) { surfaceData = windowLayer.replaceSurfaceData(); @@ -164,19 +156,37 @@ } } - public void setAutoResizable(boolean toResize) { - nativeSetAutoResizable(this.getAWTView(), toResize); + public void setAutoResizable(final boolean toResize) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetAutoResizable(ptr, toResize); + } + }); } public boolean isUnderMouse() { - return nativeIsViewUnderMouse(getAWTView()); + final AtomicBoolean ref = new AtomicBoolean(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(nativeIsViewUnderMouse(ptr)); + } + }); + return ref.get(); } public GraphicsDevice getGraphicsDevice() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); CGraphicsEnvironment cge = (CGraphicsEnvironment)ge; - int displayID = nativeGetNSViewDisplayID(getAWTView()); - GraphicsDevice gd = cge.getScreenDevice(displayID); + final AtomicInteger ref = new AtomicInteger(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(nativeGetNSViewDisplayID(ptr)); + } + }); + GraphicsDevice gd = cge.getScreenDevice(ref.get()); if (gd == null) { // this could possibly happen during device removal // use the default screen device in this case @@ -186,8 +196,18 @@ } public Point getLocationOnScreen() { - Rectangle r = nativeGetLocationOnScreen(this.getAWTView()).getBounds(); - return new Point(r.x, r.y); + final AtomicReference<Rectangle> ref = new AtomicReference<>(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(nativeGetLocationOnScreen(ptr).getBounds()); + } + }); + Rectangle r = ref.get(); + if (r != null) { + return new Point(r.x, r.y); + } + return new Point(0, 0); } // ----------------------------------------------------------------------
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Jul 14 00:56:29 2017 +0100 @@ -25,19 +25,25 @@ package sun.lwawt.macosx; -import java.awt.BufferCapabilities.FlipContents; import java.awt.*; import java.awt.Dialog.ModalityType; import java.awt.event.*; import java.awt.peer.WindowPeer; import java.beans.*; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; import java.util.List; import java.util.Objects; import javax.swing.*; import sun.awt.*; +import sun.awt.AWTAccessor.ComponentAccessor; +import sun.awt.AWTAccessor.WindowAccessor; import sun.java2d.SurfaceData; import sun.java2d.opengl.CGLSurfaceData; import sun.lwawt.*; @@ -63,9 +69,9 @@ private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled); private static native void nativeSynthesizeMouseEnteredExitedEvents(); private static native void nativeDispose(long nsWindowPtr); - private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse(); private static native void nativeEnterFullScreenMode(long nsWindowPtr); private static native void nativeExitFullScreenMode(long nsWindowPtr); + static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse(); // Loger to report issues happened during execution but that do not affect functionality private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow"); @@ -179,16 +185,31 @@ c.setStyleBits(FULLSCREENABLE, Boolean.parseBoolean(value.toString())); }}, new Property<CPlatformWindow>(WINDOW_SHADOW_REVALIDATE_NOW) { public void applyProperty(final CPlatformWindow c, final Object value) { - nativeRevalidateNSWindowShadow(c.getNSWindowPtr()); + c.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeRevalidateNSWindowShadow(ptr); + } + }); }}, new Property<CPlatformWindow>(WINDOW_DOCUMENT_FILE) { public void applyProperty(final CPlatformWindow c, final Object value) { if (value == null || !(value instanceof java.io.File)) { - nativeSetNSWindowRepresentedFilename(c.getNSWindowPtr(), null); + c.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowRepresentedFilename(ptr, null); + } + }); return; } final String filename = ((java.io.File)value).getAbsolutePath(); - nativeSetNSWindowRepresentedFilename(c.getNSWindowPtr(), filename); + c.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowRepresentedFilename(ptr, filename); + } + }); }} }) { public CPlatformWindow convertJComponentToTarget(final JRootPane p) { @@ -206,6 +227,8 @@ private volatile boolean isFullScreenMode; private boolean isFullScreenAnimationOn; + private volatile boolean isIconifyAnimationActive; + private Window target; private LWWindowPeer peer; protected CPlatformView contentView; @@ -237,11 +260,35 @@ contentView = createContentView(); contentView.initialize(peer, responder); - final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L; - Rectangle bounds = _peer.constrainBounds(_target.getBounds()); - final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), - ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height); - setPtr(nativeWindowPtr); + final Rectangle bounds; + if (!IS(DECORATED, styleBits)) { + // For undecorated frames the move/resize event does not come if the frame is centered on the screen + // so we need to set a stub location to force an initial move/resize. Real bounds would be set later. + bounds = new Rectangle(0, 0, 1, 1); + } else { + bounds = _peer.constrainBounds(_target.getBounds()); + } + final AtomicLong ref = new AtomicLong(); + contentView.execute(new CFNativeAction() { + @Override + public void run(final long viewPtr) { + if (owner != null) { + owner.execute(new CFNativeAction() { + @Override + public void run(long ownerPtr) { + ref.set(nativeCreateNSWindow(viewPtr, ownerPtr, styleBits, + bounds.x, bounds.y, + bounds.width, bounds.height)); + } + }); + } else { + ref.set(nativeCreateNSWindow(viewPtr, 0, + styleBits, bounds.x, bounds.y, + bounds.width, bounds.height)); + } + } + }); + setPtr(ref.get()); // TODO: implement on top of JObjC bridged class // NSWindow window = JObjC.getInstance().AppKit().NSWindow().getInstance(nativeWindowPtr, JObjCRuntime.getInstance()); @@ -398,53 +445,58 @@ // this is the counter-point to -[CWindow _nativeSetStyleBit:] protected void setStyleBits(final int mask, final boolean value) { - nativeSetNSWindowStyleBits(getNSWindowPtr(), mask, value ? mask : 0); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowStyleBits(ptr, mask, value ? mask : 0); + } + }); } private native void _toggleFullScreenMode(final long model); public void toggleFullScreen() { - _toggleFullScreenMode(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + _toggleFullScreenMode(ptr); + } + }); } @Override // PlatformWindow public void setMenuBar(MenuBar mb) { - final long nsWindowPtr = getNSWindowPtr(); - CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb); - if (mbPeer != null) { - mbPeer.execute(new CFNativeAction() { - @Override - public void run(long ptr) { - nativeSetNSWindowMenuBar(nsWindowPtr, ptr); - } - }); - } else { - nativeSetNSWindowMenuBar(nsWindowPtr, 0); - } - } - - @Override // PlatformWindow - public Image createBackBuffer() { - return contentView.createBackBuffer(); + final CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb); + execute(new CFNativeAction() { + @Override + public void run(final long nsWindowPtr) { + if (mbPeer != null) { + mbPeer.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowMenuBar(nsWindowPtr, ptr); + } + }); + } else { + nativeSetNSWindowMenuBar(nsWindowPtr, 0); + } + } + }); } @Override // PlatformWindow public void dispose() { - if (owner != null) { - CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr()); - } contentView.dispose(); - nativeDispose(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CPlatformWindow.nativeDispose(ptr); + } + }); CPlatformWindow.super.dispose(); } @Override // PlatformWindow - public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { - // TODO: not implemented - (new RuntimeException("unimplemented")).printStackTrace(); - } - - @Override // PlatformWindow public FontMetrics getFontMetrics(Font f) { // TODO: not implemented (new RuntimeException("unimplemented")).printStackTrace(); @@ -453,7 +505,14 @@ @Override // PlatformWindow public Insets getInsets() { - return nativeGetNSWindowInsets(getNSWindowPtr()); + final AtomicReference<Insets> ref = new AtomicReference<>(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(nativeGetNSWindowInsets(ptr)); + } + }); + return ref.get() != null ? ref.get() : new Insets(0, 0, 0, 0); } @Override // PlatformWindow @@ -478,9 +537,14 @@ } @Override // PlatformWindow - public void setBounds(int x, int y, int w, int h) { + public void setBounds(final int x, final int y, final int w, final int h) { // assert CThreading.assertEventQueue(); - nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowBounds(ptr, x, y, w, h); + } + }); } public boolean isVisible() { @@ -488,8 +552,17 @@ } private boolean isMaximized() { - return undecorated ? this.normalBounds != null - : CWrapper.NSWindow.isZoomed(getNSWindowPtr()); + if (undecorated) { + return this.normalBounds != null; + } + final AtomicBoolean ref = new AtomicBoolean(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(CWrapper.NSWindow.isZoomed(ptr)); + } + }); + return ref.get(); } private void maximize() { @@ -497,7 +570,12 @@ return; } if (!undecorated) { - CWrapper.NSWindow.zoom(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.zoom(ptr); + } + }); } else { deliverZoom(true); @@ -518,7 +596,12 @@ return; } if (!undecorated) { - CWrapper.NSWindow.zoom(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.zoom(ptr); + } + }); } else { deliverZoom(false); @@ -530,27 +613,6 @@ @Override // PlatformWindow public void setVisible(boolean visible) { - final long nsWindowPtr = getNSWindowPtr(); - - // Process parent-child relationship when hiding - if (!visible) { - // Unparent my children - for (Window w : target.getOwnedWindows()) { - WindowPeer p = (WindowPeer)w.getPeer(); - if (p instanceof LWWindowPeer) { - CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); - if (pw != null && pw.isVisible()) { - CWrapper.NSWindow.removeChildWindow(nsWindowPtr, pw.getNSWindowPtr()); - } - } - } - - // Unparent myself - if (owner != null && owner.isVisible()) { - CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), nsWindowPtr); - } - } - // Configure stuff updateIconImages(); updateFocusabilityForAutoRequestFocus(false); @@ -560,27 +622,64 @@ if (blocker == null || !visible) { // If it ain't blocked, or is being hidden, go regular way if (visible) { - CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView()); + contentView.execute(new CFNativeAction() { + @Override + public void run(final long viewPtr) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.makeFirstResponder(ptr, + viewPtr); + } + }); + } + }); - boolean isPopup = (target.getType() == Window.Type.POPUP); - if (isPopup) { - // Popups in applets don't activate applet's process - CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr); - } else { - CWrapper.NSWindow.orderFront(nsWindowPtr); - } + final boolean isPopup = (target.getType() == Window.Type.POPUP); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + if (isPopup) { + // Popups in applets don't activate applet's process + CWrapper.NSWindow.orderFrontRegardless(ptr); + } else { + CWrapper.NSWindow.orderFront(ptr); + } - boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr); - if (!isKeyWindow) { - CWrapper.NSWindow.makeKeyWindow(nsWindowPtr); - } + boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(ptr); + if (!isKeyWindow) { + CWrapper.NSWindow.makeKeyWindow(ptr); + } + } + }); } else { - CWrapper.NSWindow.orderOut(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + // immediately hide the window + CWrapper.NSWindow.orderOut(ptr); + // process the close + CWrapper.NSWindow.close(ptr); + } + }); } } else { // otherwise, put it in a proper z-order - CWrapper.NSWindow.orderWindow(nsWindowPtr, CWrapper.NSWindow.NSWindowBelow, - ((CPlatformWindow)blocker.getPlatformWindow()).getNSWindowPtr()); + CPlatformWindow bw + = (CPlatformWindow) blocker.getPlatformWindow(); + bw.execute(new CFNativeAction() { + @Override + public void run(final long blockerPtr) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderWindow(ptr, + CWrapper.NSWindow.NSWindowBelow, + blockerPtr); + } + }); + } + }); } this.visible = visible; @@ -595,7 +694,12 @@ } switch (frameState) { case Frame.ICONIFIED: - CWrapper.NSWindow.miniaturize(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.miniaturize(ptr); + } + }); break; case Frame.MAXIMIZED_BOTH: maximize(); @@ -614,24 +718,40 @@ // Manage parent-child relationship when showing if (visible) { - // Add myself as a child + // Order myself above my parent if (owner != null && owner.isVisible()) { - CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove); - if (target.isAlwaysOnTop()) { - CWrapper.NSWindow.setLevel(nsWindowPtr, CWrapper.NSWindow.NSFloatingWindowLevel); - } + owner.execute(new CFNativeAction() { + @Override + public void run(final long ownerPtr) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr); + } + }); + } + }); + applyWindowLevel(target); } - // Add my own children to myself + // Order my own children above myself for (Window w : target.getOwnedWindows()) { WindowPeer p = (WindowPeer)w.getPeer(); if (p instanceof LWWindowPeer) { CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); if (pw != null && pw.isVisible()) { - CWrapper.NSWindow.addChildWindow(nsWindowPtr, pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove); - if (w.isAlwaysOnTop()) { - CWrapper.NSWindow.setLevel(pw.getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel); - } + pw.execute(new CFNativeAction() { + @Override + public void run(final long childPtr) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderWindow(childPtr, CWrapper.NSWindow.NSWindowAbove, ptr); + } + }); + } + }); + pw.applyWindowLevel(w); } } } @@ -645,26 +765,34 @@ } @Override // PlatformWindow - public void setTitle(String title) { - nativeSetNSWindowTitle(getNSWindowPtr(), title); + public void setTitle(final String title) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowTitle(ptr, title); + } + }); } // Should be called on every window key property change. @Override // PlatformWindow public void updateIconImages() { - final long nsWindowPtr = getNSWindowPtr(); final CImage cImage = getImageForTarget(); - nativeSetNSWindowMinimizedIcon(nsWindowPtr, cImage == null ? 0L : cImage.ptr); - } - - public long getNSWindowPtr() { - final long nsWindowPtr = ptr; - if (nsWindowPtr == 0L) { - if(logger.isLoggable(PlatformLogger.Level.FINE)) { - logger.fine("NSWindow already disposed?", new Exception("Pointer to native NSWindow is invalid.")); + execute(new CFNativeAction() { + @Override + public void run(final long ptr) { + if (cImage == null) { + nativeSetNSWindowMinimizedIcon(ptr, 0L); + } else { + cImage.execute(new CFNativeAction() { + @Override + public void run(long imagePtr) { + nativeSetNSWindowMinimizedIcon(ptr, imagePtr); + } + }); + } } - } - return nsWindowPtr; + }); } public SurfaceData getSurfaceData() { @@ -673,13 +801,16 @@ @Override // PlatformWindow public void toBack() { - final long nsWindowPtr = getNSWindowPtr(); - nativePushNSWindowToBack(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CPlatformWindow.nativePushNSWindowToBack(ptr); + } + }); } @Override // PlatformWindow public void toFront() { - final long nsWindowPtr = getNSWindowPtr(); LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit(); Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if( w != null && w.getPeer() != null @@ -688,7 +819,12 @@ lwcToolkit.activateApplicationIgnoringOtherApps(); } updateFocusabilityForAutoRequestFocus(false); - nativePushNSWindowToFront(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CPlatformWindow.nativePushNSWindowToFront(ptr); + } + }); updateFocusabilityForAutoRequestFocus(true); } @@ -709,8 +845,13 @@ } @Override - public void setSizeConstraints(int minW, int minH, int maxW, int maxH) { - nativeSetNSWindowMinMax(getNSWindowPtr(), minW, minH, maxW, maxH); + public void setSizeConstraints(final int minW, final int minH, final int maxW, final int maxH) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetNSWindowMinMax(ptr, minW, minH, maxW, maxH); + } + }); } @Override @@ -727,19 +868,28 @@ @Override public boolean requestWindowFocus() { - - long ptr = getNSWindowPtr(); - if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) { - CWrapper.NSWindow.makeMainWindow(ptr); - } - CWrapper.NSWindow.makeKeyAndOrderFront(ptr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) { + CWrapper.NSWindow.makeMainWindow(ptr); + } + CWrapper.NSWindow.makeKeyAndOrderFront(ptr); + } + }); return true; } @Override public boolean isActive() { - long ptr = getNSWindowPtr(); - return CWrapper.NSWindow.isKeyWindow(ptr); + final AtomicBoolean ref = new AtomicBoolean(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(CWrapper.NSWindow.isKeyWindow(ptr)); + } + }); + return ref.get(); } @Override @@ -759,21 +909,45 @@ setStyleBits(ALWAYS_ON_TOP, isAlwaysOnTop); } - public PlatformWindow getTopmostPlatformWindowUnderMouse() { - return CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse(); - } @Override - public void setOpacity(float opacity) { - CWrapper.NSWindow.setAlphaValue(getNSWindowPtr(), opacity); + public void setOpacity(final float opacity) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.setAlphaValue(ptr, opacity); + } + }); } @Override - public void setOpaque(boolean isOpaque) { - CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque); - boolean isTextured = (peer == null)? false : peer.isTextured(); - if (!isOpaque && !isTextured) { - long clearColor = CWrapper.NSColor.clearColor(); - CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor); + public void setOpaque(final boolean isOpaque) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.setOpaque(ptr, isOpaque); + } + }); + boolean isTextured = (peer == null) ? false : peer.isTextured(); + if (!isTextured) { + if (!isOpaque) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.setBackgroundColor(ptr, 0); + } + }); + } else if (peer != null) { + Color color = peer.getBackground(); + if (color != null) { + final int rgb = color.getRGB(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.setBackgroundColor(ptr, rgb); + } + }); + } + } } //This is a temporary workaround. Looks like after 7124236 will be fixed @@ -789,12 +963,22 @@ @Override public void enterFullScreenMode() { isFullScreenMode = true; - nativeEnterFullScreenMode(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CPlatformWindow.nativeEnterFullScreenMode(ptr); + } + }); } @Override public void exitFullScreenMode() { - nativeExitFullScreenMode(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CPlatformWindow.nativeExitFullScreenMode(ptr); + } + }); isFullScreenMode = false; } @@ -813,7 +997,6 @@ int prevWindowState = peer.getState(); if (prevWindowState == windowState) return; - final long nsWindowPtr = getNSWindowPtr(); if ((windowState & Frame.ICONIFIED) != 0) { // Treat all state bit masks with ICONIFIED bit as ICONIFIED state. windowState = Frame.ICONIFIED; @@ -825,18 +1008,33 @@ // the zoom call toggles between the normal and the max states unmaximize(); } - CWrapper.NSWindow.miniaturize(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.miniaturize(ptr); + } + }); break; case Frame.MAXIMIZED_BOTH: if (prevWindowState == Frame.ICONIFIED) { // let's return into the normal states first - CWrapper.NSWindow.deminiaturize(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.deminiaturize(ptr); + } + }); } maximize(); break; case Frame.NORMAL: if (prevWindowState == Frame.ICONIFIED) { - CWrapper.NSWindow.deminiaturize(nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.deminiaturize(ptr); + } + }); } else if (prevWindowState == Frame.MAXIMIZED_BOTH) { // the zoom call toggles between the normal and the max states unmaximize(); @@ -853,17 +1051,27 @@ } @Override - public void setModalBlocked(boolean blocked) { + public void setModalBlocked(final boolean blocked) { if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { return; } - nativeSetEnabled(getNSWindowPtr(), !blocked); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetEnabled(ptr, !blocked); + } + }); } public final void invalidateShadow(){ - nativeRevalidateNSWindowShadow(getNSWindowPtr()); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeRevalidateNSWindowShadow(ptr); + } + }); } // ---------------------------------------------------------------------- @@ -881,19 +1089,7 @@ if (icons == null || icons.size() == 0) { return null; } - - // Choose the best (largest) image - Image image = icons.get(0); - // Assume images are square, so check their widths only - int width = image.getWidth(null); - for (Image img : icons) { - final int w = img.getWidth(null); - if (w > width) { - image = img; - width = w; - } - } - return CImage.getCreator().createFromImage(image); + return CImage.getCreator().createFromImages(icons); } /* @@ -991,6 +1187,9 @@ if (peer != null) { peer.notifyIconify(iconify); } + if (iconify) { + isIconifyAnimationActive = false; + } } private void deliverZoom(final boolean isZoomed) { @@ -1041,38 +1240,136 @@ pWindow.orderAboveSiblings(); - final long nsWindowPtr = pWindow.getNSWindowPtr(); - CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr); - CWrapper.NSWindow.makeKeyAndOrderFront(nsWindowPtr); - CWrapper.NSWindow.makeMainWindow(nsWindowPtr); + pWindow.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderFrontRegardless(ptr); + CWrapper.NSWindow.makeKeyAndOrderFront(ptr); + CWrapper.NSWindow.makeMainWindow(ptr); + } + }); + return true; + } - return true; + private boolean isIconified() { + boolean isIconified = false; + if (target instanceof Frame) { + int state = ((Frame)target).getExtendedState(); + if ((state & Frame.ICONIFIED) != 0) { + isIconified = true; + } + } + return isIconifyAnimationActive || isIconified; + } + + private boolean isOneOfOwnersOrSelf(CPlatformWindow window) { + while (window != null) { + if (this == window) { + return true; + } + window = window.owner; + } + return false; + } + + private CPlatformWindow getRootOwner() { + CPlatformWindow rootOwner = this; + while (rootOwner.owner != null) { + rootOwner = rootOwner.owner; + } + return rootOwner; } private void orderAboveSiblings() { - if (owner == null) { - return; + // Recursively pop up the windows from the very bottom, (i.e. root owner) so that + // the windows are ordered above their nearest owner; ancestors of the window, + // which is going to become 'main window', are placed above their siblings. + CPlatformWindow rootOwner = getRootOwner(); + if (rootOwner.isVisible() && !rootOwner.isIconified()) { + rootOwner.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderFront(ptr); + } + }); } + // Do not order child windows of iconified owner. + if (!rootOwner.isIconified()) { + final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); + orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target)); + } + } + + private void orderAboveSiblingsImpl(Window[] windows) { + ArrayList<Window> childWindows = new ArrayList<Window>(); + + final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor(); + final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); - // NOTE: the logic will fail if we have a hierarchy like: - // visible root owner - // invisible owner - // visible dialog - // However, this is an unlikely scenario for real life apps - if (owner.isVisible()) { - // Recursively pop up the windows from the very bottom so that only - // the very top-most one becomes the main window - owner.orderAboveSiblings(); + // Go through the list of windows and perform ordering. + for (Window w : windows) { + boolean iconified = false; + final Object p = componentAccessor.getPeer(w); + if (p instanceof LWWindowPeer) { + final CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); + iconified = isIconified(); + if (pw != null && pw.isVisible() && !iconified) { + // If the window is one of ancestors of 'main window' or is going to become main by itself, + // the window should be ordered above its siblings; otherwise the window is just ordered + // above its nearest parent. + if (pw.isOneOfOwnersOrSelf(this)) { + pw.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderFront(ptr); + } + }); + } else { + pw.owner.execute(new CFNativeAction() { + @Override + public void run(final long ownerPtr) { + pw.execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr); + } + }); + } + }); + } + pw.applyWindowLevel(w); + } + } + // Retrieve the child windows for each window from the list except iconified ones + // and store them for future use. + // Note: we collect data about child windows even for invisible owners, since they may have + // visible children. + if (!iconified) { + childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w))); + } + } + // If some windows, which have just been ordered, have any child windows, let's start new iteration + // and order these child windows. + if (!childWindows.isEmpty()) { + orderAboveSiblingsImpl(childWindows.toArray(new Window[0])); + } + } - // Order the window to front of the stack of child windows - final long nsWindowSelfPtr = getNSWindowPtr(); - final long nsWindowOwnerPtr = owner.getNSWindowPtr(); - CWrapper.NSWindow.removeChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr); - CWrapper.NSWindow.addChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove); - } - - if (target.isAlwaysOnTop()) { - CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel); + protected void applyWindowLevel(Window target) { + if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.setLevel(ptr, CWrapper.NSWindow.NSFloatingWindowLevel); + } + }); + } else if (target.getType() == Window.Type.POPUP) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.setLevel(ptr, CWrapper.NSWindow.NSPopUpMenuWindowLevel); + } + }); } } @@ -1080,6 +1377,10 @@ // NATIVE CALLBACKS // ---------------------------------------------------------------------- + private void windowWillMiniaturize() { + isIconifyAnimationActive = true; + } + private void windowDidBecomeMain() { assert CThreading.assertAppKit();
--- a/src/macosx/classes/sun/lwawt/macosx/CRobot.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CRobot.java Fri Jul 14 00:56:29 2017 +0100 @@ -78,7 +78,7 @@ @Override public void mousePress(int buttons) { mouseButtonsState |= buttons; - + checkMousePos(); mouseEvent(fDevice.getCGDisplayID(), mouseLastX, mouseLastY, buttons, true, false); } @@ -92,11 +92,40 @@ @Override public void mouseRelease(int buttons) { mouseButtonsState &= ~buttons; - + checkMousePos(); mouseEvent(fDevice.getCGDisplayID(), mouseLastX, mouseLastY, buttons, false, false); } + /** + * Set unknown mouse location, if needed. + */ + private void checkMousePos() { + if (mouseLastX == MOUSE_LOCATION_UNKNOWN || + mouseLastY == MOUSE_LOCATION_UNKNOWN) { + + Rectangle deviceBounds = fDevice.getDefaultConfiguration().getBounds(); + Point mousePos = CCursorManager.getInstance().getCursorPosition(); + + if (mousePos.x < deviceBounds.x) { + mousePos.x = deviceBounds.x; + } + else if (mousePos.x > deviceBounds.x + deviceBounds.width) { + mousePos.x = deviceBounds.x + deviceBounds.width; + } + + if (mousePos.y < deviceBounds.y) { + mousePos.y = deviceBounds.y; + } + else if (mousePos.y > deviceBounds.y + deviceBounds.height) { + mousePos.y = deviceBounds.y + deviceBounds.height; + } + + mouseLastX = mousePos.x; + mouseLastY = mousePos.y; + } + } + @Override public native void mouseWheel(int wheelAmt);
--- a/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java Fri Jul 14 00:56:29 2017 +0100 @@ -35,6 +35,7 @@ import java.awt.peer.TrayIconPeer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.concurrent.atomic.AtomicReference; public class CTrayIcon extends CFRetainedResource implements TrayIconPeer { private TrayIcon target; @@ -86,10 +87,6 @@ return nativeCreate(); } - private long getModel() { - return ptr; - } - private native long nativeCreate(); //invocation from the AWTTrayIcon.m @@ -142,8 +139,13 @@ } @Override - public void setToolTip(String tooltip) { - nativeSetToolTip(getModel(), tooltip); + public void setToolTip(final String tooltip) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + nativeSetToolTip(ptr, tooltip); + } + }); } //adds tooltip to the NSStatusBar's NSButton. @@ -172,7 +174,18 @@ } CImage cimage = CImage.getCreator().createFromImage(image); - setNativeImage(getModel(), cimage.ptr, target.isImageAutoSize()); + final boolean imageAutoSize = target.isImageAutoSize(); + cimage.execute(new CFNativeAction() { + @Override + public void run(final long imagePtr) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + setNativeImage(ptr, imagePtr, imageAutoSize); + } + }); + } + }); } private native void setNativeImage(final long model, final long nsimage, final boolean autosize); @@ -349,7 +362,17 @@ private void showMessageDialog() { Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); - Point2D iconLoc = nativeGetIconLocation(getModel()); + final AtomicReference<Point2D> ref = new AtomicReference<>(); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + ref.set(nativeGetIconLocation(ptr)); + } + }); + Point2D iconLoc = ref.get(); + if (iconLoc == null) { + return; + } int dialogY = (int)iconLoc.getY(); int dialogX = (int)iconLoc.getX();
--- a/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java Fri Jul 14 00:56:29 2017 +0100 @@ -78,13 +78,23 @@ @Override public void dispose() { - CWrapper.NSView.removeFromSuperview(view.getAWTView()); + view.execute(new CFRetainedResource.CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSView.removeFromSuperview(ptr); + } + }); view.dispose(); } @Override - public void setVisible(boolean visible) { - CWrapper.NSView.setHidden(view.getAWTView(), !visible); + public void setVisible(final boolean visible) { + view.execute(new CFRetainedResource.CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSView.setHidden(ptr, !visible); + } + }); } @Override @@ -148,11 +158,6 @@ } @Override - public PlatformWindow getTopmostPlatformWindowUnderMouse() { - return null; - } - - @Override public void updateFocusableWindowState() { } @@ -217,14 +222,4 @@ public boolean isUnderMouse() { return view.isUnderMouse(); } - - @Override - public Image createBackBuffer() { - return view.createBackBuffer(); - } - - @Override - public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) { - throw new RuntimeException("Not implemented"); - } }
--- a/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java Fri Jul 14 00:56:29 2017 +0100 @@ -119,7 +119,7 @@ setBounds((int)point.getX(), (int)point.getY(), getWidth(), getHeight()); } - public void setVisible(boolean visible, boolean doSchedule) { + public void setVisible(final boolean visible, boolean doSchedule) { synchronized (scheduler) { if (showingTaskHandle != null) { showingTaskHandle.cancel(false); @@ -217,40 +217,42 @@ } @Override - public void setVisible(boolean visible) { + public void setVisible(final boolean visible) { synchronized (lock) { - final long nsWindowPtr = getNSWindowPtr(); - - // Process parent-child relationship when hiding - if (!visible) { - // Unparent myself - if (owner != null && owner.isVisible()) { - CWrapper.NSWindow.removeChildWindow( - owner.getNSWindowPtr(), nsWindowPtr); + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + // Actually show or hide the window + if (visible) { + CWrapper.NSWindow.orderFront(ptr); + } else { + CWrapper.NSWindow.orderOut(ptr); + } } - } - - // Actually show or hide the window - if (visible) { - CWrapper.NSWindow.orderFront(nsWindowPtr); - } else { - CWrapper.NSWindow.orderOut(nsWindowPtr); - } + }); this.visible = visible; // Manage parent-child relationship when showing if (visible) { - // Add myself as a child + // Order myself above my parent if (owner != null && owner.isVisible()) { - CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), - nsWindowPtr, CWrapper.NSWindow.NSWindowAbove); + owner.execute(new CFNativeAction() { + @Override + public void run(final long ownerPtr) { + execute(new CFNativeAction() { + @Override + public void run(long ptr) { + CWrapper.NSWindow.orderWindow(ptr, + CWrapper.NSWindow.NSWindowAbove, + ownerPtr); + } + }); + } + }); // do not allow security warning to be obscured by other windows - if (ownerWindow.isAlwaysOnTop()) { - CWrapper.NSWindow.setLevel(nsWindowPtr, - CWrapper.NSWindow.NSFloatingWindowLevel); - } + applyWindowLevel(ownerWindow); } } }
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Fri Jul 14 00:56:29 2017 +0100 @@ -40,6 +40,7 @@ // The levels: (these are NOT real constants, these are keys. See native code.) static final int NSNormalWindowLevel = 0; static final int NSFloatingWindowLevel = 1; + static final int NSPopUpMenuWindowLevel = 2; // 'level' is one of the keys defined above static native void setLevel(long window, int level); @@ -53,14 +54,39 @@ static native void orderFront(long window); static native void orderFrontRegardless(long window); static native void orderWindow(long window, int ordered, long relativeTo); + + /** + * Removes the window from the screen. + * + * @param window the pointer of the NSWindow + */ static native void orderOut(long window); + /** + * Removes the window from the screen and releases it. According to + * documentation this method should be similar to {@link #orderOut}, + * because we use ReleasedWhenClosed:NO, so the window shouldn't be + * released. But the close method works differently, for example it + * close the space if the window was in the full screen via + * {@link CPlatformWindow#toggleFullScreen()}. + * + * @param window the pointer of the NSWindow + */ + static native void close(long window); + static native void addChildWindow(long parent, long child, int ordered); static native void removeChildWindow(long parent, long child); static native void setAlphaValue(long window, float alpha); static native void setOpaque(long window, boolean opaque); - static native void setBackgroundColor(long window, long color); + + /** + * Sets background color of the NSWindow. + * + * @param window the pointer of the NSWindow + * @param color the color in argb format + */ + static native void setBackgroundColor(long window, int color); static native void miniaturize(long window); static native void deminiaturize(long window); @@ -81,8 +107,4 @@ static native void setToolTip(long view, String msg); } - - static final class NSColor { - static native long clearColor(); - } }
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Fri Jul 14 00:56:29 2017 +0100 @@ -35,14 +35,17 @@ import java.awt.im.InputMethodHighlight; import java.awt.peer.*; import java.lang.reflect.*; +import java.net.URL; import java.security.*; import java.util.*; import java.util.concurrent.Callable; +import java.net.MalformedURLException; import sun.awt.*; import sun.lwawt.*; import sun.lwawt.LWWindowPeer.PeerType; import sun.security.action.GetBooleanAction; +import sun.awt.image.MultiResolutionImage; import sun.util.CoreResourceBundleControl; @@ -470,9 +473,30 @@ @Override public Image getImage(final String filename) { final Image nsImage = checkForNSImage(filename); - if (nsImage != null) return nsImage; + if (nsImage != null) { + return nsImage; + } + + if (imageCached(filename)) { + return super.getImage(filename); + } - return super.getImage(filename); + String fileneame2x = getScaledImageName(filename); + return (imageExists(fileneame2x)) + ? getImageWithResolutionVariant(filename, fileneame2x) + : super.getImage(filename); + } + + @Override + public Image getImage(URL url) { + + if (imageCached(url)) { + return super.getImage(url); + } + + URL url2x = getScaledImageURL(url); + return (imageExists(url2x)) + ? getImageWithResolutionVariant(url, url2x) : super.getImage(url); } static final String nsImagePrefix = "NSImage://"; @@ -763,8 +787,45 @@ return true; } + private static URL getScaledImageURL(URL url) { + try { + String scaledImagePath = getScaledImageName(url.getPath()); + return scaledImagePath == null ? null : new URL(url.getProtocol(), + url.getHost(), url.getPort(), scaledImagePath); + } catch (MalformedURLException e) { + return null; + } + } + + private static String getScaledImageName(String path) { + if (!isValidPath(path)) { + return null; + } + + int slash = path.lastIndexOf('/'); + String name = (slash < 0) ? path : path.substring(slash + 1); + + if (name.contains("@2x")) { + return null; + } + + int dot = name.lastIndexOf('.'); + String name2x = (dot < 0) ? name + "@2x" + : name.substring(0, dot) + "@2x" + name.substring(dot); + return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x; + } + + private static boolean isValidPath(String path) { + return !path.isEmpty() && !path.endsWith("/") && !path.endsWith("."); + } + @Override public boolean enableInputMethodsForTextComponent() { return true; } + + @Override + protected PlatformWindow getPlatformWindowUnderMouse() { + return CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse(); + } }
--- a/src/macosx/native/sun/awt/AWTSurfaceLayers.h Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/AWTSurfaceLayers.h Fri Jul 14 00:56:29 2017 +0100 @@ -41,6 +41,8 @@ CALayer *windowLayer; } +@property (retain) CALayer *windowLayer; + - (id) initWithWindowLayer: (CALayer *)windowLayer; - (void) setBounds: (CGRect)rect;
--- a/src/macosx/native/sun/awt/AWTSurfaceLayers.m Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/AWTSurfaceLayers.m Fri Jul 14 00:56:29 2017 +0100 @@ -37,11 +37,15 @@ self = [super init]; if (self == nil) return self; - windowLayer = aWindowLayer; + self.windowLayer = aWindowLayer; return self; } +- (void) dealloc { + self.windowLayer = nil; + [super dealloc]; +} - (CALayer *) layer { return layer;
--- a/src/macosx/native/sun/awt/AWTWindow.h Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/AWTWindow.h Fri Jul 14 00:56:29 2017 +0100 @@ -47,6 +47,7 @@ NSWindow *nsWindow; AWTWindow *ownerWindow; jint preFullScreenLevel; + BOOL isMinimizing; } // An instance of either AWTWindow_Normal or AWTWindow_Panel @@ -61,6 +62,7 @@ @property (nonatomic) jint styleBits; @property (nonatomic) BOOL isEnabled; @property (nonatomic) jint preFullScreenLevel; +@property (nonatomic) BOOL isMinimizing; - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow ownerWindow:owner
--- a/src/macosx/native/sun/awt/AWTWindow.m Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/AWTWindow.m Fri Jul 14 00:56:29 2017 +0100 @@ -143,6 +143,7 @@ @synthesize isEnabled; @synthesize ownerWindow; @synthesize preFullScreenLevel; +@synthesize isMinimizing; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -281,6 +282,7 @@ [self.nsWindow release]; // the property retains the object already self.isEnabled = YES; + self.isMinimizing = NO; self.javaPlatformWindow = platformWindow; self.styleBits = bits; self.ownerWindow = owner; @@ -319,10 +321,44 @@ return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]]; } +// Retrieves the list of possible window layers (levels) ++ (NSArray*) getWindowLayers { + static NSArray *windowLayers; + static dispatch_once_t token; + + // Initialize the list of possible window layers + dispatch_once(&token, ^{ + // The layers are ordered from front to back, (i.e. the toppest one is the first) + windowLayers = [NSArray arrayWithObjects: + [NSNumber numberWithInt:CGWindowLevelForKey(kCGPopUpMenuWindowLevelKey)], + [NSNumber numberWithInt:CGWindowLevelForKey(kCGFloatingWindowLevelKey)], + [NSNumber numberWithInt:CGWindowLevelForKey(kCGNormalWindowLevelKey)], + nil + ]; + [windowLayers retain]; + }); + return windowLayers; +} + + // return id for the topmost window under mouse + (NSInteger) getTopmostWindowUnderMouseID { NSInteger result = -1; - + + NSArray *windowLayers = [AWTWindow getWindowLayers]; + // Looking for the window under mouse starting from the toppest layer + for (NSNumber *layer in windowLayers) { + result = [AWTWindow getTopmostWindowUnderMouseIDImpl:[layer integerValue]]; + if (result != -1) { + break; + } + } + return result; +} + ++ (NSInteger) getTopmostWindowUnderMouseIDImpl:(NSInteger)windowLayer { + NSInteger result = -1; + NSRect screenRect = [[NSScreen mainScreen] frame]; NSPoint nsMouseLocation = [NSEvent mouseLocation]; CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y); @@ -332,7 +368,7 @@ for (NSDictionary *window in windows) { NSInteger layer = [[window objectForKey:(id)kCGWindowLayer] integerValue]; - if (layer == 0) { + if (layer == windowLayer) { CGRect rect; CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect); if (CGRectContainsPoint(rect, cgMouseLocation)) { @@ -423,6 +459,68 @@ [super dealloc]; } +// Tests wheather the corresponding Java paltform window is visible or not ++ (BOOL) isJavaPlatformWindowVisible:(NSWindow *)window { + BOOL isVisible = NO; + + if ([AWTWindow isAWTWindow:window] && [window delegate] != nil) { + AWTWindow *awtWindow = (AWTWindow *)[window delegate]; + [AWTToolkit eventCountPlusPlus]; + + JNIEnv *env = [ThreadUtilities getJNIEnv]; + jobject platformWindow = [awtWindow.javaPlatformWindow jObjectWithEnv:env]; + if (platformWindow != NULL) { + static JNF_MEMBER_CACHE(jm_isVisible, jc_CPlatformWindow, "isVisible", "()Z"); + isVisible = JNFCallBooleanMethod(env, platformWindow, jm_isVisible) == JNI_TRUE ? YES : NO; + (*env)->DeleteLocalRef(env, platformWindow); + + } + } + return isVisible; +} + +// Orders window's childs based on the current focus state +- (void) orderChildWindows:(BOOL)focus { +AWT_ASSERT_APPKIT_THREAD; + + if (self.isMinimizing) { + // Do not perform any ordering, if iconify is in progress + return; + } + + NSEnumerator *windowEnumerator = [[NSApp windows]objectEnumerator]; + NSWindow *window; + while ((window = [windowEnumerator nextObject]) != nil) { + if ([AWTWindow isJavaPlatformWindowVisible:window]) { + AWTWindow *awtWindow = (AWTWindow *)[window delegate]; + AWTWindow *owner = awtWindow.ownerWindow; + if (IS(awtWindow.styleBits, ALWAYS_ON_TOP)) { + // Do not order 'always on top' windows + continue; + } + while (awtWindow.ownerWindow != nil) { + if (awtWindow.ownerWindow == self) { + if (focus) { + // Move the childWindow to floating level + // so it will appear in front of its + // parent which owns the focus + [window setLevel:NSFloatingWindowLevel]; + } else { + // Focus owner has changed, move the childWindow + // back to normal window level + [window setLevel:NSNormalWindowLevel]; + } + // The childWindow should be displayed in front of + // its nearest parentWindow + [window orderWindow:NSWindowAbove relativeTo:[owner.nsWindow windowNumber]]; + break; + } + awtWindow = awtWindow.ownerWindow; + } + } + } +} + // NSWindow overrides - (BOOL) canBecomeKeyWindow { AWT_ASSERT_APPKIT_THREAD; @@ -572,6 +670,30 @@ return YES; } +// Hides/shows window's childs during iconify/de-iconify operation +- (void) iconifyChildWindows:(BOOL)iconify { +AWT_ASSERT_APPKIT_THREAD; + + NSEnumerator *windowEnumerator = [[NSApp windows]objectEnumerator]; + NSWindow *window; + while ((window = [windowEnumerator nextObject]) != nil) { + if ([AWTWindow isJavaPlatformWindowVisible:window]) { + AWTWindow *awtWindow = (AWTWindow *)[window delegate]; + while (awtWindow.ownerWindow != nil) { + if (awtWindow.ownerWindow == self) { + if (iconify) { + [window orderOut:window]; + } else { + [window orderFront:window]; + } + break; + } + awtWindow = awtWindow.ownerWindow; + } + } + } +} + - (void) _deliverIconify:(BOOL)iconify { AWT_ASSERT_APPKIT_THREAD; @@ -585,16 +707,36 @@ } } +- (void)windowWillMiniaturize:(NSNotification *)notification { +AWT_ASSERT_APPKIT_THREAD; + + self.isMinimizing = YES; + + JNIEnv *env = [ThreadUtilities getJNIEnv]; + jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; + if (platformWindow != NULL) { + static JNF_MEMBER_CACHE(jm_windowWillMiniaturize, jc_CPlatformWindow, "windowWillMiniaturize", "()V"); + JNFCallVoidMethod(env, platformWindow, jm_windowWillMiniaturize); + (*env)->DeleteLocalRef(env, platformWindow); + } + // Excplicitly make myself a key window to avoid possible + // negative visual effects during iconify operation + [self.nsWindow makeKeyAndOrderFront:self.nsWindow]; + [self iconifyChildWindows:YES]; +} + - (void)windowDidMiniaturize:(NSNotification *)notification { AWT_ASSERT_APPKIT_THREAD; [self _deliverIconify:JNI_TRUE]; + self.isMinimizing = NO; } - (void)windowDidDeminiaturize:(NSNotification *)notification { AWT_ASSERT_APPKIT_THREAD; [self _deliverIconify:JNI_FALSE]; + [self iconifyChildWindows:NO]; } - (void) _deliverWindowFocusEvent:(BOOL)focused oppositeWindow:(AWTWindow *)opposite { @@ -640,6 +782,7 @@ [AWTWindow setLastKeyWindow:nil]; [self _deliverWindowFocusEvent:YES oppositeWindow: opposite]; + [self orderChildWindows:YES]; } - (void) windowDidResignKey: (NSNotification *) notification { @@ -667,6 +810,7 @@ } [self _deliverWindowFocusEvent:NO oppositeWindow: opposite]; + [self orderChildWindows:NO]; } - (void) windowDidBecomeMain: (NSNotification *) notification { @@ -1195,15 +1339,16 @@ JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetTopmostPlatformWindowUnderMouse (JNIEnv *env, jclass clazz) { - jobject topmostWindowUnderMouse = nil; + __block jobject topmostWindowUnderMouse = nil; JNF_COCOA_ENTER(env); - AWT_ASSERT_APPKIT_THREAD; - AWTWindow *awtWindow = [AWTWindow getTopmostWindowUnderMouse]; - if (awtWindow != nil) { - topmostWindowUnderMouse = [awtWindow.javaPlatformWindow jObject]; - } + [ThreadUtilities performOnMainThreadWaiting:YES block:^{ + AWTWindow *awtWindow = [AWTWindow getTopmostWindowUnderMouse]; + if (awtWindow != nil) { + topmostWindowUnderMouse = [awtWindow.javaPlatformWindow jObject]; + } + }]; JNF_COCOA_EXIT(env);
--- a/src/macosx/native/sun/awt/CCursorManager.m Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/CCursorManager.m Fri Jul 14 00:56:29 2017 +0100 @@ -118,13 +118,11 @@ JNF_COCOA_ENTER(env); - __block NSPoint pt = NSZeroPoint; - - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]); - }]; - - jpt = NSToJavaPoint(env, pt); + CGEventRef event = CGEventCreate(NULL); + CGPoint globalPos = CGEventGetLocation(event); + CFRelease(event); + + jpt = NSToJavaPoint(env, globalPos); JNF_COCOA_EXIT(env);
--- a/src/macosx/native/sun/awt/CImage.m Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/CImage.m Fri Jul 14 00:56:29 2017 +0100 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +#import "jni_util.h" #import <Cocoa/Cocoa.h> #import <JavaNativeFoundation/JavaNativeFoundation.h> @@ -52,36 +53,29 @@ } static void CImage_CopyNSImageIntoArray -(NSImage *srcImage, jint *dstPixels, int width, int height) +(NSImage *srcImage, jint *dstPixels, NSRect fromRect, NSRect toRect) { + int width = toRect.size.width; + int height = toRect.size.height; CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); - CGContextRef cgRef = CGBitmapContextCreate(dstPixels, width, height, 8, width * 4, colorspace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); + CGContextRef cgRef = CGBitmapContextCreate(dstPixels, width, height, + 8, width * 4, colorspace, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); CGColorSpaceRelease(colorspace); NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithGraphicsPort:cgRef flipped:NO]; CGContextRelease(cgRef); NSGraphicsContext *oldContext = [[NSGraphicsContext currentContext] retain]; [NSGraphicsContext setCurrentContext:context]; - NSRect rect = NSMakeRect(0, 0, width, height); - [srcImage drawInRect:rect - fromRect:rect + [srcImage drawInRect:toRect + fromRect:fromRect operation:NSCompositeSourceOver fraction:1.0]; [NSGraphicsContext setCurrentContext:oldContext]; [oldContext release]; } -/* - * Class: sun_lwawt_macosx_CImage - * Method: nativeCreateNSImageFromArray - * Signature: ([III)J - */ -JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CImage_nativeCreateNSImageFromArray -(JNIEnv *env, jclass klass, jintArray buffer, jint width, jint height) +static NSBitmapImageRep* CImage_CreateImageRep(JNIEnv *env, jintArray buffer, jint width, jint height) { - jlong result = 0L; - -JNF_COCOA_ENTER(env); - NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:width pixelsHigh:height @@ -104,10 +98,70 @@ (*env)->ReleasePrimitiveArrayCritical(env, buffer, src, JNI_ABORT); - NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] retain]; - [nsImage addRepresentation:imageRep]; - [imageRep release]; - result = ptr_to_jlong(nsImage); + return imageRep; +} + +/* + * Class: sun_lwawt_macosx_CImage + * Method: nativeCreateNSImageFromArray + * Signature: ([III)J + */ +JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CImage_nativeCreateNSImageFromArray +(JNIEnv *env, jclass klass, jintArray buffer, jint width, jint height) +{ + jlong result = 0L; + +JNF_COCOA_ENTER(env); + + NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height); + if (imageRep) { + NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] retain]; + [nsImage addRepresentation:imageRep]; + [imageRep release]; + result = ptr_to_jlong(nsImage); + } + +JNF_COCOA_EXIT(env); + + return result; +} + +/* + * Class: sun_lwawt_macosx_CImage + * Method: nativeCreateNSImageFromArrays + * Signature: ([[I[I[I)J + */ +JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CImage_nativeCreateNSImageFromArrays +(JNIEnv *env, jclass klass, jobjectArray buffers, jintArray widths, jintArray heights) +{ + jlong result = 0L; + +JNF_COCOA_ENTER(env); + + jsize num = (*env)->GetArrayLength(env, buffers); + NSMutableArray * reps = [NSMutableArray arrayWithCapacity: num]; + + jint * ws = (*env)->GetIntArrayElements(env, widths, NULL); + jint * hs = (*env)->GetIntArrayElements(env, heights, NULL); + + jsize i; + for (i = 0; i < num; i++) { + jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i); + + NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]); + if (imageRep) { + [reps addObject: imageRep]; + } + } + + (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT); + (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT); + + if ([reps count]) { + NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(0, 0)] retain]; + [nsImage addRepresentations: reps]; + result = ptr_to_jlong(nsImage); + } JNF_COCOA_EXIT(env); @@ -202,17 +256,20 @@ /* * Class: sun_lwawt_macosx_CImage * Method: nativeCopyNSImageIntoArray - * Signature: (J[III)V + * Signature: (J[IIIII)V */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeCopyNSImageIntoArray -(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint w, jint h) +(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint sw, jint sh, + jint dw, jint dh) { JNF_COCOA_ENTER(env); NSImage *img = (NSImage *)jlong_to_ptr(nsImgPtr); jint *dst = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL); if (dst) { - CImage_CopyNSImageIntoArray(img, dst, w, h); + NSRect fromRect = NSMakeRect(0, 0, sw, sh); + NSRect toRect = NSMakeRect(0, 0, dw, dh); + CImage_CopyNSImageIntoArray(img, dst, fromRect, toRect); (*env)->ReleasePrimitiveArrayCritical(env, buffer, dst, JNI_ABORT); } @@ -256,3 +313,110 @@ JNF_COCOA_EXIT(env); } + +/* + * Class: sun_lwawt_macosx_CImage + * Method: nativeResizeNSImageRepresentations + * Signature: (JDD)V + */ +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeResizeNSImageRepresentations +(JNIEnv *env, jclass clazz, jlong image, jdouble w, jdouble h) +{ + if (!image) return; + NSImage *i = (NSImage *)jlong_to_ptr(image); + +JNF_COCOA_ENTER(env); + + NSImageRep *imageRep = nil; + NSArray *imageRepresentations = [i representations]; + NSEnumerator *imageEnumerator = [imageRepresentations objectEnumerator]; + while ((imageRep = [imageEnumerator nextObject]) != nil) { + [imageRep setSize:NSMakeSize(w, h)]; + } + +JNF_COCOA_EXIT(env); +} + +NSComparisonResult getOrder(BOOL order){ + return (NSComparisonResult) (order ? NSOrderedAscending : NSOrderedDescending); +} + +/* + * Class: sun_lwawt_macosx_CImage + * Method: nativeGetNSImageRepresentationsCount + * Signature: (JDD)[Ljava/awt/geom/Dimension2D; + */ +JNIEXPORT jobjectArray JNICALL + Java_sun_lwawt_macosx_CImage_nativeGetNSImageRepresentationSizes +(JNIEnv *env, jclass clazz, jlong image, jdouble w, jdouble h) +{ + if (!image) return NULL; + jobjectArray jreturnArray = NULL; + NSImage *img = (NSImage *)jlong_to_ptr(image); + +JNF_COCOA_ENTER(env); + + NSArray *imageRepresentations = [img representations]; + if([imageRepresentations count] == 0){ + return NULL; + } + + NSArray *sortedImageRepresentations = [imageRepresentations + sortedArrayUsingComparator: ^(id obj1, id obj2) { + + NSImageRep *imageRep1 = (NSImageRep *) obj1; + NSImageRep *imageRep2 = (NSImageRep *) obj2; + NSSize size1 = [imageRep1 size]; + NSSize size2 = [imageRep2 size]; + + if (NSEqualSizes(size1, size2)) { + return getOrder([imageRep1 pixelsWide] <= [imageRep2 pixelsWide] && + [imageRep1 pixelsHigh] <= [imageRep2 pixelsHigh]); + } + + return getOrder(size1.width <= size2.width && size1.height <= size2.height); + }]; + + NSMutableArray *sortedPixelSizes = [[NSMutableArray alloc] init]; + NSSize lastSize = [[sortedImageRepresentations lastObject] size]; + + NSUInteger i = [sortedImageRepresentations indexOfObjectPassingTest: + ^BOOL(id obj, NSUInteger idx, BOOL *stop) { + NSSize imageRepSize = [obj size]; + return (w <= imageRepSize.width && h <= imageRepSize.height) + || NSEqualSizes(imageRepSize, lastSize); + }]; + + NSUInteger count = [sortedImageRepresentations count]; + i = (i == NSNotFound) ? count - 1 : i; + NSSize bestFitSize = [[sortedImageRepresentations objectAtIndex: i] size]; + + for(; i < count; i++){ + NSImageRep *imageRep = [sortedImageRepresentations objectAtIndex: i]; + + if (!NSEqualSizes([imageRep size], bestFitSize)) { + break; + } + + NSSize pixelSize = NSMakeSize( + [imageRep pixelsWide], [imageRep pixelsHigh]); + [sortedPixelSizes addObject: [NSValue valueWithSize: pixelSize]]; + } + + count = [sortedPixelSizes count]; + static JNF_CLASS_CACHE(jc_Dimension, "java/awt/Dimension"); + jreturnArray = JNFNewObjectArray(env, &jc_Dimension, count); + CHECK_NULL_RETURN(jreturnArray, NULL); + + for(i = 0; i < count; i++){ + NSSize pixelSize = [[sortedPixelSizes objectAtIndex: i] sizeValue]; + + (*env)->SetObjectArrayElement(env, jreturnArray, i, + NSToJavaSize(env, pixelSize)); + JNU_CHECK_EXCEPTION_RETURN(env, NULL); + } + +JNF_COCOA_EXIT(env); + + return jreturnArray; +} \ No newline at end of file
--- a/src/macosx/native/sun/awt/CRobot.m Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/CRobot.m Fri Jul 14 00:56:29 2017 +0100 @@ -143,47 +143,10 @@ // This is the native method called when Robot mouse events occur. // The CRobot tracks the mouse position, and which button was - // pressed. If the mouse position is unknown it is obtained from - // CGEvents. The peer also tracks the mouse button desired state, + // pressed. The peer also tracks the mouse button desired state, // the appropriate key modifier state, and whether the mouse action // is simply a mouse move with no mouse button state changes. - CGError err = kCGErrorSuccess; - - CGRect globalDeviceBounds = CGDisplayBounds(displayID); - - // Set unknown mouse location, if needed. - if ((mouseLastX == sun_lwawt_macosx_CRobot_MOUSE_LOCATION_UNKNOWN) || - (mouseLastY == sun_lwawt_macosx_CRobot_MOUSE_LOCATION_UNKNOWN)) - { - CGEventRef event = CGEventCreate(NULL); - if (event == NULL) { - return; - } - - CGPoint globalPos = CGEventGetLocation(event); - CFRelease(event); - - // Normalize the coords within this display device, as - // per Robot rules. - if (globalPos.x < CGRectGetMinX(globalDeviceBounds)) { - globalPos.x = CGRectGetMinX(globalDeviceBounds); - } - else if (globalPos.x > CGRectGetMaxX(globalDeviceBounds)) { - globalPos.x = CGRectGetMaxX(globalDeviceBounds); - } - - if (globalPos.y < CGRectGetMinY(globalDeviceBounds)) { - globalPos.y = CGRectGetMinY(globalDeviceBounds); - } - else if (globalPos.y > CGRectGetMaxY(globalDeviceBounds)) { - globalPos.y = CGRectGetMaxY(globalDeviceBounds); - } - - mouseLastX = (jint)globalPos.x; - mouseLastY = (jint)globalPos.y; - } - // volatile, otherwise it warns that it might be clobbered by 'longjmp' volatile CGPoint point;
--- a/src/macosx/native/sun/awt/CWrapper.m Thu Apr 27 03:09:54 2017 +0100 +++ b/src/macosx/native/sun/awt/CWrapper.m Fri Jul 14 00:56:29 2017 +0100 @@ -175,6 +175,23 @@ /* * Class: sun_lwawt_macosx_CWrapper$NSWindow + * Method: close + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_sun_lwawt_macosx_CWrapper_00024NSWindow_close + (JNIEnv *env, jclass cls, jlong windowPtr) +{ +JNF_COCOA_ENTER(env); + NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ + [window close]; + }]; +JNF_COCOA_EXIT(env); +} + +/* + * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: orderFrontRegardless * Signature: (J)V */ @@ -222,6 +239,7 @@ dispatch_once(&pred, ^{ LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSNormalWindowLevel] = NSNormalWindowLevel; LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSFloatingWindowLevel] = NSFloatingWindowLevel; + LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSPopUpMenuWindowLevel] = NSPopUpMenuWindowLevel; }); } @@ -336,12 +354,17 @@ */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor -(JNIEnv *env, jclass cls, jlong windowPtr, jlong colorPtr) +(JNIEnv *env, jclass cls, jlong windowPtr, jint rgb) { JNF_COCOA_ENTER(env); NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); - NSColor *color = (NSColor *)jlong_to_ptr(colorPtr); + CGFloat alpha = (((rgb >> 24) & 0xff) / 255.0); + CGFloat red = (((rgb >> 16) & 0xff) / 255.0); + CGFloat green = (((rgb >> 8) & 0xff) / 255.0); + CGFloat blue = (((rgb >> 0) & 0xff) / 255.0); + NSColor *color = [NSColor colorWithCalibratedRed:red green:green blue:blue + alpha:alpha]; [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ [window setBackgroundColor:color]; }]; @@ -574,26 +597,3 @@ JNF_COCOA_EXIT(env); } - -/* - * Class: sun_lwawt_macosx_CWrapper$NSColor - * Method: clearColor - * Signature: ()J - */ -JNIEXPORT jlong JNICALL -Java_sun_lwawt_macosx_CWrapper_00024NSColor_clearColor -(JNIEnv *env, jclass cls) -{ - __block jlong clearColorPtr = 0L; - -JNF_COCOA_ENTER(env); - - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - clearColorPtr = ptr_to_jlong([NSColor clearColor]); - }]; - -JNF_COCOA_EXIT(env); - - return clearColorPtr; -} -
--- a/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties Fri Jul 14 00:56:29 2017 +0100 @@ -38,7 +38,7 @@ FileChooser.viewMenuButtonToolTipText = \uBCF4\uAE30 \uBA54\uB274 FileChooser.viewMenuButtonAccessibleName = \uBCF4\uAE30 \uBA54\uB274 FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80\uC815\uBCF4 -FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68 +FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C\uACE0\uCE68 FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30 FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984 FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
--- a/src/share/classes/com/sun/jndi/ldap/pool/Connections.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/jndi/ldap/pool/Connections.java Fri Jul 14 00:56:29 2017 +0100 @@ -27,7 +27,6 @@ import java.util.ArrayList; // JDK 1.2 import java.util.List; -import java.util.Iterator; import java.lang.ref.Reference; import java.lang.ref.SoftReference; @@ -290,23 +289,28 @@ * @param threshold an entry idle since this time has expired. * @return true if no more connections in list */ - synchronized boolean expire(long threshold) { - Iterator<ConnectionDesc> iter = conns.iterator(); - ConnectionDesc entry; - while (iter.hasNext()) { - entry = iter.next(); + boolean expire(long threshold) { + List<ConnectionDesc> clonedConns; + synchronized(this) { + clonedConns = new ArrayList<>(conns); + } + List<ConnectionDesc> expired = new ArrayList<>(); + + for (ConnectionDesc entry : clonedConns) { + d("expire(): ", entry); if (entry.expire(threshold)) { - d("expire(): removing ", entry); - td("Expired ", entry); - - iter.remove(); // remove from pool - - // Don't need to call notify() because we're - // removing only idle connections. If there were - // idle connections, then there should be no waiters. + expired.add(entry); + td("expire(): Expired ", entry); } } - return conns.isEmpty(); // whether whole list has 'expired' + + synchronized (this) { + conns.removeAll(expired); + // Don't need to call notify() because we're + // removing only idle connections. If there were + // idle connections, then there should be no waiters. + return conns.isEmpty(); // whether whole list has 'expired' + } } /**
--- a/src/share/classes/com/sun/jndi/ldap/pool/Pool.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/jndi/ldap/pool/Pool.java Fri Jul 14 00:56:29 2017 +0100 @@ -25,11 +25,11 @@ package com.sun.jndi.ldap.pool; +import java.util.ArrayList; import java.util.Map; import java.util.WeakHashMap; import java.util.Collection; import java.util.Collections; -import java.util.Iterator; import java.util.LinkedList; import java.io.PrintStream; @@ -163,17 +163,25 @@ * and removed. */ public void expire(long threshold) { + Collection<ConnectionsRef> copy; synchronized (map) { - Iterator<ConnectionsRef> iter = map.values().iterator(); - Connections conns; - while (iter.hasNext()) { - conns = iter.next().getConnections(); - if (conns.expire(threshold)) { - d("expire(): removing ", conns); - iter.remove(); - } + copy = new ArrayList<>(map.values()); + } + + ArrayList<ConnectionsRef> removed = new ArrayList<>(); + Connections conns; + for (ConnectionsRef ref : copy) { + conns = ref.getConnections(); + if (conns.expire(threshold)) { + d("expire(): removing ", conns); + removed.add(ref); } } + + synchronized (map) { + map.values().removeAll(removed); + } + expungeStaleConnections(); }
--- a/src/share/classes/com/sun/rowset/RowSetResourceBundle_sv.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/rowset/RowSetResourceBundle_sv.properties Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ cachedrowsetimpl.longfail = getLong utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1} cachedrowsetimpl.floatfail = getFloat utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1} cachedrowsetimpl.doublefail = getDouble utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1} -cachedrowsetimpl.dtypemismt = Inkompatibel datatyp +cachedrowsetimpl.dtypemismt = Felmatchad datatyp cachedrowsetimpl.datefail = getDate utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}, ingen konvertering tillg\u00E4nglig cachedrowsetimpl.timefail = getTime utf\u00F6rdes inte f\u00F6r v\u00E4rdet ({0}) i kolumnen {1}, ingen konvertering tillg\u00E4nglig cachedrowsetimpl.posupdate = Det finns inte st\u00F6d f\u00F6r positionerad uppdatering
--- a/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Fri Jul 14 00:56:29 2017 +0100 @@ -33,7 +33,7 @@ ############ FILE CHOOSER STRINGS ############# FileChooser.fileDescription.textAndMnemonic=Generisk fil FileChooser.directoryDescription.textAndMnemonic=Katalog -FileChooser.newFolderError.textAndMnemonic=Fel uppstod n\u00E4r ny mapp skapades +FileChooser.newFolderError.textAndMnemonic=Kan inte skapa ny mapp FileChooser.newFolderErrorSeparator= : FileChooser.newFolderParentDoesntExistTitle.textAndMnemonic=Kan inte skapa mappen FileChooser.newFolderParentDoesntExist.textAndMnemonic=Kan inte skapa mappen.\n\nSystemet kan inte hitta angiven s\u00F6kv\u00E4g. @@ -59,15 +59,15 @@ FileChooser.win32.newFolder=Ny mapp FileChooser.win32.newFolder.subsequent=Ny mapp ({0}) FileChooser.other.newFolder=Ny mapp -FileChooser.other.newFolder.subsequent=Ny mapp.{0} +FileChooser.other.newFolder.subsequent=Ny mapp {0} ## file chooser tooltips ### -FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt filvalsdialogruta +FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan f\u00F6r filval FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil FileChooser.updateButtonToolTip.textAndMnemonic=Uppdatera kataloglistan -FileChooser.helpButtonToolTip.textAndMnemonic=Hj\u00E4lp - Filv\u00E4ljare +FileChooser.helpButtonToolTip.textAndMnemonic=Hj\u00E4lp f\u00F6r val av fil FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u00D6ppna vald katalog FileChooser.filesListAccessibleName=Fillista @@ -129,7 +129,7 @@ # The following string will be formatted by a MessageFormat # and {0} will be replaced by page number being printed -PrintingDialog.contentProgress.textAndMnemonic=Utskriven sida {0}... +PrintingDialog.contentProgress.textAndMnemonic=Skriver ut sida {0}... PrintingDialog.contentAborting.textAndMnemonic=Utskriften avbryts... @@ -177,8 +177,8 @@ ProgressMonitor.progress.textAndMnemonic=P\u00E5g\u00E5r... ############ Split Pane Strings ############ -SplitPane.leftButton.textAndMnemonic=v\u00E4nster knapp -SplitPane.rightButton.textAndMnemonic=h\u00F6ger knapp +SplitPane.leftButton.textAndMnemonic=v\u00E4nsterknapp +SplitPane.rightButton.textAndMnemonic=h\u00F6gerknapp # Used for Isindex IsindexView.prompt=Detta \u00E4r ett s\u00F6kbart index. Ange s\u00F6kord:
--- a/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties Fri Jul 14 00:56:29 2017 +0100 @@ -36,7 +36,7 @@ FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80\uC815\uBCF4 FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80\uC815\uBCF4 FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80\uC815\uBCF4 -FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68 +FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C\uACE0\uCE68 FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30 FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984 FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
--- a/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties Fri Jul 14 00:56:29 2017 +0100 @@ -20,7 +20,7 @@ FileChooser.lookInLabel.textAndMnemonic=Leta &i: FileChooser.saveInLabel.textAndMnemonic=Spara i: -FileChooser.fileNameLabel.textAndMnemonic=&Fil: +FileChooser.fileNameLabel.textAndMnemonic=Fil&namn: FileChooser.folderNameLabel.textAndMnemonic=&Mapp: FileChooser.filesOfTypeLabel.textAndMnemonic=Filer av &typen: FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
--- a/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties Fri Jul 14 00:56:29 2017 +0100 @@ -36,7 +36,7 @@ FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80\uC815\uBCF4 FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80\uC815\uBCF4 FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80\uC815\uBCF4 -FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68 +FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C\uACE0\uCE68 FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30 FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984 FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
--- a/src/share/classes/java/awt/CheckboxMenuItem.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/CheckboxMenuItem.java Fri Jul 14 00:56:29 2017 +0100 @@ -277,7 +277,7 @@ * @since 1.4 */ public synchronized ItemListener[] getItemListeners() { - return (ItemListener[])(getListeners(ItemListener.class)); + return getListeners(ItemListener.class); } /**
--- a/src/share/classes/java/awt/Cursor.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/Cursor.java Fri Jul 14 00:56:29 2017 +0100 @@ -163,11 +163,11 @@ * hashtable, filesystem dir prefix, filename, and properties for custom cursors support */ - private static final Hashtable systemCustomCursors = new Hashtable(1); + private static final Hashtable<String,Cursor> systemCustomCursors = new Hashtable<>(1); private static final String systemCustomCursorDirPrefix = initCursorDir(); private static String initCursorDir() { - String jhome = (String) java.security.AccessController.doPrivileged( + String jhome = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("java.home")); return jhome + File.separator + "lib" + File.separator + "images" + @@ -298,7 +298,7 @@ static public Cursor getSystemCustomCursor(final String name) throws AWTException, HeadlessException { GraphicsEnvironment.checkHeadless(); - Cursor cursor = (Cursor)systemCustomCursors.get(name); + Cursor cursor = systemCustomCursors.get(name); if (cursor == null) { synchronized(systemCustomCursors) { @@ -319,11 +319,11 @@ final String fileName = systemCustomCursorProperties.getProperty(key); - String localized = (String)systemCustomCursorProperties.getProperty(prefix + DotNameSuffix); + String localized = systemCustomCursorProperties.getProperty(prefix + DotNameSuffix); if (localized == null) localized = name; - String hotspot = (String)systemCustomCursorProperties.getProperty(prefix + DotHotspotSuffix); + String hotspot = systemCustomCursorProperties.getProperty(prefix + DotHotspotSuffix); if (hotspot == null) throw new AWTException("no hotspot property defined for cursor: " + name); @@ -348,9 +348,9 @@ final int fy = y; final String flocalized = localized; - cursor = (Cursor) java.security.AccessController.doPrivileged( - new java.security.PrivilegedExceptionAction() { - public Object run() throws Exception { + cursor = java.security.AccessController.<Cursor>doPrivileged( + new java.security.PrivilegedExceptionAction<Cursor>() { + public Cursor run() throws Exception { Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.getImage( systemCustomCursorDirPrefix + fileName); @@ -447,8 +447,8 @@ systemCustomCursorProperties = new Properties(); try { - AccessController.doPrivileged( - new java.security.PrivilegedExceptionAction() { + AccessController.<Object>doPrivileged( + new java.security.PrivilegedExceptionAction<Object>() { public Object run() throws Exception { FileInputStream fis = null; try {
--- a/src/share/classes/java/awt/EventQueue.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/EventQueue.java Fri Jul 14 00:56:29 2017 +0100 @@ -166,7 +166,7 @@ * The modifiers field of the current event, if the current event is an * InputEvent or ActionEvent. */ - private WeakReference currentEvent; + private WeakReference<AWTEvent> currentEvent; /* * Non-zero if a thread is waiting in getNextEvent(int) for an event of @@ -834,7 +834,7 @@ pushPopLock.lock(); try { return (Thread.currentThread() == dispatchThread) - ? ((AWTEvent)currentEvent.get()) + ? currentEvent.get() : null; } finally { pushPopLock.unlock(); @@ -1183,7 +1183,7 @@ return; } - currentEvent = new WeakReference(e); + currentEvent = new WeakReference<>(e); // This series of 'instanceof' checks should be replaced with a // polymorphic type (for example, an interface which declares a
--- a/src/share/classes/java/awt/MediaTracker.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/MediaTracker.java Fri Jul 14 00:56:29 2017 +0100 @@ -28,6 +28,7 @@ import java.awt.Component; import java.awt.Image; import java.awt.image.ImageObserver; +import sun.awt.image.MultiResolutionToolkitImage; /** * The <code>MediaTracker</code> class is a utility class to track @@ -222,10 +223,17 @@ * @param h the height at which the image is rendered */ public synchronized void addImage(Image image, int id, int w, int h) { + addImageImpl(image, id, w, h); + Image rvImage = getResolutionVariant(image); + if (rvImage != null) { + addImageImpl(rvImage, id, 2 * w, 2 * h); + } + } + + private void addImageImpl(Image image, int id, int w, int h) { head = MediaEntry.insert(head, new ImageMediaEntry(this, image, id, w, h)); } - /** * Flag indicating that media is currently being loaded. * @see java.awt.MediaTracker#statusAll @@ -719,6 +727,15 @@ * @since JDK1.1 */ public synchronized void removeImage(Image image) { + removeImageImpl(image); + Image rvImage = getResolutionVariant(image); + if (rvImage != null) { + removeImageImpl(rvImage); + } + notifyAll(); // Notify in case remaining images are "done". + } + + private void removeImageImpl(Image image) { MediaEntry cur = head; MediaEntry prev = null; while (cur != null) { @@ -735,7 +752,6 @@ } cur = next; } - notifyAll(); // Notify in case remaining images are "done". } /** @@ -750,6 +766,15 @@ * @since JDK1.1 */ public synchronized void removeImage(Image image, int id) { + removeImageImpl(image, id); + Image rvImage = getResolutionVariant(image); + if (rvImage != null) { + removeImageImpl(rvImage, id); + } + notifyAll(); // Notify in case remaining images are "done". + } + + private void removeImageImpl(Image image, int id) { MediaEntry cur = head; MediaEntry prev = null; while (cur != null) { @@ -766,7 +791,6 @@ } cur = next; } - notifyAll(); // Notify in case remaining images are "done". } /** @@ -783,6 +807,16 @@ */ public synchronized void removeImage(Image image, int id, int width, int height) { + removeImageImpl(image, id, width, height); + Image rvImage = getResolutionVariant(image); + if (rvImage != null) { + removeImageImpl(rvImage, id, 2 * width, 2 * height); + + } + notifyAll(); // Notify in case remaining images are "done". + } + + private void removeImageImpl(Image image, int id, int width, int height) { MediaEntry cur = head; MediaEntry prev = null; while (cur != null) { @@ -801,12 +835,18 @@ } cur = next; } - notifyAll(); // Notify in case remaining images are "done". } synchronized void setDone() { notifyAll(); } + + private static Image getResolutionVariant(Image image) { + if (image instanceof MultiResolutionToolkitImage) { + return ((MultiResolutionToolkitImage) image).getResolutionVariant(); + } + return null; + } } abstract class MediaEntry {
--- a/src/share/classes/java/awt/Menu.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/Menu.java Fri Jul 14 00:56:29 2017 +0100 @@ -66,7 +66,7 @@ AWTAccessor.setMenuAccessor( new AWTAccessor.MenuAccessor() { - public Vector getItems(Menu menu) { + public Vector<MenuComponent> getItems(Menu menu) { return menu.items; } }); @@ -78,7 +78,7 @@ * @serial * @see #countItems() */ - Vector items = new Vector(); + Vector<MenuComponent> items = new Vector<>(); /** * This field indicates whether the menu has the @@ -313,7 +313,7 @@ } int nitems = getItemCount(); - Vector tempItems = new Vector(); + Vector<MenuItem> tempItems = new Vector<>(); /* Remove the item at index, nitems-index times storing them in a temporary vector in the @@ -330,7 +330,7 @@ already in the correct order in the temp vector. */ for (int i = 0; i < tempItems.size() ; i++) { - add((MenuItem)tempItems.elementAt(i)); + add(tempItems.elementAt(i)); } } } @@ -379,7 +379,7 @@ } int nitems = getItemCount(); - Vector tempItems = new Vector(); + Vector<MenuItem> tempItems = new Vector<>(); /* Remove the item at index, nitems-index times storing them in a temporary vector in the @@ -396,7 +396,7 @@ already in the correct order in the temp vector. */ for (int i = 0; i < tempItems.size() ; i++) { - add((MenuItem)tempItems.elementAt(i)); + add(tempItems.elementAt(i)); } } } @@ -411,9 +411,9 @@ items.removeElementAt(index); MenuPeer peer = (MenuPeer)this.peer; if (peer != null) { + peer.delItem(index); mi.removeNotify(); mi.parent = null; - peer.delItem(index); } } } @@ -475,13 +475,13 @@ return null; } - synchronized Enumeration shortcuts() { - Vector shortcuts = new Vector(); + synchronized Enumeration<MenuShortcut> shortcuts() { + Vector<MenuShortcut> shortcuts = new Vector<>(); int nitems = getItemCount(); for (int i = 0 ; i < nitems ; i++) { MenuItem mi = getItem(i); if (mi instanceof Menu) { - Enumeration e = ((Menu)mi).shortcuts(); + Enumeration<MenuShortcut> e = ((Menu)mi).shortcuts(); while (e.hasMoreElements()) { shortcuts.addElement(e.nextElement()); }
--- a/src/share/classes/java/awt/MenuBar.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/MenuBar.java Fri Jul 14 00:56:29 2017 +0100 @@ -81,7 +81,7 @@ return menuBar.helpMenu; } - public Vector getMenus(MenuBar menuBar) { + public Vector<Menu> getMenus(MenuBar menuBar) { return menuBar.menus; } }); @@ -94,7 +94,7 @@ * @serial * @see #countMenus() */ - Vector menus = new Vector(); + Vector<Menu> menus = new Vector<>(); /** * This menu is a special menu dedicated to @@ -222,7 +222,6 @@ if (m.parent != null) { m.parent.remove(m); } - menus.addElement(m); m.parent = this; MenuBarPeer peer = (MenuBarPeer)this.peer; @@ -230,7 +229,10 @@ if (m.peer == null) { m.addNotify(); } + menus.addElement(m); peer.addMenu(m); + } else { + menus.addElement(m); } return m; } @@ -248,9 +250,9 @@ menus.removeElementAt(index); MenuBarPeer peer = (MenuBarPeer)this.peer; if (peer != null) { + peer.delMenu(index); m.removeNotify(); m.parent = null; - peer.delMenu(index); } } } @@ -309,7 +311,7 @@ * be called on the toolkit thread. */ final Menu getMenuImpl(int i) { - return (Menu)menus.elementAt(i); + return menus.elementAt(i); } /** @@ -321,10 +323,10 @@ * @since JDK1.1 */ public synchronized Enumeration<MenuShortcut> shortcuts() { - Vector shortcuts = new Vector(); + Vector<MenuShortcut> shortcuts = new Vector<>(); int nmenus = getMenuCount(); for (int i = 0 ; i < nmenus ; i++) { - Enumeration e = getMenu(i).shortcuts(); + Enumeration<MenuShortcut> e = getMenu(i).shortcuts(); while (e.hasMoreElements()) { shortcuts.addElement(e.nextElement()); } @@ -438,7 +440,7 @@ // HeadlessException will be thrown from MenuComponent's readObject s.defaultReadObject(); for (int i = 0; i < menus.size(); i++) { - Menu m = (Menu)menus.elementAt(i); + Menu m = menus.elementAt(i); m.parent = this; } }
--- a/src/share/classes/java/awt/MenuComponent.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/MenuComponent.java Fri Jul 14 00:56:29 2017 +0100 @@ -75,7 +75,7 @@ * @see #setFont(Font) * @see #getFont() */ - Font font; + volatile Font font; /** * The menu component's name, which defaults to <code>null</code>. @@ -292,11 +292,13 @@ * @see java.awt.font.TextAttribute */ public void setFont(Font f) { - font = f; - //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font) - MenuComponentPeer peer = (MenuComponentPeer)this.peer; - if (peer != null) { - peer.setFont(f); + synchronized (getTreeLock()) { + font = f; + //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font) + MenuComponentPeer peer = this.peer; + if (peer != null) { + peer.setFont(f); + } } } @@ -307,7 +309,7 @@ */ public void removeNotify() { synchronized (getTreeLock()) { - MenuComponentPeer p = (MenuComponentPeer)this.peer; + MenuComponentPeer p = this.peer; if (p != null) { Toolkit.getEventQueue().removeSourceEvents(this, true); this.peer = null;
--- a/src/share/classes/java/awt/MenuItem.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/MenuItem.java Fri Jul 14 00:56:29 2017 +0100 @@ -564,7 +564,7 @@ * @since 1.4 */ public synchronized ActionListener[] getActionListeners() { - return (ActionListener[])(getListeners(ActionListener.class)); + return getListeners(ActionListener.class); } /**
--- a/src/share/classes/java/awt/RenderingHints.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/RenderingHints.java Fri Jul 14 00:56:29 2017 +0100 @@ -92,7 +92,7 @@ * {@code equals()} method. */ public abstract static class Key { - private static HashMap identitymap = new HashMap(17); + private static HashMap<Object,Object> identitymap = new HashMap<>(17); private String getIdentity() { // Note that the identity string is dependent on 3 variables: @@ -138,7 +138,7 @@ } // Note: Use a weak reference to avoid holding on to extra // objects and classes after they should be unloaded. - identitymap.put(identity, new WeakReference(k)); + identitymap.put(identity, new WeakReference<Key>(k)); } private int privatekey; @@ -195,7 +195,7 @@ } } - HashMap hintmap = new HashMap(7); + HashMap<Object,Object> hintmap = new HashMap<>(7); /** * Antialiasing hint key. @@ -1267,12 +1267,13 @@ * object. * @return a clone of this instance. */ + @SuppressWarnings("unchecked") public Object clone() { RenderingHints rh; try { rh = (RenderingHints) super.clone(); if (hintmap != null) { - rh.hintmap = (HashMap) hintmap.clone(); + rh.hintmap = (HashMap<Object,Object>) hintmap.clone(); } } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable
--- a/src/share/classes/java/awt/Window.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/Window.java Fri Jul 14 00:56:29 2017 +0100 @@ -4072,6 +4072,10 @@ public void setTrayIconWindow(Window w, boolean isTrayIconWindow) { w.isTrayIconWindow = isTrayIconWindow; } + + public Window[] getOwnedWindows(Window w) { + return w.getOwnedWindows_NoClientCode(); + } }); // WindowAccessor } // static
--- a/src/share/classes/java/awt/datatransfer/Clipboard.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/datatransfer/Clipboard.java Fri Jul 14 00:56:29 2017 +0100 @@ -72,7 +72,7 @@ * * @since 1.5 */ - private Set currentDataFlavors; + private Set<DataFlavor> currentDataFlavors; /** * Creates a clipboard object. @@ -314,7 +314,7 @@ if (flavorListeners == null) { return; } - Set prevDataFlavors = currentDataFlavors; + Set<DataFlavor> prevDataFlavors = currentDataFlavors; currentDataFlavors = getAvailableDataFlavorSet(); if (prevDataFlavors.equals(currentDataFlavors)) { return; @@ -340,8 +340,8 @@ * * @since 1.5 */ - private Set getAvailableDataFlavorSet() { - Set set = new HashSet(); + private Set<DataFlavor> getAvailableDataFlavorSet() { + Set<DataFlavor> set = new HashSet<>(); Transferable contents = getContents(null); if (contents != null) { DataFlavor[] flavors = contents.getTransferDataFlavors();
--- a/src/share/classes/java/awt/dnd/DragGestureEvent.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/dnd/DragGestureEvent.java Fri Jul 14 00:56:29 2017 +0100 @@ -165,7 +165,7 @@ * <P> * @return an Iterator for the events comprising the gesture */ - + @SuppressWarnings("unchecked") public Iterator<InputEvent> iterator() { return events.iterator(); } /** @@ -184,7 +184,7 @@ * <P> * @return an array of the events comprising the gesture */ - + @SuppressWarnings("unchecked") public Object[] toArray(Object[] array) { return events.toArray(array); } /** @@ -333,7 +333,6 @@ component = (Component)f.get("component", null); origin = (Point)f.get("origin", null); action = f.get("action", 0); - // Pre-1.4 support. 'events' was previously non-transient try { events = (List)f.get("events", null); @@ -351,7 +350,7 @@ /* * fields */ - + @SuppressWarnings("rawtypes") private transient List events; /**
--- a/src/share/classes/java/awt/dnd/DragGestureRecognizer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/dnd/DragGestureRecognizer.java Fri Jul 14 00:56:29 2017 +0100 @@ -297,7 +297,7 @@ * @return the initial event that triggered the drag gesture */ - public InputEvent getTriggerEvent() { return events.isEmpty() ? null : (InputEvent)events.get(0); } + public InputEvent getTriggerEvent() { return events.isEmpty() ? null : events.get(0); } /** * Reset the Recognizer, if its currently recognizing a gesture, ignore
--- a/src/share/classes/java/awt/dnd/DragSource.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/dnd/DragSource.java Fri Jul 14 00:56:29 2017 +0100 @@ -600,7 +600,7 @@ * @since 1.4 */ public DragSourceListener[] getDragSourceListeners() { - return (DragSourceListener[])getListeners(DragSourceListener.class); + return getListeners(DragSourceListener.class); } /** @@ -660,8 +660,7 @@ * @since 1.4 */ public DragSourceMotionListener[] getDragSourceMotionListeners() { - return (DragSourceMotionListener[]) - getListeners(DragSourceMotionListener.class); + return getListeners(DragSourceMotionListener.class); } /** @@ -896,8 +895,8 @@ * @since 1.5 */ public static int getDragThreshold() { - int ts = ((Integer)AccessController.doPrivileged( - new GetIntegerAction("awt.dnd.drag.threshold", 0))).intValue(); + int ts = AccessController.doPrivileged( + new GetIntegerAction("awt.dnd.drag.threshold", 0)).intValue(); if (ts > 0) { return ts; } else {
--- a/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java Fri Jul 14 00:56:29 2017 +0100 @@ -36,6 +36,8 @@ public class InvalidDnDOperationException extends IllegalStateException { + private static final long serialVersionUID = -6062568741193956678L; + static private String dft_msg = "The operation requested cannot be performed by the DnD system since it is not in the appropriate state"; /**
--- a/src/share/classes/java/awt/geom/AffineTransform.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/awt/geom/AffineTransform.java Fri Jul 14 00:56:29 2017 +0100 @@ -876,6 +876,7 @@ * they have not been cached. * @see #getType */ + @SuppressWarnings("fallthrough") private void calculateType() { int ret = TYPE_IDENTITY; boolean sgn0, sgn1; @@ -1038,6 +1039,7 @@ * @see #TYPE_UNIFORM_SCALE * @since 1.2 */ + @SuppressWarnings("fallthrough") public double getDeterminant() { switch (state) { default: @@ -1250,6 +1252,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): m02 = tx * m00 + ty * m01 + m02; m12 = tx * m10 + ty * m11 + m12; @@ -1631,6 +1634,7 @@ * Y axis direction * @since 1.2 */ + @SuppressWarnings("fallthrough") public void scale(double sx, double sy) { int state = this.state; switch (state) { @@ -1705,6 +1709,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE): double M0, M1; @@ -2224,6 +2229,7 @@ * @see #preConcatenate * @since 1.2 */ + @SuppressWarnings("fallthrough") public void concatenate(AffineTransform Tx) { double M0, M1; double T00, T01, T10, T11; @@ -2432,6 +2438,7 @@ * @see #concatenate * @since 1.2 */ + @SuppressWarnings("fallthrough") public void preConcatenate(AffineTransform Tx) { double M0, M1; double T00, T01, T10, T11; @@ -2655,6 +2662,7 @@ default: stateError(); /* NOTREACHED */ + return null; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): det = m00 * m11 - m01 * m10; if (Math.abs(det) <= Double.MIN_VALUE) { @@ -2751,6 +2759,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): M00 = m00; M01 = m01; M02 = m02; M10 = m10; M11 = m11; M12 = m12; @@ -2885,6 +2894,7 @@ default: stateError(); /* NOTREACHED */ + return null; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): ptDst.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12); @@ -2968,6 +2978,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): dst.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12); @@ -3043,6 +3054,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): M00 = m00; M01 = m01; M02 = m02; M10 = m10; M11 = m11; M12 = m12; @@ -3157,6 +3169,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): M00 = m00; M01 = m01; M02 = m02; M10 = m10; M11 = m11; M12 = m12; @@ -3252,6 +3265,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): M00 = m00; M01 = m01; M02 = m02; M10 = m10; M11 = m11; M12 = m12; @@ -3347,6 +3361,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): M00 = m00; M01 = m01; M02 = m02; M10 = m10; M11 = m11; M12 = m12; @@ -3436,6 +3451,7 @@ * inverted. * @since 1.2 */ + @SuppressWarnings("fallthrough") public Point2D inverseTransform(Point2D ptSrc, Point2D ptDst) throws NoninvertibleTransformException { @@ -3547,6 +3563,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): M00 = m00; M01 = m01; M02 = m02; M10 = m10; M11 = m11; M12 = m12; @@ -3679,6 +3696,7 @@ default: stateError(); /* NOTREACHED */ + return null; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE): ptDst.setLocation(x * m00 + y * m01, x * m10 + y * m11); @@ -3754,6 +3772,7 @@ default: stateError(); /* NOTREACHED */ + return; case (APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE): case (APPLY_SHEAR | APPLY_SCALE): M00 = m00; M01 = m01;
--- a/src/share/classes/java/io/ObjectInputStream.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/io/ObjectInputStream.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -1772,12 +1772,19 @@ } catch (ClassNotFoundException ex) { resolveEx = ex; } + + // Call filterCheck on the class before reading anything else + filterCheck(cl, -1); + skipCustomData(); - desc.initProxy(cl, resolveEx, readClassDesc(false)); - - // Call filterCheck on the definition - filterCheck(desc.forClass(), -1); + try { + totalObjectRefs++; + depth++; + desc.initProxy(cl, resolveEx, readClassDesc(false)); + } finally { + depth--; + } handles.finish(descHandle); passHandle = descHandle; @@ -1822,12 +1829,19 @@ } catch (ClassNotFoundException ex) { resolveEx = ex; } + + // Call filterCheck on the class before reading anything else + filterCheck(cl, -1); + skipCustomData(); - desc.initNonProxy(readDesc, cl, resolveEx, readClassDesc(false)); - - // Call filterCheck on the definition - filterCheck(desc.forClass(), -1); + try { + totalObjectRefs++; + depth++; + desc.initNonProxy(readDesc, cl, resolveEx, readClassDesc(false)); + } finally { + depth--; + } handles.finish(descHandle); passHandle = descHandle;
--- a/src/share/classes/java/lang/Thread.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/java/lang/Thread.java Fri Jul 14 00:56:29 2017 +0100 @@ -342,11 +342,11 @@ /** * Initializes a Thread with the current AccessControlContext. - * @see #init(ThreadGroup,Runnable,String,long,AccessControlContext) + * @see #init(ThreadGroup,Runnable,String,long,AccessControlContext,boolean) */ private void init(ThreadGroup g, Runnable target, String name, long stackSize) { - init(g, target, name, stackSize, null); + init(g, target, name, stackSize, null, true); } /** @@ -359,9 +359,12 @@ * zero to indicate that this parameter is to be ignored. * @param acc the AccessControlContext to inherit, or * AccessController.getContext() if null + * @param inheritThreadLocals if {@code true}, inherit initial values for + * inheritable thread-locals from the constructing thread */ private void init(ThreadGroup g, Runnable target, String name, - long stackSize, AccessControlContext acc) { + long stackSize, AccessControlContext acc, + boolean inheritThreadLocals) { if (name == null) { throw new NullPointerException("name cannot be null"); } @@ -412,7 +415,7 @@ acc != null ? acc : AccessController.getContext(); this.target = target; setPriority(priority); - if (parent.inheritableThreadLocals != null) + if (inheritThreadLocals && parent.inheritableThreadLocals != null) this.inheritableThreadLocals = ThreadLocal.createInheritedMap(parent.inheritableThreadLocals); /* Stash the specified stack size in case the VM cares */ @@ -466,7 +469,7 @@ * This is not a public constructor. */ Thread(Runnable target, AccessControlContext acc) { - init(null, target, "Thread-" + nextThreadNum(), 0, acc); + init(null, target, "Thread-" + nextThreadNum(), 0, acc, false); } /**
--- a/src/share/classes/javax/swing/JDialog.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/javax/swing/JDialog.java Fri Jul 14 00:56:29 2017 +0100 @@ -644,6 +644,7 @@ enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK); setLocale( JComponent.getDefaultLocale() ); setRootPane(createRootPane()); + setBackground(UIManager.getColor("control")); setRootPaneCheckingEnabled(true); if (JDialog.isDefaultLookAndFeelDecorated()) { boolean supportsWindowDecorations =
--- a/src/share/classes/sun/awt/AWTAccessor.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/awt/AWTAccessor.java Fri Jul 14 00:56:29 2017 +0100 @@ -326,6 +326,12 @@ * Marks the specified window as an utility window for TrayIcon. */ void setTrayIconWindow(Window w, boolean isTrayIconWindow); + + /** + * Return an array containing all the windows this + * window currently owns. + */ + Window[] getOwnedWindows(Window w); } /**
--- a/src/share/classes/sun/awt/SunHints.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/awt/SunHints.java Fri Jul 14 00:56:29 2017 +0100 @@ -171,7 +171,7 @@ } } - private static final int NUM_KEYS = 9; + private static final int NUM_KEYS = 10; private static final int VALS_PER_KEY = 8; /** @@ -252,6 +252,13 @@ public static final int INTVAL_STROKE_PURE = 2; /** + * Image scaling hint key and values + */ + public static final int INTKEY_RESOLUTION_VARIANT = 9; + public static final int INTVAL_RESOLUTION_VARIANT_DEFAULT = 0; + public static final int INTVAL_RESOLUTION_VARIANT_OFF = 1; + public static final int INTVAL_RESOLUTION_VARIANT_ON = 2; + /** * LCD text contrast control hint key. * Value is "100" to make discontiguous with the others which * are all enumerative and are of a different class. @@ -449,6 +456,24 @@ SunHints.INTVAL_STROKE_PURE, "Pure stroke conversion for accurate paths"); + /** + * Image resolution variant hint key and value objects + */ + public static final Key KEY_RESOLUTION_VARIANT = + new SunHints.Key(SunHints.INTKEY_RESOLUTION_VARIANT, + "Global image resolution variant key"); + public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT = + new SunHints.Value(KEY_RESOLUTION_VARIANT, + SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT, + "Choose image resolutions based on a default heuristic"); + public static final Object VALUE_RESOLUTION_VARIANT_OFF = + new SunHints.Value(KEY_RESOLUTION_VARIANT, + SunHints.INTVAL_RESOLUTION_VARIANT_OFF, + "Use only the standard resolution of an image"); + public static final Object VALUE_RESOLUTION_VARIANT_ON = + new SunHints.Value(KEY_RESOLUTION_VARIANT, + SunHints.INTVAL_RESOLUTION_VARIANT_ON, + "Always use resolution-specific variants of images"); public static class LCDContrastKey extends Key {
--- a/src/share/classes/sun/awt/SunToolkit.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/awt/SunToolkit.java Fri Jul 14 00:56:29 2017 +0100 @@ -36,6 +36,9 @@ import java.awt.TrayIcon; import java.awt.SystemTray; import java.awt.event.InputEvent; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.security.PrivilegedAction; import java.util.*; @@ -725,6 +728,194 @@ static final SoftCache imgCache = new SoftCache(); static Image getImageFromHash(Toolkit tk, URL url) { + checkPermissions(url); + synchronized (imgCache) { + Image img = (Image)imgCache.get(url); + if (img == null) { + try { + img = tk.createImage(new URLImageSource(url)); + imgCache.put(url, img); + } catch (Exception e) { + } + } + return img; + } + } + + static Image getImageFromHash(Toolkit tk, + String filename) { + checkPermissions(filename); + synchronized (imgCache) { + Image img = (Image)imgCache.get(filename); + if (img == null) { + try { + img = tk.createImage(new FileImageSource(filename)); + imgCache.put(filename, img); + } catch (Exception e) { + } + } + return img; + } + } + + public Image getImage(String filename) { + return getImageFromHash(this, filename); + } + + public Image getImage(URL url) { + return getImageFromHash(this, url); + } + + protected Image getImageWithResolutionVariant(String fileName, + String resolutionVariantName) { + synchronized (imgCache) { + Image image = getImageFromHash(this, fileName); + if (image instanceof MultiResolutionImage) { + return image; + } + Image resolutionVariant = getImageFromHash(this, resolutionVariantName); + image = createImageWithResolutionVariant(image, resolutionVariant); + imgCache.put(fileName, image); + return image; + } + } + + protected Image getImageWithResolutionVariant(URL url, + URL resolutionVariantURL) { + synchronized (imgCache) { + Image image = getImageFromHash(this, url); + if (image instanceof MultiResolutionImage) { + return image; + } + Image resolutionVariant = getImageFromHash(this, resolutionVariantURL); + image = createImageWithResolutionVariant(image, resolutionVariant); + imgCache.put(url, image); + return image; + } + } + + + public Image createImage(String filename) { + checkPermissions(filename); + return createImage(new FileImageSource(filename)); + } + + public Image createImage(URL url) { + checkPermissions(url); + return createImage(new URLImageSource(url)); + } + + public Image createImage(byte[] data, int offset, int length) { + return createImage(new ByteArrayImageSource(data, offset, length)); + } + + public Image createImage(ImageProducer producer) { + return new ToolkitImage(producer); + } + + public static Image createImageWithResolutionVariant(Image image, + Image resolutionVariant) { + return new MultiResolutionToolkitImage(image, resolutionVariant); + } + + public int checkImage(Image img, int w, int h, ImageObserver o) { + if (!(img instanceof ToolkitImage)) { + return ImageObserver.ALLBITS; + } + + ToolkitImage tkimg = (ToolkitImage)img; + int repbits; + if (w == 0 || h == 0) { + repbits = ImageObserver.ALLBITS; + } else { + repbits = tkimg.getImageRep().check(o); + } + return (tkimg.check(o) | repbits) & checkResolutionVariant(img, w, h, o); + } + + public boolean prepareImage(Image img, int w, int h, ImageObserver o) { + if (w == 0 || h == 0) { + return true; + } + + // Must be a ToolkitImage + if (!(img instanceof ToolkitImage)) { + return true; + } + + ToolkitImage tkimg = (ToolkitImage)img; + if (tkimg.hasError()) { + if (o != null) { + o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT, + -1, -1, -1, -1); + } + return false; + } + ImageRepresentation ir = tkimg.getImageRep(); + return ir.prepare(o) & prepareResolutionVariant(img, w, h, o); + } + + private int checkResolutionVariant(Image img, int w, int h, ImageObserver o) { + ToolkitImage rvImage = getResolutionVariant(img); + // Ignore the resolution variant in case of error + return (rvImage == null || rvImage.hasError()) ? 0xFFFF : + checkImage(rvImage, 2 * w, 2 * h, MultiResolutionToolkitImage. + getResolutionVariantObserver( + img, o, w, h, 2 * w, 2 * h)); + } + + private boolean prepareResolutionVariant(Image img, int w, int h, + ImageObserver o) { + + ToolkitImage rvImage = getResolutionVariant(img); + // Ignore the resolution variant in case of error + return rvImage == null || rvImage.hasError() || prepareImage( + rvImage, 2 * w, 2 * h, + MultiResolutionToolkitImage.getResolutionVariantObserver( + img, o, w, h, 2 * w, 2 * h)); + } + + private static ToolkitImage getResolutionVariant(Image image) { + if (image instanceof MultiResolutionToolkitImage) { + Image resolutionVariant = ((MultiResolutionToolkitImage) image). + getResolutionVariant(); + if (resolutionVariant instanceof ToolkitImage) { + return (ToolkitImage) resolutionVariant; + } + } + return null; + } + + protected static boolean imageCached(Object key) { + return imgCache.containsKey(key); + } + + protected static boolean imageExists(String filename) { + checkPermissions(filename); + return filename != null && new File(filename).exists(); + } + + @SuppressWarnings("try") + protected static boolean imageExists(URL url) { + checkPermissions(url); + if (url != null) { + try (InputStream is = url.openStream()) { + return true; + }catch(IOException e){ + return false; + } + } + return false; + } + + private static void checkPermissions(String filename) { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + security.checkRead(filename); + } + } + + private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { @@ -752,128 +943,6 @@ sm.checkConnect(url.getHost(), url.getPort()); } } - synchronized (imgCache) { - Image img = (Image)imgCache.get(url); - if (img == null) { - try { - img = tk.createImage(new URLImageSource(url)); - imgCache.put(url, img); - } catch (Exception e) { - } - } - return img; - } - } - - static Image getImageFromHash(Toolkit tk, - String filename) { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - security.checkRead(filename); - } - synchronized (imgCache) { - Image img = (Image)imgCache.get(filename); - if (img == null) { - try { - img = tk.createImage(new FileImageSource(filename)); - imgCache.put(filename, img); - } catch (Exception e) { - } - } - return img; - } - } - - public Image getImage(String filename) { - return getImageFromHash(this, filename); - } - - public Image getImage(URL url) { - return getImageFromHash(this, url); - } - - public Image createImage(String filename) { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - security.checkRead(filename); - } - return createImage(new FileImageSource(filename)); - } - - public Image createImage(URL url) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - try { - java.security.Permission perm = - url.openConnection().getPermission(); - if (perm != null) { - try { - sm.checkPermission(perm); - } catch (SecurityException se) { - // fallback to checkRead/checkConnect for pre 1.2 - // security managers - if ((perm instanceof java.io.FilePermission) && - perm.getActions().indexOf("read") != -1) { - sm.checkRead(perm.getName()); - } else if ((perm instanceof - java.net.SocketPermission) && - perm.getActions().indexOf("connect") != -1) { - sm.checkConnect(url.getHost(), url.getPort()); - } else { - throw se; - } - } - } - } catch (java.io.IOException ioe) { - sm.checkConnect(url.getHost(), url.getPort()); - } - } - return createImage(new URLImageSource(url)); - } - - public Image createImage(byte[] data, int offset, int length) { - return createImage(new ByteArrayImageSource(data, offset, length)); - } - - public Image createImage(ImageProducer producer) { - return new ToolkitImage(producer); - } - - public int checkImage(Image img, int w, int h, ImageObserver o) { - if (!(img instanceof ToolkitImage)) { - return ImageObserver.ALLBITS; - } - - ToolkitImage tkimg = (ToolkitImage)img; - int repbits; - if (w == 0 || h == 0) { - repbits = ImageObserver.ALLBITS; - } else { - repbits = tkimg.getImageRep().check(o); - } - return tkimg.check(o) | repbits; - } - - public boolean prepareImage(Image img, int w, int h, ImageObserver o) { - if (w == 0 || h == 0) { - return true; - } - - // Must be a ToolkitImage - if (!(img instanceof ToolkitImage)) { - return true; - } - - ToolkitImage tkimg = (ToolkitImage)img; - if (tkimg.hasError()) { - if (o != null) { - o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT, - -1, -1, -1, -1); - } - return false; - } - ImageRepresentation ir = tkimg.getImageRep(); - return ir.prepare(o); } /**
--- a/src/share/classes/sun/awt/TextureSizeConstraining.java Thu Apr 27 03:09:54 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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.awt; - -/** - * A GraphicsConfiguration implements the TextureSizeConstraining - * interface to indicate that it imposes certain limitations on the - * maximum size of supported textures. - */ -public interface TextureSizeConstraining { - - /** - * Returns the maximum width of any texture image. - */ - public int getMaxTextureWidth(); - - /** - * Returns the maximum height of any texture image. - */ - public int getMaxTextureHeight(); - -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.awt.image; + +import java.awt.Image; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.util.Arrays; +import java.util.List; + +public class MultiResolutionBufferedImage extends BufferedImage + implements MultiResolutionImage { + + Image[] resolutionVariants; + int baseIndex; + + public MultiResolutionBufferedImage(int imageType, int baseIndex, Image... images) { + super(images[baseIndex].getWidth(null), images[baseIndex].getHeight(null), + imageType); + this.baseIndex = baseIndex; + this.resolutionVariants = images; + Graphics g = getGraphics(); + g.drawImage(images[baseIndex], 0, 0, null); + g.dispose(); + images[baseIndex] = this; + } + + @Override + public Image getResolutionVariant(int width, int height) { + for (Image image : resolutionVariants) { + if (width <= image.getWidth(null) && height <= image.getHeight(null)) { + return image; + } + } + return this; + } + + @Override + public List<Image> getResolutionVariants() { + return Arrays.asList(resolutionVariants); + } + + public MultiResolutionBufferedImage map(ImageMapper mapper) { + Image[] images = new Image[resolutionVariants.length]; + for (int index = 0; index < resolutionVariants.length; ++index) { + images[index] = mapper.mapImage(resolutionVariants[index]); + } + return new MultiResolutionBufferedImage(getType(), baseIndex, images); + } + + public static interface ImageMapper { + public Image mapImage(Image img); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/image/MultiResolutionImage.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.awt.image; + +import java.awt.Image; +import java.util.List; + +/** + * This interface is designed to provide a set of images at various resolutions. + * + * The <code>MultiResolutionImage</code> interface should be implemented by any + * class whose instances are intended to provide image resolution variants + * according to the given image width and height. + * + * For example, + * <pre> + * {@code + * public class ScaledImage extends BufferedImage + * implements MultiResolutionImage { + * + * @Override + * public Image getResolutionVariant(int width, int height) { + * return ((width <= getWidth() && height <= getHeight())) + * ? this : highResolutionImage; + * } + * + * @Override + * public List<Image> getResolutionVariants() { + * return Arrays.asList(this, highResolutionImage); + * } + * } + * }</pre> + * + * It is recommended to cache image variants for performance reasons. + * + * <b>WARNING</b>: This class is an implementation detail. This API may change + * between update release, and it may even be removed or be moved in some other + * package(s)/class(es). + */ +public interface MultiResolutionImage { + + /** + * Provides an image with necessary resolution which best fits to the given + * image width and height. + * + * @param width the desired image resolution width. + * @param height the desired image resolution height. + * @return image resolution variant. + * + * @since JDK1.8 + */ + public Image getResolutionVariant(int width, int height); + + /** + * Gets list of all resolution variants including the base image + * + * @return list of resolution variants. + * @since JDK1.8 + */ + public List<Image> getResolutionVariants(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.awt.image; + +import java.awt.Image; +import java.awt.image.ImageObserver; +import java.util.Arrays; +import java.util.List; +import sun.misc.SoftCache; + +public class MultiResolutionToolkitImage extends ToolkitImage implements MultiResolutionImage { + + Image resolutionVariant; + + public MultiResolutionToolkitImage(Image lowResolutionImage, Image resolutionVariant) { + super(lowResolutionImage.getSource()); + this.resolutionVariant = resolutionVariant; + } + + @Override + public Image getResolutionVariant(int width, int height) { + return ((width <= getWidth() && height <= getHeight())) + ? this : resolutionVariant; + } + + public Image getResolutionVariant() { + return resolutionVariant; + } + + @Override + public List<Image> getResolutionVariants() { + return Arrays.<Image>asList(this, resolutionVariant); + } + + private static final int BITS_INFO = ImageObserver.SOMEBITS + | ImageObserver.FRAMEBITS | ImageObserver.ALLBITS; + + private static class ObserverCache { + + static final SoftCache INSTANCE = new SoftCache(); + } + + public static ImageObserver getResolutionVariantObserver( + final Image image, final ImageObserver observer, + final int imgWidth, final int imgHeight, + final int rvWidth, final int rvHeight) { + + if (observer == null) { + return null; + } + + synchronized (ObserverCache.INSTANCE) { + ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(image); + + if (o == null) { + + o = new ImageObserver() { + @Override + public boolean imageUpdate(Image resolutionVariant, int flags, + int x, int y, int width, int height) { + + if ((flags & (ImageObserver.WIDTH | BITS_INFO)) != 0) { + width = (width + 1) / 2; + } + + if ((flags & (ImageObserver.HEIGHT | BITS_INFO)) != 0) { + height = (height + 1) / 2; + } + + if ((flags & BITS_INFO) != 0) { + x /= 2; + y /= 2; + } + + return observer.imageUpdate( + image, flags, x, y, width, height); + } + }; + + ObserverCache.INSTANCE.put(image, o); + } + return o; + } + } +}
--- a/src/share/classes/sun/awt/resources/awt_sv.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/awt/resources/awt_sv.properties Fri Jul 14 00:56:29 2017 +0100 @@ -19,14 +19,14 @@ AWT.pause=Paus AWT.capsLock=Caps Lock AWT.escape=Esc -AWT.space=Mellanslag +AWT.space=Blanksteg AWT.pgup=Sida upp AWT.pgdn=Sida ned AWT.end=End AWT.home=Hem AWT.left=V\u00E4nster AWT.up=Upp -AWT.right=H\u00F6gerpil +AWT.right=H\u00F6ger AWT.down=Nedpil AWT.begin=Begin AWT.comma=Kommatecken
--- a/src/share/classes/sun/java2d/SunGraphics2D.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/java2d/SunGraphics2D.java Fri Jul 14 00:56:29 2017 +0100 @@ -61,6 +61,7 @@ import java.awt.Rectangle; import java.text.AttributedCharacterIterator; import java.awt.Font; +import java.awt.Point; import java.awt.image.ImageObserver; import java.awt.Transparency; import java.awt.font.GlyphVector; @@ -92,6 +93,14 @@ import java.util.Iterator; import sun.misc.PerformanceLogger; +import sun.awt.image.MultiResolutionImage; + +import static java.awt.geom.AffineTransform.TYPE_FLIP; +import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE; +import static java.awt.geom.AffineTransform.TYPE_TRANSLATION; +import sun.awt.image.MultiResolutionToolkitImage; +import sun.awt.image.ToolkitImage; + /** * This is a the master Graphics2D superclass for all of the Sun * Graphics implementations. This class relies on subclasses to @@ -212,6 +221,7 @@ protected Region devClip; // Actual physical drawable in pixels private final int devScale; // Actual physical scale factor + private int resolutionVariantHint; // cached state for text rendering private boolean validFontInfo; @@ -249,6 +259,7 @@ lcdTextContrast = lcdTextContrastDefaultValue; interpolationHint = -1; strokeHint = SunHints.INTVAL_STROKE_DEFAULT; + resolutionVariantHint = SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT; interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR; @@ -1224,6 +1235,10 @@ stateChanged = (strokeHint != newHint); strokeHint = newHint; break; + case SunHints.INTKEY_RESOLUTION_VARIANT: + stateChanged = (resolutionVariantHint != newHint); + resolutionVariantHint = newHint; + break; default: recognized = false; stateChanged = false; @@ -1297,6 +1312,9 @@ case SunHints.INTKEY_STROKE_CONTROL: return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL, strokeHint); + case SunHints.INTKEY_RESOLUTION_VARIANT: + return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT, + resolutionVariantHint); } return null; } @@ -3027,18 +3045,58 @@ } // end of text rendering methods - private static boolean isHiDPIImage(final Image img) { - return SurfaceManager.getImageScale(img) != 1; + private boolean isHiDPIImage(final Image img) { + return (SurfaceManager.getImageScale(img) != 1) || + (resolutionVariantHint != SunHints.INTVAL_RESOLUTION_VARIANT_OFF + && img instanceof MultiResolutionImage); } private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) { - final int scale = SurfaceManager.getImageScale(img); - sx1 = Region.clipScale(sx1, scale); - sx2 = Region.clipScale(sx2, scale); - sy1 = Region.clipScale(sy1, scale); - sy2 = Region.clipScale(sy2, scale); + + if (SurfaceManager.getImageScale(img) != 1) { // Volatile Image + final int scale = SurfaceManager.getImageScale(img); + sx1 = Region.clipScale(sx1, scale); + sx2 = Region.clipScale(sx2, scale); + sy1 = Region.clipScale(sy1, scale); + sy2 = Region.clipScale(sy2, scale); + } else if (img instanceof MultiResolutionImage) { + // get scaled destination image size + + int width = img.getWidth(observer); + int height = img.getHeight(observer); + + Image resolutionVariant = getResolutionVariant( + (MultiResolutionImage) img, width, height, + dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2); + + if (resolutionVariant != img && resolutionVariant != null) { + // recalculate source region for the resolution variant + + ImageObserver rvObserver = MultiResolutionToolkitImage. + getResolutionVariantObserver(img, observer, + width, height, -1, -1); + + int rvWidth = resolutionVariant.getWidth(rvObserver); + int rvHeight = resolutionVariant.getHeight(rvObserver); + + if (0 < width && 0 < height && 0 < rvWidth && 0 < rvHeight) { + + float widthScale = ((float) rvWidth) / width; + float heightScale = ((float) rvHeight) / height; + + sx1 = Region.clipScale(sx1, widthScale); + sy1 = Region.clipScale(sy1, heightScale); + sx2 = Region.clipScale(sx2, widthScale); + sy2 = Region.clipScale(sy2, heightScale); + + observer = rvObserver; + img = resolutionVariant; + } + } + } + try { return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer); @@ -3058,6 +3116,54 @@ } } + private Image getResolutionVariant(MultiResolutionImage img, + int srcWidth, int srcHeight, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2) { + + if (srcWidth <= 0 || srcHeight <= 0) { + return null; + } + + int sw = sx2 - sx1; + int sh = sy2 - sy1; + + if (sw == 0 || sh == 0) { + return null; + } + + int type = transform.getType(); + int dw = dx2 - dx1; + int dh = dy2 - dy1; + double destRegionWidth; + double destRegionHeight; + + if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) { + destRegionWidth = dw; + destRegionHeight = dh; + } else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) { + destRegionWidth = dw * transform.getScaleX(); + destRegionHeight = dh * transform.getScaleY(); + } else { + destRegionWidth = dw * Math.hypot( + transform.getScaleX(), transform.getShearY()); + destRegionHeight = dh * Math.hypot( + transform.getShearX(), transform.getScaleY()); + } + + int destImageWidth = (int) Math.abs(srcWidth * destRegionWidth / sw); + int destImageHeight = (int) Math.abs(srcHeight * destRegionHeight / sh); + + Image resolutionVariant + = img.getResolutionVariant(destImageWidth, destImageHeight); + + if (resolutionVariant instanceof ToolkitImage + && ((ToolkitImage) resolutionVariant).hasError()) { + return null; + } + + return resolutionVariant; + } + /** * Draws an image scaled to x,y,w,h in nonblocking mode with a * callback object.
--- a/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties Fri Jul 14 00:56:29 2017 +0100 @@ -40,7 +40,7 @@ java.launcher.X.usage=\ -Xmixed execu\u00E7\u00E3o no modo misto (padr\u00E3o)\n -Xint execu\u00E7\u00E3o somente no modo interpretado\n -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n -Xdiag mostra mensagens de diagn\u00F3stico adicionais\n -Xnoclassgc desativa a coleta de lixo da classe\n -Xincgc ativa a coleta de lixo incremental\n -Xloggc:<arquivo> registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n -Xbatch desativa a compila\u00E7\u00E3o em segundo plano\n -Xms<tamanho> define o tamanho inicial do heap Java\n -Xmx<tamanho> define o tamanho m\u00E1ximo do heap Java\n -Xss<tamanho> define o tamanho da pilha de threads java\n -Xprof produz dados de perfil da cpu\n -Xfuture ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor padr\u00E3o futuro\n -Xrs reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n -Xcheck:jni executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n -Xshare:off n\u00E3o tenta usar dados da classe compartilhada\n -Xshare:auto se poss\u00EDvel, usa dados da classe compartilhada (padr\u00E3o)\n -Xshare:on requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n -XshowSettings mostra todas as defini\u00E7\u00F5es e continua\n -XshowSettings:all\n mostra todas as defini\u00E7\u00F5es e continua\n -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n -XshowSettings:properties\n mostra todas as defini\u00E7\u00F5es da propriedade e continua\n -XshowSettings:locale\n mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n # Translators please note do not translate the options themselves -java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n -XstartOnFirstThread\n executa o m\u00E9todo main() no primeiro thread (AppKit)\n -Xdock:name=<nome da aplica\u00E7\u00E3o>"\n substitui o nome da aplica\u00E7\u00E3o padr\u00E3o exibido no encaixe\n -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n substitui o \u00EDcone exibido no encaixe\n\n +java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n -XstartOnFirstThread\n executa o m\u00E9todo main() no primeiro thread (AppKit)\n -Xdock:name=<nome do aplicativo>"\n substitui o nome do aplicativo padr\u00E3o exibido no encaixe\n -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n substitui o \u00EDcone exibido no encaixe\n\n java.launcher.cls.error1=Erro: N\u00E3o foi poss\u00EDvel localizar nem carregar a classe principal {0} java.launcher.cls.error2=Erro: o m\u00E9todo main n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo main como:\n public static void main(String[] args)
--- a/src/share/classes/sun/misc/Launcher.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/misc/Launcher.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, 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 @@ -28,11 +28,7 @@ import java.io.File; import java.io.IOException; import java.io.FilePermission; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.MalformedURLException; -import java.net.URLStreamHandler; -import java.net.URLStreamHandlerFactory; +import java.net.*; import java.util.HashSet; import java.util.StringTokenizer; import java.util.Set; @@ -211,8 +207,16 @@ URL[] urls = super.getURLs(); File prevDir = null; for (int i = 0; i < urls.length; i++) { - // Get the ext directory from the URL - File dir = new File(urls[i].getPath()).getParentFile(); + // Get the ext directory from the URL; convert to + // URI first, so the URL will be decoded. + URI uri; + try { + uri = urls[i].toURI(); + } catch (URISyntaxException ue) { + // skip this URL if cannot convert it to URI + continue; + } + File dir = new File(uri).getParentFile(); if (dir != null && !dir.equals(prevDir)) { // Look in architecture-specific subdirectory first // Read from the saved system properties to avoid deadlock
--- a/src/share/classes/sun/net/ftp/impl/FtpClient.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/net/ftp/impl/FtpClient.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, 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 @@ -518,7 +518,8 @@ * @return <code>true</code> if the command was successful * @throws IOException */ - private boolean issueCommand(String cmd) throws IOException { + private boolean issueCommand(String cmd) throws IOException, + sun.net.ftp.FtpProtocolException { if (!isConnected()) { throw new IllegalStateException("Not connected"); } @@ -529,6 +530,12 @@ // ignore... } } + if (cmd.indexOf('\n') != -1) { + sun.net.ftp.FtpProtocolException ex + = new sun.net.ftp.FtpProtocolException("Illegal FTP command"); + ex.initCause(new IllegalArgumentException("Illegal carriage return")); + throw ex; + } sendServer(cmd + "\r\n"); return readReply(); } @@ -1121,7 +1128,10 @@ */ public void close() throws IOException { if (isConnected()) { - issueCommand("QUIT"); + try { + issueCommand("QUIT"); + } catch (FtpProtocolException e) { + } loggedIn = false; } disconnect(); @@ -1899,7 +1909,8 @@ return null; } - private boolean sendSecurityData(byte[] buf) throws IOException { + private boolean sendSecurityData(byte[] buf) throws IOException, + sun.net.ftp.FtpProtocolException { BASE64Encoder encoder = new BASE64Encoder(); String s = encoder.encode(buf); return issueCommand("ADAT " + s);
--- a/src/share/classes/sun/net/smtp/SmtpClient.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/net/smtp/SmtpClient.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, 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,7 @@ public class SmtpClient extends TransferProtocolClient { + private static int DEFAULT_SMTP_PORT = 25; String mailhost; SmtpPrintStream message; @@ -74,6 +75,10 @@ } public void to(String s) throws IOException { + if (s.indexOf('\n') != -1) { + throw new IOException("Illegal SMTP command", + new IllegalArgumentException("Illegal carriage return")); + } int st = 0; int limit = s.length(); int pos = 0; @@ -116,16 +121,21 @@ } public void from(String s) throws IOException { - if (s.startsWith("<")) + if (s.indexOf('\n') != -1) { + throw new IOException("Illegal SMTP command", + new IllegalArgumentException("Illegal carriage return")); + } + if (s.startsWith("<")) { issueCommand("mail from: " + s + "\r\n", 250); - else + } else { issueCommand("mail from: <" + s + ">\r\n", 250); + } } /** open a SMTP connection to host <i>host</i>. */ private void openServer(String host) throws IOException { mailhost = host; - openServer(mailhost, 25); + openServer(mailhost, DEFAULT_SMTP_PORT); issueCommand("helo "+InetAddress.getLocalHost().getHostName()+"\r\n", 250); }
--- a/src/share/classes/sun/net/www/http/HttpClient.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/net/www/http/HttpClient.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, 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,7 +98,20 @@ // from previous releases. private static boolean retryPostProp = true; + /* Value of the system property jdk.ntlm.cache; + if false, then NTLM connections will not be cached. + The default value is 'true'. */ + private static final boolean cacheNTLMProp; + /* Value of the system property jdk.spnego.cache; + if false, then connections authentified using the Negotiate/Kerberos + scheme will not be cached. + The default value is 'true'. */ + private static final boolean cacheSPNEGOProp; + volatile boolean keepingAlive = false; /* this is a keep-alive connection */ + volatile boolean disableKeepAlive;/* keep-alive has been disabled for this + connection - this will be used when + recomputing the value of keepingAlive */ int keepAliveConnections = -1; /* number of keep-alives left */ /**Idle timeout value, in milliseconds. Zero means infinity, @@ -149,6 +162,12 @@ String retryPost = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("sun.net.http.retryPost")); + String cacheNTLM = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("jdk.ntlm.cache")); + + String cacheSPNEGO = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("jdk.spnego.cache")); + if (keepAlive != null) { keepAliveProp = Boolean.valueOf(keepAlive).booleanValue(); } else { @@ -157,9 +176,21 @@ if (retryPost != null) { retryPostProp = Boolean.valueOf(retryPost).booleanValue(); - } else - retryPostProp = true; + } else { + retryPostProp = true; + } + if (cacheNTLM != null) { + cacheNTLMProp = Boolean.parseBoolean(cacheNTLM); + } else { + cacheNTLMProp = true; + } + + if (cacheSPNEGO != null) { + cacheSPNEGOProp = Boolean.parseBoolean(cacheSPNEGO); + } else { + cacheSPNEGOProp = true; + } } /** @@ -694,6 +725,7 @@ nread += r; } String keep=null; + String authenticate=null; ret = b[0] == 'H' && b[1] == 'T' && b[2] == 'T' && b[3] == 'P' && b[4] == '/' && b[5] == '1' && b[6] == '.'; @@ -722,17 +754,44 @@ */ if (usingProxy) { // not likely a proxy will return this keep = responses.findValue("Proxy-Connection"); + authenticate = responses.findValue("Proxy-Authenticate"); } if (keep == null) { keep = responses.findValue("Connection"); + authenticate = responses.findValue("WWW-Authenticate"); } + + // 'disableKeepAlive' starts with the value false. + // It can transition from false to true, but once true + // it stays true. + // If cacheNTLMProp is false, and disableKeepAlive is false, + // then we need to examine the response headers to figure out + // whether we are doing NTLM authentication. If we do NTLM, + // and cacheNTLMProp is false, than we can't keep this connection + // alive: we will switch disableKeepAlive to true. + boolean canKeepAlive = !disableKeepAlive; + if (canKeepAlive && (cacheNTLMProp == false || cacheSPNEGOProp == false) + && authenticate != null) { + authenticate = authenticate.toLowerCase(Locale.US); + if (cacheNTLMProp == false) { + canKeepAlive &= !authenticate.startsWith("ntlm "); + } + if (cacheSPNEGOProp == false) { + canKeepAlive &= !authenticate.startsWith("negotiate "); + canKeepAlive &= !authenticate.startsWith("kerberos "); + } + } + disableKeepAlive |= !canKeepAlive; + if (keep != null && keep.toLowerCase(Locale.US).equals("keep-alive")) { /* some servers, notably Apache1.1, send something like: * "Keep-Alive: timeout=15, max=1" which we should respect. */ - HeaderParser p = new HeaderParser( + if (disableKeepAlive) { + keepAliveConnections = 1; + } else { + HeaderParser p = new HeaderParser( responses.findValue("Keep-Alive")); - if (p != null) { /* default should be larger in case of proxy */ keepAliveConnections = p.findInt("max", usingProxy?50:5); keepAliveTimeout = p.findInt("timeout", usingProxy?60:5); @@ -742,7 +801,7 @@ * We're talking 1.1 or later. Keep persistent until * the server says to close. */ - if (keep != null) { + if (keep != null || disableKeepAlive) { /* * The only Connection token we understand is close. * Paranoia: if there is any Connection header then @@ -824,7 +883,7 @@ keepAliveConnections = 1; keepingAlive = false; } else { - keepingAlive = true; + keepingAlive = !disableKeepAlive; } failedOnce = false; } else { @@ -857,7 +916,7 @@ (cl >= 0 || code == HttpURLConnection.HTTP_NOT_MODIFIED || code == HttpURLConnection.HTTP_NO_CONTENT)) { - keepingAlive = true; + keepingAlive = !disableKeepAlive; failedOnce = false; } else if (keepingAlive) { /* Previously we were keeping alive, and now we're not. Remove @@ -879,7 +938,11 @@ pi.setContentType(responses.findValue("content-type")); } - if (isKeepingAlive()) { + // If disableKeepAlive == true, the client will not be returned + // to the cache. But we still need to use a keepalive stream to + // allow the multi-message authentication exchange on the connection + boolean useKeepAliveStream = isKeepingAlive() || disableKeepAlive; + if (useKeepAliveStream) { // Wrap KeepAliveStream if keep alive is enabled. logFinest("KeepAlive stream used: " + url); serverInput = new KeepAliveStream(serverInput, pi, cl, this);
--- a/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2016, 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 @@ -298,6 +298,13 @@ // Just keep throwing for now. throw e; } catch (FtpProtocolException fe) { + if (ftp != null) { + try { + ftp.close(); + } catch (IOException ioe) { + fe.addSuppressed(ioe); + } + } throw new IOException(fe); } try { @@ -480,11 +487,34 @@ msgh.add("content-type", "text/plain"); msgh.add("access-type", "directory"); } catch (IOException ex) { - throw new FileNotFoundException(fullpath); + FileNotFoundException fnfe = new FileNotFoundException(fullpath); + if (ftp != null) { + try { + ftp.close(); + } catch (IOException ioe) { + fnfe.addSuppressed(ioe); + } + } + throw fnfe; } catch (FtpProtocolException ex2) { - throw new FileNotFoundException(fullpath); + FileNotFoundException fnfe = new FileNotFoundException(fullpath); + if (ftp != null) { + try { + ftp.close(); + } catch (IOException ioe) { + fnfe.addSuppressed(ioe); + } + } + throw fnfe; } } catch (FtpProtocolException ftpe) { + if (ftp != null) { + try { + ftp.close(); + } catch (IOException ioe) { + ftpe.addSuppressed(ioe); + } + } throw new IOException(ftpe); } setProperties(msgh);
--- a/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2016, 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 @@ -62,8 +62,7 @@ * repeatedly, via the Authenticator. Default is false, which means that this * behavior is switched off. */ - static boolean serializeAuth; - + static final boolean serializeAuth; static { serializeAuth = java.security.AccessController.doPrivileged( new sun.security.action.GetBooleanAction( @@ -103,6 +102,16 @@ public String getProtocolScheme() { return protocol; } + /** + * Whether we should cache this instance in the AuthCache. + * This method returns {@code true} by default. + * Subclasses may override this method to add + * additional restrictions. + * @return {@code true} by default. + */ + protected boolean useAuthCache() { + return true; + } /** * requests is used to ensure that interaction with the @@ -339,9 +348,11 @@ */ void addToCache() { String key = cacheKey(true); - cache.put(key, this); - if (supportsPreemptiveAuthorization()) { - cache.put(cacheKey(false), this); + if (useAuthCache()) { + cache.put(key, this); + if (supportsPreemptiveAuthorization()) { + cache.put(cacheKey(false), this); + } } endAuthRequest(key); }
--- a/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import sun.util.logging.PlatformLogger; import static sun.net.www.protocol.http.AuthScheme.NEGOTIATE; import static sun.net.www.protocol.http.AuthScheme.KERBEROS; +import sun.security.action.GetPropertyAction; /** * NegotiateAuthentication: @@ -53,10 +54,18 @@ // These maps are used to manage the GSS availability for diffrent // hosts. The key for both maps is the host name. // <code>supported</code> is set when isSupported is checked, + // if it's true, a cached Negotiator is put into <code>cache</code>. // the cache can be used only once, so after the first use, it's cleaned. static HashMap <String, Boolean> supported = null; - static HashMap <String, Negotiator> cache = null; + static ThreadLocal <HashMap <String, Negotiator>> cache = null; + /* Whether cache is enabled for Negotiate/Kerberos */ + private static final boolean cacheSPNEGO; + static { + String spnegoCacheProp = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("jdk.spnego.cache", "true")); + cacheSPNEGO = Boolean.parseBoolean(spnegoCacheProp); + } // The HTTP Negotiate Helper private Negotiator negotiator = null; @@ -119,8 +128,7 @@ */ private static synchronized boolean isSupportedImpl(HttpCallerInfo hci) { if (supported == null) { - supported = new HashMap <String, Boolean>(); - cache = new HashMap <String, Negotiator>(); + supported = new HashMap<>(); } String hostname = hci.host; hostname = hostname.toLowerCase(); @@ -133,7 +141,15 @@ supported.put(hostname, true); // the only place cache.put is called. here we can make sure // the object is valid and the oneToken inside is not null - cache.put(hostname, neg); + if (cache == null) { + cache = new ThreadLocal<HashMap<String, Negotiator>>() { + @Override + protected HashMap<String, Negotiator> initialValue() { + return new HashMap<>(); + } + }; + } + cache.get().put(hostname, neg); return true; } else { supported.put(hostname, false); @@ -141,6 +157,16 @@ } } + private static synchronized HashMap<String, Negotiator> getCache() { + if (cache == null) return null; + return cache.get(); + } + + @Override + protected boolean useAuthCache() { + return super.useAuthCache() && cacheSPNEGO; + } + /** * Not supported. Must use the setHeaders() method */ @@ -198,12 +224,11 @@ */ private byte[] firstToken() throws IOException { negotiator = null; - if (cache != null) { - synchronized(cache) { - negotiator = cache.get(getHost()); - if (negotiator != null) { - cache.remove(getHost()); // so that it is only used once - } + HashMap <String, Negotiator> cachedMap = getCache(); + if (cachedMap != null) { + negotiator = cachedMap.get(getHost()); + if (negotiator != null) { + cachedMap.remove(getHost()); // so that it is only used once } } if (negotiator == null) {
--- a/src/share/classes/sun/security/smartcardio/TerminalImpl.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/smartcardio/TerminalImpl.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -75,10 +75,10 @@ } } try { - card = new CardImpl(this, protocol); + card = new CardImpl(this, protocol); return card; } catch (PCSCException e) { - if (e.code == SCARD_W_REMOVED_CARD) { + if (e.code == SCARD_W_REMOVED_CARD || e.code == SCARD_E_NO_SMARTCARD) { throw new CardNotPresentException("No card present", e); } else { throw new CardException("connect() failed", e);
--- a/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -134,15 +134,15 @@ " X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}, {"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"}, {".Signature.related.entries.","(\u7F72\u540D\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"}, - {".Unsigned.entries.", "(\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA)"}, + {".Unsigned.entries.", "(\u7F72\u540D\u306A\u3057\u306E\u30A8\u30F3\u30C8\u30EA)"}, {"jar.is.unsigned", "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}, {"jar.treated.unsigned", - "\u8B66\u544A: \u7F72\u540D\u304C\u69CB\u6587\u89E3\u6790\u3067\u304D\u306A\u3044\u304B\u691C\u8A3C\u3067\u304D\u306A\u3044\u305F\u3081\u3001\u3053\u306Ejar\u306F\u672A\u7F72\u540D\u3068\u3057\u3066\u6271\u308F\u308C\u307E\u3059\u3002\u8A73\u7D30\u306F\u3001\u30C7\u30D0\u30C3\u30B0\u3092\u6709\u52B9\u306B\u3057\u3066(-J-Djava.security.debug=jar) jarsigner\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, + "\u8B66\u544A: \u7F72\u540D\u304C\u69CB\u6587\u89E3\u6790\u3067\u304D\u306A\u3044\u304B\u691C\u8A3C\u3067\u304D\u306A\u3044\u305F\u3081\u3001\u3053\u306Ejar\u306F\u7F72\u540D\u306A\u3057\u3068\u3057\u3066\u6271\u308F\u308C\u307E\u3059\u3002\u8A73\u7D30\u306F\u3001\u30C7\u30D0\u30C3\u30B0\u3092\u6709\u52B9\u306B\u3057\u3066(-J-Djava.security.debug=jar) jarsigner\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, {"jar.treated.unsigned.see.weak", - "\u3053\u306Ejar\u306F\u3001\u73FE\u5728\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u5F31\u3044\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u672A\u7F72\u540D\u3068\u3057\u3066\u6271\u308F\u308C\u307E\u3059\u3002\n\n\u8A73\u7D30\u306F\u3001-verbose\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066jarsigner\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, + "\u3053\u306Ejar\u306F\u3001\u73FE\u5728\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u5F31\u3044\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u7F72\u540D\u306A\u3057\u3068\u3057\u3066\u6271\u308F\u308C\u307E\u3059\u3002\n\n\u8A73\u7D30\u306F\u3001-verbose\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066jarsigner\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, {"jar.treated.unsigned.see.weak.verbose", - "\u8B66\u544A: \u3053\u306Ejar\u306F\u3001\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u3088\u3063\u3066\u73FE\u5728\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u5F31\u3044\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u672A\u7F72\u540D\u3068\u3057\u3066\u6271\u308F\u308C\u307E\u3059:"}, + "\u8B66\u544A: \u3053\u306Ejar\u306F\u3001\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u3088\u3063\u3066\u73FE\u5728\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u5F31\u3044\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u7F72\u540D\u306A\u3057\u3068\u3057\u3066\u6271\u308F\u308C\u307E\u3059:"}, {"jar.signed.", "jar\u306F\u7F72\u540D\u3055\u308C\u307E\u3057\u305F\u3002"}, {"jar.signed.with.signer.errors.", "jar\u306F\u7F72\u540D\u3055\u308C\u307E\u3057\u305F - \u7F72\u540D\u8005\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059\u3002"}, {"jar.verified.", "jar\u306F\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F\u3002"}, @@ -215,7 +215,7 @@ {"Warning.", "\u8B66\u544A: "}, {"Error.", "\u30A8\u30E9\u30FC: "}, {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.", - "\u3053\u306Ejar\u306B\u306F\u3001\u6574\u5408\u6027\u30C1\u30A7\u30C3\u30AF\u3092\u3057\u3066\u3044\u306A\u3044\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "}, + "\u3053\u306Ejar\u306B\u306F\u3001\u6574\u5408\u6027\u30C1\u30A7\u30C3\u30AF\u3092\u3057\u3066\u3044\u306A\u3044\u7F72\u540D\u306A\u3057\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "}, {"This.jar.contains.entries.whose.signer.certificate.has.expired.", "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C\u671F\u9650\u5207\u308C\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "}, {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
--- a/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -142,7 +142,7 @@ {"jar.treated.unsigned.see.weak", "\u7531\u4E8E\u8BE5 jar \u662F\u4F7F\u7528\u76EE\u524D\u5DF2\u7981\u7528\u7684\u5F31\u7B97\u6CD5\u7B7E\u540D\u7684, \u56E0\u6B64\u8BE5 jar \u5C06\u88AB\u89C6\u4E3A\u672A\u7B7E\u540D\u3002\n\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u4F7F\u7528 -verbose \u9009\u9879\u91CD\u65B0\u8FD0\u884C jarsigner\u3002"}, {"jar.treated.unsigned.see.weak.verbose", - "\u8B66\u544A: \u7531\u4E8E\u8BE5 jar \u662F\u4F7F\u7528\u76EE\u524D\u5DF2\u7531\u5B89\u5168\u5C5E\u6027\u7981\u7528\u7684\u5F31\u7B97\u6CD5\u7B7E\u540D\u7684, \u56E0\u6B64\u8BE5 jar \u5C06\u88AB\u89C6\u4E3A\u672A\u7B7E\u540D:"}, + "\u8B66\u544A: \u8BE5 jar \u5C06\u88AB\u89C6\u4E3A\u672A\u7B7E\u540D, \u56E0\u4E3A\u5B83\u662F\u7531\u76EE\u524D\u5B89\u5168\u5C5E\u6027\u7981\u7528\u7684\u5F31\u7B97\u6CD5\u7B7E\u540D\u7684:"}, {"jar.signed.", "jar \u5DF2\u7B7E\u540D\u3002"}, {"jar.signed.with.signer.errors.", "jar \u5DF2\u7B7E\u540D, \u4F46\u51FA\u73B0\u7B7E\u540D\u8005\u9519\u8BEF\u3002"}, {"jar.verified.", "jar \u5DF2\u9A8C\u8BC1\u3002"},
--- a/src/share/classes/sun/security/tools/keytool/Resources_sv.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/keytool/Resources_sv.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, 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 @@ -175,7 +175,7 @@ {"validity.number.of.days", "antal dagar f\u00F6r giltighet"}, //-validity {"Serial.ID.of.cert.to.revoke", - "Seriellt ID f\u00F6r certifikat som ska \u00E5terkallas"}, //-id + "Seriellt id f\u00F6r certifikat som ska \u00E5terkallas"}, //-id // keytool: Running part {"keytool.error.", "nyckelverktygsfel: "}, {"Illegal.option.", "Otill\u00E5tet alternativ: "}, @@ -371,7 +371,7 @@ "***************** WARNING WARNING WARNING *****************"}, {"Signer.d.", "Signerare #%d:"}, {"Timestamp.", "Tidsst\u00E4mpel:"}, - {"Signature.", "Underskrift:"}, + {"Signature.", "Signatur:"}, {"CRLs.", "CRL:er:"}, {"Certificate.owner.", "Certifikat\u00E4gare: "}, {"Not.a.signed.jar.file", "Ingen signerad jar-fil"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_de.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_de.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "Verwendung: policytool [Optionen]"}, {".file.file.policy.file.location", " [-file <Datei>] Policy-Dateiverzeichnis"}, - {"New", "Neu"}, - {"Open", "\u00D6ffnen"}, - {"Save", "Speichern"}, - {"Save.As", "Speichern unter"}, - {"View.Warning.Log", "Warnungslog anzeigen"}, - {"Exit", "Beenden"}, - {"Add.Policy.Entry", "Policy-Eintrag hinzuf\u00FCgen"}, - {"Edit.Policy.Entry", "Policy-Eintrag bearbeiten"}, - {"Remove.Policy.Entry", "Policy-Eintrag entfernen"}, - {"Edit", "Bearbeiten"}, + {"New", "&Neu"}, + {"Open", "&\u00D6ffnen..."}, + {"Save", "&Speichern"}, + {"Save.As", "Speichern &unter..."}, + {"View.Warning.Log", "&Warnungslog anzeigen"}, + {"Exit", "B&eenden"}, + {"Add.Policy.Entry", "Policy-Eintrag &hinzuf\u00FCgen"}, + {"Edit.Policy.Entry", "Policy-Eintrag &bearbeiten"}, + {"Remove.Policy.Entry", "Policy-Eintrag &entfernen"}, + {"Edit", "&Bearbeiten"}, {"Retain", "Beibehalten"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "Public Key-Alias hinzuf\u00FCgen"}, {"Remove.Public.Key.Alias", "Public Key-Alias entfernen"}, - {"File", "Datei"}, - {"KeyStore", "KeyStore"}, + {"File", "&Datei"}, + {"KeyStore", "&KeyStore"}, {"Policy.File.", "Policy-Datei:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "Policy-Datei konnte nicht ge\u00F6ffnet werden: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "Vorhandene Datei {0} \u00FCberschreiben?"}, {"Cancel", "Abbrechen"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "Principal hinzuf\u00FCgen"}, - {"Edit.Principal", "Principal bearbeiten"}, - {"Remove.Principal", "Principal entfernen"}, - {"Principals.", "Principals:"}, - {".Add.Permission", " Berechtigung hinzuf\u00FCgen"}, - {".Edit.Permission", " Berechtigung bearbeiten"}, - {"Remove.Permission", "Berechtigung entfernen"}, + {"CodeBase.", "&CodeBase:"}, + {"SignedBy.", "&SignedBy:"}, + {"Add.Principal", "Principal &hinzuf\u00FCgen"}, + {"Edit.Principal", "Principal &bearbeiten"}, + {"Remove.Principal", "Principal ent&fernen"}, + {"Principals.", "&Principals:"}, + {".Add.Permission", " B&erechtigung hinzuf\u00FCgen"}, + {".Edit.Permission", " Be&rechtigung bearbeiten"}, + {"Remove.Permission", "Berec&htigung entfernen"}, {"Done", "Fertig"}, - {"KeyStore.URL.", "KeyStore-URL:"}, - {"KeyStore.Type.", "KeyStore-Typ:"}, - {"KeyStore.Provider.", "KeyStore-Provider:"}, - {"KeyStore.Password.URL.", "KeyStore-Kennwort-URL:"}, + {"KeyStore.URL.", "KeyStore-&URL:"}, + {"KeyStore.Type.", "KeyStore-&Typ:"}, + {"KeyStore.Provider.", "KeyStore-&Provider:"}, + {"KeyStore.Password.URL.", "KeyStore-Kenn&wort-URL:"}, {"Principals", "Principals"}, {".Edit.Principal.", " Principal bearbeiten:"}, {".Add.New.Principal.", " Neuen Principal hinzuf\u00FCgen:"}, @@ -117,8 +117,8 @@ "Policy erfolgreich in {0} geschrieben"}, {"null.filename", "Null-Dateiname"}, {"Save.changes.", "\u00C4nderungen speichern?"}, - {"Yes", "Ja"}, - {"No", "Nein"}, + {"Yes", "&Ja"}, + {"No", "&Nein"}, {"Policy.Entry", "Policy-Eintrag"}, {"Save.Changes", "\u00C4nderungen speichern"}, {"No.Policy.Entry.selected", "Kein Policy-Eintrag ausgew\u00E4hlt"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_es.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_es.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "Sintaxis: policytool [opciones]"}, {".file.file.policy.file.location", " [-file <archivo>] ubicaci\u00F3n del archivo de normas"}, - {"New", "Nuevo"}, - {"Open", "Abrir"}, - {"Save", "Guardar"}, - {"Save.As", "Guardar como"}, - {"View.Warning.Log", "Ver Log de Advertencias"}, - {"Exit", "Salir"}, - {"Add.Policy.Entry", "Agregar Entrada de Pol\u00EDtica"}, - {"Edit.Policy.Entry", "Editar Entrada de Pol\u00EDtica"}, - {"Remove.Policy.Entry", "Eliminar Entrada de Pol\u00EDtica"}, - {"Edit", "Editar"}, + {"New", "&Nueva"}, + {"Open", "&Abrir..."}, + {"Save", "&Guardar"}, + {"Save.As", "Guardar &como..."}, + {"View.Warning.Log", "Ver &log de advertencias"}, + {"Exit", "&Salir"}, + {"Add.Policy.Entry", "Agregar &entrada de pol\u00EDtica"}, + {"Edit.Policy.Entry", "E&ditar entrada de pol\u00EDtica"}, + {"Remove.Policy.Entry", "&Eliminar entrada de pol\u00EDtica"}, + {"Edit", "&Editar"}, {"Retain", "Mantener"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "Agregar Alias de Clave P\u00FAblico"}, {"Remove.Public.Key.Alias", "Eliminar Alias de Clave P\u00FAblico"}, - {"File", "Archivo"}, - {"KeyStore", "Almac\u00E9n de Claves"}, + {"File", "&Archivo"}, + {"KeyStore", "Al&mac\u00E9n de claves"}, {"Policy.File.", "Archivo de Pol\u00EDtica:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "No se ha podido abrir el archivo de pol\u00EDtica: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "\u00BFSobrescribir el archivo existente {0}?"}, {"Cancel", "Cancelar"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "Agregar Principal"}, - {"Edit.Principal", "Editar Principal"}, - {"Remove.Principal", "Eliminar Principal"}, - {"Principals.", "Principales:"}, - {".Add.Permission", " Agregar Permiso"}, - {".Edit.Permission", " Editar Permiso"}, - {"Remove.Permission", "Eliminar Permiso"}, + {"CodeBase.", "&CodeBase:"}, + {"SignedBy.", "&SignedBy:"}, + {"Add.Principal", "&Agregar principal"}, + {"Edit.Principal", "&Editar principal"}, + {"Remove.Principal", "Elimina&r principal"}, + {"Principals.", "&Principales:"}, + {".Add.Permission", "A&gregar permiso"}, + {".Edit.Permission", "Ed&itar permiso"}, + {"Remove.Permission", "Eli&minar permiso"}, {"Done", "Listo"}, - {"KeyStore.URL.", "URL de Almac\u00E9n de Claves:"}, - {"KeyStore.Type.", "Tipo de Almac\u00E9n de Claves:"}, - {"KeyStore.Provider.", "Proveedor de Almac\u00E9n de Claves:"}, - {"KeyStore.Password.URL.", "URL de Contrase\u00F1a de Almac\u00E9n de Claves:"}, + {"KeyStore.URL.", "&URL de almac\u00E9n de claves:"}, + {"KeyStore.Type.", "&Tipo de almac\u00E9n de claves:"}, + {"KeyStore.Provider.", "&Proveedor de almac\u00E9n de claves:"}, + {"KeyStore.Password.URL.", "URL de Contra&se\u00F1a de almac\u00E9n de claves:"}, {"Principals", "Principales"}, {".Edit.Principal.", " Editar Principal:"}, {".Add.New.Principal.", " Agregar Nuevo Principal:"}, @@ -117,8 +117,8 @@ "Pol\u00EDtica escrita correctamente en {0}"}, {"null.filename", "nombre de archivo nulo"}, {"Save.changes.", "\u00BFGuardar los cambios?"}, - {"Yes", "S\u00ED"}, - {"No", "No"}, + {"Yes", "&S\u00ED"}, + {"No", "&No"}, {"Policy.Entry", "Entrada de Pol\u00EDtica"}, {"Save.Changes", "Guardar Cambios"}, {"No.Policy.Entry.selected", "No se ha seleccionado la entrada de pol\u00EDtica"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_fr.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_fr.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,25 +44,25 @@ {"Usage.policytool.options.", "Syntaxe : policytool [options]"}, {".file.file.policy.file.location", " [-file <file>] emplacement du fichier de r\u00E8gles"}, - {"New", "Nouveau"}, - {"Open", "Ouvrir"}, - {"Save", "Enregistrer"}, - {"Save.As", "Enregistrer sous"}, - {"View.Warning.Log", "Afficher le journal des avertissements"}, - {"Exit", "Quitter"}, - {"Add.Policy.Entry", "Ajouter une r\u00E8gle"}, - {"Edit.Policy.Entry", "Modifier une r\u00E8gle"}, - {"Remove.Policy.Entry", "Enlever une r\u00E8gle"}, - {"Edit", "Modifier"}, + {"New", "&Nouveau"}, + {"Open", "&Ouvrir..."}, + {"Save", "Enregi&strer"}, + {"Save.As", "Enregistrer so&us..."}, + {"View.Warning.Log", "Affic&her le journal des avertissements"}, + {"Exit", "&Quitter"}, + {"Add.Policy.Entry", "&Ajouter une r\u00E8gle"}, + {"Edit.Policy.Entry", "Modifi&er une r\u00E8gle"}, + {"Remove.Policy.Entry", "Enlever une &r\u00E8gle"}, + {"Edit", "Modifi&er"}, {"Retain", "Conserver"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", - "Avertissement : il se peut que le nom de fichier contienne des barres obliques inverses avec caract\u00E8re d'\u00E9chappement. Il n'est pas n\u00E9cessaire d'ajouter un caract\u00E8re d'\u00E9chappement aux barres obliques inverses. (L'outil proc\u00E8de \u00E0 l'\u00E9chappement si n\u00E9cessaire lorsqu'il \u00E9crit le contenu des r\u00E8gles dans la zone de stockage persistant).\n\nCliquez sur Conserver pour garder le nom saisi ou sur Modifier pour le remplacer."}, + "Avertissement : il se peut que le nom de fichier contienne des barres obliques inverses avec caract\u00E8re d'\u00E9chappement. Il n'est pas n\u00E9cessaire d'ajouter un caract\u00E8re d'\u00E9chappement aux barres obliques inverses. L'outil proc\u00E8de \u00E0 l'\u00E9chappement si n\u00E9cessaire lorsqu'il \u00E9crit le contenu des r\u00E8gles dans la zone de stockage persistant.\n\nCliquez sur Conserver pour garder le nom saisi ou sur Modifier pour le remplacer."}, {"Add.Public.Key.Alias", "Ajouter un alias de cl\u00E9 publique"}, {"Remove.Public.Key.Alias", "Enlever un alias de cl\u00E9 publique"}, - {"File", "Fichier"}, - {"KeyStore", "Fichier de cl\u00E9s"}, + {"File", "&Fichier"}, + {"KeyStore", "Fichier &de cl\u00E9s"}, {"Policy.File.", "Fichier de r\u00E8gles :"}, {"Could.not.open.policy.file.policyFile.e.toString.", "Impossible d''ouvrir le fichier de r\u00E8gles\u00A0: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "Remplacer le fichier existant {0} ?"}, {"Cancel", "Annuler"}, - {"CodeBase.", "Base de code :"}, - {"SignedBy.", "Sign\u00E9 par :"}, - {"Add.Principal", "Ajouter un principal"}, - {"Edit.Principal", "Modifier un principal"}, - {"Remove.Principal", "Enlever un principal"}, - {"Principals.", "Principaux :"}, - {".Add.Permission", " Ajouter un droit"}, - {".Edit.Permission", " Modifier un droit"}, - {"Remove.Permission", "Enlever un droit"}, + {"CodeBase.", "Base de &code :"}, + {"SignedBy.", "&Sign\u00E9 par :"}, + {"Add.Principal", "&Ajouter un principal"}, + {"Edit.Principal", "Modifi&er un principal"}, + {"Remove.Principal", "Enleve&r un principal"}, + {"Principals.", "&Principaux :"}, + {".Add.Permission", " Ajouter un &droit"}, + {".Edit.Permission", " Mod&ifier un droit"}, + {"Remove.Permission", "Enlever un dr&oit"}, {"Done", "Termin\u00E9"}, - {"KeyStore.URL.", "URL du fichier de cl\u00E9s :"}, - {"KeyStore.Type.", "Type du fichier de cl\u00E9s :"}, - {"KeyStore.Provider.", "Fournisseur du fichier de cl\u00E9s :"}, - {"KeyStore.Password.URL.", "URL du mot de passe du fichier de cl\u00E9s :"}, + {"KeyStore.URL.", "&URL du fichier de cl\u00E9s :"}, + {"KeyStore.Type.", "&Type du fichier de cl\u00E9s :"}, + {"KeyStore.Provider.", "Four&nisseur du fichier de cl\u00E9s :"}, + {"KeyStore.Password.URL.", "UR&L du mot de passe du fichier de cl\u00E9s :"}, {"Principals", "Principaux"}, {".Edit.Principal.", " Modifier un principal :"}, {".Add.New.Principal.", " Ajouter un principal :"}, @@ -117,8 +117,8 @@ "R\u00E8gle \u00E9crite dans {0}"}, {"null.filename", "nom de fichier NULL"}, {"Save.changes.", "Enregistrer les modifications ?"}, - {"Yes", "Oui"}, - {"No", "Non"}, + {"Yes", "&Oui"}, + {"No", "&Non"}, {"Policy.Entry", "R\u00E8gle"}, {"Save.Changes", "Enregistrer les modifications"}, {"No.Policy.Entry.selected", "Aucune r\u00E8gle s\u00E9lectionn\u00E9e"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_it.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_it.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "Uso: policytool [opzioni]"}, {".file.file.policy.file.location", " [-file <file>] posizione del file dei criteri"}, - {"New", "Nuovo"}, - {"Open", "Apri"}, - {"Save", "Salva"}, - {"Save.As", "Salva con nome"}, - {"View.Warning.Log", "Visualizza registro avvertenze"}, - {"Exit", "Esci"}, - {"Add.Policy.Entry", "Aggiungi voce dei criteri"}, - {"Edit.Policy.Entry", "Modifica voce dei criteri"}, - {"Remove.Policy.Entry", "Rimuovi voce dei criteri"}, - {"Edit", "Modifica"}, + {"New", "&Nuovo"}, + {"Open", "&Apri..."}, + {"Save", "&Salva"}, + {"Save.As", "Sal&va con nome..."}, + {"View.Warning.Log", "Visuali&zza registro avvertenze"}, + {"Exit", "&Esci"}, + {"Add.Policy.Entry", "Aggi&ungi voce criteri"}, + {"Edit.Policy.Entry", "&Modifica voce criteri"}, + {"Remove.Policy.Entry", "&Rimuovi voce criteri"}, + {"Edit", "&Modifica"}, {"Retain", "Mantieni"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "Aggiungi alias chiave pubblica"}, {"Remove.Public.Key.Alias", "Rimuovi alias chiave pubblica"}, - {"File", "File"}, - {"KeyStore", "Keystore"}, + {"File", "&File"}, + {"KeyStore", "&Keystore"}, {"Policy.File.", "File dei criteri:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "Impossibile aprire il file di criteri {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "OK per sovrascrivere il file {0}?"}, {"Cancel", "Annulla"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "Aggiungi principal"}, - {"Edit.Principal", "Modifica principal"}, - {"Remove.Principal", "Rimuovi principal"}, - {"Principals.", "Principal:"}, - {".Add.Permission", " Aggiungi autorizzazione"}, - {".Edit.Permission", " Modifica autorizzazione"}, - {"Remove.Permission", "Rimuovi autorizzazione"}, + {"CodeBase.", "&CodeBase:"}, + {"SignedBy.", "&SignedBy:"}, + {"Add.Principal", "&Aggiungi principal"}, + {"Edit.Principal", "&Modifica principal"}, + {"Remove.Principal", "&Rimuovi principal"}, + {"Principals.", "&Principal:"}, + {".Add.Permission", " Aggiu&ngi autorizzazione"}, + {".Edit.Permission", " Mo&difica autorizzazione"}, + {"Remove.Permission", "R&imuovi autorizzazione"}, {"Done", "Fine"}, - {"KeyStore.URL.", "URL keystore:"}, - {"KeyStore.Type.", "Tipo keystore:"}, - {"KeyStore.Provider.", "Provider keystore:"}, - {"KeyStore.Password.URL.", "URL password keystore:"}, + {"KeyStore.URL.", "&URL keystore:"}, + {"KeyStore.Type.", "&Tipo keystore:"}, + {"KeyStore.Provider.", "Pro&vider keystore:"}, + {"KeyStore.Password.URL.", "URL pass&word keystore:"}, {"Principals", "Principal:"}, {".Edit.Principal.", " Modifica principal:"}, {".Add.New.Principal.", " Aggiungi nuovo principal:"}, @@ -117,8 +117,8 @@ "I criteri sono stati scritti in {0}"}, {"null.filename", "nome file nullo"}, {"Save.changes.", "Salvare le modifiche?"}, - {"Yes", "S\u00EC"}, - {"No", "No"}, + {"Yes", "&S\u00EC"}, + {"No", "&No"}, {"Policy.Entry", "Voce dei criteri"}, {"Save.Changes", "Salva le modifiche"}, {"No.Policy.Entry.selected", "Nessuna voce dei criteri selezionata"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_ja.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_ja.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "\u4F7F\u7528\u65B9\u6CD5: policytool [options]"}, {".file.file.policy.file.location", " [-file <file>] \u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240"}, - {"New", "\u65B0\u898F"}, - {"Open", "\u958B\u304F"}, - {"Save", "\u4FDD\u5B58"}, - {"Save.As", "\u5225\u540D\u4FDD\u5B58"}, - {"View.Warning.Log", "\u8B66\u544A\u30ED\u30B0\u306E\u8868\u793A"}, - {"Exit", "\u7D42\u4E86"}, - {"Add.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u8FFD\u52A0"}, - {"Edit.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u7DE8\u96C6"}, - {"Remove.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664"}, - {"Edit", "\u7DE8\u96C6"}, + {"New", "\u65B0\u898F(&N)"}, + {"Open", "\u958B\u304F(&O)..."}, + {"Save", "\u4FDD\u5B58(&S)"}, + {"Save.As", "\u5225\u540D\u4FDD\u5B58(&A)..."}, + {"View.Warning.Log", "\u8B66\u544A\u30ED\u30B0\u306E\u8868\u793A(&W)"}, + {"Exit", "\u7D42\u4E86(&X)"}, + {"Add.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u8FFD\u52A0(&A)"}, + {"Edit.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u7DE8\u96C6(&E)"}, + {"Remove.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664(&R)"}, + {"Edit", "\u7DE8\u96C6(&E)"}, {"Retain", "\u4FDD\u6301"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u306E\u8FFD\u52A0"}, {"Remove.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u3092\u524A\u9664"}, - {"File", "\u30D5\u30A1\u30A4\u30EB"}, - {"KeyStore", "\u30AD\u30FC\u30B9\u30C8\u30A2"}, + {"File", "\u30D5\u30A1\u30A4\u30EB(&F)"}, + {"KeyStore", "\u30AD\u30FC\u30B9\u30C8\u30A2(&K)"}, {"Policy.File.", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\u3002"}, {"Cancel", "\u53D6\u6D88"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u8FFD\u52A0"}, - {"Edit.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6"}, - {"Remove.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u524A\u9664"}, - {"Principals.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB:"}, - {".Add.Permission", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0"}, - {".Edit.Permission", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6"}, - {"Remove.Permission", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u524A\u9664"}, + {"CodeBase.", "CodeBase(&C):"}, + {"SignedBy.", "SignedBy(&S):"}, + {"Add.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u8FFD\u52A0(&A)"}, + {"Edit.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6(&E)"}, + {"Remove.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u524A\u9664(&R)"}, + {"Principals.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB(&P):"}, + {".Add.Permission", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0(&D)"}, + {".Edit.Permission", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6(&I)"}, + {"Remove.Permission", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u524A\u9664(&M)"}, {"Done", "\u5B8C\u4E86"}, - {"KeyStore.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2URL:"}, - {"KeyStore.Type.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30BF\u30A4\u30D7:"}, - {"KeyStore.Provider.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0:"}, - {"KeyStore.Password.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9URL:"}, + {"KeyStore.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2URL(&U):"}, + {"KeyStore.Type.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30BF\u30A4\u30D7(&T):"}, + {"KeyStore.Provider.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0(&P):"}, + {"KeyStore.Password.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9URL(&W):"}, {"Principals", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB"}, {".Edit.Principal.", " \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6:"}, {".Add.New.Principal.", " \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u65B0\u898F\u8FFD\u52A0:"}, @@ -117,8 +117,8 @@ "\u30DD\u30EA\u30B7\u30FC\u306E{0}\u3078\u306E\u66F8\u8FBC\u307F\u306B\u6210\u529F\u3057\u307E\u3057\u305F"}, {"null.filename", "\u30D5\u30A1\u30A4\u30EB\u540D\u304Cnull\u3067\u3059"}, {"Save.changes.", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059\u304B\u3002"}, - {"Yes", "\u306F\u3044"}, - {"No", "\u3044\u3044\u3048"}, + {"Yes", "\u306F\u3044(&Y)"}, + {"No", "\u3044\u3044\u3048(&N)"}, {"Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA"}, {"Save.Changes", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059"}, {"No.Policy.Entry.selected", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_ko.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_ko.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "\uC0AC\uC6A9\uBC95: policytool [options]"}, {".file.file.policy.file.location", " [-file <file>] \uC815\uCC45 \uD30C\uC77C \uC704\uCE58"}, - {"New", "\uC0C8\uB85C \uB9CC\uB4E4\uAE30"}, - {"Open", "\uC5F4\uAE30"}, - {"Save", "\uC800\uC7A5"}, - {"Save.As", "\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5"}, - {"View.Warning.Log", "\uACBD\uACE0 \uB85C\uADF8 \uBCF4\uAE30"}, - {"Exit", "\uC885\uB8CC"}, - {"Add.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uCD94\uAC00"}, - {"Edit.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uD3B8\uC9D1"}, - {"Remove.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uC81C\uAC70"}, - {"Edit", "\uD3B8\uC9D1"}, + {"New", "\uC0C8\uB85C \uB9CC\uB4E4\uAE30(&N)"}, + {"Open", "\uC5F4\uAE30(&O)..."}, + {"Save", "\uC800\uC7A5(&S)"}, + {"Save.As", "\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5(&A)..."}, + {"View.Warning.Log", "\uACBD\uACE0 \uB85C\uADF8 \uBCF4\uAE30(&W)"}, + {"Exit", "\uC885\uB8CC(&X)"}, + {"Add.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uCD94\uAC00(&A)"}, + {"Edit.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uD3B8\uC9D1(&E)"}, + {"Remove.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uC81C\uAC70(&R)"}, + {"Edit", "\uD3B8\uC9D1(&E)"}, {"Retain", "\uC720\uC9C0"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uCD94\uAC00"}, {"Remove.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uC81C\uAC70"}, - {"File", "\uD30C\uC77C"}, - {"KeyStore", "\uD0A4 \uC800\uC7A5\uC18C"}, + {"File", "\uD30C\uC77C(&F)"}, + {"KeyStore", "\uD0A4 \uC800\uC7A5\uC18C(&K)"}, {"Policy.File.", "\uC815\uCC45 \uD30C\uC77C:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "\uC815\uCC45 \uD30C\uC77C\uC744 \uC5F4 \uC218 \uC5C6\uC74C: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "\uAE30\uC874 \uD30C\uC77C {0}\uC744(\uB97C) \uACB9\uCCD0 \uC4F0\uACA0\uC2B5\uB2C8\uAE4C?"}, {"Cancel", "\uCDE8\uC18C"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "\uC8FC\uCCB4 \uCD94\uAC00"}, - {"Edit.Principal", "\uC8FC\uCCB4 \uD3B8\uC9D1"}, - {"Remove.Principal", "\uC8FC\uCCB4 \uC81C\uAC70"}, - {"Principals.", "\uC8FC\uCCB4:"}, - {".Add.Permission", " \uAD8C\uD55C \uCD94\uAC00"}, - {".Edit.Permission", " \uAD8C\uD55C \uD3B8\uC9D1"}, - {"Remove.Permission", "\uAD8C\uD55C \uC81C\uAC70"}, + {"CodeBase.", "CodeBase(&C)"}, + {"SignedBy.", "SignedBy(&S):"}, + {"Add.Principal", "\uC8FC\uCCB4 \uCD94\uAC00(&A)"}, + {"Edit.Principal", "\uC8FC\uCCB4 \uD3B8\uC9D1(&E)"}, + {"Remove.Principal", "\uC8FC\uCCB4 \uC81C\uAC70(&R)"}, + {"Principals.", "\uC8FC\uCCB4(&P):"}, + {".Add.Permission", " \uAD8C\uD55C \uCD94\uAC00(&D)"}, + {".Edit.Permission", " \uAD8C\uD55C \uD3B8\uC9D1(&I)"}, + {"Remove.Permission", "\uAD8C\uD55C \uC81C\uAC70(&M)"}, {"Done", "\uC644\uB8CC"}, - {"KeyStore.URL.", "\uD0A4 \uC800\uC7A5\uC18C URL:"}, - {"KeyStore.Type.", "\uD0A4 \uC800\uC7A5\uC18C \uC720\uD615:"}, - {"KeyStore.Provider.", "\uD0A4 \uC800\uC7A5\uC18C \uC81C\uACF5\uC790:"}, - {"KeyStore.Password.URL.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL:"}, + {"KeyStore.URL.", "\uD0A4 \uC800\uC7A5\uC18C URL(&U):"}, + {"KeyStore.Type.", "\uD0A4 \uC800\uC7A5\uC18C \uC720\uD615(&T):"}, + {"KeyStore.Provider.", "\uD0A4 \uC800\uC7A5\uC18C \uC81C\uACF5\uC790(&P):"}, + {"KeyStore.Password.URL.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL(&W):"}, {"Principals", "\uC8FC\uCCB4"}, {".Edit.Principal.", " \uC8FC\uCCB4 \uD3B8\uC9D1:"}, {".Add.New.Principal.", " \uC0C8 \uC8FC\uCCB4 \uCD94\uAC00:"}, @@ -117,8 +117,8 @@ "{0}\uC5D0 \uC131\uACF5\uC801\uC73C\uB85C \uC815\uCC45\uC744 \uC37C\uC2B5\uB2C8\uB2E4."}, {"null.filename", "\uB110 \uD30C\uC77C \uC774\uB984"}, {"Save.changes.", "\uBCC0\uACBD \uC0AC\uD56D\uC744 \uC800\uC7A5\uD558\uACA0\uC2B5\uB2C8\uAE4C?"}, - {"Yes", "\uC608"}, - {"No", "\uC544\uB2C8\uC624"}, + {"Yes", "\uC608(&Y)"}, + {"No", "\uC544\uB2C8\uC624(&N)"}, {"Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9"}, {"Save.Changes", "\uBCC0\uACBD \uC0AC\uD56D \uC800\uC7A5"}, {"No.Policy.Entry.selected", "\uC120\uD0DD\uB41C \uC815\uCC45 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
--- a/src/share/classes/sun/security/tools/policytool/Resources_pt_BR.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_pt_BR.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "Uso: policytool [op\u00E7\u00F5es]"}, {".file.file.policy.file.location", " [-file <arquivo>] localiza\u00E7\u00E3o do arquivo de pol\u00EDtica"}, - {"New", "Novo"}, - {"Open", "Abrir"}, - {"Save", "Salvar"}, - {"Save.As", "Salvar Como"}, - {"View.Warning.Log", "Exibir Log de Advert\u00EAncias"}, - {"Exit", "Sair"}, - {"Add.Policy.Entry", "Adicionar Entrada de Pol\u00EDtica"}, - {"Edit.Policy.Entry", "Editar Entrada de Pol\u00EDtica"}, - {"Remove.Policy.Entry", "Remover Entrada de Pol\u00EDtica"}, - {"Edit", "Editar"}, + {"New", "&Novo"}, + {"Open", "&Abrir..."}, + {"Save", "&Salvar"}, + {"Save.As", "Salvar c&omo..."}, + {"View.Warning.Log", "E&xibir Log de Advert\u00EAncias"}, + {"Exit", "S&air"}, + {"Add.Policy.Entry", "&Adicionar Entrada de Pol\u00EDtica"}, + {"Edit.Policy.Entry", "&Editar Entrada de Pol\u00EDtica"}, + {"Remove.Policy.Entry", "&Remover Entrada de Pol\u00EDtica"}, + {"Edit", "&Editar"}, {"Retain", "Reter"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "Adicionar Alias de Chave P\u00FAblica"}, {"Remove.Public.Key.Alias", "Remover Alias de Chave P\u00FAblica"}, - {"File", "Arquivo"}, - {"KeyStore", "KeyStore"}, + {"File", "&Arquivo"}, + {"KeyStore", "&KeyStore"}, {"Policy.File.", "Arquivo de Pol\u00EDtica:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "N\u00E3o foi poss\u00EDvel abrir o arquivo de pol\u00EDtica: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "Est\u00E1 correto substituir o arquivo existente {0}?"}, {"Cancel", "Cancelar"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "Adicionar Principal"}, - {"Edit.Principal", "Editar Principal"}, - {"Remove.Principal", "Remover Principal"}, - {"Principals.", "Principais:"}, - {".Add.Permission", " Adicionar Permiss\u00E3o"}, - {".Edit.Permission", " Editar Permiss\u00E3o"}, - {"Remove.Permission", "Remover Permiss\u00E3o"}, + {"CodeBase.", "&CodeBase:"}, + {"SignedBy.", "&SignedBy:"}, + {"Add.Principal", "&Adicionar Principal"}, + {"Edit.Principal", "&Editar Principal"}, + {"Remove.Principal", "&Remover Principal"}, + {"Principals.", "&Principais:"}, + {".Add.Permission", " A&dicionar Permiss\u00E3o"}, + {".Edit.Permission", " Ed&itar Permiss\u00E3o"}, + {"Remove.Permission", "Re&mover Permiss\u00E3o"}, {"Done", "Conclu\u00EDdo"}, - {"KeyStore.URL.", "URL do KeyStore:"}, - {"KeyStore.Type.", "Tipo de KeyStore:"}, - {"KeyStore.Provider.", "Fornecedor de KeyStore:"}, - {"KeyStore.Password.URL.", "URL da Senha do KeyStore:"}, + {"KeyStore.URL.", "&URL do KeyStore:"}, + {"KeyStore.Type.", "&Tipo de KeyStore:"}, + {"KeyStore.Provider.", "&Fornecedor de KeyStore:"}, + {"KeyStore.Password.URL.", "URL da Senha do Ke&yStore:"}, {"Principals", "Principais"}, {".Edit.Principal.", " Editar Principal:"}, {".Add.New.Principal.", " Adicionar Novo Principal:"}, @@ -117,8 +117,8 @@ "Pol\u00EDtica gravada com \u00EAxito em {0}"}, {"null.filename", "nome de arquivo nulo"}, {"Save.changes.", "Salvar altera\u00E7\u00F5es?"}, - {"Yes", "Sim"}, - {"No", "N\u00E3o"}, + {"Yes", "&Sim"}, + {"No", "&N\u00E3o"}, {"Policy.Entry", "Entrada de Pol\u00EDtica"}, {"Save.Changes", "Salvar Altera\u00E7\u00F5es"}, {"No.Policy.Entry.selected", "Nenhuma Entrada de Pol\u00EDtica Selecionada"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_sv.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_sv.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "Syntax: policytool [alternativ]"}, {".file.file.policy.file.location", " [-file <fil>] policyfiladress"}, - {"New", "Nytt"}, - {"Open", "\u00D6ppna"}, - {"Save", "Spara"}, - {"Save.As", "Spara som"}, - {"View.Warning.Log", "Visa varningslogg"}, - {"Exit", "Avsluta"}, - {"Add.Policy.Entry", "L\u00E4gg till policypost"}, - {"Edit.Policy.Entry", "Redigera policypost"}, - {"Remove.Policy.Entry", "Ta bort policypost"}, - {"Edit", "Redigera"}, + {"New", "&Nytt"}, + {"Open", "&\u00D6ppna..."}, + {"Save", "S¶"}, + {"Save.As", "Spara &som..."}, + {"View.Warning.Log", "Visa varningslo&gg"}, + {"Exit", "A&vsluta"}, + {"Add.Policy.Entry", "&L\u00E4gg till policypost"}, + {"Edit.Policy.Entry", "&Redigera policypost"}, + {"Remove.Policy.Entry", "&Ta bort policypost"}, + {"Edit", "&Redigera"}, {"Retain", "Beh\u00E5ll"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,14 +61,14 @@ {"Add.Public.Key.Alias", "L\u00E4gg till offentligt nyckelalias"}, {"Remove.Public.Key.Alias", "Ta bort offentligt nyckelalias"}, - {"File", "Fil"}, - {"KeyStore", "Nyckellager"}, + {"File", "&Arkiv"}, + {"KeyStore", "&KeyStore"}, {"Policy.File.", "Policyfil:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "Kan inte \u00F6ppna policyfilen: {0}: {1}"}, {"Policy.Tool", "Policyverktyg"}, {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.", - "Det uppstod ett fel n\u00E4r policykonfigurationen skulle \u00F6ppnas. Se varningsloggen f\u00F6r mer information."}, + "Ett fel intr\u00E4ffade n\u00E4r policykonfigurationen skulle \u00F6ppnas. Se varningsloggen f\u00F6r mer information."}, {"Error", "Fel"}, {"OK", "OK"}, {"Status", "Status"}, @@ -80,24 +80,24 @@ {"Target.Name.", "M\u00E5l: "}, {"Actions.", - "Funktioner: "}, + "\u00C5tg\u00E4rder: "}, {"OK.to.overwrite.existing.file.filename.", "Ska den befintliga filen {0} skrivas \u00F6ver?"}, {"Cancel", "Avbryt"}, - {"CodeBase.", "Kodbas:"}, - {"SignedBy.", "Signerad av:"}, - {"Add.Principal", "L\u00E4gg till identitetshavare"}, - {"Edit.Principal", "Redigera identitetshavare"}, - {"Remove.Principal", "Ta bort identitetshavare"}, + {"CodeBase.", "&CodeBase:"}, + {"SignedBy.", "&SignedBy:"}, + {"Add.Principal", "&L\u00E4gg till identitetshavare"}, + {"Edit.Principal", "&Redigera identitetshavare"}, + {"Remove.Principal", "&Ta bort identitetshavare"}, {"Principals.", "Identitetshavare:"}, - {".Add.Permission", " L\u00E4gg till beh\u00F6righet"}, - {".Edit.Permission", " Redigera beh\u00F6righet"}, - {"Remove.Permission", "Ta bort beh\u00F6righet"}, + {".Add.Permission", " L&\u00E4gg till beh\u00F6righet"}, + {".Edit.Permission", " Re&digera beh\u00F6righet"}, + {"Remove.Permission", "Ta &bort beh\u00F6righet"}, {"Done", "Utf\u00F6rd"}, - {"KeyStore.URL.", "URL f\u00F6r nyckellager:"}, - {"KeyStore.Type.", "Nyckellagertyp:"}, - {"KeyStore.Provider.", "Nyckellagerleverant\u00F6r:"}, - {"KeyStore.Password.URL.", "URL f\u00F6r l\u00F6senord till nyckellager:"}, + {"KeyStore.URL.", "Nyckellager-&URL:"}, + {"KeyStore.Type.", "Nyckellager&typ:"}, + {"KeyStore.Provider.", "Nyckellager&leverant\u00F6r:"}, + {"KeyStore.Password.URL.", "L\u00F6sen&ords-URL till nyckellager:"}, {"Principals", "Identitetshavare"}, {".Edit.Principal.", " Redigera identitetshavare:"}, {".Add.New.Principal.", " L\u00E4gg till ny identitetshavare:"}, @@ -117,8 +117,8 @@ "Policy har skrivits till {0}"}, {"null.filename", "nullfilnamn"}, {"Save.changes.", "Vill du spara \u00E4ndringarna?"}, - {"Yes", "Ja"}, - {"No", "Nej"}, + {"Yes", "&Ja"}, + {"No", "&Nej"}, {"Policy.Entry", "Policyfel"}, {"Save.Changes", "Spara \u00E4ndringar"}, {"No.Policy.Entry.selected", "Ingen policypost har valts"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_zh_CN.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_zh_CN.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "\u7528\u6CD5: policytool [\u9009\u9879]"}, {".file.file.policy.file.location", " [-file <file>] \u7B56\u7565\u6587\u4EF6\u4F4D\u7F6E"}, - {"New", "\u65B0\u5EFA"}, - {"Open", "\u6253\u5F00"}, - {"Save", "\u4FDD\u5B58"}, - {"Save.As", "\u53E6\u5B58\u4E3A"}, - {"View.Warning.Log", "\u67E5\u770B\u8B66\u544A\u65E5\u5FD7"}, - {"Exit", "\u9000\u51FA"}, - {"Add.Policy.Entry", "\u6DFB\u52A0\u7B56\u7565\u6761\u76EE"}, - {"Edit.Policy.Entry", "\u7F16\u8F91\u7B56\u7565\u6761\u76EE"}, - {"Remove.Policy.Entry", "\u5220\u9664\u7B56\u7565\u6761\u76EE"}, - {"Edit", "\u7F16\u8F91"}, + {"New", "\u65B0\u5EFA(&N)"}, + {"Open", "\u6253\u5F00(&O)..."}, + {"Save", "\u4FDD\u5B58(&S)"}, + {"Save.As", "\u53E6\u5B58\u4E3A(&A)..."}, + {"View.Warning.Log", "\u67E5\u770B\u8B66\u544A\u65E5\u5FD7(&W)"}, + {"Exit", "\u9000\u51FA(&X)"}, + {"Add.Policy.Entry", "\u6DFB\u52A0\u7B56\u7565\u6761\u76EE(&A)"}, + {"Edit.Policy.Entry", "\u7F16\u8F91\u7B56\u7565\u6761\u76EE(&E)"}, + {"Remove.Policy.Entry", "\u5220\u9664\u7B56\u7565\u6761\u76EE(&R)"}, + {"Edit", "\u7F16\u8F91(&E)"}, {"Retain", "\u4FDD\u7559"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "\u6DFB\u52A0\u516C\u5171\u5BC6\u94A5\u522B\u540D"}, {"Remove.Public.Key.Alias", "\u5220\u9664\u516C\u5171\u5BC6\u94A5\u522B\u540D"}, - {"File", "\u6587\u4EF6"}, - {"KeyStore", "\u5BC6\u94A5\u5E93"}, + {"File", "\u6587\u4EF6(&F)"}, + {"KeyStore", "\u5BC6\u94A5\u5E93(&K)"}, {"Policy.File.", "\u7B56\u7565\u6587\u4EF6:"}, {"Could.not.open.policy.file.policyFile.e.toString.", "\u65E0\u6CD5\u6253\u5F00\u7B56\u7565\u6587\u4EF6: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "\u786E\u8BA4\u8986\u76D6\u73B0\u6709\u7684\u6587\u4EF6{0}?"}, {"Cancel", "\u53D6\u6D88"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "\u6DFB\u52A0\u4E3B\u7528\u6237"}, - {"Edit.Principal", "\u7F16\u8F91\u4E3B\u7528\u6237"}, - {"Remove.Principal", "\u5220\u9664\u4E3B\u7528\u6237"}, - {"Principals.", "\u4E3B\u7528\u6237:"}, - {".Add.Permission", " \u6DFB\u52A0\u6743\u9650"}, - {".Edit.Permission", " \u7F16\u8F91\u6743\u9650"}, - {"Remove.Permission", "\u5220\u9664\u6743\u9650"}, + {"CodeBase.", "CodeBase(&C):"}, + {"SignedBy.", "SignedBy(&S):"}, + {"Add.Principal", "\u6DFB\u52A0\u4E3B\u7528\u6237(&A)"}, + {"Edit.Principal", "\u7F16\u8F91\u4E3B\u7528\u6237(&E)"}, + {"Remove.Principal", "\u5220\u9664\u4E3B\u7528\u6237(&R)"}, + {"Principals.", "\u4E3B\u7528\u6237(&P):"}, + {".Add.Permission", " \u6DFB\u52A0\u6743\u9650(&D)"}, + {".Edit.Permission", " \u7F16\u8F91\u6743\u9650(&I)"}, + {"Remove.Permission", "\u5220\u9664\u6743\u9650(&M)"}, {"Done", "\u5B8C\u6210"}, - {"KeyStore.URL.", "\u5BC6\u94A5\u5E93 URL:"}, - {"KeyStore.Type.", "\u5BC6\u94A5\u5E93\u7C7B\u578B:"}, - {"KeyStore.Provider.", "\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9:"}, - {"KeyStore.Password.URL.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"}, + {"KeyStore.URL.", "\u5BC6\u94A5\u5E93 URL(&U):"}, + {"KeyStore.Type.", "\u5BC6\u94A5\u5E93\u7C7B\u578B(&T):"}, + {"KeyStore.Provider.", "\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9(&P):"}, + {"KeyStore.Password.URL.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL(&W):"}, {"Principals", "\u4E3B\u7528\u6237"}, {".Edit.Principal.", " \u7F16\u8F91\u4E3B\u7528\u6237:"}, {".Add.New.Principal.", " \u6DFB\u52A0\u65B0\u4E3B\u7528\u6237:"}, @@ -117,8 +117,8 @@ "\u7B56\u7565\u5DF2\u6210\u529F\u5199\u5165\u5230{0}"}, {"null.filename", "\u7A7A\u6587\u4EF6\u540D"}, {"Save.changes.", "\u662F\u5426\u4FDD\u5B58\u6240\u505A\u7684\u66F4\u6539?"}, - {"Yes", "\u662F"}, - {"No", "\u5426"}, + {"Yes", "\u662F(&Y)"}, + {"No", "\u5426(&N)"}, {"Policy.Entry", "\u7B56\u7565\u6761\u76EE"}, {"Save.Changes", "\u4FDD\u5B58\u66F4\u6539"}, {"No.Policy.Entry.selected", "\u6CA1\u6709\u9009\u62E9\u7B56\u7565\u6761\u76EE"},
--- a/src/share/classes/sun/security/tools/policytool/Resources_zh_TW.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/tools/policytool/Resources_zh_TW.java Fri Jul 14 00:56:29 2017 +0100 @@ -44,16 +44,16 @@ {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"}, {".file.file.policy.file.location", " [-file <file>] \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"}, - {"New", "\u65B0\u589E"}, - {"Open", "\u958B\u555F"}, - {"Save", "\u5132\u5B58"}, - {"Save.As", "\u53E6\u5B58\u65B0\u6A94"}, - {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304"}, - {"Exit", "\u7D50\u675F"}, - {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE"}, - {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE"}, - {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE"}, - {"Edit", "\u7DE8\u8F2F"}, + {"New", "\u65B0\u5EFA(&N)"}, + {"Open", "\u958B\u555F(&O)..."}, + {"Save", "\u5132\u5B58(&S)"}, + {"Save.As", "\u53E6\u5B58\u65B0\u6A94(&A)..."}, + {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304(&W)"}, + {"Exit", "\u7D50\u675F(&X)"}, + {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE(&A)"}, + {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE(&E)"}, + {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE(&R)"}, + {"Edit", "\u7DE8\u8F2F(&E)"}, {"Retain", "\u4FDD\u7559"}, {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes", @@ -61,8 +61,8 @@ {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"}, {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"}, - {"File", "\u6A94\u6848"}, - {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB"}, + {"File", "\u6A94\u6848(&F)"}, + {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB(&K)"}, {"Policy.File.", "\u539F\u5247\u6A94\u6848: "}, {"Could.not.open.policy.file.policyFile.e.toString.", "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"}, @@ -84,20 +84,20 @@ {"OK.to.overwrite.existing.file.filename.", "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"}, {"Cancel", "\u53D6\u6D88"}, - {"CodeBase.", "CodeBase:"}, - {"SignedBy.", "SignedBy:"}, - {"Add.Principal", "\u65B0\u589E Principal"}, - {"Edit.Principal", "\u7DE8\u8F2F Principal"}, - {"Remove.Principal", "\u79FB\u9664 Principal"}, - {"Principals.", "Principal:"}, - {".Add.Permission", " \u65B0\u589E\u6B0A\u9650"}, - {".Edit.Permission", " \u7DE8\u8F2F\u6B0A\u9650"}, - {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650"}, + {"CodeBase.", "CodeBase(&C):"}, + {"SignedBy.", "SignedBy(&S):"}, + {"Add.Principal", "\u65B0\u589E Principal(&A)"}, + {"Edit.Principal", "\u7DE8\u8F2F Principal(&E)"}, + {"Remove.Principal", "\u79FB\u9664 Principal(&R)"}, + {"Principals.", "Principal(&P):"}, + {".Add.Permission", " \u65B0\u589E\u6B0A\u9650(&D)"}, + {".Edit.Permission", " \u7DE8\u8F2F\u6B0A\u9650(&I)"}, + {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650(&M)"}, {"Done", "\u5B8C\u6210"}, - {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL: "}, - {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B:"}, - {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005:"}, - {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL: "}, + {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL(&U): "}, + {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B(&T):"}, + {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005(&P):"}, + {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL(&W): "}, {"Principals", "Principal"}, {".Edit.Principal.", " \u7DE8\u8F2F Principal: "}, {".Add.New.Principal.", " \u65B0\u589E Principal: "}, @@ -117,8 +117,8 @@ "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"}, {"null.filename", "\u7A7A\u503C\u6A94\u540D"}, {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"}, - {"Yes", "\u662F"}, - {"No", "\u5426"}, + {"Yes", "\u662F(&Y)"}, + {"No", "\u5426(&N)"}, {"Policy.Entry", "\u539F\u5247\u9805\u76EE"}, {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"}, {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
--- a/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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
--- a/src/share/classes/sun/tools/jar/resources/jar_de.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/tools/jar/resources/jar_de.properties Fri Jul 14 00:56:29 2017 +0100 @@ -44,4 +44,4 @@ out.inflated=\ vergr\u00F6\u00DFert: {0} out.size=(ein = {0}) (aus = {1}) -usage=Verwendung: jar {ctxui}[vfm0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien ...\nOptionen:\n -c Neues Archiv erstellen\n -t Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n -x Benannte (oder alle) Dateien aus dem Archiv extrahieren\n -u Vorhandenes Archiv aktualisieren\n -v Ausgabe im Verbose-Modus aus Standard-Ausgabe generieren\n -f Dateinamen f\u00FCr Archiv angeben\n -m Manifestinformationen aus angegebener Manifestdatei einschlie\u00DFen\n -e Anwendungseinstiegspunkt f\u00FCr Standalone-Anwendung angeben \n in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelt\n -0 Nur speichern; keine ZIP-Komprimierung verwenden\n -P Komponenten mit vorangestelltem "/" (absoluter Pfad) und ".." (\u00FCbergeordnetes Verzeichnis) aus Dateinamen beibehalten\n -M Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n -i Indexinformationen f\u00FCr die angegebenen JAR-Dateien erstellen\n -C Zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifestdatei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifestdatei "mymanifest", und archivieren Sie alle\n Dateien im Verzeichnis foo/ directory in "classes.jar": \n jar cvfm classes.jar mymanifest -C foo/ .\n +usage=Verwendung: jar {ctxui}[vfm0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien...\nOptionen:\n -c Neues Archiv erstellen\n -t Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n -x Benannte (oder alle) Dateien aus dem Archiv extrahieren\n -u Vorhandenes Archiv aktualisieren\n -v Ausgabe im Verbose-Modus aus Standard-Ausgabe generieren\n -f Dateinamen f\u00FCr Archiv angeben\n -m Manifestinformationen aus angegebener Manifestdatei einschlie\u00DFen\n -e Anwendungseinstiegspunkt f\u00FCr Standalone-Anwendung angeben \n in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelt\n -0 Nur speichern; keine ZIP-Komprimierung verwenden\n -P Komponenten mit vorangestelltem "/" (absoluter Pfad) und ".." (\u00FCbergeordnetes Verzeichnis) aus Dateinamen beibehalten\n -M Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n -i Indexinformationen f\u00FCr die angegebenen JAR-Dateien erstellen\n -C Zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifestdatei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifestdatei "mymanifest", und archivieren Sie alle\n Dateien im Verzeichnis foo/ directory in "classes.jar": \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/src/share/classes/sun/tools/jar/resources/jar_it.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/tools/jar/resources/jar_it.properties Fri Jul 14 00:56:29 2017 +0100 @@ -44,4 +44,4 @@ out.inflated=\ decompresso: {0} out.size=(in = {0}) (out = {1}) -usage=Uso: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\nOpzioni:\n -c crea un nuovo archivio\n -t visualizza l'indice dell'archivio\n -x estrae i file con nome (o tutti i file) dall'archivio\n -u aggiorna l'archivio esistente\n -v genera output commentato dall'output standard\n -f specifica il nome file dell'archivio\n -m include informazioni manifest dal file manifest specificato\n -n esegue normalizzazione Pack200 dopo la creazione di un nuovo archivio\n -e specifica il punto di ingresso per l'applicazione stand-alone \n inclusa nel file jar eseguibile\n -0 solo memorizzazione; senza compressione ZIP\n -P conserva i componenti iniziali '/' (percorso assoluto) e \\"..\\" (directory padre) dai nomi file\n -M consente di non creare un file manifest per le voci\n -i genera informazioni sull'indice per i file jar specificati\n -C imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n file della directory foo/ in 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n +usage=Uso: jar {ctxui}[vfm0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\nOpzioni:\n -c crea un nuovo archivio\n -t visualizza l'indice dell'archivio\n -x estrae i file con nome (o tutti i file) dall'archivio\n -u aggiorna l'archivio esistente\n -v genera output commentato dall'output standard\n -f specifica il nome file dell'archivio\n -m include informazioni manifest dal file manifest specificato\n -e specifica il punto di ingresso per l'applicazione stand-alone \n inclusa nel file jar eseguibile\n -0 solo memorizzazione; senza compressione ZIP\n -P conserva i componenti iniziali '/' (percorso assoluto) e \\"..\\" (directory padre) dai nomi file\n -M consente di non creare un file manifest per le voci\n -i genera informazioni sull'indice per i file jar specificati\n -C imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n file della directory foo/ in 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties Fri Jul 14 00:56:29 2017 +0100 @@ -44,4 +44,4 @@ out.inflated=\ inflado: {0} out.size=(entrada = {0}) (sa\u00EDda= {1}) -usage=Uso: jar {ctxui}[vfm0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n -c cria novo arquivo compactado\n -t lista o sum\u00E1rio do arquivo compactado\n -x extrai arquivos com o nome (ou todos) do arquivo compactado\n -u atualiza o arquivo compactado existente\n -v gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n -f especifica o nome do arquivo do arquivo compactado\n -m inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n -e especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o stand-alone \n empacotada em um arquivo jar execut\u00E1vel\n -0 armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n -P preserva os componentes '/' inicial (caminho absoluto) e ".." (diret\u00F3rio pai) nos nomes dos arquivos\n -M n\u00E3o cria um arquivo de manifesto para as entradas\n -i gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n -C passa para o diret\u00F3rio especificado e inclui o arquivo a seguir\nSe um arquivo tamb\u00E9m for um diret\u00F3rio, ele ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado denominado classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n arquivos no diret\u00F3rio foo/ na 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n +usage=Uso: jar {ctxui}[vfm0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n -c cria novo arquivo compactado\n -t lista o sum\u00E1rio do arquivo compactado\n -x extrai arquivos com o nome (ou todos) do arquivo compactado\n -u atualiza o arquivo compactado existente\n -v gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n -f especifica o nome do arquivo do arquivo compactado\n -m inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n -e especifica o ponto de entrada da aplicativo para aplicativo stand-alone \n empacotada em um arquivo jar execut\u00E1vel\n -0 armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n -P preserva os componentes '/' inicial (caminho absoluto) e ".." (diret\u00F3rio pai) nos nomes dos arquivos\n -P preserva os componentes '/' inicial (caminho absoluto) e ".." (diret\u00F3rio pai) nos nomes dos arquivos\n -M n\u00E3o cria um arquivo de manifesto para as entradas\n -i gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n -C passa para o diret\u00F3rio especificado e inclui o arquivo a seguir\nSe um arquivo tamb\u00E9m for um diret\u00F3rio, ele ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado denominado classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n arquivos no diret\u00F3rio foo/ na 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/src/share/classes/sun/tools/jar/resources/jar_sv.properties Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/classes/sun/tools/jar/resources/jar_sv.properties Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ error.bad.uflag=f\u00F6r u-flaggan m\u00E5ste manifest-, e-flagg- eller indatafiler anges. error.bad.eflag=e-flaggan och manifest med attributet Main-Class kan inte anges \ntillsammans. error.nosuch.fileordir={0} : det finns ingen s\u00E5dan fil eller katalog -error.write.file=Det uppstod ett fel vid skrivning till befintlig jar-fil. +error.write.file=Ett fel intr\u00E4ffade vid skrivning till befintlig jar-fil. error.create.dir={0} : kunde inte skapa n\u00E5gon katalog error.incorrect.length=ogiltig l\u00E4ngd vid bearbetning: {0} out.added.manifest=tillagt manifestfil
--- a/src/share/lib/security/java.security-linux Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/lib/security/java.security-linux Fri Jul 14 00:56:29 2017 +0100 @@ -473,7 +473,7 @@ # implementation. It is not guaranteed to be examined and used by other # implementations. # -jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024 +jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing
--- a/src/share/lib/security/java.security-macosx Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/lib/security/java.security-macosx Fri Jul 14 00:56:29 2017 +0100 @@ -478,7 +478,7 @@ # implementation. It is not guaranteed to be examined and used by other # implementations. # -jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024 +jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing
--- a/src/share/lib/security/java.security-solaris Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/lib/security/java.security-solaris Fri Jul 14 00:56:29 2017 +0100 @@ -477,7 +477,7 @@ # implementation. It is not guaranteed to be examined and used by other # implementations. # -jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024 +jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing
--- a/src/share/lib/security/java.security-windows Thu Apr 27 03:09:54 2017 +0100 +++ b/src/share/lib/security/java.security-windows Fri Jul 14 00:56:29 2017 +0100 @@ -478,7 +478,7 @@ # implementation. It is not guaranteed to be examined and used by other # implementations. # -jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024 +jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing
--- a/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -73,11 +73,15 @@ private String hostname; private static String defaultDomain; /* Domain to use if not specified by user */ + private static final boolean ntlmCache; /* Whether cache is enabled for NTLM */ static { defaultDomain = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("http.auth.ntlm.domain", "")); - }; + String ntlmCacheProp = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("jdk.ntlm.cache", "true")); + ntlmCache = Boolean.parseBoolean(ntlmCacheProp); + } public static boolean supportsTransparentAuth () { return false; @@ -166,6 +170,11 @@ init (pw); } + @Override + protected boolean useAuthCache() { + return ntlmCache && super.useAuthCache(); + } + /** * @return true if this authentication supports preemptive authorization */ @@ -242,7 +251,6 @@ return result; } } - class B64Encoder extends sun.misc.BASE64Encoder { /* to force it to to the entire encoding in one line */ protected int bytesPerLine () {
--- a/src/solaris/native/java/net/NetworkInterface.c Thu Apr 27 03:09:54 2017 +0100 +++ b/src/solaris/native/java/net/NetworkInterface.c Fri Jul 14 00:56:29 2017 +0100 @@ -1038,8 +1038,9 @@ } -/** Linux, AIX **/ -#if !defined(__solaris__) +/** Linux, AIX. For Solaris and BSD there are similar sections below. **/ +#if !defined(__solaris__) && !defined(_ALLBSD_SOURCE) + /* Open socket for further ioct calls, try v4 socket first and * if it falls return v6 socket */
--- a/src/windows/classes/sun/awt/windows/WMenuItemPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/classes/sun/awt/windows/WMenuItemPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -71,7 +71,7 @@ enable(false); } - public void readShortcutLabel() { + private void readShortcutLabel() { //Fix for 6288578: PIT. Windows: Shortcuts displayed for the menuitems in a popup menu WMenuPeer ancestor = parent; while (ancestor != null && !(ancestor instanceof WMenuBarPeer)) { @@ -115,7 +115,7 @@ readShortcutLabel(); } - protected void checkMenuCreation() + void checkMenuCreation() { // fix for 5088782: check if menu peer is created successfully if (pData == 0) @@ -184,7 +184,9 @@ */ private static native void initIDs(); - // Needed for MenuComponentPeer. - public void setFont(Font f) { + private native void _setFont(Font f); + + public void setFont(final Font f) { + _setFont(f); } }
--- a/src/windows/classes/sun/awt/windows/WObjectPeer.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/classes/sun/awt/windows/WObjectPeer.java Fri Jul 14 00:56:29 2017 +0100 @@ -34,16 +34,16 @@ } // The Windows handle for the native widget. - long pData; + volatile long pData; // if the native peer has been destroyed - boolean destroyed = false; + private volatile boolean destroyed; // The associated AWT object. - Object target; + volatile Object target; private volatile boolean disposed; // set from JNI if any errors in creating the peer occur - protected Error createError = null; + volatile Error createError = null; // used to synchronize the state of this peer private final Object stateLock = new Object();
--- a/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,11 +50,15 @@ private String hostname; private static String defaultDomain; /* Domain to use if not specified by user */ + private static final boolean ntlmCache; /* Whether cache is enabled for NTLM */ static { defaultDomain = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("http.auth.ntlm.domain", "domain")); + String ntlmCacheProp = java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("jdk.ntlm.cache", "true")); + ntlmCache = Boolean.parseBoolean(ntlmCacheProp); }; private void init0() { @@ -130,6 +134,11 @@ init (pw); } + @Override + protected boolean useAuthCache() { + return ntlmCache && super.useAuthCache(); + } + /** * @return true if this authentication supports preemptive authorization */
--- a/src/windows/native/java/lang/java_props_md.c Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/java/lang/java_props_md.c Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, 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 @@ -319,8 +319,8 @@ GetJavaProperties(JNIEnv* env) { static java_props_t sprops = {0}; - - OSVERSIONINFOEX ver; + int majorVersion; + int minorVersion; if (sprops.user_dir) { return &sprops; @@ -351,21 +351,67 @@ /* OS properties */ { char buf[100]; - SYSTEM_INFO si; - PGNSI pGNSI; + boolean is_workstation; + boolean is_64bit; + DWORD platformId; + { + OSVERSIONINFOEX ver; + ver.dwOSVersionInfoSize = sizeof(ver); + GetVersionEx((OSVERSIONINFO *) &ver); + majorVersion = ver.dwMajorVersion; + minorVersion = ver.dwMinorVersion; + is_workstation = (ver.wProductType == VER_NT_WORKSTATION); + platformId = ver.dwPlatformId; + sprops.patch_level = _strdup(ver.szCSDVersion); + } - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx((OSVERSIONINFO *) &ver); + { + SYSTEM_INFO si; + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + GetNativeSystemInfo(&si); + + is_64bit = (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64); + } + do { + // Read the major and minor version number from kernel32.dll + VS_FIXEDFILEINFO *file_info; + WCHAR kernel32_path[MAX_PATH]; + DWORD version_size; + LPTSTR version_info; + UINT len, ret; - ZeroMemory(&si, sizeof(SYSTEM_INFO)); - // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. - pGNSI = (PGNSI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "GetNativeSystemInfo"); - if(NULL != pGNSI) - pGNSI(&si); - else - GetSystemInfo(&si); + // Get the full path to \Windows\System32\kernel32.dll and use that for + // determining what version of Windows we're running on. + len = MAX_PATH - (UINT)strlen("\\kernel32.dll") - 1; + ret = GetSystemDirectoryW(kernel32_path, len); + if (ret == 0 || ret > len) { + break; + } + wcsncat(kernel32_path, L"\\kernel32.dll", MAX_PATH - ret); + + version_size = GetFileVersionInfoSizeW(kernel32_path, NULL); + if (version_size == 0) { + break; + } + + version_info = (LPTSTR)malloc(version_size); + if (version_info == NULL) { + break; + } + + if (!GetFileVersionInfoW(kernel32_path, 0, version_size, version_info)) { + free(version_info); + break; + } + + if (!VerQueryValueW(version_info, L"\\", (LPVOID*)&file_info, &len)) { + free(version_info); + break; + } + majorVersion = HIWORD(file_info->dwProductVersionMS); + minorVersion = LOWORD(file_info->dwProductVersionMS); + free(version_info); + } while (0); /* * From msdn page on OSVERSIONINFOEX, current as of this @@ -391,17 +437,17 @@ * Windows Server 2008 R2 6 1 (!VER_NT_WORKSTATION) * Windows 8 6 2 (VER_NT_WORKSTATION) * Windows Server 2012 6 2 (!VER_NT_WORKSTATION) + * Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION) + * Windows 10 10 0 (VER_NT_WORKSTATION) + * Windows Server 2016 10 0 (!VER_NT_WORKSTATION) * * This mapping will presumably be augmented as new Windows * versions are released. */ - switch (ver.dwPlatformId) { - case VER_PLATFORM_WIN32s: - sprops.os_name = "Windows 3.1"; - break; + switch (platformId) { case VER_PLATFORM_WIN32_WINDOWS: - if (ver.dwMajorVersion == 4) { - switch (ver.dwMinorVersion) { + if (majorVersion == 4) { + switch (minorVersion) { case 0: sprops.os_name = "Windows 95"; break; case 10: sprops.os_name = "Windows 98"; break; case 90: sprops.os_name = "Windows Me"; break; @@ -412,10 +458,10 @@ } break; case VER_PLATFORM_WIN32_NT: - if (ver.dwMajorVersion <= 4) { + if (majorVersion <= 4) { sprops.os_name = "Windows NT"; - } else if (ver.dwMajorVersion == 5) { - switch (ver.dwMinorVersion) { + } else if (majorVersion == 5) { + switch (minorVersion) { case 0: sprops.os_name = "Windows 2000"; break; case 1: sprops.os_name = "Windows XP"; break; case 2: @@ -430,8 +476,7 @@ * If it is, the operating system is Windows XP 64 bit; * otherwise, it is Windows Server 2003." */ - if(ver.wProductType == VER_NT_WORKSTATION && - si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + if (is_workstation && is_64bit) { sprops.os_name = "Windows XP"; /* 64 bit */ } else { sprops.os_name = "Windows 2003"; @@ -439,12 +484,12 @@ break; default: sprops.os_name = "Windows NT (unknown)"; break; } - } else if (ver.dwMajorVersion == 6) { + } else if (majorVersion == 6) { /* * See table in MSDN OSVERSIONINFOEX documentation. */ - if (ver.wProductType == VER_NT_WORKSTATION) { - switch (ver.dwMinorVersion) { + if (is_workstation) { + switch (minorVersion) { case 0: sprops.os_name = "Windows Vista"; break; case 1: sprops.os_name = "Windows 7"; break; case 2: sprops.os_name = "Windows 8"; break; @@ -452,7 +497,7 @@ default: sprops.os_name = "Windows NT (unknown)"; } } else { - switch (ver.dwMinorVersion) { + switch (minorVersion) { case 0: sprops.os_name = "Windows Server 2008"; break; case 1: sprops.os_name = "Windows Server 2008 R2"; break; case 2: sprops.os_name = "Windows Server 2012"; break; @@ -460,6 +505,18 @@ default: sprops.os_name = "Windows NT (unknown)"; } } + } else if (majorVersion == 10) { + if (is_workstation) { + switch (minorVersion) { + case 0: sprops.os_name = "Windows 10"; break; + default: sprops.os_name = "Windows NT (unknown)"; + } + } else { + switch (minorVersion) { + case 0: sprops.os_name = "Windows Server 2016"; break; + default: sprops.os_name = "Windows NT (unknown)"; + } + } } else { sprops.os_name = "Windows NT (unknown)"; } @@ -468,7 +525,7 @@ sprops.os_name = "Windows (unknown)"; break; } - sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion); + sprintf(buf, "%d.%d", majorVersion, minorVersion); sprops.os_version = _strdup(buf); #if _M_IA64 sprops.os_arch = "ia64"; @@ -479,9 +536,6 @@ #else sprops.os_arch = "unknown"; #endif - - sprops.patch_level = _strdup(ver.szCSDVersion); - sprops.desktop = "windows"; } @@ -601,7 +655,7 @@ &display_encoding); sprops.sun_jnu_encoding = getEncodingInternal(systemDefaultLCID); - if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && ver.dwMajorVersion == 6) { + if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && majorVersion == 6) { // MS claims "Vista has built-in support for HKSCS-2004. // All of the HKSCS-2004 characters have Unicode 4.1. // PUA code point assignments". But what it really means
--- a/src/windows/native/sun/windows/awt_Component.cpp Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Component.cpp Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -3747,7 +3747,10 @@ HWND hWnd = GetHWnd(); HWND hTop = GetTopLevelParentForWindow(hWnd); ::ClientToScreen(hTop, &p); - + if (!m_bitsCandType) { + SetCandidateWindow(m_bitsCandType, x - p.x, y - p.y); + return; + } for (int iCandType=0; iCandType<32; iCandType++, bits<<=1) { if ( m_bitsCandType & bits ) SetCandidateWindow(iCandType, x - p.x, y - p.y); @@ -3765,7 +3768,7 @@ HIMC hIMC = ImmGetContext(hwnd); CANDIDATEFORM cf; cf.dwIndex = iCandType; - cf.dwStyle = CFS_CANDIDATEPOS; + cf.dwStyle = CFS_POINT; cf.ptCurrentPos.x = x; cf.ptCurrentPos.y = y; @@ -3797,9 +3800,15 @@ MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType) { - if (!m_useNativeCompWindow && subMsg == IMN_OPENCANDIDATE) { - m_bitsCandType = bitsCandType; - InquireCandidatePosition(); + if (!m_useNativeCompWindow) { + if (subMsg == IMN_OPENCANDIDATE) { + m_bitsCandType = subMsg; + InquireCandidatePosition(); + } else if (subMsg == IMN_OPENSTATUSWINDOW || + subMsg == WM_IME_STARTCOMPOSITION) { + m_bitsCandType = 0; + InquireCandidatePosition(); + } return mrConsume; } return mrDoDefault; @@ -4053,14 +4062,14 @@ return (HWND)NULL; } -/* Call DefWindowProc for the focus proxy, if any */ +/* Redirects message to the focus proxy, if any */ void AwtComponent::CallProxyDefWindowProc(UINT message, WPARAM wParam, LPARAM lParam, LRESULT &retVal, MsgRouting &mr) { if (mr != mrConsume) { HWND proxy = GetProxyFocusOwner(); if (proxy != NULL && ::IsWindowEnabled(proxy)) { - retVal = ComCtl32Util::GetInstance().DefWindowProc(NULL, proxy, message, wParam, lParam); + retVal = ::DefWindowProc(proxy, message, wParam, lParam); mr = mrConsume; } } @@ -4139,7 +4148,7 @@ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); if (drawInfo.CtlType == ODT_MENU) { - if (drawInfo.itemData != 0) { + if (IsMenu((HMENU)drawInfo.hwndItem) && drawInfo.itemData != 0) { AwtMenu* menu = (AwtMenu*)(drawInfo.itemData); menu->DrawItem(drawInfo); }
--- a/src/windows/native/sun/windows/awt_Menu.cpp Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Menu.cpp Fri Jul 14 00:56:29 2017 +0100 @@ -34,6 +34,13 @@ /* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code. */ +/***********************************************************************/ +// struct for _DelItem() method +struct DelItemStruct { + jobject menuitem; + jint index; +}; + /************************************************************************ * AwtMenuItem fields */ @@ -64,7 +71,6 @@ ::DestroyMenu(m_hMenu); m_hMenu = NULL; } - AwtMenuItem::Dispose(); } @@ -73,7 +79,7 @@ } /* Create a new AwtMenu object and menu. */ -AwtMenu* AwtMenu::Create(jobject self, AwtMenu* parentMenu) +AwtMenu* AwtMenu::Create(jobject self, jobject parent) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); @@ -85,6 +91,9 @@ return NULL; } + JNI_CHECK_NULL_GOTO(parent, "peer", done); + AwtMenu* parentMenu = (AwtMenu*) JNI_GET_PDATA(parent); + target = env->GetObjectField(self, AwtObject::targetID); JNI_CHECK_NULL_GOTO(target, "null target", done); @@ -119,6 +128,81 @@ return menu; } +void AwtMenu::_AddSeparator(void *param) +{ + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + jobject self = (jobject)param; + AwtMenu *m = NULL; + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + m = (AwtMenu *)pData; + m->AddSeparator(); +ret: + env->DeleteGlobalRef(self); + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenu::_AddSeparator, param); + } +} + +void AwtMenu::_DelItem(void *param) +{ + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + DelItemStruct *dis = (DelItemStruct*) param; + jobject self = dis->menuitem; + jint index = dis->index; + + AwtMenu *m = NULL; + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + m = (AwtMenu *)pData; + m->DeleteItem(static_cast<UINT>(index)); +ret: + env->DeleteGlobalRef(self); + delete dis; + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenu::_DelItem, param); + } +} + +void AwtMenu::UpdateLayout() +{ + UpdateLayout(GetHMenu()); + RedrawMenuBar(); +} + +void AwtMenu::UpdateLayout(const HMENU hmenu) +{ + const int nMenuItemCount = ::GetMenuItemCount(hmenu); + static MENUITEMINFO mii; + for (int idx = 0; idx < nMenuItemCount; ++idx) { + memset(&mii, 0, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID + | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; + if (::GetMenuItemInfo(hmenu, idx, TRUE, &mii)) { + VERIFY(::RemoveMenu(hmenu, idx, MF_BYPOSITION)); + VERIFY(::InsertMenuItem(hmenu, idx, TRUE, &mii)); + if (mii.hSubMenu != NULL) { + UpdateLayout(mii.hSubMenu); + } + } + } +} + +void AwtMenu::UpdateContainerLayout() +{ + AwtMenu* menu = GetMenuContainer(); + if (menu != NULL) { + menu->UpdateLayout(); + } else { + UpdateLayout(); + } +} + AwtMenuBar* AwtMenu::GetMenuBar() { return (GetMenuContainer() == NULL) ? NULL : GetMenuContainer()->GetMenuBar(); } @@ -204,6 +288,7 @@ } jobject menuItem = env->CallObjectMethod(target, AwtMenu::getItemMID, index); + if (!menuItem) return NULL; // menu item was removed concurrently DASSERT(!safe_ExceptionOccurred(env)); jobject wMenuItemPeer = GetPeerForTarget(env, menuItem); @@ -229,9 +314,9 @@ } /* target is a java.awt.Menu */ jobject target = GetTarget(env); - + if(!target || env->ExceptionCheck()) return; int nCount = CountItem(target); - for (int i = 0; i < nCount; i++) { + for (int i = 0; i < nCount && !env->ExceptionCheck(); i++) { AwtMenuItem* awtMenuItem = GetItem(target, i); if (awtMenuItem != NULL) { SendDrawItem(awtMenuItem, drawInfo); @@ -259,8 +344,9 @@ } /* target is a java.awt.Menu */ jobject target = GetTarget(env); + if(!target || env->ExceptionCheck()) return; int nCount = CountItem(target); - for (int i = 0; i < nCount; i++) { + for (int i = 0; i < nCount && !env->ExceptionCheck(); i++) { AwtMenuItem* awtMenuItem = GetItem(target, i); if (awtMenuItem != NULL) { SendMeasureItem(awtMenuItem, hDC, measureInfo); @@ -286,24 +372,6 @@ return (GetMenuBar() == GetMenuContainer()); } -LRESULT AwtMenu::WinThreadExecProc(ExecuteArgs * args) -{ - switch( args->cmdId ) { - case MENU_ADDSEPARATOR: - this->AddSeparator(); - break; - - case MENU_DELITEM: - this->DeleteItem(static_cast<UINT>(args->param1)); - break; - - default: - AwtMenuItem::WinThreadExecProc(args); - break; - } - return 0L; -} - /************************************************************************ * WMenuPeer native methods */ @@ -344,15 +412,14 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(self); + jobject selfGlobalRef = env->NewGlobalRef(self); - AwtObject::WinThreadExec(self, AwtMenu::MENU_ADDSEPARATOR); + AwtToolkit::GetInstance().SyncCall(AwtMenu::_AddSeparator, selfGlobalRef); + // selfGlobalRef is deleted in _AddSeparator CATCH_BAD_ALLOC; } - /* * Class: sun_awt_windows_WMenuPeer * Method: delItem @@ -364,10 +431,12 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(self); + DelItemStruct *dis = new DelItemStruct; + dis->menuitem = env->NewGlobalRef(self); + dis->index = index; - AwtObject::WinThreadExec(self, AwtMenu::MENU_DELITEM, index); + AwtToolkit::GetInstance().SyncCall(AwtMenu::_DelItem, dis); + // global refs and dis are deleted in _DelItem CATCH_BAD_ALLOC; } @@ -383,13 +452,8 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(menuBar); - - AwtMenuBar* awtMenuBar = (AwtMenuBar *)pData; - AwtToolkit::CreateComponent(self, awtMenuBar, - (AwtToolkit::ComponentFactory)AwtMenu::Create,FALSE); - JNI_CHECK_PEER_CREATION_RETURN(self); + AwtToolkit::CreateComponent(self, menuBar, + (AwtToolkit::ComponentFactory)AwtMenu::Create); CATCH_BAD_ALLOC; } @@ -405,13 +469,8 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(menu); - - AwtMenu* awtMenu = (AwtMenu *)pData; - AwtToolkit::CreateComponent(self, awtMenu, - (AwtToolkit::ComponentFactory)AwtMenu::Create,FALSE); - JNI_CHECK_PEER_CREATION_RETURN(self); + AwtToolkit::CreateComponent(self, menu, + (AwtToolkit::ComponentFactory)AwtMenu::Create); CATCH_BAD_ALLOC; }
--- a/src/windows/native/sun/windows/awt_Menu.h Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Menu.h Fri Jul 14 00:56:29 2017 +0100 @@ -42,13 +42,6 @@ class AwtMenu : public AwtMenuItem { public: - // id's for methods executed on toolkit thread - enum { - MENU_ADDSEPARATOR = MENUITEM_LAST+1, - MENU_DELITEM, - MENU_LAST - }; - /* method ids for java.awt.Menu */ static jmethodID countItemsMID; static jmethodID getItemMID; @@ -61,7 +54,7 @@ virtual LPCTSTR GetClassName(); /* Create a new AwtMenu. This must be run on the main thread. */ - static AwtMenu* Create(jobject self, AwtMenu* parentMenu); + static AwtMenu* Create(jobject self, jobject parent); INLINE HMENU GetHMenu() { return m_hMenu; } INLINE void SetHMenu(HMENU hMenu) { @@ -72,6 +65,8 @@ virtual AwtMenuBar* GetMenuBar(); void AddSeparator(); + virtual void UpdateContainerLayout(); + void UpdateLayout(); virtual void AddItem(AwtMenuItem *item); virtual void DeleteItem(UINT index); @@ -92,9 +87,9 @@ void MeasureItem(HDC hDC, MEASUREITEMSTRUCT& measureInfo); void MeasureItems(HDC hDC, MEASUREITEMSTRUCT& measureInfo); - virtual LRESULT WinThreadExecProc(ExecuteArgs * args); - // invoked on Toolkit thread + static void _AddSeparator(void *param); + static void _DelItem(void *param); static void _CreateMenu(void *param); static void _CreateSubMenu(void *param); virtual BOOL IsSeparator() { return FALSE; } @@ -103,6 +98,7 @@ virtual void RemoveCmdID() { /* do nothing */ } private: + void UpdateLayout(const HMENU hmenu); HMENU m_hMenu; };
--- a/src/windows/native/sun/windows/awt_MenuBar.cpp Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_MenuBar.cpp Fri Jul 14 00:56:29 2017 +0100 @@ -30,6 +30,12 @@ */ /***********************************************************************/ +// struct for _DelItem() method +struct DelItemStruct { + jobject menuitem; + jint index; +}; +/***********************************************************************/ // struct for _AddMenu() method struct AddMenuStruct { jobject menubar; @@ -130,18 +136,6 @@ return myFrame->GetHWnd(); } -void AwtMenuBar::SendDrawItem(AwtMenuItem* awtMenuItem, - DRAWITEMSTRUCT& drawInfo) -{ - awtMenuItem->DrawItem(drawInfo); -} - -void AwtMenuBar::SendMeasureItem(AwtMenuItem* awtMenuItem, - HDC hDC, MEASUREITEMSTRUCT& measureInfo) -{ - awtMenuItem->MeasureItem(hDC, measureInfo); -} - int AwtMenuBar::CountItem(jobject menuBar) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); @@ -159,13 +153,16 @@ } jobject menu = env->CallObjectMethod(target, AwtMenuBar::getMenuMID,index); + if (!menu) return NULL; // menu item was removed concurrently DASSERT(!safe_ExceptionOccurred(env)); jobject menuItemPeer = GetPeerForTarget(env, menu); PDATA pData; - JNI_CHECK_PEER_RETURN_NULL(menuItemPeer); - AwtMenuItem* awtMenuItem = (AwtMenuItem*)pData; + AwtMenuItem* awtMenuItem = NULL; + JNI_CHECK_PEER_GOTO(menuItemPeer, done); + awtMenuItem = (AwtMenuItem*)pData; +done: env->DeleteLocalRef(menu); env->DeleteLocalRef(menuItemPeer); @@ -201,21 +198,15 @@ if (hOwnerWnd != NULL) { VERIFY(::InvalidateRect(hOwnerWnd,0,TRUE)); } - ::DrawMenuBar(GetOwnerHWnd()); + RedrawMenuBar(); } -LRESULT AwtMenuBar::WinThreadExecProc(ExecuteArgs * args) -{ - switch( args->cmdId ) { - case MENUBAR_DELITEM: - this->DeleteItem(static_cast<UINT>(args->param1)); - break; - - default: - AwtMenu::WinThreadExecProc(args); - break; - } - return 0L; +/** + * If the menu changes after the system has created the window, + * this function must be called to draw the changed menu bar. + */ +void AwtMenuBar::RedrawMenuBar() { + VERIFY(::DrawMenuBar(GetOwnerHWnd())); } void AwtMenuBar::_AddMenu(void *param) @@ -235,7 +226,7 @@ if (::IsWindow(m->GetOwnerHWnd())) { /* The menu was already created and added during peer creation -- redraw */ - ::DrawMenuBar(m->GetOwnerHWnd()); + m->RedrawMenuBar(); } ret: env->DeleteGlobalRef(self); @@ -246,6 +237,28 @@ delete ams; } +void AwtMenuBar::_DelItem(void *param) +{ + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + DelItemStruct *dis = (DelItemStruct*) param; + jobject self = dis->menuitem; + jint index = dis->index; + + AwtMenuBar *m = NULL; + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + m = (AwtMenuBar *)pData; + m->DeleteItem(static_cast<UINT>(index)); +ret: + env->DeleteGlobalRef(self); + delete dis; + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenuBar::_DelItem, param); + } +} + /************************************************************************ * MenuBar native methods */ @@ -312,9 +325,12 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(self); - AwtObject::WinThreadExec(self, AwtMenuBar::MENUBAR_DELITEM, (LPARAM)index); + DelItemStruct *dis = new DelItemStruct; + dis->menuitem = env->NewGlobalRef(self); + dis->index = index; + + AwtToolkit::GetInstance().SyncCall(AwtMenuBar::_DelItem, dis); + // global refs and dis are deleted in _DelItem CATCH_BAD_ALLOC; } @@ -333,9 +349,6 @@ AwtToolkit::CreateComponent(self, frame, (AwtToolkit::ComponentFactory) AwtMenuBar::Create); - PDATA pData; - JNI_CHECK_PEER_CREATION_RETURN(self); - CATCH_BAD_ALLOC; }
--- a/src/windows/native/sun/windows/awt_MenuBar.h Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_MenuBar.h Fri Jul 14 00:56:29 2017 +0100 @@ -42,10 +42,6 @@ class AwtMenuBar : public AwtMenu { public: - // id's for methods executed on toolkit thread - enum MenuExecIds { - MENUBAR_DELITEM = MENU_LAST+1 - }; /* java.awt.MenuBar method ids */ static jmethodID getMenuCountMID; @@ -68,24 +64,20 @@ } virtual HWND GetOwnerHWnd(); + virtual void RedrawMenuBar(); AwtMenuItem* GetItem(jobject target, long index); int CountItem(jobject menuBar); - void SendDrawItem(AwtMenuItem* awtMenuItem, - DRAWITEMSTRUCT& drawInfo); - void SendMeasureItem(AwtMenuItem* awtMenuItem, - HDC hDC, MEASUREITEMSTRUCT& measureInfo); void DrawItem(DRAWITEMSTRUCT& drawInfo); void MeasureItem(HDC hDC, MEASUREITEMSTRUCT& measureInfo); void AddItem(AwtMenuItem* item); void DeleteItem(UINT index); - virtual LRESULT WinThreadExecProc(ExecuteArgs * args); - // called on Toolkit thread static void _AddMenu(void *param); + static void _DelItem(void *param); protected: AwtFrame* m_frame; };
--- a/src/windows/native/sun/windows/awt_MenuItem.cpp Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_MenuItem.cpp Fri Jul 14 00:56:29 2017 +0100 @@ -50,6 +50,16 @@ jobject menuitem; jstring label; }; +// struct for _SetEnable() method +struct SetEnableStruct { + jobject menuitem; + jboolean isEnabled; +}; +// struct for _setState() method +struct SetStateStruct { + jobject menuitem; + jboolean isChecked; +}; /************************************************************************ * AwtMenuItem fields */ @@ -104,6 +114,7 @@ { if (m_freeId) { AwtToolkit::GetInstance().RemoveCmdID( GetID() ); + m_freeId = FALSE; } } void AwtMenuItem::Dispose() @@ -112,6 +123,7 @@ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); if (m_peerObject != NULL) { + JNI_SET_DESTROYED(m_peerObject); JNI_SET_PDATA(m_peerObject, NULL); env->DeleteGlobalRef(m_peerObject); m_peerObject = NULL; @@ -199,13 +211,12 @@ if (env->EnsureLocalCapacity(1) < 0) { return NULL; } - PDATA pData; - JNI_CHECK_PEER_RETURN_NULL(menuPeer); + JNI_CHECK_NULL_RETURN_NULL(menuPeer, "peer"); /* target is a java.awt.MenuItem */ target = env->GetObjectField(peer, AwtObject::targetID); - AwtMenu* menu = (AwtMenu *)pData; + AwtMenu* menu = (AwtMenu *)JNI_GET_PDATA(menuPeer); item = new AwtMenuItem(); jboolean isCheckbox = (jboolean)env->GetBooleanField(peer, AwtMenuItem::isCheckboxID); @@ -216,7 +227,9 @@ item->LinkObjects(env, peer); item->SetMenuContainer(menu); item->SetNewID(); - menu->AddItem(item); + if (menu != NULL) { + menu->AddItem(item); + } } catch (...) { env->DeleteLocalRef(target); throw; @@ -626,7 +639,7 @@ mii.dwTypeData = (LPTSTR)(*sb); // find index by menu item id - int nMenuItemCount = ::GetMenuItemCount(hMenu);; + int nMenuItemCount = ::GetMenuItemCount(hMenu); int idx; for (idx = 0; (idx < nMenuItemCount); idx++) { memset(&mii1, 0, sizeof(MENUITEMINFO)); @@ -639,10 +652,7 @@ ::RemoveMenu(hMenu, idx, MF_BYPOSITION); ::InsertMenuItem(hMenu, idx, TRUE, &mii); - // Redraw menu bar if it was affected. - if (menu->GetMenuBar() == menu) { - ::DrawMenuBar(menu->GetOwnerHWnd()); - } + RedrawMenuBar(); } void AwtMenuItem::Enable(BOOL isEnabled) @@ -658,10 +668,7 @@ MF_BYCOMMAND | (isEnabled ? MF_ENABLED : MF_GRAYED)) != 0xFFFFFFFF); - // Redraw menu bar if it was affected. - if (menu->GetMenuBar() == menu) { - ::DrawMenuBar(menu->GetOwnerHWnd()); - } + RedrawMenuBar(); } void AwtMenuItem::SetState(BOOL isChecked) @@ -676,116 +683,170 @@ MF_BYCOMMAND | (isChecked ? MF_CHECKED : MF_UNCHECKED)) != 0xFFFFFFFF); - // Redraw menu bar if it was affected. - if (menu->GetMenuBar() == menu) { - ::DrawMenuBar(menu->GetOwnerHWnd()); + RedrawMenuBar(); +} + +/** + * If the menu changes after the system has created the window, + * this function must be called to draw the changed menu bar. + */ +void AwtMenuItem::RedrawMenuBar() { + AwtMenu* menu = GetMenuContainer(); + if (menu != NULL && menu->GetMenuBar() == menu){ + menu->RedrawMenuBar(); + } +} + +void AwtMenuItem::UpdateContainerLayout() { + AwtMenu* menu = GetMenuContainer(); + if (menu != NULL) { + DASSERT(menu != NULL && GetID() >= 0); + menu->UpdateLayout(); } } -LRESULT AwtMenuItem::WinThreadExecProc(ExecuteArgs * args) -{ - switch( args->cmdId ) { - case MENUITEM_SETLABEL: - { - LPCTSTR sb = (LPCTSTR)args->param1; - DASSERT(!IsBadStringPtr(sb, 20)); - this->SetLabel(sb); - } - break; - - case MENUITEM_ENABLE: - { - BOOL isEnabled = (BOOL)args->param1; - this->Enable(isEnabled); - } - break; +void AwtMenuItem::_SetLabel(void *param) { + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); - case MENUITEM_SETSTATE: - { - BOOL isChecked = (BOOL)args->param1; - this->SetState(isChecked); - } - break; + SetLabelStruct *sls = (SetLabelStruct *)param; + jobject self = sls->menuitem; + jstring label = sls->label; - default: - AwtObject::WinThreadExecProc(args); - break; - } - return 0L; -} - -void AwtMenuItem::_SetLabel(void *param) -{ - JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + int badAlloc = 0; + AwtMenuItem *m = NULL; - SetLabelStruct *sls = (SetLabelStruct *)param; - jobject self = sls->menuitem; - jstring label = sls->label; - - int badAlloc = 0; - AwtMenuItem *m = NULL; - - PDATA pData; - JNI_CHECK_PEER_GOTO(self, ret); - m = (AwtMenuItem *)pData; + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + m = (AwtMenuItem *)pData; // if (::IsWindow(m->GetOwnerHWnd())) - { - // fix for bug 4251036 MenuItem setLabel(null/"") behaves differently - // under Win32 and Solaris - jstring empty = NULL; - if (JNU_IsNull(env, label)) { - empty = JNU_NewStringPlatform(env, TEXT("")); - } - LPCTSTR labelPtr; - if (empty != NULL) - { - labelPtr = JNU_GetStringPlatformChars(env, empty, 0); - } - else - { - labelPtr = JNU_GetStringPlatformChars(env, label, 0); - } - if (labelPtr == NULL) - { - badAlloc = 1; - } - else - { - ExecuteArgs args; - args.cmdId = MENUITEM_SETLABEL; - args.param1 = (LPARAM)labelPtr; - m->WinThreadExecProc(&args); + // fix for bug 4251036 MenuItem setLabel(null/"") behaves differently + // under Win32 and Solaris + jstring empty = NULL; + if (JNU_IsNull(env, label)) + { + empty = JNU_NewStringPlatform(env, TEXT("")); + } + LPCTSTR labelPtr; if (empty != NULL) { - JNU_ReleaseStringPlatformChars(env, empty, labelPtr); + labelPtr = JNU_GetStringPlatformChars(env, empty, 0); + } + else + { + labelPtr = JNU_GetStringPlatformChars(env, label, 0); + } + if (labelPtr == NULL) + { + badAlloc = 1; } else { - JNU_ReleaseStringPlatformChars(env, label, labelPtr); + DASSERT(!IsBadStringPtr(labelPtr, 20)); + m->SetLabel(labelPtr); + if (empty != NULL) + { + JNU_ReleaseStringPlatformChars(env, empty, labelPtr); + } + else + { + JNU_ReleaseStringPlatformChars(env, label, labelPtr); + } + } + if (empty != NULL) + { + env->DeleteLocalRef(empty); } } - if (empty != NULL) - { - env->DeleteLocalRef(empty); - } - } ret: - env->DeleteGlobalRef(self); - if (label != NULL) - { - env->DeleteGlobalRef(label); - } + env->DeleteGlobalRef(self); + if (label != NULL) + { + env->DeleteGlobalRef(label); + } - delete sls; + delete sls; - if (badAlloc) - { - throw std::bad_alloc(); + if (badAlloc) + { + throw std::bad_alloc(); + } + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenuItem::_SetLabel, param); } } +void AwtMenuItem::_UpdateLayout(void *param) +{ + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + jobject self = (jobject)param; + + AwtMenuItem *m = NULL; + + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + + m = (AwtMenuItem *)pData; + + m->UpdateContainerLayout(); +ret: + env->DeleteGlobalRef(self); + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenuItem::_UpdateLayout, param); + } +} + +void AwtMenuItem::_SetEnable(void *param) +{ + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + SetEnableStruct *ses = (SetEnableStruct*) param; + jobject self = ses->menuitem; + jboolean isEnabled = ses->isEnabled; + + AwtMenuItem *m = NULL; + + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + + m = (AwtMenuItem *)pData; + + m->Enable(isEnabled); +ret: + env->DeleteGlobalRef(self); + delete ses; + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenuItem::_SetEnable, param); + } +} + +void AwtMenuItem::_SetState(void *param) +{ + if (AwtToolkit::IsMainThread()) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + SetStateStruct *sts = (SetStateStruct*) param; + jobject self = sts->menuitem; + jboolean isChecked = sts->isChecked; + + AwtMenuItem *m = NULL; + + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + m = (AwtMenuItem *)pData; + m->SetState(isChecked); +ret: + env->DeleteGlobalRef(self); + delete sts; + } else { + AwtToolkit::GetInstance().InvokeFunction(AwtMenuItem::_SetState, param); + } +} BOOL AwtMenuItem::IsSeparator() { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); if (env->EnsureLocalCapacity(2) < 0) { @@ -883,8 +944,8 @@ /* * Class: sun_awt_windows_WMenuItemPeer - * Method: _setLabel - * Signature: (Ljava/lang/String;)V + * Method: initIDs + * Signature: ()V */ JNIEXPORT void JNICALL Java_sun_awt_windows_WMenuItemPeer_initIDs(JNIEnv *env, jclass cls) @@ -927,6 +988,26 @@ /* * Class: sun_awt_windows_WMenuItemPeer + * Method: _setFont + * Signature: (Ljava/awt/Font;)V + */ +JNIEXPORT void JNICALL +Java_sun_awt_windows_WMenuItemPeer__1setFont(JNIEnv *env, jobject self, jobject) +{ + TRY; + + jobject selfGlobalRef = env->NewGlobalRef(self); + + // Current implementation of AwtMenuItem get font attribute from the peer + // directly, so we ignore it here, but update current menu layout. + AwtToolkit::GetInstance().SyncCall(AwtMenuItem::_UpdateLayout, selfGlobalRef); + // selfGlobalRef is deleted in _UpdateLayout + + CATCH_BAD_ALLOC; +} + +/* + * Class: sun_awt_windows_WMenuItemPeer * Method: create * Signature: (Lsun/awt/windows/WMenuPeer;)V */ @@ -936,13 +1017,9 @@ { TRY; - JNI_CHECK_NULL_RETURN(menu, "null Menu"); AwtToolkit::CreateComponent(self, menu, (AwtToolkit::ComponentFactory) AwtMenuItem::Create); - PDATA pData; - JNI_CHECK_PEER_CREATION_RETURN(self); - CATCH_BAD_ALLOC; } @@ -957,9 +1034,12 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(self); - AwtObject::WinThreadExec(self, AwtMenuItem::MENUITEM_ENABLE, (LPARAM)on ); + SetEnableStruct *ses = new SetEnableStruct; + ses->menuitem = env->NewGlobalRef(self); + ses->isEnabled = on; + + AwtToolkit::GetInstance().SyncCall(AwtMenuItem::_SetEnable, ses); + // global refs and ses are deleted in _SetEnable CATCH_BAD_ALLOC; } @@ -998,9 +1078,12 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(self); - AwtObject::WinThreadExec(self, AwtMenuItem::MENUITEM_SETSTATE, (LPARAM)on); + SetStateStruct *sts = new SetStateStruct; + sts->menuitem = env->NewGlobalRef(self); + sts->isChecked = on; + + AwtToolkit::GetInstance().SyncCall(AwtMenuItem::_SetState, sts); + // global refs and sts are deleted in _SetState CATCH_BAD_ALLOC; }
--- a/src/windows/native/sun/windows/awt_MenuItem.h Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_MenuItem.h Fri Jul 14 00:56:29 2017 +0100 @@ -46,14 +46,6 @@ class AwtMenuItem : public AwtObject { public: - // id's for methods executed on toolkit thread - enum { - MENUITEM_SETLABEL, - MENUITEM_ENABLE, - MENUITEM_SETSTATE, - MENUITEM_LAST - }; - /* java.awt.MenuComponent fields */ static jfieldID fontID; static jfieldID appContextID; @@ -78,7 +70,6 @@ virtual LPCTSTR GetClassName(); - void AwtMenuItem::LinkObjects(jobject peer); static AwtMenuItem* Create(jobject self, jobject menu); INLINE AwtMenu* GetMenuContainer() { return m_menuContainer; } @@ -148,6 +139,8 @@ void SetLabel(LPCTSTR sb); virtual void Enable(BOOL isEnabled); + virtual void UpdateContainerLayout(); + virtual void RedrawMenuBar(); void SetState(BOOL isChecked); /* @@ -155,14 +148,16 @@ */ MsgRouting WmNotify(UINT notifyCode); - virtual LRESULT WinThreadExecProc(ExecuteArgs * args); virtual BOOL IsDisabledAndPopup() { return FALSE; } virtual BOOL IsSeparator(); // invoked on Toolkit thread + static void _SetState(void *param); + static void _SetEnable(void *param); static void _SetLabel(void *param); + static void _UpdateLayout(void *param); protected: AwtMenu* m_menuContainer; /* The menu object containing this item */
--- a/src/windows/native/sun/windows/awt_PopupMenu.cpp Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_PopupMenu.cpp Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ } /* Create a new AwtPopupMenu object and menu. */ -AwtPopupMenu* AwtPopupMenu::Create(jobject self, AwtComponent* parent) +AwtPopupMenu* AwtPopupMenu::Create(jobject self, jobject parent) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); @@ -78,6 +78,9 @@ return NULL; } + JNI_CHECK_NULL_GOTO(parent, "peer", done); + AwtComponent* awtParent = (AwtComponent*) JNI_GET_PDATA(parent); + target = env->GetObjectField(self, AwtObject::targetID); JNI_CHECK_NULL_GOTO(target, "null target", done); @@ -95,7 +98,7 @@ popupMenu->SetHMenu(hMenu); popupMenu->LinkObjects(env, self); - popupMenu->SetParent(parent); + popupMenu->SetParent(awtParent); } catch (...) { env->DeleteLocalRef(target); throw; @@ -277,12 +280,8 @@ { TRY; - PDATA pData; - JNI_CHECK_PEER_RETURN(parent); - AwtComponent* awtParent = (AwtComponent *)pData; AwtToolkit::CreateComponent( - self, awtParent, (AwtToolkit::ComponentFactory)AwtPopupMenu::Create, FALSE); - JNI_CHECK_PEER_CREATION_RETURN(self); + self, parent, (AwtToolkit::ComponentFactory)AwtPopupMenu::Create); CATCH_BAD_ALLOC; }
--- a/src/windows/native/sun/windows/awt_PopupMenu.h Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_PopupMenu.h Fri Jul 14 00:56:29 2017 +0100 @@ -48,7 +48,7 @@ virtual LPCTSTR GetClassName(); /* Create a new AwtPopupMenu. This must be run on the main thread. */ - static AwtPopupMenu* Create(jobject self, AwtComponent* parent); + static AwtPopupMenu* Create(jobject self, jobject parent); /* Display the popup modally. */ void Show(JNIEnv *env, jobject event, BOOL isTrayIconPopup);
--- a/src/windows/native/sun/windows/awt_new.cpp Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/native/sun/windows/awt_new.cpp Fri Jul 14 00:56:29 2017 +0100 @@ -177,6 +177,9 @@ } else { // rethrow exception env->Throw(xcp); + // temp solution to reveal all concurrency issues in jtreg and JCK + // we will switch it back to silent mode before the release + env->ExceptionDescribe(); return xcp; } }
--- a/src/windows/resource/java.manifest Thu Apr 27 03:09:54 2017 +0100 +++ b/src/windows/resource/java.manifest Fri Jul 14 00:56:29 2017 +0100 @@ -52,6 +52,8 @@ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> </application> </compatibility>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,32 @@ +<!-- + Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. +--> + +<html> + <head> + <title>High resolution custom cursor test, bug ID 8028212</title> + </head> + <body> + <applet CODE="MultiResolutionCursorTest.class" WIDTH=300 HEIGHT=100></applet> + <p> See the dialog box (usually in upper left corner) for instructions</p> +</body> +</html> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Label; +import java.awt.Point; +import java.awt.TextArea; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.util.LinkedList; +import java.util.List; +import javax.swing.JApplet; +import sun.awt.OSInfo; +import sun.awt.image.MultiResolutionImage; + +/** + * @test + * @bug 8028212 + * @summary [macosx] Custom Cursor HiDPI support + * @author Alexander Scherbatiy + * @run applet/manual=yesno MultiResolutionCursorTest.html + */ +public class MultiResolutionCursorTest extends JApplet { + //Declare things used in the test, like buttons and labels here + + static final int sizes[] = {16, 32, 128}; + static final Color colors[] = {Color.WHITE, Color.RED, Color.GREEN, Color.BLUE}; + + public void init() { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + this.setLayout(new BorderLayout()); + + if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) { + String[] instructions = { + "Verify that high resolution custom cursor is used" + + " on HiDPI displays.", + "1) Run the test on Retina display or enable the Quartz Debug" + + " and select the screen resolution with (HiDPI) label", + "2) Move the cursor to the Test Frame", + "3) Check that cursor has red, green or blue color", + "If so, press PASS, else press FAIL." + }; + Sysout.createDialogWithInstructions(instructions); + + } else { + String[] instructions = { + "This test is not applicable to the current platform. Press PASS." + }; + Sysout.createDialogWithInstructions(instructions); + } + }//End init() + + public void start() { + //Get things going. Request focus, set size, et cetera + setSize(200, 200); + setVisible(true); + validate(); + + final Image image = new MultiResolutionCursor(); + + int center = sizes[0] / 2; + Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor( + image, new Point(center, center), "multi-resolution cursor"); + + Frame frame = new Frame("Test Frame"); + frame.setSize(300, 300); + frame.setLocation(300, 50); + frame.add(new Label("Move cursor here")); + frame.setCursor(cursor); + frame.setVisible(true); + }// start() + + + static class MultiResolutionCursor extends BufferedImage implements MultiResolutionImage { + + List<Image> highResolutionImages; + + public MultiResolutionCursor() { + super(sizes[0], sizes[0], BufferedImage.TYPE_INT_RGB); + + draw(getGraphics(), 0); + highResolutionImages = new LinkedList<>(); + highResolutionImages.add(this); + + for (int i = 1; i < sizes.length; i++) { + BufferedImage highResolutionImage = + new BufferedImage(sizes[i], sizes[i], BufferedImage.TYPE_INT_RGB); + draw(highResolutionImage.getGraphics(), i); + highResolutionImages.add(highResolutionImage); + } + } + + @Override + public Image getResolutionVariant(int width, int height) { + + for (int i = 0; i < sizes.length; i++) { + Image image = highResolutionImages.get(i); + int w = image.getWidth(null); + int h = image.getHeight(null); + + if (width <= w && height <= h) { + return image; + } + } + + return highResolutionImages.get(highResolutionImages.size() - 1); + } + + void draw(Graphics graphics, int index) { + Graphics2D g2 = (Graphics2D) graphics; + Color color = colors[index]; + g2.setColor(color); + g2.fillRect(0, 0, sizes[index], sizes[index]); + } + + @Override + public List<Image> getResolutionVariants() { + return highResolutionImages; + } + } +}// class BlockedWindowTest + +/* Place other classes related to the test after this line */ +/** + * ************************************************** + * 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 { + + private 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); + } +}// Te \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/ObscuredFrame/ObscuredFrameTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016, 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 8171952 + * @summary Tests that getMousePosition() returns null for obscured component. + * @author Dmitry Markov + * @library ../../regtesthelpers + * @build Util + * @run main ObscuredFrameTest + */ + +import java.awt.*; + +import test.java.awt.regtesthelpers.Util; + +public class ObscuredFrameTest { + public static void main(String[] args) { + Robot robot = Util.createRobot(); + + Frame frame = new Frame("Obscured Frame"); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + Button button = new Button("Button"); + frame.add(button); + + Dialog dialog = new Dialog(frame, "Visible Dialog", false); + dialog.setSize(200, 200); + dialog.setLocationRelativeTo(null); + dialog.setVisible(true); + + frame.setVisible(true); + + Util.waitForIdle(robot); + + Util.pointOnComp(button, robot); + Util.waitForIdle(robot); + robot.delay(2000); + + try { + if (button.getMousePosition() != null) { + throw new RuntimeException("Test Failed! Mouse position is not null for obscured component."); + } + } finally { + frame.dispose(); + dialog.dispose(); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/MouseInfo/GetPointerInfoTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 + @summary unit test for getPointerInfo() from MouseInfo class + @author dav@sparc.spb.su: area= + @bug 4009555 + @run main GetPointerInfoTest +*/ + +import java.awt.*; + +/** + * Simply check the result on non-null and results are correct. + */ +public class GetPointerInfoTest { + private static final String successStage = "Test stage completed.Passed."; + + public static void main(String[] args) throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gds = ge.getScreenDevices(); + int gdslen = gds.length; + System.out.println("There are " + gdslen + " Graphics Devices"); + if (gdslen == 0) { + System.out.println("Nothing to be done."); + return; + } + Robot robot = new Robot(gds[0]); + robot.setAutoDelay(0); + robot.setAutoWaitForIdle(true); + robot.delay(10); + robot.waitForIdle(); + Point p = new Point(101, 99); + robot.mouseMove(p.x, p.y); + + PointerInfo pi = MouseInfo.getPointerInfo(); + if (pi == null) { + throw new RuntimeException("Test failed. getPointerInfo() returned null value."); + } else { + System.out.println(successStage); + } + Point piLocation = pi.getLocation(); + + if (piLocation.x != p.x || piLocation.y != p.y) { + throw new RuntimeException("Test failed.getPointerInfo() returned incorrect result."); + } else { + System.out.println(successStage); + } + + System.out.println("Test PASSED."); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/MouseInfo/MultiscreenPointerInfo.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 + @summary unit test for getPointerInfo() from MouseInfo class + @author prs@sparc.spb.su: area= + @bug 4009555 + @run main MultiscreenPointerInfo +*/ + +import java.awt.*; + +/** + * Simply check the result on non-null and results are correct. + */ +public class MultiscreenPointerInfo +{ + private static final String successStage = "Test stage completed.Passed."; + + public static void main(String[] args) throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gds = ge.getScreenDevices(); + int gdslen = gds.length; + System.out.println("There are " + gdslen + " Graphics Devices"); + if (gdslen < 2) { + System.out.println("Nothing to be done. PASSED automatically."); + return; + } + Rectangle rx = gds[1].getDefaultConfiguration().getBounds(); + Robot robot; + + if (rx.x == 0 && rx.y == 0) { + // Assuming independent graphics devices + robot = new Robot(gds[1]); + } else { + // Means we have a virtual device + robot = new Robot(gds[0]); + } + robot.setAutoDelay(0); + robot.setAutoWaitForIdle(true); + robot.delay(10); + robot.waitForIdle(); + Point p = new Point(rx.x + 101, rx.y + 99); + robot.mouseMove(p.x, p.y); + PointerInfo pi = MouseInfo.getPointerInfo(); + if (pi == null) { + throw new RuntimeException("Test failed. getPointerInfo() returned null value."); + } else { + System.out.println(successStage); + } + + Point piLocation = pi.getLocation(); + + if (piLocation.x != p.x || piLocation.y != p.y) { + throw new RuntimeException("Test failed.getPointerInfo() returned incorrect location."); + } else { + System.out.println(successStage); + } + + GraphicsDevice dev = pi.getDevice(); + + if (dev != gds[1]) { + throw new RuntimeException("Test failed.getPointerInfo() returned incorrect device."); + } else { + System.out.println(successStage); + } + System.out.println("Test PASSED."); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.awt.Dimension; +import java.awt.Frame; +import java.awt.ScrollPane; +import java.awt.Toolkit; + +import sun.awt.SunToolkit; + +/** + * @test + * @bug 7124213 + * @author Sergey Bylokhov + */ +public final class ScrollPanePreferredSize { + + public static void main(final String[] args) { + final Dimension expected = new Dimension(300, 300); + final Frame frame = new Frame(); + final ScrollPane sp = new ScrollPane(); + sp.setSize(expected); + frame.add(sp); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + sleep(); + final Dimension size = frame.getSize(); + if (size.width < expected.width || size.height < expected.height) { + throw new RuntimeException( + "Expected size: >= " + expected + ", actual size: " + size); + } + frame.dispose(); + } + + private static void sleep() { + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + try { + Thread.sleep(500L); + } catch (InterruptedException ignored) { + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.awt.Dimension; +import java.awt.Frame; +import java.awt.TextArea; +import java.awt.Toolkit; + +import sun.awt.SunToolkit; + +/** + * @test + * @bug 7160627 + * @summary We shouldn't get different frame size when we call Frame.pack() + * twice. + * @author Sergey Bylokhov + */ +public final class TextAreaTwicePack { + + public static void main(final String[] args) { + final Frame frame = new Frame(); + final TextArea ta = new TextArea(); + frame.add(ta); + frame.pack(); + frame.setVisible(true); + sleep(); + final Dimension before = frame.getSize(); + frame.pack(); + final Dimension after = frame.getSize(); + if (!after.equals(before)) { + throw new RuntimeException( + "Expected size: " + before + ", actual size: " + after); + } + frame.dispose(); + } + + private static void sleep() { + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + try { + Thread.sleep(500L); + } catch (InterruptedException ignored) { + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Window/8027025/Test8027025.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 8027025 + * @summary [macosx] getLocationOnScreen returns 0 if parent invisible + * @author Petr Pchelko + * @run main Test8027025 + */ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import java.awt.*; +import java.util.concurrent.atomic.AtomicReference; + +public class Test8027025 { + + private static Frame frame; + private static Window window; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new Frame("Dummy Frame"); + window = new Window(frame); + window.setSize(200, 200); + window.setLocationRelativeTo(frame); + window.setVisible(true); + } + }); + + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + + final AtomicReference<Point> point = new AtomicReference<>(); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + point.set(window.getLocationOnScreen()); + } + }); + + if (point.get().getX() == 0 || point.get().getY() == 0) { + throw new RuntimeException("Test failed. The location was not set"); + } + } finally { + if (frame != null) { + frame.dispose(); + } + if (window != null) { + window.dispose(); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Window/WindowJumpingTest/WindowJumpingTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016, 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 8080729 + * @summary Dialogs on multiscreen jump to parent frame on focus gain + * @author Dmitry Markov + * @library ../../regtesthelpers + * @build Util + * @run main WindowJumpingTest + */ +import java.awt.*; + +import test.java.awt.regtesthelpers.Util; + +public class WindowJumpingTest { + public static void main(String[] args) throws AWTException { + Robot r = Util.createRobot(); + + GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices(); + if (graphicsDevices.length < 2) { + System.out.println("This is multi-screen test... Skipping!"); + return; + } + + Frame frame = new Frame("Frame", graphicsDevices[0].getDefaultConfiguration()); + frame.setSize(400, 300); + frame.setVisible(true); + Util.waitForIdle(r); + + Dialog dialog = new Dialog(frame, "Dialog", false, graphicsDevices[1].getDefaultConfiguration()); + dialog.setSize(400, 300); + dialog.setVisible(true); + Util.waitForIdle(r); + + checkGraphicsDevice(frame, graphicsDevices[0]); + checkGraphicsDevice(dialog, graphicsDevices[1]); + + Util.clickOnComp(frame, r); + Util.waitForIdle(r); + + checkGraphicsDevice(frame, graphicsDevices[0]); + checkGraphicsDevice(dialog, graphicsDevices[1]); + + Util.clickOnComp(dialog, r); + Util.waitForIdle(r); + + checkGraphicsDevice(frame, graphicsDevices[0]); + checkGraphicsDevice(dialog, graphicsDevices[1]); + + dialog.dispose(); + frame.dispose(); + } + + private static void checkGraphicsDevice(Window window, GraphicsDevice graphicsDevice) { + GraphicsDevice actualGraphicsDevice = window.getGraphicsConfiguration().getDevice(); + + if (!actualGraphicsDevice.equals(graphicsDevice)) { + System.err.println("Expected screen: " + graphicsDevice); + System.err.println("Actual screen: "+ actualGraphicsDevice); + throw new RuntimeException("Test FAILED: " + window + " is displayed on wrong screen"); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/MultiResolutionImage/NSImageToMultiResolutionImageTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.awt.Image; +import java.awt.Toolkit; +import sun.awt.OSInfo; +import sun.awt.image.MultiResolutionImage; +/* + * @test + * @bug 8033534 + * @summary [macosx] Get MultiResolution image from native system + * @author Alexander Scherbatiy + * @run main NSImageToMultiResolutionImageTest + */ + +public class NSImageToMultiResolutionImageTest { + + public static void main(String[] args) throws Exception { + + if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { + return; + } + + String icon = "NSImage://NSApplicationIcon"; + final Image image = Toolkit.getDefaultToolkit().getImage(icon); + + if (!(image instanceof MultiResolutionImage)) { + throw new RuntimeException("Icon does not have resolution variants!"); + } + + MultiResolutionImage multiResolutionImage = (MultiResolutionImage) image; + + int width = 0; + int height = 0; + + for (Image resolutionVariant : multiResolutionImage.getResolutionVariants()) { + int rvWidth = resolutionVariant.getWidth(null); + int rvHeight = resolutionVariant.getHeight(null); + if (rvWidth < width || rvHeight < height) { + throw new RuntimeException("Resolution variants are not sorted!"); + } + width = rvWidth; + height = rvHeight; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/MultiResolutionImageTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,620 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import javax.imageio.ImageIO; +import sun.awt.OSInfo; +import sun.awt.SunHints; +import java.awt.MediaTracker; +import java.awt.geom.AffineTransform; +import java.awt.image.ImageObserver; +import java.util.Arrays; +import java.util.List; +import javax.swing.JPanel; +import sun.awt.SunToolkit; +import sun.awt.image.MultiResolutionImage; + +/** + * @test + * @bug 8011059 + * @author Alexander Scherbatiy + * @summary [macosx] Make JDK demos look perfect on retina displays + * @run main MultiResolutionImageTest CUSTOM + * @run main MultiResolutionImageTest TOOLKIT_PREPARE + * @run main MultiResolutionImageTest TOOLKIT_LOAD + * @run main MultiResolutionImageTest TOOLKIT + */ +public class MultiResolutionImageTest { + + private static final int IMAGE_WIDTH = 300; + private static final int IMAGE_HEIGHT = 200; + private static final Color COLOR_1X = Color.GREEN; + private static final Color COLOR_2X = Color.BLUE; + private static final String IMAGE_NAME_1X = "image.png"; + private static final String IMAGE_NAME_2X = "image@2x.png"; + + public static void main(String[] args) throws Exception { + + System.out.println("args: " + args.length); + + if (args.length == 0) { + throw new RuntimeException("Not found a test"); + } + + String test = args[0]; + + System.out.println("TEST: " + test); + System.out.println("CHECK OS: " + checkOS()); + + if ("CUSTOM".equals(test)) { + testCustomMultiResolutionImage(); + } else if (checkOS()) { + switch (test) { + case "CUSTOM": + break; + case "TOOLKIT_PREPARE": + testToolkitMultiResolutionImagePrepare(); + break; + case "TOOLKIT_LOAD": + testToolkitMultiResolutionImageLoad(); + break; + case "TOOLKIT": + testToolkitMultiResolutionImage(); + testImageNameTo2xParsing(); + break; + default: + throw new RuntimeException("Unknown test: " + test); + } + } + } + + static boolean checkOS() { + return OSInfo.getOSType() == OSInfo.OSType.MACOSX; + } + + public static void testCustomMultiResolutionImage() { + testCustomMultiResolutionImage(false); + testCustomMultiResolutionImage(true); + } + + public static void testCustomMultiResolutionImage(boolean enableImageScaling) { + + Image image = new MultiResolutionBufferedImage(); + + // Same image size + BufferedImage bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.drawImage(image, 0, 0, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false); + + // Twice image size + bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling); + + // Scale 2x + bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.scale(2, 2); + g2d.drawImage(image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling); + + // Rotate + bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.drawImage(image, 0, 0, null); + g2d.rotate(Math.PI / 4); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false); + + // Scale 2x and Rotate + bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.scale(-2, 2); + g2d.rotate(-Math.PI / 10); + g2d.drawImage(image, -IMAGE_WIDTH, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling); + + // General Transform + bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + float delta = 0.05f; + float cos = 1 - delta * delta / 2; + float sin = 1 + delta; + AffineTransform transform = new AffineTransform(2 * cos, 0.1, 0.3, -2 * sin, 10, -5); + g2d.setTransform(transform); + g2d.drawImage(image, 0, -IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling); + + int D = 10; + // From Source to small Destination region + bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.drawImage(image, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, + D, D, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false); + + // From Source to large Destination region + bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + g2d = (Graphics2D) bufferedImage.getGraphics(); + setImageScalingHint(g2d, enableImageScaling); + g2d.drawImage(image, D, D, 2 * IMAGE_WIDTH - D, 2 * IMAGE_HEIGHT - D, + IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null); + checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling); + } + + static class MultiResolutionBufferedImage extends BufferedImage + implements MultiResolutionImage { + + Image highResolutionImage; + + public MultiResolutionBufferedImage() { + super(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + highResolutionImage = new BufferedImage( + 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + draw(getGraphics(), 1); + draw(highResolutionImage.getGraphics(), 2); + } + + void draw(Graphics graphics, float resolution) { + Graphics2D g2 = (Graphics2D) graphics; + g2.scale(resolution, resolution); + g2.setColor((resolution == 1) ? COLOR_1X : COLOR_2X); + g2.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); + } + + @Override + public Image getResolutionVariant(int width, int height) { + return ((width <= getWidth() && height <= getHeight())) + ? this : highResolutionImage; + } + + @Override + public List<Image> getResolutionVariants() { + return Arrays.asList(this, highResolutionImage); + } + } + + static void testToolkitMultiResolutionImagePrepare() throws Exception { + + generateImages(); + + File imageFile = new File(IMAGE_NAME_1X); + String fileName = imageFile.getAbsolutePath(); + + Image image = Toolkit.getDefaultToolkit().getImage(fileName); + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image)); + + testToolkitMultiResolutionImageLoad(image); + } + + static void testToolkitMultiResolutionImageLoad() throws Exception { + + generateImages(); + + File imageFile = new File(IMAGE_NAME_1X); + String fileName = imageFile.getAbsolutePath(); + Image image = Toolkit.getDefaultToolkit().getImage(fileName); + testToolkitMultiResolutionImageLoad(image); + } + + static void testToolkitMultiResolutionImageLoad(Image image) throws Exception { + + MediaTracker tracker = new MediaTracker(new JPanel()); + tracker.addImage(image, 0); + tracker.waitForID(0); + if (tracker.isErrorAny()) { + throw new RuntimeException("Error during image loading"); + } + tracker.removeImage(image, 0); + + testImageLoaded(image); + + int w = image.getWidth(null); + int h = image.getHeight(null); + + Image resolutionVariant = ((MultiResolutionImage) image) + .getResolutionVariant(2 * w, 2 * h); + + if (image == resolutionVariant) { + throw new RuntimeException("Resolution variant is not loaded"); + } + + testImageLoaded(resolutionVariant); + } + + static void testImageLoaded(Image image) { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + int flags = toolkit.checkImage(image, IMAGE_WIDTH, IMAGE_WIDTH, new SilentImageObserver()); + if ((flags & (ImageObserver.FRAMEBITS | ImageObserver.ALLBITS)) == 0) { + throw new RuntimeException("Image is not loaded!"); + } + } + + static class SilentImageObserver implements ImageObserver { + + @Override + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + throw new RuntimeException("Observer should not be called!"); + } + } + + static class LoadImageObserver implements ImageObserver { + + Image image; + + public LoadImageObserver(Image image) { + this.image = image; + } + + @Override + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + + if (image != img) { + throw new RuntimeException("Original image is not passed to the observer"); + } + + if ((infoflags & ImageObserver.WIDTH) != 0) { + if (width != IMAGE_WIDTH) { + throw new RuntimeException("Original width is not passed to the observer"); + } + } + + if ((infoflags & ImageObserver.HEIGHT) != 0) { + if (height != IMAGE_HEIGHT) { + throw new RuntimeException("Original height is not passed to the observer"); + } + } + + return (infoflags & ALLBITS) == 0; + } + + } + + static void testToolkitMultiResolutionImage() throws Exception { + + generateImages(); + + File imageFile = new File(IMAGE_NAME_1X); + String fileName = imageFile.getAbsolutePath(); + URL url = imageFile.toURI().toURL(); + testToolkitMultiResolutionImageChache(fileName, url); + + Image image = Toolkit.getDefaultToolkit().getImage(fileName); + testToolkitImageObserver(image); + testToolkitMultiResolutionImage(image, false); + testToolkitMultiResolutionImage(image, true); + + image = Toolkit.getDefaultToolkit().getImage(url); + testToolkitImageObserver(image); + testToolkitMultiResolutionImage(image, false); + testToolkitMultiResolutionImage(image, true); + } + + static void testToolkitMultiResolutionImageChache(String fileName, URL url) { + + Image img1 = Toolkit.getDefaultToolkit().getImage(fileName); + if (!(img1 instanceof MultiResolutionImage)) { + throw new RuntimeException("Not a MultiResolutionImage"); + } + + Image img2 = Toolkit.getDefaultToolkit().getImage(fileName); + if (img1 != img2) { + throw new RuntimeException("Image is not cached"); + } + + img1 = Toolkit.getDefaultToolkit().getImage(url); + if (!(img1 instanceof MultiResolutionImage)) { + throw new RuntimeException("Not a MultiResolutionImage"); + } + + img2 = Toolkit.getDefaultToolkit().getImage(url); + if (img1 != img2) { + throw new RuntimeException("Image is not cached"); + } + } + + static void testToolkitMultiResolutionImage(Image image, boolean enableImageScaling) + throws Exception { + + MediaTracker tracker = new MediaTracker(new JPanel()); + tracker.addImage(image, 0); + tracker.waitForID(0); + if (tracker.isErrorAny()) { + throw new RuntimeException("Error during image loading"); + } + + final BufferedImage bufferedImage1x = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + Graphics2D g1x = (Graphics2D) bufferedImage1x.getGraphics(); + setImageScalingHint(g1x, false); + g1x.drawImage(image, 0, 0, null); + checkColor(bufferedImage1x.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false); + + Image resolutionVariant = ((MultiResolutionImage) image). + getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT); + + if (resolutionVariant == null) { + throw new RuntimeException("Resolution variant is null"); + } + + MediaTracker tracker2x = new MediaTracker(new JPanel()); + tracker2x.addImage(resolutionVariant, 0); + tracker2x.waitForID(0); + if (tracker2x.isErrorAny()) { + throw new RuntimeException("Error during scalable image loading"); + } + + final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH, + 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics(); + setImageScalingHint(g2x, enableImageScaling); + g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null); + checkColor(bufferedImage2x.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling); + + if (!(image instanceof MultiResolutionImage)) { + throw new RuntimeException("Not a MultiResolutionImage"); + } + + MultiResolutionImage multiResolutionImage = (MultiResolutionImage) image; + + Image image1x = multiResolutionImage.getResolutionVariant(IMAGE_WIDTH, IMAGE_HEIGHT); + Image image2x = multiResolutionImage.getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT); + + if (image1x.getWidth(null) * 2 != image2x.getWidth(null) + || image1x.getHeight(null) * 2 != image2x.getHeight(null)) { + throw new RuntimeException("Wrong resolution variant size"); + } + } + + static void testToolkitImageObserver(final Image image) { + + ImageObserver observer = new ImageObserver() { + + @Override + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + + if (img != image) { + throw new RuntimeException("Wrong image in observer"); + } + + if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT)) != 0) { + throw new RuntimeException("Error during image loading"); + } + + return (infoflags & ImageObserver.ALLBITS) == 0; + + } + }; + + final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH, + 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics(); + setImageScalingHint(g2x, true); + + g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, observer); + + } + + static void setImageScalingHint(Graphics2D g2d, boolean enableImageScaling) { + g2d.setRenderingHint(SunHints.KEY_RESOLUTION_VARIANT, enableImageScaling + ? SunHints.VALUE_RESOLUTION_VARIANT_ON + : SunHints.VALUE_RESOLUTION_VARIANT_OFF); + } + + static void checkColor(int rgb, boolean isImageScaled) { + + if (!isImageScaled && COLOR_1X.getRGB() != rgb) { + throw new RuntimeException("Wrong 1x color: " + new Color(rgb)); + } + + if (isImageScaled && COLOR_2X.getRGB() != rgb) { + throw new RuntimeException("Wrong 2x color" + new Color(rgb)); + } + } + + static void generateImages() throws Exception { + if (!new File(IMAGE_NAME_1X).exists()) { + generateImage(1); + } + + if (!new File(IMAGE_NAME_2X).exists()) { + generateImage(2); + } + } + + static void generateImage(int scale) throws Exception { + BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + Graphics g = image.getGraphics(); + g.setColor(scale == 1 ? COLOR_1X : COLOR_2X); + g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT); + File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X); + ImageIO.write(image, "png", file); + } + + static void testImageNameTo2xParsing() throws Exception { + + for (String[] testNames : TEST_FILE_NAMES) { + String testName = testNames[0]; + String goldenName = testNames[1]; + String resultName = getTestScaledImageName(testName); + + if (!isValidPath(testName) && resultName == null) { + continue; + } + + if (goldenName.equals(resultName)) { + continue; + } + + throw new RuntimeException("Test name " + testName + + ", result name: " + resultName); + } + + for (URL[] testURLs : TEST_URLS) { + URL testURL = testURLs[0]; + URL goldenURL = testURLs[1]; + URL resultURL = getTestScaledImageURL(testURL); + + if (!isValidPath(testURL.getPath()) && resultURL == null) { + continue; + } + + if (goldenURL.equals(resultURL)) { + continue; + } + + throw new RuntimeException("Test url: " + testURL + + ", result url: " + resultURL); + } + + } + + static URL getTestScaledImageURL(URL url) throws Exception { + Method method = getScalableImageMethod("getScaledImageURL", URL.class); + return (URL) method.invoke(null, url); + } + + static String getTestScaledImageName(String name) throws Exception { + Method method = getScalableImageMethod("getScaledImageName", String.class); + return (String) method.invoke(null, name); + } + + private static boolean isValidPath(String path) { + return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".") + && !path.contains("@2x"); + } + + private static Method getScalableImageMethod(String name, + Class... parameterTypes) throws Exception { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + Method method = toolkit.getClass().getDeclaredMethod(name, parameterTypes); + method.setAccessible(true); + return method; + } + private static final String[][] TEST_FILE_NAMES; + private static final URL[][] TEST_URLS; + + static { + TEST_FILE_NAMES = new String[][]{ + {"", null}, + {".", null}, + {"..", null}, + {"/", null}, + {"/.", null}, + {"dir/", null}, + {"dir/.", null}, + {"aaa@2x.png", null}, + {"/dir/aaa@2x.png", null}, + {"image", "image@2x"}, + {"image.ext", "image@2x.ext"}, + {"image.aaa.ext", "image.aaa@2x.ext"}, + {"dir/image", "dir/image@2x"}, + {"dir/image.ext", "dir/image@2x.ext"}, + {"dir/image.aaa.ext", "dir/image.aaa@2x.ext"}, + {"dir/aaa.bbb/image", "dir/aaa.bbb/image@2x"}, + {"dir/aaa.bbb/image.ext", "dir/aaa.bbb/image@2x.ext"}, + {"dir/aaa.bbb/image.ccc.ext", "dir/aaa.bbb/image.ccc@2x.ext"}, + {"/dir/image", "/dir/image@2x"}, + {"/dir/image.ext", "/dir/image@2x.ext"}, + {"/dir/image.aaa.ext", "/dir/image.aaa@2x.ext"}, + {"/dir/aaa.bbb/image", "/dir/aaa.bbb/image@2x"}, + {"/dir/aaa.bbb/image.ext", "/dir/aaa.bbb/image@2x.ext"}, + {"/dir/aaa.bbb/image.ccc.ext", "/dir/aaa.bbb/image.ccc@2x.ext"} + }; + try { + TEST_URLS = new URL[][]{ + // file + {new URL("file:/aaa"), new URL("file:/aaa@2x")}, + {new URL("file:/aaa.ext"), new URL("file:/aaa@2x.ext")}, + {new URL("file:/aaa.bbb.ext"), new URL("file:/aaa.bbb@2x.ext")}, + {new URL("file:/ccc/aaa.bbb.ext"), + new URL("file:/ccc/aaa.bbb@2x.ext")}, + {new URL("file:/ccc.ddd/aaa.bbb.ext"), + new URL("file:/ccc.ddd/aaa.bbb@2x.ext")}, + {new URL("file:///~/image"), new URL("file:///~/image@2x")}, + {new URL("file:///~/image.ext"), + new URL("file:///~/image@2x.ext")}, + // http + {new URL("http://www.test.com"), null}, + {new URL("http://www.test.com/"), null}, + {new URL("http://www.test.com///"), null}, + {new URL("http://www.test.com/image"), + new URL("http://www.test.com/image@2x")}, + {new URL("http://www.test.com/image.ext"), + new URL("http://www.test.com/image@2x.ext")}, + {new URL("http://www.test.com/dir/image"), + new URL("http://www.test.com/dir/image@2x")}, + {new URL("http://www.test.com:80/dir/image.aaa.ext"), + new URL("http://www.test.com:80/dir/image.aaa@2x.ext")}, + {new URL("http://www.test.com:8080/dir/image.aaa.ext"), + new URL("http://www.test.com:8080/dir/image.aaa@2x.ext")}, + // jar + {new URL("jar:file:/dir/Java2D.jar!/image"), + new URL("jar:file:/dir/Java2D.jar!/image@2x")}, + {new URL("jar:file:/dir/Java2D.jar!/image.aaa.ext"), + new URL("jar:file:/dir/Java2D.jar!/image.aaa@2x.ext")}, + {new URL("jar:file:/dir/Java2D.jar!/images/image"), + new URL("jar:file:/dir/Java2D.jar!/images/image@2x")}, + {new URL("jar:file:/dir/Java2D.jar!/images/image.ext"), + new URL("jar:file:/dir/Java2D.jar!/images/image@2x.ext")}, + {new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image.ext"), + new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image@2x.ext")}, + {new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image.ext"), + new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image@2x.ext")},}; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + static class PreloadedImageObserver implements ImageObserver { + + @Override + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + throw new RuntimeException("Image should be already preloaded"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.awt.Color; +import java.lang.reflect.InvocationTargetException; + +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.UIDefaults; +import javax.swing.UIManager; +import javax.swing.plaf.ColorUIResource; + +/** + * @test + * @bug 8033786 + * @summary JDialog should update background color of the native peer. + * @author Sergey Bylokhov + */ +public final class WrongBackgroundColor { + + public static void main(final String[] args) + throws InvocationTargetException, InterruptedException { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + UIDefaults ui = UIManager.getDefaults(); + ui.put("control", new ColorUIResource(54, 54, 54)); + final JDialog dialog = new JDialog(); + final JFrame frame = new JFrame(); + frame.pack(); + dialog.pack(); + final Color dialogBackground = dialog.getBackground(); + final Color frameBackground = frame.getBackground(); + frame.dispose(); + dialog.dispose(); + if (!dialogBackground.equals(frameBackground)) { + System.err.println("Expected:" + frameBackground); + System.err.println("Actual:" + dialogBackground); + throw new RuntimeException("Wrong background color"); + } + } + }); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JMenuItem/8031573/bug8031573.html Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,40 @@ +<!-- + Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + 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> +<body> + +Verify that high resolution system icons are used JCheckBoxMenuItem +on HiDPI displays. + +If the display does not support HiDPI mode press PASS. + +1. Run the test on HiDPI Display. +2. Press the Menu in the applet +3. Check that the icon on the JCheckBoxMenuItem is smooth +If so, press PASS, else press FAIL. + +<applet code="bug8031573.class" width=250 height=250></applet> + +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JMenuItem/8031573/bug8031573.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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.awt.FlowLayout; +import javax.swing.JApplet; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.SwingUtilities; + +/* @test + * @bug 8031573 + * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered + * in high resolution on Retina + * @author Alexander Scherbatiy + * @run applet/manual=yesno bug8031573.html + */ +public class bug8031573 extends JApplet { + + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + JMenuBar bar = new JMenuBar(); + JMenu menu = new JMenu("Menu"); + JCheckBoxMenuItem checkBoxMenuItem + = new JCheckBoxMenuItem("JCheckBoxMenuItem"); + checkBoxMenuItem.setSelected(true); + menu.add(checkBoxMenuItem); + bar.add(menu); + setJMenuBar(bar); + } + }); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JOptionPane/8024926/bug8024926.html Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,32 @@ +<!-- + Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. +--> + +<html> + <head> + <title>High resolution icon test, bug ID 8024926</title> + </head> + <body> + <applet CODE="bug8024926.class" WIDTH=300 HEIGHT=100></applet> + <p> See the dialog box (usually in upper left corner) for instructions</p> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JOptionPane/8024926/bug8024926.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.awt.BorderLayout; +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.TextArea; +import javax.swing.JApplet; +import javax.swing.JOptionPane; +import sun.awt.OSInfo; + +/** + * @test + * @bug 8024926 + * @summary [macosx] AquaIcon HiDPI support + * @author Alexander Scherbatiy + * @run applet/manual=yesno bug8024926.html + */ +public class bug8024926 extends JApplet { + //Declare things used in the test, like buttons and labels here + + public void init() { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + this.setLayout(new BorderLayout()); + + + if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) { + String[] instructions = { + "Verify that high resolution system icons are used" + + " in JOptionPane on HiDPI displays.", + "1) Run the test on Retina display or enable the Quartz Debug" + + " and select the screen resolution with (HiDPI) label", + "2) Check that the error icon on the JOptionPane is smooth", + "If so, press PASS, else press FAIL." + }; + Sysout.createDialogWithInstructions(instructions); + + } else { + String[] instructions = { + "This test is not applicable to the current platform. Press PASS." + }; + Sysout.createDialogWithInstructions(instructions); + } + + + }//End init() + + public void start() { + //Get things going. Request focus, set size, et cetera + setSize(200, 200); + setVisible(true); + validate(); + EventQueue.invokeLater(new Runnable() { + + public void run() { + createAndShowGUI(); + } + }); + }// start() + + //The rest of this class is the actions which perform the test... + //Use Sysout.println to communicate with the user NOT System.out!! + //Sysout.println ("Something Happened!"); + private static void createAndShowGUI() { + JOptionPane.showMessageDialog(null, + "Icons should have high resolution.", + "High resolution icon test.", + JOptionPane.ERROR_MESSAGE); + } +}// class BlockedWindowTest + +/* Place other classes related to the test after this line */ +/** + * ************************************************** + * 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 { + + private 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/test/javax/swing/JPopupMenu/7154841/bug7154841.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 7154841 + @summary JPopupMenu is overlapped by a Dock on Mac OS X + @author Petr Pchelko + */ + +import sun.awt.OSInfo; +import sun.awt.SunToolkit; + +import java.awt.*; +import javax.swing.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.util.concurrent.atomic.AtomicReference; + +public class bug7154841 { + + private static final int STEP = 10; + + private static volatile boolean passed = false; + private static JFrame frame; + private static JPopupMenu popupMenu; + private static AtomicReference<Rectangle> screenBounds = new AtomicReference<>(); + + private static void initAndShowUI() { + popupMenu = new JPopupMenu(); + for (int i = 0; i < 100; i++) { + JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); + item.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + passed = true; + } + }); + popupMenu.add(item); + } + + frame = new JFrame(); + screenBounds.set(getScreenBounds()); + frame.setBounds(screenBounds.get()); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { + return; // Test only for Mac OS X + } + + try { + Robot r = new Robot(); + r.setAutoDelay(100); + r.setAutoWaitForIdle(true); + r.mouseMove(0, 0); + + SwingUtilities.invokeAndWait(bug7154841::initAndShowUI); + + sleep(); + + SwingUtilities.invokeAndWait(() -> { + popupMenu.show(frame, frame.getX() + frame.getWidth() / 2, frame.getY() + frame.getHeight() / 2); + }); + + sleep(); + + int y = (int)screenBounds.get().getY() + (int)screenBounds.get().getHeight() - 10; + int center = (int)(screenBounds.get().getX() + screenBounds.get().getWidth() / 2); + for (int x = center - 10 * STEP; x < center + 10 * STEP; x += STEP) { + r.mouseMove(x, y); + } + + if (!passed) { + throw new RuntimeException("Failed: no mouse events on the popup menu"); + } + } finally { + SwingUtilities.invokeLater(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static Rectangle getScreenBounds() { + return GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getDefaultScreenDevice() + .getDefaultConfiguration() + .getBounds(); + } + + private static void sleep() { + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + try { + Thread.sleep(200); + } catch (InterruptedException ignored) { } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/transform/8167179/NamespacePrefixTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2016, 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.StringReader; +import java.io.StringWriter; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertTrue; + +/* + * @test + * @bug 8167179 + * @run testng/othervm NamespacePrefixTest + * @summary This class tests the generation of namespace prefixes + */ +public class NamespacePrefixTest { + + @Test + public void testReuseTemplates() throws Exception { + final TransformerFactory tf = TransformerFactory.newInstance(); + final Source xslsrc = new StreamSource(new StringReader(XSL)); + final Templates tmpl = tf.newTemplates(xslsrc); + for (int i = 0; i < TRANSF_COUNT; i++) { + checkResult(doTransformation(tmpl.newTransformer())); + } + } + + @Test + public void testReuseTransformer() throws Exception { + final TransformerFactory tf = TransformerFactory.newInstance(); + final Source xslsrc = new StreamSource(new StringReader(XSL)); + final Transformer t = tf.newTransformer(xslsrc); + for (int i = 0; i < TRANSF_COUNT; i++) { + checkResult(doTransformation(t)); + } + } + + @Test + public void testConcurrentTransformations() throws Exception { + final TransformerFactory tf = TransformerFactory.newInstance(); + final Source xslsrc = new StreamSource(new StringReader(XSL)); + final Templates tmpl = tf.newTemplates(xslsrc); + concurrentTestPassed.set(true); + + // Execute multiple TestWorker tasks + for (int id = 0; id < THREADS_COUNT; id++) { + EXECUTOR.execute(new TransformerThread(tmpl.newTransformer(), id)); + } + // Initiate shutdown of previously submitted task + EXECUTOR.shutdown(); + // Wait for termination of submitted tasks + if (!EXECUTOR.awaitTermination(THREADS_COUNT, TimeUnit.SECONDS)) { + // If not all tasks terminates during the time out force them to shutdown + EXECUTOR.shutdownNow(); + } + // Check if all transformation threads generated the correct namespace prefix + assertTrue(concurrentTestPassed.get()); + } + + // Do one transformation with the provided transformer + private static String doTransformation(Transformer t) throws Exception { + StringWriter resWriter = new StringWriter(); + Source xmlSrc = new StreamSource(new StringReader(XML)); + t.transform(xmlSrc, new StreamResult(resWriter)); + return resWriter.toString(); + } + + // Check if the transformation result string contains the + // element with the exact namespace prefix generated. + private static void checkResult(String result) { + // Check prefix of 'Element2' element, it should always be the same + assertTrue(result.contains(EXPECTED_CONTENT)); + } + + // Check if the transformation result string contains the element with + // the exact namespace prefix generated by current thread. + // If the expected prefix is not found and there was no failures observed by + // other test threads then mark concurrent test as failed. + private static void checkThreadResult(String result, int id) { + boolean res = result.contains(EXPECTED_CONTENT); + System.out.printf("%d: transformation result: %s%n", id, res ? "Pass" : "Fail"); + if (!res) { + System.out.printf("%d result:%s%n", id, result); + } + concurrentTestPassed.compareAndSet(true, res); + } + + // TransformerThread task that does the transformation similar + // to testReuseTransformer test method + private class TransformerThread implements Runnable { + + private final Transformer transformer; + private final int id; + + TransformerThread(Transformer transformer, int id) { + this.transformer = transformer; + this.id = id; + } + + @Override + public void run() { + try { + System.out.printf("%d: waiting for barrier%n", id); + //Synchronize startup of all tasks + BARRIER.await(); + System.out.printf("%d: starting transformation%n", id); + checkThreadResult(doTransformation(transformer), id); + } catch (Exception ex) { + throw new RuntimeException("TransformerThread " + id + " failed", ex); + } + } + } + + // Number of subsequent transformations + private static final int TRANSF_COUNT = 10; + + // Number of transformer threads running concurently + private static final int THREADS_COUNT = 10; + + // Variable for storing the concurrent transformation test result. It is + // updated by transformer threads + private static final AtomicBoolean concurrentTestPassed = new AtomicBoolean(true); + + // Cyclic barrier for threads startup synchronization + private static final CyclicBarrier BARRIER = new CyclicBarrier(THREADS_COUNT); + + // Thread pool + private static final ExecutorService EXECUTOR = Executors.newCachedThreadPool(); + + // XSL that transforms XML and produces unique namespace prefixes for each element + private final static String XSL = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" + + " <xsl:template match=\"node()|@*\" priority=\"1\">\n" + + " <xsl:copy>\n" + + " <xsl:apply-templates select=\"node()|@*\"/>\n" + + " </xsl:copy>\n" + + " </xsl:template>\n" + + " <xsl:template match=\"*\" priority=\"2\">\n" + + " <xsl:element name=\"{name()}\" namespace=\"{namespace-uri()}\">\n" + + " <xsl:apply-templates select=\"node()|@*\"/>\n" + + " </xsl:element>\n" + + " </xsl:template>\n" + + "</xsl:stylesheet>"; + + // Simple XML content with root and two child elements + private final static String XML = "<TestRoot xmlns=\"test.xmlns\">\n" + + " <Element1 xmlns=\"test.xmlns\">\n" + + " </Element1>\n" + + " <Element2 xmlns=\"test.xmlns\">\n" + + " </Element2>\n" + + "</TestRoot>"; + + // With thread local namespace prefix index each transformation result should + // be the same and contain the same prefix for Element2 + private final static String EXPECTED_CONTENT = "</ns2:Element2>"; + +}
--- a/test/sun/misc/URLClassPath/ClassnameCharTest.java Thu Apr 27 03:09:54 2017 +0100 +++ b/test/sun/misc/URLClassPath/ClassnameCharTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -21,75 +21,141 @@ * questions. */ -/** - * See ClassnameCharTest.sh for details. +/* @test + * @bug 4957669 5017871 + * @compile -XDignore.symbol.file=true ClassnameCharTest.java + * @run main ClassnameCharTest + * @summary cannot load class names containing some JSR 202 characters; + * plugin does not escape unicode character in http request */ import java.io.*; import java.net.*; -import java.security.*; +import java.util.jar.*; +import com.sun.net.httpserver.*; import sun.applet.AppletClassLoader; -public class ClassnameCharTest implements HttpCallback { - private static String FNPrefix; - private String[] respBody = new String[52]; - private byte[][] bufs = new byte[52][8*1024]; - private static MessageDigest md5; - private static byte[] file1Mac, file2Mac; - public void request (HttpTransaction req) { - try { - String filename = req.getRequestURI().getPath(); - System.out.println("getRequestURI = "+req.getRequestURI()); - System.out.println("filename = "+filename); - FileInputStream fis = new FileInputStream(FNPrefix+filename); - req.setResponseEntityBody(fis); - req.sendResponse(200, "OK"); - req.orderlyClose(); - } catch (IOException e) { - e.printStackTrace(); - } - } +public class ClassnameCharTest { + static String FNPrefix = System.getProperty("test.src", ".") + File.separator; + static File classesJar = new File(FNPrefix + "testclasses.jar"); static HttpServer server; - public static void test () throws Exception { + public static void realMain(String[] args) throws Exception { + server = HttpServer.create(new InetSocketAddress(0), 0); + server.createContext("/", new HttpHandler() { + @Override + public void handle(HttpExchange exchange) { + try { + String filename = exchange.getRequestURI().getPath(); + System.out.println("getRequestURI = " + exchange.getRequestURI()); + System.out.println("filename = " + filename); + try (FileInputStream fis = new FileInputStream(classesJar); + JarInputStream jis = new JarInputStream(fis)) { + JarEntry entry; + while ((entry = jis.getNextJarEntry()) != null) { + if (filename.endsWith(entry.getName())) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buf = new byte[8092]; + int count = 0; + while ((count = jis.read(buf)) != -1) + baos.write(buf, 0, count); + exchange.sendResponseHeaders(200, baos.size()); + try (OutputStream os = exchange.getResponseBody()) { + baos.writeTo(os); + } + return; + } + } + fail("Failed to find " + filename); + } + } catch (IOException e) { + unexpected(e); + } + } + }); + server.start(); try { - - FNPrefix = System.getProperty("test.classes", ".")+"/"; - server = new HttpServer (new ClassnameCharTest(), 1, 10, 0); - System.out.println ("Server: listening on port: " + server.getLocalPort()); - URL base = new URL("http://localhost:"+server.getLocalPort()); + URL base = new URL("http://localhost:" + server.getAddress().getPort()); + System.out.println ("Server: listening on " + base); MyAppletClassLoader acl = new MyAppletClassLoader(base); - Class class1 = acl.findClass("fo o"); - System.out.println("class1 = "+class1); + Class<?> class1 = acl.findClass("fo o"); + System.out.println("class1 = " + class1); + pass(); // can't test the following class unless platform in unicode locale // Class class2 = acl.findClass("\u624b\u518c"); // System.out.println("class2 = "+class2); - } catch (Exception e) { - if (server != null) { - server.terminate(); - } - throw e; + } finally { + server.stop(0); + } + } + + static class MyAppletClassLoader extends AppletClassLoader { + MyAppletClassLoader(URL base) { + super(base); } - server.terminate(); + @Override + public Class<?> findClass(String name) throws ClassNotFoundException { + return super.findClass(name); + } } - public static void main(String[] args) throws Exception { - test(); + //--------------------- Infrastructure --------------------------- + static volatile int passed = 0, failed = 0; + + static boolean pass() { + passed++; + return true; + } + + static boolean fail() { + failed++; + if (server != null) { + server.stop(0); + } + Thread.dumpStack(); + return false; + } + + static boolean fail(String msg) { + System.out.println(msg); + return fail(); } - public static void except (String s) { - server.terminate(); - throw new RuntimeException (s); + static void unexpected(Throwable t) { + failed++; + if (server != null) { + server.stop(0); + } + t.printStackTrace(); + } + + static boolean check(boolean cond) { + if (cond) { + pass(); + } else { + fail(); + } + return cond; + } + + static boolean equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) { + return pass(); + } else { + return fail(x + " not equal to " + y); + } + } + + public static void main(String[] args) throws Throwable { + try { + realMain(args); + } catch (Throwable t) { + unexpected(t); + } + System.out.println("\nPassed = " + passed + " failed = " + failed); + if (failed > 0) { + throw new AssertionError("Some tests failed"); + } } } - -class MyAppletClassLoader extends AppletClassLoader { - MyAppletClassLoader(URL base) { - super(base); - } - - public Class findClass(String name) throws ClassNotFoundException { - return super.findClass(name); - } -}
--- a/test/sun/misc/URLClassPath/ClassnameCharTest.sh Thu Apr 27 03:09:54 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -#! /bin/sh - -# -# Copyright (c) 2004, 2010, 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 -# @author Yingxian Wang -# @bug 4957669 5017871 -# @library ../../../sun/net/www/httptest/ -# @build HttpCallback HttpServer ClosedChannelList HttpTransaction -# @run shell/timeout=300 ClassnameCharTest.sh -# @summary ; cannot load class names containing some JSR 202 characters; -# plugin does not escape unicode character in http request -# -# set platform-dependent variables - -OS=`uname -s` -case "$OS" in - SunOS | Linux | Darwin | AIX ) - PS=":" - FS="/" - ;; - Windows* | CYGWIN* ) - PS=";" - FS="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -cp ${TESTSRC}${FS}testclasses.jar ${TESTCLASSES} -cd ${TESTCLASSES} -${TESTJAVA}${FS}bin${FS}jar xvf testclasses.jar "fo o.class" -${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES} ${TESTSRC}${FS}ClassnameCharTest.java - -${TESTJAVA}${FS}bin${FS}java -classpath "${TESTCLASSES}${PS}${TESTCLASSES}${FS}sun${FS}misc${FS}URLClassPath" ClassnameCharTest - -rm -rf "fo o.class" testclasses.jar
--- a/test/sun/net/www/protocol/http/HttpInputStream.java Thu Apr 27 03:09:54 2017 +0100 +++ b/test/sun/net/www/protocol/http/HttpInputStream.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,77 +23,95 @@ /* @test * @bug 4937598 - * @summary http://www.clipstream.com vedio does not play; read() problem + * @summary http://www.clipstream.com video does not play; read() problem */ -import java.util.*; -import java.io.*; -import java.net.*; -import java.text.*; - -public class HttpInputStream implements Runnable { - - ServerSocket serverSock; - - public void run() { - try { - Socket s = serverSock.accept(); - InputStream in = s.getInputStream(); - byte b[] = new byte[4096]; - - // assume we read the entire http request - // (bad assumption but okay for test case) - int nread = in.read(b); - - OutputStream o = s.getOutputStream(); - - o.write( "HTTP/1.1 200 OK".getBytes() ); - o.write( "Content-Length: 20".getBytes() ); - o.write( (byte)'\r' ); - o.write( (byte)'\n' ); - o.write( (byte)'\r' ); - o.write( (byte)'\n' ); - - for (int i = 0; i < 20; i++) { - o.write((byte)0xff); - } - - o.flush(); - o.close(); - - } catch (Exception e) { } - } - public HttpInputStream() throws Exception { +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; - serverSock = new ServerSocket(0); - int port = serverSock.getLocalPort(); +public class HttpInputStream { + + private static final int CONTENT_LENGTH = 20; - Thread thr = new Thread(this); - thr.start(); + static class Server implements AutoCloseable, Runnable { + + final ServerSocket serverSocket; + static final byte[] requestEnd = new byte[]{'\r', '\n', '\r', '\n'}; + static final int TIMEOUT = 10 * 1000; - Date date = new Date(new Date().getTime()-1440000); // this time yesterday - URL url; - HttpURLConnection con; + Server() throws IOException { + serverSocket = new ServerSocket(0); + } - url = new URL("http://localhost:" + String.valueOf(port) + - "/anything"); - con = (HttpURLConnection)url.openConnection(); + void readOneRequest(InputStream is) throws IOException { + int requestEndCount = 0, r; + while ((r = is.read()) != -1) { + if (r == requestEnd[requestEndCount]) { + requestEndCount++; + if (requestEndCount == 4) { + break; + } + } else { + requestEndCount = 0; + } + } + } - int ret = con.getResponseCode(); - byte[] b = new byte[20]; - InputStream is = con.getInputStream(); - int i = 0, count = 0; - while ((i = is.read()) != -1) { - System.out.println("i = "+i); - count++; - } - if (count != 20) { - throw new RuntimeException("HttpInputStream.read() failed with 0xff"); - } - } + @Override + public void run() { + try (Socket s = serverSocket.accept()) { + s.setSoTimeout(TIMEOUT); + readOneRequest(s.getInputStream()); + try (OutputStream os = + s.getOutputStream()) { + os.write("HTTP/1.1 200 OK".getBytes()); + os.write(("Content-Length: " + CONTENT_LENGTH).getBytes()); + os.write("\r\n\r\n".getBytes()); + for (int i = 0; i < CONTENT_LENGTH; i++) { + os.write(0xff); + } + os.flush(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void close() throws IOException { + if (!serverSocket.isClosed()) { + serverSocket.close(); + } + } - public static void main(String args[]) throws Exception { - new HttpInputStream(); - } + public int getPort() { + return serverSocket.getLocalPort(); + } + } + + + private static int read(InputStream is) throws IOException { + int len = 0; + while (is.read() != -1) { + len++; + } + return len; + } + + public static void main(String args[]) throws IOException { + try (Server server = new Server()) { + (new Thread(server)).start(); + URL url = new URL("http://localhost:" + server.getPort() + "/anything"); + try (InputStream is = url.openConnection().getInputStream()) { + if (read(is) != CONTENT_LENGTH) { + throw new RuntimeException("HttpInputStream.read() failed with 0xff"); + } + } + } + } }
--- a/test/sun/security/ssl/ServerHandshaker/HelloExtensionsTest.java Thu Apr 27 03:09:54 2017 +0100 +++ b/test/sun/security/ssl/ServerHandshaker/HelloExtensionsTest.java Fri Jul 14 00:56:29 2017 +0100 @@ -25,9 +25,9 @@ * @test * @bug 8173783 * @summary 6u141 IllegalArgumentException: jdk.tls.namedGroups - * run main/othervm HelloExtensionsTest - * run main/othervm HelloExtensionsTest -Djdk.tls.namedGroups="bug, bug" - * run main/othervm HelloExtensionsTest -Djdk.tls.namedGroups="secp521r1" + * @run main/othervm HelloExtensionsTest + * @run main/othervm HelloExtensionsTest -Djdk.tls.namedGroups="bug, bug" + * @run main/othervm HelloExtensionsTest -Djdk.tls.namedGroups="secp521r1" * */ import javax.crypto.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/CloseSocket.java Thu Apr 27 03:09:54 2017 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/CloseSocket.java Fri Jul 14 00:56:29 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,67 +26,96 @@ * @bug 4674913 * @summary Verify that EOFException are correctly handled during the handshake * @author Andreas Sterbenz + * @run main/othervm CloseSocket */ -import java.io.*; -import java.net.*; - -import javax.net.ssl.*; +import javax.net.SocketFactory; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.ArrayList; public class CloseSocket { + private static ArrayList<TestCase> testCases = new ArrayList<>(); + + static { + testCases.add(socket -> socket.startHandshake()); + testCases.add(socket -> { + InputStream in = socket.getInputStream(); + in.read(); + }); + testCases.add(socket -> { + OutputStream out = socket.getOutputStream(); + out.write(43); + }); + } + public static void main(String[] args) throws Exception { - final ServerSocket serverSocket = new ServerSocket(0); - int serverPort = serverSocket.getLocalPort(); - new Thread() { - public void run() { - try { - Socket s = serverSocket.accept(); - System.out.println("Server accepted connection"); - // wait a bit before closing the socket to give - // the client time to send its hello message - Thread.currentThread().sleep(100); - s.close(); - System.out.println("Server closed socket, done."); - } catch (Exception e) { - System.out.println("Server exception:"); - e.printStackTrace(); + try (Server server = new Server()) { + new Thread(server).start(); + + SocketFactory factory = SSLSocketFactory.getDefault(); + try (SSLSocket socket = (SSLSocket) factory.createSocket("localhost", + server.getPort())) { + socket.setSoTimeout(2000); + System.out.println("Client established TCP connection"); + boolean failed = false; + for (TestCase testCase : testCases) { + try { + testCase.test(socket); + System.out.println("ERROR: no exception"); + failed = true; + } catch (IOException e) { + System.out.println("Failed as expected: " + e); + } + } + if (failed) { + throw new Exception("One or more tests failed"); } } - }.start(); - SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault(); - SSLSocket socket = (SSLSocket)factory.createSocket("localhost", serverPort); - System.out.println("Client established TCP connection"); - boolean failed = false; - try { - System.out.println("Starting handshake..."); - socket.startHandshake(); - System.out.println("ERROR: no exception"); - failed = true; - } catch (IOException e) { - System.out.println("Failed as expected: " + e); - } - try { - System.out.println("Trying read..."); - InputStream in = socket.getInputStream(); - int b = in.read(); - System.out.println("ERROR: no exception, read: " + b); - failed = true; - } catch (IOException e) { - System.out.println("Failed as expected: " + e); - } - try { - System.out.println("Trying read..."); - OutputStream out = socket.getOutputStream(); - out.write(43); - System.out.println("ERROR: no exception"); - failed = true; - } catch (IOException e) { - System.out.println("Failed as expected: " + e); - } - if (failed) { - throw new Exception("One or more tests failed"); } } + static class Server implements AutoCloseable, Runnable { + + final ServerSocket serverSocket; + + Server() throws IOException { + serverSocket = new ServerSocket(0); + } + + public int getPort() { + return serverSocket.getLocalPort(); + } + + @Override + public void run() { + try (Socket s = serverSocket.accept()) { + System.out.println("Server accepted connection"); + // wait a bit before closing the socket to give + // the client time to send its hello message + Thread.currentThread().sleep(100); + s.close(); + System.out.println("Server closed socket, done."); + } catch (Exception e) { + throw new RuntimeException("Problem in test execution", e); + } + } + + @Override + public void close() throws Exception { + if (!serverSocket.isClosed()) { + serverSocket.close(); + } + } + } + + interface TestCase { + void test(SSLSocket socket) throws IOException; + } }
--- a/test/sun/security/tools/jarsigner/TimestampCheck.java Thu Apr 27 03:09:54 2017 +0100 +++ b/test/sun/security/tools/jarsigner/TimestampCheck.java Fri Jul 14 00:56:29 2017 +0100 @@ -60,7 +60,7 @@ /* * @test - * @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911 8169688 + * @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911 8169688 8171121 * @summary checking response of timestamp * @modules java.base/sun.security.pkcs * java.base/sun.security.timestamp @@ -348,8 +348,8 @@ .shouldHaveExitValue(0); checkTimestamp("tsaalg.jar", defaultPolicyId, "SHA-1"); - sign("weak", "-digestalg", "MD2", - "-sigalg", "MD2withRSA", "-tsadigestalg", "MD2") + sign("weak", "-digestalg", "MD5", + "-sigalg", "MD5withRSA", "-tsadigestalg", "MD5") .shouldHaveExitValue(0); checkWeak("weak.jar");