提交 90cdb0ed 编写于 作者: L lana

Merge

......@@ -31,13 +31,6 @@ BUILDDIR = ../..
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
ifndef OPENJDK
ORG_EXISTS := $(call DirExists,$(CLOSED_SRC)/share/classes/sun/org,,)
ifneq ("$(ORG_EXISTS)", "")
SCRIPT_SUBDIR = script
endif
endif
# jarsigner is part of JRE
SUBDIRS = java security net/ssl jarsigner
......
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# 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.
#
BUILDDIR = ../../..
PACKAGE = com.sun.script
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
AUTO_FILES_JAVA_DIRS = com/sun/script
#
# Files that need to be copied
#
SERVICEDIR = $(CLASSBINDIR)/META-INF/services
FILES_copy = \
$(SERVICEDIR)/javax.script.ScriptEngineFactory
include $(BUILDDIR)/common/Classes.gmk
all: classes copy-files
#
# Copy the service provider configuration file into the resource
# directory.
#
copy-files: $(FILES_copy)
$(SERVICEDIR)/%: $(SHARE_SRC)/classes/com/sun/script/javascript/META-INF/services/%
$(install-file)
.PHONY: copy-files
clean::
$(RM) -r $(CLASSDESTDIR)/com/sun/script/javascript
$(RM) $(FILES_copy)
......@@ -969,26 +969,35 @@ else
# Create the list of db *.zip files to bundle with jdk
ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
DB_BINARY_BUNDLE = $(shell $(LS) $(ABS_DB_PATH)/db-derby-*-bin.zip 2>/dev/null)
# Java DB image. Move the Java DB demo directory into the JDK's demo
# dir and in the process, rename it to db. Also remove index.html,
# since it presumes docs are co-located. Also remove register.html (no
# longer relevant).
initial-image-jdk-db: $(DB_ZIP_LIST)
# since it presumes docs are co-located, javadoc, docs and tests and
# update the copyright year of the JDK READMEs to that of the release.
initial-image-jdk-db: $(DB_BINARY_BUNDLE)
$(MKDIR) -p $(JDK_IMAGE_DIR)/db
for d in $(DB_ZIP_LIST); do \
($(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
done
$(CP) $(ABS_DB_PATH)/README-JDK.html $(JDK_IMAGE_DIR)/db
$(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $(DB_BINARY_BUNDLE)
$(CD) $(JDK_IMAGE_DIR)/db && $(MV) db-derby-*-bin/* .
$(CD) $(JDK_IMAGE_DIR)/db && $(RM) -r db-derby-*-bin
$(CAT) $(ABS_DB_PATH)/README-JDK.html | \
$(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > \
$(JDK_IMAGE_DIR)/db/README-JDK.html
$(CAT) $(ABS_DB_PATH)/3RDPARTY | \
$(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > \
$(JDK_IMAGE_DIR)/db/3RDPARTY
ifndef NO_DEMOS
$(RM) -rf $(DEMODIR)/db
$(RM) -r $(DEMODIR)/db
$(MV) $(JDK_IMAGE_DIR)/db/demo $(DEMODIR)/db
$(CP) $(ABS_DB_PATH)/README-JDK-DEMOS.html $(DEMODIR)/db/
$(CAT) $(ABS_DB_PATH)/README-JDK-DEMOS.html | \
$(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > \
$(DEMODIR)/db/README-JDK-DEMOS.html
else
$(RM) -rf $(JDK_IMAGE_DIR)/db/demo
$(RM) -r $(JDK_IMAGE_DIR)/db/demo
endif
$(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/register.html
@# remove stuff from original distro we don't want
$(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/KEYS
$(RM) -r $(JDK_IMAGE_DIR)/db/{docs,javadoc,test}
endif
# The launcher source files we need for src.zip
......
......@@ -31,12 +31,6 @@ BUILDDIR = ..
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
# Rhino/Mozilla java sources
ORG_EXISTS := $(call DirExists,$(CLOSED_SRC)/share/classes/sun/org,,)
ifneq ("$(ORG_EXISTS)", "")
ORG_SUBDIR = org
endif
# Non windows subdirs
ifneq ($(PLATFORM), windows)
ifndef OPENJDK
......@@ -83,7 +77,7 @@ SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \
$(LWAWT_PRE_SUBDIR) $(DISPLAY_LIBS) $(DGA_SUBDIR) $(LWAWT_SUBDIR) \
jawt font jpeg cmm $(DISPLAY_TOOLS)
SUBDIRS_management = management
SUBDIRS_misc = $(ORG_SUBDIR) rmi tracing
SUBDIRS_misc = rmi tracing
SUBDIRS_tools = native2ascii serialver tools jconsole
ifndef OPENJDK
......
......@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2012i
tzdata2013c
......@@ -27,9 +27,9 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# From Paul Eggert (2013-02-21):
#
# A good source for time zone historical data outside the U.S. is
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
......@@ -48,6 +48,10 @@
# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
# I found in the UCLA library.
#
# For data circa 1899, a common source is:
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>.
#
# A reliable and entertaining source about time zones is
# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
#
......@@ -139,8 +143,12 @@ Zone Africa/Porto-Novo 0:10:28 - LMT 1912
1:00 - WAT
# Botswana
# From Paul Eggert (2013-02-21):
# Milne says they were regulated by the Cape Town Signal in 1899;
# assume they switched to 2:00 when Cape Town did.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Gaborone 1:43:40 - LMT 1885
1:30 - SAST 1903 Mar
2:00 - CAT 1943 Sep 19 2:00
2:00 1:00 CAST 1944 Mar 19 2:00
2:00 - CAT
......@@ -212,6 +220,11 @@ Zone Africa/Djibouti 2:52:36 - LMT 1911 Jul
# Egypt
# Milne says Cairo used 2:05:08.9, the local mean time of the Abbasizeh
# observatory; round to nearest. Milne also says that the official time for
# Egypt was mean noon at the Great Pyramid, 2:04:30.5, but apparently this
# did not apply to Cairo, Alexandria, or Port Said.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Egypt 1940 only - Jul 15 0:00 1:00 S
Rule Egypt 1940 only - Oct 1 0:00 0 -
......@@ -352,7 +365,7 @@ Rule Egypt 2010 only - Sep 10 0:00 1:00 S
Rule Egypt 2010 only - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
Zone Africa/Cairo 2:05:09 - LMT 1900 Oct
2:00 Egypt EE%sT
# Equatorial Guinea
......@@ -447,6 +460,20 @@ Zone Africa/Monrovia -0:43:08 - LMT 1882
# Libya
# From Even Scharning (2012-11-10):
# Libya set their time one hour back at 02:00 on Saturday November 10.
# http://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
# Here is an official source [in Arabic]: http://ls.ly/fb6Yc
#
# Steffen Thorsen forwarded a translation (2012-11-10) in
# http://mm.icann.org/pipermail/tz/2012-November/018451.html
#
# From Tim Parenti (2012-11-11):
# Treat the 2012-11-10 change as a zone change from UTC+2 to UTC+1.
# The DST rules planned for 2013 and onward roughly mirror those of Europe
# (either two days before them or five days after them, so as to fall on
# lastFri instead of lastSun).
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Libya 1951 only - Oct 14 2:00 1:00 S
Rule Libya 1952 only - Jan 1 0:00 0 -
......@@ -461,17 +488,21 @@ Rule Libya 1986 only - Apr 4 0:00 1:00 S
Rule Libya 1986 only - Oct 3 0:00 0 -
Rule Libya 1987 1989 - Apr 1 0:00 1:00 S
Rule Libya 1987 1989 - Oct 1 0:00 0 -
Rule Libya 1997 only - Apr 4 0:00 1:00 S
Rule Libya 1997 only - Oct 4 0:00 0 -
Rule Libya 2013 max - Mar lastFri 1:00 1:00 S
Rule Libya 2013 max - Oct lastFri 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Tripoli 0:52:44 - LMT 1920
1:00 Libya CE%sT 1959
2:00 - EET 1982
1:00 Libya CE%sT 1990 May 4
# The following entries are from Shanks & Pottenger;
# The 1996 and 1997 entries are from Shanks & Pottenger;
# the IATA SSIM data contain some obvious errors.
2:00 - EET 1996 Sep 30
1:00 - CET 1997 Apr 4
1:00 1:00 CEST 1997 Oct 4
2:00 - EET
1:00 Libya CE%sT 1997 Oct 4
2:00 - EET 2012 Nov 10 2:00
1:00 Libya CE%sT
# Madagascar
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
......@@ -838,6 +869,41 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# 3:00 am Friday, July 20, 2012 and will again be advanced by 60 minutes
# August 20, 2012 from 2:00 am.
# From Paul Eggert (2013-03-06):
# Morocco's daylight-saving transitions due to Ramadan seem to be
# announced a bit in advance. On 2012-07-11 the Moroccan government
# 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>.
#
# To estimate what the Moroccan government will do in future years,
# transition dates for 2013 through 2021 were determined by running
# the following program under GNU Emacs 24.3:
#
# (let ((islamic-year 1434))
# (while (< islamic-year 1444)
# (let ((a
# (calendar-gregorian-from-absolute
# (calendar-islamic-to-absolute (list 9 1 islamic-year))))
# (b
# (calendar-gregorian-from-absolute
# (calendar-islamic-to-absolute (list 10 1 islamic-year)))))
# (insert
# (format
# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t %2d\t 3:00\t0\t-\n"
# "Rule\tMorocco\t%d\tonly\t-\t%s\t %2d\t 2:00\t1:00\tS\n")
# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)))))
# (setq islamic-year (+ 1 islamic-year))))
#
# with the results hand-edited for 2020-2022, when the normal spring-forward
# date falls during the estimated Ramadan.
#
# From 2023 through 2038 Ramadan is not predicted to overlap with
# daylight saving time. Starting in 2039 there will be overlap again,
# but 32-bit time_t values roll around in 2038 so for now do not worry
# about dates after 2038.
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
......@@ -863,10 +929,28 @@ Rule Morocco 2010 only - May 2 0:00 1:00 S
Rule Morocco 2010 only - Aug 8 0:00 0 -
Rule Morocco 2011 only - Apr 3 0:00 1:00 S
Rule Morocco 2011 only - Jul 31 0 0 -
Rule Morocco 2012 max - Apr lastSun 2:00 1:00 S
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 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 -
Rule Morocco 2015 only - Jul 18 2:00 1:00 S
Rule Morocco 2016 only - Jun 7 3:00 0 -
Rule Morocco 2016 only - Jul 7 2:00 1:00 S
Rule Morocco 2017 only - May 27 3:00 0 -
Rule Morocco 2017 only - Jun 26 2:00 1:00 S
Rule Morocco 2018 only - May 16 3:00 0 -
Rule Morocco 2018 only - Jun 15 2:00 1:00 S
Rule Morocco 2019 only - May 6 3:00 0 -
Rule Morocco 2019 only - Jun 5 2:00 1:00 S
Rule Morocco 2020 only - May 24 2:00 1:00 S
Rule Morocco 2021 only - May 13 2:00 1:00 S
Rule Morocco 2022 only - May 3 2:00 1:00 S
Rule Morocco 2023 max - Apr lastSun 2:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
......
......@@ -73,38 +73,8 @@ Rule ChileAQ 2009 only - Mar Sun>=9 3:00u 0 -
Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 -
Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 -
Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S
Rule ChileAQ 2012 only - Apr Sun>=23 3:00u 0 -
Rule ChileAQ 2012 only - Sep Sun>=2 4:00u 1:00 S
Rule ChileAQ 2013 max - Mar Sun>=9 3:00u 0 -
Rule ChileAQ 2013 max - Oct Sun>=9 4:00u 1:00 S
# These rules are stolen from the `australasia' file.
Rule AusAQ 1917 only - Jan 1 0:01 1:00 -
Rule AusAQ 1917 only - Mar 25 2:00 0 -
Rule AusAQ 1942 only - Jan 1 2:00 1:00 -
Rule AusAQ 1942 only - Mar 29 2:00 0 -
Rule AusAQ 1942 only - Sep 27 2:00 1:00 -
Rule AusAQ 1943 1944 - Mar lastSun 2:00 0 -
Rule AusAQ 1943 only - Oct 3 2:00 1:00 -
Rule ATAQ 1967 only - Oct Sun>=1 2:00s 1:00 -
Rule ATAQ 1968 only - Mar lastSun 2:00s 0 -
Rule ATAQ 1968 1985 - Oct lastSun 2:00s 1:00 -
Rule ATAQ 1969 1971 - Mar Sun>=8 2:00s 0 -
Rule ATAQ 1972 only - Feb lastSun 2:00s 0 -
Rule ATAQ 1973 1981 - Mar Sun>=1 2:00s 0 -
Rule ATAQ 1982 1983 - Mar lastSun 2:00s 0 -
Rule ATAQ 1984 1986 - Mar Sun>=1 2:00s 0 -
Rule ATAQ 1986 only - Oct Sun>=15 2:00s 1:00 -
Rule ATAQ 1987 1990 - Mar Sun>=15 2:00s 0 -
Rule ATAQ 1987 only - Oct Sun>=22 2:00s 1:00 -
Rule ATAQ 1988 1990 - Oct lastSun 2:00s 1:00 -
Rule ATAQ 1991 1999 - Oct Sun>=1 2:00s 1:00 -
Rule ATAQ 1991 2005 - Mar lastSun 2:00s 0 -
Rule ATAQ 2000 only - Aug lastSun 2:00s 1:00 -
Rule ATAQ 2001 max - Oct Sun>=1 2:00s 1:00 -
Rule ATAQ 2006 only - Apr Sun>=1 2:00s 0 -
Rule ATAQ 2007 only - Mar lastSun 2:00s 0 -
Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 -
Rule ChileAQ 2012 max - Apr Sun>=23 3:00u 0 -
Rule ChileAQ 2012 max - Sep Sun>=2 4:00u 1:00 S
# Argentina - year-round bases
# Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
......@@ -147,10 +117,7 @@ Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 -
# </a>
# From Steffen Thorsen (2010-03-10):
# We got these changes from the Australian Antarctic Division:
# - 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.
# We got these changes from the Australian Antarctic Division: ...
#
# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
# The change to UTC+11 is being considered as a regular summer thing but
......@@ -161,9 +128,6 @@ Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 -
#
# - Mawson station stays on UTC+5.
#
# In addition to the Rule changes for Casey/Davis, it means that Macquarie
# will no longer be like Hobart and will have to have its own Zone created.
#
# Background:
# <a href="http://www.timeanddate.com/news/time/antartica-time-changes-2010.html">
# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
......@@ -190,12 +154,6 @@ Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
6:00 - MAWT 2009 Oct 18 2:00
# Mawson Time
5:00 - MAWT
Zone Antarctica/Macquarie 0 - zzz 1911
10:00 - EST 1916 Oct 1 2:00
10:00 1:00 EST 1917 Feb
10:00 AusAQ EST 1967
10:00 ATAQ EST 2010 Apr 4 3:00
11:00 - MIST # Macquarie Island Time
# References:
# <a href="http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html">
# Casey Weather (1998-02-26)
......
......@@ -27,9 +27,9 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# From Paul Eggert (2013-02-21):
#
# A good source for time zone historical data outside the U.S. is
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
......@@ -48,6 +48,10 @@
# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
# I found in the UCLA library.
#
# For data circa 1899, a common source is:
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>.
#
# A reliable and entertaining source about time zones is
# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
#
......@@ -302,9 +306,12 @@ Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan
8:00 - BNT
# Burma / Myanmar
# Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Rangoon 6:24:40 - LMT 1880 # or Yangon
6:24:36 - RMT 1920 # Rangoon Mean Time?
6:24:40 - RMT 1920 # Rangoon Mean Time?
6:30 - BURT 1942 May # Burma Time
9:00 - JST 1945 May 3
6:30 - MMT # Myanmar Time
......@@ -407,7 +414,8 @@ Zone Asia/Harbin 8:26:44 - LMT 1928 # or Haerbin
8:00 PRC C%sT
# Zhongyuan Time ("Central plain Time")
# most of China
Zone Asia/Shanghai 8:05:52 - LMT 1928
# Milne gives 8:05:56.7; round to nearest.
Zone Asia/Shanghai 8:05:57 - LMT 1928
8:00 Shang C%sT 1949
8:00 PRC C%sT
# Long-shu Time (probably due to Long and Shu being two names of that area)
......@@ -504,6 +512,10 @@ Zone Asia/Kashgar 5:03:56 - LMT 1928 # or Kashi or Kaxgar
8:00 PRC C%sT
# Hong Kong (Xianggang)
# Milne gives 7:36:41.7; round this.
# From Lee Yiu Chung (2009-10-24):
# I found there are some mistakes for the...DST rule for Hong
# Kong. [According] to the DST record from Hong Kong Observatory (actually,
......@@ -570,7 +582,6 @@ Zone Asia/Kashgar 5:03:56 - LMT 1928 # or Kashi or Kaxgar
# The Japanese surrender of Hong Kong was signed 1945-09-15.
# For lack of anything better, use start of those days as the transition times.
# Hong Kong (Xianggang)
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule HK 1941 only - Apr 1 3:30 1:00 S
Rule HK 1941 only - Sep 30 3:30 0 -
......@@ -592,7 +603,7 @@ Rule HK 1973 only - Dec 30 3:30 1:00 S
Rule HK 1979 only - May Sun>=8 3:30 1:00 S
Rule HK 1979 only - Oct Sun>=16 3:30 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Hong_Kong 7:36:36 - LMT 1904 Oct 30
Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30
8:00 HK HK%sT 1941 Dec 25
9:00 - JST 1945 Sep 15
8:00 HK HK%sT
......@@ -669,6 +680,9 @@ Zone Asia/Macau 7:34:20 - LMT 1912
###############################################################################
# Cyprus
#
# Milne says the Eastern Telegraph Company used 2:14:00. Stick with LMT.
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cyprus 1975 only - Apr 13 0:00 1:00 S
Rule Cyprus 1975 only - Oct 12 0:00 0 -
......@@ -1222,7 +1236,6 @@ 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
......@@ -1235,6 +1248,10 @@ Rule Zion 2012 only - Sep 23 2:00 0 S
# 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.
# 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
......@@ -1824,8 +1841,11 @@ Zone Asia/Kathmandu 5:41:16 - LMT 1920
5:45 - NPT # Nepal Time
# Oman
# Milne says 3:54:24 was the meridian of the Muscat Tidal Observatory.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Muscat 3:54:20 - LMT 1920
Zone Asia/Muscat 3:54:24 - LMT 1920
4:00 - GST
# Pakistan
......@@ -2072,8 +2092,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# occurred before our cutoff date of 1970.
# However, as we get more information, we may need to add entries
# for parts of the West Bank as they transitioned from Israel's rules
# to Palestine's rules. If you have more info about this, please
# send it to tz@elsie.nci.nih.gov for incorporation into future editions.
# to Palestine's rules.
# From IINS News Service - Israel - 1998-03-23 10:38:07 Israel time,
# forwarded by Ephraim Silverberg:
......@@ -2295,11 +2314,20 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
# </a>
# From Arthur David Olson (2012-03-27):
# The timeanddate article for 2012 says that "the end date has not yet been
# announced" and that "Last year, both...paused daylight saving time during...
# Ramadan. It is not yet known [for] 2012."
# For now, assume both switch back on the last Friday in September. XXX
# From Steffen Thorsen (2013-03-26):
# The following news sources tells that Palestine will "start daylight saving
# time from midnight on Friday, March 29, 2013" (translated).
# [These are in Arabic and are for Gaza and for Ramallah, respectively.]
# http://www.samanews.com/index.php?act=Show&id=154120
# http://safa.ps/details/news/99844/%D8%B1%D8%A7%D9%85-%D8%A7%D9%84%D9%84%D9%87-%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-29-%D8%A7%D9%84%D8%AC%D8%A7%D8%B1%D9%8A.html
# From Paul Eggert (2013-04-15):
# For future dates, guess the last Thursday in March at 24:00 through
# the first Friday on or after September 21 at 01:00. This is consistent with
# the predictions in today's editions of the following URLs,
# which are for Gaza and Hebron respectively:
# http://www.timeanddate.com/worldclock/timezone.html?n=702
# http://www.timeanddate.com/worldclock/timezone.html?n=2364
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
......@@ -2313,19 +2341,20 @@ Rule Palestine 1999 2005 - Apr Fri>=15 0:00 1:00 S
Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 -
Rule Palestine 2004 only - Oct 1 1:00 0 -
Rule Palestine 2005 only - Oct 4 2:00 0 -
Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S
Rule Palestine 2006 2007 - Apr 1 0:00 1:00 S
Rule Palestine 2006 only - Sep 22 0:00 0 -
Rule Palestine 2007 only - Sep Thu>=8 2:00 0 -
Rule Palestine 2008 only - Aug lastFri 0:00 0 -
Rule Palestine 2009 only - Mar lastFri 0:00 1:00 S
Rule Palestine 2009 only - Sep Fri>=1 2:00 0 -
Rule Palestine 2010 only - Mar lastSat 0:01 1:00 S
Rule Palestine 2008 2009 - Mar lastFri 0:00 1:00 S
Rule Palestine 2008 only - Sep 1 0:00 0 -
Rule Palestine 2009 only - Sep Fri>=1 1:00 0 -
Rule Palestine 2010 only - Mar 26 0:00 1:00 S
Rule Palestine 2010 only - Aug 11 0:00 0 -
# From Arthur David Olson (2011-09-20):
# 2011 transitions per http://www.timeanddate.com as of 2011-09-20.
# From Paul Eggert (2012-10-12):
# 2012 transitions per http://www.timeanddate.com as of 2012-10-12.
Rule Palestine 2011 only - Apr 1 0:01 1:00 S
Rule Palestine 2011 only - Aug 1 0:00 0 -
Rule Palestine 2011 only - Aug 30 0:00 1:00 S
Rule Palestine 2011 only - Sep 30 0:00 0 -
Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S
Rule Palestine 2012 max - Sep Fri>=21 1:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
......@@ -2333,26 +2362,20 @@ Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
2:00 EgyptAsia EE%sT 1967 Jun 5
2:00 Zion I%sT 1996
2:00 Jordan EE%sT 1999
2:00 Palestine EE%sT 2011 Apr 2 12:01
2:00 1:00 EEST 2011 Aug 1
2:00 - EET 2012 Mar 30
2:00 1:00 EEST 2012 Sep 21 1:00
2:00 - EET
2:00 Palestine EE%sT 2008 Aug 29 0:00
2:00 - EET 2008 Sep
2:00 Palestine EE%sT 2010
2:00 - EET 2010 Mar 27 0:01
2:00 Palestine EE%sT 2011 Aug 1
2:00 - EET 2012
2:00 Palestine EE%sT
Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
2:00 Zion EET 1948 May 15
2:00 EgyptAsia EE%sT 1967 Jun 5
2:00 Zion I%sT 1996
2:00 Jordan EE%sT 1999
2:00 Palestine EE%sT 2008 Aug
2:00 1:00 EEST 2008 Sep
2:00 Palestine EE%sT 2011 Apr 1 12:01
2:00 1:00 EEST 2011 Aug 1
2:00 - EET 2011 Aug 30
2:00 1:00 EEST 2011 Sep 30 3:00
2:00 - EET 2012 Mar 30
2:00 1:00 EEST 2012 Sep 21 1:00
2:00 - EET
2:00 Palestine EE%sT
# Paracel Is
# no information
......@@ -2421,6 +2444,13 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1
# no information
# Sri Lanka
# From Paul Eggert (2013-02-21):
# Milne says "Madras mean time use from May 1, 1898. Prior to this Colombo
# mean time, 5h. 4m. 21.9s. F., was used." But 5:04:21.9 differs considerably
# from Colombo's meridian 5:19:24, so for now ignore Milne and stick with
# Shanks and Pottenger.
# From Paul Eggert (1996-09-03):
# "Sri Lanka advances clock by an hour to avoid blackout"
# (www.virtual-pc.com/lankaweb/news/items/240596-2.html, 1996-05-24,
......@@ -2720,6 +2750,12 @@ Zone Asia/Tashkent 4:37:12 - LMT 1924 May 2
# Vietnam
# From Paul Eggert (2013-02-21):
# Milne gives 7:16:56 for the meridian of Saigon in 1899, as being
# used in Lower Laos, Cambodia, and Annam. But this is quite a ways
# from Saigon's location. For now, ignore this and stick with Shanks
# and Pottenger.
# From Arthur David Olson (2008-03-18):
# The English-language name of Vietnam's most populous city is "Ho Chi Min City";
# we use Ho_Chi_Minh below to avoid a name of more than 14 characters.
......@@ -2733,6 +2769,10 @@ Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jun 9
7:00 - ICT
# Yemen
# Milne says 2:59:54 was the meridian of the saluting battery at Aden,
# and that Yemen was at 1:55:56, the meridian of the Hagia Sophia.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Aden 3:00:48 - LMT 1950
Zone Asia/Aden 2:59:54 - LMT 1950
3:00 - AST
......@@ -241,9 +241,26 @@ Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb
# no times are set
#
# Macquarie
# permanent occupation (scientific station) since 1948;
# sealing and penguin oil station operated 1888/1917
# like Australia/Hobart
# Permanent occupation (scientific station) 1911-1915 and since 25 March 1948;
# sealing and penguin oil station operated Nov 1899 to Apr 1919. See the
# Tasmania Parks & Wildlife Service history of sealing at Macquarie Island
# <http://www.parks.tas.gov.au/index.aspx?base=1828>
# <http://www.parks.tas.gov.au/index.aspx?base=1831>.
# Guess that it was like Australia/Hobart while inhabited before 2010.
#
# From Steffen Thorsen (2010-03-10):
# We got these changes from the Australian Antarctic Division:
# - 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.
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
0 - zzz 1948 Mar 25
10:00 Aus EST 1967
10:00 AT EST 2010 Apr 4 3:00
11:00 - MIST # Macquarie I Standard Time
# Christmas
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
......@@ -269,6 +286,9 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
6:30 - CCT # Cocos Islands Time
# Fiji
# Milne gives 11:55:44 for Suva.
# From Alexander Krivenyshev (2009-11-10):
# According to Fiji Broadcasting Corporation, Fiji plans to re-introduce DST
# from November 29th 2009 to April 25th 2010.
......@@ -362,7 +382,7 @@ Rule Fiji 2010 max - Oct Sun>=18 2:00 1:00 S
Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2012 max - Jan Sun>=18 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time
# French Polynesia
......@@ -803,9 +823,9 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# From Paul Eggert (2013-02-21):
# A good source for time zone historical data outside the U.S. is
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
# San Diego: ACS Publications, Inc. (2003).
......@@ -823,6 +843,10 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
# I found in the UCLA library.
#
# For data circa 1899, a common source is:
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>.
#
# A reliable and entertaining source about time zones is
# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
#
......
......@@ -27,7 +27,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# A good source for time zone historical data outside the U.S. is
......@@ -53,6 +53,12 @@
# William Willett, The Waste of Daylight, 19th edition
# </a> (1914-03)
#
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>. He writes:
# "It is requested that corrections and additions to these tables
# may be sent to Mr. John Milne, Royal Geographical Society,
# Savile Row, London." Nowadays please email them to tz@iana.org.
#
# Brazil's Departamento Servico da Hora (DSH),
# <a href="http://pcdsh01.on.br/HISTHV.htm">
# History of Summer Time
......@@ -689,6 +695,8 @@ Zone Europe/Andorra 0:06:04 - LMT 1901
# Austria
# Milne says Vienna time was 1:05:21.
# From Paul Eggert (2006-03-22): Shanks & Pottenger give 1918-06-16 and
# 1945-11-18, but the Austrian Federal Office of Metrology and
# Surveying (BEV) gives 1918-09-16 and for Vienna gives the "alleged"
......@@ -706,7 +714,7 @@ Rule Austria 1948 only - Apr 18 2:00s 1:00 S
Rule Austria 1980 only - Apr 6 0:00 1:00 S
Rule Austria 1980 only - Sep 28 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Vienna 1:05:20 - LMT 1893 Apr
Zone Europe/Vienna 1:05:21 - LMT 1893 Apr
1:00 C-Eur CE%sT 1920
1:00 Austria CE%sT 1940 Apr 1 2:00s
1:00 C-Eur CE%sT 1945 Apr 2 2:00s
......@@ -1262,6 +1270,21 @@ Zone Europe/Berlin 0:53:28 - LMT 1893 Apr
1:00 Germany CE%sT 1980
1:00 EU CE%sT
# From Tobias Conradi (2011-09-12):
# Busingen <http://www.buesingen.de>, surrounded by the Swiss canton
# Schaffhausen, did not start observing DST in 1980 as the rest of DE
# (West Germany at that time) and DD (East Germany at that time) did.
# DD merged into DE, the area is currently covered by code DE in ISO 3166-1,
# which in turn is covered by the zone Europe/Berlin.
#
# Source for the time in Busingen 1980:
# http://www.srf.ch/player/video?id=c012c029-03b7-4c2b-9164-aa5902cd58d3
# From Arthur David Olson (2012-03-03):
# Busingen and Zurich have shared clocks since 1970.
Link Europe/Zurich Europe/Busingen
# Georgia
# Please see the "asia" file for Asia/Tbilisi.
# Herodotus (Histories, IV.45) says Georgia north of the Phasis (now Rioni)
......@@ -2066,6 +2089,70 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct
# Russia
# From Alexander Krivenyshev (2011-09-15):
# Based on last Russian Government Decree # 725 on August 31, 2011
# (Government document
# <a href="http://www.government.ru/gov/results/16355/print/">
# http://www.government.ru/gov/results/16355/print/
# </a>
# in Russian)
# there are few corrections have to be made for some Russian time zones...
# All updated Russian Time Zones were placed in table and translated to English
# by WorldTimeZone.com at the link below:
# <a href="http://www.worldtimezone.com/dst_news/dst_news_russia36.htm">
# http://www.worldtimezone.com/dst_news/dst_news_russia36.htm
# </a>
# From Sanjeev Gupta (2011-09-27):
# Scans of [Decree #23 of January 8, 1992] are available at:
# <a href="http://government.consultant.ru/page.aspx?1223966">
# http://government.consultant.ru/page.aspx?1223966
# They are in Cyrillic letters (presumably Russian).
# From Arthur David Olson (2012-05-09):
# Regarding the instant when clocks in time-zone-shifting parts of Russia
# changed in September 2011:
#
# One source is
# < a href="http://government.ru/gov/results/16355/>
# http://government.ru/gov/results/16355/
# </a>
# which, according to translate.google.com, begins "Decree of August 31,
# 2011 No 725" and contains no other dates or "effective date" information.
#
# Another source is
# <a href="http://www.rg.ru/2011/09/06/chas-zona-dok.html">
# http://www.rg.ru/2011/09/06/chas-zona-dok.html
# </a>
# which, according to translate.google.com, begins "Resolution of the
# Government of the Russian Federation on August 31, 2011 N 725" and also
# contains "Date first official publication: September 6, 2011 Posted on:
# in the 'RG' - Federal Issue number 5573 September 6, 2011" but which
# does not contain any "effective date" information.
#
# Another source is
# <a href="http://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7">
# http://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7
# </a>
# which, in note 8, contains "Resolution #725 of August 31, 2011...
# Effective as of after 7 days following the day of the official publication"
# but which does not contain any reference to September 6, 2011.
#
# The Wikipedia article refers to
# <a href="http://base.consultant.ru/cons/cgi/online.cgi?req=doc;base=LAW;n=118896">
# http://base.consultant.ru/cons/cgi/online.cgi?req=doc;base=LAW;n=118896
# </a>
# which seems to copy the text of the government.ru page.
#
# Tobias Conradi combines Wikipedia's
# "as of after 7 days following the day of the official publication"
# with www.rg.ru's "Date of first official publication: September 6, 2011" to get
# September 13, 2011 as the cutover date (unusually, a Tuesday, as Tobias Conradi notes).
#
# None of the sources indicates a time of day for changing clocks.
#
# Go with 2011-09-13 0:00s.
# From Paul Eggert (2006-03-22):
# Except for Moscow after 1919-07-01, I invented the time zone abbreviations.
# Moscow time zone abbreviations after 1919-07-01, and Moscow rules after 1991,
......@@ -2293,14 +2380,32 @@ Zone Asia/Yakutsk 8:38:40 - LMT 1919 Dec 15
# [parts of] Respublika Sakha (Yakutiya).
# From Oscar van Vlijmen (2009-11-29):
# The Sakha districts are: Bulunskij, Verkhoyanskij, Tomponskij, Ust'-Majskij,
# Ust'-Yanskij.
# The Sakha districts are: Bulunskij, Verkhoyanskij, ... Ust'-Yanskij.
Zone Asia/Vladivostok 8:47:44 - LMT 1922 Nov 15
9:00 - VLAT 1930 Jun 21 # Vladivostok Time
10:00 Russia VLA%sT 1991 Mar 31 2:00s
9:00 Russia VLA%sST 1992 Jan 19 2:00s
10:00 Russia VLA%sT 2011 Mar 27 2:00s
11:00 - VLAT
# From Arthur David Olson (2012-05-09):
# Tomponskij and Ust'-Majskij switched from Vladivostok time to Yakutsk time
# in 2011.
#
# From Paul Eggert (2012-11-25):
# Shanks and Pottenger (2003) has Khandyga on Yakutsk time.
# Make a wild guess that it switched to Vladivostok time in 2004.
# This transition is no doubt wrong, but we have no better info.
#
Zone Asia/Khandyga 9:02:13 - LMT 1919 Dec 15
8:00 - YAKT 1930 Jun 21 # Yakutsk Time
9:00 Russia YAK%sT 1991 Mar 31 2:00s
8:00 Russia YAK%sT 1992 Jan 19 2:00s
9:00 Russia YAK%sT 2004
10:00 Russia VLA%sT 2011 Mar 27 2:00s
11:00 - VLAT 2011 Sep 13 0:00s # Decree 725?
10:00 - YAKT
#
# Sakhalinskaya oblast'.
# The Zone name should be Yuzhno-Sakhalinsk, but that's too long.
......@@ -2319,14 +2424,26 @@ Zone Asia/Sakhalin 9:30:48 - LMT 1905 Aug 23
# From Oscar van Vlijmen (2009-11-29):
# The Sakha districts are: Abyjskij, Allaikhovskij, Verkhhhnekolymskij, Momskij,
# Nizhnekolymskij, Ojmyakonskij, Srednekolymskij.
# Nizhnekolymskij, ... Srednekolymskij.
Zone Asia/Magadan 10:03:12 - LMT 1924 May 2
10:00 - MAGT 1930 Jun 21 # Magadan Time
11:00 Russia MAG%sT 1991 Mar 31 2:00s
10:00 Russia MAG%sT 1992 Jan 19 2:00s
11:00 Russia MAG%sT 2011 Mar 27 2:00s
12:00 - MAGT
#
# From Arthur David Olson (2012-05-09):
# Ojmyakonskij and the Kuril Islands switched from
# Magadan time to Vladivostok time in 2011.
Zone Asia/Ust-Nera 9:32:54 - LMT 1919 Dec 15
8:00 - YAKT 1930 Jun 21 # Yakutsk Time
9:00 Russia YAKT 1981 Apr 1
11:00 Russia MAG%sT 1991 Mar 31 2:00s
10:00 Russia MAG%sT 1992 Jan 19 2:00s
11:00 Russia MAG%sT 2011 Mar 27 2:00s
12:00 - MAGT 2011 Sep 13 0:00s # Decree 725?
11:00 - VLAT
# From Oscar van Vlijmen (2001-08-25): [This region consists of]
# Kamchatskaya oblast', Koryakskij avtonomnyj okrug.
#
......
......@@ -29,7 +29,7 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# tz@iana.org for general use in the future).
# From Paul Eggert (1999-03-22):
# A reliable and entertaining source about time zones is
......@@ -1042,6 +1042,9 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
# William Willett, The Waste of Daylight, 19th edition
# </a> (1914-03)
#
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>.
#
# See the `europe' file for Greenland.
# Canada
......@@ -2577,6 +2580,8 @@ Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
# Bahamas
#
# For 1899 Milne gives -5:09:29.5; round that.
#
# From Sue Williams (2006-12-07):
# The Bahamas announced about a month ago that they plan to change their DST
# rules to sync with the U.S. starting in 2007....
......@@ -2586,11 +2591,14 @@ Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
Rule Bahamas 1964 1975 - Oct lastSun 2:00 0 S
Rule Bahamas 1964 1975 - Apr lastSun 2:00 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Nassau -5:09:24 - LMT 1912 Mar 2
Zone America/Nassau -5:09:30 - LMT 1912 Mar 2
-5:00 Bahamas E%sT 1976
-5:00 US E%sT
# Barbados
# For 1899 Milne gives -3:58:29.2; round that.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Barb 1977 only - Jun 12 2:00 1:00 D
Rule Barb 1977 1978 - Oct Sun>=1 2:00 0 S
......@@ -2598,8 +2606,8 @@ Rule Barb 1978 1980 - Apr Sun>=15 2:00 1:00 D
Rule Barb 1979 only - Sep 30 2:00 0 S
Rule Barb 1980 only - Sep 25 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Barbados -3:58:28 - LMT 1924 # Bridgetown
-3:58:28 - BMT 1932 # Bridgetown Mean Time
Zone America/Barbados -3:58:29 - LMT 1924 # Bridgetown
-3:58:29 - BMT 1932 # Bridgetown Mean Time
-4:00 Barb A%sT
# Belize
......@@ -2617,6 +2625,9 @@ Zone America/Belize -5:52:48 - LMT 1912 Apr
# Bermuda
# For 1899 Milne gives -4:19:18.3 as the meridian of the clock tower,
# Bermuda dockyard, Ireland I; round that.
# From Dan Jones, reporting in The Royal Gazette (2006-06-26):
# Next year, however, clocks in the US will go forward on the second Sunday
......@@ -2626,7 +2637,7 @@ Zone America/Belize -5:52:48 - LMT 1912 Apr
# http://www.theroyalgazette.com/apps/pbcs.dll/article?AID=/20060529/NEWS/105290135
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Atlantic/Bermuda -4:19:04 - LMT 1930 Jan 1 2:00 # Hamilton
Zone Atlantic/Bermuda -4:19:18 - LMT 1930 Jan 1 2:00 # Hamilton
-4:00 - AST 1974 Apr 28 2:00
-4:00 Bahamas A%sT 1976
-4:00 US A%sT
......@@ -2638,6 +2649,9 @@ Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
-5:00 - EST
# Costa Rica
# Milne gives -5:36:13.3 as San Jose mean time; round to nearest.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule CR 1979 1980 - Feb lastSun 0:00 1:00 D
Rule CR 1979 1980 - Jun Sun>=1 0:00 0 S
......@@ -2648,14 +2662,19 @@ Rule CR 1991 only - Jul 1 0:00 0 S
Rule CR 1992 only - Mar 15 0:00 0 S
# There are too many San Joses elsewhere, so we'll use `Costa Rica'.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
-5:36:20 - SJMT 1921 Jan 15 # San Jose Mean Time
Zone America/Costa_Rica -5:36:13 - LMT 1890 # San Jose
-5:36:13 - SJMT 1921 Jan 15 # San Jose Mean Time
-6:00 CR C%sT
# Coco
# no information; probably like America/Costa_Rica
# Cuba
# From Paul Eggert (2013-02-21):
# Milne gives -5:28:50.45 for the observatory at Havana, -5:29:23.57
# for the port, and -5:30 for meteorological observations.
# For now, stick with Shanks & Pottenger.
# From Arthur David Olson (1999-03-29):
# The 1999-03-28 exhibition baseball game held in Havana, Cuba, between
# the Cuban National Team and the Baltimore Orioles was carried live on
......@@ -3004,24 +3023,21 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5
# apparently using the same start and end date as USA/Canada.
# So this means they have already changed their time.
#
# (Sources in French):
# <a href="http://www.alterpresse.org/spip.php?article12510">
# http://www.alterpresse.org/spip.php?article12510
# </a>
# <a href="http://radiovision2000haiti.net/home/?p=13253">
# http://radiovision2000haiti.net/home/?p=13253
# </a>
#
# Our coverage:
# <a href="http://www.timeanddate.com/news/time/haiti-dst-2012.html">
# http://www.timeanddate.com/news/time/haiti-dst-2012.html
# </a>
# From Arthur David Olson (2012-03-11):
# The alterpresse.org source seems to show a US-style leap from 2:00 a.m. to
# 3:00 a.m. rather than the traditional Haitian jump at midnight.
# Assume a US-style fall back as well XXX.
# Do not yet assume that the change carries forward past 2012 XXX.
# Assume a US-style fall back as well.
# From Steffen Thorsen (2013-03-10):
# It appears that Haiti is observing DST this year as well, same rules
# as US/Canada. They did it last year as well, and it looks like they
# are going to observe DST every year now...
#
# http://radiovision2000haiti.net/public/haiti-avis-changement-dheure-dimanche/
# http://www.canalplushaiti.net/?p=6714
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Haiti 1983 only - May 8 0:00 1:00 D
......@@ -3033,8 +3049,8 @@ Rule Haiti 1988 1997 - Apr Sun>=1 1:00s 1:00 D
Rule Haiti 1988 1997 - Oct lastSun 1:00s 0 S
Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D
Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S
Rule Haiti 2012 only - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2012 only - Nov Sun>=1 2:00 0 S
Rule Haiti 2012 max - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2012 max - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Port-au-Prince -4:49:20 - LMT 1890
-4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT
......
......@@ -27,13 +27,17 @@
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# tz@iana.org for general use in the future).
# From Paul Eggert (2006-03-22):
# A good source for time zone historical data outside the U.S. is
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
# San Diego: ACS Publications, Inc. (2003).
#
# For data circa 1899, a common source is:
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>.
#
# Gwillim Law writes that a good source
# for recent time zone data is the International Air Transport
# Association's Standard Schedules Information Manual (IATA SSIM),
......@@ -404,21 +408,11 @@ Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 S
# <a/>
# is the official page for the Province Government).
#
# There's also a note in only one of the major national papers (La Nación) at
# <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912">
# There's also a note in only one of the major national papers ...
# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
# </a>
#
# The press release says:
# (...) anunció que el próximo domingo a las 00:00 los puntanos deberán
# atrasar una hora sus relojes.
#
# A partir de entonces, San Luis establecerá el huso horario propio de
# la Provincia. De esta manera, durante el periodo del calendario anual
# 2009, el cambio horario quedará comprendido entre las 00:00 del tercer
# domingo de marzo y las 24:00 del segundo sábado de octubre.
# Quick&dirty translation
# (...) announced that next Sunday, at 00:00, Puntanos (the San Luis
# The press release says [quick and dirty translation]:
# ... announced that next Sunday, at 00:00, Puntanos (the San Luis
# inhabitants) will have to turn back one hour their clocks
#
# Since then, San Luis will establish its own Province timezone. Thus,
......@@ -480,6 +474,9 @@ Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 S
# rules...San Luis is still using "Western ARgentina Time" and it got
# stuck on Summer daylight savings time even though the summer is over.
# From Paul Eggert (2013-02-21):
# Milne says Cordoba time was -4:16:48.2. Round to the nearest second.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
# Buenos Aires (BA), Capital Federal (CF),
......@@ -835,9 +832,9 @@ Zone America/La_Paz -4:32:36 - LMT 1890
# From Guilherme Bernardes Rodrigues (2011-10-07):
# There is news in the media, however there is still no decree about it.
# I just send a e-mail to Zulmira Brandão at
# I just send a e-mail to Zulmira Brandao at
# <a href="http://pcdsh01.on.br/">http://pcdsh01.on.br/</a> the
# oficial agency about time in Brazil, and she confirmed that the old rule is
# official agency about time in Brazil, and she confirmed that the old rule is
# still in force.
# From Guilherme Bernardes Rodrigues (2011-10-14)
......@@ -1266,9 +1263,13 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# b. Saturday, September 1, 2012, clocks should go forward 60 minutes; that is,
# at 23:59:59, instead of passing to 0:00, the time should be adjusted to be
# 01:00 on September 2.
#
# Note that...this is yet another "temporary" change that will be reevaluated
# AGAIN in 2013.
# From Steffen Thorsen (2013-02-15):
# According to several news sources, Chile has extended DST this year,
# they will end DST later and start DST earlier than planned. They
# hope to save energy. The new end date is 2013-04-28 00:00 and new
# start date is 2013-09-08 00:00....
# http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
......@@ -1311,10 +1312,8 @@ Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
Rule Chile 2010 only - Apr Sun>=1 3:00u 0 -
Rule Chile 2011 only - May Sun>=2 3:00u 0 -
Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
Rule Chile 2012 only - Apr Sun>=23 3:00u 0 -
Rule Chile 2012 only - Sep Sun>=2 4:00u 1:00 S
Rule Chile 2013 max - Mar Sun>=9 3:00u 0 -
Rule Chile 2013 max - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2012 max - Apr Sun>=23 3:00u 0 -
Rule Chile 2012 max - Sep Sun>=2 4:00u 1:00 S
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
......@@ -1336,17 +1335,23 @@ Zone Pacific/Easter -7:17:44 - LMT 1890
# San Felix, and Antarctic bases, are like America/Santiago.
# Colombia
# Milne gives 4:56:16.4 for Bogota time in 1899; round to nearest. He writes,
# "A variation of fifteen minutes in the public clocks of Bogota is not rare."
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule CO 1992 only - May 3 0:00 1:00 S
Rule CO 1993 only - Apr 4 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Bogota -4:56:20 - LMT 1884 Mar 13
-4:56:20 - BMT 1914 Nov 23 # Bogota Mean Time
Zone America/Bogota -4:56:16 - LMT 1884 Mar 13
-4:56:16 - BMT 1914 Nov 23 # Bogota Mean Time
-5:00 CO CO%sT # Colombia Time
# Malpelo, Providencia, San Andres
# no information; probably like America/Bogota
# Curacao
# Milne gives 4:35:46.9 for Curacao mean time; round to nearest.
#
# From Paul Eggert (2006-03-22):
# Shanks & Pottenger say that The Bottom and Philipsburg have been at
......@@ -1363,7 +1368,7 @@ Zone America/Bogota -4:56:20 - LMT 1884 Mar 13
# though, as far as we know.
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Curacao -4:35:44 - LMT 1912 Feb 12 # Willemstad
Zone America/Curacao -4:35:47 - LMT 1912 Feb 12 # Willemstad
-4:30 - ANT 1965 # Netherlands Antilles Time
-4:00 - AST
......@@ -1377,6 +1382,8 @@ Link America/Curacao America/Kralendijk # Bonaire, Sint Estatius and Saba
# Ecuador
#
# Milne says the Sentral and South American Telegraph Company used -5:24:15.
#
# From Paul Eggert (2007-03-04):
# Apparently Ecuador had a failed experiment with DST in 1992.
# <http://midena.gov.ec/content/view/1261/208/> (2007-02-27) and
......@@ -1582,7 +1589,16 @@ Rule Para 2005 2009 - Mar Sun>=8 0:00 0 -
# forward 60 minutes, in all the territory of the Paraguayan Republic.
# ...
Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S
Rule Para 2010 max - Apr Sun>=8 0:00 0 -
Rule Para 2010 2012 - Apr Sun>=8 0:00 0 -
#
# From Steffen Thorsen (2013-03-07):
# Paraguay will end DST on 2013-03-24 00:00....
# http://www.ande.gov.py/interna.php?id=1075
#
# From Carlos Raul Perasso (2013-03-15):
# The change in Paraguay is now final. Decree number 10780
# http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
Rule Para 2013 max - Mar Sun>=22 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Asuncion -3:50:40 - LMT 1890
......
......@@ -65,7 +65,6 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
AQ -5430+15857 Antarctica/Macquarie Macquarie Island Station, Macquarie Island
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
......@@ -81,6 +80,7 @@ AR -5448-06818 America/Argentina/Ushuaia Tierra del Fuego (TF)
AS -1416-17042 Pacific/Pago_Pago
AT +4813+01620 Europe/Vienna
AU -3133+15905 Australia/Lord_Howe Lord Howe Island
AU -5430+15857 Antarctica/Macquarie Macquarie Island
AU -4253+14719 Australia/Hobart Tasmania - most locations
AU -3956+14352 Australia/Currie Tasmania - King Island
AU -3749+14458 Australia/Melbourne Victoria
......@@ -182,7 +182,8 @@ CW +1211-06900 America/Curacao
CX -1025+10543 Indian/Christmas
CY +3510+03322 Asia/Nicosia
CZ +5005+01426 Europe/Prague
DE +5230+01322 Europe/Berlin
DE +5230+01322 Europe/Berlin most locations
DE +4742+00841 Europe/Busingen Busingen
DJ +1136+04309 Africa/Djibouti
DK +5540+01235 Europe/Copenhagen
DM +1518-06124 America/Dominica
......@@ -364,8 +365,10 @@ RU +5345+08707 Asia/Novokuznetsk Moscow+03 - Novokuznetsk
RU +5601+09250 Asia/Krasnoyarsk Moscow+04 - Yenisei River
RU +5216+10420 Asia/Irkutsk Moscow+05 - Lake Baikal
RU +6200+12940 Asia/Yakutsk Moscow+06 - Lena River
RU +623923+1353314 Asia/Khandyga Moscow+06 - Tomponsky, Ust-Maysky
RU +4310+13156 Asia/Vladivostok Moscow+07 - Amur River
RU +4658+14242 Asia/Sakhalin Moscow+07 - Sakhalin Island
RU +643337+1431336 Asia/Ust-Nera Moscow+07 - Oymyakonsky
RU +5934+15048 Asia/Magadan Moscow+08 - Magadan
RU +5301+15839 Asia/Kamchatka Moscow+08 - Kamchatka
RU +6445+17729 Asia/Anadyr Moscow+08 - Bering Sea
......
......@@ -87,9 +87,6 @@ build: $(FILES_genout_extcs) $(CHARSETS_JAR)
#
# Extra rules to build character converters.
SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider
SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION)
GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping
GENCSSRCDIR = $(BUILDDIR)/tools/src/build/tools/charsetmapping
GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext
......@@ -118,10 +115,6 @@ $(FILES_genout_extcs): \
$(GENCSSRCDIR)/HKSCS.java
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs
$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
$(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH)
$(install-file)
# no compression unless requested
ifndef COMPRESS_JARS
CREATE_JAR_OPTS_NOMANIFEST = cf0
......@@ -129,10 +122,9 @@ else
CREATE_JAR_OPTS_NOMANIFEST = cf
endif
$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
$(CHARSETS_JAR): $(FILES_class) $(FILES_DAT)
$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(CHARSETS_JAR) \
-C $(CLASSDESTDIR) sun \
-C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \
$(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
......
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. 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.
#
#
# Makefile for building Mozilla JavaScript modules
#
BUILDDIR = ../../..
PRODUCT = org
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = javascript
include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::
$(SUBDIRS-loop)
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# 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.
#
#
# Makefile for building all of sun.org.mozilla.javascript.internal.*
#
BUILDDIR = ../../../..
PACKAGE = sun.org.mozilla.javascript.internal
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
AUTO_FILES_JAVA_DIRS = sun/org/mozilla/javascript/internal
RESOURCEDIR = \
$(CLASSDESTDIR)/sun/org/mozilla/javascript/internal/resources
FILES_copy = \
$(RESOURCEDIR)/Messages.properties \
$(RESOURCEDIR)/Messages_fr.properties
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
all: classes copy-files
#
# Copy resource messages file for Rhino JavaScript interpreter
#
copy-files: $(FILES_copy)
$(RESOURCEDIR)/%: $(CLOSED_SRC)/share/classes/sun/org/mozilla/javascript/internal/resources/%
$(install-file)
.PHONY: copy-files
clean clobber::
$(RM) -rf $(CLASSDESTDIR)/sun/org/mozilla/javascript
......@@ -38,12 +38,10 @@ SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk
# build sun/security/jgss/wrapper on non-windows non-macosx platforms
# build sun/security/jgss/wrapper on non-windows platforms
JGSS_WRAPPER =
ifneq ($(PLATFORM), windows)
ifneq ($(PLATFORM), macosx)
JGSS_WRAPPER = jgss/wrapper
endif
JGSS_WRAPPER = jgss/wrapper
endif
# Build PKCS#11 on all platforms
......
......@@ -124,15 +124,6 @@ CLASSDESTDIR = $(TEMPDIR)/classes
#
AUTO_FILES_JAVA_DIRS = $(PKGDIR)
#
# Exclude the sources that get built by ../other/Makefile
#
AUTO_JAVA_PRUNE = \
ECParameters.java \
ECPrivateKeyImpl.java \
ECPublicKeyImpl.java \
NamedCurve.java
#
# Some licensees do not get the native ECC sources, but we still need to
# be able to build "all" for them. Check here to see if the sources are
......
......@@ -49,15 +49,6 @@ AUTO_FILES_JAVA_DIRS = \
sun/security/x509 \
com/sun/net/ssl/internal/ssl
#
# EC classes used by the packages above
#
FILES_java += \
sun/security/ec/ECParameters.java \
sun/security/ec/ECPrivateKeyImpl.java \
sun/security/ec/ECPublicKeyImpl.java \
sun/security/ec/NamedCurve.java
#
# Rules
#
......
......@@ -34,6 +34,8 @@ import java.nio.file.Path;
import java.util.*;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/**
......@@ -234,6 +236,17 @@ public class CLDRConverter {
}
}
/**
* Configure the parser to allow access to DTDs on the file system.
*/
private static void enableFileAccess(SAXParser parser) throws SAXNotSupportedException {
try {
parser.setProperty("http://javax.xml.XMLConstants/property/accessExternalDTD", "file");
} catch (SAXNotRecognizedException ignore) {
// property requires >= JAXP 1.5
}
}
private static List<Bundle> readBundleList() throws Exception {
ResourceBundle.Control defCon = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
List<Bundle> retList = new ArrayList<>();
......@@ -279,6 +292,7 @@ public class CLDRConverter {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
SAXParser parser = factory.newSAXParser();
enableFileAccess(parser);
LDMLParseHandler handler = new LDMLParseHandler(id);
File file = new File(SOURCE_FILE_DIR + File.separator + id + ".xml");
if (!file.exists()) {
......@@ -314,6 +328,7 @@ public class CLDRConverter {
SAXParserFactory factorySuppl = SAXParserFactory.newInstance();
factorySuppl.setValidating(true);
SAXParser parserSuppl = factorySuppl.newSAXParser();
enableFileAccess(parserSuppl);
handlerSuppl = new SupplementDataParseHandler();
File fileSupply = new File(SPPL_SOURCE_FILE);
parserSuppl.parse(fileSupply, handlerSuppl);
......@@ -322,6 +337,7 @@ public class CLDRConverter {
SAXParserFactory numberingParser = SAXParserFactory.newInstance();
numberingParser.setValidating(true);
SAXParser parserNumbering = numberingParser.newSAXParser();
enableFileAccess(parserNumbering);
handlerNumbering = new NumberingSystemsParseHandler();
File fileNumbering = new File(NUMBERING_SOURCE_FILE);
parserNumbering.parse(fileNumbering, handlerNumbering);
......@@ -330,6 +346,7 @@ public class CLDRConverter {
SAXParserFactory metazonesParser = SAXParserFactory.newInstance();
metazonesParser.setValidating(true);
SAXParser parserMetaZones = metazonesParser.newSAXParser();
enableFileAccess(parserMetaZones);
handlerMetaZones = new MetaZonesParseHandler();
File fileMetaZones = new File(METAZONES_SOURCE_FILE);
parserNumbering.parse(fileMetaZones, handlerMetaZones);
......
......@@ -30,7 +30,5 @@ sun.security.krb5.Realm=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,comp
# Residual references to java.beans.
# The RemoveMethods tool does not yet purge the constant pool.
# Rhino is due to be replaced so not worth addressing this dependency now.
#
java.beans.PropertyChangeListener=java.util.logging.LogManager,sun.org.mozilla.javascript.internal.Context,compact1,compact2,compact3
java.beans.PropertyChangeEvent=sun.org.mozilla.javascript.internal.Context,compact3
java.beans.PropertyChangeListener=java.util.logging.LogManager,compact1,compact2,compact3
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
......@@ -432,20 +433,22 @@ endif
##################################################################################################
ifndef OPENJDK
DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*demo*.zip)
DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)
$(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
$(MKDIR) -p $(@D)
$(RM) -r $(JDK_OUTPUTDIR)/demo/db $(JDK_OUTPUTDIR)/demo/demo
$(CD) $(JDK_OUTPUTDIR)/demo && $(UNZIP) -q -o $<
$(MV) $(JDK_OUTPUTDIR)/demo/demo $(JDK_OUTPUTDIR)/demo/db
$(MV) $(JDK_OUTPUTDIR)/demo/db-derby-*-bin/demo $(JDK_OUTPUTDIR)/demo/db
$(CD) $(JDK_OUTPUTDIR)/demo && $(RM) -r db-derby-*-bin
$(TOUCH) $@
# Copy this after the unzip above to avoid race with directory creation and mv command.
$(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html: \
$(JDK_TOPDIR)/src/closed/share/db/README-JDK-DEMOS.html \
| $(JDK_OUTPUTDIR)/demo/_the.db.unzipped
$(call install-file)
$(MKDIR) -p $(@D)
$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/_the.db.unzipped $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html
endif
......
......@@ -2560,7 +2560,6 @@ BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
##########################################################################################
ifneq ($(OPENJDK_TARGET_OS), windows)
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
LIBRARY:=j2gss,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
......@@ -2581,7 +2580,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
endif
endif
##########################################################################################
......
......@@ -458,24 +458,6 @@ endif # OPENJDK
ifndef OPENJDK
JS_RESOURCES_FILES := Messages.properties Messages_fr.properties
JS_RESOURCES_SRC_DIR := $(JDK_TOPDIR)/src/closed/share/classes/sun/org/mozilla/javascript/internal/resources
JS_RESOURCES_DST_DIR := $(JDK_OUTPUTDIR)/classes/sun/org/mozilla/javascript/internal/resources
JS_RESOURCES_SRC := $(foreach F,$(JS_RESOURCES_FILES),$(JS_RESOURCES_SRC_DIR)/$(F))
JS_RESOURCES_DST := $(foreach F,$(JS_RESOURCES_FILES),$(JS_RESOURCES_DST_DIR)/$(F))
$(JS_RESOURCES_DST_DIR)/% : $(JS_RESOURCES_SRC_DIR)/%
$(call install-file)
COPY_FILES += $(JS_RESOURCES_DST)
endif
##########################################################################################
ifndef OPENJDK
#
# Solaris X11 Direct Graphics Access library
#
......
......@@ -172,10 +172,6 @@ ifneq ($(ALL_META-INF_DIRS_targetapi),)
else
ALL_META-INF_DIRS:=$(ALL_META-INF_DIRS_share)
endif
# Filter out META-INF dirs that shouldn't be included
ifdef OPENJDK
ALL_META-INF_DIRS:=$(filter-out %com/sun/script/javascript/META-INF,$(ALL_META-INF_DIRS))
endif
ifndef OPENJDK
ALL_META-INF_DIRS += $(JDK_TOPDIR)/src/closed/share/classes/sun/java2d/cmm/kcms/META-INF
......
......@@ -201,7 +201,6 @@ RT_JAR_EXCLUDES += \
META-INF/services/com.sun.jdi.connect.spi.TransportService \
META-INF/services/com.sun.tools.attach.spi.AttachProvider \
META-INF/services/com.sun.tools.xjc.Plugin \
META-INF/services/java.nio.charset.spi.CharsetProvider \
META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
org/relaxng/datatype \
sun/awt/HKSCS.class \
......@@ -217,19 +216,7 @@ RT_JAR_EXCLUDES += \
sun/net/spi/nameservice/dns \
sun/nio/cs/ext \
sun/rmi/rmic \
sun/security/ec/ECDHKeyAgreement.class \
sun/security/ec/ECDSASignature.class \
sun/security/ec/ECDSASignature\$$$$Raw.class \
sun/security/ec/ECDSASignature\$$$$SHA1.class \
sun/security/ec/ECDSASignature\$$$$SHA224.class \
sun/security/ec/ECDSASignature\$$$$SHA256.class \
sun/security/ec/ECDSASignature\$$$$SHA384.class \
sun/security/ec/ECDSASignature\$$$$SHA512.class \
sun/security/ec/ECKeyFactory.class \
sun/security/ec/ECKeyPairGenerator.class \
sun/security/ec/SunEC\$$$$1.class \
sun/security/ec/SunEC.class \
sun/security/ec/SunECEntries.class \
sun/security/ec \
sun/security/internal \
sun/security/mscapi \
sun/security/pkcs11 \
......@@ -428,8 +415,7 @@ $(eval $(call SetupArchive,BUILD_CHARSETS_JAR,,\
SUFFIXES:=.class .dat,\
INCLUDES:=sun/nio/cs/ext,\
EXTRA_FILES := sun/awt/HKSCS.class \
$(CHARSETS_EXTRA_FILES) \
META-INF/services/java.nio.charset.spi.CharsetProvider, \
$(CHARSETS_EXTRA_FILES), \
JAR:=$(IMAGES_OUTPUTDIR)/lib/charsets.jar, \
SKIP_METAINF := true, \
CHECK_COMPRESS_JAR:=true))
......
......@@ -532,17 +532,22 @@ ifndef OPENJDK
$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped: $(JDK_TOPDIR)/src/closed/share/db/%
$(ECHO) Unzipping $(patsubst $(SRC_ROOT)/%,%,$<)
$(MKDIR) -p $(JDK_IMAGE_DIR)/db
cd $(JDK_IMAGE_DIR)/db && $(UNZIP) -q -o $< -x index.html 2> /dev/null
cd $(JDK_IMAGE_DIR)/db && $(UNZIP) -q -o $< -x */index.html */KEYS */test/* *javadoc/* */docs/* */demo/* 2> /dev/null
cd $(JDK_IMAGE_DIR)/db && $(MV) db-derby-*-bin/* . && $(RM) -r db-derby-*-bin
$(MKDIR) -p $(@D)
$(TOUCH) $@
$(JDK_IMAGE_DIR)/db/README-JDK.html: $(JDK_TOPDIR)/src/closed/share/db/README-JDK.html
$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
$(install-file)
$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
$(JDK_IMAGE_DIR)/db/3RDPARTY: $(JDK_TOPDIR)/src/closed/share/db/3RDPARTY
$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
$(call not-containing,demo,$(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip))) \
$(JDK_IMAGE_DIR)/db/README-JDK.html
$(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)) \
$(JDK_IMAGE_DIR)/db/README-JDK.html $(JDK_IMAGE_DIR)/db/3RDPARTY
endif
......
......@@ -57,6 +57,7 @@ PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
java/time \
java/util \
javax/net \
javax/script \
javax/security \
jdk \
sun/invoke \
......@@ -111,7 +112,6 @@ PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
com/sun/nio/sctp \
com/sun/org/apache/xml/internal/security \
com/sun/rowset \
com/sun/script \
com/sun/security/auth \
com/sun/security/jgss \
com/sun/security/ntlm \
......@@ -125,7 +125,6 @@ PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
javax/lang/model \
javax/management \
javax/naming \
javax/script \
javax/security/auth/kerberos \
javax/security/sasl \
javax/smartcardio \
......@@ -140,7 +139,6 @@ PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
sun/net/www/protocol/http/ntlm \
sun/net/www/protocol/http/spnego \
sun/nio/ch/sctp \
sun/org/mozilla \
sun/security/acl \
sun/security/jgss \
sun/security/krb5 \
......@@ -161,10 +159,6 @@ PROFILE_3_RTJAR_EXCLUDE_TYPES := \
javax/management/remote/rmi/_RMIServerImpl_Tie.class \
javax/management/remote/rmi/_RMIServer_Stub.class
PROFILE_3_INCLUDE_METAINF_SERVICES := \
META-INF/services/javax.script.ScriptEngineFactory
FULL_JRE_RTJAR_INCLUDE_PACKAGES := \
com/oracle \
com/sun/accessibility/internal/resources \
......
/*
* Copyright (c) 1995, 2012, 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
......@@ -149,12 +149,15 @@ static int KnownVMIndex(const char* name);
static void FreeKnownVMs();
static jboolean IsWildCardEnabled();
#define ARG_CHECK(n, f, a) if (n < 1) { \
JLI_ReportErrorMessage(f, a); \
printUsage = JNI_TRUE; \
*pret = 1; \
return JNI_TRUE; \
}
#define ARG_CHECK(AC_arg_count, AC_failure_message, AC_questionable_arg) \
do { \
if (AC_arg_count < 1) { \
JLI_ReportErrorMessage(AC_failure_message, AC_questionable_arg); \
printUsage = JNI_TRUE; \
*pret = 1; \
return JNI_TRUE; \
} \
} while (JNI_FALSE)
/*
* Running Java code in primordial thread caused many problems. We will
......@@ -310,29 +313,37 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
* mainThread.isAlive() to work as expected.
*/
#define LEAVE() \
if ((*vm)->DetachCurrentThread(vm) != 0) { \
JLI_ReportErrorMessage(JVM_ERROR2); \
ret = 1; \
} \
(*vm)->DestroyJavaVM(vm); \
return ret \
#define CHECK_EXCEPTION_NULL_LEAVE(e) \
if ((*env)->ExceptionOccurred(env)) { \
JLI_ReportExceptionDescription(env); \
LEAVE(); \
} \
if ((e) == NULL) { \
JLI_ReportErrorMessage(JNI_ERROR); \
LEAVE(); \
}
#define CHECK_EXCEPTION_LEAVE(rv) \
if ((*env)->ExceptionOccurred(env)) { \
JLI_ReportExceptionDescription(env); \
ret = (rv); \
LEAVE(); \
}
do { \
if ((*vm)->DetachCurrentThread(vm) != JNI_OK) { \
JLI_ReportErrorMessage(JVM_ERROR2); \
ret = 1; \
} \
if (JNI_TRUE) { \
(*vm)->DestroyJavaVM(vm); \
return ret; \
} \
} while (JNI_FALSE)
#define CHECK_EXCEPTION_NULL_LEAVE(CENL_exception) \
do { \
if ((*env)->ExceptionOccurred(env)) { \
JLI_ReportExceptionDescription(env); \
LEAVE(); \
} \
if ((CENL_exception) == NULL) { \
JLI_ReportErrorMessage(JNI_ERROR); \
LEAVE(); \
} \
} while (JNI_FALSE)
#define CHECK_EXCEPTION_LEAVE(CEL_return_value) \
do { \
if ((*env)->ExceptionOccurred(env)) { \
JLI_ReportExceptionDescription(env); \
ret = (CEL_return_value); \
LEAVE(); \
} \
} while (JNI_FALSE)
int JNICALL
JavaMain(void * _args)
......@@ -434,7 +445,7 @@ JavaMain(void * _args)
* consistent in the UI we need to track and report the application main class.
*/
appClass = GetApplicationClass(env);
NULL_CHECK(appClass);
NULL_CHECK_RETURN_VALUE(appClass, -1);
/*
* PostJVMInit uses the class name as the application name for GUI purposes,
* for example, on OSX this sets the application name in the menu bar for
......
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
......@@ -242,14 +242,18 @@ typedef struct {
InvocationFunctions ifn;
} JavaMainArgs;
#define NULL_CHECK0(e) if ((e) == 0) { \
JLI_ReportErrorMessage(JNI_ERROR); \
return 0; \
}
#define NULL_CHECK_RETURN_VALUE(NCRV_check_pointer, NCRV_return_value) \
do { \
if ((NCRV_check_pointer) == NULL) { \
JLI_ReportErrorMessage(JNI_ERROR); \
return NCRV_return_value; \
} \
} while (JNI_FALSE)
#define NULL_CHECK(e) if ((e) == 0) { \
JLI_ReportErrorMessage(JNI_ERROR); \
return; \
}
#define NULL_CHECK0(NC0_check_pointer) \
NULL_CHECK_RETURN_VALUE(NC0_check_pointer, 0)
#define NULL_CHECK(NC_check_pointer) \
NULL_CHECK_RETURN_VALUE(NC_check_pointer, )
#endif /* _JAVA_H_ */
/*
* Copyright (c) 2005, 2012, 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
......@@ -136,8 +136,10 @@ WildcardIterator_for(const char *wildcard)
{
WildcardIterator it = NEW_(WildcardIterator);
HANDLE handle = FindFirstFile(wildcard, &find_data);
if (handle == INVALID_HANDLE_VALUE)
if (handle == INVALID_HANDLE_VALUE) {
JLI_MemFree(it);
return NULL;
}
it->handle = handle;
it->firstFile = find_data.cFileName;
return it;
......
......@@ -99,6 +99,7 @@ class Attribute implements Comparable<Attribute> {
return this == def.canon;
}
@Override
public int compareTo(Attribute that) {
return this.def.compareTo(that.def);
}
......@@ -212,20 +213,20 @@ class Attribute implements Comparable<Attribute> {
// Metadata.
//
// We define metadata using similar layouts
// for all five kinds of metadata attributes.
// for all five kinds of metadata attributes and 2 type metadata attributes
//
// Regular annotations are a counted list of [RSHNH[RUH(1)]][...]
// pack.method.attribute.RuntimeVisibleAnnotations=[NH[(1)]][RSHNH[RUH(1)]][TB...]
//
// Parameter annotations are a counted list of regular annotations.
// pack.method.attribute.RuntimeVisibleParameterAnnotations=[NH[(1)]][NH[(1)]][RSHNH[RUH(1)]][TB...]
// pack.method.attribute.RuntimeVisibleParameterAnnotations=[NB[(1)]][NH[(1)]][RSHNH[RUH(1)]][TB...]
//
// RuntimeInvisible annotations are defined similarly...
// Non-method annotations are defined similarly...
//
// Annotation are a simple tagged value [TB...]
// pack.attribute.method.AnnotationDefault=[TB...]
//
static {
String mdLayouts[] = {
Attribute.normalizeLayoutString
......@@ -238,6 +239,9 @@ class Attribute implements Comparable<Attribute> {
+"\n # annotations :="
+"\n [ NH[(1)] ] # forward call to annotation"
+"\n "
),
Attribute.normalizeLayoutString
(""
+"\n # annotation :="
+"\n [RSH"
+"\n NH[RUH (1)] # forward call to value"
......@@ -259,24 +263,67 @@ class Attribute implements Comparable<Attribute> {
+"\n ()[] ]"
)
};
/*
* RuntimeVisibleTypeAnnotation and RuntimeInvisibleTypeAnnotatation are
* similar to RuntimeVisibleAnnotation and RuntimeInvisibleAnnotation,
* a type-annotation union and a type-path structure precedes the
* annotation structure
*/
String typeLayouts[] = {
Attribute.normalizeLayoutString
(""
+"\n # type-annotations :="
+"\n [ NH[(1)(2)(3)] ] # forward call to type-annotations"
),
Attribute.normalizeLayoutString
( ""
+"\n # type-annotation :="
+"\n [TB"
+"\n (0-1) [B] # {CLASS, METHOD}_TYPE_PARAMETER"
+"\n (16) [FH] # CLASS_EXTENDS"
+"\n (17-18) [BB] # {CLASS, METHOD}_TYPE_PARAMETER_BOUND"
+"\n (19-21) [] # FIELD, METHOD_RETURN, METHOD_RECEIVER"
+"\n (22) [B] # METHOD_FORMAL_PARAMETER"
+"\n (23) [H] # THROWS"
+"\n (64-65) [NH[PHOHH]] # LOCAL_VARIABLE, RESOURCE_VARIABLE"
+"\n (66) [H] # EXCEPTION_PARAMETER"
+"\n (67-70) [PH] # INSTANCEOF, NEW, {CONSTRUCTOR, METHOD}_REFERENCE_RECEIVER"
+"\n (71-75) [PHB] # CAST, {CONSTRUCTOR,METHOD}_INVOCATION_TYPE_ARGUMENT, {CONSTRUCTOR, METHOD}_REFERENCE_TYPE_ARGUMENT"
+"\n ()[] ]"
),
Attribute.normalizeLayoutString
(""
+"\n # type-path"
+"\n [ NB[BB] ]"
)
};
Map<Layout, Attribute> sd = standardDefs;
String defaultLayout = mdLayouts[2];
String annotationsLayout = mdLayouts[1] + mdLayouts[2];
String defaultLayout = mdLayouts[3];
String annotationsLayout = mdLayouts[1] + mdLayouts[2] + mdLayouts[3];
String paramsLayout = mdLayouts[0] + annotationsLayout;
String typesLayout = typeLayouts[0] + typeLayouts[1] +
typeLayouts[2] + mdLayouts[2] + mdLayouts[3];
for (int ctype = 0; ctype < ATTR_CONTEXT_LIMIT; ctype++) {
if (ctype == ATTR_CONTEXT_CODE) continue;
define(sd, ctype,
"RuntimeVisibleAnnotations", annotationsLayout);
define(sd, ctype,
"RuntimeInvisibleAnnotations", annotationsLayout);
if (ctype == ATTR_CONTEXT_METHOD) {
define(sd, ctype,
"RuntimeVisibleParameterAnnotations", paramsLayout);
if (ctype != ATTR_CONTEXT_CODE) {
define(sd, ctype,
"RuntimeInvisibleParameterAnnotations", paramsLayout);
"RuntimeVisibleAnnotations", annotationsLayout);
define(sd, ctype,
"AnnotationDefault", defaultLayout);
"RuntimeInvisibleAnnotations", annotationsLayout);
if (ctype == ATTR_CONTEXT_METHOD) {
define(sd, ctype,
"RuntimeVisibleParameterAnnotations", paramsLayout);
define(sd, ctype,
"RuntimeInvisibleParameterAnnotations", paramsLayout);
define(sd, ctype,
"AnnotationDefault", defaultLayout);
}
}
define(sd, ctype,
"RuntimeVisibleTypeAnnotations", typesLayout);
define(sd, ctype,
"RuntimeInvisibleTypeAnnotations", typesLayout);
}
}
......@@ -529,6 +576,7 @@ class Attribute implements Comparable<Attribute> {
return canon.addContent(bytes, null);
}
@Override
public boolean equals(Object x) {
return ( x != null) && ( x.getClass() == Layout.class ) &&
equals((Layout)x);
......@@ -538,11 +586,13 @@ class Attribute implements Comparable<Attribute> {
&& this.layout.equals(that.layout)
&& this.ctype == that.ctype;
}
@Override
public int hashCode() {
return (((17 + name.hashCode())
* 37 + layout.hashCode())
* 37 + ctype);
}
@Override
public int compareTo(Layout that) {
int r;
r = this.name.compareTo(that.name);
......@@ -551,6 +601,7 @@ class Attribute implements Comparable<Attribute> {
if (r != 0) return r;
return this.ctype - that.ctype;
}
@Override
public String toString() {
String str = contextName(ctype)+"."+name+"["+layout+"]";
// If -ea, print out more informative strings!
......@@ -698,11 +749,14 @@ class Attribute implements Comparable<Attribute> {
// References (to a local cpMap) are embedded in the bytes.
def.parse(holder, bytes, 0, bytes.length,
new ValueStream() {
@Override
public void putInt(int bandIndex, int value) {
}
@Override
public void putRef(int bandIndex, Entry ref) {
refs.add(ref);
}
@Override
public int encodeBCI(int bci) {
return bci;
}
......@@ -716,6 +770,7 @@ class Attribute implements Comparable<Attribute> {
return def.unparse(in, out);
}
@Override
public String toString() {
return def
+"{"+(bytes == null ? -1 : size())+"}"
......@@ -1309,7 +1364,7 @@ class Attribute implements Comparable<Attribute> {
}
out.putRef(bandIndex, globalRef);
break;
default: assert(false); continue;
default: assert(false);
}
}
return pos;
......@@ -1416,8 +1471,7 @@ class Attribute implements Comparable<Attribute> {
int localRef;
if (globalRef != null) {
// It's a one-element array, really an lvalue.
fixups[0] = Fixups.add(fixups[0], null, out.size(),
Fixups.U2_FORMAT, globalRef);
fixups[0] = Fixups.addRefWithLoc(fixups[0], out.size(), globalRef);
localRef = 0; // placeholder for fixups
} else {
localRef = 0; // fixed null value
......
......@@ -146,7 +146,6 @@ class Code extends Attribute.Holder {
int verbose = getPackage().verbose;
if (verbose > 2)
System.out.println("Reference scan "+this);
Class cls = thisClass();
refs.addAll(Arrays.asList(handler_class));
if (fixups != null) {
fixups.visitRefs(refs);
......
......@@ -785,53 +785,55 @@ class ConstantPool {
return new String(sig);
}
static private int skipClassNameChars(String sig, int i) {
int len = sig.length();
for (; i < len; i++) {
char ch = sig.charAt(i);
if (ch <= ' ') break;
if (ch >= ';' && ch <= '@') break;
}
return i;
static private int skipTo(char semi, String sig, int i) {
i = sig.indexOf(semi, i);
return (i >= 0) ? i : sig.length();
}
static String[] structureSignature(String sig) {
sig = sig.intern();
int formLen = 0;
int nparts = 1;
for (int i = 0; i < sig.length(); i++) {
char ch = sig.charAt(i);
formLen++;
if (ch == 'L') {
nparts++;
int i2 = skipClassNameChars(sig, i+1);
i = i2-1; // keep the semicolon in the form
int i3 = sig.indexOf('<', i+1);
if (i3 > 0 && i3 < i2)
i = i3-1;
}
}
char[] form = new char[formLen];
if (nparts == 1) {
int firstl = sig.indexOf('L');
if (firstl < 0) {
String[] parts = { sig };
return parts;
}
String[] parts = new String[nparts];
int j = 0;
int k = 1;
for (int i = 0; i < sig.length(); i++) {
char ch = sig.charAt(i);
form[j++] = ch;
if (ch == 'L') {
int i2 = skipClassNameChars(sig, i+1);
parts[k++] = sig.substring(i+1, i2);
i = i2;
--i; // keep the semicolon in the form
// Segment the string like sig.split("L\\([^;<]*\\)").
// N.B.: Previous version of this code did a more complex match,
// to next ch < ' ' or ch in [';'..'@']. The only important
// characters are ';' and '<', since they are part of the
// signature syntax.
// Examples:
// "(Ljava/lang/Object;IJLLoo;)V" => {"(L;IJL;)V", "java/lang/Object", "Loo"}
// "Ljava/util/List<Ljava/lang/String;>;" => {"L<L;>;", "java/util/List", "java/lang/String"}
char[] form = null;
String[] parts = null;
for (int pass = 0; pass <= 1; pass++) {
// pass 0 is a sizing pass, pass 1 packs the arrays
int formPtr = 0;
int partPtr = 1;
int nextsemi = 0, nextangl = 0; // next ';' or '<', or zero, or sigLen
int lastj = 0;
for (int i = firstl + 1, j; i > 0; i = sig.indexOf('L', j) + 1) {
// sig[i-1] is 'L', while sig[j] will be the first ';' or '<' after it
// each part is in sig[i .. j-1]
if (nextsemi < i) nextsemi = skipTo(';', sig, i);
if (nextangl < i) nextangl = skipTo('<', sig, i);
j = (nextsemi < nextangl ? nextsemi : nextangl);
if (pass != 0) {
sig.getChars(lastj, i, form, formPtr);
parts[partPtr] = sig.substring(i, j);
}
formPtr += (i - lastj);
partPtr += 1;
lastj = j;
}
if (pass != 0) {
sig.getChars(lastj, sig.length(), form, formPtr);
break;
}
formPtr += (sig.length() - lastj);
form = new char[formPtr];
parts = new String[partPtr];
}
assert(j == formLen);
assert(k == parts.length);
parts[0] = new String(form);
//assert(flattenSignature(parts).equals(sig));
return parts;
......
......@@ -45,6 +45,7 @@ class Constants {
1.5 to 1.5.X 49,0
1.6 to 1.5.x 50,0
1.7 to 1.6.x 51,0
1.8 to 1.7.x 52,0
*/
public final static Package.Version JAVA_MIN_CLASS_VERSION =
......@@ -161,7 +162,9 @@ class Constants {
METHOD_ATTR_RuntimeInvisibleParameterAnnotations = 24,
CLASS_ATTR_ClassFile_version = 24,
METHOD_ATTR_AnnotationDefault = 25,
METHOD_ATTR_MethodParameters = 26,
METHOD_ATTR_MethodParameters = 26, // JDK8
X_ATTR_RuntimeVisibleTypeAnnotations = 27, // JDK8
X_ATTR_RuntimeInvisibleTypeAnnotations = 28, // JDK8
CODE_ATTR_StackMapTable = 0, // new in Java 6
CODE_ATTR_LineNumberTable = 1,
CODE_ATTR_LocalVariableTable = 2,
......
/*
* 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
......@@ -30,6 +30,7 @@ import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
/**
* Collection of relocatable constant pool references.
......@@ -77,8 +78,9 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
private static final int MINBIGSIZE = 1;
// cleverly share empty bigDescs:
private static int[] noBigDescs = {MINBIGSIZE};
private static final int[] noBigDescs = {MINBIGSIZE};
@Override
public int size() {
return size;
}
......@@ -105,6 +107,7 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
}
}
@Override
public void clear() {
if (bytes != null) {
// Clean the bytes:
......@@ -141,16 +144,16 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
assert(old.equals(new ArrayList<>(this)));
}
static final int LOC_SHIFT = 1;
static final int FMT_MASK = 0x1;
static final byte UNUSED_BYTE = 0;
static final byte OVERFLOW_BYTE = -1;
private static final int LOC_SHIFT = 1;
private static final int FMT_MASK = 0x1;
private static final byte UNUSED_BYTE = 0;
private static final byte OVERFLOW_BYTE = -1;
// fill pointer of bigDescs array is in element [0]
static final int BIGSIZE = 0;
private static final int BIGSIZE = 0;
// Format values:
public static final int U2_FORMAT = 0;
public static final int U1_FORMAT = 1;
private static final int U2_FORMAT = 0;
private static final int U1_FORMAT = 1;
// Special values for the static methods.
private static final int SPECIAL_LOC = 0;
......@@ -232,6 +235,14 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
}
}
void addU1(int pc, Entry ref) {
add(pc, U1_FORMAT, ref);
}
void addU2(int pc, Entry ref) {
add(pc, U2_FORMAT, ref);
}
/** Simple and necessary tuple to present each fixup. */
public static
class Fixup implements Comparable<Fixup> {
......@@ -248,15 +259,25 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
public int location() { return descLoc(desc); }
public int format() { return descFmt(desc); }
public Entry entry() { return entry; }
@Override
public int compareTo(Fixup that) {
// Ordering depends only on location.
return this.location() - that.location();
}
@Override
public boolean equals(Object x) {
if (!(x instanceof Fixup)) return false;
Fixup that = (Fixup) x;
return this.desc == that.desc && this.entry == that.entry;
}
@Override
public int hashCode() {
int hash = 7;
hash = 59 * hash + this.desc;
hash = 59 * hash + Objects.hashCode(this.entry);
return hash;
}
@Override
public String toString() {
return "@"+location()+(format()==U1_FORMAT?".1":"")+"="+entry;
}
......@@ -267,8 +288,11 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
int index = 0; // index into entries
int bigIndex = BIGSIZE+1; // index into bigDescs
int next = head; // desc pointing to next fixup
@Override
public boolean hasNext() { return index < size; }
@Override
public void remove() { throw new UnsupportedOperationException(); }
@Override
public Fixup next() {
int thisIndex = index;
return new Fixup(nextDesc(), entries[thisIndex]);
......@@ -293,17 +317,20 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
}
}
@Override
public Iterator<Fixup> iterator() {
return new Itr();
}
public void add(int location, int format, Entry entry) {
addDesc(makeDesc(location, format), entry);
}
@Override
public boolean add(Fixup f) {
addDesc(f.desc, f.entry);
return true;
}
@Override
public boolean addAll(Collection<? extends Fixup> c) {
if (c instanceof Fixups) {
// Use knowledge of Itr structure to avoid building little structs.
......@@ -367,7 +394,13 @@ final class Fixups extends AbstractCollection<Fixups.Fixup> {
}
/// Static methods that optimize the use of this class.
public static
static Object addRefWithBytes(Object f, byte[] bytes, Entry e) {
return add(f, bytes, 0, U2_FORMAT, e);
}
static Object addRefWithLoc(Object f, int loc, Entry entry) {
return add(f, null, loc, U2_FORMAT, entry);
}
private static
Object add(Object prevFixups,
byte[] bytes, int loc, int fmt,
Entry e) {
......
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
......@@ -259,7 +259,7 @@ class Package {
byte[] bytes = new byte[2];
sfName = getRefString(obvious);
Object f = null;
f = Fixups.add(f, bytes, 0, Fixups.U2_FORMAT, sfName);
f = Fixups.addRefWithBytes(f, bytes, sfName);
a = attrSourceFileSpecial.addContent(bytes, f);
}
} else if (obvious.equals(sfName.stringValue())) {
......
......@@ -116,7 +116,7 @@ class PackageReader extends BandStructure {
int nr = super.read(b, off, len);
servedPos = pos;
if (nr >= 0) served += nr;
assert(served <= limit || limit == -1);
//assert(served <= limit || limit == -1);
return nr;
}
public long skip(long n) throws IOException {
......@@ -1500,6 +1500,7 @@ class PackageReader extends BandStructure {
// ic_local_bands
// *class_ClassFile_version_minor_H :UNSIGNED5
// *class_ClassFile_version_major_H :UNSIGNED5
// class_type_metadata_bands
//
// field_attr_bands:
// *field_flags :UNSIGNED5
......@@ -1509,6 +1510,7 @@ class PackageReader extends BandStructure {
// *field_Signature_RS :UNSIGNED5 (cp_Signature)
// field_metadata_bands
// *field_ConstantValue_KQ :UNSIGNED5 (cp_Int, etc.; see note)
// field_type_metadata_bands
//
// method_attr_bands:
// *method_flags :UNSIGNED5
......@@ -1522,6 +1524,7 @@ class PackageReader extends BandStructure {
// *method_MethodParameters_NB: BYTE1
// *method_MethodParameters_RUN: UNSIGNED5 (cp_Utf8)
// *method_MethodParameters_FH: UNSIGNED5 (flag)
// method_type_metadata_bands
//
// code_attr_bands:
// *code_flags :UNSIGNED5
......@@ -1537,6 +1540,7 @@ class PackageReader extends BandStructure {
// *code_LocalVariableTable_name_RU :UNSIGNED5 (cp_Utf8)
// *code_LocalVariableTable_type_RS :UNSIGNED5 (cp_Signature)
// *code_LocalVariableTable_slot :UNSIGNED5
// code_type_metadata_bands
countAttrs(ctype, holders);
readAttrs(ctype, holders);
......@@ -1703,8 +1707,9 @@ class PackageReader extends BandStructure {
class_InnerClasses_outer_RCN.readFrom(in);
class_InnerClasses_name_RUN.expectLength(tupleCount);
class_InnerClasses_name_RUN.readFrom(in);
} else if (totalCount == 0) {
// Expect no elements at all. Skip quickly.
} else if (!optDebugBands && totalCount == 0) {
// Expect no elements at all. Skip quickly. however if we
// are debugging bands, read all bands regardless
for (int j = 0; j < ab.length; j++) {
ab[j].doneWithUnusedBand();
}
......@@ -1723,11 +1728,17 @@ class PackageReader extends BandStructure {
assert(cbles[j].kind == Attribute.EK_CBLE);
int entryCount = forwardCounts[j];
forwardCounts[j] = -1; // No more, please!
if (cbles[j].flagTest(Attribute.EF_BACK))
if (totalCount > 0 && cbles[j].flagTest(Attribute.EF_BACK))
entryCount += xxx_attr_calls.getInt();
readAttrBands(cbles[j].body, entryCount, forwardCounts, ab);
}
}
// mark them read, to satisfy asserts
if (optDebugBands && totalCount == 0) {
for (int j = 0; j < ab.length; j++) {
ab[j].doneDisbursing();
}
}
}
}
if (!predef) break;
......@@ -2154,11 +2165,10 @@ class PackageReader extends BandStructure {
if (size == 1) ldcRefSet.add(ref);
int fmt;
switch (size) {
case 1: fmt = Fixups.U1_FORMAT; break;
case 2: fmt = Fixups.U2_FORMAT; break;
case 1: fixupBuf.addU1(pc, ref); break;
case 2: fixupBuf.addU2(pc, ref); break;
default: assert(false); fmt = 0;
}
fixupBuf.add(pc, fmt, ref);
buf[pc+0] = buf[pc+1] = 0;
pc += size;
}
......@@ -2193,7 +2203,7 @@ class PackageReader extends BandStructure {
int coding = bc_initref.getInt();
// Find the nth overloading of <init> in classRef.
MemberEntry ref = pkg.cp.getOverloadingForIndex(CONSTANT_Methodref, classRef, "<init>", coding);
fixupBuf.add(pc, Fixups.U2_FORMAT, ref);
fixupBuf.addU2(pc, ref);
buf[pc+0] = buf[pc+1] = 0;
pc += 2;
assert(Instruction.opLength(origBC) == (pc - curPC));
......@@ -2226,7 +2236,7 @@ class PackageReader extends BandStructure {
insnMap[numInsns++] = curPC;
}
buf[pc++] = (byte) origBC;
fixupBuf.add(pc, Fixups.U2_FORMAT, ref);
fixupBuf.addU2(pc, ref);
buf[pc+0] = buf[pc+1] = 0;
pc += 2;
assert(Instruction.opLength(origBC) == (pc - curPC));
......@@ -2289,11 +2299,10 @@ class PackageReader extends BandStructure {
buf[pc++] = (byte) origBC;
int fmt;
switch (size) {
case 1: fmt = Fixups.U1_FORMAT; break;
case 2: fmt = Fixups.U2_FORMAT; break;
case 1: fixupBuf.addU1(pc, ref); break;
case 2: fixupBuf.addU2(pc, ref); break;
default: assert(false); fmt = 0;
}
fixupBuf.add(pc, fmt, ref);
buf[pc+0] = buf[pc+1] = 0;
pc += size;
if (origBC == _multianewarray) {
......
......@@ -102,7 +102,7 @@ public class DnsContext extends ComponentDirContext {
this.domain = new DnsName(domain.endsWith(".")
? domain
: domain + ".");
this.servers = servers;
this.servers = (servers == null) ? null : servers.clone();
this.environment = (Hashtable<Object,Object>) environment.clone();
envShared = false;
parentIsDns = false;
......@@ -129,11 +129,11 @@ public class DnsContext extends ComponentDirContext {
* no conflict.
*/
private DnsContext(DnsContext ctx) {
environment = ctx.environment;
environment = ctx.environment; // shared environment, copy-on-write
envShared = ctx.envShared = true;
parentIsDns = ctx.parentIsDns;
domain = ctx.domain;
servers = ctx.servers;
servers = ctx.servers; // shared servers, no write operation
resolver = ctx.resolver;
authoritative = ctx.authoritative;
recursion = ctx.recursion;
......
......@@ -81,7 +81,7 @@ public class BasicControl implements Control {
this.id = id;
this.criticality = criticality;
if (value != null) {
this.value = value;
this.value = value.clone();
}
}
......
......@@ -42,7 +42,7 @@ public final class BerDecoder extends Ber {
*/
public BerDecoder(byte buf[], int offset, int bufsize) {
this.buf = buf;
this.buf = buf; // shared buffer, be careful to use this class
this.bufsize = bufsize;
this.origOffset = offset;
......
......@@ -99,7 +99,7 @@ public final class BerEncoder extends Ber {
if (curSeqIndex != 0) {
throw new IllegalStateException("BER encode error: Unbalanced SEQUENCEs.");
}
return buf;
return buf; // shared buffer, be careful to use this method.
}
/**
......
......@@ -134,7 +134,9 @@ final public class StartTlsResponseImpl extends StartTlsResponse {
* @see #negotiate
*/
public void setEnabledCipherSuites(String[] suites) {
this.suites = suites;
// The impl does accept null suites, although the spec requires
// a non-null list.
this.suites = suites == null ? null : suites.clone();
}
/**
......
/*
* Copyright (c) 2005, 2006, 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.script.javascript;
import sun.org.mozilla.javascript.internal.*;
import javax.script.*;
import java.util.*;
/**
* ExternalScriptable is an implementation of Scriptable
* backed by a JSR 223 ScriptContext instance.
*
* @author Mike Grogan
* @author A. Sundararajan
* @since 1.6
*/
final class ExternalScriptable implements Scriptable {
/* Underlying ScriptContext that we use to store
* named variables of this scope.
*/
private ScriptContext context;
/* JavaScript allows variables to be named as numbers (indexed
* properties). This way arrays, objects (scopes) are treated uniformly.
* Note that JSR 223 API supports only String named variables and
* so we can't store these in Bindings. Also, JavaScript allows name
* of the property name to be even empty String! Again, JSR 223 API
* does not support empty name. So, we use the following fallback map
* to store such variables of this scope. This map is not exposed to
* JSR 223 API. We can just script objects "as is" and need not convert.
*/
private Map<Object, Object> indexedProps;
// my prototype
private Scriptable prototype;
// my parent scope, if any
private Scriptable parent;
ExternalScriptable(ScriptContext context) {
this(context, new HashMap<Object, Object>());
}
ExternalScriptable(ScriptContext context, Map<Object, Object> indexedProps) {
if (context == null) {
throw new NullPointerException("context is null");
}
this.context = context;
this.indexedProps = indexedProps;
}
ScriptContext getContext() {
return context;
}
private boolean isEmpty(String name) {
return name.equals("");
}
/**
* Return the name of the class.
*/
public String getClassName() {
return "Global";
}
/**
* Returns the value of the named property or NOT_FOUND.
*
* If the property was created using defineProperty, the
* appropriate getter method is called.
*
* @param name the name of the property
* @param start the object in which the lookup began
* @return the value of the property (may be null), or NOT_FOUND
*/
public synchronized Object get(String name, Scriptable start) {
if (isEmpty(name)) {
if (indexedProps.containsKey(name)) {
return indexedProps.get(name);
} else {
return NOT_FOUND;
}
} else {
synchronized (context) {
int scope = context.getAttributesScope(name);
if (scope != -1) {
Object value = context.getAttribute(name, scope);
return Context.javaToJS(value, this);
} else {
return NOT_FOUND;
}
}
}
}
/**
* Returns the value of the indexed property or NOT_FOUND.
*
* @param index the numeric index for the property
* @param start the object in which the lookup began
* @return the value of the property (may be null), or NOT_FOUND
*/
public synchronized Object get(int index, Scriptable start) {
Integer key = new Integer(index);
if (indexedProps.containsKey(index)) {
return indexedProps.get(key);
} else {
return NOT_FOUND;
}
}
/**
* Returns true if the named property is defined.
*
* @param name the name of the property
* @param start the object in which the lookup began
* @return true if and only if the property was found in the object
*/
public synchronized boolean has(String name, Scriptable start) {
if (isEmpty(name)) {
return indexedProps.containsKey(name);
} else {
synchronized (context) {
return context.getAttributesScope(name) != -1;
}
}
}
/**
* Returns true if the property index is defined.
*
* @param index the numeric index for the property
* @param start the object in which the lookup began
* @return true if and only if the property was found in the object
*/
public synchronized boolean has(int index, Scriptable start) {
Integer key = new Integer(index);
return indexedProps.containsKey(key);
}
/**
* Sets the value of the named property, creating it if need be.
*
* @param name the name of the property
* @param start the object whose property is being set
* @param value value to set the property to
*/
public void put(String name, Scriptable start, Object value) {
if (start == this) {
synchronized (this) {
if (isEmpty(name)) {
indexedProps.put(name, value);
} else {
synchronized (context) {
int scope = context.getAttributesScope(name);
if (scope == -1) {
scope = ScriptContext.ENGINE_SCOPE;
}
context.setAttribute(name, jsToJava(value), scope);
}
}
}
} else {
start.put(name, start, value);
}
}
/**
* Sets the value of the indexed property, creating it if need be.
*
* @param index the numeric index for the property
* @param start the object whose property is being set
* @param value value to set the property to
*/
public void put(int index, Scriptable start, Object value) {
if (start == this) {
synchronized (this) {
indexedProps.put(new Integer(index), value);
}
} else {
start.put(index, start, value);
}
}
/**
* Removes a named property from the object.
*
* If the property is not found, no action is taken.
*
* @param name the name of the property
*/
public synchronized void delete(String name) {
if (isEmpty(name)) {
indexedProps.remove(name);
} else {
synchronized (context) {
int scope = context.getAttributesScope(name);
if (scope != -1) {
context.removeAttribute(name, scope);
}
}
}
}
/**
* Removes the indexed property from the object.
*
* If the property is not found, no action is taken.
*
* @param index the numeric index for the property
*/
public void delete(int index) {
indexedProps.remove(new Integer(index));
}
/**
* Get the prototype of the object.
* @return the prototype
*/
public Scriptable getPrototype() {
return prototype;
}
/**
* Set the prototype of the object.
* @param prototype the prototype to set
*/
public void setPrototype(Scriptable prototype) {
this.prototype = prototype;
}
/**
* Get the parent scope of the object.
* @return the parent scope
*/
public Scriptable getParentScope() {
return parent;
}
/**
* Set the parent scope of the object.
* @param parent the parent scope to set
*/
public void setParentScope(Scriptable parent) {
this.parent = parent;
}
/**
* Get an array of property ids.
*
* Not all property ids need be returned. Those properties
* whose ids are not returned are considered non-enumerable.
*
* @return an array of Objects. Each entry in the array is either
* a java.lang.String or a java.lang.Number
*/
public synchronized Object[] getIds() {
String[] keys = getAllKeys();
int size = keys.length + indexedProps.size();
Object[] res = new Object[size];
System.arraycopy(keys, 0, res, 0, keys.length);
int i = keys.length;
// now add all indexed properties
for (Object index : indexedProps.keySet()) {
res[i++] = index;
}
return res;
}
/**
* Get the default value of the object with a given hint.
* The hints are String.class for type String, Number.class for type
* Number, Scriptable.class for type Object, and Boolean.class for
* type Boolean. <p>
*
* A <code>hint</code> of null means "no hint".
*
* See ECMA 8.6.2.6.
*
* @param hint the type hint
* @return the default value
*/
public Object getDefaultValue(Class typeHint) {
for (int i=0; i < 2; i++) {
boolean tryToString;
if (typeHint == ScriptRuntime.StringClass) {
tryToString = (i == 0);
} else {
tryToString = (i == 1);
}
String methodName;
Object[] args;
if (tryToString) {
methodName = "toString";
args = ScriptRuntime.emptyArgs;
} else {
methodName = "valueOf";
args = new Object[1];
String hint;
if (typeHint == null) {
hint = "undefined";
} else if (typeHint == ScriptRuntime.StringClass) {
hint = "string";
} else if (typeHint == ScriptRuntime.ScriptableClass) {
hint = "object";
} else if (typeHint == ScriptRuntime.FunctionClass) {
hint = "function";
} else if (typeHint == ScriptRuntime.BooleanClass
|| typeHint == Boolean.TYPE)
{
hint = "boolean";
} else if (typeHint == ScriptRuntime.NumberClass ||
typeHint == ScriptRuntime.ByteClass ||
typeHint == Byte.TYPE ||
typeHint == ScriptRuntime.ShortClass ||
typeHint == Short.TYPE ||
typeHint == ScriptRuntime.IntegerClass ||
typeHint == Integer.TYPE ||
typeHint == ScriptRuntime.FloatClass ||
typeHint == Float.TYPE ||
typeHint == ScriptRuntime.DoubleClass ||
typeHint == Double.TYPE)
{
hint = "number";
} else {
throw Context.reportRuntimeError(
"Invalid JavaScript value of type " +
typeHint.toString());
}
args[0] = hint;
}
Object v = ScriptableObject.getProperty(this, methodName);
if (!(v instanceof Function))
continue;
Function fun = (Function) v;
Context cx = RhinoScriptEngine.enterContext();
try {
v = fun.call(cx, fun.getParentScope(), this, args);
} finally {
cx.exit();
}
if (v != null) {
if (!(v instanceof Scriptable)) {
return v;
}
if (typeHint == ScriptRuntime.ScriptableClass
|| typeHint == ScriptRuntime.FunctionClass)
{
return v;
}
if (tryToString && v instanceof Wrapper) {
// Let a wrapped java.lang.String pass for a primitive
// string.
Object u = ((Wrapper)v).unwrap();
if (u instanceof String)
return u;
}
}
}
// fall through to error
String arg = (typeHint == null) ? "undefined" : typeHint.getName();
throw Context.reportRuntimeError(
"Cannot find default value for object " + arg);
}
/**
* Implements the instanceof operator.
*
* @param instance The value that appeared on the LHS of the instanceof
* operator
* @return true if "this" appears in value's prototype chain
*
*/
public boolean hasInstance(Scriptable instance) {
// Default for JS objects (other than Function) is to do prototype
// chasing.
Scriptable proto = instance.getPrototype();
while (proto != null) {
if (proto.equals(this)) return true;
proto = proto.getPrototype();
}
return false;
}
private String[] getAllKeys() {
ArrayList<String> list = new ArrayList<String>();
synchronized (context) {
for (int scope : context.getScopes()) {
Bindings bindings = context.getBindings(scope);
if (bindings != null) {
list.ensureCapacity(bindings.size());
for (String key : bindings.keySet()) {
list.add(key);
}
}
}
}
String[] res = new String[list.size()];
list.toArray(res);
return res;
}
/**
* We convert script values to the nearest Java value.
* We unwrap wrapped Java objects so that access from
* Bindings.get() would return "workable" value for Java.
* But, at the same time, we need to make few special cases
* and hence the following function is used.
*/
private Object jsToJava(Object jsObj) {
if (jsObj instanceof Wrapper) {
Wrapper njb = (Wrapper) jsObj;
/* importClass feature of ImporterTopLevel puts
* NativeJavaClass in global scope. If we unwrap
* it, importClass won't work.
*/
if (njb instanceof NativeJavaClass) {
return njb;
}
/* script may use Java primitive wrapper type objects
* (such as java.lang.Integer, java.lang.Boolean etc)
* explicitly. If we unwrap, then these script objects
* will become script primitive types. For example,
*
* var x = new java.lang.Double(3.0); print(typeof x);
*
* will print 'number'. We don't want that to happen.
*/
Object obj = njb.unwrap();
if (obj instanceof Number || obj instanceof String ||
obj instanceof Boolean || obj instanceof Character) {
// special type wrapped -- we just leave it as is.
return njb;
} else {
// return unwrapped object for any other object.
return obj;
}
} else { // not-a-Java-wrapper
return jsObj;
}
}
}
/*
* Copyright (c) 2005, 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.script.javascript;
import sun.org.mozilla.javascript.internal.*;
import java.util.*;
/**
* JSAdapter is java.lang.reflect.Proxy equivalent for JavaScript. JSAdapter
* calls specially named JavaScript methods on an adaptee object when property
* access is attempted on it.
*
* Example:
*
* var y = {
* __get__ : function (name) { ... }
* __has__ : function (name) { ... }
* __put__ : function (name, value) {...}
* __delete__ : function (name) { ... }
* __getIds__ : function () { ... }
* };
*
* var x = new JSAdapter(y);
*
* x.i; // calls y.__get__
* i in x; // calls y.__has__
* x.p = 10; // calls y.__put__
* delete x.p; // calls y.__delete__
* for (i in x) { print(i); } // calls y.__getIds__
*
* If a special JavaScript method is not found in the adaptee, then JSAdapter
* forwards the property access to the adaptee itself.
*
* JavaScript caller of adapter object is isolated from the fact that
* the property access/mutation/deletion are really calls to
* JavaScript methods on adaptee. Use cases include 'smart'
* properties, property access tracing/debugging, encaptulation with
* easy client access - in short JavaScript becomes more "Self" like.
*
* Note that Rhino already supports special properties like __proto__
* (to set, get prototype), __parent__ (to set, get parent scope). We
* follow the same double underscore nameing convention here. Similarly
* the name JSAdapter is derived from JavaAdapter -- which is a facility
* to extend, implement Java classes/interfaces by JavaScript.
*
* @author A. Sundararajan
* @since 1.6
*/
public final class JSAdapter implements Scriptable, Function {
private JSAdapter(Scriptable obj) {
setAdaptee(obj);
}
// initializer to setup JSAdapter prototype in the given scope
public static void init(Context cx, Scriptable scope, boolean sealed)
throws RhinoException {
JSAdapter obj = new JSAdapter(cx.newObject(scope));
obj.setParentScope(scope);
obj.setPrototype(getFunctionPrototype(scope));
obj.isPrototype = true;
ScriptableObject.defineProperty(scope, "JSAdapter", obj,
ScriptableObject.DONTENUM);
}
public String getClassName() {
return "JSAdapter";
}
public Object get(String name, Scriptable start) {
Function func = getAdapteeFunction(GET_PROP);
if (func != null) {
return call(func, new Object[] { name });
} else {
start = getAdaptee();
return start.get(name, start);
}
}
public Object get(int index, Scriptable start) {
Function func = getAdapteeFunction(GET_PROP);
if (func != null) {
return call(func, new Object[] { new Integer(index) });
} else {
start = getAdaptee();
return start.get(index, start);
}
}
public boolean has(String name, Scriptable start) {
Function func = getAdapteeFunction(HAS_PROP);
if (func != null) {
Object res = call(func, new Object[] { name });
return Context.toBoolean(res);
} else {
start = getAdaptee();
return start.has(name, start);
}
}
public boolean has(int index, Scriptable start) {
Function func = getAdapteeFunction(HAS_PROP);
if (func != null) {
Object res = call(func, new Object[] { new Integer(index) });
return Context.toBoolean(res);
} else {
start = getAdaptee();
return start.has(index, start);
}
}
public void put(String name, Scriptable start, Object value) {
if (start == this) {
Function func = getAdapteeFunction(PUT_PROP);
if (func != null) {
call(func, new Object[] { name, value });
} else {
start = getAdaptee();
start.put(name, start, value);
}
} else {
start.put(name, start, value);
}
}
public void put(int index, Scriptable start, Object value) {
if (start == this) {
Function func = getAdapteeFunction(PUT_PROP);
if( func != null) {
call(func, new Object[] { new Integer(index), value });
} else {
start = getAdaptee();
start.put(index, start, value);
}
} else {
start.put(index, start, value);
}
}
public void delete(String name) {
Function func = getAdapteeFunction(DEL_PROP);
if (func != null) {
call(func, new Object[] { name });
} else {
getAdaptee().delete(name);
}
}
public void delete(int index) {
Function func = getAdapteeFunction(DEL_PROP);
if (func != null) {
call(func, new Object[] { new Integer(index) });
} else {
getAdaptee().delete(index);
}
}
public Scriptable getPrototype() {
return prototype;
}
public void setPrototype(Scriptable prototype) {
this.prototype = prototype;
}
public Scriptable getParentScope() {
return parent;
}
public void setParentScope(Scriptable parent) {
this.parent = parent;
}
public Object[] getIds() {
Function func = getAdapteeFunction(GET_PROPIDS);
if (func != null) {
Object val = call(func, new Object[0]);
// in most cases, adaptee would return native JS array
if (val instanceof NativeArray) {
NativeArray array = (NativeArray) val;
Object[] res = new Object[(int)array.getLength()];
for (int index = 0; index < res.length; index++) {
res[index] = mapToId(array.get(index, array));
}
return res;
} else if (val instanceof NativeJavaArray) {
// may be attempt wrapped Java array
Object tmp = ((NativeJavaArray)val).unwrap();
Object[] res;
if (tmp.getClass() == Object[].class) {
Object[] array = (Object[]) tmp;
res = new Object[array.length];
for (int index = 0; index < array.length; index++) {
res[index] = mapToId(array[index]);
}
} else {
// just return an empty array
res = Context.emptyArgs;
}
return res;
} else {
// some other return type, just return empty array
return Context.emptyArgs;
}
} else {
return getAdaptee().getIds();
}
}
public boolean hasInstance(Scriptable scriptable) {
if (scriptable instanceof JSAdapter) {
return true;
} else {
Scriptable proto = scriptable.getPrototype();
while (proto != null) {
if (proto.equals(this)) return true;
proto = proto.getPrototype();
}
return false;
}
}
public Object getDefaultValue(Class hint) {
return getAdaptee().getDefaultValue(hint);
}
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
throws RhinoException {
if (isPrototype) {
return construct(cx, scope, args);
} else {
Scriptable tmp = getAdaptee();
if (tmp instanceof Function) {
return ((Function)tmp).call(cx, scope, tmp, args);
} else {
throw Context.reportRuntimeError("TypeError: not a function");
}
}
}
public Scriptable construct(Context cx, Scriptable scope, Object[] args)
throws RhinoException {
if (isPrototype) {
Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
JSAdapter newObj;
if (args.length > 0) {
newObj = new JSAdapter(Context.toObject(args[0], topLevel));
} else {
throw Context.reportRuntimeError("JSAdapter requires adaptee");
}
return newObj;
} else {
Scriptable tmp = getAdaptee();
if (tmp instanceof Function) {
return ((Function)tmp).construct(cx, scope, args);
} else {
throw Context.reportRuntimeError("TypeError: not a constructor");
}
}
}
public Scriptable getAdaptee() {
return adaptee;
}
public void setAdaptee(Scriptable adaptee) {
if (adaptee == null) {
throw new NullPointerException("adaptee can not be null");
}
this.adaptee = adaptee;
}
//-- internals only below this point
// map a property id. Property id can only be an Integer or String
private Object mapToId(Object tmp) {
if (tmp instanceof Double) {
return new Integer(((Double)tmp).intValue());
} else {
return Context.toString(tmp);
}
}
private static Scriptable getFunctionPrototype(Scriptable scope) {
return ScriptableObject.getFunctionPrototype(scope);
}
private Function getAdapteeFunction(String name) {
Object o = ScriptableObject.getProperty(getAdaptee(), name);
return (o instanceof Function)? (Function)o : null;
}
private Object call(Function func, Object[] args) {
Context cx = Context.getCurrentContext();
Scriptable thisObj = getAdaptee();
Scriptable scope = func.getParentScope();
try {
return func.call(cx, scope, thisObj, args);
} catch (RhinoException re) {
throw Context.reportRuntimeError(re.getMessage());
}
}
private Scriptable prototype;
private Scriptable parent;
private Scriptable adaptee;
private boolean isPrototype;
// names of adaptee JavaScript functions
private static final String GET_PROP = "__get__";
private static final String HAS_PROP = "__has__";
private static final String PUT_PROP = "__put__";
private static final String DEL_PROP = "__delete__";
private static final String GET_PROPIDS = "__getIds__";
}
/*
* Copyright (c) 2005, 2006, 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.script.javascript;
import javax.script.Invocable;
import sun.org.mozilla.javascript.internal.*;
/**
* This class implements Rhino-like JavaAdapter to help implement a Java
* interface in JavaScript. We support this using Invocable.getInterface.
* Using this JavaAdapter, script author could write:
*
* var r = new java.lang.Runnable() {
* run: function() { script... }
* };
*
* r.run();
* new java.lang.Thread(r).start();
*
* Note that Rhino's JavaAdapter support allows extending a Java class and/or
* implementing one or more interfaces. This JavaAdapter implementation does
* not support these.
*
* @author A. Sundararajan
* @since 1.6
*/
final class JavaAdapter extends ScriptableObject implements Function {
private JavaAdapter(Invocable engine) {
this.engine = engine;
}
static void init(Context cx, Scriptable scope, boolean sealed)
throws RhinoException {
RhinoTopLevel topLevel = (RhinoTopLevel) scope;
Invocable engine = topLevel.getScriptEngine();
JavaAdapter obj = new JavaAdapter(engine);
obj.setParentScope(scope);
obj.setPrototype(getFunctionPrototype(scope));
/*
* Note that we can't use defineProperty. A property of this
* name is already defined in Context.initStandardObjects. We
* simply overwrite the property value!
*/
ScriptableObject.putProperty(topLevel, "JavaAdapter", obj);
}
public String getClassName() {
return "JavaAdapter";
}
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args) throws RhinoException {
return construct(cx, scope, args);
}
public Scriptable construct(Context cx, Scriptable scope, Object[] args)
throws RhinoException {
if (args.length == 2) {
Class<?> clazz = null;
Object obj1 = args[0];
if (obj1 instanceof Wrapper) {
Object o = ((Wrapper)obj1).unwrap();
if (o instanceof Class && ((Class)o).isInterface()) {
clazz = (Class) o;
}
} else if (obj1 instanceof Class) {
if (((Class)obj1).isInterface()) {
clazz = (Class) obj1;
}
}
if (clazz == null) {
throw Context.reportRuntimeError("JavaAdapter: first arg should be interface Class");
}
Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
return cx.toObject(engine.getInterface(args[1], clazz), topLevel);
} else {
throw Context.reportRuntimeError("JavaAdapter requires two arguments");
}
}
private Invocable engine;
}
#script engines supported
com.sun.script.javascript.RhinoScriptEngineFactory #javascript
/*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.script.javascript;
import com.sun.script.util.*;
import javax.script.*;
import sun.org.mozilla.javascript.internal.*;
import java.lang.reflect.Method;
import java.io.*;
import java.util.*;
/**
* Implementation of <code>ScriptEngine</code> using the Mozilla Rhino
* interpreter.
*
* @author Mike Grogan
* @author A. Sundararajan
* @since 1.6
*/
public final class RhinoScriptEngine extends AbstractScriptEngine
implements Invocable, Compilable {
private static final boolean DEBUG = false;
/* Scope where standard JavaScript objects and our
* extensions to it are stored. Note that these are not
* user defined engine level global variables. These are
* variables have to be there on all compliant ECMAScript
* scopes. We put these standard objects in this top level.
*/
private RhinoTopLevel topLevel;
/* map used to store indexed properties in engine scope
* refer to comment on 'indexedProps' in ExternalScriptable.java.
*/
private Map<Object, Object> indexedProps;
private ScriptEngineFactory factory;
private InterfaceImplementor implementor;
private static final int languageVersion = getLanguageVersion();
private static final int optimizationLevel = getOptimizationLevel();
static {
ContextFactory.initGlobal(new ContextFactory() {
protected Context makeContext() {
Context cx = super.makeContext();
cx.setLanguageVersion(languageVersion);
cx.setOptimizationLevel(optimizationLevel);
cx.setClassShutter(RhinoClassShutter.getInstance());
cx.setWrapFactory(RhinoWrapFactory.getInstance());
return cx;
}
});
}
private static final String RHINO_JS_VERSION = "rhino.js.version";
private static int getLanguageVersion() {
int version;
String tmp = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction(RHINO_JS_VERSION));
if (tmp != null) {
version = Integer.parseInt((String)tmp);
} else {
version = Context.VERSION_1_8;
}
return version;
}
private static final String RHINO_OPT_LEVEL = "rhino.opt.level";
private static int getOptimizationLevel() {
int optLevel = -1;
// disable optimizer under security manager, for now.
if (System.getSecurityManager() == null) {
optLevel = Integer.getInteger(RHINO_OPT_LEVEL, -1);
}
return optLevel;
}
/**
* Creates a new instance of RhinoScriptEngine
*/
public RhinoScriptEngine() {
Context cx = enterContext();
try {
topLevel = new RhinoTopLevel(cx, this);
} finally {
cx.exit();
}
indexedProps = new HashMap<Object, Object>();
//construct object used to implement getInterface
implementor = new InterfaceImplementor(this) {
protected boolean isImplemented(Object thiz, Class<?> iface) {
Context cx = enterContext();
try {
if (thiz != null && !(thiz instanceof Scriptable)) {
thiz = cx.toObject(thiz, topLevel);
}
Scriptable engineScope = getRuntimeScope(context);
Scriptable localScope = (thiz != null)? (Scriptable) thiz :
engineScope;
for (Method method : iface.getMethods()) {
// ignore methods of java.lang.Object class
if (method.getDeclaringClass() == Object.class) {
continue;
}
Object obj = ScriptableObject.getProperty(localScope, method.getName());
if (! (obj instanceof Function)) {
return false;
}
}
return true;
} finally {
cx.exit();
}
}
protected Object convertResult(Method method, Object res)
throws ScriptException {
Class desiredType = method.getReturnType();
if (desiredType == Void.TYPE) {
return null;
} else {
return Context.jsToJava(res, desiredType);
}
}
};
}
public Object eval(Reader reader, ScriptContext ctxt)
throws ScriptException {
Object ret;
Context cx = enterContext();
try {
Scriptable scope = getRuntimeScope(ctxt);
String filename = (String) get(ScriptEngine.FILENAME);
filename = filename == null ? "<Unknown source>" : filename;
ret = cx.evaluateReader(scope, reader, filename , 1, null);
} catch (RhinoException re) {
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
String msg;
if (re instanceof JavaScriptException) {
msg = String.valueOf(((JavaScriptException)re).getValue());
} else {
msg = re.toString();
}
ScriptException se = new ScriptException(msg, re.sourceName(), line);
se.initCause(re);
throw se;
} catch (IOException ee) {
throw new ScriptException(ee);
} finally {
cx.exit();
}
return unwrapReturnValue(ret);
}
public Object eval(String script, ScriptContext ctxt) throws ScriptException {
if (script == null) {
throw new NullPointerException("null script");
}
return eval(new StringReader(script) , ctxt);
}
public ScriptEngineFactory getFactory() {
if (factory != null) {
return factory;
} else {
return new RhinoScriptEngineFactory();
}
}
public Bindings createBindings() {
return new SimpleBindings();
}
//Invocable methods
public Object invokeFunction(String name, Object... args)
throws ScriptException, NoSuchMethodException {
return invoke(null, name, args);
}
public Object invokeMethod(Object thiz, String name, Object... args)
throws ScriptException, NoSuchMethodException {
if (thiz == null) {
throw new IllegalArgumentException("script object can not be null");
}
return invoke(thiz, name, args);
}
private Object invoke(Object thiz, String name, Object... args)
throws ScriptException, NoSuchMethodException {
Context cx = enterContext();
try {
if (name == null) {
throw new NullPointerException("method name is null");
}
if (thiz != null && !(thiz instanceof Scriptable)) {
thiz = cx.toObject(thiz, topLevel);
}
Scriptable engineScope = getRuntimeScope(context);
Scriptable localScope = (thiz != null)? (Scriptable) thiz :
engineScope;
Object obj = ScriptableObject.getProperty(localScope, name);
if (! (obj instanceof Function)) {
throw new NoSuchMethodException("no such method: " + name);
}
Function func = (Function) obj;
Scriptable scope = func.getParentScope();
if (scope == null) {
scope = engineScope;
}
Object result = func.call(cx, scope, localScope,
wrapArguments(args));
return unwrapReturnValue(result);
} catch (RhinoException re) {
if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line;
ScriptException se = new ScriptException(re.toString(), re.sourceName(), line);
se.initCause(re);
throw se;
} finally {
cx.exit();
}
}
public <T> T getInterface(Class<T> clasz) {
try {
return implementor.getInterface(null, clasz);
} catch (ScriptException e) {
return null;
}
}
public <T> T getInterface(Object thiz, Class<T> clasz) {
if (thiz == null) {
throw new IllegalArgumentException("script object can not be null");
}
try {
return implementor.getInterface(thiz, clasz);
} catch (ScriptException e) {
return null;
}
}
private static final String printSource =
"function print(str, newline) { \n" +
" if (typeof(str) == 'undefined') { \n" +
" str = 'undefined'; \n" +
" } else if (str == null) { \n" +
" str = 'null'; \n" +
" } \n" +
" var out = context.getWriter(); \n" +
" if (!(out instanceof java.io.PrintWriter))\n" +
" out = new java.io.PrintWriter(out); \n" +
" out.print(String(str)); \n" +
" if (newline) out.print('\\n'); \n" +
" out.flush(); \n" +
"}\n" +
"function println(str) { \n" +
" print(str, true); \n" +
"}";
Scriptable getRuntimeScope(ScriptContext ctxt) {
if (ctxt == null) {
throw new NullPointerException("null script context");
}
// we create a scope for the given ScriptContext
Scriptable newScope = new ExternalScriptable(ctxt, indexedProps);
// Set the prototype of newScope to be 'topLevel' so that
// JavaScript standard objects are visible from the scope.
newScope.setPrototype(topLevel);
// define "context" variable in the new scope
newScope.put("context", newScope, ctxt);
// define "print", "println" functions in the new scope
Context cx = enterContext();
try {
cx.evaluateString(newScope, printSource, "print", 1, null);
} finally {
cx.exit();
}
return newScope;
}
//Compilable methods
public CompiledScript compile(String script) throws ScriptException {
return compile(new StringReader(script));
}
public CompiledScript compile(java.io.Reader script) throws ScriptException {
CompiledScript ret = null;
Context cx = enterContext();
try {
String fileName = (String) get(ScriptEngine.FILENAME);
if (fileName == null) {
fileName = "<Unknown Source>";
}
Scriptable scope = getRuntimeScope(context);
Script scr = cx.compileReader(scope, script, fileName, 1, null);
ret = new RhinoCompiledScript(this, scr);
} catch (Exception e) {
if (DEBUG) e.printStackTrace();
throw new ScriptException(e);
} finally {
cx.exit();
}
return ret;
}
//package-private helpers
static Context enterContext() {
// call this always so that initializer of this class runs
// and initializes custom wrap factory and class shutter.
return Context.enter();
}
void setEngineFactory(ScriptEngineFactory fac) {
factory = fac;
}
Object[] wrapArguments(Object[] args) {
if (args == null) {
return Context.emptyArgs;
}
Object[] res = new Object[args.length];
for (int i = 0; i < res.length; i++) {
res[i] = Context.javaToJS(args[i], topLevel);
}
return res;
}
Object unwrapReturnValue(Object result) {
if (result instanceof Wrapper) {
result = ( (Wrapper) result).unwrap();
}
return result instanceof Undefined ? null : result;
}
/*
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("No file specified");
return;
}
InputStreamReader r = new InputStreamReader(new FileInputStream(args[0]));
ScriptEngine engine = new RhinoScriptEngine();
engine.put("x", "y");
engine.put(ScriptEngine.FILENAME, args[0]);
engine.eval(r);
System.out.println(engine.get("x"));
}
*/
}
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. 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.script.javascript;
import javax.script.*;
import java.util.*;
import sun.org.mozilla.javascript.internal.*;
import com.sun.script.util.*;
/**
* Factory to create RhinoScriptEngine
*
* @author Mike Grogan
* @since 1.6
*/
public class RhinoScriptEngineFactory extends ScriptEngineFactoryBase {
public RhinoScriptEngineFactory() {
}
public List<String> getExtensions() {
return extensions;
}
public List<String> getMimeTypes() {
return mimeTypes;
}
public List<String> getNames() {
return names;
}
public Object getParameter(String key) {
if (key.equals(ScriptEngine.NAME)) {
return "javascript";
} else if (key.equals(ScriptEngine.ENGINE)) {
return "Mozilla Rhino";
} else if (key.equals(ScriptEngine.ENGINE_VERSION)) {
return "1.7 release 3 PRERELEASE";
} else if (key.equals(ScriptEngine.LANGUAGE)) {
return "ECMAScript";
} else if (key.equals(ScriptEngine.LANGUAGE_VERSION)) {
return "1.8";
} else if (key.equals("THREADING")) {
return "MULTITHREADED";
} else {
throw new IllegalArgumentException("Invalid key");
}
}
public ScriptEngine getScriptEngine() {
RhinoScriptEngine ret = new RhinoScriptEngine();
ret.setEngineFactory(this);
return ret;
}
public String getMethodCallSyntax(String obj, String method, String... args) {
String ret = obj + "." + method + "(";
int len = args.length;
if (len == 0) {
ret += ")";
return ret;
}
for (int i = 0; i < len; i++) {
ret += args[i];
if (i != len - 1) {
ret += ",";
} else {
ret += ")";
}
}
return ret;
}
public String getOutputStatement(String toDisplay) {
StringBuffer buf = new StringBuffer();
int len = toDisplay.length();
buf.append("print(\"");
for (int i = 0; i < len; i++) {
char ch = toDisplay.charAt(i);
switch (ch) {
case '"':
buf.append("\\\"");
break;
case '\\':
buf.append("\\\\");
break;
default:
buf.append(ch);
break;
}
}
buf.append("\")");
return buf.toString();
}
public String getProgram(String... statements) {
int len = statements.length;
String ret = "";
for (int i = 0; i < len; i++) {
ret += statements[i] + ";";
}
return ret;
}
/*
public static void main(String[] args) {
RhinoScriptEngineFactory fact = new RhinoScriptEngineFactory();
System.out.println(fact.getParameter(ScriptEngine.ENGINE_VERSION));
}
*/
private static List<String> names;
private static List<String> mimeTypes;
private static List<String> extensions;
static {
names = new ArrayList<String>(6);
names.add("js");
names.add("rhino");
names.add("JavaScript");
names.add("javascript");
names.add("ECMAScript");
names.add("ecmascript");
names = Collections.unmodifiableList(names);
mimeTypes = new ArrayList<String>(4);
mimeTypes.add("application/javascript");
mimeTypes.add("application/ecmascript");
mimeTypes.add("text/javascript");
mimeTypes.add("text/ecmascript");
mimeTypes = Collections.unmodifiableList(mimeTypes);
extensions = new ArrayList<String>(1);
extensions.add("js");
extensions = Collections.unmodifiableList(extensions);
}
}
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. 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.script.javascript;
import sun.org.mozilla.javascript.internal.*;
import javax.script.*;
/**
* This class serves as top level scope for Rhino. This class adds
* 3 top level functions (bindings, scope, sync) and two constructors
* (JSAdapter, JavaAdapter).
*
* @author A. Sundararajan
* @since 1.6
*/
public final class RhinoTopLevel extends ImporterTopLevel {
RhinoTopLevel(Context cx, RhinoScriptEngine engine) {
super(cx);
this.engine = engine;
// initialize JSAdapter lazily. Reduces footprint & startup time.
new LazilyLoadedCtor(this, "JSAdapter",
"com.sun.script.javascript.JSAdapter",
false);
/*
* initialize JavaAdapter. We can't lazy initialize this because
* lazy initializer attempts to define a new property. But, JavaAdapter
* is an exisiting property that we overwrite.
*/
JavaAdapter.init(cx, this, false);
// add top level functions
String names[] = { "bindings", "scope", "sync" };
defineFunctionProperties(names, RhinoTopLevel.class,
ScriptableObject.DONTENUM);
}
/**
* The bindings function takes a JavaScript scope object
* of type ExternalScriptable and returns the underlying Bindings
* instance.
*
* var page = scope(pageBindings);
* with (page) {
* // code that uses page scope
* }
* var b = bindings(page);
* // operate on bindings here.
*/
public static Object bindings(Context cx, Scriptable thisObj, Object[] args,
Function funObj) {
if (args.length == 1) {
Object arg = args[0];
if (arg instanceof Wrapper) {
arg = ((Wrapper)arg).unwrap();
}
if (arg instanceof ExternalScriptable) {
ScriptContext ctx = ((ExternalScriptable)arg).getContext();
Bindings bind = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
return Context.javaToJS(bind,
ScriptableObject.getTopLevelScope(thisObj));
}
}
return cx.getUndefinedValue();
}
/**
* The scope function creates a new JavaScript scope object
* with given Bindings object as backing store. This can be used
* to create a script scope based on arbitrary Bindings instance.
* For example, in webapp scenario, a 'page' level Bindings instance
* may be wrapped as a scope and code can be run in JavaScripe 'with'
* statement:
*
* var page = scope(pageBindings);
* with (page) {
* // code that uses page scope
* }
*/
public static Object scope(Context cx, Scriptable thisObj, Object[] args,
Function funObj) {
if (args.length == 1) {
Object arg = args[0];
if (arg instanceof Wrapper) {
arg = ((Wrapper)arg).unwrap();
}
if (arg instanceof Bindings) {
ScriptContext ctx = new SimpleScriptContext();
ctx.setBindings((Bindings)arg, ScriptContext.ENGINE_SCOPE);
Scriptable res = new ExternalScriptable(ctx);
res.setPrototype(ScriptableObject.getObjectPrototype(thisObj));
res.setParentScope(ScriptableObject.getTopLevelScope(thisObj));
return res;
}
}
return cx.getUndefinedValue();
}
/**
* The sync function creates a synchronized function (in the sense
* of a Java synchronized method) from an existing function. The
* new function synchronizes on the <code>this</code> object of
* its invocation.
* js> var o = { f : sync(function(x) {
* print("entry");
* Packages.java.lang.Thread.sleep(x*1000);
* print("exit");
* })};
* js> thread(function() {o.f(5);});
* entry
* js> thread(function() {o.f(5);});
* js>
* exit
* entry
* exit
*/
public static Object sync(Context cx, Scriptable thisObj, Object[] args,
Function funObj) {
if (args.length == 1 && args[0] instanceof Function) {
return new Synchronizer((Function)args[0]);
} else {
throw Context.reportRuntimeError("wrong argument(s) for sync");
}
}
RhinoScriptEngine getScriptEngine() {
return engine;
}
private RhinoScriptEngine engine;
}
/*
* Copyright (c) 2005, 2006, 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.script.javascript;
import java.lang.reflect.*;
import static sun.security.util.SecurityConstants.*;
import sun.org.mozilla.javascript.internal.*;
/**
* This wrap factory is used for security reasons. JSR 223 script
* engine interface and JavaScript engine classes are run as bootstrap
* classes. For example, java.lang.Class.forName method (when called without
* class loader) uses caller's class loader. This may be exploited by script
* authors to access classes otherwise not accessible. For example,
* classes in sun.* namespace are normally not accessible to untrusted
* code and hence should not be accessible to JavaScript run from
* untrusted code.
*
* @author A. Sundararajan
* @since 1.6
*/
final class RhinoWrapFactory extends WrapFactory {
private RhinoWrapFactory() {}
private static RhinoWrapFactory theInstance;
static synchronized WrapFactory getInstance() {
if (theInstance == null) {
theInstance = new RhinoWrapFactory();
}
return theInstance;
}
// We use instance of this class to wrap security sensitive
// Java object. Please refer below.
private static class RhinoJavaObject extends NativeJavaObject {
RhinoJavaObject(Scriptable scope, Object obj, Class type) {
// we pass 'null' to object. NativeJavaObject uses
// passed 'type' to reflect fields and methods when
// object is null.
super(scope, null, type);
// Now, we set actual object. 'javaObject' is protected
// field of NativeJavaObject.
javaObject = obj;
}
}
public Scriptable wrapAsJavaObject(Context cx, Scriptable scope,
Object javaObject, Class staticType) {
SecurityManager sm = System.getSecurityManager();
ClassShutter classShutter = RhinoClassShutter.getInstance();
if (javaObject instanceof ClassLoader) {
// Check with Security Manager whether we can expose a
// ClassLoader...
if (sm != null) {
sm.checkPermission(GET_CLASSLOADER_PERMISSION);
}
// if we fall through here, check permission succeeded.
return super.wrapAsJavaObject(cx, scope, javaObject, staticType);
} else {
String name = null;
if (javaObject instanceof Class) {
name = ((Class)javaObject).getName();
} else if (javaObject instanceof Member) {
Member member = (Member) javaObject;
// Check member access. Don't allow reflective access to
// non-public members. Note that we can't call checkMemberAccess
// because that expects exact stack depth!
if (sm != null && !Modifier.isPublic(member.getModifiers())) {
return null;
}
name = member.getDeclaringClass().getName();
}
// Now, make sure that no ClassShutter prevented Class or Member
// of it is accessed reflectively. Note that ClassShutter may
// prevent access to a class, even though SecurityManager permit.
if (name != null) {
if (!classShutter.visibleToScripts(name)) {
return null;
} else {
return super.wrapAsJavaObject(cx, scope, javaObject, staticType);
}
}
}
// we have got some non-reflective object.
Class dynamicType = javaObject.getClass();
String name = dynamicType.getName();
if (!classShutter.visibleToScripts(name)) {
// Object of some sensitive class (such as sun.net.www.*
// objects returned from public method of java.net.URL class.
// We expose this object as though it is an object of some
// super class that is safe for access.
Class type = null;
// Whenever a Java Object is wrapped, we are passed with a
// staticType which is the type found from environment. For
// example, method return type known from signature. The dynamic
// type would be the actual Class of the actual returned object.
// If the staticType is an interface, we just use that type.
if (staticType != null && staticType.isInterface()) {
type = staticType;
} else {
// dynamicType is always a class type and never an interface.
// find an accessible super class of the dynamic type.
while (dynamicType != null) {
dynamicType = dynamicType.getSuperclass();
name = dynamicType.getName();
if (classShutter.visibleToScripts(name)) {
type = dynamicType; break;
}
}
// atleast java.lang.Object has to be accessible. So, when
// we reach here, type variable should not be null.
assert type != null:
"even java.lang.Object is not accessible?";
}
// create custom wrapper with the 'safe' type.
return new RhinoJavaObject(scope, javaObject, type);
} else {
return super.wrapAsJavaObject(cx, scope, javaObject, staticType);
}
}
}
/*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.script.util;
import javax.script.*;
import java.lang.reflect.*;
import java.security.*;
/*
* java.lang.reflect.Proxy based interface implementor. This is meant
* to be used to implement Invocable.getInterface.
*
* @author Mike Grogan
* @since 1.6
*/
public class InterfaceImplementor {
private Invocable engine;
/** Creates a new instance of Invocable */
public InterfaceImplementor(Invocable engine) {
this.engine = engine;
}
private final class InterfaceImplementorInvocationHandler
implements InvocationHandler {
private Object thiz;
private AccessControlContext accCtxt;
public InterfaceImplementorInvocationHandler(Object thiz,
AccessControlContext accCtxt) {
this.thiz = thiz;
this.accCtxt = accCtxt;
}
public Object invoke(Object proxy , Method method, Object[] args)
throws java.lang.Throwable {
// give chance to convert input args
args = convertArguments(method, args);
Object result;
final Method m = method;
final Object[] a = args;
result = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
if (thiz == null) {
return engine.invokeFunction(m.getName(), a);
} else {
return engine.invokeMethod(thiz, m.getName(), a);
}
}
}, accCtxt);
// give chance to convert the method result
return convertResult(method, result);
}
}
public <T> T getInterface(Object thiz, Class<T> iface)
throws ScriptException {
if (iface == null || !iface.isInterface()) {
throw new IllegalArgumentException("interface Class expected");
}
if (! isImplemented(thiz, iface)) {
return null;
}
AccessControlContext accCtxt = AccessController.getContext();
return iface.cast(Proxy.newProxyInstance(iface.getClassLoader(),
new Class[]{iface},
new InterfaceImplementorInvocationHandler(thiz, accCtxt)));
}
protected boolean isImplemented(Object thiz, Class<?> iface) {
return true;
}
// called to convert method result after invoke
protected Object convertResult(Method method, Object res)
throws ScriptException {
// default is identity conversion
return res;
}
// called to convert method arguments before invoke
protected Object[] convertArguments(Method method, Object[] args)
throws ScriptException {
// default is identity conversion
return args;
}
}
......@@ -348,14 +348,23 @@ final class DigestMD5Client extends DigestMD5Base implements SaslClient {
0, false);
cbh.handle(new Callback[] {ccb, ncb, pcb});
/* Acquire realm from RealmChoiceCallback*/
negotiatedRealm = realmTokens[ccb.getSelectedIndexes()[0]];
// Acquire realm from RealmChoiceCallback
int[] selected = ccb.getSelectedIndexes();
if (selected == null
|| selected[0] < 0
|| selected[0] >= realmTokens.length) {
throw new SaslException("DIGEST-MD5: Invalid realm chosen");
}
negotiatedRealm = realmTokens[selected[0]];
}
passwd = pcb.getPassword();
pcb.clearPassword();
username = ncb.getName();
} catch (SaslException se) {
throw se;
} catch (UnsupportedCallbackException e) {
throw new SaslException("DIGEST-MD5: Cannot perform callback to " +
"acquire realm, authentication ID or password", e);
......
......@@ -142,7 +142,7 @@ abstract class AbstractLauncher extends ConnectorImpl implements LaunchingConnec
* This class simply provides a context for a single launch and
* accept. It provides instance fields that can be used by
* all threads involved. This stuff can't be in the Connector proper
* because the connector is is a singleton and not specific to any
* because the connector is a singleton and is not specific to any
* one launch.
*/
private class Helper {
......
......@@ -213,7 +213,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin
exePath = exe;
}
// Quote only if necessary in case the quote arg value is bogus
if (hasWhitespace(exe)) {
if (hasWhitespace(exePath)) {
exePath = quote + exePath + quote;
}
......
/*
* Copyright (c) 1996, 2011, 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
......@@ -26,6 +26,13 @@
package java.io;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
* Reads text from a character-input stream, buffering characters so as to
* provide for the efficient reading of characters, arrays, and lines.
......@@ -522,4 +529,64 @@ public class BufferedReader extends Reader {
}
}
}
/**
* Returns a {@code Stream}, the elements of which are lines read from
* this {@code BufferedReader}. The {@link Stream} is lazily populated,
* i.e, read only occurs during the
* <a href="../util/stream/package-summary.html#StreamOps">terminal
* stream operation</a>.
*
* <p> The reader must not be operated on during the execution of the
* terminal stream operation. Otherwise, the result of the terminal stream
* operation is undefined.
*
* <p> After execution of the terminal stream operation there are no
* guarantees that the reader will be at a specific position from which to
* read the next character or line.
*
* <p> If an {@link IOException} is thrown when accessing the underlying
* {@code BufferedReader}, it is wrapped in an {@link
* UncheckedIOException} which will be thrown from the {@code Stream}
* method that caused the read to take place. This method will return a
* Stream if invoked on a BufferedReader that is closed. Any operation on
* that stream requires reading from the BufferedReader after is it closed
* will cause an UncheckedIOException to be thrown.
*
* @return a {@code Stream<String>} providing the lines of text
* described by this {@code BufferedReader}
*
* @since 1.8
*/
public Stream<String> lines() {
Iterator<String> iter = new Iterator<String>() {
String nextLine = null;
@Override
public boolean hasNext() {
if (nextLine != null) {
return true;
} else {
try {
nextLine = readLine();
return (nextLine != null);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
@Override
public String next() {
if (nextLine != null || hasNext()) {
String line = nextLine;
nextLine = null;
return line;
} else {
throw new NoSuchElementException();
}
}
};
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter, Spliterator.ORDERED));
}
}
此差异已折叠。
/*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 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
......@@ -123,6 +123,9 @@ class FileInputStream extends InputStream
if (name == null) {
throw new NullPointerException();
}
if (file.isInvalid()) {
throw new FileNotFoundException("Invalid file path");
}
fd = new FileDescriptor();
fd.attach(this);
open(name);
......
/*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 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
......@@ -196,6 +196,9 @@ class FileOutputStream extends OutputStream
if (name == null) {
throw new NullPointerException();
}
if (file.isInvalid()) {
throw new FileNotFoundException("Invalid file path");
}
this.fd = new FileDescriptor();
fd.attach(this);
this.append = append;
......
/*
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 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
......@@ -228,6 +228,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
if (name == null) {
throw new NullPointerException();
}
if (file.isInvalid()) {
throw new FileNotFoundException("Invalid file path");
}
fd = new FileDescriptor();
fd.attach(this);
open(name, imode);
......
......@@ -29,7 +29,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.security.AccessControlException;
import java.util.Arrays;
import java.util.ArrayList;
......@@ -1024,10 +1023,10 @@ public final class ProcessBuilder
dir,
redirects,
redirectErrorStream);
} catch (IOException e) {
} catch (IOException | IllegalArgumentException e) {
String exceptionInfo = ": " + e.getMessage();
Throwable cause = e;
if (security != null) {
if ((e instanceof IOException) && security != null) {
// Can not disclose the fail reason for read-protected files.
try {
security.checkRead(prog);
......
......@@ -1246,6 +1246,9 @@ public final class System {
public StackTraceElement getStackTraceElement(Throwable t, int i) {
return t.getStackTraceElement(i);
}
public String newStringUnsafe(char[] chars) {
return new String(chars, true);
}
});
}
}
......@@ -236,6 +236,8 @@ import java.util.Objects;
assert(MethodHandleNatives.refKindIsMethod(refKind));
if (clazz.isInterface())
assert(refKind == REF_invokeInterface ||
refKind == REF_invokeStatic ||
refKind == REF_invokeSpecial ||
refKind == REF_invokeVirtual && isObjectPublicMethod());
} else {
assert(false);
......@@ -268,7 +270,7 @@ import java.util.Objects;
assert(refKind == REF_invokeSpecial) : this;
return true;
}
assert(false) : this;
assert(false) : this+" != "+MethodHandleNatives.refKindName((byte)originalRefKind);
return true;
}
private boolean staticIsConsistent() {
......@@ -485,14 +487,19 @@ import java.util.Objects;
if (this.type == null)
this.type = new Object[] { m.getReturnType(), m.getParameterTypes() };
if (wantSpecial) {
assert(!isAbstract()) : this;
if (getReferenceKind() == REF_invokeVirtual)
changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual);
else if (getReferenceKind() == REF_invokeInterface)
// invokeSpecial on a default method
changeReferenceKind(REF_invokeSpecial, REF_invokeInterface);
}
}
public MemberName asSpecial() {
switch (getReferenceKind()) {
case REF_invokeSpecial: return this;
case REF_invokeVirtual: return clone().changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual);
case REF_invokeInterface: return clone().changeReferenceKind(REF_invokeSpecial, REF_invokeInterface);
case REF_newInvokeSpecial: return clone().changeReferenceKind(REF_invokeSpecial, REF_newInvokeSpecial);
}
throw new IllegalArgumentException(this.toString());
......
......@@ -1161,6 +1161,6 @@ class Field extends AccessibleObject implements Member {
this,
getDeclaringClass(),
getGenericType(),
TypeAnnotation.TypeAnnotationTarget.FIELD_TYPE);
TypeAnnotation.TypeAnnotationTarget.FIELD);
}
}
......@@ -200,6 +200,19 @@ public final class Parameter implements AnnotatedElement {
return tmp;
}
/**
* Returns an AnnotatedType object that represents the use of a type to
* specify the type of the formal parameter represented by this Parameter.
*
* @return an {@code AnnotatedType} object representing the use of a type
* to specify the type of the formal parameter represented by this
* Parameter
*/
public AnnotatedType getAnnotatedType() {
// no caching for now
return executable.getAnnotatedParameterTypes()[index];
}
private transient volatile Class<?> parameterClassCache = null;
/**
......
此差异已折叠。
......@@ -67,7 +67,7 @@ package java.time;
* This exception is used to indicate problems with creating, querying
* and manipulating date-time objects.
*
* <h3>Specification for implementors</h3>
* @implSpec
* This class is intended for use in a single thread.
*
* @since 1.8
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册