mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-13 21:09:41 +01:00
Compare commits
16 Commits
jdk-11.0.2
...
jdk-11.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a60fb5a71d | ||
|
|
1f85c15d3b | ||
|
|
5aa8538b17 | ||
|
|
54d1857208 | ||
|
|
4c25b228c9 | ||
|
|
9be4891909 | ||
|
|
77c0da4b01 | ||
|
|
38c11fd645 | ||
|
|
0dc17ca068 | ||
|
|
191b074a79 | ||
|
|
9276ded252 | ||
|
|
433c10b07f | ||
|
|
57e3a82b70 | ||
|
|
54ada10524 | ||
|
|
6922a6035a | ||
|
|
9379be4e03 |
@@ -21,4 +21,4 @@
|
|||||||
# or visit www.oracle.com if you need additional information or have any
|
# or visit www.oracle.com if you need additional information or have any
|
||||||
# questions.
|
# questions.
|
||||||
#
|
#
|
||||||
tzdata2023d
|
tzdata2024a
|
||||||
|
|||||||
@@ -53,6 +53,10 @@
|
|||||||
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
|
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
|
||||||
# https://www.jstor.org/stable/1774359
|
# https://www.jstor.org/stable/1774359
|
||||||
#
|
#
|
||||||
|
# For the 1911/1912 establishment of standard time in French possessions, see:
|
||||||
|
# Société Française de Physique, Recueil de constantes physiques (1913),
|
||||||
|
# page 752, 18b.
|
||||||
|
#
|
||||||
# European-style abbreviations are commonly used along the Mediterranean.
|
# European-style abbreviations are commonly used along the Mediterranean.
|
||||||
# For sub-Saharan Africa abbreviations were less standardized.
|
# For sub-Saharan Africa abbreviations were less standardized.
|
||||||
# Previous editions of this database used WAT, CAT, SAT, and EAT
|
# Previous editions of this database used WAT, CAT, SAT, and EAT
|
||||||
@@ -136,7 +140,7 @@ Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia
|
|||||||
|
|
||||||
# Chad
|
# Chad
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena
|
Zone Africa/Ndjamena 1:00:12 - LMT 1912 Jan 1 # N'Djamena
|
||||||
1:00 - WAT 1979 Oct 14
|
1:00 - WAT 1979 Oct 14
|
||||||
1:00 1:00 WAST 1980 Mar 8
|
1:00 1:00 WAST 1980 Mar 8
|
||||||
1:00 - WAT
|
1:00 - WAT
|
||||||
@@ -162,7 +166,7 @@ Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena
|
|||||||
# Inaccessible, Nightingale: uninhabited
|
# Inaccessible, Nightingale: uninhabited
|
||||||
|
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone Africa/Abidjan -0:16:08 - LMT 1912
|
Zone Africa/Abidjan -0:16:08 - LMT 1912 Jan 1
|
||||||
0:00 - GMT
|
0:00 - GMT
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|||||||
@@ -2480,18 +2480,33 @@ Zone Asia/Amman 2:23:44 - LMT 1931
|
|||||||
# effective December 21st, 2018....
|
# effective December 21st, 2018....
|
||||||
# http://adilet.zan.kz/rus/docs/P1800000817 (russian language).
|
# http://adilet.zan.kz/rus/docs/P1800000817 (russian language).
|
||||||
|
|
||||||
|
# From Zhanbolat Raimbekov (2024-01-19):
|
||||||
|
# Kazakhstan (all parts) switching to UTC+5 on March 1, 2024
|
||||||
|
# https://www.gov.kz/memleket/entities/mti/press/news/details/688998?lang=ru
|
||||||
|
# [in Russian]
|
||||||
|
# (2024-01-20): https://primeminister.kz/ru/decisions/19012024-20
|
||||||
|
#
|
||||||
|
# From Alexander Krivenyshev (2024-01-19):
|
||||||
|
# According to a different news and the official web site for the Ministry of
|
||||||
|
# Trade and Integration of the Republic of Kazakhstan:
|
||||||
|
# https://en.inform.kz/news/kazakhstan-to-switch-to-single-hour-zone-mar-1-54ad0b/
|
||||||
|
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
#
|
#
|
||||||
# Almaty (formerly Alma-Ata), representing most locations in Kazakhstan
|
# Almaty (formerly Alma-Ata), representing most locations in Kazakhstan
|
||||||
# This includes KZ-AKM, KZ-ALA, KZ-ALM, KZ-AST, KZ-BAY, KZ-VOS, KZ-ZHA,
|
# This includes Abai/Abay (ISO 3166-2 code KZ-10), Aqmola/Akmola (KZ-11),
|
||||||
# KZ-KAR, KZ-SEV, KZ-PAV, and KZ-YUZ.
|
# Almaty (KZ-19), Almaty city (KZ-75), Astana city (KZ-71),
|
||||||
|
# East Kazkhstan (KZ-63), Jambyl/Zhambyl (KZ-31), Jetisu/Zhetysu (KZ-33),
|
||||||
|
# Karaganda (KZ-35), North Kazakhstan (KZ-59), Pavlodar (KZ-55),
|
||||||
|
# Shyumkent city (KZ-79), Turkistan (KZ-61), and Ulytau (KZ-62).
|
||||||
Zone Asia/Almaty 5:07:48 - LMT 1924 May 2 # or Alma-Ata
|
Zone Asia/Almaty 5:07:48 - LMT 1924 May 2 # or Alma-Ata
|
||||||
5:00 - +05 1930 Jun 21
|
5:00 - +05 1930 Jun 21
|
||||||
6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s
|
6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s
|
||||||
5:00 RussiaAsia +05/+06 1992 Jan 19 2:00s
|
5:00 RussiaAsia +05/+06 1992 Jan 19 2:00s
|
||||||
6:00 RussiaAsia +06/+07 2004 Oct 31 2:00s
|
6:00 RussiaAsia +06/+07 2004 Oct 31 2:00s
|
||||||
6:00 - +06
|
6:00 - +06 2024 Mar 1 0:00
|
||||||
# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) (KZ-KZY)
|
5:00 - +05
|
||||||
|
# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) (KZ-43)
|
||||||
Zone Asia/Qyzylorda 4:21:52 - LMT 1924 May 2
|
Zone Asia/Qyzylorda 4:21:52 - LMT 1924 May 2
|
||||||
4:00 - +04 1930 Jun 21
|
4:00 - +04 1930 Jun 21
|
||||||
5:00 - +05 1981 Apr 1
|
5:00 - +05 1981 Apr 1
|
||||||
@@ -2504,8 +2519,7 @@ Zone Asia/Qyzylorda 4:21:52 - LMT 1924 May 2
|
|||||||
5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s
|
5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s
|
||||||
6:00 - +06 2018 Dec 21 0:00
|
6:00 - +06 2018 Dec 21 0:00
|
||||||
5:00 - +05
|
5:00 - +05
|
||||||
#
|
# Qostanay (aka Kostanay, Kustanay) (KZ-39)
|
||||||
# Qostanay (aka Kostanay, Kustanay) (KZ-KUS)
|
|
||||||
# The 1991/2 rules are unclear partly because of the 1997 Turgai
|
# The 1991/2 rules are unclear partly because of the 1997 Turgai
|
||||||
# reorganization.
|
# reorganization.
|
||||||
Zone Asia/Qostanay 4:14:28 - LMT 1924 May 2
|
Zone Asia/Qostanay 4:14:28 - LMT 1924 May 2
|
||||||
@@ -2516,9 +2530,9 @@ Zone Asia/Qostanay 4:14:28 - LMT 1924 May 2
|
|||||||
5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s
|
5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s
|
||||||
4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s
|
4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s
|
||||||
5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s
|
5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s
|
||||||
6:00 - +06
|
6:00 - +06 2024 Mar 1 0:00
|
||||||
|
5:00 - +05
|
||||||
# Aqtöbe (aka Aktobe, formerly Aktyubinsk) (KZ-AKT)
|
# Aqtöbe (aka Aktobe, formerly Aktyubinsk) (KZ-15)
|
||||||
Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2
|
Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2
|
||||||
4:00 - +04 1930 Jun 21
|
4:00 - +04 1930 Jun 21
|
||||||
5:00 - +05 1981 Apr 1
|
5:00 - +05 1981 Apr 1
|
||||||
@@ -2528,7 +2542,7 @@ Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2
|
|||||||
4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s
|
4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s
|
||||||
5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s
|
5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s
|
||||||
5:00 - +05
|
5:00 - +05
|
||||||
# Mangghystaū (KZ-MAN)
|
# Mangghystaū (KZ-47)
|
||||||
# Aqtau was not founded until 1963, but it represents an inhabited region,
|
# Aqtau was not founded until 1963, but it represents an inhabited region,
|
||||||
# so include timestamps before 1963.
|
# so include timestamps before 1963.
|
||||||
Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2
|
Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2
|
||||||
@@ -2540,7 +2554,7 @@ Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2
|
|||||||
5:00 RussiaAsia +05/+06 1994 Sep 25 2:00s
|
5:00 RussiaAsia +05/+06 1994 Sep 25 2:00s
|
||||||
4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s
|
4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s
|
||||||
5:00 - +05
|
5:00 - +05
|
||||||
# Atyraū (KZ-ATY) is like Mangghystaū except it switched from
|
# Atyraū (KZ-23) is like Mangghystaū except it switched from
|
||||||
# +04/+05 to +05/+06 in spring 1999, not fall 1994.
|
# +04/+05 to +05/+06 in spring 1999, not fall 1994.
|
||||||
Zone Asia/Atyrau 3:27:44 - LMT 1924 May 2
|
Zone Asia/Atyrau 3:27:44 - LMT 1924 May 2
|
||||||
3:00 - +03 1930 Jun 21
|
3:00 - +03 1930 Jun 21
|
||||||
@@ -2551,7 +2565,7 @@ Zone Asia/Atyrau 3:27:44 - LMT 1924 May 2
|
|||||||
5:00 RussiaAsia +05/+06 1999 Mar 28 2:00s
|
5:00 RussiaAsia +05/+06 1999 Mar 28 2:00s
|
||||||
4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s
|
4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s
|
||||||
5:00 - +05
|
5:00 - +05
|
||||||
# West Kazakhstan (KZ-ZAP)
|
# West Kazakhstan (KZ-27)
|
||||||
# From Paul Eggert (2016-03-18):
|
# From Paul Eggert (2016-03-18):
|
||||||
# The 1989 transition is from USSR act No. 227 (1989-03-14).
|
# 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
|
Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk
|
||||||
@@ -3453,19 +3467,26 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
|
|||||||
# ... winter time will begin in Palestine from Saturday 10-28-2023,
|
# ... winter time will begin in Palestine from Saturday 10-28-2023,
|
||||||
# 02:00 AM by 60 minutes back.
|
# 02:00 AM by 60 minutes back.
|
||||||
#
|
#
|
||||||
# From Paul Eggert (2023-03-22):
|
# From Heba Hamad (2024-01-25):
|
||||||
|
# the summer time for the years 2024,2025 will begin in Palestine
|
||||||
|
# from Saturday at 02:00 AM by 60 minutes forward as shown below:
|
||||||
|
# year date
|
||||||
|
# 2024 2024-04-20
|
||||||
|
# 2025 2025-04-12
|
||||||
|
#
|
||||||
|
# From Paul Eggert (2024-01-25):
|
||||||
# For now, guess that spring and fall transitions will normally
|
# For now, guess that spring and fall transitions will normally
|
||||||
# continue to use 2022's rules, that during DST Palestine will switch
|
# continue to use 2022's rules, that during DST Palestine will switch
|
||||||
# to standard time at 02:00 the last Saturday before Ramadan and back
|
# to standard time at 02:00 the last Saturday before Ramadan and back
|
||||||
# to DST at 02:00 the first Saturday after Ramadan, and that
|
# to DST at 02:00 the second Saturday after Ramadan, and that
|
||||||
# if the normal spring-forward or fall-back transition occurs during
|
# if the normal spring-forward or fall-back transition occurs during
|
||||||
# Ramadan the former is delayed and the latter advanced.
|
# Ramadan the former is delayed and the latter advanced.
|
||||||
# To implement this, I predicted Ramadan-oriented transition dates for
|
# To implement this, I predicted Ramadan-oriented transition dates for
|
||||||
# 2023 through 2086 by running the following program under GNU Emacs 28.2,
|
# 2026 through 2086 by running the following program under GNU Emacs 29.2,
|
||||||
# with the results integrated by hand into the table below.
|
# with the results integrated by hand into the table below.
|
||||||
# Predictions after 2086 are approximated without Ramadan.
|
# Predictions after 2086 are approximated without Ramadan.
|
||||||
#
|
#
|
||||||
# (let ((islamic-year 1444))
|
# (let ((islamic-year 1447))
|
||||||
# (require 'cal-islam)
|
# (require 'cal-islam)
|
||||||
# (while (< islamic-year 1510)
|
# (while (< islamic-year 1510)
|
||||||
# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
|
# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
|
||||||
@@ -3474,6 +3495,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
|
|||||||
# (while (/= saturday (mod (setq a (1- a)) 7)))
|
# (while (/= saturday (mod (setq a (1- a)) 7)))
|
||||||
# (while (/= saturday (mod b 7))
|
# (while (/= saturday (mod b 7))
|
||||||
# (setq b (1+ b)))
|
# (setq b (1+ b)))
|
||||||
|
# (setq b (+ 7 b))
|
||||||
# (setq a (calendar-gregorian-from-absolute a))
|
# (setq a (calendar-gregorian-from-absolute a))
|
||||||
# (setq b (calendar-gregorian-from-absolute b))
|
# (setq b (calendar-gregorian-from-absolute b))
|
||||||
# (insert
|
# (insert
|
||||||
@@ -3524,84 +3546,84 @@ Rule Palestine 2021 only - Oct 29 1:00 0 -
|
|||||||
Rule Palestine 2022 only - Mar 27 0:00 1:00 S
|
Rule Palestine 2022 only - Mar 27 0:00 1:00 S
|
||||||
Rule Palestine 2022 2035 - Oct Sat<=30 2:00 0 -
|
Rule Palestine 2022 2035 - Oct Sat<=30 2:00 0 -
|
||||||
Rule Palestine 2023 only - Apr 29 2:00 1:00 S
|
Rule Palestine 2023 only - Apr 29 2:00 1:00 S
|
||||||
Rule Palestine 2024 only - Apr 13 2:00 1:00 S
|
Rule Palestine 2024 only - Apr 20 2:00 1:00 S
|
||||||
Rule Palestine 2025 only - Apr 5 2:00 1:00 S
|
Rule Palestine 2025 only - Apr 12 2:00 1:00 S
|
||||||
Rule Palestine 2026 2054 - Mar Sat<=30 2:00 1:00 S
|
Rule Palestine 2026 2054 - Mar Sat<=30 2:00 1:00 S
|
||||||
Rule Palestine 2036 only - Oct 18 2:00 0 -
|
Rule Palestine 2036 only - Oct 18 2:00 0 -
|
||||||
Rule Palestine 2037 only - Oct 10 2:00 0 -
|
Rule Palestine 2037 only - Oct 10 2:00 0 -
|
||||||
Rule Palestine 2038 only - Sep 25 2:00 0 -
|
Rule Palestine 2038 only - Sep 25 2:00 0 -
|
||||||
Rule Palestine 2039 only - Sep 17 2:00 0 -
|
Rule Palestine 2039 only - Sep 17 2:00 0 -
|
||||||
Rule Palestine 2039 only - Oct 22 2:00 1:00 S
|
|
||||||
Rule Palestine 2039 2067 - Oct Sat<=30 2:00 0 -
|
|
||||||
Rule Palestine 2040 only - Sep 1 2:00 0 -
|
Rule Palestine 2040 only - Sep 1 2:00 0 -
|
||||||
Rule Palestine 2040 only - Oct 13 2:00 1:00 S
|
Rule Palestine 2040 only - Oct 20 2:00 1:00 S
|
||||||
|
Rule Palestine 2040 2067 - Oct Sat<=30 2:00 0 -
|
||||||
Rule Palestine 2041 only - Aug 24 2:00 0 -
|
Rule Palestine 2041 only - Aug 24 2:00 0 -
|
||||||
Rule Palestine 2041 only - Sep 28 2:00 1:00 S
|
Rule Palestine 2041 only - Oct 5 2:00 1:00 S
|
||||||
Rule Palestine 2042 only - Aug 16 2:00 0 -
|
Rule Palestine 2042 only - Aug 16 2:00 0 -
|
||||||
Rule Palestine 2042 only - Sep 20 2:00 1:00 S
|
Rule Palestine 2042 only - Sep 27 2:00 1:00 S
|
||||||
Rule Palestine 2043 only - Aug 1 2:00 0 -
|
Rule Palestine 2043 only - Aug 1 2:00 0 -
|
||||||
Rule Palestine 2043 only - Sep 12 2:00 1:00 S
|
Rule Palestine 2043 only - Sep 19 2:00 1:00 S
|
||||||
Rule Palestine 2044 only - Jul 23 2:00 0 -
|
Rule Palestine 2044 only - Jul 23 2:00 0 -
|
||||||
Rule Palestine 2044 only - Aug 27 2:00 1:00 S
|
Rule Palestine 2044 only - Sep 3 2:00 1:00 S
|
||||||
Rule Palestine 2045 only - Jul 15 2:00 0 -
|
Rule Palestine 2045 only - Jul 15 2:00 0 -
|
||||||
Rule Palestine 2045 only - Aug 19 2:00 1:00 S
|
Rule Palestine 2045 only - Aug 26 2:00 1:00 S
|
||||||
Rule Palestine 2046 only - Jun 30 2:00 0 -
|
Rule Palestine 2046 only - Jun 30 2:00 0 -
|
||||||
Rule Palestine 2046 only - Aug 11 2:00 1:00 S
|
Rule Palestine 2046 only - Aug 18 2:00 1:00 S
|
||||||
Rule Palestine 2047 only - Jun 22 2:00 0 -
|
Rule Palestine 2047 only - Jun 22 2:00 0 -
|
||||||
Rule Palestine 2047 only - Jul 27 2:00 1:00 S
|
Rule Palestine 2047 only - Aug 3 2:00 1:00 S
|
||||||
Rule Palestine 2048 only - Jun 6 2:00 0 -
|
Rule Palestine 2048 only - Jun 6 2:00 0 -
|
||||||
Rule Palestine 2048 only - Jul 18 2:00 1:00 S
|
Rule Palestine 2048 only - Jul 25 2:00 1:00 S
|
||||||
Rule Palestine 2049 only - May 29 2:00 0 -
|
Rule Palestine 2049 only - May 29 2:00 0 -
|
||||||
Rule Palestine 2049 only - Jul 3 2:00 1:00 S
|
Rule Palestine 2049 only - Jul 10 2:00 1:00 S
|
||||||
Rule Palestine 2050 only - May 21 2:00 0 -
|
Rule Palestine 2050 only - May 21 2:00 0 -
|
||||||
Rule Palestine 2050 only - Jun 25 2:00 1:00 S
|
Rule Palestine 2050 only - Jul 2 2:00 1:00 S
|
||||||
Rule Palestine 2051 only - May 6 2:00 0 -
|
Rule Palestine 2051 only - May 6 2:00 0 -
|
||||||
Rule Palestine 2051 only - Jun 17 2:00 1:00 S
|
Rule Palestine 2051 only - Jun 24 2:00 1:00 S
|
||||||
Rule Palestine 2052 only - Apr 27 2:00 0 -
|
Rule Palestine 2052 only - Apr 27 2:00 0 -
|
||||||
Rule Palestine 2052 only - Jun 1 2:00 1:00 S
|
Rule Palestine 2052 only - Jun 8 2:00 1:00 S
|
||||||
Rule Palestine 2053 only - Apr 12 2:00 0 -
|
Rule Palestine 2053 only - Apr 12 2:00 0 -
|
||||||
Rule Palestine 2053 only - May 24 2:00 1:00 S
|
Rule Palestine 2053 only - May 31 2:00 1:00 S
|
||||||
Rule Palestine 2054 only - Apr 4 2:00 0 -
|
Rule Palestine 2054 only - Apr 4 2:00 0 -
|
||||||
Rule Palestine 2054 only - May 16 2:00 1:00 S
|
Rule Palestine 2054 only - May 23 2:00 1:00 S
|
||||||
Rule Palestine 2055 only - May 1 2:00 1:00 S
|
Rule Palestine 2055 only - May 8 2:00 1:00 S
|
||||||
Rule Palestine 2056 only - Apr 22 2:00 1:00 S
|
Rule Palestine 2056 only - Apr 29 2:00 1:00 S
|
||||||
Rule Palestine 2057 only - Apr 7 2:00 1:00 S
|
Rule Palestine 2057 only - Apr 14 2:00 1:00 S
|
||||||
Rule Palestine 2058 max - Mar Sat<=30 2:00 1:00 S
|
Rule Palestine 2058 only - Apr 6 2:00 1:00 S
|
||||||
|
Rule Palestine 2059 max - Mar Sat<=30 2:00 1:00 S
|
||||||
Rule Palestine 2068 only - Oct 20 2:00 0 -
|
Rule Palestine 2068 only - Oct 20 2:00 0 -
|
||||||
Rule Palestine 2069 only - Oct 12 2:00 0 -
|
Rule Palestine 2069 only - Oct 12 2:00 0 -
|
||||||
Rule Palestine 2070 only - Oct 4 2:00 0 -
|
Rule Palestine 2070 only - Oct 4 2:00 0 -
|
||||||
Rule Palestine 2071 only - Sep 19 2:00 0 -
|
Rule Palestine 2071 only - Sep 19 2:00 0 -
|
||||||
Rule Palestine 2072 only - Sep 10 2:00 0 -
|
Rule Palestine 2072 only - Sep 10 2:00 0 -
|
||||||
Rule Palestine 2072 only - Oct 15 2:00 1:00 S
|
Rule Palestine 2072 only - Oct 22 2:00 1:00 S
|
||||||
Rule Palestine 2072 max - Oct Sat<=30 2:00 0 -
|
Rule Palestine 2072 max - Oct Sat<=30 2:00 0 -
|
||||||
Rule Palestine 2073 only - Sep 2 2:00 0 -
|
Rule Palestine 2073 only - Sep 2 2:00 0 -
|
||||||
Rule Palestine 2073 only - Oct 7 2:00 1:00 S
|
Rule Palestine 2073 only - Oct 14 2:00 1:00 S
|
||||||
Rule Palestine 2074 only - Aug 18 2:00 0 -
|
Rule Palestine 2074 only - Aug 18 2:00 0 -
|
||||||
Rule Palestine 2074 only - Sep 29 2:00 1:00 S
|
Rule Palestine 2074 only - Oct 6 2:00 1:00 S
|
||||||
Rule Palestine 2075 only - Aug 10 2:00 0 -
|
Rule Palestine 2075 only - Aug 10 2:00 0 -
|
||||||
Rule Palestine 2075 only - Sep 14 2:00 1:00 S
|
Rule Palestine 2075 only - Sep 21 2:00 1:00 S
|
||||||
Rule Palestine 2076 only - Jul 25 2:00 0 -
|
Rule Palestine 2076 only - Jul 25 2:00 0 -
|
||||||
Rule Palestine 2076 only - Sep 5 2:00 1:00 S
|
Rule Palestine 2076 only - Sep 12 2:00 1:00 S
|
||||||
Rule Palestine 2077 only - Jul 17 2:00 0 -
|
Rule Palestine 2077 only - Jul 17 2:00 0 -
|
||||||
Rule Palestine 2077 only - Aug 28 2:00 1:00 S
|
Rule Palestine 2077 only - Sep 4 2:00 1:00 S
|
||||||
Rule Palestine 2078 only - Jul 9 2:00 0 -
|
Rule Palestine 2078 only - Jul 9 2:00 0 -
|
||||||
Rule Palestine 2078 only - Aug 13 2:00 1:00 S
|
Rule Palestine 2078 only - Aug 20 2:00 1:00 S
|
||||||
Rule Palestine 2079 only - Jun 24 2:00 0 -
|
Rule Palestine 2079 only - Jun 24 2:00 0 -
|
||||||
Rule Palestine 2079 only - Aug 5 2:00 1:00 S
|
Rule Palestine 2079 only - Aug 12 2:00 1:00 S
|
||||||
Rule Palestine 2080 only - Jun 15 2:00 0 -
|
Rule Palestine 2080 only - Jun 15 2:00 0 -
|
||||||
Rule Palestine 2080 only - Jul 20 2:00 1:00 S
|
Rule Palestine 2080 only - Jul 27 2:00 1:00 S
|
||||||
Rule Palestine 2081 only - Jun 7 2:00 0 -
|
Rule Palestine 2081 only - Jun 7 2:00 0 -
|
||||||
Rule Palestine 2081 only - Jul 12 2:00 1:00 S
|
Rule Palestine 2081 only - Jul 19 2:00 1:00 S
|
||||||
Rule Palestine 2082 only - May 23 2:00 0 -
|
Rule Palestine 2082 only - May 23 2:00 0 -
|
||||||
Rule Palestine 2082 only - Jul 4 2:00 1:00 S
|
Rule Palestine 2082 only - Jul 11 2:00 1:00 S
|
||||||
Rule Palestine 2083 only - May 15 2:00 0 -
|
Rule Palestine 2083 only - May 15 2:00 0 -
|
||||||
Rule Palestine 2083 only - Jun 19 2:00 1:00 S
|
Rule Palestine 2083 only - Jun 26 2:00 1:00 S
|
||||||
Rule Palestine 2084 only - Apr 29 2:00 0 -
|
Rule Palestine 2084 only - Apr 29 2:00 0 -
|
||||||
Rule Palestine 2084 only - Jun 10 2:00 1:00 S
|
Rule Palestine 2084 only - Jun 17 2:00 1:00 S
|
||||||
Rule Palestine 2085 only - Apr 21 2:00 0 -
|
Rule Palestine 2085 only - Apr 21 2:00 0 -
|
||||||
Rule Palestine 2085 only - Jun 2 2:00 1:00 S
|
Rule Palestine 2085 only - Jun 9 2:00 1:00 S
|
||||||
Rule Palestine 2086 only - Apr 13 2:00 0 -
|
Rule Palestine 2086 only - Apr 13 2:00 0 -
|
||||||
Rule Palestine 2086 only - May 18 2:00 1:00 S
|
Rule Palestine 2086 only - May 25 2:00 1:00 S
|
||||||
|
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
|
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
|
||||||
@@ -3629,7 +3651,7 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
|
|||||||
|
|
||||||
# Philippines
|
# Philippines
|
||||||
|
|
||||||
# From Paul Eggert (2018-11-18):
|
# From Paul Eggert (2024-01-21):
|
||||||
# The Spanish initially used American (west-of-Greenwich) time.
|
# The Spanish initially used American (west-of-Greenwich) time.
|
||||||
# It is unknown what time Manila kept when the British occupied it from
|
# It is unknown what time Manila kept when the British occupied it from
|
||||||
# 1762-10-06 through 1764-04; for now assume it kept American time.
|
# 1762-10-06 through 1764-04; for now assume it kept American time.
|
||||||
@@ -3637,7 +3659,7 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
|
|||||||
# Philippines, issued a proclamation announcing that 1844-12-30 was to
|
# Philippines, issued a proclamation announcing that 1844-12-30 was to
|
||||||
# be immediately followed by 1845-01-01; see R.H. van Gent's
|
# be immediately followed by 1845-01-01; see R.H. van Gent's
|
||||||
# History of the International Date Line
|
# History of the International Date Line
|
||||||
# https://www.staff.science.uu.nl/~gent0113/idl/idl_philippines.htm
|
# https://webspace.science.uu.nl/~gent0113/idl/idl_philippines.htm
|
||||||
# The rest of the data entries are from Shanks & Pottenger.
|
# The rest of the data entries are from Shanks & Pottenger.
|
||||||
|
|
||||||
# From Jesper Nørgaard Welen (2006-04-26):
|
# From Jesper Nørgaard Welen (2006-04-26):
|
||||||
@@ -4064,7 +4086,8 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2
|
|||||||
# The English-language name of Vietnam's most populous city is "Ho Chi Minh
|
# The English-language name of Vietnam's most populous city is "Ho Chi Minh
|
||||||
# City"; use Ho_Chi_Minh below to avoid a name of more than 14 characters.
|
# City"; use Ho_Chi_Minh below to avoid a name of more than 14 characters.
|
||||||
|
|
||||||
# From Paul Eggert (2022-07-27) after a 2014 heads-up from Trần Ngọc Quân:
|
# From Paul Eggert (2024-01-14) after a 2014 heads-up from Trần Ngọc Quân
|
||||||
|
# and a 2024-01-14 heads-up from Đoàn Trần Công Danh:
|
||||||
# Trần Tiến Bình's authoritative book "Lịch Việt Nam: thế kỷ XX-XXI (1901-2100)"
|
# Trần Tiến Bình's authoritative book "Lịch Việt Nam: thế kỷ XX-XXI (1901-2100)"
|
||||||
# (Nhà xuất bản Văn Hoá - Thông Tin, Hanoi, 2005), pp 49-50,
|
# (Nhà xuất bản Văn Hoá - Thông Tin, Hanoi, 2005), pp 49-50,
|
||||||
# is quoted verbatim in:
|
# is quoted verbatim in:
|
||||||
@@ -4094,14 +4117,35 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2
|
|||||||
#
|
#
|
||||||
# Trần cites the following sources; it's unclear which supplied the info above.
|
# Trần cites the following sources; it's unclear which supplied the info above.
|
||||||
#
|
#
|
||||||
# Hoàng Xuân Hãn: "Lịch và lịch Việt Nam". Tập san Khoa học Xã hội,
|
# Hoàng Xuân Hãn: "Lịch và lịch Việt Nam". Tập san Khoa học Xã hội,
|
||||||
# No. 9, Paris, February 1982.
|
# No. 9, Paris, February 1982.
|
||||||
#
|
#
|
||||||
# Lê Thành Lân: "Lịch và niên biểu lịch sử hai mươi thế kỷ (0001-2010)",
|
# Lê Thành Lân: "Lịch và niên biểu lịch sử hai mươi thế kỷ (0001-2010)",
|
||||||
# NXB Thống kê, Hanoi, 2000.
|
# NXB Thống kê, Hanoi, 2000.
|
||||||
#
|
#
|
||||||
# Lê Thành Lân: "Lịch hai thế kỷ (1802-2010) và các lịch vĩnh cửu",
|
# Lê Thành Lân: "Lịch hai thế kỷ (1802-2010) và các lịch vĩnh cửu",
|
||||||
# NXB Thuận Hoá, Huế, 1995.
|
# NXB Thuận Hoá, Huế, 1995.
|
||||||
|
#
|
||||||
|
# Here is the decision for the September 1945 transition:
|
||||||
|
# Võ Nguyên Giáp, Việt Nam Dân Quốc Công Báo, No. 1 (1945-09-29), page 13
|
||||||
|
# http://baochi.nlv.gov.vn/baochi/cgi-bin/baochi?a=d&d=JwvzO19450929.2.5&dliv=none
|
||||||
|
# It says that on 1945-09-01 at 24:00, Vietnam moved back two hours, to +07.
|
||||||
|
# It also mentions a 1945-03-29 decree (by a Japanese Goveror-General)
|
||||||
|
# to set the time zone to +09, but does not say whether that decree
|
||||||
|
# merely legalized an earlier change to +09.
|
||||||
|
#
|
||||||
|
# July 1955 transition:
|
||||||
|
# Ngô Đình Diệm, Công Báo Việt Nam, No. 92 (1955-07-02), page 1780-1781
|
||||||
|
# Ordinance (Dụ) No. 46 (1955-06-25)
|
||||||
|
# http://ddsnext.crl.edu/titles/32341#?c=0&m=29&s=0&cv=4&r=0&xywh=-89%2C342%2C1724%2C1216
|
||||||
|
# It says that on 1955-07-01 at 01:00, South Vietnam moved back 1 hour (to +07).
|
||||||
|
#
|
||||||
|
# December 1959 transition:
|
||||||
|
# Ngô Đình Diệm, Công Báo Việt Nam Cộng Hòa, 1960 part 1 (1960-01-02), page 62
|
||||||
|
# Decree (Sắc lệnh) No. 362-TTP (1959-12-30)
|
||||||
|
# http://ddsnext.crl.edu/titles/32341#?c=0&m=138&s=0&cv=793&r=0&xywh=-54%2C1504%2C1705%2C1202
|
||||||
|
# It says that on 1959-12-31 at 23:00, South Vietnam moved forward 1 hour (to +08).
|
||||||
|
|
||||||
|
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
#STDOFF 7:06:30.13
|
#STDOFF 7:06:30.13
|
||||||
@@ -4109,9 +4153,9 @@ Zone Asia/Ho_Chi_Minh 7:06:30 - LMT 1906 Jul 1
|
|||||||
7:06:30 - PLMT 1911 May 1 # Phù Liễn MT
|
7:06:30 - PLMT 1911 May 1 # Phù Liễn MT
|
||||||
7:00 - +07 1942 Dec 31 23:00
|
7:00 - +07 1942 Dec 31 23:00
|
||||||
8:00 - +08 1945 Mar 14 23:00
|
8:00 - +08 1945 Mar 14 23:00
|
||||||
9:00 - +09 1945 Sep 2
|
9:00 - +09 1945 Sep 1 24:00
|
||||||
7:00 - +07 1947 Apr 1
|
7:00 - +07 1947 Apr 1
|
||||||
8:00 - +08 1955 Jul 1
|
8:00 - +08 1955 Jul 1 01:00
|
||||||
7:00 - +07 1959 Dec 31 23:00
|
7:00 - +07 1959 Dec 31 23:00
|
||||||
8:00 - +08 1975 Jun 13
|
8:00 - +08 1975 Jun 13
|
||||||
7:00 - +07
|
7:00 - +07
|
||||||
|
|||||||
@@ -443,11 +443,11 @@ Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva
|
|||||||
|
|
||||||
# French Polynesia
|
# French Polynesia
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone Pacific/Gambier -8:59:48 - LMT 1912 Oct # Rikitea
|
Zone Pacific/Gambier -8:59:48 - LMT 1912 Oct 1 # Rikitea
|
||||||
-9:00 - -09
|
-9:00 - -09
|
||||||
Zone Pacific/Marquesas -9:18:00 - LMT 1912 Oct
|
Zone Pacific/Marquesas -9:18:00 - LMT 1912 Oct 1
|
||||||
-9:30 - -0930
|
-9:30 - -0930
|
||||||
Zone Pacific/Tahiti -9:58:16 - LMT 1912 Oct # Papeete
|
Zone Pacific/Tahiti -9:58:16 - LMT 1912 Oct 1 # Papeete
|
||||||
-10:00 - -10
|
-10:00 - -10
|
||||||
# Clipperton (near North America) is administered from French Polynesia;
|
# Clipperton (near North America) is administered from French Polynesia;
|
||||||
# it is uninhabited.
|
# it is uninhabited.
|
||||||
@@ -825,7 +825,7 @@ Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5
|
|||||||
# Solomon Is
|
# Solomon Is
|
||||||
# excludes Bougainville, for which see Papua New Guinea
|
# excludes Bougainville, for which see Papua New Guinea
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Honiara
|
Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct 1 # Honiara
|
||||||
11:00 - +11
|
11:00 - +11
|
||||||
|
|
||||||
# Tokelau
|
# Tokelau
|
||||||
@@ -986,6 +986,10 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
|
|||||||
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
|
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
|
||||||
# https://www.jstor.org/stable/1774359
|
# https://www.jstor.org/stable/1774359
|
||||||
#
|
#
|
||||||
|
# For the 1911/1912 establishment of standard time in French possessions, see:
|
||||||
|
# Société Française de Physique, Recueil de constantes physiques (1913),
|
||||||
|
# page 752, 18b.
|
||||||
|
#
|
||||||
# A reliable and entertaining source about time zones is
|
# A reliable and entertaining source about time zones is
|
||||||
# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
|
# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
|
||||||
#
|
#
|
||||||
@@ -2062,7 +2066,7 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
|
|||||||
# ordaining - by a masterpiece of diplomatic flattery - that
|
# ordaining - by a masterpiece of diplomatic flattery - that
|
||||||
# the Fourth of July should be celebrated twice in that year."
|
# the Fourth of July should be celebrated twice in that year."
|
||||||
# This happened in 1892, according to the Evening News (Sydney) of 1892-07-20.
|
# This happened in 1892, according to the Evening News (Sydney) of 1892-07-20.
|
||||||
# https://www.staff.science.uu.nl/~gent0113/idl/idl.htm
|
# https://webspace.science.uu.nl/~gent0113/idl/idl_alaska_samoa.htm
|
||||||
|
|
||||||
# Although Shanks & Pottenger says they both switched to UT -11:30
|
# Although Shanks & Pottenger says they both switched to UT -11:30
|
||||||
# in 1911, and to -11 in 1950. many earlier sources give -11
|
# in 1911, and to -11 in 1950. many earlier sources give -11
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
# These entries are for uses not otherwise covered by the tz database.
|
# These entries are for uses not otherwise covered by the tz database.
|
||||||
# Their main practical use is for platforms like Android that lack
|
# Their main practical use is for platforms like Android that lack
|
||||||
# support for POSIX-style TZ strings. On such platforms these entries
|
# support for POSIX.1-2017-style TZ strings. On such platforms these entries
|
||||||
# can be useful if the timezone database is wrong or if a ship or
|
# can be useful if the timezone database is wrong or if a ship or
|
||||||
# aircraft at sea is not in a timezone.
|
# aircraft at sea is not in a timezone.
|
||||||
|
|
||||||
|
|||||||
@@ -1013,9 +1013,34 @@ Zone Europe/Sofia 1:33:16 - LMT 1880
|
|||||||
# Czech Republic (Czechia)
|
# Czech Republic (Czechia)
|
||||||
# Slovakia
|
# Slovakia
|
||||||
#
|
#
|
||||||
# From Paul Eggert (2018-04-15):
|
# From Ivan Benovic (2024-01-30):
|
||||||
# The source for Czech data is: Kdy začíná a končí letní čas. 2018-04-15.
|
# https://www.slov-lex.sk/pravne-predpisy/SK/ZZ/1946/54/
|
||||||
|
# (This is an official link to the Czechoslovak Summer Time Act of
|
||||||
|
# March 8, 1946 that authorizes the Czechoslovak government to set the
|
||||||
|
# exact dates of change to summer time and back to Central European Time.
|
||||||
|
# The act also implicitly confirms Central European Time as the
|
||||||
|
# official time zone of Czechoslovakia and currently remains in force
|
||||||
|
# in both the Czech Republic and Slovakia.)
|
||||||
|
# https://www.psp.cz/eknih/1945pns/tisky/t0216_00.htm
|
||||||
|
# (This is a link to the original legislative proposal dating back to
|
||||||
|
# February 22, 1946. The accompanying memorandum to the proposal says
|
||||||
|
# that an advisory committee on European railroad transportation that
|
||||||
|
# met in Brussels in October 1945 decided that the change of time
|
||||||
|
# should be carried out in all participating countries in a strictly
|
||||||
|
# coordinated manner....)
|
||||||
|
#
|
||||||
|
# From Paul Eggert (2024-01-30):
|
||||||
|
# The source for Czech data is: Kdy začíná a končí letní čas.
|
||||||
# https://kalendar.beda.cz/kdy-zacina-a-konci-letni-cas
|
# https://kalendar.beda.cz/kdy-zacina-a-konci-letni-cas
|
||||||
|
# Its main text disagrees with its quoted sources only in 1918,
|
||||||
|
# where the main text says spring and autumn transitions
|
||||||
|
# occurred at 02:00 and 03:00 respectively (as usual),
|
||||||
|
# whereas the 1918 source "Oznámení o zavedení letního času v roce 1918"
|
||||||
|
# says transitions were at 01:00 and 02:00 respectively.
|
||||||
|
# As the 1918 source appears to be a humorous piece, and it is
|
||||||
|
# unlikely that Prague would have disagreed with its neighbors by an hour,
|
||||||
|
# go with the main text for now.
|
||||||
|
#
|
||||||
# We know of no English-language name for historical Czech winter time;
|
# We know of no English-language name for historical Czech winter time;
|
||||||
# abbreviate it as "GMT", as it happened to be GMT.
|
# abbreviate it as "GMT", as it happened to be GMT.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -26,13 +26,10 @@
|
|||||||
# This file is in the public domain.
|
# This file is in the public domain.
|
||||||
|
|
||||||
# This file is generated automatically from the data in the public-domain
|
# This file is generated automatically from the data in the public-domain
|
||||||
# NIST format leap-seconds.list file, which can be copied from
|
# NIST/IERS format leap-seconds.list file, which can be copied from
|
||||||
# <ftp://ftp.nist.gov/pub/time/leap-seconds.list>
|
|
||||||
# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>.
|
|
||||||
# The NIST file is used instead of its IERS upstream counterpart
|
|
||||||
# <https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list>
|
# <https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list>
|
||||||
# because under US law the NIST file is public domain
|
# or, in a variant with different comments, from
|
||||||
# whereas the IERS file's copyright and license status is unclear.
|
# <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>.
|
||||||
# For more about leap-seconds.list, please see
|
# For more about leap-seconds.list, please see
|
||||||
# The NTP Timescale and Leap Seconds
|
# The NTP Timescale and Leap Seconds
|
||||||
# <https://www.eecis.udel.edu/~mills/leap.html>.
|
# <https://www.eecis.udel.edu/~mills/leap.html>.
|
||||||
@@ -95,11 +92,11 @@ Leap 2016 Dec 31 23:59:60 + S
|
|||||||
# Any additional leap seconds will come after this.
|
# Any additional leap seconds will come after this.
|
||||||
# This Expires line is commented out for now,
|
# This Expires line is commented out for now,
|
||||||
# so that pre-2020a zic implementations do not reject this file.
|
# so that pre-2020a zic implementations do not reject this file.
|
||||||
#Expires 2024 Jun 28 00:00:00
|
#Expires 2024 Dec 28 00:00:00
|
||||||
|
|
||||||
# POSIX timestamps for the data in this file:
|
# POSIX timestamps for the data in this file:
|
||||||
#updated 1467936000 (2016-07-08 00:00:00 UTC)
|
#updated 1704708379 (2024-01-08 10:06:19 UTC)
|
||||||
#expires 1719532800 (2024-06-28 00:00:00 UTC)
|
#expires 1735344000 (2024-12-28 00:00:00 UTC)
|
||||||
|
|
||||||
# Updated through IERS Bulletin C66
|
# Updated through IERS Bulletin C (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat)
|
||||||
# File expires on: 28 June 2024
|
# File expires on 28 December 2024
|
||||||
|
|||||||
@@ -1291,6 +1291,10 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
|
|||||||
# <http://cs.ucla.edu/~eggert/The-Waste-of-Daylight-19th.pdf>
|
# <http://cs.ucla.edu/~eggert/The-Waste-of-Daylight-19th.pdf>
|
||||||
# [PDF] (1914-03)
|
# [PDF] (1914-03)
|
||||||
#
|
#
|
||||||
|
# For the 1911/1912 establishment of standard time in French possessions, see:
|
||||||
|
# Société Française de Physique, Recueil de constantes physiques (1913),
|
||||||
|
# page 752, 18b.
|
||||||
|
#
|
||||||
# See the 'europe' file for Greenland.
|
# See the 'europe' file for Greenland.
|
||||||
|
|
||||||
# Canada
|
# Canada
|
||||||
@@ -1377,7 +1381,7 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
|
|||||||
# From Paul Eggert (2014-10-18):
|
# From Paul Eggert (2014-10-18):
|
||||||
# H. David Matthews and Mary Vincent's map
|
# H. David Matthews and Mary Vincent's map
|
||||||
# "It's about TIME", _Canadian Geographic_ (September-October 1998)
|
# "It's about TIME", _Canadian Geographic_ (September-October 1998)
|
||||||
# http://www.canadiangeographic.ca/Magazine/SO98/alacarte.asp
|
# https://web.archive.org/web/19990827055050/https://canadiangeographic.ca/SO98/geomap.htm
|
||||||
# contains detailed boundaries for regions observing nonstandard
|
# contains detailed boundaries for regions observing nonstandard
|
||||||
# time and daylight saving time arrangements in Canada circa 1998.
|
# time and daylight saving time arrangements in Canada circa 1998.
|
||||||
#
|
#
|
||||||
@@ -1665,6 +1669,15 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9
|
|||||||
# Some cities in the United States have pushed the deadline back
|
# Some cities in the United States have pushed the deadline back
|
||||||
# three weeks and will change over from daylight saving in October.
|
# three weeks and will change over from daylight saving in October.
|
||||||
|
|
||||||
|
# From Chris Walton (2024-01-09):
|
||||||
|
# The [Toronto] changes in 1947, 1948, and 1949 took place at 2:00 a.m. local
|
||||||
|
# time instead of midnight.... Toronto Daily Star - ...
|
||||||
|
# April 2, 1947 - Page 39 ... April 7, 1948 - Page 13 ...
|
||||||
|
# April 2, 1949 - Page 1 ... April 7, 1949 - Page 24 ...
|
||||||
|
# November 25, 1949 - Page 52 ... April 21, 1950 - Page 14 ...
|
||||||
|
# September 19, 1950 - Page 46 ... September 20, 1950 - Page 3 ...
|
||||||
|
# November 24, 1950 - Page 21
|
||||||
|
|
||||||
# From Arthur David Olson (2010-07-17):
|
# From Arthur David Olson (2010-07-17):
|
||||||
#
|
#
|
||||||
# "Standard Time and Time Zones in Canada" appeared in
|
# "Standard Time and Time Zones in Canada" appeared in
|
||||||
@@ -1726,13 +1739,9 @@ Rule Toronto 1927 1937 - Sep Sun>=25 2:00 0 S
|
|||||||
Rule Toronto 1928 1937 - Apr Sun>=25 2:00 1:00 D
|
Rule Toronto 1928 1937 - Apr Sun>=25 2:00 1:00 D
|
||||||
Rule Toronto 1938 1940 - Apr lastSun 2:00 1:00 D
|
Rule Toronto 1938 1940 - Apr lastSun 2:00 1:00 D
|
||||||
Rule Toronto 1938 1939 - Sep lastSun 2:00 0 S
|
Rule Toronto 1938 1939 - Sep lastSun 2:00 0 S
|
||||||
Rule Toronto 1945 1946 - Sep lastSun 2:00 0 S
|
Rule Toronto 1945 1948 - Sep lastSun 2:00 0 S
|
||||||
Rule Toronto 1946 only - Apr lastSun 2:00 1:00 D
|
Rule Toronto 1946 1973 - Apr lastSun 2:00 1:00 D
|
||||||
Rule Toronto 1947 1949 - Apr lastSun 0:00 1:00 D
|
Rule Toronto 1949 1950 - Nov lastSun 2:00 0 S
|
||||||
Rule Toronto 1947 1948 - Sep lastSun 0:00 0 S
|
|
||||||
Rule Toronto 1949 only - Nov lastSun 0:00 0 S
|
|
||||||
Rule Toronto 1950 1973 - Apr lastSun 2:00 1:00 D
|
|
||||||
Rule Toronto 1950 only - Nov lastSun 2:00 0 S
|
|
||||||
Rule Toronto 1951 1956 - Sep lastSun 2:00 0 S
|
Rule Toronto 1951 1956 - Sep lastSun 2:00 0 S
|
||||||
# Shanks & Pottenger say Toronto ended DST a week early in 1971,
|
# Shanks & Pottenger say Toronto ended DST a week early in 1971,
|
||||||
# namely on 1971-10-24, but Mark Brader wrote (2003-05-31) that this
|
# namely on 1971-10-24, but Mark Brader wrote (2003-05-31) that this
|
||||||
@@ -3455,7 +3464,7 @@ Zone America/Jamaica -5:07:10 - LMT 1890 # Kingston
|
|||||||
# Martinique
|
# Martinique
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone America/Martinique -4:04:20 - LMT 1890 # Fort-de-France
|
Zone America/Martinique -4:04:20 - LMT 1890 # Fort-de-France
|
||||||
-4:04:20 - FFMT 1911 May # Fort-de-France MT
|
-4:04:20 - FFMT 1911 May 1 # Fort-de-France MT
|
||||||
-4:00 - AST 1980 Apr 6
|
-4:00 - AST 1980 Apr 6
|
||||||
-4:00 1:00 ADT 1980 Sep 28
|
-4:00 1:00 ADT 1980 Sep 28
|
||||||
-4:00 - AST
|
-4:00 - AST
|
||||||
@@ -3562,7 +3571,7 @@ Zone America/Puerto_Rico -4:24:25 - LMT 1899 Mar 28 12:00 # San Juan
|
|||||||
# St Pierre and Miquelon
|
# St Pierre and Miquelon
|
||||||
# There are too many St Pierres elsewhere, so we'll use 'Miquelon'.
|
# There are too many St Pierres elsewhere, so we'll use 'Miquelon'.
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre
|
Zone America/Miquelon -3:44:40 - LMT 1911 Jun 15 # St Pierre
|
||||||
-4:00 - AST 1980 May
|
-4:00 - AST 1980 May
|
||||||
-3:00 - -03 1987
|
-3:00 - -03 1987
|
||||||
-3:00 Canada -03/-02
|
-3:00 Canada -03/-02
|
||||||
|
|||||||
@@ -1593,8 +1593,11 @@ Zone Atlantic/Stanley -3:51:24 - LMT 1890
|
|||||||
-3:00 - -03
|
-3:00 - -03
|
||||||
|
|
||||||
# French Guiana
|
# French Guiana
|
||||||
|
# For the 1911/1912 establishment of standard time in French possessions, see:
|
||||||
|
# Société Française de Physique, Recueil de constantes physiques (1913),
|
||||||
|
# page 752, 18b.
|
||||||
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
# Zone NAME STDOFF RULES FORMAT [UNTIL]
|
||||||
Zone America/Cayenne -3:29:20 - LMT 1911 Jul
|
Zone America/Cayenne -3:29:20 - LMT 1911 Jul 1
|
||||||
-4:00 - -04 1967 Oct
|
-4:00 - -04 1967 Oct
|
||||||
-3:00 - -03
|
-3:00 - -03
|
||||||
|
|
||||||
|
|||||||
@@ -1168,6 +1168,11 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected_method->is_abstract()) {
|
||||||
|
ResourceMark rm(THREAD);
|
||||||
|
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), selected_method->name()->as_C_string());
|
||||||
|
}
|
||||||
|
|
||||||
methodHandle method(THREAD, selected_method);
|
methodHandle method(THREAD, selected_method);
|
||||||
|
|
||||||
// Create object to hold arguments for the JavaCall, and associate it with
|
// Create object to hold arguments for the JavaCall, and associate it with
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -1290,7 +1290,10 @@ public class JavaCompiler {
|
|||||||
options.isSet(PROCESSOR_PATH) ||
|
options.isSet(PROCESSOR_PATH) ||
|
||||||
options.isSet(PROCESSOR_MODULE_PATH) ||
|
options.isSet(PROCESSOR_MODULE_PATH) ||
|
||||||
options.isSet(PROC, "only") ||
|
options.isSet(PROC, "only") ||
|
||||||
|
options.isSet(PROC, "full") ||
|
||||||
|
options.isSet(A) ||
|
||||||
options.isSet(XPRINT);
|
options.isSet(XPRINT);
|
||||||
|
// Skipping -XprintRounds and -XprintProcessorInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeferredDiagnosticHandler(Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
|
public void setDeferredDiagnosticHandler(Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -81,6 +81,11 @@ import static com.sun.tools.javac.main.Option.OptionKind.*;
|
|||||||
* {@code handleOption} then calls {@link #process process} providing a suitable
|
* {@code handleOption} then calls {@link #process process} providing a suitable
|
||||||
* {@link OptionHelper} to provide access the compiler state.
|
* {@link OptionHelper} to provide access the compiler state.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* <p>Maintenance note: when adding new annotation processing related
|
||||||
|
* options, the list of options regarded as requesting explicit
|
||||||
|
* annotation processing in JavaCompiler should be updated.
|
||||||
|
*
|
||||||
* <p><b>This is NOT part of any supported API.
|
* <p><b>This is NOT part of any supported API.
|
||||||
* If you write code that depends on this, you do so at your own
|
* If you write code that depends on this, you do so at your own
|
||||||
* risk. This code and its internal interfaces are subject to change
|
* risk. This code and its internal interfaces are subject to change
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public final class MetadataRepository {
|
|||||||
// annotations, such as Period and Threshold.
|
// annotations, such as Period and Threshold.
|
||||||
if (pEventType.hasPeriod()) {
|
if (pEventType.hasPeriod()) {
|
||||||
pEventType.setEventHook(true);
|
pEventType.setEventHook(true);
|
||||||
if (!(Type.EVENT_NAME_PREFIX + "ExecutionSample").equals(type.getName())) {
|
if (!pEventType.isMethodSampling()) {
|
||||||
requestHooks.add(new RequestHook(pEventType));
|
requestHooks.add(new RequestHook(pEventType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,4 +278,8 @@ public final class PlatformEventType extends Type {
|
|||||||
public int getStackTraceOffset() {
|
public int getStackTraceOffset() {
|
||||||
return stackTraceOffset;
|
return stackTraceOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMethodSampling() {
|
||||||
|
return isMethodSampling;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -224,12 +224,12 @@ public class UnsafeGetStableArrayElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void testMismatched(Callable<?> c, Runnable setDefaultAction) throws Exception {
|
static void testMismatched(Callable<?> c, Runnable setDefaultAction) throws Exception {
|
||||||
testMismatched(c, setDefaultAction, false);
|
testMismatched(c, setDefaultAction, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testMismatched(Callable<?> c, Runnable setDefaultAction, boolean objectArray) throws Exception {
|
static void testMismatched(Callable<?> c, Runnable setDefaultAction, boolean objectArray, boolean aligned) throws Exception {
|
||||||
if (Compiler.isGraalEnabled() && !objectArray) {
|
if (Compiler.isGraalEnabled() && !objectArray && aligned) {
|
||||||
// Graal will constant fold mismatched reads from primitive stable arrays
|
// Graal will constant fold mismatched reads from primitive stable arrays, except unaligned ones
|
||||||
run(c, setDefaultAction, null);
|
run(c, setDefaultAction, null);
|
||||||
} else {
|
} else {
|
||||||
run(c, null, setDefaultAction);
|
run(c, null, setDefaultAction);
|
||||||
@@ -319,15 +319,15 @@ public class UnsafeGetStableArrayElement {
|
|||||||
testMatched( Test::testD_D, Test::changeD);
|
testMatched( Test::testD_D, Test::changeD);
|
||||||
|
|
||||||
// Object[], aligned accesses
|
// Object[], aligned accesses
|
||||||
testMismatched(Test::testL_J, Test::changeL, true); // long & double are always as large as an OOP
|
testMismatched(Test::testL_J, Test::changeL, true, true); // long & double are always as large as an OOP
|
||||||
testMismatched(Test::testL_D, Test::changeL, true);
|
testMismatched(Test::testL_D, Test::changeL, true, true);
|
||||||
testMatched( Test::testL_L, Test::changeL);
|
testMatched( Test::testL_L, Test::changeL);
|
||||||
|
|
||||||
// Unaligned accesses
|
// Unaligned accesses
|
||||||
testMismatched(Test::testS_U, Test::changeS);
|
testMismatched(Test::testS_U, Test::changeS, false, false);
|
||||||
testMismatched(Test::testC_U, Test::changeC);
|
testMismatched(Test::testC_U, Test::changeC, false, false);
|
||||||
testMismatched(Test::testI_U, Test::changeI);
|
testMismatched(Test::testI_U, Test::changeI, false, false);
|
||||||
testMismatched(Test::testJ_U, Test::changeJ);
|
testMismatched(Test::testJ_U, Test::changeJ, true, false);
|
||||||
|
|
||||||
// No way to reliably check the expected behavior:
|
// No way to reliably check the expected behavior:
|
||||||
// (1) OOPs change during GC;
|
// (1) OOPs change during GC;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
* @requires !vm.flightRecorder
|
* @requires !vm.flightRecorder
|
||||||
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
|
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
|
||||||
* @requires vm.opt.MaxGCPauseMillis == "null"
|
* @requires vm.opt.MaxGCPauseMillis == "null"
|
||||||
|
* @requires vm.compMode != "Xcomp"
|
||||||
* @library /test/lib /
|
* @library /test/lib /
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
* @requires vm.gc.G1
|
* @requires vm.gc.G1
|
||||||
* @requires !vm.flightRecorder
|
* @requires !vm.flightRecorder
|
||||||
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
|
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
|
||||||
|
* @requires !vm.graal.enabled
|
||||||
|
* @requires vm.compMode != "Xcomp"
|
||||||
* @requires os.maxMemory > 1G
|
* @requires os.maxMemory > 1G
|
||||||
* @library /test/lib /
|
* @library /test/lib /
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024, 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* This is a non-abstract class with an abstract method.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
super public class AbstractMethodClass
|
||||||
|
extends java/lang/Object
|
||||||
|
version 51:0 // Java 7 version
|
||||||
|
{
|
||||||
|
|
||||||
|
public Method "<init>":"()V"
|
||||||
|
stack 1 locals 1
|
||||||
|
{
|
||||||
|
aload_0;
|
||||||
|
invokespecial Method java/lang/Object."<init>":"()V";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Method "abstractM":"()V";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024, 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 8323243
|
||||||
|
* @summary Test that invocation of an abstract method from JNI works correctly
|
||||||
|
* @compile AbstractMethodClass.jasm
|
||||||
|
* @run main/othervm/native TestJNIAbstractMethod
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We are testing invocation of an abstract method from JNI - which should
|
||||||
|
* simply result in throwning AbstractMethodError. To invoke an abstract method
|
||||||
|
* we must have an instance method (as abstract static methods are illegal),
|
||||||
|
* but instantiating an abstract class is also illegal at the Java language
|
||||||
|
* level, so we have to use a custom jasm class that contains an abstract method
|
||||||
|
* declaration, but which is not itself declared as an abstract class.
|
||||||
|
*/
|
||||||
|
public class TestJNIAbstractMethod {
|
||||||
|
|
||||||
|
// Invokes an abstract method from JNI and throws AbstractMethodError.
|
||||||
|
private static native void invokeAbstractM(Class<?> AMclass,
|
||||||
|
AbstractMethodClass receiver);
|
||||||
|
|
||||||
|
static {
|
||||||
|
System.loadLibrary("JNIAbstractMethod");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
AbstractMethodClass obj = new AbstractMethodClass();
|
||||||
|
try {
|
||||||
|
System.out.println("Attempting direct invocation via Java");
|
||||||
|
obj.abstractM();
|
||||||
|
throw new RuntimeException("Did not get AbstractMethodError from Java!");
|
||||||
|
} catch (AbstractMethodError expected) {
|
||||||
|
System.out.println("ok - got expected exception: " + expected);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
System.out.println("Attempting direct invocation via JNI");
|
||||||
|
invokeAbstractM(obj.getClass(), obj);
|
||||||
|
throw new RuntimeException("Did not get AbstractMethodError from JNI!");
|
||||||
|
} catch (AbstractMethodError expected) {
|
||||||
|
System.out.println("ok - got expected exception: " + expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024, 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <jni.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_TestJNIAbstractMethod_invokeAbstractM(JNIEnv* env,
|
||||||
|
jclass this_cls,
|
||||||
|
jclass target_cls,
|
||||||
|
jobject receiver) {
|
||||||
|
|
||||||
|
jmethodID mid = (*env)->GetMethodID(env, target_cls, "abstractM", "()V");
|
||||||
|
if (mid == NULL) {
|
||||||
|
fprintf(stderr, "Error looking up method abstractM\n");
|
||||||
|
(*env)->ExceptionDescribe(env);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Invoking abstract method ...\n");
|
||||||
|
(*env)->CallVoidMethod(env, receiver, mid); // Should raise exception
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018, 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
exclusiveAccess.dirs=.
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2018, 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
exclusiveAccess.dirs=.
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -35,6 +35,8 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
|
||||||
import nsk.share.test.LazyIntArrayToString;
|
import nsk.share.test.LazyIntArrayToString;
|
||||||
import nsk.share.test.TestUtils;
|
import nsk.share.test.TestUtils;
|
||||||
import vm.mlvm.meth.share.transform.v2.MHArrayEnvelopeTFPair;
|
import vm.mlvm.meth.share.transform.v2.MHArrayEnvelopeTFPair;
|
||||||
@@ -70,47 +72,68 @@ public class MHTransformationGen {
|
|||||||
private static final boolean USE_SAM = false; // Disabled in JDK7
|
private static final boolean USE_SAM = false; // Disabled in JDK7
|
||||||
private static final boolean USE_THROW_CATCH = false; // Test bugs
|
private static final boolean USE_THROW_CATCH = false; // Test bugs
|
||||||
|
|
||||||
private static final Optional<MemoryPoolMXBean> NON_SEGMENTED_CODE_CACHE_POOL;
|
/**
|
||||||
private static final Optional<MemoryPoolMXBean> NON_NMETHODS_POOL;
|
* The class is used for periodical checks if a code-cache consuming operation
|
||||||
private static final Optional<MemoryPoolMXBean> PROFILED_NMETHODS_POOL;
|
* could be executed (i.e. if code cache has enought free space for a typical operation).
|
||||||
private static final Optional<MemoryPoolMXBean> NON_PROFILED_NMETHODS_POOL ;
|
*/
|
||||||
|
private static class CodeCacheMonitor {
|
||||||
|
|
||||||
// Limit numbers are arbitrary, feel free to change if arguably necessary
|
private static final Optional<MemoryPoolMXBean> NON_SEGMENTED_CODE_CACHE_POOL;
|
||||||
private static final int NON_SEGMENTED_CACHE_ALLOWANCE = 2_000_000;
|
private static final Optional<MemoryPoolMXBean> NON_NMETHODS_POOL;
|
||||||
private static final int SEGMENTED_CACHE_ALLOWANCE = 1_000_000;
|
private static final Optional<MemoryPoolMXBean> PROFILED_NMETHODS_POOL;
|
||||||
|
private static final Optional<MemoryPoolMXBean> NON_PROFILED_NMETHODS_POOL;
|
||||||
|
|
||||||
static {
|
// Trial runs show up that maximal increase in code cache consumption between checks (for one
|
||||||
var pools = ManagementFactory.getMemoryPoolMXBeans();
|
// cycle/tree build in MHTransformationGen::createSequence), falls within the following intervals:
|
||||||
NON_SEGMENTED_CODE_CACHE_POOL = pools.stream()
|
//
|
||||||
.filter(pool -> pool.getName().equals("CodeCache")).findFirst();
|
// | Threads number | Without Xcomp | With Xcomp |
|
||||||
NON_NMETHODS_POOL = pools.stream()
|
// |----------------|---------------|------------|
|
||||||
.filter(pool -> pool.getName().equals("CodeHeap 'non-nmethods'")).findFirst();
|
// | 1 | 100-200 K | 400-500 K |
|
||||||
PROFILED_NMETHODS_POOL = pools.stream()
|
// | 10 | 1 - 2 M | 5-6 M |
|
||||||
.filter(pool -> pool.getName().equals("CodeHeap 'profiled nmethods'")).findFirst();
|
//
|
||||||
NON_PROFILED_NMETHODS_POOL = pools.stream()
|
// Those numbers are approximate (since trees are generated randomly and the total consumption
|
||||||
.filter(pool -> pool.getName().equals("CodeHeap 'non-profiled nmethods'")).findFirst();
|
// between checks depends on how threads are aligned - for example, if all threads finish up their
|
||||||
}
|
// cycles approximately at one time, the consumption increase will be the highest, like with a
|
||||||
|
// resonance's amplitude)
|
||||||
|
// The 10 threads is chosen as it is a typical number for multi-threaded tests.
|
||||||
|
//
|
||||||
|
// Based on these numbers, values of 10 M for Xcomp and 5 M for non-Xcomp, were suggested.
|
||||||
|
private static final int NON_SEGMENTED_CACHE_ALLOWANCE = Platform.isComp() ? 10_000_000 : 5_000_000;
|
||||||
|
private static final int SEGMENTED_CACHE_ALLOWANCE = Platform.isComp() ? 10_000_000 : 5_000_000;
|
||||||
|
|
||||||
|
static {
|
||||||
|
var pools = ManagementFactory.getMemoryPoolMXBeans();
|
||||||
|
NON_SEGMENTED_CODE_CACHE_POOL = pools.stream()
|
||||||
|
.filter(pool -> pool.getName().equals("CodeCache")).findFirst();
|
||||||
|
NON_NMETHODS_POOL = pools.stream()
|
||||||
|
.filter(pool -> pool.getName().equals("CodeHeap 'non-nmethods'")).findFirst();
|
||||||
|
PROFILED_NMETHODS_POOL = pools.stream()
|
||||||
|
.filter(pool -> pool.getName().equals("CodeHeap 'profiled nmethods'")).findFirst();
|
||||||
|
NON_PROFILED_NMETHODS_POOL = pools.stream()
|
||||||
|
.filter(pool -> pool.getName().equals("CodeHeap 'non-profiled nmethods'")).findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final boolean isCodeCacheEffectivelyFull() {
|
||||||
|
var result = new Object() { boolean value = false; };
|
||||||
|
|
||||||
|
BiConsumer<MemoryPoolMXBean, Integer> check = (pool, limit) -> {
|
||||||
|
var usage = pool.getUsage();
|
||||||
|
result.value |= usage.getMax() - usage.getUsed() < limit;
|
||||||
|
};
|
||||||
|
|
||||||
|
NON_SEGMENTED_CODE_CACHE_POOL.ifPresent(pool -> check.accept(pool, NON_SEGMENTED_CACHE_ALLOWANCE));
|
||||||
|
NON_NMETHODS_POOL.ifPresent(pool -> check.accept(pool, SEGMENTED_CACHE_ALLOWANCE));
|
||||||
|
PROFILED_NMETHODS_POOL.ifPresent(pool -> check.accept(pool, SEGMENTED_CACHE_ALLOWANCE));
|
||||||
|
NON_PROFILED_NMETHODS_POOL.ifPresent(pool -> check.accept(pool, SEGMENTED_CACHE_ALLOWANCE));
|
||||||
|
|
||||||
|
return result.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static class ThrowCatchTestException extends Throwable {
|
public static class ThrowCatchTestException extends Throwable {
|
||||||
private static final long serialVersionUID = -6749961303738648241L;
|
private static final long serialVersionUID = -6749961303738648241L;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean isCodeCacheEffectivelyFull() {
|
|
||||||
var result = new Object() { boolean value = false; };
|
|
||||||
|
|
||||||
BiConsumer<MemoryPoolMXBean, Integer> check = (pool, limit) -> {
|
|
||||||
var usage = pool.getUsage();
|
|
||||||
result.value |= usage.getMax() - usage.getUsed() < limit;
|
|
||||||
};
|
|
||||||
|
|
||||||
NON_SEGMENTED_CODE_CACHE_POOL.ifPresent(pool -> check.accept(pool, NON_SEGMENTED_CACHE_ALLOWANCE));
|
|
||||||
NON_NMETHODS_POOL.ifPresent(pool -> check.accept(pool, SEGMENTED_CACHE_ALLOWANCE));
|
|
||||||
PROFILED_NMETHODS_POOL.ifPresent(pool -> check.accept(pool, SEGMENTED_CACHE_ALLOWANCE));
|
|
||||||
NON_PROFILED_NMETHODS_POOL.ifPresent(pool -> check.accept(pool, SEGMENTED_CACHE_ALLOWANCE));
|
|
||||||
|
|
||||||
return result.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static MHMacroTF createSequence(Argument finalRetVal, Object boundObj, MethodHandle finalMH, Argument[] finalArgs) throws Throwable {
|
public static MHMacroTF createSequence(Argument finalRetVal, Object boundObj, MethodHandle finalMH, Argument[] finalArgs) throws Throwable {
|
||||||
Env.traceDebug("Generating sequence.");
|
Env.traceDebug("Generating sequence.");
|
||||||
@@ -133,7 +156,7 @@ public class MHTransformationGen {
|
|||||||
|
|
||||||
final int cyclesToBuild = nextInt(MAX_CYCLES);
|
final int cyclesToBuild = nextInt(MAX_CYCLES);
|
||||||
for ( int i = 0; i < cyclesToBuild; i++) {
|
for ( int i = 0; i < cyclesToBuild; i++) {
|
||||||
if (isCodeCacheEffectivelyFull()) {
|
if (CodeCacheMonitor.isCodeCacheEffectivelyFull()) {
|
||||||
Env.traceNormal("Not enought code cache to build up MH sequences anymore. " +
|
Env.traceNormal("Not enought code cache to build up MH sequences anymore. " +
|
||||||
" Has only been able to achieve " + i + " out of " + cyclesToBuild);
|
" Has only been able to achieve " + i + " out of " + cyclesToBuild);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -607,8 +607,6 @@ sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-
|
|||||||
sun/security/pkcs11/KeyStore/ClientAuth.sh 8254806 solaris-all
|
sun/security/pkcs11/KeyStore/ClientAuth.sh 8254806 solaris-all
|
||||||
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all
|
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all
|
||||||
|
|
||||||
sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all
|
|
||||||
|
|
||||||
javax/net/ssl/DTLS/PacketLossRetransmission.java 8169086 macosx-x64
|
javax/net/ssl/DTLS/PacketLossRetransmission.java 8169086 macosx-x64
|
||||||
javax/net/ssl/DTLS/RespondToRetransmit.java 8169086 macosx-all
|
javax/net/ssl/DTLS/RespondToRetransmit.java 8169086 macosx-all
|
||||||
javax/net/ssl/DTLS/CipherSuite.java 8202059 macosx-x64
|
javax/net/ssl/DTLS/CipherSuite.java 8202059 macosx-x64
|
||||||
|
|||||||
252
test/jdk/java/awt/Clipboard/DelayedQueryTest.java
Normal file
252
test/jdk/java/awt/Clipboard/DelayedQueryTest.java
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000, 2023, 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 4085183 8000630
|
||||||
|
@summary tests that clipboard contents is retrieved even if the app didn't
|
||||||
|
receive native events for a long time.
|
||||||
|
@requires (os.family != "mac")
|
||||||
|
@key headful
|
||||||
|
@run main DelayedQueryTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.AWTException;
|
||||||
|
import java.awt.Button;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Panel;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.datatransfer.Clipboard;
|
||||||
|
import java.awt.datatransfer.ClipboardOwner;
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
|
import java.awt.datatransfer.StringSelection;
|
||||||
|
import java.awt.datatransfer.Transferable;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
public class DelayedQueryTest implements ClipboardOwner, Runnable {
|
||||||
|
int returnCode = Child.CHILD_RETURN_CODE_NOT_READY;
|
||||||
|
|
||||||
|
Process childProcess = null;
|
||||||
|
Frame frame;
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
throws InterruptedException, InvocationTargetException {
|
||||||
|
String osName = System.getProperty("os.name");
|
||||||
|
if (osName.toLowerCase().contains("os x")) {
|
||||||
|
System.out.println("This test is not for MacOS, considered passed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DelayedQueryTest delayedQueryTest = new DelayedQueryTest();
|
||||||
|
EventQueue.invokeAndWait(delayedQueryTest::initAndShowGui);
|
||||||
|
try {
|
||||||
|
delayedQueryTest.start();
|
||||||
|
} finally {
|
||||||
|
EventQueue.invokeAndWait(() -> delayedQueryTest.frame.dispose());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initAndShowGui(){
|
||||||
|
frame = new Frame("DelayedQueryTest");
|
||||||
|
frame.add(new Panel());
|
||||||
|
frame.setBounds(200,200, 200, 200);
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
// Some mouse activity to update the Xt time stamp at
|
||||||
|
// the parent process.
|
||||||
|
robot.delay(1000);
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
|
Point p = frame.getLocationOnScreen();
|
||||||
|
robot.mouseMove(p.x + 100, p.y + 100);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
} catch (AWTException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("The test failed.");
|
||||||
|
}
|
||||||
|
Child.sysClipboard.setContents(Child.transferable, this);
|
||||||
|
|
||||||
|
String javaPath = System.getProperty("java.home", "");
|
||||||
|
String[] command = {
|
||||||
|
javaPath + File.separator + "bin" + File.separator + "java",
|
||||||
|
"-cp", System.getProperty("test.classes", "."),
|
||||||
|
"Child"
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
|
childProcess = process;
|
||||||
|
returnCode = process.waitFor();
|
||||||
|
childProcess = null;
|
||||||
|
|
||||||
|
InputStream errorStream = process.getErrorStream();
|
||||||
|
int count = errorStream.available();
|
||||||
|
if (count > 0) {
|
||||||
|
byte[] b = new byte[count];
|
||||||
|
errorStream.read(b);
|
||||||
|
System.err.println("========= Child VM System.err ========");
|
||||||
|
System.err.print(new String(b));
|
||||||
|
System.err.println("======================================");
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("The test failed.");
|
||||||
|
}
|
||||||
|
if (returnCode != Child.CHILD_RETURN_CODE_OK) {
|
||||||
|
System.err.println("Child VM: returned " + returnCode);
|
||||||
|
throw new RuntimeException("The test failed.");
|
||||||
|
}
|
||||||
|
} // start()
|
||||||
|
|
||||||
|
public void lostOwnership(Clipboard clipboard,
|
||||||
|
Transferable contents) {
|
||||||
|
// At this moment the child process has definitely started.
|
||||||
|
// So we can try to retrieve the clipboard contents set
|
||||||
|
// by the child process.
|
||||||
|
new Thread(this).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
// We are going to check if it is possible to retrieve the data
|
||||||
|
// after the child process has set the clipboard contents twice,
|
||||||
|
// since after the first setting the retrieval is always successful.
|
||||||
|
// So we wait to let the child process set the clipboard contents
|
||||||
|
// twice.
|
||||||
|
try {
|
||||||
|
Thread.sleep(Child.CHILD_SELECTION_CHANGE_TIMEOUT);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String s = (String)Child.sysClipboard
|
||||||
|
.getContents(null)
|
||||||
|
.getTransferData(DataFlavor.stringFlavor);
|
||||||
|
if (!"String".equals(s)) {
|
||||||
|
System.err.println("Data retrieved: " + s);
|
||||||
|
throw new RuntimeException("Retrieved data is incorrect.");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
if (childProcess != null) {
|
||||||
|
childProcess.destroy();
|
||||||
|
childProcess = null;
|
||||||
|
}
|
||||||
|
throw new RuntimeException("Failed to retrieve the data.");
|
||||||
|
}
|
||||||
|
Child.sysClipboard.setContents(Child.transferable, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Child {
|
||||||
|
static final Clipboard sysClipboard =
|
||||||
|
Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||||
|
static final Transferable transferable = new StringSelection("String");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Timeouts.
|
||||||
|
*/
|
||||||
|
static final int FRAME_ACTIVATION_TIMEOUT = 1000;
|
||||||
|
static final int PARENT_TIME_STAMP_TIMEOUT = 1000;
|
||||||
|
static final int CHILD_SELECTION_CHANGE_TIMEOUT =
|
||||||
|
FRAME_ACTIVATION_TIMEOUT + PARENT_TIME_STAMP_TIMEOUT + 5000;
|
||||||
|
static final int PARENT_RETRIEVE_DATA_TIMEOUT = 10000;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Child process return codes.
|
||||||
|
*/
|
||||||
|
static final int CHILD_RETURN_CODE_NOT_READY = -1;
|
||||||
|
static final int CHILD_RETURN_CODE_OK = 0;
|
||||||
|
static final int CHILD_RETURN_CODE_UNEXPECTED_EXCEPTION = 1;
|
||||||
|
static final int CHILD_RETURN_CODE_OTHER_FAILURE = 2;
|
||||||
|
static Button button;
|
||||||
|
|
||||||
|
static void initAndShowGui() {
|
||||||
|
final Frame frame = new Frame();
|
||||||
|
button = new Button("button");
|
||||||
|
frame.add(button);
|
||||||
|
frame.pack();
|
||||||
|
frame.setLocation(100, 100);
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
sysClipboard.setContents(
|
||||||
|
new StringSelection("First String"), null);
|
||||||
|
|
||||||
|
// Some mouse activity to update the Xt time stamp at
|
||||||
|
// the child process.
|
||||||
|
try {
|
||||||
|
EventQueue.invokeAndWait(Child::initAndShowGui);
|
||||||
|
try {
|
||||||
|
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(CHILD_RETURN_CODE_UNEXPECTED_EXCEPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
|
Point p = button.getLocationOnScreen();
|
||||||
|
robot.mouseMove(p.x + 10, p.y + 10);
|
||||||
|
// Wait to let the Xt time stamp become out-of-date.
|
||||||
|
try {
|
||||||
|
Thread.sleep(PARENT_TIME_STAMP_TIMEOUT);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(CHILD_RETURN_CODE_UNEXPECTED_EXCEPTION);
|
||||||
|
}
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(CHILD_RETURN_CODE_UNEXPECTED_EXCEPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
sysClipboard.setContents(transferable, new ClipboardOwner() {
|
||||||
|
public void lostOwnership(Clipboard clipboard,
|
||||||
|
Transferable contents) {
|
||||||
|
System.exit(CHILD_RETURN_CODE_OK);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Wait to let the parent process retrieve the data.
|
||||||
|
try {
|
||||||
|
Thread.sleep(PARENT_RETRIEVE_DATA_TIMEOUT);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// Parent failed to set clipboard contents, so we signal test failure
|
||||||
|
System.exit(CHILD_RETURN_CODE_OTHER_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
58
test/jdk/java/awt/Clipboard/NullContentsTest.java
Normal file
58
test/jdk/java/awt/Clipboard/NullContentsTest.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000, 2023, 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 4378007 4250859
|
||||||
|
@summary Verifies that setting the contents of the system Clipboard to null
|
||||||
|
throws a NullPointerException
|
||||||
|
@key headful
|
||||||
|
@run main NullContentsTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.datatransfer.Clipboard;
|
||||||
|
import java.awt.datatransfer.StringSelection;
|
||||||
|
|
||||||
|
public class NullContentsTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// Clipboard.setContents(null, foo) should throw an NPE, but
|
||||||
|
// Clipboard.setContents(bar, foo), where bar.getTransferData(baz)
|
||||||
|
// returns null, should not.
|
||||||
|
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||||
|
try {
|
||||||
|
clip.setContents(null, null);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
StringSelection ss = new StringSelection(null);
|
||||||
|
try {
|
||||||
|
clip.setContents(ss, null);
|
||||||
|
} catch (NullPointerException ee) {
|
||||||
|
throw new RuntimeException("test failed: null transfer data");
|
||||||
|
}
|
||||||
|
System.err.println("test passed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new RuntimeException("test failed: null Transferable");
|
||||||
|
}
|
||||||
|
}
|
||||||
198
test/jdk/java/awt/Clipboard/SerializeLocalFlavorTest.java
Normal file
198
test/jdk/java/awt/Clipboard/SerializeLocalFlavorTest.java
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006, 2023, 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 4696186
|
||||||
|
@summary tests that NotSerializableException is not printed in the console if
|
||||||
|
non-serializable object with DataFlavor.javaJVMLocalObjectMimeType
|
||||||
|
is set into the clipboard
|
||||||
|
@key headful
|
||||||
|
@run main SerializeLocalFlavorTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
|
import java.awt.datatransfer.Transferable;
|
||||||
|
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public class SerializeLocalFlavorTest {
|
||||||
|
private boolean failed = false;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new SerializeLocalFlavorTest().start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start () {
|
||||||
|
try {
|
||||||
|
String[] command = {
|
||||||
|
System.getProperty("java.home", "")
|
||||||
|
+ File.separator + "bin" + File.separator
|
||||||
|
+ "java",
|
||||||
|
"-cp",
|
||||||
|
System.getProperty("test.classes", "."),
|
||||||
|
"Child"
|
||||||
|
};
|
||||||
|
|
||||||
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
|
ProcessResults pres = ProcessResults.doWaitFor(process);
|
||||||
|
|
||||||
|
if (pres.stderr != null && pres.stderr.length() > 0) {
|
||||||
|
System.err.println("========= Child err ========");
|
||||||
|
System.err.print(pres.stderr);
|
||||||
|
System.err.println("======================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pres.stdout != null && pres.stdout.length() > 0) {
|
||||||
|
System.err.println("========= Child out ========");
|
||||||
|
System.err.print(pres.stdout);
|
||||||
|
System.err.println("======================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pres.stderr.indexOf("java.io.NotSerializableException") >= 0) {
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failed) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"The test failed: java.io.NotSerializableException printed!");
|
||||||
|
} else {
|
||||||
|
System.err.println("The test passed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Child {
|
||||||
|
public static void main (String [] args) throws Exception {
|
||||||
|
NotSerializableLocalTransferable t =
|
||||||
|
new NotSerializableLocalTransferable(new NotSer());
|
||||||
|
Toolkit.getDefaultToolkit()
|
||||||
|
.getSystemClipboard().setContents(t, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NotSerializableLocalTransferable implements Transferable {
|
||||||
|
public final DataFlavor flavor;
|
||||||
|
|
||||||
|
private final DataFlavor[] flavors;
|
||||||
|
|
||||||
|
private final Object data;
|
||||||
|
|
||||||
|
|
||||||
|
public NotSerializableLocalTransferable(Object data) throws Exception {
|
||||||
|
this.data = data;
|
||||||
|
flavor = new DataFlavor(
|
||||||
|
DataFlavor.javaJVMLocalObjectMimeType +
|
||||||
|
";class=" + "\"" + data.getClass().getName() + "\"");
|
||||||
|
this.flavors = new DataFlavor[] { flavor };
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataFlavor[] getTransferDataFlavors() {
|
||||||
|
return flavors.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||||
|
return this.flavor.equals(flavor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getTransferData(DataFlavor flavor)
|
||||||
|
throws UnsupportedFlavorException
|
||||||
|
{
|
||||||
|
if (this.flavor.equals(flavor)) {
|
||||||
|
return (Object)data;
|
||||||
|
}
|
||||||
|
throw new UnsupportedFlavorException(flavor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class NotSer implements Serializable {
|
||||||
|
private Object field = new Object(); // not serializable field
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProcessResults {
|
||||||
|
public int exitValue;
|
||||||
|
public String stdout;
|
||||||
|
public String stderr;
|
||||||
|
|
||||||
|
public ProcessResults() {
|
||||||
|
exitValue = -1;
|
||||||
|
stdout = "";
|
||||||
|
stderr = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to perform a "wait" for a process and return its exit value.
|
||||||
|
* This is a workaround for <code>Process.waitFor()</code> never returning.
|
||||||
|
*/
|
||||||
|
public static ProcessResults doWaitFor(Process p) {
|
||||||
|
ProcessResults pres = new ProcessResults();
|
||||||
|
|
||||||
|
InputStream in = null;
|
||||||
|
InputStream err = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
in = p.getInputStream();
|
||||||
|
err = p.getErrorStream();
|
||||||
|
|
||||||
|
boolean finished = false;
|
||||||
|
|
||||||
|
while (!finished) {
|
||||||
|
try {
|
||||||
|
while (in.available() > 0) {
|
||||||
|
pres.stdout += (char)in.read();
|
||||||
|
}
|
||||||
|
while (err.available() > 0) {
|
||||||
|
pres.stderr += (char)err.read();
|
||||||
|
}
|
||||||
|
// Ask the process for its exitValue. If the process
|
||||||
|
// is not finished, an IllegalThreadStateException
|
||||||
|
// is thrown. If it is finished, we fall through and
|
||||||
|
// the variable finished is set to true.
|
||||||
|
pres.exitValue = p.exitValue();
|
||||||
|
finished = true;
|
||||||
|
}
|
||||||
|
catch (IllegalThreadStateException e) {
|
||||||
|
// Process is not finished yet;
|
||||||
|
// Sleep a little to save on CPU cycles
|
||||||
|
Thread.sleep(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in != null) in.close();
|
||||||
|
if (err != null) err.close();
|
||||||
|
}
|
||||||
|
catch (Throwable e) {
|
||||||
|
System.err.println("doWaitFor(): unexpected exception");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return pres;
|
||||||
|
}
|
||||||
|
}
|
||||||
62
test/jdk/java/awt/ColorClass/ColorSerializationTest.java
Normal file
62
test/jdk/java/awt/ColorClass/ColorSerializationTest.java
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006, 2023, 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 4330102
|
||||||
|
@summary Tests that Color object is serializable
|
||||||
|
@run main ColorSerializationTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.image.IndexColorModel;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
public class ColorSerializationTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
java.awt.Color cobj = new java.awt.Color(255, 255, 255);
|
||||||
|
try {
|
||||||
|
cobj.createContext(
|
||||||
|
new IndexColorModel(
|
||||||
|
8, 1,
|
||||||
|
new byte[]{0}, new byte[]{0}, new byte[]{0}),
|
||||||
|
new Rectangle(1, 1, 2, 3),
|
||||||
|
new Rectangle(3, 3),
|
||||||
|
new AffineTransform(),
|
||||||
|
new RenderingHints(null));
|
||||||
|
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream objos = new ObjectOutputStream(ostream);
|
||||||
|
objos.writeObject(cobj);
|
||||||
|
objos.close();
|
||||||
|
System.out.println("Test PASSED");
|
||||||
|
} catch (java.io.IOException e) {
|
||||||
|
System.out.println("Test FAILED");
|
||||||
|
throw new RuntimeException("Test FAILED: Color is not serializable: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -892,7 +892,7 @@ public class CopyAndMove {
|
|||||||
if (supportsLinks) {
|
if (supportsLinks) {
|
||||||
source = createSourceFile(dir1);
|
source = createSourceFile(dir1);
|
||||||
link = dir1.resolve("link");
|
link = dir1.resolve("link");
|
||||||
createSymbolicLink(link, source);
|
createSymbolicLink(link, source.getFileName());
|
||||||
target = getTargetFile(dir2);
|
target = getTargetFile(dir2);
|
||||||
copyAndVerify(link, target);
|
copyAndVerify(link, target);
|
||||||
delete(link);
|
delete(link);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -118,6 +118,8 @@ public class AKISerialNumber {
|
|||||||
PKIXBuilderParameters params = new PKIXBuilderParameters
|
PKIXBuilderParameters params = new PKIXBuilderParameters
|
||||||
(Collections.singleton(anchor), sel);
|
(Collections.singleton(anchor), sel);
|
||||||
params.setRevocationEnabled(false);
|
params.setRevocationEnabled(false);
|
||||||
|
// Set date to 2024-01-01 to satisfy cert constraints
|
||||||
|
params.setDate(new java.util.Date(1704067200000l));
|
||||||
|
|
||||||
ArrayList<X509Certificate> certs = new ArrayList<>();
|
ArrayList<X509Certificate> certs = new ArrayList<>();
|
||||||
certs.add(intCert);
|
certs.add(intCert);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
tzdata2023d
|
tzdata2024a
|
||||||
|
|||||||
115
test/jdk/javax/swing/text/CompositeView/bug4398059.java
Normal file
115
test/jdk/javax/swing/text/CompositeView/bug4398059.java
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001, 2023, 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.Robot;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import javax.swing.JEditorPane;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.text.BadLocationException;
|
||||||
|
import javax.swing.text.Document;
|
||||||
|
import javax.swing.text.Element;
|
||||||
|
import javax.swing.text.Position;
|
||||||
|
import javax.swing.text.StyleConstants;
|
||||||
|
import javax.swing.text.View;
|
||||||
|
import javax.swing.text.ViewFactory;
|
||||||
|
import javax.swing.text.html.HTML;
|
||||||
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
|
import javax.swing.text.html.ParagraphView;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 4398059
|
||||||
|
* @key headful
|
||||||
|
* @summary Tests that CompositeView doesn't throw NPE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class bug4398059 {
|
||||||
|
private static JFrame jFrame;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
SwingUtilities.invokeAndWait(bug4398059::createAndShowUI);
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(1000);
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
if (jFrame != null) {
|
||||||
|
jFrame.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createAndShowUI() {
|
||||||
|
String text = "<H1>text";
|
||||||
|
jFrame = new JFrame("CompositeView Test");
|
||||||
|
JEditorPane jep = new JEditorPane();
|
||||||
|
jep.setEditorKit(new MyHTMLEditorKit());
|
||||||
|
jep.setText(text);
|
||||||
|
|
||||||
|
Document doc = jep.getDocument();
|
||||||
|
jep.setCaretPosition(doc.getLength() - 1);
|
||||||
|
|
||||||
|
jFrame.getContentPane().add(jep);
|
||||||
|
jFrame.setSize(200,200);
|
||||||
|
jFrame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyHTMLEditorKit extends HTMLEditorKit {
|
||||||
|
private static final ViewFactory defaultFactory = new MyHTMLFactory();
|
||||||
|
|
||||||
|
public ViewFactory getViewFactory() {
|
||||||
|
return defaultFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyHTMLFactory extends HTMLEditorKit.HTMLFactory {
|
||||||
|
public View create(Element elem) {
|
||||||
|
Object obj = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
|
||||||
|
if (obj instanceof HTML.Tag) {
|
||||||
|
HTML.Tag kind = (HTML.Tag) obj;
|
||||||
|
if (kind == HTML.Tag.H1) {
|
||||||
|
return new MyParagraphView(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.create(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyParagraphView extends ParagraphView {
|
||||||
|
public MyParagraphView(Element elem) {
|
||||||
|
super(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Shape getChildAllocation(int index, Shape a) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Shape modelToView(int pos, Shape a, Position.Bias b)
|
||||||
|
throws BadLocationException {
|
||||||
|
return super.modelToView(pos, a, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
106
test/jdk/javax/swing/text/DefaultCaret/bug4197894.java
Normal file
106
test/jdk/javax/swing/text/DefaultCaret/bug4197894.java
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1999, 2023, 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.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 4197894
|
||||||
|
* @key headful
|
||||||
|
* @summary Tests if shift-click adjusts selection in text areas.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class bug4197894 {
|
||||||
|
private static JFrame jFrame;
|
||||||
|
private static JTextArea ta;
|
||||||
|
|
||||||
|
private static volatile Point point = null;
|
||||||
|
private static volatile Rectangle bounds;
|
||||||
|
|
||||||
|
private static volatile boolean passed = true;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(50);
|
||||||
|
robot.setAutoWaitForIdle(true);
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(bug4197894::createAndShowUI);
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(1000);
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
point = ta.getLocationOnScreen();
|
||||||
|
bounds = ta.getBounds();
|
||||||
|
});
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(300);
|
||||||
|
|
||||||
|
robot.mouseMove((point.x + bounds.width / 4),
|
||||||
|
(point.y + bounds.height / 4));
|
||||||
|
|
||||||
|
robot.keyPress(KeyEvent.VK_SHIFT);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.keyRelease(KeyEvent.VK_SHIFT);
|
||||||
|
robot.delay(300);
|
||||||
|
|
||||||
|
if (!passed) {
|
||||||
|
throw new RuntimeException("Test failed." +
|
||||||
|
" Shift-Click Text Selection does not work!");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
if (jFrame != null) {
|
||||||
|
jFrame.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createAndShowUI() {
|
||||||
|
jFrame = new JFrame("Shift-Click Text Selection");
|
||||||
|
ta = new JTextArea();
|
||||||
|
ta.addKeyListener(new KeyAdapter() {
|
||||||
|
public void keyReleased(KeyEvent e) {
|
||||||
|
String selText = ta.getSelectedText();
|
||||||
|
passed = !(selText == null || (selText.length() == 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ta.setText("12345\n12345\n12345\n12345\n12345\n12345\n12345");
|
||||||
|
ta.setCaretPosition(ta.getDocument().getLength());
|
||||||
|
jFrame.getContentPane().add(ta);
|
||||||
|
jFrame.pack();
|
||||||
|
jFrame.setLocationRelativeTo(null);
|
||||||
|
jFrame.setAlwaysOnTop(true);
|
||||||
|
jFrame.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
134
test/jdk/javax/swing/text/DefaultCaret/bug4203175.java
Normal file
134
test/jdk/javax/swing/text/DefaultCaret/bug4203175.java
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000, 2023, 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.Container;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 4203175
|
||||||
|
* @key headful
|
||||||
|
* @summary Tests that double-click on disabled JTextField doesn't
|
||||||
|
* cause other text-field to select content.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class bug4203175 {
|
||||||
|
private static JFrame jFrame;
|
||||||
|
private static JTextField tf1, tf2;
|
||||||
|
private static JButton b;
|
||||||
|
private static volatile Point point;
|
||||||
|
private static volatile boolean passed = true;
|
||||||
|
private static int clicks = 0;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(50);
|
||||||
|
robot.setAutoWaitForIdle(true);
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(bug4203175::createAndShowUI);
|
||||||
|
robot.delay(1000);
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(() -> point = tf1.getLocationOnScreen());
|
||||||
|
robot.mouseMove(point.x, point.y);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.delay(200);
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(() -> point = b.getLocationOnScreen());
|
||||||
|
robot.mouseMove(point.x, point.y);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.delay(200);
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(() -> point = tf2.getLocationOnScreen());
|
||||||
|
robot.mouseMove(point.x, point.y);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.delay(200);
|
||||||
|
|
||||||
|
if (!passed) {
|
||||||
|
throw new RuntimeException("Test failed!! Text selection on disabled" +
|
||||||
|
" TextField does not work as expected!");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
if (jFrame != null) {
|
||||||
|
jFrame.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createAndShowUI() {
|
||||||
|
jFrame = new JFrame("JTextField Text Selection");
|
||||||
|
Container cont = jFrame.getContentPane();
|
||||||
|
cont.setLayout(new BoxLayout(cont, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
tf1 = new JTextField(20);
|
||||||
|
tf1.setText("sometext");
|
||||||
|
tf1.setName("Field 1");
|
||||||
|
tf1.setCaretPosition(tf1.getDocument().getLength());
|
||||||
|
cont.add(tf1);
|
||||||
|
|
||||||
|
tf2 = new JTextField(20);
|
||||||
|
tf2.setName("Field 2");
|
||||||
|
tf2.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
super.mouseClicked(e);
|
||||||
|
clicks++;
|
||||||
|
if (clicks == 2) {
|
||||||
|
String selText = tf1.getSelectedText();
|
||||||
|
passed = (selText == null || (selText.length() == 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cont.add(tf2);
|
||||||
|
|
||||||
|
b = new JButton("Toggle Enabled");
|
||||||
|
cont.add(b);
|
||||||
|
b.addActionListener(e -> {
|
||||||
|
if (e.getSource() == b) {
|
||||||
|
boolean b = tf1.isEnabled();
|
||||||
|
tf1.setEnabled(!b);
|
||||||
|
tf2.setEnabled(!b);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jFrame.pack();
|
||||||
|
jFrame.setLocationRelativeTo(null);
|
||||||
|
jFrame.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
52
test/jdk/javax/swing/text/DefaultEditorKit/bug4265242.java
Normal file
52
test/jdk/javax/swing/text/DefaultEditorKit/bug4265242.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1999, 2023, 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.event.ActionEvent;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.JTextPane;
|
||||||
|
import javax.swing.text.DefaultEditorKit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 4265242
|
||||||
|
* @summary Tests endParagraphAction in JTextPane
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class bug4265242 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JTextPane jTextPane = new JTextPane();
|
||||||
|
jTextPane.setText("Merry sparrow");
|
||||||
|
|
||||||
|
Action[] actions = jTextPane.getActions();
|
||||||
|
Action endPara = null;
|
||||||
|
for (Action action : actions) {
|
||||||
|
String name = (String) action.getValue(Action.NAME);
|
||||||
|
if (name.equals(DefaultEditorKit.endParagraphAction)) {
|
||||||
|
endPara = action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endPara.actionPerformed(new ActionEvent(jTextPane,
|
||||||
|
ActionEvent.ACTION_PERFORMED,
|
||||||
|
DefaultEditorKit.endParagraphAction));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001, 2023, 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 javax.swing.text.DefaultStyledDocument;
|
||||||
|
import javax.swing.text.Element;
|
||||||
|
import javax.swing.text.MutableAttributeSet;
|
||||||
|
import javax.swing.text.SimpleAttributeSet;
|
||||||
|
import javax.swing.text.StyleConstants;
|
||||||
|
import javax.swing.text.StyledDocument;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 4472852
|
||||||
|
* @summary Tests DefaultStyledDocument.split(int, int)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class bug4472852 {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// create a Document and insert some text there
|
||||||
|
StyledDocument doc = new DefaultStyledDocument();
|
||||||
|
doc.insertString(0, "this", null);
|
||||||
|
|
||||||
|
// add style to the last word
|
||||||
|
Element root = doc.getDefaultRootElement();
|
||||||
|
int end = root.getEndOffset();
|
||||||
|
MutableAttributeSet as = new SimpleAttributeSet();
|
||||||
|
StyleConstants.setBackground(as, Color.BLUE);
|
||||||
|
doc.setCharacterAttributes(end-5, 5, as, true);
|
||||||
|
|
||||||
|
// inspect Elements of the only Paragraph --
|
||||||
|
// there should be no empty Elements
|
||||||
|
Element para = root.getElement(0);
|
||||||
|
for (int i = 0; i < para.getElementCount(); i++) {
|
||||||
|
Element el = para.getElement(i);
|
||||||
|
if (el.getStartOffset() == el.getEndOffset()) {
|
||||||
|
throw new RuntimeException("Failed: empty Element found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
116
test/jdk/javax/swing/text/html/TableView/bug4813831.java
Normal file
116
test/jdk/javax/swing/text/html/TableView/bug4813831.java
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2003, 2023, 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 4813831
|
||||||
|
* @summary Verifies contents of table cells in HTML in JEditorPane wraps correctly
|
||||||
|
* @key headful
|
||||||
|
* @run main bug4813831
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.JEditorPane;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.text.View;
|
||||||
|
import javax.swing.text.ParagraphView;
|
||||||
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
|
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
|
public class bug4813831 {
|
||||||
|
|
||||||
|
private static boolean passed = false;
|
||||||
|
private boolean finished = false;
|
||||||
|
|
||||||
|
private static JEditorPane jep;
|
||||||
|
private static JFrame f;
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
|
||||||
|
String text =
|
||||||
|
"<html><body>" +
|
||||||
|
"<table border><tr>" +
|
||||||
|
"<td align=center>XXXXXXXXXXXXXX<BR>X<BR>X</td>" +
|
||||||
|
"</tr></table>" +
|
||||||
|
"</body></html>";
|
||||||
|
|
||||||
|
f = new JFrame();
|
||||||
|
jep = new JEditorPane();
|
||||||
|
jep.setEditorKit(new HTMLEditorKit());
|
||||||
|
jep.setEditable(false);
|
||||||
|
|
||||||
|
jep.setText(text);
|
||||||
|
|
||||||
|
f.getContentPane().add(jep);
|
||||||
|
f.setSize(20,500);
|
||||||
|
f.setLocationRelativeTo(null);
|
||||||
|
f.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(100);
|
||||||
|
bug4813831 test = new bug4813831();
|
||||||
|
try {
|
||||||
|
SwingUtilities.invokeAndWait(() -> test.init());
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(1000);
|
||||||
|
Shape r = jep.getBounds();
|
||||||
|
View v = jep.getUI().getRootView(jep);
|
||||||
|
do {
|
||||||
|
int n = v.getViewCount();
|
||||||
|
Shape sh = v.getChildAllocation(n - 1, r);
|
||||||
|
if (sh != null) {
|
||||||
|
r = sh;
|
||||||
|
}
|
||||||
|
v = v.getView(n - 1);
|
||||||
|
} while (!(v instanceof ParagraphView));
|
||||||
|
|
||||||
|
int n = v.getViewCount();
|
||||||
|
// there should be 3 lines or more (if the first long line was wrapped) in a cell
|
||||||
|
passed = n >= 3;
|
||||||
|
|
||||||
|
if (passed) {
|
||||||
|
Shape sh = v.getChildAllocation(n - 2, r);
|
||||||
|
int x1 = sh.getBounds().x;
|
||||||
|
sh = v.getChildAllocation(n - 1, r);
|
||||||
|
int x2 = sh.getBounds().x;
|
||||||
|
System.out.println("x1: " + x1 + " x2: " + x2);
|
||||||
|
// lines should be equally aligned
|
||||||
|
passed = (x1 == x2);
|
||||||
|
}
|
||||||
|
if (!passed) {
|
||||||
|
throw new RuntimeException("Test failed.");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
if (f != null) {
|
||||||
|
f.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
133
test/jdk/javax/swing/tree/DefaultTreeCellEditor/bug4480602.java
Normal file
133
test/jdk/javax/swing/tree/DefaultTreeCellEditor/bug4480602.java
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2003, 2023, 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 4480602
|
||||||
|
* @summary Verifies if DefaultTreeCellEditor.inHitRegion() incorrectly
|
||||||
|
* handles row bounds
|
||||||
|
* @key headful
|
||||||
|
* @run main bug4480602
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.ComponentOrientation;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTree;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import javax.swing.tree.DefaultTreeCellEditor;
|
||||||
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class bug4480602 {
|
||||||
|
|
||||||
|
static JTree tree;
|
||||||
|
static JFrame fr;
|
||||||
|
static MyTreeCellEditor editor;
|
||||||
|
|
||||||
|
static Robot robot;
|
||||||
|
boolean passed = false;
|
||||||
|
boolean do_test = false;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(100);
|
||||||
|
try {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
fr = new JFrame("Test");
|
||||||
|
|
||||||
|
String s = "0\u05D01\u05D02\u05D03\u05D04\u05D05";
|
||||||
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode(s);
|
||||||
|
root.add(new DefaultMutableTreeNode(s));
|
||||||
|
root.add(new DefaultMutableTreeNode(s));
|
||||||
|
|
||||||
|
tree = new JTree(root);
|
||||||
|
editor = new MyTreeCellEditor(tree, new DefaultTreeCellRenderer());
|
||||||
|
tree.setCellEditor(editor);
|
||||||
|
tree.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
|
||||||
|
tree.setEditable(true);
|
||||||
|
JScrollPane sp = new JScrollPane(tree);
|
||||||
|
fr.getContentPane().add(sp);
|
||||||
|
|
||||||
|
fr.setSize(250,200);
|
||||||
|
fr.setLocationRelativeTo(null);
|
||||||
|
fr.setVisible(true);
|
||||||
|
});
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(1000);
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
Rectangle rect = tree.getRowBounds(1);
|
||||||
|
editor.testTreeCellEditor(rect);
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
if (fr != null) {
|
||||||
|
fr.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyTreeCellEditor extends DefaultTreeCellEditor {
|
||||||
|
|
||||||
|
public MyTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer) {
|
||||||
|
super(tree, renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTreeCellEditor(Rectangle rect) {
|
||||||
|
int x = rect.x + 10;
|
||||||
|
int y = rect.y + rect.height / 2;
|
||||||
|
MouseEvent me = new MouseEvent(tree,
|
||||||
|
MouseEvent.MOUSE_PRESSED,
|
||||||
|
(new Date()).getTime(),
|
||||||
|
MouseEvent.BUTTON1_DOWN_MASK,
|
||||||
|
rect.x + 10, rect.y + 10,
|
||||||
|
1, true);
|
||||||
|
isCellEditable(me);
|
||||||
|
|
||||||
|
if (tree == null) {
|
||||||
|
throw new RuntimeException("isCellEditable() should set the tree");
|
||||||
|
}
|
||||||
|
if (lastRow != 1) {
|
||||||
|
throw new RuntimeException("isCellEditable() should set the lastRow");
|
||||||
|
}
|
||||||
|
if (offset == 0) {
|
||||||
|
throw new RuntimeException("isCellEditable() should determine offset");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inHitRegion(x,y)) {
|
||||||
|
throw new RuntimeException("Hit region should contain point ("+x+", "+y+")");
|
||||||
|
}
|
||||||
|
x = rect.x + rect.width - 10;
|
||||||
|
if (inHitRegion(x,y)) {
|
||||||
|
throw new RuntimeException("Hit region shouldn't contain point ("+x+", "+y+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1999, 2023, 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 4180224
|
||||||
|
* @summary DefaultTreeCellRenderer.hasFocus protected (not private) now.
|
||||||
|
* @key headful
|
||||||
|
* @run main bug4180224
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||||
|
|
||||||
|
public class bug4180224 {
|
||||||
|
|
||||||
|
static class MyDTCR extends DefaultTreeCellRenderer {
|
||||||
|
void test() {
|
||||||
|
hasFocus = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] argv) {
|
||||||
|
MyDTCR m = new MyDTCR();
|
||||||
|
m.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
174
test/jdk/javax/swing/tree/FixedHeightLayoutCache/bug4745001.java
Normal file
174
test/jdk/javax/swing/tree/FixedHeightLayoutCache/bug4745001.java
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002, 2023, 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 4745001
|
||||||
|
* @summary JTree with setLargeModel(true) not display correctly
|
||||||
|
* when we expand/collapse nodes
|
||||||
|
* @key headful
|
||||||
|
* @run main bug4745001
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Robot;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JTree;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
|
import javax.swing.tree.TreePath;
|
||||||
|
import javax.swing.event.TreeExpansionEvent;
|
||||||
|
import javax.swing.event.TreeExpansionListener;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
public class bug4745001 {
|
||||||
|
|
||||||
|
static JTree tree;
|
||||||
|
static JFrame fr;
|
||||||
|
boolean stateChanged;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(100);
|
||||||
|
bug4745001 test = new bug4745001();
|
||||||
|
try {
|
||||||
|
SwingUtilities.invokeAndWait(() -> test.init());
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(1000);
|
||||||
|
test.start();
|
||||||
|
robot.delay(1000);
|
||||||
|
test.destroy();
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
if (fr != null) {
|
||||||
|
fr.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
fr = new JFrame("Test");
|
||||||
|
fr.getContentPane().setLayout(new FlowLayout());
|
||||||
|
|
||||||
|
tree = new JTree();
|
||||||
|
tree.setRowHeight(20);
|
||||||
|
tree.setLargeModel(true);
|
||||||
|
tree.setPreferredSize(new Dimension(100, 400));
|
||||||
|
tree.setRootVisible(false);
|
||||||
|
tree.setShowsRootHandles(true);
|
||||||
|
|
||||||
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode("");
|
||||||
|
DefaultMutableTreeNode a = new DefaultMutableTreeNode("a");
|
||||||
|
DefaultMutableTreeNode b = new DefaultMutableTreeNode("b");
|
||||||
|
DefaultMutableTreeNode c = new DefaultMutableTreeNode("c");
|
||||||
|
root.add(a);
|
||||||
|
root.add(b);
|
||||||
|
root.add(c);
|
||||||
|
b.add(new DefaultMutableTreeNode("b1"));
|
||||||
|
c.add(new DefaultMutableTreeNode("c2"));
|
||||||
|
tree.setModel(new DefaultTreeModel(root));
|
||||||
|
|
||||||
|
fr.getContentPane().add(tree);
|
||||||
|
|
||||||
|
tree.addTreeExpansionListener(new TreeExpansionListener() {
|
||||||
|
public void treeExpanded(TreeExpansionEvent e) {
|
||||||
|
TreePath path = e.getPath();
|
||||||
|
if (path != null) {
|
||||||
|
DefaultMutableTreeNode node =
|
||||||
|
(DefaultMutableTreeNode)path.getLastPathComponent();
|
||||||
|
node.removeAllChildren();
|
||||||
|
String s = (String)node.getUserObject();
|
||||||
|
node.add(new DefaultMutableTreeNode(s + "1"));
|
||||||
|
node.add(new DefaultMutableTreeNode(s + "2"));
|
||||||
|
node.add(new DefaultMutableTreeNode(s + "3"));
|
||||||
|
DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
|
||||||
|
model.nodeStructureChanged(node);
|
||||||
|
synchronized (bug4745001.this) {
|
||||||
|
stateChanged = true;
|
||||||
|
bug4745001.this.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void treeCollapsed(TreeExpansionEvent e) {
|
||||||
|
synchronized (bug4745001.this) {
|
||||||
|
stateChanged = true;
|
||||||
|
bug4745001.this.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fr.pack();
|
||||||
|
fr.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void changeNodeStateForRow(final int row, final boolean expand) throws Exception {
|
||||||
|
try {
|
||||||
|
stateChanged = false;
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
if (expand) {
|
||||||
|
tree.expandRow(row);
|
||||||
|
} else {
|
||||||
|
tree.collapseRow(row);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
synchronized (this) {
|
||||||
|
while (!stateChanged) {
|
||||||
|
bug4745001.this.wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() throws Exception {
|
||||||
|
// expand node "c"
|
||||||
|
changeNodeStateForRow(2, true);
|
||||||
|
// expand node "b"
|
||||||
|
changeNodeStateForRow(1, true);
|
||||||
|
// collapse node "c"
|
||||||
|
changeNodeStateForRow(1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] expected = new String[] {"a", "b", "c", "c1", "c2", "c3"};
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
for (int i = 0; i < expected.length; i++) {
|
||||||
|
Object obj = tree.getPathForRow(i).getLastPathComponent();
|
||||||
|
if (!obj.toString().equals(expected[i])) {
|
||||||
|
throw new RuntimeException("Unexpected node at row "+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.security.*;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Export a private key from the named keychain entry without supplying a
|
|
||||||
* password. See JDK-8062264.
|
|
||||||
*
|
|
||||||
* NOTE: Keychain access controls must already have been lowered to permit
|
|
||||||
* the target entry to be accessed.
|
|
||||||
*/
|
|
||||||
public class ExportPrivateKeyNoPwd {
|
|
||||||
|
|
||||||
public static final void main(String[] args) throws Exception {
|
|
||||||
|
|
||||||
if (args.length != 1) {
|
|
||||||
throw new Exception(
|
|
||||||
"ExportPrivateKeyNoPwd: must supply name of a keystore entry");
|
|
||||||
}
|
|
||||||
String alias = args[0];
|
|
||||||
|
|
||||||
KeyStore ks = KeyStore.getInstance("KeychainStore");
|
|
||||||
System.out.println("ExportPrivateKeyNoPwd: loading keychains...");
|
|
||||||
ks.load(null, null);
|
|
||||||
|
|
||||||
System.out.println("ExportPrivateKeyNoPwd: exporting key...");
|
|
||||||
Key key = ks.getKey(alias, null);
|
|
||||||
if (key instanceof PrivateKey) {
|
|
||||||
System.out.println("ExportPrivateKeyNoPwd: exported " +
|
|
||||||
key.getAlgorithm() + " private key from '" + alias + "'");
|
|
||||||
} else {
|
|
||||||
throw new Exception("Error exporting private key from keychain");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
202
test/jdk/sun/security/tools/keytool/ListKeyChainStore.java
Normal file
202
test/jdk/sun/security/tools/keytool/ListKeyChainStore.java
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012, 2023, 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 7133495 8062264 8046777 8153005
|
||||||
|
* @summary KeyChain KeyStore implementation retrieves only one private key entry
|
||||||
|
* @requires (os.family == "mac")
|
||||||
|
* @library /test/lib
|
||||||
|
* @run main/othervm/manual ListKeyChainStore
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.SecurityTools;
|
||||||
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.security.Key;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
|
||||||
|
public class ListKeyChainStore {
|
||||||
|
private static final String PWD = "xxxxxx";
|
||||||
|
private static final String DEFAULT_KEYTOOL = "-list -storetype KeychainStore " +
|
||||||
|
"-keystore NONE -storepass " + PWD;
|
||||||
|
private static final String USER_DIR = System.getProperty("user.dir", ".");
|
||||||
|
private static final String FS = System.getProperty("file.separator");
|
||||||
|
private static final String PKCS12_KEYSTORE = USER_DIR + FS + "7133495.p12";
|
||||||
|
private static final String KEYCHAIN_FILE = USER_DIR + FS + "7133495.keychain";
|
||||||
|
private static final String TEMPORARY_FILE = USER_DIR + FS + "7133495.tmp";
|
||||||
|
private static final String USER_KEYCHAIN_LIST = USER_DIR + FS + "user.keychain.list";
|
||||||
|
private static final String PRIVATE_KEY_ENTRY = "PrivateKeyEntry";
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
LOG_MSG("WARNING: This test doesn't work on macOS virtualized environment. " +
|
||||||
|
"`security list-keychains -s` doesn't update the search order.");
|
||||||
|
|
||||||
|
deleteTestTempFilesIfExists();
|
||||||
|
|
||||||
|
// Get the old security keychain list to restore later
|
||||||
|
try (PrintStream printStream = new PrintStream(USER_KEYCHAIN_LIST)) {
|
||||||
|
ProcessTools.executeCommand("sh", "-c", "security list-keychains")
|
||||||
|
.shouldHaveExitValue(0).outputTo(printStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
try (PrintStream printStream = new PrintStream(TEMPORARY_FILE)) {
|
||||||
|
SecurityTools.keytool(DEFAULT_KEYTOOL).shouldHaveExitValue(0)
|
||||||
|
.outputTo(printStream);
|
||||||
|
}
|
||||||
|
int oldPrivateKeyCount = countOccurrences(TEMPORARY_FILE, PRIVATE_KEY_ENTRY);
|
||||||
|
LOG_MSG("Found " + oldPrivateKeyCount + " private key entries in the " +
|
||||||
|
"Keychain keystore");
|
||||||
|
|
||||||
|
// Create the PKCS12 keystore containing 3 public/private key pairs
|
||||||
|
LOG_MSG("Creating PKCS12 keystore: " + PKCS12_KEYSTORE);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
// Use legacy encryption and MAC algorithms, refer macOS open radar FB8988319
|
||||||
|
// macOS security framework doesn't work with the latest algorithms
|
||||||
|
SecurityTools.keytool(String.format("-J-Dkeystore.pkcs12.legacy -genkeypair" +
|
||||||
|
" -storetype PKCS12 -keystore %s -storepass %s -keyalg rsa -dname " +
|
||||||
|
"CN=CN%d,OU=OU%d,O=O%d,ST=ST%d,C=US -alias 7133495-%d",
|
||||||
|
PKCS12_KEYSTORE, PWD, i, i, i, i, i)).shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the keychain
|
||||||
|
LOG_MSG("Creating keychain: " + KEYCHAIN_FILE);
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("security create-keychain" +
|
||||||
|
" -p %s %s", PWD, KEYCHAIN_FILE)).shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
// Unlock the keychain
|
||||||
|
LOG_MSG("Unlock keychain: " + KEYCHAIN_FILE);
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("security unlock-keychain" +
|
||||||
|
" -p %s %s", PWD, KEYCHAIN_FILE)).shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
// Import the key pairs from the PKCS12 keystore into the keychain
|
||||||
|
// The '-A' option is used to lower the keychain's access controls
|
||||||
|
LOG_MSG("Importing the key pairs from " + PKCS12_KEYSTORE
|
||||||
|
+ " to " + KEYCHAIN_FILE);
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("security import %s -k %s" +
|
||||||
|
" -f pkcs12 -P %s -A", PKCS12_KEYSTORE, KEYCHAIN_FILE, PWD)).shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
// Generate a 2048-bit RSA keypair and import into the keychain
|
||||||
|
// Its private key is configured with non-default key usage settings
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("certtool ca k=%s " +
|
||||||
|
"<<EOF\n" +
|
||||||
|
"test\n" +
|
||||||
|
"r\n" +
|
||||||
|
"2048\n" +
|
||||||
|
"y\n" +
|
||||||
|
"b\n" +
|
||||||
|
"s\n" +
|
||||||
|
"y\n" +
|
||||||
|
"A\n" +
|
||||||
|
"US\n" +
|
||||||
|
"A\n" +
|
||||||
|
"A\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"y\n" +
|
||||||
|
"EOF", KEYCHAIN_FILE)).shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
// Adjust the keychain search order to add KEYCHAIN_FILE to top
|
||||||
|
try (PrintStream printStream = new PrintStream(TEMPORARY_FILE)) {
|
||||||
|
printStream.println("\"" + KEYCHAIN_FILE + "\"");
|
||||||
|
printStream.println(ProcessTools.executeCommand("sh", "-c", "security list-keychains")
|
||||||
|
.shouldHaveExitValue(0).getOutput());
|
||||||
|
}
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("security list-keychains -s %s",
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("xargs < %s",
|
||||||
|
TEMPORARY_FILE)).getOutput()));
|
||||||
|
LOG_MSG("Keychain search order:");
|
||||||
|
ProcessTools.executeCommand("sh", "-c", "security list-keychains");
|
||||||
|
|
||||||
|
// Recount the number of private key entries in the Keychain keystore
|
||||||
|
// 3 private keys imported from PKCS12, 1 private key generated by 'certtool'
|
||||||
|
Files.deleteIfExists(Paths.get(TEMPORARY_FILE));
|
||||||
|
try (PrintStream printStream = new PrintStream(TEMPORARY_FILE)) {
|
||||||
|
SecurityTools.keytool(DEFAULT_KEYTOOL).shouldHaveExitValue(0)
|
||||||
|
.outputTo(printStream);
|
||||||
|
}
|
||||||
|
int newPrivateKeyCount = countOccurrences(TEMPORARY_FILE, PRIVATE_KEY_ENTRY);
|
||||||
|
LOG_MSG("Found " + newPrivateKeyCount + " private key entries in " +
|
||||||
|
"the Keychain keystore");
|
||||||
|
if (newPrivateKeyCount < (oldPrivateKeyCount + 4)) {
|
||||||
|
throw new RuntimeException("Error: expected more private key entries in the " +
|
||||||
|
"Keychain keystore");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export a private key from the keychain (without supplying a password)
|
||||||
|
// Access controls have already been lowered (see 'security import ... -A' above)
|
||||||
|
LOG_MSG("Exporting a private key from the keychain");
|
||||||
|
KeyStore ks = KeyStore.getInstance("KeychainStore");
|
||||||
|
ks.load(null, null);
|
||||||
|
Key key = ks.getKey("CN0", null);
|
||||||
|
if (key instanceof PrivateKey) {
|
||||||
|
LOG_MSG("Exported " + key.getAlgorithm() + " private key from CN0");
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Error exporting private key from keychain");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// Reset earlier keychain list
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("security list-keychains -s %s",
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("xargs < %s",
|
||||||
|
USER_KEYCHAIN_LIST)).getOutput()));
|
||||||
|
|
||||||
|
deleteTestTempFilesIfExists();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void deleteTestTempFilesIfExists() throws Throwable {
|
||||||
|
Files.deleteIfExists(Paths.get(USER_KEYCHAIN_LIST));
|
||||||
|
Files.deleteIfExists(Paths.get(PKCS12_KEYSTORE));
|
||||||
|
if (Files.exists(Paths.get(KEYCHAIN_FILE))) {
|
||||||
|
ProcessTools.executeCommand("sh", "-c", String.format("security delete-keychain" +
|
||||||
|
" %s", KEYCHAIN_FILE)).shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
Files.deleteIfExists(Paths.get(TEMPORARY_FILE));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int countOccurrences(String filePath, String word) throws IOException {
|
||||||
|
int count = 0;
|
||||||
|
try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
if (line.contains(word)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LOG_MSG(String msg) {
|
||||||
|
// ProcessTools and SecurityTools log a lot of messages so pretty format
|
||||||
|
// messages logged from this test
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("==> " + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2012, 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
|
|
||||||
# @bug 7133495 8041740 8062264 8046777
|
|
||||||
# @summary [macosx] KeyChain KeyStore implementation retrieves only one private key entry
|
|
||||||
|
|
||||||
if [ "${TESTJAVA}" = "" ] ; then
|
|
||||||
JAVAC_CMD=`which javac`
|
|
||||||
TESTJAVA=`dirname $JAVAC_CMD`/..
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${TESTSRC}" = "" ] ; then
|
|
||||||
TESTSRC="."
|
|
||||||
fi
|
|
||||||
if [ "${TESTCLASSES}" = "" ] ; then
|
|
||||||
TESTCLASSES=`pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Only run on MacOS
|
|
||||||
OS=`uname -s`
|
|
||||||
case "$OS" in
|
|
||||||
Darwin )
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
echo "Will not run test on: ${OS}"
|
|
||||||
exit 0;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
PWD="xxxxxx"
|
|
||||||
KEYTOOL="${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -storetype KeychainStore -keystore NONE -storepass $PWD"
|
|
||||||
TEMPORARY_P12="$TESTCLASSES/7133495.p12"
|
|
||||||
TEMPORARY_KC="$TESTCLASSES/7133495.keychain"
|
|
||||||
TEMPORARY_LIST="$TESTCLASSES/7133495.tmp"
|
|
||||||
CLEANUP_P12="rm -f $TEMPORARY_P12"
|
|
||||||
CLEANUP_KC="security delete-keychain $TEMPORARY_KC"
|
|
||||||
CLEANUP_LIST="rm -f $TEMPORARY_LIST"
|
|
||||||
|
|
||||||
# Count the number of private key entries in the Keychain keystores
|
|
||||||
|
|
||||||
COUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l`
|
|
||||||
echo "Found $COUNT private key entries in the Keychain keystores"
|
|
||||||
|
|
||||||
# Create a temporary PKCS12 keystore containing 3 public/private keypairs
|
|
||||||
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
|
|
||||||
for i in X Y Z
|
|
||||||
do
|
|
||||||
${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair \
|
|
||||||
-storetype PKCS12 \
|
|
||||||
-keystore $TEMPORARY_P12 \
|
|
||||||
-storepass $PWD \
|
|
||||||
-keyalg rsa \
|
|
||||||
-dname "CN=$i,OU=$i,O=$i,ST=$i,C=US" \
|
|
||||||
-alias 7133495-$i
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: cannot create keypair $i in the temporary PKCS12 keystore"
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "Created a temporary PKCS12 keystore: $TEMPORARY_P12"
|
|
||||||
|
|
||||||
# Create a temporary keychain
|
|
||||||
|
|
||||||
security create-keychain -p $PWD $TEMPORARY_KC
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: cannot create the temporary keychain"
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
echo "Created a temporary keychain: $TEMPORARY_KC"
|
|
||||||
|
|
||||||
# Unlock the temporary keychain
|
|
||||||
|
|
||||||
security unlock-keychain -p $PWD $TEMPORARY_KC
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: cannot unlock the temporary keychain"
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
RESULT=`$CLEANUP_KC`
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
echo "Unlocked the temporary keychain"
|
|
||||||
|
|
||||||
# Import the keypairs from the PKCS12 keystore into the keychain
|
|
||||||
# (The '-A' option is used to lower the temporary keychain's access controls)
|
|
||||||
|
|
||||||
security import $TEMPORARY_P12 -k $TEMPORARY_KC -f pkcs12 -P $PWD -A
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: cannot import keypairs from PKCS12 keystore into the keychain"
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
RESULT=`$CLEANUP_KC`
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
echo "Imported keypairs from PKCS12 keystore into the keychain"
|
|
||||||
|
|
||||||
# Generate a 2048-bit RSA keypair and import into the temporary keychain
|
|
||||||
# (its private key is configured with non-default key usage settings)
|
|
||||||
|
|
||||||
certtool c k=$TEMPORARY_KC <<EOF
|
|
||||||
test
|
|
||||||
r
|
|
||||||
2048
|
|
||||||
y
|
|
||||||
b
|
|
||||||
s
|
|
||||||
y
|
|
||||||
A
|
|
||||||
US
|
|
||||||
A
|
|
||||||
A
|
|
||||||
|
|
||||||
|
|
||||||
y
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Adjust the keychain search order
|
|
||||||
|
|
||||||
echo "\"$TEMPORARY_KC\"" > $TEMPORARY_LIST
|
|
||||||
security list-keychains >> $TEMPORARY_LIST
|
|
||||||
security list-keychains -s `xargs < ${TEMPORARY_LIST}`
|
|
||||||
`$CLEANUP_LIST`
|
|
||||||
echo "Temporary keychain search order:"
|
|
||||||
security list-keychains
|
|
||||||
|
|
||||||
# Recount the number of private key entries in the Keychain keystores
|
|
||||||
# (3 private keys imported from PKCS12, 1 private key generated by 'certtool')
|
|
||||||
|
|
||||||
RECOUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l`
|
|
||||||
echo "Found $RECOUNT private key entries in the Keychain keystore"
|
|
||||||
if [ $RECOUNT -lt `expr $COUNT + 4` ]; then
|
|
||||||
echo "Error: expected >$COUNT private key entries in the Keychain keystores"
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
RESULT=`$CLEANUP_KC`
|
|
||||||
exit 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Export a private key from the keychain (without supplying a password)
|
|
||||||
# Access controls have already been lowered (see 'security import ... -A' above)
|
|
||||||
|
|
||||||
${TESTJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/ExportPrivateKeyNoPwd.java || exit 6
|
|
||||||
${TESTJAVA}/bin/java ${TESTVMOPTS} ExportPrivateKeyNoPwd x
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error exporting private key from the temporary keychain"
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
RESULT=`$CLEANUP_KC`
|
|
||||||
exit 6
|
|
||||||
fi
|
|
||||||
echo "Exported a private key from the temporary keychain"
|
|
||||||
|
|
||||||
RESULT=`$CLEANUP_P12`
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: cannot remove the temporary PKCS12 keystore"
|
|
||||||
exit 7
|
|
||||||
fi
|
|
||||||
echo "Removed the temporary PKCS12 keystore"
|
|
||||||
|
|
||||||
RESULT=`$CLEANUP_KC`
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: cannot remove the temporary keychain"
|
|
||||||
exit 8
|
|
||||||
fi
|
|
||||||
echo "Removed the temporary keychain"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@@ -607,15 +607,15 @@ public final class OutputAnalyzer {
|
|||||||
/**
|
/**
|
||||||
* @see #shouldMatchByLine(String, String, String)
|
* @see #shouldMatchByLine(String, String, String)
|
||||||
*/
|
*/
|
||||||
public OutputAnalyzer shouldMatchByLineFrom(String from, String pattern) {
|
public OutputAnalyzer shouldMatchByLineFrom(String fromPattern, String pattern) {
|
||||||
return shouldMatchByLine(from, null, pattern);
|
return shouldMatchByLine(fromPattern, null, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #shouldMatchByLine(String, String, String)
|
* @see #shouldMatchByLine(String, String, String)
|
||||||
*/
|
*/
|
||||||
public OutputAnalyzer shouldMatchByLineTo(String to, String pattern) {
|
public OutputAnalyzer shouldMatchByLineTo(String toPattern, String pattern) {
|
||||||
return shouldMatchByLine(null, to, pattern);
|
return shouldMatchByLine(null, toPattern, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -623,17 +623,17 @@ public final class OutputAnalyzer {
|
|||||||
* {@code pattern} line by line. The whole output could be matched or
|
* {@code pattern} line by line. The whole output could be matched or
|
||||||
* just a subset of it.
|
* just a subset of it.
|
||||||
*
|
*
|
||||||
* @param from
|
* @param fromPattern
|
||||||
* The line (excluded) from where output will be matched.
|
* The pattern of line (excluded) from where output will be matched.
|
||||||
* Set {@code from} to null for matching from the first line.
|
* Set {@code fromPattern} to null for matching from the first line.
|
||||||
* @param to
|
* @param toPattern
|
||||||
* The line (excluded) until where output will be matched.
|
* The pattern of line (excluded) until where output will be matched.
|
||||||
* Set {@code to} to null for matching until the last line.
|
* Set {@code toPattern} to null for matching until the last line.
|
||||||
* @param pattern
|
* @param pattern
|
||||||
* Matching pattern
|
* Matching pattern
|
||||||
*/
|
*/
|
||||||
public OutputAnalyzer shouldMatchByLine(String from, String to, String pattern) {
|
public OutputAnalyzer shouldMatchByLine(String fromPattern, String toPattern, String pattern) {
|
||||||
return shouldMatchByLine(getOutput(), from, to, pattern);
|
return shouldMatchByLine(getOutput(), fromPattern, toPattern, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -641,34 +641,34 @@ public final class OutputAnalyzer {
|
|||||||
* {@code pattern} line by line. The whole stdout could be matched or
|
* {@code pattern} line by line. The whole stdout could be matched or
|
||||||
* just a subset of it.
|
* just a subset of it.
|
||||||
*
|
*
|
||||||
* @param from
|
* @param fromPattern
|
||||||
* The line (excluded) from where stdout will be matched.
|
* The pattern of line (excluded) from where stdout will be matched.
|
||||||
* Set {@code from} to null for matching from the first line.
|
* Set {@code fromPattern} to null for matching from the first line.
|
||||||
* @param to
|
* @param toPattern
|
||||||
* The line (excluded) until where stdout will be matched.
|
* The pattern of line (excluded) until where stdout will be matched.
|
||||||
* Set {@code to} to null for matching until the last line.
|
* Set {@code toPattern} to null for matching until the last line.
|
||||||
* @param pattern
|
* @param pattern
|
||||||
* Matching pattern
|
* Matching pattern
|
||||||
*/
|
*/
|
||||||
public OutputAnalyzer stdoutShouldMatchByLine(String from, String to, String pattern) {
|
public OutputAnalyzer stdoutShouldMatchByLine(String fromPattern, String toPattern, String pattern) {
|
||||||
return shouldMatchByLine(getStdout(), from, to, pattern);
|
return shouldMatchByLine(getStdout(), fromPattern, toPattern, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OutputAnalyzer shouldMatchByLine(String buffer, String from, String to, String pattern) {
|
private OutputAnalyzer shouldMatchByLine(String buffer, String fromPattern, String toPattern, String pattern) {
|
||||||
List<String> lines = asLines(buffer);
|
List<String> lines = asLines(buffer);
|
||||||
|
|
||||||
int fromIndex = 0;
|
int fromIndex = 0;
|
||||||
if (from != null) {
|
if (fromPattern != null) {
|
||||||
fromIndex = indexOf(lines, from, 0) + 1; // + 1 -> apply 'pattern' to lines after 'from' match
|
fromIndex = indexOf(lines, fromPattern, 0) + 1; // + 1 -> apply 'pattern' to lines after 'from' match
|
||||||
Asserts.assertGreaterThan(fromIndex, 0,
|
Asserts.assertGreaterThan(fromIndex, 0,
|
||||||
"The line/pattern '" + from + "' from where the output should match can not be found");
|
"The line matched with pattern '" + fromPattern + "' from where the output should match can not be found");
|
||||||
}
|
}
|
||||||
|
|
||||||
int toIndex = lines.size();
|
int toIndex = lines.size();
|
||||||
if (to != null) {
|
if (toPattern != null) {
|
||||||
toIndex = indexOf(lines, to, fromIndex);
|
toIndex = indexOf(lines, toPattern, fromIndex);
|
||||||
Asserts.assertGreaterThan(toIndex, fromIndex,
|
Asserts.assertGreaterThan(toIndex, fromIndex,
|
||||||
"The line/pattern '" + to + "' until where the output should match can not be found");
|
"The line matched with pattern '" + toPattern + "' until where the output should match can not be found");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> subList = lines.subList(fromIndex, toIndex);
|
List<String> subList = lines.subList(fromIndex, toIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user