Merge
This commit is contained in:
commit
403562720b
@ -50,6 +50,7 @@ FILES_export = \
|
||||
java/lang/SecurityManager.java \
|
||||
java/lang/Shutdown.java \
|
||||
java/lang/Package.java \
|
||||
java/lang/UNIXProcess.java \
|
||||
java/lang/ref/Finalizer.java \
|
||||
java/lang/reflect/AccessibleObject.java \
|
||||
java/lang/reflect/Field.java \
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -87,6 +87,7 @@ FILES_java += java/lang/UNIXProcess.java \
|
||||
java/util/prefs/FileSystemPreferencesFactory.java \
|
||||
|
||||
FILES_c += UNIXProcess_md.c \
|
||||
childproc.c \
|
||||
UnixFileSystem_md.c \
|
||||
canonicalize_md.c \
|
||||
TimeZone.c \
|
||||
@ -468,3 +469,36 @@ $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
|
||||
clean::
|
||||
$(RM) $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java
|
||||
|
||||
|
||||
HELPER_EXE = $(LIBDIR)/$(LIBARCH)/jspawnhelper
|
||||
BUILDHELPER =
|
||||
ifeq ($(PLATFORM), solaris)
|
||||
BUILDHELPER = 1
|
||||
endif
|
||||
ifeq ($(PLATFORM), macosx)
|
||||
HELPER_EXE = $(LIBDIR)/jspawnhelper
|
||||
BUILDHELPER = 1
|
||||
endif
|
||||
|
||||
ARCHFLAG =
|
||||
ifeq ($(ARCH_DATA_MODEL), 64)
|
||||
ARCHFLAG = -m64
|
||||
endif
|
||||
|
||||
ifdef BUILDHELPER
|
||||
|
||||
HELPER_EXE_FILES_c = jspawnhelper.c
|
||||
HELPER_EXE_FILES_o = $(OBJDIR)/jspawnhelper.o \
|
||||
$(OBJDIR)/childproc.o
|
||||
|
||||
$(HELPER_EXE): $(HELPER_EXE_FILES_o)
|
||||
$(CC) $(ARCHFLAG) $(HELPER_EXE_FILES_o) \
|
||||
-o $(TEMPDIR)/jspawnhelper
|
||||
$(CP) $(TEMPDIR)/jspawnhelper $(HELPER_EXE)
|
||||
|
||||
build: $(HELPER_EXE)
|
||||
|
||||
clean clobber::
|
||||
$(RM) $(HELPER_EXE_FILES_o) $(HELPER_EXE)
|
||||
|
||||
endif #BUILDHELPER
|
||||
|
@ -100,7 +100,7 @@ SUNWprivate_1.1 {
|
||||
Java_java_io_RandomAccessFile_open;
|
||||
Java_java_io_RandomAccessFile_read;
|
||||
Java_java_io_RandomAccessFile_readBytes;
|
||||
Java_java_io_RandomAccessFile_seek;
|
||||
Java_java_io_RandomAccessFile_seek0;
|
||||
Java_java_io_RandomAccessFile_setLength;
|
||||
Java_java_io_RandomAccessFile_write;
|
||||
Java_java_io_RandomAccessFile_writeBytes;
|
||||
|
@ -21,4 +21,4 @@
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
tzdata2013c
|
||||
tzdata2013d
|
||||
|
@ -875,12 +875,18 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
|
||||
# announced that year's Ramadan daylight-saving transitions would be
|
||||
# 2012-07-20 and 2012-08-20; see
|
||||
# <http://www.mmsp.gov.ma/fr/actualites.aspx?id=288>.
|
||||
#
|
||||
|
||||
# From Andrew Paprocki (2013-07-02):
|
||||
# Morocco announced that the year's Ramadan daylight-savings
|
||||
# transitions would be 2013-07-07 and 2013-08-10; see:
|
||||
# http://www.maroc.ma/en/news/morocco-suspends-daylight-saving-time-july-7-aug10
|
||||
|
||||
# From Paul Eggert (2013-07-03):
|
||||
# To estimate what the Moroccan government will do in future years,
|
||||
# transition dates for 2013 through 2021 were determined by running
|
||||
# transition dates for 2014 through 2021 were determined by running
|
||||
# the following program under GNU Emacs 24.3:
|
||||
#
|
||||
# (let ((islamic-year 1434))
|
||||
# (let ((islamic-year 1435))
|
||||
# (while (< islamic-year 1444)
|
||||
# (let ((a
|
||||
# (calendar-gregorian-from-absolute
|
||||
@ -933,8 +939,8 @@ Rule Morocco 2012 2019 - Apr lastSun 2:00 1:00 S
|
||||
Rule Morocco 2012 max - Sep lastSun 3:00 0 -
|
||||
Rule Morocco 2012 only - Jul 20 3:00 0 -
|
||||
Rule Morocco 2012 only - Aug 20 2:00 1:00 S
|
||||
Rule Morocco 2013 only - Jul 9 3:00 0 -
|
||||
Rule Morocco 2013 only - Aug 8 2:00 1:00 S
|
||||
Rule Morocco 2013 only - Jul 7 3:00 0 -
|
||||
Rule Morocco 2013 only - Aug 10 2:00 1:00 S
|
||||
Rule Morocco 2014 only - Jun 29 3:00 0 -
|
||||
Rule Morocco 2014 only - Jul 29 2:00 1:00 S
|
||||
Rule Morocco 2015 only - Jun 18 3:00 0 -
|
||||
|
@ -1235,39 +1235,21 @@ Rule Zion 2011 only - Oct 2 2:00 0 S
|
||||
Rule Zion 2012 only - Mar Fri>=26 2:00 1:00 D
|
||||
Rule Zion 2012 only - Sep 23 2:00 0 S
|
||||
|
||||
# From Ephraim Silverberg (2012-10-18):
|
||||
# Yesterday, the Interior Ministry Committee, after more than a year
|
||||
# past, approved sending the proposed June 2011 changes to the Time
|
||||
# Decree Law back to the Knesset for second and third (final) votes
|
||||
# before the upcoming elections on Jan. 22, 2013. Hence, although the
|
||||
# changes are not yet law, they are expected to be so before February 2013.
|
||||
# From Ephraim Silverberg (2013-06-27):
|
||||
# On June 23, 2013, the Israeli government approved changes to the
|
||||
# Time Decree Law. The next day, the changes passed the First Reading
|
||||
# in the Knesset. The law is expected to pass the Second and Third
|
||||
# (final) Readings by the beginning of September 2013.
|
||||
#
|
||||
# As of 2013, DST starts at 02:00 on the Friday before the last Sunday in March.
|
||||
# DST ends at 02:00 on the first Sunday after October 1, unless it occurs on the
|
||||
# second day of the Jewish Rosh Hashana holiday, in which case DST ends a day
|
||||
# later (i.e. at 02:00 the first Monday after October 2).
|
||||
# [Rosh Hashana holidays are factored in until 2100.]
|
||||
|
||||
# From Ephraim Silverberg (2012-11-05):
|
||||
# The Knesset passed today (in second and final readings) the amendment to the
|
||||
# Time Decree Law making the changes ... law.
|
||||
# As of 2013, DST starts at 02:00 on the Friday before the last Sunday
|
||||
# in March. DST ends at 02:00 on the last Sunday of October.
|
||||
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule Zion 2013 max - Mar Fri>=23 2:00 1:00 D
|
||||
Rule Zion 2013 2026 - Oct Sun>=2 2:00 0 S
|
||||
Rule Zion 2027 only - Oct Mon>=3 2:00 0 S
|
||||
Rule Zion 2028 max - Oct Sun>=2 2:00 0 S
|
||||
# The following rules are commented out for now, as they break older
|
||||
# versions of zic that support only signed 32-bit timestamps, i.e.,
|
||||
# through 2038-01-19 03:14:07 UTC.
|
||||
#Rule Zion 2028 2053 - Oct Sun>=2 2:00 0 S
|
||||
#Rule Zion 2054 only - Oct Mon>=3 2:00 0 S
|
||||
#Rule Zion 2055 2080 - Oct Sun>=2 2:00 0 S
|
||||
#Rule Zion 2081 only - Oct Mon>=3 2:00 0 S
|
||||
#Rule Zion 2082 max - Oct Sun>=2 2:00 0 S
|
||||
Rule Zion 2013 max - Oct lastSun 2:00 0 S
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Asia/Jerusalem 2:20:56 - LMT 1880
|
||||
Zone Asia/Jerusalem 2:20:54 - LMT 1880
|
||||
2:20:40 - JMT 1918 # Jerusalem Mean Time?
|
||||
2:00 Zion I%sT
|
||||
|
||||
@ -2570,8 +2552,8 @@ Rule Syria 2006 only - Sep 22 0:00 0 -
|
||||
Rule Syria 2007 only - Mar lastFri 0:00 1:00 S
|
||||
# From Jesper Norgard (2007-10-27):
|
||||
# The sister center ICARDA of my work CIMMYT is confirming that Syria DST will
|
||||
# not take place 1.st November at 0:00 o'clock but 1.st November at 24:00 or
|
||||
# rather Midnight between Thursday and Friday. This does make more sence than
|
||||
# not take place 1st November at 0:00 o'clock but 1st November at 24:00 or
|
||||
# rather Midnight between Thursday and Friday. This does make more sense than
|
||||
# having it between Wednesday and Thursday (two workdays in Syria) since the
|
||||
# weekend in Syria is not Saturday and Sunday, but Friday and Saturday. So now
|
||||
# it is implemented at midnight of the last workday before weekend...
|
||||
|
@ -253,10 +253,16 @@ Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb
|
||||
# - Macquarie Island will stay on UTC+11 for winter and therefore not
|
||||
# switch back from daylight savings time when other parts of Australia do
|
||||
# on 4 April.
|
||||
#
|
||||
# From Arthur David Olson (2013-05-23):
|
||||
# The 1919 transition is overspecified below so pre-2013 zics
|
||||
# will produce a binary file with an EST-type as the first 32-bit type;
|
||||
# this is required for correct handling of times before 1916 by
|
||||
# pre-2013 versions of localtime.
|
||||
Zone Antarctica/Macquarie 0 - zzz 1899 Nov
|
||||
10:00 - EST 1916 Oct 1 2:00
|
||||
10:00 1:00 EST 1917 Feb
|
||||
10:00 Aus EST 1919 Apr
|
||||
10:00 Aus EST 1919 Apr 1 0:00s
|
||||
0 - zzz 1948 Mar 25
|
||||
10:00 Aus EST 1967
|
||||
10:00 AT EST 2010 Apr 4 3:00
|
||||
@ -1498,12 +1504,12 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
|
||||
# From Paul Eggert (2000-01-08):
|
||||
# IATA SSIM (1999-09) says DST ends 0100 local time. Go with McDow.
|
||||
|
||||
# From the BBC World Service (1998-10-31 11:32 UTC):
|
||||
# From the BBC World Service in
|
||||
# http://news.bbc.co.uk/2/hi/asia-pacific/205226.stm (1998-10-31 16:03 UTC):
|
||||
# The Fijiian government says the main reasons for the time change is to
|
||||
# improve productivity and reduce road accidents. But correspondents say it
|
||||
# also hopes the move will boost Fiji's ability to compete with other pacific
|
||||
# islands in the effort to attract tourists to witness the dawning of the new
|
||||
# millenium.
|
||||
# improve productivity and reduce road accidents.... [T]he move is also
|
||||
# intended to boost Fiji's ability to attract tourists to witness the dawning
|
||||
# of the new millennium.
|
||||
|
||||
# http://www.fiji.gov.fj/press/2000_09/2000_09_13-05.shtml (2000-09-13)
|
||||
# reports that Fiji has discontinued DST.
|
||||
@ -1648,7 +1654,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
|
||||
# Shanks & Pottenger say the transition was on 1968-10-01; go with Mundell.
|
||||
|
||||
# From Eric Ulevik (1999-05-03):
|
||||
# Tonga's director of tourism, who is also secretary of the National Millenium
|
||||
# Tonga's director of tourism, who is also secretary of the National Millennium
|
||||
# Committee, has a plan to get Tonga back in front.
|
||||
# He has proposed a one-off move to tropical daylight saving for Tonga from
|
||||
# October to March, which has won approval in principle from the Tongan
|
||||
|
@ -546,7 +546,7 @@ Rule C-Eur 1944 only - Oct 2 2:00s 0 -
|
||||
# It seems that Paris, Monaco, Rule France, Rule Belgium all agree on
|
||||
# 2:00 standard time, e.g. 3:00 local time. However there are no
|
||||
# countries that use C-Eur rules in September 1945, so the only items
|
||||
# affected are apparently these ficticious zones that translates acronyms
|
||||
# affected are apparently these fictitious zones that translate acronyms
|
||||
# CET and MET:
|
||||
#
|
||||
# Zone CET 1:00 C-Eur CE%sT
|
||||
@ -2802,9 +2802,9 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
|
||||
|
||||
# Ukraine
|
||||
#
|
||||
# From Igor Karpov, who works for the Ukranian Ministry of Justice,
|
||||
# From Igor Karpov, who works for the Ukrainian Ministry of Justice,
|
||||
# via Garrett Wollman (2003-01-27):
|
||||
# BTW, I've found the official document on this matter. It's goverment
|
||||
# BTW, I've found the official document on this matter. It's government
|
||||
# regulations number 509, May 13, 1996. In my poor translation it says:
|
||||
# "Time in Ukraine is set to second timezone (Kiev time). Each last Sunday
|
||||
# of March at 3am the time is changing to 4am and each last Sunday of
|
||||
@ -2838,7 +2838,7 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
|
||||
# time this year after all.
|
||||
#
|
||||
# From Udo Schwedt (2011-10-18):
|
||||
# As far as I understand, the recent change to the Ukranian time zone
|
||||
# As far as I understand, the recent change to the Ukrainian time zone
|
||||
# (Europe/Kiev) to introduce permanent daylight saving time (similar
|
||||
# to Russia) was reverted today:
|
||||
#
|
||||
|
@ -21,19 +21,17 @@
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
# <pre>
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
# ISO 3166 alpha-2 country codes
|
||||
#
|
||||
# From Paul Eggert (2006-09-27):
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
#
|
||||
# From Paul Eggert (2013-05-27):
|
||||
#
|
||||
# This file contains a table with the following columns:
|
||||
# 1. ISO 3166-1 alpha-2 country code, current as of
|
||||
# ISO 3166-1 Newsletter VI-1 (2007-09-21). See:
|
||||
# <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/index.html">
|
||||
# ISO 3166 Maintenance agency (ISO 3166/MA)
|
||||
# </a>.
|
||||
# ISO 3166-1 Newsletter VI-15 (2013-05-10). See: Updates on ISO 3166
|
||||
# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
|
||||
# 2. The usual English name for the country,
|
||||
# chosen so that alphabetic sorting of subsets produces helpful lists.
|
||||
# This is not the same as the English name in the ISO 3166 tables.
|
||||
@ -43,8 +41,9 @@
|
||||
#
|
||||
# Lines beginning with `#' are comments.
|
||||
#
|
||||
# From Arthur David Olson (2011-08-17):
|
||||
# Resynchronized today with the ISO 3166 site (adding SS for South Sudan).
|
||||
# This table is intended as an aid for users, to help them select time
|
||||
# zone data appropriate for their practical needs. It is not intended
|
||||
# to take or endorse any position on legal or territorial claims.
|
||||
#
|
||||
#country-
|
||||
#code country name
|
||||
@ -77,7 +76,7 @@ BL St Barthelemy
|
||||
BM Bermuda
|
||||
BN Brunei
|
||||
BO Bolivia
|
||||
BQ Bonaire Sint Eustatius & Saba
|
||||
BQ Bonaire, St Eustatius & Saba
|
||||
BR Brazil
|
||||
BS Bahamas
|
||||
BT Bhutan
|
||||
@ -258,7 +257,7 @@ SR Suriname
|
||||
SS South Sudan
|
||||
ST Sao Tome & Principe
|
||||
SV El Salvador
|
||||
SX Sint Maarten
|
||||
SX St Maarten (Dutch part)
|
||||
SY Syria
|
||||
SZ Swaziland
|
||||
TC Turks & Caicos Is
|
||||
|
@ -994,7 +994,7 @@ Rule Brazil 2007 only - Feb 25 0:00 0 -
|
||||
# adopted by the same states as before.
|
||||
Rule Brazil 2007 only - Oct Sun>=8 0:00 1:00 S
|
||||
# From Frederico A. C. Neves (2008-09-10):
|
||||
# Acording to this decree
|
||||
# According to this decree
|
||||
# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm">
|
||||
# http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm
|
||||
# </a>
|
||||
@ -1226,7 +1226,7 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
|
||||
# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651
|
||||
# </a>
|
||||
#
|
||||
# This is not yet reflected in the offical "cambio de hora" site, but
|
||||
# This is not yet reflected in the official "cambio de hora" site, but
|
||||
# probably will be soon:
|
||||
# <a href="http://www.horaoficial.cl/cambio.htm">
|
||||
# http://www.horaoficial.cl/cambio.htm
|
||||
|
@ -21,21 +21,24 @@
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
# <pre>
|
||||
# TZ zone descriptions
|
||||
#
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
#
|
||||
# TZ zone descriptions
|
||||
#
|
||||
# From Paul Eggert (1996-08-05):
|
||||
# From Paul Eggert (2013-05-27):
|
||||
#
|
||||
# This file contains a table with the following columns:
|
||||
# 1. ISO 3166 2-character country code. See the file `iso3166.tab'.
|
||||
# This identifies a country that overlaps the zone. The country may
|
||||
# overlap other zones and the zone may overlap other countries.
|
||||
# 2. Latitude and longitude of the zone's principal location
|
||||
# in ISO 6709 sign-degrees-minutes-seconds format,
|
||||
# either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
|
||||
# first latitude (+ is north), then longitude (+ is east).
|
||||
# This location need not lie within the column-1 country.
|
||||
# 3. Zone name used in value of TZ environment variable.
|
||||
# Please see the 'Theory' file for how zone names are chosen.
|
||||
# 4. Comments; present if and only if the country has multiple rows.
|
||||
#
|
||||
# Columns are separated by a single tab.
|
||||
@ -45,6 +48,10 @@
|
||||
#
|
||||
# Lines beginning with `#' are comments.
|
||||
#
|
||||
# This table is intended as an aid for users, to help them select time
|
||||
# zone data appropriate for their practical needs. It is not intended
|
||||
# to take or endorse any position on legal or territorial claims.
|
||||
#
|
||||
#country-
|
||||
#code coordinates TZ comments
|
||||
AD +4230+00131 Europe/Andorra
|
||||
@ -239,7 +246,7 @@ ID -0002+10920 Asia/Pontianak west & central Borneo
|
||||
ID -0507+11924 Asia/Makassar east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
|
||||
ID -0232+14042 Asia/Jayapura west New Guinea (Irian Jaya) & Malukus (Moluccas)
|
||||
IE +5320-00615 Europe/Dublin
|
||||
IL +3146+03514 Asia/Jerusalem
|
||||
IL +314650+0351326 Asia/Jerusalem
|
||||
IM +5409-00428 Europe/Isle_of_Man
|
||||
IN +2232+08822 Asia/Kolkata
|
||||
IO -0720+07225 Indian/Chagos
|
||||
|
@ -94,4 +94,5 @@ $(JARFILE): $(LIBDIR) $(FILES_class) $(FILES_png) $(FILES_gif) $(FILES_prop) $(T
|
||||
|
||||
clean clobber::
|
||||
$(RM) $(TEMPDIR)/manifest $(JARFILE)
|
||||
$(RM) $(GENSRCDIR)/sun/tools/jconsole/Version.java
|
||||
|
||||
|
100
jdk/make/tools/CharsetMapping/IBM290.c2b
Normal file
100
jdk/make/tools/CharsetMapping/IBM290.c2b
Normal file
@ -0,0 +1,100 @@
|
||||
#
|
||||
# Diff of
|
||||
# b2c: cdctables.zip/Package2.zip/IBM-290.zip/012234B0.TPMAP100
|
||||
# c2b: cdctables.zip/Package2.zip/IBM-290.zip/012234B0.UPMAP100
|
||||
#
|
||||
# fullwidth form
|
||||
0x4B U+FF0E
|
||||
0x4C U+FF1C
|
||||
0x4D U+FF08
|
||||
0x4E U+FF0B
|
||||
0x4F U+FF5C
|
||||
0x50 U+FF06
|
||||
0x5A U+FF01
|
||||
0x5C U+FF0A
|
||||
0x5D U+FF09
|
||||
0x5E U+FF1B
|
||||
0x60 U+FF0D
|
||||
0x61 U+FF0F
|
||||
0x62 U+FF41
|
||||
0x63 U+FF42
|
||||
0x64 U+FF43
|
||||
0x65 U+FF44
|
||||
0x66 U+FF45
|
||||
0x67 U+FF46
|
||||
0x68 U+FF47
|
||||
0x69 U+FF48
|
||||
0x6B U+FF0C
|
||||
0x6C U+FF05
|
||||
0x6D U+FF3F
|
||||
0x6E U+FF1E
|
||||
0x6F U+FF1F
|
||||
0x70 U+FF3B
|
||||
0x71 U+FF49
|
||||
0x72 U+FF4A
|
||||
0x73 U+FF4B
|
||||
0x74 U+FF4C
|
||||
0x75 U+FF4D
|
||||
0x76 U+FF4E
|
||||
0x77 U+FF4F
|
||||
0x78 U+FF50
|
||||
0x79 U+FF40
|
||||
0x7A U+FF1A
|
||||
0x7B U+FF03
|
||||
0x7C U+FF20
|
||||
0x7D U+FF07
|
||||
0x7E U+FF1D
|
||||
0x7F U+FF02
|
||||
0x80 U+FF3D
|
||||
0x8B U+FF51
|
||||
0x9B U+FF52
|
||||
0xA0 U+FF5E
|
||||
0xAB U+FF53
|
||||
0xB0 U+FF3E
|
||||
0xB2 U+FF3C
|
||||
0xB3 U+FF54
|
||||
0xB4 U+FF55
|
||||
0xB5 U+FF56
|
||||
0xB6 U+FF57
|
||||
0xB7 U+FF58
|
||||
0xB8 U+FF59
|
||||
0xB9 U+FF5A
|
||||
0xC0 U+FF5B
|
||||
0xC1 U+FF21
|
||||
0xC2 U+FF22
|
||||
0xC3 U+FF23
|
||||
0xC4 U+FF24
|
||||
0xC5 U+FF25
|
||||
0xC6 U+FF26
|
||||
0xC7 U+FF27
|
||||
0xC8 U+FF28
|
||||
0xC9 U+FF29
|
||||
0xD0 U+FF5D
|
||||
0xD1 U+FF2A
|
||||
0xD2 U+FF2B
|
||||
0xD3 U+FF2C
|
||||
0xD4 U+FF2D
|
||||
0xD5 U+FF2E
|
||||
0xD6 U+FF2F
|
||||
0xD7 U+FF30
|
||||
0xD8 U+FF31
|
||||
0xD9 U+FF32
|
||||
0xE0 U+FF04
|
||||
0xE2 U+FF33
|
||||
0xE3 U+FF34
|
||||
0xE4 U+FF35
|
||||
0xE5 U+FF36
|
||||
0xE6 U+FF37
|
||||
0xE7 U+FF38
|
||||
0xE8 U+FF39
|
||||
0xE9 U+FF3A
|
||||
0xF0 U+FF10
|
||||
0xF1 U+FF11
|
||||
0xF2 U+FF12
|
||||
0xF3 U+FF13
|
||||
0xF4 U+FF14
|
||||
0xF5 U+FF15
|
||||
0xF6 U+FF16
|
||||
0xF7 U+FF17
|
||||
0xF8 U+FF18
|
||||
0xF9 U+FF19
|
232
jdk/make/tools/CharsetMapping/IBM290.map
Normal file
232
jdk/make/tools/CharsetMapping/IBM290.map
Normal file
@ -0,0 +1,232 @@
|
||||
#
|
||||
# b2c mapping for IBM290, generated from
|
||||
# cdctables.zip/Package2.zip/IBM-290.zip/012234B0.TPMAP100
|
||||
#
|
||||
0x00 U+0000
|
||||
0x01 U+0001
|
||||
0x02 U+0002
|
||||
0x03 U+0003
|
||||
0x04 U+009C
|
||||
0x05 U+0009
|
||||
0x06 U+0086
|
||||
0x07 U+007F
|
||||
0x08 U+0097
|
||||
0x09 U+008D
|
||||
0x0A U+008E
|
||||
0x0B U+000B
|
||||
0x0C U+000C
|
||||
0x0D U+000D
|
||||
0x0E U+000E
|
||||
0x0F U+000F
|
||||
0x10 U+0010
|
||||
0x11 U+0011
|
||||
0x12 U+0012
|
||||
0x13 U+0013
|
||||
0x14 U+009D
|
||||
0x15 U+0085
|
||||
0x16 U+0008
|
||||
0x17 U+0087
|
||||
0x18 U+0018
|
||||
0x19 U+0019
|
||||
0x1A U+0092
|
||||
0x1B U+008F
|
||||
0x1C U+001C
|
||||
0x1D U+001D
|
||||
0x1E U+001E
|
||||
0x1F U+001F
|
||||
0x20 U+0080
|
||||
0x21 U+0081
|
||||
0x22 U+0082
|
||||
0x23 U+0083
|
||||
0x24 U+0084
|
||||
0x25 U+000A
|
||||
0x26 U+0017
|
||||
0x27 U+001B
|
||||
0x28 U+0088
|
||||
0x29 U+0089
|
||||
0x2A U+008A
|
||||
0x2B U+008B
|
||||
0x2C U+008C
|
||||
0x2D U+0005
|
||||
0x2E U+0006
|
||||
0x2F U+0007
|
||||
0x30 U+0090
|
||||
0x31 U+0091
|
||||
0x32 U+0016
|
||||
0x33 U+0093
|
||||
0x34 U+0094
|
||||
0x35 U+0095
|
||||
0x36 U+0096
|
||||
0x37 U+0004
|
||||
0x38 U+0098
|
||||
0x39 U+0099
|
||||
0x3A U+009A
|
||||
0x3B U+009B
|
||||
0x3C U+0014
|
||||
0x3D U+0015
|
||||
0x3E U+009E
|
||||
0x3F U+001A
|
||||
0x40 U+0020
|
||||
0x41 U+FF61
|
||||
0x42 U+FF62
|
||||
0x43 U+FF63
|
||||
0x44 U+FF64
|
||||
0x45 U+FF65
|
||||
0x46 U+FF66
|
||||
0x47 U+FF67
|
||||
0x48 U+FF68
|
||||
0x49 U+FF69
|
||||
0x4A U+00A3
|
||||
0x4B U+002E
|
||||
0x4C U+003C
|
||||
0x4D U+0028
|
||||
0x4E U+002B
|
||||
0x4F U+007C
|
||||
0x50 U+0026
|
||||
0x51 U+FF6A
|
||||
0x52 U+FF6B
|
||||
0x53 U+FF6C
|
||||
0x54 U+FF6D
|
||||
0x55 U+FF6E
|
||||
0x56 U+FF6F
|
||||
0x58 U+FF70
|
||||
0x5A U+0021
|
||||
0x5B U+00A5
|
||||
0x5C U+002A
|
||||
0x5D U+0029
|
||||
0x5E U+003B
|
||||
0x5F U+00AC
|
||||
0x60 U+002D
|
||||
0x61 U+002F
|
||||
0x62 U+0061
|
||||
0x63 U+0062
|
||||
0x64 U+0063
|
||||
0x65 U+0064
|
||||
0x66 U+0065
|
||||
0x67 U+0066
|
||||
0x68 U+0067
|
||||
0x69 U+0068
|
||||
0x6B U+002C
|
||||
0x6C U+0025
|
||||
0x6D U+005F
|
||||
0x6E U+003E
|
||||
0x6F U+003F
|
||||
0x70 U+005B
|
||||
0x71 U+0069
|
||||
0x72 U+006A
|
||||
0x73 U+006B
|
||||
0x74 U+006C
|
||||
0x75 U+006D
|
||||
0x76 U+006E
|
||||
0x77 U+006F
|
||||
0x78 U+0070
|
||||
0x79 U+0060
|
||||
0x7A U+003A
|
||||
0x7B U+0023
|
||||
0x7C U+0040
|
||||
0x7D U+0027
|
||||
0x7E U+003D
|
||||
0x7F U+0022
|
||||
0x80 U+005D
|
||||
0x81 U+FF71
|
||||
0x82 U+FF72
|
||||
0x83 U+FF73
|
||||
0x84 U+FF74
|
||||
0x85 U+FF75
|
||||
0x86 U+FF76
|
||||
0x87 U+FF77
|
||||
0x88 U+FF78
|
||||
0x89 U+FF79
|
||||
0x8A U+FF7A
|
||||
0x8B U+0071
|
||||
0x8C U+FF7B
|
||||
0x8D U+FF7C
|
||||
0x8E U+FF7D
|
||||
0x8F U+FF7E
|
||||
0x90 U+FF7F
|
||||
0x91 U+FF80
|
||||
0x92 U+FF81
|
||||
0x93 U+FF82
|
||||
0x94 U+FF83
|
||||
0x95 U+FF84
|
||||
0x96 U+FF85
|
||||
0x97 U+FF86
|
||||
0x98 U+FF87
|
||||
0x99 U+FF88
|
||||
0x9A U+FF89
|
||||
0x9B U+0072
|
||||
0x9D U+FF8A
|
||||
0x9E U+FF8B
|
||||
0x9F U+FF8C
|
||||
0xA0 U+007E
|
||||
0xA1 U+203E
|
||||
0xA2 U+FF8D
|
||||
0xA3 U+FF8E
|
||||
0xA4 U+FF8F
|
||||
0xA5 U+FF90
|
||||
0xA6 U+FF91
|
||||
0xA7 U+FF92
|
||||
0xA8 U+FF93
|
||||
0xA9 U+FF94
|
||||
0xAA U+FF95
|
||||
0xAB U+0073
|
||||
0xAC U+FF96
|
||||
0xAD U+FF97
|
||||
0xAE U+FF98
|
||||
0xAF U+FF99
|
||||
0xB0 U+005E
|
||||
0xB1 U+00A2
|
||||
0xB2 U+005C
|
||||
0xB3 U+0074
|
||||
0xB4 U+0075
|
||||
0xB5 U+0076
|
||||
0xB6 U+0077
|
||||
0xB7 U+0078
|
||||
0xB8 U+0079
|
||||
0xB9 U+007A
|
||||
0xBA U+FF9A
|
||||
0xBB U+FF9B
|
||||
0xBC U+FF9C
|
||||
0xBD U+FF9D
|
||||
0xBE U+FF9E
|
||||
0xBF U+FF9F
|
||||
0xC0 U+007B
|
||||
0xC1 U+0041
|
||||
0xC2 U+0042
|
||||
0xC3 U+0043
|
||||
0xC4 U+0044
|
||||
0xC5 U+0045
|
||||
0xC6 U+0046
|
||||
0xC7 U+0047
|
||||
0xC8 U+0048
|
||||
0xC9 U+0049
|
||||
0xD0 U+007D
|
||||
0xD1 U+004A
|
||||
0xD2 U+004B
|
||||
0xD3 U+004C
|
||||
0xD4 U+004D
|
||||
0xD5 U+004E
|
||||
0xD6 U+004F
|
||||
0xD7 U+0050
|
||||
0xD8 U+0051
|
||||
0xD9 U+0052
|
||||
0xE0 U+0024
|
||||
0xE2 U+0053
|
||||
0xE3 U+0054
|
||||
0xE4 U+0055
|
||||
0xE5 U+0056
|
||||
0xE6 U+0057
|
||||
0xE7 U+0058
|
||||
0xE8 U+0059
|
||||
0xE9 U+005A
|
||||
0xF0 U+0030
|
||||
0xF1 U+0031
|
||||
0xF2 U+0032
|
||||
0xF3 U+0033
|
||||
0xF4 U+0034
|
||||
0xF5 U+0035
|
||||
0xF6 U+0036
|
||||
0xF7 U+0037
|
||||
0xF8 U+0038
|
||||
0xF9 U+0039
|
||||
0xFF U+009F
|
50
jdk/make/tools/CharsetMapping/IBM300.c2b
Normal file
50
jdk/make/tools/CharsetMapping/IBM300.c2b
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# Diff of
|
||||
# b2c: cdctables.zip/Package2.zip/IBM-300.zip/012C34B0.TPMAP120
|
||||
# c2b: cdctables.zip/Package2.zip/IBM-300.zip/012C34B0.UPMAP120
|
||||
#
|
||||
4260 2212
|
||||
426A 00A6
|
||||
43A1 301C
|
||||
444A 2014
|
||||
446E F86F
|
||||
447C 2016
|
||||
4C7D 9E7C
|
||||
4EB3 9830
|
||||
4F5E 5861
|
||||
507F 91AC
|
||||
5190 56CA
|
||||
51F1 6805
|
||||
51FA 91B1
|
||||
5261 9EB4
|
||||
52A1 881F
|
||||
52C9 840A
|
||||
52DA 7E61
|
||||
52EC 4FE0
|
||||
5353 8EC0
|
||||
5373 7E6B
|
||||
53B3 8346
|
||||
53DA 9A52
|
||||
53E8 87EC
|
||||
53EE 7130
|
||||
53F8 8523
|
||||
5443 5C5B
|
||||
5464 9DD7
|
||||
547D 5699
|
||||
5481 525D
|
||||
54A3 6414
|
||||
54A4 7626
|
||||
54CA 7C1E
|
||||
54CD 6451
|
||||
54D4 555E
|
||||
54FA 6F51
|
||||
5550 7006
|
||||
5553 79B1
|
||||
555F 9EB5
|
||||
55C0 5C62
|
||||
55C1 985A
|
||||
5B72 6522
|
||||
5BFE 688E
|
||||
60F1 7E48
|
||||
61B0 8141
|
||||
66C8 9839
|
11644
jdk/make/tools/CharsetMapping/IBM300.map
Normal file
11644
jdk/make/tools/CharsetMapping/IBM300.map
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@ PCK x-PCK PCK basic sun.nio.cs.ext true 0x81 0xfc 0x40
|
||||
IBM1364 x-IBM1364 Cp1364 ebcdic sun.nio.cs.ext false 0x40 0xde 0x40 0xfe
|
||||
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
|
||||
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
IBM300 x-IBM300 Cp300 dbcsonly sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM933 x-IBM933 Cp933 ebcdic sun.nio.cs.ext false 0x40 0xdd 0x40 0xfe
|
||||
IBM935 x-IBM935 Cp935 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
|
@ -28,6 +28,7 @@ IBM278 IBM278 Cp278 false sun.nio.cs.ext
|
||||
IBM280 IBM280 Cp280 false sun.nio.cs.ext
|
||||
IBM284 IBM284 Cp284 false sun.nio.cs.ext
|
||||
IBM285 IBM285 Cp285 false sun.nio.cs.ext
|
||||
IBM290 IBM290 Cp290 false sun.nio.cs.ext
|
||||
IBM297 IBM297 Cp297 false sun.nio.cs.ext
|
||||
IBM420 IBM420 Cp420 false sun.nio.cs.ext
|
||||
IBM424 IBM424 Cp424 false sun.nio.cs.ext
|
||||
|
@ -2,19 +2,19 @@ This directory contains tools and tests associated with creating the
|
||||
class list for class data sharing.
|
||||
|
||||
The class list is produced by running the refWorkload startup3 benchmark with
|
||||
the -verbose:class option. The -Xshare:off option must also be used so that
|
||||
bootclasspath classes are loaded from rt.jar. The MakeClasslist program
|
||||
should be built into the jar file makeclasslist.jar and is run
|
||||
the -XX:+TraceClassLoadingPreorder option. The -Xshare:off option must also be
|
||||
used so that bootclasspath classes are loaded from rt.jar. The MakeClasslist
|
||||
program should be built into the jar file makeclasslist.jar and is run
|
||||
on one of the logs from each of the benchmarks in the following fashion:
|
||||
|
||||
cd .../results.startup3
|
||||
$JAVA_HOME/bin/java -jar makeclasslist.jar results.Noop/results_1/log results.Framer/results_1/log results.XFramer/results_1/log results.JEdit/results_1/log results.LimeWire/results_1/log results.NetBeans/results_1/log
|
||||
cd .../<resultsdir>/results.startup3
|
||||
$JAVA_HOME/bin/java -jar makeclasslist.jar results.Noop/results_1/log results.Framer/results_1/log results.XFramer/results_1/log results.JEdit/results_1/log results.LimeWire/results_1/log results.NetBeans50/results_1/log
|
||||
|
||||
Presently, $JAVA_HOME must be the same path used to run the startup3 benchmark.
|
||||
|
||||
The logs are deliberately concatenated in roughly smallest to largest
|
||||
order based on application size. The resulting output is redirected
|
||||
into a file and results in one of classlist.solaris, classlist.linux,
|
||||
The logs are deliberately concatenated in roughly smallest to largest order
|
||||
based on application size. The resulting output is redirected into a file
|
||||
and results in one of classlist.solaris, classlist.linux, classlist.macosx,
|
||||
or classlist.windows. These files are checked in to the workspace. A
|
||||
necessary checksum (AddJsum.java) is added to the final classlist
|
||||
(installed in lib/ or jre/lib/) during the build process by the
|
||||
@ -27,8 +27,8 @@ classes and, on Unix platforms, the XML parsing classes.
|
||||
The properties file supplied to the refworkload is approximately the
|
||||
following:
|
||||
|
||||
javahome=/usr/java/j2sdk1.5.0
|
||||
javahome=/usr/java/j2sdk1.8.0
|
||||
resultsdir=classlist-run
|
||||
iterations=1
|
||||
benchmarks=startup3
|
||||
globalvmoptions=-client -Xshare:off -verbose:class
|
||||
globalvmoptions=-client -Xshare:off -XX:+TraceClassLoadingPreorder
|
||||
|
@ -196,11 +196,14 @@ public class DBCS {
|
||||
|
||||
// (5) c2b replacement, only used for JIs0208/0212, which
|
||||
// are two pure db charsets so default '3f' does not work
|
||||
// TBD: move this into configuration file
|
||||
String c2bRepl = "";
|
||||
if (clzName.startsWith("JIS_X_0208")) {
|
||||
c2bRepl = "new byte[]{ (byte)0x21, (byte)0x29 },";
|
||||
} else if (clzName.startsWith("JIS_X_0212")) {
|
||||
c2bRepl = "new byte[]{ (byte)0x22, (byte)0x44 },";
|
||||
} else if (clzName.startsWith("IBM300")) {
|
||||
c2bRepl = "new byte[]{ (byte)0x42, (byte)0x6f },";
|
||||
}
|
||||
|
||||
while (s.hasNextLine()) {
|
||||
|
@ -605,7 +605,23 @@ public class CLDRConverter {
|
||||
copyIfPresent(map, key, formatData);
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for islamic-umalqura name support (JDK-8015986)
|
||||
switch (id) {
|
||||
case "ar":
|
||||
map.put(CLDRConverter.CALENDAR_NAME_PREFIX
|
||||
+ CalendarType.ISLAMIC_UMALQURA.lname(),
|
||||
// derived from CLDR 24 draft
|
||||
"\u0627\u0644\u062a\u0642\u0648\u064a\u0645 "
|
||||
+"\u0627\u0644\u0625\u0633\u0644\u0627\u0645\u064a "
|
||||
+"[\u0623\u0645 \u0627\u0644\u0642\u0631\u0649]");
|
||||
break;
|
||||
case "en":
|
||||
map.put(CLDRConverter.CALENDAR_NAME_PREFIX
|
||||
+ CalendarType.ISLAMIC_UMALQURA.lname(),
|
||||
// derived from CLDR 24 draft
|
||||
"Islamic Calendar [Umm al-Qura]");
|
||||
break;
|
||||
}
|
||||
// Copy available calendar names
|
||||
for (String key : map.keySet()) {
|
||||
if (key.startsWith(CLDRConverter.CALENDAR_NAME_PREFIX)) {
|
||||
|
@ -31,7 +31,8 @@ import java.util.Locale;
|
||||
* Constants for the Calendars supported by JRE.
|
||||
*/
|
||||
enum CalendarType {
|
||||
GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC, ISLAMIC, ISLAMIC_CIVIL("islamicc");
|
||||
GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC,
|
||||
ISLAMIC, ISLAMIC_CIVIL("islamicc"), ISLAMIC_UMALQURA("islamic-umalqura");
|
||||
|
||||
private static final int[][] ERA_DATA = {
|
||||
// start index, array length
|
||||
@ -41,6 +42,7 @@ enum CalendarType {
|
||||
{0, 2}, // roc (Minguo)
|
||||
{0, 1}, // islamic (Hijrah)
|
||||
{0, 1}, // islamicc (same as islamic)
|
||||
{0, 1}, // islamic-umalqura
|
||||
};
|
||||
|
||||
private final String lname; // lowercase name
|
||||
@ -52,8 +54,8 @@ enum CalendarType {
|
||||
|
||||
private CalendarType(String uname) {
|
||||
String lname = name().toLowerCase(Locale.ROOT);
|
||||
if (lname.equals("islamic_civil")) {
|
||||
lname = "islamic-civil";
|
||||
if (lname.startsWith("islamic_")) {
|
||||
lname = lname.replace('_', '-');
|
||||
}
|
||||
this.lname = lname;
|
||||
this.uname = (uname != null) ? uname : lname;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,11 +29,11 @@ import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
|
||||
/** Reads a set of files containing the output of java -verbose:class
|
||||
runs. Finds all classes that were loaded from the bootstrap class
|
||||
path by comparing the prefix of the load path to the current JRE's
|
||||
java.home system property. Prints the names of these classes to
|
||||
stdout.
|
||||
/** Reads a set of files containing the output of java
|
||||
-XX:+TraceClassLoadingPreorder runs. Finds all classes that were
|
||||
loaded from the bootstrap class path by comparing the prefix of
|
||||
the load path to the current JRE's java.home system property.
|
||||
Prints the names of these classes to stdout.
|
||||
*/
|
||||
|
||||
public class MakeClasslist {
|
||||
@ -86,7 +86,7 @@ public class MakeClasslist {
|
||||
|
||||
Set<String> seenClasses = new HashSet<>();
|
||||
|
||||
for (String str : seenClasses) {
|
||||
for (String str : classes) {
|
||||
if (seenClasses.add(str)) {
|
||||
System.out.println(str);
|
||||
}
|
||||
|
@ -597,6 +597,44 @@ else
|
||||
$(CHMOD) a+x $@
|
||||
endif
|
||||
|
||||
##########################################################################################
|
||||
|
||||
BUILD_JSPAWNHELPER :=
|
||||
BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/solaris/native/java/lang
|
||||
BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
|
||||
LINK_JSPAWNHELPER_OBJECTS := $(JDK_OUTPUTDIR)/objs/libjava/childproc.o
|
||||
LINK_JSPAWNHELPER_FLAGS :=
|
||||
|
||||
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris),)
|
||||
BUILD_JSPAWNHELPER := 1
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
|
||||
LINK_JSPAWNHELPER_FLAGS += -m64
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_JSPAWNHELPER), 1)
|
||||
$(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER,\
|
||||
SRC:=$(BUILD_JSPAWNHELPER_SRC),\
|
||||
INCLUDE_FILES:=jspawnhelper.c,\
|
||||
LANG:=C,\
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS:=$(CFLAGS_JDKEXE), \
|
||||
LDFLAGS:=$(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
|
||||
LDFLAGS_SUFFIX:= $(LINK_JSPAWNHELPER_OBJECTS), \
|
||||
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jspawnhelper,\
|
||||
OUTPUT_DIR:=$(BUILD_JSPAWNHELPER_DST_DIR),\
|
||||
PROGRAM:=jspawnhelper))
|
||||
|
||||
$(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)
|
||||
|
||||
BUILD_LAUNCHERS += $(BUILD_JSPAWNHELPER)
|
||||
endif
|
||||
|
||||
##########################################################################################
|
||||
# jabswitch
|
||||
|
||||
|
@ -205,7 +205,7 @@ ifneq (,$(JDK_UPDATE_VERSION))
|
||||
LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
|
||||
endif
|
||||
|
||||
LIBJAVA_EXCLUDE_FILES:=check_code.c check_format.c
|
||||
LIBJAVA_EXCLUDE_FILES:=check_code.c check_format.c jspawnhelper.c
|
||||
|
||||
ifneq ($(OPENJDK_TARGET_OS),macosx)
|
||||
LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
|
||||
@ -1042,6 +1042,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH,\
|
||||
LANG:=C,\
|
||||
OPTIMIZATION:=LOW, \
|
||||
CFLAGS:=$(CFLAGS_JDKLIB),\
|
||||
CFLAGS_windows:=/Gy,\
|
||||
MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
|
||||
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
|
||||
RC_FLAGS:=$(RC_FLAGS) \
|
||||
@ -1051,6 +1052,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH,\
|
||||
LDFLAGS:=$(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN),\
|
||||
LDFLAGS_solaris:=-ldoor,\
|
||||
LDFLAGS_windows:=/ORDER:@$(JDK_TOPDIR)/makefiles/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU),\
|
||||
LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
|
||||
LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib psapi.lib,\
|
||||
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libattach,\
|
||||
|
2
jdk/makefiles/mapfiles/libattach/reorder-windows-x86
Normal file
2
jdk/makefiles/mapfiles/libattach/reorder-windows-x86
Normal file
@ -0,0 +1,2 @@
|
||||
jvm_attach_thread_func@4
|
||||
jvm_attach_thread_func_end
|
2
jdk/makefiles/mapfiles/libattach/reorder-windows-x86_64
Normal file
2
jdk/makefiles/mapfiles/libattach/reorder-windows-x86_64
Normal file
@ -0,0 +1,2 @@
|
||||
jvm_attach_thread_func
|
||||
jvm_attach_thread_func_end
|
@ -100,7 +100,7 @@ SUNWprivate_1.1 {
|
||||
Java_java_io_RandomAccessFile_open;
|
||||
Java_java_io_RandomAccessFile_read;
|
||||
Java_java_io_RandomAccessFile_readBytes;
|
||||
Java_java_io_RandomAccessFile_seek;
|
||||
Java_java_io_RandomAccessFile_seek0;
|
||||
Java_java_io_RandomAccessFile_setLength;
|
||||
Java_java_io_RandomAccessFile_write;
|
||||
Java_java_io_RandomAccessFile_writeBytes;
|
||||
|
@ -102,6 +102,7 @@ PROFILE_1_JRE_JAR_FILES := \
|
||||
security/US_export_policy.jar \
|
||||
security/local_policy.jar
|
||||
|
||||
|
||||
PROFILE_2_JRE_BIN_FILES := \
|
||||
rmid$(EXE_SUFFIX) \
|
||||
rmiregistry$(EXE_SUFFIX)
|
||||
@ -140,7 +141,6 @@ PROFILE_3_JRE_LIB_FILES := \
|
||||
PROFILE_3_JRE_OTHER_FILES :=
|
||||
|
||||
PROFILE_3_JRE_JAR_FILES := \
|
||||
jfr.jar \
|
||||
management-agent.jar
|
||||
|
||||
|
||||
@ -253,6 +253,6 @@ FULL_JRE_JAR_FILES := \
|
||||
ext/cldrdata.jar \
|
||||
ext/dnsns.jar \
|
||||
ext/nashorn.jar \
|
||||
ext/zipfs.jar
|
||||
|
||||
ext/zipfs.jar \
|
||||
jfr.jar
|
||||
|
||||
|
@ -124,7 +124,8 @@ public final class SunJCE extends Provider {
|
||||
put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
|
||||
put("Cipher.RSA SupportedModes", "ECB");
|
||||
put("Cipher.RSA SupportedPaddings",
|
||||
"NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
|
||||
"NOPADDING|PKCS1PADDING|OAEPPADDING"
|
||||
+ "|OAEPWITHMD5ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA1ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-1ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-224ANDMGF1PADDING"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,5 +29,6 @@ package com.sun.java.swing;
|
||||
*
|
||||
* @deprecated Use {@link javax.swing.Painter} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface Painter<T> extends javax.swing.Painter<T> {
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,5 +29,6 @@ package com.sun.java.swing.plaf.nimbus;
|
||||
*
|
||||
* @deprecated Use {@link javax.swing.plaf.nimbus.AbstractRegionPainter} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractRegionPainter extends javax.swing.plaf.nimbus.AbstractRegionPainter {
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,5 +29,6 @@ package com.sun.java.swing.plaf.nimbus;
|
||||
*
|
||||
* @deprecated Use {@link javax.swing.plaf.nimbus.NimbusLookAndFeel} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class NimbusLookAndFeel extends javax.swing.plaf.nimbus.NimbusLookAndFeel {
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ import org.w3c.dom.Element;
|
||||
public class DEREncodedKeyValue extends Signature11ElementProxy implements KeyInfoContent {
|
||||
|
||||
/** JCA algorithm key types supported by this implementation. */
|
||||
public static final String supportedKeyTypes[] = { "RSA", "DSA", "EC"};
|
||||
private static final String supportedKeyTypes[] = { "RSA", "DSA", "EC"};
|
||||
|
||||
/**
|
||||
* Constructor DEREncodedKeyValue
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,964 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.security.auth;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.RuntimePermission;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.SocketPermission;
|
||||
import java.net.URL;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Vector;
|
||||
import java.util.StringTokenizer;
|
||||
import sun.security.util.PropertyExpander;
|
||||
|
||||
/**
|
||||
* The policy for a Java runtime (specifying
|
||||
* which permissions are available for code from various principals)
|
||||
* is represented as a separate
|
||||
* persistent configuration. The configuration may be stored as a
|
||||
* flat ASCII file, as a serialized binary file of
|
||||
* the Policy class, or as a database. <p>
|
||||
*
|
||||
* <p>The Java runtime creates one global Policy object, which is used to
|
||||
* represent the static policy configuration file. It is consulted by
|
||||
* a ProtectionDomain when the protection domain initializes its set of
|
||||
* permissions. <p>
|
||||
*
|
||||
* <p>The Policy <code>init</code> method parses the policy
|
||||
* configuration file, and then
|
||||
* populates the Policy object. The Policy object is agnostic in that
|
||||
* it is not involved in making policy decisions. It is merely the
|
||||
* Java runtime representation of the persistent policy configuration
|
||||
* file. <p>
|
||||
*
|
||||
* <p>When a protection domain needs to initialize its set of
|
||||
* permissions, it executes code such as the following
|
||||
* to ask the global Policy object to populate a
|
||||
* Permissions object with the appropriate permissions:
|
||||
* <pre>
|
||||
* policy = Policy.getPolicy();
|
||||
* Permissions perms = policy.getPermissions(MyCodeSource)
|
||||
* </pre>
|
||||
*
|
||||
* <p>The protection domain passes in a CodeSource
|
||||
* object, which encapsulates its codebase (URL) and public key attributes.
|
||||
* The Policy object evaluates the global policy in light of who the
|
||||
* principal is and returns an appropriate Permissions object.
|
||||
*
|
||||
* @deprecated As of JDK 1.4, replaced by
|
||||
* {@link sun.security.provider.PolicyParser}.
|
||||
* This class is entirely deprecated.
|
||||
*
|
||||
* @author Roland Schemers
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
@Deprecated
|
||||
class PolicyParser {
|
||||
|
||||
private static final java.util.ResourceBundle rb =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<java.util.ResourceBundle>() {
|
||||
public java.util.ResourceBundle run() {
|
||||
return (java.util.ResourceBundle.getBundle
|
||||
("sun.security.util.AuthResources"));
|
||||
}
|
||||
});
|
||||
|
||||
private Vector<GrantEntry> grantEntries;
|
||||
|
||||
// Convenience variables for parsing
|
||||
private static final sun.security.util.Debug debug =
|
||||
sun.security.util.Debug.getInstance("parser", "\t[Auth Policy Parser]");
|
||||
private StreamTokenizer st;
|
||||
private int lookahead;
|
||||
private int linenum;
|
||||
private boolean expandProp = false;
|
||||
private String keyStoreUrlString = null; // unexpanded
|
||||
private String keyStoreType = null;
|
||||
|
||||
private String expand(String value)
|
||||
throws PropertyExpander.ExpandException
|
||||
{
|
||||
if (expandProp)
|
||||
return PropertyExpander.expand(value);
|
||||
else
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Creates a PolicyParser object.
|
||||
*/
|
||||
|
||||
public PolicyParser() {
|
||||
grantEntries = new Vector<GrantEntry>();
|
||||
}
|
||||
|
||||
|
||||
public PolicyParser(boolean expandProp) {
|
||||
this();
|
||||
this.expandProp = expandProp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a policy configuration into the Policy object using a
|
||||
* Reader object. <p>
|
||||
*
|
||||
* @param policy the policy Reader object.
|
||||
*
|
||||
* @exception ParsingException if the policy configuration contains
|
||||
* a syntax error.
|
||||
*
|
||||
* @exception IOException if an error occurs while reading the policy
|
||||
* configuration.
|
||||
*/
|
||||
|
||||
public void read(Reader policy)
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
if (!(policy instanceof BufferedReader)) {
|
||||
policy = new BufferedReader(policy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the stream tokenizer:
|
||||
* Recognize strings between "..."
|
||||
* Don't convert words to lowercase
|
||||
* Recognize both C-style and C++-style comments
|
||||
* Treat end-of-line as white space, not as a token
|
||||
*/
|
||||
st = new StreamTokenizer(policy);
|
||||
|
||||
st.resetSyntax();
|
||||
st.wordChars('a', 'z');
|
||||
st.wordChars('A', 'Z');
|
||||
st.wordChars('.', '.');
|
||||
st.wordChars('0', '9');
|
||||
st.wordChars('_', '_');
|
||||
st.wordChars('$', '$');
|
||||
st.wordChars(128 + 32, 255);
|
||||
st.whitespaceChars(0, ' ');
|
||||
st.commentChar('/');
|
||||
st.quoteChar('\'');
|
||||
st.quoteChar('"');
|
||||
st.lowerCaseMode(false);
|
||||
st.ordinaryChar('/');
|
||||
st.slashSlashComments(true);
|
||||
st.slashStarComments(true);
|
||||
|
||||
/**
|
||||
* The main parsing loop. The loop is executed once
|
||||
* for each entry in the config file. The entries
|
||||
* are delimited by semicolons. Once we've read in
|
||||
* the information for an entry, go ahead and try to
|
||||
* add it to the policy vector.
|
||||
*
|
||||
*/
|
||||
|
||||
lookahead = st.nextToken();
|
||||
while (lookahead != StreamTokenizer.TT_EOF) {
|
||||
if (peek("grant")) {
|
||||
GrantEntry ge = parseGrantEntry();
|
||||
// could be null if we couldn't expand a property
|
||||
if (ge != null)
|
||||
add(ge);
|
||||
} else if (peek("keystore") && keyStoreUrlString==null) {
|
||||
// only one keystore entry per policy file, others will be
|
||||
// ignored
|
||||
parseKeyStoreEntry();
|
||||
} else {
|
||||
// error?
|
||||
}
|
||||
match(";");
|
||||
}
|
||||
}
|
||||
|
||||
public void add(GrantEntry ge)
|
||||
{
|
||||
grantEntries.addElement(ge);
|
||||
}
|
||||
|
||||
public void replace(GrantEntry origGe, GrantEntry newGe)
|
||||
{
|
||||
grantEntries.setElementAt(newGe, grantEntries.indexOf(origGe));
|
||||
}
|
||||
|
||||
public boolean remove(GrantEntry ge)
|
||||
{
|
||||
return grantEntries.removeElement(ge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the (possibly expanded) keystore location, or null if the
|
||||
* expansion fails.
|
||||
*/
|
||||
public String getKeyStoreUrl() {
|
||||
try {
|
||||
if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) {
|
||||
return expand(keyStoreUrlString).replace(File.separatorChar,
|
||||
'/');
|
||||
}
|
||||
} catch (PropertyExpander.ExpandException peee) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setKeyStoreUrl(String url) {
|
||||
keyStoreUrlString = url;
|
||||
}
|
||||
|
||||
public String getKeyStoreType() {
|
||||
return keyStoreType;
|
||||
}
|
||||
|
||||
public void setKeyStoreType(String type) {
|
||||
keyStoreType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate all the entries in the global policy object.
|
||||
* This method is used by policy admin tools. The tools
|
||||
* should use the Enumeration methods on the returned object
|
||||
* to fetch the elements sequentially.
|
||||
*/
|
||||
public Enumeration<GrantEntry> grantElements(){
|
||||
return grantEntries.elements();
|
||||
}
|
||||
|
||||
/**
|
||||
* write out the policy
|
||||
*/
|
||||
|
||||
public void write(Writer policy)
|
||||
{
|
||||
PrintWriter out = new PrintWriter(new BufferedWriter(policy));
|
||||
|
||||
Enumeration<GrantEntry> enum_ = grantElements();
|
||||
|
||||
out.println("/* AUTOMATICALLY GENERATED ON "+
|
||||
(new java.util.Date()) + "*/");
|
||||
out.println("/* DO NOT EDIT */");
|
||||
out.println();
|
||||
|
||||
// write the (unexpanded) keystore entry as the first entry of the
|
||||
// policy file
|
||||
if (keyStoreUrlString != null) {
|
||||
writeKeyStoreEntry(out);
|
||||
}
|
||||
|
||||
// write "grant" entries
|
||||
while (enum_.hasMoreElements()) {
|
||||
GrantEntry ge = enum_.nextElement();
|
||||
ge.write(out);
|
||||
out.println();
|
||||
}
|
||||
out.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* parses a keystore entry
|
||||
*/
|
||||
private void parseKeyStoreEntry() throws ParsingException, IOException {
|
||||
match("keystore");
|
||||
keyStoreUrlString = match("quoted string");
|
||||
|
||||
// parse keystore type
|
||||
if (!peek(",")) {
|
||||
return; // default type
|
||||
}
|
||||
match(",");
|
||||
|
||||
if (peek("\"")) {
|
||||
keyStoreType = match("quoted string");
|
||||
} else {
|
||||
throw new ParsingException(st.lineno(),
|
||||
rb.getString("expected.keystore.type"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* writes the (unexpanded) keystore entry
|
||||
*/
|
||||
private void writeKeyStoreEntry(PrintWriter out) {
|
||||
out.print("keystore \"");
|
||||
out.print(keyStoreUrlString);
|
||||
out.print('"');
|
||||
if (keyStoreType != null && keyStoreType.length() > 0)
|
||||
out.print(", \"" + keyStoreType + "\"");
|
||||
out.println(";");
|
||||
out.println();
|
||||
}
|
||||
|
||||
/**
|
||||
* parse a Grant entry
|
||||
*/
|
||||
private GrantEntry parseGrantEntry()
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
GrantEntry e = new GrantEntry();
|
||||
LinkedList<PrincipalEntry> principals = null;
|
||||
boolean ignoreEntry = false;
|
||||
|
||||
match("grant");
|
||||
|
||||
while(!peek("{")) {
|
||||
|
||||
if (peekAndMatch("Codebase")) {
|
||||
e.codeBase = match("quoted string");
|
||||
peekAndMatch(",");
|
||||
} else if (peekAndMatch("SignedBy")) {
|
||||
e.signedBy = match("quoted string");
|
||||
peekAndMatch(",");
|
||||
} else if (peekAndMatch("Principal")) {
|
||||
if (principals == null) {
|
||||
principals = new LinkedList<PrincipalEntry>();
|
||||
}
|
||||
|
||||
// check for principalClass wildcard
|
||||
String principalClass;
|
||||
if (peek("*")) {
|
||||
match("*");
|
||||
principalClass = PrincipalEntry.WILDCARD_CLASS;
|
||||
} else {
|
||||
principalClass = match("principal type");
|
||||
}
|
||||
|
||||
// check for principalName wildcard
|
||||
String principalName;
|
||||
if (peek("*")) {
|
||||
match("*");
|
||||
principalName = PrincipalEntry.WILDCARD_NAME;
|
||||
} else {
|
||||
principalName = match("quoted string");
|
||||
}
|
||||
|
||||
// disallow WILDCARD_CLASS && actual name
|
||||
if (principalClass.equals(PrincipalEntry.WILDCARD_CLASS) &&
|
||||
!principalName.equals(PrincipalEntry.WILDCARD_NAME)) {
|
||||
if (debug != null)
|
||||
debug.println("disallowing principal that has " +
|
||||
"WILDCARD class but no WILDCARD name");
|
||||
throw new ParsingException
|
||||
(st.lineno(),
|
||||
rb.getString("can.not.specify.Principal.with.a." +
|
||||
"wildcard.class.without.a.wildcard.name"));
|
||||
}
|
||||
|
||||
try {
|
||||
principalName = expand(principalName);
|
||||
principals.add
|
||||
(new PrincipalEntry(principalClass, principalName));
|
||||
} catch (PropertyExpander.ExpandException peee) {
|
||||
// ignore the entire policy entry
|
||||
// but continue parsing all the info
|
||||
// so we can get to the next entry
|
||||
if (debug != null)
|
||||
debug.println("principal name expansion failed: " +
|
||||
principalName);
|
||||
ignoreEntry = true;
|
||||
}
|
||||
peekAndMatch(",");
|
||||
} else {
|
||||
throw new
|
||||
ParsingException(st.lineno(),
|
||||
rb.getString("expected.codeBase.or.SignedBy"));
|
||||
}
|
||||
}
|
||||
|
||||
// disallow non principal-based grant entries
|
||||
if (principals == null) {
|
||||
throw new ParsingException
|
||||
(st.lineno(),
|
||||
rb.getString("only.Principal.based.grant.entries.permitted"));
|
||||
}
|
||||
|
||||
e.principals = principals;
|
||||
match("{");
|
||||
|
||||
while(!peek("}")) {
|
||||
if (peek("Permission")) {
|
||||
try {
|
||||
PermissionEntry pe = parsePermissionEntry();
|
||||
e.add(pe);
|
||||
} catch (PropertyExpander.ExpandException peee) {
|
||||
// ignore. The add never happened
|
||||
skipEntry(); // BugId 4219343
|
||||
}
|
||||
match(";");
|
||||
} else {
|
||||
throw new
|
||||
ParsingException(st.lineno(),
|
||||
rb.getString("expected.permission.entry"));
|
||||
}
|
||||
}
|
||||
match("}");
|
||||
|
||||
try {
|
||||
if (e.codeBase != null)
|
||||
e.codeBase = expand(e.codeBase).replace(File.separatorChar, '/');
|
||||
e.signedBy = expand(e.signedBy);
|
||||
} catch (PropertyExpander.ExpandException peee) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (ignoreEntry == true) ? null : e;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse a Permission entry
|
||||
*/
|
||||
private PermissionEntry parsePermissionEntry()
|
||||
throws ParsingException, IOException, PropertyExpander.ExpandException
|
||||
{
|
||||
PermissionEntry e = new PermissionEntry();
|
||||
|
||||
// Permission
|
||||
match("Permission");
|
||||
e.permission = match("permission type");
|
||||
|
||||
if (peek("\"")) {
|
||||
// Permission name
|
||||
e.name = expand(match("quoted string"));
|
||||
}
|
||||
|
||||
if (!peek(",")) {
|
||||
return e;
|
||||
}
|
||||
match(",");
|
||||
|
||||
if (peek("\"")) {
|
||||
e.action = expand(match("quoted string"));
|
||||
if (!peek(",")) {
|
||||
return e;
|
||||
}
|
||||
match(",");
|
||||
}
|
||||
|
||||
if (peekAndMatch("SignedBy")) {
|
||||
e.signedBy = expand(match("quoted string"));
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
private boolean peekAndMatch(String expect)
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
if (peek(expect)) {
|
||||
match(expect);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean peek(String expect) {
|
||||
boolean found = false;
|
||||
|
||||
switch (lookahead) {
|
||||
|
||||
case StreamTokenizer.TT_WORD:
|
||||
if (expect.equalsIgnoreCase(st.sval))
|
||||
found = true;
|
||||
break;
|
||||
case ',':
|
||||
if (expect.equalsIgnoreCase(","))
|
||||
found = true;
|
||||
break;
|
||||
case '{':
|
||||
if (expect.equalsIgnoreCase("{"))
|
||||
found = true;
|
||||
break;
|
||||
case '}':
|
||||
if (expect.equalsIgnoreCase("}"))
|
||||
found = true;
|
||||
break;
|
||||
case '"':
|
||||
if (expect.equalsIgnoreCase("\""))
|
||||
found = true;
|
||||
break;
|
||||
case '*':
|
||||
if (expect.equalsIgnoreCase("*"))
|
||||
found = true;
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
private String match(String expect)
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
String value = null;
|
||||
|
||||
switch (lookahead) {
|
||||
case StreamTokenizer.TT_NUMBER:
|
||||
throw new ParsingException(st.lineno(), expect,
|
||||
rb.getString("number.") +
|
||||
String.valueOf(st.nval));
|
||||
case StreamTokenizer.TT_EOF:
|
||||
MessageFormat form = new MessageFormat(
|
||||
rb.getString("expected.expect.read.end.of.file."));
|
||||
Object[] source = {expect};
|
||||
throw new ParsingException(form.format(source));
|
||||
case StreamTokenizer.TT_WORD:
|
||||
if (expect.equalsIgnoreCase(st.sval)) {
|
||||
lookahead = st.nextToken();
|
||||
} else if (expect.equalsIgnoreCase("permission type")) {
|
||||
value = st.sval;
|
||||
lookahead = st.nextToken();
|
||||
} else if (expect.equalsIgnoreCase("principal type")) {
|
||||
value = st.sval;
|
||||
lookahead = st.nextToken();
|
||||
} else {
|
||||
throw new ParsingException(st.lineno(), expect, st.sval);
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
if (expect.equalsIgnoreCase("quoted string")) {
|
||||
value = st.sval;
|
||||
lookahead = st.nextToken();
|
||||
} else if (expect.equalsIgnoreCase("permission type")) {
|
||||
value = st.sval;
|
||||
lookahead = st.nextToken();
|
||||
} else if (expect.equalsIgnoreCase("principal type")) {
|
||||
value = st.sval;
|
||||
lookahead = st.nextToken();
|
||||
} else {
|
||||
throw new ParsingException(st.lineno(), expect, st.sval);
|
||||
}
|
||||
break;
|
||||
case ',':
|
||||
if (expect.equalsIgnoreCase(","))
|
||||
lookahead = st.nextToken();
|
||||
else
|
||||
throw new ParsingException(st.lineno(), expect, ",");
|
||||
break;
|
||||
case '{':
|
||||
if (expect.equalsIgnoreCase("{"))
|
||||
lookahead = st.nextToken();
|
||||
else
|
||||
throw new ParsingException(st.lineno(), expect, "{");
|
||||
break;
|
||||
case '}':
|
||||
if (expect.equalsIgnoreCase("}"))
|
||||
lookahead = st.nextToken();
|
||||
else
|
||||
throw new ParsingException(st.lineno(), expect, "}");
|
||||
break;
|
||||
case ';':
|
||||
if (expect.equalsIgnoreCase(";"))
|
||||
lookahead = st.nextToken();
|
||||
else
|
||||
throw new ParsingException(st.lineno(), expect, ";");
|
||||
break;
|
||||
case '*':
|
||||
if (expect.equalsIgnoreCase("*"))
|
||||
lookahead = st.nextToken();
|
||||
else
|
||||
throw new ParsingException(st.lineno(), expect, "*");
|
||||
break;
|
||||
default:
|
||||
throw new ParsingException(st.lineno(), expect,
|
||||
new String(new char[] {(char)lookahead}));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* skip all tokens for this entry leaving the delimiter ";"
|
||||
* in the stream.
|
||||
*/
|
||||
private void skipEntry()
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
while(lookahead != ';') {
|
||||
switch (lookahead) {
|
||||
case StreamTokenizer.TT_NUMBER:
|
||||
throw new ParsingException(st.lineno(), ";",
|
||||
rb.getString("number.") +
|
||||
String.valueOf(st.nval));
|
||||
case StreamTokenizer.TT_EOF:
|
||||
throw new ParsingException
|
||||
(rb.getString("expected.read.end.of.file"));
|
||||
default:
|
||||
lookahead = st.nextToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Each grant entry in the policy configuration file is
|
||||
* represented by a
|
||||
* GrantEntry object. <p>
|
||||
*
|
||||
* <p>
|
||||
* For example, the entry
|
||||
* <pre>
|
||||
* grant signedBy "Duke" {
|
||||
* permission java.io.FilePermission "/tmp", "read,write";
|
||||
* };
|
||||
*
|
||||
* </pre>
|
||||
* is represented internally
|
||||
* <pre>
|
||||
*
|
||||
* pe = new PermissionEntry("java.io.FilePermission",
|
||||
* "/tmp", "read,write");
|
||||
*
|
||||
* ge = new GrantEntry("Duke", null);
|
||||
*
|
||||
* ge.add(pe);
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author Roland Schemers
|
||||
*
|
||||
* version 1.19, 05/21/98
|
||||
*/
|
||||
|
||||
static class GrantEntry {
|
||||
|
||||
public String signedBy;
|
||||
public String codeBase;
|
||||
public LinkedList<PrincipalEntry> principals;
|
||||
public Vector<PermissionEntry> permissionEntries;
|
||||
|
||||
public GrantEntry() {
|
||||
permissionEntries = new Vector<PermissionEntry>();
|
||||
}
|
||||
|
||||
public GrantEntry(String signedBy, String codeBase) {
|
||||
this.codeBase = codeBase;
|
||||
this.signedBy = signedBy;
|
||||
permissionEntries = new Vector<PermissionEntry>();
|
||||
}
|
||||
|
||||
public void add(PermissionEntry pe)
|
||||
{
|
||||
permissionEntries.addElement(pe);
|
||||
}
|
||||
|
||||
public boolean remove(PermissionEntry pe)
|
||||
{
|
||||
return permissionEntries.removeElement(pe);
|
||||
}
|
||||
|
||||
public boolean contains(PermissionEntry pe)
|
||||
{
|
||||
return permissionEntries.contains(pe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate all the permission entries in this GrantEntry.
|
||||
*/
|
||||
public Enumeration<PermissionEntry> permissionElements(){
|
||||
return permissionEntries.elements();
|
||||
}
|
||||
|
||||
|
||||
public void write(PrintWriter out) {
|
||||
out.print("grant");
|
||||
if (signedBy != null) {
|
||||
out.print(" signedBy \"");
|
||||
out.print(signedBy);
|
||||
out.print('"');
|
||||
if (codeBase != null)
|
||||
out.print(", ");
|
||||
}
|
||||
if (codeBase != null) {
|
||||
out.print(" codeBase \"");
|
||||
out.print(codeBase);
|
||||
out.print('"');
|
||||
if (principals != null && principals.size() > 0)
|
||||
out.print(",\n");
|
||||
}
|
||||
if (principals != null && principals.size() > 0) {
|
||||
ListIterator<PrincipalEntry> pli = principals.listIterator();
|
||||
while (pli.hasNext()) {
|
||||
out.print("\tPrincipal ");
|
||||
PrincipalEntry pe = pli.next();
|
||||
out.print(pe.principalClass +
|
||||
" \"" + pe.principalName + "\"");
|
||||
if (pli.hasNext())
|
||||
out.print(",\n");
|
||||
}
|
||||
}
|
||||
out.println(" {");
|
||||
Enumeration<PermissionEntry> enum_ = permissionEntries.elements();
|
||||
while (enum_.hasMoreElements()) {
|
||||
PermissionEntry pe = enum_.nextElement();
|
||||
out.write(" ");
|
||||
pe.write(out);
|
||||
}
|
||||
out.println("};");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Principal info (class and name) in a grant entry
|
||||
*/
|
||||
static class PrincipalEntry {
|
||||
|
||||
static final String WILDCARD_CLASS = "WILDCARD_PRINCIPAL_CLASS";
|
||||
static final String WILDCARD_NAME = "WILDCARD_PRINCIPAL_NAME";
|
||||
|
||||
String principalClass;
|
||||
String principalName;
|
||||
|
||||
/**
|
||||
* A PrincipalEntry consists of the <code>Principal</code>
|
||||
* class and <code>Principal</code> name.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* @param principalClass the <code>Principal</code> class. <p>
|
||||
*
|
||||
* @param principalName the <code>Principal</code> name. <p>
|
||||
*/
|
||||
public PrincipalEntry(String principalClass, String principalName) {
|
||||
if (principalClass == null || principalName == null)
|
||||
throw new NullPointerException
|
||||
("null principalClass or principalName");
|
||||
this.principalClass = principalClass;
|
||||
this.principalName = principalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for equality between the specified object and this object.
|
||||
* Two PrincipalEntries are equal if their PrincipalClass and
|
||||
* PrincipalName values are equal.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* @param obj the object to test for equality with this object.
|
||||
*
|
||||
* @return true if the objects are equal, false otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (!(obj instanceof PrincipalEntry))
|
||||
return false;
|
||||
|
||||
PrincipalEntry that = (PrincipalEntry)obj;
|
||||
if (this.principalClass.equals(that.principalClass) &&
|
||||
this.principalName.equals(that.principalName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a hashcode for this <code>PrincipalEntry</code>.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* @return a hashcode for this <code>PrincipalEntry</code>.
|
||||
*/
|
||||
public int hashCode() {
|
||||
return principalClass.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Each permission entry in the policy configuration file is
|
||||
* represented by a
|
||||
* PermissionEntry object. <p>
|
||||
*
|
||||
* <p>
|
||||
* For example, the entry
|
||||
* <pre>
|
||||
* permission java.io.FilePermission "/tmp", "read,write";
|
||||
* </pre>
|
||||
* is represented internally
|
||||
* <pre>
|
||||
*
|
||||
* pe = new PermissionEntry("java.io.FilePermission",
|
||||
* "/tmp", "read,write");
|
||||
* </pre>
|
||||
*
|
||||
* @author Roland Schemers
|
||||
*
|
||||
* version 1.19, 05/21/98
|
||||
*/
|
||||
|
||||
static class PermissionEntry {
|
||||
|
||||
public String permission;
|
||||
public String name;
|
||||
public String action;
|
||||
public String signedBy;
|
||||
|
||||
public PermissionEntry() {
|
||||
}
|
||||
|
||||
public PermissionEntry(String permission,
|
||||
String name,
|
||||
String action) {
|
||||
this.permission = permission;
|
||||
this.name = name;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates a hash code value for the object. Objects
|
||||
* which are equal will also have the same hashcode.
|
||||
*/
|
||||
public int hashCode() {
|
||||
int retval = permission.hashCode();
|
||||
if (name != null) retval ^= name.hashCode();
|
||||
if (action != null) retval ^= action.hashCode();
|
||||
return retval;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this)
|
||||
return true;
|
||||
|
||||
if (! (obj instanceof PermissionEntry))
|
||||
return false;
|
||||
|
||||
PermissionEntry that = (PermissionEntry) obj;
|
||||
|
||||
if (this.permission == null) {
|
||||
if (that.permission != null) return false;
|
||||
} else {
|
||||
if (!this.permission.equals(that.permission)) return false;
|
||||
}
|
||||
|
||||
if (this.name == null) {
|
||||
if (that.name != null) return false;
|
||||
} else {
|
||||
if (!this.name.equals(that.name)) return false;
|
||||
}
|
||||
|
||||
if (this.action == null) {
|
||||
if (that.action != null) return false;
|
||||
} else {
|
||||
if (!this.action.equals(that.action)) return false;
|
||||
}
|
||||
|
||||
if (this.signedBy == null) {
|
||||
if (that.signedBy != null) return false;
|
||||
} else {
|
||||
if (!this.signedBy.equals(that.signedBy)) return false;
|
||||
}
|
||||
|
||||
// everything matched -- the 2 objects are equal
|
||||
return true;
|
||||
}
|
||||
|
||||
public void write(PrintWriter out) {
|
||||
out.print("permission ");
|
||||
out.print(permission);
|
||||
if (name != null) {
|
||||
out.print(" \"");
|
||||
|
||||
// have to add escape chars for quotes
|
||||
if (name.indexOf("\"") != -1) {
|
||||
int numQuotes = 0;
|
||||
char[] chars = name.toCharArray();
|
||||
|
||||
// count the number of quote chars
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] == '"')
|
||||
numQuotes++;
|
||||
}
|
||||
|
||||
// now, add an escape char before each quote
|
||||
char[] newChars = new char[chars.length + numQuotes];
|
||||
for (int i = 0, j = 0; i < chars.length; i++) {
|
||||
if (chars[i] != '"') {
|
||||
newChars[j++] = chars[i];
|
||||
} else {
|
||||
newChars[j++] = '\\';
|
||||
newChars[j++] = chars[i];
|
||||
}
|
||||
}
|
||||
name = new String(newChars);
|
||||
}
|
||||
out.print(name);
|
||||
out.print('"');
|
||||
}
|
||||
if (action != null) {
|
||||
out.print(", \"");
|
||||
out.print(action);
|
||||
out.print('"');
|
||||
}
|
||||
if (signedBy != null) {
|
||||
out.print(", signedBy \"");
|
||||
out.print(signedBy);
|
||||
out.print('"');
|
||||
}
|
||||
out.println(";");
|
||||
}
|
||||
}
|
||||
|
||||
static class ParsingException extends GeneralSecurityException {
|
||||
|
||||
private static final long serialVersionUID = 8240970523155877400L;
|
||||
|
||||
/**
|
||||
* Constructs a ParsingException with the specified
|
||||
* detail message. A detail message is a String that describes
|
||||
* this particular exception, which may, for example, specify which
|
||||
* algorithm is not available.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
*/
|
||||
public ParsingException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public ParsingException(int line, String msg) {
|
||||
super(rb.getString("line.") + line + rb.getString("COLON") + msg);
|
||||
}
|
||||
|
||||
public ParsingException(int line, String expect, String actual) {
|
||||
super(rb.getString("line.") + line + rb.getString(".expected.") +
|
||||
expect + rb.getString(".found.") + actual +
|
||||
rb.getString("QUOTE"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String arg[]) throws Exception {
|
||||
PolicyParser pp = new PolicyParser(true);
|
||||
pp.read(new FileReader(arg[0]));
|
||||
FileWriter fr = new FileWriter(arg[1]);
|
||||
pp.write(fr);
|
||||
fr.close();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,9 +30,9 @@ import javax.security.auth.login.Configuration;
|
||||
import java.net.URI;
|
||||
|
||||
// NOTE: As of JDK 8, this class instantiates
|
||||
// sun.security.provider.ConfigSpiFile and forwards all methods to that
|
||||
// sun.security.provider.ConfigFile.Spi and forwards all methods to that
|
||||
// implementation. All implementation fixes and enhancements should be made to
|
||||
// sun.security.provider.ConfigSpiFile and not this class.
|
||||
// sun.security.provider.ConfigFile.Spi and not this class.
|
||||
// See JDK-8005117 for more information.
|
||||
|
||||
/**
|
||||
@ -85,7 +85,7 @@ import java.net.URI;
|
||||
*/
|
||||
public class ConfigFile extends Configuration {
|
||||
|
||||
private sun.security.provider.ConfigSpiFile configFile;
|
||||
private final sun.security.provider.ConfigFile.Spi spi;
|
||||
|
||||
/**
|
||||
* Create a new {@code Configuration} object.
|
||||
@ -94,7 +94,7 @@ public class ConfigFile extends Configuration {
|
||||
* initialized
|
||||
*/
|
||||
public ConfigFile() {
|
||||
configFile = new sun.security.provider.ConfigSpiFile();
|
||||
spi = new sun.security.provider.ConfigFile.Spi();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ public class ConfigFile extends Configuration {
|
||||
* @throws NullPointerException if {@code uri} is null
|
||||
*/
|
||||
public ConfigFile(URI uri) {
|
||||
configFile = new sun.security.provider.ConfigSpiFile(uri);
|
||||
spi = new sun.security.provider.ConfigFile.Spi(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ public class ConfigFile extends Configuration {
|
||||
public AppConfigurationEntry[] getAppConfigurationEntry
|
||||
(String applicationName) {
|
||||
|
||||
return configFile.engineGetAppConfigurationEntry(applicationName);
|
||||
return spi.engineGetAppConfigurationEntry(applicationName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,7 +134,7 @@ public class ConfigFile extends Configuration {
|
||||
* to refresh the {@code Configuration}
|
||||
*/
|
||||
@Override
|
||||
public synchronized void refresh() {
|
||||
configFile.engineRefresh();
|
||||
public void refresh() {
|
||||
spi.engineRefresh();
|
||||
}
|
||||
}
|
||||
|
@ -1144,7 +1144,7 @@ function contains(array, code) {
|
||||
} else {
|
||||
for (var index in array) {
|
||||
var it = array[index];
|
||||
if (func(it, index, array)) {
|
||||
if (func(it, String(index), array)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ function filter(array, code) {
|
||||
var result = new Array();
|
||||
for (var index in array) {
|
||||
var it = array[index];
|
||||
if (func(it, index, array, result)) {
|
||||
if (func(it, String(index), array, result)) {
|
||||
result[result.length] = it;
|
||||
}
|
||||
}
|
||||
@ -1317,7 +1317,7 @@ function map(array, code) {
|
||||
var result = new Array();
|
||||
for (var index in array) {
|
||||
var it = array[index];
|
||||
result[result.length] = func(it, index, array, result);
|
||||
result[result.length] = func(it, String(index), array, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -518,7 +518,15 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
* @exception IOException if {@code pos} is less than
|
||||
* {@code 0} or if an I/O error occurs.
|
||||
*/
|
||||
public native void seek(long pos) throws IOException;
|
||||
public void seek(long pos) throws IOException {
|
||||
if (pos < 0) {
|
||||
throw new IOException("Negative seek offset");
|
||||
} else {
|
||||
seek0(pos);
|
||||
}
|
||||
}
|
||||
|
||||
private native void seek0(long pos) throws IOException;
|
||||
|
||||
/**
|
||||
* Returns the length of this file.
|
||||
|
@ -825,7 +825,7 @@ public final class Math {
|
||||
public static int multiplyExact(int x, int y) {
|
||||
long r = (long)x * (long)y;
|
||||
if ((int)r != r) {
|
||||
throw new ArithmeticException("long overflow");
|
||||
throw new ArithmeticException("integer overflow");
|
||||
}
|
||||
return (int)r;
|
||||
}
|
||||
@ -856,6 +856,108 @@ public final class Math {
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the argument incremented by one, throwing an exception if the
|
||||
* result overflows an {@code int}.
|
||||
*
|
||||
* @param a the value to increment
|
||||
* @return the result
|
||||
* @throws ArithmeticException if the result overflows an int
|
||||
* @since 1.8
|
||||
*/
|
||||
public static int incrementExact(int a) {
|
||||
if (a == Integer.MAX_VALUE) {
|
||||
throw new ArithmeticException("integer overflow");
|
||||
}
|
||||
|
||||
return a + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the argument incremented by one, throwing an exception if the
|
||||
* result overflows a {@code long}.
|
||||
*
|
||||
* @param a the value to increment
|
||||
* @return the result
|
||||
* @throws ArithmeticException if the result overflows a long
|
||||
* @since 1.8
|
||||
*/
|
||||
public static long incrementExact(long a) {
|
||||
if (a == Long.MAX_VALUE) {
|
||||
throw new ArithmeticException("long overflow");
|
||||
}
|
||||
|
||||
return a + 1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the argument decremented by one, throwing an exception if the
|
||||
* result overflows an {@code int}.
|
||||
*
|
||||
* @param a the value to decrement
|
||||
* @return the result
|
||||
* @throws ArithmeticException if the result overflows an int
|
||||
* @since 1.8
|
||||
*/
|
||||
public static int decrementExact(int a) {
|
||||
if (a == Integer.MIN_VALUE) {
|
||||
throw new ArithmeticException("integer overflow");
|
||||
}
|
||||
|
||||
return a - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the argument decremented by one, throwing an exception if the
|
||||
* result overflows a {@code long}.
|
||||
*
|
||||
* @param a the value to decrement
|
||||
* @return the result
|
||||
* @throws ArithmeticException if the result overflows a long
|
||||
* @since 1.8
|
||||
*/
|
||||
public static long decrementExact(long a) {
|
||||
if (a == Long.MIN_VALUE) {
|
||||
throw new ArithmeticException("long overflow");
|
||||
}
|
||||
|
||||
return a - 1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the negation of the argument, throwing an exception if the
|
||||
* result overflows an {@code int}.
|
||||
*
|
||||
* @param a the value to negate
|
||||
* @return the result
|
||||
* @throws ArithmeticException if the result overflows an int
|
||||
* @since 1.8
|
||||
*/
|
||||
public static int negateExact(int a) {
|
||||
if (a == Integer.MIN_VALUE) {
|
||||
throw new ArithmeticException("integer overflow");
|
||||
}
|
||||
|
||||
return -a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the negation of the argument, throwing an exception if the
|
||||
* result overflows a {@code long}.
|
||||
*
|
||||
* @param a the value to negate
|
||||
* @return the result
|
||||
* @throws ArithmeticException if the result overflows a long
|
||||
* @since 1.8
|
||||
*/
|
||||
public static long negateExact(long a) {
|
||||
if (a == Long.MIN_VALUE) {
|
||||
throw new ArithmeticException("long overflow");
|
||||
}
|
||||
|
||||
return -a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the {@code long} argument;
|
||||
* throwing an exception if the value overflows an {@code int}.
|
||||
|
@ -1242,6 +1242,9 @@ class MutableBigInteger {
|
||||
int r = intLen;
|
||||
int s = b.intLen;
|
||||
|
||||
// Clear the quotient
|
||||
quotient.offset = quotient.intLen = 0;
|
||||
|
||||
if (r < s) {
|
||||
return this;
|
||||
} else {
|
||||
@ -1276,7 +1279,6 @@ class MutableBigInteger {
|
||||
// do schoolbook division on blocks, dividing 2-block numbers by 1-block numbers
|
||||
MutableBigInteger qi = new MutableBigInteger();
|
||||
MutableBigInteger ri;
|
||||
quotient.offset = quotient.intLen = 0;
|
||||
for (int i=t-2; i > 0; i--) {
|
||||
// step 8a: compute (qi,ri) such that z=b*qi+ri
|
||||
ri = z.divide2n1n(bShifted, qi);
|
||||
|
@ -139,8 +139,7 @@ class DatagramPacket {
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int offset, int length,
|
||||
SocketAddress address) throws SocketException {
|
||||
public DatagramPacket(byte buf[], int offset, int length, SocketAddress address) {
|
||||
setData(buf, offset, length);
|
||||
setSocketAddress(address);
|
||||
}
|
||||
@ -175,8 +174,7 @@ class DatagramPacket {
|
||||
* @since 1.4
|
||||
* @see java.net.InetAddress
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int length,
|
||||
SocketAddress address) throws SocketException {
|
||||
public DatagramPacket(byte buf[], int length, SocketAddress address) {
|
||||
this(buf, 0, length, address);
|
||||
}
|
||||
|
||||
|
@ -113,11 +113,18 @@ public final class IDN {
|
||||
int p = 0, q = 0;
|
||||
StringBuffer out = new StringBuffer();
|
||||
|
||||
if (isRootLabel(input)) {
|
||||
return ".";
|
||||
}
|
||||
|
||||
while (p < input.length()) {
|
||||
q = searchDots(input, p);
|
||||
out.append(toASCIIInternal(input.substring(p, q), flag));
|
||||
if (q != (input.length())) {
|
||||
// has more labels, or keep the trailing dot as at present
|
||||
out.append('.');
|
||||
}
|
||||
p = q + 1;
|
||||
if (p < input.length()) out.append('.');
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
@ -167,11 +174,18 @@ public final class IDN {
|
||||
int p = 0, q = 0;
|
||||
StringBuffer out = new StringBuffer();
|
||||
|
||||
if (isRootLabel(input)) {
|
||||
return ".";
|
||||
}
|
||||
|
||||
while (p < input.length()) {
|
||||
q = searchDots(input, p);
|
||||
out.append(toUnicodeInternal(input.substring(p, q), flag));
|
||||
if (q != (input.length())) {
|
||||
// has more labels, or keep the trailing dot as at present
|
||||
out.append('.');
|
||||
}
|
||||
p = q + 1;
|
||||
if (p < input.length()) out.append('.');
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
@ -263,6 +277,13 @@ public final class IDN {
|
||||
dest = new StringBuffer(label);
|
||||
}
|
||||
|
||||
// step 8, move forward to check the smallest number of the code points
|
||||
// the length must be inside 1..63
|
||||
if (dest.length() == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Empty label is not a legal name");
|
||||
}
|
||||
|
||||
// step 3
|
||||
// Verify the absence of non-LDH ASCII code points
|
||||
// 0..0x2c, 0x2e..0x2f, 0x3a..0x40, 0x5b..0x60, 0x7b..0x7f
|
||||
@ -311,7 +332,7 @@ public final class IDN {
|
||||
|
||||
// step 8
|
||||
// the length must be inside 1..63
|
||||
if(dest.length() > MAX_LABEL_LENGTH){
|
||||
if (dest.length() > MAX_LABEL_LENGTH) {
|
||||
throw new IllegalArgumentException("The label in the input is too long");
|
||||
}
|
||||
|
||||
@ -409,8 +430,7 @@ public final class IDN {
|
||||
private static int searchDots(String s, int start) {
|
||||
int i;
|
||||
for (i = start; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '.' || c == '\u3002' || c == '\uFF0E' || c == '\uFF61') {
|
||||
if (isLabelSeparator(s.charAt(i))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -418,6 +438,19 @@ public final class IDN {
|
||||
return i;
|
||||
}
|
||||
|
||||
//
|
||||
// to check if a string is a root label, ".".
|
||||
//
|
||||
private static boolean isRootLabel(String s) {
|
||||
return (s.length() == 1 && isLabelSeparator(s.charAt(0)));
|
||||
}
|
||||
|
||||
//
|
||||
// to check if a character is a label separator, i.e. a dot character.
|
||||
//
|
||||
private static boolean isLabelSeparator(char c) {
|
||||
return (c == '.' || c == '\u3002' || c == '\uFF0E' || c == '\uFF61');
|
||||
}
|
||||
|
||||
//
|
||||
// to check if a string only contains US-ASCII code point
|
||||
|
@ -1601,7 +1601,6 @@ class InetAddress implements java.io.Serializable {
|
||||
pf.put("address", holder().getAddress());
|
||||
pf.put("family", holder().getFamily());
|
||||
s.writeFields();
|
||||
s.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,6 @@ import sun.security.util.SecurityConstants;
|
||||
* <p>
|
||||
* The classes that are loaded are by default granted permission only to
|
||||
* access the URLs specified when the URLClassLoader was created.
|
||||
* <p>
|
||||
* Where a JAR file contains the {@link Name#PROFILE Profile} attribute
|
||||
* then its value is the name of the Java SE profile that the library
|
||||
* minimally requires. If this runtime does not support the profile then
|
||||
* it causes {@link java.util.jar.UnsupportedProfileException} to be
|
||||
* thrown at some unspecified time.
|
||||
*
|
||||
* @author David Connelly
|
||||
* @since 1.2
|
||||
|
@ -98,7 +98,7 @@ import javax.xml.transform.Source;
|
||||
* or, to set the result value from SAX events:
|
||||
* <pre>
|
||||
* SAXResult saxResult = sqlxml.setResult(SAXResult.class);
|
||||
* ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
|
||||
* ContentHandler contentHandler = saxResult.getHandler();
|
||||
* contentHandler.startDocument();
|
||||
* // set the XML elements and attributes into the result
|
||||
* contentHandler.endDocument();
|
||||
|
@ -107,7 +107,7 @@ public final class JapaneseEra
|
||||
* The singleton instance for the 'Meiji' era (1868-09-08 - 1912-07-29)
|
||||
* which has the value -1.
|
||||
*/
|
||||
public static final JapaneseEra MEIJI = new JapaneseEra(-1, LocalDate.of(1868, 9, 8));
|
||||
public static final JapaneseEra MEIJI = new JapaneseEra(-1, LocalDate.of(1868, 1, 1));
|
||||
/**
|
||||
* The singleton instance for the 'Taisho' era (1912-07-30 - 1926-12-24)
|
||||
* which has the value 0.
|
||||
|
@ -888,6 +888,19 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
||||
elements[i] = s.readObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* deque.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
|
||||
* {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
|
||||
* {@link Spliterator#NONNULL}. Overriding implementations should document
|
||||
* the reporting of additional characteristic values.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this deque
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new DeqSpliterator<E>(this, -1, -1);
|
||||
}
|
||||
|
@ -1238,6 +1238,20 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* list.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
|
||||
* {@link Spliterator#SUBSIZED}, and {@link Spliterator#ORDERED}.
|
||||
* Overriding implementations should document the reporting of additional
|
||||
* characteristic values.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this list
|
||||
* @since 1.8
|
||||
*/
|
||||
@Override
|
||||
public Spliterator<E> spliterator() {
|
||||
return new ArrayListSpliterator<>(this, 0, -1, 0);
|
||||
}
|
||||
|
@ -504,7 +504,10 @@ public interface Collection<E> extends Iterable<E> {
|
||||
*
|
||||
* <p>The returned {@code Spliterator} must report the characteristic
|
||||
* {@link Spliterator#SIZED}; implementations should document any additional
|
||||
* characteristic values reported by the returned Spliterator.
|
||||
* characteristic values reported by the returned spliterator. If
|
||||
* this collection contains no elements then the returned spliterator is
|
||||
* only required to report {@link Spliterator#SIZED} and is not required to
|
||||
* report additional characteristic values (if any).
|
||||
*
|
||||
* <p>The default implementation should be overridden by subclasses that
|
||||
* can return a more efficient spliterator. In order to
|
||||
@ -535,6 +538,14 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* The returned {@code Spliterator} additionally reports
|
||||
* {@link Spliterator#SUBSIZED}.
|
||||
*
|
||||
* <p>If a spliterator covers no elements then the reporting of additional
|
||||
* characteristic values, beyond that of {@code SIZED} and {@code SUBSIZED},
|
||||
* does not aid clients to control, specialize or simplify computation.
|
||||
* However, this does enable shared use of an immutable and empty
|
||||
* spliterator instance (see {@link Spliterators#emptySpliterator()}) for
|
||||
* empty collections, and enables clients to determine if such a spliterator
|
||||
* covers no elements.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this collection
|
||||
* @since 1.8
|
||||
*/
|
||||
|
@ -4508,7 +4508,6 @@ public class Collections {
|
||||
}
|
||||
@Override
|
||||
public void sort(Comparator<? super E> c) {
|
||||
Objects.requireNonNull(c);
|
||||
}
|
||||
|
||||
// Override default methods in Collection
|
||||
|
@ -28,7 +28,7 @@ formatVersion=1
|
||||
# Version of the currency code information in this class.
|
||||
# It is a serial number that accompanies with each amendment.
|
||||
|
||||
dataVersion=155
|
||||
dataVersion=156
|
||||
|
||||
# List of all valid ISO 4217 currency codes.
|
||||
# To ensure compatibility, do not remove codes.
|
||||
@ -320,7 +320,7 @@ KG=KGS
|
||||
# LAO PEOPLE'S DEMOCRATIC REPUBLIC
|
||||
LA=LAK
|
||||
# LATVIA
|
||||
LV=LVL
|
||||
LV=LVL;2013-12-31-22-00-00;EUR
|
||||
# LEBANON
|
||||
LB=LBP
|
||||
# LESOTHO
|
||||
|
@ -4196,7 +4196,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
case DateTime.CENTURY: // 'C' (00 - 99)
|
||||
case DateTime.YEAR_2: // 'y' (00 - 99)
|
||||
case DateTime.YEAR_4: { // 'Y' (0000 - 9999)
|
||||
int i = t.get(ChronoField.YEAR);
|
||||
int i = t.get(ChronoField.YEAR_OF_ERA);
|
||||
int size = 2;
|
||||
switch (c) {
|
||||
case DateTime.CENTURY:
|
||||
|
@ -312,6 +312,18 @@ public class HashSet<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* set.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED} and
|
||||
* {@link Spliterator#DISTINCT}. Overriding implementations should document
|
||||
* the reporting of additional characteristic values.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this set
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new HashMap.KeySpliterator<E,Object>(map, 0, -1, 0, 0);
|
||||
}
|
||||
|
@ -129,10 +129,20 @@ import java.util.function.BiFunction;
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
*
|
||||
* <p>The spliterators returned by the spliterator method of the collections
|
||||
* returned by all of this class's collection view methods are
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em>,
|
||||
* <em>fail-fast</em>, and additionally report {@link Spliterator#ORDERED}.
|
||||
*
|
||||
* <p>This class is a member of the
|
||||
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
|
||||
* Java Collections Framework</a>.
|
||||
*
|
||||
* @implNote
|
||||
* The spliterators returned by the spliterator method of the collections
|
||||
* returned by all of this class's collection view methods are created from
|
||||
* the iterators of the corresponding collections.
|
||||
*
|
||||
* @param <K> the type of keys maintained by this map
|
||||
* @param <V> the type of mapped values
|
||||
*
|
||||
|
@ -170,13 +170,23 @@ public class LinkedHashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@code Spliterator}, over the elements in this set, that
|
||||
* reports {@code SIZED}, {@code DISTINCT} and {@code ORDERED}.
|
||||
* Overriding implementations are expected to document if the
|
||||
* {@code Spliterator} reports any additional and relevant characteristic
|
||||
* values.
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@code Spliterator} over the elements in this set.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
|
||||
* {@link Spliterator#DISTINCT}, and {@code ORDERED}. Implementations
|
||||
* should document the reporting of additional characteristic values.
|
||||
*
|
||||
* @implNote
|
||||
* The implementation creates a
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em> spliterator
|
||||
* from the set's {@code Iterator}. The spliterator inherits the
|
||||
* <em>fail-fast</em> properties of the set's iterator.
|
||||
* The created {@code Spliterator} additionally reports
|
||||
* {@link Spliterator#SUBSIZED}.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this set
|
||||
* @since 1.8
|
||||
*/
|
||||
@Override
|
||||
public Spliterator<E> spliterator() {
|
||||
|
@ -1149,6 +1149,23 @@ public class LinkedList<E>
|
||||
linkLast((E)s.readObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* list.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED} and
|
||||
* {@link Spliterator#ORDERED}. Overriding implementations should document
|
||||
* the reporting of additional characteristic values.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} additionally reports {@link Spliterator#SUBSIZED}
|
||||
* and implements {@code trySplit} to permit limited parallelism..
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this list
|
||||
* @since 1.8
|
||||
*/
|
||||
@Override
|
||||
public Spliterator<E> spliterator() {
|
||||
return new LLSpliterator<E>(this, -1, 0);
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ public interface List<E> extends Collection<E> {
|
||||
* The default implementation creates a
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em> spliterator
|
||||
* from the list's {@code Iterator}. The spliterator inherits the
|
||||
* <em>fail-fast</em> properties of the collection's iterator.
|
||||
* <em>fail-fast</em> properties of the list's iterator.
|
||||
*
|
||||
* @implNote
|
||||
* The created {@code Spliterator} additionally reports
|
||||
|
@ -795,6 +795,19 @@ public class PriorityQueue<E> extends AbstractQueue<E>
|
||||
heapify();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* queue.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
|
||||
* {@link Spliterator#SUBSIZED}, and {@link Spliterator#NONNULL}.
|
||||
* Overriding implementations should document the reporting of additional
|
||||
* characteristic values.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this queue
|
||||
* @since 1.8
|
||||
*/
|
||||
public final Spliterator<E> spliterator() {
|
||||
return new PriorityQueueSpliterator<E>(this, 0, -1, 0);
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ public interface Set<E> extends Collection<E> {
|
||||
* The default implementation creates a
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em> spliterator
|
||||
* from the set's {@code Iterator}. The spliterator inherits the
|
||||
* <em>fail-fast</em> properties of the collection's iterator.
|
||||
* <em>fail-fast</em> properties of the set's iterator.
|
||||
*
|
||||
* @implNote
|
||||
* The created {@code Spliterator} additionally reports
|
||||
|
@ -238,7 +238,7 @@ public interface SortedSet<E> extends Set<E> {
|
||||
* The default implementation creates a
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em> spliterator
|
||||
* from the sorted set's {@code Iterator}. The spliterator inherits the
|
||||
* <em>fail-fast</em> properties of the collection's iterator. The
|
||||
* <em>fail-fast</em> properties of the set's iterator. The
|
||||
* spliterator's comparator is the same as the sorted set's comparator.
|
||||
*
|
||||
* @implNote
|
||||
|
@ -74,7 +74,11 @@ import java.util.function.LongConsumer;
|
||||
* source prior to binding are reflected when the Spliterator is traversed.
|
||||
* After binding a Spliterator should, on a best-effort basis, throw
|
||||
* {@link ConcurrentModificationException} if structural interference is
|
||||
* detected. Spliterators that do this are called <em>fail-fast</em>.
|
||||
* detected. Spliterators that do this are called <em>fail-fast</em>. The
|
||||
* bulk traversal method ({@link #forEachRemaining forEachRemaining()}) of a
|
||||
* Spliterator may optimize traversal and check for structural interference
|
||||
* after all elements have been traversed, rather than checking per-element and
|
||||
* failing immediately.
|
||||
*
|
||||
* <p>Spliterators can provide an estimate of the number of remaining elements
|
||||
* via the {@link #estimateSize} method. Ideally, as reflected in characteristic
|
||||
|
@ -790,8 +790,19 @@ public class TreeMap<K,V>
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the keys contained in this map.
|
||||
* The set's iterator returns the keys in ascending order.
|
||||
* The set is backed by the map, so changes to the map are
|
||||
*
|
||||
* <p>The set's iterator returns the keys in ascending order.
|
||||
* The set's spliterator is
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em>,
|
||||
* <em>fail-fast</em>, and additionally reports {@link Spliterator#SORTED}
|
||||
* and {@link Spliterator#ORDERED} with an encounter order that is ascending
|
||||
* key order. The spliterator's comparator (see
|
||||
* {@link java.util.Spliterator#getComparator()}) is {@code null} if
|
||||
* the tree map's comparator (see {@link #comparator()}) is {@code null}.
|
||||
* Otherwise, the spliterator's comparator is the same as or imposes the
|
||||
* same total ordering as the tree map's comparator.
|
||||
*
|
||||
* <p>The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own {@code remove} operation), the results of
|
||||
@ -823,9 +834,15 @@ public class TreeMap<K,V>
|
||||
|
||||
/**
|
||||
* Returns a {@link Collection} view of the values contained in this map.
|
||||
* The collection's iterator returns the values in ascending order
|
||||
* of the corresponding keys.
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
*
|
||||
* <p>The collection's iterator returns the values in ascending order
|
||||
* of the corresponding keys. The collection's spliterator is
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em>,
|
||||
* <em>fail-fast</em>, and additionally reports {@link Spliterator#ORDERED}
|
||||
* with an encounter order that is ascending order of the corresponding
|
||||
* keys.
|
||||
*
|
||||
* <p>The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. If the map is
|
||||
* modified while an iteration over the collection is in progress
|
||||
* (except through the iterator's own {@code remove} operation),
|
||||
@ -843,8 +860,15 @@ public class TreeMap<K,V>
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the mappings contained in this map.
|
||||
* The set's iterator returns the entries in ascending key order.
|
||||
* The set is backed by the map, so changes to the map are
|
||||
*
|
||||
* <p>The set's iterator returns the entries in ascending key order. The
|
||||
* sets's spliterator is
|
||||
* <em><a href="Spliterator.html#binding">late-binding</a></em>,
|
||||
* <em>fail-fast</em>, and additionally reports {@link Spliterator#SORTED} and
|
||||
* {@link Spliterator#ORDERED} with an encounter order that is ascending key
|
||||
* order.
|
||||
*
|
||||
* <p>The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own {@code remove} operation, or through the
|
||||
@ -2944,16 +2968,11 @@ public class TreeMap<K,V>
|
||||
|
||||
@Override
|
||||
public Comparator<Map.Entry<K, V>> getComparator() {
|
||||
// Since SORTED is reported and Map.Entry elements are not comparable
|
||||
// then a non-null comparator needs to be returned
|
||||
// Adapt or create a key-based comparator
|
||||
if (tree.comparator != null) {
|
||||
// Adapt the existing non-null comparator to compare entries
|
||||
// by key
|
||||
return Map.Entry.comparingByKey(tree.comparator);
|
||||
}
|
||||
else {
|
||||
// Return a comparator of entries by key, with K assumed to be
|
||||
// of Comparable
|
||||
return (Comparator<Map.Entry<K, V>> & Serializable) (e1, e2) -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
Comparable<? super K> k1 = (Comparable<? super K>) e1.getKey();
|
||||
|
@ -533,6 +533,25 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
tm.readTreeSet(size, s, PRESENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* set.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
|
||||
* {@link Spliterator#DISTINCT}, {@link Spliterator#SORTED}, and
|
||||
* {@link Spliterator#ORDERED}. Overriding implementations should document
|
||||
* the reporting of additional characteristic values.
|
||||
*
|
||||
* <p>The spliterator's comparator (see
|
||||
* {@link java.util.Spliterator#getComparator()}) is {@code null} if
|
||||
* the tree set's comparator (see {@link #comparator()}) is {@code null}.
|
||||
* Otherwise, the spliterator's comparator is the same as or imposes the
|
||||
* same total ordering as the tree set's comparator.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this set
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return TreeMap.keySpliteratorFor(m);
|
||||
}
|
||||
|
@ -1323,6 +1323,19 @@ public class Vector<E>
|
||||
modCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
|
||||
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
|
||||
* list.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
|
||||
* {@link Spliterator#SUBSIZED}, and {@link Spliterator#ORDERED}.
|
||||
* Overriding implementations should document the reporting of additional
|
||||
* characteristic values.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this list
|
||||
* @since 1.8
|
||||
*/
|
||||
@Override
|
||||
public Spliterator<E> spliterator() {
|
||||
return new VectorSpliterator<>(this, null, 0, -1, 0);
|
||||
|
@ -757,12 +757,8 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
|
||||
* Returns an iterator over the elements in this queue in proper sequence.
|
||||
* The elements will be returned in order from first (head) to last (tail).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this queue in proper sequence
|
||||
*/
|
||||
@ -1396,9 +1392,26 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this queue.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} implements {@code trySplit} to permit limited
|
||||
* parallelism.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this queue
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return Spliterators.spliterator
|
||||
(this, Spliterator.ORDERED | Spliterator.NONNULL |
|
||||
Spliterator.CONCURRENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -420,6 +420,7 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
|
||||
}
|
||||
|
||||
/** Base class can act as either FJ or plain Runnable */
|
||||
@SuppressWarnings("serial")
|
||||
abstract static class Async extends ForkJoinTask<Void>
|
||||
implements Runnable, AsynchronousCompletionTask {
|
||||
public final Void getRawResult() { return null; }
|
||||
@ -671,6 +672,7 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
|
||||
}
|
||||
|
||||
// Opportunistically subclass AtomicInteger to use compareAndSet to claim.
|
||||
@SuppressWarnings("serial")
|
||||
abstract static class Completion extends AtomicInteger implements Runnable {
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ import java.util.AbstractMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
@ -94,14 +93,14 @@ import java.util.stream.Stream;
|
||||
* that key reporting the updated value.) For aggregate operations
|
||||
* such as {@code putAll} and {@code clear}, concurrent retrievals may
|
||||
* reflect insertion or removal of only some entries. Similarly,
|
||||
* Iterators and Enumerations return elements reflecting the state of
|
||||
* the hash table at some point at or since the creation of the
|
||||
* Iterators, Spliterators and Enumerations return elements reflecting the
|
||||
* state of the hash table at some point at or since the creation of the
|
||||
* iterator/enumeration. They do <em>not</em> throw {@link
|
||||
* ConcurrentModificationException}. However, iterators are designed
|
||||
* to be used by only one thread at a time. Bear in mind that the
|
||||
* results of aggregate status methods including {@code size}, {@code
|
||||
* isEmpty}, and {@code containsValue} are typically useful only when
|
||||
* a map is not undergoing concurrent updates in other threads.
|
||||
* java.util.ConcurrentModificationException ConcurrentModificationException}.
|
||||
* However, iterators are designed to be used by only one thread at a time.
|
||||
* Bear in mind that the results of aggregate status methods including
|
||||
* {@code size}, {@code isEmpty}, and {@code containsValue} are typically
|
||||
* useful only when a map is not undergoing concurrent updates in other threads.
|
||||
* Otherwise the results of these methods reflect transient states
|
||||
* that may be adequate for monitoring or estimation purposes, but not
|
||||
* for program control.
|
||||
@ -1200,11 +1199,11 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
* operations. It does not support the {@code add} or
|
||||
* {@code addAll} operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator
|
||||
* that will never throw {@link ConcurrentModificationException},
|
||||
* and guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The view's {@code spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#DISTINCT}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @return the set view
|
||||
*/
|
||||
@ -1223,11 +1222,11 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
* {@code retainAll}, and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator
|
||||
* that will never throw {@link ConcurrentModificationException},
|
||||
* and guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The view's {@code spliterator} reports {@link Spliterator#CONCURRENT}
|
||||
* and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @return the collection view
|
||||
*/
|
||||
@ -1245,11 +1244,11 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
* {@code removeAll}, {@code retainAll}, and {@code clear}
|
||||
* operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator
|
||||
* that will never throw {@link ConcurrentModificationException},
|
||||
* and guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The view's {@code spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#DISTINCT}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @return the set view
|
||||
*/
|
||||
@ -2785,7 +2784,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((s | WAITER) == 0) {
|
||||
else if ((s & WAITER) == 0) {
|
||||
if (U.compareAndSwapInt(this, LOCKSTATE, s, s | WAITER)) {
|
||||
waiting = true;
|
||||
waiter = Thread.currentThread();
|
||||
@ -4308,12 +4307,12 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
// implementations below rely on concrete classes supplying these
|
||||
// abstract methods
|
||||
/**
|
||||
* Returns a "weakly consistent" iterator that will never
|
||||
* throw {@link ConcurrentModificationException}, and
|
||||
* guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not
|
||||
* guaranteed to) reflect any modifications subsequent to
|
||||
* construction.
|
||||
* Returns an iterator over the elements in this collection.
|
||||
*
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this collection
|
||||
*/
|
||||
public abstract Iterator<E> iterator();
|
||||
public abstract boolean contains(Object o);
|
||||
@ -4716,6 +4715,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
* Base class for bulk tasks. Repeats some fields and code from
|
||||
* class Traverser, because we need to subclass CountedCompleter.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
abstract static class BulkTask<K,V,R> extends CountedCompleter<R> {
|
||||
Node<K,V>[] tab; // same as Traverser
|
||||
Node<K,V> next;
|
||||
|
@ -55,12 +55,8 @@ import java.util.function.Consumer;
|
||||
* Like most other concurrent collection implementations, this class
|
||||
* does not permit the use of {@code null} elements.
|
||||
*
|
||||
* <p>Iterators are <i>weakly consistent</i>, returning elements
|
||||
* reflecting the state of the deque at some point at or since the
|
||||
* creation of the iterator. They do <em>not</em> throw {@link
|
||||
* java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and may proceed concurrently with
|
||||
* other operations.
|
||||
* <p>Iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>Beware that, unlike in most collections, the {@code size} method
|
||||
* is <em>NOT</em> a constant-time operation. Because of the
|
||||
@ -1290,12 +1286,8 @@ public class ConcurrentLinkedDeque<E>
|
||||
* Returns an iterator over the elements in this deque in proper sequence.
|
||||
* The elements will be returned in order from first (head) to last (tail).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this deque in proper sequence
|
||||
*/
|
||||
@ -1308,12 +1300,8 @@ public class ConcurrentLinkedDeque<E>
|
||||
* sequential order. The elements will be returned in order from
|
||||
* last (tail) to first (head).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this deque in reverse order
|
||||
*/
|
||||
@ -1493,6 +1481,22 @@ public class ConcurrentLinkedDeque<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this deque.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} implements {@code trySplit} to permit limited
|
||||
* parallelism.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this deque
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new CLDSpliterator<E>(this);
|
||||
}
|
||||
@ -1500,6 +1504,8 @@ public class ConcurrentLinkedDeque<E>
|
||||
/**
|
||||
* Saves this deque to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData All of the elements (each an {@code E}) in
|
||||
* the proper order, followed by a null
|
||||
*/
|
||||
@ -1522,6 +1528,10 @@ public class ConcurrentLinkedDeque<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this deque from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
|
@ -654,12 +654,8 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
* Returns an iterator over the elements in this queue in proper sequence.
|
||||
* The elements will be returned in order from first (head) to last (tail).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this queue in proper sequence
|
||||
*/
|
||||
@ -749,6 +745,8 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
/**
|
||||
* Saves this queue to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData All of the elements (each an {@code E}) in
|
||||
* the proper order, followed by a null
|
||||
*/
|
||||
@ -771,6 +769,10 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this queue from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
@ -881,6 +883,23 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this queue.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} implements {@code trySplit} to permit limited
|
||||
* parallelism.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this queue
|
||||
* @since 1.8
|
||||
*/
|
||||
@Override
|
||||
public Spliterator<E> spliterator() {
|
||||
return new CLQSpliterator<E>(this);
|
||||
}
|
||||
|
@ -120,11 +120,8 @@ public interface ConcurrentNavigableMap<K,V>
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator
|
||||
* that will never throw {@link ConcurrentModificationException},
|
||||
* and guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return a navigable set view of the keys in this map
|
||||
*/
|
||||
@ -141,11 +138,8 @@ public interface ConcurrentNavigableMap<K,V>
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator
|
||||
* that will never throw {@link ConcurrentModificationException},
|
||||
* and guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>This method is equivalent to method {@code navigableKeySet}.
|
||||
*
|
||||
@ -164,11 +158,8 @@ public interface ConcurrentNavigableMap<K,V>
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator
|
||||
* that will never throw {@link ConcurrentModificationException},
|
||||
* and guarantees to traverse elements as they existed upon
|
||||
* construction of the iterator, and may (but is not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return a reverse order navigable set view of the keys in this map
|
||||
*/
|
||||
|
@ -34,6 +34,7 @@
|
||||
*/
|
||||
|
||||
package java.util.concurrent;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractCollection;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractSet;
|
||||
@ -44,11 +45,15 @@ import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.Spliterator;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentNavigableMap;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.BiConsumer;
|
||||
@ -66,12 +71,13 @@ import java.util.function.Function;
|
||||
* {@code containsKey}, {@code get}, {@code put} and
|
||||
* {@code remove} operations and their variants. Insertion, removal,
|
||||
* update, and access operations safely execute concurrently by
|
||||
* multiple threads. Iterators are <i>weakly consistent</i>, returning
|
||||
* elements reflecting the state of the map at some point at or since
|
||||
* the creation of the iterator. They do <em>not</em> throw {@link
|
||||
* java.util.ConcurrentModificationException ConcurrentModificationException},
|
||||
* and may proceed concurrently with other operations. Ascending key ordered
|
||||
* views and their iterators are faster than descending ones.
|
||||
* multiple threads.
|
||||
*
|
||||
* <p>Iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>Ascending key ordered views and their iterators are faster than
|
||||
* descending ones.
|
||||
*
|
||||
* <p>All {@code Map.Entry} pairs returned by methods in this class
|
||||
* and its views represent snapshots of mappings at the time they were
|
||||
@ -108,9 +114,7 @@ import java.util.function.Function;
|
||||
* @since 1.6
|
||||
*/
|
||||
public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
implements ConcurrentNavigableMap<K,V>,
|
||||
Cloneable,
|
||||
java.io.Serializable {
|
||||
implements ConcurrentNavigableMap<K,V>, Cloneable, Serializable {
|
||||
/*
|
||||
* This class implements a tree-like two-dimensionally linked skip
|
||||
* list in which the index levels are represented in separate
|
||||
@ -1412,6 +1416,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
/**
|
||||
* Saves this map to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData The key (Object) and value (Object) for each
|
||||
* key-value mapping represented by the map, followed by
|
||||
* {@code null}. The key-value mappings are emitted in key-order
|
||||
@ -1436,6 +1442,10 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
|
||||
/**
|
||||
* Reconstitutes this map from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(final java.io.ObjectInputStream s)
|
||||
@ -1795,8 +1805,18 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
|
||||
/**
|
||||
* Returns a {@link NavigableSet} view of the keys contained in this map.
|
||||
* The set's iterator returns the keys in ascending order.
|
||||
* The set is backed by the map, so changes to the map are
|
||||
*
|
||||
* <p>The set's iterator returns the keys in ascending order.
|
||||
* The set's spliterator additionally reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#NONNULL}, {@link Spliterator#SORTED} and
|
||||
* {@link Spliterator#ORDERED}, with an encounter order that is ascending
|
||||
* key order. The spliterator's comparator (see
|
||||
* {@link java.util.Spliterator#getComparator()}) is {@code null} if
|
||||
* the map's comparator (see {@link #comparator()}) is {@code null}.
|
||||
* Otherwise, the spliterator's comparator is the same as or imposes the
|
||||
* same total ordering as the map's comparator.
|
||||
*
|
||||
* <p>The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. The set supports element
|
||||
* removal, which removes the corresponding mapping from the map,
|
||||
* via the {@code Iterator.remove}, {@code Set.remove},
|
||||
@ -1804,11 +1824,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse elements
|
||||
* as they existed upon construction of the iterator, and may (but is not
|
||||
* guaranteed to) reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>This method is equivalent to method {@code navigableKeySet}.
|
||||
*
|
||||
@ -1826,9 +1843,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
|
||||
/**
|
||||
* Returns a {@link Collection} view of the values contained in this map.
|
||||
* The collection's iterator returns the values in ascending order
|
||||
* of the corresponding keys.
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
* <p>The collection's iterator returns the values in ascending order
|
||||
* of the corresponding keys. The collections's spliterator additionally
|
||||
* reports {@link Spliterator#CONCURRENT}, {@link Spliterator#NONNULL} and
|
||||
* {@link Spliterator#ORDERED}, with an encounter order that is ascending
|
||||
* order of the corresponding keys.
|
||||
*
|
||||
* <p>The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
@ -1836,11 +1857,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
* {@code retainAll} and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse elements
|
||||
* as they existed upon construction of the iterator, and may (but is not
|
||||
* guaranteed to) reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*/
|
||||
public Collection<V> values() {
|
||||
Values<V> vs = values;
|
||||
@ -1849,8 +1867,14 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the mappings contained in this map.
|
||||
* The set's iterator returns the entries in ascending key order.
|
||||
* The set is backed by the map, so changes to the map are
|
||||
*
|
||||
* <p>The set's iterator returns the entries in ascending key order. The
|
||||
* set's spliterator additionally reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#NONNULL}, {@link Spliterator#SORTED} and
|
||||
* {@link Spliterator#ORDERED}, with an encounter order that is ascending
|
||||
* key order.
|
||||
*
|
||||
* <p>The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. The set supports element
|
||||
* removal, which removes the corresponding mapping from the map,
|
||||
* via the {@code Iterator.remove}, {@code Set.remove},
|
||||
@ -1858,15 +1882,12 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
* operations. It does not support the {@code add} or
|
||||
* {@code addAll} operations.
|
||||
*
|
||||
* <p>The view's {@code iterator} is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse elements
|
||||
* as they existed upon construction of the iterator, and may (but is not
|
||||
* guaranteed to) reflect any modifications subsequent to construction.
|
||||
* <p>The view's iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Map.Entry} elements returned by
|
||||
* {@code iterator.next()} do <em>not</em> support the
|
||||
* {@code setValue} operation.
|
||||
* <p>The {@code Map.Entry} elements traversed by the {@code iterator}
|
||||
* or {@code spliterator} do <em>not</em> support the {@code setValue}
|
||||
* operation.
|
||||
*
|
||||
* @return a set view of the mappings contained in this map,
|
||||
* sorted in ascending key order
|
||||
@ -2548,8 +2569,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
* @serial include
|
||||
*/
|
||||
static final class SubMap<K,V> extends AbstractMap<K,V>
|
||||
implements ConcurrentNavigableMap<K,V>, Cloneable,
|
||||
java.io.Serializable {
|
||||
implements ConcurrentNavigableMap<K,V>, Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -7647078645895051609L;
|
||||
|
||||
/** Underlying map */
|
||||
@ -3180,6 +3200,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
public long estimateSize() {
|
||||
return Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final class SubMapValueIterator extends SubMapIter<V> {
|
||||
@ -3434,7 +3455,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
public int characteristics() {
|
||||
return Spliterator.CONCURRENT | Spliterator.NONNULL;
|
||||
return Spliterator.CONCURRENT | Spliterator.ORDERED |
|
||||
Spliterator.NONNULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3528,8 +3550,17 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
public final Comparator<Map.Entry<K,V>> getComparator() {
|
||||
return comparator == null ? null :
|
||||
Map.Entry.comparingByKey(comparator);
|
||||
// Adapt or create a key-based comparator
|
||||
if (comparator != null) {
|
||||
return Map.Entry.comparingByKey(comparator);
|
||||
}
|
||||
else {
|
||||
return (Comparator<Map.Entry<K,V>> & Serializable) (e1, e2) -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
Comparable<? super K> k1 = (Comparable<? super K>) e1.getKey();
|
||||
return k1.compareTo(e2.getKey());
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,12 @@ import java.util.Spliterator;
|
||||
* cost for the {@code contains}, {@code add}, and {@code remove}
|
||||
* operations and their variants. Insertion, removal, and access
|
||||
* operations safely execute concurrently by multiple threads.
|
||||
* Iterators are <i>weakly consistent</i>, returning elements
|
||||
* reflecting the state of the set at some point at or since the
|
||||
* creation of the iterator. They do <em>not</em> throw {@link
|
||||
* java.util.ConcurrentModificationException}, and may proceed
|
||||
* concurrently with other operations. Ascending ordered views and
|
||||
* their iterators are faster than descending ones.
|
||||
*
|
||||
* <p>Iterators and spliterators are
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>Ascending ordered views and their iterators are faster than
|
||||
* descending ones.
|
||||
*
|
||||
* <p>Beware that, unlike in most collections, the {@code size}
|
||||
* method is <em>not</em> a constant-time operation. Because of the
|
||||
@ -480,6 +480,24 @@ public class ConcurrentSkipListSet<E>
|
||||
return new ConcurrentSkipListSet<E>(m.descendingMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this set.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#NONNULL}, {@link Spliterator#DISTINCT},
|
||||
* {@link Spliterator#SORTED} and {@link Spliterator#ORDERED}, with an
|
||||
* encounter order that is ascending order. Overriding implementations
|
||||
* should document the reporting of additional characteristic values.
|
||||
*
|
||||
* <p>The spliterator's comparator (see
|
||||
* {@link java.util.Spliterator#getComparator()}) is {@code null} if
|
||||
* the set's comparator (see {@link #comparator()}) is {@code null}.
|
||||
* Otherwise, the spliterator's comparator is the same as or imposes the
|
||||
* same total ordering as the set's comparator.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this set
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Spliterator<E> spliterator() {
|
||||
if (m instanceof ConcurrentSkipListMap)
|
||||
|
@ -952,6 +952,8 @@ public class CopyOnWriteArrayList<E>
|
||||
/**
|
||||
* Saves this list to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData The length of the array backing the list is emitted
|
||||
* (int), followed by all of its elements (each an Object)
|
||||
* in the proper order.
|
||||
@ -972,6 +974,10 @@ public class CopyOnWriteArrayList<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this list from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
@ -1092,15 +1098,29 @@ public class CopyOnWriteArrayList<E>
|
||||
*
|
||||
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||
*/
|
||||
public ListIterator<E> listIterator(final int index) {
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
Object[] elements = getArray();
|
||||
int len = elements.length;
|
||||
if (index<0 || index>len)
|
||||
if (index < 0 || index > len)
|
||||
throw new IndexOutOfBoundsException("Index: "+index);
|
||||
|
||||
return new COWIterator<E>(elements, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this list.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#IMMUTABLE},
|
||||
* {@link Spliterator#ORDERED}, {@link Spliterator#SIZED}, and
|
||||
* {@link Spliterator#SUBSIZED}.
|
||||
*
|
||||
* <p>The spliterator provides a snapshot of the state of the list
|
||||
* when the spliterator was constructed. No synchronization is needed while
|
||||
* operating on the spliterator.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this list
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return Spliterators.spliterator
|
||||
(getArray(), Spliterator.IMMUTABLE | Spliterator.ORDERED);
|
||||
@ -1257,7 +1277,7 @@ public class CopyOnWriteArrayList<E>
|
||||
|
||||
// only call this holding l's lock
|
||||
private void rangeCheck(int index) {
|
||||
if (index<0 || index>=size)
|
||||
if (index < 0 || index >= size)
|
||||
throw new IndexOutOfBoundsException("Index: "+index+
|
||||
",Size: "+size);
|
||||
}
|
||||
@ -1304,7 +1324,7 @@ public class CopyOnWriteArrayList<E>
|
||||
lock.lock();
|
||||
try {
|
||||
checkForComodification();
|
||||
if (index<0 || index>size)
|
||||
if (index < 0 || index > size)
|
||||
throw new IndexOutOfBoundsException();
|
||||
l.add(index+offset, element);
|
||||
expectedArray = l.getArray();
|
||||
@ -1361,12 +1381,12 @@ public class CopyOnWriteArrayList<E>
|
||||
}
|
||||
}
|
||||
|
||||
public ListIterator<E> listIterator(final int index) {
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
final ReentrantLock lock = l.lock;
|
||||
lock.lock();
|
||||
try {
|
||||
checkForComodification();
|
||||
if (index<0 || index>size)
|
||||
if (index < 0 || index > size)
|
||||
throw new IndexOutOfBoundsException("Index: "+index+
|
||||
", Size: "+size);
|
||||
return new COWSubListIterator<E>(l, index, offset, size);
|
||||
@ -1380,7 +1400,7 @@ public class CopyOnWriteArrayList<E>
|
||||
lock.lock();
|
||||
try {
|
||||
checkForComodification();
|
||||
if (fromIndex<0 || toIndex>size)
|
||||
if (fromIndex < 0 || toIndex > size)
|
||||
throw new IndexOutOfBoundsException();
|
||||
return new COWSubList<E>(l, fromIndex + offset,
|
||||
toIndex + offset);
|
||||
@ -1580,6 +1600,7 @@ public class CopyOnWriteArrayList<E>
|
||||
return Spliterators.spliterator
|
||||
(a, lo, hi, Spliterator.IMMUTABLE | Spliterator.ORDERED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class COWSubListIterator<E> implements ListIterator<E> {
|
||||
|
@ -404,6 +404,21 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E>
|
||||
al.forEach(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this set in the order
|
||||
* in which these elements were added.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#IMMUTABLE},
|
||||
* {@link Spliterator#DISTINCT}, {@link Spliterator#SIZED}, and
|
||||
* {@link Spliterator#SUBSIZED}.
|
||||
*
|
||||
* <p>The spliterator provides a snapshot of the state of the set
|
||||
* when the spliterator was constructed. No synchronization is needed while
|
||||
* operating on the spliterator.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this set
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return Spliterators.spliterator
|
||||
(al.getArray(), Spliterator.IMMUTABLE | Spliterator.DISTINCT);
|
||||
|
@ -512,12 +512,8 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E>
|
||||
* unexpired) in this queue. The iterator does not return the
|
||||
* elements in any particular order.
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this queue
|
||||
*/
|
||||
|
@ -144,7 +144,8 @@ import java.util.concurrent.TimeUnit;
|
||||
* Upon any error in establishing these settings, default parameters
|
||||
* are used. It is possible to disable or limit the use of threads in
|
||||
* the common pool by setting the parallelism property to zero, and/or
|
||||
* using a factory that may return {@code null}.
|
||||
* using a factory that may return {@code null}. However doing so may
|
||||
* cause unjoined tasks to never be executed.
|
||||
*
|
||||
* <p><b>Implementation notes</b>: This implementation restricts the
|
||||
* maximum number of running threads to 32767. Attempts to create
|
||||
@ -3303,8 +3304,8 @@ public class ForkJoinPool extends AbstractExecutorService {
|
||||
}
|
||||
|
||||
if (parallelism < 0 && // default 1 less than #cores
|
||||
(parallelism = Runtime.getRuntime().availableProcessors() - 1) < 0)
|
||||
parallelism = 0;
|
||||
(parallelism = Runtime.getRuntime().availableProcessors() - 1) <= 0)
|
||||
parallelism = 1;
|
||||
if (parallelism > MAX_CAP)
|
||||
parallelism = MAX_CAP;
|
||||
return new ForkJoinPool(parallelism, factory, handler, LIFO_QUEUE,
|
||||
|
@ -1008,12 +1008,8 @@ public class LinkedBlockingDeque<E>
|
||||
* Returns an iterator over the elements in this deque in proper sequence.
|
||||
* The elements will be returned in order from first (head) to last (tail).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this deque in proper sequence
|
||||
*/
|
||||
@ -1026,12 +1022,8 @@ public class LinkedBlockingDeque<E>
|
||||
* sequential order. The elements will be returned in order from
|
||||
* last (tail) to first (head).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this deque in reverse order
|
||||
*/
|
||||
@ -1270,6 +1262,22 @@ public class LinkedBlockingDeque<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this deque.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} implements {@code trySplit} to permit limited
|
||||
* parallelism.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this deque
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new LBDSpliterator<E>(this);
|
||||
}
|
||||
@ -1277,6 +1285,8 @@ public class LinkedBlockingDeque<E>
|
||||
/**
|
||||
* Saves this deque to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData The capacity (int), followed by elements (each an
|
||||
* {@code Object}) in the proper order, followed by a null
|
||||
*/
|
||||
@ -1299,6 +1309,10 @@ public class LinkedBlockingDeque<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this deque from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
|
@ -766,12 +766,8 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E>
|
||||
* Returns an iterator over the elements in this queue in proper sequence.
|
||||
* The elements will be returned in order from first (head) to last (tail).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this queue in proper sequence
|
||||
*/
|
||||
@ -973,6 +969,22 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this queue.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} implements {@code trySplit} to permit limited
|
||||
* parallelism.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this queue
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new LBQSpliterator<E>(this);
|
||||
}
|
||||
@ -980,6 +992,8 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E>
|
||||
/**
|
||||
* Saves this queue to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData The capacity is emitted (int), followed by all of
|
||||
* its elements (each an {@code Object}) in the proper order,
|
||||
* followed by a null
|
||||
@ -1005,6 +1019,10 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this queue from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
|
@ -40,6 +40,7 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
@ -1018,6 +1019,22 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this queue.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
|
||||
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} implements {@code trySplit} to permit limited
|
||||
* parallelism.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this queue
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new LTQSpliterator<E>(this);
|
||||
}
|
||||
@ -1301,12 +1318,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
* Returns an iterator over the elements in this queue in proper sequence.
|
||||
* The elements will be returned in order from first (head) to last (tail).
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this queue in proper sequence
|
||||
*/
|
||||
@ -1407,6 +1420,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
/**
|
||||
* Saves this queue to a stream (that is, serializes it).
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
* @serialData All of the elements (each an {@code E}) in
|
||||
* the proper order, followed by a null
|
||||
*/
|
||||
@ -1421,6 +1436,10 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this queue from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
|
@ -864,12 +864,8 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
|
||||
* Returns an iterator over the elements in this queue. The
|
||||
* iterator does not return the elements in any particular order.
|
||||
*
|
||||
* <p>The returned iterator is a "weakly consistent" iterator that
|
||||
* will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}, and guarantees to traverse
|
||||
* elements as they existed upon construction of the iterator, and
|
||||
* may (but is not guaranteed to) reflect any modifications
|
||||
* subsequent to construction.
|
||||
* <p>The returned iterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* @return an iterator over the elements in this queue
|
||||
*/
|
||||
@ -915,6 +911,9 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
|
||||
* For compatibility with previous version of this class, elements
|
||||
* are first copied to a java.util.PriorityQueue, which is then
|
||||
* serialized.
|
||||
*
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void writeObject(java.io.ObjectOutputStream s)
|
||||
throws java.io.IOException {
|
||||
@ -932,6 +931,10 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this queue from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
@ -1005,6 +1008,21 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Spliterator} over the elements in this queue.
|
||||
*
|
||||
* <p>The returned spliterator is
|
||||
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
|
||||
*
|
||||
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED} and
|
||||
* {@link Spliterator#NONNULL}.
|
||||
*
|
||||
* @implNote
|
||||
* The {@code Spliterator} additionally reports {@link Spliterator#SUBSIZED}.
|
||||
*
|
||||
* @return a {@code Spliterator} over the elements in this queue
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return new PBQSpliterator<E>(this, null, 0, -1);
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ package java.util.concurrent;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.*;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
|
||||
/**
|
||||
* A {@linkplain BlockingQueue blocking queue} in which each insert
|
||||
@ -1062,21 +1064,17 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
*
|
||||
* @return an empty iterator
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<E> iterator() {
|
||||
return (Iterator<E>) EmptyIterator.EMPTY_ITERATOR;
|
||||
}
|
||||
|
||||
// Replicated from a previous version of Collections
|
||||
private static class EmptyIterator<E> implements Iterator<E> {
|
||||
static final EmptyIterator<Object> EMPTY_ITERATOR
|
||||
= new EmptyIterator<Object>();
|
||||
|
||||
public boolean hasNext() { return false; }
|
||||
public E next() { throw new NoSuchElementException(); }
|
||||
public void remove() { throw new IllegalStateException(); }
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an empty spliterator in which calls to
|
||||
* {@link java.util.Spliterator#trySplit()} always return {@code null}.
|
||||
*
|
||||
* @return an empty spliterator
|
||||
* @since 1.8
|
||||
*/
|
||||
public Spliterator<E> spliterator() {
|
||||
return Spliterators.emptySpliterator();
|
||||
}
|
||||
@ -1163,6 +1161,8 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
|
||||
/**
|
||||
* Saves this queue to a stream (that is, serializes it).
|
||||
* @param s the stream
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void writeObject(java.io.ObjectOutputStream s)
|
||||
throws java.io.IOException {
|
||||
@ -1182,8 +1182,12 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
|
||||
/**
|
||||
* Reconstitutes this queue from a stream (that is, deserializes it).
|
||||
* @param s the stream
|
||||
* @throws ClassNotFoundException if the class of a serialized object
|
||||
* could not be found
|
||||
* @throws java.io.IOException if an I/O error occurs
|
||||
*/
|
||||
private void readObject(final java.io.ObjectInputStream s)
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
s.defaultReadObject();
|
||||
if (waitingProducers instanceof FifoWaitQueue)
|
||||
|
@ -43,6 +43,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
* for classes supporting dynamic striping on 64bit values. The class
|
||||
* extends Number so that concrete subclasses must publicly do so.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
abstract class Striped64 extends Number {
|
||||
/*
|
||||
* This class maintains a lazily-initialized table of atomically
|
||||
|
@ -210,13 +210,19 @@
|
||||
* collections are unshared, or are accessible only when
|
||||
* holding other locks.
|
||||
*
|
||||
* <p>Most concurrent Collection implementations (including most
|
||||
* Queues) also differ from the usual java.util conventions in that
|
||||
* their Iterators provide <em>weakly consistent</em> rather than
|
||||
* fast-fail traversal. A weakly consistent iterator is thread-safe,
|
||||
* but does not necessarily freeze the collection while iterating, so
|
||||
* it may (or may not) reflect any updates since the iterator was
|
||||
* created.
|
||||
* <p id="Weakly">Most concurrent Collection implementations
|
||||
* (including most Queues) also differ from the usual {@code java.util}
|
||||
* conventions in that their {@linkplain java.util.Iterator Iterators}
|
||||
* and {@linkplain java.util.Spliterator Spliterators} provide
|
||||
* <em>weakly consistent</em> rather than fast-fail traversal:
|
||||
* <ul>
|
||||
* <li>they may proceed concurrently with other operations
|
||||
* <li>they will never throw {@link java.util.ConcurrentModificationException
|
||||
* ConcurrentModificationException}
|
||||
* <li>they are guaranteed to traverse elements as they existed upon
|
||||
* construction exactly once, and may (but are not guaranteed to)
|
||||
* reflect any modifications subsequent to construction.
|
||||
* </ul>
|
||||
*
|
||||
* <h2 id="MemoryVisibility">Memory Consistency Properties</h2>
|
||||
*
|
||||
|
@ -564,15 +564,6 @@ public class Attributes implements Map<Object,Object>, Cloneable {
|
||||
*/
|
||||
public static final Name MAIN_CLASS = new Name("Main-Class");
|
||||
|
||||
/**
|
||||
* {@code Name} object for {@code Profile} manifest attribute used by
|
||||
* applications or libraries packaged as JAR files to indicate the
|
||||
* minimum profile required to execute the application.
|
||||
* @since 1.8
|
||||
* @see UnsupportedProfileException
|
||||
*/
|
||||
public static final Name PROFILE = new Name("Profile");
|
||||
|
||||
/**
|
||||
* <code>Name</code> object for <code>Sealed</code> manifest attribute
|
||||
* used for sealing.
|
||||
|
@ -69,8 +69,6 @@ class JarFile extends ZipFile {
|
||||
|
||||
// indicates if Class-Path attribute present (only valid if hasCheckedSpecialAttributes true)
|
||||
private boolean hasClassPathAttribute;
|
||||
// indicates if Profile attribute present (only valid if hasCheckedSpecialAttributes true)
|
||||
private boolean hasProfileAttribute;
|
||||
// true if manifest checked for special attributes
|
||||
private volatile boolean hasCheckedSpecialAttributes;
|
||||
|
||||
@ -459,15 +457,10 @@ class JarFile extends ZipFile {
|
||||
|
||||
// Statics for hand-coded Boyer-Moore search
|
||||
private static final char[] CLASSPATH_CHARS = {'c','l','a','s','s','-','p','a','t','h'};
|
||||
private static final char[] PROFILE_CHARS = { 'p', 'r', 'o', 'f', 'i', 'l', 'e' };
|
||||
// The bad character shift for "class-path"
|
||||
private static final int[] CLASSPATH_LASTOCC;
|
||||
// The good suffix shift for "class-path"
|
||||
private static final int[] CLASSPATH_OPTOSFT;
|
||||
// The bad character shift for "profile"
|
||||
private static final int[] PROFILE_LASTOCC;
|
||||
// The good suffix shift for "profile"
|
||||
private static final int[] PROFILE_OPTOSFT;
|
||||
|
||||
static {
|
||||
CLASSPATH_LASTOCC = new int[128];
|
||||
@ -483,19 +476,6 @@ class JarFile extends ZipFile {
|
||||
for (int i=0; i<9; i++)
|
||||
CLASSPATH_OPTOSFT[i] = 10;
|
||||
CLASSPATH_OPTOSFT[9]=1;
|
||||
|
||||
PROFILE_LASTOCC = new int[128];
|
||||
PROFILE_OPTOSFT = new int[7];
|
||||
PROFILE_LASTOCC[(int)'p'] = 1;
|
||||
PROFILE_LASTOCC[(int)'r'] = 2;
|
||||
PROFILE_LASTOCC[(int)'o'] = 3;
|
||||
PROFILE_LASTOCC[(int)'f'] = 4;
|
||||
PROFILE_LASTOCC[(int)'i'] = 5;
|
||||
PROFILE_LASTOCC[(int)'l'] = 6;
|
||||
PROFILE_LASTOCC[(int)'e'] = 7;
|
||||
for (int i=0; i<6; i++)
|
||||
PROFILE_OPTOSFT[i] = 7;
|
||||
PROFILE_OPTOSFT[6] = 1;
|
||||
}
|
||||
|
||||
private JarEntry getManEntry() {
|
||||
@ -529,15 +509,6 @@ class JarFile extends ZipFile {
|
||||
return hasClassPathAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} iff this JAR file has a manifest with the
|
||||
* Profile attribute
|
||||
*/
|
||||
boolean hasProfileAttribute() throws IOException {
|
||||
checkForSpecialAttributes();
|
||||
return hasProfileAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the pattern {@code src} is found in {@code b}.
|
||||
* The {@code lastOcc} and {@code optoSft} arrays are the precomputed
|
||||
@ -564,7 +535,7 @@ class JarFile extends ZipFile {
|
||||
|
||||
/**
|
||||
* On first invocation, check if the JAR file has the Class-Path
|
||||
* and/or Profile attributes. A no-op on subsequent calls.
|
||||
* attribute. A no-op on subsequent calls.
|
||||
*/
|
||||
private void checkForSpecialAttributes() throws IOException {
|
||||
if (hasCheckedSpecialAttributes) return;
|
||||
@ -574,8 +545,6 @@ class JarFile extends ZipFile {
|
||||
byte[] b = getBytes(manEntry);
|
||||
if (match(CLASSPATH_CHARS, b, CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT))
|
||||
hasClassPathAttribute = true;
|
||||
if (match(PROFILE_CHARS, b, PROFILE_LASTOCC, PROFILE_OPTOSFT))
|
||||
hasProfileAttribute = true;
|
||||
}
|
||||
}
|
||||
hasCheckedSpecialAttributes = true;
|
||||
|
@ -139,14 +139,22 @@ class JarVerifier {
|
||||
return;
|
||||
}
|
||||
|
||||
if (uname.equals(JarFile.MANIFEST_NAME)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SignatureFileVerifier.isBlockOrSF(uname)) {
|
||||
/* We parse only DSA, RSA or EC PKCS7 blocks. */
|
||||
parsingBlockOrSF = true;
|
||||
baos.reset();
|
||||
mev.setEntry(null, je);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// If a META-INF entry is not MF or block or SF, they should
|
||||
// be normal entries. According to 2 above, no more block or
|
||||
// SF will appear. Let's doneWithMeta.
|
||||
}
|
||||
}
|
||||
|
||||
if (parsingMeta) {
|
||||
|
@ -37,10 +37,6 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
|
||||
return jar.hasClassPathAttribute();
|
||||
}
|
||||
|
||||
public boolean jarFileHasProfileAttribute(JarFile jar) throws IOException {
|
||||
return jar.hasProfileAttribute();
|
||||
}
|
||||
|
||||
public CodeSource[] getCodeSources(JarFile jar, URL url) {
|
||||
return jar.getCodeSources(url);
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.util.jar;
|
||||
|
||||
/**
|
||||
* Thrown to indicate an attempt to access a JAR file with a {@link
|
||||
* Attributes.Name#PROFILE Profile} attribute that names a profile that
|
||||
* is not supported by this runtime.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public class UnsupportedProfileException extends RuntimeException {
|
||||
private static final long serialVersionUID = -1834773870678792406L;
|
||||
|
||||
/**
|
||||
* Constructs an {@code UnsupportedProfileException} with no detail
|
||||
* message.
|
||||
*/
|
||||
public UnsupportedProfileException() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an {@code UnsupportedProfileException} with the
|
||||
* specified detail message.
|
||||
*
|
||||
* @param message the detail message
|
||||
*/
|
||||
public UnsupportedProfileException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -353,6 +353,43 @@ public final class Collectors {
|
||||
downstream.characteristics());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts a {@code Collector} to perform an additional finishing
|
||||
* transformation. For example, one could adapt the {@link #toList()}
|
||||
* collector to always produce an immutable list with:
|
||||
* <pre>{@code
|
||||
* List<String> people
|
||||
* = people.stream().collect(collectingAndThen(toList(), Collections::unmodifiableList));
|
||||
* }</pre>
|
||||
*
|
||||
* @param <T> the type of the input elements
|
||||
* @param <A> intermediate accumulation type of the downstream collector
|
||||
* @param <R> result type of the downstream collector
|
||||
* @param <RR> result type of the resulting collector
|
||||
* @param downstream a collector
|
||||
* @param finisher a function to be applied to the final result of the downstream collector
|
||||
* @return a collector which performs the action of the downstream collector,
|
||||
* followed by an additional finishing step
|
||||
*/
|
||||
public static<T,A,R,RR> Collector<T,A,RR> collectingAndThen(Collector<T,A,R> downstream,
|
||||
Function<R,RR> finisher) {
|
||||
Set<Collector.Characteristics> characteristics = downstream.characteristics();
|
||||
if (characteristics.contains(Collector.Characteristics.IDENTITY_FINISH)) {
|
||||
if (characteristics.size() == 1)
|
||||
characteristics = Collectors.CH_NOID;
|
||||
else {
|
||||
characteristics = EnumSet.copyOf(characteristics);
|
||||
characteristics.remove(Collector.Characteristics.IDENTITY_FINISH);
|
||||
characteristics = Collections.unmodifiableSet(characteristics);
|
||||
}
|
||||
}
|
||||
return new CollectorImpl<>(downstream.supplier(),
|
||||
downstream.accumulator(),
|
||||
downstream.combiner(),
|
||||
downstream.finisher().andThen(finisher),
|
||||
characteristics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code Collector} accepting elements of type {@code T} that
|
||||
* counts the number of input elements. If no elements are present, the
|
||||
|
@ -62,6 +62,11 @@ class Adler32 implements Checksum {
|
||||
|
||||
/**
|
||||
* Updates the checksum with the specified array of bytes.
|
||||
*
|
||||
* @throws ArrayIndexOutOfBoundsException
|
||||
* if {@code off} is negative, or {@code len} is negative,
|
||||
* or {@code off+len} is greater than the length of the
|
||||
* array {@code b}
|
||||
*/
|
||||
public void update(byte[] b, int off, int len) {
|
||||
if (b == null) {
|
||||
|
@ -60,6 +60,11 @@ class CRC32 implements Checksum {
|
||||
|
||||
/**
|
||||
* Updates the CRC-32 checksum with the specified array of bytes.
|
||||
*
|
||||
* @throws ArrayIndexOutOfBoundsException
|
||||
* if {@code off} is negative, or {@code len} is negative,
|
||||
* or {@code off+len} is greater than the length of the
|
||||
* array {@code b}
|
||||
*/
|
||||
public void update(byte[] b, int off, int len) {
|
||||
if (b == null) {
|
||||
|
@ -76,6 +76,13 @@ interface ZipConstants {
|
||||
static final int EXTID_UNIX = 0x000d; // UNIX
|
||||
static final int EXTID_EXTT = 0x5455; // Info-ZIP Extended Timestamp
|
||||
|
||||
/*
|
||||
* EXTT timestamp flags
|
||||
*/
|
||||
static final int EXTT_FLAG_LMT = 0x1; // LastModifiedTime
|
||||
static final int EXTT_FLAG_LAT = 0x2; // LastAccessTime
|
||||
static final int EXTT_FLAT_CT = 0x4; // CreationTime
|
||||
|
||||
/*
|
||||
* Central directory (CEN) header field offsets
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,6 +25,11 @@
|
||||
|
||||
package java.util.zip;
|
||||
|
||||
import static java.util.zip.ZipUtils.*;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* This class is used to represent a ZIP file entry.
|
||||
*
|
||||
@ -32,8 +37,12 @@ package java.util.zip;
|
||||
*/
|
||||
public
|
||||
class ZipEntry implements ZipConstants, Cloneable {
|
||||
|
||||
String name; // entry name
|
||||
long mtime = -1; // last modification time
|
||||
long time = -1; // last modification time
|
||||
FileTime mtime; // last modification time, from extra field data
|
||||
FileTime atime; // last access time, from extra field data
|
||||
FileTime ctime; // creation time, from extra field data
|
||||
long crc = -1; // crc-32 of entry data
|
||||
long size = -1; // uncompressed size of entry data
|
||||
long csize = -1; // compressed size of entry data
|
||||
@ -55,15 +64,15 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
/**
|
||||
* Creates a new zip entry with the specified name.
|
||||
*
|
||||
* @param name the entry name
|
||||
* @exception NullPointerException if the entry name is null
|
||||
* @exception IllegalArgumentException if the entry name is longer than
|
||||
* @param name
|
||||
* The entry name
|
||||
*
|
||||
* @throws NullPointerException if the entry name is null
|
||||
* @throws IllegalArgumentException if the entry name is longer than
|
||||
* 0xFFFF bytes
|
||||
*/
|
||||
public ZipEntry(String name) {
|
||||
if (name == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
Objects.requireNonNull(name, "name");
|
||||
if (name.length() > 0xFFFF) {
|
||||
throw new IllegalArgumentException("entry name too long");
|
||||
}
|
||||
@ -73,11 +82,19 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
/**
|
||||
* Creates a new zip entry with fields taken from the specified
|
||||
* zip entry.
|
||||
* @param e a zip Entry object
|
||||
*
|
||||
* @param e
|
||||
* A zip Entry object
|
||||
*
|
||||
* @throws NullPointerException if the entry object is null
|
||||
*/
|
||||
public ZipEntry(ZipEntry e) {
|
||||
Objects.requireNonNull(e, "entry");
|
||||
name = e.name;
|
||||
time = e.time;
|
||||
mtime = e.mtime;
|
||||
atime = e.atime;
|
||||
ctime = e.ctime;
|
||||
crc = e.crc;
|
||||
size = e.size;
|
||||
csize = e.csize;
|
||||
@ -103,30 +120,175 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
/**
|
||||
* Sets the last modification time of the entry.
|
||||
*
|
||||
* @param time the last modification time of the entry in milliseconds since the epoch
|
||||
* <p> If the entry is output to a ZIP file or ZIP file formatted
|
||||
* output stream the last modification time set by this method will
|
||||
* be stored into the {@code date and time fields} of the zip file
|
||||
* entry and encoded in standard {@code MS-DOS date and time format}.
|
||||
* The {@link java.util.TimeZone#getDefault() default TimeZone} is
|
||||
* used to convert the epoch time to the MS-DOS data and time.
|
||||
*
|
||||
* @param time
|
||||
* The last modification time of the entry in milliseconds
|
||||
* since the epoch
|
||||
*
|
||||
* @see #getTime()
|
||||
* @see #getLastModifiedTime()
|
||||
*/
|
||||
public void setTime(long time) {
|
||||
this.mtime = time;
|
||||
this.time = time;
|
||||
this.mtime = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last modification time of the entry.
|
||||
* <p> The last modificatin time may come from zip entry's extensible
|
||||
* data field {@code NTFS} or {@code Info-ZIP Extended Timestamp}, if
|
||||
* the entry is read from {@link ZipInputStream} or {@link ZipFile}.
|
||||
*
|
||||
* @return the last modification time of the entry, or -1 if not specified
|
||||
* <p> If the entry is read from a ZIP file or ZIP file formatted
|
||||
* input stream, this is the last modification time from the {@code
|
||||
* date and time fields} of the zip file entry. The
|
||||
* {@link java.util.TimeZone#getDefault() default TimeZone} is used
|
||||
* to convert the standard MS-DOS formatted date and time to the
|
||||
* epoch time.
|
||||
*
|
||||
* @return The last modification time of the entry in milliseconds
|
||||
* since the epoch, or -1 if not specified
|
||||
*
|
||||
* @see #setTime(long)
|
||||
* @see #setLastModifiedTime(FileTime)
|
||||
*/
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last modification time of the entry.
|
||||
*
|
||||
* <p> When output to a ZIP file or ZIP file formatted output stream
|
||||
* the last modification time set by this method will be stored into
|
||||
* zip file entry's {@code date and time fields} in {@code standard
|
||||
* MS-DOS date and time format}), and the extended timestamp fields
|
||||
* in {@code optional extra data} in UTC time.
|
||||
*
|
||||
* @param time
|
||||
* The last modification time of the entry
|
||||
* @return This zip entry
|
||||
*
|
||||
* @throws NullPointerException if the {@code time} is null
|
||||
*
|
||||
* @see #getLastModifiedTime()
|
||||
* @since 1.8
|
||||
*/
|
||||
public ZipEntry setLastModifiedTime(FileTime time) {
|
||||
Objects.requireNonNull(name, "time");
|
||||
this.mtime = time;
|
||||
this.time = time.to(TimeUnit.MILLISECONDS);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last modification time of the entry.
|
||||
*
|
||||
* <p> If the entry is read from a ZIP file or ZIP file formatted
|
||||
* input stream, this is the last modification time from the zip
|
||||
* file entry's {@code optional extra data} if the extended timestamp
|
||||
* fields are present. Otherwise the last modification time is read
|
||||
* from the entry's {@code date and time fields}, the {@link
|
||||
* java.util.TimeZone#getDefault() default TimeZone} is used to convert
|
||||
* the standard MS-DOS formatted date and time to the epoch time.
|
||||
*
|
||||
* @return The last modification time of the entry, null if not specified
|
||||
*
|
||||
* @see #setLastModifiedTime(FileTime)
|
||||
* @since 1.8
|
||||
*/
|
||||
public FileTime getLastModifiedTime() {
|
||||
if (mtime != null)
|
||||
return mtime;
|
||||
if (time == -1)
|
||||
return null;
|
||||
return FileTime.from(time, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last access time of the entry.
|
||||
*
|
||||
* <p> If set, the last access time will be stored into the extended
|
||||
* timestamp fields of entry's {@code optional extra data}, when output
|
||||
* to a ZIP file or ZIP file formatted stream.
|
||||
*
|
||||
* @param time
|
||||
* The last access time of the entry
|
||||
* @return This zip entry
|
||||
*
|
||||
* @throws NullPointerException if the {@code time} is null
|
||||
*
|
||||
* @see #getLastAccessTime()
|
||||
* @since 1.8
|
||||
*/
|
||||
public ZipEntry setLastAccessTime(FileTime time) {
|
||||
Objects.requireNonNull(name, "time");
|
||||
this.atime = time;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last access time of the entry.
|
||||
*
|
||||
* <p> The last access time is from the extended timestamp fields
|
||||
* of entry's {@code optional extra data} when read from a ZIP file
|
||||
* or ZIP file formatted stream.
|
||||
*
|
||||
* @return The last access time of the entry, null if not specified
|
||||
|
||||
* @see #setLastAccessTime(FileTime)
|
||||
* @since 1.8
|
||||
*/
|
||||
public FileTime getLastAccessTime() {
|
||||
return atime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the creation time of the entry.
|
||||
*
|
||||
* <p> If set, the creation time will be stored into the extended
|
||||
* timestamp fields of entry's {@code optional extra data}, when
|
||||
* output to a ZIP file or ZIP file formatted stream.
|
||||
*
|
||||
* @param time
|
||||
* The creation time of the entry
|
||||
* @return This zip entry
|
||||
*
|
||||
* @throws NullPointerException if the {@code time} is null
|
||||
*
|
||||
* @see #getCreationTime()
|
||||
* @since 1.8
|
||||
*/
|
||||
public ZipEntry setCreationTime(FileTime time) {
|
||||
Objects.requireNonNull(name, "time");
|
||||
this.ctime = time;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the creation time of the entry.
|
||||
*
|
||||
* <p> The creation time is from the extended timestamp fields of
|
||||
* entry's {@code optional extra data} when read from a ZIP file
|
||||
* or ZIP file formatted stream.
|
||||
*
|
||||
* @return the creation time of the entry, null if not specified
|
||||
* @see #setCreationTime(FileTime)
|
||||
* @since 1.8
|
||||
*/
|
||||
public FileTime getCreationTime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the uncompressed size of the entry data.
|
||||
*
|
||||
* @param size the uncompressed size in bytes
|
||||
* @exception IllegalArgumentException if the specified size is less
|
||||
*
|
||||
* @throws IllegalArgumentException if the specified size is less
|
||||
* than 0, is greater than 0xFFFFFFFF when
|
||||
* <a href="package-summary.html#zip64">ZIP64 format</a> is not supported,
|
||||
* or is less than 0 when ZIP64 is supported
|
||||
@ -140,7 +302,8 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the uncompressed size of the entry data, or -1 if not known.
|
||||
* Returns the uncompressed size of the entry data.
|
||||
*
|
||||
* @return the uncompressed size of the entry data, or -1 if not known
|
||||
* @see #setSize(long)
|
||||
*/
|
||||
@ -149,9 +312,11 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the compressed entry data, or -1 if not known.
|
||||
* In the case of a stored entry, the compressed size will be the same
|
||||
* Returns the size of the compressed entry data.
|
||||
*
|
||||
* <p> In the case of a stored entry, the compressed size will be the same
|
||||
* as the uncompressed size of the entry.
|
||||
*
|
||||
* @return the size of the compressed entry data, or -1 if not known
|
||||
* @see #setCompressedSize(long)
|
||||
*/
|
||||
@ -161,7 +326,9 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
|
||||
/**
|
||||
* Sets the size of the compressed entry data.
|
||||
*
|
||||
* @param csize the compressed size to set to
|
||||
*
|
||||
* @see #getCompressedSize()
|
||||
*/
|
||||
public void setCompressedSize(long csize) {
|
||||
@ -170,8 +337,10 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
|
||||
/**
|
||||
* Sets the CRC-32 checksum of the uncompressed entry data.
|
||||
*
|
||||
* @param crc the CRC-32 value
|
||||
* @exception IllegalArgumentException if the specified CRC-32 value is
|
||||
*
|
||||
* @throws IllegalArgumentException if the specified CRC-32 value is
|
||||
* less than 0 or greater than 0xFFFFFFFF
|
||||
* @see #getCrc()
|
||||
*/
|
||||
@ -183,10 +352,11 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CRC-32 checksum of the uncompressed entry data, or -1 if
|
||||
* not known.
|
||||
* Returns the CRC-32 checksum of the uncompressed entry data.
|
||||
*
|
||||
* @return the CRC-32 checksum of the uncompressed entry data, or -1 if
|
||||
* not known
|
||||
*
|
||||
* @see #setCrc(long)
|
||||
*/
|
||||
public long getCrc() {
|
||||
@ -195,8 +365,10 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
|
||||
/**
|
||||
* Sets the compression method for the entry.
|
||||
*
|
||||
* @param method the compression method, either STORED or DEFLATED
|
||||
* @exception IllegalArgumentException if the specified compression
|
||||
*
|
||||
* @throws IllegalArgumentException if the specified compression
|
||||
* method is invalid
|
||||
* @see #getMethod()
|
||||
*/
|
||||
@ -208,7 +380,8 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the compression method of the entry, or -1 if not specified.
|
||||
* Returns the compression method of the entry.
|
||||
*
|
||||
* @return the compression method of the entry, or -1 if not specified
|
||||
* @see #setMethod(int)
|
||||
*/
|
||||
@ -218,21 +391,104 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
|
||||
/**
|
||||
* Sets the optional extra field data for the entry.
|
||||
* @param extra the extra field data bytes
|
||||
* @exception IllegalArgumentException if the length of the specified
|
||||
*
|
||||
* <p> Invoking this method may change this entry's last modification
|
||||
* time, last access time and creation time, if the {@code extra} field
|
||||
* data includes the extensible timestamp fields, such as {@code NTFS tag
|
||||
* 0x0001} or {@code Info-ZIP Extended Timestamp}, as specified in
|
||||
* <a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">Info-ZIP
|
||||
* Application Note 970311</a>.
|
||||
*
|
||||
* @param extra
|
||||
* The extra field data bytes
|
||||
*
|
||||
* @throws IllegalArgumentException if the length of the specified
|
||||
* extra field data is greater than 0xFFFF bytes
|
||||
*
|
||||
* @see #getExtra()
|
||||
*/
|
||||
public void setExtra(byte[] extra) {
|
||||
if (extra != null && extra.length > 0xFFFF) {
|
||||
setExtra0(extra, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the optional extra field data for the entry.
|
||||
*
|
||||
* @param extra
|
||||
* the extra field data bytes
|
||||
* @param doZIP64
|
||||
* if true, set size and csize from ZIP64 fields if present
|
||||
*/
|
||||
void setExtra0(byte[] extra, boolean doZIP64) {
|
||||
if (extra != null) {
|
||||
if (extra.length > 0xFFFF) {
|
||||
throw new IllegalArgumentException("invalid extra field length");
|
||||
}
|
||||
// extra fields are in "HeaderID(2)DataSize(2)Data... format
|
||||
int off = 0;
|
||||
int len = extra.length;
|
||||
while (off + 4 < len) {
|
||||
int tag = get16(extra, off);
|
||||
int sz = get16(extra, off + 2);
|
||||
off += 4;
|
||||
if (off + sz > len) // invalid data
|
||||
break;
|
||||
switch (tag) {
|
||||
case EXTID_ZIP64:
|
||||
if (doZIP64) {
|
||||
// LOC extra zip64 entry MUST include BOTH original
|
||||
// and compressed file size fields.
|
||||
// If invalid zip64 extra fields, simply skip. Even
|
||||
// it's rare, it's possible the entry size happens to
|
||||
// be the magic value and it "accidently" has some
|
||||
// bytes in extra match the id.
|
||||
if (sz >= 16) {
|
||||
size = get64(extra, off);
|
||||
csize = get64(extra, off + 8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EXTID_NTFS:
|
||||
int pos = off + 4; // reserved 4 bytes
|
||||
if (get16(extra, pos) != 0x0001 || get16(extra, pos + 2) != 24)
|
||||
break;
|
||||
mtime = winTimeToFileTime(get64(extra, pos + 4));
|
||||
atime = winTimeToFileTime(get64(extra, pos + 12));
|
||||
ctime = winTimeToFileTime(get64(extra, pos + 20));
|
||||
break;
|
||||
case EXTID_EXTT:
|
||||
int flag = Byte.toUnsignedInt(extra[off]);
|
||||
int sz0 = 1;
|
||||
// The CEN-header extra field contains the modification
|
||||
// time only, or no timestamp at all. 'sz' is used to
|
||||
// flag its presence or absence. But if mtime is present
|
||||
// in LOC it must be present in CEN as well.
|
||||
if ((flag & 0x1) != 0 && (sz0 + 4) <= sz) {
|
||||
mtime = unixTimeToFileTime(get32(extra, off + sz0));
|
||||
sz0 += 4;
|
||||
}
|
||||
if ((flag & 0x2) != 0 && (sz0 + 4) <= sz) {
|
||||
atime = unixTimeToFileTime(get32(extra, off + sz0));
|
||||
sz0 += 4;
|
||||
}
|
||||
if ((flag & 0x4) != 0 && (sz0 + 4) <= sz) {
|
||||
ctime = unixTimeToFileTime(get32(extra, off + sz0));
|
||||
sz0 += 4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
off += sz;
|
||||
}
|
||||
}
|
||||
this.extra = extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extra field data for the entry, or null if none.
|
||||
* Returns the extra field data for the entry.
|
||||
*
|
||||
* @return the extra field data for the entry, or null if none
|
||||
*
|
||||
* @see #setExtra(byte[])
|
||||
*/
|
||||
public byte[] getExtra() {
|
||||
@ -255,8 +511,10 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the comment string for the entry, or null if none.
|
||||
* Returns the comment string for the entry.
|
||||
*
|
||||
* @return the comment string for the entry, or null if none
|
||||
*
|
||||
* @see #setComment(String)
|
||||
*/
|
||||
public String getComment() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -567,44 +567,12 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
e.name = zc.toString(bname, bname.length);
|
||||
}
|
||||
}
|
||||
e.time = dosToJavaTime(getEntryTime(jzentry));
|
||||
e.crc = getEntryCrc(jzentry);
|
||||
e.size = getEntrySize(jzentry);
|
||||
e. csize = getEntryCSize(jzentry);
|
||||
e.csize = getEntryCSize(jzentry);
|
||||
e.method = getEntryMethod(jzentry);
|
||||
e.extra = getEntryBytes(jzentry, JZENTRY_EXTRA);
|
||||
if (e.extra != null) {
|
||||
byte[] extra = e.extra;
|
||||
int len = e.extra.length;
|
||||
int off = 0;
|
||||
while (off + 4 < len) {
|
||||
int pos = off;
|
||||
int tag = get16(extra, pos);
|
||||
int sz = get16(extra, pos + 2);
|
||||
pos += 4;
|
||||
if (pos + sz > len) // invalid data
|
||||
break;
|
||||
switch (tag) {
|
||||
case EXTID_NTFS:
|
||||
pos += 4; // reserved 4 bytes
|
||||
if (get16(extra, pos) != 0x0001 || get16(extra, pos + 2) != 24)
|
||||
break;
|
||||
e.mtime = winToJavaTime(get64(extra, pos + 4));
|
||||
break;
|
||||
case EXTID_EXTT:
|
||||
int flag = Byte.toUnsignedInt(extra[pos++]);
|
||||
if ((flag & 0x1) != 0) {
|
||||
e.mtime = unixToJavaTime(get32(extra, pos));
|
||||
pos += 4;
|
||||
}
|
||||
break;
|
||||
default: // unknown tag
|
||||
}
|
||||
off += (sz + 4);
|
||||
}
|
||||
}
|
||||
if (e.mtime == -1) {
|
||||
e.mtime = dosToJavaTime(getEntryTime(jzentry));
|
||||
}
|
||||
e.setExtra0(getEntryBytes(jzentry, JZENTRY_EXTRA), false);
|
||||
byte[] bcomm = getEntryBytes(jzentry, JZENTRY_COMMENT);
|
||||
if (bcomm == null) {
|
||||
e.comment = null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -288,9 +288,9 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
int len = get16(tmpbuf, LOCNAM);
|
||||
int blen = b.length;
|
||||
if (len > blen) {
|
||||
do
|
||||
do {
|
||||
blen = blen * 2;
|
||||
while (len > blen);
|
||||
} while (len > blen);
|
||||
b = new byte[blen];
|
||||
}
|
||||
readFully(b, 0, len);
|
||||
@ -303,7 +303,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
throw new ZipException("encrypted ZIP entry not supported");
|
||||
}
|
||||
e.method = get16(tmpbuf, LOCHOW);
|
||||
e.mtime = dosToJavaTime(get32(tmpbuf, LOCTIM));
|
||||
e.time = dosToJavaTime(get32(tmpbuf, LOCTIM));
|
||||
if ((flag & 8) == 8) {
|
||||
/* "Data Descriptor" present */
|
||||
if (e.method != DEFLATED) {
|
||||
@ -319,49 +319,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
if (len > 0) {
|
||||
byte[] extra = new byte[len];
|
||||
readFully(extra, 0, len);
|
||||
e.setExtra(extra);
|
||||
// extra fields are in "HeaderID(2)DataSize(2)Data... format
|
||||
int off = 0;
|
||||
while (off + 4 < len) {
|
||||
int pos = off;
|
||||
int tag = get16(extra, pos);
|
||||
int sz = get16(extra, pos + 2);
|
||||
pos += 4;
|
||||
if (pos + sz > len) // invalid data
|
||||
break;
|
||||
switch (tag) {
|
||||
case EXTID_ZIP64 :
|
||||
// LOC extra zip64 entry MUST include BOTH original and
|
||||
// compressed file size fields.
|
||||
//
|
||||
// If invalid zip64 extra fields, simply skip. Even it's
|
||||
// rare, it's possible the entry size happens to be
|
||||
// the magic value and it "accidently" has some bytes
|
||||
// in extra match the id.
|
||||
if (sz >= 16 && (pos + sz) <= len ) {
|
||||
e.size = get64(extra, pos);
|
||||
e.csize = get64(extra, pos + 8);
|
||||
}
|
||||
break;
|
||||
case EXTID_NTFS:
|
||||
pos += 4; // reserved 4 bytes
|
||||
if (get16(extra, pos) != 0x0001 || get16(extra, pos + 2) != 24)
|
||||
break;
|
||||
// override the loc field, NTFS time has 'microsecond' granularity
|
||||
e.mtime = winToJavaTime(get64(extra, pos + 4));
|
||||
break;
|
||||
case EXTID_EXTT:
|
||||
int flag = Byte.toUnsignedInt(extra[pos++]);
|
||||
if ((flag & 0x1) != 0) {
|
||||
e.mtime = unixToJavaTime(get32(extra, pos));
|
||||
pos += 4;
|
||||
}
|
||||
break;
|
||||
default: // unknown tag
|
||||
}
|
||||
off += (sz + 4);
|
||||
}
|
||||
|
||||
e.setExtra0(extra, true);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
@ -59,8 +59,9 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
"jdk.util.zip.inhibitZip64", "false")));
|
||||
|
||||
private static class XEntry {
|
||||
public final ZipEntry entry;
|
||||
public final long offset;
|
||||
final ZipEntry entry;
|
||||
final long offset;
|
||||
long dostime; // last modification time in msdos format
|
||||
public XEntry(ZipEntry entry, long offset) {
|
||||
this.entry = entry;
|
||||
this.offset = offset;
|
||||
@ -191,7 +192,9 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
if (current != null) {
|
||||
closeEntry(); // close previous entry
|
||||
}
|
||||
if (e.mtime == -1) {
|
||||
if (e.time == -1) {
|
||||
// by default, do NOT use extended timestamps in extra
|
||||
// data, for now.
|
||||
e.setTime(System.currentTimeMillis());
|
||||
}
|
||||
if (e.method == -1) {
|
||||
@ -384,25 +387,20 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
ZipEntry e = xentry.entry;
|
||||
int flag = e.flag;
|
||||
boolean hasZip64 = false;
|
||||
int elen = (e.extra != null) ? e.extra.length : 0;
|
||||
int eoff = 0;
|
||||
boolean foundEXTT = false; // if EXTT already present
|
||||
// do nothing.
|
||||
while (eoff + 4 < elen) {
|
||||
int tag = get16(e.extra, eoff);
|
||||
int sz = get16(e.extra, eoff + 2);
|
||||
if (tag == EXTID_EXTT) {
|
||||
foundEXTT = true;
|
||||
}
|
||||
eoff += (4 + sz);
|
||||
}
|
||||
int elen = getExtraLen(e.extra);
|
||||
|
||||
// keep a copy of dostime for writeCEN(), otherwise the tz
|
||||
// sensitive local time entries in loc and cen might be
|
||||
// different if the default tz get changed during writeLOC()
|
||||
// and writeCEN()
|
||||
xentry.dostime = javaToDosTime(e.time);
|
||||
|
||||
writeInt(LOCSIG); // LOC header signature
|
||||
if ((flag & 8) == 8) {
|
||||
writeShort(version(e)); // version needed to extract
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(javaToDosTime(e.mtime)); // last modification time
|
||||
|
||||
writeInt(xentry.dostime); // last modification time
|
||||
// store size, uncompressed size, and crc-32 in data descriptor
|
||||
// immediately following compressed entry data
|
||||
writeInt(0);
|
||||
@ -417,7 +415,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
}
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(javaToDosTime(e.mtime)); // last modification time
|
||||
writeInt(xentry.dostime); // last modification time
|
||||
writeInt(e.crc); // crc-32
|
||||
if (hasZip64) {
|
||||
writeInt(ZIP64_MAGICVAL);
|
||||
@ -430,8 +428,23 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
}
|
||||
byte[] nameBytes = zc.getBytes(e.name);
|
||||
writeShort(nameBytes.length);
|
||||
if (!foundEXTT)
|
||||
elen += 9; // use Info-ZIP's ext time in extra
|
||||
|
||||
int elenEXTT = 0; // info-zip extended timestamp
|
||||
int flagEXTT = 0;
|
||||
if (e.mtime != null) {
|
||||
elenEXTT += 4;
|
||||
flagEXTT |= EXTT_FLAG_LMT;
|
||||
}
|
||||
if (e.atime != null) {
|
||||
elenEXTT += 4;
|
||||
flagEXTT |= EXTT_FLAG_LAT;
|
||||
}
|
||||
if (e.ctime != null) {
|
||||
elenEXTT += 4;
|
||||
flagEXTT |= EXTT_FLAT_CT;
|
||||
}
|
||||
if (flagEXTT != 0)
|
||||
elen += (elenEXTT + 5); // headid(2) + size(2) + flag(1) + data
|
||||
writeShort(elen);
|
||||
writeBytes(nameBytes, 0, nameBytes.length);
|
||||
if (hasZip64) {
|
||||
@ -440,15 +453,18 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
writeLong(e.size);
|
||||
writeLong(e.csize);
|
||||
}
|
||||
if (!foundEXTT) {
|
||||
if (flagEXTT != 0) {
|
||||
writeShort(EXTID_EXTT);
|
||||
writeShort(5); // size for the folowing data block
|
||||
writeByte(0x1); // flags byte, mtime only
|
||||
writeInt(javaToUnixTime(e.mtime));
|
||||
}
|
||||
if (e.extra != null) {
|
||||
writeBytes(e.extra, 0, e.extra.length);
|
||||
writeShort(elenEXTT + 1); // flag + data
|
||||
writeByte(flagEXTT);
|
||||
if (e.mtime != null)
|
||||
writeInt(fileTimeToUnixTime(e.mtime));
|
||||
if (e.atime != null)
|
||||
writeInt(fileTimeToUnixTime(e.atime));
|
||||
if (e.ctime != null)
|
||||
writeInt(fileTimeToUnixTime(e.ctime));
|
||||
}
|
||||
writeExtra(e.extra);
|
||||
locoff = written;
|
||||
}
|
||||
|
||||
@ -506,31 +522,35 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
}
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(javaToDosTime(e.mtime)); // last modification time
|
||||
// use the copy in xentry, which has been converted
|
||||
// from e.time in writeLOC()
|
||||
writeInt(xentry.dostime); // last modification time
|
||||
writeInt(e.crc); // crc-32
|
||||
writeInt(csize); // compressed size
|
||||
writeInt(size); // uncompressed size
|
||||
byte[] nameBytes = zc.getBytes(e.name);
|
||||
writeShort(nameBytes.length);
|
||||
|
||||
int elen = (e.extra != null) ? e.extra.length : 0;
|
||||
int eoff = 0;
|
||||
boolean foundEXTT = false; // if EXTT already present
|
||||
// do nothing.
|
||||
while (eoff + 4 < elen) {
|
||||
int tag = get16(e.extra, eoff);
|
||||
int sz = get16(e.extra, eoff + 2);
|
||||
if (tag == EXTID_EXTT) {
|
||||
foundEXTT = true;
|
||||
}
|
||||
eoff += (4 + sz);
|
||||
}
|
||||
int elen = getExtraLen(e.extra);
|
||||
if (hasZip64) {
|
||||
// + headid(2) + datasize(2)
|
||||
elen += (elenZIP64 + 4);
|
||||
elen += (elenZIP64 + 4);// + headid(2) + datasize(2)
|
||||
}
|
||||
// cen info-zip extended timestamp only outputs mtime
|
||||
// but set the flag for a/ctime, if present in loc
|
||||
int flagEXTT = 0;
|
||||
if (e.mtime != null) {
|
||||
elen += 4; // + mtime(4)
|
||||
flagEXTT |= EXTT_FLAG_LMT;
|
||||
}
|
||||
if (e.atime != null) {
|
||||
flagEXTT |= EXTT_FLAG_LAT;
|
||||
}
|
||||
if (e.ctime != null) {
|
||||
flagEXTT |= EXTT_FLAT_CT;
|
||||
}
|
||||
if (flagEXTT != 0) {
|
||||
elen += 5; // headid + sz + flag
|
||||
}
|
||||
if (!foundEXTT)
|
||||
elen += 9; // Info-ZIP's Extended Timestamp
|
||||
writeShort(elen);
|
||||
byte[] commentBytes;
|
||||
if (e.comment != null) {
|
||||
@ -545,6 +565,8 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
writeInt(0); // external file attributes (unused)
|
||||
writeInt(offset); // relative offset of local header
|
||||
writeBytes(nameBytes, 0, nameBytes.length);
|
||||
|
||||
// take care of EXTID_ZIP64 and EXTID_EXTT
|
||||
if (hasZip64) {
|
||||
writeShort(ZIP64_EXTID);// Zip64 extra
|
||||
writeShort(elenZIP64);
|
||||
@ -555,15 +577,18 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
if (offset == ZIP64_MAGICVAL)
|
||||
writeLong(xentry.offset);
|
||||
}
|
||||
if (!foundEXTT) {
|
||||
if (flagEXTT != 0) {
|
||||
writeShort(EXTID_EXTT);
|
||||
writeShort(5);
|
||||
writeByte(0x1); // flags byte
|
||||
writeInt(javaToUnixTime(e.mtime));
|
||||
if (e.mtime != null) {
|
||||
writeShort(5); // flag + mtime
|
||||
writeByte(flagEXTT);
|
||||
writeInt(fileTimeToUnixTime(e.mtime));
|
||||
} else {
|
||||
writeShort(1); // flag only
|
||||
writeByte(flagEXTT);
|
||||
}
|
||||
if (e.extra != null) {
|
||||
writeBytes(e.extra, 0, e.extra.length);
|
||||
}
|
||||
writeExtra(e.extra);
|
||||
if (commentBytes != null) {
|
||||
writeBytes(commentBytes, 0, Math.min(commentBytes.length, 0xffff));
|
||||
}
|
||||
@ -626,6 +651,47 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the length of extra data without EXTT and ZIP64.
|
||||
*/
|
||||
private int getExtraLen(byte[] extra) {
|
||||
if (extra == null)
|
||||
return 0;
|
||||
int skipped = 0;
|
||||
int len = extra.length;
|
||||
int off = 0;
|
||||
while (off + 4 <= len) {
|
||||
int tag = get16(extra, off);
|
||||
int sz = get16(extra, off + 2);
|
||||
if (tag == EXTID_EXTT || tag == EXTID_ZIP64) {
|
||||
skipped += (sz + 4);
|
||||
}
|
||||
off += (sz + 4);
|
||||
}
|
||||
return len - skipped;
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes extra data without EXTT and ZIP64.
|
||||
*
|
||||
* Extra timestamp and ZIP64 data is handled/output separately
|
||||
* in writeLOC and writeCEN.
|
||||
*/
|
||||
private void writeExtra(byte[] extra) throws IOException {
|
||||
if (extra != null) {
|
||||
int len = extra.length;
|
||||
int off = 0;
|
||||
while (off + 4 <= len) {
|
||||
int tag = get16(extra, off);
|
||||
int sz = get16(extra, off + 2);
|
||||
if (tag != EXTID_EXTT && tag != EXTID_ZIP64) {
|
||||
writeBytes(extra, off, sz + 4);
|
||||
}
|
||||
off += (sz + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes a 8-bit byte to the output stream.
|
||||
*/
|
||||
|
@ -25,42 +25,45 @@
|
||||
|
||||
package java.util.zip;
|
||||
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.util.zip.ZipConstants.*;
|
||||
import static java.util.zip.ZipConstants64.*;
|
||||
|
||||
class ZipUtils {
|
||||
|
||||
// used to adjust values between Windows and java epoch
|
||||
private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
|
||||
|
||||
/**
|
||||
* Converts Windows time (in microseconds, UTC/GMT) time to Java time.
|
||||
* Converts Windows time (in microseconds, UTC/GMT) time to FileTime.
|
||||
*/
|
||||
public static final long winToJavaTime(long wtime) {
|
||||
return TimeUnit.MILLISECONDS.convert(
|
||||
wtime / 10 + WINDOWS_EPOCH_IN_MICROSECONDS, TimeUnit.MICROSECONDS);
|
||||
public static final FileTime winTimeToFileTime(long wtime) {
|
||||
return FileTime.from(wtime / 10 + WINDOWS_EPOCH_IN_MICROSECONDS,
|
||||
TimeUnit.MICROSECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Java time to Windows time.
|
||||
* Converts FileTime to Windows time.
|
||||
*/
|
||||
public static final long javaToWinTime(long time) {
|
||||
return (TimeUnit.MICROSECONDS.convert(time, TimeUnit.MILLISECONDS)
|
||||
- WINDOWS_EPOCH_IN_MICROSECONDS) * 10;
|
||||
public static final long fileTimeToWinTime(FileTime ftime) {
|
||||
return (ftime.to(TimeUnit.MICROSECONDS) - WINDOWS_EPOCH_IN_MICROSECONDS) * 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts "standard Unix time"(in seconds, UTC/GMT) to Java time
|
||||
* Converts "standard Unix time"(in seconds, UTC/GMT) to FileTime
|
||||
*/
|
||||
public static final long unixToJavaTime(long utime) {
|
||||
return TimeUnit.MILLISECONDS.convert(utime, TimeUnit.SECONDS);
|
||||
public static final FileTime unixTimeToFileTime(long utime) {
|
||||
return FileTime.from(utime, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Java time to "standard Unix time".
|
||||
* Converts FileTime to "standard Unix time".
|
||||
*/
|
||||
public static final long javaToUnixTime(long time) {
|
||||
return TimeUnit.SECONDS.convert(time, TimeUnit.MILLISECONDS);
|
||||
public static final long fileTimeToUnixTime(FileTime ftime) {
|
||||
return ftime.to(TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,7 +95,6 @@ class ZipUtils {
|
||||
d.getSeconds() >> 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches unsigned 16-bit value from byte array at specified offset.
|
||||
* The bytes are assumed to be in Intel (little-endian) byte order.
|
||||
@ -116,5 +118,4 @@ class ZipUtils {
|
||||
public static final long get64(byte b[], int off) {
|
||||
return get32(b, off) | (get32(b, off+4) << 32);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ public class PBEParameterSpec implements AlgorithmParameterSpec {
|
||||
* @param salt the salt. The contents of <code>salt</code> are copied
|
||||
* to protect against subsequent modification.
|
||||
* @param iterationCount the iteration count.
|
||||
* @param paramSpec the cipher algorithm parameter specification.
|
||||
* @param paramSpec the cipher algorithm parameter specification, which
|
||||
* may be null.
|
||||
* @exception NullPointerException if <code>salt</code> is null.
|
||||
*
|
||||
* @since 1.8
|
||||
|
@ -156,9 +156,10 @@ public abstract class Policy {
|
||||
|
||||
private static Policy policy;
|
||||
private static ClassLoader contextClassLoader;
|
||||
private final static String AUTH_POLICY =
|
||||
"sun.security.provider.AuthPolicyFile";
|
||||
|
||||
// true if a custom (not com.sun.security.auth.PolicyFile) system-wide
|
||||
// policy object is set
|
||||
// true if a custom (not AUTH_POLICY) system-wide policy object is set
|
||||
private static boolean isCustomPolicy;
|
||||
|
||||
static {
|
||||
@ -220,7 +221,7 @@ public abstract class Policy {
|
||||
}
|
||||
});
|
||||
if (policy_class == null) {
|
||||
policy_class = "com.sun.security.auth.PolicyFile";
|
||||
policy_class = AUTH_POLICY;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -236,8 +237,7 @@ public abstract class Policy {
|
||||
contextClassLoader).newInstance();
|
||||
}
|
||||
});
|
||||
isCustomPolicy =
|
||||
!finalClass.equals("com.sun.security.auth.PolicyFile");
|
||||
isCustomPolicy = !finalClass.equals(AUTH_POLICY);
|
||||
} catch (Exception e) {
|
||||
throw new SecurityException
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
@ -274,14 +274,14 @@ public abstract class Policy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a custom (not com.sun.security.auth.PolicyFile)
|
||||
* system-wide policy object has been set or installed. This method is
|
||||
* called by SubjectDomainCombiner to provide backwards compatibility for
|
||||
* Returns true if a custom (not AUTH_POLICY) system-wide policy object
|
||||
* has been set or installed. This method is called by
|
||||
* SubjectDomainCombiner to provide backwards compatibility for
|
||||
* developers that provide their own javax.security.auth.Policy
|
||||
* implementations.
|
||||
*
|
||||
* @return true if a custom (not com.sun.security.auth.PolicyFile)
|
||||
* system-wide policy object has been set; false otherwise
|
||||
* @return true if a custom (not AUTH_POLICY) system-wide policy object
|
||||
* has been set; false otherwise
|
||||
*/
|
||||
static boolean isCustomPolicySet(Debug debug) {
|
||||
if (policy != null) {
|
||||
@ -299,8 +299,7 @@ public abstract class Policy {
|
||||
return Security.getProperty("auth.policy.provider");
|
||||
}
|
||||
});
|
||||
if (policyClass != null
|
||||
&& !policyClass.equals("com.sun.security.auth.PolicyFile")) {
|
||||
if (policyClass != null && !policyClass.equals(AUTH_POLICY)) {
|
||||
if (debug != null) {
|
||||
debug.println("Providing backwards compatibility for " +
|
||||
"javax.security.auth.policy implementation: " +
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user