Mercurial > hg > release > icedtea7-forest-2.3 > jdk
changeset 6301:bd392c168d5c icedtea-2.3.10
Merge
line wrap: on
line diff
--- a/.hgtags Tue Jun 18 14:04:33 2013 +0100 +++ b/.hgtags Fri Jun 21 15:46:14 2013 -0500 @@ -223,6 +223,7 @@ ca6ee539c5f4f4dd9d5fb9b0604d94c5806c3e28 icedtea-2.3.6 ca6ee539c5f4f4dd9d5fb9b0604d94c5806c3e28 icedtea-2.3.6 0000000000000000000000000000000000000000 icedtea-2.3.6 +8c2c5d63a17ee5aa85face026d6f60fb7d34aded jdk7u6-b31 78e01a6ca8d30e8fc4eb297d297a098edfb3fec6 jdk7u7-b10 9666d4e4bbf3f80614e246d5c15df86154544013 jdk7u7-b30 94154c14973aee7c5ff4846af7bcb71fe7a82fa5 jdk7u7-b11 @@ -236,6 +237,8 @@ 901c290c9c8b495a2696f10a87523363239d001b jdk7u9-b02 7302c386ca9c6cd20c27d0a2adb0b142f679d6b3 jdk7u9-b04 ffad06d7009576c3098705e05452ebc309a59e56 jdk7u9-b05 +3b1a395f1948c7063d342a0c3e26c8450c6e7acb jdk7u9-b31 +77f7e5f13763fed11afb6e12840d78bd55c2d979 jdk7u9-b32 c1efb11d7db509dafd7882811b2562ba593f6431 jdk7u10-b10 0243e41000c6f76654725cac31ffdc95633c63e7 jdk7u10-b11 c86a49dd4a0dca3a56f00429cfcffb2ad5f2a224 jdk7u10-b12 @@ -246,8 +249,11 @@ a1c5bac982a6d4aa58f551cb46cde53f526aca48 jdk7u10-b17 115d1e4365293846bbc911cf312886c471e37fbd jdk7u10-b18 84218dff5e4c7bc00fd9266769c0d12bdde866f5 jdk7u10-b30 +3515fd583ede49b125a0b5f72ac403b3984d199b jdk7u10-b31 ecc14534318c80dc7612c8b1d328a67849c5b07f jdk7u11-b20 d9969a953f693f5760b1d2759f11a2cb222e4f20 jdk7u11-b21 +c7282a85c6bcc717b7099a03db028ecb77b41098 jdk7u11-b32 +8fd5e105c6a288b01f8809a6c84a5a64a63f39be jdk7u11-b33 84da14fbd3ac12a3c6734fa4b6a366cfde1426af jdk7u11-b03 932ef74edbf984299a68c126c70bbe04ffbde9b5 jdk7u11-b04 fb35fb91f6478f8076993bcc4112746bcd9a2985 jdk7u11-b05 @@ -273,6 +279,40 @@ 835448d525a10bb826f4f7ebe272fc410bdb0f5d jdk7u15-b01 0443fe2d8023111b52f4c8db32e038f4a5a9f373 jdk7u15-b02 70b0f967c0649c501fb14a27bb06daeccbff823a jdk7u15-b30 +9f20468265071696b4d2ece286bc228a4d5a302a jdk7u15-b31 +3ef25219292f57ea56ac0ef338ceadf5fd098bdf jdk7u15-b33 87e45d30e24db726ea03b20d861f0a025e437641 jdk7u15-b03 b5ae6fb92e71df1833221026efe50863593bf682 jdk7u17-b01 8e91101e36f0e0bcb68036c32c69dda38e79b118 icedtea-2.3.9 +b130c8cfecfc552614047b3244d5d94439827fcd jdk7u17-b02 +a474615061bf610105a426780a7ac4c95bd76456 jdk7u17-b30 +1ad6f413e250bd2671b4908e232bd0d244c917a7 jdk7u17-b31 +6c6b9d7943e78d1f797b0c2e1c1231f81816dfde jdk7u17-b32 +8261e56b7f91c7553e8485b206bdc9030a3546e4 jdk7u21-b01 +af6be9d7aed7c323858932c908b049f4bcdb6a3e jdk7u21-b05 +ffc1454e644a39265cd6d80ef4b4c12c5dbf35c9 jdk7u21-b06 +b453d9be6b3f5496aa217ade7478d3b7fa32b13b jdk7u21-b07 +de4e41c5c549136209a68154d847cf126e563b88 jdk7u21-b08 +622aedcdda610a148a082558a0c25d8b3b735d07 jdk7u21-b09 +f447c3bbf074439ece0ce9fea82c857f93817801 jdk7u21-b10 +f9323b9d020ce8d313af2d2e2682e2b6cabcc40d jdk7u21-b11 +08ed0bfc9668f04ce4e3803f16aad92f6e50f885 jdk7u21-b30 +f3cf02a53684b9fbefabb212c80dfbea0c27f113 jdk7u21-b12 +a5e712ea6944b1c81bcd5343a50645964f12b107 jdk7u21-b02 +9d87f5f84afef6ba4c92523a76e3c81fd9acfa00 jdk7u21-b03 +139d3e3b62d49374112ce1add84cd3d1e5ed5335 jdk7u21-b04 +7fd0922d6ed2988954c666de313f7fceef75dc63 jdk7u25-b01 +846304f476f1b1d2955d025d54307be76c3c4874 jdk7u25-b02 +2a444d8e36ebc7161a735b45143b22e141d9a5c0 jdk7u25-b03 +7fc6c331082c3586fa6c6ead014c96f3c532bc34 jdk7u25-b04 +f2d4da9ba0f05165e8a85d0fd5085d707e434eab jdk7u25-b05 +5748526c96f0d3fd5771b72a81fcd61f4e23b0d8 jdk7u25-b06 +fe514475bc17355f5f0a8dc7dd423d0043ed5326 jdk7u25-b07 +f8373784a79eba32b47e655cc5880f594a12423c jdk7u25-b08 +023297d5b047c0b6c54869d6514fa3c1427c206c jdk7u25-b09 +c82ed89b21bcb5279ff2fd4bc54127cd580dea7e jdk7u25-b10 +ef5d29607ccee9712f2c768f269e4b9fa53a6859 jdk7u25-b11 +39282f16234385bbddd19189de2450f8bf88492b jdk7u25-b12 +ba6c3d64b94d17d90b86e36b7a282480a1c6808a jdk7u25-b13 +a71103b8cbb155a4af136baaee4f4bdd30ee817c jdk7u25-b14 +e1768e2070c938ec97325ad48b0d281e3031a29c jdk7u25-b15
--- a/make/common/Defs.gmk Tue Jun 18 14:04:33 2013 +0100 +++ b/make/common/Defs.gmk Fri Jun 21 15:46:14 2013 -0500 @@ -312,6 +312,7 @@ JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-image JRE_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-image +JDK_SERVER_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-server-image #where the demo source can be found DEMOSRCDIR = $(SHARE_SRC)/demo
--- a/make/common/Release-macosx.gmk Tue Jun 18 14:04:33 2013 +0100 +++ b/make/common/Release-macosx.gmk Fri Jun 21 15:46:14 2013 -0500 @@ -31,6 +31,8 @@ JDK_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents JRE_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2re-bundle/jre$(JDK_VERSION).jre/Contents +JDK_SERVER_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2sdk-server-bundle/jdk$(JDK_VERSION).jdk/Contents +JDK_SERVER_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-server-image MACOSX_SRC = $(JDK_TOPDIR)/src/macosx @@ -70,6 +72,13 @@ $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" < $(MACOSX_SRC)/bundle/JDK-Info.plist > $(JDK_BUNDLE_DIR)/Info.plist /usr/bin/SetFile -a B $(JDK_BUNDLE_DIR)/../ -EXTRA_IMAGE_TARGETS += jre-bundle-setup jdk-bundle-setup jre-bundle-files jdk-bundle-files +jdk-server-bundle-files: + $(MKDIR) -p $(JDK_SERVER_BUNDLE_DIR)/MacOS + ln -s ../Home/jre/lib/jli/libjli.dylib $(JDK_SERVER_BUNDLE_DIR)/MacOS/ + $(CP) -r $(JDK_IMAGE_DIR) $(JDK_SERVER_BUNDLE_DIR)/Home + $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" -e "s/@@NAME@@/$(BUNDE_NAME_JDK)/g" -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" < $(MACOSX_SRC)/bundle/JDK-Info.plist > $(JDK_SERVER_BUNDLE_DIR)/Info.plist + /usr/bin/SetFile -a B $(JDK_SERVER_BUNDLE_DIR)/../ + +EXTRA_IMAGE_TARGETS += jre-bundle-setup jdk-bundle-setup jre-bundle-files jdk-bundle-files jdk-server-bundle-files .PHONY: $(EXTRA_JRE_TARGETS) $(EXTRA_IMAGE_TARGETS)
--- a/make/common/Release.gmk Tue Jun 18 14:04:33 2013 +0100 +++ b/make/common/Release.gmk Fri Jun 21 15:46:14 2013 -0500 @@ -236,8 +236,8 @@ trim-image-jre trim-image-jdk \ identify-image-jre identify-image-jdk \ process-image-jre process-image-jdk \ -compare-image \ -sec-files sec-files-win jgss-files :: +compare-image \ +sec-files sec-files-win jgss-files server-jdk-image :: @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." # Order is important here, trim jre after jdk image is created @@ -246,16 +246,17 @@ images:: sanity-images post-sanity-images \ $(INITIAL_IMAGE_JRE) $(EXTRA_JRE_TARGETS) $(INITIAL_IMAGE_JDK) \ trim-image-jre trim-image-jdk \ - identify-image-jre identify-image-jdk \ - process-image-jre process-image-jdk sec-files sec-files-win jgss-files \ - $(EXTRA_IMAGE_TARGETS) + identify-image-jre identify-image-jdk \ + process-image-jre process-image-jdk sec-files sec-files-win \ + jgss-files $(EXTRA_IMAGE_TARGETS) server-jdk-image else images:: sanity-images post-sanity-images \ $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \ trim-image-jre trim-image-jdk \ identify-image-jre identify-image-jdk \ - process-image-jre process-image-jdk sec-files sec-files-win jgss-files + process-image-jre process-image-jdk sec-files sec-files-win \ + jgss-files server-jdk-image endif # Don't use these @@ -931,6 +932,27 @@ done $(RM) $(JRE_BIN_LIST) +# Duplicate current j2re-image contents to server-j2re-image +# for the server version of jre, before deploy build +server-jdk-image:: +ifeq ($(PLATFORM), macosx) + $(RM) -r $(JDK_SERVER_BUNDLE_DIR)/Home/demo + $(RM) -r $(JDK_SERVER_BUNDLE_DIR)/Home/sample + $(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/bin/jcontrol + $(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/jre/bin/jcontrol + $(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/man/ja_JP.UTF-8/man1/javaws.1 + $(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/man/man1/javaws.1 +else + $(RM) -r $(JDK_SERVER_IMAGE_DIR) + $(CP) -r $(JDK_IMAGE_DIR) $(JDK_SERVER_IMAGE_DIR) + $(RM) -r $(JDK_SERVER_IMAGE_DIR)/demo + $(RM) -r $(JDK_SERVER_IMAGE_DIR)/sample + $(RM) $(JDK_SERVER_IMAGE_DIR)/bin/jcontrol + $(RM) $(JDK_SERVER_IMAGE_DIR)/jre/bin/jcontrol + $(RM) $(JDK_SERVER_IMAGE_DIR)/man/ja_JP.UTF-8/man1/javaws.1 + $(RM) $(JDK_SERVER_IMAGE_DIR)/man/man1/javaws.1 +endif + ###################################################### # JDK Image ######################################################
--- a/make/java/java/mapfile-vers Tue Jun 18 14:04:33 2013 +0100 +++ b/make/java/java/mapfile-vers Fri Jun 21 15:46:14 2013 -0500 @@ -266,6 +266,7 @@ Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; Java_sun_reflect_NativeMethodAccessorImpl_invoke0; Java_sun_reflect_Reflection_getCallerClass; + Java_sun_reflect_Reflection_getCallerClass0; Java_sun_reflect_Reflection_getClassAccessFlags; Java_sun_misc_Version_getJdkVersionInfo; Java_sun_misc_Version_getJdkSpecialVersion;
--- a/make/sun/cmm/lcms/FILES_c_unix.gmk Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/cmm/lcms/FILES_c_unix.gmk Fri Jun 21 15:46:14 2013 -0500 @@ -32,6 +32,7 @@ cmserr.c \ cmsgamma.c \ cmsgmt.c \ + cmshalf.c \ cmsintrp.c \ cmsio0.c \ cmsio1.c \
--- a/make/sun/cmm/lcms/FILES_c_windows.gmk Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/cmm/lcms/FILES_c_windows.gmk Fri Jun 21 15:46:14 2013 -0500 @@ -30,6 +30,7 @@ cmserr.c \ cmsgamma.c \ cmsgmt.c \ + cmshalf.c \ cmsintrp.c \ cmsio0.c \ cmsio1.c \
--- a/make/sun/font/FILES_c.gmk Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/font/FILES_c.gmk Fri Jun 21 15:46:14 2013 -0500 @@ -106,7 +106,21 @@ OpenTypeLayoutEngine.cpp \ ThaiLayoutEngine.cpp \ ScriptAndLanguageTags.cpp \ - FontInstanceAdapter.cpp + FontInstanceAdapter.cpp \ + ContextualGlyphInsertionProc2.cpp \ + ContextualGlyphSubstProc2.cpp \ + GXLayoutEngine2.cpp \ + IndicRearrangementProcessor2.cpp \ + LigatureSubstProc2.cpp \ + MorphTables2.cpp \ + NonContextualGlyphSubstProc2.cpp \ + SegmentArrayProcessor2.cpp \ + SegmentSingleProcessor2.cpp \ + SimpleArrayProcessor2.cpp \ + SingleTableProcessor2.cpp \ + StateTableProcessor2.cpp \ + SubtableProcessor2.cpp \ + TrimmedArrayProcessor2.cpp ifeq ($(PLATFORM),windows)
--- a/make/sun/javazic/tzdata/VERSION Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/VERSION Fri Jun 21 15:46:14 2013 -0500 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2012i +tzdata2013b
--- a/make/sun/javazic/tzdata/africa Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/africa Fri Jun 21 15:46:14 2013 -0500 @@ -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 @@ 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 @@ # 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 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 @@ # 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 - 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 @@ # 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 - 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
--- a/make/sun/javazic/tzdata/antarctica Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/antarctica Fri Jun 21 15:46:14 2013 -0500 @@ -73,10 +73,8 @@ 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 +Rule ChileAQ 2012 max - Apr Sun>=23 3:00u 0 - +Rule ChileAQ 2012 max - Sep Sun>=2 4:00u 1:00 S # These rules are stolen from the `australasia' file. Rule AusAQ 1917 only - Jan 1 0:01 1:00 -
--- a/make/sun/javazic/tzdata/asia Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/asia Fri Jun 21 15:46:14 2013 -0500 @@ -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 @@ 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 @@ 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 @@ 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 @@ # 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 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 @@ ############################################################################### # 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 - 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 @@ # 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 @@ 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 @@ # 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: @@ -2421,6 +2440,13 @@ # 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 +2746,12 @@ # 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 +2765,10 @@ 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
--- a/make/sun/javazic/tzdata/australasia Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/australasia Fri Jun 21 15:46:14 2013 -0500 @@ -269,6 +269,9 @@ 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 +365,7 @@ 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 +806,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), # San Diego: ACS Publications, Inc. (2003). @@ -823,6 +826,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). #
--- a/make/sun/javazic/tzdata/europe Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/europe Fri Jun 21 15:46:14 2013 -0500 @@ -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 @@ # 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 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 @@ 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 @@ # 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 @@ # [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 @@ # 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. #
--- a/make/sun/javazic/tzdata/northamerica Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/northamerica Fri Jun 21 15:46:14 2013 -0500 @@ -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 @@ # 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 @@ # 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 @@ 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 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 @@ # 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 @@ # 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 @@ -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 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 @@ # 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 - 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
--- a/make/sun/javazic/tzdata/southamerica Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/southamerica Fri Jun 21 15:46:14 2013 -0500 @@ -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 @@ # <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 @@ # 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 @@ # 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 @@ # 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 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 @@ # 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 @@ # 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 @@ # 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 @@ -1583,6 +1590,15 @@ # ... Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S Rule Para 2010 max - Apr Sun>=8 0:00 0 - +# +# From Steffen Thorsen (2013-03-07): +# Paraguay will end DST on 2013-03-24 00:00.... +# They do not tell if this will be a permanent change or just this year.... +# http://www.ande.gov.py/interna.php?id=1075 +# +# From Paul Eggert (2013-03-07): +# For now, assume it's just this year. +Rule Para 2013 only - Mar 24 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890
--- a/make/sun/javazic/tzdata/zone.tab Tue Jun 18 14:04:33 2013 +0100 +++ b/make/sun/javazic/tzdata/zone.tab Fri Jun 21 15:46:14 2013 -0500 @@ -182,7 +182,8 @@ 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 +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
--- a/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,6 +57,8 @@ void initializeImpl() { super.initializeImpl(); final Scrollbar target = getTarget(); + setLineIncrement(target.getUnitIncrement()); + setPageIncrement(target.getBlockIncrement()); setValues(target.getValue(), target.getVisibleAmount(), target.getMinimum(), target.getMaximum());
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/LWToolkit.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -540,7 +540,7 @@ @Override public void ungrab(Window w) { if (w.getPeer() != null) { - ((LWWindowPeer)w.getPeer()).ungrab(); + ((LWWindowPeer)w.getPeer()).ungrab(false); } } }
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Fri Jun 21 15:46:14 2013 -0500 @@ -1329,13 +1329,19 @@ grabbingWindow = this; } - void ungrab() { + final void ungrab(boolean doPost) { if (isGrabbing()) { grabbingWindow = null; - postEvent(new UngrabEvent(getTarget())); + if (doPost) { + postEvent(new UngrabEvent(getTarget())); + } } } + void ungrab() { + ungrab(true); + } + private boolean isGrabbing() { return this == grabbingWindow; }
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Fri Jun 21 15:46:14 2013 -0500 @@ -38,7 +38,8 @@ public class CEmbeddedFrame extends EmbeddedFrame { private CPlatformResponder responder; - private boolean focused = true; + private static final Object classLock = new Object(); + private static volatile CEmbeddedFrame focusedWindow; private boolean parentWindowActive = true; public CEmbeddedFrame() { @@ -97,29 +98,45 @@ public void handleKeyEvent(int eventType, int modifierFlags, String characters, String charsIgnoringMods, boolean isRepeat, short keyCode, boolean needsKeyTyped) { - responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped); - } - - // REMIND: delete this method once 'deploy' changes for 7156194 is pushed - public void handleKeyEvent(int eventType, int modifierFlags, String characters, - String charsIgnoringMods, boolean isRepeat, short keyCode) { - handleKeyEvent(eventType, modifierFlags, characters, charsIgnoringMods, isRepeat, keyCode, true); + responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped, isRepeat); } public void handleInputEvent(String text) { responder.handleInputEvent(text); } + // handleFocusEvent is called when the applet becames focused/unfocused. + // This method can be called from different threads. public void handleFocusEvent(boolean focused) { - this.focused = focused; - if (parentWindowActive) { + + boolean handleWindowFocusEvent; + synchronized (classLock) { + // In some cases an applet may not receive the focus lost event + // from the parent window (see 8012330) + focusedWindow = (focused) ? this + : ((focusedWindow == this) ? null : focusedWindow); + handleWindowFocusEvent = parentWindowActive; + } + + if (handleWindowFocusEvent) { responder.handleWindowFocusEvent(focused); } } + // handleWindowFocusEvent is called for all applets, when the browser + // becames active/inactive. This event should be filtered out for + // non-focused applet. This method can be called from different threads. public void handleWindowFocusEvent(boolean parentWindowActive) { - this.parentWindowActive = parentWindowActive; - if (focused) { + + boolean handleWindowFocusEvent; + synchronized (classLock) { + this.parentWindowActive = parentWindowActive; + handleWindowFocusEvent = focusedWindow == this && parentWindowActive; + } + + // ignore focus "lost" native request as it may mistakenly + // deactivate active window (see 8001161) + if (handleWindowFocusEvent) { responder.handleWindowFocusEvent(parentWindowActive); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Fri Jun 21 15:46:14 2013 -0500 @@ -43,6 +43,7 @@ private final PlatformEventNotifier eventNotifier; private final boolean isNpapiCallback; + private int lastKeyPressCode = KeyEvent.VK_UNDEFINED; CPlatformResponder(final PlatformEventNotifier eventNotifier, final boolean isNpapiCallback) { @@ -126,7 +127,7 @@ * Handles key events. */ void handleKeyEvent(int eventType, int modifierFlags, String chars, - short keyCode, boolean needsKeyTyped) { + short keyCode, boolean needsKeyTyped, boolean needsKeyReleased) { boolean isFlagsChangedEvent = isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) : (eventType == CocoaConstants.NSFlagsChanged); @@ -178,7 +179,9 @@ int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags); long when = System.currentTimeMillis(); - + if (jeventType == KeyEvent.KEY_PRESSED) { + lastKeyPressCode = jkeyCode; + } eventNotifier.notifyKeyEvent(jeventType, when, jmodifiers, jkeyCode, javaChar, jkeyLocation); @@ -191,18 +194,29 @@ // Modifier keys (shift, etc) don't want to send TYPED events. // On the other hand we don't want to generate keyTyped events // for clipboard related shortcuts like Meta + [CVX] - boolean isMetaDown = (jmodifiers & KeyEvent.META_DOWN_MASK) != 0; - if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && !isMetaDown) { + if (jeventType == KeyEvent.KEY_PRESSED && postsTyped && + (jmodifiers & KeyEvent.META_DOWN_MASK) == 0) { + // Enter and Space keys finish the input method processing, + // KEY_TYPED and KEY_RELEASED events for them are synthesized in handleInputEvent + if (needsKeyReleased && (jkeyCode == KeyEvent.VK_ENTER || jkeyCode == KeyEvent.VK_SPACE)) { + return; + } eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED, when, jmodifiers, KeyEvent.VK_UNDEFINED, javaChar, KeyEvent.KEY_LOCATION_UNKNOWN); + //If events come from Firefox, released events should also be generated. + if (needsKeyReleased) { + eventNotifier.notifyKeyEvent(KeyEvent.KEY_RELEASED, when, jmodifiers, + jkeyCode, javaChar, + KeyEvent.KEY_LOCATION_UNKNOWN); + } } } void handleInputEvent(String text) { if (text != null) { int index = 0, length = text.length(); - char c; + char c = 0; while (index < length) { c = text.charAt(index); eventNotifier.notifyKeyEvent(KeyEvent.KEY_TYPED, @@ -211,6 +225,10 @@ KeyEvent.KEY_LOCATION_UNKNOWN); index++; } + eventNotifier.notifyKeyEvent(KeyEvent.KEY_RELEASED, + System.currentTimeMillis(), + 0, lastKeyPressCode, c, + KeyEvent.KEY_LOCATION_UNKNOWN); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Fri Jun 21 15:46:14 2013 -0500 @@ -212,7 +212,7 @@ private void deliverKeyEvent(NSEvent event) { responder.handleKeyEvent(event.getType(), event.getModifierFlags(), - event.getCharactersIgnoringModifiers(), event.getKeyCode(), true); + event.getCharactersIgnoringModifiers(), event.getKeyCode(), true, false); } private void deliverWindowDidExposeEvent() {
--- a/src/macosx/lib/flavormap.properties Tue Jun 18 14:04:33 2013 +0100 +++ b/src/macosx/lib/flavormap.properties Fri Jun 21 15:46:14 2013 -0500 @@ -1,7 +1,7 @@ # # This properties file is used to initialize the default -# java.awt.datatransfer.SystemFlavorMap. It contains the X11 platform-specific, -# default mappings between common X11 selection atoms and platform-independent +# java.awt.datatransfer.SystemFlavorMap. It contains the Mac OS X platform-specific, +# default mappings between common Mac OS X selection atoms and platform-independent # MIME type strings, which will be converted into # java.awt.datatransfer.DataFlavors. # @@ -76,3 +76,5 @@ text/uri-list=application/x-java-file-list;class=java.util.List PNG=image/x-java-image;class=java.awt.Image JFIF=image/x-java-image;class=java.awt.Image +RICH_TEXT=text/rtf +HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,6 +32,7 @@ import java.io.ObjectInputStream; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Modifier; import java.security.AccessControlContext; import java.security.AccessController; import java.security.Permission; @@ -227,7 +228,7 @@ // Instantiate the new object try { ReflectUtil.checkPackageAccess(theClass); - ReflectUtil.ensureClassAccess(theClass); + ensureClassAccess(theClass); moi= cons.newInstance(); } catch (InvocationTargetException e) { // Wrap the exception. @@ -303,7 +304,7 @@ } try { ReflectUtil.checkPackageAccess(theClass); - ReflectUtil.ensureClassAccess(theClass); + ensureClassAccess(theClass); moi = cons.newInstance(params); } catch (NoSuchMethodError error) { @@ -756,6 +757,15 @@ } } + private static void ensureClassAccess(Class clazz) + throws IllegalAccessException + { + int mod = clazz.getModifiers(); + if (!Modifier.isPublic(mod)) { + throw new IllegalAccessException("Class is not public and can't be instantiated"); + } + } + private ClassLoader getClassLoader(final ObjectName name) { if(clr == null){ return null;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java Fri Jun 21 15:46:14 2013 -0500 @@ -54,6 +54,7 @@ import com.sun.org.apache.xml.internal.security.utils.IdResolver; import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; import com.sun.org.apache.xml.internal.security.utils.XMLUtils; +import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -128,8 +129,11 @@ */ public KeyInfo(Element element, String BaseURI) throws XMLSecurityException { super(element, BaseURI); - // _storageResolvers.add(null); + Attr attr = element.getAttributeNodeNS(null, "Id"); + if (attr != null) { + element.setIdAttributeNode(attr, true); + } } /** @@ -139,9 +143,8 @@ */ public void setId(String Id) { - if ((Id != null)) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + if (Id != null) { + setLocalIdAttribute(Constants._ATT_ID, Id); } } @@ -1008,7 +1011,7 @@ /** * Stores the individual (per-KeyInfo) {@link KeyResolver}s */ - List<KeyResolverSpi> _internalKeyResolvers = null; + List<KeyResolverSpi> _internalKeyResolvers = new ArrayList<KeyResolverSpi>(); /** * This method is used to add a custom {@link KeyResolverSpi} to a KeyInfo
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java Fri Jun 21 15:46:14 2013 -0500 @@ -42,6 +42,7 @@ import com.sun.org.apache.xml.internal.security.utils.XMLUtils; import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver; import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi; +import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -100,6 +101,11 @@ super(element, BaseURI); + Attr attr = element.getAttributeNodeNS(null, "Id"); + if (attr != null) { + element.setIdAttributeNode(attr, true); + } + // check out Reference children this._referencesEl = XMLUtils.selectDsNodes(this._constructionElement.getFirstChild(), Constants._TAG_REFERENCE); @@ -120,6 +126,11 @@ this._references = new ArrayList(le); for (int i = 0; i < le; i++) { + Element refElem = this._referencesEl[i]; + Attr refAttr = refElem.getAttributeNodeNS(null, "Id"); + if (refAttr != null) { + refElem.setIdAttributeNode(refAttr, true); + } this._references.add(null); } } @@ -220,8 +231,7 @@ public void setId(String Id) { if (Id != null) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + setLocalIdAttribute(Constants._ATT_ID, Id); } }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/ObjectContainer.java Fri Jun 21 15:46:14 2013 -0500 @@ -68,9 +68,8 @@ */ public void setId(String Id) { - if ((Id != null)) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + if (Id != null) { + setLocalIdAttribute(Constants._ATT_ID, Id); } }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java Fri Jun 21 15:46:14 2013 -0500 @@ -284,8 +284,7 @@ public void setId(String Id) { if ( Id != null ) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + setLocalIdAttribute(Constants._ATT_ID, Id); } }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperties.java Fri Jun 21 15:46:14 2013 -0500 @@ -25,6 +25,7 @@ import com.sun.org.apache.xml.internal.security.utils.IdResolver; import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; import com.sun.org.apache.xml.internal.security.utils.XMLUtils; +import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -61,6 +62,21 @@ public SignatureProperties(Element element, String BaseURI) throws XMLSecurityException { super(element, BaseURI); + + Attr attr = element.getAttributeNodeNS(null, "Id"); + if (attr != null) { + element.setIdAttributeNode(attr, true); + } + + int length = getLength(); + for (int i = 0; i < length; i++) { + Element propertyElem = + XMLUtils.selectDsNode(getElement(), Constants._TAG_SIGNATUREPROPERTY, i); + Attr propertyAttr = propertyElem.getAttributeNodeNS(null, "Id"); + if (propertyAttr != null) { + propertyElem.setIdAttributeNode(propertyAttr, true); + } + } } /** @@ -109,9 +125,8 @@ */ public void setId(String Id) { - if ((Id != null)) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + if (Id != null) { + setLocalIdAttribute(Constants._ATT_ID, Id); } }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/SignatureProperty.java Fri Jun 21 15:46:14 2013 -0500 @@ -80,9 +80,8 @@ */ public void setId(String Id) { - if ((Id != null)) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + if (Id != null) { + setLocalIdAttribute(Constants._ATT_ID, Id); } }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java Fri Jun 21 15:46:14 2013 -0500 @@ -49,9 +49,11 @@ import com.sun.org.apache.xml.internal.security.utils.XMLUtils; import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver; import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi; +import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import org.w3c.dom.Text; @@ -306,6 +308,10 @@ throw new XMLSignatureException("xml.WrongContent", exArgs); } + Attr signatureValueAttr = signatureValueElement.getAttributeNodeNS(null, "Id"); + if (signatureValueAttr != null) { + signatureValueElement.setIdAttributeNode(signatureValueAttr, true); + } // <element ref="ds:KeyInfo" minOccurs="0"/> Element keyInfoElem = XMLUtils.getNextElement(signatureValueElement.getNextSibling());//XMLUtils.selectDsNode(this._constructionElement.getFirstChild(), @@ -316,6 +322,34 @@ keyInfoElem.getLocalName().equals(Constants._TAG_KEYINFO)) ) { this._keyInfo = new KeyInfo(keyInfoElem, BaseURI); } + + // <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/> + Element objectElem = + XMLUtils.getNextElement(signatureValueElement.getNextSibling()); + while (objectElem != null) { + Attr objectAttr = objectElem.getAttributeNodeNS(null, "Id"); + if (objectAttr != null) { + objectElem.setIdAttributeNode(objectAttr, true); + } + + NodeList nodes = objectElem.getChildNodes(); + int length = nodes.getLength(); + // Register Ids of the Object child elements + for (int i = 0; i < length; i++) { + Node child = nodes.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + Element childElem = (Element)child; + String tag = childElem.getLocalName(); + if (tag.equals("Manifest")) { + new Manifest(childElem, BaseURI); + } else if (tag.equals("SignatureProperties")) { + new SignatureProperties(childElem, BaseURI); + } + } + } + + objectElem = XMLUtils.getNextElement(objectElem.getNextSibling()); + } } /** @@ -325,9 +359,8 @@ */ public void setId(String Id) { - if ( (Id != null)) { - this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); - IdResolver.registerElementById(this._constructionElement, Id); + if (Id != null) { + setLocalIdAttribute(Constants._ATT_ID, Id); } }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,7 @@ import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -243,13 +243,13 @@ if (circumvent) { XMLUtils.circumventBug2650(XMLUtils.getOwnerDocument(_subNode)); } - this._inputNodeSet = new HashSet(); + this._inputNodeSet = new LinkedHashSet(); XMLUtils.getSet(_subNode,this._inputNodeSet, excludeNode, this.excludeComments); return this._inputNodeSet; } else if (this.isOctetStream()) { convertToNodes(); - HashSet result=new HashSet(); + LinkedHashSet result = new LinkedHashSet(); XMLUtils.getSet(_subNode, result,null,false); //this._inputNodeSet=result; return result;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java Fri Jun 21 15:46:14 2013 -0500 @@ -515,4 +515,16 @@ return prefixMappings.get(namespace); } + protected void setLocalIdAttribute(String attrName, String value) { + + if (value != null) { + Attr attr = getDocument().createAttributeNS(null, attrName); + attr.setValue(value); + getElement().setAttributeNodeNS(attr); + getElement().setIdAttributeNode(attr, true); + } + else { + getElement().removeAttributeNS(null, attrName); + } + } }
--- a/src/share/classes/com/sun/tools/jdi/AbstractLauncher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/tools/jdi/AbstractLauncher.java Fri Jun 21 15:46:14 2013 -0500 @@ -142,7 +142,7 @@ * 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 {
--- a/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Fri Jun 21 15:46:14 2013 -0500 @@ -213,7 +213,7 @@ exePath = exe; } // Quote only if necessary in case the quote arg value is bogus - if (hasWhitespace(exe)) { + if (hasWhitespace(exePath)) { exePath = quote + exePath + quote; }
--- a/src/share/classes/java/awt/EventQueue.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/awt/EventQueue.java Fri Jun 21 15:46:14 2013 -0500 @@ -174,6 +174,11 @@ */ private volatile int waitForID; + /* + * AppContext corresponding to the queue. + */ + private final AppContext appContext; + private final String name = "AWT-EventQueue-" + threadInitNumber.getAndIncrement(); private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue"); @@ -220,8 +225,9 @@ * completes thus causing mess in thread group to appcontext mapping. */ - pushPopLock = (Lock)AppContext.getAppContext().get(AppContext.EVENT_QUEUE_LOCK_KEY); - pushPopCond = (Condition)AppContext.getAppContext().get(AppContext.EVENT_QUEUE_COND_KEY); + appContext = AppContext.getAppContext(); + pushPopLock = (Lock)appContext.get(AppContext.EVENT_QUEUE_LOCK_KEY); + pushPopCond = (Condition)appContext.get(AppContext.EVENT_QUEUE_COND_KEY); } /** @@ -235,7 +241,7 @@ * @throws NullPointerException if <code>theEvent</code> is <code>null</code> */ public void postEvent(AWTEvent theEvent) { - SunToolkit.flushPendingEvents(); + SunToolkit.flushPendingEvents(appContext); postEventPrivate(theEvent); } @@ -526,7 +532,7 @@ * of the synchronized block to avoid deadlock when * event queues are nested with push()/pop(). */ - SunToolkit.flushPendingEvents(); + SunToolkit.flushPendingEvents(appContext); pushPopLock.lock(); try { AWTEvent event = getNextEventPrivate(); @@ -566,7 +572,7 @@ * of the synchronized block to avoid deadlock when * event queues are nested with push()/pop(). */ - SunToolkit.flushPendingEvents(); + SunToolkit.flushPendingEvents(appContext); pushPopLock.lock(); try { for (int i = 0; i < NUM_PRIORITIES; i++) { @@ -874,7 +880,6 @@ newEventQueue.previousQueue = topQueue; topQueue.nextQueue = newEventQueue; - AppContext appContext = AppContext.getAppContext(); if (appContext.get(AppContext.EVENT_QUEUE_KEY) == topQueue) { appContext.put(AppContext.EVENT_QUEUE_KEY, newEventQueue); } @@ -935,7 +940,6 @@ topQueue.dispatchThread.setEventQueue(prevQueue); } - AppContext appContext = AppContext.getAppContext(); if (appContext.get(AppContext.EVENT_QUEUE_KEY) == this) { appContext.put(AppContext.EVENT_QUEUE_KEY, prevQueue); } @@ -1028,7 +1032,6 @@ final void initDispatchThread() { pushPopLock.lock(); try { - AppContext appContext = AppContext.getAppContext(); if (dispatchThread == null && !threadGroup.isDestroyed() && !appContext.isDisposed()) { dispatchThread = AccessController.doPrivileged( new PrivilegedAction<EventDispatchThread>() { @@ -1114,7 +1117,7 @@ * <code>removeNotify</code> method. */ final void removeSourceEvents(Object source, boolean removeAllEvents) { - SunToolkit.flushPendingEvents(); + SunToolkit.flushPendingEvents(appContext); pushPopLock.lock(); try { for (int i = 0; i < NUM_PRIORITIES; i++) {
--- a/src/share/classes/java/awt/Toolkit.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/awt/Toolkit.java Fri Jun 21 15:46:14 2013 -0500 @@ -48,8 +48,6 @@ import java.io.FileInputStream; import java.util.*; -import sun.util.logging.PlatformLogger; - import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import sun.awt.AppContext; @@ -1978,7 +1976,7 @@ */ public abstract boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType); - private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.Toolkit"); + // 8014736: logging has been removed from Toolkit private static final int LONG_BITS = 64; private int[] calls = new int[LONG_BITS]; @@ -2145,12 +2143,6 @@ } synchronized int countAWTEventListeners(long eventMask) { - if (log.isLoggable(PlatformLogger.FINE)) { - if (eventMask == 0) { - log.fine("Assertion (eventMask != 0) failed"); - } - } - int ci = 0; for (; eventMask != 0; eventMask >>>= 1, ci++) { }
--- a/src/share/classes/java/awt/image/BufferedImage.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/awt/image/BufferedImage.java Fri Jun 21 15:46:14 2013 -0500 @@ -35,6 +35,8 @@ import java.awt.geom.Point2D; import java.awt.Point; import java.awt.Rectangle; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Hashtable; import java.util.Vector; @@ -643,6 +645,7 @@ this.properties = properties; int numBands = raster.getNumBands(); boolean isAlphaPre = cm.isAlphaPremultiplied(); + final boolean isStandard = isStandard(cm, raster); ColorSpace cs; // Force the raster data alpha state to match the premultiplied @@ -653,8 +656,9 @@ cs = cm.getColorSpace(); int csType = cs.getType(); if (csType != ColorSpace.TYPE_RGB) { - if (csType == ColorSpace.TYPE_GRAY - && ComponentColorModel.class.equals(cm.getClass())) { + if (csType == ColorSpace.TYPE_GRAY && + isStandard && + cm instanceof ComponentColorModel) { // Check if this might be a child raster (fix for bug 4240596) if (sm instanceof ComponentSampleModel && ((ComponentSampleModel)sm).getPixelStride() != numBands) { @@ -686,8 +690,8 @@ // are correct int pixSize = cm.getPixelSize(); if (iraster.getPixelStride() == 1 && - DirectColorModel.class.equals(cm.getClass()) && - SinglePixelPackedSampleModel.class.equals(sm.getClass()) && + isStandard && + cm instanceof DirectColorModel && (pixSize == 32 || pixSize == 24)) { // Now check on the DirectColorModel params @@ -718,8 +722,8 @@ } // if (rmask == DCM_BGR_RED_MASK && } // if (iraster.getPixelStride() == 1 } // ((raster instanceof IntegerComponentRaster) && - else if ((IndexColorModel.class.equals(cm.getClass())) && - (numBands == 1) && + else if ((cm instanceof IndexColorModel) && (numBands == 1) && + isStandard && (!cm.hasAlpha() || !isAlphaPre)) { IndexColorModel icm = (IndexColorModel) cm; @@ -740,8 +744,8 @@ } } // else if (cm instanceof IndexColorModel) && (numBands == 1)) else if ((raster instanceof ShortComponentRaster) - && (DirectColorModel.class.equals(cm.getClass())) - && (SinglePixelPackedSampleModel.class.equals(sm.getClass())) + && (cm instanceof DirectColorModel) + && isStandard && (numBands == 3) && !cm.hasAlpha()) { @@ -761,6 +765,7 @@ } // else if ((cm instanceof IndexColorModel) && (numBands == 1)) else if ((raster instanceof ByteComponentRaster) && (cm instanceof ComponentColorModel) + && isStandard && (raster.getSampleModel() instanceof PixelInterleavedSampleModel) && (numBands == 3 || numBands == 4)) { @@ -804,6 +809,27 @@ } // else if ((raster instanceof ByteComponentRaster) && } + private static boolean isStandard(ColorModel cm, WritableRaster wr) { + final Class<? extends ColorModel> cmClass = cm.getClass(); + final Class<? extends WritableRaster> wrClass = wr.getClass(); + final Class<? extends SampleModel> smClass = wr.getSampleModel().getClass(); + + final PrivilegedAction<Boolean> checkClassLoadersAction = + new PrivilegedAction<Boolean>() + { + + @Override + public Boolean run() { + final ClassLoader std = System.class.getClassLoader(); + + return (cmClass.getClassLoader() == std) && + (smClass.getClassLoader() == std) && + (wrClass.getClassLoader() == std); + } + }; + return AccessController.doPrivileged(checkClassLoadersAction); + } + /** * Returns the image type. If it is not one of the known types, * TYPE_CUSTOM is returned.
--- a/src/share/classes/java/awt/image/Raster.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/awt/image/Raster.java Fri Jun 21 15:46:14 2013 -0500 @@ -392,7 +392,8 @@ } } int banks = maxBank + 1; - int size = scanlineStride * (h - 1) + // fisrt (h - 1) scans + int size = maxBandOff + + scanlineStride * (h - 1) + // fisrt (h - 1) scans w; // last scan switch(dataType) {
--- a/src/share/classes/java/io/ObjectStreamClass.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/io/ObjectStreamClass.java Fri Jun 21 15:46:14 2013 -0500 @@ -266,9 +266,11 @@ if (cl == null) { return null; } - Class<?> caller = Reflection.getCallerClass(); - if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) { - ReflectUtil.checkPackageAccess(cl); + if (System.getSecurityManager() != null) { + Class<?> caller = Reflection.getCallerClass(); + if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) { + ReflectUtil.checkPackageAccess(cl); + } } return cl; }
--- a/src/share/classes/java/io/ObjectStreamField.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/io/ObjectStreamField.java Fri Jun 21 15:46:14 2013 -0500 @@ -162,9 +162,11 @@ */ @CallerSensitive public Class<?> getType() { - Class<?> caller = Reflection.getCallerClass(); - if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) { - ReflectUtil.checkPackageAccess(type); + if (System.getSecurityManager() != null) { + Class<?> caller = Reflection.getCallerClass(); + if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) { + ReflectUtil.checkPackageAccess(type); + } } return type; }
--- a/src/share/classes/java/lang/Class.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/lang/Class.java Fri Jun 21 15:46:14 2013 -0500 @@ -1134,13 +1134,9 @@ enclosingCandidate = enclosingClass; } - // be very careful not to change the stack depth of this - // checkMemberAccess call for security reasons - // see java.lang.SecurityManager.checkMemberAccess - if (enclosingCandidate != null) { - enclosingCandidate.checkMemberAccess(Member.DECLARED, - Reflection.getCallerClass(), true); - } + if (enclosingCandidate != null) + enclosingCandidate.checkPackageAccess( + ClassLoader.getClassLoader(Reflection.getCallerClass()), true); return enclosingCandidate; } @@ -2214,6 +2210,8 @@ * Check if client is allowed to access members. If access is denied, * throw a SecurityException. * + * This method also enforces package access. + * * <p> Default policy: allow all clients access with normal Java access * control. */ @@ -2234,7 +2232,19 @@ // checkMemberAccess of subclasses of SecurityManager as specified. s.checkMemberAccess(this, which); } + this.checkPackageAccess(ccl, checkProxyInterfaces); + } + } + /* + * Checks if a client loaded in ClassLoader ccl is allowed to access this + * class under the current package access policy. If access is denied, + * throw a SecurityException. + */ + private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { + final SecurityManager s = System.getSecurityManager(); + if (s != null) { + final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.');
--- a/src/share/classes/java/lang/ProcessBuilder.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/lang/ProcessBuilder.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,7 +29,6 @@ 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; @@ -1025,10 +1024,10 @@ 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);
--- a/src/share/classes/java/lang/invoke/MethodHandleNatives.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/lang/invoke/MethodHandleNatives.java Fri Jun 21 15:46:14 2013 -0500 @@ -524,6 +524,8 @@ return defc == java.io.ObjectStreamClass.class; case "getLogger": return defc == java.util.logging.Logger.class; + case "getAnonymousLogger": + return defc == java.util.logging.Logger.class; } return false; }
--- a/src/share/classes/java/util/logging/LogManager.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/util/logging/LogManager.java Fri Jun 21 15:46:14 2013 -0500 @@ -33,10 +33,8 @@ import java.lang.ref.WeakReference; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.net.URL; import sun.misc.JavaAWTAccess; import sun.misc.SharedSecrets; -import sun.security.action.GetPropertyAction; /** * There is a single global LogManager object that is used to @@ -151,7 +149,6 @@ // The global LogManager object private static LogManager manager; - private final static Handler[] emptyHandlers = { }; private Properties props = new Properties(); private PropertyChangeSupport changes = new PropertyChangeSupport(LogManager.class); @@ -392,11 +389,11 @@ // add a new Logger or return the one that has been added previously // as a LogManager subclass may override the addLogger, getLogger, // readConfiguration, and other methods. - Logger demandLogger(String name, String resourceBundleName) { + Logger demandLogger(String name, String resourceBundleName, Class<?> caller) { Logger result = getLogger(name); if (result == null) { // only allocate the new logger once - Logger newLogger = new Logger(name, resourceBundleName); + Logger newLogger = new Logger(name, resourceBundleName, caller); do { if (addLogger(newLogger)) { // We successfully added the new Logger that we @@ -478,7 +475,7 @@ Logger demandLogger(String name, String resourceBundleName) { // a LogManager subclass may have its own implementation to add and // get a Logger. So delegate to the LogManager to do the work. - return manager.demandLogger(name, resourceBundleName); + return manager.demandLogger(name, resourceBundleName, null); } synchronized Logger findLogger(String name) { @@ -496,7 +493,7 @@ } synchronized void ensureRootLogger(Logger logger) { - if (logger == manager.rootLogger) + if (logger.getName().isEmpty()) return; // during initialization, rootLogger is null when @@ -516,14 +513,11 @@ throw new NullPointerException(); } - // cleanup some Loggers that have been GC'ed - manager.drainLoggerRefQueueBounded(); - LoggerWeakRef ref = namedLoggers.get(name); if (ref != null) { if (ref.get() == null) { - // It's possible that the Logger was GC'ed after the - // drainLoggerRefQueueBounded() call above so allow + // It's possible that the Logger was GC'ed after a + // drainLoggerRefQueueBounded() call so allow // a new one to be registered. removeLogger(name); } else { @@ -571,6 +565,8 @@ return true; } + // note: all calls to removeLogger are synchronized on LogManager's + // intrinsic lock void removeLogger(String name) { namedLoggers.remove(name); } @@ -852,6 +848,7 @@ if (name == null) { throw new NullPointerException(); } + drainLoggerRefQueueBounded(); LoggerContext cx = getUserContext(); if (cx.addLocalLogger(logger)) { // Do we have a per logger handler too?
--- a/src/share/classes/java/util/logging/Logger.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/java/util/logging/Logger.java Fri Jun 21 15:46:14 2013 -0500 @@ -190,6 +190,7 @@ private ArrayList<LogManager.LoggerWeakRef> kids; // WeakReferences to loggers that have us as parent private volatile Level levelObject; private volatile int levelValue; // current effective level value + private WeakReference<ClassLoader> callersClassLoaderRef; /** * GLOBAL_LOGGER_NAME is a name for the global logger. @@ -250,15 +251,31 @@ * no corresponding resource can be found. */ protected Logger(String name, String resourceBundleName) { + this(name, resourceBundleName, null); + } + + Logger(String name, String resourceBundleName, Class<?> caller) { this.manager = LogManager.getLogManager(); - if (resourceBundleName != null) { - // Note: we may get a MissingResourceException here. - setupResourceInfo(resourceBundleName); - } + setupResourceInfo(resourceBundleName, caller); this.name = name; levelValue = Level.INFO.intValue(); } + private void setCallersClassLoaderRef(Class<?> caller) { + ClassLoader callersClassLoader = ((caller != null) + ? caller.getClassLoader() + : null); + if (callersClassLoader != null) { + this.callersClassLoaderRef = new WeakReference(callersClassLoader); + } + } + + private ClassLoader getCallersClassLoader() { + return (callersClassLoaderRef != null) + ? callersClassLoaderRef.get() + : null; + } + // This constructor is used only to create the global Logger. // It is needed to break a cyclic dependence between the LogManager // and Logger static initializers causing deadlocks. @@ -292,8 +309,13 @@ // null, we assume it's a system logger and add it to the system context. // These system loggers only set the resource bundle to the given // resource bundle name (rather than the default system resource bundle). - private static class SystemLoggerHelper { - static boolean disableCallerCheck = getBooleanProperty("sun.util.logging.disableCallerCheck"); + private static class LoggerHelper { + static boolean disableCallerCheck = + getBooleanProperty("sun.util.logging.disableCallerCheck"); + + // workaround to turn on the old behavior for resource bundle search + static boolean allowStackWalkSearch = + getBooleanProperty("jdk.logging.allowStackWalkSearch"); private static boolean getBooleanProperty(final String key) { String s = AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { @@ -307,12 +329,14 @@ private static Logger demandLogger(String name, String resourceBundleName, Class<?> caller) { LogManager manager = LogManager.getLogManager(); SecurityManager sm = System.getSecurityManager(); - if (sm != null && !SystemLoggerHelper.disableCallerCheck) { + if (sm != null && !LoggerHelper.disableCallerCheck) { if (caller.getClassLoader() == null) { return manager.demandSystemLogger(name, resourceBundleName); } } - return manager.demandLogger(name, resourceBundleName); + return manager.demandLogger(name, resourceBundleName, caller); + // ends up calling new Logger(name, resourceBundleName, caller) + // iff the logger doesn't exist already } /** @@ -405,11 +429,24 @@ // adding a new Logger object is handled by LogManager.addLogger(). @CallerSensitive public static Logger getLogger(String name, String resourceBundleName) { - Logger result = demandLogger(name, resourceBundleName, Reflection.getCallerClass()); + Class<?> callerClass = Reflection.getCallerClass(); + Logger result = demandLogger(name, resourceBundleName, callerClass); + if (result.resourceBundleName == null) { + // We haven't set a bundle name yet on the Logger, so it's ok to proceed. + + // We have to set the callers ClassLoader here in case demandLogger + // above found a previously created Logger. This can happen, for + // example, if Logger.getLogger(name) is called and subsequently + // Logger.getLogger(name, resourceBundleName) is called. In this case + // we won't necessarily have the correct classloader saved away, so + // we need to set it here, too. + // Note: we may get a MissingResourceException here. - result.setupResourceInfo(resourceBundleName); + result.setupResourceInfo(resourceBundleName, callerClass); } else if (!result.resourceBundleName.equals(resourceBundleName)) { + // We already had a bundle name on the Logger and we're trying + // to change it here which is not allowed. throw new IllegalArgumentException(result.resourceBundleName + " != " + resourceBundleName); } @@ -479,11 +516,13 @@ // Synchronization is not required here. All synchronization for // adding a new anonymous Logger object is handled by doSetParent(). + @CallerSensitive public static Logger getAnonymousLogger(String resourceBundleName) { LogManager manager = LogManager.getLogManager(); // cleanup some Loggers that have been GC'ed manager.drainLoggerRefQueueBounded(); - Logger result = new Logger(null, resourceBundleName); + Logger result = new Logger(null, resourceBundleName, + Reflection.getCallerClass()); result.anonymous = true; Logger root = manager.getLogger(""); result.doSetParent(root); @@ -499,7 +538,7 @@ * @return localization bundle (may be null) */ public ResourceBundle getResourceBundle() { - return findResourceBundle(getResourceBundleName()); + return findResourceBundle(getResourceBundleName(), true); } /** @@ -581,7 +620,7 @@ String ebname = getEffectiveResourceBundleName(); if (ebname != null && !ebname.equals(SYSTEM_LOGGER_RB_NAME)) { lr.setResourceBundleName(ebname); - lr.setResourceBundle(findResourceBundle(ebname)); + lr.setResourceBundle(findResourceBundle(ebname, true)); } log(lr); } @@ -798,7 +837,7 @@ lr.setLoggerName(name); if (rbname != null) { lr.setResourceBundleName(rbname); - lr.setResourceBundle(findResourceBundle(rbname)); + lr.setResourceBundle(findResourceBundle(rbname, false)); } log(lr); } @@ -822,7 +861,6 @@ * can be null * @param msg The string message (or a key in the message catalog) */ - public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msg) { if (level.intValue() < levelValue || levelValue == offValue) { @@ -1322,16 +1360,6 @@ return useParentHandlers; } - /** - * Private utility method to map a resource bundle name to an - * actual resource bundle, using a simple one-entry cache. - * Returns null for a null name. - * May also return null if we can't find the resource bundle and - * there is no suitable previous cached value. - * - * @param name the ResourceBundle to locate - * @return ResourceBundle specified by name or null if not found - */ static final String SYSTEM_LOGGER_RB_NAME = "sun.util.logging.resources.logging"; private static ResourceBundle findSystemResourceBundle(final Locale locale) { @@ -1349,7 +1377,26 @@ }); } - private synchronized ResourceBundle findResourceBundle(String name) { + /** + * Private utility method to map a resource bundle name to an + * actual resource bundle, using a simple one-entry cache. + * Returns null for a null name. + * May also return null if we can't find the resource bundle and + * there is no suitable previous cached value. + * + * @param name the ResourceBundle to locate + * @param userCallersClassLoader if true search using the caller's ClassLoader + * @return ResourceBundle specified by name or null if not found + */ + private synchronized ResourceBundle findResourceBundle(String name, + boolean useCallersClassLoader) { + // For all lookups, we first check the thread context class loader + // if it is set. If not, we use the system classloader. If we + // still haven't found it we use the callersClassLoaderRef if it + // is set and useCallersClassLoader is true. We set + // callersClassLoaderRef initially upon creating the logger with a + // non-null resource bundle name. + // Return a null bundle for a null name. if (name == null) { return null; @@ -1382,22 +1429,88 @@ catalogLocale = currentLocale; return catalog; } catch (MissingResourceException ex) { + // We can't find the ResourceBundle in the default + // ClassLoader. Drop through. + } + + if (useCallersClassLoader) { + // Try with the caller's ClassLoader + ClassLoader callersClassLoader = getCallersClassLoader(); + if (callersClassLoader != null && callersClassLoader != cl) { + try { + catalog = ResourceBundle.getBundle(name, currentLocale, + callersClassLoader); + catalogName = name; + catalogLocale = currentLocale; + return catalog; + } catch (MissingResourceException ex) { + } + } + } + + // If -Djdk.logging.allowStackWalkSearch=true is set, + // does stack walk to search for the resource bundle + if (LoggerHelper.allowStackWalkSearch) { + return findResourceBundleFromStack(name, currentLocale, cl); + } else { return null; } } + /** + * This method will fail when running with a VM that enforces caller-sensitive + * methods and only allows to get the immediate caller. + */ + @CallerSensitive + private synchronized ResourceBundle findResourceBundleFromStack(String name, + Locale locale, + ClassLoader cl) + { + for (int ix = 0; ; ix++) { + Class<?> clz = sun.reflect.Reflection.getCallerClass(ix); + if (clz == null) { + break; + } + ClassLoader cl2 = clz.getClassLoader(); + if (cl2 == null) { + cl2 = ClassLoader.getSystemClassLoader(); + } + if (cl == cl2) { + // We've already checked this classloader. + continue; + } + cl = cl2; + try { + catalog = ResourceBundle.getBundle(name, locale, cl); + catalogName = name; + catalogLocale = locale; + return catalog; + } catch (MissingResourceException ex) { + } + } + return null; + } + // Private utility method to initialize our one entry - // resource bundle cache. + // resource bundle name cache and the callers ClassLoader // Note: for consistency reasons, we are careful to check // that a suitable ResourceBundle exists before setting the - // ResourceBundleName. - private synchronized void setupResourceInfo(String name) { + // resourceBundleName field. + // Synchronized to prevent races in setting the fields. + private synchronized void setupResourceInfo(String name, + Class<?> callersClass) { if (name == null) { return; } - if (findResourceBundle(name) == null) { + + setCallersClassLoaderRef(callersClass); + if (findResourceBundle(name, true) == null) { // We've failed to find an expected ResourceBundle. - throw new MissingResourceException("Can't find " + name + " bundle", name, ""); + // unset the caller's ClassLoader since we were unable to find the + // the bundle using it + this.callersClassLoaderRef = null; + throw new MissingResourceException("Can't find " + name + " bundle", + name, ""); } resourceBundleName = name; }
--- a/src/share/classes/javax/management/StandardEmitterMBean.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/javax/management/StandardEmitterMBean.java Fri Jun 21 15:46:14 2013 -0500 @@ -258,8 +258,13 @@ } public MBeanNotificationInfo[] getNotificationInfo() { - if (notificationInfo == null || notificationInfo.length == 0) { + // this getter might get called from the super constructor + // when the notificationInfo has not been properly set yet + if (notificationInfo == null) { return NO_NOTIFICATION_INFO; + } + if (notificationInfo.length == 0) { + return notificationInfo; } else { return notificationInfo.clone(); }
--- a/src/share/classes/javax/swing/RepaintManager.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/javax/swing/RepaintManager.java Fri Jun 21 15:46:14 2013 -0500 @@ -342,7 +342,7 @@ // Queue a Runnable to invoke paintDirtyRegions and // validateInvalidComponents. - scheduleProcessingRunnable(); + scheduleProcessingRunnable(SunToolkit.targetToAppContext(invalidComponent)); } @@ -431,7 +431,7 @@ // Queue a Runnable to invoke paintDirtyRegions and // validateInvalidComponents. - scheduleProcessingRunnable(); + scheduleProcessingRunnable(SunToolkit.targetToAppContext(c)); } /** @@ -1373,10 +1373,6 @@ return paintManager; } - private void scheduleProcessingRunnable() { - scheduleProcessingRunnable(AppContext.getAppContext()); - } - private void scheduleProcessingRunnable(AppContext context) { if (processingRunnable.markPending()) { Toolkit tk = Toolkit.getDefaultToolkit();
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java Fri Jun 21 15:46:14 2013 -0500 @@ -48,7 +48,7 @@ public Iterator iterator() { // If nodefilters are set, must execute them first to create node-set - if (xi.getNodeFilters() != null) { + if (xi.getNodeFilters() != null && !xi.getNodeFilters().isEmpty()) { return Collections.unmodifiableSet (getNodeSet(xi.getNodeFilters())).iterator(); }
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java Fri Jun 21 15:46:14 2013 -0500 @@ -230,6 +230,21 @@ } catch (Exception e) { throw new URIReferenceException(e); } + + // guard against RetrievalMethod loops + if ((data instanceof NodeSetData) && Utils.secureValidation(context)) { + NodeSetData nsd = (NodeSetData)data; + Iterator i = nsd.iterator(); + if (i.hasNext()) { + Node root = (Node)i.next(); + if ("RetrievalMethod".equals(root.getLocalName())) { + throw new URIReferenceException( + "It is forbidden to have one RetrievalMethod point " + + "to another when secure validation is enabled"); + } + } + } + return data; }
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java Fri Jun 21 15:46:14 2013 -0500 @@ -107,6 +107,9 @@ } static boolean secureValidation(XMLCryptoContext xc) { + if (xc == null) { + return false; + } return getBoolean(xc, "org.jcp.xml.dsig.secureValidation"); }
--- a/src/share/classes/sun/awt/AppContext.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/awt/AppContext.java Fri Jun 21 15:46:14 2013 -0500 @@ -190,10 +190,16 @@ public static final String DISPOSED_PROPERTY_NAME = "disposed"; public static final String GUI_DISPOSED = "guidisposed"; - private volatile boolean isDisposed = false; // true if AppContext is disposed + private enum State { + VALID, + BEING_DISPOSED, + DISPOSED + }; + + private volatile State state = State.VALID; public boolean isDisposed() { - return isDisposed; + return state == State.DISPOSED; } /* @@ -392,10 +398,11 @@ } synchronized(this) { - if (this.isDisposed) { - return; // If already disposed, bail. + if (this.state != State.VALID) { + return; // If already disposed or being disposed, bail. } - this.isDisposed = true; + + this.state = State.BEING_DISPOSED; } final PropertyChangeSupport changeSupport = this.changeSupport; @@ -465,6 +472,11 @@ } catch (InterruptedException e) { } } + // We are done with posting events, so change the state to disposed + synchronized(this) { + this.state = State.DISPOSED; + } + // Next, we interrupt all Threads in the ThreadGroup this.threadGroup.interrupt(); // Note, the EventDispatchThread we've interrupted may dump an @@ -801,16 +813,24 @@ static { sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() { public Object get(Object key) { - return getAppContext().get(key); + AppContext ac = getAppContext(); + return (ac == null) ? null : ac.get(key); } public void put(Object key, Object value) { - getAppContext().put(key, value); + AppContext ac = getAppContext(); + if (ac != null) { + ac.put(key, value); + } } public void remove(Object key) { - getAppContext().remove(key); + AppContext ac = getAppContext(); + if (ac != null) { + ac.remove(key); + } } public boolean isDisposed() { - return getAppContext().isDisposed(); + AppContext ac = getAppContext(); + return (ac == null) ? true : ac.isDisposed(); } public boolean isMainAppContext() { return (numAppContexts.get() == 1 && mainAppContext != null);
--- a/src/share/classes/sun/awt/SunToolkit.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/awt/SunToolkit.java Fri Jun 21 15:46:14 2013 -0500 @@ -58,7 +58,7 @@ implements WindowClosingSupport, WindowClosingListener, ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { - private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.SunToolkit"); + // 8014736: logging has been removed from SunToolkit /* Load debug settings for native code */ static { @@ -97,6 +97,14 @@ */ public final static int MAX_BUTTONS_SUPPORTED = 20; + /** + * Creates and initializes EventQueue instance for the specified + * AppContext. + * Note that event queue must be created from createNewAppContext() + * only in order to ensure that EventQueue constructor obtains + * the correct AppContext. + * @param appContext AppContext to associate with the event queue + */ private static void initEQ(AppContext appContext) { EventQueue eventQueue; @@ -482,10 +490,6 @@ // otherwise have to be modified to precisely identify // system-generated events. setSystemGenerated(event); - AppContext eventContext = targetToAppContext(event.getSource()); - if (eventContext != null && !eventContext.equals(appContext)) { - log.fine("Event posted on wrong app context : " + event); - } PostEventQueue postEventQueue = (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); if (postEventQueue != null) { @@ -514,13 +518,17 @@ * EventQueue yet. */ public static void flushPendingEvents() { + AppContext appContext = AppContext.getAppContext(); + flushPendingEvents(appContext); + } + + public static void flushPendingEvents(AppContext appContext) { flushLock.lock(); try { // Don't call flushPendingEvents() recursively if (!isFlushingPendingEvents) { isFlushingPendingEvents = true; try { - AppContext appContext = AppContext.getAppContext(); PostEventQueue postEventQueue = (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); if (postEventQueue != null) { @@ -890,10 +898,6 @@ //with scale factors x1, x3/4, x2/3, xN, x1/N. Image im = i.next(); if (im == null) { - if (log.isLoggable(PlatformLogger.FINER)) { - log.finer("SunToolkit.getScaledIconImage: " + - "Skipping the image passed into Java because it's null."); - } continue; } if (im instanceof ToolkitImage) { @@ -906,10 +910,6 @@ iw = im.getWidth(null); ih = im.getHeight(null); } catch (Exception e){ - if (log.isLoggable(PlatformLogger.FINER)) { - log.finer("SunToolkit.getScaledIconImage: " + - "Perhaps the image passed into Java is broken. Skipping this icon."); - } continue; } if (iw > 0 && ih > 0) { @@ -981,14 +981,6 @@ try { int x = (width - bestWidth) / 2; int y = (height - bestHeight) / 2; - if (log.isLoggable(PlatformLogger.FINER)) { - log.finer("WWindowPeer.getScaledIconData() result : " + - "w : " + width + " h : " + height + - " iW : " + bestImage.getWidth(null) + " iH : " + bestImage.getHeight(null) + - " sim : " + bestSimilarity + " sf : " + bestScaleFactor + - " adjW : " + bestWidth + " adjH : " + bestHeight + - " x : " + x + " y : " + y); - } g.drawImage(bestImage, x, y, bestWidth, bestHeight, null); } finally { g.dispose(); @@ -999,10 +991,6 @@ public static DataBufferInt getScaledIconData(java.util.List<Image> imageList, int width, int height) { BufferedImage bimage = getScaledIconImage(imageList, width, height); if (bimage == null) { - if (log.isLoggable(PlatformLogger.FINER)) { - log.finer("SunToolkit.getScaledIconData: " + - "Perhaps the image passed into Java is broken. Skipping this icon."); - } return null; } Raster raster = bimage.getRaster();
--- a/src/share/classes/sun/font/ExtendedTextSourceLabel.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/font/ExtendedTextSourceLabel.java Fri Jun 21 15:46:14 2013 -0500 @@ -247,6 +247,10 @@ float aw = 0f; float ah = cm.ascent + cm.descent; + if (charinfo == null || charinfo.length == 0) { + return new Rectangle2D.Float(al, at, aw, ah); + } + boolean lineIsLTR = (source.getLayoutFlags() & 0x8) == 0; int rn = info.length - numvals; if (lineIsLTR) { @@ -350,24 +354,42 @@ public float getCharX(int index) { validate(index); - return getCharinfo()[l2v(index) * numvals + posx]; + float[] charinfo = getCharinfo(); + int idx = l2v(index) * numvals + posx; + if (charinfo == null || idx >= charinfo.length) { + return 0f; + } else { + return charinfo[idx]; + } } public float getCharY(int index) { validate(index); - return getCharinfo()[l2v(index) * numvals + posy]; + float[] charinfo = getCharinfo(); + int idx = l2v(index) * numvals + posy; + if (charinfo == null || idx >= charinfo.length) { + return 0f; + } else { + return charinfo[idx]; + } } public float getCharAdvance(int index) { validate(index); - return getCharinfo()[l2v(index) * numvals + advx]; + float[] charinfo = getCharinfo(); + int idx = l2v(index) * numvals + advx; + if (charinfo == null || idx >= charinfo.length) { + return 0f; + } else { + return charinfo[idx]; + } } public Rectangle2D handleGetCharVisualBounds(int index) { validate(index); float[] charinfo = getCharinfo(); index = l2v(index) * numvals; - if ((index+vish) >= charinfo.length) { + if (charinfo == null || (index+vish) >= charinfo.length) { return new Rectangle2D.Float(); } return new Rectangle2D.Float( @@ -463,7 +485,7 @@ if (cidx >= charinfo.length) { break; // layout bailed for some reason } - float adv = charinfo[l2v(start) * numvals + advx]; + float adv = charinfo[cidx]; width -= adv; } @@ -512,7 +534,13 @@ // } //} - return getCharinfo()[v * numvals + advx] != 0; + int idx = v * numvals + advx; + float[] charinfo = getCharinfo(); + if (charinfo == null || idx >= charinfo.length) { + return false; + } else { + return charinfo[idx] != 0; + } } private final float[] getCharinfo() { @@ -604,6 +632,9 @@ */ int numGlyphs = gv.getNumGlyphs(); + if (numGlyphs == 0) { + return glyphinfo; + } int[] indices = gv.getGlyphCharIndices(0, numGlyphs, null); boolean DEBUG = false;
--- a/src/share/classes/sun/font/GlyphLayout.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/font/GlyphLayout.java Fri Jun 21 15:46:14 2013 -0500 @@ -464,7 +464,12 @@ break; } catch (IndexOutOfBoundsException e) { - _gvdata.grow(); + if (_gvdata._count >=0) { + _gvdata.grow(); + } + } + if (_gvdata._count < 0) { + break; } } } @@ -473,7 +478,19 @@ // _gvdata.adjustPositions(txinfo.invdtx); // } - StandardGlyphVector gv = _gvdata.createGlyphVector(font, frc, result); + // If layout fails (negative glyph count) create an un-laid out GV instead. + // ie default positions. This will be a lot better than the alternative of + // a complete blank layout. + StandardGlyphVector gv; + if (_gvdata._count < 0) { + gv = new StandardGlyphVector(font, text, offset, count, frc); + if (FontUtilities.debugFonts()) { + FontUtilities.getLogger().warning("OpenType layout failed on font: " + + font); + } + } else { + gv = _gvdata.createGlyphVector(font, frc, result); + } // System.err.println("Layout returns: " + gv); return gv; }
--- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2007, 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 @@ -25,6 +25,7 @@ package sun.java2d.opengl; +import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Transparency; import java.awt.geom.AffineTransform; @@ -96,6 +97,8 @@ CompositeType.AnyAlpha, blitIntArgbPreToSurface), + new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLSurface), + new OGLSwToSurfaceScale(SurfaceType.IntRgb, OGLSurfaceData.PF_INT_RGB), new OGLSwToSurfaceScale(SurfaceType.IntRgbx, @@ -172,6 +175,9 @@ new OGLGeneralBlit(OGLSurfaceData.OpenGLTexture, CompositeType.SrcNoEa, blitIntArgbPreToTexture), + + new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLTexture), + }; GraphicsPrimitiveMgr.register(primitives); } @@ -760,3 +766,49 @@ } } } + +class OGLAnyCompositeBlit extends Blit { + private WeakReference<SurfaceData> dstTmp; + + public OGLAnyCompositeBlit(SurfaceType dstType) { + super(SurfaceType.Any, CompositeType.Any, dstType); + } + public synchronized void Blit(SurfaceData src, SurfaceData dst, + Composite comp, Region clip, + int sx, int sy, int dx, int dy, + int w, int h) + { + Blit convertdst = Blit.getFromCache(dst.getSurfaceType(), + CompositeType.SrcNoEa, + SurfaceType.IntArgbPre); + + SurfaceData cachedDst = null; + + if (dstTmp != null) { + // use cached intermediate surface, if available + cachedDst = dstTmp.get(); + } + + // convert source to IntArgbPre + SurfaceData dstBuffer = convertFrom(convertdst, dst, dx, dy, w, h, + cachedDst, BufferedImage.TYPE_INT_ARGB_PRE); + + Blit performop = Blit.getFromCache(src.getSurfaceType(), + CompositeType.Any, dstBuffer.getSurfaceType()); + + performop.Blit(src, dstBuffer, comp, clip, + sx, sy, 0, 0, w, h); + + if (dstBuffer != cachedDst) { + // cache the intermediate surface + dstTmp = new WeakReference(dstBuffer); + } + + // now blit the buffer back to the destination + convertdst = Blit.getFromCache(dstBuffer.getSurfaceType(), + CompositeType.SrcNoEa, + dst.getSurfaceType()); + convertdst.Blit(dstBuffer, dst, AlphaComposite.Src, + clip, 0, 0, dx, dy, w, h); + } +}
--- a/src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,6 +76,7 @@ CompositeType comp, Color bgColor) { - return (bgColor == null || transparency == Transparency.OPAQUE); + return comp.isDerivedFrom(CompositeType.AnyAlpha) && + (bgColor == null || transparency == Transparency.OPAQUE); } }
--- a/src/share/classes/sun/misc/SharedSecrets.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/misc/SharedSecrets.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -198,6 +198,9 @@ public static JavaAWTAccess getJavaAWTAccess() { // this may return null in which case calling code needs to // provision for. + if (javaAWTAccess == null || javaAWTAccess.getContext() == null) { + return null; + } return javaAWTAccess; } }
--- a/src/share/classes/sun/reflect/Reflection.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/reflect/Reflection.java Fri Jun 21 15:46:14 2013 -0500 @@ -58,6 +58,21 @@ @CallerSensitive public static native Class getCallerClass(); + /** + * @deprecated No replacement. This method will be removed in the next + * JDK 7 update release. + */ + @Deprecated + @CallerSensitive + public static Class getCallerClass(int depth) { + return getCallerClass0(depth); + } + + // If the VM enforces getting caller class with @CallerSensitive, + // this will fail anyway. + @CallerSensitive + private static native Class getCallerClass0(int depth); + /** Retrieves the access flags written to the class file. For inner classes these flags may differ from those returned by Class.getModifiers(), which searches the InnerClasses
--- a/src/share/classes/sun/security/provider/certpath/CertPathHelper.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/provider/certpath/CertPathHelper.java Fri Jun 21 15:46:14 2013 -0500 @@ -64,7 +64,7 @@ instance.implSetPathToNames(sel, names); } - static void setDateAndTime(X509CRLSelector sel, Date date, long skew) { + public static void setDateAndTime(X509CRLSelector sel, Date date, long skew) { instance.implSetDateAndTime(sel, date, skew); } }
--- a/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -308,11 +308,9 @@ mPossibleCRLs.add((X509CRL)crl); } } - DistributionPointFetcher store = - DistributionPointFetcher.getInstance(); // all CRLs returned by the DP Fetcher have also been verified - mApprovedCRLs.addAll(store.getCRLs(sel, signFlag, prevKey, - mSigProvider, mStores, reasonsMask, trustAnchors, + mApprovedCRLs.addAll(DistributionPointFetcher.getCRLs(sel, signFlag, + prevKey, mSigProvider, mStores, reasonsMask, trustAnchors, mParams.getDate())); } catch (Exception e) { if (debug != null) { @@ -762,14 +760,12 @@ CRLDistributionPointsExtension.POINTS); } Set<X509CRL> results = new HashSet<X509CRL>(); - DistributionPointFetcher dpf = - DistributionPointFetcher.getInstance(); for (Iterator<DistributionPoint> t = points.iterator(); t.hasNext() && !Arrays.equals(reasonsMask, ALL_REASONS); ) { DistributionPoint point = t.next(); for (X509CRL crl : crls) { - if (dpf.verifyCRL(certImpl, point, crl, reasonsMask, - signFlag, prevKey, mSigProvider, + if (DistributionPointFetcher.verifyCRL(certImpl, point, crl, + reasonsMask, signFlag, prevKey, mSigProvider, trustAnchors, mStores, mParams.getDate())) { results.add(crl); }
--- a/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -50,7 +50,7 @@ * @author Sean Mullan * @since 1.4.2 */ -class DistributionPointFetcher { +public class DistributionPointFetcher { private static final Debug debug = Debug.getInstance("certpath"); @@ -65,34 +65,28 @@ private final static boolean USE_CRLDP = AccessController.doPrivileged (new GetBooleanAction("com.sun.security.enableCRLDP")); - // singleton instance - private static final DistributionPointFetcher INSTANCE = - new DistributionPointFetcher(); - /** * Private instantiation only. */ private DistributionPointFetcher() {} /** - * Return a DistributionPointFetcher instance. - */ - static DistributionPointFetcher getInstance() { - return INSTANCE; - } - - /** * Return the X509CRLs matching this selector. The selector must be * an X509CRLSelector with certificateChecking set. * * If CRLDP support is disabled, this method always returns an * empty set. */ - Collection<X509CRL> getCRLs(X509CRLSelector selector, boolean signFlag, - PublicKey prevKey, String provider, List<CertStore> certStores, - boolean[] reasonsMask, Set<TrustAnchor> trustAnchors, - Date validity) throws CertStoreException { - + public static Collection<X509CRL> getCRLs(X509CRLSelector selector, + boolean signFlag, + PublicKey prevKey, + String provider, + List<CertStore> certStores, + boolean[] reasonsMask, + Set<TrustAnchor> trustAnchors, + Date validity) + throws CertStoreException + { if (USE_CRLDP == false) { return Collections.emptySet(); } @@ -140,7 +134,7 @@ * Download CRLs from the given distribution point, verify and return them. * See the top of the class for current limitations. */ - private Collection<X509CRL> getCRLs(X509CRLSelector selector, + private static Collection<X509CRL> getCRLs(X509CRLSelector selector, X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask, boolean signFlag, PublicKey prevKey, String provider, List<CertStore> certStores, Set<TrustAnchor> trustAnchors, @@ -214,7 +208,7 @@ /** * Download CRL from given URI. */ - private X509CRL getCRL(URIName name) { + private static X509CRL getCRL(URIName name) { URI uri = name.getURI(); if (debug != null) { debug.println("Trying to fetch CRL from DP " + uri); @@ -240,7 +234,7 @@ /** * Fetch CRLs from certStores. */ - private Collection<X509CRL> getCRLs(X500Name name, + private static Collection<X509CRL> getCRLs(X500Name name, X500Principal certIssuer, List<CertStore> certStores) { if (debug != null) { @@ -285,7 +279,7 @@ * certification path should be determined * @return true if ok, false if not */ - boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point, + static boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point, X509CRL crl, boolean[] reasonsMask, boolean signFlag, PublicKey prevKey, String provider, Set<TrustAnchor> trustAnchors, List<CertStore> certStores, @@ -670,7 +664,7 @@ * Append relative name to the issuer name and return a new * GeneralNames object. */ - private GeneralNames getFullNames(X500Name issuer, RDN rdn) + private static GeneralNames getFullNames(X500Name issuer, RDN rdn) throws IOException { List<RDN> rdns = new ArrayList<RDN>(issuer.rdns()); rdns.add(rdn);
--- a/src/share/classes/sun/security/provider/certpath/OCSP.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/provider/certpath/OCSP.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -43,6 +43,7 @@ import static sun.security.provider.certpath.OCSPResponse.*; import sun.misc.IOUtils; +import sun.security.action.GetIntegerAction; import sun.security.util.Debug; import sun.security.x509.AccessDescription; import sun.security.x509.AuthorityInfoAccessExtension; @@ -65,7 +66,30 @@ private static final Debug debug = Debug.getInstance("certpath"); - private static final int CONNECT_TIMEOUT = 15000; // 15 seconds + private static final int DEFAULT_CONNECT_TIMEOUT = 15000; + + /** + * Integer value indicating the timeout length, in seconds, to be + * used for the OCSP check. A timeout of zero is interpreted as + * an infinite timeout. + */ + private static final int CONNECT_TIMEOUT = initializeTimeout(); + + /** + * Initialize the timeout length by getting the OCSP timeout + * system property. If the property has not been set, or if its + * value is negative, set the timeout length to the default. + */ + private static int initializeTimeout() { + Integer tmp = java.security.AccessController.doPrivileged( + new GetIntegerAction("com.sun.security.ocsp.timeout")); + if (tmp == null || tmp < 0) { + return DEFAULT_CONNECT_TIMEOUT; + } + // Convert to milliseconds, as the system property will be + // specified in seconds + return tmp * 1000; + } private OCSP() {}
--- a/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, 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 @@ -41,6 +41,7 @@ import java.util.List; import java.util.Map; import sun.misc.HexDumpEncoder; +import sun.security.action.GetIntegerAction; import sun.security.x509.*; import sun.security.util.*; @@ -148,9 +149,31 @@ private final ResponseStatus responseStatus; private final Map<CertId, SingleResponse> singleResponseMap; - // Maximum clock skew in milliseconds (15 minutes) allowed when checking - // validity of OCSP responses - private static final long MAX_CLOCK_SKEW = 900000; + // Default maximum clock skew in milliseconds (15 minutes) + // allowed when checking validity of OCSP responses + private static final int DEFAULT_MAX_CLOCK_SKEW = 900000; + + /** + * Integer value indicating the maximum allowable clock skew, in seconds, + * to be used for the OCSP check. + */ + private static final int MAX_CLOCK_SKEW = initializeClockSkew(); + + /** + * Initialize the maximum allowable clock skew by getting the OCSP + * clock skew system property. If the property has not been set, or if its + * value is negative, set the skew to the default. + */ + private static int initializeClockSkew() { + Integer tmp = java.security.AccessController.doPrivileged( + new GetIntegerAction("com.sun.security.ocsp.clockSkew")); + if (tmp == null || tmp < 0) { + return DEFAULT_MAX_CLOCK_SKEW; + } + // Convert to milliseconds, as the system property will be + // specified in seconds + return tmp * 1000; + } // an array of all of the CRLReasons (used in SingleResponse) private static CRLReason[] values = CRLReason.values();
--- a/src/share/classes/sun/security/provider/certpath/URICertStore.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/provider/certpath/URICertStore.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -53,6 +53,7 @@ import java.util.Collections; import java.util.List; import java.util.Locale; +import sun.security.action.GetIntegerAction; import sun.security.x509.AccessDescription; import sun.security.x509.GeneralNameInterface; import sun.security.x509.URIName; @@ -149,6 +150,33 @@ } } + // Default maximum connect timeout in milliseconds (15 seconds) + // allowed when downloading CRLs + private static final int DEFAULT_CRL_CONNECT_TIMEOUT = 15000; + + /** + * Integer value indicating the connect timeout, in seconds, to be + * used for the CRL download. A timeout of zero is interpreted as + * an infinite timeout. + */ + private static final int CRL_CONNECT_TIMEOUT = initializeTimeout(); + + /** + * Initialize the timeout length by getting the CRL timeout + * system property. If the property has not been set, or if its + * value is negative, set the timeout length to the default. + */ + private static int initializeTimeout() { + Integer tmp = java.security.AccessController.doPrivileged( + new GetIntegerAction("com.sun.security.crl.timeout")); + if (tmp == null || tmp < 0) { + return DEFAULT_CRL_CONNECT_TIMEOUT; + } + // Convert to milliseconds, as the system property will be + // specified in seconds + return tmp * 1000; + } + /** * Creates a URICertStore. * @@ -395,6 +423,7 @@ if (lastModified != 0) { connection.setIfModifiedSince(lastModified); } + connection.setConnectTimeout(CRL_CONNECT_TIMEOUT); in = connection.getInputStream(); long oldLastModified = lastModified; lastModified = connection.getLastModified();
--- a/src/share/classes/sun/security/util/UntrustedCertificates.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/security/util/UntrustedCertificates.java Fri Jun 21 15:46:14 2013 -0500 @@ -843,5 +843,52 @@ "zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc\n" + "-----END CERTIFICATE-----"); + // + // Revoked code signing certificate w/ a stolen key issued by GoDaddy + // used to sign malware + // + + // Subject: CN=CLEARESULT CONSULTING INC., OU=Corporate IT, + // O=CLEARESULT CONSULTING INC., L=Austin, ST=TX, C=US + // Issuer: SERIALNUMBER=07969287, + // CN=Go Daddy Secure Certification Authority, + // OU=http://certificates.godaddy.com/repository, + // O="GoDaddy.com, Inc.", + // L=Scottsdale, + // ST=Arizona, + // C=US + // Serial: 2b:73:43:2a:a8:4f:44 + add("clearesult-consulting-inc-2AA84F44", + "-----BEGIN CERTIFICATE-----\n" + + "MIIFYjCCBEqgAwIBAgIHK3NDKqhPRDANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE\n" + + "BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY\n" + + "BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm\n" + + "aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5\n" + + "IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky\n" + + "ODcwHhcNMTIwMjE1MjEwOTA2WhcNMTQwMjE1MjEwOTA2WjCBjDELMAkGA1UEBgwC\n" + + "VVMxCzAJBgNVBAgMAlRYMQ8wDQYDVQQHDAZBdXN0aW4xIzAhBgNVBAoMGkNMRUFS\n" + + "RVNVTFQgQ09OU1VMVElORyBJTkMuMRUwEwYDVQQLDAxDb3Jwb3JhdGUgSVQxIzAh\n" + + "BgNVBAMMGkNMRUFSRVNVTFQgQ09OU1VMVElORyBJTkMuMIIBIjANBgkqhkiG9w0B\n" + + "AQEFAAOCAQ8AMIIBCgKCAQEAtIOjCKeAicull+7ZIzt0/4ya3IeXUFlfypqKMLkU\n" + + "IbKjn0P5uMj6VE3rlbZr44RCegxvdnR6umBh1c0ZXoN3o+yc0JKcKcLiApmJJ277\n" + + "p7IbLwYDhBXRQNoIJm187IOMRPIxsKN4hL91txn9jGBmW+9zKlJlNhR5R7vjwU2E\n" + + "jrH/6oqsc9EM2yYpfjlNv6+3jSwAYZCkSWr+27PQOV+YHKmIxtJjX0upFz5FdIrV\n" + + "9CCX+L2Kji1THOkSgG4QTbYxmEcHqGViWz8hXLeNXjcbEsPuIiAu3hknxRHfUTE/\n" + + "U0Lh0Ug1e3LrJu+WnxM2SmUY4krsZ22c0yWUW9hzWITIjQIDAQABo4IBhzCCAYMw\n" + + "DwYDVR0TAQH/BAUwAwEBADATBgNVHSUEDDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8E\n" + + "BAMCB4AwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5LmNvbS9n\n" + + "ZHM1LTE2LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcCMDkwNwYIKwYBBQUH\n" + + "AgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8w\n" + + "gYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZ29kYWRk\n" + + "eS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdvZGFkZHku\n" + + "Y29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSMEGDAWgBT9\n" + + "rGEyk2xF1uLuhV+auud2mWjM5zAdBgNVHQ4EFgQUDtdeKqeN2QkcbEp1HovFieNB\n" + + "XiowDQYJKoZIhvcNAQEFBQADggEBAD74Agw5tvi2aBl4/f/s7/VE/BClzDsKMb9K\n" + + "v9qpeC45ZA/jelxV11HKbQnVF194gDb7D2H9OsAsRUy8HVKbXEcc/8dKvwOqb+BC\n" + + "2i/EmfjLgmCfezNFtLq8xcPxF3zIRc44vPrK0z4YZsaHdH+yTEJ51p5EMdTqaLaP\n" + + "4n5m8LX3RfqlQB9dYFe6dUoYZjKm9d/pIRww3VqfOzjl42Edi1w6dWmBVMx1NZuR\n" + + "DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI\n" + + "LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=\n" + + "-----END CERTIFICATE-----"); } }
--- a/src/share/classes/sun/util/resources/TimeZoneNames.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "Central European Summer Time", "CEST"}; String CHAST[] = new String[] {"Chatham Standard Time", "CHAST", "Chatham Daylight Time", "CHADT"}; + String ChST[] = new String[] {"Chamorro Standard Time", "ChST", + "Chamorro Daylight Time", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"Central Indonesia Time", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"Pacific Standard Time", "PST", "Pacific Daylight Time", "PDT"}; + String SAMOA[] = new String[] {"Samoa Standard Time", "SST", + "Samoa Daylight Time", "SDT"}; String SAST[] = new String[] {"South Africa Standard Time", "SAST", "South Africa Summer Time", "SAST"}; String SBT[] = new String[] {"Solomon Is. Time", "SBT", @@ -175,6 +179,14 @@ "Turkmenistan Summer Time", "TMST"}; String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT", "Ulaanbaatar Summer Time", "ULAST"}; + String UTC[] = new String[] {"Coordinated Universal Time", "UTC", + "Coordinated Universal Time", "UTC"}; + String UZT[] = new String[] {"Uzbekistan Time", "UZT", + "Uzbekistan Summer Time", "UZST"}; + String VICTORIA[] = new String[] {"Eastern Standard Time (Victoria)", "EST", + "Eastern Summer Time (Victoria)", "EST"}; + String VLAT[] = new String[] {"Vladivostok Time", "VLAT", + "Vladivostok Summer Time", "VLAST"}; String WART[] = new String[] {"Western Argentine Time", "WART", "Western Argentine Summer Time", "WARST"}; String WAT[] = new String[] {"Western African Time", "WAT", @@ -185,18 +197,10 @@ "West Indonesia Summer Time", "WIST"}; String WST_AUS[] = new String[] {"Western Standard Time (Australia)", "WST", "Western Summer Time (Australia)", "WST"}; - String SAMOA[] = new String[] {"Samoa Standard Time", "SST", - "Samoa Daylight Time", "SDT"}; String WST_SAMOA[] = new String[] {"West Samoa Time", "WST", "West Samoa Daylight Time", "WSDT"}; - String ChST[] = new String[] {"Chamorro Standard Time", "ChST", - "Chamorro Daylight Time", "ChDT"}; - String VICTORIA[] = new String[] {"Eastern Standard Time (Victoria)", "EST", - "Eastern Summer Time (Victoria)", "EST"}; - String UTC[] = new String[] {"Coordinated Universal Time", "UTC", - "Coordinated Universal Time", "UTC"}; - String UZT[] = new String[] {"Uzbekistan Time", "UZT", - "Uzbekistan Summer Time", "UZST"}; + String YAKT[] = new String[] {"Yakutsk Time", "YAKT", + "Yakutsk Summer Time", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Krasnoyarsk Time", "KRAT", "Krasnoyarsk Summer Time", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Vladivostok Time", "VLAT", - "Vladivostok Summer Time", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Yakutsk Time", "YAKT", - "Yakutsk Summer Time", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Yekaterinburg Time", "YEKT", "Yekaterinburg Summer Time", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Middle Europe Time", "MET", "Middle Europe Summer Time", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_de.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_de.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "Mitteleurop\u00e4ische Sommerzeit", "MESZ"}; String CHAST[] = new String[] {"Chatham Normalzeit", "CHAST", "Chatham Sommerzeit", "CHADT"}; + String ChST[] = new String[] {"Chamorro Normalzeit", "ChST", + "Chamorro Sommerzeit", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"Zentralindonesische Zeit", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"Pazifische Normalzeit", "PST", "Pazifische Sommerzeit", "PDT"}; + String SAMOA[] = new String[] {"Samoa Normalzeit", "SST", + "Samoa Sommerzeit", "SDT"}; String SAST[] = new String[] {"S\u00fcdafrikanische Normalzeit", "SAST", "S\u00fcdafrikanische Sommerzeit", "SAST"}; String SBT[] = new String[] {"Salomoninseln Zeit", "SBT", @@ -175,6 +179,14 @@ "Turkmenische Sommerzeit", "TMST"}; String ULAT[]= new String[] {"Ulaanbaatar Zeit", "ULAT", "Ulaanbaatar Sommerzeit", "ULAST"}; + String UTC[] = new String[] {"Koordinierte Universalzeit", "UTC", + "Koordinierte Universalzeit", "UTC"}; + String UZT[] = new String[] {"Usbekistan Zeit", "UZT", + "Usbekistan Sommerzeit", "UZST"}; + String VICTORIA[] = new String[] {"\u00d6stliche Normalzeit (Victoria)", "EST", + "\u00d6stliche Sommerzeit (Victoria)", "EST"}; + String VLAT[] = new String[] {"Wladiwostok Zeit", "VLAT", + "Wladiwostok Sommerzeit", "VLAST"}; String WART[] = new String[] {"Westargentinische Zeit", "WART", "Westargentinische Sommerzeit", "WARST"}; String WAT[] = new String[] {"Westafrikanische Zeit", "WAT", @@ -185,18 +197,10 @@ "Westindonesische Sommerzeit", "WIST"}; String WST_AUS[] = new String[] {"Westliche Normalzeit (Australien)", "WST", "Westliche Sommerzeit (Australien)", "WST"}; - String SAMOA[] = new String[] {"Samoa Normalzeit", "SST", - "Samoa Sommerzeit", "SDT"}; String WST_SAMOA[] = new String[] {"West Samoa Zeit", "WST", "West Samoa Sommerzeit", "WSDT"}; - String ChST[] = new String[] {"Chamorro Normalzeit", "ChST", - "Chamorro Sommerzeit", "ChDT"}; - String VICTORIA[] = new String[] {"\u00d6stliche Normalzeit (Victoria)", "EST", - "\u00d6stliche Sommerzeit (Victoria)", "EST"}; - String UTC[] = new String[] {"Koordinierte Universalzeit", "UTC", - "Koordinierte Universalzeit", "UTC"}; - String UZT[] = new String[] {"Usbekistan Zeit", "UZT", - "Usbekistan Sommerzeit", "UZST"}; + String YAKT[] = new String[] {"Jakutsk Zeit", "YAKT", + "Jakutsk Sommerzeit", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Krasnojarsker Zeit", "KRAT", "Krasnojarsker Sommerzeit", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Wladiwostok Zeit", "VLAT", - "Wladiwostok Sommerzeit", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Jakutsk Zeit", "YAKT", - "Jakutsk Sommerzeit", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Jekaterinburger Zeit", "YEKT", "Jekaterinburger Sommerzeit", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Zentraleurop\u00e4ische Zeit", "MET", "Zentraleurop\u00e4ische Sommerzeit", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_es.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_es.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "Hora de verano de Europa Central", "CEST"}; String CHAST[] = new String[] {"Hora est\u00e1ndar de Chatham", "CHAST", "Hora de verano de Chatham", "CHADT"}; + String ChST[] = new String[] {"Hora est\u00e1ndar de Chamorro", "ChST", + "Hora de verano de Chamorro", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"Hora de Indonesia Central", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"Hora est\u00e1ndar del Pac\u00edfico", "PST", "Hora de verano del Pac\u00edfico", "PDT"}; + String SAMOA[] = new String[] {"Hora est\u00e1ndar de Samoa", "SST", + "Hora de verano de Samoa", "SDT"}; String SAST[] = new String[] {"Hora est\u00e1ndar de Sud\u00e1frica", "SAST", "Hora de verano de Sud\u00e1frica", "SAST"}; String SBT[] = new String[] {"Hora de las Islas Solomon", "SBT", @@ -175,6 +179,14 @@ "Hora de verano de Turkmenist\u00e1n", "TMST"}; String ULAT[]= new String[] {"Hora de Ulan Bator", "ULAT", "Hora de verano de Ulan Bator", "ULAST"}; + String UTC[] = new String[] {"Hora Universal Coordinada", "UTC", + "Hora Universal Coordinada", "UTC"}; + String UZT[] = new String[] {"Hora de Uzbekist\u00e1n", "UZT", + "Hora de verano de Uzbekist\u00e1n", "UZST"}; + String VICTORIA[] = new String[] {"Hora est\u00e1ndar del Este (Victoria)", "EST", + "Hora de verano del Este (Victoria)", "EST"}; + String VLAT[] = new String[] {"Hora de Vladivostok", "VLAT", + "Hora de verano de Vladivostok", "VLAST"}; String WART[] = new String[] {"Hora de Argentina Occidental", "WART", "Hora de verano de Argentina Occidental", "WARST"}; String WAT[] = new String[] {"Hora de \u00c1frica Occidental", "WAT", @@ -185,18 +197,10 @@ "Indonesia Hora de verano de Indonesia Occidental", "WIST"}; String WST_AUS[] = new String[] {"Hora est\u00e1ndar Occidental (Australia)", "WST", "Hora de verano Occidental (Australia)", "WST"}; - String SAMOA[] = new String[] {"Hora est\u00e1ndar de Samoa", "SST", - "Hora de verano de Samoa", "SDT"}; String WST_SAMOA[] = new String[] {"Hora de Samoa Occidental", "WST", "Hora de verano de Samoa Occidental", "WSDT"}; - String ChST[] = new String[] {"Hora est\u00e1ndar de Chamorro", "ChST", - "Hora de verano de Chamorro", "ChDT"}; - String VICTORIA[] = new String[] {"Hora est\u00e1ndar del Este (Victoria)", "EST", - "Hora de verano del Este (Victoria)", "EST"}; - String UTC[] = new String[] {"Hora Universal Coordinada", "UTC", - "Hora Universal Coordinada", "UTC"}; - String UZT[] = new String[] {"Hora de Uzbekist\u00e1n", "UZT", - "Hora de verano de Uzbekist\u00e1n", "UZST"}; + String YAKT[] = new String[] {"Hora de Yakutsk", "YAKT", + "Hora de verano de Yakutsk", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Hora de Krasnoyarsk", "KRAT", "Hora de verano de Krasnoyarsk", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Hora de Vladivostok", "VLAT", - "Hora de verano de Vladivostok", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Hora de Yakutsk", "YAKT", - "Hora de verano de Yakutsk", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Hora de Ekaterinburgo", "YEKT", "Hora de verano de Ekaterinburgo", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Hora de Europa Central", "MET", "Hora de verano de Europa Central", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Fri Jun 21 15:46:14 2013 -0500 @@ -48,43 +48,45 @@ String ADELAIDE[] = new String[] {"Heure standard d'Australie centrale (Australie du sud)", "CST", "Heure d'\u00e9t\u00e9 d'Australie centrale (Australie du sud)", "CST"}; String AGT[] = new String[] {"Heure D'Argentine", "ART", - "Heure d'\u00e9t\u00e9 D'Argentine", "ARST"} ; + "Heure d'\u00e9t\u00e9 D'Argentine", "ARST"}; String AKST[] = new String[] {"Heure normale d'Alaska", "AKST", - "Heure avanc\u00e9e d'Alaska", "AKDT"} ; + "Heure avanc\u00e9e d'Alaska", "AKDT"}; String AMT[] = new String[] {"Heure normale d'Amazonie", "AMT", - "Heure d'\u00e9t\u00e9 d'Amazonie", "AMST"} ; + "Heure d'\u00e9t\u00e9 d'Amazonie", "AMST"}; String ARAST[] = new String[] {"Heure normale d'Arabie", "AST", - "Heure avanc\u00e9e d'Arabie", "ADT"} ; + "Heure avanc\u00e9e d'Arabie", "ADT"}; String ARMT[] = new String[] {"Heure d'Arm\u00e9nie", "AMT", - "Heure d'\u00e9t\u00e9 d'Arm\u00e9nie", "AMST"} ; + "Heure d'\u00e9t\u00e9 d'Arm\u00e9nie", "AMST"}; String AST[] = new String[] {"Heure normale de l'Atlantique", "AST", - "Heure avanc\u00e9e de l'Atlantique", "ADT"} ; + "Heure avanc\u00e9e de l'Atlantique", "ADT"}; String BDT[] = new String[] {"Heure du Bangladesh", "BDT", - "Heure d'\u00e9t\u00e9 du Bangladesh", "BDST"} ; + "Heure d'\u00e9t\u00e9 du Bangladesh", "BDST"}; String BRISBANE[] = new String[] {"Heure standard d'Australie orientale (Queensland)", "EST", "Heure d'\u00e9t\u00e9 d'Australie orientale (Queensland)", "EST"}; String BROKEN_HILL[] = new String[] {"Heure standard d'Australie centrale (Australie du sud/Nouvelle-Galles du sud)", "CST", "Heure d'\u00e9t\u00e9 d'Australie centrale(Australie du sud/Nouvelle-Galles du sud)", "CST"}; String BRT[] = new String[] {"Heure du Br\u00e9sil", "BRT", - "Heure d'\u00e9t\u00e9 du Br\u00e9sil", "BRST"} ; + "Heure d'\u00e9t\u00e9 du Br\u00e9sil", "BRST"}; String BTT[] = new String[] {"Heure du Bhoutan", "BTT", - "Heure d'\u00e9t\u00e9 du Bhoutan", "BTST"} ; + "Heure d'\u00e9t\u00e9 du Bhoutan", "BTST"}; String CAT[] = new String[] {"Heure d'Afrique centrale", "CAT", - "Heure d'\u00e9t\u00e9 d'Afrique centrale", "CAST"} ; + "Heure d'\u00e9t\u00e9 d'Afrique centrale", "CAST"}; String CET[] = new String[] {"Heure d'Europe centrale", "CET", - "Heure d'\u00e9t\u00e9 d'Europe centrale", "CEST"} ; + "Heure d'\u00e9t\u00e9 d'Europe centrale", "CEST"}; String CHAST[] = new String[] {"Heure standard de Chatham", "CHAST", "Heure avanc\u00e9e de Chatham", "CHADT"}; + String ChST[] = new String[] {"Heure normale des \u00eeles Mariannes", "ChST", + "Heure d'\u00e9t\u00e9 des \u00eeles Mariannes", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"Heure d'Indon\u00e9sie centrale", "CIT", "Heure d'\u00e9t\u00e9 d'Indon\u00e9sie centrale", "CIST"}; String CLT[] = new String[] {"Heure du Chili", "CLT", - "Heure d'\u00e9t\u00e9 du Chili", "CLST"} ; + "Heure d'\u00e9t\u00e9 du Chili", "CLST"}; String CST[] = new String[] {"Heure normale du Centre", "CST", - "Heure avanc\u00e9e du Centre", "CDT"} ; + "Heure avanc\u00e9e du Centre", "CDT"}; String CTT[] = new String[] {"Heure normale de Chine", "CST", - "Heure avanc\u00e9e de Chine", "CDT"} ; + "Heure avanc\u00e9e de Chine", "CDT"}; String CUBA[] = new String[] {"Heure standard de Cuba", "CST", "Heure d'\u00e9t\u00e9 de Cuba", "CDT"}; String DARWIN[] = new String[] {"Heure standard d'Australie centrale (Territoire du Nord)", "CST", @@ -92,17 +94,17 @@ String DUBLIN[] = new String[] {"Heure du m\u00e9ridien de Greenwich", "GMT", "Heure d'\u00e9t\u00e9 irlandaise", "IST"}; String EAT[] = new String[] {"Heure d'Afrique de l'Est", "EAT", - "Heure d'\u00e9t\u00e9 d'Afrique de l'Est", "EAST"} ; + "Heure d'\u00e9t\u00e9 d'Afrique de l'Est", "EAST"}; String EASTER[] = new String[] {"Heure de l'Ile de P\u00e2ques", "EAST", "Heure d'\u00e9t\u00e9 de l'Ile de P\u00e2ques", "EASST"}; String EET[] = new String[] {"Heure d'Europe de l'Est", "EET", - "Heure d'\u00e9t\u00e9 d'Europe de l'Est", "EEST"} ; + "Heure d'\u00e9t\u00e9 d'Europe de l'Est", "EEST"}; String EGT[] = new String[] {"Heure du Groenland de l'Est", "EGT", - "Heure d'\u00e9t\u00e9 du Groenland de l'Est", "EGST"} ; + "Heure d'\u00e9t\u00e9 du Groenland de l'Est", "EGST"}; String EST[] = new String[] {"Heure normale de l'Est", "EST", - "Heure avanc\u00e9e de l'Est", "EDT"} ; + "Heure avanc\u00e9e de l'Est", "EDT"}; String EST_NSW[] = new String[] {"Heure normale de l'Est (Nouvelle-Galles du Sud)", "EST", - "Heure d'\u00e9t\u00e9 de l'Est (Nouvelle-Galles du Sud)", "EST"} ; + "Heure d'\u00e9t\u00e9 de l'Est (Nouvelle-Galles du Sud)", "EST"}; String FET[] = new String[] {"Further-eastern European Time", "FET", "Further-eastern European Summer Time", "FEST"}; String GHMT[] = new String[] {"Heure du Ghana", "GMT", @@ -110,29 +112,29 @@ String GAMBIER[] = new String[] {"Heure de Gambi", "GAMT", "Heure d'\u00e9t\u00e9 de Gambi", "GAMST"}; String GMT[] = new String[] {"Heure de Greenwich", "GMT", - "Heure de Greenwich", "GMT"} ; + "Heure de Greenwich", "GMT"}; String GMTBST[] = new String[] {"Heure du m\u00e9ridien de Greenwich", "GMT", "Heure d'\u00e9t\u00e9 britannique", "BST"}; String GST[] = new String[] {"Heure normale du Golfe", "GST", - "Heure avanc\u00e9e du Golfe", "GDT"} ; + "Heure avanc\u00e9e du Golfe", "GDT"}; String HAST[] = new String[] {"Heure normale d'Hawa\u00ef-Al\u00e9outiennes", "HAST", - "Heure avanc\u00e9e d'Hawa\u00ef-Al\u00e9outiennes", "HADT"} ; + "Heure avanc\u00e9e d'Hawa\u00ef-Al\u00e9outiennes", "HADT"}; String HKT[] = new String[] {"Heure de Hong Kong", "HKT", "Heure d'\u00e9t\u00e9 de Hong Kong", "HKST"}; String HST[] = new String[] {"Heure normale d'Hawa\u00ef", "HST", - "Heure avanc\u00e9e d'Hawa\u00ef", "HDT"} ; + "Heure avanc\u00e9e d'Hawa\u00ef", "HDT"}; String ICT[] = new String[] {"Heure d'Indochine", "ICT", - "Heure d'\u00e9t\u00e9 d'Indochine", "ICST"} ; + "Heure d'\u00e9t\u00e9 d'Indochine", "ICST"}; String IRT[] = new String[] {"Heure normale d'Iran", "IRST", - "Heure avanc\u00e9e d'Iran", "IRDT"} ; + "Heure avanc\u00e9e d'Iran", "IRDT"}; String ISRAEL[] = new String[] {"Heure standard d'Isra\u00ebl", "IST", "Heure avanc\u00e9e d'Isra\u00ebl", "IDT"}; String IST[] = new String[] {"Heure normale d'Inde", "IST", - "Heure avanc\u00e9e d'Inde", "IDT"} ; + "Heure avanc\u00e9e d'Inde", "IDT"}; String JST[] = new String[] {"Heure normale du Japon", "JST", - "Heure avanc\u00e9e du Japon", "JDT"} ; + "Heure avanc\u00e9e du Japon", "JDT"}; String KST[] = new String[] {"Heure normale de Cor\u00e9e", "KST", - "Heure avanc\u00e9e de Cor\u00e9e", "KDT"} ; + "Heure avanc\u00e9e de Cor\u00e9e", "KDT"}; String LORD_HOWE[] = new String[] {"Heure standard de Lord Howe", "LHST", "Heure d'\u00e9t\u00e9 de Lord Howe", "LHST"}; String MHT[] = new String[] {"Heure des Iles Marshall", "MHT", @@ -140,7 +142,7 @@ String MSK[] = new String[] {"Heure standard de Moscou", "MSK", "Heure avanc\u00e9e de Moscou", "MSD"}; String MST[] = new String[] {"Heure normale des Rocheuses", "MST", - "Heure avanc\u00e9e des Rocheuses", "MDT"} ; + "Heure avanc\u00e9e des Rocheuses", "MDT"}; String MYT[] = new String[] {"Heure de Malaisie", "MYT", "Heure d'\u00e9t\u00e9 de Malaisie", "MYST"}; String NORONHA[] = new String[] {"Heure de Fernando de Noronha", "FNT", @@ -150,21 +152,23 @@ String NPT[] = new String[] {"Heure du N\u00e9pal", "NPT", "Heure d'\u00e9t\u00e9 du N\u00e9pal", "NPST"}; String NST[] = new String[] {"Heure normale de Terre-Neuve", "NST", - "Heure avanc\u00e9e de Terre-Neuve", "NDT"} ; + "Heure avanc\u00e9e de Terre-Neuve", "NDT"}; String NZST[] = new String[] {"Heure normale de Nouvelle-Z\u00e9lande", "NZST", - "Heure avanc\u00e9e de Nouvelle-Z\u00e9lande", "NZDT"} ; + "Heure avanc\u00e9e de Nouvelle-Z\u00e9lande", "NZDT"}; String PITCAIRN[] = new String[] {"Heure standard des Pitcairn", "PST", "heure avanc\u00e9e des Pitcairn", "PDT"}; String PKT[] = new String[] {"Heure du Pakistan", "PKT", - "Heure d'\u00e9t\u00e9 du Pakistan", "PKST"} ; + "Heure d'\u00e9t\u00e9 du Pakistan", "PKST"}; String PONT[] = new String[] {"Pohnpei Time", "PONT", "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"Heure normale du Pacifique", "PST", - "Heure avanc\u00e9e du Pacifique", "PDT"} ; + "Heure avanc\u00e9e du Pacifique", "PDT"}; + String SAMOA[] = new String[] {"Heure standard de Samoa", "SST", + "Heure avanc\u00e9e de Samoa", "SDT"}; String SAST[] = new String[] {"Heure normale d'Afrique du Sud", "SAST", - "Heure d'\u00e9t\u00e9 d'Afrique du Sud", "SAST"} ; + "Heure d'\u00e9t\u00e9 d'Afrique du Sud", "SAST"}; String SBT[] = new String[] {"Heure des \u00celes Salomon", "SBT", - "Heure d'\u00e9t\u00e9 des \u00celes Salomon", "SBST"} ; + "Heure d'\u00e9t\u00e9 des \u00celes Salomon", "SBST"}; String SGT[] = new String[] {"Heure de Singapour", "SGT", "Heure d'\u00e9t\u00e9 de Singapour", "SGST"}; String SLST[] = new String[] {"Heure du m\u00e9ridien de Greenwich", "GMT", @@ -172,31 +176,31 @@ String TASMANIA[] = new String[] {"Heure standard d'Australie orientale (Tasmanie)", "EST", "Heure d'\u00e9t\u00e9 d'Australie orientale (Tasmanie)", "EST"}; String TMT[] = new String[] {"Heure du Turkm\u00e9nistan", "TMT", - "Heure d'\u00e9t\u00e9 du Turkm\u00e9nistan", "TMST"} ; + "Heure d'\u00e9t\u00e9 du Turkm\u00e9nistan", "TMST"}; String ULAT[]= new String[] {"Heure de l'Ulaanbaatar", "ULAT", - "Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"} ; - String WART[] = new String[] {"Heure D'Argentine de l'Ouest", "WART", - "Heure d'\u00e9t\u00e9 D'Argentine de l'Ouest", "WARST"} ; - String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT", - "Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"} ; - String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET", - "Heure d'\u00e9t\u00e9 d'Europe de l'Ouest", "WEST"} ; - String WIT[] = new String[] {"Heure de l'Indon\u00e9sie occidentale", "WIT", - "Heure d'\u00e9t\u00e9 de l'Indon\u00e9sie occidentale", "WIST"}; - String WST_AUS[] = new String[] {"Heure normale de l'Ouest (Australie)", "WST", - "Heure d'\u00e9t\u00e9 de l'Ouest (Australie)", "WST"} ; - String SAMOA[] = new String[] {"Heure standard de Samoa", "SST", - "Heure avanc\u00e9e de Samoa", "SDT"}; - String WST_SAMOA[] = new String[] {"Heure des Samoas occidentales", "WST", - "Heure d'\u00e9t\u00e9 des Samoas occidentales", "WSDT"} ; - String ChST[] = new String[] {"Heure normale des \u00eeles Mariannes", "ChST", - "Heure d'\u00e9t\u00e9 des \u00eeles Mariannes", "ChDT"}; - String VICTORIA[] = new String[] {"Heure standard d'Australie orientale (Victoria)", "EST", - "Heure d'\u00e9t\u00e9 d'Australie orientale (Victoria)", "EST"}; + "Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"}; String UTC[] = new String[] {"Temps universel coordonn\u00e9", "UTC", "Temps universel coordonn\u00e9", "UTC"}; String UZT[] = new String[] {"Heure de l'Ouzb\u00e9kistan", "UZT", "Heure d'\u00e9t\u00e9 de l'Ouzb\u00e9kistan", "UZST"}; + String VICTORIA[] = new String[] {"Heure standard d'Australie orientale (Victoria)", "EST", + "Heure d'\u00e9t\u00e9 d'Australie orientale (Victoria)", "EST"}; + String VLAT[] = new String[] {"Heure de Vladivostok", "VLAT", + "Heure d'\u00e9t\u00e9 de Vladivostok", "VLAST"}; + String WART[] = new String[] {"Heure D'Argentine de l'Ouest", "WART", + "Heure d'\u00e9t\u00e9 D'Argentine de l'Ouest", "WARST"}; + String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT", + "Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"}; + String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET", + "Heure d'\u00e9t\u00e9 d'Europe de l'Ouest", "WEST"}; + String WIT[] = new String[] {"Heure de l'Indon\u00e9sie occidentale", "WIT", + "Heure d'\u00e9t\u00e9 de l'Indon\u00e9sie occidentale", "WIST"}; + String WST_AUS[] = new String[] {"Heure normale de l'Ouest (Australie)", "WST", + "Heure d'\u00e9t\u00e9 de l'Ouest (Australie)", "WST"}; + String WST_SAMOA[] = new String[] {"Heure des Samoas occidentales", "WST", + "Heure d'\u00e9t\u00e9 des Samoas occidentales", "WSDT"}; + String YAKT[] = new String[] {"Heure du Iakoutsk", "YAKT", + "Heure d'\u00e9t\u00e9 du Iakoutsk", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Heure de Krasno\u00efarsk", "KRAT", "Heure d'\u00e9t\u00e9 de Krasno\u00efarsk", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Heure de Vladivostok", "VLAT", - "Heure d'\u00e9t\u00e9 de Vladivostok", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Heure du Iakoutsk", "YAKT", - "Heure d'\u00e9t\u00e9 du Iakoutsk", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Heure de Yekaterinburg", "YEKT", "Heure d'\u00e9t\u00e9 de Yekaterinburg", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Heure de l'Europe centrale", "MET", "Heure d'\u00e9t\u00e9 de l'Europe centrale", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_it.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_it.java Fri Jun 21 15:46:14 2013 -0500 @@ -77,6 +77,8 @@ "Ora legale di Chatham", "CHADT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; + String ChST[] = new String[] {"Ora standard di Chamorro", "ChST", + "Ora legale di Chamorro", "ChDT"}; String CIT[] = new String[] {"Ora dell'Indonesia centrale", "CIT", "Ora estiva dell'Indonesia centrale", "CIST"}; String CLT[] = new String[] {"Ora del Cile", "CLT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"Ora solare della costa occidentale USA", "PST", "Ora legale della costa occidentale USA", "PDT"}; + String SAMOA[] = new String[] {"Ora standard di Samoa", "SST", + "Ora legale di Samoa", "SDT"}; String SAST[] = new String[] {"Ora solare del Sudafrica", "SAST", "Ora estiva del Sudafrica", "SAST"}; String SBT[] = new String[] {"Ora delle Isole Salomone", "SBT", @@ -175,6 +179,14 @@ "Ora estiva del Turkmenistan", "TMST"}; String ULAT[]= new String[] {"Ora di Ulaanbaatar", "ULAT", "Ora estiva di Ulaanbaatar", "ULAST"}; + String UTC[] = new String[] {"Tempo universale coordinato", "UTC", + "Tempo universale coordinato", "UTC"}; + String UZT[] = new String[] {"Ora dell'Uzbekistan", "UZT", + "Ora estiva dell'Uzbekistan", "UZST"}; + String VICTORIA[] = new String[] {"Ora orientale standard (Victoria)", "EST", + "Ora estiva orientale (Victoria)", "EST"}; + String VLAT[] = new String[] {"Ora di Vladivostok", "VLAT", + "Ora estiva di Vladivostok", "VLAST"}; String WART[] = new String[] {"Ora dell'Argentina occidentale", "WART", "Ora estiva dell'Argentina occidentale", "WARST"}; String WAT[] = new String[] {"Ora dell'Africa occidentale", "WAT", @@ -185,18 +197,10 @@ "Ora estiva dell'Indonesia occidentale", "WIST"}; String WST_AUS[] = new String[] {"Ora solare dell'Australia occidentale", "WST", "Ora estiva dell'Australia occidentale", "WST"}; - String SAMOA[] = new String[] {"Ora standard di Samoa", "SST", - "Ora legale di Samoa", "SDT"}; String WST_SAMOA[] = new String[] {"Ora di Samoa", "WST", "Ora estiva di Samoa", "WSDT"}; - String ChST[] = new String[] {"Ora standard di Chamorro", "ChST", - "Ora legale di Chamorro", "ChDT"}; - String VICTORIA[] = new String[] {"Ora orientale standard (Victoria)", "EST", - "Ora estiva orientale (Victoria)", "EST"}; - String UTC[] = new String[] {"Tempo universale coordinato", "UTC", - "Tempo universale coordinato", "UTC"}; - String UZT[] = new String[] {"Ora dell'Uzbekistan", "UZT", - "Ora estiva dell'Uzbekistan", "UZST"}; + String YAKT[] = new String[] {"Ora di Jakutsk", "YAKT", + "Ora estiva di Jakutsk", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Ora di Krasnojarsk", "KRAT", "Ora estiva di Krasnojarsk", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Ora di Vladivostok", "VLAT", - "Ora estiva di Vladivostok", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Ora di Jakutsk", "YAKT", - "Ora estiva di Jakutsk", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Ora di Ekaterinburg", "YEKT", "Ora estiva di Ekaterinburg", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Ora dell'Europa centrale", "MET", "Ora estiva dell'Europa centrale", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "\u4e2d\u90e8\u30e8\u30fc\u30ed\u30c3\u30d1\u590f\u6642\u9593", "CEST"}; String CHAST[] = new String[] {"\u30c1\u30e3\u30bf\u30e0\u6a19\u6e96\u6642", "CHAST", "\u30c1\u30e3\u30bf\u30e0\u590f\u6642\u9593", "CHADT"}; + String ChST[] = new String[] {"\u30b0\u30a2\u30e0\u6a19\u6e96\u6642", "ChST", + "\u30b0\u30a2\u30e0\u590f\u6642\u9593", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"\u4e2d\u592e\u30a4\u30f3\u30c9\u30cd\u30b7\u30a2\u6642\u9593", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642", "PST", "\u592a\u5e73\u6d0b\u590f\u6642\u9593", "PDT"}; + String SAMOA[] = new String[] {"\u30b5\u30e2\u30a2\u6a19\u6e96\u6642", "SST", + "\u30b5\u30e2\u30a2\u590f\u6642\u9593", "SDT"}; String SAST[] = new String[] {"\u5357\u30a2\u30d5\u30ea\u30ab\u6a19\u6e96\u6642", "SAST", "\u5357\u30a2\u30d5\u30ea\u30ab\u590f\u6642\u9593", "SAST"}; String SBT[] = new String[] {"\u30bd\u30ed\u30e2\u30f3\u8af8\u5cf6\u6642\u9593", "SBT", @@ -175,6 +179,14 @@ "\u30c8\u30eb\u30af\u30e1\u30cb\u30b9\u30bf\u30f3\u590f\u6642\u9593", "TMST"}; String ULAT[]= new String[] {"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u6642\u9593", "ULAT", "\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u590f\u6642\u9593", "ULAST"}; + String UTC[] = new String[] {"\u5354\u5b9a\u4e16\u754c\u6642", "UTC", + "\u5354\u5b9a\u4e16\u754c\u6642", "UTC"}; + String UZT[] = new String[] {"\u30a6\u30ba\u30d9\u30ad\u30b9\u30bf\u30f3\u6642\u9593", "UZT", + "\u30a6\u30ba\u30d9\u30ad\u30b9\u30bf\u30f3\u590f\u6642\u9593", "UZST"}; + String VICTORIA[] = new String[] {"\u6771\u90e8\u6a19\u6e96\u6642 (\u30d3\u30af\u30c8\u30ea\u30a2)", "EST", + "\u6771\u90e8\u590f\u6642\u9593 (\u30d3\u30af\u30c8\u30ea\u30a2)", "EST"}; + String VLAT[] = new String[] {"\u30a6\u30e9\u30b8\u30aa\u30b9\u30c8\u30af\u6642\u9593", "VLAT", + "\u30a6\u30e9\u30b8\u30aa\u30b9\u30c8\u30af\u590f\u6642\u9593", "VLAST"}; String WART[] = new String[] {"\u897f\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART", "\u897f\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"}; String WAT[] = new String[] {"\u897f\u30a2\u30d5\u30ea\u30ab\u6642\u9593", "WAT", @@ -185,18 +197,10 @@ "\u897f\u30a4\u30f3\u30c9\u30cd\u30b7\u30a2\u590f\u6642\u9593", "WIST"}; String WST_AUS[] = new String[] {"\u897f\u90e8\u6a19\u6e96\u6642 (\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2)", "WST", "\u897f\u90e8\u590f\u6642\u9593 (\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2)", "WST"}; - String SAMOA[] = new String[] {"\u30b5\u30e2\u30a2\u6a19\u6e96\u6642", "SST", - "\u30b5\u30e2\u30a2\u590f\u6642\u9593", "SDT"}; String WST_SAMOA[] = new String[] {"\u897f\u30b5\u30e2\u30a2\u6642\u9593", "WST", "\u897f\u30b5\u30e2\u30a2\u590f\u6642\u9593", "WSDT"}; - String ChST[] = new String[] {"\u30b0\u30a2\u30e0\u6a19\u6e96\u6642", "ChST", - "\u30b0\u30a2\u30e0\u590f\u6642\u9593", "ChDT"}; - String VICTORIA[] = new String[] {"\u6771\u90e8\u6a19\u6e96\u6642 (\u30d3\u30af\u30c8\u30ea\u30a2)", "EST", - "\u6771\u90e8\u590f\u6642\u9593 (\u30d3\u30af\u30c8\u30ea\u30a2)", "EST"}; - String UTC[] = new String[] {"\u5354\u5b9a\u4e16\u754c\u6642", "UTC", - "\u5354\u5b9a\u4e16\u754c\u6642", "UTC"}; - String UZT[] = new String[] {"\u30a6\u30ba\u30d9\u30ad\u30b9\u30bf\u30f3\u6642\u9593", "UZT", - "\u30a6\u30ba\u30d9\u30ad\u30b9\u30bf\u30f3\u590f\u6642\u9593", "UZST"}; + String YAKT[] = new String[] {"\u30e4\u30af\u30fc\u30c4\u30af\u6642\u9593", "YAKT", + "\u30e4\u30af\u30fc\u30c4\u30af\u590f\u6642\u9593", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"\u30af\u30e9\u30b9\u30ce\u30e4\u30eb\u30b9\u30af\u6642\u9593", "KRAT", "\u30af\u30e9\u30b9\u30ce\u30e4\u30eb\u30b9\u30af\u590f\u6642\u9593", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"\u30a6\u30e9\u30b8\u30aa\u30b9\u30c8\u30af\u6642\u9593", "VLAT", - "\u30a6\u30e9\u30b8\u30aa\u30b9\u30c8\u30af\u590f\u6642\u9593", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"\u30e4\u30af\u30fc\u30c4\u30af\u6642\u9593", "YAKT", - "\u30e4\u30af\u30fc\u30c4\u30af\u590f\u6642\u9593", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"\u30a8\u30ab\u30c6\u30ea\u30f3\u30d6\u30eb\u30b0\u6642\u9593", "YEKT", "\u30a8\u30ab\u30c6\u30ea\u30f3\u30d6\u30eb\u30b0\u590f\u6642\u9593", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"\u4e2d\u90e8\u30e8\u30fc\u30ed\u30c3\u30d1\u6642\u9593", "MET", "\u4e2d\u90e8\u30e8\u30fc\u30ed\u30c3\u30d1\u590f\u6642\u9593", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "\uc911\uc559 \uc720\ub7fd \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CEST"}; String CHAST[] = new String[] {"Chatham \ud45c\uc900\uc2dc", "CHAST", "Chatham \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CHADT"}; + String ChST[] = new String[] {"\ucc28\ubaa8\ub85c \ud45c\uc900\uc2dc", "ChST", + "\ucc28\ubaa8\ub85c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"\uc911\uc559 \uc778\ub3c4\ub124\uc2dc\uc544 \uc2dc\uac04", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc", "PST", "\ud0dc\ud3c9\uc591 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "PDT"}; + String SAMOA[] = new String[] {"\uc0ac\ubaa8\uc544 \ud45c\uc900\uc2dc", "SST", + "\uc0ac\ubaa8\uc544 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "SDT"}; String SAST[] = new String[] {"\ub0a8\uc544\ud504\ub9ac\uce74 \ud45c\uc900\uc2dc", "SAST", "\ub0a8\uc544\ud504\ub9ac\uce74 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "SAST"}; String SBT[] = new String[] {"\uc194\ub85c\ubaac \uad70\ub3c4 \uc2dc\uac04", "SBT", @@ -175,6 +179,14 @@ "\ud22c\ub974\ud06c\uba54\ub2c8\uc2a4\ud0c4 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "TMST"}; String ULAT[]= new String[] {"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc2dc\uac04", "ULAT", "\uc6b8\ub780\ubc14\ud0c0\ub974 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ULAST"}; + String UTC[] = new String[] {"\uc138\uacc4 \ud45c\uc900\uc2dc", "UTC", + "\uc138\uacc4 \ud45c\uc900\uc2dc", "UTC"}; + String UZT[] = new String[] {"\uc6b0\uc988\ubca0\ud0a4\uc2a4\ud0c4 \uc2dc\uac04", "UZT", + "\uc6b0\uc988\ubca0\ud0a4\uc2a4\ud0c4 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "UZST"}; + String VICTORIA[] = new String[] {"\ub3d9\ubd80 \ud45c\uc900\uc2dc(\ube45\ud1a0\ub9ac\uc544)", "EST", + "\ub3d9\ubd80 \uc77c\uad11\uc808\uc57d\uc2dc\uac04(\ube45\ud1a0\ub9ac\uc544)", "EST"}; + String VLAT[] = new String[] {"\ube14\ub77c\ub514\ubcf4\uc2a4\ud1a1 \uc2dc\uac04", "VLAT", + "\ube14\ub77c\ub514\ubcf4\uc2a4\ud1a1 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VLAST"}; String WART[] = new String[] {"\uc11c\ubd80 \uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART", "\uc11c\ubd80 \uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"}; String WAT[] = new String[] {"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc2dc\uac04", "WAT", @@ -185,18 +197,10 @@ "\uc11c\uc778\ub3c4\ub124\uc2dc\uc544 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WIST"}; String WST_AUS[] = new String[] {"\uc11c\ubd80 \ud45c\uc900\uc2dc(\ud638\uc8fc)", "WST", "\uc11c\ubd80 \uc77c\uad11\uc808\uc57d\uc2dc\uac04(\ud638\uc8fc)", "WST"}; - String SAMOA[] = new String[] {"\uc0ac\ubaa8\uc544 \ud45c\uc900\uc2dc", "SST", - "\uc0ac\ubaa8\uc544 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "SDT"}; String WST_SAMOA[] = new String[] {"\uc11c\uc0ac\ubaa8\uc544 \uc2dc\uac04", "WST", "\uc11c\uc0ac\ubaa8\uc544 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WSDT"}; - String ChST[] = new String[] {"\ucc28\ubaa8\ub85c \ud45c\uc900\uc2dc", "ChST", - "\ucc28\ubaa8\ub85c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ChDT"}; - String VICTORIA[] = new String[] {"\ub3d9\ubd80 \ud45c\uc900\uc2dc(\ube45\ud1a0\ub9ac\uc544)", "EST", - "\ub3d9\ubd80 \uc77c\uad11\uc808\uc57d\uc2dc\uac04(\ube45\ud1a0\ub9ac\uc544)", "EST"}; - String UTC[] = new String[] {"\uc138\uacc4 \ud45c\uc900\uc2dc", "UTC", - "\uc138\uacc4 \ud45c\uc900\uc2dc", "UTC"}; - String UZT[] = new String[] {"\uc6b0\uc988\ubca0\ud0a4\uc2a4\ud0c4 \uc2dc\uac04", "UZT", - "\uc6b0\uc988\ubca0\ud0a4\uc2a4\ud0c4 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "UZST"}; + String YAKT[] = new String[] {"\uc57c\uce20\ud06c \uc2dc\uac04", "YAKT", + "\uc57c\uce20\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"\ud06c\ub77c\uc2a4\ub178\uc57c\ub974\uc2a4\ud06c \uc2dc\uac04", "KRAT", "\ud06c\ub77c\uc2a4\ub178\uc57c\ub974\uc2a4\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"\ube14\ub77c\ub514\ubcf4\uc2a4\ud1a1 \uc2dc\uac04", "VLAT", - "\ube14\ub77c\ub514\ubcf4\uc2a4\ud1a1 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"\uc57c\uce20\ud06c \uc2dc\uac04", "YAKT", - "\uc57c\uce20\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"\uc608\uce74\ud14c\ub9b0\ubc84\uadf8 \uc2dc\uac04", "YEKT", "\uc608\uce74\ud14c\ub9b0\ubc84\uadf8 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"\uc911\ubd80 \uc720\ub7fd \uc2dc\uac04", "MET", "\uc911\ubd80 \uc720\ub7fd \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"}; String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST", "Hor\u00e1rio de luz natural de Chatham", "CHADT"}; + String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST", + "Hor\u00e1rio de luz natural de Chamorro", "ChDT"}; String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT", "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"}; String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT", @@ -159,6 +161,8 @@ "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"}; String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST", "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"}; + String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST", + "Hor\u00e1rio de luz natural de Samoa", "SDT"}; String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST", "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"}; String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT", @@ -175,6 +179,16 @@ "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"}; String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT", "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"}; + String UTC[] = new String[] {"Tempo universal coordenado", "UTC", + "Tempo universal coordenado", "UTC"}; + String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT", + "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"}; + String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"}; + String VLAT[] = new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT", + "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}; + String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART", + "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"}; String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT", "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"}; String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET", @@ -183,20 +197,10 @@ "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"}; String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST", "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"}; - String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST", - "Hor\u00e1rio de luz natural de Samoa", "SDT"}; String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST", "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSDT"}; - String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST", - "Hor\u00e1rio de luz natural de Chamorro", "ChDT"}; - String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"}; - String UTC[] = new String[] {"Tempo universal coordenado", "UTC", - "Tempo universal coordenado", "UTC"}; - String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT", - "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"}; - String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART", - "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"}; + String YAKT[] = new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT", "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT", - "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT", "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET", "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "Centraleuropeisk sommartid", "CEST"}; String CHAST[] = new String[] {"Chatham, normaltid", "CHAST", "Chatham, sommartid", "CHADT"}; + String ChST[] = new String[] {"Chamorro, normaltid", "ChST", + "Chamorro, sommartid", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"Centralindonesisk tid", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"Stilla havet, normaltid", "PST", "Stilla havet, sommartid", "PDT"}; + String SAMOA[] = new String[] {"Samoa, normaltid", "SST", + "Samoa, sommartid", "SDT"}; String SAST[] = new String[] {"Sydafrika, normaltid", "SAST", "Sydafrika, sommartid", "SAST"}; String SBT[] = new String[] {"Salomon\u00f6arna, normaltid", "SBT", @@ -175,6 +179,14 @@ "Turkmenistan, sommartid", "TMST"}; String ULAT[]= new String[] {"Ulaanbaatar, normaltid", "ULAT", "Ulaanbaatar, sommartid", "ULAST"}; + String UTC[] = new String[] {"Koordinerad universell tid", "UTC", + "Koordinerad universell tid", "UTC"}; + String UZT[] = new String[] {"Uzbekistan, normaltid", "UZT", + "Uzbekistan, sommartid", "UZST"}; + String VICTORIA[] = new String[] {"\u00d6stlig normaltid (Victoria)", "EST", + "\u00d6stlig sommartid (Victoria)", "EST"}; + String VLAT[] = new String[] {"Vladivostok, normaltid", "VLAT", + "Vladivostok, sommartid", "VLAST"}; String WART[] = new String[] {"V\u00e4stargentina, normaltid", "WART", "V\u00e4stargentina, sommartid", "WARST"}; String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT", @@ -185,18 +197,10 @@ "V\u00e4stindonesisk sommartid", "WIST"}; String WST_AUS[] = new String[] {"V\u00e4stlig normaltid (Australien)", "WST", "V\u00e4stlig sommartid (Australien)", "WST"}; - String SAMOA[] = new String[] {"Samoa, normaltid", "SST", - "Samoa, sommartid", "SDT"}; String WST_SAMOA[] = new String[] {"V\u00e4stsamoansk tid", "WST", "V\u00e4stsamoansk sommartid", "WSDT"}; - String ChST[] = new String[] {"Chamorro, normaltid", "ChST", - "Chamorro, sommartid", "ChDT"}; - String VICTORIA[] = new String[] {"\u00d6stlig normaltid (Victoria)", "EST", - "\u00d6stlig sommartid (Victoria)", "EST"}; - String UTC[] = new String[] {"Koordinerad universell tid", "UTC", - "Koordinerad universell tid", "UTC"}; - String UZT[] = new String[] {"Uzbekistan, normaltid", "UZT", - "Uzbekistan, sommartid", "UZST"}; + String YAKT[] = new String[] {"Jakutsk, normaltid", "YAKT", + "Jakutsk, sommartid", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Krasnojarsk, normaltid", "KRAT", "Krasnojarsk, sommartid", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Vladivostok, normaltid", "VLAT", - "Vladivostok, sommartid", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Jakutsk, normaltid", "YAKT", - "Jakutsk, sommartid", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Jekaterinburg, normaltid", "YEKT", "Jekaterinburg, sommartid", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"Mellaneuropeisk tid", "MET", "Mellaneuropeisk sommartid", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "\u4e2d\u6b27\u590f\u4ee4\u65f6", "CEST"}; String CHAST[] = new String[] {"\u67e5\u8428\u59c6\u6807\u51c6\u65f6\u95f4", "CHAST", "\u67e5\u8428\u59c6\u590f\u4ee4\u65f6", "CHADT"}; + String ChST[] = new String[] {"Chamorro \u6807\u51c6\u65f6\u95f4", "ChST", + "Chamorro \u590f\u4ee4\u65f6", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"\u4e2d\u90e8\u5370\u5ea6\u5c3c\u897f\u4e9a\u65f6\u95f4", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4", "PST", "\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6", "PDT"}; + String SAMOA[] = new String[] {"\u8428\u6469\u4e9a\u7fa4\u5c9b\u6807\u51c6\u65f6\u95f4", "SST", + "\u8428\u6469\u4e9a\u7fa4\u5c9b\u590f\u4ee4\u65f6", "SDT"}; String SAST[] = new String[] {"\u5357\u975e\u6807\u51c6\u65f6\u95f4", "SAST", "\u5357\u975e\u590f\u4ee4\u65f6", "SAST"}; String SBT[] = new String[] {"\u6240\u7f57\u95e8\u7fa4\u5c9b\u65f6\u95f4", "SBT", @@ -175,6 +179,14 @@ "\u571f\u5e93\u66fc\u590f\u4ee4\u65f6", "TMST"}; String ULAT[]= new String[] {"\u5e93\u4f26\u65f6\u95f4", "ULAT", "\u5e93\u4f26\u590f\u4ee4\u65f6", "ULAST"}; + String UTC[] = new String[] {"\u534f\u8c03\u4e16\u754c\u65f6\u95f4", "UTC", + "\u534f\u8c03\u4e16\u754c\u65f6\u95f4", "UTC"}; + String UZT[] = new String[] {"\u4e4c\u5179\u522b\u514b\u65af\u5766\u65f6\u95f4", "UZT", + "\u4e4c\u5179\u522b\u514b\u65af\u5766\u590f\u4ee4\u65f6", "UZST"}; + String VICTORIA[] = new String[] {"\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\uff08\u7ef4\u591a\u5229\u4e9a\uff09", "EST", + "\u4e1c\u90e8\u590f\u4ee4\u65f6\uff08\u7ef4\u591a\u5229\u4e9a\uff09", "EST"}; + String VLAT[] = new String[] {"\u6d77\u53c2\u5d34\u65f6\u95f4", "VLAT", + "\u6d77\u53c2\u5d34\u590f\u4ee4\u65f6", "VLAST"}; String WART[] = new String[] {"\u897f\u963f\u6839\u5ef7\u65f6\u95f4", "WART", "\u897f\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"}; String WAT[] = new String[] {"\u897f\u975e\u65f6\u95f4", "WAT", @@ -185,18 +197,10 @@ "\u897f\u5370\u5ea6\u5c3c\u897f\u4e9a\u590f\u4ee4\u65f6", "WIST"}; String WST_AUS[] = new String[] {"\u897f\u90e8\u6807\u51c6\u65f6\u95f4\uff08\u6fb3\u5927\u5229\u4e9a\uff09", "WST", "\u897f\u90e8\u590f\u4ee4\u65f6\uff08\u6fb3\u5927\u5229\u4e9a\uff09", "WST"}; - String SAMOA[] = new String[] {"\u8428\u6469\u4e9a\u7fa4\u5c9b\u6807\u51c6\u65f6\u95f4", "SST", - "\u8428\u6469\u4e9a\u7fa4\u5c9b\u590f\u4ee4\u65f6", "SDT"}; String WST_SAMOA[] = new String[] {"\u897f\u8428\u6469\u4e9a\u65f6\u95f4", "WST", "\u897f\u8428\u6469\u4e9a\u590f\u4ee4\u65f6", "WSDT"}; - String ChST[] = new String[] {"Chamorro \u6807\u51c6\u65f6\u95f4", "ChST", - "Chamorro \u590f\u4ee4\u65f6", "ChDT"}; - String VICTORIA[] = new String[] {"\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\uff08\u7ef4\u591a\u5229\u4e9a\uff09", "EST", - "\u4e1c\u90e8\u590f\u4ee4\u65f6\uff08\u7ef4\u591a\u5229\u4e9a\uff09", "EST"}; - String UTC[] = new String[] {"\u534f\u8c03\u4e16\u754c\u65f6\u95f4", "UTC", - "\u534f\u8c03\u4e16\u754c\u65f6\u95f4", "UTC"}; - String UZT[] = new String[] {"\u4e4c\u5179\u522b\u514b\u65af\u5766\u65f6\u95f4", "UZT", - "\u4e4c\u5179\u522b\u514b\u65af\u5766\u590f\u4ee4\u65f6", "UZST"}; + String YAKT[] = new String[] {"\u4e9a\u5e93\u6b21\u514b\u65f6\u95f4", "YAKT", + "\u4e9a\u5e93\u6b21\u514b\u590f\u4ee4\u65f6", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"\u514b\u62c9\u65af\u8bfa\u4e9a\u5c14\u65af\u514b\u65f6\u95f4", "KRAT", "\u514b\u62c9\u65af\u8bfa\u4e9a\u5c14\u65af\u514b\u590f\u4ee4\u65f6", "KRAST"}}, @@ -581,11 +586,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"\u6d77\u53c2\u5d34\u65f6\u95f4", "VLAT", - "\u6d77\u53c2\u5d34\u590f\u4ee4\u65f6", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"\u4e9a\u5e93\u6b21\u514b\u65f6\u95f4", "YAKT", - "\u4e9a\u5e93\u6b21\u514b\u590f\u4ee4\u65f6", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Yekaterinburg \u65f6\u95f4", "YEKT", "Yekaterinburg \u590f\u4ee4\u65f6", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -669,6 +673,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -748,7 +753,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"\u4e2d\u6b27\u65f6\u95f4", "MET", "\u4e2d\u6b27\u590f\u4ee4\u65f6", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,6 +75,8 @@ "\u4e2d\u6b50\u590f\u4ee4\u6642\u9593", "CEST"}; String CHAST[] = new String[] {"\u67e5\u5766\u6a19\u6e96\u6642\u9593", "CHAST", "\u67e5\u5766\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "CHADT"}; + String ChST[] = new String[] {"\u67e5\u83ab\u6d1b\u6a19\u6e96\u6642\u9593", "ChST", + "\u67e5\u83ab\u6d1b\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "ChDT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", "Chuuk Summer Time", "CHUST"}; String CIT[] = new String[] {"\u4e2d\u5370\u5ea6\u5c3c\u897f\u4e9e\u6642\u9593", "CIT", @@ -161,6 +163,8 @@ "Pohnpei Summer Time", "PONST"}; String PST[] = new String[] {"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593", "PST", "\u592a\u5e73\u6d0b\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "PDT"}; + String SAMOA[] = new String[] {"\u85a9\u6469\u4e9e\u6a19\u6e96\u6642\u9593", "SST", + "\u85a9\u6469\u4e9e\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "SDT"}; String SAST[] = new String[] {"\u5357\u975e\u6a19\u6e96\u6642\u9593", "SAST", "\u5357\u975e\u590f\u4ee4\u6642\u9593", "SAST"}; String SBT[] = new String[] {"\u6240\u7f85\u9580\u7fa4\u5cf6\u6642\u9593", "SBT", @@ -175,7 +179,15 @@ "\u571f\u5eab\u66fc\u590f\u4ee4\u6642\u9593", "TMST"}; String ULAT[]= new String[] {"\u5eab\u502b\u6642\u9593", "ULAT", "\u5eab\u502b\u590f\u4ee4\u6642\u9593", "ULAST"}; - String WART[] = new String[] {"\u897f\u963f\u6839\u5ef7\u6642\u9593", "WART", + String UTC[] = new String[] {"\u5354\u8abf\u4e16\u754c\u6642\u9593", "UTC", + "\u5354\u8abf\u4e16\u754c\u6642\u9593", "UTC"}; + String UZT[] = new String[] {"\u70cf\u8332\u5225\u514b\u65af\u5766\u6642\u9593", "UZT", + "\u70cf\u8332\u5225\u514b\u65af\u5766\u590f\u4ee4\u6642\u9593", "UZST"}; + String VICTORIA[] = new String[] {"\u6771\u90e8\u6a19\u6e96\u6642\u9593 (\u7dad\u591a\u5229\u4e9e\u90a6)", "EST", + "\u6771\u90e8\u590f\u4ee4\u6642\u9593 (\u7dad\u591a\u5229\u4e9e\u90a6)", "EST"}; + String VLAT[] = new String[] {"\u6d77\u53c3\u5d34\u6642\u9593", "VLAT", + "\u6d77\u53c3\u5d34\u590f\u4ee4\u6642\u9593", "VLAST"}; + String WART[] = new String[] {"\u897f\u963f\u6839\u5ef7\u6642\u9593", "WART", "\u897f\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"}; String WAT[] = new String[] {"\u897f\u975e\u6642\u9593", "WAT", "\u897f\u975e\u590f\u4ee4\u6642\u9593", "WAST"}; @@ -185,18 +197,10 @@ "\u897f\u5370\u5c3c\u590f\u4ee4\u6642\u9593", "WIST"}; String WST_AUS[] = new String[] {"\u897f\u65b9\u6a19\u6e96\u6642\u9593 (\u6fb3\u5927\u5229\u4e9e)", "WST", "\u897f\u65b9\u590f\u4ee4\u6642\u9593 (\u6fb3\u5927\u5229\u4e9e)", "WST"}; - String SAMOA[] = new String[] {"\u85a9\u6469\u4e9e\u6a19\u6e96\u6642\u9593", "SST", - "\u85a9\u6469\u4e9e\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "SDT"}; String WST_SAMOA[] = new String[] {"\u897f\u85a9\u6469\u4e9e\u6642\u9593", "WST", "\u897f\u85a9\u6469\u4e9e\u590f\u4ee4\u6642\u9593", "WSDT"}; - String ChST[] = new String[] {"\u67e5\u83ab\u6d1b\u6a19\u6e96\u6642\u9593", "ChST", - "\u67e5\u83ab\u6d1b\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "ChDT"}; - String VICTORIA[] = new String[] {"\u6771\u90e8\u6a19\u6e96\u6642\u9593 (\u7dad\u591a\u5229\u4e9e\u90a6)", "EST", - "\u6771\u90e8\u590f\u4ee4\u6642\u9593 (\u7dad\u591a\u5229\u4e9e\u90a6)", "EST"}; - String UTC[] = new String[] {"\u5354\u8abf\u4e16\u754c\u6642\u9593", "UTC", - "\u5354\u8abf\u4e16\u754c\u6642\u9593", "UTC"}; - String UZT[] = new String[] {"\u70cf\u8332\u5225\u514b\u65af\u5766\u6642\u9593", "UZT", - "\u70cf\u8332\u5225\u514b\u65af\u5766\u590f\u4ee4\u6642\u9593", "UZST"}; + String YAKT[] = new String[] {"\u4e9e\u5eab\u6b21\u514b\u6642\u9593", "YAKT", + "\u4e9e\u5eab\u6b21\u514b\u590f\u4ee4\u6642\u9593", "YAKST"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -287,7 +291,7 @@ {"Africa/Porto-Novo", WAT}, {"Africa/Sao_Tome", GMT}, {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, + {"Africa/Tripoli", CET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, {"America/Adak", HAST}, @@ -533,6 +537,7 @@ {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, + {"Asia/Khandyga", YAKT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"\u514b\u62c9\u65af\u8afe\u4e9e\u723e\u65af\u514b\u6642\u9593", "KRAT", "\u514b\u62c9\u65af\u8afe\u4e9e\u723e\u65af\u514b\u590f\u4ee4\u6642\u9593", "KRAST"}}, @@ -582,11 +587,10 @@ {"Asia/Ulaanbaatar", ULAT}, {"Asia/Ulan_Bator", ULAT}, {"Asia/Urumqi", CTT}, + {"Asia/Ust-Nera", VLAT}, {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"\u6d77\u53c3\u5d34\u6642\u9593", "VLAT", - "\u6d77\u53c3\u5d34\u590f\u4ee4\u6642\u9593", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"\u4e9e\u5eab\u6b21\u514b\u6642\u9593", "YAKT", - "\u4e9e\u5eab\u6b21\u514b\u590f\u4ee4\u6642\u9593", "YAKST"}}, + {"Asia/Vladivostok", VLAT}, + {"Asia/Yakutsk", YAKT}, {"Asia/Yekaterinburg", new String[] {"Yekaterinburg \u6642\u9593", "YEKT", "Yekaterinburg \u590f\u4ee4\u6642\u9593", "YEKST"}}, {"Asia/Yerevan", ARMT}, @@ -670,6 +674,7 @@ {"Europe/Bratislava", CET}, {"Europe/Brussels", CET}, {"Europe/Budapest", CET}, + {"Europe/Busingen", CET}, {"Europe/Chisinau", EET}, {"Europe/Copenhagen", CET}, {"Europe/Dublin", DUBLIN}, @@ -749,7 +754,7 @@ {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, - {"Libya", EET}, + {"Libya", CET}, {"MET", new String[] {"\u4e2d\u6b50\u6642\u9593", "MET", "\u4e2d\u6b50\u590f\u4ee4\u6642\u9593", "MEST"}}, {"Mexico/BajaNorte", PST},
--- a/src/share/lib/security/java.security-windows Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/lib/security/java.security-windows Fri Jun 21 15:46:14 2013 -0500 @@ -149,7 +149,7 @@ com.sun.org.apache.xml.internal.utils.,\ com.sun.org.apache.xml.internal.security.,\ com.sun.org.glassfish.,\ - org.jcp.xml.dsig.internal.\ + org.jcp.xml.dsig.internal.,\ com.sun.java.accessibility. # @@ -187,7 +187,7 @@ com.sun.org.apache.xml.internal.utils.,\ com.sun.org.apache.xml.internal.security.,\ com.sun.org.glassfish.,\ - org.jcp.xml.dsig.internal.\ + org.jcp.xml.dsig.internal.,\ com.sun.java.accessibility. #
--- a/src/share/native/sun/awt/medialib/awt_ImagingLib.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/awt/medialib/awt_ImagingLib.c Fri Jun 21 15:46:14 2013 -0500 @@ -1302,20 +1302,24 @@ return 0; } - lut_nbands = (*env)->GetArrayLength(env, jtableArrays); + nbands = setImageHints(env, srcImageP, dstImageP, FALSE, TRUE, + FALSE, &hint); + + if (nbands < 1 || nbands > srcImageP->cmodel.numComponents) { + /* Can't handle any custom images */ + awt_freeParsedImage(srcImageP, TRUE); + awt_freeParsedImage(dstImageP, TRUE); + return 0; + } ncomponents = srcImageP->cmodel.isDefaultCompatCM ? 4 : srcImageP->cmodel.numComponents; - if (lut_nbands > ncomponents) { - lut_nbands = ncomponents; - } - /* Make sure that color order can be used for * re-ordering of lookup arrays. */ - for (i = 0; i < ncomponents; i++) { + for (i = 0; i < nbands; i++) { int idx = srcImageP->hints.colorOrder[i]; if (idx < 0 || idx >= ncomponents) { @@ -1325,6 +1329,12 @@ } } + lut_nbands = (*env)->GetArrayLength(env, jtableArrays); + + if (lut_nbands > ncomponents) { + lut_nbands = ncomponents; + } + tbl = NULL; if (SAFE_TO_ALLOC_2(ncomponents, sizeof(unsigned char *))) { tbl = (unsigned char **) @@ -1367,17 +1377,6 @@ } } - nbands = setImageHints(env, srcImageP, dstImageP, FALSE, TRUE, - FALSE, &hint); - if (nbands < 1) { - /* Can't handle any custom images */ - free(tbl); - free(jtable); - awt_freeParsedImage(srcImageP, TRUE); - awt_freeParsedImage(dstImageP, TRUE); - return 0; - } - /* Allocate the arrays */ if (allocateArray(env, srcImageP, &src, &sdata, TRUE, FALSE, FALSE) < 0) { /* Must be some problem */
--- a/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,6 +30,8 @@ #include "sizecalc.h" +#include "sizecalc.h" + #define GIF_TRANSPARENT 0x01 #define GIF_USER_INPUT 0x02 #define GIF_DISPOSE_MASK 0x07
--- a/src/share/native/sun/font/layout/ContextualGlyphInsertion.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ContextualGlyphInsertion.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -49,6 +49,11 @@ { }; +struct ContextualGlyphInsertionHeader2 : MorphStateTableHeader2 +{ + le_uint32 insertionTableOffset; +}; + enum ContextualGlyphInsertionFlags { cgiSetMark = 0x8000, @@ -61,11 +66,17 @@ cgiMarkedInsertCountMask = 0x001F }; -struct LigatureSubstitutionStateEntry : StateEntry +struct ContextualGlyphInsertionStateEntry : StateEntry { ByteOffset currentInsertionListOffset; ByteOffset markedInsertionListOffset; }; +struct ContextualGlyphInsertionStateEntry2 : StateEntry2 +{ + le_uint16 currentInsertionListIndex; + le_uint16 markedInsertionListIndex; +}; + U_NAMESPACE_END #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/ContextualGlyphInsertionProc2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,139 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "StateTables.h" +#include "MorphStateTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "ContextualGlyphInsertionProc2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphInsertionProcessor2) + +ContextualGlyphInsertionProcessor2::ContextualGlyphInsertionProcessor2( + const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : StateTableProcessor2(morphSubtableHeader, success) +{ + contextualGlyphHeader = LEReferenceTo<ContextualGlyphInsertionHeader2>(morphSubtableHeader, success); + if(LE_FAILURE(success) || !contextualGlyphHeader.isValid()) return; + le_uint32 insertionTableOffset = SWAPL(contextualGlyphHeader->insertionTableOffset); + insertionTable = LEReferenceToArrayOf<le_uint16>(stHeader, success, insertionTableOffset, LE_UNBOUNDED_ARRAY); + entryTable = LEReferenceToArrayOf<ContextualGlyphInsertionStateEntry2>(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY); +} + +ContextualGlyphInsertionProcessor2::~ContextualGlyphInsertionProcessor2() +{ +} + +void ContextualGlyphInsertionProcessor2::beginStateTable() +{ + markGlyph = 0; +} + +void ContextualGlyphInsertionProcessor2::doInsertion(LEGlyphStorage &glyphStorage, + le_int16 atGlyph, + le_int16 &index, + le_int16 count, + le_bool /* isKashidaLike */, + le_bool isBefore, + LEErrorCode &success) { + LEGlyphID *insertGlyphs = glyphStorage.insertGlyphs(atGlyph, count + 1, success); + + if(LE_FAILURE(success) || insertGlyphs==NULL) { + return; + } + + // Note: Kashida vs Split Vowel seems to only affect selection and highlighting. + // We note the flag, but do not layout different. + // https://developer.apple.com/fonts/TTRefMan/RM06/Chap6mort.html + + le_int16 targetIndex = 0; + if(isBefore) { + // insert at beginning + insertGlyphs[targetIndex++] = glyphStorage[atGlyph]; + } else { + // insert at end + insertGlyphs[count] = glyphStorage[atGlyph]; + } + + while(count--) { + insertGlyphs[targetIndex++] = insertionTable.getObject(index++, success); + } + glyphStorage.applyInsertions(); +} + +le_uint16 ContextualGlyphInsertionProcessor2::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, + EntryTableIndex2 index, LEErrorCode &success) +{ + const ContextualGlyphInsertionStateEntry2 *entry = entryTable.getAlias(index, success); + + if(LE_FAILURE(success)) return 0; // TODO- which state? + + le_uint16 newState = SWAPW(entry->newStateIndex); + le_uint16 flags = SWAPW(entry->flags); + + le_int16 markIndex = SWAPW(entry->markedInsertionListIndex); + if (markIndex > 0) { + le_int16 count = (flags & cgiMarkedInsertCountMask) >> 5; + le_bool isKashidaLike = (flags & cgiMarkedIsKashidaLike); + le_bool isBefore = (flags & cgiMarkInsertBefore); + doInsertion(glyphStorage, markGlyph, markIndex, count, isKashidaLike, isBefore, success); + } + + le_int16 currIndex = SWAPW(entry->currentInsertionListIndex); + if (currIndex > 0) { + le_int16 count = flags & cgiCurrentInsertCountMask; + le_bool isKashidaLike = (flags & cgiCurrentIsKashidaLike); + le_bool isBefore = (flags & cgiCurrentInsertBefore); + doInsertion(glyphStorage, currGlyph, currIndex, count, isKashidaLike, isBefore, success); + } + + if (flags & cgiSetMark) { + markGlyph = currGlyph; + } + + if (!(flags & cgiDontAdvance)) { + currGlyph += dir; + } + + return newState; +} + +void ContextualGlyphInsertionProcessor2::endStateTable() +{ +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/ContextualGlyphInsertionProc2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,106 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 2013 - All Rights Reserved + * + */ + +#ifndef __CONTEXTUALGLYPHINSERTIONPROCESSOR2_H +#define __CONTEXTUALGLYPHINSERTIONPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "ContextualGlyphInsertionProc2.h" +#include "ContextualGlyphInsertion.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class ContextualGlyphInsertionProcessor2 : public StateTableProcessor2 +{ +public: + virtual void beginStateTable(); + + virtual le_uint16 processStateEntry(LEGlyphStorage &glyphStorage, + le_int32 &currGlyph, EntryTableIndex2 index, LEErrorCode &success); + + virtual void endStateTable(); + + ContextualGlyphInsertionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + virtual ~ContextualGlyphInsertionProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + ContextualGlyphInsertionProcessor2(); + + /** + * Perform the actual insertion + * @param atGlyph index of glyph to insert at + * @param index index into the insertionTable (in/out) + * @param count number of insertions + * @param isKashidaLike Kashida like (vs Split Vowel like). No effect currently. + * @param isBefore if true, insert extra glyphs before the marked glyph + */ + void doInsertion(LEGlyphStorage &glyphStorage, + le_int16 atGlyph, + le_int16 &index, + le_int16 count, + le_bool isKashidaLike, + le_bool isBefore, + LEErrorCode &success); + + +protected: + le_int32 markGlyph; + LEReferenceToArrayOf<le_uint16> insertionTable; + LEReferenceToArrayOf<ContextualGlyphInsertionStateEntry2> entryTable; + LEReferenceTo<ContextualGlyphInsertionHeader2> contextualGlyphHeader; +}; + +U_NAMESPACE_END +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,170 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "StateTables.h" +#include "MorphStateTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "ContextualGlyphSubstProc2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ContextualGlyphSubstitutionProcessor2) + +ContextualGlyphSubstitutionProcessor2::ContextualGlyphSubstitutionProcessor2( + const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : StateTableProcessor2(morphSubtableHeader, success), contextualGlyphHeader(morphSubtableHeader, success) +{ + if(LE_FAILURE(success)) return; + le_uint32 perGlyphTableOffset = SWAPL(contextualGlyphHeader->perGlyphTableOffset); + perGlyphTable = LEReferenceToArrayOf<le_uint32> (stHeader, success, perGlyphTableOffset, LE_UNBOUNDED_ARRAY); + entryTable = LEReferenceToArrayOf<ContextualGlyphStateEntry2>(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY); +} + +ContextualGlyphSubstitutionProcessor2::~ContextualGlyphSubstitutionProcessor2() +{ +} + +void ContextualGlyphSubstitutionProcessor2::beginStateTable() +{ + markGlyph = 0; +} + +le_uint16 ContextualGlyphSubstitutionProcessor2::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, + EntryTableIndex2 index, LEErrorCode &success) +{ + if(LE_FAILURE(success)) return 0; + const ContextualGlyphStateEntry2 *entry = entryTable.getAlias(index, success); + if(LE_FAILURE(success)) return 0; + le_uint16 newState = SWAPW(entry->newStateIndex); + le_uint16 flags = SWAPW(entry->flags); + le_int16 markIndex = SWAPW(entry->markIndex); + le_int16 currIndex = SWAPW(entry->currIndex); + + if (markIndex != -1) { + le_uint32 offset = SWAPL(perGlyphTable(markIndex, success)); + LEGlyphID mGlyph = glyphStorage[markGlyph]; + TTGlyphID newGlyph = lookup(offset, mGlyph, success); + glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph); + } + + if (currIndex != -1) { + le_uint32 offset = SWAPL(perGlyphTable(currIndex, success)); + LEGlyphID thisGlyph = glyphStorage[currGlyph]; + TTGlyphID newGlyph = lookup(offset, thisGlyph, success); + glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph); + } + + if (flags & cgsSetMark) { + markGlyph = currGlyph; + } + + if (!(flags & cgsDontAdvance)) { + currGlyph += dir; + } + + return newState; +} + +TTGlyphID ContextualGlyphSubstitutionProcessor2::lookup(le_uint32 offset, LEGlyphID gid, LEErrorCode &success) +{ + TTGlyphID newGlyph = 0xFFFF; + if(LE_FAILURE(success)) return newGlyph; + LEReferenceTo<LookupTable> lookupTable(perGlyphTable, success, offset); + if(LE_FAILURE(success)) return newGlyph; + le_int16 format = SWAPW(lookupTable->format); + + switch (format) { + case ltfSimpleArray: { +#ifdef TEST_FORMAT + // Disabled pending for design review + LEReferenceTo<SimpleArrayLookupTable> lookupTable0(lookupTable, success); + LEReferenceToArrayOf<LookupValue> valueArray(lookupTable0, success, &lookupTable0->valueArray[0], LE_UNBOUNDED_ARRAY); + if(LE_FAILURE(success)) return newGlyph; + TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid); + newGlyph = SWAPW(lookupTable0->valueArray(glyphCode, success)); +#endif + break; + } + case ltfSegmentSingle: { +#ifdef TEST_FORMAT + // Disabled pending for design review + LEReferenceTo<SegmentSingleLookupTable> lookupTable2 = (SegmentSingleLookupTable *) lookupTable; + const LookupSegment *segment = lookupTable2->lookupSegment(lookupTable2->segments, gid); + if (segment != NULL) { + newGlyph = SWAPW(segment->value); + } +#endif + break; + } + case ltfSegmentArray: { + //printf("Context Lookup Table Format4: specific interpretation needed!\n"); + break; + } + case ltfSingleTable: + { +#ifdef TEST_FORMAT + // Disabled pending for design review + LEReferenceTo<SingleTableLookupTable> lookupTable6 = (SingleTableLookupTable *) lookupTable; + const LEReferenceTo<LookupSingle> segment = lookupTable6->lookupSingle(lookupTable6->entries, gid); + if (segment != NULL) { + newGlyph = SWAPW(segment->value); + } +#endif + break; + } + case ltfTrimmedArray: { + LEReferenceTo<TrimmedArrayLookupTable> lookupTable8(lookupTable, success); + if (LE_FAILURE(success)) return newGlyph; + TTGlyphID firstGlyph = SWAPW(lookupTable8->firstGlyph); + TTGlyphID glyphCount = SWAPW(lookupTable8->glyphCount); + TTGlyphID lastGlyph = firstGlyph + glyphCount; + TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid); + if ((glyphCode >= firstGlyph) && (glyphCode < lastGlyph)) { + LEReferenceToArrayOf<LookupValue> valueArray(lookupTable8, success, &lookupTable8->valueArray[0], glyphCount); + newGlyph = SWAPW(valueArray(glyphCode - firstGlyph, success)); + } + } + default: + break; + } + return newGlyph; +} + +void ContextualGlyphSubstitutionProcessor2::endStateTable() +{ +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,92 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR2_H +#define __CONTEXTUALGLYPHSUBSTITUTIONPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "ContextualGlyphSubstitution.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class ContextualGlyphSubstitutionProcessor2 : public StateTableProcessor2 +{ +public: + virtual void beginStateTable(); + + virtual le_uint16 processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex2 index, LEErrorCode &success); + + virtual void endStateTable(); + + ContextualGlyphSubstitutionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + virtual ~ContextualGlyphSubstitutionProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + ContextualGlyphSubstitutionProcessor2(); + TTGlyphID lookup(le_uint32 offset, LEGlyphID gid, LEErrorCode &success); + +protected: + LEReferenceToArrayOf<le_uint32> perGlyphTable; + LEReferenceToArrayOf<ContextualGlyphStateEntry2> entryTable; + + le_int16 perGlyphTableFormat; + le_int32 markGlyph; + + LEReferenceTo<ContextualGlyphHeader2> contextualGlyphHeader; + +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ContextualGlyphSubstitution.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -49,6 +49,11 @@ ByteOffset substitutionTableOffset; }; +struct ContextualGlyphHeader2 : MorphStateTableHeader2 +{ + le_uint32 perGlyphTableOffset; // no more substitution tables +}; + enum ContextualGlyphSubstitutionFlags { cgsSetMark = 0x8000, @@ -62,5 +67,11 @@ WordOffset currOffset; }; +struct ContextualGlyphStateEntry2 : StateEntry2 +{ + le_uint16 markIndex; + le_uint16 currIndex; +}; + U_NAMESPACE_END #endif
--- a/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -218,6 +218,9 @@ LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { le_uint16 srSetCount = SWAPW(subRuleSetCount); @@ -267,6 +270,9 @@ LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { const ClassDefinitionTable *classDefinitionTable = @@ -395,6 +401,9 @@ LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { le_uint16 srSetCount = SWAPW(chainSubRuleSetCount); @@ -466,6 +475,9 @@ LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(lookupProcessor->getReference(), glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { const ClassDefinitionTable *backtrackClassDefinitionTable =
--- a/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/CursiveAttachmentSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -45,7 +45,7 @@ le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success); le_uint16 eeCount = SWAPW(entryExitCount); - if (coverageIndex < 0 || coverageIndex >= eeCount) { + if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) { glyphIterator->setCursiveGlyph(); return 0; }
--- a/src/share/native/sun/font/layout/ExtensionSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ExtensionSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -44,10 +44,10 @@ #define READ_LONG(code) (le_uint32)((SWAPW(*(le_uint16*)&code) << 16) + SWAPW(*(((le_uint16*)&code) + 1))) // FIXME: should look at the format too... maybe have a sub-class for it? -le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, +le_uint32 ExtensionSubtable::process(const LEReferenceTo<ExtensionSubtable> &thisRef, + const LookupProcessor *lookupProcessor, le_uint16 lookupType, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const { - const LEReferenceTo<ExtensionSubtable> thisRef(lookupProcessor->getReference(), success); // create a reference to this if (LE_FAILURE(success)) { return 0; @@ -57,7 +57,7 @@ if (elt != lookupType) { le_uint32 extOffset = READ_LONG(extensionOffset); - LEReferenceTo<LookupSubtable> subtable(thisRef, success, extOffset); + LEReferenceTo<LookupSubtable> subtable(thisRef, success, extOffset); if(LE_SUCCESS(success)) { return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);
--- a/src/share/native/sun/font/layout/ExtensionSubtables.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ExtensionSubtables.h Fri Jun 21 15:46:14 2013 -0500 @@ -52,7 +52,8 @@ le_uint16 extensionLookupType; le_uint32 extensionOffset; - le_uint32 process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, + le_uint32 process(const LEReferenceTo<ExtensionSubtable> &extRef, + const LookupProcessor *lookupProcessor, le_uint16 lookupType, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/GXLayoutEngine2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,91 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "LayoutEngine.h" +#include "GXLayoutEngine2.h" +#include "LEGlyphStorage.h" +#include "MorphTables.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine2) + +GXLayoutEngine2::GXLayoutEngine2(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader2> &morphTable, le_int32 typoFlags, LEErrorCode &success) + : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fMorphTable(morphTable) +{ + // nothing else to do? +} + +GXLayoutEngine2::~GXLayoutEngine2() +{ + reset(); +} + +// apply 'morx' table +le_int32 GXLayoutEngine2::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + if (LE_FAILURE(success)) { + return 0; + } + + if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { + success = LE_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + + mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success); + + if (LE_FAILURE(success)) { + return 0; + } + + fMorphTable->process(fMorphTable, glyphStorage, fTypoFlags, success); + return count; +} + +// apply positional tables +void GXLayoutEngine2::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/, + LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success) +{ + if (LE_FAILURE(success)) { + return; + } + + if (chars == NULL || offset < 0 || count < 0) { + success = LE_ILLEGAL_ARGUMENT_ERROR; + return; + } + + // FIXME: no positional processing yet... +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/GXLayoutEngine2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,149 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __GXLAYOUTENGINE2_H +#define __GXLAYOUTENGINE2_H + +#include "LETypes.h" +#include "LayoutEngine.h" + +#include "MorphTables.h" + +U_NAMESPACE_BEGIN + +class LEFontInstance; +class LEGlyphStorage; + +/** + * This class implements layout for QuickDraw GX or Apple Advanced Typograyph (AAT) + * fonts. A font is a GX or AAT font if it contains a 'mort' table. See Apple's + * TrueType Reference Manual (http://fonts.apple.com/TTRefMan/index.html) for details. + * Information about 'mort' tables is in the chapter titled "Font Files." + * + * @internal + */ +class GXLayoutEngine2 : public LayoutEngine +{ +public: + /** + * This is the main constructor. It constructs an instance of GXLayoutEngine for + * a particular font, script and language. It takes the 'mort' table as a parameter since + * LayoutEngine::layoutEngineFactory has to read the 'mort' table to know that it has a + * GX font. + * + * Note: GX and AAT fonts don't contain any script and language specific tables, so + * the script and language are ignored. + * + * @param fontInstance - the font + * @param scriptCode - the script + * @param langaugeCode - the language + * @param morphTable - the 'mort' table + * @param success - set to an error code if the operation fails + * + * @see LayoutEngine::layoutEngineFactory + * @see ScriptAndLangaugeTags.h for script and language codes + * + * @internal + */ + GXLayoutEngine2(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader2> &morphTable, le_int32 typoFlags, LEErrorCode &success); + + /** + * The destructor, virtual for correct polymorphic invocation. + * + * @internal + */ + virtual ~GXLayoutEngine2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +protected: + + /** + * The address of the 'mort' table + * + * @internal + */ + const LEReferenceTo<MorphTableHeader2> fMorphTable; + + /** + * This method does GX layout using the font's 'mort' table. It converts the + * input character codes to glyph indices using mapCharsToGlyphs, and then + * applies the 'mort' table. + * + * Input parameters: + * @param chars - the input character context + * @param offset - the index of the first character to process + * @param count - the number of characters to process + * @param max - the number of characters in the input context + * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run + * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. + * + * Output parameters: + * @param success - set to an error code if the operation fails + * + * @return the number of glyphs in the glyph index array + * + * @internal + */ + virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success); + + /** + * This method adjusts the glyph positions using the font's + * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables. + * + * Input parameters: + * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed. + * + * Output parameters: + * @param success - set to an error code if the operation fails + * + * @internal + */ + virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, + LEGlyphStorage &glyphStorage, LEErrorCode &success); + +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/GlyphPosnLookupProc.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -168,7 +168,7 @@ { LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success); - delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); + delta = subtable->process(subtable, this, lookupType, glyphIterator, fontInstance, success); break; }
--- a/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/GlyphSubstLookupProc.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -139,7 +139,7 @@ { const LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success); - delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); + delta = subtable->process(subtable, this, lookupType, glyphIterator, fontInstance, success); break; }
--- a/src/share/native/sun/font/layout/IndicClassTables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/IndicClassTables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -186,13 +186,15 @@ }; // FIXME: Should some of the bb's be pb's? (KA, NA, MA, YA, VA, etc. (approx 13)) +// U+C43 and U+C44 are _lm here not _dr. Similar to the situation with U+CC3 and +// U+CC4 in Kannada below. static const IndicClassTable::CharClass teluCharClasses[] = { _xx, _mp, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, // 0C00 - 0C0F _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, // 0C10 - 0C1F _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, // 0C20 - 0C2F _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, // 0C30 - 0C3F - _da, _dr, _dr, _dr, _dr, _xx, _a1, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, // 0C40 - 0C4F + _da, _dr, _dr, _lm, _lm, _xx, _a1, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, // 0C40 - 0C4F _xx, _xx, _xx, _xx, _xx, _da, _m2, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, // 0C50 - 0C5F _iv, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx // 0C60 - 0C6F };
--- a/src/share/native/sun/font/layout/IndicRearrangement.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/IndicRearrangement.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -49,6 +49,10 @@ { }; +struct IndicRearrangementSubtableHeader2 : MorphStateTableHeader2 +{ +}; + enum IndicRearrangementFlags { irfMarkFirst = 0x8000, @@ -85,6 +89,10 @@ { }; +struct IndicRearrangementStateEntry2 : StateEntry2 +{ +}; + U_NAMESPACE_END #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/IndicRearrangementProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,425 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "StateTables.h" +#include "MorphStateTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "IndicRearrangementProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor2) + +IndicRearrangementProcessor2::IndicRearrangementProcessor2( + const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : StateTableProcessor2(morphSubtableHeader, success), indicRearrangementSubtableHeader(morphSubtableHeader, success), + entryTable(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY) +{ +} + +IndicRearrangementProcessor2::~IndicRearrangementProcessor2() +{ +} + +void IndicRearrangementProcessor2::beginStateTable() +{ + firstGlyph = 0; + lastGlyph = 0; +} + +le_uint16 IndicRearrangementProcessor2::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, + EntryTableIndex2 index, LEErrorCode &success) +{ + const IndicRearrangementStateEntry2 *entry = entryTable.getAlias(index, success); + if (LE_FAILURE(success)) return 0; // TODO - what to return in bad state? + le_uint16 newState = SWAPW(entry->newStateIndex); // index to the new state + IndicRearrangementFlags flags = (IndicRearrangementFlags) SWAPW(entry->flags); + + if (flags & irfMarkFirst) { + firstGlyph = currGlyph; + } + + if (flags & irfMarkLast) { + lastGlyph = currGlyph; + } + + doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask)); + + if (!(flags & irfDontAdvance)) { + currGlyph += dir; + } + + return newState; // index to new state +} + +void IndicRearrangementProcessor2::endStateTable() +{ +} + +void IndicRearrangementProcessor2::doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb) const +{ + LEGlyphID a, b, c, d; + le_int32 ia, ib, ic, id, ix, x; + LEErrorCode success = LE_NO_ERROR; + + switch(verb) + { + case irvNoAction: + break; + + case irvxA: + a = glyphStorage[firstGlyph]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + x = firstGlyph + 1; + + while (x <= lastGlyph) { + glyphStorage[x - 1] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x - 1, ix, success); + x += 1; + } + + glyphStorage[lastGlyph] = a; + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvDx: + d = glyphStorage[lastGlyph]; + id = glyphStorage.getCharIndex(lastGlyph, success); + x = lastGlyph - 1; + + while (x >= firstGlyph) { + glyphStorage[x + 1] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x + 1, ix, success); + x -= 1; + } + + glyphStorage[firstGlyph] = d; + glyphStorage.setCharIndex(firstGlyph, id, success); + break; + + case irvDxA: + a = glyphStorage[firstGlyph]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + + glyphStorage[firstGlyph] = glyphStorage[lastGlyph]; + glyphStorage[lastGlyph] = a; + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvxAB: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + x = firstGlyph + 2; + + while (x <= lastGlyph) { + glyphStorage[x - 2] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x - 2, ix, success); + x += 1; + } + + glyphStorage[lastGlyph - 1] = a; + glyphStorage[lastGlyph] = b; + + glyphStorage.setCharIndex(lastGlyph - 1, ia, success); + glyphStorage.setCharIndex(lastGlyph, ib, success); + break; + + case irvxBA: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + x = firstGlyph + 2; + + while (x <= lastGlyph) { + glyphStorage[x - 2] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x - 2, ix, success); + x += 1; + } + + glyphStorage[lastGlyph - 1] = b; + glyphStorage[lastGlyph] = a; + + glyphStorage.setCharIndex(lastGlyph - 1, ib, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvCDx: + c = glyphStorage[lastGlyph - 1]; + d = glyphStorage[lastGlyph]; + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + x = lastGlyph - 2; + + while (x >= firstGlyph) { + glyphStorage[x + 2] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x + 2, ix, success); + x -= 1; + } + + glyphStorage[firstGlyph] = c; + glyphStorage[firstGlyph + 1] = d; + + glyphStorage.setCharIndex(firstGlyph, ic, success); + glyphStorage.setCharIndex(firstGlyph + 1, id, success); + break; + + case irvDCx: + c = glyphStorage[lastGlyph - 1]; + d = glyphStorage[lastGlyph]; + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + x = lastGlyph - 2; + + while (x >= firstGlyph) { + glyphStorage[x + 2] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x + 2, ix, success); + x -= 1; + } + + glyphStorage[firstGlyph] = d; + glyphStorage[firstGlyph + 1] = c; + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(firstGlyph + 1, ic, success); + break; + + case irvCDxA: + a = glyphStorage[firstGlyph]; + c = glyphStorage[lastGlyph - 1]; + d = glyphStorage[lastGlyph]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + x = lastGlyph - 2; + + while (x > firstGlyph) { + glyphStorage[x + 1] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x + 1, ix, success); + x -= 1; + } + + glyphStorage[firstGlyph] = c; + glyphStorage[firstGlyph + 1] = d; + glyphStorage[lastGlyph] = a; + + glyphStorage.setCharIndex(firstGlyph, ic, success); + glyphStorage.setCharIndex(firstGlyph + 1, id, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvDCxA: + a = glyphStorage[firstGlyph]; + c = glyphStorage[lastGlyph - 1]; + d = glyphStorage[lastGlyph]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + x = lastGlyph - 2; + + while (x > firstGlyph) { + glyphStorage[x + 1] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x + 1, ix, success); + x -= 1; + } + + glyphStorage[firstGlyph] = d; + glyphStorage[firstGlyph + 1] = c; + glyphStorage[lastGlyph] = a; + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(firstGlyph + 1, ic, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvDxAB: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + d = glyphStorage[lastGlyph]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + x = firstGlyph + 2; + + while (x < lastGlyph) { + glyphStorage[x - 2] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x - 2, ix, success); + x += 1; + } + + glyphStorage[firstGlyph] = d; + glyphStorage[lastGlyph - 1] = a; + glyphStorage[lastGlyph] = b; + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(lastGlyph - 1, ia, success); + glyphStorage.setCharIndex(lastGlyph, ib, success); + break; + + case irvDxBA: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + d = glyphStorage[lastGlyph]; + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + x = firstGlyph + 2; + + while (x < lastGlyph) { + glyphStorage[x - 2] = glyphStorage[x]; + ix = glyphStorage.getCharIndex(x, success); + glyphStorage.setCharIndex(x - 2, ix, success); + x += 1; + } + + glyphStorage[firstGlyph] = d; + glyphStorage[lastGlyph - 1] = b; + glyphStorage[lastGlyph] = a; + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(lastGlyph - 1, ib, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvCDxAB: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + + glyphStorage[firstGlyph] = glyphStorage[lastGlyph - 1]; + glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph]; + + glyphStorage[lastGlyph - 1] = a; + glyphStorage[lastGlyph] = b; + + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + + glyphStorage.setCharIndex(firstGlyph, ic, success); + glyphStorage.setCharIndex(firstGlyph + 1, id, success); + + glyphStorage.setCharIndex(lastGlyph - 1, ia, success); + glyphStorage.setCharIndex(lastGlyph, ib, success); + break; + + case irvCDxBA: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + + glyphStorage[firstGlyph] = glyphStorage[lastGlyph - 1]; + glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph]; + + glyphStorage[lastGlyph - 1] = b; + glyphStorage[lastGlyph] = a; + + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + + glyphStorage.setCharIndex(firstGlyph, ic, success); + glyphStorage.setCharIndex(firstGlyph + 1, id, success); + + glyphStorage.setCharIndex(lastGlyph - 1, ib, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + case irvDCxAB: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + + glyphStorage[firstGlyph] = glyphStorage[lastGlyph]; + glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph - 1]; + + glyphStorage[lastGlyph - 1] = a; + glyphStorage[lastGlyph] = b; + + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(firstGlyph + 1, ic, success); + + glyphStorage.setCharIndex(lastGlyph - 1, ia, success); + glyphStorage.setCharIndex(lastGlyph, ib, success); + break; + + case irvDCxBA: + a = glyphStorage[firstGlyph]; + b = glyphStorage[firstGlyph + 1]; + + glyphStorage[firstGlyph] = glyphStorage[lastGlyph]; + glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph - 1]; + + glyphStorage[lastGlyph - 1] = b; + glyphStorage[lastGlyph] = a; + + ia = glyphStorage.getCharIndex(firstGlyph, success); + ib = glyphStorage.getCharIndex(firstGlyph + 1, success); + ic = glyphStorage.getCharIndex(lastGlyph - 1, success); + id = glyphStorage.getCharIndex(lastGlyph, success); + + glyphStorage.setCharIndex(firstGlyph, id, success); + glyphStorage.setCharIndex(firstGlyph + 1, ic, success); + + glyphStorage.setCharIndex(lastGlyph - 1, ib, success); + glyphStorage.setCharIndex(lastGlyph, ia, success); + break; + + default: + break; + } + +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/IndicRearrangementProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,88 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __INDICREARRANGEMENTPROCESSOR2_H +#define __INDICREARRANGEMENTPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor.h" +#include "StateTableProcessor2.h" +#include "IndicRearrangement.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class IndicRearrangementProcessor2 : public StateTableProcessor2 +{ +public: + virtual void beginStateTable(); + + virtual le_uint16 processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex2 index, LEErrorCode &success); + + virtual void endStateTable(); + + void doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb) const; + + IndicRearrangementProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + virtual ~IndicRearrangementProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +protected: + le_int32 firstGlyph; + le_int32 lastGlyph; + + LEReferenceToArrayOf<IndicRearrangementStateEntry2> entryTable; + LEReferenceTo<IndicRearrangementSubtableHeader2> indicRearrangementSubtableHeader; + +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/IndicReordering.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/IndicReordering.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -266,7 +266,7 @@ le_uint32 saveAuxData = fGlyphStorage.getAuxData(i+inv_count,success); const SplitMatra *splitMatra = classTable->getSplitMatra(matraClass); int j; - for (j = 0 ; *(splitMatra)[j] != 0 ; j++) { + for (j = 0 ; j < SM_MAX_PIECES && *(splitMatra)[j] != 0 ; j++) { LEUnicode piece = (*splitMatra)[j]; if ( j == 0 ) { fOutChars[i+inv_count] = piece; @@ -357,7 +357,7 @@ const SplitMatra *splitMatra = classTable->getSplitMatra(matraClass); int i; - for (i = 0; i < 3 && (*splitMatra)[i] != 0; i += 1) { + for (i = 0; i < SM_MAX_PIECES && (*splitMatra)[i] != 0; i += 1) { LEUnicode piece = (*splitMatra)[i]; IndicClassTable::CharClass pieceClass = classTable->getCharClass(piece); @@ -1229,7 +1229,6 @@ LEUnicode currentChar; - LEUnicode virama; LEUnicode workChars[2]; LEGlyphStorage workGlyphs; @@ -1237,14 +1236,17 @@ //le_int32 offset = 0; +#if 0 +// TODO: Should this section of code have actually been doing something? // First find the relevant virama for the script we are dealing with - + LEUnicode virama; for ( currentChar = classTable->firstChar ; currentChar <= classTable->lastChar ; currentChar++ ) { if ( classTable->isVirama(currentChar)) { virama = currentChar; break; } } +#endif for ( currentChar = classTable->firstChar ; currentChar <= classTable->lastChar ; currentChar++ ) { if ( classTable->isConsonant(currentChar)) {
--- a/src/share/native/sun/font/layout/IndicReordering.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/IndicReordering.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -96,7 +96,9 @@ #define SF_POST_BASE_LIMIT_MASK 0x0000FFFFU #define SF_NO_POST_BASE_LIMIT 0x00007FFFU -typedef LEUnicode SplitMatra[3]; +#define SM_MAX_PIECES 3 + +typedef LEUnicode SplitMatra[SM_MAX_PIECES]; class MPreFixups; class LEGlyphStorage;
--- a/src/share/native/sun/font/layout/KernTable.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/KernTable.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -48,7 +48,7 @@ le_int16 value; // fword, kern value in funits }; #define KERN_PAIRINFO_SIZE 6 - +LE_CORRECT_SIZE(PairInfo, KERN_PAIRINFO_SIZE) struct Subtable_0 { le_uint16 nPairs; le_uint16 searchRange; @@ -56,6 +56,7 @@ le_uint16 rangeShift; }; #define KERN_SUBTABLE_0_HEADER_SIZE 8 +LE_CORRECT_SIZE(Subtable_0, KERN_SUBTABLE_0_HEADER_SIZE) // Kern table version 0 only struct SubtableHeader { @@ -64,6 +65,7 @@ le_uint16 coverage; }; #define KERN_SUBTABLE_HEADER_SIZE 6 +LE_CORRECT_SIZE(SubtableHeader, KERN_SUBTABLE_HEADER_SIZE) // Version 0 only, version 1 has different layout struct KernTableHeader { @@ -71,6 +73,7 @@ le_uint16 nTables; }; #define KERN_TABLE_HEADER_SIZE 4 +LE_CORRECT_SIZE(KernTableHeader, KERN_TABLE_HEADER_SIZE) #define COVERAGE_HORIZONTAL 0x1 #define COVERAGE_MINIMUM 0x2 @@ -92,8 +95,8 @@ * TODO: support multiple subtables * TODO: respect header flags */ -KernTable::KernTable(const LETableReference &table, LEErrorCode &success) - : pairs(table, success), pairsSwapped(NULL), fTable(table) +KernTable::KernTable(const LETableReference& base, LEErrorCode &success) + : pairs(), pairsSwapped(NULL), fTable(base) { if(LE_FAILURE(success) || (fTable.isEmpty())) { #if DEBUG @@ -106,7 +109,7 @@ #if DEBUG // dump first 32 bytes of header for (int i = 0; i < 64; ++i) { - fprintf(stderr, "%0.2x ", ((const char*)tableData)[i]&0xff); + fprintf(stderr, "%0.2x ", ((const char*)header.getAlias())[i]&0xff); if (((i+1)&0xf) == 0) { fprintf(stderr, "\n"); } else if (((i+1)&0x7) == 0) { @@ -140,7 +143,14 @@ #endif if(LE_SUCCESS(success) && nPairs>0) { - pairs.setToOffsetInParent(table, KERN_SUBTABLE_0_HEADER_SIZE, nPairs, success); + // pairs is an instance member, and table is on the stack. + // set 'pairs' based on table.getAlias(). This will range check it. + + pairs = LEReferenceToArrayOf<PairInfo>(fTable, // based on overall table + success, + (const PairInfo*)table.getAlias(), // subtable 0 + .. + KERN_SUBTABLE_0_HEADER_SIZE, // .. offset of header size + nPairs); // count } if (LE_SUCCESS(success) && pairs.isValid()) { pairsSwapped = (PairInfo*)(malloc(nPairs*sizeof(PairInfo))); @@ -152,6 +162,11 @@ fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it } +#if 0 + fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairs.getAlias()); + fprintf(stderr, " searchRange: %d entrySelector: %d rangeShift: %d\n", searchRange, entrySelector, rangeShift); + fprintf(stderr, "[[ ignored font table entries: range %d selector %d shift %d ]]\n", SWAPW(table->searchRange), SWAPW(table->entrySelector), SWAPW(table->rangeShift)); +#endif #if DEBUG fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairs); fprintf(stderr, @@ -208,7 +223,8 @@ le_uint32 key = storage[0]; // no need to mask off high bits float adjust = 0; - for (int i = 1, e = storage.getGlyphCount(); i < e; ++i) { + + for (int i = 1, e = storage.getGlyphCount(); LE_SUCCESS(success)&& i < e; ++i) { key = key << 16 | (storage[i] & 0xffff); // argh, to do a binary search, we need to have the pair list in sorted order
--- a/src/share/native/sun/font/layout/LEFontInstance.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LEFontInstance.h Fri Jun 21 15:46:14 2013 -0500 @@ -190,9 +190,6 @@ */ virtual const void *getFontTable(LETag tableTag) const = 0; - virtual void *getKernPairs() const = 0; - virtual void setKernPairs(void *pairs) const = 0; - /** * This method reads a table from the font. Note that in general, * it only makes sense to call this method on an <code>LEFontInstance</code> @@ -201,10 +198,10 @@ * will have different tables, and there's no way to know which subfont to access. * * Subclasses which represent composite fonts should always return <code>NULL</code>. - * + * * This version sets a length, for range checking. * - * @param tableTag - the four byte table tag. (e.g. 'cmap') + * @param tableTag - the four byte table tag. (e.g. 'cmap') * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown. * @return the address of the table in memory, or <code>NULL</code> * if the table doesn't exist. @@ -212,6 +209,9 @@ */ virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); } /* -1 = unknown length */ + virtual void *getKernPairs() const = 0; + virtual void setKernPairs(void *pairs) const = 0; + /** * This method is used to determine if the font can * render the given character. This can usually be done
--- a/src/share/native/sun/font/layout/LEGlyphFilter.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LEGlyphFilter.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -36,6 +36,7 @@ U_NAMESPACE_BEGIN +#ifndef U_HIDE_INTERNAL_API /** * This is a helper class that is used to * recognize a set of glyph indices. @@ -63,6 +64,7 @@ */ virtual le_bool accept(LEGlyphID glyph) const = 0; }; +#endif /* U_HIDE_INTERNAL_API */ U_NAMESPACE_END #endif
--- a/src/share/native/sun/font/layout/LEInsertionList.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LEInsertionList.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* ********************************************************************** - * Copyright (C) 1998-2008, International Business Machines + * Copyright (C) 1998-2013, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ @@ -39,6 +39,7 @@ struct InsertionRecord; +#ifndef U_HIDE_INTERNAL_API /** * This class encapsulates the callback used by <code>LEInsertionList</code> * to apply an insertion from the insertion list. @@ -194,6 +195,7 @@ */ le_bool append; }; +#endif /* U_HIDE_INTERNAL_API */ U_NAMESPACE_END #endif
--- a/src/share/native/sun/font/layout/LEScripts.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LEScripts.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved. + * (C) Copyright IBM Corp. 1998-2013. All Rights Reserved. * * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * YOU REALLY KNOW WHAT YOU'RE DOING.
--- a/src/share/native/sun/font/layout/LETableReference.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LETableReference.h Fri Jun 21 15:46:14 2013 -0500 @@ -1,4 +1,5 @@ /* + * Copyright (c) 2007, 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 @@ -20,7 +21,6 @@ * 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. - * */ /* @@ -52,7 +52,7 @@ * defined in OpenTypeUtilities.cpp * @internal */ -U_INTERNAL void U_EXPORT2 _debug_LETableReference(const char *f, int l, const char *msg, const LETableReference *what, const void *ptr, size_t len); +extern void _debug_LETableReference(const char *f, int l, const char *msg, const LETableReference *what, const void *ptr, size_t len); #define LE_DEBUG_TR(x) _debug_LETableReference(__FILE__, __LINE__, x, this, NULL, 0); #define LE_DEBUG_TR3(x,y,z) _debug_LETableReference(__FILE__, __LINE__, x, this, (const void*)y, (size_t)z); @@ -204,18 +204,6 @@ return fLength; } - le_bool isSubsetOf(const LETableReference& base) const { - if(this == &base) return true; - if(fStart < base.fStart) return false; - if(base.hasBounds()) { - if(fStart >= base.fStart + base.fLength) return false; - if(hasBounds()) { - if(fStart + fLength > base.fStart + base.fLength) return false; - } - } - return true; - } - /** * Change parent link to another */ @@ -278,6 +266,12 @@ * dereferencing NULL is valid here because we never actually dereference it, just inside sizeof. */ #define LE_VAR_ARRAY(x,y) template<> inline size_t LETableVarSizer<x>::getSize() { return sizeof(x) - (sizeof(((const x*)0)->y)); } +/** + * \def LE_CORRECT_SIZE + * @param x type (T) + * @param y fixed size for T + */ +#define LE_CORRECT_SIZE(x,y) template<> inline size_t LETableVarSizer<x>::getSize() { return y; } /** * Open a new entry based on an existing table @@ -338,15 +332,7 @@ using LETableReference::getAlias; const T *getAlias(le_uint32 i, LEErrorCode &success) const { - if(LE_SUCCESS(success)&& i<getCount()) { - return ((const T*)getAlias())+i; - } else { - if(LE_SUCCESS(success)) { - LE_DEBUG_TR("getAlias(subscript) out of range"); - success = LE_INDEX_OUT_OF_BOUNDS_ERROR; - } - return ((const T*)getAlias()); // return first item, so there's no crash - } + return ((const T*)(((const char*)getAlias())+getOffsetFor(i, success))); } const T *getAliasTODO() const { LE_DEBUG_TR("getAliasTODO<>"); return (const T*)fStart; } @@ -377,46 +363,6 @@ LE_TRACE_TR("INFO: null RTAO") } - /** - * set this to point within our fParent, but based on 'base' as a subtable. - */ - void setToOffsetInParent(const LETableReference& base, size_t offset, le_uint32 count, LEErrorCode &success) { -LE_TRACE_TR("INFO: sTOIP") - if(LE_FAILURE(success)) return; - if(!fParent->isSubsetOf(base)) { // Ensure that 'base' is containable within our parent. - clear(); // otherwise, it's not a subtable of our parent. - LE_DEBUG_TR("setToOffsetInParents called on non subsets"); - success = LE_ILLEGAL_ARGUMENT_ERROR; return; - } - size_t baseOffset = fParent->ptrToOffset(((const le_uint8*)base.getAlias())+offset, success); - if(LE_FAILURE(success)) return; // base was outside of parent's range - if(fParent->hasBounds()) { - if((baseOffset >= fParent->getLength()) || // start off end of parent - (baseOffset+(count*LETableVarSizer<T>::getSize()) >= fParent->getLength()) || // or off end of parent - count > LE_UINTPTR_MAX/LETableVarSizer<T>::getSize()) { // or more than would fit in memory - LE_DEBUG_TR("setToOffsetInParent called with bad length"); - success = LE_INDEX_OUT_OF_BOUNDS_ERROR; - clear(); - return; // start would go off end of parent - } - } - fStart = (const le_uint8*)(fParent->getAlias()) + baseOffset; - //fLength = count*LETableVarSizer<T>::getSize(); - no- do not shrink fLength. - if(fParent->hasBounds()) { - fLength = (fParent->getLength() - (fStart-(const le_uint8*)fParent->getAlias())); // reduces fLength accordingly. - } else { - fLength = LE_UINTPTR_MAX; // unbounded - } - if((fStart < fParent->getAlias()) || - (hasBounds()&&(fStart+fLength < fStart))) { // wrapped - LE_DEBUG_TR("setToOffsetInParent called with bad length"); - success = LE_INDEX_OUT_OF_BOUNDS_ERROR; - clear(); - return; // start would go off end of parent - } - fCount = count; - } - private: le_uint32 fCount; };
--- a/src/share/native/sun/font/layout/LETypes.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LETypes.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -50,14 +50,15 @@ #endif #include "unicode/utypes.h" + +#ifdef __cplusplus #include "unicode/uobject.h" +#endif + #ifdef LE_USE_CMEMORY #include "cmemory.h" #endif -#endif /* not standalone */ - - -U_NAMESPACE_BEGIN +#endif /*! * \file @@ -296,12 +297,14 @@ */ typedef UChar32 LEUnicode32; +#ifndef U_HIDE_DEPRECATED_API /** * Used to represent 16-bit Unicode code points. * * @deprecated since ICU 2.4. Use LEUnicode16 instead */ typedef UChar LEUnicode; +#endif /* U_HIDE_DEPRECATED_API */ /** * Used to hold a pair of (x, y) values which represent a point. @@ -325,7 +328,7 @@ float fY; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus /** * Used to hold a pair of (x, y) values which represent a point. * @@ -366,6 +369,39 @@ */ #define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn)) +#ifndef U_HIDE_INTERNAL_API + +#ifndef LE_ASSERT_BAD_FONT +#define LE_ASSERT_BAD_FONT 0 +#endif + +#if LE_ASSERT_BAD_FONT +#include <stdio.h> +#define LE_DEBUG_BAD_FONT(x) fprintf(stderr,"%s:%d: BAD FONT: %s\n", __FILE__, __LINE__, (x)); +#else +#define LE_DEBUG_BAD_FONT(x) +#endif + +/** + * Max value representable by a uintptr + */ + +#ifndef UINT32_MAX +#define LE_UINT32_MAX 0xFFFFFFFFU +#else +#define LE_UINT32_MAX UINT32_MAX +#endif + +#ifndef UINTPTR_MAX +#define LE_UINTPTR_MAX LE_UINT32_MAX +#else +#define LE_UINTPTR_MAX UINTPTR_MAX +#endif + +/** + * Range check for overflow + */ +#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn)) /** * A convenience macro to get the length of an array. * @@ -404,7 +440,52 @@ * @internal */ #define LE_DELETE_ARRAY(array) uprv_free((void *) (array)) -#endif +#else +/* !LE_USE_CMEMORY - Not using ICU memory - use C std lib versions */ + +#include <stdlib.h> +#include <string.h> + +/** + * A convenience macro to get the length of an array. + * + * @internal + */ +#define LE_ARRAY_SIZE(array) (sizeof array / sizeof array[0]) + +/** + * A convenience macro for copying an array. + * + * @internal + */ +#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0]) + +/** + * Allocate an array of basic types. This is used to isolate the rest of + * the LayoutEngine code from cmemory.h. + * + * @internal + */ +#define LE_NEW_ARRAY(type, count) LE_RANGE_CHECK(type,count,(type *) malloc((count) * sizeof(type))) + +/** + * Re-allocate an array of basic types. This is used to isolate the rest of + * the LayoutEngine code from cmemory.h. + * + * @internal + */ +#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0]) + + /** + * Free an array of basic types. This is used to isolate the rest of + * the LayoutEngine code from cmemory.h. + * + * @internal + */ +#define LE_DELETE_ARRAY(array) free((void *) (array)) + +#endif /* LE_USE_CMEMORY */ +#endif /* U_HIDE_INTERNAL_API */ /** * A macro to construct the four-letter tags used to @@ -567,7 +648,7 @@ LE_RAND_FEATURE_TAG = 0x72616E64UL, /**< 'rand' */ LE_RLIG_FEATURE_TAG = 0x726C6967UL, /**< 'rlig' */ LE_RPHF_FEATURE_TAG = 0x72706866UL, /**< 'rphf' */ - LE_RKRF_FEATURE_TAG = 0x726B7266UL, /**< 'rkrf' */ + LE_RKRF_FEATURE_TAG = 0x726B7266UL, /**< 'rkrf' */ LE_RTBD_FEATURE_TAG = 0x72746264UL, /**< 'rtbd' */ LE_RTLA_FEATURE_TAG = 0x72746C61UL, /**< 'rtla' */ LE_RUBY_FEATURE_TAG = 0x72756279UL, /**< 'ruby' */ @@ -618,16 +699,66 @@ LE_ZERO_FEATURE_TAG = 0x7A65726FUL /**< 'zero' */ }; +/** + * @internal + */ enum LEFeatureENUMs { - LE_Kerning_FEATURE_ENUM = 0, - LE_Ligatures_FEATURE_ENUM = 1, - LE_CHAR_FILTER_FEATURE_ENUM = 31, - LE_FEATURE_ENUM_MAX = LE_CHAR_FILTER_FEATURE_ENUM + LE_Kerning_FEATURE_ENUM = 0, /**< Requests Kerning. Formerly LayoutEngine::kTypoFlagKern */ + LE_Ligatures_FEATURE_ENUM = 1, /**< Requests Ligatures. Formerly LayoutEngine::kTypoFlagLiga */ + LE_NoCanon_FEATURE_ENUM = 2, /**< Requests No Canonical Processing */ + LE_CLIG_FEATURE_ENUM, /**< Feature specific enum */ + LE_DLIG_FEATURE_ENUM, /**< Feature specific enum */ + LE_HLIG_FEATURE_ENUM, /**< Feature specific enum */ + LE_LIGA_FEATURE_ENUM, /**< Feature specific enum */ + LE_RLIG_FEATURE_ENUM, /**< Feature specific enum */ + LE_SMCP_FEATURE_ENUM, /**< Feature specific enum */ + LE_FRAC_FEATURE_ENUM, /**< Feature specific enum */ + LE_AFRC_FEATURE_ENUM, /**< Feature specific enum */ + LE_ZERO_FEATURE_ENUM, /**< Feature specific enum */ + LE_SWSH_FEATURE_ENUM, /**< Feature specific enum */ + LE_CSWH_FEATURE_ENUM, /**< Feature specific enum */ + LE_SALT_FEATURE_ENUM, /**< Feature specific enum */ + LE_NALT_FEATURE_ENUM, /**< Feature specific enum */ + LE_RUBY_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS01_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS02_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS03_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS04_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS05_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS06_FEATURE_ENUM, /**< Feature specific enum */ + LE_SS07_FEATURE_ENUM, /**< Feature specific enum */ + + LE_CHAR_FILTER_FEATURE_ENUM = 31, /**< Apply CharSubstitutionFilter */ + LE_FEATURE_ENUM_MAX = LE_CHAR_FILTER_FEATURE_ENUM }; -#define LE_Kerning_FEATURE_FLAG (1 << LE_Kerning_FEATURE_ENUM) +#define LE_Kerning_FEATURE_FLAG (1 << LE_Kerning_FEATURE_ENUM) #define LE_Ligatures_FEATURE_FLAG (1 << LE_Ligatures_FEATURE_ENUM) +#define LE_NoCanon_FEATURE_FLAG (1 << LE_NoCanon_FEATURE_ENUM) +#define LE_CLIG_FEATURE_FLAG (1 << LE_CLIG_FEATURE_ENUM) +#define LE_DLIG_FEATURE_FLAG (1 << LE_DLIG_FEATURE_ENUM) +#define LE_HLIG_FEATURE_FLAG (1 << LE_HLIG_FEATURE_ENUM) +#define LE_LIGA_FEATURE_FLAG (1 << LE_LIGA_FEATURE_ENUM) +#define LE_RLIG_FEATURE_FLAG (1 << LE_RLIG_FEATURE_ENUM) +#define LE_SMCP_FEATURE_FLAG (1 << LE_SMCP_FEATURE_ENUM) +#define LE_FRAC_FEATURE_FLAG (1 << LE_FRAC_FEATURE_ENUM) +#define LE_AFRC_FEATURE_FLAG (1 << LE_AFRC_FEATURE_ENUM) +#define LE_ZERO_FEATURE_FLAG (1 << LE_ZERO_FEATURE_ENUM) +#define LE_SWSH_FEATURE_FLAG (1 << LE_SWSH_FEATURE_ENUM) +#define LE_CSWH_FEATURE_FLAG (1 << LE_CSWH_FEATURE_ENUM) +#define LE_SALT_FEATURE_FLAG (1 << LE_SALT_FEATURE_ENUM) +#define LE_NALT_FEATURE_FLAG (1 << LE_NALT_FEATURE_ENUM) +#define LE_RUBY_FEATURE_FLAG (1 << LE_RUBY_FEATURE_ENUM) +#define LE_SS01_FEATURE_FLAG (1 << LE_SS01_FEATURE_ENUM) +#define LE_SS02_FEATURE_FLAG (1 << LE_SS02_FEATURE_ENUM) +#define LE_SS03_FEATURE_FLAG (1 << LE_SS03_FEATURE_ENUM) +#define LE_SS04_FEATURE_FLAG (1 << LE_SS04_FEATURE_ENUM) +#define LE_SS05_FEATURE_FLAG (1 << LE_SS05_FEATURE_ENUM) +#define LE_SS06_FEATURE_FLAG (1 << LE_SS06_FEATURE_ENUM) +#define LE_SS07_FEATURE_FLAG (1 << LE_SS07_FEATURE_ENUM) + #define LE_CHAR_FILTER_FEATURE_FLAG (1 << LE_CHAR_FILTER_FEATURE_ENUM) + #define LE_DEFAULT_FEATURE_FLAG (LE_Kerning_FEATURE_FLAG | LE_Ligatures_FEATURE_FLAG) /**< default features */ /** @@ -654,7 +785,7 @@ }; #endif -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus /** * Error codes returned by the LayoutEngine. * @@ -681,7 +812,4 @@ #define LE_FAILURE(code) (U_FAILURE((UErrorCode)code)) #endif -U_NAMESPACE_END -#endif - - +#endif /* __LETYPES_H */
--- a/src/share/native/sun/font/layout/LayoutEngine.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LayoutEngine.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -45,6 +45,8 @@ #include "ThaiLayoutEngine.h" #include "TibetanLayoutEngine.h" #include "GXLayoutEngine.h" +#include "GXLayoutEngine2.h" + #include "ScriptAndLanguageTags.h" #include "CharSubstitutionFilter.h" @@ -64,6 +66,10 @@ /* Leave this copyright notice here! It needs to go somewhere in this library. */ static const char copyright[] = U_COPYRIGHT_STRING; +/* TODO: remove these? */ +const le_int32 LayoutEngine::kTypoFlagKern = LE_Kerning_FEATURE_FLAG; +const le_int32 LayoutEngine::kTypoFlagLiga = LE_Ligatures_FEATURE_FLAG; + const LEUnicode32 DefaultCharMapper::controlChars[] = { 0x0009, 0x000A, 0x000D, /*0x200C, 0x200D,*/ 0x200E, 0x200F, @@ -253,7 +259,7 @@ return 0; } - if ((fTypoFlags & 0x4) == 0) { // no canonical processing + if ((fTypoFlags & LE_NoCanon_FEATURE_FLAG) == 0) { // no canonical processing return count; } @@ -577,6 +583,7 @@ { static const le_uint32 gsubTableTag = LE_GSUB_TABLE_TAG; static const le_uint32 mortTableTag = LE_MORT_TABLE_TAG; + static const le_uint32 morxTableTag = LE_MORX_TABLE_TAG; if (LE_FAILURE(success)) { return NULL; @@ -613,6 +620,11 @@ result = new ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success); break; + case hebrScriptCode: + // Disable hebrew ligatures since they have only archaic uses, see ticket #8318 + result = new OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags & ~kTypoFlagLiga, gsubTable, success); + break; + case hangScriptCode: result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success); break; @@ -651,26 +663,29 @@ break; } } else { - LEReferenceTo<MorphTableHeader> mortTable(fontInstance, mortTableTag, success); - - if (LE_SUCCESS(success) && mortTable.isValid() && SWAPL(mortTable->version)==0x00010000) { // mort - result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, mortTable, success); + MorphTableHeader2 *morxTable = (MorphTableHeader2 *)fontInstance->getFontTable(morxTableTag); + if (morxTable != NULL && SWAPL(morxTable->version)==0x00020000) { + result = new GXLayoutEngine2(fontInstance, scriptCode, languageCode, morxTable, typoFlags, success); } else { - switch (scriptCode) { - case bengScriptCode: - case devaScriptCode: - case gujrScriptCode: - case kndaScriptCode: - case mlymScriptCode: - case oryaScriptCode: - case guruScriptCode: - case tamlScriptCode: - case teluScriptCode: - case sinhScriptCode: - { - result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success); - break; - } + LEReferenceTo<MorphTableHeader> mortTable(fontInstance, mortTableTag, success); + if (LE_SUCCESS(success) && mortTable.isValid() && SWAPL(mortTable->version)==0x00010000) { // mort + result = new GXLayoutEngine(fontInstance, scriptCode, languageCode, mortTable, success); + } else { + switch (scriptCode) { + case bengScriptCode: + case devaScriptCode: + case gujrScriptCode: + case kndaScriptCode: + case mlymScriptCode: + case oryaScriptCode: + case guruScriptCode: + case tamlScriptCode: + case teluScriptCode: + case sinhScriptCode: + { + result = new IndicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success); + break; + } case arabScriptCode: //case hebrScriptCode: @@ -688,9 +703,10 @@ result = new HangulOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success); break; - default: - result = new LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success); - break; + default: + result = new LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success); + break; + } } } }
--- a/src/share/native/sun/font/layout/LayoutEngine.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LayoutEngine.h Fri Jun 21 15:46:14 2013 -0500 @@ -26,7 +26,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -90,6 +90,14 @@ * @stable ICU 2.8 */ class U_LAYOUT_API LayoutEngine : public UObject { +public: +#ifndef U_HIDE_INTERNAL_API + /** @internal Flag to request kerning. Use LE_Kerning_FEATURE_FLAG instead. */ + static const le_int32 kTypoFlagKern; + /** @internal Flag to request ligatures. Use LE_Ligatures_FEATURE_FLAG instead. */ + static const le_int32 kTypoFlagLiga; +#endif /* U_HIDE_INTERNAL_API */ + protected: /** * The object which holds the glyph storage @@ -140,6 +148,7 @@ */ le_bool fFilterZeroWidth; +#ifndef U_HIDE_INTERNAL_API /** * This constructs an instance for a given font, script and language. Subclass constructors * must call this constructor. @@ -161,7 +170,10 @@ le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success); +#endif /* U_HIDE_INTERNAL_API */ + // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public default constructor. /** * This overrides the default no argument constructor to make it * difficult for clients to call it. Clients are expected to call @@ -308,6 +320,7 @@ */ virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success); +#ifndef U_HIDE_INTERNAL_API /** * This is a convenience method that forces the advance width of mark * glyphs to be zero, which is required for proper selection and highlighting. @@ -342,7 +355,7 @@ * @internal */ static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success); - +#endif /* U_HIDE_INTERNAL_API */ public: /**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/LigatureSubstProc2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,170 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp and Others. 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "StateTables.h" +#include "MorphStateTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "LigatureSubstProc2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +#define ExtendedComplement(m) ((le_int32) (~((le_uint32) (m)))) +#define SignBit(m) ((ExtendedComplement(m) >> 1) & (le_int32)(m)) +#define SignExtend(v,m) (((v) & SignBit(m))? ((v) | ExtendedComplement(m)): (v)) + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor2) + +LigatureSubstitutionProcessor2::LigatureSubstitutionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : StateTableProcessor2(morphSubtableHeader, success), + ligActionOffset(0), + ligatureSubstitutionHeader(morphSubtableHeader, success), componentOffset(0), ligatureOffset(0), entryTable() +{ + if (LE_FAILURE(success)) return; + + ligActionOffset = SWAPL(ligatureSubstitutionHeader->ligActionOffset); + componentOffset = SWAPL(ligatureSubstitutionHeader->componentOffset); + ligatureOffset = SWAPL(ligatureSubstitutionHeader->ligatureOffset); + + entryTable = LEReferenceToArrayOf<LigatureSubstitutionStateEntry2>(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY); +} + +LigatureSubstitutionProcessor2::~LigatureSubstitutionProcessor2() +{ +} + +void LigatureSubstitutionProcessor2::beginStateTable() +{ + m = -1; +} + +le_uint16 LigatureSubstitutionProcessor2::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex2 index, LEErrorCode &success) +{ + const LigatureSubstitutionStateEntry2 *entry = entryTable.getAlias(index, success); + if(LE_FAILURE(success)) return 0; + + le_uint16 nextStateIndex = SWAPW(entry->nextStateIndex); + le_uint16 flags = SWAPW(entry->entryFlags); + le_uint16 ligActionIndex = SWAPW(entry->ligActionIndex); + + if (flags & lsfSetComponent) { + if (++m >= nComponents) { + m = 0; + } + componentStack[m] = currGlyph; + } else if ( m == -1) { + // bad font- skip this glyph. + //LE_DEBUG_BAD_FONT("m==-1 (componentCount went negative)") + currGlyph+= dir; + return nextStateIndex; + } + + ByteOffset actionOffset = flags & lsfPerformAction; + + if (actionOffset != 0) { + LEReferenceTo<LigatureActionEntry> ap(stHeader, success, ligActionOffset); // byte offset + ap.addObject(ligActionIndex - 1, success); // index offset ( one before the actual start, because we will pre-increment) + LEReferenceToArrayOf<TTGlyphID> ligatureTable(stHeader, success, ligatureOffset, LE_UNBOUNDED_ARRAY); + LigatureActionEntry action; + le_int32 offset, i = 0; + le_int32 stack[nComponents]; + le_int16 mm = -1; + + LEReferenceToArrayOf<le_uint16> componentTable(stHeader, success, componentOffset, LE_UNBOUNDED_ARRAY); + if(LE_FAILURE(success)) { + currGlyph+= dir; + return nextStateIndex; // get out! bad font + } + + do { + le_uint32 componentGlyph = componentStack[m--]; // pop off + + ap.addObject(success); + action = SWAPL(*ap.getAlias()); + + if (m < 0) { + m = nComponents - 1; + } + + offset = action & lafComponentOffsetMask; + if (offset != 0) { + if(componentGlyph > glyphStorage.getGlyphCount()) { + LE_DEBUG_BAD_FONT("preposterous componentGlyph"); + currGlyph+= dir; + return nextStateIndex; // get out! bad font + } + i += SWAPW(componentTable(LE_GET_GLYPH(glyphStorage[componentGlyph]) + (SignExtend(offset, lafComponentOffsetMask)),success)); + + if (action & (lafLast | lafStore)) { + TTGlyphID ligatureGlyph = SWAPW(ligatureTable(i,success)); + glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph); + if(mm==nComponents) { + LE_DEBUG_BAD_FONT("exceeded nComponents"); + mm--; // don't overrun the stack. + } + stack[++mm] = componentGlyph; + i = 0; + } else { + glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF); + } + } +#if LE_ASSERT_BAD_FONT + if(m<0) { + LE_DEBUG_BAD_FONT("m<0") + } +#endif + } while (!(action & lafLast) && (m>=0) ); // stop if last bit is set, or if run out of items + + while (mm >= 0) { + if (++m >= nComponents) { + m = 0; + } + + componentStack[m] = stack[mm--]; + } + } + + if (!(flags & lsfDontAdvance)) { + currGlyph += dir; + } + + return nextStateIndex; +} + +void LigatureSubstitutionProcessor2::endStateTable() +{ +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/LigatureSubstProc2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,97 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __LIGATURESUBSTITUTIONPROCESSOR2_H +#define __LIGATURESUBSTITUTIONPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "LigatureSubstitution.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +#define nComponents 16 + +class LigatureSubstitutionProcessor2 : public StateTableProcessor2 +{ +public: + virtual void beginStateTable(); + + virtual le_uint16 processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, + EntryTableIndex2 index, LEErrorCode &success); + + virtual void endStateTable(); + + LigatureSubstitutionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + virtual ~LigatureSubstitutionProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + LigatureSubstitutionProcessor2(); + +protected: + le_uint32 ligActionOffset; + le_uint32 componentOffset; + le_uint32 ligatureOffset; + + LEReferenceToArrayOf<LigatureSubstitutionStateEntry2> entryTable; + + le_int32 componentStack[nComponents]; + le_int16 m; + + const LEReferenceTo<LigatureSubstitutionHeader2> ligatureSubstitutionHeader; + +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -45,6 +45,10 @@ LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); + if (LE_FAILURE(success)) { + return 0; + } + if (coverageIndex >= 0) { Offset ligSetTableOffset = SWAPW(ligSetTableOffsetArray[coverageIndex]); const LigatureSetTable *ligSetTable = (const LigatureSetTable *) ((char *) this + ligSetTableOffset);
--- a/src/share/native/sun/font/layout/LigatureSubstitution.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LigatureSubstitution.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -52,17 +52,32 @@ ByteOffset ligatureTableOffset; }; +struct LigatureSubstitutionHeader2 : MorphStateTableHeader2 +{ + le_uint32 ligActionOffset; + le_uint32 componentOffset; + le_uint32 ligatureOffset; +}; + enum LigatureSubstitutionFlags { lsfSetComponent = 0x8000, lsfDontAdvance = 0x4000, - lsfActionOffsetMask = 0x3FFF + lsfActionOffsetMask = 0x3FFF, // N/A in morx + lsfPerformAction = 0x2000 }; struct LigatureSubstitutionStateEntry : StateEntry { }; +struct LigatureSubstitutionStateEntry2 +{ + le_uint16 nextStateIndex; + le_uint16 entryFlags; + le_uint16 ligActionIndex; +}; + typedef le_uint32 LigatureActionEntry; enum LigatureActionFlags
--- a/src/share/native/sun/font/layout/LookupProcessor.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/LookupProcessor.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -94,11 +94,11 @@ FeatureMask selectMask = lookupSelectArray[lookup]; if (selectMask != 0) { - const LEReferenceTo<LookupTable> lookupTable = lookupListTable->getLookupTable(lookupListTable, lookup, success); - if (!lookupTable.isValid() ||LE_FAILURE(success) ) { - continue; + const LEReferenceTo<LookupTable> lookupTable = lookupListTable->getLookupTable(lookupListTable, lookup, success); + if (!lookupTable.isValid() ||LE_FAILURE(success) ) { + continue; } - le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags); + le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags); glyphIterator.reset(lookupFlags, selectMask); @@ -137,7 +137,7 @@ le_int32 LookupProcessor::selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success) { - le_uint16 lookupCount = featureTable.isValid()? SWAPW(featureTable->lookupCount) : 0; + le_uint16 lookupCount = featureTable.isValid()? SWAPW(featureTable->lookupCount) : 0; le_int32 store = order; LEReferenceToArrayOf<le_uint16> lookupListIndexArray(featureTable, success, featureTable->lookupListIndexArray, lookupCount); @@ -162,8 +162,8 @@ : lookupListTable(), featureListTable(), lookupSelectArray(NULL), lookupSelectCount(0), lookupOrderArray(NULL), lookupOrderCount(0), fReference(baseAddress) { - LEReferenceTo<ScriptListTable> scriptListTable; - LEReferenceTo<LangSysTable> langSysTable; + LEReferenceTo<ScriptListTable> scriptListTable; + LEReferenceTo<LangSysTable> langSysTable; le_uint16 featureCount = 0; le_uint16 lookupListCount = 0; le_uint16 requiredFeatureIndex; @@ -234,7 +234,7 @@ featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success); if (!featureTable.isValid() || LE_FAILURE(success)) { continue; - } + } featureReferences += SWAPW(featureTable->lookupCount); } }
--- a/src/share/native/sun/font/layout/MPreFixups.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MPreFixups.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 2002-2008 - All Rights Reserved + * (C) Copyright IBM Corp. 2002-2013 - All Rights Reserved * */ @@ -65,9 +65,9 @@ } } -void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& leSuccess) +void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success) { - if (LE_FAILURE(leSuccess)) { + if (LE_FAILURE(success)) { return; }
--- a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -56,6 +56,10 @@ LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); + if (LE_FAILURE(success)) { + return 0; + } + if (markCoverage < 0) { // markGlyph isn't a covered mark glyph return 0;
--- a/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MarkToLigaturePosnSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -55,6 +55,10 @@ LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); + if (LE_FAILURE(success)) { + return 0; + } + if (markCoverage < 0) { // markGlyph isn't a covered mark glyph return 0;
--- a/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MarkToMarkPosnSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -56,6 +56,10 @@ LEGlyphID markGlyph = glyphIterator->getCurrGlyphID(); le_int32 markCoverage = getGlyphCoverage(base, (LEGlyphID) markGlyph, success); + if (LE_FAILURE(success)) { + return 0; + } + if (markCoverage < 0) { // markGlyph isn't a covered mark glyph return 0;
--- a/src/share/native/sun/font/layout/MorphStateTables.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MorphStateTables.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -49,5 +49,10 @@ StateTableHeader stHeader; }; +struct MorphStateTableHeader2 : MorphSubtableHeader2 +{ + StateTableHeader2 stHeader; +}; + U_NAMESPACE_END #endif
--- a/src/share/native/sun/font/layout/MorphTables.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MorphTables.h Fri Jun 21 15:46:14 2013 -0500 @@ -79,6 +79,7 @@ LE_VAR_ARRAY(MorphTableHeader, chains) typedef le_int16 SubtableCoverage; +typedef le_uint32 SubtableCoverage2; enum SubtableCoverageFlags { @@ -108,6 +109,304 @@ void process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const; }; +enum SubtableCoverageFlags2 +{ + scfVertical2 = 0x80000000, + scfReverse2 = 0x40000000, + scfIgnoreVt2 = 0x20000000, + scfReserved2 = 0x1FFFFF00, + scfTypeMask2 = 0x000000FF +}; + +struct MorphSubtableHeader2 +{ + le_uint32 length; + SubtableCoverage2 coverage; + FeatureFlags subtableFeatures; + + void process(const LEReferenceTo<MorphSubtableHeader2> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const; +}; + +struct ChainHeader2 +{ + FeatureFlags defaultFlags; + le_uint32 chainLength; + le_uint32 nFeatureEntries; + le_uint32 nSubtables; + FeatureTableEntry featureTable[ANY_NUMBER]; +}; +LE_VAR_ARRAY(ChainHeader2, featureTable) + +struct MorphTableHeader2 +{ + le_int32 version; + le_uint32 nChains; + ChainHeader2 chains[ANY_NUMBER]; + + void process(const LEReferenceTo<MorphTableHeader2> &base, LEGlyphStorage &glyphStorage, le_int32 typoFlags, LEErrorCode &success) const; +}; +LE_VAR_ARRAY(MorphTableHeader2, chains) + +/* + * AAT Font Features + * source: https://developer.apple.com/fonts/registry/ + * (plus addition from ATS/SFNTLayoutTypes.h) + */ + +enum { + + allTypographicFeaturesType = 0, + + allTypeFeaturesOnSelector = 0, + allTypeFeaturesOffSelector = 1, + + ligaturesType = 1, + + requiredLigaturesOnSelector = 0, + requiredLigaturesOffSelector = 1, + commonLigaturesOnSelector = 2, + commonLigaturesOffSelector = 3, + rareLigaturesOnSelector = 4, + rareLigaturesOffSelector = 5, + logosOnSelector = 6, + logosOffSelector = 7, + rebusPicturesOnSelector = 8, + rebusPicturesOffSelector = 9, + diphthongLigaturesOnSelector = 10, + diphthongLigaturesOffSelector = 11, + squaredLigaturesOnSelector = 12, + squaredLigaturesOffSelector = 13, + abbrevSquaredLigaturesOnSelector = 14, + abbrevSquaredLigaturesOffSelector = 15, + symbolLigaturesOnSelector = 16, + symbolLigaturesOffSelector = 17, + contextualLigaturesOnSelector = 18, + contextualLigaturesOffSelector = 19, + historicalLigaturesOnSelector = 20, + historicalLigaturesOffSelector = 21, + + cursiveConnectionType = 2, + + unconnectedSelector = 0, + partiallyConnectedSelector = 1, + cursiveSelector = 2, + + letterCaseType = 3, + + upperAndLowerCaseSelector = 0, + allCapsSelector = 1, + allLowerCaseSelector = 2, + smallCapsSelector = 3, + initialCapsSelector = 4, + initialCapsAndSmallCapsSelector = 5, + + verticalSubstitutionType = 4, + + substituteVerticalFormsOnSelector = 0, + substituteVerticalFormsOffSelector = 1, + + linguisticRearrangementType = 5, + + linguisticRearrangementOnSelector = 0, + linguisticRearrangementOffSelector = 1, + + numberSpacingType = 6, + + monospacedNumbersSelector = 0, + proportionalNumbersSelector = 1, + + /* + appleReserved1Type = 7, + */ + + smartSwashType = 8, + + wordInitialSwashesOnSelector = 0, + wordInitialSwashesOffSelector = 1, + wordFinalSwashesOnSelector = 2, + wordFinalSwashesOffSelector = 3, + lineInitialSwashesOnSelector = 4, + lineInitialSwashesOffSelector = 5, + lineFinalSwashesOnSelector = 6, + lineFinalSwashesOffSelector = 7, + nonFinalSwashesOnSelector = 8, + nonFinalSwashesOffSelector = 9, + + diacriticsType = 9, + + showDiacriticsSelector = 0, + hideDiacriticsSelector = 1, + decomposeDiacriticsSelector = 2, + + verticalPositionType = 10, + + normalPositionSelector = 0, + superiorsSelector = 1, + inferiorsSelector = 2, + ordinalsSelector = 3, + + fractionsType = 11, + + noFractionsSelector = 0, + verticalFractionsSelector = 1, + diagonalFractionsSelector = 2, + + /* + appleReserved2Type = 12, + */ + + overlappingCharactersType = 13, + + preventOverlapOnSelector = 0, + preventOverlapOffSelector = 1, + + typographicExtrasType = 14, + + hyphensToEmDashOnSelector = 0, + hyphensToEmDashOffSelector = 1, + hyphenToEnDashOnSelector = 2, + hyphenToEnDashOffSelector = 3, + unslashedZeroOnSelector = 4, + slashedZeroOffSelector = 4, + unslashedZeroOffSelector = 5, + slashedZeroOnSelector = 5, + formInterrobangOnSelector = 6, + formInterrobangOffSelector = 7, + smartQuotesOnSelector = 8, + smartQuotesOffSelector = 9, + periodsToEllipsisOnSelector = 10, + periodsToEllipsisOffSelector = 11, + + mathematicalExtrasType = 15, + + hyphenToMinusOnSelector = 0, + hyphenToMinusOffSelector = 1, + asteriskToMultiplyOnSelector = 2, + asteriskToMultiplyOffSelector = 3, + slashToDivideOnSelector = 4, + slashToDivideOffSelector = 5, + inequalityLigaturesOnSelector = 6, + inequalityLigaturesOffSelector = 7, + exponentsOnSelector = 8, + exponentsOffSelector = 9, + + ornamentSetsType = 16, + + noOrnamentsSelector = 0, + dingbatsSelector = 1, + piCharactersSelector = 2, + fleuronsSelector = 3, + decorativeBordersSelector = 4, + internationalSymbolsSelector = 5, + mathSymbolsSelector = 6, + + characterAlternativesType = 17, + + noAlternatesSelector = 0, + + designComplexityType = 18, + + designLevel1Selector = 0, + designLevel2Selector = 1, + designLevel3Selector = 2, + designLevel4Selector = 3, + designLevel5Selector = 4, + designLevel6Selector = 5, + designLevel7Selector = 6, + + styleOptionsType = 19, + + noStyleOptionsSelector = 0, + displayTextSelector = 1, + engravedTextSelector = 2, + illuminatedCapsSelector = 3, + titlingCapsSelector = 4, + tallCapsSelector = 5, + + characterShapeType = 20, + + traditionalCharactersSelector = 0, + simplifiedCharactersSelector = 1, + jis1978CharactersSelector = 2, + jis1983CharactersSelector = 3, + jis1990CharactersSelector = 4, + traditionalAltOneSelector = 5, + traditionalAltTwoSelector = 6, + traditionalAltThreeSelector = 7, + traditionalAltFourSelector = 8, + traditionalAltFiveSelector = 9, + expertCharactersSelector = 10, + + numberCaseType = 21, + + lowerCaseNumbersSelector = 0, + upperCaseNumbersSelector = 1, + + textSpacingType = 22, + + proportionalTextSelector = 0, + monospacedTextSelector = 1, + halfWidthTextSelector = 2, + normallySpacedTextSelector = 3, + + transliterationType = 23, + + noTransliterationSelector = 0, + hanjaToHangulSelector = 1, + hiraganaToKatakanaSelector = 2, + katakanaToHiraganaSelector = 3, + kanaToRomanizationSelector = 4, + romanizationToHiraganaSelector = 5, + romanizationToKatakanaSelector = 6, + hanjaToHangulAltOneSelector = 7, + hanjaToHangulAltTwoSelector = 8, + hanjaToHangulAltThreeSelector = 9, + + annotationType = 24, + + noAnnotationSelector = 0, + boxAnnotationSelector = 1, + roundedBoxAnnotationSelector = 2, + circleAnnotationSelector = 3, + invertedCircleAnnotationSelector = 4, + parenthesisAnnotationSelector = 5, + periodAnnotationSelector = 6, + romanNumeralAnnotationSelector = 7, + diamondAnnotationSelector = 8, + + kanaSpacingType = 25, + + fullWidthKanaSelector = 0, + proportionalKanaSelector = 1, + + ideographicSpacingType = 26, + + fullWidthIdeographsSelector = 0, + proportionalIdeographsSelector = 1, + + cjkRomanSpacingType = 103, + + halfWidthCJKRomanSelector = 0, + proportionalCJKRomanSelector = 1, + defaultCJKRomanSelector = 2, + fullWidthCJKRomanSelector = 3, + + rubyKanaType = 28, + + rubyKanaOnSelector = 2, + rubyKanaOffSelector = 3, + +/* The following types are provided for compatibility; note that + their use is deprecated. */ + + adobeCharacterSpacingType = 100, /* prefer 22 */ + adobeKanaSpacingType = 101, /* prefer 25 */ + adobeKanjiSpacingType = 102, /* prefer 26 */ + adobeSquareLigatures = 104, /* prefer 1 */ + + lastFeatureType = -1 +}; + U_NAMESPACE_END #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/MorphTables2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,248 @@ +/* + * 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. + * + */ + +/* + * (C) Copyright IBM Corp. and others 1998 - 2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "LayoutTables.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "IndicRearrangementProcessor2.h" +#include "ContextualGlyphSubstProc2.h" +#include "LigatureSubstProc2.h" +#include "NonContextualGlyphSubstProc2.h" +#include "ContextualGlyphInsertionProc2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +void MorphTableHeader2::process(const LEReferenceTo<MorphTableHeader2> &base, LEGlyphStorage &glyphStorage, + le_int32 typoFlags, LEErrorCode &success) const +{ + if(LE_FAILURE(success)) return; + + le_uint32 chainCount = SWAPL(this->nChains); + LEReferenceTo<ChainHeader2> chainHeader(base, success, &chains[0]); + /* chainHeader and subtableHeader are implemented as a moving pointer rather than an array dereference + * to (slightly) reduce code churn. However, must be careful to preincrement them the 2nd time through. + * We don't want to increment them at the end of the loop, as that would attempt to dereference + * out of range memory. + */ + le_uint32 chain; + + for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain++) { + if (chain>0) { + le_uint32 chainLength = SWAPL(chainHeader->chainLength); + chainHeader.addOffset(chainLength, success); // Don't increment the first time + } + FeatureFlags flag = SWAPL(chainHeader->defaultFlags); + le_uint32 nFeatureEntries = SWAPL(chainHeader->nFeatureEntries); + le_uint32 nSubtables = SWAPL(chainHeader->nSubtables); + LEReferenceTo<MorphSubtableHeader2> subtableHeader(chainHeader, + success, (const MorphSubtableHeader2 *)&chainHeader->featureTable[nFeatureEntries]); + le_uint32 subtable; + if(LE_FAILURE(success)) break; // malformed table + + if (typoFlags != 0) { + le_uint32 featureEntry; + LEReferenceToArrayOf<FeatureTableEntry> featureTableRef(chainHeader, success, &chainHeader->featureTable[0], nFeatureEntries); + if(LE_FAILURE(success)) break; + // Feature subtables + for (featureEntry = 0; featureEntry < nFeatureEntries; featureEntry++) { + const FeatureTableEntry &featureTableEntry = featureTableRef(featureEntry, success); + le_int16 featureType = SWAPW(featureTableEntry.featureType); + le_int16 featureSetting = SWAPW(featureTableEntry.featureSetting); + le_uint32 enableFlags = SWAPL(featureTableEntry.enableFlags); + le_uint32 disableFlags = SWAPL(featureTableEntry.disableFlags); + switch (featureType) { + case ligaturesType: + if ((typoFlags & LE_Ligatures_FEATURE_ENUM ) && (featureSetting ^ 0x1)){ + flag &= disableFlags; + flag |= enableFlags; + } else { + if (((typoFlags & LE_RLIG_FEATURE_FLAG) && featureSetting == requiredLigaturesOnSelector) || + ((typoFlags & LE_CLIG_FEATURE_FLAG) && featureSetting == contextualLigaturesOnSelector) || + ((typoFlags & LE_HLIG_FEATURE_FLAG) && featureSetting == historicalLigaturesOnSelector) || + ((typoFlags & LE_LIGA_FEATURE_FLAG) && featureSetting == commonLigaturesOnSelector)) { + flag &= disableFlags; + flag |= enableFlags; + } + } + break; + case letterCaseType: + if ((typoFlags & LE_SMCP_FEATURE_FLAG) && featureSetting == smallCapsSelector) { + flag &= disableFlags; + flag |= enableFlags; + } + break; + case verticalSubstitutionType: + break; + case linguisticRearrangementType: + break; + case numberSpacingType: + break; + case smartSwashType: + if ((typoFlags & LE_SWSH_FEATURE_FLAG) && (featureSetting ^ 0x1)){ + flag &= disableFlags; + flag |= enableFlags; + } + break; + case diacriticsType: + break; + case verticalPositionType: + break; + case fractionsType: + if (((typoFlags & LE_FRAC_FEATURE_FLAG) && featureSetting == diagonalFractionsSelector) || + ((typoFlags & LE_AFRC_FEATURE_FLAG) && featureSetting == verticalFractionsSelector)) { + flag &= disableFlags; + flag |= enableFlags; + } else { + flag &= disableFlags; + } + break; + case typographicExtrasType: + if ((typoFlags & LE_ZERO_FEATURE_FLAG) && featureSetting == slashedZeroOnSelector) { + flag &= disableFlags; + flag |= enableFlags; + } + break; + case mathematicalExtrasType: + break; + case ornamentSetsType: + break; + case characterAlternativesType: + break; + case designComplexityType: + if (((typoFlags & LE_SS01_FEATURE_FLAG) && featureSetting == designLevel1Selector) || + ((typoFlags & LE_SS02_FEATURE_FLAG) && featureSetting == designLevel2Selector) || + ((typoFlags & LE_SS03_FEATURE_FLAG) && featureSetting == designLevel3Selector) || + ((typoFlags & LE_SS04_FEATURE_FLAG) && featureSetting == designLevel4Selector) || + ((typoFlags & LE_SS05_FEATURE_FLAG) && featureSetting == designLevel5Selector) || + ((typoFlags & LE_SS06_FEATURE_FLAG) && featureSetting == designLevel6Selector) || + ((typoFlags & LE_SS07_FEATURE_FLAG) && featureSetting == designLevel7Selector)) { + + flag &= disableFlags; + flag |= enableFlags; + } + break; + case styleOptionsType: + break; + case characterShapeType: + break; + case numberCaseType: + break; + case textSpacingType: + break; + case transliterationType: + break; + case annotationType: + if ((typoFlags & LE_NALT_FEATURE_FLAG) && featureSetting == circleAnnotationSelector) { + flag &= disableFlags; + flag |= enableFlags; + } + break; + case kanaSpacingType: + break; + case ideographicSpacingType: + break; + case rubyKanaType: + if ((typoFlags & LE_RUBY_FEATURE_FLAG) && featureSetting == rubyKanaOnSelector) { + flag &= disableFlags; + flag |= enableFlags; + } + break; + case cjkRomanSpacingType: + break; + default: + break; + } + } + } + + for (subtable = 0; LE_SUCCESS(success) && subtable < nSubtables; subtable++) { + if(subtable>0) { + le_uint32 length = SWAPL(subtableHeader->length); + subtableHeader.addOffset(length, success); // Don't addOffset for the last entry. + } + le_uint32 coverage = SWAPL(subtableHeader->coverage); + FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures); + // should check coverage more carefully... + if (((coverage & scfIgnoreVt2) || !(coverage & scfVertical2)) && (subtableFeatures & flag) != 0) { + subtableHeader->process(subtableHeader, glyphStorage, success); + } + } + } +} + +void MorphSubtableHeader2::process(const LEReferenceTo<MorphSubtableHeader2> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const +{ + SubtableProcessor2 *processor = NULL; + + switch (SWAPL(coverage) & scfTypeMask2) + { + case mstIndicRearrangement: + processor = new IndicRearrangementProcessor2(base, success); + break; + + case mstContextualGlyphSubstitution: + processor = new ContextualGlyphSubstitutionProcessor2(base, success); + break; + + case mstLigatureSubstitution: + processor = new LigatureSubstitutionProcessor2(base, success); + break; + + case mstReservedUnused: + break; + + case mstNonContextualGlyphSubstitution: + processor = NonContextualGlyphSubstitutionProcessor2::createInstance(base, success); + break; + + + case mstContextualGlyphInsertion: + processor = new ContextualGlyphInsertionProcessor2(base, success); + break; + + default: + return; + break; /*NOTREACHED*/ + } + + if (processor != NULL) { + processor->process(glyphStorage, success); + delete processor; + } else { + if(LE_SUCCESS(success)) { + success = LE_MEMORY_ALLOCATION_ERROR; // because ptr is null and we didn't break out. + } + } +} + +U_NAMESPACE_END
--- a/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -61,6 +61,10 @@ le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); le_uint16 seqCount = SWAPW(sequenceCount); + if (LE_FAILURE(success)) { + return 0; + } + if (coverageIndex >= 0 && coverageIndex < seqCount) { Offset sequenceTableOffset = SWAPW(sequenceTableOffsetArray[coverageIndex]); const SequenceTable *sequenceTable = (const SequenceTable *) ((char *) this + sequenceTableOffset);
--- a/src/share/native/sun/font/layout/NonContextualGlyphSubst.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/NonContextualGlyphSubst.h Fri Jun 21 15:46:14 2013 -0500 @@ -26,7 +26,7 @@ /* * * - * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -50,6 +50,11 @@ LookupTable table; }; +struct NonContextualGlyphSubstitutionHeader2 : MorphSubtableHeader2 +{ + LookupTable table; +}; + U_NAMESPACE_END #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,88 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" +#include "SimpleArrayProcessor2.h" +#include "SegmentSingleProcessor2.h" +#include "SegmentArrayProcessor2.h" +#include "SingleTableProcessor2.h" +#include "TrimmedArrayProcessor2.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +NonContextualGlyphSubstitutionProcessor2::NonContextualGlyphSubstitutionProcessor2() +{ +} + +NonContextualGlyphSubstitutionProcessor2::NonContextualGlyphSubstitutionProcessor2( + const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : SubtableProcessor2(morphSubtableHeader, success) +{ +} + +NonContextualGlyphSubstitutionProcessor2::~NonContextualGlyphSubstitutionProcessor2() +{ +} + +SubtableProcessor2 *NonContextualGlyphSubstitutionProcessor2::createInstance( + const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) +{ + const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); + if(LE_FAILURE(success)) return NULL; + + switch (SWAPW(header->table.format)) + { + case ltfSimpleArray: + return new SimpleArrayProcessor2(morphSubtableHeader, success); + + case ltfSegmentSingle: + return new SegmentSingleProcessor2(morphSubtableHeader, success); + + case ltfSegmentArray: + return new SegmentArrayProcessor2(morphSubtableHeader, success); + + case ltfSingleTable: + return new SingleTableProcessor2(morphSubtableHeader, success); + + case ltfTrimmedArray: + return new TrimmedArrayProcessor2(morphSubtableHeader, success); + + default: + return NULL; + } +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/NonContextualGlyphSubstProc2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,68 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __NONCONTEXTUALGLYPHSUBSTITUTIONPROCESSOR2_H +#define __NONCONTEXTUALGLYPHSUBSTITUTIONPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class NonContextualGlyphSubstitutionProcessor2 : public SubtableProcessor2 +{ +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success) = 0; + + static SubtableProcessor2 *createInstance(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + +protected: + NonContextualGlyphSubstitutionProcessor2(); + NonContextualGlyphSubstitutionProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + virtual ~NonContextualGlyphSubstitutionProcessor2(); + +private: + NonContextualGlyphSubstitutionProcessor2(const NonContextualGlyphSubstitutionProcessor2 &other); // forbid copying of this class + NonContextualGlyphSubstitutionProcessor2 &operator=(const NonContextualGlyphSubstitutionProcessor2 &other); // forbid copying of this class +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/OpenTypeLayoutEngine.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -26,7 +26,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -64,11 +64,27 @@ #define loclFeatureTag LE_LOCL_FEATURE_TAG #define caltFeatureTag LE_CALT_FEATURE_TAG -// 'dlig' not used at the moment -#define dligFeatureTag 0x646C6967 +#define dligFeatureTag LE_DLIG_FEATURE_TAG +#define rligFeatureTag LE_RLIG_FEATURE_TAG +#define paltFeatureTag LE_PALT_FEATURE_TAG -// 'palt' -#define paltFeatureTag 0x70616C74 +#define hligFeatureTag LE_HLIG_FEATURE_TAG +#define smcpFeatureTag LE_SMCP_FEATURE_TAG +#define fracFeatureTag LE_FRAC_FEATURE_TAG +#define afrcFeatureTag LE_AFRC_FEATURE_TAG +#define zeroFeatureTag LE_ZERO_FEATURE_TAG +#define swshFeatureTag LE_SWSH_FEATURE_TAG +#define cswhFeatureTag LE_CSWH_FEATURE_TAG +#define saltFeatureTag LE_SALT_FEATURE_TAG +#define naltFeatureTag LE_NALT_FEATURE_TAG +#define rubyFeatureTag LE_RUBY_FEATURE_TAG +#define ss01FeatureTag LE_SS01_FEATURE_TAG +#define ss02FeatureTag LE_SS02_FEATURE_TAG +#define ss03FeatureTag LE_SS03_FEATURE_TAG +#define ss04FeatureTag LE_SS04_FEATURE_TAG +#define ss05FeatureTag LE_SS05_FEATURE_TAG +#define ss06FeatureTag LE_SS06_FEATURE_TAG +#define ss07FeatureTag LE_SS07_FEATURE_TAG #define ccmpFeatureMask 0x80000000UL #define ligaFeatureMask 0x40000000UL @@ -80,10 +96,27 @@ #define loclFeatureMask 0x01000000UL #define caltFeatureMask 0x00800000UL +#define dligFeatureMask 0x00400000UL +#define rligFeatureMask 0x00200000UL +#define hligFeatureMask 0x00100000UL +#define smcpFeatureMask 0x00080000UL +#define fracFeatureMask 0x00040000UL +#define afrcFeatureMask 0x00020000UL +#define zeroFeatureMask 0x00010000UL +#define swshFeatureMask 0x00008000UL +#define cswhFeatureMask 0x00004000UL +#define saltFeatureMask 0x00002000UL +#define naltFeatureMask 0x00001000UL +#define rubyFeatureMask 0x00000800UL +#define ss01FeatureMask 0x00000400UL +#define ss02FeatureMask 0x00000200UL +#define ss03FeatureMask 0x00000100UL +#define ss04FeatureMask 0x00000080UL +#define ss05FeatureMask 0x00000040UL +#define ss06FeatureMask 0x00000020UL +#define ss07FeatureMask 0x00000010UL + #define minimalFeatures (ccmpFeatureMask | markFeatureMask | mkmkFeatureMask | loclFeatureMask | caltFeatureMask) -#define ligaFeatures (ligaFeatureMask | cligFeatureMask | minimalFeatures) -#define kernFeatures (kernFeatureMask | paltFeatureMask | minimalFeatures) -#define kernAndLigaFeatures (ligaFeatures | kernFeatures) static const FeatureMap featureMap[] = { @@ -95,7 +128,24 @@ {markFeatureTag, markFeatureMask}, {mkmkFeatureTag, mkmkFeatureMask}, {loclFeatureTag, loclFeatureMask}, - {caltFeatureTag, caltFeatureMask} + {caltFeatureTag, caltFeatureMask}, + {hligFeatureTag, hligFeatureMask}, + {smcpFeatureTag, smcpFeatureMask}, + {fracFeatureTag, fracFeatureMask}, + {afrcFeatureTag, afrcFeatureMask}, + {zeroFeatureTag, zeroFeatureMask}, + {swshFeatureTag, swshFeatureMask}, + {cswhFeatureTag, cswhFeatureMask}, + {saltFeatureTag, saltFeatureMask}, + {naltFeatureTag, naltFeatureMask}, + {rubyFeatureTag, rubyFeatureMask}, + {ss01FeatureTag, ss01FeatureMask}, + {ss02FeatureTag, ss02FeatureMask}, + {ss03FeatureTag, ss03FeatureMask}, + {ss04FeatureTag, ss04FeatureMask}, + {ss05FeatureTag, ss05FeatureMask}, + {ss06FeatureTag, ss06FeatureMask}, + {ss07FeatureTag, ss07FeatureMask} }; static const le_int32 featureMapCount = LE_ARRAY_SIZE(featureMap); @@ -109,7 +159,6 @@ fGPOSTable(fontInstance, LE_GPOS_TABLE_TAG, success), fSubstitutionFilter(NULL) { applyTypoFlags(); - setScriptAndLanguageTags(); // JK patch, 2008-05-30 - see Sinhala bug report and LKLUG font @@ -123,17 +172,65 @@ const le_int32& typoFlags = fTypoFlags; const LEFontInstance *fontInstance = fFontInstance; - // todo: switch to more flags and bitfield rather than list of feature tags? - switch (typoFlags & ~0x80000000L) { - case 0: break; // default - case 1: fFeatureMask = kernFeatures; break; - case 2: fFeatureMask = ligaFeatures; break; - case 3: fFeatureMask = kernAndLigaFeatures; break; - default: break; + switch (typoFlags & (LE_SS01_FEATURE_FLAG + | LE_SS02_FEATURE_FLAG + | LE_SS03_FEATURE_FLAG + | LE_SS04_FEATURE_FLAG + | LE_SS05_FEATURE_FLAG + | LE_SS06_FEATURE_FLAG + | LE_SS07_FEATURE_FLAG)) { + case LE_SS01_FEATURE_FLAG: + fFeatureMask |= ss01FeatureMask; + break; + case LE_SS02_FEATURE_FLAG: + fFeatureMask |= ss02FeatureMask; + break; + case LE_SS03_FEATURE_FLAG: + fFeatureMask |= ss03FeatureMask; + break; + case LE_SS04_FEATURE_FLAG: + fFeatureMask |= ss04FeatureMask; + break; + case LE_SS05_FEATURE_FLAG: + fFeatureMask |= ss05FeatureMask; + break; + case LE_SS06_FEATURE_FLAG: + fFeatureMask |= ss06FeatureMask; + break; + case LE_SS07_FEATURE_FLAG: + fFeatureMask |= ss07FeatureMask; + break; } - if (typoFlags & 0x80000000L) { - fSubstitutionFilter = new CharSubstitutionFilter(fontInstance); + if (typoFlags & LE_Kerning_FEATURE_FLAG) { + fFeatureMask |= (kernFeatureMask | paltFeatureMask); + // Convenience. + } + if (typoFlags & LE_Ligatures_FEATURE_FLAG) { + fFeatureMask |= (ligaFeatureMask | cligFeatureMask); + // Convenience TODO: should add: .. dligFeatureMask | rligFeatureMask ? + } + if (typoFlags & LE_CLIG_FEATURE_FLAG) fFeatureMask |= cligFeatureMask; + if (typoFlags & LE_DLIG_FEATURE_FLAG) fFeatureMask |= dligFeatureMask; + if (typoFlags & LE_HLIG_FEATURE_FLAG) fFeatureMask |= hligFeatureMask; + if (typoFlags & LE_LIGA_FEATURE_FLAG) fFeatureMask |= ligaFeatureMask; + if (typoFlags & LE_RLIG_FEATURE_FLAG) fFeatureMask |= rligFeatureMask; + if (typoFlags & LE_SMCP_FEATURE_FLAG) fFeatureMask |= smcpFeatureMask; + if (typoFlags & LE_FRAC_FEATURE_FLAG) fFeatureMask |= fracFeatureMask; + if (typoFlags & LE_AFRC_FEATURE_FLAG) fFeatureMask |= afrcFeatureMask; + if (typoFlags & LE_ZERO_FEATURE_FLAG) fFeatureMask |= zeroFeatureMask; + if (typoFlags & LE_SWSH_FEATURE_FLAG) fFeatureMask |= swshFeatureMask; + if (typoFlags & LE_CSWH_FEATURE_FLAG) fFeatureMask |= cswhFeatureMask; + if (typoFlags & LE_SALT_FEATURE_FLAG) fFeatureMask |= saltFeatureMask; + if (typoFlags & LE_RUBY_FEATURE_FLAG) fFeatureMask |= rubyFeatureMask; + if (typoFlags & LE_NALT_FEATURE_FLAG) { + // Mutually exclusive with ALL other features. http://www.microsoft.com/typography/otspec/features_ko.htm + fFeatureMask = naltFeatureMask; + } + + if (typoFlags & LE_CHAR_FILTER_FEATURE_FLAG) { + // This isn't a font feature, but requests a Char Substitution Filter + fSubstitutionFilter = new CharSubstitutionFilter(fontInstance); } } @@ -331,7 +428,7 @@ { LEUnicode *outChars = NULL; LEGlyphStorage fakeGlyphStorage; - le_int32 outCharCount, outGlyphCount, fakeGlyphCount; + le_int32 outCharCount, outGlyphCount; if (LE_FAILURE(success)) { return 0; @@ -349,11 +446,13 @@ } if (outChars != NULL) { - fakeGlyphCount = glyphProcessing(outChars, 0, outCharCount, outCharCount, rightToLeft, fakeGlyphStorage, success); + // le_int32 fakeGlyphCount = + glyphProcessing(outChars, 0, outCharCount, outCharCount, rightToLeft, fakeGlyphStorage, success); LE_DELETE_ARRAY(outChars); // FIXME: a subclass may have allocated this, in which case this delete might not work... //adjustGlyphs(outChars, 0, outCharCount, rightToLeft, fakeGlyphs, fakeGlyphCount); } else { - fakeGlyphCount = glyphProcessing(chars, offset, count, max, rightToLeft, fakeGlyphStorage, success); + // le_int32 fakeGlyphCount = + glyphProcessing(chars, offset, count, max, rightToLeft, fakeGlyphStorage, success); //adjustGlyphs(chars, offset, count, rightToLeft, fakeGlyphs, fakeGlyphCount); }
--- a/src/share/native/sun/font/layout/PairPositioningSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/PairPositioningSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -126,6 +126,11 @@ { LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success); + + if (LE_FAILURE(success)) { + return 0; + } + GlyphIterator tempIterator(*glyphIterator); if (coverageIndex >= 0 && glyphIterator->next()) {
--- a/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ScriptAndLanguageTags.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved. + * (C) Copyright IBM Corp. 1998-2013. All Rights Reserved. * * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * YOU REALLY KNOW WHAT YOU'RE DOING. @@ -186,7 +186,18 @@ nbatScriptTag, /* 'nbat' (NBAT) */ palmScriptTag, /* 'palm' (PALM) */ sindScriptTag, /* 'sind' (SIND) */ - waraScriptTag /* 'wara' (WARA) */ + waraScriptTag, /* 'wara' (WARA) */ + afakScriptTag, /* 'afak' (AFAK) */ + jurcScriptTag, /* 'jurc' (JURC) */ + mrooScriptTag, /* 'mroo' (MROO) */ + nshuScriptTag, /* 'nshu' (NSHU) */ + shrdScriptTag, /* 'shrd' (SHARADA) */ + soraScriptTag, /* 'sora' (SORA_SOMPENG) */ + takrScriptTag, /* 'takr' (TAKRI) */ + tangScriptTag, /* 'tang' (TANG) */ + woleScriptTag, /* 'wole' (WOLE) */ + khojScriptTag, /* 'khoj' (KHOJ) */ + tirhScriptTag /* 'tirh' (TIRH) */ }; const LETag OpenTypeLayoutEngine::languageTags[] = {
--- a/src/share/native/sun/font/layout/ScriptAndLanguageTags.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/ScriptAndLanguageTags.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2010. All Rights Reserved. + * (C) Copyright IBM Corp. 1998-2013. All Rights Reserved. * * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS * YOU REALLY KNOW WHAT YOU'RE DOING. @@ -201,6 +201,17 @@ const LETag palmScriptTag = 0x70616C6D; /* 'palm' (PALM) */ const LETag sindScriptTag = 0x73696E64; /* 'sind' (SIND) */ const LETag waraScriptTag = 0x77617261; /* 'wara' (WARA) */ +const LETag afakScriptTag = 0x6166616B; /* 'afak' (AFAK) */ +const LETag jurcScriptTag = 0x6A757263; /* 'jurc' (JURC) */ +const LETag mrooScriptTag = 0x6D726F6F; /* 'mroo' (MROO) */ +const LETag nshuScriptTag = 0x6E736875; /* 'nshu' (NSHU) */ +const LETag shrdScriptTag = 0x73687264; /* 'shrd' (SHARADA) */ +const LETag soraScriptTag = 0x736F7261; /* 'sora' (SORA_SOMPENG) */ +const LETag takrScriptTag = 0x74616B72; /* 'takr' (TAKRI) */ +const LETag tangScriptTag = 0x74616E67; /* 'tang' (TANG) */ +const LETag woleScriptTag = 0x776F6C65; /* 'wole' (WOLE) */ +const LETag khojScriptTag = 0x6B686F6A; /* 'khoj' (KHOJ) */ +const LETag tirhScriptTag = 0x74697268; /* 'tirh' (TIRH) */ const LETag nullScriptTag = 0x00000000; /* '' (NULL) */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SegmentArrayProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,84 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" +#include "SegmentArrayProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentArrayProcessor2) + +SegmentArrayProcessor2::SegmentArrayProcessor2() +{ +} + +SegmentArrayProcessor2::SegmentArrayProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader, success) +{ + const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); + segmentArrayLookupTable = LEReferenceTo<SegmentArrayLookupTable>(morphSubtableHeader, success, &header->table); // don't parent to 'header' as it is on the stack +} + +SegmentArrayProcessor2::~SegmentArrayProcessor2() +{ +} + +void SegmentArrayProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + const LookupSegment *segments = segmentArrayLookupTable->segments; + le_int32 glyphCount = glyphStorage.getGlyphCount(); + le_int32 glyph; + + for (glyph = 0; glyph < glyphCount; glyph += 1) { + LEGlyphID thisGlyph = glyphStorage[glyph]; + const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segmentArrayLookupTable, segments, thisGlyph, success); + + if (lookupSegment != NULL) { + TTGlyphID firstGlyph = SWAPW(lookupSegment->firstGlyph); + le_int16 offset = SWAPW(lookupSegment->value); + + if (offset != 0) { + TTGlyphID *glyphArray = (TTGlyphID *) ((char *) subtableHeader.getAliasTODO() + offset); + TTGlyphID newGlyph = SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]); + + glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); + } + } + } +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SegmentArrayProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,82 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __SEGMENTARRAYPROCESSOR_H +#define __SEGMENTARRAYPROCESSOR_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class SegmentArrayProcessor2 : public NonContextualGlyphSubstitutionProcessor2 +{ +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); + + SegmentArrayProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + virtual ~SegmentArrayProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + SegmentArrayProcessor2(); + +protected: + LEReferenceTo<SegmentArrayLookupTable> segmentArrayLookupTable; + +}; + +U_NAMESPACE_END +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SegmentSingleProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,79 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" +#include "SegmentSingleProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SegmentSingleProcessor2) + +SegmentSingleProcessor2::SegmentSingleProcessor2() +{ +} + +SegmentSingleProcessor2::SegmentSingleProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader, success) +{ + const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); + + segmentSingleLookupTable = LEReferenceTo<SegmentSingleLookupTable>(morphSubtableHeader, success, &header->table); +} + +SegmentSingleProcessor2::~SegmentSingleProcessor2() +{ +} + +void SegmentSingleProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + const LookupSegment *segments = segmentSingleLookupTable->segments; + le_int32 glyphCount = glyphStorage.getGlyphCount(); + le_int32 glyph; + + for (glyph = 0; glyph < glyphCount; glyph += 1) { + LEGlyphID thisGlyph = glyphStorage[glyph]; + const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segmentSingleLookupTable, segments, thisGlyph, success); + + if (lookupSegment != NULL && LE_SUCCESS(success)) { + TTGlyphID newGlyph = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value); + + glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); + } + } +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SegmentSingleProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,82 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __SEGMENTSINGLEPROCESSOR_H +#define __SEGMENTSINGLEPROCESSOR_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class SegmentSingleProcessor2 : public NonContextualGlyphSubstitutionProcessor2 +{ +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); + + SegmentSingleProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + virtual ~SegmentSingleProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + SegmentSingleProcessor2(); + +protected: + LEReferenceTo<SegmentSingleLookupTable> segmentSingleLookupTable; + +}; + +U_NAMESPACE_END +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SimpleArrayProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,78 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" +#include "SimpleArrayProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleArrayProcessor2) + +SimpleArrayProcessor2::SimpleArrayProcessor2() +{ +} + +SimpleArrayProcessor2::SimpleArrayProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader, success) +{ + const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); + + simpleArrayLookupTable = LEReferenceTo<SimpleArrayLookupTable>(morphSubtableHeader, success, &header->table); + valueArray = LEReferenceToArrayOf<LookupValue>(morphSubtableHeader, success, &simpleArrayLookupTable->valueArray[0], LE_UNBOUNDED_ARRAY); +} + +SimpleArrayProcessor2::~SimpleArrayProcessor2() +{ +} + +void SimpleArrayProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + if (LE_FAILURE(success)) return; + le_int32 glyphCount = glyphStorage.getGlyphCount(); + le_int32 glyph; + + for (glyph = 0; glyph < glyphCount; glyph += 1) { + LEGlyphID thisGlyph = glyphStorage[glyph]; + if (LE_GET_GLYPH(thisGlyph) < 0xFFFF) { + TTGlyphID newGlyph = SWAPW(valueArray(LE_GET_GLYPH(thisGlyph),success)); + + glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); + } + } +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SimpleArrayProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,83 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __SIMPLEARRAYPROCESSOR2_H +#define __SIMPLEARRAYPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class SimpleArrayProcessor2 : public NonContextualGlyphSubstitutionProcessor2 +{ +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); + + SimpleArrayProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + virtual ~SimpleArrayProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + SimpleArrayProcessor2(); + +protected: + LEReferenceTo<SimpleArrayLookupTable> simpleArrayLookupTable; + LEReferenceToArrayOf<LookupValue> valueArray; + +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/SinglePositioningSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -70,6 +70,9 @@ { LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); @@ -84,6 +87,9 @@ { LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int16 coverageIndex = (le_int16) getGlyphCoverage(base, glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
--- a/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/SingleSubstitutionSubtables.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -69,6 +69,9 @@ { LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { TTGlyphID substitute = ((TTGlyphID) LE_GET_GLYPH(glyph)) + SWAPW(deltaGlyphID); @@ -87,6 +90,9 @@ { LEGlyphID glyph = glyphIterator->getCurrGlyphID(); le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0) { TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SingleTableProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,77 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" +#include "SingleTableProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SingleTableProcessor2) + +SingleTableProcessor2::SingleTableProcessor2() +{ +} + +SingleTableProcessor2::SingleTableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader, success) +{ + const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); + + singleTableLookupTable = LEReferenceTo<SingleTableLookupTable>(morphSubtableHeader, success, &header->table); +} + +SingleTableProcessor2::~SingleTableProcessor2() +{ +} + +void SingleTableProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + if(LE_FAILURE(success)) return; + const LookupSingle *entries = singleTableLookupTable->entries; + le_int32 glyph; + le_int32 glyphCount = glyphStorage.getGlyphCount(); + + for (glyph = 0; glyph < glyphCount; glyph += 1) { + const LookupSingle *lookupSingle = singleTableLookupTable->lookupSingle(singleTableLookupTable, entries, glyphStorage[glyph], success); + + if (lookupSingle != NULL) { + glyphStorage[glyph] = SWAPW(lookupSingle->value); + } + } +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SingleTableProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,82 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __SINGLETABLEPROCESSOR2_H +#define __SINGLETABLEPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class SingleTableProcessor2 : public NonContextualGlyphSubstitutionProcessor2 +{ +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); + + SingleTableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + virtual ~SingleTableProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + SingleTableProcessor2(); + +protected: + LEReferenceTo<SingleTableLookupTable> singleTableLookupTable; + +}; + +U_NAMESPACE_END +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/StateTableProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,236 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "StateTables.h" +#include "MorphStateTables.h" +#include "SubtableProcessor2.h" +#include "StateTableProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" +#include "LookupTables.h" + +U_NAMESPACE_BEGIN + +StateTableProcessor2::StateTableProcessor2() +{ +} + +StateTableProcessor2::StateTableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : SubtableProcessor2(morphSubtableHeader, success), stateTableHeader(morphSubtableHeader, success), + stHeader(stateTableHeader, success, (const StateTableHeader2*)&stateTableHeader->stHeader), + nClasses(0), classTableOffset(0), stateArrayOffset(0), entryTableOffset(0), classTable(), format(0), + stateArray() +{ + if (LE_FAILURE(success)) { + return; + } + nClasses = SWAPL(stHeader->nClasses); + classTableOffset = SWAPL(stHeader->classTableOffset); + stateArrayOffset = SWAPL(stHeader->stateArrayOffset); + entryTableOffset = SWAPL(stHeader->entryTableOffset); + + classTable = LEReferenceTo<LookupTable>(stHeader, success, classTableOffset); + format = SWAPW(classTable->format); + + stateArray = LEReferenceToArrayOf<EntryTableIndex2>(stHeader, success, stateArrayOffset, LE_UNBOUNDED_ARRAY); +} + +StateTableProcessor2::~StateTableProcessor2() +{ +} + +void StateTableProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + if (LE_FAILURE(success)) return; + // Start at state 0 + // XXX: How do we know when to start at state 1? + le_uint16 currentState = 0; + le_int32 glyphCount = glyphStorage.getGlyphCount(); + + LE_STATE_PATIENCE_INIT(); + + le_int32 currGlyph = 0; + if ((coverage & scfReverse2) != 0) { // process glyphs in descending order + currGlyph = glyphCount - 1; + dir = -1; + } else { + dir = 1; + } + + beginStateTable(); + switch (format) { + case ltfSimpleArray: { +#ifdef TEST_FORMAT + LEReferenceTo<SimpleArrayLookupTable> lookupTable0(classTable, success); + if(LE_FAILURE(success)) break; + while ((dir == 1 && currGlyph <= glyphCount) || (dir == -1 && currGlyph >= -1)) { + if (LE_FAILURE(success)) break; + if (LE_STATE_PATIENCE_DECR()) { + LE_DEBUG_BAD_FONT("patience exceeded - state table not moving") + break; // patience exceeded. + } + LookupValue classCode = classCodeOOB; + if (currGlyph == glyphCount || currGlyph == -1) { + // XXX: How do we handle EOT vs. EOL? + classCode = classCodeEOT; + } else { + LEGlyphID gid = glyphStorage[currGlyph]; + TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid); + + if (glyphCode == 0xFFFF) { + classCode = classCodeDEL; + } else { + classCode = SWAPW(lookupTable0->valueArray[gid]); + } + } + EntryTableIndex2 entryTableIndex = SWAPW(stateArray(classCode + currentState * nClasses, success)); + LE_STATE_PATIENCE_CURR(le_int32, currGlyph); + currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex); // return a zero-based index instead of a byte offset + LE_STATE_PATIENCE_INCR(currGlyph); + } +#endif + break; + } + case ltfSegmentSingle: { + LEReferenceTo<SegmentSingleLookupTable> lookupTable2(classTable, success); + if(LE_FAILURE(success)) break; + while ((dir == 1 && currGlyph <= glyphCount) || (dir == -1 && currGlyph >= -1)) { + if (LE_FAILURE(success)) break; + if (LE_STATE_PATIENCE_DECR()) { + LE_DEBUG_BAD_FONT("patience exceeded - state table not moving") + break; // patience exceeded. + } + LookupValue classCode = classCodeOOB; + if (currGlyph == glyphCount || currGlyph == -1) { + // XXX: How do we handle EOT vs. EOL? + classCode = classCodeEOT; + } else { + LEGlyphID gid = glyphStorage[currGlyph]; + TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid); + + if (glyphCode == 0xFFFF) { + classCode = classCodeDEL; + } else { + const LookupSegment *segment = + lookupTable2->lookupSegment(lookupTable2, lookupTable2->segments, gid, success); + if (segment != NULL && LE_SUCCESS(success)) { + classCode = SWAPW(segment->value); + } + } + } + EntryTableIndex2 entryTableIndex = SWAPW(stateArray(classCode + currentState * nClasses,success)); + LE_STATE_PATIENCE_CURR(le_int32, currGlyph); + currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex, success); + LE_STATE_PATIENCE_INCR(currGlyph); + } + break; + } + case ltfSegmentArray: { + //printf("Lookup Table Format4: specific interpretation needed!\n"); + break; + } + case ltfSingleTable: { + LEReferenceTo<SingleTableLookupTable> lookupTable6(classTable, success); + while ((dir == 1 && currGlyph <= glyphCount) || (dir == -1 && currGlyph >= -1)) { + if (LE_FAILURE(success)) break; + if (LE_STATE_PATIENCE_DECR()) { + LE_DEBUG_BAD_FONT("patience exceeded - state table not moving") + break; // patience exceeded. + } + LookupValue classCode = classCodeOOB; + if (currGlyph == glyphCount || currGlyph == -1) { + // XXX: How do we handle EOT vs. EOL? + classCode = classCodeEOT; + } else if(currGlyph > glyphCount) { + // note if > glyphCount, we've run off the end (bad font) + currGlyph = glyphCount; + classCode = classCodeEOT; + } else { + LEGlyphID gid = glyphStorage[currGlyph]; + TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid); + + if (glyphCode == 0xFFFF) { + classCode = classCodeDEL; + } else { + const LookupSingle *segment = lookupTable6->lookupSingle(lookupTable6, lookupTable6->entries, gid, success); + if (segment != NULL) { + classCode = SWAPW(segment->value); + } + } + } + EntryTableIndex2 entryTableIndex = SWAPW(stateArray(classCode + currentState * nClasses, success)); + LE_STATE_PATIENCE_CURR(le_int32, currGlyph); + currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex, success); + LE_STATE_PATIENCE_INCR(currGlyph); + } + break; + } + case ltfTrimmedArray: { + LEReferenceTo<TrimmedArrayLookupTable> lookupTable8(classTable, success); + if (LE_FAILURE(success)) break; + TTGlyphID firstGlyph = SWAPW(lookupTable8->firstGlyph); + TTGlyphID lastGlyph = firstGlyph + SWAPW(lookupTable8->glyphCount); + + while ((dir == 1 && currGlyph <= glyphCount) || (dir == -1 && currGlyph >= -1)) { + if(LE_STATE_PATIENCE_DECR()) { + LE_DEBUG_BAD_FONT("patience exceeded - state table not moving") + break; // patience exceeded. + } + + LookupValue classCode = classCodeOOB; + if (currGlyph == glyphCount || currGlyph == -1) { + // XXX: How do we handle EOT vs. EOL? + classCode = classCodeEOT; + } else { + TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(glyphStorage[currGlyph]); + if (glyphCode == 0xFFFF) { + classCode = classCodeDEL; + } else if ((glyphCode >= firstGlyph) && (glyphCode < lastGlyph)) { + classCode = SWAPW(lookupTable8->valueArray[glyphCode - firstGlyph]); + } + } + EntryTableIndex2 entryTableIndex = SWAPW(stateArray(classCode + currentState * nClasses, success)); + LE_STATE_PATIENCE_CURR(le_int32, currGlyph); + currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex, success); + LE_STATE_PATIENCE_INCR(currGlyph); + } + break; + } + default: + break; + } + + endStateTable(); +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/StateTableProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,85 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __STATETABLEPROCESSOR2_H +#define __STATETABLEPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "MorphStateTables.h" +#include "SubtableProcessor2.h" +#include "LookupTables.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class StateTableProcessor2 : public SubtableProcessor2 +{ +public: + void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); + + virtual void beginStateTable() = 0; + + virtual le_uint16 processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex2 index, LEErrorCode &success) = 0; + + virtual void endStateTable() = 0; + +protected: + StateTableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + virtual ~StateTableProcessor2(); + + StateTableProcessor2(); + + le_int32 dir; + le_uint16 format; + le_uint32 nClasses; + le_uint32 classTableOffset; + le_uint32 stateArrayOffset; + le_uint32 entryTableOffset; + + LEReferenceTo<LookupTable> classTable; + LEReferenceToArrayOf<EntryTableIndex2> stateArray; + LEReferenceTo<MorphStateTableHeader2> stateTableHeader; + LEReferenceTo<StateTableHeader2> stHeader; // for convenience + +private: + StateTableProcessor2(const StateTableProcessor2 &other); // forbid copying of this class + StateTableProcessor2 &operator=(const StateTableProcessor2 &other); // forbid copying of this class +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/StateTables.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/StateTables.h Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -85,6 +85,14 @@ ByteOffset entryTableOffset; }; +struct StateTableHeader2 +{ + le_uint32 nClasses; + le_uint32 classTableOffset; + le_uint32 stateArrayOffset; + le_uint32 entryTableOffset; +}; + enum ClassCodes { classCodeEOT = 0, @@ -121,6 +129,14 @@ le_int16 flags; }; +typedef le_uint16 EntryTableIndex2; + +struct StateEntry2 // same struct different interpretation +{ + le_uint16 newStateIndex; + le_uint16 flags; +}; + U_NAMESPACE_END #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SubtableProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,57 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +SubtableProcessor2::SubtableProcessor2() +{ +} + +SubtableProcessor2::SubtableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : subtableHeader(morphSubtableHeader, success), length(0), coverage(0), subtableFeatures(0L) +{ + if(LE_FAILURE(success)) return; + + length = SWAPL(subtableHeader->length); + coverage = SWAPL(subtableHeader->coverage); + subtableFeatures = SWAPL(subtableHeader->subtableFeatures); +} + +SubtableProcessor2::~SubtableProcessor2() +{ +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/SubtableProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,70 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __SUBTABLEPROCESSOR2_H +#define __SUBTABLEPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class SubtableProcessor2 : public UMemory { +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success) = 0; + virtual ~SubtableProcessor2(); + +protected: + SubtableProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + SubtableProcessor2(); + + le_uint32 length; + SubtableCoverage2 coverage; + FeatureFlags subtableFeatures; + + const LEReferenceTo<MorphSubtableHeader2> subtableHeader; + +private: + + SubtableProcessor2(const SubtableProcessor2 &other); // forbid copying of this class + SubtableProcessor2 &operator=(const SubtableProcessor2 &other); // forbid copying of this class +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/font/layout/SunLayoutEngine.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/font/layout/SunLayoutEngine.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -203,16 +203,19 @@ getFloat(env, pt, x, y); jboolean rtl = (typo_flags & TYPO_RTL) != 0; int glyphCount = engine->layoutChars(chars, start - min, limit - start, len, rtl, x, y, success); - // fprintf(stderr, "sle nl len %d -> gc: %d\n", len, glyphCount); fflush(stderr); + // fprintf(stderr, "sle nl len %d -> gc: %d\n", len, glyphCount); fflush(stderr); engine->getGlyphPosition(glyphCount, x, y, success); - // fprintf(stderr, "layout glyphs: %d x: %g y: %g\n", glyphCount, x, y); fflush(stderr); - - if (putGV(env, gmask, baseIndex, gvdata, engine, glyphCount)) { - // !!! hmmm, could use current value in positions array of GVData... - putFloat(env, pt, x, y); - } + // fprintf(stderr, "layout glyphs: %d x: %g y: %g\n", glyphCount, x, y); fflush(stderr); + if (LE_FAILURE(success)) { + env->SetIntField(gvdata, gvdCountFID, -1); // flag failure + } else { + if (putGV(env, gmask, baseIndex, gvdata, engine, glyphCount)) { + // !!! hmmm, could use current value in positions array of GVData... + putFloat(env, pt, x, y); + } + } if (chars != buffer) { free(chars);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/TrimmedArrayProcessor2.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,82 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" +#include "TrimmedArrayProcessor2.h" +#include "LEGlyphStorage.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TrimmedArrayProcessor2) + +TrimmedArrayProcessor2::TrimmedArrayProcessor2() +{ +} + +TrimmedArrayProcessor2::TrimmedArrayProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success) + : NonContextualGlyphSubstitutionProcessor2(morphSubtableHeader, success) +{ + const LEReferenceTo<NonContextualGlyphSubstitutionHeader2> header(morphSubtableHeader, success); + + trimmedArrayLookupTable = LEReferenceTo<TrimmedArrayLookupTable>(morphSubtableHeader, success, &header->table); + firstGlyph = SWAPW(trimmedArrayLookupTable->firstGlyph); + lastGlyph = firstGlyph + SWAPW(trimmedArrayLookupTable->glyphCount); + valueArray = LEReferenceToArrayOf<LookupValue>(morphSubtableHeader, success, &trimmedArrayLookupTable->valueArray[0], LE_UNBOUNDED_ARRAY); +} + +TrimmedArrayProcessor2::~TrimmedArrayProcessor2() +{ +} + +void TrimmedArrayProcessor2::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) +{ + if(LE_FAILURE(success)) return; + le_int32 glyphCount = glyphStorage.getGlyphCount(); + le_int32 glyph; + + for (glyph = 0; glyph < glyphCount; glyph += 1) { + LEGlyphID thisGlyph = glyphStorage[glyph]; + TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(thisGlyph); + + if ((ttGlyph > firstGlyph) && (ttGlyph < lastGlyph)) { + TTGlyphID newGlyph = SWAPW(valueArray(ttGlyph - firstGlyph, success)); + + glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); + } + } +} + +U_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/font/layout/TrimmedArrayProcessor2.h Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,84 @@ +/* + * 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. + * + */ + +/* + * + * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * + */ + +#ifndef __TRIMMEDARRAYPROCESSOR2_H +#define __TRIMMEDARRAYPROCESSOR2_H + +/** + * \file + * \internal + */ + +#include "LETypes.h" +#include "MorphTables.h" +#include "SubtableProcessor2.h" +#include "NonContextualGlyphSubst.h" +#include "NonContextualGlyphSubstProc2.h" + +U_NAMESPACE_BEGIN + +class LEGlyphStorage; + +class TrimmedArrayProcessor2 : public NonContextualGlyphSubstitutionProcessor2 +{ +public: + virtual void process(LEGlyphStorage &glyphStorage, LEErrorCode &success); + + TrimmedArrayProcessor2(const LEReferenceTo<MorphSubtableHeader2> &morphSubtableHeader, LEErrorCode &success); + + virtual ~TrimmedArrayProcessor2(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID getStaticClassID(); + +private: + TrimmedArrayProcessor2(); + +protected: + TTGlyphID firstGlyph; + TTGlyphID lastGlyph; + LEReferenceTo<TrimmedArrayLookupTable> trimmedArrayLookupTable; + LEReferenceToArrayOf<LookupValue> valueArray; +}; + +U_NAMESPACE_END +#endif
--- a/src/share/native/sun/java2d/cmm/lcms/cmscam02.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmscam02.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -409,29 +409,29 @@ switch (lpMod -> surround) { - case CUTSHEET_SURROUND: - lpMod->F = 0.8; - lpMod->c = 0.41; - lpMod->Nc = 0.8; - break; + case CUTSHEET_SURROUND: + lpMod->F = 0.8; + lpMod->c = 0.41; + lpMod->Nc = 0.8; + break; - case DARK_SURROUND: - lpMod -> F = 0.8; - lpMod -> c = 0.525; - lpMod -> Nc = 0.8; - break; + case DARK_SURROUND: + lpMod -> F = 0.8; + lpMod -> c = 0.525; + lpMod -> Nc = 0.8; + break; - case DIM_SURROUND: - lpMod -> F = 0.9; - lpMod -> c = 0.59; - lpMod -> Nc = 0.95; - break; + case DIM_SURROUND: + lpMod -> F = 0.9; + lpMod -> c = 0.59; + lpMod -> Nc = 0.95; + break; - default: - // Average surround - lpMod -> F = 1.0; - lpMod -> c = 0.69; - lpMod -> Nc = 1.0; + default: + // Average surround + lpMod -> F = 1.0; + lpMod -> c = 0.69; + lpMod -> Nc = 1.0; } lpMod -> n = compute_n(lpMod);
--- a/src/share/native/sun/java2d/cmm/lcms/cmscgats.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmscgats.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -73,6 +73,7 @@ # define DIR_CHAR '/' #endif + // Symbols typedef enum { @@ -143,6 +144,8 @@ // Table. Each individual table can hold properties and rows & cols typedef struct _Table { + char SheetType[MAXSTR]; // The first row of the IT8 (the type) + int nSamples, nPatches; // Cols, Rows int SampleID; // Pos of ID @@ -162,7 +165,6 @@ // This struct hold all information about an open IT8 handler. typedef struct { - char SheetType[MAXSTR]; // The first row of the IT8 (the type) cmsUInt32Number TablesCount; // How many tables in this stream cmsUInt32Number nTable; // The actual table @@ -433,6 +435,8 @@ return FALSE; } + + // Makes a file path based on a given reference path // NOTE: this function doesn't check if the path exists or even if it's legal static @@ -574,7 +578,7 @@ if (it8->ch == '.') { // Decimal point cmsFloat64Number frac = 0.0; // fraction - int prec = 0; // precision + int prec = 0; // precision NextCh(it8); // Eats dec. point @@ -621,6 +625,81 @@ } } +// Parses a float number +// This can not call directly atof because it uses locale dependant +// parsing, while CCMX files always use . as decimal separator +static +cmsFloat64Number ParseFloatNumber(const char *Buffer) +{ + cmsFloat64Number dnum = 0.0; + int sign = 1; + + if (*Buffer == '-' || *Buffer == '+') { + + sign = (*Buffer == '-') ? -1 : 1; + Buffer++; + } + + + while (*Buffer && isdigit((int) *Buffer)) { + + dnum = dnum * 10.0 + (*Buffer - '0'); + if (*Buffer) Buffer++; + } + + if (*Buffer == '.') { + + cmsFloat64Number frac = 0.0; // fraction + int prec = 0; // precission + + if (*Buffer) Buffer++; + + while (*Buffer && isdigit((int) *Buffer)) { + + frac = frac * 10.0 + (*Buffer - '0'); + prec++; + if (*Buffer) Buffer++; + } + + dnum = dnum + (frac / xpow10(prec)); + } + + // Exponent, example 34.00E+20 + if (*Buffer && toupper(*Buffer) == 'E') { + + int e; + int sgn; + + if (*Buffer) Buffer++; + sgn = 1; + + if (*Buffer == '-') { + + sgn = -1; + if (*Buffer) Buffer++; + } + else + if (*Buffer == '+') { + + sgn = +1; + if (*Buffer) Buffer++; + } + + e = 0; + while (*Buffer && isdigit((int) *Buffer)) { + + if ((cmsFloat64Number) e * 10L < INT_MAX) + e = e * 10 + (*Buffer - '0'); + + if (*Buffer) Buffer++; + } + + e = sgn*e; + dnum = dnum * xpow10(e); + } + + return sign * dnum; +} // Reads next symbol @@ -1011,7 +1090,7 @@ cmsUInt32Number Free = it8 ->Allocator.BlockSize - it8 ->Allocator.Used; cmsUInt8Number* ptr; - size = _cmsALIGNLONG(size); + size = _cmsALIGNMEM(size); if (size > Free) { @@ -1212,7 +1291,7 @@ cmsHANDLE CMSEXPORT cmsIT8Alloc(cmsContext ContextID) { cmsIT8* it8; - int i; + cmsUInt32Number i; it8 = (cmsIT8*) _cmsMallocZero(ContextID, sizeof(cmsIT8)); if (it8 == NULL) return NULL; @@ -1243,7 +1322,7 @@ it8 -> lineno = 1; strcpy(it8->DoubleFormatter, DEFAULT_DBL_FORMAT); - strcpy(it8->SheetType, "CGATS.17"); + cmsIT8SetSheetType((cmsHANDLE) it8, "CGATS.17"); // Initialize predefined properties & data @@ -1260,18 +1339,15 @@ const char* CMSEXPORT cmsIT8GetSheetType(cmsHANDLE hIT8) { - cmsIT8* it8 = (cmsIT8*) hIT8; - - return it8 ->SheetType; - + return GetTable((cmsIT8*) hIT8)->SheetType; } cmsBool CMSEXPORT cmsIT8SetSheetType(cmsHANDLE hIT8, const char* Type) { - cmsIT8* it8 = (cmsIT8*) hIT8; - - strncpy(it8 ->SheetType, Type, MAXSTR-1); - it8 ->SheetType[MAXSTR-1] = 0; + TABLE* t = GetTable((cmsIT8*) hIT8); + + strncpy(t ->SheetType, Type, MAXSTR-1); + t ->SheetType[MAXSTR-1] = 0; return TRUE; } @@ -1285,8 +1361,6 @@ return AddToList(it8, &GetTable(it8)->HeaderList, "# ", NULL, Val, WRITE_UNCOOKED) != NULL; } - - // Sets a property cmsBool CMSEXPORT cmsIT8SetPropertyStr(cmsHANDLE hIT8, const char* Key, const char *Val) { @@ -1298,7 +1372,6 @@ return AddToList(it8, &GetTable(it8)->HeaderList, Key, NULL, Val, WRITE_STRINGIFY) != NULL; } - cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val) { cmsIT8* it8 = (cmsIT8*) hIT8; @@ -1351,8 +1424,7 @@ { const char *v = cmsIT8GetProperty(hIT8, cProp); - if (v) return atof(v); - else return 0.0; + return ParseFloatNumber(v); } const char* CMSEXPORT cmsIT8GetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char *SubKey) @@ -1553,6 +1625,9 @@ KEYVALUE* p; TABLE* t = GetTable(it8); + // Writes the type + WriteStr(fp, t->SheetType); + WriteStr(fp, "\n"); for (p = t->HeaderList; (p != NULL); p = p->Next) { @@ -1701,8 +1776,6 @@ sd.stream = fopen(cFileName, "wt"); if (!sd.stream) return FALSE; - WriteStr(&sd, it8->SheetType); - WriteStr(&sd, "\n"); for (i=0; i < it8 ->TablesCount; i++) { cmsIT8SetTable(hIT8, i); @@ -1737,20 +1810,18 @@ else sd.Max = 0; // Just counting the needed bytes - WriteStr(&sd, it8->SheetType); - WriteStr(&sd, "\n"); for (i=0; i < it8 ->TablesCount; i++) { - cmsIT8SetTable(hIT8, i); - WriteHeader(it8, &sd); - WriteDataFormat(&sd, it8); - WriteData(&sd, it8); + cmsIT8SetTable(hIT8, i); + WriteHeader(it8, &sd); + WriteDataFormat(&sd, it8); + WriteData(&sd, it8); } sd.Used++; // The \0 at the very end if (sd.Base) - sd.Ptr = 0; + *sd.Ptr = 0; *BytesNeeded = sd.Used; @@ -1963,12 +2034,8 @@ static -cmsBool ParseIT8(cmsIT8* it8, cmsBool nosheet) +void ReadType(cmsIT8* it8, char* SheetTypePtr) { - char* SheetTypePtr = it8 ->SheetType; - - if (nosheet == 0) { - // First line is a very special case. while (isseparator(it8->ch)) @@ -1979,9 +2046,20 @@ *SheetTypePtr++= (char) it8 ->ch; NextCh(it8); } - } *SheetTypePtr = 0; +} + + +static +cmsBool ParseIT8(cmsIT8* it8, cmsBool nosheet) +{ + char* SheetTypePtr = it8 ->Tab[0].SheetType; + + if (nosheet == 0) { + ReadType(it8, SheetTypePtr); + } + InSymbol(it8); SkipEOLN(it8); @@ -2003,6 +2081,39 @@ AllocTable(it8); it8 ->nTable = it8 ->TablesCount - 1; + + // Read sheet type if present. We only support identifier and string. + // <ident> <eoln> is a type string + // anything else, is not a type string + if (nosheet == 0) { + + if (it8 ->sy == SIDENT) { + + // May be a type sheet or may be a prop value statement. We cannot use insymbol in + // this special case... + while (isseparator(it8->ch)) + NextCh(it8); + + // If a newline is found, then this is a type string + if (it8 ->ch == '\n') { + + cmsIT8SetSheetType(it8, it8 ->id); + InSymbol(it8); + } + else + { + // It is not. Just continue + cmsIT8SetSheetType(it8, ""); + } + } + else + // Validate quoted strings + if (it8 ->sy == SSTRING) { + cmsIT8SetSheetType(it8, it8 ->str); + InSymbol(it8); + } + } + } break; @@ -2123,14 +2234,14 @@ // Try to infere if the file is a CGATS/IT8 file at all. Read first line // that should be something like some printable characters plus a \n - +// returns 0 if this is not like a CGATS, or an integer otherwise. This integer is the number of words in first line? static int IsMyBlock(cmsUInt8Number* Buffer, int n) { - int cols = 1, space = 0, quot = 0; + int words = 1, space = 0, quot = 0; int i; - if (n < 10) return FALSE; // Too small + if (n < 10) return 0; // Too small if (n > 132) n = 132; @@ -2141,7 +2252,7 @@ { case '\n': case '\r': - return quot == 1 || cols > 2 ? 0 : cols; + return ((quot == 1) || (words > 2)) ? 0 : words; case '\t': case ' ': if(!quot && !space) @@ -2153,14 +2264,13 @@ default: if (Buffer[i] < 32) return 0; if (Buffer[i] > 127) return 0; - cols += space; + words += space; space = 0; break; } } - return FALSE; - + return 0; } @@ -2271,7 +2381,7 @@ it8 ->nTable = 0; if (fclose(it8 ->FileStack[0]->Stream)!= 0) { - cmsIT8Free(hIT8); + cmsIT8Free(hIT8); return NULL; } @@ -2454,13 +2564,7 @@ Buffer = cmsIT8GetDataRowCol(hIT8, row, col); - if (Buffer) { - - return atof(Buffer); - - } else - return 0; - + return ParseFloatNumber(Buffer); } @@ -2515,14 +2619,7 @@ Buffer = cmsIT8GetData(it8, cPatch, cSample); - if (Buffer) { - - return atof(Buffer); - - } else { - - return 0; - } + return ParseFloatNumber(Buffer); } @@ -2680,5 +2777,7 @@ strcpy(it8->DoubleFormatter, DEFAULT_DBL_FORMAT); else strcpy(it8->DoubleFormatter, Formatter); + + it8 ->DoubleFormatter[sizeof(it8 ->DoubleFormatter)-1] = 0; }
--- a/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -193,17 +193,21 @@ static cmsFloat64Number CHAD2Temp(const cmsMAT3* Chad) { - // Convert D50 across CHAD to get the absolute white point - cmsVEC3 d, s; - cmsCIEXYZ Dest; - cmsCIExyY DestChromaticity; - cmsFloat64Number TempK; + // Convert D50 across inverse CHAD to get the absolute white point + cmsVEC3 d, s; + cmsCIEXYZ Dest; + cmsCIExyY DestChromaticity; + cmsFloat64Number TempK; + cmsMAT3 m1, m2; + + m1 = *Chad; + if (!_cmsMAT3inverse(&m1, &m2)) return FALSE; s.n[VX] = cmsD50_XYZ() -> X; s.n[VY] = cmsD50_XYZ() -> Y; s.n[VZ] = cmsD50_XYZ() -> Z; - _cmsMAT3eval(&d, Chad, &s); + _cmsMAT3eval(&d, &m2, &s); Dest.X = d.n[VX]; Dest.Y = d.n[VY]; @@ -219,15 +223,14 @@ // Compute a CHAD based on a given temperature static -void Temp2CHAD(cmsMAT3* Chad, cmsFloat64Number Temp) + void Temp2CHAD(cmsMAT3* Chad, cmsFloat64Number Temp) { cmsCIEXYZ White; cmsCIExyY ChromaticityOfWhite; cmsWhitePointFromTemp(&ChromaticityOfWhite, Temp); cmsxyY2XYZ(&White, &ChromaticityOfWhite); - _cmsAdaptationMatrix(Chad, NULL, cmsD50_XYZ(), &White); - + _cmsAdaptationMatrix(Chad, NULL, &White, cmsD50_XYZ()); } // Join scalings to obtain relative input to absolute and then to relative output. @@ -240,7 +243,7 @@ const cmsMAT3* ChromaticAdaptationMatrixOut, cmsMAT3* m) { - cmsMAT3 Scale, m1, m2, m3; + cmsMAT3 Scale, m1, m2, m3, m4; // Adaptation state if (AdaptationState == 1.0) { @@ -259,23 +262,32 @@ _cmsVEC3init(&Scale.v[1], 0, WhitePointIn->Y / WhitePointOut->Y, 0); _cmsVEC3init(&Scale.v[2], 0, 0, WhitePointIn->Z / WhitePointOut->Z); - m1 = *ChromaticAdaptationMatrixIn; - if (!_cmsMAT3inverse(&m1, &m2)) return FALSE; - _cmsMAT3per(&m3, &m2, &Scale); + + if (AdaptationState == 0.0) { - // m3 holds CHAD from input white to D50 times abs. col. scaling - if (AdaptationState == 0.0) { + m1 = *ChromaticAdaptationMatrixOut; + _cmsMAT3per(&m2, &m1, &Scale); + // m2 holds CHAD from output white to D50 times abs. col. scaling // Observer is not adapted, undo the chromatic adaptation _cmsMAT3per(m, &m3, ChromaticAdaptationMatrixOut); + m3 = *ChromaticAdaptationMatrixIn; + if (!_cmsMAT3inverse(&m3, &m4)) return FALSE; + _cmsMAT3per(m, &m2, &m4); + } else { cmsMAT3 MixedCHAD; cmsFloat64Number TempSrc, TempDest, Temp; - TempSrc = CHAD2Temp(ChromaticAdaptationMatrixIn); // K for source white - TempDest = CHAD2Temp(ChromaticAdaptationMatrixOut); // K for dest white + m1 = *ChromaticAdaptationMatrixIn; + if (!_cmsMAT3inverse(&m1, &m2)) return FALSE; + _cmsMAT3per(&m3, &m2, &Scale); + // m3 holds CHAD from input white to D50 times abs. col. scaling + + TempSrc = CHAD2Temp(ChromaticAdaptationMatrixIn); + TempDest = CHAD2Temp(ChromaticAdaptationMatrixOut); if (TempSrc < 0.0 || TempDest < 0.0) return FALSE; // Something went wrong @@ -285,9 +297,9 @@ return TRUE; } - Temp = AdaptationState * TempSrc + (1.0 - AdaptationState) * TempDest; + Temp = (1.0 - AdaptationState) * TempDest + AdaptationState * TempSrc; - // Get a CHAD from D50 to whatever output temperature. This replaces output CHAD + // Get a CHAD from whatever output temperature to D50. This replaces output CHAD Temp2CHAD(&MixedCHAD, Temp); _cmsMAT3per(m, &m3, &MixedCHAD); @@ -362,7 +374,7 @@ cmsCIEXYZ BlackPointIn, BlackPointOut; cmsDetectBlackPoint(&BlackPointIn, hProfiles[i-1], Intent, 0); - cmsDetectBlackPoint(&BlackPointOut, hProfiles[i], Intent, 0); + cmsDetectDestinationBlackPoint(&BlackPointOut, hProfiles[i], Intent, 0); // If black points are equal, then do nothing if (BlackPointIn.X != BlackPointOut.X || @@ -463,6 +475,10 @@ // If they are same, they are compatible. if (a == b) return TRUE; + // Check for MCH4 substitution of CMYK + if ((a == cmsSig4colorData) && (b == cmsSigCmykData)) return TRUE; + if ((a == cmsSigCmykData) && (b == cmsSig4colorData)) return TRUE; + // Check for XYZ/Lab. Those spaces are interchangeable as they can be computed one from other. if ((a == cmsSigXYZData) && (b == cmsSigLabData)) return TRUE; if ((a == cmsSigLabData) && (b == cmsSigXYZData)) return TRUE; @@ -511,7 +527,7 @@ lIsInput = TRUE; } else { - // Else use profile in the input direction if current space is not PCS + // Else use profile in the input direction if current space is not PCS lIsInput = (CurrentColorSpace != cmsSigXYZData) && (CurrentColorSpace != cmsSigLabData); } @@ -537,7 +553,7 @@ // If devicelink is found, then no custom intent is allowed and we can // read the LUT to be applied. Settings don't apply here. - if (lIsDeviceLink) { + if (lIsDeviceLink || ((ClassSig == cmsSigNamedColorClass) && (nProfiles == 1))) { // Get the involved LUT from the profile Lut = _cmsReadDevicelinkLUT(hProfile, Intent); @@ -876,7 +892,8 @@ // Check for non-cmyk profiles if (cmsGetColorSpace(hProfiles[0]) != cmsSigCmykData || - cmsGetColorSpace(hProfiles[nProfiles-1]) != cmsSigCmykData) + !(cmsGetColorSpace(hProfiles[nProfiles-1]) == cmsSigCmykData || + cmsGetDeviceClass(hProfiles[nProfiles-1]) == cmsSigOutputClass)) return DefaultICCintents(ContextID, nProfiles, ICCIntents, hProfiles, BPC, AdaptationStates, dwFlags); // Allocate an empty LUT for holding the result @@ -893,6 +910,8 @@ // Get total area coverage (in 0..1 domain) bp.MaxTAC = cmsDetectTAC(hProfiles[nProfiles-1]) / 100.0; + if (bp.MaxTAC <= 0) goto Cleanup; + // Create a LUT holding normal ICC transform bp.cmyk2cmyk = DefaultICCintents(ContextID, @@ -902,6 +921,7 @@ BPC, AdaptationStates, dwFlags); + if (bp.cmyk2cmyk == NULL) goto Cleanup; // Now the tone curve bp.KTone = _cmsBuildKToneCurve(ContextID, 4096, nProfiles, @@ -910,7 +930,7 @@ BPC, AdaptationStates, dwFlags); - + if (bp.KTone == NULL) goto Cleanup; // To measure the output, Last profile to Lab hLab = cmsCreateLab4ProfileTHR(ContextID, NULL); @@ -918,6 +938,7 @@ CHANNELS_SH(4)|BYTES_SH(2), hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE); + if ( bp.hProofOutput == NULL) goto Cleanup; // Same as anterior, but lab in the 0..1 range bp.cmyk2Lab = cmsCreateTransformTHR(ContextID, hProfiles[nProfiles-1], @@ -925,6 +946,7 @@ FLOAT_SH(1)|CHANNELS_SH(3)|BYTES_SH(4), INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE); + if (bp.cmyk2Lab == NULL) goto Cleanup; cmsCloseProfile(hLab); // Error estimation (for debug only)
--- a/src/share/native/sun/java2d/cmm/lcms/cmserr.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmserr.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -72,17 +72,21 @@ // long int because C99 specifies ftell in such way (7.19.9.2) long int CMSEXPORT cmsfilelength(FILE* f) { - long int n; + long int p , n; + + p = ftell(f); // register current file position if (fseek(f, 0, SEEK_END) != 0) { return -1; } + n = ftell(f); - fseek(f, 0, SEEK_SET); + fseek(f, p, SEEK_SET); // file position restored return n; } + // Memory handling ------------------------------------------------------------------ // // This is the interface to low-level memory management routines. By default a simple @@ -160,6 +164,12 @@ { cmsUInt32Number Total = num * size; + // Preserve calloc behaviour + if (Total == 0) return NULL; + + // Safe check for overflow. + if (num >= UINT_MAX / size) return NULL; + // Check for overflow if (Total < num || Total < size) { return NULL; @@ -269,12 +279,16 @@ // Sub allocation takes care of many pointers of small size. The memory allocated in // this way have be freed at once. Next function allocates a single chunk for linked list // I prefer this method over realloc due to the big inpact on xput realloc may have if -// memory is being swapped to disk. This approach is safer (although thats not true on any platform) +// memory is being swapped to disk. This approach is safer (although that may not be true on all platforms) static _cmsSubAllocator_chunk* _cmsCreateSubAllocChunk(cmsContext ContextID, cmsUInt32Number Initial) { _cmsSubAllocator_chunk* chunk; + // 20K by default + if (Initial == 0) + Initial = 20*1024; + // Create the container chunk = (_cmsSubAllocator_chunk*) _cmsMallocZero(ContextID, sizeof(_cmsSubAllocator_chunk)); if (chunk == NULL) return NULL; @@ -288,9 +302,7 @@ return NULL; } - // 20K by default - if (Initial == 0) - Initial = 20*1024; + chunk ->BlockSize = Initial; chunk ->Used = 0; @@ -344,7 +356,7 @@ cmsUInt32Number Free = sub -> h ->BlockSize - sub -> h -> Used; cmsUInt8Number* ptr; - size = _cmsALIGNLONG(size); + size = _cmsALIGNMEM(size); // Check for memory. If there is no room, allocate a new chunk of double memory size. if (size > Free) {
--- a/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -277,18 +277,28 @@ switch (Type) { - // X = Y ^ Gamma + // X = Y ^ Gamma case 1: - if (R < 0) - Val = 0; + if (R < 0) { + + if (fabs(Params[0] - 1.0) < MATRIX_DET_TOLERANCE) + Val = R; + else + Val = 0; + } else Val = pow(R, Params[0]); break; // Type 1 Reversed: X = Y ^1/gamma case -1: - if (R < 0) - Val = 0; + if (R < 0) { + + if (fabs(Params[0] - 1.0) < MATRIX_DET_TOLERANCE) + Val = R; + else + Val = 0; + } else Val = pow(R, 1/Params[0]); break; @@ -552,6 +562,19 @@ return MINUS_INF; } +// Access to estimated low-res table +cmsUInt32Number CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t) +{ + _cmsAssert(t != NULL); + return t ->nEntries; +} + +const cmsUInt16Number* CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t) +{ + _cmsAssert(t != NULL); + return t ->Table16; +} + // Create an empty gamma curve, by using tables. This specifies only the limited-precision part, and leaves the // floating point description empty. @@ -828,7 +851,7 @@ cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsInt32Number nResultSamples, const cmsToneCurve* InCurve) { cmsToneCurve *out; - cmsFloat64Number a = 1, b = 0, y, x1, y1, x2, y2; + cmsFloat64Number a = 0, b = 0, y, x1, y1, x2, y2; int i, j; int Ascending; @@ -859,6 +882,7 @@ j = GetInterval(y, InCurve->Table16, InCurve->InterpParams); if (j >= 0) { + // Get limits of interval x1 = InCurve ->Table16[j]; x2 = InCurve ->Table16[j+1]; @@ -883,6 +907,7 @@ out ->Table16[i] = _cmsQuickSaturateWord(a* y + b); } + return out; } @@ -891,7 +916,7 @@ { _cmsAssert(InGamma != NULL); - return cmsReverseToneCurveEx(InGamma -> nEntries, InGamma); + return cmsReverseToneCurveEx(4096, InGamma); } // From: Eilers, P.H.C. (1994) Smoothing and interpolation with finite @@ -1035,20 +1060,42 @@ { int n; int i, last; + cmsBool lDescending; _cmsAssert(t != NULL); - n = t ->nEntries; - last = t ->Table16[n-1]; + // Degenerated curves are monotonic? Ok, let's pass them + n = t ->nEntries; + if (n < 2) return TRUE; - for (i = n-2; i >= 0; --i) { + // Curve direction + lDescending = cmsIsToneCurveDescending(t); + + if (lDescending) { + + last = t ->Table16[0]; + + for (i = 1; i < n; i++) { - if (t ->Table16[i] > last) + if (t ->Table16[i] - last > 2) // We allow some ripple + return FALSE; + else + last = t ->Table16[i]; + + } + } + else { - return FALSE; - else - last = t ->Table16[i]; + last = t ->Table16[n-1]; + + for (i = n-2; i >= 0; --i) { + if (t ->Table16[i] - last > 2) + return FALSE; + else + last = t ->Table16[i]; + + } } return TRUE; @@ -1163,4 +1210,3 @@ return (sum / n); // The mean } -
--- a/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -212,7 +212,6 @@ // Make sure it is monotonic if (!cmsIsToneCurveMonotonic(KTone)) { - cmsFreeToneCurve(KTone); return NULL; } @@ -246,7 +245,7 @@ GAMUTCHAIN* t = (GAMUTCHAIN* ) Cargo; cmsCIELab LabIn1, LabOut1; cmsCIELab LabIn2, LabOut2; - cmsFloat32Number Proof[cmsMAXCHANNELS], Proof2[cmsMAXCHANNELS]; + cmsUInt16Number Proof[cmsMAXCHANNELS], Proof2[cmsMAXCHANNELS]; cmsFloat64Number dE1, dE2, ErrorRatio; // Assume in-gamut by default. @@ -396,8 +395,8 @@ cmsFLAGS_NOCACHE); - // Does create the forward step. Lab double to cmsFloat32Number - dwFormat = (FLOAT_SH(1)|CHANNELS_SH(nChannels)|BYTES_SH(4)); + // Does create the forward step. Lab double to device + dwFormat = (CHANNELS_SH(nChannels)|BYTES_SH(2)); Chain.hForward = cmsCreateTransformTHR(ContextID, hLab, TYPE_Lab_DBL, hGamut, dwFormat, @@ -421,10 +420,10 @@ if (Gamut != NULL) { - CLUT = cmsStageAllocCLut16bit(ContextID, nGridpoints, nChannels, 1, NULL); - cmsPipelineInsertStage(Gamut, cmsAT_BEGIN, CLUT); + CLUT = cmsStageAllocCLut16bit(ContextID, nGridpoints, nChannels, 1, NULL); + cmsPipelineInsertStage(Gamut, cmsAT_BEGIN, CLUT); - cmsStageSampleCLut16bit(CLUT, GamutSampler, (void*) &Chain, 0); + cmsStageSampleCLut16bit(CLUT, GamutSampler, (void*) &Chain, 0); } } else
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/native/sun/java2d/cmm/lcms/cmshalf.c Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,564 @@ +/* + * 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. + */ + +// This file is available under and governed by the GNU General Public +// License version 2 only, as published by the Free Software Foundation. +// However, the following notice accompanied the original version of this +// file: +// +//--------------------------------------------------------------------------------- +// +// Little Color Management System +// Copyright (c) 1998-2012 Marti Maria Saguer +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//--------------------------------------------------------------------------------- +// +// +#include "lcms2_internal.h" + +#ifndef CMS_NO_HALF_SUPPORT + +// This code is inspired in the paper "Fast Half Float Conversions" +// by Jeroen van der Zijp + +static cmsUInt32Number Mantissa[2048] = { + +0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34a00000, +0x34c00000, 0x34e00000, 0x35000000, 0x35100000, 0x35200000, 0x35300000, +0x35400000, 0x35500000, 0x35600000, 0x35700000, 0x35800000, 0x35880000, +0x35900000, 0x35980000, 0x35a00000, 0x35a80000, 0x35b00000, 0x35b80000, +0x35c00000, 0x35c80000, 0x35d00000, 0x35d80000, 0x35e00000, 0x35e80000, +0x35f00000, 0x35f80000, 0x36000000, 0x36040000, 0x36080000, 0x360c0000, +0x36100000, 0x36140000, 0x36180000, 0x361c0000, 0x36200000, 0x36240000, +0x36280000, 0x362c0000, 0x36300000, 0x36340000, 0x36380000, 0x363c0000, +0x36400000, 0x36440000, 0x36480000, 0x364c0000, 0x36500000, 0x36540000, +0x36580000, 0x365c0000, 0x36600000, 0x36640000, 0x36680000, 0x366c0000, +0x36700000, 0x36740000, 0x36780000, 0x367c0000, 0x36800000, 0x36820000, +0x36840000, 0x36860000, 0x36880000, 0x368a0000, 0x368c0000, 0x368e0000, +0x36900000, 0x36920000, 0x36940000, 0x36960000, 0x36980000, 0x369a0000, +0x369c0000, 0x369e0000, 0x36a00000, 0x36a20000, 0x36a40000, 0x36a60000, +0x36a80000, 0x36aa0000, 0x36ac0000, 0x36ae0000, 0x36b00000, 0x36b20000, +0x36b40000, 0x36b60000, 0x36b80000, 0x36ba0000, 0x36bc0000, 0x36be0000, +0x36c00000, 0x36c20000, 0x36c40000, 0x36c60000, 0x36c80000, 0x36ca0000, +0x36cc0000, 0x36ce0000, 0x36d00000, 0x36d20000, 0x36d40000, 0x36d60000, +0x36d80000, 0x36da0000, 0x36dc0000, 0x36de0000, 0x36e00000, 0x36e20000, +0x36e40000, 0x36e60000, 0x36e80000, 0x36ea0000, 0x36ec0000, 0x36ee0000, +0x36f00000, 0x36f20000, 0x36f40000, 0x36f60000, 0x36f80000, 0x36fa0000, +0x36fc0000, 0x36fe0000, 0x37000000, 0x37010000, 0x37020000, 0x37030000, +0x37040000, 0x37050000, 0x37060000, 0x37070000, 0x37080000, 0x37090000, +0x370a0000, 0x370b0000, 0x370c0000, 0x370d0000, 0x370e0000, 0x370f0000, +0x37100000, 0x37110000, 0x37120000, 0x37130000, 0x37140000, 0x37150000, +0x37160000, 0x37170000, 0x37180000, 0x37190000, 0x371a0000, 0x371b0000, +0x371c0000, 0x371d0000, 0x371e0000, 0x371f0000, 0x37200000, 0x37210000, +0x37220000, 0x37230000, 0x37240000, 0x37250000, 0x37260000, 0x37270000, +0x37280000, 0x37290000, 0x372a0000, 0x372b0000, 0x372c0000, 0x372d0000, +0x372e0000, 0x372f0000, 0x37300000, 0x37310000, 0x37320000, 0x37330000, +0x37340000, 0x37350000, 0x37360000, 0x37370000, 0x37380000, 0x37390000, +0x373a0000, 0x373b0000, 0x373c0000, 0x373d0000, 0x373e0000, 0x373f0000, +0x37400000, 0x37410000, 0x37420000, 0x37430000, 0x37440000, 0x37450000, +0x37460000, 0x37470000, 0x37480000, 0x37490000, 0x374a0000, 0x374b0000, +0x374c0000, 0x374d0000, 0x374e0000, 0x374f0000, 0x37500000, 0x37510000, +0x37520000, 0x37530000, 0x37540000, 0x37550000, 0x37560000, 0x37570000, +0x37580000, 0x37590000, 0x375a0000, 0x375b0000, 0x375c0000, 0x375d0000, +0x375e0000, 0x375f0000, 0x37600000, 0x37610000, 0x37620000, 0x37630000, +0x37640000, 0x37650000, 0x37660000, 0x37670000, 0x37680000, 0x37690000, +0x376a0000, 0x376b0000, 0x376c0000, 0x376d0000, 0x376e0000, 0x376f0000, +0x37700000, 0x37710000, 0x37720000, 0x37730000, 0x37740000, 0x37750000, +0x37760000, 0x37770000, 0x37780000, 0x37790000, 0x377a0000, 0x377b0000, +0x377c0000, 0x377d0000, 0x377e0000, 0x377f0000, 0x37800000, 0x37808000, +0x37810000, 0x37818000, 0x37820000, 0x37828000, 0x37830000, 0x37838000, +0x37840000, 0x37848000, 0x37850000, 0x37858000, 0x37860000, 0x37868000, +0x37870000, 0x37878000, 0x37880000, 0x37888000, 0x37890000, 0x37898000, +0x378a0000, 0x378a8000, 0x378b0000, 0x378b8000, 0x378c0000, 0x378c8000, +0x378d0000, 0x378d8000, 0x378e0000, 0x378e8000, 0x378f0000, 0x378f8000, +0x37900000, 0x37908000, 0x37910000, 0x37918000, 0x37920000, 0x37928000, +0x37930000, 0x37938000, 0x37940000, 0x37948000, 0x37950000, 0x37958000, +0x37960000, 0x37968000, 0x37970000, 0x37978000, 0x37980000, 0x37988000, +0x37990000, 0x37998000, 0x379a0000, 0x379a8000, 0x379b0000, 0x379b8000, +0x379c0000, 0x379c8000, 0x379d0000, 0x379d8000, 0x379e0000, 0x379e8000, +0x379f0000, 0x379f8000, 0x37a00000, 0x37a08000, 0x37a10000, 0x37a18000, +0x37a20000, 0x37a28000, 0x37a30000, 0x37a38000, 0x37a40000, 0x37a48000, +0x37a50000, 0x37a58000, 0x37a60000, 0x37a68000, 0x37a70000, 0x37a78000, +0x37a80000, 0x37a88000, 0x37a90000, 0x37a98000, 0x37aa0000, 0x37aa8000, +0x37ab0000, 0x37ab8000, 0x37ac0000, 0x37ac8000, 0x37ad0000, 0x37ad8000, +0x37ae0000, 0x37ae8000, 0x37af0000, 0x37af8000, 0x37b00000, 0x37b08000, +0x37b10000, 0x37b18000, 0x37b20000, 0x37b28000, 0x37b30000, 0x37b38000, +0x37b40000, 0x37b48000, 0x37b50000, 0x37b58000, 0x37b60000, 0x37b68000, +0x37b70000, 0x37b78000, 0x37b80000, 0x37b88000, 0x37b90000, 0x37b98000, +0x37ba0000, 0x37ba8000, 0x37bb0000, 0x37bb8000, 0x37bc0000, 0x37bc8000, +0x37bd0000, 0x37bd8000, 0x37be0000, 0x37be8000, 0x37bf0000, 0x37bf8000, +0x37c00000, 0x37c08000, 0x37c10000, 0x37c18000, 0x37c20000, 0x37c28000, +0x37c30000, 0x37c38000, 0x37c40000, 0x37c48000, 0x37c50000, 0x37c58000, +0x37c60000, 0x37c68000, 0x37c70000, 0x37c78000, 0x37c80000, 0x37c88000, +0x37c90000, 0x37c98000, 0x37ca0000, 0x37ca8000, 0x37cb0000, 0x37cb8000, +0x37cc0000, 0x37cc8000, 0x37cd0000, 0x37cd8000, 0x37ce0000, 0x37ce8000, +0x37cf0000, 0x37cf8000, 0x37d00000, 0x37d08000, 0x37d10000, 0x37d18000, +0x37d20000, 0x37d28000, 0x37d30000, 0x37d38000, 0x37d40000, 0x37d48000, +0x37d50000, 0x37d58000, 0x37d60000, 0x37d68000, 0x37d70000, 0x37d78000, +0x37d80000, 0x37d88000, 0x37d90000, 0x37d98000, 0x37da0000, 0x37da8000, +0x37db0000, 0x37db8000, 0x37dc0000, 0x37dc8000, 0x37dd0000, 0x37dd8000, +0x37de0000, 0x37de8000, 0x37df0000, 0x37df8000, 0x37e00000, 0x37e08000, +0x37e10000, 0x37e18000, 0x37e20000, 0x37e28000, 0x37e30000, 0x37e38000, +0x37e40000, 0x37e48000, 0x37e50000, 0x37e58000, 0x37e60000, 0x37e68000, +0x37e70000, 0x37e78000, 0x37e80000, 0x37e88000, 0x37e90000, 0x37e98000, +0x37ea0000, 0x37ea8000, 0x37eb0000, 0x37eb8000, 0x37ec0000, 0x37ec8000, +0x37ed0000, 0x37ed8000, 0x37ee0000, 0x37ee8000, 0x37ef0000, 0x37ef8000, +0x37f00000, 0x37f08000, 0x37f10000, 0x37f18000, 0x37f20000, 0x37f28000, +0x37f30000, 0x37f38000, 0x37f40000, 0x37f48000, 0x37f50000, 0x37f58000, +0x37f60000, 0x37f68000, 0x37f70000, 0x37f78000, 0x37f80000, 0x37f88000, +0x37f90000, 0x37f98000, 0x37fa0000, 0x37fa8000, 0x37fb0000, 0x37fb8000, +0x37fc0000, 0x37fc8000, 0x37fd0000, 0x37fd8000, 0x37fe0000, 0x37fe8000, +0x37ff0000, 0x37ff8000, 0x38000000, 0x38004000, 0x38008000, 0x3800c000, +0x38010000, 0x38014000, 0x38018000, 0x3801c000, 0x38020000, 0x38024000, +0x38028000, 0x3802c000, 0x38030000, 0x38034000, 0x38038000, 0x3803c000, +0x38040000, 0x38044000, 0x38048000, 0x3804c000, 0x38050000, 0x38054000, +0x38058000, 0x3805c000, 0x38060000, 0x38064000, 0x38068000, 0x3806c000, +0x38070000, 0x38074000, 0x38078000, 0x3807c000, 0x38080000, 0x38084000, +0x38088000, 0x3808c000, 0x38090000, 0x38094000, 0x38098000, 0x3809c000, +0x380a0000, 0x380a4000, 0x380a8000, 0x380ac000, 0x380b0000, 0x380b4000, +0x380b8000, 0x380bc000, 0x380c0000, 0x380c4000, 0x380c8000, 0x380cc000, +0x380d0000, 0x380d4000, 0x380d8000, 0x380dc000, 0x380e0000, 0x380e4000, +0x380e8000, 0x380ec000, 0x380f0000, 0x380f4000, 0x380f8000, 0x380fc000, +0x38100000, 0x38104000, 0x38108000, 0x3810c000, 0x38110000, 0x38114000, +0x38118000, 0x3811c000, 0x38120000, 0x38124000, 0x38128000, 0x3812c000, +0x38130000, 0x38134000, 0x38138000, 0x3813c000, 0x38140000, 0x38144000, +0x38148000, 0x3814c000, 0x38150000, 0x38154000, 0x38158000, 0x3815c000, +0x38160000, 0x38164000, 0x38168000, 0x3816c000, 0x38170000, 0x38174000, +0x38178000, 0x3817c000, 0x38180000, 0x38184000, 0x38188000, 0x3818c000, +0x38190000, 0x38194000, 0x38198000, 0x3819c000, 0x381a0000, 0x381a4000, +0x381a8000, 0x381ac000, 0x381b0000, 0x381b4000, 0x381b8000, 0x381bc000, +0x381c0000, 0x381c4000, 0x381c8000, 0x381cc000, 0x381d0000, 0x381d4000, +0x381d8000, 0x381dc000, 0x381e0000, 0x381e4000, 0x381e8000, 0x381ec000, +0x381f0000, 0x381f4000, 0x381f8000, 0x381fc000, 0x38200000, 0x38204000, +0x38208000, 0x3820c000, 0x38210000, 0x38214000, 0x38218000, 0x3821c000, +0x38220000, 0x38224000, 0x38228000, 0x3822c000, 0x38230000, 0x38234000, +0x38238000, 0x3823c000, 0x38240000, 0x38244000, 0x38248000, 0x3824c000, +0x38250000, 0x38254000, 0x38258000, 0x3825c000, 0x38260000, 0x38264000, +0x38268000, 0x3826c000, 0x38270000, 0x38274000, 0x38278000, 0x3827c000, +0x38280000, 0x38284000, 0x38288000, 0x3828c000, 0x38290000, 0x38294000, +0x38298000, 0x3829c000, 0x382a0000, 0x382a4000, 0x382a8000, 0x382ac000, +0x382b0000, 0x382b4000, 0x382b8000, 0x382bc000, 0x382c0000, 0x382c4000, +0x382c8000, 0x382cc000, 0x382d0000, 0x382d4000, 0x382d8000, 0x382dc000, +0x382e0000, 0x382e4000, 0x382e8000, 0x382ec000, 0x382f0000, 0x382f4000, +0x382f8000, 0x382fc000, 0x38300000, 0x38304000, 0x38308000, 0x3830c000, +0x38310000, 0x38314000, 0x38318000, 0x3831c000, 0x38320000, 0x38324000, +0x38328000, 0x3832c000, 0x38330000, 0x38334000, 0x38338000, 0x3833c000, +0x38340000, 0x38344000, 0x38348000, 0x3834c000, 0x38350000, 0x38354000, +0x38358000, 0x3835c000, 0x38360000, 0x38364000, 0x38368000, 0x3836c000, +0x38370000, 0x38374000, 0x38378000, 0x3837c000, 0x38380000, 0x38384000, +0x38388000, 0x3838c000, 0x38390000, 0x38394000, 0x38398000, 0x3839c000, +0x383a0000, 0x383a4000, 0x383a8000, 0x383ac000, 0x383b0000, 0x383b4000, +0x383b8000, 0x383bc000, 0x383c0000, 0x383c4000, 0x383c8000, 0x383cc000, +0x383d0000, 0x383d4000, 0x383d8000, 0x383dc000, 0x383e0000, 0x383e4000, +0x383e8000, 0x383ec000, 0x383f0000, 0x383f4000, 0x383f8000, 0x383fc000, +0x38400000, 0x38404000, 0x38408000, 0x3840c000, 0x38410000, 0x38414000, +0x38418000, 0x3841c000, 0x38420000, 0x38424000, 0x38428000, 0x3842c000, +0x38430000, 0x38434000, 0x38438000, 0x3843c000, 0x38440000, 0x38444000, +0x38448000, 0x3844c000, 0x38450000, 0x38454000, 0x38458000, 0x3845c000, +0x38460000, 0x38464000, 0x38468000, 0x3846c000, 0x38470000, 0x38474000, +0x38478000, 0x3847c000, 0x38480000, 0x38484000, 0x38488000, 0x3848c000, +0x38490000, 0x38494000, 0x38498000, 0x3849c000, 0x384a0000, 0x384a4000, +0x384a8000, 0x384ac000, 0x384b0000, 0x384b4000, 0x384b8000, 0x384bc000, +0x384c0000, 0x384c4000, 0x384c8000, 0x384cc000, 0x384d0000, 0x384d4000, +0x384d8000, 0x384dc000, 0x384e0000, 0x384e4000, 0x384e8000, 0x384ec000, +0x384f0000, 0x384f4000, 0x384f8000, 0x384fc000, 0x38500000, 0x38504000, +0x38508000, 0x3850c000, 0x38510000, 0x38514000, 0x38518000, 0x3851c000, +0x38520000, 0x38524000, 0x38528000, 0x3852c000, 0x38530000, 0x38534000, +0x38538000, 0x3853c000, 0x38540000, 0x38544000, 0x38548000, 0x3854c000, +0x38550000, 0x38554000, 0x38558000, 0x3855c000, 0x38560000, 0x38564000, +0x38568000, 0x3856c000, 0x38570000, 0x38574000, 0x38578000, 0x3857c000, +0x38580000, 0x38584000, 0x38588000, 0x3858c000, 0x38590000, 0x38594000, +0x38598000, 0x3859c000, 0x385a0000, 0x385a4000, 0x385a8000, 0x385ac000, +0x385b0000, 0x385b4000, 0x385b8000, 0x385bc000, 0x385c0000, 0x385c4000, +0x385c8000, 0x385cc000, 0x385d0000, 0x385d4000, 0x385d8000, 0x385dc000, +0x385e0000, 0x385e4000, 0x385e8000, 0x385ec000, 0x385f0000, 0x385f4000, +0x385f8000, 0x385fc000, 0x38600000, 0x38604000, 0x38608000, 0x3860c000, +0x38610000, 0x38614000, 0x38618000, 0x3861c000, 0x38620000, 0x38624000, +0x38628000, 0x3862c000, 0x38630000, 0x38634000, 0x38638000, 0x3863c000, +0x38640000, 0x38644000, 0x38648000, 0x3864c000, 0x38650000, 0x38654000, +0x38658000, 0x3865c000, 0x38660000, 0x38664000, 0x38668000, 0x3866c000, +0x38670000, 0x38674000, 0x38678000, 0x3867c000, 0x38680000, 0x38684000, +0x38688000, 0x3868c000, 0x38690000, 0x38694000, 0x38698000, 0x3869c000, +0x386a0000, 0x386a4000, 0x386a8000, 0x386ac000, 0x386b0000, 0x386b4000, +0x386b8000, 0x386bc000, 0x386c0000, 0x386c4000, 0x386c8000, 0x386cc000, +0x386d0000, 0x386d4000, 0x386d8000, 0x386dc000, 0x386e0000, 0x386e4000, +0x386e8000, 0x386ec000, 0x386f0000, 0x386f4000, 0x386f8000, 0x386fc000, +0x38700000, 0x38704000, 0x38708000, 0x3870c000, 0x38710000, 0x38714000, +0x38718000, 0x3871c000, 0x38720000, 0x38724000, 0x38728000, 0x3872c000, +0x38730000, 0x38734000, 0x38738000, 0x3873c000, 0x38740000, 0x38744000, +0x38748000, 0x3874c000, 0x38750000, 0x38754000, 0x38758000, 0x3875c000, +0x38760000, 0x38764000, 0x38768000, 0x3876c000, 0x38770000, 0x38774000, +0x38778000, 0x3877c000, 0x38780000, 0x38784000, 0x38788000, 0x3878c000, +0x38790000, 0x38794000, 0x38798000, 0x3879c000, 0x387a0000, 0x387a4000, +0x387a8000, 0x387ac000, 0x387b0000, 0x387b4000, 0x387b8000, 0x387bc000, +0x387c0000, 0x387c4000, 0x387c8000, 0x387cc000, 0x387d0000, 0x387d4000, +0x387d8000, 0x387dc000, 0x387e0000, 0x387e4000, 0x387e8000, 0x387ec000, +0x387f0000, 0x387f4000, 0x387f8000, 0x387fc000, 0x38000000, 0x38002000, +0x38004000, 0x38006000, 0x38008000, 0x3800a000, 0x3800c000, 0x3800e000, +0x38010000, 0x38012000, 0x38014000, 0x38016000, 0x38018000, 0x3801a000, +0x3801c000, 0x3801e000, 0x38020000, 0x38022000, 0x38024000, 0x38026000, +0x38028000, 0x3802a000, 0x3802c000, 0x3802e000, 0x38030000, 0x38032000, +0x38034000, 0x38036000, 0x38038000, 0x3803a000, 0x3803c000, 0x3803e000, +0x38040000, 0x38042000, 0x38044000, 0x38046000, 0x38048000, 0x3804a000, +0x3804c000, 0x3804e000, 0x38050000, 0x38052000, 0x38054000, 0x38056000, +0x38058000, 0x3805a000, 0x3805c000, 0x3805e000, 0x38060000, 0x38062000, +0x38064000, 0x38066000, 0x38068000, 0x3806a000, 0x3806c000, 0x3806e000, +0x38070000, 0x38072000, 0x38074000, 0x38076000, 0x38078000, 0x3807a000, +0x3807c000, 0x3807e000, 0x38080000, 0x38082000, 0x38084000, 0x38086000, +0x38088000, 0x3808a000, 0x3808c000, 0x3808e000, 0x38090000, 0x38092000, +0x38094000, 0x38096000, 0x38098000, 0x3809a000, 0x3809c000, 0x3809e000, +0x380a0000, 0x380a2000, 0x380a4000, 0x380a6000, 0x380a8000, 0x380aa000, +0x380ac000, 0x380ae000, 0x380b0000, 0x380b2000, 0x380b4000, 0x380b6000, +0x380b8000, 0x380ba000, 0x380bc000, 0x380be000, 0x380c0000, 0x380c2000, +0x380c4000, 0x380c6000, 0x380c8000, 0x380ca000, 0x380cc000, 0x380ce000, +0x380d0000, 0x380d2000, 0x380d4000, 0x380d6000, 0x380d8000, 0x380da000, +0x380dc000, 0x380de000, 0x380e0000, 0x380e2000, 0x380e4000, 0x380e6000, +0x380e8000, 0x380ea000, 0x380ec000, 0x380ee000, 0x380f0000, 0x380f2000, +0x380f4000, 0x380f6000, 0x380f8000, 0x380fa000, 0x380fc000, 0x380fe000, +0x38100000, 0x38102000, 0x38104000, 0x38106000, 0x38108000, 0x3810a000, +0x3810c000, 0x3810e000, 0x38110000, 0x38112000, 0x38114000, 0x38116000, +0x38118000, 0x3811a000, 0x3811c000, 0x3811e000, 0x38120000, 0x38122000, +0x38124000, 0x38126000, 0x38128000, 0x3812a000, 0x3812c000, 0x3812e000, +0x38130000, 0x38132000, 0x38134000, 0x38136000, 0x38138000, 0x3813a000, +0x3813c000, 0x3813e000, 0x38140000, 0x38142000, 0x38144000, 0x38146000, +0x38148000, 0x3814a000, 0x3814c000, 0x3814e000, 0x38150000, 0x38152000, +0x38154000, 0x38156000, 0x38158000, 0x3815a000, 0x3815c000, 0x3815e000, +0x38160000, 0x38162000, 0x38164000, 0x38166000, 0x38168000, 0x3816a000, +0x3816c000, 0x3816e000, 0x38170000, 0x38172000, 0x38174000, 0x38176000, +0x38178000, 0x3817a000, 0x3817c000, 0x3817e000, 0x38180000, 0x38182000, +0x38184000, 0x38186000, 0x38188000, 0x3818a000, 0x3818c000, 0x3818e000, +0x38190000, 0x38192000, 0x38194000, 0x38196000, 0x38198000, 0x3819a000, +0x3819c000, 0x3819e000, 0x381a0000, 0x381a2000, 0x381a4000, 0x381a6000, +0x381a8000, 0x381aa000, 0x381ac000, 0x381ae000, 0x381b0000, 0x381b2000, +0x381b4000, 0x381b6000, 0x381b8000, 0x381ba000, 0x381bc000, 0x381be000, +0x381c0000, 0x381c2000, 0x381c4000, 0x381c6000, 0x381c8000, 0x381ca000, +0x381cc000, 0x381ce000, 0x381d0000, 0x381d2000, 0x381d4000, 0x381d6000, +0x381d8000, 0x381da000, 0x381dc000, 0x381de000, 0x381e0000, 0x381e2000, +0x381e4000, 0x381e6000, 0x381e8000, 0x381ea000, 0x381ec000, 0x381ee000, +0x381f0000, 0x381f2000, 0x381f4000, 0x381f6000, 0x381f8000, 0x381fa000, +0x381fc000, 0x381fe000, 0x38200000, 0x38202000, 0x38204000, 0x38206000, +0x38208000, 0x3820a000, 0x3820c000, 0x3820e000, 0x38210000, 0x38212000, +0x38214000, 0x38216000, 0x38218000, 0x3821a000, 0x3821c000, 0x3821e000, +0x38220000, 0x38222000, 0x38224000, 0x38226000, 0x38228000, 0x3822a000, +0x3822c000, 0x3822e000, 0x38230000, 0x38232000, 0x38234000, 0x38236000, +0x38238000, 0x3823a000, 0x3823c000, 0x3823e000, 0x38240000, 0x38242000, +0x38244000, 0x38246000, 0x38248000, 0x3824a000, 0x3824c000, 0x3824e000, +0x38250000, 0x38252000, 0x38254000, 0x38256000, 0x38258000, 0x3825a000, +0x3825c000, 0x3825e000, 0x38260000, 0x38262000, 0x38264000, 0x38266000, +0x38268000, 0x3826a000, 0x3826c000, 0x3826e000, 0x38270000, 0x38272000, +0x38274000, 0x38276000, 0x38278000, 0x3827a000, 0x3827c000, 0x3827e000, +0x38280000, 0x38282000, 0x38284000, 0x38286000, 0x38288000, 0x3828a000, +0x3828c000, 0x3828e000, 0x38290000, 0x38292000, 0x38294000, 0x38296000, +0x38298000, 0x3829a000, 0x3829c000, 0x3829e000, 0x382a0000, 0x382a2000, +0x382a4000, 0x382a6000, 0x382a8000, 0x382aa000, 0x382ac000, 0x382ae000, +0x382b0000, 0x382b2000, 0x382b4000, 0x382b6000, 0x382b8000, 0x382ba000, +0x382bc000, 0x382be000, 0x382c0000, 0x382c2000, 0x382c4000, 0x382c6000, +0x382c8000, 0x382ca000, 0x382cc000, 0x382ce000, 0x382d0000, 0x382d2000, +0x382d4000, 0x382d6000, 0x382d8000, 0x382da000, 0x382dc000, 0x382de000, +0x382e0000, 0x382e2000, 0x382e4000, 0x382e6000, 0x382e8000, 0x382ea000, +0x382ec000, 0x382ee000, 0x382f0000, 0x382f2000, 0x382f4000, 0x382f6000, +0x382f8000, 0x382fa000, 0x382fc000, 0x382fe000, 0x38300000, 0x38302000, +0x38304000, 0x38306000, 0x38308000, 0x3830a000, 0x3830c000, 0x3830e000, +0x38310000, 0x38312000, 0x38314000, 0x38316000, 0x38318000, 0x3831a000, +0x3831c000, 0x3831e000, 0x38320000, 0x38322000, 0x38324000, 0x38326000, +0x38328000, 0x3832a000, 0x3832c000, 0x3832e000, 0x38330000, 0x38332000, +0x38334000, 0x38336000, 0x38338000, 0x3833a000, 0x3833c000, 0x3833e000, +0x38340000, 0x38342000, 0x38344000, 0x38346000, 0x38348000, 0x3834a000, +0x3834c000, 0x3834e000, 0x38350000, 0x38352000, 0x38354000, 0x38356000, +0x38358000, 0x3835a000, 0x3835c000, 0x3835e000, 0x38360000, 0x38362000, +0x38364000, 0x38366000, 0x38368000, 0x3836a000, 0x3836c000, 0x3836e000, +0x38370000, 0x38372000, 0x38374000, 0x38376000, 0x38378000, 0x3837a000, +0x3837c000, 0x3837e000, 0x38380000, 0x38382000, 0x38384000, 0x38386000, +0x38388000, 0x3838a000, 0x3838c000, 0x3838e000, 0x38390000, 0x38392000, +0x38394000, 0x38396000, 0x38398000, 0x3839a000, 0x3839c000, 0x3839e000, +0x383a0000, 0x383a2000, 0x383a4000, 0x383a6000, 0x383a8000, 0x383aa000, +0x383ac000, 0x383ae000, 0x383b0000, 0x383b2000, 0x383b4000, 0x383b6000, +0x383b8000, 0x383ba000, 0x383bc000, 0x383be000, 0x383c0000, 0x383c2000, +0x383c4000, 0x383c6000, 0x383c8000, 0x383ca000, 0x383cc000, 0x383ce000, +0x383d0000, 0x383d2000, 0x383d4000, 0x383d6000, 0x383d8000, 0x383da000, +0x383dc000, 0x383de000, 0x383e0000, 0x383e2000, 0x383e4000, 0x383e6000, +0x383e8000, 0x383ea000, 0x383ec000, 0x383ee000, 0x383f0000, 0x383f2000, +0x383f4000, 0x383f6000, 0x383f8000, 0x383fa000, 0x383fc000, 0x383fe000, +0x38400000, 0x38402000, 0x38404000, 0x38406000, 0x38408000, 0x3840a000, +0x3840c000, 0x3840e000, 0x38410000, 0x38412000, 0x38414000, 0x38416000, +0x38418000, 0x3841a000, 0x3841c000, 0x3841e000, 0x38420000, 0x38422000, +0x38424000, 0x38426000, 0x38428000, 0x3842a000, 0x3842c000, 0x3842e000, +0x38430000, 0x38432000, 0x38434000, 0x38436000, 0x38438000, 0x3843a000, +0x3843c000, 0x3843e000, 0x38440000, 0x38442000, 0x38444000, 0x38446000, +0x38448000, 0x3844a000, 0x3844c000, 0x3844e000, 0x38450000, 0x38452000, +0x38454000, 0x38456000, 0x38458000, 0x3845a000, 0x3845c000, 0x3845e000, +0x38460000, 0x38462000, 0x38464000, 0x38466000, 0x38468000, 0x3846a000, +0x3846c000, 0x3846e000, 0x38470000, 0x38472000, 0x38474000, 0x38476000, +0x38478000, 0x3847a000, 0x3847c000, 0x3847e000, 0x38480000, 0x38482000, +0x38484000, 0x38486000, 0x38488000, 0x3848a000, 0x3848c000, 0x3848e000, +0x38490000, 0x38492000, 0x38494000, 0x38496000, 0x38498000, 0x3849a000, +0x3849c000, 0x3849e000, 0x384a0000, 0x384a2000, 0x384a4000, 0x384a6000, +0x384a8000, 0x384aa000, 0x384ac000, 0x384ae000, 0x384b0000, 0x384b2000, +0x384b4000, 0x384b6000, 0x384b8000, 0x384ba000, 0x384bc000, 0x384be000, +0x384c0000, 0x384c2000, 0x384c4000, 0x384c6000, 0x384c8000, 0x384ca000, +0x384cc000, 0x384ce000, 0x384d0000, 0x384d2000, 0x384d4000, 0x384d6000, +0x384d8000, 0x384da000, 0x384dc000, 0x384de000, 0x384e0000, 0x384e2000, +0x384e4000, 0x384e6000, 0x384e8000, 0x384ea000, 0x384ec000, 0x384ee000, +0x384f0000, 0x384f2000, 0x384f4000, 0x384f6000, 0x384f8000, 0x384fa000, +0x384fc000, 0x384fe000, 0x38500000, 0x38502000, 0x38504000, 0x38506000, +0x38508000, 0x3850a000, 0x3850c000, 0x3850e000, 0x38510000, 0x38512000, +0x38514000, 0x38516000, 0x38518000, 0x3851a000, 0x3851c000, 0x3851e000, +0x38520000, 0x38522000, 0x38524000, 0x38526000, 0x38528000, 0x3852a000, +0x3852c000, 0x3852e000, 0x38530000, 0x38532000, 0x38534000, 0x38536000, +0x38538000, 0x3853a000, 0x3853c000, 0x3853e000, 0x38540000, 0x38542000, +0x38544000, 0x38546000, 0x38548000, 0x3854a000, 0x3854c000, 0x3854e000, +0x38550000, 0x38552000, 0x38554000, 0x38556000, 0x38558000, 0x3855a000, +0x3855c000, 0x3855e000, 0x38560000, 0x38562000, 0x38564000, 0x38566000, +0x38568000, 0x3856a000, 0x3856c000, 0x3856e000, 0x38570000, 0x38572000, +0x38574000, 0x38576000, 0x38578000, 0x3857a000, 0x3857c000, 0x3857e000, +0x38580000, 0x38582000, 0x38584000, 0x38586000, 0x38588000, 0x3858a000, +0x3858c000, 0x3858e000, 0x38590000, 0x38592000, 0x38594000, 0x38596000, +0x38598000, 0x3859a000, 0x3859c000, 0x3859e000, 0x385a0000, 0x385a2000, +0x385a4000, 0x385a6000, 0x385a8000, 0x385aa000, 0x385ac000, 0x385ae000, +0x385b0000, 0x385b2000, 0x385b4000, 0x385b6000, 0x385b8000, 0x385ba000, +0x385bc000, 0x385be000, 0x385c0000, 0x385c2000, 0x385c4000, 0x385c6000, +0x385c8000, 0x385ca000, 0x385cc000, 0x385ce000, 0x385d0000, 0x385d2000, +0x385d4000, 0x385d6000, 0x385d8000, 0x385da000, 0x385dc000, 0x385de000, +0x385e0000, 0x385e2000, 0x385e4000, 0x385e6000, 0x385e8000, 0x385ea000, +0x385ec000, 0x385ee000, 0x385f0000, 0x385f2000, 0x385f4000, 0x385f6000, +0x385f8000, 0x385fa000, 0x385fc000, 0x385fe000, 0x38600000, 0x38602000, +0x38604000, 0x38606000, 0x38608000, 0x3860a000, 0x3860c000, 0x3860e000, +0x38610000, 0x38612000, 0x38614000, 0x38616000, 0x38618000, 0x3861a000, +0x3861c000, 0x3861e000, 0x38620000, 0x38622000, 0x38624000, 0x38626000, +0x38628000, 0x3862a000, 0x3862c000, 0x3862e000, 0x38630000, 0x38632000, +0x38634000, 0x38636000, 0x38638000, 0x3863a000, 0x3863c000, 0x3863e000, +0x38640000, 0x38642000, 0x38644000, 0x38646000, 0x38648000, 0x3864a000, +0x3864c000, 0x3864e000, 0x38650000, 0x38652000, 0x38654000, 0x38656000, +0x38658000, 0x3865a000, 0x3865c000, 0x3865e000, 0x38660000, 0x38662000, +0x38664000, 0x38666000, 0x38668000, 0x3866a000, 0x3866c000, 0x3866e000, +0x38670000, 0x38672000, 0x38674000, 0x38676000, 0x38678000, 0x3867a000, +0x3867c000, 0x3867e000, 0x38680000, 0x38682000, 0x38684000, 0x38686000, +0x38688000, 0x3868a000, 0x3868c000, 0x3868e000, 0x38690000, 0x38692000, +0x38694000, 0x38696000, 0x38698000, 0x3869a000, 0x3869c000, 0x3869e000, +0x386a0000, 0x386a2000, 0x386a4000, 0x386a6000, 0x386a8000, 0x386aa000, +0x386ac000, 0x386ae000, 0x386b0000, 0x386b2000, 0x386b4000, 0x386b6000, +0x386b8000, 0x386ba000, 0x386bc000, 0x386be000, 0x386c0000, 0x386c2000, +0x386c4000, 0x386c6000, 0x386c8000, 0x386ca000, 0x386cc000, 0x386ce000, +0x386d0000, 0x386d2000, 0x386d4000, 0x386d6000, 0x386d8000, 0x386da000, +0x386dc000, 0x386de000, 0x386e0000, 0x386e2000, 0x386e4000, 0x386e6000, +0x386e8000, 0x386ea000, 0x386ec000, 0x386ee000, 0x386f0000, 0x386f2000, +0x386f4000, 0x386f6000, 0x386f8000, 0x386fa000, 0x386fc000, 0x386fe000, +0x38700000, 0x38702000, 0x38704000, 0x38706000, 0x38708000, 0x3870a000, +0x3870c000, 0x3870e000, 0x38710000, 0x38712000, 0x38714000, 0x38716000, +0x38718000, 0x3871a000, 0x3871c000, 0x3871e000, 0x38720000, 0x38722000, +0x38724000, 0x38726000, 0x38728000, 0x3872a000, 0x3872c000, 0x3872e000, +0x38730000, 0x38732000, 0x38734000, 0x38736000, 0x38738000, 0x3873a000, +0x3873c000, 0x3873e000, 0x38740000, 0x38742000, 0x38744000, 0x38746000, +0x38748000, 0x3874a000, 0x3874c000, 0x3874e000, 0x38750000, 0x38752000, +0x38754000, 0x38756000, 0x38758000, 0x3875a000, 0x3875c000, 0x3875e000, +0x38760000, 0x38762000, 0x38764000, 0x38766000, 0x38768000, 0x3876a000, +0x3876c000, 0x3876e000, 0x38770000, 0x38772000, 0x38774000, 0x38776000, +0x38778000, 0x3877a000, 0x3877c000, 0x3877e000, 0x38780000, 0x38782000, +0x38784000, 0x38786000, 0x38788000, 0x3878a000, 0x3878c000, 0x3878e000, +0x38790000, 0x38792000, 0x38794000, 0x38796000, 0x38798000, 0x3879a000, +0x3879c000, 0x3879e000, 0x387a0000, 0x387a2000, 0x387a4000, 0x387a6000, +0x387a8000, 0x387aa000, 0x387ac000, 0x387ae000, 0x387b0000, 0x387b2000, +0x387b4000, 0x387b6000, 0x387b8000, 0x387ba000, 0x387bc000, 0x387be000, +0x387c0000, 0x387c2000, 0x387c4000, 0x387c6000, 0x387c8000, 0x387ca000, +0x387cc000, 0x387ce000, 0x387d0000, 0x387d2000, 0x387d4000, 0x387d6000, +0x387d8000, 0x387da000, 0x387dc000, 0x387de000, 0x387e0000, 0x387e2000, +0x387e4000, 0x387e6000, 0x387e8000, 0x387ea000, 0x387ec000, 0x387ee000, +0x387f0000, 0x387f2000, 0x387f4000, 0x387f6000, 0x387f8000, 0x387fa000, +0x387fc000, 0x387fe000 +}; + +static cmsUInt16Number Offset[64] = { +0x0000, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0000, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, +0x0400, 0x0400, 0x0400, 0x0400 +}; + +static cmsUInt32Number Exponent[64] = { +0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000, +0x03000000, 0x03800000, 0x04000000, 0x04800000, 0x05000000, 0x05800000, +0x06000000, 0x06800000, 0x07000000, 0x07800000, 0x08000000, 0x08800000, +0x09000000, 0x09800000, 0x0a000000, 0x0a800000, 0x0b000000, 0x0b800000, +0x0c000000, 0x0c800000, 0x0d000000, 0x0d800000, 0x0e000000, 0x0e800000, +0x0f000000, 0x47800000, 0x80000000, 0x80800000, 0x81000000, 0x81800000, +0x82000000, 0x82800000, 0x83000000, 0x83800000, 0x84000000, 0x84800000, +0x85000000, 0x85800000, 0x86000000, 0x86800000, 0x87000000, 0x87800000, +0x88000000, 0x88800000, 0x89000000, 0x89800000, 0x8a000000, 0x8a800000, +0x8b000000, 0x8b800000, 0x8c000000, 0x8c800000, 0x8d000000, 0x8d800000, +0x8e000000, 0x8e800000, 0x8f000000, 0xc7800000 +}; + +static cmsUInt16Number Base[512] = { +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, +0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00, +0x2000, 0x2400, 0x2800, 0x2c00, 0x3000, 0x3400, 0x3800, 0x3c00, 0x4000, 0x4400, +0x4800, 0x4c00, 0x5000, 0x5400, 0x5800, 0x5c00, 0x6000, 0x6400, 0x6800, 0x6c00, +0x7000, 0x7400, 0x7800, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, +0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, +0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001, +0x8002, 0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100, 0x8200, 0x8400, +0x8800, 0x8c00, 0x9000, 0x9400, 0x9800, 0x9c00, 0xa000, 0xa400, 0xa800, 0xac00, +0xb000, 0xb400, 0xb800, 0xbc00, 0xc000, 0xc400, 0xc800, 0xcc00, 0xd000, 0xd400, +0xd800, 0xdc00, 0xe000, 0xe400, 0xe800, 0xec00, 0xf000, 0xf400, 0xf800, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, +0xfc00, 0xfc00 +}; + +static cmsUInt8Number Shift[512] = { +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17, +0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, +0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, +0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0d, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, +0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, +0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, +0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x0d +}; + +cmsFloat32Number _cmsHalf2Float(cmsUInt16Number h) +{ + union { + cmsFloat32Number flt; + cmsUInt32Number num; + } out; + + int n = h >> 10; + + out.num = Mantissa[ (h & 0x3ff) + Offset[ n ] ] + Exponent[ n ]; + return out.flt; +} + +cmsUInt16Number _cmsFloat2Half(cmsFloat32Number flt) +{ + union { + cmsFloat32Number flt; + cmsUInt32Number num; + } in; + + cmsUInt32Number n, j; + + in.flt = flt; + n = in.num; + j = (n >> 23) & 0x1ff; + + return (cmsUInt16Number) ((cmsUInt32Number) Base[ j ] + (( n & 0x007fffff) >> Shift[ j ])); +} + +#endif
--- a/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -55,7 +55,7 @@ #include "lcms2_internal.h" -// This module incorporates several interpolation routines, for 1, 3, 4, 5, 6, 7 and 8 channels on input and +// This module incorporates several interpolation routines, for 1 to 8 channels on input and // up to 65535 channels on output. The user may change those by using the interpolation plug-in // Interpolation routines by default @@ -83,7 +83,7 @@ // Set the interpolation method -static + cmsBool _cmsSetInterpolationRoutine(cmsInterpParams* p) { // Invoke factory, possibly in the Plug-in @@ -318,6 +318,116 @@ } } +// Bilinear interpolation (16 bits) - cmsFloat32Number version +static +void BilinearInterpFloat(const cmsFloat32Number Input[], + cmsFloat32Number Output[], + const cmsInterpParams* p) + +{ +# define LERP(a,l,h) (cmsFloat32Number) ((l)+(((h)-(l))*(a))) +# define DENS(i,j) (LutTable[(i)+(j)+OutChan]) + + const cmsFloat32Number* LutTable = (cmsFloat32Number*) p ->Table; + cmsFloat32Number px, py; + int x0, y0, + X0, Y0, X1, Y1; + int TotalOut, OutChan; + cmsFloat32Number fx, fy, + d00, d01, d10, d11, + dx0, dx1, + dxy; + + TotalOut = p -> nOutputs; + px = Input[0] * p->Domain[0]; + py = Input[1] * p->Domain[1]; + + x0 = (int) _cmsQuickFloor(px); fx = px - (cmsFloat32Number) x0; + y0 = (int) _cmsQuickFloor(py); fy = py - (cmsFloat32Number) y0; + + X0 = p -> opta[1] * x0; + X1 = X0 + (Input[0] >= 1.0 ? 0 : p->opta[1]); + + Y0 = p -> opta[0] * y0; + Y1 = Y0 + (Input[1] >= 1.0 ? 0 : p->opta[0]); + + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + + d00 = DENS(X0, Y0); + d01 = DENS(X0, Y1); + d10 = DENS(X1, Y0); + d11 = DENS(X1, Y1); + + dx0 = LERP(fx, d00, d10); + dx1 = LERP(fx, d01, d11); + + dxy = LERP(fy, dx0, dx1); + + Output[OutChan] = dxy; + } + + +# undef LERP +# undef DENS +} + +// Bilinear interpolation (16 bits) - optimized version +static +void BilinearInterp16(register const cmsUInt16Number Input[], + register cmsUInt16Number Output[], + register const cmsInterpParams* p) + +{ +#define DENS(i,j) (LutTable[(i)+(j)+OutChan]) +#define LERP(a,l,h) (cmsUInt16Number) (l + ROUND_FIXED_TO_INT(((h-l)*a))) + + const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table; + int OutChan, TotalOut; + cmsS15Fixed16Number fx, fy; + register int rx, ry; + int x0, y0; + register int X0, X1, Y0, Y1; + int d00, d01, d10, d11, + dx0, dx1, + dxy; + + TotalOut = p -> nOutputs; + + fx = _cmsToFixedDomain((int) Input[0] * p -> Domain[0]); + x0 = FIXED_TO_INT(fx); + rx = FIXED_REST_TO_INT(fx); // Rest in 0..1.0 domain + + + fy = _cmsToFixedDomain((int) Input[1] * p -> Domain[1]); + y0 = FIXED_TO_INT(fy); + ry = FIXED_REST_TO_INT(fy); + + + X0 = p -> opta[1] * x0; + X1 = X0 + (Input[0] == 0xFFFFU ? 0 : p->opta[1]); + + Y0 = p -> opta[0] * y0; + Y1 = Y0 + (Input[1] == 0xFFFFU ? 0 : p->opta[0]); + + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + + d00 = DENS(X0, Y0); + d01 = DENS(X0, Y1); + d10 = DENS(X1, Y0); + d11 = DENS(X1, Y1); + + dx0 = LERP(rx, d00, d10); + dx1 = LERP(rx, d01, d11); + + dxy = LERP(ry, dx0, dx1); + + Output[OutChan] = (cmsUInt16Number) dxy; + } + + +# undef LERP +# undef DENS +} // Trilinear interpolation (16 bits) - cmsFloat32Number version @@ -343,9 +453,21 @@ TotalOut = p -> nOutputs; - px = Input[0] * p->Domain[0]; - py = Input[1] * p->Domain[1]; - pz = Input[2] * p->Domain[2]; + // We need some clipping here + px = Input[0]; + py = Input[1]; + pz = Input[2]; + + if (px < 0) px = 0; + if (px > 1) px = 1; + if (py < 0) py = 0; + if (py > 1) py = 1; + if (pz < 0) pz = 0; + if (pz > 1) pz = 1; + + px *= p->Domain[0]; + py *= p->Domain[1]; + pz *= p->Domain[2]; x0 = (int) _cmsQuickFloor(px); fx = px - (cmsFloat32Number) x0; y0 = (int) _cmsQuickFloor(py); fy = py - (cmsFloat32Number) y0; @@ -486,9 +608,21 @@ TotalOut = p -> nOutputs; - px = Input[0] * p->Domain[0]; - py = Input[1] * p->Domain[1]; - pz = Input[2] * p->Domain[2]; + // We need some clipping here + px = Input[0]; + py = Input[1]; + pz = Input[2]; + + if (px < 0) px = 0; + if (px > 1) px = 1; + if (py < 0) py = 0; + if (py > 1) py = 1; + if (pz < 0) pz = 0; + if (pz > 1) pz = 1; + + px *= p->Domain[0]; + py *= p->Domain[1]; + pz *= p->Domain[2]; x0 = (int) _cmsQuickFloor(px); rx = (px - (cmsFloat32Number) x0); y0 = (int) _cmsQuickFloor(py); ry = (py - (cmsFloat32Number) y0); @@ -570,7 +704,6 @@ -#define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) static void TetrahedralInterp16(register const cmsUInt16Number Input[], @@ -578,99 +711,131 @@ register const cmsInterpParams* p) { const cmsUInt16Number* LutTable = (cmsUInt16Number*) p -> Table; - cmsS15Fixed16Number fx, fy, fz; - cmsS15Fixed16Number rx, ry, rz; - int x0, y0, z0; - cmsS15Fixed16Number c0, c1, c2, c3, Rest; - cmsUInt32Number OutChan; - cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; - cmsUInt32Number TotalOut = p -> nOutputs; - + cmsS15Fixed16Number fx, fy, fz; + cmsS15Fixed16Number rx, ry, rz; + int x0, y0, z0; + cmsS15Fixed16Number c0, c1, c2, c3, Rest; + cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + cmsUInt32Number TotalOut = p -> nOutputs; - fx = _cmsToFixedDomain((int) Input[0] * p -> Domain[0]); - fy = _cmsToFixedDomain((int) Input[1] * p -> Domain[1]); - fz = _cmsToFixedDomain((int) Input[2] * p -> Domain[2]); + fx = _cmsToFixedDomain((int) Input[0] * p -> Domain[0]); + fy = _cmsToFixedDomain((int) Input[1] * p -> Domain[1]); + fz = _cmsToFixedDomain((int) Input[2] * p -> Domain[2]); - x0 = FIXED_TO_INT(fx); - y0 = FIXED_TO_INT(fy); - z0 = FIXED_TO_INT(fz); + x0 = FIXED_TO_INT(fx); + y0 = FIXED_TO_INT(fy); + z0 = FIXED_TO_INT(fz); - rx = FIXED_REST_TO_INT(fx); - ry = FIXED_REST_TO_INT(fy); - rz = FIXED_REST_TO_INT(fz); + rx = FIXED_REST_TO_INT(fx); + ry = FIXED_REST_TO_INT(fy); + rz = FIXED_REST_TO_INT(fz); X0 = p -> opta[2] * x0; - X1 = X0 + (Input[0] == 0xFFFFU ? 0 : p->opta[2]); + X1 = (Input[0] == 0xFFFFU ? 0 : p->opta[2]); Y0 = p -> opta[1] * y0; - Y1 = Y0 + (Input[1] == 0xFFFFU ? 0 : p->opta[1]); + Y1 = (Input[1] == 0xFFFFU ? 0 : p->opta[1]); Z0 = p -> opta[0] * z0; - Z1 = Z0 + (Input[2] == 0xFFFFU ? 0 : p->opta[0]); - - // These are the 6 Tetrahedral - for (OutChan=0; OutChan < TotalOut; OutChan++) { + Z1 = (Input[2] == 0xFFFFU ? 0 : p->opta[0]); - c0 = DENS(X0, Y0, Z0); - - if (rx >= ry && ry >= rz) { - - c1 = DENS(X1, Y0, Z0) - c0; - c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); - c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + LutTable = &LutTable[X0+Y0+Z0]; - } - else - if (rx >= rz && rz >= ry) { - - c1 = DENS(X1, Y0, Z0) - c0; - c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); - c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); - - } - else - if (rz >= rx && rx >= ry) { - - c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); - c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); - c3 = DENS(X0, Y0, Z1) - c0; - - } - else - if (ry >= rx && rx >= rz) { + // Output should be computed as x = ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)) + // which expands as: x = (Rest + ((Rest+0x7fff)/0xFFFF) + 0x8000)>>16 + // This can be replaced by: t = Rest+0x8001, x = (t + (t>>16))>>16 + // at the cost of being off by one at 7fff and 17ffe. - c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); - c2 = DENS(X0, Y1, Z0) - c0; - c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); - - } - else - if (ry >= rz && rz >= rx) { - - c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); - c2 = DENS(X0, Y1, Z0) - c0; - c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); - - } - else - if (rz >= ry && ry >= rx) { - - c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); - c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); - c3 = DENS(X0, Y0, Z1) - c0; - - } - else { - c1 = c2 = c3 = 0; - } - - Rest = c1 * rx + c2 * ry + c3 * rz; - - Output[OutChan] = (cmsUInt16Number) c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)); + if (rx >= ry) { + if (ry >= rz) { + Y1 += X1; + Z1 += Y1; + for (; TotalOut; TotalOut--) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c3 -= c2; + c2 -= c1; + c1 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + *Output++ = (cmsUInt16Number) c0 + ((Rest + (Rest>>16))>>16); + } + } else if (rz >= rx) { + X1 += Z1; + Y1 += X1; + for (; TotalOut; TotalOut--) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c2 -= c1; + c1 -= c3; + c3 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + *Output++ = (cmsUInt16Number) c0 + ((Rest + (Rest>>16))>>16); + } + } else { + Z1 += X1; + Y1 += Z1; + for (; TotalOut; TotalOut--) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c2 -= c3; + c3 -= c1; + c1 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + *Output++ = (cmsUInt16Number) c0 + ((Rest + (Rest>>16))>>16); + } + } + } else { + if (rx >= rz) { + X1 += Y1; + Z1 += X1; + for (; TotalOut; TotalOut--) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c3 -= c1; + c1 -= c2; + c2 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + *Output++ = (cmsUInt16Number) c0 + ((Rest + (Rest>>16))>>16); + } + } else if (ry >= rz) { + Z1 += Y1; + X1 += Z1; + for (; TotalOut; TotalOut--) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c1 -= c3; + c3 -= c2; + c2 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + *Output++ = (cmsUInt16Number) c0 + ((Rest + (Rest>>16))>>16); + } + } else { + Y1 += Z1; + X1 += Y1; + for (; TotalOut; TotalOut--) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c1 -= c2; + c2 -= c3; + c3 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + *Output++ = (cmsUInt16Number) c0 + ((Rest + (Rest>>16))>>16); + } + } } - } -#undef DENS #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) @@ -1102,7 +1267,7 @@ K1 = p16 -> opta[6] * (k0 + (Input[0] != 0xFFFFU ? 1 : 0)); p1 = *p16; - memmove(&p1.Domain[0], &p16 ->Domain[1], 5*sizeof(cmsUInt32Number)); + memmove(&p1.Domain[0], &p16 ->Domain[1], 6*sizeof(cmsUInt32Number)); T = LutTable + K0; p1.Table = T; @@ -1285,6 +1450,12 @@ } break; + case 2: // Duotone + if (IsFloat) + Interpolation.LerpFloat = BilinearInterpFloat; + else + Interpolation.Lerp16 = BilinearInterp16; + break; case 3: // RGB et al
--- a/src/share/native/sun/java2d/cmm/lcms/cmsio0.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsio0.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -142,6 +142,7 @@ iohandler ->ContextID = ContextID; iohandler ->stream = (void*) fm; iohandler ->UsedSpace = 0; + iohandler ->ReportedSize = 0; iohandler ->PhysicalFile[0] = 0; iohandler ->Read = NULLRead; @@ -232,13 +233,11 @@ memmove(ResData ->Block + ResData ->Pointer, Ptr, size); ResData ->Pointer += size; + iohandler->UsedSpace += size; if (ResData ->Pointer > iohandler->UsedSpace) iohandler->UsedSpace = ResData ->Pointer; - - iohandler->UsedSpace += size; - return TRUE; } @@ -297,6 +296,7 @@ fm ->FreeBlockOnClose = TRUE; fm ->Size = size; fm ->Pointer = 0; + iohandler -> ReportedSize = size; break; case 'w': @@ -307,10 +307,11 @@ fm ->FreeBlockOnClose = FALSE; fm ->Size = size; fm ->Pointer = 0; + iohandler -> ReportedSize = 0; break; default: - cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknow access mode '%c'", *AccessMode); + cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown access mode '%c'", *AccessMode); return NULL; } @@ -407,6 +408,7 @@ cmsSignalError(ContextID, cmsERROR_FILE, "File '%s' not found", FileName); return NULL; } + iohandler -> ReportedSize = cmsfilelength(fm); break; case 'w': @@ -416,11 +418,12 @@ cmsSignalError(ContextID, cmsERROR_FILE, "Couldn't create '%s'", FileName); return NULL; } + iohandler -> ReportedSize = 0; break; default: _cmsFree(ContextID, iohandler); - cmsSignalError(ContextID, cmsERROR_FILE, "Unknow access mode '%c'", *AccessMode); + cmsSignalError(ContextID, cmsERROR_FILE, "Unknown access mode '%c'", *AccessMode); return NULL; } @@ -455,6 +458,7 @@ iohandler -> ContextID = ContextID; iohandler -> stream = (void*) Stream; iohandler -> UsedSpace = 0; + iohandler -> ReportedSize = cmsfilelength(Stream); iohandler -> PhysicalFile[0] = 0; iohandler ->Read = FileRead; @@ -643,12 +647,17 @@ Icc -> flags = _cmsAdjustEndianess32(Header.flags); Icc -> manufacturer = _cmsAdjustEndianess32(Header.manufacturer); Icc -> model = _cmsAdjustEndianess32(Header.model); - _cmsAdjustEndianess64(&Icc -> attributes, Header.attributes); + _cmsAdjustEndianess64(&Icc -> attributes, &Header.attributes); Icc -> Version = _cmsAdjustEndianess32(Header.version); // Get size as reported in header HeaderSize = _cmsAdjustEndianess32(Header.size); + // Make sure HeaderSize is lower than profile size + if (HeaderSize >= Icc ->IOhandler ->ReportedSize) + HeaderSize = Icc ->IOhandler ->ReportedSize; + + // Get creation date/time _cmsDecodeDateTimeNumber(&Header.date, &Icc ->Created); @@ -664,6 +673,7 @@ return FALSE; } + // Read tag directory Icc -> TagCount = 0; for (i=0; i < TagCount; i++) { @@ -673,7 +683,8 @@ if (!_cmsReadUInt32Number(io, &Tag.size)) return FALSE; // Perform some sanity check. Offset + size should fall inside file. - if (Tag.offset + Tag.size > HeaderSize) + if (Tag.offset + Tag.size > HeaderSize || + Tag.offset + Tag.size < Tag.offset) continue; Icc -> TagNames[Icc ->TagCount] = Tag.sig; @@ -728,7 +739,7 @@ Header.manufacturer = _cmsAdjustEndianess32(Icc -> manufacturer); Header.model = _cmsAdjustEndianess32(Icc -> model); - _cmsAdjustEndianess64(&Header.attributes, Icc -> attributes); + _cmsAdjustEndianess64(&Header.attributes, &Icc -> attributes); // Rendering intent in the header (for embedded profiles) Header.renderingIntent = _cmsAdjustEndianess32(Icc -> RenderingIntent); @@ -822,7 +833,7 @@ void CMSEXPORT cmsSetHeaderModel(cmsHPROFILE hProfile, cmsUInt32Number model) { _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; - Icc -> manufacturer = (cmsUInt32Number) model; + Icc -> model = (cmsUInt32Number) model; } @@ -1138,10 +1149,12 @@ continue; } - TypeBase = TypeHandler ->Signature; + TypeBase = TypeHandler ->Signature; if (!_cmsWriteTypeBase(io, TypeBase)) return FALSE; + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; if (!TypeHandler ->WritePtr(TypeHandler, io, Data, TagDescriptor ->ElemCount)) { char String[5]; @@ -1317,8 +1330,12 @@ cmsTagTypeHandler* TypeHandler = Icc ->TagTypeHandlers[i]; - if (TypeHandler != NULL) + if (TypeHandler != NULL) { + + TypeHandler ->ContextID = Icc ->ContextID; // As an additional parameters + TypeHandler ->ICCVersion = Icc ->Version; TypeHandler ->FreePtr(TypeHandler, Icc -> TagPtrs[i]); + } else _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]); } @@ -1371,7 +1388,6 @@ if (n < 0) return NULL; // Not found, return NULL - // If the element is already in memory, return the pointer if (Icc -> TagPtrs[n]) { @@ -1406,6 +1422,9 @@ // Read the tag Icc -> TagTypeHandlers[n] = TypeHandler; + + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; Icc -> TagPtrs[n] = TypeHandler ->ReadPtr(TypeHandler, io, &ElemCount, TagSize); // The tag type is supported, but something wrong happend and we cannot read the tag. @@ -1463,11 +1482,15 @@ cmsTagTypeSignature Type; int i; cmsFloat64Number Version; + char TypeString[5], SigString[5]; if (data == NULL) { - cmsSignalError(cmsGetProfileContextID(hProfile), cmsERROR_NULL, "couldn't wite NULL to tag"); + i = _cmsSearchTag(Icc, sig, FALSE); + if (i >= 0) + Icc ->TagNames[i] = (cmsTagSignature) 0; + // Unsupported by now, reserved for future ampliations (delete) return FALSE; } @@ -1482,7 +1505,13 @@ } else { TypeHandler = Icc ->TagTypeHandlers[i]; - TypeHandler->FreePtr(TypeHandler, Icc -> TagPtrs[i]); + + if (TypeHandler != NULL) { + + TypeHandler ->ContextID = Icc ->ContextID; // As an additional parameter + TypeHandler ->ICCVersion = Icc ->Version; + TypeHandler->FreePtr(TypeHandler, Icc -> TagPtrs[i]); + } } } } @@ -1514,6 +1543,7 @@ // Now we need to know which type to use. It depends on the version. Version = cmsGetProfileVersion(hProfile); + if (TagDescriptor ->DecideType != NULL) { // Let the tag descriptor to decide the type base on depending on @@ -1525,33 +1555,47 @@ } else { + Type = TagDescriptor ->SupportedTypes[0]; } // Does the tag support this type? if (!IsTypeSupported(TagDescriptor, Type)) { - cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported type '%x' for tag '%x'", Type, sig); + + _cmsTagSignature2String(TypeString, (cmsTagSignature) Type); + _cmsTagSignature2String(SigString, sig); + + cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported type '%s' for tag '%s'", TypeString, SigString); return FALSE; } // Does we have a handler for this type? TypeHandler = _cmsGetTagTypeHandler(Type); if (TypeHandler == NULL) { - cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported type '%x' for tag '%x'", Type, sig); + + _cmsTagSignature2String(TypeString, (cmsTagSignature) Type); + _cmsTagSignature2String(SigString, sig); + + cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported type '%s' for tag '%s'", TypeString, SigString); return FALSE; // Should never happen } + // Fill fields on icc structure Icc ->TagTypeHandlers[i] = TypeHandler; Icc ->TagNames[i] = sig; Icc ->TagSizes[i] = 0; Icc ->TagOffsets[i] = 0; - Icc ->TagPtrs[i] = TypeHandler ->DupPtr(TypeHandler, data, TagDescriptor ->ElemCount); + + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; + Icc ->TagPtrs[i] = TypeHandler ->DupPtr(TypeHandler, data, TagDescriptor ->ElemCount); if (Icc ->TagPtrs[i] == NULL) { - TypeHandler ->DupPtr(TypeHandler, data, TagDescriptor ->ElemCount); - cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "Malformed struct in type '%x' for tag '%x'", Type, sig); + _cmsTagSignature2String(TypeString, (cmsTagSignature) Type); + _cmsTagSignature2String(SigString, sig); + cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "Malformed struct in type '%s' for tag '%s'", TypeString, SigString); return FALSE; } @@ -1627,21 +1671,31 @@ if (data == NULL) { MemIO = cmsOpenIOhandlerFromNULL(cmsGetProfileContextID(hProfile)); } else{ - MemIO = cmsOpenIOhandlerFromMem(cmsGetProfileContextID(hProfile), data, BufferSize, "w"); + MemIO = cmsOpenIOhandlerFromMem(cmsGetProfileContextID(hProfile), data, BufferSize, "w"); } if (MemIO == NULL) return 0; // Obtain type handling for the tag TypeHandler = Icc ->TagTypeHandlers[i]; TagDescriptor = _cmsGetTagDescriptor(sig); + if (TagDescriptor == NULL) { + cmsCloseIOhandler(MemIO); + return 0; + } // Serialize + TypeHandler ->ContextID = Icc ->ContextID; + TypeHandler ->ICCVersion = Icc ->Version; + if (!_cmsWriteTypeBase(MemIO, TypeHandler ->Signature)) { cmsCloseIOhandler(MemIO); return 0; } - if (!TypeHandler ->WritePtr(TypeHandler, MemIO, Object, TagDescriptor ->ElemCount)) return 0; + if (!TypeHandler ->WritePtr(TypeHandler, MemIO, Object, TagDescriptor ->ElemCount)) { + cmsCloseIOhandler(MemIO); + return 0; + } // Get Size and close rc = MemIO ->Tell(MemIO); @@ -1692,3 +1746,17 @@ return TRUE; } + + +// Returns the tag linked to sig, in the case two tags are sharing same resource +cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig) +{ + _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; + int i; + + // Search for given tag in ICC profile directory + i = _cmsSearchTag(Icc, sig, FALSE); + if (i < 0) return (cmsTagSignature) 0; // Not found, return 0 + + return Icc -> TagLinked[i]; +}
--- a/src/share/native/sun/java2d/cmm/lcms/cmsio1.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsio1.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -150,7 +150,7 @@ return TRUE; } - return _cmsAdaptationMatrix(Dest, NULL, cmsD50_XYZ(), White); + return _cmsAdaptationMatrix(Dest, NULL, White, cmsD50_XYZ()); } } @@ -261,11 +261,81 @@ cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, Shapes)); cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 3, (cmsFloat64Number*) &Mat, NULL)); + + // Note that it is certainly possible a single profile would have a LUT based + // tag for output working in lab and a matrix-shaper for the fallback cases. + // This is not allowed by the spec, but this code is tolerant to those cases + if (cmsGetPCS(hProfile) == cmsSigLabData) { + + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocXYZ2Lab(ContextID)); + } + } return Lut; } + + +// Read the DToAX tag, adjusting the encoding of Lab or XYZ if neded +/*static +cmsPipeline* _cmsReadFloatInputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat) +{ + cmsContext ContextID = cmsGetProfileContextID(hProfile); + cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile); + + if (Lut == NULL) return NULL; + + // If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding, + // and since the formatter has already accomodated to 0..1.0, we should undo this change + if ( spc == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID)); + } + else + if (spc == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID)); + } + + return Lut; +} +*/ +static +cmsPipeline* _cmsReadFloatInputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat) +{ + cmsContext ContextID = cmsGetProfileContextID(hProfile); + cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile); + cmsColorSpaceSignature PCS = cmsGetPCS(hProfile); + + if (Lut == NULL) return NULL; + + // input and output of transform are in lcms 0..1 encoding. If XYZ or Lab spaces are used, + // these need to be normalized into the appropriate ranges (Lab = 100,0,0, XYZ=1.0,1.0,1.0) + if ( spc == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID)); + } + else if (spc == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID)); + } + + if ( PCS == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID)); + } + else if( PCS == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID)); + } + + return Lut; +} + + // Read and create a BRAND NEW MPE LUT from a given profile. All stuff dependent of version, etc // is adjusted here in order to create a LUT that takes care of all those details cmsPipeline* _cmsReadInputLUT(cmsHPROFILE hProfile, int Intent) @@ -275,10 +345,30 @@ cmsTagSignature tagFloat = Device2PCSFloat[Intent]; cmsContext ContextID = cmsGetProfileContextID(hProfile); + // On named color, take the appropiate tag + if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) { + + cmsPipeline* Lut; + cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*) cmsReadTag(hProfile, cmsSigNamedColor2Tag); + + if (nc == NULL) return NULL; + + Lut = cmsPipelineAlloc(ContextID, 0, 0); + if (Lut == NULL) { + cmsFreeNamedColorList(nc); + return NULL; + } + + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocNamedColor(nc, TRUE)); + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)); + return Lut; + } + if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence - // Floating point LUT are always V4, so no adjustment is required - return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + // Floating point LUT are always V4, but the encoding range is no + // longer 0..1.0, so we need to add an stage depending on the color space + return _cmsReadFloatInputTag(hProfile, tagFloat); } // Revert to perceptual if no tag is found @@ -304,6 +394,10 @@ if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData) return Lut; + // If the input is Lab, add also a conversion at the begin + if (cmsGetColorSpace(hProfile) == cmsSigLabData) + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)); + // Add a matrix for conversion V2 to V4 Lab PCS cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)); return Lut; @@ -407,6 +501,14 @@ Lut = cmsPipelineAlloc(ContextID, 3, 3); if (Lut != NULL) { + // Note that it is certainly possible a single profile would have a LUT based + // tag for output working in lab and a matrix-shaper for the fallback cases. + // This is not allowed by the spec, but this code is tolerant to those cases + if (cmsGetPCS(hProfile) == cmsSigLabData) { + + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLab2XYZ(ContextID)); + } + cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 3, (cmsFloat64Number*) &Inv, NULL)); cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, InvShapes)); } @@ -415,6 +517,88 @@ return Lut; } + +// Change CLUT interpolation to trilinear +static +void ChangeInterpolationToTrilinear(cmsPipeline* Lut) +{ + cmsStage* Stage; + + for (Stage = cmsPipelineGetPtrToFirstStage(Lut); + Stage != NULL; + Stage = cmsStageNext(Stage)) { + + if (cmsStageType(Stage) == cmsSigCLutElemType) { + + _cmsStageCLutData* CLUT = (_cmsStageCLutData*) Stage ->Data; + + CLUT ->Params->dwFlags |= CMS_LERP_FLAGS_TRILINEAR; + _cmsSetInterpolationRoutine(CLUT ->Params); + } + } +} + + +// Read the DToAX tag, adjusting the encoding of Lab or XYZ if neded +/*static +cmsPipeline* _cmsReadFloatOutputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat) +{ + cmsContext ContextID = cmsGetProfileContextID(hProfile); + cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + cmsColorSpaceSignature PCS = cmsGetPCS(hProfile); + + if (Lut == NULL) return NULL; + + // If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding, + // and since the formatter has already accomodated to 0..1.0, we should undo this change + if ( PCS == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID)); + } + else + if (PCS == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID)); + } + + return Lut; +}*/ + +static +cmsPipeline* _cmsReadFloatOutputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat) +{ + cmsContext ContextID = cmsGetProfileContextID(hProfile); + cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + cmsColorSpaceSignature PCS = cmsGetPCS(hProfile); + cmsColorSpaceSignature dataSpace = cmsGetColorSpace(hProfile); + + if (Lut == NULL) return NULL; + + // If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding, + // and since the formatter has already accomodated to 0..1.0, we should undo this change + if ( PCS == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID)); + } + else + if (PCS == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID)); + } + + // the output can be Lab or XYZ, in which case normalisation is needed on the end of the pipeline + if ( dataSpace == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID)); + } + else if ( dataSpace == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID)); + } + + return Lut; +} + // Create an output MPE LUT from agiven profile. Version mismatches are handled here cmsPipeline* _cmsReadOutputLUT(cmsHPROFILE hProfile, int Intent) { @@ -425,8 +609,8 @@ if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence - // Floating point LUT are always V4, so no adjustment is required - return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + // Floating point LUT are always V4 + return _cmsReadFloatOutputTag(hProfile, tagFloat); } // Revert to perceptual if no tag is found @@ -447,6 +631,12 @@ // The profile owns the Lut, so we need to copy it Lut = cmsPipelineDup(Lut); + if (Lut == NULL) return NULL; + + // Now it is time for a controversial stuff. I found that for 3D LUTS using + // Lab used as indexer space, trilinear interpolation should be used + if (cmsGetPCS(hProfile) == cmsSigLabData) + ChangeInterpolationToTrilinear(Lut); // We need to adjust data only for Lab and Lut16 type if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData) @@ -454,6 +644,11 @@ // Add a matrix for conversion V4 to V2 Lab PCS cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)); + + // If the output is Lab, add also a conversion at the end + if (cmsGetColorSpace(hProfile) == cmsSigLabData) + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)); + return Lut; } @@ -467,12 +662,46 @@ return BuildGrayOutputPipeline(hProfile); } - // Not gray, create a normal matrix-shaper + // Not gray, create a normal matrix-shaper, which only operates in XYZ space return BuildRGBOutputMatrixShaper(hProfile); } // --------------------------------------------------------------------------------------------------------------- +// Read the AToD0 tag, adjusting the encoding of Lab or XYZ if neded +static +cmsPipeline* _cmsReadFloatDevicelinkTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat) +{ + cmsContext ContextID = cmsGetProfileContextID(hProfile); + cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + cmsColorSpaceSignature PCS = cmsGetPCS(hProfile); + cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile); + + if (Lut == NULL) return NULL; + + if (spc == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID)); + } + else + if (spc == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID)); + } + + if (PCS == cmsSigLabData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID)); + } + else + if (PCS == cmsSigXYZData) + { + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID)); + } + + return Lut; +} + // This one includes abstract profiles as well. Matrix-shaper cannot be obtained on that device class. The // tag name here may default to AToB0 cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent) @@ -483,10 +712,30 @@ cmsTagSignature tagFloat = Device2PCSFloat[Intent]; cmsContext ContextID = cmsGetProfileContextID(hProfile); + + // On named color, take the appropiate tag + if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) { + + cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*) cmsReadTag(hProfile, cmsSigNamedColor2Tag); + + if (nc == NULL) return NULL; + + Lut = cmsPipelineAlloc(ContextID, 0, 0); + if (Lut == NULL) { + cmsFreeNamedColorList(nc); + return NULL; + } + + cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocNamedColor(nc, FALSE)); + if (cmsGetColorSpace(hProfile) == cmsSigLabData) + cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)); + return Lut; + } + if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence - // Floating point LUT are always V4, no adjustment is required - return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + // Floating point LUT are always V + return _cmsReadFloatDevicelinkTag(hProfile, tagFloat); } tagFloat = Device2PCSFloat[0]; @@ -509,6 +758,12 @@ // The profile owns the Lut, so we need to copy it Lut = cmsPipelineDup(Lut); + if (Lut == NULL) return NULL; + + // Now it is time for a controversial stuff. I found that for 3D LUTS using + // Lab used as indexer space, trilinear interpolation should be used + if (cmsGetColorSpace(hProfile) == cmsSigLabData) + ChangeInterpolationToTrilinear(Lut); // After reading it, we have info about the original type OriginalType = _cmsGetTagTrueType(hProfile, tag16); @@ -558,7 +813,7 @@ } // Returns TRUE if the intent is implemented as CLUT -cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, int UsedDirection) +cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection) { const cmsTagSignature* TagTable; @@ -589,7 +844,7 @@ // Return info about supported intents cmsBool CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, - cmsUInt32Number Intent, int UsedDirection) + cmsUInt32Number Intent, cmsUInt32Number UsedDirection) { if (cmsIsCLUT(hProfile, Intent, UsedDirection)) return TRUE; @@ -607,7 +862,6 @@ // Read both, profile sequence description and profile sequence id if present. Then combine both to // create qa unique structure holding both. Shame on ICC to store things in such complicated way. - cmsSEQ* _cmsReadProfileSequence(cmsHPROFILE hProfile) { cmsSEQ* ProfileSeq; @@ -632,12 +886,13 @@ NewSeq = cmsDupProfileSequenceDescription(ProfileSeq); // Ok, proceed to the mixing - for (i=0; i < ProfileSeq ->n; i++) { + if (NewSeq != NULL) { + for (i=0; i < ProfileSeq ->n; i++) { - memmove(&NewSeq ->seq[i].ProfileID, &ProfileId ->seq[i].ProfileID, sizeof(cmsProfileID)); - NewSeq ->seq[i].Description = cmsMLUdup(ProfileId ->seq[i].Description); + memmove(&NewSeq ->seq[i].ProfileID, &ProfileId ->seq[i].ProfileID, sizeof(cmsProfileID)); + NewSeq ->seq[i].Description = cmsMLUdup(ProfileId ->seq[i].Description); + } } - return NewSeq; }
--- a/src/share/native/sun/java2d/cmm/lcms/cmslut.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmslut.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -154,7 +154,7 @@ for (i=0; i < n; i++) { // Get asked type - Type = va_arg(args, cmsStageSignature); + Type = (cmsStageSignature)va_arg(args, cmsStageSignature); if (mpe ->Type != Type) { va_end(args); // Mismatch. We are done. @@ -197,9 +197,14 @@ cmsFloat32Number Out[], const cmsStage *mpe) { - _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*) mpe ->Data; + _cmsStageToneCurvesData* Data; cmsUInt32Number i; + _cmsAssert(mpe != NULL); + + Data = (_cmsStageToneCurvesData*) mpe ->Data; + if (Data == NULL) return; + if (Data ->TheCurves == NULL) return; for (i=0; i < Data ->nCurves; i++) { @@ -210,9 +215,14 @@ static void CurveSetElemTypeFree(cmsStage* mpe) { - _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*) mpe ->Data; + _cmsStageToneCurvesData* Data; cmsUInt32Number i; + _cmsAssert(mpe != NULL); + + Data = (_cmsStageToneCurvesData*) mpe ->Data; + if (Data == NULL) return; + if (Data ->TheCurves != NULL) { for (i=0; i < Data ->nCurves; i++) { if (Data ->TheCurves[i] != NULL) @@ -275,12 +285,14 @@ EvaluateCurves, CurveSetDup, CurveSetElemTypeFree, NULL ); if (NewMPE == NULL) return NULL; - NewElem = (_cmsStageToneCurvesData*) _cmsMalloc(ContextID, sizeof(_cmsStageToneCurvesData)); + NewElem = (_cmsStageToneCurvesData*) _cmsMallocZero(ContextID, sizeof(_cmsStageToneCurvesData)); if (NewElem == NULL) { cmsStageFree(NewMPE); return NULL; } + NewMPE ->Data = (void*) NewElem; + NewElem ->nCurves = nChannels; NewElem ->TheCurves = (cmsToneCurve**) _cmsCalloc(ContextID, nChannels, sizeof(cmsToneCurve*)); if (NewElem ->TheCurves == NULL) { @@ -301,11 +313,10 @@ cmsStageFree(NewMPE); return NULL; } + } - NewMPE ->Data = (void*) NewElem; - - return NewMPE; + return NewMPE; } @@ -402,6 +413,9 @@ n = Rows * Cols; // Check for overflow + if (n == 0) return NULL; + if (n >= UINT_MAX / Cols) return NULL; + if (n >= UINT_MAX / Rows) return NULL; if (n < Rows || n < Cols) return NULL; NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigMatrixElemType, Cols, Rows, @@ -479,10 +493,20 @@ static cmsUInt32Number CubeSize(const cmsUInt32Number Dims[], cmsUInt32Number b) { - cmsUInt32Number rv; + cmsUInt32Number rv, dim; + + _cmsAssert(Dims != NULL); + + for (rv = 1; b > 0; b--) { - for (rv = 1; b > 0; b--) - rv *= Dims[b-1]; + dim = Dims[b-1]; + if (dim == 0) return 0; // Error + + rv *= dim; + + // Check for overflow + if (rv > UINT_MAX / dim) return 0; + } return rv; } @@ -549,17 +573,35 @@ _cmsStageCLutData* NewElem; cmsStage* NewMPE; + _cmsAssert(clutPoints != NULL); + + if (inputChan > MAX_INPUT_DIMENSIONS) { + cmsSignalError(ContextID, cmsERROR_RANGE, "Too many input channels (%d channels, max=%d)", inputChan, MAX_INPUT_DIMENSIONS); + return NULL; + } + NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigCLutElemType, inputChan, outputChan, EvaluateCLUTfloatIn16, CLUTElemDup, CLutElemTypeFree, NULL ); if (NewMPE == NULL) return NULL; - NewElem = (_cmsStageCLutData*) _cmsMalloc(ContextID, sizeof(_cmsStageCLutData)); - if (NewElem == NULL) return NULL; + NewElem = (_cmsStageCLutData*) _cmsMallocZero(ContextID, sizeof(_cmsStageCLutData)); + if (NewElem == NULL) { + cmsStageFree(NewMPE); + return NULL; + } + + NewMPE ->Data = (void*) NewElem; NewElem -> nEntries = n = outputChan * CubeSize(clutPoints, inputChan); NewElem -> HasFloatValues = FALSE; + if (n == 0) { + cmsStageFree(NewMPE); + return NULL; + } + + NewElem ->Tab.T = (cmsUInt16Number*) _cmsCalloc(ContextID, n, sizeof(cmsUInt16Number)); if (NewElem ->Tab.T == NULL) { cmsStageFree(NewMPE); @@ -578,8 +620,6 @@ return NULL; } - NewMPE ->Data = (void*) NewElem; - return NewMPE; } @@ -623,18 +663,37 @@ { cmsUInt32Number i, n; _cmsStageCLutData* NewElem; - cmsStage* NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigCLutElemType, inputChan, outputChan, + cmsStage* NewMPE; + + _cmsAssert(clutPoints != NULL); + + if (inputChan > MAX_INPUT_DIMENSIONS) { + cmsSignalError(ContextID, cmsERROR_RANGE, "Too many input channels (%d channels, max=%d)", inputChan, MAX_INPUT_DIMENSIONS); + return NULL; + } + + NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigCLutElemType, inputChan, outputChan, EvaluateCLUTfloat, CLUTElemDup, CLutElemTypeFree, NULL); - if (NewMPE == NULL) return NULL; - NewElem = (_cmsStageCLutData*) _cmsMalloc(ContextID, sizeof(_cmsStageCLutData)); - if (NewElem == NULL) return NULL; + NewElem = (_cmsStageCLutData*) _cmsMallocZero(ContextID, sizeof(_cmsStageCLutData)); + if (NewElem == NULL) { + cmsStageFree(NewMPE); + return NULL; + } + + NewMPE ->Data = (void*) NewElem; - NewElem -> nEntries = n = outputChan * CubeSize( clutPoints, inputChan); + // There is a potential integer overflow on conputing n and nEntries. + NewElem -> nEntries = n = outputChan * CubeSize(clutPoints, inputChan); NewElem -> HasFloatValues = TRUE; + if (n == 0) { + cmsStageFree(NewMPE); + return NULL; + } + NewElem ->Tab.TFloat = (cmsFloat32Number*) _cmsCalloc(ContextID, n, sizeof(cmsFloat32Number)); if (NewElem ->Tab.TFloat == NULL) { cmsStageFree(NewMPE); @@ -647,7 +706,6 @@ } } - NewMPE ->Data = (void*) NewElem; NewElem ->Params = _cmsComputeInterpParamsEx(ContextID, clutPoints, inputChan, outputChan, NewElem ->Tab.TFloat, CMS_LERP_FLAGS_FLOAT); if (NewElem ->Params == NULL) { @@ -715,8 +773,13 @@ int nInputs, nOutputs; cmsUInt32Number* nSamples; cmsUInt16Number In[cmsMAXCHANNELS], Out[MAX_STAGE_CHANNELS]; - _cmsStageCLutData* clut = (_cmsStageCLutData*) mpe->Data; + _cmsStageCLutData* clut; + + if (mpe == NULL) return FALSE; + clut = (_cmsStageCLutData*) mpe->Data; + + if (clut == NULL) return FALSE; nSamples = clut->Params ->nSamples; nInputs = clut->Params ->nInputs; @@ -726,6 +789,7 @@ if (nOutputs >= MAX_STAGE_CHANNELS) return FALSE; nTotalPoints = CubeSize(nSamples, nInputs); + if (nTotalPoints == 0) return FALSE; index = 0; for (i = 0; i < nTotalPoints; i++) { @@ -779,6 +843,7 @@ if (nOutputs >= MAX_STAGE_CHANNELS) return FALSE; nTotalPoints = CubeSize(nSamples, nInputs); + if (nTotalPoints == 0) return FALSE; index = 0; for (i = 0; i < nTotalPoints; i++) { @@ -828,6 +893,7 @@ if (nInputs >= cmsMAXCHANNELS) return FALSE; nTotalPoints = CubeSize(clutPoints, nInputs); + if (nTotalPoints == 0) return FALSE; for (i = 0; i < nTotalPoints; i++) { @@ -857,6 +923,7 @@ if (nInputs >= cmsMAXCHANNELS) return FALSE; nTotalPoints = CubeSize(clutPoints, nInputs); + if (nTotalPoints == 0) return FALSE; for (i = 0; i < nTotalPoints; i++) { @@ -993,6 +1060,89 @@ } +// To Lab to float. Note that the MPE gives numbers in normal Lab range +// and we need 0..1.0 range for the formatters +// L* : 0...100 => 0...1.0 (L* / 100) +// ab* : -128..+127 to 0..1 ((ab* + 128) / 255) + +cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID) +{ + static const cmsFloat64Number a1[] = { + 1.0/100.0, 0, 0, + 0, 1.0/255.0, 0, + 0, 0, 1.0/255.0 + }; + + static const cmsFloat64Number o1[] = { + 0, + 128.0/255.0, + 128.0/255.0 + }; + + cmsStage *mpe = cmsStageAllocMatrix(ContextID, 3, 3, a1, o1); + + if (mpe == NULL) return mpe; + mpe ->Implements = cmsSigLab2FloatPCS; + return mpe; +} + +// Fom XYZ to floating point PCS +cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID) +{ +#define n (32768.0/65535.0) + static const cmsFloat64Number a1[] = { + n, 0, 0, + 0, n, 0, + 0, 0, n + }; +#undef n + + cmsStage *mpe = cmsStageAllocMatrix(ContextID, 3, 3, a1, NULL); + + if (mpe == NULL) return mpe; + mpe ->Implements = cmsSigXYZ2FloatPCS; + return mpe; +} + +cmsStage* _cmsStageNormalizeToLabFloat(cmsContext ContextID) +{ + static const cmsFloat64Number a1[] = { + 100.0, 0, 0, + 0, 255.0, 0, + 0, 0, 255.0 + }; + + static const cmsFloat64Number o1[] = { + 0, + -128.0, + -128.0 + }; + + cmsStage *mpe = cmsStageAllocMatrix(ContextID, 3, 3, a1, o1); + if (mpe == NULL) return mpe; + mpe ->Implements = cmsSigFloatPCS2Lab; + return mpe; +} + +cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID) +{ +#define n (65535.0/32768.0) + + static const cmsFloat64Number a1[] = { + n, 0, 0, + 0, n, 0, + 0, 0, n + }; +#undef n + + cmsStage *mpe = cmsStageAllocMatrix(ContextID, 3, 3, a1, NULL); + if (mpe == NULL) return mpe; + mpe ->Implements = cmsSigFloatPCS2XYZ; + return mpe; +} + + + // ******************************************************************************** // Type cmsSigXYZ2LabElemType // ******************************************************************************** @@ -1202,22 +1352,28 @@ NewLUT ->DupDataFn = NULL; NewLUT ->FreeDataFn = NULL; NewLUT ->Data = NewLUT; - - NewLUT ->ContextID = ContextID; + NewLUT ->ContextID = ContextID; BlessLUT(NewLUT); return NewLUT; } +cmsContext CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut) +{ + _cmsAssert(lut != NULL); + return lut ->ContextID; +} cmsUInt32Number CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut) { + _cmsAssert(lut != NULL); return lut ->InputChannels; } cmsUInt32Number CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut) { + _cmsAssert(lut != NULL); return lut ->OutputChannels; } @@ -1245,6 +1401,7 @@ // Default to evaluate the LUT on 16 bit-basis. void CMSEXPORT cmsPipelineEval16(const cmsUInt16Number In[], cmsUInt16Number Out[], const cmsPipeline* lut) { + _cmsAssert(lut != NULL); lut ->Eval16Fn(In, Out, lut->Data); } @@ -1252,6 +1409,7 @@ // Does evaluate the LUT on cmsFloat32Number-basis. void CMSEXPORT cmsPipelineEvalFloat(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsPipeline* lut) { + _cmsAssert(lut != NULL); lut ->EvalFloatFn(In, Out, lut); } @@ -1291,8 +1449,10 @@ Anterior = NewMPE; } - NewLUT ->DupDataFn = lut ->DupDataFn; - NewLUT ->FreeDataFn = lut ->FreeDataFn; + NewLUT ->Eval16Fn = lut ->Eval16Fn; + NewLUT ->EvalFloatFn = lut ->EvalFloatFn; + NewLUT ->DupDataFn = lut ->DupDataFn; + NewLUT ->FreeDataFn = lut ->FreeDataFn; if (NewLUT ->DupDataFn != NULL) NewLUT ->Data = NewLUT ->DupDataFn(lut ->ContextID, lut->Data); @@ -1309,6 +1469,9 @@ { cmsStage* Anterior = NULL, *pt; + _cmsAssert(lut != NULL); + _cmsAssert(mpe != NULL); + switch (loc) { case cmsAT_BEGIN: @@ -1459,13 +1622,13 @@ return n; } -// This function may be used to set the optional evalueator and a block of private data. If private data is being used, an optional +// This function may be used to set the optional evaluator and a block of private data. If private data is being used, an optional // duplicator and free functions should also be specified in order to duplicate the LUT construct. Use NULL to inhibit such functionality. void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut, _cmsOPTeval16Fn Eval16, void* PrivateData, - _cmsOPTfreeDataFn FreePrivateDataFn, - _cmsOPTdupDataFn DupPrivateDataFn) + _cmsFreeUserDataFn FreePrivateDataFn, + _cmsDupUserDataFn DupPrivateDataFn) { Lut ->Eval16Fn = Eval16; @@ -1643,3 +1806,4 @@ return TRUE; } +
--- a/src/share/native/sun/java2d/cmm/lcms/cmsmd5.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsmd5.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"),
--- a/src/share/native/sun/java2d/cmm/lcms/cmsmtrx.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsmtrx.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -202,3 +202,4 @@ r->n[VZ] = a->v[2].n[VX]*v->n[VX] + a->v[2].n[VY]*v->n[VY] + a->v[2].n[VZ]*v->n[VZ]; } +
--- a/src/share/native/sun/java2d/cmm/lcms/cmsnamed.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsnamed.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2012 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -117,7 +117,7 @@ } -// Grows a ntry table for a MLU. Each time this function is called, table size is multiplied times two. +// Grows a entry table for a MLU. Each time this function is called, table size is multiplied times two. static cmsBool GrowMLUtable(cmsMLU* mlu) { @@ -130,7 +130,7 @@ AllocatedEntries = mlu ->AllocatedEntries * 2; // Check for overflow - if (AllocatedEntries < mlu ->AllocatedEntries) return FALSE; + if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE; // Reallocate the memory NewPtr = (_cmsMLUentry*)_cmsRealloc(mlu ->ContextID, mlu ->Entries, AllocatedEntries*sizeof(_cmsMLUentry)); @@ -359,9 +359,9 @@ if (Best == -1) Best = 0; - v = mlu ->Entries + Best; + v = mlu ->Entries + Best; - if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language; + if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language; if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country; if (len != NULL) *len = v ->Len; @@ -372,8 +372,8 @@ // Obtain an ASCII representation of the wide string. Setting buffer to NULL returns the len cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu, - const char LanguageCode[3], const char CountryCode[3], - char* Buffer, cmsUInt32Number BufferSize) + const char LanguageCode[3], const char CountryCode[3], + char* Buffer, cmsUInt32Number BufferSize) { const wchar_t *Wide; cmsUInt32Number StrLen = 0; @@ -417,8 +417,8 @@ // Obtain a wide representation of the MLU, on depending on current locale settings cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu, - const char LanguageCode[3], const char CountryCode[3], - wchar_t* Buffer, cmsUInt32Number BufferSize) + const char LanguageCode[3], const char CountryCode[3], + wchar_t* Buffer, cmsUInt32Number BufferSize) { const wchar_t *Wide; cmsUInt32Number StrLen = 0; @@ -491,6 +491,9 @@ else size = v ->Allocated * 2; + // Keep a maximum color lists can grow, 100K entries seems reasonable + if (size > 1024*100) return FALSE; + NewPtr = (_cmsNAMEDCOLOR*) _cmsRealloc(v ->ContextID, v ->List, size * sizeof(_cmsNAMEDCOLOR)); if (NewPtr == NULL) return FALSE; @@ -516,6 +519,8 @@ strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix) - 1); strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix) - 1); + v->Prefix[sizeof(v ->Prefix) - 1] = v->Suffix[sizeof(v ->Suffix) - 1] = 0; + v -> ColorantCount = ColorantCount; return v; @@ -569,9 +574,15 @@ for (i=0; i < 3; i++) NamedColorList ->List[NamedColorList ->nColors].PCS[i] = PCS == NULL ? 0 : PCS[i]; - if (Name != NULL) + if (Name != NULL) { + strncpy(NamedColorList ->List[NamedColorList ->nColors].Name, Name, sizeof(NamedColorList ->List[NamedColorList ->nColors].Name) - 1); + + NamedColorList ->List[NamedColorList ->nColors]. + Name[sizeof(NamedColorList ->List[NamedColorList ->nColors].Name) - 1] = 0; + + } else NamedColorList ->List[NamedColorList ->nColors].Name[0] = 0; @@ -645,6 +656,24 @@ } static +void EvalNamedColorPCS(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage *mpe) +{ + cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) mpe ->Data; + cmsUInt16Number index = (cmsUInt16Number) _cmsQuickSaturateWord(In[0] * 65535.0); + + if (index >= NamedColorList-> nColors) { + cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, "Color %d out of range; ignored", index); + } + else { + + // Named color always uses Lab + Out[0] = (cmsFloat32Number) (NamedColorList->List[index].PCS[0] / 65535.0); + Out[1] = (cmsFloat32Number) (NamedColorList->List[index].PCS[1] / 65535.0); + Out[2] = (cmsFloat32Number) (NamedColorList->List[index].PCS[2] / 65535.0); + } +} + +static void EvalNamedColor(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage *mpe) { cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) mpe ->Data; @@ -662,15 +691,15 @@ // Named color lookup element -cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList) +cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS) { return _cmsStageAllocPlaceholder(NamedColorList ->ContextID, - cmsSigNamedColorElemType, - 1, 3, - EvalNamedColor, - DupNamedColorList, - FreeNamedColorList, - cmsDupNamedColorList(NamedColorList)); + cmsSigNamedColorElemType, + 1, UsePCS ? 3 : NamedColorList ->ColorantCount, + UsePCS ? EvalNamedColorPCS : EvalNamedColor, + DupNamedColorList, + FreeNamedColorList, + cmsDupNamedColorList(NamedColorList)); } @@ -775,3 +804,131 @@ return NULL; } +// Dictionaries -------------------------------------------------------------------------------------------------------- + +// Dictionaries are just very simple linked lists + + +typedef struct _cmsDICT_struct { + cmsDICTentry* head; + cmsContext ContextID; +} _cmsDICT; + + +// Allocate an empty dictionary +cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID) +{ + _cmsDICT* dict = (_cmsDICT*) _cmsMallocZero(ContextID, sizeof(_cmsDICT)); + if (dict == NULL) return NULL; + + dict ->ContextID = ContextID; + return (cmsHANDLE) dict; + +} + +// Dispose resources +void CMSEXPORT cmsDictFree(cmsHANDLE hDict) +{ + _cmsDICT* dict = (_cmsDICT*) hDict; + cmsDICTentry *entry, *next; + + _cmsAssert(dict != NULL); + + // Walk the list freeing all nodes + entry = dict ->head; + while (entry != NULL) { + + if (entry ->DisplayName != NULL) cmsMLUfree(entry ->DisplayName); + if (entry ->DisplayValue != NULL) cmsMLUfree(entry ->DisplayValue); + if (entry ->Name != NULL) _cmsFree(dict ->ContextID, entry -> Name); + if (entry ->Value != NULL) _cmsFree(dict ->ContextID, entry -> Value); + + // Don't fall in the habitual trap... + next = entry ->Next; + _cmsFree(dict ->ContextID, entry); + + entry = next; + } + + _cmsFree(dict ->ContextID, dict); +} + + +// Duplicate a wide char string +static +wchar_t* DupWcs(cmsContext ContextID, const wchar_t* ptr) +{ + if (ptr == NULL) return NULL; + return (wchar_t*) _cmsDupMem(ContextID, ptr, (mywcslen(ptr) + 1) * sizeof(wchar_t)); +} + +// Add a new entry to the linked list +cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue) +{ + _cmsDICT* dict = (_cmsDICT*) hDict; + cmsDICTentry *entry; + + _cmsAssert(dict != NULL); + _cmsAssert(Name != NULL); + + entry = (cmsDICTentry*) _cmsMallocZero(dict ->ContextID, sizeof(cmsDICTentry)); + if (entry == NULL) return FALSE; + + entry ->DisplayName = cmsMLUdup(DisplayName); + entry ->DisplayValue = cmsMLUdup(DisplayValue); + entry ->Name = DupWcs(dict ->ContextID, Name); + entry ->Value = DupWcs(dict ->ContextID, Value); + + entry ->Next = dict ->head; + dict ->head = entry; + + return TRUE; +} + + +// Duplicates an existing dictionary +cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict) +{ + _cmsDICT* old_dict = (_cmsDICT*) hDict; + cmsHANDLE hNew; + _cmsDICT* new_dict; + cmsDICTentry *entry; + + _cmsAssert(old_dict != NULL); + + hNew = cmsDictAlloc(old_dict ->ContextID); + if (hNew == NULL) return NULL; + + new_dict = (_cmsDICT*) hNew; + + // Walk the list freeing all nodes + entry = old_dict ->head; + while (entry != NULL) { + + if (!cmsDictAddEntry(hNew, entry ->Name, entry ->Value, entry ->DisplayName, entry ->DisplayValue)) { + + cmsDictFree(hNew); + return NULL; + } + + entry = entry -> Next; + } + + return hNew; +} + +// Get a pointer to the linked list +const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict) +{ + _cmsDICT* dict = (_cmsDICT*) hDict; + + if (dict == NULL) return NULL; + return dict ->head; +} + +// Helper For external languages +const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e) +{ + if (e == NULL) return NULL; + return e ->Next; +}
--- a/src/share/native/sun/java2d/cmm/lcms/cmsopt.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsopt.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -223,6 +223,12 @@ // Remove V2 to V4 followed by V4 to V2 Opt |= _Remove2Op(Lut, cmsSigLabV2toV4, cmsSigLabV4toV2); + // Remove float pcs Lab conversions + Opt |= _Remove2Op(Lut, cmsSigLab2FloatPCS, cmsSigFloatPCS2Lab); + + // Remove float pcs Lab conversions + Opt |= _Remove2Op(Lut, cmsSigXYZ2FloatPCS, cmsSigFloatPCS2XYZ); + if (Opt) AnyOpt = TRUE; } while (Opt); @@ -298,7 +304,7 @@ int nOutputs, cmsToneCurve** Out ) { int i; - Prelin16Data* p16 = (Prelin16Data*) _cmsMallocZero(ContextID, sizeof(Prelin16Data)); + Prelin16Data* p16 = _cmsMallocZero(ContextID, sizeof(Prelin16Data)); if (p16 == NULL) return NULL; p16 ->nInputs = nInputs; @@ -411,17 +417,17 @@ return FALSE; } - px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0; - py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0; - pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0; - pw = ((cmsFloat64Number) At[3] * (p16->Domain[3])) / 65535.0; + if (nChannelsIn == 4) { - x0 = (int) floor(px); - y0 = (int) floor(py); - z0 = (int) floor(pz); - w0 = (int) floor(pw); + px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0; + py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0; + pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0; + pw = ((cmsFloat64Number) At[3] * (p16->Domain[3])) / 65535.0; - if (nChannelsIn == 4) { + x0 = (int) floor(px); + y0 = (int) floor(py); + z0 = (int) floor(pz); + w0 = (int) floor(pw); if (((px - x0) != 0) || ((py - y0) != 0) || @@ -429,24 +435,36 @@ ((pw - w0) != 0)) return FALSE; // Not on exact node index = p16 -> opta[3] * x0 + - p16 -> opta[2] * y0 + - p16 -> opta[1] * z0 + - p16 -> opta[0] * w0; + p16 -> opta[2] * y0 + + p16 -> opta[1] * z0 + + p16 -> opta[0] * w0; } else if (nChannelsIn == 3) { + px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0; + py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0; + pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0; + + x0 = (int) floor(px); + y0 = (int) floor(py); + z0 = (int) floor(pz); + if (((px - x0) != 0) || ((py - y0) != 0) || ((pz - z0) != 0)) return FALSE; // Not on exact node index = p16 -> opta[2] * x0 + - p16 -> opta[1] * y0 + - p16 -> opta[0] * z0; + p16 -> opta[1] * y0 + + p16 -> opta[0] * z0; } else if (nChannelsIn == 1) { + px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0; + + x0 = (int) floor(px); + if (((px - x0) != 0)) return FALSE; // Not on exact node index = p16 -> opta[0] * x0; @@ -462,13 +480,15 @@ return TRUE; } -// Auxiliar, to see if two values are equal. +// Auxiliar, to see if two values are equal or very different static cmsBool WhitesAreEqual(int n, cmsUInt16Number White1[], cmsUInt16Number White2[] ) { int i; for (i=0; i < n; i++) { + + if (abs(White1[i] - White2[i]) > 0xf000) return TRUE; // Values are so extremly different that the fixup should be avoided if (White1[i] != White2[i]) return FALSE; } return TRUE; @@ -491,6 +511,8 @@ &WhitePointOut, NULL, &nOuts)) return FALSE; // It needs to be fixed? + if (Lut ->InputChannels != nIns) return FALSE; + if (Lut ->OutputChannels != nOuts) return FALSE; cmsPipelineEval16(WhitePointIn, ObtainedOut, Lut); @@ -555,6 +577,7 @@ { cmsPipeline* Src; cmsPipeline* Dest; + cmsStage* mpe; cmsStage* CLUT; cmsStage *KeepPreLin = NULL, *KeepPostLin = NULL; int nGridPoints; @@ -580,6 +603,13 @@ Src = *Lut; + // Named color pipelines cannot be optimized either + for (mpe = cmsPipelineGetPtrToFirstStage(Src); + mpe != NULL; + mpe = cmsStageNext(mpe)) { + if (cmsStageType(mpe) == cmsSigNamedColorElemType) return FALSE; + } + // Allocate an empty LUT Dest = cmsPipelineAlloc(Src ->ContextID, Src ->InputChannels, Src ->OutputChannels); if (!Dest) return FALSE; @@ -817,8 +847,8 @@ cmsUInt8Number r, g, b; cmsS15Fixed16Number rx, ry, rz; cmsS15Fixed16Number c0, c1, c2, c3, Rest; - int OutChan; - register cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + int OutChan; + register cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; Prelin8Data* p8 = (Prelin8Data*) D; register const cmsInterpParams* p = p8 ->p; int TotalOut = p -> nOutputs; @@ -892,15 +922,35 @@ } - Rest = c1 * rx + c2 * ry + c3 * rz; - - Output[OutChan] = (cmsUInt16Number)c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)); + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + Output[OutChan] = (cmsUInt16Number)c0 + ((Rest + (Rest>>16))>>16); } } #undef DENS + +// Curves that contain wide empty areas are not optimizeable +static +cmsBool IsDegenerated(const cmsToneCurve* g) +{ + int i, Zeros = 0, Poles = 0; + int nEntries = g ->nEntries; + + for (i=0; i < nEntries; i++) { + + if (g ->Table16[i] == 0x0000) Zeros++; + if (g ->Table16[i] == 0xffff) Poles++; + } + + if (Zeros == 1 && Poles == 1) return FALSE; // For linear tables + if (Zeros > (nEntries / 4)) return TRUE; // Degenerated, mostly zeros + if (Poles > (nEntries / 4)) return TRUE; // Degenerated, mostly poles + + return FALSE; +} + // -------------------------------------------------------------------------------------------------------------- // We need xput over here @@ -917,6 +967,7 @@ cmsStage* OptimizedCLUTmpe; cmsColorSpaceSignature ColorSpace, OutputColorSpace; cmsStage* OptimizedPrelinMpe; + cmsStage* mpe; cmsToneCurve** OptimizedPrelinCurves; _cmsStageCLutData* OptimizedPrelinCLUT; @@ -935,6 +986,14 @@ } OriginalLut = *Lut; + + // Named color pipelines cannot be optimized either + for (mpe = cmsPipelineGetPtrToFirstStage(OriginalLut); + mpe != NULL; + mpe = cmsStageNext(mpe)) { + if (cmsStageType(mpe) == cmsSigNamedColorElemType) return FALSE; + } + ColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*InputFormat)); OutputColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*OutputFormat)); nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags); @@ -981,6 +1040,9 @@ // Exclude if non-monotonic if (!cmsIsToneCurveMonotonic(Trans[t])) lIsSuitable = FALSE; + + if (IsDegenerated(Trans[t])) + lIsSuitable = FALSE; } // If it is not suitable, just quit @@ -1422,12 +1484,12 @@ // first we compute the resulting byte and then we store the byte times // 257. This quantization allows to round very quick by doing a >> 8, but // since the low byte is always equal to msb, we can do a & 0xff and this works! - cmsUInt16Number w = _cmsQuickSaturateWord(Val * 65535.0 + 0.5); + cmsUInt16Number w = _cmsQuickSaturateWord(Val * 65535.0); cmsUInt8Number b = FROM_16_TO_8(w); Table[i] = FROM_8_TO_16(b); } - else Table[i] = _cmsQuickSaturateWord(Val * 65535.0 + 0.5); + else Table[i] = _cmsQuickSaturateWord(Val * 65535.0); } } @@ -1664,3 +1726,5 @@ return AnySuccess; } + +
--- a/src/share/native/sun/java2d/cmm/lcms/cmspack.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmspack.c Fri Jun 21 15:46:14 2013 -0500 @@ -57,8 +57,8 @@ // This module handles all formats supported by lcms. There are two flavors, 16 bits and // floating point. Floating point is supported only in a subset, those formats holding -// cmsFloat32Number (4 bytes per component) and double (marked as 0 bytes per component as special -// case) +// cmsFloat32Number (4 bytes per component) and double (marked as 0 bytes per component +// as special case) // --------------------------------------------------------------------------- @@ -73,9 +73,7 @@ // * 0xffff / 0xff00 = (255 * 257) / (255 * 256) = 257 / 256 cmsINLINE cmsUInt16Number FomLabV2ToLabV4(cmsUInt16Number x) { - int a; - - a = (x << 8 | x) >> 8; // * 257 / 256 + int a = (x << 8 | x) >> 8; // * 257 / 256 if ( a > 0xffff) return 0xffff; return (cmsUInt16Number) a; } @@ -90,17 +88,18 @@ typedef struct { cmsUInt32Number Type; cmsUInt32Number Mask; - cmsFormatter16 Frm; + cmsFormatter16 Frm; } cmsFormatters16; typedef struct { cmsUInt32Number Type; cmsUInt32Number Mask; - cmsFormatterFloat Frm; + cmsFormatterFloat Frm; } cmsFormattersFloat; + #define ANYSPACE COLORSPACE_SH(31) #define ANYCHANNELS CHANNELS_SH(15) #define ANYEXTRA EXTRA_SH(7) @@ -119,6 +118,7 @@ // Unpacking routines (16 bits) ---------------------------------------------------------------------------------------- + // Does almost everything but is slow static cmsUInt8Number* UnrollChunkyBytes(register _cmsTRANSFORM* info, @@ -131,7 +131,7 @@ int Reverse = T_FLAVOR(info ->InputFormat); int SwapFirst = T_SWAPFIRST(info -> InputFormat); int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap && !SwapFirst; + int ExtraFirst = DoSwap ^ SwapFirst; cmsUInt16Number v; int i; @@ -160,6 +160,10 @@ } return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); + } // Extra channels are just ignored because come in the next planes @@ -169,13 +173,14 @@ register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap= T_DOSWAP(info ->InputFormat); - int Reverse= T_FLAVOR(info ->InputFormat); + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); int i; cmsUInt8Number* Init = accum; - if (DoSwap) { + if (DoSwap ^ SwapFirst) { accum += T_EXTRA(info -> InputFormat) * Stride; } @@ -204,6 +209,9 @@ wIn[3] = FROM_8_TO_16(*accum); accum++; // K return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -218,6 +226,9 @@ wIn[3] = FROM_8_TO_16(REVERSE_FLAVOR_8(*accum)); accum++; // K return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -232,6 +243,9 @@ wIn[2] = FROM_8_TO_16(*accum); accum++; // Y return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // KYMC @@ -247,6 +261,9 @@ wIn[0] = FROM_8_TO_16(*accum); accum++; // C return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -261,6 +278,9 @@ wIn[3] = FROM_8_TO_16(*accum); accum++; // C return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -274,6 +294,9 @@ wIn[2] = FROM_8_TO_16(*accum); accum++; // B return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -288,6 +311,9 @@ wIn[0] = FROM_8_TO_16(*accum); accum++; // R return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -302,6 +328,9 @@ wIn[2] = FROM_8_TO_16(*accum); accum++; // B return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } @@ -317,6 +346,9 @@ wIn[0] = FROM_8_TO_16(*accum); accum++; // R return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -330,6 +362,9 @@ wIn[2] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++; // b return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -344,6 +379,9 @@ wIn[2] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++; // b return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -357,34 +395,30 @@ wIn[2] = FomLabV2ToLabV4(*(cmsUInt16Number*) accum); accum += 2; // b return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } - - -// Monochrome + alpha. Alpha is lost +// for duplex static cmsUInt8Number* Unroll2Bytes(register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) -{ - wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L - wIn[3] = FROM_8_TO_16(*accum); accum++; // alpha - return accum; -} - -static -cmsUInt8Number* Unroll2ByteSwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wIn[], register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - wIn[3] = FROM_8_TO_16(*accum); accum++; // alpha - wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L + wIn[0] = FROM_8_TO_16(*accum); accum++; // ch1 + wIn[1] = FROM_8_TO_16(*accum); accum++; // ch2 + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } + + // Monochrome duplicates L into RGB for null-transforms static cmsUInt8Number* Unroll1Byte(register _cmsTRANSFORM* info, @@ -393,7 +427,27 @@ register cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); +} + + +static +cmsUInt8Number* Unroll1ByteSkip1(register _cmsTRANSFORM* info, + register cmsUInt16Number wIn[], + register cmsUInt8Number* accum, + register cmsUInt32Number Stride) +{ + wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L + accum += 1; + + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -404,7 +458,11 @@ { wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L accum += 2; + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -414,7 +472,11 @@ register cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = REVERSE_FLAVOR_16(FROM_8_TO_16(*accum)); accum++; // L + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } @@ -430,7 +492,7 @@ int Reverse = T_FLAVOR(info ->InputFormat); int SwapFirst = T_SWAPFIRST(info -> InputFormat); int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap && !SwapFirst; + int ExtraFirst = DoSwap ^ SwapFirst; int i; if (ExtraFirst) { @@ -463,6 +525,8 @@ } return accum; + + cmsUNUSED_PARAMETER(Stride); } static @@ -511,6 +575,9 @@ wIn[3] = *(cmsUInt16Number*) accum; accum+= 2; // K return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -525,6 +592,9 @@ wIn[3] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; // K return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -539,6 +609,9 @@ wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // Y return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // KYMC @@ -554,6 +627,9 @@ wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -568,6 +644,9 @@ wIn[3] = *(cmsUInt16Number*) accum; accum+= 2; // C return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -579,7 +658,11 @@ wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C R wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // M G wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // Y B + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -591,7 +674,11 @@ wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // C R wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // M G wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // Y B + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -606,6 +693,9 @@ wIn[0] = *(cmsUInt16Number*) accum; accum += 2; // B return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -620,6 +710,9 @@ wIn[2] = *(cmsUInt16Number*) accum; accum += 2; // B return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -629,7 +722,11 @@ register cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // L + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -639,7 +736,11 @@ register cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -651,33 +752,29 @@ wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum += 8; + return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static cmsUInt8Number* Unroll2Words(register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) -{ - wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // L - wIn[3] = *(cmsUInt16Number*) accum; accum += 2; // alpha - - return accum; -} - -static -cmsUInt8Number* Unroll2WordSwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wIn[], register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - wIn[3] = *(cmsUInt16Number*) accum; accum += 2; // alpha - wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // L + wIn[0] = *(cmsUInt16Number*) accum; accum += 2; // ch1 + wIn[1] = *(cmsUInt16Number*) accum; accum += 2; // ch2 return accum; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } + // This is a conversion of Lab double to 16 bits static cmsUInt8Number* UnrollLabDoubleTo16(register _cmsTRANSFORM* info, @@ -701,7 +798,41 @@ else { cmsFloat2LabEncoded(wIn, (cmsCIELab*) accum); - accum += sizeof(cmsCIELab); + accum += sizeof(cmsCIELab) + T_EXTRA(info ->InputFormat) * sizeof(cmsFloat64Number); + return accum; + } +} + + +// This is a conversion of Lab float to 16 bits +static +cmsUInt8Number* UnrollLabFloatTo16(register _cmsTRANSFORM* info, + register cmsUInt16Number wIn[], + register cmsUInt8Number* accum, + register cmsUInt32Number Stride) +{ + cmsCIELab Lab; + + if (T_PLANAR(info -> InputFormat)) { + + cmsFloat32Number* Pt = (cmsFloat32Number*) accum; + + + Lab.L = Pt[0]; + Lab.a = Pt[Stride]; + Lab.b = Pt[Stride*2]; + + cmsFloat2LabEncoded(wIn, &Lab); + return accum + sizeof(cmsFloat32Number); + } + else { + + Lab.L = ((cmsFloat32Number*) accum)[0]; + Lab.a = ((cmsFloat32Number*) accum)[1]; + Lab.b = ((cmsFloat32Number*) accum)[2]; + + cmsFloat2LabEncoded(wIn, &Lab); + accum += (3 + T_EXTRA(info ->InputFormat)) * sizeof(cmsFloat32Number); return accum; } } @@ -729,7 +860,7 @@ else { cmsFloat2XYZEncoded(wIn, (cmsCIEXYZ*) accum); - accum += sizeof(cmsCIEXYZ); + accum += sizeof(cmsCIEXYZ) + T_EXTRA(info ->InputFormat) * sizeof(cmsFloat64Number); return accum; } @@ -761,65 +892,117 @@ // Inks does come in percentage, remaining cases are between 0..1.0, again to 16 bits static cmsUInt8Number* UnrollDoubleTo16(register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) + register cmsUInt16Number wIn[], + register cmsUInt8Number* accum, + register cmsUInt32Number Stride) { - cmsFloat64Number* Inks = (cmsFloat64Number*) accum; - int nChan = T_CHANNELS(info -> InputFormat); - int Planar = T_PLANAR(info -> InputFormat); - int i; + + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info -> InputFormat); + int Extra = T_EXTRA(info -> InputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + int Planar = T_PLANAR(info -> InputFormat); cmsFloat64Number v; - cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + cmsUInt16Number vi; + int i, start = 0; + cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + + + if (ExtraFirst) + start = Extra; for (i=0; i < nChan; i++) { + int index = DoSwap ? (nChan - i - 1) : i; + if (Planar) - - v = Inks[i * Stride]; + v = (cmsFloat32Number) ((cmsFloat64Number*) accum)[(i + start) * Stride]; else - v = Inks[i]; - - wIn[i] = _cmsQuickSaturateWord(v * maximum); + v = (cmsFloat32Number) ((cmsFloat64Number*) accum)[i + start]; + + vi = _cmsQuickSaturateWord(v * maximum); + + if (Reverse) + vi = REVERSE_FLAVOR_16(vi); + + wIn[index] = vi; + } + + + if (Extra == 0 && SwapFirst) { + cmsUInt16Number tmp = wIn[0]; + + memmove(&wIn[0], &wIn[1], (nChan-1) * sizeof(cmsUInt16Number)); + wIn[nChan-1] = tmp; } if (T_PLANAR(info -> InputFormat)) return accum + sizeof(cmsFloat64Number); else - return accum + (nChan + T_EXTRA(info ->InputFormat)) * sizeof(cmsFloat64Number); + return accum + (nChan + Extra) * sizeof(cmsFloat64Number); } + + static cmsUInt8Number* UnrollFloatTo16(register _cmsTRANSFORM* info, register cmsUInt16Number wIn[], register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - cmsFloat32Number* Inks = (cmsFloat32Number*) accum; - int nChan = T_CHANNELS(info -> InputFormat); - int Planar = T_PLANAR(info -> InputFormat); - int i; + + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info -> InputFormat); + int Extra = T_EXTRA(info -> InputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + int Planar = T_PLANAR(info -> InputFormat); cmsFloat32Number v; - cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + cmsUInt16Number vi; + int i, start = 0; + cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + + + if (ExtraFirst) + start = Extra; for (i=0; i < nChan; i++) { + int index = DoSwap ? (nChan - i - 1) : i; + if (Planar) - - v = Inks[i * Stride]; + v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[(i + start) * Stride]; else - v = Inks[i]; - - wIn[i] = _cmsQuickSaturateWord(v * maximum); + v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[i + start]; + + vi = _cmsQuickSaturateWord(v * maximum); + + if (Reverse) + vi = REVERSE_FLAVOR_16(vi); + + wIn[index] = vi; + } + + + if (Extra == 0 && SwapFirst) { + cmsUInt16Number tmp = wIn[0]; + + memmove(&wIn[0], &wIn[1], (nChan-1) * sizeof(cmsUInt16Number)); + wIn[nChan-1] = tmp; } if (T_PLANAR(info -> InputFormat)) return accum + sizeof(cmsFloat32Number); else - return accum + (nChan + T_EXTRA(info ->InputFormat)) * sizeof(cmsFloat32Number); + return accum + (nChan + Extra) * sizeof(cmsFloat32Number); } + + // For 1 channel, we need to duplicate data (it comes in 0..1.0 range) static cmsUInt8Number* UnrollDouble1Chan(register _cmsTRANSFORM* info, @@ -832,12 +1015,13 @@ wIn[0] = wIn[1] = wIn[2] = _cmsQuickSaturateWord(Inks[0] * 65535.0); return accum + sizeof(cmsFloat64Number); + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } //------------------------------------------------------------------------------------------------------------------- -// True cmsFloat32Number transformation. - // For anything going from cmsFloat32Number static cmsUInt8Number* UnrollFloatsToFloat(_cmsTRANSFORM* info, @@ -845,55 +1029,104 @@ cmsUInt8Number* accum, cmsUInt32Number Stride) { - cmsFloat32Number* Inks = (cmsFloat32Number*) accum; - int nChan = T_CHANNELS(info -> InputFormat); - int Planar = T_PLANAR(info -> InputFormat); - int i; - cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 100.0 : 1.0; - - - for (i=0; i < nChan; i++) { + + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info -> InputFormat); + int Extra = T_EXTRA(info -> InputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + int Planar = T_PLANAR(info -> InputFormat); + cmsFloat32Number v; + int i, start = 0; + cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F; + + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; if (Planar) - wIn[i] = (cmsFloat32Number) (Inks[i * Stride] / maximum); + v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[(i + start) * Stride]; else - wIn[i] = (cmsFloat32Number) (Inks[i] / maximum); + v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[i + start]; + + v /= maximum; + + wIn[index] = Reverse ? 1 - v : v; + } + + + if (Extra == 0 && SwapFirst) { + cmsFloat32Number tmp = wIn[0]; + + memmove(&wIn[0], &wIn[1], (nChan-1) * sizeof(cmsFloat32Number)); + wIn[nChan-1] = tmp; } if (T_PLANAR(info -> InputFormat)) return accum + sizeof(cmsFloat32Number); else - return accum + (nChan + T_EXTRA(info ->InputFormat)) * sizeof(cmsFloat32Number); + return accum + (nChan + Extra) * sizeof(cmsFloat32Number); } // For anything going from double + static cmsUInt8Number* UnrollDoublesToFloat(_cmsTRANSFORM* info, - cmsFloat32Number wIn[], - cmsUInt8Number* accum, - cmsUInt32Number Stride) + cmsFloat32Number wIn[], + cmsUInt8Number* accum, + cmsUInt32Number Stride) { - cmsFloat64Number* Inks = (cmsFloat64Number*) accum; - int nChan = T_CHANNELS(info -> InputFormat); - int Planar = T_PLANAR(info -> InputFormat); - int i; + + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info -> InputFormat); + int Extra = T_EXTRA(info -> InputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + int Planar = T_PLANAR(info -> InputFormat); + cmsFloat64Number v; + int i, start = 0; cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 100.0 : 1.0; - for (i=0; i < nChan; i++) { + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; if (Planar) - wIn[i] = (cmsFloat32Number) (Inks[i * Stride] / maximum); + v = (cmsFloat64Number) ((cmsFloat64Number*) accum)[(i + start) * Stride]; else - wIn[i] = (cmsFloat32Number) (Inks[i] / maximum); + v = (cmsFloat64Number) ((cmsFloat64Number*) accum)[i + start]; + + v /= maximum; + + wIn[index] = (cmsFloat32Number) (Reverse ? 1.0 - v : v); + } + + + if (Extra == 0 && SwapFirst) { + cmsFloat32Number tmp = wIn[0]; + + memmove(&wIn[0], &wIn[1], (nChan-1) * sizeof(cmsFloat32Number)); + wIn[nChan-1] = tmp; } if (T_PLANAR(info -> InputFormat)) return accum + sizeof(cmsFloat64Number); else - return accum + (nChan + T_EXTRA(info ->InputFormat)) * sizeof(cmsFloat64Number); + return accum + (nChan + Extra) * sizeof(cmsFloat64Number); } + // From Lab double to cmsFloat32Number static cmsUInt8Number* UnrollLabDoubleToFloat(_cmsTRANSFORM* info, @@ -913,11 +1146,11 @@ } else { - wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 + wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 wIn[1] = (cmsFloat32Number) ((Pt[1] + 128) / 255.0); // form -128..+127 to 0..1 wIn[2] = (cmsFloat32Number) ((Pt[2] + 128) / 255.0); - accum += sizeof(cmsFloat64Number)*3; + accum += sizeof(cmsFloat64Number)*(3 + T_EXTRA(info ->InputFormat)); return accum; } } @@ -933,7 +1166,7 @@ if (T_PLANAR(info -> InputFormat)) { - wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 + wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 wIn[1] = (cmsFloat32Number) ((Pt[Stride] + 128) / 255.0); // form -128..+127 to 0..1 wIn[2] = (cmsFloat32Number) ((Pt[Stride*2] + 128) / 255.0); @@ -941,16 +1174,17 @@ } else { - wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 + wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 wIn[1] = (cmsFloat32Number) ((Pt[1] + 128) / 255.0); // form -128..+127 to 0..1 wIn[2] = (cmsFloat32Number) ((Pt[2] + 128) / 255.0); - accum += sizeof(cmsFloat32Number)*3; + accum += sizeof(cmsFloat32Number)*(3 + T_EXTRA(info ->InputFormat)); return accum; } } + // 1.15 fixed point, that means maximum value is MAX_ENCODEABLE_XYZ (0xFFFF) static cmsUInt8Number* UnrollXYZDoubleToFloat(_cmsTRANSFORM* info, @@ -974,7 +1208,7 @@ wIn[1] = (cmsFloat32Number) (Pt[1] / MAX_ENCODEABLE_XYZ); wIn[2] = (cmsFloat32Number) (Pt[2] / MAX_ENCODEABLE_XYZ); - accum += sizeof(cmsFloat64Number)*3; + accum += sizeof(cmsFloat64Number)*(3 + T_EXTRA(info ->InputFormat)); return accum; } } @@ -1001,11 +1235,13 @@ wIn[1] = (cmsFloat32Number) (Pt[1] / MAX_ENCODEABLE_XYZ); wIn[2] = (cmsFloat32Number) (Pt[2] / MAX_ENCODEABLE_XYZ); - accum += sizeof(cmsFloat32Number)*3; + accum += sizeof(cmsFloat32Number)*(3 + T_EXTRA(info ->InputFormat)); return accum; } } + + // Packing routines ----------------------------------------------------------------------------------------------------------- @@ -1022,7 +1258,7 @@ int Reverse = T_FLAVOR(info ->OutputFormat); int Extra = T_EXTRA(info -> OutputFormat); int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int ExtraFirst = DoSwap && !SwapFirst; + int ExtraFirst = DoSwap ^ SwapFirst; cmsUInt8Number* swap1; cmsUInt8Number v = 0; int i; @@ -1057,6 +1293,8 @@ return output; + + cmsUNUSED_PARAMETER(Stride); } @@ -1073,7 +1311,7 @@ int Reverse = T_FLAVOR(info ->OutputFormat); int Extra = T_EXTRA(info -> OutputFormat); int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int ExtraFirst = DoSwap && !SwapFirst; + int ExtraFirst = DoSwap ^ SwapFirst; cmsUInt16Number* swap1; cmsUInt16Number v = 0; int i; @@ -1113,6 +1351,8 @@ return output; + + cmsUNUSED_PARAMETER(Stride); } @@ -1122,12 +1362,19 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse= T_FLAVOR(info ->OutputFormat); + int nChan = T_CHANNELS(info -> OutputFormat); + int DoSwap = T_DOSWAP(info ->OutputFormat); + int SwapFirst = T_SWAPFIRST(info ->OutputFormat); + int Reverse = T_FLAVOR(info ->OutputFormat); int i; cmsUInt8Number* Init = output; + + if (DoSwap ^ SwapFirst) { + output += T_EXTRA(info -> OutputFormat) * Stride; + } + + for (i=0; i < nChan; i++) { int index = DoSwap ? (nChan - i - 1) : i; @@ -1138,6 +1385,8 @@ } return (Init + 1); + + cmsUNUSED_PARAMETER(Stride); } @@ -1194,6 +1443,9 @@ *output++ = FROM_16_TO_8(wOut[5]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // KCMYcm @@ -1212,6 +1464,9 @@ *output++ = FROM_16_TO_8(wOut[0]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // CMYKcm @@ -1235,6 +1490,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // KCMYcm @@ -1258,6 +1516,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } @@ -1273,6 +1534,9 @@ *output++ = FROM_16_TO_8(wOut[3]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1287,6 +1551,9 @@ *output++ = REVERSE_FLAVOR_8(FROM_16_TO_8(wOut[3])); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } @@ -1302,6 +1569,9 @@ *output++ = FROM_16_TO_8(wOut[2]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // ABGR @@ -1317,6 +1587,9 @@ *output++ = FROM_16_TO_8(wOut[0]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1331,6 +1604,9 @@ *output++ = FROM_16_TO_8(wOut[3]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1349,6 +1625,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1367,6 +1646,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // ABGR @@ -1386,6 +1668,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // CMYK @@ -1405,6 +1690,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } @@ -1419,6 +1707,9 @@ *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[2])); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1433,6 +1724,9 @@ *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[2])); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1449,6 +1743,9 @@ output += 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1462,6 +1759,9 @@ *output++ = FROM_16_TO_8(wOut[2]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1475,6 +1775,9 @@ *output++ = (wOut[2] & 0xFF); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1488,6 +1791,9 @@ *output++ = FROM_16_TO_8(wOut[0]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1501,6 +1807,9 @@ *output++ = (wOut[0] & 0xFF); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } @@ -1518,6 +1827,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1534,6 +1846,9 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static @@ -1550,10 +1865,13 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1564,10 +1882,13 @@ output++; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1Optimized(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1Optimized(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1578,11 +1899,14 @@ output++; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1593,10 +1917,13 @@ *output++ = FROM_16_TO_8(wOut[2]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1607,10 +1934,13 @@ *output++ = (wOut[2] & 0xFF); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1Swap(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1Swap(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1621,10 +1951,13 @@ *output++ = FROM_16_TO_8(wOut[0]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1635,11 +1968,14 @@ *output++ = (wOut[0] & 0xFF); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1650,10 +1986,13 @@ output++; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1664,10 +2003,13 @@ output++; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3WordsAndSkip1(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3WordsAndSkip1(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1681,10 +2023,13 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3WordsAndSkip1Swap(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3WordsAndSkip1Swap(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1698,11 +2043,14 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1716,11 +2064,14 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1734,46 +2085,61 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1Byte(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1Byte(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); + return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1ByteReversed(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1ByteReversed(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(REVERSE_FLAVOR_16(wOut[0])); + return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1ByteSkip1(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1ByteSkip1(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); output++; + return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1ByteSkip1SwapFirst(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1ByteSkip1SwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1782,10 +2148,13 @@ *output++ = FROM_16_TO_8(wOut[0]); return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1Word(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1Word(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1794,11 +2163,14 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1WordReversed(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1WordReversed(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1807,10 +2179,13 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1WordBigEndian(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1WordBigEndian(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1819,11 +2194,14 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1WordSkip1(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1WordSkip1(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1832,10 +2210,13 @@ output+= 4; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } static -cmsUInt8Number* Pack1WordSkip1SwapFirst(register _cmsTRANSFORM* Info, +cmsUInt8Number* Pack1WordSkip1SwapFirst(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) @@ -1845,18 +2226,21 @@ output+= 2; return output; + + cmsUNUSED_PARAMETER(info); + cmsUNUSED_PARAMETER(Stride); } // Unencoded Float values -- don't try optimize speed static -cmsUInt8Number* PackLabDoubleFrom16(register _cmsTRANSFORM* Info, +cmsUInt8Number* PackLabDoubleFrom16(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) { - if (T_PLANAR(Info -> OutputFormat)) { + if (T_PLANAR(info -> OutputFormat)) { cmsCIELab Lab; cmsFloat64Number* Out = (cmsFloat64Number*) output; @@ -1871,9 +2255,38 @@ else { cmsLabEncoded2Float((cmsCIELab*) output, wOut); - return output + (sizeof(cmsCIELab) + T_EXTRA(Info ->OutputFormat) * sizeof(cmsFloat64Number)); + return output + (sizeof(cmsCIELab) + T_EXTRA(info ->OutputFormat) * sizeof(cmsFloat64Number)); } - +} + + +static +cmsUInt8Number* PackLabFloatFrom16(register _cmsTRANSFORM* info, + register cmsUInt16Number wOut[], + register cmsUInt8Number* output, + register cmsUInt32Number Stride) +{ + cmsCIELab Lab; + cmsLabEncoded2Float(&Lab, wOut); + + if (T_PLANAR(info -> OutputFormat)) { + + cmsFloat32Number* Out = (cmsFloat32Number*) output; + + Out[0] = (cmsFloat32Number)Lab.L; + Out[Stride] = (cmsFloat32Number)Lab.a; + Out[Stride*2] = (cmsFloat32Number)Lab.b; + + return output + sizeof(cmsFloat32Number); + } + else { + + ((cmsFloat32Number*) output)[0] = (cmsFloat32Number) Lab.L; + ((cmsFloat32Number*) output)[1] = (cmsFloat32Number) Lab.a; + ((cmsFloat32Number*) output)[2] = (cmsFloat32Number) Lab.b; + + return output + (3 + T_EXTRA(info ->OutputFormat)) * sizeof(cmsFloat32Number); + } } static @@ -1888,7 +2301,7 @@ cmsFloat64Number* Out = (cmsFloat64Number*) output; cmsXYZEncoded2Float(&XYZ, wOut); - Out[0] = XYZ.X; + Out[0] = XYZ.X; Out[Stride] = XYZ.Y; Out[Stride*2] = XYZ.Z; @@ -1904,97 +2317,136 @@ } static -cmsUInt8Number* PackDoubleFrom16(register _cmsTRANSFORM* Info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) -{ - cmsFloat64Number* Inks = (cmsFloat64Number*) output; - int nChan = T_CHANNELS(Info -> OutputFormat); - int i; - cmsFloat64Number maximum = IsInkSpace(Info ->InputFormat) ? 655.35 : 65535.0; - - if (T_PLANAR(Info -> OutputFormat)) { - - for (i=0; i < nChan; i++) { - - Inks[i*Stride] = wOut[i] / maximum; - } - - return output + sizeof(cmsFloat64Number); - } - else { - - for (i=0; i < nChan; i++) { - - Inks[i] = wOut[i] / maximum; - } - - - return output + (nChan + T_EXTRA(Info ->OutputFormat)) * sizeof(cmsFloat64Number); - } - -} - -static -cmsUInt8Number* PackFloatFrom16(register _cmsTRANSFORM* Info, +cmsUInt8Number* PackDoubleFrom16(register _cmsTRANSFORM* info, register cmsUInt16Number wOut[], register cmsUInt8Number* output, register cmsUInt32Number Stride) { - cmsFloat32Number* Inks = (cmsFloat32Number*) output; - int nChan = T_CHANNELS(Info -> OutputFormat); - int i; - cmsFloat64Number maximum = IsInkSpace(Info ->OutputFormat) ? 655.35 : 65535.0; - - if (T_PLANAR(Info -> OutputFormat)) { - - for (i=0; i < nChan; i++) { - - Inks[i*Stride] = (cmsFloat32Number) (wOut[i] / maximum); - } - - return output + sizeof(cmsFloat32Number); + int nChan = T_CHANNELS(info -> OutputFormat); + int DoSwap = T_DOSWAP(info ->OutputFormat); + int Reverse = T_FLAVOR(info ->OutputFormat); + int Extra = T_EXTRA(info -> OutputFormat); + int SwapFirst = T_SWAPFIRST(info -> OutputFormat); + int Planar = T_PLANAR(info -> OutputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 655.35 : 65535.0; + cmsFloat64Number v = 0; + cmsFloat64Number* swap1 = (cmsFloat64Number*) output; + int i, start = 0; + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + v = (cmsFloat64Number) wOut[index] / maximum; + + if (Reverse) + v = maximum - v; + + if (Planar) + ((cmsFloat64Number*) output)[(i + start) * Stride]= v; + else + ((cmsFloat64Number*) output)[i + start] = v; } - else { - - for (i=0; i < nChan; i++) { - - Inks[i] = (cmsFloat32Number) (wOut[i] / maximum); - } - - - return output + (nChan + T_EXTRA(Info ->OutputFormat)) * sizeof(cmsFloat32Number); + + if (!ExtraFirst) { + output += Extra * sizeof(cmsFloat64Number); } + if (Extra == 0 && SwapFirst) { + + memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsFloat64Number)); + *swap1 = v; + } + + if (T_PLANAR(info -> OutputFormat)) + return output + sizeof(cmsFloat64Number); + else + return output + nChan * sizeof(cmsFloat64Number); + } -// -------------------------------------------------------------------------------------------------------- - static -cmsUInt8Number* PackChunkyFloatsFromFloat(_cmsTRANSFORM* info, - cmsFloat32Number wOut[], - cmsUInt8Number* output, - cmsUInt32Number Stride) +cmsUInt8Number* PackFloatFrom16(register _cmsTRANSFORM* info, + register cmsUInt16Number wOut[], + register cmsUInt8Number* output, + register cmsUInt32Number Stride) { int nChan = T_CHANNELS(info -> OutputFormat); int DoSwap = T_DOSWAP(info ->OutputFormat); int Reverse = T_FLAVOR(info ->OutputFormat); int Extra = T_EXTRA(info -> OutputFormat); int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int ExtraFirst = DoSwap && !SwapFirst; - cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 100.0 : 1.0; - cmsFloat32Number* swap1; + int Planar = T_PLANAR(info -> OutputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 655.35 : 65535.0; cmsFloat64Number v = 0; - int i; - - swap1 = (cmsFloat32Number*) output; - - if (ExtraFirst) { + cmsFloat32Number* swap1 = (cmsFloat32Number*) output; + int i, start = 0; + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + v = (cmsFloat64Number) wOut[index] / maximum; + + if (Reverse) + v = maximum - v; + + if (Planar) + ((cmsFloat32Number*) output)[(i + start ) * Stride]= (cmsFloat32Number) v; + else + ((cmsFloat32Number*) output)[i + start] = (cmsFloat32Number) v; + } + + if (!ExtraFirst) { output += Extra * sizeof(cmsFloat32Number); } + if (Extra == 0 && SwapFirst) { + + memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsFloat32Number)); + *swap1 = (cmsFloat32Number) v; + } + + if (T_PLANAR(info -> OutputFormat)) + return output + sizeof(cmsFloat32Number); + else + return output + nChan * sizeof(cmsFloat32Number); +} + + + +// -------------------------------------------------------------------------------------------------------- + +static +cmsUInt8Number* PackFloatsFromFloat(_cmsTRANSFORM* info, + cmsFloat32Number wOut[], + cmsUInt8Number* output, + cmsUInt32Number Stride) +{ + int nChan = T_CHANNELS(info -> OutputFormat); + int DoSwap = T_DOSWAP(info ->OutputFormat); + int Reverse = T_FLAVOR(info ->OutputFormat); + int Extra = T_EXTRA(info -> OutputFormat); + int SwapFirst = T_SWAPFIRST(info -> OutputFormat); + int Planar = T_PLANAR(info -> OutputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 100.0 : 1.0; + cmsFloat32Number* swap1 = (cmsFloat32Number*) output; + cmsFloat64Number v = 0; + int i, start = 0; + + if (ExtraFirst) + start = Extra; + for (i=0; i < nChan; i++) { int index = DoSwap ? (nChan - i - 1) : i; @@ -2004,42 +2456,48 @@ if (Reverse) v = maximum - v; - *(cmsFloat32Number*) output = (cmsFloat32Number) v; - - output += sizeof(cmsFloat32Number); + if (Planar) + ((cmsFloat32Number*) output)[(i + start)* Stride]= (cmsFloat32Number) v; + else + ((cmsFloat32Number*) output)[i + start] = (cmsFloat32Number) v; } if (!ExtraFirst) { output += Extra * sizeof(cmsFloat32Number); } - if (Extra == 0 && SwapFirst) { - - memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsFloat32Number)); + if (Extra == 0 && SwapFirst) { + + memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsFloat32Number)); *swap1 = (cmsFloat32Number) v; } - - return output; + if (T_PLANAR(info -> OutputFormat)) + return output + sizeof(cmsFloat32Number); + else + return output + nChan * sizeof(cmsFloat32Number); } static -cmsUInt8Number* PackPlanarFloatsFromFloat(_cmsTRANSFORM* info, - cmsFloat32Number wOut[], - cmsUInt8Number* output, - cmsUInt32Number Stride) +cmsUInt8Number* PackDoublesFromFloat(_cmsTRANSFORM* info, + cmsFloat32Number wOut[], + cmsUInt8Number* output, + cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse= T_FLAVOR(info ->OutputFormat); - int i; - cmsUInt8Number* Init = output; + int nChan = T_CHANNELS(info -> OutputFormat); + int DoSwap = T_DOSWAP(info ->OutputFormat); + int Reverse = T_FLAVOR(info ->OutputFormat); + int Extra = T_EXTRA(info -> OutputFormat); + int SwapFirst = T_SWAPFIRST(info -> OutputFormat); + int Planar = T_PLANAR(info -> OutputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 100.0 : 1.0; - cmsFloat64Number v; - - if (DoSwap) { - output += T_EXTRA(info -> OutputFormat) * Stride * sizeof(cmsFloat32Number); - } + cmsFloat64Number v = 0; + cmsFloat64Number* swap1 = (cmsFloat64Number*) output; + int i, start = 0; + + if (ExtraFirst) + start = Extra; for (i=0; i < nChan; i++) { @@ -2048,100 +2506,32 @@ v = wOut[index] * maximum; if (Reverse) - v = maximum - v; - - *(cmsFloat32Number*) output = (cmsFloat32Number) v; - output += (Stride * sizeof(cmsFloat32Number)); - } - - return (Init + sizeof(cmsFloat32Number)); -} - - -static -cmsUInt8Number* PackChunkyDoublesFromFloat(_cmsTRANSFORM* info, - cmsFloat32Number wOut[], - cmsUInt8Number* output, - cmsUInt32Number Stride) -{ - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse = T_FLAVOR(info ->OutputFormat); - int Extra = T_EXTRA(info -> OutputFormat); - int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int ExtraFirst = DoSwap && !SwapFirst; - cmsFloat64Number* swap1; - cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 100.0 : 1.0; - cmsFloat64Number v = 0; - int i; - - swap1 = (cmsFloat64Number*) output; - - if (ExtraFirst) { - output += Extra * sizeof(cmsFloat64Number); - } - - for (i=0; i < nChan; i++) { - - int index = DoSwap ? (nChan - i - 1) : i; - - v = (cmsFloat64Number) wOut[index] * maximum; - - if (Reverse) v = maximum - v; - *(cmsFloat64Number*) output = v; - - output += sizeof(cmsFloat64Number); + if (Planar) + ((cmsFloat64Number*) output)[(i + start) * Stride] = v; + else + ((cmsFloat64Number*) output)[i + start] = v; } if (!ExtraFirst) { output += Extra * sizeof(cmsFloat64Number); } - if (Extra == 0 && SwapFirst) { - - memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsFloat64Number)); + if (Extra == 0 && SwapFirst) { + + memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsFloat64Number)); *swap1 = v; } - return output; + if (T_PLANAR(info -> OutputFormat)) + return output + sizeof(cmsFloat64Number); + else + return output + nChan * sizeof(cmsFloat64Number); + } -static -cmsUInt8Number* PackPlanarDoublesFromFloat(_cmsTRANSFORM* info, - cmsFloat32Number wOut[], - cmsUInt8Number* output, - cmsUInt32Number Stride) -{ - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse= T_FLAVOR(info ->OutputFormat); - int i; - cmsUInt8Number* Init = output; - cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 100.0 : 1.0; - cmsFloat64Number v; - - if (DoSwap) { - output += T_EXTRA(info -> OutputFormat) * Stride * sizeof(cmsFloat64Number); - } - - for (i=0; i < nChan; i++) { - - int index = DoSwap ? (nChan - i - 1) : i; - - v = (cmsFloat64Number) wOut[index] * maximum; - - if (Reverse) - v = maximum - v; - - *(cmsFloat64Number*) output = v; - output += (Stride * sizeof(cmsFloat64Number)); - } - - return (Init + sizeof(cmsFloat64Number)); -} @@ -2156,7 +2546,7 @@ if (T_PLANAR(Info -> OutputFormat)) { - Out[0] = (cmsFloat32Number) (wOut[0] * 100.0); + Out[0] = (cmsFloat32Number) (wOut[0] * 100.0); Out[Stride] = (cmsFloat32Number) (wOut[1] * 255.0 - 128.0); Out[Stride*2] = (cmsFloat32Number) (wOut[2] * 255.0 - 128.0); @@ -2173,6 +2563,7 @@ } + static cmsUInt8Number* PackLabDoubleFromFloat(_cmsTRANSFORM* Info, cmsFloat32Number wOut[], @@ -2183,7 +2574,7 @@ if (T_PLANAR(Info -> OutputFormat)) { - Out[0] = (cmsFloat64Number) (wOut[0] * 100.0); + Out[0] = (cmsFloat64Number) (wOut[0] * 100.0); Out[Stride] = (cmsFloat64Number) (wOut[1] * 255.0 - 128.0); Out[Stride*2] = (cmsFloat64Number) (wOut[2] * 255.0 - 128.0); @@ -2212,7 +2603,7 @@ if (T_PLANAR(Info -> OutputFormat)) { - Out[0] = (cmsFloat32Number) (wOut[0] * MAX_ENCODEABLE_XYZ); + Out[0] = (cmsFloat32Number) (wOut[0] * MAX_ENCODEABLE_XYZ); Out[Stride] = (cmsFloat32Number) (wOut[1] * MAX_ENCODEABLE_XYZ); Out[Stride*2] = (cmsFloat32Number) (wOut[2] * MAX_ENCODEABLE_XYZ); @@ -2229,7 +2620,6 @@ } - // Same, but convert to double static cmsUInt8Number* PackXYZDoubleFromFloat(_cmsTRANSFORM* Info, @@ -2241,7 +2631,7 @@ if (T_PLANAR(Info -> OutputFormat)) { - Out[0] = (cmsFloat64Number) (wOut[0] * MAX_ENCODEABLE_XYZ); + Out[0] = (cmsFloat64Number) (wOut[0] * MAX_ENCODEABLE_XYZ); Out[Stride] = (cmsFloat64Number) (wOut[1] * MAX_ENCODEABLE_XYZ); Out[Stride*2] = (cmsFloat64Number) (wOut[2] * MAX_ENCODEABLE_XYZ); @@ -2261,24 +2651,246 @@ // ---------------------------------------------------------------------------------------------------------------- +#ifndef CMS_NO_HALF_SUPPORT + +// Decodes an stream of half floats to wIn[] described by input format + +static +cmsUInt8Number* UnrollHalfTo16(register _cmsTRANSFORM* info, + register cmsUInt16Number wIn[], + register cmsUInt8Number* accum, + register cmsUInt32Number Stride) +{ + + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info -> InputFormat); + int Extra = T_EXTRA(info -> InputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + int Planar = T_PLANAR(info -> InputFormat); + cmsFloat32Number v; + int i, start = 0; + cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 655.35F : 65535.0F; + + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + if (Planar) + v = _cmsHalf2Float ( ((cmsUInt16Number*) accum)[(i + start) * Stride] ); + else + v = _cmsHalf2Float ( ((cmsUInt16Number*) accum)[i + start] ) ; + + if (Reverse) v = maximum - v; + + wIn[index] = _cmsQuickSaturateWord(v * maximum); + } + + + if (Extra == 0 && SwapFirst) { + cmsUInt16Number tmp = wIn[0]; + + memmove(&wIn[0], &wIn[1], (nChan-1) * sizeof(cmsUInt16Number)); + wIn[nChan-1] = tmp; + } + + if (T_PLANAR(info -> InputFormat)) + return accum + sizeof(cmsUInt16Number); + else + return accum + (nChan + Extra) * sizeof(cmsUInt16Number); +} + +// Decodes an stream of half floats to wIn[] described by input format + +static +cmsUInt8Number* UnrollHalfToFloat(_cmsTRANSFORM* info, + cmsFloat32Number wIn[], + cmsUInt8Number* accum, + cmsUInt32Number Stride) +{ + + int nChan = T_CHANNELS(info -> InputFormat); + int DoSwap = T_DOSWAP(info ->InputFormat); + int Reverse = T_FLAVOR(info ->InputFormat); + int SwapFirst = T_SWAPFIRST(info -> InputFormat); + int Extra = T_EXTRA(info -> InputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + int Planar = T_PLANAR(info -> InputFormat); + cmsFloat32Number v; + int i, start = 0; + cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F; + + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + if (Planar) + v = _cmsHalf2Float ( ((cmsUInt16Number*) accum)[(i + start) * Stride] ); + else + v = _cmsHalf2Float ( ((cmsUInt16Number*) accum)[i + start] ) ; + + v /= maximum; + + wIn[index] = Reverse ? 1 - v : v; + } + + + if (Extra == 0 && SwapFirst) { + cmsFloat32Number tmp = wIn[0]; + + memmove(&wIn[0], &wIn[1], (nChan-1) * sizeof(cmsFloat32Number)); + wIn[nChan-1] = tmp; + } + + if (T_PLANAR(info -> InputFormat)) + return accum + sizeof(cmsUInt16Number); + else + return accum + (nChan + Extra) * sizeof(cmsUInt16Number); +} + + +static +cmsUInt8Number* PackHalfFrom16(register _cmsTRANSFORM* info, + register cmsUInt16Number wOut[], + register cmsUInt8Number* output, + register cmsUInt32Number Stride) +{ + int nChan = T_CHANNELS(info -> OutputFormat); + int DoSwap = T_DOSWAP(info ->OutputFormat); + int Reverse = T_FLAVOR(info ->OutputFormat); + int Extra = T_EXTRA(info -> OutputFormat); + int SwapFirst = T_SWAPFIRST(info -> OutputFormat); + int Planar = T_PLANAR(info -> OutputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + cmsFloat32Number maximum = IsInkSpace(info ->OutputFormat) ? 655.35F : 65535.0F; + cmsFloat32Number v = 0; + cmsUInt16Number* swap1 = (cmsUInt16Number*) output; + int i, start = 0; + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + v = (cmsFloat32Number) wOut[index] / maximum; + + if (Reverse) + v = maximum - v; + + if (Planar) + ((cmsUInt16Number*) output)[(i + start ) * Stride]= _cmsFloat2Half(v); + else + ((cmsUInt16Number*) output)[i + start] = _cmsFloat2Half(v); + } + + if (!ExtraFirst) { + output += Extra * sizeof(cmsUInt16Number); + } + + if (Extra == 0 && SwapFirst) { + + memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsUInt16Number)); + *swap1 = _cmsFloat2Half(v); + } + + if (T_PLANAR(info -> OutputFormat)) + return output + sizeof(cmsUInt16Number); + else + return output + nChan * sizeof(cmsUInt16Number); +} + + + +static +cmsUInt8Number* PackHalfFromFloat(_cmsTRANSFORM* info, + cmsFloat32Number wOut[], + cmsUInt8Number* output, + cmsUInt32Number Stride) +{ + int nChan = T_CHANNELS(info -> OutputFormat); + int DoSwap = T_DOSWAP(info ->OutputFormat); + int Reverse = T_FLAVOR(info ->OutputFormat); + int Extra = T_EXTRA(info -> OutputFormat); + int SwapFirst = T_SWAPFIRST(info -> OutputFormat); + int Planar = T_PLANAR(info -> OutputFormat); + int ExtraFirst = DoSwap ^ SwapFirst; + cmsFloat32Number maximum = IsInkSpace(info ->OutputFormat) ? 100.0F : 1.0F; + cmsUInt16Number* swap1 = (cmsUInt16Number*) output; + cmsFloat32Number v = 0; + int i, start = 0; + + if (ExtraFirst) + start = Extra; + + for (i=0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + v = wOut[index] * maximum; + + if (Reverse) + v = maximum - v; + + if (Planar) + ((cmsUInt16Number*) output)[(i + start)* Stride]= _cmsFloat2Half( v ); + else + ((cmsUInt16Number*) output)[i + start] = _cmsFloat2Half( v ); + } + + if (!ExtraFirst) { + output += Extra * sizeof(cmsUInt16Number); + } + + if (Extra == 0 && SwapFirst) { + + memmove(swap1 + 1, swap1, (nChan-1)* sizeof(cmsUInt16Number)); + *swap1 = (cmsUInt16Number) _cmsFloat2Half( v ); + } + + if (T_PLANAR(info -> OutputFormat)) + return output + sizeof(cmsUInt16Number); + else + return output + nChan * sizeof(cmsUInt16Number); +} + +#endif + +// ---------------------------------------------------------------------------------------------------------------- + static cmsFormatters16 InputFormatters16[] = { // Type Mask Function // ---------------------------- ------------------------------------ ---------------------------- - { TYPE_Lab_DBL, ANYPLANAR, UnrollLabDoubleTo16}, - { TYPE_XYZ_DBL, ANYPLANAR, UnrollXYZDoubleTo16}, + { TYPE_Lab_DBL, ANYPLANAR|ANYEXTRA, UnrollLabDoubleTo16}, + { TYPE_XYZ_DBL, ANYPLANAR|ANYEXTRA, UnrollXYZDoubleTo16}, + { TYPE_Lab_FLT, ANYPLANAR|ANYEXTRA, UnrollLabFloatTo16}, { TYPE_GRAY_DBL, 0, UnrollDouble1Chan}, - { FLOAT_SH(1)|BYTES_SH(0), ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, UnrollDoubleTo16}, - { FLOAT_SH(1)|BYTES_SH(4), ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, UnrollFloatTo16}, - + { FLOAT_SH(1)|BYTES_SH(0), ANYCHANNELS|ANYPLANAR|ANYSWAPFIRST|ANYFLAVOR| + ANYSWAP|ANYEXTRA|ANYSPACE, UnrollDoubleTo16}, + { FLOAT_SH(1)|BYTES_SH(4), ANYCHANNELS|ANYPLANAR|ANYSWAPFIRST|ANYFLAVOR| + ANYSWAP|ANYEXTRA|ANYSPACE, UnrollFloatTo16}, +#ifndef CMS_NO_HALF_SUPPORT + { FLOAT_SH(1)|BYTES_SH(2), ANYCHANNELS|ANYPLANAR|ANYSWAPFIRST|ANYFLAVOR| + ANYEXTRA|ANYSWAP|ANYSPACE, UnrollHalfTo16}, +#endif { CHANNELS_SH(1)|BYTES_SH(1), ANYSPACE, Unroll1Byte}, + { CHANNELS_SH(1)|BYTES_SH(1)|EXTRA_SH(1), ANYSPACE, Unroll1ByteSkip1}, { CHANNELS_SH(1)|BYTES_SH(1)|EXTRA_SH(2), ANYSPACE, Unroll1ByteSkip2}, { CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1), ANYSPACE, Unroll1ByteReversed}, - - { CHANNELS_SH(2)|BYTES_SH(1), ANYSPACE, Unroll2Bytes}, - { CHANNELS_SH(2)|BYTES_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Unroll2ByteSwapFirst}, + { COLORSPACE_SH(PT_MCH2)|CHANNELS_SH(2)|BYTES_SH(1), 0, Unroll2Bytes}, { TYPE_LabV2_8, 0, UnrollLabV2_8 }, { TYPE_ALabV2_8, 0, UnrollALabV2_8 }, @@ -2295,17 +2907,17 @@ { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1), ANYSPACE, Unroll4BytesSwap}, { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Unroll4BytesSwapSwapFirst}, - { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollPlanarBytes}, - { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollChunkyBytes}, - + { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAPFIRST| + ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollPlanarBytes}, + + { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP| + ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollChunkyBytes}, { CHANNELS_SH(1)|BYTES_SH(2), ANYSPACE, Unroll1Word}, { CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1), ANYSPACE, Unroll1WordReversed}, { CHANNELS_SH(1)|BYTES_SH(2)|EXTRA_SH(3), ANYSPACE, Unroll1WordSkip3}, { CHANNELS_SH(2)|BYTES_SH(2), ANYSPACE, Unroll2Words}, - { CHANNELS_SH(2)|BYTES_SH(2)|SWAPFIRST_SH(1), ANYSPACE, Unroll2WordSwapFirst}, - { CHANNELS_SH(3)|BYTES_SH(2), ANYSPACE, Unroll3Words}, { CHANNELS_SH(4)|BYTES_SH(2), ANYSPACE, Unroll4Words}, @@ -2318,7 +2930,7 @@ { CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Unroll4WordsSwapSwapFirst}, - { BYTES_SH(2)|PLANAR_SH(1), ANYFLAVOR|ANYSWAP|ANYENDIAN|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollPlanarWords }, + { BYTES_SH(2)|PLANAR_SH(1), ANYFLAVOR|ANYSWAP|ANYENDIAN|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollPlanarWords}, { BYTES_SH(2), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYENDIAN|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollAnyWords}, }; @@ -2328,13 +2940,21 @@ // Type Mask Function // ---------------------------- ------------------------------------ ---------------------------- - { TYPE_Lab_DBL, ANYPLANAR, UnrollLabDoubleToFloat}, - { TYPE_Lab_FLT, ANYPLANAR, UnrollLabFloatToFloat}, - { TYPE_XYZ_DBL, ANYPLANAR, UnrollXYZDoubleToFloat}, - { TYPE_XYZ_FLT, ANYPLANAR, UnrollXYZFloatToFloat}, - - { FLOAT_SH(1)|BYTES_SH(4), ANYPLANAR|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollFloatsToFloat}, - { FLOAT_SH(1)|BYTES_SH(0), ANYPLANAR|ANYEXTRA|ANYCHANNELS|ANYSPACE, UnrollDoublesToFloat}, + { TYPE_Lab_DBL, ANYPLANAR|ANYEXTRA, UnrollLabDoubleToFloat}, + { TYPE_Lab_FLT, ANYPLANAR|ANYEXTRA, UnrollLabFloatToFloat}, + + { TYPE_XYZ_DBL, ANYPLANAR|ANYEXTRA, UnrollXYZDoubleToFloat}, + { TYPE_XYZ_FLT, ANYPLANAR|ANYEXTRA, UnrollXYZFloatToFloat}, + + { FLOAT_SH(1)|BYTES_SH(4), ANYPLANAR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| + ANYCHANNELS|ANYSPACE, UnrollFloatsToFloat}, + + { FLOAT_SH(1)|BYTES_SH(0), ANYPLANAR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| + ANYCHANNELS|ANYSPACE, UnrollDoublesToFloat}, +#ifndef CMS_NO_HALF_SUPPORT + { FLOAT_SH(1)|BYTES_SH(2), ANYPLANAR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA| + ANYCHANNELS|ANYSPACE, UnrollHalfToFloat}, +#endif }; @@ -2345,9 +2965,9 @@ cmsUInt32Number i; cmsFormatter fr; - - if (!(dwFlags & CMS_PACK_FLAGS_FLOAT)) { - + switch (dwFlags) { + + case CMS_PACK_FLAGS_16BITS: { for (i=0; i < sizeof(InputFormatters16) / sizeof(cmsFormatters16); i++) { cmsFormatters16* f = InputFormatters16 + i; @@ -2357,7 +2977,9 @@ } } } - else { + break; + + case CMS_PACK_FLAGS_FLOAT: { for (i=0; i < sizeof(InputFormattersFloat) / sizeof(cmsFormattersFloat); i++) { cmsFormattersFloat* f = InputFormattersFloat + i; @@ -2367,6 +2989,11 @@ } } } + break; + + default:; + + } fr.Fmt16 = NULL; return fr; @@ -2376,10 +3003,19 @@ // Type Mask Function // ---------------------------- ------------------------------------ ---------------------------- - { TYPE_Lab_DBL, ANYPLANAR, PackLabDoubleFrom16}, - { TYPE_XYZ_DBL, ANYPLANAR, PackXYZDoubleFrom16}, - { FLOAT_SH(1)|BYTES_SH(0), ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, PackDoubleFrom16}, - { FLOAT_SH(1)|BYTES_SH(4), ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, PackFloatFrom16}, + { TYPE_Lab_DBL, ANYPLANAR|ANYEXTRA, PackLabDoubleFrom16}, + { TYPE_XYZ_DBL, ANYPLANAR|ANYEXTRA, PackXYZDoubleFrom16}, + + { TYPE_Lab_FLT, ANYPLANAR|ANYEXTRA, PackLabFloatFrom16}, + + { FLOAT_SH(1)|BYTES_SH(0), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP| + ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, PackDoubleFrom16}, + { FLOAT_SH(1)|BYTES_SH(4), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP| + ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, PackFloatFrom16}, +#ifndef CMS_NO_HALF_SUPPORT + { FLOAT_SH(1)|BYTES_SH(2), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP| + ANYCHANNELS|ANYPLANAR|ANYEXTRA|ANYSPACE, PackHalfFrom16}, +#endif { CHANNELS_SH(1)|BYTES_SH(1), ANYSPACE, Pack1Byte}, { CHANNELS_SH(1)|BYTES_SH(1)|EXTRA_SH(1), ANYSPACE, Pack1ByteSkip1}, @@ -2419,7 +3055,7 @@ { CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Pack4BytesSwapSwapFirst}, { BYTES_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackAnyBytes}, - { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackPlanarBytes}, + { BYTES_SH(1)|PLANAR_SH(1), ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackPlanarBytes}, { CHANNELS_SH(1)|BYTES_SH(2), ANYSPACE, Pack1Word}, { CHANNELS_SH(1)|BYTES_SH(2)|EXTRA_SH(1), ANYSPACE, Pack1WordSkip1}, @@ -2453,29 +3089,51 @@ static cmsFormattersFloat OutputFormattersFloat[] = { // Type Mask Function // ---------------------------- --------------------------------------------------- ---------------------------- - { TYPE_Lab_FLT, ANYPLANAR, PackLabFloatFromFloat}, - { TYPE_XYZ_FLT, ANYPLANAR, PackXYZFloatFromFloat}, - { TYPE_Lab_DBL, ANYPLANAR, PackLabDoubleFromFloat}, - { TYPE_XYZ_DBL, ANYPLANAR, PackXYZDoubleFromFloat}, - { FLOAT_SH(1)|BYTES_SH(4), - ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackChunkyFloatsFromFloat }, - { FLOAT_SH(1)|BYTES_SH(4)|PLANAR_SH(1), ANYEXTRA|ANYCHANNELS|ANYSPACE, PackPlanarFloatsFromFloat}, - { FLOAT_SH(1)|BYTES_SH(0), - ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackChunkyDoublesFromFloat }, - { FLOAT_SH(1)|BYTES_SH(0)|PLANAR_SH(1), ANYEXTRA|ANYCHANNELS|ANYSPACE, PackPlanarDoublesFromFloat}, + { TYPE_Lab_FLT, ANYPLANAR|ANYEXTRA, PackLabFloatFromFloat}, + { TYPE_XYZ_FLT, ANYPLANAR|ANYEXTRA, PackXYZFloatFromFloat}, + + { TYPE_Lab_DBL, ANYPLANAR|ANYEXTRA, PackLabDoubleFromFloat}, + { TYPE_XYZ_DBL, ANYPLANAR|ANYEXTRA, PackXYZDoubleFromFloat}, + + { FLOAT_SH(1)|BYTES_SH(4), ANYPLANAR| + ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackFloatsFromFloat }, + { FLOAT_SH(1)|BYTES_SH(0), ANYPLANAR| + ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackDoublesFromFloat }, +#ifndef CMS_NO_HALF_SUPPORT + { FLOAT_SH(1)|BYTES_SH(2), + ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackHalfFromFloat }, +#endif + }; // Bit fields set to one in the mask are not compared +static cmsFormatter _cmsGetStockOutputFormatter(cmsUInt32Number dwInput, cmsUInt32Number dwFlags) { cmsUInt32Number i; cmsFormatter fr; - if (dwFlags & CMS_PACK_FLAGS_FLOAT) { + switch (dwFlags) + { + + case CMS_PACK_FLAGS_16BITS: { + + for (i=0; i < sizeof(OutputFormatters16) / sizeof(cmsFormatters16); i++) { + cmsFormatters16* f = OutputFormatters16 + i; + + if ((dwInput & ~f ->Mask) == f ->Type) { + fr.Fmt16 = f ->Frm; + return fr; + } + } + } + break; + + case CMS_PACK_FLAGS_FLOAT: { for (i=0; i < sizeof(OutputFormattersFloat) / sizeof(cmsFormattersFloat); i++) { cmsFormattersFloat* f = OutputFormattersFloat + i; @@ -2485,18 +3143,11 @@ return fr; } } - - } - else { - - for (i=0; i < sizeof(OutputFormatters16) / sizeof(cmsFormatters16); i++) { - cmsFormatters16* f = OutputFormatters16 + i; - - if ((dwInput & ~f ->Mask) == f ->Type) { - fr.Fmt16 = f ->Frm; - return fr; - } } + break; + + default:; + } fr.Fmt16 = NULL; @@ -2523,8 +3174,8 @@ // Reset if (Data == NULL) { - FactoryList = NULL; - return TRUE; + FactoryList = NULL; + return TRUE; } fl = (cmsFormattersFactoryList*) _cmsPluginMalloc(sizeof(cmsFormattersFactoryList)); @@ -2540,7 +3191,7 @@ cmsFormatter _cmsGetFormatter(cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8 cmsFormatterDirection Dir, - cmsUInt32Number dwFlags) // Float or 16 bits + cmsUInt32Number dwFlags) { cmsFormattersFactoryList* f; @@ -2597,3 +3248,4 @@ // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); } +
--- a/src/share/native/sun/java2d/cmm/lcms/cmspcs.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmspcs.c Fri Jun 21 15:46:14 2013 -0500 @@ -898,6 +898,7 @@ { switch (ColorSpace) { + case cmsSig1colorData: case cmsSigGrayData: return 1; case cmsSig2colorData: return 2;
--- a/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c Fri Jun 21 15:46:14 2013 -0500 @@ -105,12 +105,12 @@ // 1 2 3 4 5 6 7 8 // 8 7 6 5 4 3 2 1 -void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number QWord) +void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord) { #ifndef CMS_USE_BIG_ENDIAN - cmsUInt8Number* pIn = (cmsUInt8Number*) &QWord; + cmsUInt8Number* pIn = (cmsUInt8Number*) QWord; cmsUInt8Number* pOut = (cmsUInt8Number*) Result; _cmsAssert(Result != NULL); @@ -128,7 +128,7 @@ _cmsAssert(Result != NULL); - *Result = QWord; + *Result = *QWord; #endif } @@ -218,7 +218,7 @@ if (io -> Read(io, &tmp, sizeof(cmsUInt64Number), 1) != 1) return FALSE; - if (n != NULL) _cmsAdjustEndianess64(n, tmp); + if (n != NULL) _cmsAdjustEndianess64(n, &tmp); return TRUE; } @@ -340,7 +340,7 @@ return TRUE; } -cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number n) +cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n) { cmsUInt64Number tmp; @@ -568,7 +568,7 @@ if (Plugin ->ExpectedVersion > LCMS_VERSION) { cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "plugin needs Little CMS %d, current version is %d", - Plugin ->ExpectedVersion, LCMS_VERSION); + Plugin ->ExpectedVersion, LCMS_VERSION); return FALSE; } @@ -610,6 +610,10 @@ if (!_cmsRegisterOptimizationPlugin(Plugin)) return FALSE; break; + case cmsPluginTransformSig: + if (!_cmsRegisterTransformPlugin(Plugin)) return FALSE; + break; + default: cmsSignalError(0, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized plugin type '%X'", Plugin -> Type); return FALSE; @@ -633,6 +637,7 @@ _cmsRegisterParametricCurvesPlugin(NULL); _cmsRegisterMultiProcessElementPlugin(NULL); _cmsRegisterOptimizationPlugin(NULL); + _cmsRegisterTransformPlugin(NULL); if (PluginPool != NULL) _cmsSubAllocDestroy(PluginPool);
--- a/src/share/native/sun/java2d/cmm/lcms/cmsps2.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsps2.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2008 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -329,9 +329,9 @@ static cmsUInt8Number L2Byte(cmsUInt16Number w) { - int ww = w + 0x0080; + int ww = w + 0x0080; - if (ww > 0xFFFF) return 0xFF; + if (ww > 0xFFFF) return 0xFF; return (cmsUInt8Number) ((cmsUInt16Number) (ww >> 8) & 0xFF); } @@ -498,6 +498,7 @@ cmsUInt32Number i; cmsFloat64Number gamma; + if (Table == NULL) return; // Error if (Table ->nEntries <= 0) return; // Empty table @@ -577,6 +578,8 @@ for( i=0; i < n; i++ ) { + if (g[i] == NULL) return; // Error + if (i > 0 && GammaTableEquals(g[i-1]->Table16, g[i]->Table16, g[i]->nEntries)) { _cmsIOPrintf(m, "dup "); @@ -674,6 +677,7 @@ cmsUInt16Number wWordOut = Out[i]; cmsUInt8Number wByteOut; // Value as byte + // We always deal with Lab4 wByteOut = Word2Byte(wWordOut); @@ -771,9 +775,9 @@ for( i=0; i < 3; i++ ) { - _cmsIOPrintf(m, "%.6f %.6f %.6f ", Matrix[0 + 3*i], - Matrix[1 + 3*i], - Matrix[2 + 3*i]); + _cmsIOPrintf(m, "%.6f %.6f %.6f ", Matrix[i + 3*0], + Matrix[i + 3*1], + Matrix[i + 3*2]); } @@ -857,21 +861,23 @@ // Generates a curve from a gray profile static -cmsToneCurve* ExtractGray2Y(cmsContext ContextID, cmsHPROFILE hProfile, int Intent) + cmsToneCurve* ExtractGray2Y(cmsContext ContextID, cmsHPROFILE hProfile, int Intent) { cmsToneCurve* Out = cmsBuildTabulatedToneCurve16(ContextID, 256, NULL); cmsHPROFILE hXYZ = cmsCreateXYZProfile(); cmsHTRANSFORM xform = cmsCreateTransformTHR(ContextID, hProfile, TYPE_GRAY_8, hXYZ, TYPE_XYZ_DBL, Intent, cmsFLAGS_NOOPTIMIZE); int i; - for (i=0; i < 256; i++) { + if (Out != NULL) { + for (i=0; i < 256; i++) { - cmsUInt8Number Gray = (cmsUInt8Number) i; - cmsCIEXYZ XYZ; + cmsUInt8Number Gray = (cmsUInt8Number) i; + cmsCIEXYZ XYZ; - cmsDoTransform(xform, &Gray, &XYZ, 1); + cmsDoTransform(xform, &Gray, &XYZ, 1); - Out ->Table16[i] =_cmsQuickSaturateWord(XYZ.Y * 65535.0); + Out ->Table16[i] =_cmsQuickSaturateWord(XYZ.Y * 65535.0); + } } cmsDeleteTransform(xform); @@ -924,7 +930,7 @@ switch (nChannels) { case 1: { - cmsToneCurve* Gray2Y = ExtractGray2Y(m ->ContextID, hProfile, Intent); + cmsToneCurve* Gray2Y = ExtractGray2Y(m ->ContextID, hProfile, Intent); EmitCIEBasedA(m, Gray2Y, &BlackPointAdaptedToD50); cmsFreeToneCurve(Gray2Y); } @@ -932,7 +938,7 @@ case 3: case 4: { - cmsUInt32Number OutFrm = TYPE_Lab_16; + cmsUInt32Number OutFrm = TYPE_Lab_16; cmsPipeline* DeviceLink; _cmsTRANSFORM* v = (_cmsTRANSFORM*) xform; @@ -984,14 +990,23 @@ if (ColorSpace == cmsSigGrayData) { cmsToneCurve** ShaperCurve = _cmsStageGetPtrToCurveSet(Shaper); - rc = EmitCIEBasedA(m, ShaperCurve[0], &BlackPointAdaptedToD50); + rc = EmitCIEBasedA(m, ShaperCurve[0], &BlackPointAdaptedToD50); } else if (ColorSpace == cmsSigRgbData) { - rc = EmitCIEBasedABC(m, GetPtrToMatrix(Matrix), - _cmsStageGetPtrToCurveSet(Shaper), + cmsMAT3 Mat; + int i, j; + + memmove(&Mat, GetPtrToMatrix(Matrix), sizeof(Mat)); + + for (i=0; i < 3; i++) + for (j=0; j < 3; j++) + Mat.v[i].n[j] *= MAX_ENCODEABLE_XYZ; + + rc = EmitCIEBasedABC(m, (cmsFloat64Number *) &Mat, + _cmsStageGetPtrToCurveSet(Shaper), &BlackPointAdaptedToD50); } else { @@ -1000,7 +1015,7 @@ return 0; } - return rc; + return rc; } @@ -1084,8 +1099,8 @@ if (ColorSpace != cmsSigXYZData && ColorSpace != cmsSigLabData) { - cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Invalid output color space"); - goto Error; + cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Invalid output color space"); + goto Error; } @@ -1101,8 +1116,8 @@ } else { - // We need a LUT for the rest - if (!WriteInputLUT(mem, hProfile, Intent, dwFlags)) goto Error; + // We need a LUT for the rest + if (!WriteInputLUT(mem, hProfile, Intent, dwFlags)) goto Error; } } @@ -1211,7 +1226,7 @@ "{0.9642 mul %g div exch pop exch pop exch pop exch pop} bind\n" "{1.0000 mul %g div exch pop exch pop exch pop exch pop} bind\n" "{0.8249 mul %g div exch pop exch pop exch pop exch pop} bind\n]\n", - White.X, White.Y, White.Z); + White.X, White.Y, White.Z); return; } @@ -1534,24 +1549,25 @@ cmsUInt32Number CMSEXPORT cmsGetPostScriptColorResource(cmsContext ContextID, - cmsPSResourceType Type, - cmsHPROFILE hProfile, - cmsUInt32Number Intent, - cmsUInt32Number dwFlags, - cmsIOHANDLER* io) + cmsPSResourceType Type, + cmsHPROFILE hProfile, + cmsUInt32Number Intent, + cmsUInt32Number dwFlags, + cmsIOHANDLER* io) { cmsUInt32Number rc; switch (Type) { - case cmsPS_RESOURCE_CSA: - rc = GenerateCSA(ContextID, hProfile, Intent, dwFlags, io); - break; - default: - case cmsPS_RESOURCE_CRD: - rc = GenerateCRD(ContextID, hProfile, Intent, dwFlags, io); - break; + case cmsPS_RESOURCE_CSA: + rc = GenerateCSA(ContextID, hProfile, Intent, dwFlags, io); + break; + + default: + case cmsPS_RESOURCE_CRD: + rc = GenerateCRD(ContextID, hProfile, Intent, dwFlags, io); + break; } return rc; @@ -1560,7 +1576,7 @@ cmsUInt32Number CMSEXPORT cmsGetPostScriptCRD(cmsContext ContextID, - cmsHPROFILE hProfile, + cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen) {
--- a/src/share/native/sun/java2d/cmm/lcms/cmssamp.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmssamp.c Fri Jun 21 15:46:14 2013 -0500 @@ -216,7 +216,6 @@ // just that. There is a special flag for using black point tag, but turned // off by default because it is bogus on most profiles. The detection algorithm // involves to turn BP to neutral and to use only L component. - cmsBool CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags) { @@ -292,3 +291,307 @@ return BlackPointAsDarkerColorant(hProfile, Intent, BlackPoint, dwFlags); } + + +// --------------------------------------------------------------------------------------------------------- + +// Least Squares Fit of a Quadratic Curve to Data +// http://www.personal.psu.edu/jhm/f90/lectures/lsq2.html + +static +cmsFloat64Number RootOfLeastSquaresFitQuadraticCurve(int n, cmsFloat64Number x[], cmsFloat64Number y[]) +{ + double sum_x = 0, sum_x2 = 0, sum_x3 = 0, sum_x4 = 0; + double sum_y = 0, sum_yx = 0, sum_yx2 = 0; + double disc; + int i; + cmsMAT3 m; + cmsVEC3 v, res; + + if (n < 4) return 0; + + for (i=0; i < n; i++) { + + double xn = x[i]; + double yn = y[i]; + + sum_x += xn; + sum_x2 += xn*xn; + sum_x3 += xn*xn*xn; + sum_x4 += xn*xn*xn*xn; + + sum_y += yn; + sum_yx += yn*xn; + sum_yx2 += yn*xn*xn; + } + + _cmsVEC3init(&m.v[0], n, sum_x, sum_x2); + _cmsVEC3init(&m.v[1], sum_x, sum_x2, sum_x3); + _cmsVEC3init(&m.v[2], sum_x2, sum_x3, sum_x4); + + _cmsVEC3init(&v, sum_y, sum_yx, sum_yx2); + + if (!_cmsMAT3solve(&res, &m, &v)) return 0; + + // y = t x2 + u x + c + // x = ( - u + Sqrt( u^2 - 4 t c ) ) / ( 2 t ) + disc = res.n[1]*res.n[1] - 4.0 * res.n[0] * res.n[2]; + if (disc < 0) return -1; + + return ( -1.0 * res.n[1] + sqrt( disc )) / (2.0 * res.n[0]); +} + +static +cmsBool IsMonotonic(int n, const cmsFloat64Number Table[]) +{ + int i; + cmsFloat64Number last; + + last = Table[n-1]; + + for (i = n-2; i >= 0; --i) { + + if (Table[i] > last) + + return FALSE; + else + last = Table[i]; + + } + + return TRUE; +} + +// Calculates the black point of a destination profile. +// This algorithm comes from the Adobe paper disclosing its black point compensation method. +cmsBool CMSEXPORT cmsDetectDestinationBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags) +{ + cmsColorSpaceSignature ColorSpace; + cmsHTRANSFORM hRoundTrip = NULL; + cmsCIELab InitialLab, destLab, Lab; + + cmsFloat64Number MinL, MaxL; + cmsBool NearlyStraightMidRange = FALSE; + cmsFloat64Number L; + cmsFloat64Number x[101], y[101]; + cmsFloat64Number lo, hi, NonMonoMin; + int n, l, i, NonMonoIndx; + + + // Make sure intent is adequate + if (Intent != INTENT_PERCEPTUAL && + Intent != INTENT_RELATIVE_COLORIMETRIC && + Intent != INTENT_SATURATION) { + BlackPoint -> X = BlackPoint ->Y = BlackPoint -> Z = 0.0; + return FALSE; + } + + + // v4 + perceptual & saturation intents does have its own black point, and it is + // well specified enough to use it. Black point tag is deprecated in V4. + if ((cmsGetEncodedICCversion(hProfile) >= 0x4000000) && + (Intent == INTENT_PERCEPTUAL || Intent == INTENT_SATURATION)) { + + // Matrix shaper share MRC & perceptual intents + if (cmsIsMatrixShaper(hProfile)) + return BlackPointAsDarkerColorant(hProfile, INTENT_RELATIVE_COLORIMETRIC, BlackPoint, 0); + + // Get Perceptual black out of v4 profiles. That is fixed for perceptual & saturation intents + BlackPoint -> X = cmsPERCEPTUAL_BLACK_X; + BlackPoint -> Y = cmsPERCEPTUAL_BLACK_Y; + BlackPoint -> Z = cmsPERCEPTUAL_BLACK_Z; + return TRUE; + } + + + // Check if the profile is lut based and gray, rgb or cmyk (7.2 in Adobe's document) + ColorSpace = cmsGetColorSpace(hProfile); + if (!cmsIsCLUT(hProfile, Intent, LCMS_USED_AS_OUTPUT ) || + (ColorSpace != cmsSigGrayData && + ColorSpace != cmsSigRgbData && + ColorSpace != cmsSigCmykData)) { + + // In this case, handle as input case + return cmsDetectBlackPoint(BlackPoint, hProfile, Intent, dwFlags); + } + + // It is one of the valid cases!, presto chargo hocus pocus, go for the Adobe magic + + // Step 1 + // ====== + + // Set a first guess, that should work on good profiles. + if (Intent == INTENT_RELATIVE_COLORIMETRIC) { + + cmsCIEXYZ IniXYZ; + + // calculate initial Lab as source black point + if (!cmsDetectBlackPoint(&IniXYZ, hProfile, Intent, dwFlags)) { + return FALSE; + } + + // convert the XYZ to lab + cmsXYZ2Lab(NULL, &InitialLab, &IniXYZ); + + } else { + + // set the initial Lab to zero, that should be the black point for perceptual and saturation + InitialLab.L = 0; + InitialLab.a = 0; + InitialLab.b = 0; + } + + + // Step 2 + // ====== + + // Create a roundtrip. Define a Transform BT for all x in L*a*b* + hRoundTrip = CreateRoundtripXForm(hProfile, Intent); + if (hRoundTrip == NULL) return FALSE; + + // Calculate Min L* + Lab = InitialLab; + Lab.L = 0; + cmsDoTransform(hRoundTrip, &Lab, &destLab, 1); + MinL = destLab.L; + + // Calculate Max L* + Lab = InitialLab; + Lab.L = 100; + cmsDoTransform(hRoundTrip, &Lab, &destLab, 1); + MaxL = destLab.L; + + // Step 3 + // ====== + + // check if quadratic estimation needs to be done. + if (Intent == INTENT_RELATIVE_COLORIMETRIC) { + + // Conceptually, this code tests how close the source l and converted L are to one another in the mid-range + // of the values. If the converted ramp of L values is close enough to a straight line y=x, then InitialLab + // is good enough to be the DestinationBlackPoint, + NearlyStraightMidRange = TRUE; + + for (l=0; l <= 100; l++) { + + Lab.L = l; + Lab.a = InitialLab.a; + Lab.b = InitialLab.b; + + cmsDoTransform(hRoundTrip, &Lab, &destLab, 1); + + L = destLab.L; + + // Check the mid range in 20% after MinL + if (L > (MinL + 0.2 * (MaxL - MinL))) { + + // Is close enough? + if (fabs(L - l) > 4.0) { + + // Too far away, profile is buggy! + NearlyStraightMidRange = FALSE; + break; + } + } + } + } + else { + // Check is always performed for perceptual and saturation intents + NearlyStraightMidRange = FALSE; + } + + + // If no furter checking is needed, we are done + if (NearlyStraightMidRange) { + + cmsLab2XYZ(NULL, BlackPoint, &InitialLab); + cmsDeleteTransform(hRoundTrip); + return TRUE; + } + + // The round-trip curve normally looks like a nearly constant section at the black point, + // with a corner and a nearly straight line to the white point. + + // STEP 4 + // ======= + + // find the black point using the least squares error quadratic curve fitting + + if (Intent == INTENT_RELATIVE_COLORIMETRIC) { + lo = 0.1; + hi = 0.5; + } + else { + + // Perceptual and saturation + lo = 0.03; + hi = 0.25; + } + + // Capture points for the fitting. + n = 0; + for (l=0; l <= 100; l++) { + + cmsFloat64Number ff; + + Lab.L = (cmsFloat64Number) l; + Lab.a = InitialLab.a; + Lab.b = InitialLab.b; + + cmsDoTransform(hRoundTrip, &Lab, &destLab, 1); + + ff = (destLab.L - MinL)/(MaxL - MinL); + + if (ff >= lo && ff < hi) { + + x[n] = Lab.L; + y[n] = ff; + n++; + } + + } + + // This part is not on the Adobe paper, but I found is necessary for getting any result. + + if (IsMonotonic(n, y)) { + + // Monotonic means lower point is stil valid + cmsLab2XYZ(NULL, BlackPoint, &InitialLab); + cmsDeleteTransform(hRoundTrip); + return TRUE; + } + + // No suitable points, regret and use safer algorithm + if (n == 0) { + cmsDeleteTransform(hRoundTrip); + return cmsDetectBlackPoint(BlackPoint, hProfile, Intent, dwFlags); + } + + + NonMonoMin = 100; + NonMonoIndx = 0; + for (i=0; i < n; i++) { + + if (y[i] < NonMonoMin) { + NonMonoIndx = i; + NonMonoMin = y[i]; + } + } + + Lab.L = x[NonMonoIndx]; + + // fit and get the vertex of quadratic curve + Lab.L = RootOfLeastSquaresFitQuadraticCurve(n, x, y); + + if (Lab.L < 0.0 || Lab.L > 50.0) { // clip to zero L* if the vertex is negative + Lab.L = 0; + } + + Lab.a = InitialLab.a; + Lab.b = InitialLab.b; + + cmsLab2XYZ(NULL, BlackPoint, &Lab); + + cmsDeleteTransform(hRoundTrip); + return TRUE; +}
--- a/src/share/native/sun/java2d/cmm/lcms/cmssm.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmssm.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -468,7 +468,8 @@ int FindNearSectors(cmsGDB* gbd, int alpha, int theta, cmsGDBPoint* Close[]) { int nSectors = 0; - int i, a, t; + int a, t; + cmsUInt32Number i; cmsGDBPoint* pt; for (i=0; i < NSTEPS; i++) { @@ -505,7 +506,7 @@ cmsVEC3 Centre; cmsLine ray; int nCloseSectors; - cmsGDBPoint* Close[NSTEPS]; + cmsGDBPoint* Close[NSTEPS + 1]; cmsSpherical closel, templ; cmsLine edge; int k, m; @@ -582,13 +583,13 @@ _cmsAssert(hGBD != NULL); // Interpolate black - for (alpha = 0; alpha <= SECTORS; alpha++) { + for (alpha = 0; alpha < SECTORS; alpha++) { if (!InterpolateMissingSector(gbd, alpha, 0)) return FALSE; } // Interpolate white - for (alpha = 0; alpha <= SECTORS; alpha++) { + for (alpha = 0; alpha < SECTORS; alpha++) { if (!InterpolateMissingSector(gbd, alpha, SECTORS-1)) return FALSE; } @@ -596,7 +597,7 @@ // Interpolate Mid for (theta = 1; theta < SECTORS; theta++) { - for (alpha = 0; alpha <= SECTORS; alpha++) { + for (alpha = 0; alpha < SECTORS; alpha++) { if (!InterpolateMissingSector(gbd, alpha, theta)) return FALSE; } @@ -760,3 +761,4 @@ return TRUE; } #endif +
--- a/src/share/native/sun/java2d/cmm/lcms/cmstypes.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmstypes.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -84,10 +84,10 @@ #define DUP_FN(x) Type_##x##_Dup // Helper macro to define a handler. Callbacks do have a fixed naming convention. -#define TYPE_HANDLER(t, x) { (t), READ_FN(x), WRITE_FN(x), DUP_FN(x), FREE_FN(x) } +#define TYPE_HANDLER(t, x) { (t), READ_FN(x), WRITE_FN(x), DUP_FN(x), FREE_FN(x), NULL, 0 } // Helper macro to define a MPE handler. Callbacks do have a fixed naming convention -#define TYPE_MPE_HANDLER(t, x) { (t), READ_FN(x), WRITE_FN(x), GenericMPEdup, GenericMPEfree } +#define TYPE_MPE_HANDLER(t, x) { (t), READ_FN(x), WRITE_FN(x), GenericMPEdup, GenericMPEfree, NULL, 0 } // Register a new type handler. This routine is shared between normal types and MPE static @@ -154,7 +154,7 @@ cmsUInt32Number i; _cmsAssert(io != NULL); - _cmsAssert(Array != NULL); + _cmsAssert(!(Array == NULL && n > 0)); for (i=0; i < n; i++) { if (!_cmsWriteUInt16Number(io, (cmsUInt16Number) Array[i])) return FALSE; @@ -163,6 +163,28 @@ return TRUE; } +static +cmsBool _cmsReadWCharArray(cmsIOHANDLER* io, cmsUInt32Number n, wchar_t* Array) +{ + cmsUInt32Number i; + cmsUInt16Number tmp; + + _cmsAssert(io != NULL); + + for (i=0; i < n; i++) { + + if (Array != NULL) { + + if (!_cmsReadUInt16Number(io, &tmp)) return FALSE; + Array[i] = (wchar_t) tmp; + } + else { + if (!_cmsReadUInt16Number(io, NULL)) return FALSE; + } + + } + return TRUE; +} // To deal with position tables typedef cmsBool (* PositionTableEntryFn)(struct _cms_typehandler_struct* self, @@ -171,8 +193,8 @@ cmsUInt32Number n, cmsUInt32Number SizeOfTag); -// Helper function to deal with position tables as decribed in several addendums to ICC spec 4.2 -// A table of n elements is written, where first comes n records containing offsets and sizes and +// Helper function to deal with position tables as decribed in ICC spec 4.3 +// A table of n elements is readed, where first comes n records containing offsets and sizes and // then a block containing the data itself. This allows to reuse same data in more than one entry static cmsBool ReadPositionTable(struct _cms_typehandler_struct* self, @@ -224,7 +246,7 @@ static cmsBool WritePositionTable(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, - cmsUInt32Number SizeOfTag, + cmsUInt32Number SizeOfTag, cmsUInt32Number Count, cmsUInt32Number BaseOffset, void *Cargo, @@ -713,6 +735,8 @@ *nItems = 0; // We need to store the "\0" at the end, so +1 + if (SizeOfTag == UINT_MAX) goto Error; + Text = (char*) _cmsMalloc(self ->ContextID, SizeOfTag + 1); if (Text == NULL) goto Error; @@ -807,13 +831,20 @@ cmsUInt32Number LenOfData; *nItems = 0; + + if (SizeOfTag < sizeof(cmsUInt32Number)) return NULL; + LenOfData = SizeOfTag - sizeof(cmsUInt32Number); + if (LenOfData > INT_MAX) return NULL; BinData = (cmsICCData*) _cmsMalloc(self ->ContextID, sizeof(cmsICCData) + LenOfData - 1); if (BinData == NULL) return NULL; BinData ->len = LenOfData; - if (!_cmsReadUInt32Number(io, &BinData->flag)) return NULL; + if (!_cmsReadUInt32Number(io, &BinData->flag)) { + _cmsFree(self ->ContextID, BinData); + return NULL; + } if (io -> Read(io, BinData ->data, sizeof(cmsUInt8Number), LenOfData) != LenOfData) { @@ -1104,6 +1135,9 @@ default: // Curve + if (Count > 0x7FFF) + return NULL; // This is to prevent bad guys for doing bad things + NewGamma = cmsBuildTabulatedToneCurve16(self ->ContextID, Count, NULL); if (!NewGamma) return NULL; @@ -1219,17 +1253,23 @@ cmsBool Type_ParametricCurve_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsToneCurve* Curve = (cmsToneCurve*) Ptr; - int i, nParams; + int i, nParams, typen; static const int ParamsByType[] = { 0, 1, 3, 4, 5, 7 }; - - if (Curve ->nSegments > 1 || Curve -> Segments[0].Type < 1) { - - cmsSignalError(self->ContextID, 0, "Multisegment or Inverted parametric curves cannot be written"); + typen = Curve -> Segments[0].Type; + + if (Curve ->nSegments > 1 || typen < 1) { + + cmsSignalError(self->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Multisegment or Inverted parametric curves cannot be written"); return FALSE; } - nParams = ParamsByType[Curve ->Segments[0].Type]; + if (typen > 5) { + cmsSignalError(self->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported parametric curve"); + return FALSE; + } + + nParams = ParamsByType[typen]; if (!_cmsWriteUInt16Number(io, (cmsUInt16Number) (Curve ->Segments[0].Type - 1))) return FALSE; if (!_cmsWriteUInt16Number(io, 0)) return FALSE; // Reserved @@ -1394,13 +1434,11 @@ // ******************************************************************************** // Type cmsSigMultiLocalizedUnicodeType // ******************************************************************************** - // // Do NOT trust SizeOfTag as there is an issue on the definition of profileSequenceDescTag. See the TechNote from // Max Derhak and Rohit Patil about this: basically the size of the string table should be guessed and cannot be // taken from the size of tag if this tag is embedded as part of bigger structures (profileSequenceDescTag, for instance) // -// FIXME: this doesn't work if sizeof(wchat_t) != 2 !!! static void *Type_MLU_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) @@ -1410,7 +1448,7 @@ cmsUInt32Number SizeOfHeader; cmsUInt32Number Len, Offset; cmsUInt32Number i; - cmsUInt16Number* Block; + wchar_t* Block; cmsUInt32Number BeginOfThisString, EndOfThisString, LargestPosition; *nItems = 0; @@ -1438,12 +1476,17 @@ // Now deal with Len and offset. if (!_cmsReadUInt32Number(io, &Len)) goto Error; - mlu ->Entries[i].Len = Len; - if (!_cmsReadUInt32Number(io, &Offset)) goto Error; + // Check for overflow + if (Offset < (SizeOfHeader + 8)) goto Error; + + // True begin of the string BeginOfThisString = Offset - SizeOfHeader - 8; - mlu ->Entries[i].StrW = BeginOfThisString; + + // Ajust to wchar_t elements + mlu ->Entries[i].Len = (Len * sizeof(wchar_t)) / sizeof(cmsUInt16Number); + mlu ->Entries[i].StrW = (BeginOfThisString * sizeof(wchar_t)) / sizeof(cmsUInt16Number); // To guess maximum size, add offset + len EndOfThisString = BeginOfThisString + Len; @@ -1452,15 +1495,22 @@ } // Now read the remaining of tag and fill all strings. Substract the directory - SizeOfTag = LargestPosition; - - Block = (cmsUInt16Number*) _cmsMalloc(self ->ContextID, SizeOfTag); - if (Block == NULL) goto Error; - - NumOfWchar = SizeOfTag / sizeof(cmsUInt16Number); - - if (!_cmsReadUInt16Array(io, NumOfWchar, Block)) goto Error; - mlu ->MemPool = Block; + SizeOfTag = (LargestPosition * sizeof(wchar_t)) / sizeof(cmsUInt16Number); + if (SizeOfTag == 0) + { + Block = NULL; + NumOfWchar = 0; + + } + else + { + Block = (wchar_t*) _cmsMalloc(self ->ContextID, SizeOfTag); + if (Block == NULL) goto Error; + NumOfWchar = SizeOfTag / sizeof(wchar_t); + if (!_cmsReadWCharArray(io, NumOfWchar, Block)) goto Error; + } + + mlu ->MemPool = Block; mlu ->PoolSize = SizeOfTag; mlu ->PoolUsed = SizeOfTag; @@ -1476,9 +1526,18 @@ cmsBool Type_MLU_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsMLU* mlu =(cmsMLU*) Ptr; - cmsUInt32Number HeaderSize, Offset; + cmsUInt32Number HeaderSize; + cmsUInt32Number Len, Offset; int i; + if (Ptr == NULL) { + + // Empty placeholder + if (!_cmsWriteUInt32Number(io, 0)) return FALSE; + if (!_cmsWriteUInt32Number(io, 12)) return FALSE; + return TRUE; + } + if (!_cmsWriteUInt32Number(io, mlu ->UsedEntries)) return FALSE; if (!_cmsWriteUInt32Number(io, 12)) return FALSE; @@ -1486,16 +1545,19 @@ for (i=0; i < mlu ->UsedEntries; i++) { + Len = mlu ->Entries[i].Len; + Offset = mlu ->Entries[i].StrW; + + Len = (Len * sizeof(cmsUInt16Number)) / sizeof(wchar_t); + Offset = (Offset * sizeof(cmsUInt16Number)) / sizeof(wchar_t) + HeaderSize + 8; + if (!_cmsWriteUInt16Number(io, mlu ->Entries[i].Language)) return FALSE; if (!_cmsWriteUInt16Number(io, mlu ->Entries[i].Country)) return FALSE; - if (!_cmsWriteUInt32Number(io, mlu ->Entries[i].Len)) return FALSE; - - Offset = mlu ->Entries[i].StrW + HeaderSize + 8; - + if (!_cmsWriteUInt32Number(io, Len)) return FALSE; if (!_cmsWriteUInt32Number(io, Offset)) return FALSE; } - if (!_cmsWriteUInt16Array(io, mlu ->PoolUsed / sizeof(cmsUInt16Number), (cmsUInt16Number*) mlu ->MemPool)) return FALSE; + if (!_cmsWriteWCharArray(io, mlu ->PoolUsed / sizeof(wchar_t), (wchar_t*) mlu ->MemPool)) return FALSE; return TRUE; @@ -1584,6 +1646,7 @@ cmsToneCurve* Tables[cmsMAXCHANNELS]; if (nChannels > cmsMAXCHANNELS) return FALSE; + if (nChannels <= 0) return FALSE; memset(Tables, 0, sizeof(Tables)); @@ -1604,6 +1667,7 @@ } _cmsFree(ContextID, Temp); + Temp = NULL; mpe = cmsStageAllocToneCurves(ContextID, nChannels, Tables); @@ -1658,12 +1722,28 @@ } +// Check overflow static -unsigned int uipow(cmsUInt32Number a, cmsUInt32Number b) { - cmsUInt32Number rv = 1; - for (; b > 0; b--) +size_t uipow(cmsUInt32Number n, cmsUInt32Number a, cmsUInt32Number b) +{ + cmsUInt32Number rv = 1, rc; + + if (a == 0) return 0; + if (n == 0) return 0; + + for (; b > 0; b--) { + rv *= a; - return rv; + + // Check for overflow + if (rv > UINT_MAX / a) return (size_t) -1; + + } + + rc = rv * n; + + if (rv != rc / n) return (size_t) -1; + return rc; } @@ -1687,6 +1767,8 @@ if (!_cmsReadUInt8Number(io, &OutputChannels)) goto Error; if (!_cmsReadUInt8Number(io, &CLUTpoints)) goto Error; + if (CLUTpoints == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least + // Padding if (!_cmsReadUInt8Number(io, NULL)) goto Error; @@ -1722,8 +1804,9 @@ // Get input tables if (!Read8bitTables(self ->ContextID, io, NewLUT, InputChannels)) goto Error; - // Get 3D CLUT - nTabSize = (OutputChannels * uipow(CLUTpoints, InputChannels)); + // Get 3D CLUT. Check the overflow.... + nTabSize = uipow(OutputChannels, CLUTpoints, InputChannels); + if (nTabSize == (size_t) -1) goto Error; if (nTabSize > 0) { cmsUInt16Number *PtrW, *T; @@ -1850,15 +1933,18 @@ // The prelinearization table if (!Write8bitTables(self ->ContextID, io, NewLUT ->InputChannels, PreMPE)) return FALSE; - nTabSize = (NewLUT->OutputChannels * uipow(clutPoints, NewLUT ->InputChannels)); - - // The 3D CLUT. - if (clut != NULL) { - - for (j=0; j < nTabSize; j++) { - - val = (cmsUInt8Number) FROM_16_TO_8(clut ->Tab.T[j]); - if (!_cmsWriteUInt8Number(io, val)) return FALSE; + nTabSize = uipow(NewLUT->OutputChannels, clutPoints, NewLUT ->InputChannels); + if (nTabSize == (size_t) -1) return FALSE; + if (nTabSize > 0) { + + // The 3D CLUT. + if (clut != NULL) { + + for (j=0; j < nTabSize; j++) { + + val = (cmsUInt8Number) FROM_16_TO_8(clut ->Tab.T[j]); + if (!_cmsWriteUInt8Number(io, val)) return FALSE; + } } } @@ -1905,6 +1991,7 @@ if (nEntries <= 0) return TRUE; // Check for malicious profiles + if (nEntries < 2) return FALSE; if (nChannels > cmsMAXCHANNELS) return FALSE; // Init table to zero @@ -1979,13 +2066,12 @@ if (!_cmsReadUInt8Number(io, &InputChannels)) return NULL; if (!_cmsReadUInt8Number(io, &OutputChannels)) return NULL; - if (!_cmsReadUInt8Number(io, &CLUTpoints)) return NULL; + if (!_cmsReadUInt8Number(io, &CLUTpoints)) return NULL; // 255 maximum // Padding if (!_cmsReadUInt8Number(io, NULL)) return NULL; // Do some checking - if (CLUTpoints > 100) goto Error; if (InputChannels > cmsMAXCHANNELS) goto Error; if (OutputChannels > cmsMAXCHANNELS) goto Error; @@ -2006,7 +2092,6 @@ // Only operates on 3 channels - if ((InputChannels == 3) && !_cmsMAT3isIdentity((cmsMAT3*) Matrix)) { mpemat = cmsStageAllocMatrix(self ->ContextID, 3, 3, Matrix, NULL); @@ -2014,15 +2099,18 @@ cmsPipelineInsertStage(NewLUT, cmsAT_END, mpemat); } - if (!_cmsReadUInt16Number(io, &InputEntries)) return NULL; - if (!_cmsReadUInt16Number(io, &OutputEntries)) return NULL; - + if (!_cmsReadUInt16Number(io, &InputEntries)) goto Error; + if (!_cmsReadUInt16Number(io, &OutputEntries)) goto Error; + + if (InputEntries > 0x7FFF || OutputEntries > 0x7FFF) goto Error; + if (CLUTpoints == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least // Get input tables if (!Read16bitTables(self ->ContextID, io, NewLUT, InputChannels, InputEntries)) goto Error; // Get 3D CLUT - nTabSize = (OutputChannels * uipow(CLUTpoints, InputChannels)); + nTabSize = uipow(OutputChannels, CLUTpoints, InputChannels); + if (nTabSize == (size_t) -1) goto Error; if (nTabSize > 0) { cmsUInt16Number *T; @@ -2030,10 +2118,17 @@ T = (cmsUInt16Number*) _cmsCalloc(self ->ContextID, nTabSize, sizeof(cmsUInt16Number)); if (T == NULL) goto Error; - if (!_cmsReadUInt16Array(io, nTabSize, T)) goto Error; + if (!_cmsReadUInt16Array(io, nTabSize, T)) { + _cmsFree(self ->ContextID, T); + goto Error; + } mpeclut = cmsStageAllocCLut16bit(self ->ContextID, CLUTpoints, InputChannels, OutputChannels, T); - if (mpeclut == NULL) goto Error; + if (mpeclut == NULL) { + _cmsFree(self ->ContextID, T); + goto Error; + } + cmsPipelineInsertStage(NewLUT, cmsAT_END, mpeclut); _cmsFree(self ->ContextID, T); } @@ -2155,11 +2250,13 @@ if (!Write16bitTables(self ->ContextID, io, PreMPE)) return FALSE; } - nTabSize = (OutputChannels * uipow(clutPoints, InputChannels)); - - // The 3D CLUT. - if (clut != NULL) { - if (!_cmsWriteUInt16Array(io, nTabSize, clut->Tab.T)) return FALSE; + nTabSize = uipow(OutputChannels, clutPoints, InputChannels); + if (nTabSize == (size_t) -1) return FALSE; + if (nTabSize > 0) { + // The 3D CLUT. + if (clut != NULL) { + if (!_cmsWriteUInt16Array(io, nTabSize, clut->Tab.T)) return FALSE; + } } // The postlinearization table @@ -2246,8 +2343,12 @@ if (!io -> Seek(io, Offset)) return NULL; if (io -> Read(io, gridPoints8, cmsMAXCHANNELS, 1) != 1) return NULL; - for (i=0; i < cmsMAXCHANNELS; i++) + + for (i=0; i < cmsMAXCHANNELS; i++) { + + if (gridPoints8[i] == 1) return NULL; // Impossible value, 0 for no CLUT and then 2 at least GridPoints[i] = gridPoints8[i]; + } if (!_cmsReadUInt8Number(io, &Precision)) return NULL; @@ -2256,6 +2357,8 @@ if (!_cmsReadUInt8Number(io, NULL)) return NULL; CLUT = cmsStageAllocCLut16bitGranular(self ->ContextID, GridPoints, InputChannels, OutputChannels, NULL); + if (CLUT == NULL) return NULL; + Data = (_cmsStageCLutData*) CLUT ->Data; // Precision can be 1 or 2 bytes @@ -2276,7 +2379,7 @@ if (!_cmsReadUInt16Array(io, Data->nEntries, Data ->Tab.T)) return NULL; } else { - cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknow precision of '%d'", Precision); + cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown precision of '%d'", Precision); return NULL; } @@ -2304,7 +2407,7 @@ char String[5]; _cmsTagSignature2String(String, (cmsTagSignature) BaseType); - cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknow curve type '%s'", String); + cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown curve type '%s'", String); } return NULL; } @@ -2313,26 +2416,30 @@ // Read a set of curves from specific offset static -cmsStage* ReadSetOfCurves(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number Offset, int nCurves) +cmsStage* ReadSetOfCurves(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number Offset, cmsUInt32Number nCurves) { cmsToneCurve* Curves[cmsMAXCHANNELS]; - int i; - cmsStage* Lin; - + cmsUInt32Number i; + cmsStage* Lin = NULL; if (nCurves > cmsMAXCHANNELS) return FALSE; if (!io -> Seek(io, Offset)) return FALSE; + for (i=0; i < nCurves; i++) + Curves[i] = NULL; + for (i=0; i < nCurves; i++) { Curves[i] = ReadEmbeddedCurve(self, io); - if (Curves[i] == NULL) return FALSE; - if (!_cmsReadAlignment(io)) return FALSE; + if (Curves[i] == NULL) goto Error; + if (!_cmsReadAlignment(io)) goto Error; + } Lin = cmsStageAllocToneCurves(self ->ContextID, nCurves, Curves); +Error: for (i=0; i < nCurves; i++) cmsFreeToneCurve(Curves[i]); @@ -2395,26 +2502,31 @@ if (offsetA!= 0) { mpe = ReadSetOfCurves(self, io, BaseOffset + offsetA, inputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetC != 0) { mpe = ReadCLUT(self, io, BaseOffset + offsetC, inputChan, outputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetM != 0) { mpe = ReadSetOfCurves(self, io, BaseOffset + offsetM, outputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetMat != 0) { mpe = ReadMatrix(self, io, BaseOffset + offsetMat); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetB != 0) { mpe = ReadSetOfCurves(self, io, BaseOffset + offsetB, outputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } @@ -2441,9 +2553,19 @@ if (!_cmsWrite15Fixed16Number(io, m -> Double[7])) return FALSE; if (!_cmsWrite15Fixed16Number(io, m -> Double[8])) return FALSE; + if (m ->Offset != NULL) { + if (!_cmsWrite15Fixed16Number(io, m -> Offset[0])) return FALSE; if (!_cmsWrite15Fixed16Number(io, m -> Offset[1])) return FALSE; if (!_cmsWrite15Fixed16Number(io, m -> Offset[2])) return FALSE; + } + else { + if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE; + if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE; + if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE; + + } + return TRUE; @@ -2468,7 +2590,8 @@ // If this is a table-based curve, use curve type even on V4 CurrentType = Type; - if (Curves[i] ->nSegments == 0) + if ((Curves[i] ->nSegments == 0)|| + ((Curves[i]->nSegments == 2) && (Curves[i] ->Segments[1].Type == 0)) ) CurrentType = cmsSigCurveType; else if (Curves[i] ->Segments[0].Type < 0) @@ -2491,7 +2614,7 @@ char String[5]; _cmsTagSignature2String(String, (cmsTagSignature) Type); - cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknow curve type '%s'", String); + cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown curve type '%s'", String); } return FALSE; } @@ -2511,6 +2634,11 @@ cmsUInt32Number i; _cmsStageCLutData* CLUT = ( _cmsStageCLutData*) mpe -> Data; + if (CLUT ->HasFloatValues) { + cmsSignalError(self ->ContextID, cmsERROR_NOT_SUITABLE, "Cannot save floating point data, CLUT are 8 or 16 bit only"); + return FALSE; + } + memset(gridPoints, 0, sizeof(gridPoints)); for (i=0; i < (cmsUInt32Number) CLUT ->Params ->nInputs; i++) gridPoints[i] = (cmsUInt8Number) CLUT ->Params ->nSamples[i]; @@ -2536,7 +2664,7 @@ if (!_cmsWriteUInt16Array(io, CLUT->nEntries, CLUT ->Tab.T)) return FALSE; } else { - cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknow precision of '%d'", Precision); + cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown precision of '%d'", Precision); return FALSE; } @@ -2694,26 +2822,31 @@ if (offsetB != 0) { mpe = ReadSetOfCurves(self, io, BaseOffset + offsetB, inputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetMat != 0) { mpe = ReadMatrix(self, io, BaseOffset + offsetMat); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetM != 0) { mpe = ReadSetOfCurves(self, io, BaseOffset + offsetM, inputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetC != 0) { mpe = ReadCLUT(self, io, BaseOffset + offsetC, inputChan, outputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } if (offsetA!= 0) { mpe = ReadSetOfCurves(self, io, BaseOffset + offsetA, outputChan); + if (mpe == NULL) { cmsPipelineFree(NewLUT); return NULL; } cmsPipelineInsertStage(NewLUT, cmsAT_END, mpe); } @@ -2978,7 +3111,10 @@ prefix[31] = suffix[31] = 0; v = cmsAllocNamedColorList(self ->ContextID, count, nDeviceCoords, prefix, suffix); - if (v == NULL) return NULL; + if (v == NULL) { + cmsSignalError(self->ContextID, cmsERROR_RANGE, "Too many named colors '%d'", count); + return NULL; + } if (nDeviceCoords > cmsMAXCHANNELS) { cmsSignalError(self->ContextID, cmsERROR_RANGE, "Too many device coordinates '%d'", nDeviceCoords); @@ -3076,6 +3212,13 @@ // Type cmsSigProfileSequenceDescType // ******************************************************************************** +// This type is an array of structures, each of which contains information from the +// header fields and tags from the original profiles which were combined to create +// the final profile. The order of the structures is the order in which the profiles +// were combined and includes a structure for the final profile. This provides a +// description of the profile sequence from source to destination, +// typically used with the DeviceLink profile. + static cmsBool ReadEmbeddedText(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU** mlu, cmsUInt32Number SizeOfTag) { @@ -3119,6 +3262,8 @@ *nItems = 0; if (!_cmsReadUInt32Number(io, &Count)) return NULL; + + if (SizeOfTag < sizeof(cmsUInt32Number)) return NULL; SizeOfTag -= sizeof(cmsUInt32Number); @@ -3133,40 +3278,42 @@ cmsPSEQDESC* sec = &OutSeq -> seq[i]; - if (!_cmsReadUInt32Number(io, &sec ->deviceMfg)) return NULL; + if (!_cmsReadUInt32Number(io, &sec ->deviceMfg)) goto Error; + if (SizeOfTag < sizeof(cmsUInt32Number)) goto Error; SizeOfTag -= sizeof(cmsUInt32Number); - if (!_cmsReadUInt32Number(io, &sec ->deviceModel)) return NULL; + if (!_cmsReadUInt32Number(io, &sec ->deviceModel)) goto Error; + if (SizeOfTag < sizeof(cmsUInt32Number)) goto Error; SizeOfTag -= sizeof(cmsUInt32Number); - if (!_cmsReadUInt64Number(io, &sec ->attributes)) return NULL; + if (!_cmsReadUInt64Number(io, &sec ->attributes)) goto Error; + if (SizeOfTag < sizeof(cmsUInt32Number)) goto Error; SizeOfTag -= sizeof(cmsUInt64Number); - if (!_cmsReadUInt32Number(io, (cmsUInt32Number *)&sec ->technology)) return NULL; + if (!_cmsReadUInt32Number(io, (cmsUInt32Number *)&sec ->technology)) goto Error; + if (SizeOfTag < sizeof(cmsUInt32Number)) goto Error; SizeOfTag -= sizeof(cmsUInt32Number); - if (!ReadEmbeddedText(self, io, &sec ->Manufacturer, SizeOfTag)) return NULL; - if (!ReadEmbeddedText(self, io, &sec ->Model, SizeOfTag)) return NULL; + if (!ReadEmbeddedText(self, io, &sec ->Manufacturer, SizeOfTag)) goto Error; + if (!ReadEmbeddedText(self, io, &sec ->Model, SizeOfTag)) goto Error; } *nItems = 1; return OutSeq; + +Error: + cmsFreeProfileSequenceDescription(OutSeq); + return NULL; } // Aux--Embed a text description type. It can be of type text description or multilocalized unicode +// and it depends of the version number passed on cmsTagDescriptor structure instead of stack static cmsBool SaveDescription(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU* Text) { - if (Text == NULL) { - - // Placeholder for a null entry - if (!_cmsWriteTypeBase(io, cmsSigTextDescriptionType)) return FALSE; - return Type_Text_Description_Write(self, io, NULL, 1); - - } - - if (Text->UsedEntries <= 1) { + if (self ->ICCVersion < 0x4000000) { + if (!_cmsWriteTypeBase(io, cmsSigTextDescriptionType)) return FALSE; return Type_Text_Description_Write(self, io, Text, 1); } @@ -3191,7 +3338,7 @@ if (!_cmsWriteUInt32Number(io, sec ->deviceMfg)) return FALSE; if (!_cmsWriteUInt32Number(io, sec ->deviceModel)) return FALSE; - if (!_cmsWriteUInt64Number(io, sec ->attributes)) return FALSE; + if (!_cmsWriteUInt64Number(io, &sec ->attributes)) return FALSE; if (!_cmsWriteUInt32Number(io, sec ->technology)) return FALSE; if (!SaveDescription(self, io, sec ->Manufacturer)) return FALSE; @@ -3366,26 +3513,33 @@ // First curve is Under color removal if (!_cmsReadUInt32Number(io, &CountUcr)) return NULL; + if (SizeOfTag < sizeof(cmsUInt32Number)) return NULL; SizeOfTag -= sizeof(cmsUInt32Number); n ->Ucr = cmsBuildTabulatedToneCurve16(self ->ContextID, CountUcr, NULL); if (n ->Ucr == NULL) return NULL; if (!_cmsReadUInt16Array(io, CountUcr, n ->Ucr->Table16)) return NULL; + if (SizeOfTag < sizeof(cmsUInt32Number)) return NULL; SizeOfTag -= CountUcr * sizeof(cmsUInt16Number); // Second curve is Black generation if (!_cmsReadUInt32Number(io, &CountBg)) return NULL; + if (SizeOfTag < sizeof(cmsUInt32Number)) return NULL; SizeOfTag -= sizeof(cmsUInt32Number); n ->Bg = cmsBuildTabulatedToneCurve16(self ->ContextID, CountBg, NULL); if (n ->Bg == NULL) return NULL; if (!_cmsReadUInt16Array(io, CountBg, n ->Bg->Table16)) return NULL; + if (SizeOfTag < CountBg * sizeof(cmsUInt16Number)) return NULL; SizeOfTag -= CountBg * sizeof(cmsUInt16Number); + if (SizeOfTag == UINT_MAX) return NULL; // Now comes the text. The length is specified by the tag size n ->Desc = cmsMLUalloc(self ->ContextID, 1); - ASCIIString = (char*) _cmsMalloc(self ->ContextID, sizeof(cmsUInt8Number)*(SizeOfTag + 1)); + if (n ->Desc == NULL) return NULL; + + ASCIIString = (char*) _cmsMalloc(self ->ContextID, SizeOfTag + 1); if (io ->Read(io, ASCIIString, sizeof(char), SizeOfTag) != SizeOfTag) return NULL; ASCIIString[SizeOfTag] = 0; cmsMLUsetASCII(n ->Desc, cmsNoLanguage, cmsNoCountry, ASCIIString); @@ -3482,7 +3636,9 @@ if (!_cmsReadUInt32Number(io, &Count)) return FALSE; + if (Count > UINT_MAX - sizeof(cmsUInt32Number)) return FALSE; if (*SizeOfTag < Count + sizeof(cmsUInt32Number)) return FALSE; + Text = (char*) _cmsMalloc(self ->ContextID, Count+1); if (Text == NULL) return FALSE; @@ -3600,6 +3756,9 @@ if (!_cmsReadUInt32Number(io, &sc ->Flag)) goto Error; if (!_cmsReadUInt32Number(io, &sc ->nChannels)) goto Error; + if (sc ->nChannels > cmsMAXCHANNELS - 1) + sc ->nChannels = cmsMAXCHANNELS - 1; + for (i=0; i < sc ->nChannels; i++) { if (!_cmsRead15Fixed16Number(io, &sc ->Channels[i].Frequency)) goto Error; @@ -3778,6 +3937,7 @@ if (!_cmsReadUInt16Number(io, &nSegments)) return NULL; if (!_cmsReadUInt16Number(io, NULL)) return NULL; + if (nSegments < 1) return NULL; Segments = (cmsCurveSegment*) _cmsCalloc(self ->ContextID, nSegments, sizeof(cmsCurveSegment)); if (Segments == NULL) return NULL; @@ -4137,7 +4297,7 @@ // Copy MAX_INPUT_DIMENSIONS at most. Expand to cmsUInt32Number nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? MAX_INPUT_DIMENSIONS : InputChans; - for (i=0; i < nMaxGrids; i++) GridPoints[i] = Dimensions8[i]; + for (i=0; i < nMaxGrids; i++) GridPoints[i] = (cmsUInt32Number) Dimensions8[i]; // Allocate the true CLUT mpe = cmsStageAllocCLutFloatGranular(self ->ContextID, GridPoints, InputChans, OutputChans, NULL); @@ -4202,8 +4362,8 @@ // This is the list of built-in MPE types static _cmsTagTypeLinkedList SupportedMPEtypes[] = { -{{ (cmsTagTypeSignature) cmsSigBAcsElemType, NULL, NULL, NULL, NULL }, &SupportedMPEtypes[1] }, // Ignore those elements for now -{{ (cmsTagTypeSignature) cmsSigEAcsElemType, NULL, NULL, NULL, NULL }, &SupportedMPEtypes[2] }, // (That's what the spec says) +{{ (cmsTagTypeSignature) cmsSigBAcsElemType, NULL, NULL, NULL, NULL, NULL, 0 }, &SupportedMPEtypes[1] }, // Ignore those elements for now +{{ (cmsTagTypeSignature) cmsSigEAcsElemType, NULL, NULL, NULL, NULL, NULL, 0 }, &SupportedMPEtypes[2] }, // (That's what the spec says) {TYPE_MPE_HANDLER((cmsTagTypeSignature) cmsSigCurveSetElemType, MPEcurve), &SupportedMPEtypes[3] }, {TYPE_MPE_HANDLER((cmsTagTypeSignature) cmsSigMatrixElemType, MPEmatrix), &SupportedMPEtypes[4] }, @@ -4466,6 +4626,11 @@ if (!_cmsReadUInt16Number(io, &nElems)) goto Error; if (!_cmsReadUInt16Number(io, &nBytes)) goto Error; + // Adobe's quirk fixup. Fixing broken profiles... + if (nElems == 256 && nBytes == 1 && SizeOfTag == 1576) + nBytes = 2; + + // Populate tone curves for (n=0; n < 3; n++) { @@ -4571,21 +4736,21 @@ cmsGetToneCurveParametricType(Curves[1]) == 5 && cmsGetToneCurveParametricType(Curves[2]) == 5) { - if (!_cmsWriteUInt32Number(io, cmsVideoCardGammaFormulaType)) return FALSE; - - // Save parameters - for (i=0; i < 3; i++) { - - _cmsVCGTGAMMA v; - - v.Gamma = Curves[i] ->Segments[0].Params[0]; - v.Min = Curves[i] ->Segments[0].Params[5]; - v.Max = pow(Curves[i] ->Segments[0].Params[1], v.Gamma) + v.Min; - - if (!_cmsWrite15Fixed16Number(io, v.Gamma)) return FALSE; - if (!_cmsWrite15Fixed16Number(io, v.Min)) return FALSE; - if (!_cmsWrite15Fixed16Number(io, v.Max)) return FALSE; - } + if (!_cmsWriteUInt32Number(io, cmsVideoCardGammaFormulaType)) return FALSE; + + // Save parameters + for (i=0; i < 3; i++) { + + _cmsVCGTGAMMA v; + + v.Gamma = Curves[i] ->Segments[0].Params[0]; + v.Min = Curves[i] ->Segments[0].Params[5]; + v.Max = pow(Curves[i] ->Segments[0].Params[1], v.Gamma) + v.Min; + + if (!_cmsWrite15Fixed16Number(io, v.Gamma)) return FALSE; + if (!_cmsWrite15Fixed16Number(io, v.Min)) return FALSE; + if (!_cmsWrite15Fixed16Number(io, v.Max)) return FALSE; + } } else { @@ -4639,6 +4804,435 @@ _cmsFree(self ->ContextID, Ptr); } + +// ******************************************************************************** +// Type cmsSigDictType +// ******************************************************************************** + +// Single column of the table can point to wchar or MLUC elements. Holds arrays of data +typedef struct { + cmsContext ContextID; + cmsUInt32Number *Offsets; + cmsUInt32Number *Sizes; +} _cmsDICelem; + +typedef struct { + _cmsDICelem Name, Value, DisplayName, DisplayValue; + +} _cmsDICarray; + +// Allocate an empty array element +static +cmsBool AllocElem(cmsContext ContextID, _cmsDICelem* e, cmsUInt32Number Count) +{ + e->Offsets = (cmsUInt32Number *) _cmsCalloc(ContextID, Count, sizeof(cmsUInt32Number *)); + if (e->Offsets == NULL) return FALSE; + + e->Sizes = (cmsUInt32Number *) _cmsCalloc(ContextID, Count, sizeof(cmsUInt32Number *)); + if (e->Sizes == NULL) { + + _cmsFree(ContextID, e -> Offsets); + return FALSE; + } + + e ->ContextID = ContextID; + return TRUE; +} + +// Free an array element +static +void FreeElem(_cmsDICelem* e) +{ + if (e ->Offsets != NULL) _cmsFree(e -> ContextID, e -> Offsets); + if (e ->Sizes != NULL) _cmsFree(e -> ContextID, e ->Sizes); + e->Offsets = e ->Sizes = NULL; +} + +// Get rid of whole array +static +void FreeArray( _cmsDICarray* a) +{ + if (a ->Name.Offsets != NULL) FreeElem(&a->Name); + if (a ->Value.Offsets != NULL) FreeElem(&a ->Value); + if (a ->DisplayName.Offsets != NULL) FreeElem(&a->DisplayName); + if (a ->DisplayValue.Offsets != NULL) FreeElem(&a ->DisplayValue); +} + + +// Allocate whole array +static +cmsBool AllocArray(cmsContext ContextID, _cmsDICarray* a, cmsUInt32Number Count, cmsUInt32Number Length) +{ + // Empty values + memset(a, 0, sizeof(_cmsDICarray)); + + // On depending on record size, create column arrays + if (!AllocElem(ContextID, &a ->Name, Count)) goto Error; + if (!AllocElem(ContextID, &a ->Value, Count)) goto Error; + + if (Length > 16) { + if (!AllocElem(ContextID, &a -> DisplayName, Count)) goto Error; + + } + if (Length > 24) { + if (!AllocElem(ContextID, &a ->DisplayValue, Count)) goto Error; + } + return TRUE; + +Error: + FreeArray(a); + return FALSE; +} + +// Read one element +static +cmsBool ReadOneElem(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, cmsUInt32Number BaseOffset) +{ + if (!_cmsReadUInt32Number(io, &e->Offsets[i])) return FALSE; + if (!_cmsReadUInt32Number(io, &e ->Sizes[i])) return FALSE; + + // An offset of zero has special meaning and shal be preserved + if (e ->Offsets[i] > 0) + e ->Offsets[i] += BaseOffset; + return TRUE; +} + + +static +cmsBool ReadOffsetArray(cmsIOHANDLER* io, _cmsDICarray* a, cmsUInt32Number Count, cmsUInt32Number Length, cmsUInt32Number BaseOffset) +{ + cmsUInt32Number i; + + // Read column arrays + for (i=0; i < Count; i++) { + + if (!ReadOneElem(io, &a -> Name, i, BaseOffset)) return FALSE; + if (!ReadOneElem(io, &a -> Value, i, BaseOffset)) return FALSE; + + if (Length > 16) { + + if (!ReadOneElem(io, &a ->DisplayName, i, BaseOffset)) return FALSE; + + } + + if (Length > 24) { + + if (!ReadOneElem(io, & a -> DisplayValue, i, BaseOffset)) return FALSE; + } + } + return TRUE; +} + + +// Write one element +static +cmsBool WriteOneElem(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i) +{ + if (!_cmsWriteUInt32Number(io, e->Offsets[i])) return FALSE; + if (!_cmsWriteUInt32Number(io, e ->Sizes[i])) return FALSE; + + return TRUE; +} + +static +cmsBool WriteOffsetArray(cmsIOHANDLER* io, _cmsDICarray* a, cmsUInt32Number Count, cmsUInt32Number Length) +{ + cmsUInt32Number i; + + for (i=0; i < Count; i++) { + + if (!WriteOneElem(io, &a -> Name, i)) return FALSE; + if (!WriteOneElem(io, &a -> Value, i)) return FALSE; + + if (Length > 16) { + + if (!WriteOneElem(io, &a -> DisplayName, i)) return FALSE; + } + + if (Length > 24) { + + if (!WriteOneElem(io, &a -> DisplayValue, i)) return FALSE; + } + } + + return TRUE; +} + +static +cmsBool ReadOneWChar(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, wchar_t ** wcstr) +{ + + cmsUInt32Number nChars; + + // Special case for undefined strings (see ICC Votable + // Proposal Submission, Dictionary Type and Metadata TAG Definition) + if (e -> Offsets[i] == 0) { + + *wcstr = NULL; + return TRUE; + } + + if (!io -> Seek(io, e -> Offsets[i])) return FALSE; + + nChars = e ->Sizes[i] / sizeof(cmsUInt16Number); + + + *wcstr = (wchar_t*) _cmsMallocZero(e ->ContextID, (nChars + 1) * sizeof(wchar_t)); + if (*wcstr == NULL) return FALSE; + + if (!_cmsReadWCharArray(io, nChars, *wcstr)) { + _cmsFree(e ->ContextID, *wcstr); + return FALSE; + } + + // End of string marker + (*wcstr)[nChars] = 0; + return TRUE; +} + +static +cmsUInt32Number mywcslen(const wchar_t *s) +{ + const wchar_t *p; + + p = s; + while (*p) + p++; + + return (cmsUInt32Number)(p - s); +} + +static +cmsBool WriteOneWChar(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, const wchar_t * wcstr, cmsUInt32Number BaseOffset) +{ + cmsUInt32Number Before = io ->Tell(io); + cmsUInt32Number n; + + e ->Offsets[i] = Before - BaseOffset; + + if (wcstr == NULL) { + e ->Sizes[i] = 0; + e ->Offsets[i] = 0; + return TRUE; + } + + n = mywcslen(wcstr); + if (!_cmsWriteWCharArray(io, n, wcstr)) return FALSE; + + e ->Sizes[i] = io ->Tell(io) - Before; + return TRUE; +} + +static +cmsBool ReadOneMLUC(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, cmsMLU** mlu) +{ + cmsUInt32Number nItems = 0; + + // A way to get null MLUCs + if (e -> Offsets[i] == 0 || e ->Sizes[i] == 0) { + + *mlu = NULL; + return TRUE; + } + + if (!io -> Seek(io, e -> Offsets[i])) return FALSE; + + *mlu = (cmsMLU*) Type_MLU_Read(self, io, &nItems, e ->Sizes[i]); + return *mlu != NULL; +} + +static +cmsBool WriteOneMLUC(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, const cmsMLU* mlu, cmsUInt32Number BaseOffset) +{ + cmsUInt32Number Before; + + // Special case for undefined strings (see ICC Votable + // Proposal Submission, Dictionary Type and Metadata TAG Definition) + if (mlu == NULL) { + e ->Sizes[i] = 0; + e ->Offsets[i] = 0; + return TRUE; + } + + Before = io ->Tell(io); + e ->Offsets[i] = Before - BaseOffset; + + if (!Type_MLU_Write(self, io, (void*) mlu, 1)) return FALSE; + + e ->Sizes[i] = io ->Tell(io) - Before; + return TRUE; +} + + +static +void *Type_Dictionary_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) +{ + cmsHANDLE hDict; + cmsUInt32Number i, Count, Length; + cmsUInt32Number BaseOffset; + _cmsDICarray a; + wchar_t *NameWCS = NULL, *ValueWCS = NULL; + cmsMLU *DisplayNameMLU = NULL, *DisplayValueMLU=NULL; + cmsBool rc; + + *nItems = 0; + + // Get actual position as a basis for element offsets + BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase); + + // Get name-value record count + if (!_cmsReadUInt32Number(io, &Count)) return NULL; + SizeOfTag -= sizeof(cmsUInt32Number); + + // Get rec lenghth + if (!_cmsReadUInt32Number(io, &Length)) return NULL; + SizeOfTag -= sizeof(cmsUInt32Number); + + // Check for valid lengths + if (Length != 16 && Length != 24 && Length != 32) { + cmsSignalError(self->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown record length in dictionary '%d'", Length); + return NULL; + } + + // Creates an empty dictionary + hDict = cmsDictAlloc(self -> ContextID); + if (hDict == NULL) return NULL; + + // On depending on record size, create column arrays + if (!AllocArray(self -> ContextID, &a, Count, Length)) goto Error; + + // Read column arrays + if (!ReadOffsetArray(io, &a, Count, Length, BaseOffset)) goto Error; + + // Seek to each element and read it + for (i=0; i < Count; i++) { + + if (!ReadOneWChar(io, &a.Name, i, &NameWCS)) goto Error; + if (!ReadOneWChar(io, &a.Value, i, &ValueWCS)) goto Error; + + if (Length > 16) { + if (!ReadOneMLUC(self, io, &a.DisplayName, i, &DisplayNameMLU)) goto Error; + } + + if (Length > 24) { + if (!ReadOneMLUC(self, io, &a.DisplayValue, i, &DisplayValueMLU)) goto Error; + } + + rc = cmsDictAddEntry(hDict, NameWCS, ValueWCS, DisplayNameMLU, DisplayValueMLU); + + if (NameWCS != NULL) _cmsFree(self ->ContextID, NameWCS); + if (ValueWCS != NULL) _cmsFree(self ->ContextID, ValueWCS); + if (DisplayNameMLU != NULL) cmsMLUfree(DisplayNameMLU); + if (DisplayValueMLU != NULL) cmsMLUfree(DisplayValueMLU); + + if (!rc) return FALSE; + } + + FreeArray(&a); + *nItems = 1; + return (void*) hDict; + +Error: + FreeArray(&a); + cmsDictFree(hDict); + return NULL; +} + + +static +cmsBool Type_Dictionary_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) +{ + cmsHANDLE hDict = (cmsHANDLE) Ptr; + const cmsDICTentry* p; + cmsBool AnyName, AnyValue; + cmsUInt32Number i, Count, Length; + cmsUInt32Number DirectoryPos, CurrentPos, BaseOffset; + _cmsDICarray a; + + if (hDict == NULL) return FALSE; + + BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase); + + // Let's inspect the dictionary + Count = 0; AnyName = FALSE; AnyValue = FALSE; + for (p = cmsDictGetEntryList(hDict); p != NULL; p = cmsDictNextEntry(p)) { + + if (p ->DisplayName != NULL) AnyName = TRUE; + if (p ->DisplayValue != NULL) AnyValue = TRUE; + Count++; + } + + Length = 16; + if (AnyName) Length += 8; + if (AnyValue) Length += 8; + + if (!_cmsWriteUInt32Number(io, Count)) return FALSE; + if (!_cmsWriteUInt32Number(io, Length)) return FALSE; + + // Keep starting position of offsets table + DirectoryPos = io ->Tell(io); + + // Allocate offsets array + if (!AllocArray(self ->ContextID, &a, Count, Length)) goto Error; + + // Write a fake directory to be filled latter on + if (!WriteOffsetArray(io, &a, Count, Length)) goto Error; + + // Write each element. Keep track of the size as well. + p = cmsDictGetEntryList(hDict); + for (i=0; i < Count; i++) { + + if (!WriteOneWChar(io, &a.Name, i, p ->Name, BaseOffset)) goto Error; + if (!WriteOneWChar(io, &a.Value, i, p ->Value, BaseOffset)) goto Error; + + if (p ->DisplayName != NULL) { + if (!WriteOneMLUC(self, io, &a.DisplayName, i, p ->DisplayName, BaseOffset)) goto Error; + } + + if (p ->DisplayValue != NULL) { + if (!WriteOneMLUC(self, io, &a.DisplayValue, i, p ->DisplayValue, BaseOffset)) goto Error; + } + + p = cmsDictNextEntry(p); + } + + // Write the directory + CurrentPos = io ->Tell(io); + if (!io ->Seek(io, DirectoryPos)) goto Error; + + if (!WriteOffsetArray(io, &a, Count, Length)) goto Error; + + if (!io ->Seek(io, CurrentPos)) goto Error; + + FreeArray(&a); + return TRUE; + +Error: + FreeArray(&a); + return FALSE; + + cmsUNUSED_PARAMETER(nItems); +} + + +static +void* Type_Dictionary_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) +{ + return (void*) cmsDictDup((cmsHANDLE) Ptr); + + cmsUNUSED_PARAMETER(n); + cmsUNUSED_PARAMETER(self); +} + + +static +void Type_Dictionary_Free(struct _cms_typehandler_struct* self, void* Ptr) +{ + cmsDictFree((cmsHANDLE) Ptr); + cmsUNUSED_PARAMETER(self); +} + + // ******************************************************************************** // Type support main routines // ******************************************************************************** @@ -4676,6 +5270,7 @@ {TYPE_HANDLER(cmsCorbisBrokenXYZtype, XYZ), &SupportedTagTypes[27] }, {TYPE_HANDLER(cmsMonacoBrokenCurveType, Curve), &SupportedTagTypes[28] }, {TYPE_HANDLER(cmsSigProfileSequenceIdType, ProfileSequenceId), &SupportedTagTypes[29] }, +{TYPE_HANDLER(cmsSigDictType, Dictionary), &SupportedTagTypes[30] }, {TYPE_HANDLER(cmsSigVcgtType, vcgt), NULL } }; @@ -4795,6 +5390,7 @@ { cmsSigScreeningTag, { 1, 1, { cmsSigScreeningType}, NULL }, &SupportedTags[59]}, { cmsSigVcgtTag, { 1, 1, { cmsSigVcgtType}, NULL }, &SupportedTags[60]}, + { cmsSigMetaTag, { 1, 1, { cmsSigDictType}, NULL }, &SupportedTags[61]}, { cmsSigProfileSequenceIdTag, { 1, 1, { cmsSigProfileSequenceIdType}, NULL}, NULL} };
--- a/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -143,7 +143,7 @@ if (!hICC) // can't allocate return NULL; - cmsSetProfileVersion(hICC, 4.2); + cmsSetProfileVersion(hICC, 4.3); cmsSetDeviceClass(hICC, cmsSigDisplayClass); cmsSetColorSpace(hICC, cmsSigRgbData); @@ -247,7 +247,7 @@ if (!hICC) // can't allocate return NULL; - cmsSetProfileVersion(hICC, 4.2); + cmsSetProfileVersion(hICC, 4.3); cmsSetDeviceClass(hICC, cmsSigDisplayClass); cmsSetColorSpace(hICC, cmsSigGrayData); @@ -310,7 +310,7 @@ if (!hICC) return NULL; - cmsSetProfileVersion(hICC, 4.2); + cmsSetProfileVersion(hICC, 4.3); cmsSetDeviceClass(hICC, cmsSigLinkClass); cmsSetColorSpace(hICC, ColorSpace); @@ -430,7 +430,7 @@ if (!hICC) // can't allocate return NULL; - cmsSetProfileVersion(hICC, 4.2); + cmsSetProfileVersion(hICC, 4.3); cmsSetDeviceClass(hICC, cmsSigLinkClass); cmsSetColorSpace(hICC, ColorSpace); @@ -538,7 +538,7 @@ hProfile = cmsCreateRGBProfileTHR(ContextID, WhitePoint == NULL ? cmsD50_xyY() : WhitePoint, NULL, NULL); if (hProfile == NULL) return NULL; - cmsSetProfileVersion(hProfile, 4.2); + cmsSetProfileVersion(hProfile, 4.3); cmsSetDeviceClass(hProfile, cmsSigAbstractClass); cmsSetColorSpace(hProfile, cmsSigLabData); @@ -583,7 +583,7 @@ hProfile = cmsCreateRGBProfileTHR(ContextID, cmsD50_xyY(), NULL, NULL); if (hProfile == NULL) return NULL; - cmsSetProfileVersion(hProfile, 4.2); + cmsSetProfileVersion(hProfile, 4.3); cmsSetDeviceClass(hProfile, cmsSigAbstractClass); cmsSetColorSpace(hProfile, cmsSigXYZData); @@ -838,7 +838,7 @@ if (!hProfile) // can't allocate return NULL; - cmsSetProfileVersion(hProfile, 4.2); + cmsSetProfileVersion(hProfile, 4.3); if (!SetTextTags(hProfile, L"NULL profile built-in")) goto Error; @@ -963,6 +963,11 @@ // Colorant count now depends on the output space nc2 ->ColorantCount = cmsPipelineOutputChannels(v ->Lut); + // Make sure we have proper formatters + cmsChangeBuffersFormat(xform, TYPE_NAMED_COLOR_INDEX, + FLOAT_SH(0) | COLORSPACE_SH(_cmsLCMScolorSpace(v ->ExitColorSpace)) + | BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(v ->ExitColorSpace))); + // Apply the transfor to colorants. for (i=0; i < nColors; i++) { cmsDoTransform(xform, &i, nc2 ->List[i].DeviceColorant, 1); @@ -983,6 +988,7 @@ typedef struct { cmsBool IsV4; // Is a V4 tag? + cmsTagSignature RequiredTag; // Set to 0 for both types cmsTagTypeSignature LutType; // The LUT type int nTypes; // Number of types (up to 5) cmsStageSignature MpeTypes[5]; // 5 is the maximum number @@ -991,16 +997,16 @@ static const cmsAllowedLUT AllowedLUTTypes[] = { - { FALSE, cmsSigLut16Type, 4, { cmsSigMatrixElemType, cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}}, - { FALSE, cmsSigLut16Type, 3, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}}, - { TRUE , cmsSigLutAtoBType, 1, { cmsSigCurveSetElemType } }, - { TRUE , cmsSigLutAtoBType, 3, { cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType } }, - { TRUE , cmsSigLutAtoBType, 3, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType } }, - { TRUE , cmsSigLutAtoBType, 5, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType }}, - { TRUE , cmsSigLutBtoAType, 1, { cmsSigCurveSetElemType }}, - { TRUE , cmsSigLutBtoAType, 3, { cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType }}, - { TRUE , cmsSigLutBtoAType, 3, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType }}, - { TRUE , cmsSigLutBtoAType, 5, { cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType }} + { FALSE, 0, cmsSigLut16Type, 4, { cmsSigMatrixElemType, cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}}, + { FALSE, 0, cmsSigLut16Type, 3, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType}}, + { TRUE , 0, cmsSigLutAtoBType, 1, { cmsSigCurveSetElemType }}, + { TRUE , cmsSigAToB0Tag, cmsSigLutAtoBType, 3, { cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType } }, + { TRUE , cmsSigAToB0Tag, cmsSigLutAtoBType, 3, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType } }, + { TRUE , cmsSigAToB0Tag, cmsSigLutAtoBType, 5, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType }}, + { TRUE , cmsSigBToA0Tag, cmsSigLutBtoAType, 1, { cmsSigCurveSetElemType }}, + { TRUE , cmsSigBToA0Tag, cmsSigLutBtoAType, 3, { cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType }}, + { TRUE , cmsSigBToA0Tag, cmsSigLutBtoAType, 3, { cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType }}, + { TRUE , cmsSigBToA0Tag, cmsSigLutBtoAType, 5, { cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType, cmsSigCLutElemType, cmsSigCurveSetElemType }} }; #define SIZE_OF_ALLOWED_LUT (sizeof(AllowedLUTTypes)/sizeof(cmsAllowedLUT)) @@ -1023,15 +1029,17 @@ static -const cmsAllowedLUT* FindCombination(const cmsPipeline* Lut, cmsBool IsV4) +const cmsAllowedLUT* FindCombination(const cmsPipeline* Lut, cmsBool IsV4, cmsTagSignature DestinationTag) { - int n; + cmsUInt32Number n; for (n=0; n < SIZE_OF_ALLOWED_LUT; n++) { const cmsAllowedLUT* Tab = AllowedLUTTypes + n; if (IsV4 ^ Tab -> IsV4) continue; + if ((Tab ->RequiredTag != 0) && (Tab ->RequiredTag != DestinationTag)) continue; + if (CheckOne(Tab, Lut)) return Tab; } @@ -1050,6 +1058,7 @@ cmsStage* mpe; cmsContext ContextID = cmsGetTransformContextID(hTransform); const cmsAllowedLUT* AllowedLUT; + cmsTagSignature DestinationTag; _cmsAssert(hTransform != NULL); @@ -1080,6 +1089,14 @@ cmsPipelineInsertStage(LUT, cmsAT_END, _cmsStageAllocLabV4ToV2(ContextID)); } + + hProfile = cmsCreateProfilePlaceholder(ContextID); + if (!hProfile) goto Error; // can't allocate + + cmsSetProfileVersion(hProfile, Version); + + FixColorSpaces(hProfile, xform -> EntryColorSpace, xform -> ExitColorSpace, dwFlags); + // Optimize the LUT and precalculate a devicelink ChansIn = cmsChannelsOf(xform -> EntryColorSpace); @@ -1092,17 +1109,22 @@ FrmOut = COLORSPACE_SH(ColorSpaceBitsOut) | CHANNELS_SH(ChansOut)|BYTES_SH(2); + if (cmsGetDeviceClass(hProfile) == cmsSigOutputClass) + DestinationTag = cmsSigBToA0Tag; + else + DestinationTag = cmsSigAToB0Tag; + // Check if the profile/version can store the result if (dwFlags & cmsFLAGS_FORCE_CLUT) AllowedLUT = NULL; else - AllowedLUT = FindCombination(LUT, Version >= 4.0); + AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag); if (AllowedLUT == NULL) { // Try to optimize _cmsOptimizePipeline(&LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags); - AllowedLUT = FindCombination(LUT, Version >= 4.0); + AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag); } @@ -1113,13 +1135,13 @@ _cmsOptimizePipeline(&LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags); // Put identity curves if needed - if (cmsPipelineStageCount(LUT) == 1) { + if (cmsPipelineGetPtrToFirstStage(LUT) ->Type != cmsSigCurveSetElemType) + cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, ChansIn)); - cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, ChansIn)); - cmsPipelineInsertStage(LUT, cmsAT_END, _cmsStageAllocIdentityCurves(ContextID, ChansOut)); - } + if (cmsPipelineGetPtrToLastStage(LUT) ->Type != cmsSigCurveSetElemType) + cmsPipelineInsertStage(LUT, cmsAT_END, _cmsStageAllocIdentityCurves(ContextID, ChansOut)); - AllowedLUT = FindCombination(LUT, Version >= 4.0); + AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag); } // Somethings is wrong... @@ -1127,25 +1149,15 @@ goto Error; } - hProfile = cmsCreateProfilePlaceholder(ContextID); - if (!hProfile) goto Error; // can't allocate - - cmsSetProfileVersion(hProfile, Version); - - FixColorSpaces(hProfile, xform -> EntryColorSpace, xform -> ExitColorSpace, dwFlags); if (dwFlags & cmsFLAGS_8BITS_DEVICELINK) cmsPipelineSetSaveAs8bitsFlag(LUT, TRUE); // Tag profile with information - if (!SetTextTags(hProfile, L"devicelink")) return NULL; - - if (cmsGetDeviceClass(hProfile) == cmsSigOutputClass) { + if (!SetTextTags(hProfile, L"devicelink")) goto Error; - if (!cmsWriteTag(hProfile, cmsSigBToA0Tag, LUT)) goto Error; - } - else - if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT)) goto Error; + // Store result + if (!cmsWriteTag(hProfile, DestinationTag, LUT)) goto Error; if (xform -> InputColorant != NULL) {
--- a/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c Fri Jun 21 15:46:14 2013 -0500 @@ -172,7 +172,7 @@ // Robertson's method cmsBool CMSEXPORT cmsTempFromWhitePoint(cmsFloat64Number* TempK, const cmsCIExyY* WhitePoint) { - int j; + cmsUInt32Number j; cmsFloat64Number us,vs; cmsFloat64Number uj,vj,tj,di,dj,mi,mj; cmsFloat64Number xs, ys; @@ -263,10 +263,10 @@ cmsBool _cmsAdaptationMatrix(cmsMAT3* r, const cmsMAT3* ConeMatrix, const cmsCIEXYZ* FromIll, const cmsCIEXYZ* ToIll) { cmsMAT3 LamRigg = {{ // Bradford matrix - {{ 0.8951, 0.2664, -0.1614 }}, - {{ -0.7502, 1.7135, 0.0367 }}, - {{ 0.0389, -0.0685, 1.0296 }} - }}; + {{ 0.8951, 0.2664, -0.1614 }}, + {{ -0.7502, 1.7135, 0.0367 }}, + {{ 0.0389, -0.0685, 1.0296 }} + }}; if (ConeMatrix == NULL) ConeMatrix = &LamRigg; @@ -376,3 +376,5 @@ return TRUE; } + +
--- a/src/share/native/sun/java2d/cmm/lcms/cmsxform.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/cmsxform.c Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -60,8 +60,8 @@ // Alarm codes for 16-bit transformations, because the fixed range of containers there are // no values left to mark out of gamut. volatile is C99 per 6.2.5 -static volatile cmsUInt16Number Alarm[cmsMAXCHANNELS]; -static volatile cmsFloat64Number GlobalAdaptationState = 0; +static volatile cmsUInt16Number Alarm[cmsMAXCHANNELS] = { 0x7F00, 0x7F00, 0x7F00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static volatile cmsFloat64Number GlobalAdaptationState = 1; // The adaptation state may be defaulted by this function. If you don't like it, use the extended transform routine cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d) @@ -118,11 +118,13 @@ if (p ->Sequence) cmsFreeProfileSequenceDescription(p ->Sequence); - LCMS_FREE_LOCK(&p->rwlock); + if (p ->UserData) + p ->FreeUserData(p ->ContextID, p ->UserData); + _cmsFree(p ->ContextID, (void *) p); } -// Apply transform +// Apply transform. void CMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform, const void* InputBuffer, void* OutputBuffer, @@ -131,7 +133,20 @@ { _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform; - p -> xform(p, InputBuffer, OutputBuffer, Size); + p -> xform(p, InputBuffer, OutputBuffer, Size, Size); +} + + +// Apply transform. +void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform, + const void* InputBuffer, + void* OutputBuffer, + cmsUInt32Number Size, cmsUInt32Number Stride) + +{ + _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform; + + p -> xform(p, InputBuffer, OutputBuffer, Size, Stride); } @@ -142,7 +157,7 @@ static void FloatXFORM(_cmsTRANSFORM* p, const void* in, - void* out, cmsUInt32Number Size) + void* out, cmsUInt32Number Size, cmsUInt32Number Stride) { cmsUInt8Number* accum; cmsUInt8Number* output; @@ -155,7 +170,7 @@ for (i=0; i < Size; i++) { - accum = p -> FromInputFloat(p, fIn, accum, Size); + accum = p -> FromInputFloat(p, fIn, accum, Stride); // Any gamut chack to do? if (p ->GamutCheck != NULL) { @@ -183,7 +198,7 @@ } // Back to asked representation - output = p -> ToOutputFloat(p, fOut, output, Size); + output = p -> ToOutputFloat(p, fOut, output, Stride); } } @@ -193,7 +208,8 @@ static void NullXFORM(_cmsTRANSFORM* p, const void* in, - void* out, cmsUInt32Number Size) + void* out, cmsUInt32Number Size, + cmsUInt32Number Stride) { cmsUInt8Number* accum; cmsUInt8Number* output; @@ -206,8 +222,8 @@ for (i=0; i < n; i++) { - accum = p -> FromInput(p, wIn, accum, Size); - output = p -> ToOutput(p, wIn, output, Size); + accum = p -> FromInput(p, wIn, accum, Stride); + output = p -> ToOutput(p, wIn, output, Stride); } } @@ -216,7 +232,7 @@ static void PrecalculatedXFORM(_cmsTRANSFORM* p, const void* in, - void* out, cmsUInt32Number Size) + void* out, cmsUInt32Number Size, cmsUInt32Number Stride) { register cmsUInt8Number* accum; register cmsUInt8Number* output; @@ -229,9 +245,9 @@ for (i=0; i < n; i++) { - accum = p -> FromInput(p, wIn, accum, Size); + accum = p -> FromInput(p, wIn, accum, Stride); p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data); - output = p -> ToOutput(p, wOut, output, Size); + output = p -> ToOutput(p, wOut, output, Stride); } } @@ -260,7 +276,7 @@ static void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p, const void* in, - void* out, cmsUInt32Number Size) + void* out, cmsUInt32Number Size, cmsUInt32Number Stride) { cmsUInt8Number* accum; cmsUInt8Number* output; @@ -273,9 +289,9 @@ for (i=0; i < n; i++) { - accum = p -> FromInput(p, wIn, accum, Size); + accum = p -> FromInput(p, wIn, accum, Stride); TransformOnePixelWithGamutCheck(p, wIn, wOut); - output = p -> ToOutput(p, wOut, output, Size); + output = p -> ToOutput(p, wOut, output, Stride); } } @@ -284,13 +300,13 @@ static void CachedXFORM(_cmsTRANSFORM* p, const void* in, - void* out, cmsUInt32Number Size) + void* out, cmsUInt32Number Size, cmsUInt32Number Stride) { cmsUInt8Number* accum; cmsUInt8Number* output; cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS]; cmsUInt32Number i, n; - cmsUInt16Number CacheIn[cmsMAXCHANNELS], CacheOut[cmsMAXCHANNELS]; + _cmsCACHE Cache; accum = (cmsUInt8Number*) in; output = (cmsUInt8Number*) out; @@ -300,36 +316,28 @@ memset(wIn, 0, sizeof(wIn)); memset(wOut, 0, sizeof(wOut)); - - LCMS_READ_LOCK(&p ->rwlock); - memmove(CacheIn, p ->CacheIn, sizeof(CacheIn)); - memmove(CacheOut, p ->CacheOut, sizeof(CacheOut)); - LCMS_UNLOCK(&p ->rwlock); + // Get copy of zero cache + memcpy(&Cache, &p ->Cache, sizeof(Cache)); for (i=0; i < n; i++) { - accum = p -> FromInput(p, wIn, accum, Size); + accum = p -> FromInput(p, wIn, accum, Stride); - if (memcmp(wIn, CacheIn, sizeof(CacheIn)) == 0) { + if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) { - memmove(wOut, CacheOut, sizeof(CacheOut)); + memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut)); } else { p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data); - memmove(CacheIn, wIn, sizeof(CacheIn)); - memmove(CacheOut, wOut, sizeof(CacheOut)); + memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn)); + memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut)); } - output = p -> ToOutput(p, wOut, output, Size); + output = p -> ToOutput(p, wOut, output, Stride); } - - LCMS_WRITE_LOCK(&p ->rwlock); - memmove(p->CacheIn, CacheIn, sizeof(CacheIn)); - memmove(p->CacheOut, CacheOut, sizeof(CacheOut)); - LCMS_UNLOCK(&p ->rwlock); } @@ -337,13 +345,13 @@ static void CachedXFORMGamutCheck(_cmsTRANSFORM* p, const void* in, - void* out, cmsUInt32Number Size) + void* out, cmsUInt32Number Size, cmsUInt32Number Stride) { cmsUInt8Number* accum; cmsUInt8Number* output; cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS]; cmsUInt32Number i, n; - cmsUInt16Number CacheIn[cmsMAXCHANNELS], CacheOut[cmsMAXCHANNELS]; + _cmsCACHE Cache; accum = (cmsUInt8Number*) in; output = (cmsUInt8Number*) out; @@ -353,51 +361,158 @@ memset(wIn, 0, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); memset(wOut, 0, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); - LCMS_READ_LOCK(&p ->rwlock); - memmove(CacheIn, p ->CacheIn, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); - memmove(CacheOut, p ->CacheOut, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); - LCMS_UNLOCK(&p ->rwlock); - + // Get copy of zero cache + memcpy(&Cache, &p ->Cache, sizeof(Cache)); for (i=0; i < n; i++) { - accum = p -> FromInput(p, wIn, accum, Size); + accum = p -> FromInput(p, wIn, accum, Stride); - if (memcmp(wIn, CacheIn, sizeof(cmsUInt16Number) * cmsMAXCHANNELS) == 0) { - memmove(wOut, CacheOut, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); + if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) { + memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut)); } else { TransformOnePixelWithGamutCheck(p, wIn, wOut); - memmove(CacheIn, wIn, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); - memmove(CacheOut, wOut, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); + memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn)); + memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut)); } - output = p -> ToOutput(p, wOut, output, Size); + output = p -> ToOutput(p, wOut, output, Stride); } - LCMS_WRITE_LOCK(&p ->rwlock); - memmove(p->CacheIn, CacheIn, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); - memmove(p->CacheOut, CacheOut, sizeof(cmsUInt16Number) * cmsMAXCHANNELS); - LCMS_UNLOCK(&p ->rwlock); +} + +// ------------------------------------------------------------------------------------------------------------- + +// List of used-defined transform factories +typedef struct _cmsTransformCollection_st { + + _cmsTransformFactory Factory; + struct _cmsTransformCollection_st *Next; + +} _cmsTransformCollection; + +// The linked list head +static _cmsTransformCollection* TransformCollection = NULL; + +// Register new ways to transform +cmsBool _cmsRegisterTransformPlugin(cmsPluginBase* Data) +{ + cmsPluginTransform* Plugin = (cmsPluginTransform*) Data; + _cmsTransformCollection* fl; + + if (Data == NULL) { + + // Free the chain. Memory is safely freed at exit + TransformCollection = NULL; + return TRUE; + } + + // Factory callback is required + if (Plugin ->Factory == NULL) return FALSE; + + + fl = (_cmsTransformCollection*) _cmsPluginMalloc(sizeof(_cmsTransformCollection)); + if (fl == NULL) return FALSE; + + // Copy the parameters + fl ->Factory = Plugin ->Factory; + + // Keep linked list + fl ->Next = TransformCollection; + TransformCollection = fl; + + // All is ok + return TRUE; } +void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn) +{ + _cmsAssert(CMMcargo != NULL); + CMMcargo ->UserData = ptr; + CMMcargo ->FreeUserData = FreePrivateDataFn; +} + +// returns the pointer defined by the plug-in to store private data +void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo) +{ + _cmsAssert(CMMcargo != NULL); + return CMMcargo ->UserData; +} + +// returns the current formatters +void CMSEXPORT _cmsGetTransformFormatters16(struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput) +{ + _cmsAssert(CMMcargo != NULL); + if (FromInput) *FromInput = CMMcargo ->FromInput; + if (ToOutput) *ToOutput = CMMcargo ->ToOutput; +} + +void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput) +{ + _cmsAssert(CMMcargo != NULL); + if (FromInput) *FromInput = CMMcargo ->FromInputFloat; + if (ToOutput) *ToOutput = CMMcargo ->ToOutputFloat; +} -// Allocate transform struct and set it to defaults +// Allocate transform struct and set it to defaults. Ask the optimization plug-in about if those formats are proper +// for separated transforms. If this is the case, static -_cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsUInt32Number InputFormat, cmsUInt32Number OutputFormat, cmsUInt32Number dwFlags) +_cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, + cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags) { + _cmsTransformCollection* Plugin; + // Allocate needed memory _cmsTRANSFORM* p = (_cmsTRANSFORM*) _cmsMallocZero(ContextID, sizeof(_cmsTRANSFORM)); if (!p) return NULL; + // Store the proposed pipeline + p ->Lut = lut; + + // Let's see if any plug-in want to do the transform by itself + for (Plugin = TransformCollection; + Plugin != NULL; + Plugin = Plugin ->Next) { + + if (Plugin ->Factory(&p->xform, &p->UserData, &p ->FreeUserData, &p ->Lut, InputFormat, OutputFormat, dwFlags)) { + + // Last plugin in the declaration order takes control. We just keep + // the original parameters as a logging. + // Note that cmsFLAGS_CAN_CHANGE_FORMATTER is not set, so by default + // an optimized transform is not reusable. The plug-in can, however, change + // the flags and make it suitable. + + p ->ContextID = ContextID; + p ->InputFormat = *InputFormat; + p ->OutputFormat = *OutputFormat; + p ->dwOriginalFlags = *dwFlags; + + // Fill the formatters just in case the optimized routine is interested. + // No error is thrown if the formatter doesn't exist. It is up to the optimization + // factory to decide what to do in those cases. + p ->FromInput = _cmsGetFormatter(*InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; + p ->ToOutput = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; + p ->FromInputFloat = _cmsGetFormatter(*InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + p ->ToOutputFloat = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + + return p; + } + } + + // Not suitable for the transform plug-in, let's check the pipeline plug-in + if (p ->Lut != NULL) + _cmsOptimizePipeline(&p->Lut, Intent, InputFormat, OutputFormat, dwFlags); + // Check whatever this is a true floating point transform - if (_cmsFormatterIsFloat(InputFormat) && _cmsFormatterIsFloat(OutputFormat)) { + if (_cmsFormatterIsFloat(*InputFormat) && _cmsFormatterIsFloat(*OutputFormat)) { // Get formatter function always return a valid union, but the contents of this union may be NULL. - p ->FromInputFloat = _cmsGetFormatter(InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat; - p ->ToOutputFloat = _cmsGetFormatter(OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + p ->FromInputFloat = _cmsGetFormatter(*InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + p ->ToOutputFloat = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat; + *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER; if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) { @@ -411,31 +526,45 @@ } else { - p ->FromInput = _cmsGetFormatter(InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; - p ->ToOutput = _cmsGetFormatter(OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; + if (*InputFormat == 0 && *OutputFormat == 0) { + p ->FromInput = p ->ToOutput = NULL; + *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER; + } + else { + + int BytesPerPixelInput; + + p ->FromInput = _cmsGetFormatter(*InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; + p ->ToOutput = _cmsGetFormatter(*OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; - if (p ->FromInput == NULL || p ->ToOutput == NULL) { + if (p ->FromInput == NULL || p ->ToOutput == NULL) { - cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); - _cmsFree(ContextID, p); - return NULL; + cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); + _cmsFree(ContextID, p); + return NULL; + } + + BytesPerPixelInput = T_BYTES(p ->InputFormat); + if (BytesPerPixelInput == 0 || BytesPerPixelInput >= 2) + *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER; + } - if (dwFlags & cmsFLAGS_NULLTRANSFORM) { + if (*dwFlags & cmsFLAGS_NULLTRANSFORM) { p ->xform = NullXFORM; } else { - if (dwFlags & cmsFLAGS_NOCACHE) { + if (*dwFlags & cmsFLAGS_NOCACHE) { - if (dwFlags & cmsFLAGS_GAMUTCHECK) + if (*dwFlags & cmsFLAGS_GAMUTCHECK) p ->xform = PrecalculatedXFORMGamutCheck; // Gamut check, no caché else p ->xform = PrecalculatedXFORM; // No caché, no gamut check } else { - if (dwFlags & cmsFLAGS_GAMUTCHECK) + if (*dwFlags & cmsFLAGS_GAMUTCHECK) p ->xform = CachedXFORMGamutCheck; // Gamut check, caché else p ->xform = CachedXFORM; // No gamut check, caché @@ -444,14 +573,11 @@ } } - - // Create a mutex for shared memory - LCMS_CREATE_LOCK(&p->rwlock); - - p ->InputFormat = InputFormat; - p ->OutputFormat = OutputFormat; - p ->dwOriginalFlags = dwFlags; + p ->InputFormat = *InputFormat; + p ->OutputFormat = *OutputFormat; + p ->dwOriginalFlags = *dwFlags; p ->ContextID = ContextID; + p ->UserData = NULL; return p; } @@ -462,12 +588,14 @@ cmsColorSpaceSignature PostColorSpace; int i; + if (nProfiles <= 0) return FALSE; if (hProfiles[0] == NULL) return FALSE; *Input = PostColorSpace = cmsGetColorSpace(hProfiles[0]); for (i=0; i < nProfiles; i++) { + cmsProfileClassSignature cls; cmsHPROFILE hProfile = hProfiles[i]; int lIsInput = (PostColorSpace != cmsSigXYZData) && @@ -475,17 +603,28 @@ if (hProfile == NULL) return FALSE; - if (lIsInput) { + cls = cmsGetDeviceClass(hProfile); + + if (cls == cmsSigNamedColorClass) { + + ColorSpaceIn = cmsSig1colorData; + ColorSpaceOut = (nProfiles > 1) ? cmsGetPCS(hProfile) : cmsGetColorSpace(hProfile); + } + else + if (lIsInput || (cls == cmsSigLinkClass)) { ColorSpaceIn = cmsGetColorSpace(hProfile); ColorSpaceOut = cmsGetPCS(hProfile); } - else { - + else + { ColorSpaceIn = cmsGetPCS(hProfile); ColorSpaceOut = cmsGetColorSpace(hProfile); } + if (i==0) + *Input = ColorSpaceIn; + PostColorSpace = ColorSpaceOut; } @@ -531,6 +670,12 @@ cmsPipeline* Lut; cmsUInt32Number LastIntent = Intents[nProfiles-1]; + // If it is a fake transform + if (dwFlags & cmsFLAGS_NULLTRANSFORM) + { + return AllocEmptyTransform(ContextID, NULL, INTENT_PERCEPTUAL, &InputFormat, &OutputFormat, &dwFlags); + } + // If gamut check is requested, make sure we have a gamut profile if (dwFlags & cmsFLAGS_GAMUTCHECK) { if (hGamutProfile == NULL) dwFlags &= ~cmsFLAGS_GAMUTCHECK; @@ -566,21 +711,24 @@ return NULL; } - // Optimize the LUT if possible - _cmsOptimizePipeline(&Lut, LastIntent, &InputFormat, &OutputFormat, &dwFlags); + // Check channel count + if ((cmsChannelsOf(EntryColorSpace) != cmsPipelineInputChannels(Lut)) || + (cmsChannelsOf(ExitColorSpace) != cmsPipelineOutputChannels(Lut))) { + cmsSignalError(ContextID, cmsERROR_NOT_SUITABLE, "Channel count doesn't match. Profile is corrupted"); + return NULL; + } // All seems ok - xform = AllocEmptyTransform(ContextID, InputFormat, OutputFormat, dwFlags); + xform = AllocEmptyTransform(ContextID, Lut, LastIntent, &InputFormat, &OutputFormat, &dwFlags); if (xform == NULL) { - cmsPipelineFree(Lut); return NULL; } // Keep values xform ->EntryColorSpace = EntryColorSpace; xform ->ExitColorSpace = ExitColorSpace; - xform ->Lut = Lut; + xform ->RenderingIntent = Intents[nProfiles-1]; // Create a gamut check LUT if requested @@ -627,14 +775,14 @@ // If this is a cached transform, init first value, which is zero (16 bits only) if (!(dwFlags & cmsFLAGS_NOCACHE)) { - memset(&xform ->CacheIn, 0, sizeof(xform ->CacheIn)); + memset(&xform ->Cache.CacheIn, 0, sizeof(xform ->Cache.CacheIn)); if (xform ->GamutCheck != NULL) { - TransformOnePixelWithGamutCheck(xform, xform ->CacheIn, xform->CacheOut); + TransformOnePixelWithGamutCheck(xform, xform ->Cache.CacheIn, xform->Cache.CacheOut); } else { - xform ->Lut ->Eval16Fn(xform ->CacheIn, xform->CacheOut, xform -> Lut->Data); + xform ->Lut ->Eval16Fn(xform ->Cache.CacheIn, xform->Cache.CacheOut, xform -> Lut->Data); } } @@ -643,7 +791,6 @@ } // Multiprofile transforms: Gamut check is not available here, as it is unclear from which profile the gamut comes. - cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransformTHR(cmsContext ContextID, cmsHPROFILE hProfiles[], cmsUInt32Number nProfiles, @@ -785,3 +932,53 @@ if (xform == NULL) return NULL; return xform -> ContextID; } + +// Grab the input/output formats +cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform) +{ + _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform; + + if (xform == NULL) return 0; + return xform->InputFormat; +} + +cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform) +{ + _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform; + + if (xform == NULL) return 0; + return xform->OutputFormat; +} + +// For backwards compatibility +cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, + cmsUInt32Number InputFormat, + cmsUInt32Number OutputFormat) +{ + + _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform; + cmsFormatter16 FromInput, ToOutput; + + + // We only can afford to change formatters if previous transform is at least 16 bits + if (!(xform ->dwOriginalFlags & cmsFLAGS_CAN_CHANGE_FORMATTER)) { + + cmsSignalError(xform ->ContextID, cmsERROR_NOT_SUITABLE, "cmsChangeBuffersFormat works only on transforms created originally with at least 16 bits of precision"); + return FALSE; + } + + FromInput = _cmsGetFormatter(InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; + ToOutput = _cmsGetFormatter(OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; + + if (FromInput == NULL || ToOutput == NULL) { + + cmsSignalError(xform -> ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); + return FALSE; + } + + xform ->InputFormat = InputFormat; + xform ->OutputFormat = OutputFormat; + xform ->FromInput = FromInput; + xform ->ToOutput = ToOutput; + return TRUE; +}
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/lcms2.h Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -52,7 +52,7 @@ // //--------------------------------------------------------------------------------- // -// Version 2.0 +// Version 2.4 // #ifndef _lcms2_H @@ -69,9 +69,6 @@ // Uncomment this if your compiler doesn't work with fast floor function // #define CMS_DONT_USE_FAST_FLOOR 1 -// Uncomment this line if your system does not support multithreading -#define CMS_DONT_USE_PTHREADS 1 - // Uncomment this line if you want lcms to use the black point tag in profile, // if commented, lcms will compute the black point by its own. // It is safer to leave it commented out @@ -84,6 +81,9 @@ // require "KEYWORD" on undefined identifiers, keep it comented out unless needed // #define CMS_STRICT_CGATS 1 +// Uncomment to get rid of the tables for "half" float support +// #define CMS_NO_HALF_SUPPORT 1 + // ********** End of configuration toggles ****************************** // Needed for streams @@ -101,7 +101,7 @@ #endif // Version/release -#define LCMS_VERSION 2000 +#define LCMS_VERSION 2040 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED @@ -110,6 +110,10 @@ typedef unsigned char cmsUInt8Number; // That is guaranteed by the C99 spec typedef signed char cmsInt8Number; // That is guaranteed by the C99 spec +#if CHAR_BIT != 8 +# error "Unable to find 8 bit type, unsupported compiler" +#endif + // IEEE float storage numbers typedef float cmsFloat32Number; typedef double cmsFloat64Number; @@ -211,11 +215,13 @@ #endif #ifdef TARGET_CPU_PPC +# if TARGET_CPU_PPC # define CMS_USE_BIG_ENDIAN 1 +# endif #endif #ifdef macintosh -# ifndef __LITTLE_ENDIAN__ +# ifdef __BIG_ENDIAN__ # define CMS_USE_BIG_ENDIAN 1 # endif #endif @@ -276,6 +282,7 @@ cmsSigCrdInfoType = 0x63726469, // 'crdi' cmsSigCurveType = 0x63757276, // 'curv' cmsSigDataType = 0x64617461, // 'data' + cmsSigDictType = 0x64696374, // 'dict' cmsSigDateTimeType = 0x6474696D, // 'dtim' cmsSigDeviceSettingsType = 0x64657673, // 'devs' cmsSigLut16Type = 0x6d667432, // 'mft2' @@ -302,9 +309,10 @@ cmsSigUInt32ArrayType = 0x75693332, // 'ui32' cmsSigUInt64ArrayType = 0x75693634, // 'ui64' cmsSigUInt8ArrayType = 0x75693038, // 'ui08' + cmsSigVcgtType = 0x76636774, // 'vcgt' cmsSigViewingConditionsType = 0x76696577, // 'view' - cmsSigXYZType = 0x58595A20, // 'XYZ ' - cmsSigVcgtType = 0x76636774 // 'vcgt' + cmsSigXYZType = 0x58595A20 // 'XYZ ' + } cmsTagTypeSignature; @@ -377,7 +385,8 @@ cmsSigUcrBgTag = 0x62666420, // 'bfd ' cmsSigViewingCondDescTag = 0x76756564, // 'vued' cmsSigViewingConditionsTag = 0x76696577, // 'view' - cmsSigVcgtTag = 0x76636774 // 'vcgt' + cmsSigVcgtTag = 0x76636774, // 'vcgt' + cmsSigMetaTag = 0x6D657461 // 'meta' } cmsTagSignature; @@ -409,7 +418,7 @@ cmsSigMotionPictureFilmScanner = 0x6D706673, // 'mpfs' cmsSigMotionPictureFilmRecorder = 0x6D706672, // 'mpfr' cmsSigDigitalMotionPictureCamera = 0x646D7063, // 'dmpc' - cmsSigDigitalCinemaProjector = 0x64636A70, // 'dcpj' + cmsSigDigitalCinemaProjector = 0x64636A70 // 'dcpj' } cmsTechnologySignature; @@ -436,12 +445,12 @@ cmsSigMCH7Data = 0x4D434837, // 'MCH7' cmsSigMCH8Data = 0x4D434838, // 'MCH8' cmsSigMCH9Data = 0x4D434839, // 'MCH9' - cmsSigMCHAData = 0x4D43483A, // 'MCHA' - cmsSigMCHBData = 0x4D43483B, // 'MCHB' - cmsSigMCHCData = 0x4D43483C, // 'MCHC' - cmsSigMCHDData = 0x4D43483D, // 'MCHD' - cmsSigMCHEData = 0x4D43483E, // 'MCHE' - cmsSigMCHFData = 0x4D43483F, // 'MCHF' + cmsSigMCHAData = 0x4D434841, // 'MCHA' + cmsSigMCHBData = 0x4D434842, // 'MCHB' + cmsSigMCHCData = 0x4D434843, // 'MCHC' + cmsSigMCHDData = 0x4D434844, // 'MCHD' + cmsSigMCHEData = 0x4D434845, // 'MCHE' + cmsSigMCHFData = 0x4D434846, // 'MCHF' cmsSigNamedData = 0x6e6d636c, // 'nmcl' cmsSig1colorData = 0x31434C52, // '1CLR' cmsSig2colorData = 0x32434C52, // '2CLR' @@ -470,7 +479,7 @@ cmsSigLinkClass = 0x6C696E6B, // 'link' cmsSigAbstractClass = 0x61627374, // 'abst' cmsSigColorSpaceClass = 0x73706163, // 'spac' - cmsSigNamedColorClass = 0x6e6d636c, // 'nmcl' + cmsSigNamedColorClass = 0x6e6d636c // 'nmcl' } cmsProfileClassSignature; @@ -512,7 +521,13 @@ cmsSigLabV4toV2 = 0x34203220, // '4 2 ' // Identities - cmsSigIdentityElemType = 0x69646E20 // 'idn ' + cmsSigIdentityElemType = 0x69646E20, // 'idn ' + + // Float to floatPCS + cmsSigLab2FloatPCS = 0x64326C20, // 'd2l ' + cmsSigFloatPCS2Lab = 0x6C326420, // 'l2d ' + cmsSigXYZ2FloatPCS = 0x64327820, // 'd2x ' + cmsSigFloatPCS2XYZ = 0x78326420 // 'x2d ' } cmsStageSignature; @@ -635,7 +650,9 @@ // Format of pixel is defined by one cmsUInt32Number, using bit fields as follows // -// A O TTTTT U Y F P X S EEE CCCC BBB +// 2 1 0 +// 3 2 10987 6 5 4 3 2 1 098 7654 321 +// A O TTTTT U Y F P X S EEE CCCC BBB // // A: Floating point -- With this flag we can differentiate 16 bits as float and as int // O: Optimized -- previous optimization already returns the final 8-bit value @@ -743,16 +760,19 @@ #define TYPE_RGBA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)) #define TYPE_ARGB_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_ARGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)|PLANAR_SH(1)) #define TYPE_ARGB_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)) #define TYPE_ABGR_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)) +#define TYPE_ABGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1)) #define TYPE_ABGR_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)) #define TYPE_ABGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1)) #define TYPE_ABGR_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1)) #define TYPE_BGRA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_BGRA_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|PLANAR_SH(1)) #define TYPE_BGRA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) -#define TYPE_BGRA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_BGRA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) #define TYPE_CMY_8 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)) #define TYPE_CMY_8_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1)) @@ -834,8 +854,8 @@ #define TYPE_Lab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)) #define TYPE_LabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)) -#define TYPE_ALab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|DOSWAP_SH(1)) -#define TYPE_ALabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|DOSWAP_SH(1)) +#define TYPE_ALab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_ALabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1)) #define TYPE_Lab_16 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2)) #define TYPE_LabV2_16 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(2)) #define TYPE_Yxy_16 (COLORSPACE_SH(PT_Yxy)|CHANNELS_SH(3)|BYTES_SH(2)) @@ -874,8 +894,16 @@ // Float formatters. #define TYPE_XYZ_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(4)) #define TYPE_Lab_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(4)) +#define TYPE_LabA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)) #define TYPE_GRAY_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4)) #define TYPE_RGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)) + +#define TYPE_RGBA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)) +#define TYPE_ARGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1)) +#define TYPE_BGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)) +#define TYPE_BGRA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_ABGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)) + #define TYPE_CMYK_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4)) // Floating point formatters. @@ -884,8 +912,21 @@ #define TYPE_Lab_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0)) #define TYPE_GRAY_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0)) #define TYPE_RGB_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)) +#define TYPE_BGR_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)|DOSWAP_SH(1)) #define TYPE_CMYK_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0)) +// IEEE 754-2008 "half" +#define TYPE_GRAY_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)) +#define TYPE_RGB_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)) +#define TYPE_RGBA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)) +#define TYPE_CMYK_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)) + +#define TYPE_RGBA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)) +#define TYPE_ARGB_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)) +#define TYPE_BGR_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)) +#define TYPE_BGRA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_ABGR_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)) + #endif // Colorspaces @@ -1116,6 +1157,10 @@ CMSAPI cmsInt32Number CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t); CMSAPI cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision); +// Tone curve tabular estimation +CMSAPI cmsUInt32Number CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t); +CMSAPI const cmsUInt16Number* CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t); + // Implements pipelines of multi-processing elements ------------------------------------------------------------- @@ -1128,6 +1173,7 @@ CMSAPI void CMSEXPORT cmsPipelineFree(cmsPipeline* lut); CMSAPI cmsPipeline* CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig); +CMSAPI cmsContext CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut); CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut); CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut); @@ -1188,10 +1234,9 @@ #define SAMPLER_INSPECT 0x01000000 // For CLUT only -CMSAPI cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags); +CMSAPI cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags); CMSAPI cmsBool CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags); - // Slicers CMSAPI cmsBool CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[], cmsSAMPLER16 Sampler, void * Cargo); @@ -1301,6 +1346,7 @@ // Profile sequence descriptor. Some fields come from profile sequence descriptor tag, others // come from Profile Sequence Identifier Tag typedef struct { + cmsSignature deviceMfg; cmsSignature deviceModel; cmsUInt64Number attributes; @@ -1324,6 +1370,27 @@ CMSAPI cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq); CMSAPI void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq); +// Dictionaries -------------------------------------------------------------------------------------------------------- + +typedef struct _cmsDICTentry_struct { + + struct _cmsDICTentry_struct* Next; + + cmsMLU *DisplayName; + cmsMLU *DisplayValue; + wchar_t* Name; + wchar_t* Value; + +} cmsDICTentry; + +CMSAPI cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID); +CMSAPI void CMSEXPORT cmsDictFree(cmsHANDLE hDict); +CMSAPI cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict); + +CMSAPI cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue); +CMSAPI const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict); +CMSAPI const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e); + // Access to Profile data ---------------------------------------------------------------------------------------------- CMSAPI cmsHPROFILE CMSEXPORT cmsCreateProfilePlaceholder(cmsContext ContextID); @@ -1336,12 +1403,18 @@ CMSAPI void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig); CMSAPI cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data); CMSAPI cmsBool CMSEXPORT cmsLinkTag(cmsHPROFILE hProfile, cmsTagSignature sig, cmsTagSignature dest); +CMSAPI cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig); // Read and write raw data CMSAPI cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize); CMSAPI cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size); // Access header data +#define cmsEmbeddedProfileFalse 0x00000000 +#define cmsEmbeddedProfileTrue 0x00000001 +#define cmsUseAnywhere 0x00000000 +#define cmsUseWithEmbeddedDataOnly 0x00000002 + CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderFlags(cmsHPROFILE hProfile); CMSAPI void CMSEXPORT cmsGetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number* Flags); CMSAPI void CMSEXPORT cmsGetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID); @@ -1377,9 +1450,9 @@ #define LCMS_USED_AS_OUTPUT 1 #define LCMS_USED_AS_PROOF 2 -CMSAPI cmsBool CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, cmsUInt32Number Intent, int UsedDirection); +CMSAPI cmsBool CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection); CMSAPI cmsBool CMSEXPORT cmsIsMatrixShaper(cmsHPROFILE hProfile); -CMSAPI cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, int UsedDirection); +CMSAPI cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection); // Translate form/to our notation to ICC CMSAPI cmsColorSpaceSignature CMSEXPORT _cmsICCcolorSpace(int OurNotation); @@ -1528,7 +1601,6 @@ #define cmsFLAGS_NOOPTIMIZE 0x0100 // Inhibit optimizations #define cmsFLAGS_NULLTRANSFORM 0x0200 // Don't transform anyway - // Proofing flags #define cmsFLAGS_GAMUTCHECK 0x1000 // Out of Gamut alarm #define cmsFLAGS_SOFTPROOFING 0x4000 // Do softproofing @@ -1626,14 +1698,32 @@ void * OutputBuffer, cmsUInt32Number Size); +CMSAPI void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform, + const void * InputBuffer, + void * OutputBuffer, + cmsUInt32Number Size, + cmsUInt32Number Stride); + + CMSAPI void CMSEXPORT cmsSetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]); CMSAPI void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]); // Adaptation state for absolute colorimetric intent CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d); +// Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed CMSAPI cmsContext CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform); +// Grab the input/output formats +CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform); +CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform); + +// For backwards compatibility +CMSAPI cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, + cmsUInt32Number InputFormat, + cmsUInt32Number OutputFormat); + + // PostScript ColorRenderingDictionary and ColorSpaceArray ---------------------------------------------------- @@ -1677,12 +1767,15 @@ CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyStr(cmsHANDLE hIT8, const char* cProp, const char *Str); CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val); CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyHex(cmsHANDLE hIT8, const char* cProp, cmsUInt32Number Val); +CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char* SubKey, const char *Buffer); CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyUncooked(cmsHANDLE hIT8, const char* Key, const char* Buffer); CMSAPI const char* CMSEXPORT cmsIT8GetProperty(cmsHANDLE hIT8, const char* cProp); CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetPropertyDbl(cmsHANDLE hIT8, const char* cProp); +CMSAPI const char* CMSEXPORT cmsIT8GetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char *SubKey); CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumProperties(cmsHANDLE hIT8, char ***PropertyNames); +CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumPropertyMulti(cmsHANDLE hIT8, const char* cProp, const char ***SubpropertyNames); // Datasets CMSAPI const char* CMSEXPORT cmsIT8GetDataRowCol(cmsHANDLE hIT8, int row, int col); @@ -1712,10 +1805,13 @@ CMSAPI int CMSEXPORT cmsIT8EnumDataFormat(cmsHANDLE hIT8, char ***SampleNames); CMSAPI const char* CMSEXPORT cmsIT8GetPatchName(cmsHANDLE hIT8, int nPatch, char* buffer); +CMSAPI int CMSEXPORT cmsIT8GetPatchByName(cmsHANDLE hIT8, const char *cPatch); // The LABEL extension CMSAPI int CMSEXPORT cmsIT8SetTableByLabel(cmsHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType); +CMSAPI cmsBool CMSEXPORT cmsIT8SetIndexColumn(cmsHANDLE hIT8, const char* cSample); + // Formatter for double CMSAPI void CMSEXPORT cmsIT8DefineDblFormat(cmsHANDLE hIT8, const char* Formatter); @@ -1731,6 +1827,7 @@ // Estimate the black point CMSAPI cmsBool CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags); +CMSAPI cmsBool CMSEXPORT cmsDetectDestinationBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags); // Estimate total area coverage CMSAPI cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile);
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -75,16 +75,18 @@ # define M_LOG10E 0.434294481903251827651 #endif -// BorlandC 5.5 is broken on that -#ifdef __BORLANDC__ +// BorlandC 5.5, VC2003 are broken on that +#if defined(__BORLANDC__) || (_MSC_VER < 1400) // 1400 == VC++ 8.0 #define sinf(x) (float)sin((float)x) #define sqrtf(x) (float)sqrt((float)x) #endif // Alignment of ICC file format uses 4 bytes (cmsUInt32Number) -#define _cmsSIZEOFLONGMINUS1 (sizeof(cmsUInt32Number)-1) -#define _cmsALIGNLONG(x) (((x)+_cmsSIZEOFLONGMINUS1) & ~(_cmsSIZEOFLONGMINUS1)) +#define _cmsALIGNLONG(x) (((x)+(sizeof(cmsUInt32Number)-1)) & ~(sizeof(cmsUInt32Number)-1)) + +// Alignment to memory pointer +#define _cmsALIGNMEM(x) (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 1)) // Maximum encodeable values in floating point #define MAX_ENCODEABLE_XYZ (1.0 + 32767.0/32768.0) @@ -94,7 +96,7 @@ #define MAX_ENCODEABLE_ab4 (127.0) // Maximum of channels for internal pipeline evaluation -#define MAX_STAGE_CHANNELS 128 +#define MAX_STAGE_CHANNELS 128 // Unused parameter warning supression #define cmsUNUSED_PARAMETER(x) ((void)x) @@ -117,36 +119,6 @@ # endif #endif -// Pthreads. In windows we use the native WIN32 API instead -#ifdef CMS_DONT_USE_PTHREADS -typedef int LCMS_RWLOCK_T; -# define LCMS_CREATE_LOCK(x) -# define LCMS_FREE_LOCK(x) -# define LCMS_READ_LOCK(x) -# define LCMS_WRITE_LOCK(x) -# define LCMS_UNLOCK(x) -#else -#ifdef CMS_IS_WINDOWS_ -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include <windows.h> - typedef CRITICAL_SECTION LCMS_RWLOCK_T; -# define LCMS_CREATE_LOCK(x) InitializeCriticalSection((x)) -# define LCMS_FREE_LOCK(x) DeleteCriticalSection((x)) -# define LCMS_READ_LOCK(x) EnterCriticalSection((x)) -# define LCMS_WRITE_LOCK(x) EnterCriticalSection((x)) -# define LCMS_UNLOCK(x) LeaveCriticalSection((x)) -#else -# include <pthread.h> - typedef pthread_rwlock_t LCMS_RWLOCK_T; -# define LCMS_CREATE_LOCK(x) pthread_rwlock_init((x), NULL) -# define LCMS_FREE_LOCK(x) pthread_rwlock_destroy((x)) -# define LCMS_READ_LOCK(x) pthread_rwlock_rdlock((x)) -# define LCMS_WRITE_LOCK(x) pthread_rwlock_wrlock((x)) -# define LCMS_UNLOCK(x) pthread_rwlock_unlock((x)) -#endif -#endif // A fast way to convert from/to 16 <-> 8 bits #define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb)) @@ -253,6 +225,8 @@ // Optimization cmsBool _cmsRegisterOptimizationPlugin(cmsPluginBase* Plugin); +// Transform +cmsBool _cmsRegisterTransformPlugin(cmsPluginBase* Plugin); // --------------------------------------------------------------------------------------------------------- @@ -396,6 +370,7 @@ cmsInterpParams* _cmsComputeInterpParams(cmsContext ContextID, int nSamples, int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags); cmsInterpParams* _cmsComputeInterpParamsEx(cmsContext ContextID, const cmsUInt32Number nSamples[], int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags); void _cmsFreeInterpParams(cmsInterpParams* p); +cmsBool _cmsSetInterpolationRoutine(cmsInterpParams* p); // Curves ---------------------------------------------------------------------------------------------------------------- @@ -443,37 +418,6 @@ struct _cmsStage_struct* Next; }; -// Data kept in "Element" member of cmsStage - -// Curves -typedef struct { - cmsUInt32Number nCurves; - cmsToneCurve** TheCurves; - -} _cmsStageToneCurvesData; - -// Matrix -typedef struct { - cmsFloat64Number* Double; // floating point for the matrix - cmsFloat64Number* Offset; // The offset - -} _cmsStageMatrixData; - -// CLUT -typedef struct { - - union { // Can have only one of both representations at same time - cmsUInt16Number* T; // Points to the table 16 bits table - cmsFloat32Number* TFloat; // Points to the cmsFloat32Number table - - } Tab; - - cmsInterpParams* Params; - cmsUInt32Number nEntries; - cmsBool HasFloatValues; - -} _cmsStageCLutData; - // Special Stages (cannot be saved) cmsStage* _cmsStageAllocLab2XYZ(cmsContext ContextID); @@ -482,9 +426,13 @@ cmsStage* _cmsStageAllocLabV2ToV4(cmsContext ContextID); cmsStage* _cmsStageAllocLabV2ToV4curves(cmsContext ContextID); cmsStage* _cmsStageAllocLabV4ToV2(cmsContext ContextID); -cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList); +cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS); cmsStage* _cmsStageAllocIdentityCurves(cmsContext ContextID, int nChannels); cmsStage* _cmsStageAllocIdentityCLut(cmsContext ContextID, int nChan); +cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID); +cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID); +cmsStage* _cmsStageNormalizeToLabFloat(cmsContext ContextID); +cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID); // For curve set only cmsToneCurve** _cmsStageGetPtrToCurveSet(const cmsStage* mpe); @@ -505,12 +453,12 @@ _cmsOPTeval16Fn Eval16Fn; _cmsPipelineEvalFloatFn EvalFloatFn; - _cmsOPTfreeDataFn FreeDataFn; - _cmsOPTdupDataFn DupDataFn; + _cmsFreeUserDataFn FreeDataFn; + _cmsDupUserDataFn DupDataFn; cmsContext ContextID; // Environment - cmsBool SaveAs8Bits; // Implemntation-specific: save as 8 bits if possible + cmsBool SaveAs8Bits; // Implementation-specific: save as 8 bits if possible }; // LUT reading & creation ------------------------------------------------------------------------------------------- @@ -573,6 +521,8 @@ // Formatters ------------------------------------------------------------------------------------------------------------ +#define cmsFLAGS_CAN_CHANGE_FORMATTER 0x02000000 // Allow change buffer format + cmsBool _cmsFormatterIsFloat(cmsUInt32Number Type); cmsBool _cmsFormatterIs8bit(cmsUInt32Number Type); @@ -581,21 +531,27 @@ cmsUInt32Number dwFlags); +#ifndef CMS_NO_HALF_SUPPORT + +// Half float +cmsFloat32Number _cmsHalf2Float(cmsUInt16Number h); +cmsUInt16Number _cmsFloat2Half(cmsFloat32Number flt); + +#endif + // Transform logic ------------------------------------------------------------------------------------------------------ struct _cmstransform_struct; -// Full xform -typedef void (* _cmsTransformFn)(struct _cmstransform_struct *Transform, - const void* InputBuffer, - void* OutputBuffer, cmsUInt32Number Size); - typedef struct { - cmsUInt32Number InputFormat, OutputFormat; // Keep formats for further reference - cmsUInt32Number StrideIn, StrideOut; // Planar support + // 1-pixel cache (16 bits only) + cmsUInt16Number CacheIn[cmsMAXCHANNELS]; + cmsUInt16Number CacheOut[cmsMAXCHANNELS]; -} cmsFormatterInfo; +} _cmsCACHE; + + // Transformation typedef struct _cmstransform_struct { @@ -612,17 +568,13 @@ cmsFormatterFloat FromInputFloat; cmsFormatterFloat ToOutputFloat; - // 1-pixel cache (16 bits only) - cmsUInt16Number CacheIn[cmsMAXCHANNELS]; - cmsUInt16Number CacheOut[cmsMAXCHANNELS]; + // 1-pixel cache seed for zero as input (16 bits, read only) + _cmsCACHE Cache; - // Semaphor for cache - LCMS_RWLOCK_T rwlock; - - // A MPE LUT holding the full (optimized) transform + // A Pipeline holding the full (optimized) transform cmsPipeline* Lut; - // A MPE LUT holding the gamut check. It goes from the input space to bilevel + // A Pipeline holding the gamut check. It goes from the input space to bilevel cmsPipeline* GamutCheck; // Colorant tables @@ -645,6 +597,10 @@ // An id that uniquely identifies the running context. May be null. cmsContext ContextID; + // A user-defined pointer that can be used to store data for transform plug-ins + void* UserData; + _cmsFreeUserDataFn FreeUserData; + } _cmsTRANSFORM; // --------------------------------------------------------------------------------------------------
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2010 Marti Maria Saguer +// Copyright (c) 1998-2011 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -144,6 +144,7 @@ cmsContext ContextID; cmsUInt32Number UsedSpace; + cmsUInt32Number ReportedSize; char PhysicalFile[cmsMAX_PATH]; cmsUInt32Number (* Read)(struct _cms_io_handler* iohandler, void *Buffer, @@ -159,7 +160,7 @@ // Endianess adjust functions CMSAPI cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word); CMSAPI cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number Value); -CMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number QWord); +CMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord); // Helper IO functions CMSAPI cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n); @@ -175,7 +176,7 @@ CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n); CMSAPI cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n); CMSAPI cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n); -CMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number n); +CMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n); CMSAPI cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n); CMSAPI cmsBool CMSEXPORT _cmsWriteXYZNumber(cmsIOHANDLER* io, const cmsCIEXYZ* XYZ); CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, const cmsUInt16Number* Array); @@ -209,6 +210,11 @@ CMSAPI void CMSEXPORT _cmsEncodeDateTimeNumber(cmsDateTimeNumber *Dest, const struct tm *Source); CMSAPI void CMSEXPORT _cmsDecodeDateTimeNumber(const cmsDateTimeNumber *Source, struct tm *Dest); +//---------------------------------------------------------------------------------------------------------- + +// Shared callbacks for user data +typedef void (* _cmsFreeUserDataFn)(cmsContext ContextID, void* Data); +typedef void* (* _cmsDupUserDataFn)(cmsContext ContextID, const void* Data); //---------------------------------------------------------------------------------------------------------- @@ -224,6 +230,7 @@ #define cmsPluginRenderingIntentSig 0x696E7448 // 'intH' #define cmsPluginMultiProcessElementSig 0x6D706548 // 'mpeH' #define cmsPluginOptimizationSig 0x6F707448 // 'optH' +#define cmsPluginTransformSig 0x7A666D48 // 'xfmH' typedef struct _cmsPluginBaseStruct { @@ -414,8 +421,9 @@ void (* FreePtr)(struct _cms_typehandler_struct* self, void *Ptr); - // The calling thread - cmsContext ContextID; + // Additional parameters used by the calling thread + cmsContext ContextID; + cmsUInt32Number ICCVersion; } cmsTagTypeHandler; @@ -513,6 +521,39 @@ } cmsPluginMultiProcessElement; + +// Data kept in "Element" member of cmsStage + +// Curves +typedef struct { + cmsUInt32Number nCurves; + cmsToneCurve** TheCurves; + +} _cmsStageToneCurvesData; + +// Matrix +typedef struct { + cmsFloat64Number* Double; // floating point for the matrix + cmsFloat64Number* Offset; // The offset + +} _cmsStageMatrixData; + +// CLUT +typedef struct { + + union { // Can have only one of both representations at same time + cmsUInt16Number* T; // Points to the table 16 bits table + cmsFloat32Number* TFloat; // Points to the cmsFloat32Number table + + } Tab; + + cmsInterpParams* Params; + cmsUInt32Number nEntries; + cmsBool HasFloatValues; + +} _cmsStageCLutData; + + //---------------------------------------------------------------------------------------------------------- // Optimization. Using this plug-in, additional optimization strategies may be implemented. // The function should return TRUE if any optimization is done on the LUT, this terminates @@ -523,9 +564,6 @@ register cmsUInt16Number Out[], register const void* Data); -typedef void (* _cmsOPTfreeDataFn)(cmsContext ContextID, void* Data); -typedef void* (* _cmsOPTdupDataFn)(cmsContext ContextID, const void* Data); - typedef cmsBool (* _cmsOPToptimizeFn)(cmsPipeline** Lut, cmsUInt32Number Intent, @@ -539,8 +577,8 @@ CMSAPI void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut, _cmsOPTeval16Fn Eval16, void* PrivateData, - _cmsOPTfreeDataFn FreePrivateDataFn, - _cmsOPTdupDataFn DupPrivateDataFn); + _cmsFreeUserDataFn FreePrivateDataFn, + _cmsDupUserDataFn DupPrivateDataFn); typedef struct { cmsPluginBase base; @@ -551,6 +589,39 @@ } cmsPluginOptimization; //---------------------------------------------------------------------------------------------------------- +// Full xform +typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo, + const void* InputBuffer, + void* OutputBuffer, + cmsUInt32Number Size, + cmsUInt32Number Stride); + +typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform, + void** UserData, + _cmsFreeUserDataFn* FreePrivateDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + + +// Retrieve user data as specified by the factory +CMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn); +CMSAPI void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo); + + +// Retrieve formatters +CMSAPI void CMSEXPORT _cmsGetTransformFormatters16 (struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput); +CMSAPI void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput); + +typedef struct { + cmsPluginBase base; + + // Transform entry point + _cmsTransformFactory Factory; + +} cmsPluginTransform; + #ifndef CMS_USE_CPP_API # ifdef __cplusplus
--- a/src/share/native/sun/reflect/Reflection.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/share/native/sun/reflect/Reflection.c Fri Jun 21 15:46:14 2013 -0500 @@ -34,6 +34,14 @@ return JVM_GetCallerClass(env, 2); } +JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass0 +(JNIEnv *env, jclass unused, jint depth) +{ + // Until there is hotspot @CallerSensitive support, + // depth must always be 2 to get the immediate caller + return JVM_GetCallerClass(env, 2); +} + JNIEXPORT jint JNICALL Java_sun_reflect_Reflection_getClassAccessFlags (JNIEnv *env, jclass unused, jclass cls) {
--- a/src/solaris/native/sun/awt/fontpath.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/solaris/native/sun/awt/fontpath.c Fri Jun 21 15:46:14 2013 -0500 @@ -40,6 +40,7 @@ #include <jni.h> #include <jni_util.h> +#include <jvm_md.h> #include <sizecalc.h> #include <sun_font_FontManager.h> #ifndef HEADLESS
--- a/src/solaris/native/sun/awt/gtk2_interface.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/solaris/native/sun/awt/gtk2_interface.c Fri Jun 21 15:46:14 2013 -0500 @@ -28,6 +28,7 @@ #include <string.h> #include "gtk2_interface.h" #include "java_awt_Transparency.h" +#include "jvm_md.h" #include "sizecalc.h" #define MIN(a, b) (((a) < (b)) ? (a) : (b))
--- a/src/windows/bin/cmdtoargs.c Tue Jun 18 14:04:33 2013 +0100 +++ b/src/windows/bin/cmdtoargs.c Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -104,6 +104,11 @@ case ' ': case '\t': + if (prev == '\\') { + for (i = 0 ; i < slashes; i++) { + *dest++ = prev; + } + } if (quotes % 2 == 1) { *dest++ = ch; } else { @@ -591,6 +596,12 @@ // v->disable(); vectors[i++] = v; + v= new Vector(argv[0], "a b\\\\ d"); + v->add("a", FALSE); + v->add("b\\\\", FALSE); + v->add("d", FALSE); + vectors[i++] = v; + dotest(vectors); printf("All tests pass [%d]\n", i); doexit(0);
--- a/src/windows/classes/java/lang/ProcessImpl.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/windows/classes/java/lang/ProcessImpl.java Fri Jun 21 15:46:14 2013 -0500 @@ -37,6 +37,9 @@ import java.lang.ProcessBuilder.Redirect; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /* This class is for the exclusive use of ProcessBuilder.start() to * create new processes. @@ -144,6 +147,66 @@ } + private static class LazyPattern { + // Escape-support version: + // "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)"; + private static final Pattern PATTERN = + Pattern.compile("[^\\s\"]+|\"[^\"]*\""); + }; + + /* Parses the command string parameter into the executable name and + * program arguments. + * + * The command string is broken into tokens. The token separator is a space + * or quota character. The space inside quotation is not a token separator. + * There are no escape sequences. + */ + private static String[] getTokensFromCommand(String command) { + ArrayList<String> matchList = new ArrayList<>(8); + Matcher regexMatcher = LazyPattern.PATTERN.matcher(command); + while (regexMatcher.find()) + matchList.add(regexMatcher.group()); + return matchList.toArray(new String[matchList.size()]); + } + + private static String createCommandLine(boolean isCmdFile, + final String executablePath, + final String cmd[]) + { + StringBuilder cmdbuf = new StringBuilder(80); + + cmdbuf.append(executablePath); + + for (int i = 1; i < cmd.length; ++i) { + cmdbuf.append(' '); + String s = cmd[i]; + if (needsEscaping(isCmdFile, s)) { + cmdbuf.append('"'); + cmdbuf.append(s); + + // The code protects the [java.exe] and console command line + // parser, that interprets the [\"] combination as an escape + // sequence for the ["] char. + // http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + // + // If the argument is an FS path, doubling of the tail [\] + // char is not a problem for non-console applications. + // + // The [\"] sequence is not an escape sequence for the [cmd.exe] + // command line parser. The case of the [""] tail escape + // sequence could not be realized due to the argument validation + // procedure. + if (!isCmdFile && s.endsWith("\\")) { + cmdbuf.append('\\'); + } + cmdbuf.append('"'); + } else { + cmdbuf.append(s); + } + } + return cmdbuf.toString(); + } + // We guarantee the only command file execution for implicit [cmd.exe] run. // http://technet.microsoft.com/en-us/library/bb490954.aspx private static final char CMD_BAT_ESCAPE[] = {' ', '\t', '<', '>', '&', '|', '^'}; @@ -226,48 +289,89 @@ } + private boolean isShellFile(String executablePath) { + String upPath = executablePath.toUpperCase(); + return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); + } + + private String quoteString(String arg) { + StringBuilder argbuf = new StringBuilder(arg.length() + 2); + return argbuf.append('"').append(arg).append('"').toString(); + } + + private long handle = 0; private OutputStream stdin_stream; private InputStream stdout_stream; private InputStream stderr_stream; - private ProcessImpl(final String cmd[], + private ProcessImpl(String cmd[], final String envblock, final String path, final long[] stdHandles, final boolean redirectErrorStream) throws IOException { - // The [executablePath] is not quoted for any case. - String executablePath = getExecutablePath(cmd[0]); + String cmdstr; + SecurityManager security = System.getSecurityManager(); + boolean allowAmbigousCommands = false; + if (security == null) { + String value = System.getProperty("jdk.lang.Process.allowAmbigousCommands"); + if (value != null) + allowAmbigousCommands = !"false".equalsIgnoreCase(value); + } + if (allowAmbigousCommands) { + // Legacy mode. + + // Normalize path if possible. + String executablePath = new File(cmd[0]).getPath(); - // We need to extend the argument verification procedure - // to guarantee the only command file execution for implicit [cmd.exe] - // run. - String upPath = executablePath.toUpperCase(); - boolean isCmdFile = (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); + // No worry about internal and unpaired ["] . + if (needsEscaping(false, executablePath) ) + executablePath = quoteString(executablePath); - StringBuilder cmdbuf = new StringBuilder(80); + cmdstr = createCommandLine( + false, //legacy mode doesn't worry about extended verification + executablePath, + cmd); + } else { + String executablePath; + try { + executablePath = getExecutablePath(cmd[0]); + } catch (IllegalArgumentException e) { + // Workaround for the calls like + // Runtime.getRuntime().exec("\"C:\\Program Files\\foo\" bar") - // Quotation protects from interpretation of the [path] argument as - // start of longer path with spaces. Quotation has no influence to - // [.exe] extension heuristic. - cmdbuf.append('"'); - cmdbuf.append(executablePath); - cmdbuf.append('"'); + // No chance to avoid CMD/BAT injection, except to do the work + // right from the beginning. Otherwise we have too many corner + // cases from + // Runtime.getRuntime().exec(String[] cmd [, ...]) + // calls with internal ["] and escape sequences. + + // Restore original command line. + StringBuilder join = new StringBuilder(); + // terminal space in command line is ok + for (String s : cmd) + join.append(s).append(' '); - for (int i = 1; i < cmd.length; i++) { - cmdbuf.append(' '); - String s = cmd[i]; - if (needsEscaping(isCmdFile, s)) { - cmdbuf.append('"'); - cmdbuf.append(s); - cmdbuf.append('"'); - } else { - cmdbuf.append(s); + // Parse the command line again. + cmd = getTokensFromCommand(join.toString()); + executablePath = getExecutablePath(cmd[0]); + + // Check new executable name once more + if (security != null) + security.checkExec(executablePath); } + + // Quotation protects from interpretation of the [path] argument as + // start of longer path with spaces. Quotation has no influence to + // [.exe] extension heuristic. + cmdstr = createCommandLine( + // We need the extended verification procedure for CMD files. + isShellFile(executablePath), + quoteString(executablePath), + cmd); } - String cmdstr = cmdbuf.toString(); handle = create(cmdstr, envblock, path, stdHandles, redirectErrorStream);
--- a/src/windows/classes/java/net/DualStackPlainSocketImpl.java Tue Jun 18 14:04:33 2013 +0100 +++ b/src/windows/classes/java/net/DualStackPlainSocketImpl.java Fri Jun 21 15:46:14 2013 -0500 @@ -184,6 +184,13 @@ int optionValue = 0; switch(opt) { + case SO_REUSEADDR : + if (exclusiveBind) { + // SO_REUSEADDR emulated when using exclusive bind + isReuseAddress = on; + return; + } + // intentional fallthrough case TCP_NODELAY : case SO_OOBINLINE : case SO_REUSEADDR :
--- a/src/windows/native/sun/windows/awt_Component.cpp Tue Jun 18 14:04:33 2013 +0100 +++ b/src/windows/native/sun/windows/awt_Component.cpp Fri Jun 21 15:46:14 2013 -0500 @@ -6131,7 +6131,7 @@ RGNDATA *pRgnData = (RGNDATA *) SAFE_SIZE_STRUCT_ALLOC(safe_Malloc, sizeof(RGNDATAHEADER), sizeof(RECT_T), numrects); - memcpy(pRgnData + sizeof(RGNDATAHEADER), pRect, sizeof(RECT_T) * numrects); + memcpy((BYTE*)pRgnData + sizeof(RGNDATAHEADER), pRect, sizeof(RECT_T) * numrects); if (pRect != rects) { free(pRect); }
--- a/test/Makefile Tue Jun 18 14:04:33 2013 +0100 +++ b/test/Makefile Fri Jun 21 15:46:14 2013 -0500 @@ -512,7 +512,7 @@ JDK_ALL_TARGETS += jdk_misc jdk_misc: $(call TestDirs, \ demo/jvmti demo/zipfs javax/naming javax/script \ - javax/smartcardio javax/xml javax/xml/soap com/sun/jndi + javax/smartcardio javax/xml com/sun/jndi com/sun/org/glassfish \ com/sun/corba com/sun/xml sun/misc) $(call RunAgentvmBatch) @@ -561,7 +561,7 @@ # Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_security2 jdk_security2: $(call TestDirs, javax/crypto com/sun/crypto) - $(call RunOthervmBatch) + $(call RunAgentvmBatch) # Stable othervm testruns (minus items from PROBLEM_LIST) # Using samevm has serious problems with these tests @@ -571,7 +571,7 @@ com/sun/org/apache/xml/internal/security \ com/oracle/security/ucrypto) $(call SharedLibraryPermissions,sun/security) - $(call RunOthervmBatch) + $(call RunAgentvmBatch) # All security tests jdk_security: jdk_security1 jdk_security2 jdk_security3 @@ -835,17 +835,17 @@ # The jtjck.jar utility to use to run the tests JTJCK_JAR = $(JCK_HOME)/lib/jtjck.jar JTJCK_JAVA_ARGS = -XX:MaxPermSize=256m -Xmx512m -JTJCK_OPTIONS = -headless -v +JTJCK_OPTIONS = -headless -v # Default tests to run ifndef JCK_COMPILER_TESTS - JCK_COMPILER_TESTS = + JCK_COMPILER_TESTS = endif ifndef JCK_RUNTIME_TESTS - JCK_RUNTIME_TESTS = + JCK_RUNTIME_TESTS = endif ifndef JCK_DEVTOOLS_TESTS - JCK_DEVTOOLS_TESTS = + JCK_DEVTOOLS_TESTS = endif # Generic rule used to run jck tests @@ -871,14 +871,14 @@ _generic_jck_tests # JCK7 runtime tests -jck7runtime: +jck7runtime: $(MAKE) UNIQUE_DIR=$@ \ JCK_HOME=$(JCK7RUNTIME_HOME) \ TESTDIRS="$(JCK_RUNTIME_TESTS)" \ _generic_jck_tests # JCK7 devtools tests -jck7devtools: +jck7devtools: $(MAKE) UNIQUE_DIR=$@ \ JCK_HOME=$(JCK7DEVTOOLS_HOME) \ TESTDIRS="$(JCK_DEVTOOLS_TESTS)" \
--- a/test/ProblemList.txt Tue Jun 18 14:04:33 2013 +0100 +++ b/test/ProblemList.txt Fri Jun 21 15:46:14 2013 -0500 @@ -1,6 +1,6 @@ -########################################################################### +########################################################################## # -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 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 @@ -217,7 +217,7 @@ # Windows X64, java.lang.IllegalStateException javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all -# 7149181 +# 7149181 sun/management/jmxremote/startstop/JMXStartStopTest.sh generic-all ############################################################################ @@ -298,6 +298,11 @@ # 6962637 java/io/File/MaxPathLength.java windows-all +# 7162111 - these tests need to be updated to run headless +java/io/Serializable/resolveClass/deserializeButton/run.sh macosx-all +java/io/Serializable/serialver/classpath/run.sh macosx-all +java/io/Serializable/serialver/nested/run.sh macosx-all + ############################################################################ # jdk_nio @@ -320,152 +325,36 @@ # jdk_rmi -# Port already in use, fails on sparc, othervm -java/rmi/reliability/benchmark/runRmiBench.sh generic-all - -# Already in use port issues? othervm solaris -java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java generic-all -java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java generic-all - -java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java generic-all -java/rmi/transport/dgcDeadLock/TestImpl_Stub.java generic-all - -# Address already in use, othervm mode, solaris -java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java generic-all -java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java generic-all - -# Registry already running on port, solaris -java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java generic-all - -# Fails on Linux 32 and 64bit -server?, impl not garbage collected??? -java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all - # 7146541 java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java linux-all -# Times out on solaris sparc -java/rmi/server/RemoteServer/AddrInUse.java generic-all - -# Connection error on Windows i586 -server -# Also connection errors in othervm on Solaris 10 sparc, same port??? -sun/rmi/transport/tcp/DeadCachedConnection.java generic-all +# 7190106 +java/rmi/reliability/benchmark/runRmiBench.sh generic-all -# Connection errors in othervm on Solaris 10 sparc, same port??? -java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java generic-all -java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java generic-all -java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java generic-all -java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java generic-all -java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java generic-all -java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java generic-all -java/rmi/activation/Activatable/extLoadedImpl/ext.sh generic-all -java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java generic-all -java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java generic-all -java/rmi/activation/Activatable/nestedActivate/NestedActivate.java generic-all -java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java generic-all -java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java generic-all -java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java generic-all -java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java generic-all -java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java generic-all -java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java generic-all -java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java generic-all -java/rmi/reliability/juicer/AppleUserImpl.java generic-all -java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java generic-all -java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java generic-all -java/rmi/transport/handshakeTimeout/HandshakeTimeout.java generic-all -java/rmi/activation/Activatable/restartService/RestartService.java generic-all -java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java generic-all -java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java generic-all -java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java generic-all -java/rmi/activation/CommandEnvironment/SetChildEnv.java generic-all -java/rmi/registry/classPathCodebase/ClassPathCodebase.java generic-all -java/rmi/registry/reexport/Reexport.java generic-all -java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java generic-all -java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java generic-all -java/rmi/server/useCustomRef/UseCustomRef.java generic-all -java/rmi/transport/checkFQDN/CheckFQDN.java generic-all -java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java generic-all -java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java generic-all -java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java generic-all -java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all +# 7191877 +java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java generic-all -# 7142596 -java/rmi/transport/httpSocket/HttpSocketTest.java macosx-all +# 7195095 +sun/rmi/transport/proxy/EagerHttpFallback.java generic-all ############################################################################ # jdk_security -# Filed 6986868 -sun/security/tools/jarsigner/crl.sh generic-all - -# Filed 6951285, not sure how often this fails, last was Linux 64bit Fedora 9 -sun/security/krb5/auto/MaxRetries.java generic-all - -# Filed 6950930, fails on windows 32bit c1 and windows 64bit -sun/security/krb5/auto/IgnoreChannelBinding.java windows-all - -# Filed 6950931, failing on all windows systems -sun/security/tools/jarsigner/crl.sh windows-all - -# Filed 6950929, only seemed to fail on solaris sparcv9 (-d64) -# Failed on Linux -server 32bit too, making generic -sun/security/krb5/auto/BadKdc4.java generic-all - # Failing on Solaris i586, 3/9/2010, not a -samevm issue (jdk_security3) sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-i586 sun/security/pkcs11/ec/ReadCertificates.java solaris-i586 sun/security/pkcs11/ec/ReadPKCS12.java solaris-i586 sun/security/pkcs11/ec/TestCurves.java solaris-i586 sun/security/pkcs11/ec/TestECDSA.java solaris-i586 -sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586 -sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586 - -# Unknown problem, could be a jtreg -samevm issue? -# Error while cleaning up threads after test -java/security/Security/SynchronizedAccess.java generic-all - -# Failing on Solaris X64 (-d64 -server) with: -# GSSException: Failure unspecified at GSS-API level -# (Mechanism level: Specified version of key is not available (44)) -sun/security/krb5/auto/BasicKrb5Test.java generic-all - -# Solaris X86 failures, readjar.jks: No such file or directory -sun/security/tools/keytool/readjar.sh generic-all - -# Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out -sun/security/tools/keytool/standard.sh generic-all - -# Fails on Solaris 10 X64, address already in use -sun/security/krb5/auto/HttpNegotiateServer.java generic-all +#sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586 +#sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586 +sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java generic-all -# Fails on almost all platforms -# java.lang.UnsupportedClassVersionError: SerialTest : -# Unsupported major.minor version 51.0 -# at java.lang.ClassLoader.defineClass1(Native Method) -sun/security/util/Oid/S11N.sh generic-all - -# Fails on Fedora 9 32bit -# GSSException: Failure unspecified at GSS-API level (Mechanism level: -# Invalid argument (400) - Cannot find key of appropriate type to decrypt -# AP REP - DES CBC mode with MD5) -# at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778) -sun/security/krb5/auto/NonMutualSpnego.java generic-all +# Directly references PKCS11 class +sun/security/pkcs11/Provider/Absolute.java windows-x64 -# Fails on Solaris 10 sparc, GSSException: Failure unspecified at GSS-API level -# Also fails on Windows 2000 similar way -sun/security/krb5/auto/ok-as-delegate.sh generic-all - -# Fails on Windows 2000, GSSException: Failure unspecified at GSS-API level -# (Mechanism level: Request is a replay (34)) -sun/security/krb5/auto/ok-as-delegate-xrealm.sh generic-all - -# Fails on Windows 2000, ExceptionInInitializerError -sun/security/mscapi/AccessKeyStore.sh generic-all - -# Fails on Solaris 10, KrbException: Additional pre-authentication required (25) -sun/security/krb5/auto/basic.sh generic-all - -# Fails on Fedora 9 64bit, PKCS11Exception: CKR_DEVICE_ERROR +# Fails on Fedora 9/Ubuntu 10.04 64bit, PKCS11Exception: CKR_DEVICE_ERROR sun/security/pkcs11/KeyAgreement/TestDH.java generic-all # Run too slow on Solaris 10 sparc @@ -474,18 +363,10 @@ sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java solaris-sparc sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java solaris-sparc sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh solaris-sparc -sun/security/tools/keytool/AltProviderPath.sh solaris-sparc # Solaris 10 sparc, passed/failed confusion? java.security.ProviderException: update() failed sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java generic-all -# Seem really slow on Solaris sparc, being excluded just for timing reasons -sun/security/tools/jarsigner/AlgOptions.sh solaris-sparc -sun/security/tools/jarsigner/nameclash.sh solaris-sparc -sun/security/krb5/auto/basic.sh solaris-sparc -sun/security/provider/PolicyFile/getinstance/getinstance.sh solaris-sparc -sun/security/tools/jarsigner/samename.sh solaris-sparc - # Timed out, Solaris 10 64bit sparcv9 com/sun/crypto/provider/Cipher/DES/PaddingTest.java generic-all @@ -496,79 +377,19 @@ # Solaris sparc and sparcv9 -server, timeout sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java generic-all -# Failed on solaris 10 sparc, othervm mode, "js.jks: No such file or directory" -# Also, cannot verify signature on solaris i586 -server -sun/security/tools/jarsigner/concise_jarsigner.sh generic-all - # Various failures on Linux Fedora 9 X64, othervm mode sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/TestAllSuites.java generic-all sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java generic-all -sun/security/tools/jarsigner/oldsig.sh generic-all # Various failures on Linux Fedora 9 X64, othervm mode sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java generic-all -# Linux i586 -server, buffer too short to hold shared secret? -com/sun/crypto/provider/KeyAgreement/DHKeyAgreement2.java generic-all - -# Solaris sparcv9: Failed to parse input emptysubject.jks: No such file or directory -sun/security/tools/keytool/emptysubject.sh generic-all - -# Timeout on solaris-sparcv9 or exception thrown -com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java solaris-all - -# Leaving file open: SerialVersion.current, windows samevm -java/security/BasicPermission/SerialVersion.java generic-all - # Solaris 11 i586, these all fail with samevm, need to be othervm??? -java/security/BasicPermission/NullOrEmptyName.java generic-all - -# Suspect missing close() on file PermClass.current, windows samevm cascade -java/security/BasicPermission/PermClass.java generic-all - -# Solaris 11 i586, these all fail with samevm, need to be othervm??? -java/security/KeyPairGenerator/Failover.java generic-all -java/security/Provider/DefaultPKCS11.java generic-all java/security/SecureClassLoader/DefineClassByteBuffer.java generic-all -java/security/SecureRandom/GetAlgorithm.java generic-all -java/security/Security/removing/RemoveProviders.java generic-all -java/security/Signature/ByteBuffers.java generic-all -java/security/Signature/NONEwithRSA.java generic-all -java/security/Signature/SignWithOutputBuffer.java generic-all -java/security/Signature/TestInitSignWithMyOwnRandom.java generic-all -java/security/UnresolvedPermission/AccessorMethods.java generic-all -java/security/UnresolvedPermission/Equals.java generic-all - -# Fails on OpenSolaris, missing classes, slow on Solaris sparc -sun/security/ec/TestEC.java generic-all - -# Problems with windows x64 -sun/security/mscapi/IsSunMSCAPIAvailable.sh windows-x64 -sun/security/mscapi/RSAEncryptDecrypt.sh windows-x64 - -# Exception in test solaris-sparc -client -server, no windows -sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java solaris-all - -# Solaris sparc client, fails to compile? -sun/security/pkcs11/KeyStore/SecretKeysBasic.sh solaris-all - -# Fails on OpenSolaris java.net.BindException: Address already in use -sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java generic-all - -# Timeout on solaris-sparcv9 or ArrayIndexOutOfBoundsException? -sun/security/rsa/TestKeyPairGeneratorLength.java solaris-all -sun/security/rsa/TestSignatures.java solaris-all # Timeout on solaris-sparc and i586 and x64, -client and -server sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java solaris-all -# Do not seem to run on windows machines? dll missing? -sun/security/tools/jarsigner/emptymanifest.sh windows-all - -# Files does not exist or no encoding? solaris-sparcv9 -sun/security/tools/keytool/importreadall.sh solaris-all -sun/security/tools/keytool/selfissued.sh solaris-all - # 7147060 com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java generic-all @@ -606,12 +427,12 @@ sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all # 7162111 -sun/tools/jrunscript/jrunscript-DTest.sh macosx-all -sun/tools/jrunscript/jrunscript-argsTest.sh macosx-all -sun/tools/jrunscript/jrunscript-cpTest.sh macosx-all -sun/tools/jrunscript/jrunscript-eTest.sh macosx-all -sun/tools/jrunscript/jrunscript-fTest.sh macosx-all -sun/tools/jrunscript/jrunscriptTest.sh macosx-all +sun/tools/jrunscript/jrunscript-DTest.sh macosx-all +sun/tools/jrunscript/jrunscript-argsTest.sh macosx-all +sun/tools/jrunscript/jrunscript-cpTest.sh macosx-all +sun/tools/jrunscript/jrunscript-eTest.sh macosx-all +sun/tools/jrunscript/jrunscript-fTest.sh macosx-all +sun/tools/jrunscript/jrunscriptTest.sh macosx-all # 8001118 sun/tools/jcmd/jcmd-f.sh generic-all @@ -652,8 +473,8 @@ java/util/concurrent/locks/Lock/TimedAcquireLeak.java generic-all # 7162111 -java/util/ResourceBundle/Control/Bug6530694.java macosx-all -java/util/logging/LoggingDeadlock4.java macosx-all +java/util/ResourceBundle/Control/Bug6530694.java macosx-all +java/util/logging/LoggingDeadlock4.java macosx-all # 7041639, Solaris DSA keypair generation bug java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all
--- a/test/TEST.ROOT Tue Jun 18 14:04:33 2013 +0100 +++ b/test/TEST.ROOT Fri Jun 21 15:46:14 2013 -0500 @@ -10,3 +10,9 @@ # given to jtreg and the -samejvm argument is used, ignored otherwise # (meaning all tests are assumed to be same jvm safe). samejvmsafe=com/sun/crypto com/sun/management com/sun/media com/sun/security java/beans/beancontext java/beans/PropertyChangeSupport java/beans/Statement java/beans/VetoableChangeSupport java/lang/Boolean java/lang/Byte java/lang/Double java/lang/Float java/lang/Integer java/lang/Long java/lang/Short java/lang/Math java/lang/StrictMath java/lang/String java/lang/Throwable java/lang/instrument java/math java/net/URI java/net/URLDecoder java/net/URLEncoder java/nio/Buffer java/nio/ByteOrder java/nio/MappedByteBuffer java/nio/channels/Channels java/nio/channels/DatagramChannel java/nio/channels/spi java/security/cert java/security/Provider java/text java/util/jar java/util/zip java/util/Array java/util/BitSet java/util/Collection java/util/List javax/imageio javax/management/openmbean javax/rmi javax/sound sun/net/www/protocol sun/misc sun/nio sun/security/pkcs11 sun/security/rsa sun/util + +# Tests that must run in othervm mode +othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi + +# Tests that cannot run concurrently +exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
--- a/test/com/sun/crypto/provider/Cipher/DES/Sealtest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/crypto/provider/Cipher/DES/Sealtest.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 0000000 + * @bug 0000000 7055362 * @summary Sealtest * @author Jan Luehe */ @@ -54,14 +54,16 @@ SealedObject sealed = new SealedObject(kp.getPrivate(), c); // serialize - FileOutputStream fos = new FileOutputStream("sealed"); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(sealed); + try (FileOutputStream fos = new FileOutputStream("sealed"); + ObjectOutputStream oos = new ObjectOutputStream(fos)) { + oos.writeObject(sealed); + } // deserialize - FileInputStream fis = new FileInputStream("sealed"); - ObjectInputStream ois = new ObjectInputStream(fis); - sealed = (SealedObject)ois.readObject(); + try (FileInputStream fis = new FileInputStream("sealed"); + ObjectInputStream ois = new ObjectInputStream(fis)) { + sealed = (SealedObject)ois.readObject(); + } System.out.println(sealed.getAlgorithm());
--- a/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP_KAT.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4894151 + * @bug 4894151 7055362 * @summary known answer test for OAEP encryption * @author Andreas Sterbenz */ @@ -62,60 +62,62 @@ System.out.println("Testing provider " + provider.getName() + "..."); Cipher c = Cipher.getInstance("RSA/ECB/OAEPwithSHA1andMGF1Padding", provider); KeyFactory kf = KeyFactory.getInstance("RSA", kfProvider); - InputStream in = new FileInputStream(new File(BASE, "oaep-vect.txt")); - BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF8")); - while (true) { - String line = reader.readLine(); - if (line == null) { - break; - } - line = line.trim(); - if (line.length() == 0) { - continue; - } - if (line.equals("# RSA modulus n:")) { - n = parseNumber(reader); - } else if (line.equals("# RSA public exponent e:")) { - e = parseNumber(reader); - } else if (line.equals("# RSA private exponent d:")) { - d = parseNumber(reader); - } else if (line.equals("# Prime p:")) { - p = parseNumber(reader); - } else if (line.equals("# Prime q:")) { - q = parseNumber(reader); - } else if (line.equals("# p's CRT exponent dP:")) { - pe = parseNumber(reader); - } else if (line.equals("# q's CRT exponent dQ:")) { - qe = parseNumber(reader); - } else if (line.equals("# CRT coefficient qInv:")) { - coeff = parseNumber(reader); - } else if (line.equals("# Message to be encrypted:")) { - plainText = parseBytes(reader); - } else if (line.equals("# Seed:")) { - seed = parseBytes(reader); - } else if (line.equals("# Encryption:")) { - cipherText = parseBytes(reader); - // do encryption test first - KeySpec pubSpec = new RSAPublicKeySpec(n, e); - PublicKey pubKey = kf.generatePublic(pubSpec); - c.init(Cipher.ENCRYPT_MODE, pubKey, new MyRandom(seed)); - cipherText2 = c.doFinal(plainText); - if (Arrays.equals(cipherText2, cipherText) == false) { - throw new Exception("Encryption mismatch"); + try (InputStream in = new FileInputStream(new File(BASE, "oaep-vect.txt")); + BufferedReader reader = + new BufferedReader(new InputStreamReader(in, "UTF8"))) { + while (true) { + String line = reader.readLine(); + if (line == null) { + break; + } + line = line.trim(); + if (line.length() == 0) { + continue; } - // followed by decryption test - KeySpec privSpec = new RSAPrivateCrtKeySpec(n, e, d, p, q, pe, qe, coeff); - PrivateKey privKey = kf.generatePrivate(privSpec); - c.init(Cipher.DECRYPT_MODE, privKey); - byte[] dec = c.doFinal(cipherText); - if (Arrays.equals(plainText, dec) == false) { - throw new Exception("Decryption mismatch"); + if (line.equals("# RSA modulus n:")) { + n = parseNumber(reader); + } else if (line.equals("# RSA public exponent e:")) { + e = parseNumber(reader); + } else if (line.equals("# RSA private exponent d:")) { + d = parseNumber(reader); + } else if (line.equals("# Prime p:")) { + p = parseNumber(reader); + } else if (line.equals("# Prime q:")) { + q = parseNumber(reader); + } else if (line.equals("# p's CRT exponent dP:")) { + pe = parseNumber(reader); + } else if (line.equals("# q's CRT exponent dQ:")) { + qe = parseNumber(reader); + } else if (line.equals("# CRT coefficient qInv:")) { + coeff = parseNumber(reader); + } else if (line.equals("# Message to be encrypted:")) { + plainText = parseBytes(reader); + } else if (line.equals("# Seed:")) { + seed = parseBytes(reader); + } else if (line.equals("# Encryption:")) { + cipherText = parseBytes(reader); + // do encryption test first + KeySpec pubSpec = new RSAPublicKeySpec(n, e); + PublicKey pubKey = kf.generatePublic(pubSpec); + c.init(Cipher.ENCRYPT_MODE, pubKey, new MyRandom(seed)); + cipherText2 = c.doFinal(plainText); + if (Arrays.equals(cipherText2, cipherText) == false) { + throw new Exception("Encryption mismatch"); + } + // followed by decryption test + KeySpec privSpec = new RSAPrivateCrtKeySpec(n, e, d, p, q, pe, qe, coeff); + PrivateKey privKey = kf.generatePrivate(privSpec); + c.init(Cipher.DECRYPT_MODE, privKey); + byte[] dec = c.doFinal(cipherText); + if (Arrays.equals(plainText, dec) == false) { + throw new Exception("Decryption mismatch"); + } + } else if (line.startsWith("# ------------------------------")) { + // ignore, do not print + } else { + // unknown line (comment), print + System.out.println(": " + line); } - } else if (line.startsWith("# ------------------------------")) { - // ignore, do not print - } else { - // unknown line (comment), print - System.out.println(": " + line); } } long stop = System.currentTimeMillis();
--- a/test/com/sun/jdi/ShellScaffold.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/jdi/ShellScaffold.sh Fri Jun 21 15:46:14 2013 -0500 @@ -250,6 +250,7 @@ isCygwin= case "$osname" in Windows* | CYGWIN*) + devnull=NUL if [ "$osname" = Windows_98 -o "$osname" = Windows_ME ]; then isWin98=1 debuggeeKeyword='we_cant_kill_debuggees_on_win98' @@ -259,6 +260,7 @@ case "$osname" in CYGWIN*) isCygwin=1 + devnull=/dev/null ;; esac @@ -269,7 +271,6 @@ transport=dt_socket address= fi - devnull=NUL baseArgs="$baseArgs -XX:-ShowMessageBoxOnError" # jtreg puts \\s in TESTCLASSES and some uses, eg. echo # treat them as control chars on mks (eg \t is tab)
--- a/test/com/sun/jndi/rmi/registry/RegistryContext/ContextWithNullProperties.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/jndi/rmi/registry/RegistryContext/ContextWithNullProperties.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,8 +30,7 @@ * @run main ContextWithNullProperties */ -import com.sun.jndi.rmi.registry.RegistryContextsun.jndi.rmi.RegistryContext; -import java.rmi.RemoteException; +import com.sun.jndi.rmi.registry.RegistryContext; import java.rmi.registry.Registry; public class ContextWithNullProperties {
--- a/test/com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,6 +32,7 @@ */ import java.rmi.registry.Registry; +import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import javax.naming.NamingException;
--- a/test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java Fri Jun 21 15:46:14 2013 -0500 @@ -97,6 +97,7 @@ System.out.println("PASSED"); } else { System.out.println("FAILED"); + atLeastOneFailed = true; } } }
--- a/test/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -24,7 +24,7 @@ /** * @test * @author Sean Mullan - * @bug 6461674 + * @bug 6461674 8009217 * @compile -XDignore.symbol.file ClassLoaderTest.java MyTransform.java * @run main ClassLoaderTest * @summary Ensure Transform.register works with transform implementations @@ -43,13 +43,12 @@ public static void main(String[] args) throws Exception { - Transform.init(); File file = new File(BASE); URL[] urls = new URL[1]; urls[0] = file.toURI().toURL(); URLClassLoader ucl = new URLClassLoader(urls); - Class c = ucl.loadClass("MyTransform"); - Constructor cons = c.getConstructor(); + Class<?> c = ucl.loadClass("MyTransform"); + Constructor<?> cons = c.getConstructor(new Class[] {}); Object o = cons.newInstance(); // Apache code swallows the ClassNotFoundExc, so we need to // check if the Transform has already been registered by registering
--- a/test/com/sun/org/apache/xml/internal/security/transforms/MyTransform.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/org/apache/xml/internal/security/transforms/MyTransform.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -21,13 +21,8 @@ * questions. */ -import java.io.IOException; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.SAXException; -import com.sun.org.apache.xml.internal.security.c14n.*; -import com.sun.org.apache.xml.internal.security.exceptions.*; -import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; -import com.sun.org.apache.xml.internal.security.transforms.*; +import com.sun.org.apache.xml.internal.security.transforms.Transform; +import com.sun.org.apache.xml.internal.security.transforms.TransformSpi; public class MyTransform extends TransformSpi { @@ -37,21 +32,13 @@ public MyTransform() { try { System.out.println("Registering Transform"); - Transform.init(); Transform.register(URI, "MyTransform"); - } catch (AlgorithmAlreadyRegisteredException e) { - // should not occur, so ignore + } catch (Exception e) { + e.printStackTrace(); } } protected String engineGetURI() { return URI; } - - protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input) - throws IOException, CanonicalizationException, - InvalidCanonicalizerException, TransformationException, - ParserConfigurationException, SAXException { - throw new TransformationException("Unsupported Operation"); - } }
--- a/test/com/sun/security/auth/login/ConfigFile/IllegalURL.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/com/sun/security/auth/login/ConfigFile/IllegalURL.java Fri Jun 21 15:46:14 2013 -0500 @@ -43,8 +43,9 @@ static void use(String f) throws Exception { System.out.println("Testing " + f + "..."); System.setProperty("java.security.auth.login.config", f); - try { - new FileInputStream(new URL(f).getFile().replace('/', File.separatorChar)); + try (FileInputStream fis = + new FileInputStream(new URL(f).getFile().replace('/', File.separatorChar))) { + // do nothing } catch (Exception e) { System.out.println("Even old implementation does not support it. Ignored."); return;
--- a/test/demo/jvmti/mtrace/TraceJFrame.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/demo/jvmti/mtrace/TraceJFrame.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,21 +32,26 @@ * @run main TraceJFrame JFrameCreateTime */ -public class TraceJFrame { +import java.awt.GraphicsEnvironment; +public class TraceJFrame { public static void main(String args[]) throws Exception { - DemoRun demo; + if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { + System.out.println("JFrame test was skipped due to headless mode"); + } else { + DemoRun demo; - /* Run demo that uses JVMTI mtrace agent (no options) */ - demo = new DemoRun("mtrace", "" /* options to mtrace */ ); - demo.runit(args[0]); + /* Run demo that uses JVMTI mtrace agent (no options) */ + demo = new DemoRun("mtrace", "" /* options to mtrace */ ); + demo.runit(args[0]); - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); + /* Make sure patterns in output look ok */ + if (demo.output_contains("ERROR")) { + throw new RuntimeException("Test failed - ERROR seen in output"); + } + + /* Must be a pass. */ + System.out.println("Test passed - cleanly terminated"); } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; + +class AbsoluteComponentCenterCalculator { + private AbsoluteComponentCenterCalculator() { + } + + public static int calculateXCenterCoordinate(Component component) { + return (int) component.getLocationOnScreen().getX() + (component.getWidth() / 2); + } + + public static int calculateYCenterCoordinate(Component component) { + return (int) component.getLocationOnScreen().getY() + (component.getHeight() / 2); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/DataFlavorSearcher.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.FlavorTable; +import java.awt.datatransfer.SystemFlavorMap; +import java.util.Arrays; + +public class DataFlavorSearcher { + static public String[] HTML_NAMES = new String[]{"HTML", "HTML Format"}; + static public String[] RICH_TEXT_NAMES = new String[]{"RICH_TEXT", "Rich Text Format"}; + + static public DataFlavor getByteDataFlavorForNative(String[] nats) { + FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap(); + + for (String nat : nats) { + java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat); + for (DataFlavor flavor : flavors) { + if (flavor != null + && flavor.getRepresentationClass().equals(byte[].class)) { + return flavor; + } + } + } + throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats)); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +interface InterprocessMessages { + final static int EXECUTION_IS_SUCCESSFULL = 0; + final static int DATA_IS_CORRUPTED = 212; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,27 @@ +<html> +<!-- + + @test + @bug 8005932 + @summary Java 7 on mac os x only provides text clipboard formats + @author mikhail.cherkasov@oracle.com + @library ../../regtesthelpers + @library ../../regtesthelpers/process + @build Util + @build ProcessResults ProcessCommunicator + + + @run applet/othervm MissedHtmlAndRtfBug.html +*/> +<head> + <title>Java 7 on mac os x only provides text clipboard formats</title> +</head> +<body> + +<h1> MissedHtmlAndRtfBug <br>Bug ID: 8005932 </h1> + +<p> This is an AUTOMATIC test, simply wait for completion </p> + +<APPLET CODE="MissedHtmlAndRtfBug.class" WIDTH=200 HEIGHT=200></APPLET> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 8005932 + @summary Java 7 on mac os x only provides text clipboard formats + @author mikhail.cherkasov@oracle.com + @library ../../regtesthelpers + @library ../../regtesthelpers/process + @build Util + @build ProcessResults ProcessCommunicator + + + @run applet/othervm MissedHtmlAndRtfBug.html +*/ +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.event.*; +import java.applet.Applet; +import java.io.File; +import java.util.ArrayList; + +import test.java.awt.regtesthelpers.process.ProcessCommunicator; +import test.java.awt.regtesthelpers.process.ProcessResults; +import test.java.awt.regtesthelpers.Util; +import sun.awt.OSInfo; + +import static java.lang.Thread.sleep; + +public class MissedHtmlAndRtfBug extends Applet { + public void init() { + setLayout(new BorderLayout()); + }//End init() + + public void start() { + if (OSInfo.getOSType() != OSInfo.OSType.MACOSX + && OSInfo.getOSType() != OSInfo.OSType.WINDOWS) { + System.out.println("This test is for Windows and Mac only. Passed."); + return; + } + + final Frame sourceFrame = new Frame("Source frame"); + final SourcePanel sourcePanel = new SourcePanel(); + sourceFrame.add(sourcePanel); + sourceFrame.pack(); + sourceFrame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + sourceFrame.dispose(); + } + }); + sourceFrame.setVisible(true); + + Util.waitForIdle(null); + + NextFramePositionCalculator positionCalculator = new NextFramePositionCalculator(sourceFrame); + + ArrayList<String> args = new ArrayList<String>(5); + args.add(String.valueOf(positionCalculator.getNextLocationX())); + args.add(String.valueOf(positionCalculator.getNextLocationY())); + args.add(String.valueOf(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(sourcePanel))); + args.add(String.valueOf(AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(sourcePanel))); + args.add(concatStrings(DataFlavorSearcher.RICH_TEXT_NAMES)); + + ProcessResults processResults = +// ProcessCommunicator.executeChildProcess(this.getClass(), "/Users/mcherkasov/ws/clipboard/DataFlover/out/production/DataFlover" + +// " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 ", +// args.toArray(new String[0])); + ProcessCommunicator.executeChildProcess(this.getClass(), + "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{})); + + verifyTestResults(processResults); + + args.set(args.size() - 1, concatStrings(DataFlavorSearcher.HTML_NAMES)); + + ProcessCommunicator.executeChildProcess(this.getClass(), + "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{})); + verifyTestResults(processResults); + + + }// start() + + private String concatStrings(String[] strings) { + StringBuffer result = new StringBuffer("\""); + for (int i = 0; i < strings.length; i++) { + result.append(strings[i]); + result.append(","); + } + result.append("\""); + return result.toString(); + } + + + private static void verifyTestResults(ProcessResults processResults) { + if (InterprocessMessages.DATA_IS_CORRUPTED == + processResults.getExitValue()) { + processResults.printProcessErrorOutput(System.err); + throw new RuntimeException("TEST IS FAILED: Target has received" + + " corrupted data."); + } + processResults.verifyStdErr(System.err); + processResults.verifyProcessExitValue(System.err); + processResults.printProcessStandartOutput(System.out); + } + + //We cannot make an instance of the applet without the default constructor + public MissedHtmlAndRtfBug() { + super(); + } + + //We need in this constructor to pass frame position between JVMs + public MissedHtmlAndRtfBug(Point targetFrameLocation, Point dragSourcePoint, DataFlavor df) + throws InterruptedException { + final Frame targetFrame = new Frame("Target frame"); + final TargetPanel targetPanel = new TargetPanel(targetFrame, df); + targetFrame.add(targetPanel); + targetFrame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + targetFrame.dispose(); + } + }); + targetFrame.setLocation(targetFrameLocation); + targetFrame.pack(); + targetFrame.setVisible(true); + + doTest(dragSourcePoint, targetPanel); + } + + private void doTest(Point dragSourcePoint, TargetPanel targetPanel) { + Util.waitForIdle(null); + + final Robot robot = Util.createRobot(); + + robot.mouseMove((int) dragSourcePoint.getX(), (int) dragSourcePoint.getY()); + try { + sleep(100); + robot.mousePress(InputEvent.BUTTON1_MASK); + sleep(100); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + Util.drag(robot, dragSourcePoint, new Point(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel), + AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)), + InputEvent.BUTTON1_MASK); + } + + + enum InterprocessArguments { + TARGET_FRAME_X_POSITION_ARGUMENT, + TARGET_FRAME_Y_POSITION_ARGUMENT, + DRAG_SOURCE_POINT_X_ARGUMENT, + DRAG_SOURCE_POINT_Y_ARGUMENT, + DATA_FLAVOR_NAMES; + + int extractInt(String[] args) { + return Integer.parseInt(args[this.ordinal()]); + } + + String[] extractStringArray(String[] args) { + return args[this.ordinal()].replaceAll("\"", "").split(","); + } + } + + public static void main(String[] args) { + Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extractInt(args), + InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extractInt(args)); + Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extractInt(args), + InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extractInt(args)); + String[] names = InterprocessArguments.DATA_FLAVOR_NAMES.extractStringArray(args); + + DataFlavor df = DataFlavorSearcher.getByteDataFlavorForNative(names); + try { + new MissedHtmlAndRtfBug(targetFrameLocation, dragSourcePoint, df); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MyTransferable.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.datatransfer.*; +import java.io.IOException; + +class MyTransferable implements Transferable { + + public static final String TEST_DATA = "<b>Test</b>"; + private DataFlavor[] dataFlavors; + + public MyTransferable() { + dataFlavors = new DataFlavor[]{DataFlavorSearcher.getByteDataFlavorForNative(DataFlavorSearcher.HTML_NAMES), + DataFlavorSearcher.getByteDataFlavorForNative(DataFlavorSearcher.RICH_TEXT_NAMES)}; + } + + + @Override + public DataFlavor[] getTransferDataFlavors() { + return dataFlavors; + } + + @Override + public boolean isDataFlavorSupported(DataFlavor flavor) { + for (DataFlavor f : dataFlavors) { + if (f.equals(flavor)) { + return true; + } + } + return false; + } + + @Override + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + if (isDataFlavorSupported(flavor)) { + return TEST_DATA.getBytes("UTF-16"); + } else { + throw new UnsupportedFlavorException(flavor); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/NextFramePositionCalculator.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,20 @@ +import java.awt.*; + + +class NextFramePositionCalculator { + + private final Frame currentFrame; + + public NextFramePositionCalculator(Frame currentFrame) { + this.currentFrame = currentFrame; + } + + public int getNextLocationX() { + return currentFrame.getX() + currentFrame.getWidth(); + } + + public int getNextLocationY() { + return currentFrame.getY(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/SourcePanel.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,26 @@ +import java.awt.dnd.DragSource; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.*; + +public class SourcePanel extends Panel { + + private final MyDragGestureListener dragGestureListener = + new MyDragGestureListener(); + + public SourcePanel() { + setPreferredSize(new Dimension(200, 200)); + DragSource defaultDragSource = + DragSource.getDefaultDragSource(); + defaultDragSource.createDefaultDragGestureRecognizer(this, + DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); + setBackground(Color.RED); + } + + private class MyDragGestureListener implements DragGestureListener { + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, new MyTransferable()); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/TargetPanel.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,83 @@ +import java.awt.datatransfer.Transferable; +import java.awt.dnd.*; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import java.util.Timer; +import java.util.TimerTask; + +public class TargetPanel extends Panel implements DropTargetListener { + + + //private final CustomDropTargetListener dropTargetListener = new CustomDropTargetListener(); + + private Frame frame; + DataFlavor dataFlavor; + + public TargetPanel(Frame frame, DataFlavor dataFlavor) { + this.dataFlavor = dataFlavor; + this.frame = frame; + setBackground(Color.DARK_GRAY); + setPreferredSize(new Dimension(200, 200)); + setDropTarget(new DropTarget(this, this)); + } + + public void dragEnter(DropTargetDragEvent dtde) { + if (dtde.isDataFlavorSupported(dataFlavor)) { + dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); + } + } + + public void dragOver(DropTargetDragEvent dtde) { + if (dtde.isDataFlavorSupported(dataFlavor)) { + dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); + } + } + + public void dropActionChanged(DropTargetDragEvent dtde) { + if (dtde.isDataFlavorSupported(dataFlavor)) { + dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); + } + } + + public void dragExit(DropTargetEvent dte) { + + } + + public void drop(DropTargetDropEvent dtde) { + dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); + if (dtde.isDataFlavorSupported(dataFlavor)) { + String result = null; + try { + Transferable t = dtde.getTransferable(); + byte[] data = (byte[]) dtde.getTransferable().getTransferData(dataFlavor); + result = new String(data, "UTF-16"); + repaint(); + } catch (UnsupportedFlavorException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + dtde.dropComplete(true); + + + if (result != null && result.contains(MyTransferable.TEST_DATA)) { + System.err.println(InterprocessMessages.EXECUTION_IS_SUCCESSFULL); + Timer t = new Timer(); + t.schedule(new TimerTask() { + @Override + public void run() { + System.exit(0); + } + }, 2000); + return; + + } + } + dtde.rejectDrop(); + System.err.println(InterprocessMessages.DATA_IS_CORRUPTED); + System.exit(InterprocessMessages.DATA_IS_CORRUPTED); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6385277 + * @summary Tests that override redirect window gets activated on click. + * @author anton.tarasov@sun.com: area=awt.focus + * @library ../../regtesthelpers + * @build Util + * @run main OverrideRedirectWindowActivationTest + */ +import java.awt.*; +import java.awt.event.*; +import java.util.concurrent.Callable; +import javax.swing.SwingUtilities; +import sun.awt.SunToolkit; +import test.java.awt.regtesthelpers.Util; + +public class OverrideRedirectWindowActivationTest { + + private static Frame frame; + private static Window window; + private static Button fbutton; + private static Button wbutton; + private static Label label; + private static Robot robot; + private static SunToolkit toolkit; + + public static void main(String[] args) throws Exception { + + if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) { + System.out.println("No testing on Motif. Test passed."); + return; + } + + toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + robot = new Robot(); + robot.setAutoDelay(50); + + Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { + + public void eventDispatched(AWTEvent e) { + System.out.println(e); + } + }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK); + + createAndShowWindow(); + toolkit.realSync(); + + createAndShowFrame(); + toolkit.realSync(); + + // click on Frame + clickOn(getClickPoint(frame)); + + if (!frame.isFocused()) { + throw new RuntimeException("Error: a frame couldn't be focused by click."); + } + + //click on Label in Window + clickOn(getClickPoint(label)); + + if (!window.isFocused()) { + throw new RuntimeException("Test failed: the window couldn't be activated by click!"); + } + + // bring focus back to the frame + clickOn(getClickPoint(fbutton)); + + if (!frame.isFocused()) { + throw new RuntimeException("Error: a frame couldn't be focused by click."); + } + + // Test 2. Verifies that clicking on a component of unfocusable Window + // won't activate it. + + window.setFocusableWindowState(false); + toolkit.realSync(); + + + clickOn(getClickPoint(label)); + + if (window.isFocused()) { + throw new RuntimeException("Test failed: unfocusable window got activated by click!"); + } + System.out.println("Test passed."); + + } + + private static void createAndShowWindow() { + + frame = new Frame("Test Frame"); + window = new Window(frame); + wbutton = new Button("wbutton"); + label = new Label("label"); + + window.setBounds(800, 200, 200, 100); + window.setLayout(new FlowLayout()); + window.add(wbutton); + window.add(label); + window.setVisible(true); + + } + + private static void createAndShowFrame() { + fbutton = new Button("fbutton"); + + frame.setBounds(800, 0, 200, 100); + frame.setLayout(new FlowLayout()); + frame.add(fbutton); + frame.setVisible(true); + + } + + static void clickOn(Point point) { + + robot.mouseMove(point.x, point.y); + + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + } + + static Point getClickPoint(Component c) { + Point p = c.getLocationOnScreen(); + Dimension d = c.getSize(); + return new Point(p.x + (int) (d.getWidth() / 2), p.y + (int) (d.getHeight() / 2)); + } + + static Point getClickPoint(Frame frame) { + Point p = frame.getLocationOnScreen(); + Dimension d = frame.getSize(); + return new Point(p.x + (int) (d.getWidth() / 2), p.y + (frame.getInsets().top / 2)); + } +}
--- a/test/java/awt/Frame/WindowDragTest/WindowDragTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/awt/Frame/WindowDragTest/WindowDragTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -23,10 +23,11 @@ /* @test - @bug 7128738 + @bug 7128738 7161759 @summary dragged dialog freezes system on dispose @author Oleg Pekhovskiy: area=awt.toplevel @library ../../regtesthelpers + @build Util @run main WindowDragTest */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Modal/ModalDialogMultiscreenTest/ModalDialogMultiscreenTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 6430802 8008379 + @summary WM should not hang after show()/close() + @author anthony.petrov@sun.com: area=awt.modal + @run main/manual ModalDialogMultiscreenTest +*/ + + +/** + * ModalDialogMultiscreenTest.java + * + * summary: Tests whether a WM will hang on show()/close() a modal dialog in multiscreen mode + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + + +public class ModalDialogMultiscreenTest +{ + + private static class ButtonActionListener implements ActionListener { + JFrame frame; + JDialog dialog; + public ButtonActionListener(JFrame frame, JDialog dialog) { + this.frame = frame; + this.dialog = dialog; + } + public void actionPerformed(ActionEvent e) { + dialog.setLocationRelativeTo(frame); + dialog.setVisible(true); + } + } + public static class TestDialog extends JDialog { + public TestDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) { + super(owner, title, modal, gc); + setSize(200, 100); + JButton button = new JButton("Close"); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + dispose(); + } + }); + getContentPane().add(button); + } + } + + private static void init() + { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gs = ge.getScreenDevices(); + + Sysout.createDialog( ); + + if (gs.length < 2) { + System.out.println("Not multi-head environment, test not valid!"); + ModalDialogMultiscreenTest.pass( ); + } + + String[] instructions = + { + "The test should be run on a multi-head X (non-xinerama) systems.", + "Otherwise click the Pass button right now.", + "You will see an open Frame on each screen your system has.", + "The frame has an 'Open dialog' button.", + "Clicking the button opens a modal dialog with a Close button.", + "The test procedure:", + "1. Open a dialog and close it with appropriate buttons.", + "2. Switch to another screen ($ DISPLAY=X.Y xprop)", + "3. Repeat steps 1-2 several times (about 3*<number-of-screens>)", + "If the test doesn't cause the window manager to hang, it's passed." + }; + Sysout.printInstructions( instructions ); + + + for (int i = 0; i < gs.length; i++) { + JFrame frame = new JFrame("Frame "+i,gs[i].getDefaultConfiguration()); + JButton button = new JButton("Open Dialog"); + button.setMinimumSize(new Dimension(200, 100)); + button.setPreferredSize(new Dimension(200, 100)); + button.setSize(new Dimension(200, 100)); + button.addActionListener(new ButtonActionListener(frame, new TestDialog(frame, "Dialog #"+i, true, gs[i].getDefaultConfiguration()))); + frame.getContentPane().add(button); + frame.pack(); + frame.setVisible(true); + } + + }//End init() + + + //ap203012: NO MORE CHANGES BELOW THIS LINE + + + + /***************************************************** + * Standard Test Machinery Section + * DO NOT modify anything in this section -- it's a + * standard chunk of code which has all of the + * synchronisation necessary for the test harness. + * By keeping it the same in all tests, it is easier + * to read and understand someone else's test, as + * well as insuring that all tests behave correctly + * with the test harness. + * There is a section following this for test-defined + * classes + ******************************************************/ + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + + private static Thread mainThread = null; + + private static int sleepTime = 300000; + + public static void main( String args[] ) throws InterruptedException + { + mainThread = Thread.currentThread(); + try + { + init(); + } + catch( TestPassedException e ) + { + //The test passed, so just return from main and harness will + // interepret this return as a pass + return; + } + //At this point, neither test passed nor test failed has been + // called -- either would have thrown an exception and ended the + // test, so we know we have multiple threads. + + //Test involves other threads, so sleep and wait for them to + // called pass() or fail() + try + { + Thread.sleep( sleepTime ); + //Timed out, so fail the test + throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" ); + } + catch (InterruptedException e) + { + if( ! testGeneratedInterrupt ) throw e; + + //reset flag in case hit this code more than once for some reason (just safety) + testGeneratedInterrupt = false; + if ( theTestPassed == false ) + { + throw new RuntimeException( failureMessage ); + } + } + + }//main + + public static synchronized void setTimeoutTo( int seconds ) + { + sleepTime = seconds * 1000; + } + + public static synchronized void pass() + { + Sysout.println( "The test passed." ); + Sysout.println( "The test is over, hit Ctl-C to stop Java VM" ); + //first check if this is executing in main thread + if ( mainThread == Thread.currentThread() ) + { + //Still in the main thread, so set the flag just for kicks, + // and throw a test passed exception which will be caught + // and end the test. + theTestPassed = true; + throw new TestPassedException(); + } + //pass was called from a different thread, so set the flag and interrupt + // the main thead. + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + }//pass() + + public static synchronized void fail() + { + //test writer didn't specify why test failed, so give generic + fail( "it just plain failed! :-)" ); + } + + public static synchronized void fail( String whyFailed ) + { + Sysout.println( "The test failed: " + whyFailed ); + Sysout.println( "The test is over, hit Ctl-C to stop Java VM" ); + //check if this called from main thread + if ( mainThread == Thread.currentThread() ) + { + //If main thread, fail now 'cause not sleeping + throw new RuntimeException( whyFailed ); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + }//fail() + +}// class ModalDialogMultiscreenTest + +//This exception is used to exit from any level of call nesting +// when it's determined that the test has passed, and immediately +// end the test. +class TestPassedException extends RuntimeException +{ +} + +//*********** End Standard Test Machinery Section ********** + + +//************ Begin classes defined for the test **************** + +// make listeners in a class defined here, and instantiate them in init() + +/* Example of a class which may be written as part of a test +class NewClass implements anInterface + { + static int newVar = 0; + + public void eventDispatched(AWTEvent e) + { + //Counting events to see if we get enough + eventCount++; + + if( eventCount == 20 ) + { + //got enough events, so pass + + ModalDialogMultiscreenTest.pass(); + } + else if( tries == 20 ) + { + //tried too many times without getting enough events so fail + + ModalDialogMultiscreenTest.fail(); + } + + }// eventDispatched() + + }// NewClass class + +*/ + + +//************** End classes defined for the test ******************* + + + + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout +{ + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.setVisible(true); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } + +}// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog implements ActionListener +{ + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + Panel buttonP = new Panel(); + Button passB = new Button( "pass" ); + Button failB = new Button( "fail" ); + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("Center", messageText); + + passB = new Button( "pass" ); + passB.setActionCommand( "pass" ); + passB.addActionListener( this ); + buttonP.add( "East", passB ); + + failB = new Button( "fail" ); + failB.setActionCommand( "fail" ); + failB.addActionListener( this ); + buttonP.add( "West", failB ); + + add( "South", buttonP ); + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + System.out.println(messageIn); + } + + //catch presses of the passed and failed buttons. + //simply call the standard pass() or fail() static methods of + //ModalDialogMultiscreenTest + public void actionPerformed( ActionEvent e ) + { + if( e.getActionCommand() == "pass" ) + { + ModalDialogMultiscreenTest.pass(); + } + else + { + ModalDialogMultiscreenTest.fail(); + } + } + +}// TestDialog class
--- a/test/java/awt/Modal/WsDisabledStyle/Winkey/Winkey.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/awt/Modal/WsDisabledStyle/Winkey/Winkey.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,8 +22,8 @@ */ /* - @test %I% %E% - @bug 6572263 6571808 + @test + @bug 6572263 6571808 8005920 @summary PIT:FileDialog minimized to taskbar(through 'Show Desktop')selecting the fileDialog using windowList @author dmitry.cherepanov: area=awt.modal @run main/manual Winkey @@ -48,12 +48,14 @@ String[] instructions = { + " 0. This test is for MS Windows only, if you use other OS, press \"pass\" button.", " 1. there is a frame with a 'show modal' button, ", " 2. press the button to show a modal dialog, ", " 3. the modal dialog will be shown over the frame, ", " 4. please verify that all (5.1, 5.2.1, 5.2.2) the following tests pass: ", " ", " 5.1. press combination Windows Key and M key to minimize all windows, ", + " note that the modal dialog and modal blocked windows are NOT minimized", " 5.2. press combination Windows Key and D key to show desktop, ", " 5.2.1. restore the dialog by choosing this one in the ALT-TAB list, ", " 5.2.2. restore the dialog by mouse click on taskbar (on java or any other item)",
--- a/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ #Call this from anywhere to fail the test with an error message # usage: fail "reason why the test failed" -fail() +fail() { echo "The test failed :-(" echo "$*" 1>&2 echo "exit status was $status" @@ -48,7 +48,7 @@ #Call this from anywhere to pass the test with a message # usage: pass "reason why the test passed if applicable" -pass() +pass() { echo "The test passed!!!" echo "$*" 1>&2 exit 0 @@ -64,20 +64,42 @@ case "$OS" in SunOS ) VAR="One value for Sun" - DEFAULT_JDK=/usr/local/java/jdk1.2/solaris + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; Linux ) VAR="A different value for Linux" - DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + + Darwin ) + VAR="A different value for MacOSX" + DEFAULT_JDK=/usr + FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME ) + Windows* ) VAR="A different value for Win32" - DEFAULT_JDK=/usr/local/java/jdk1.2/win32 + DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" FILESEP="\\" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` + ;; + + CYGWIN* ) + VAR="A different value for Cygwin" + DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" + FILESEP="/" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; # catch all other OSs @@ -88,8 +110,8 @@ esac -# Want this test to run standalone as well as in the harness, so do the -# following to copy the test's directory into the harness's scratch directory +# Want this test to run standalone as well as in the harness, so do the +# following to copy the test's directory into the harness's scratch directory # and set all appropriate variables: if [ -z "${TESTJAVA}" ] ; then @@ -104,7 +126,7 @@ if [ -n "$1" ] ; then TESTJAVA=$1 else echo "no JDK specified on command line so using default!" - TESTJAVA=$DEFAULT_JDK + TESTJAVA=$DEFAULT_JDK fi TESTSRC=. TESTCLASSES=. @@ -113,25 +135,25 @@ echo "JDK under test is: $TESTJAVA" #Deal with .class files: -if [ -n "${STANDALONE}" ] ; - then +if [ -n "${STANDALONE}" ] ; + then #if standalone, remind user to cd to dir. containing test before running it echo "Just a reminder: cd to the dir containing this test when running it" # then compile all .java files (if there are any) into .class files - if [ -a *.java ] ; + if [ -a *.java ] ; then echo "Reminder, this test should be in its own directory with all" echo "supporting files it needs in the directory with it." - ${TESTJAVA}/bin/javac ./*.java ; + ${TESTJAVA}/bin/javac ./*.java ; fi # else in harness so copy all the class files from where jtreg put them - # over to the scratch directory this test is running in. + # over to the scratch directory this test is running in. else cp ${TESTCLASSES}/*.class . ; fi -#if in test harness, then copy the entire directory that the test is in over +#if in test harness, then copy the entire directory that the test is in over # to the scratch directory. This catches any support files needed by the test. -if [ -z "${STANDALONE}" ] ; - then cp ${TESTSRC}/* . +if [ -z "${STANDALONE}" ] ; + then cp ${TESTSRC}/* . fi #Just before executing anything, make sure it has executable permission!
--- a/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ #Call this from anywhere to fail the test with an error message # usage: fail "reason why the test failed" -fail() +fail() { echo "The test failed :-(" echo "$*" 1>&2 echo "exit status was $status" @@ -47,7 +47,7 @@ #Call this from anywhere to pass the test with a message # usage: pass "reason why the test passed if applicable" -pass() +pass() { echo "The test passed!!!" echo "$*" 1>&2 exit 0 @@ -99,20 +99,42 @@ case "$OS" in SunOS ) VAR="One value for Sun" - DEFAULT_JDK=/usr/local/java/jdk1.2.1/solaris + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; Linux ) VAR="A different value for Linux" - DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + + Darwin ) + VAR="A different value for MacOSX" + DEFAULT_JDK=/usr + FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN_NT-5.1) + Windows* ) VAR="A different value for Win32" - DEFAULT_JDK=/usr/local/java/jdk1.2.1/win32 + DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" FILESEP="\\" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` + ;; + + CYGWIN* ) + VAR="A different value for Cygwin" + DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" + FILESEP="/" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; # catch all other OSs @@ -132,12 +154,12 @@ # note that the name of the executable is in the fail string as well. # this is how to check for presence of the compiler, etc. #RESOURCE=`whence SomeProgramOrFileNeeded` -#if [ "${RESOURCE}" = "" ] ; -# then fail "Need SomeProgramOrFileNeeded to perform the test" ; +#if [ "${RESOURCE}" = "" ] ; +# then fail "Need SomeProgramOrFileNeeded to perform the test" ; #fi -# Want this test to run standalone as well as in the harness, so do the -# following to copy the test's directory into the harness's scratch directory +# Want this test to run standalone as well as in the harness, so do the +# following to copy the test's directory into the harness's scratch directory # and set all appropriate variables: if [ -z "${TESTJAVA}" ] ; then @@ -152,7 +174,7 @@ if [ -n "$1" ] ; then TESTJAVA=$1 else echo "no JDK specified on command line so using default!" - TESTJAVA=$DEFAULT_JDK + TESTJAVA=$DEFAULT_JDK fi TESTSRC=. TESTCLASSES=. @@ -161,25 +183,25 @@ echo "JDK under test is: $TESTJAVA" #Deal with .class files: -if [ -n "${STANDALONE}" ] ; - then +if [ -n "${STANDALONE}" ] ; + then #if standalone, remind user to cd to dir. containing test before running it echo "Just a reminder: cd to the dir containing this test when running it" # then compile all .java files (if there are any) into .class files - if [ -a *.java ] ; + if [ -a *.java ] ; then echo "Reminder, this test should be in its own directory with all" echo "supporting files it needs in the directory with it." - ${TESTJAVA}/bin/javac ./*.java ; + ${TESTJAVA}/bin/javac ./*.java ; fi # else in harness so copy all the class files from where jtreg put them - # over to the scratch directory this test is running in. + # over to the scratch directory this test is running in. else cp ${TESTCLASSES}/*.class . ; fi -#if in test harness, then copy the entire directory that the test is in over +#if in test harness, then copy the entire directory that the test is in over # to the scratch directory. This catches any support files needed by the test. -#if [ -z "${STANDALONE}" ] ; -# then cp ${TESTSRC}/* . +#if [ -z "${STANDALONE}" ] ; +# then cp ${TESTSRC}/* . #fi #Just before executing anything, make sure it has executable permission! @@ -198,7 +220,7 @@ # this shell test as appropriate ( 0 status is considered a pass here ) # The test verifies that appletviewer correctly works with the different -# names of the files, including relative and absolute paths +# names of the files, including relative and absolute paths # 6619458: exclude left brace from the name of the files managed by the VCS NAME='test.html'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.html Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,22 @@ +<html> +<!-- + @test + @bug 8010009 + @summary [macosx] Unable type into online word games on MacOSX + @author petr.pchelko : area=awt.keyboard + @run clean * + @run build TestApplet + @run applet/manual=yesno KeyReleasedInAppletTest.html + --> +<head> +<title>KeyReleasedInAppletTest </title> +</head> +<body> + +<h1>KeyReleasedInAppletTest<br>Bug ID:8010009 </h1> + +<p> See the dialog box (usually in upper left corner) for instructions</p> + +<APPLET CODE="KeyReleasedInAppletTest.class" WIDTH=200 HEIGHT=200></APPLET> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.*; +import javax.swing.JLabel; +import javax.swing.JTextArea; +import java.awt.*; +import java.awt.FileDialog; +import java.awt.Label; +import java.awt.event.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.io.FileWriter; +import java.lang.*; +import java.lang.Override; +import java.lang.String; +import java.lang.System; +import java.lang.Throwable; +import java.util.Hashtable; + +/* +@test +@bug 8010009 +@summary [macosx] Unable type into online word games on MacOSX +@author petr.pchelko : area=awt.keyboard +@run clean * +@run build TestApplet +@run applet/manual=yesno KeyReleasedInAppletTest.html +*/ + +public class KeyReleasedInAppletTest extends JApplet { + private static final String TEST_HTML_NAME = "TestApplet.html"; + + public void init() { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + this.setLayout(new BorderLayout()); + + try { + String testFilePath = System.getProperty("test.classes"); + FileWriter testHTML = null; + try { + testHTML = new FileWriter(testFilePath + "/" + TEST_HTML_NAME); + testHTML.write("<html>\n" + + "<head>\n" + + "<title>KeyReleasedInAppletTest </title>\n" + + "</head>\n" + + "<body>\n" + + "<h1>KeyReleasedInAppletTest<br>Bug ID:8010009 </h1>\n" + + "<p>Make sure the applet is focuced and type any character on the keyboard. <br>"+ + "The applet should show keyPressed, keyTyped and keyReleased messages.</p>\n" + + "<APPLET CODE=\"TestApplet.class\" WIDTH=400 HEIGHT=200></APPLET>\n" + + "</body>"); + } finally { + if (testHTML != null) { + testHTML.close(); + } + } + + String[] instructions = + { + "(1) Install the tested JDK to be used by the Java Plugin.\n", + "(2) Open Java Preferences and set security level to minimal.\n", + "(3) Open the " + TEST_HTML_NAME + " in Firefox in firefox web browser\n" + + " It is located at: " + testFilePath, + "(5) Continue the test according to the instructions in the applet.\n", + }; + Sysout.createDialogWithInstructions(instructions); + } catch (Throwable e) { + //Fail the test. + throw new RuntimeException(e.getMessage()); + } + + }//End init() + + public void start() { + }// start() +} + +/* Place other classes related to the test after this line */ + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + * This is part of the standard test machinery. + * It creates a dialog (with the instructions), and is the interface + * for sending text messages to the user. + * To print the instructions, send an array of strings to Sysout.createDialog + * WithInstructions method. Put one line of instructions per array entry. + * To display a message for the tester to see, simply call Sysout.println + * with the string to be displayed. + * This mimics System.out.println but works within the test harness as well + * as standalone. + */ + +class Sysout { + private static TestDialog dialog; + private static boolean numbering = false; + private static int messageNumber = 0; + + public static void createDialogWithInstructions(String[] instructions) { + dialog = new TestDialog(new Frame(), "Instructions"); + dialog.printInstructions(instructions); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void createDialog() { + dialog = new TestDialog(new Frame(), "Instructions"); + String[] defInstr = {"Instructions will appear here. ", ""}; + dialog.printInstructions(defInstr); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + /* Enables message counting for the tester. */ + public static void enableNumbering(boolean enable) { + numbering = enable; + } + + public static void printInstructions(String[] instructions) { + dialog.printInstructions(instructions); + } + + + public static void println(String messageIn) { + if (numbering) { + messageIn = "" + messageNumber + " " + messageIn; + messageNumber++; + } + dialog.displayMessage(messageIn); + } + +}// Sysout class + +/** + * This is part of the standard test machinery. It provides a place for the + * test instructions to be displayed, and a place for interactive messages + * to the user to be displayed. + * To have the test instructions displayed, see Sysout. + * To have a message to the user be displayed, see Sysout. + * Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog(Frame frame, String name) { + super(frame, name); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea("", 15, maxStringLength, scrollBoth); + add("North", instructionsText); + + messageText = new TextArea("", 5, maxStringLength, scrollBoth); + add("Center", messageText); + + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions(String[] instructions) { + //Clear out any current instructions + instructionsText.setText(""); + + //Go down array of instruction strings + + String printStr, remainingStr; + for (int i = 0; i < instructions.length; i++) { + //chop up each into pieces maxSringLength long + remainingStr = instructions[i]; + while (remainingStr.length() > 0) { + //if longer than max then chop off first max chars to print + if (remainingStr.length() >= maxStringLength) { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf(' ', maxStringLength - 1); + + if (posOfSpace <= 0) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring(0, posOfSpace + 1); + remainingStr = remainingStr.substring(posOfSpace + 1); + } + //else just print + else { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append(printStr + "\n"); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage(String messageIn) { + messageText.append(messageIn + "\n"); + System.out.println(messageIn); + } + +}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/TestApplet.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.*; +import java.awt.*; +import java.awt.Color; +import java.awt.Label; +import java.awt.TextArea; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.lang.String; +import java.lang.System; + + +public class TestApplet extends JApplet { + + public void init() { + final TextArea log = new TextArea("Events:\n"); + log.setEditable(false); + log.setSize(400, 200); + this.add(log); + log.addKeyListener( + new KeyAdapter() { + @Override public void keyTyped(KeyEvent e) { + log.append("Key typed: char = " + e.getKeyChar() + "\n"); + } + + @Override public void keyPressed(KeyEvent e) { + log.append("Key pressed: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n"); + } + + @Override public void keyReleased(KeyEvent e) { + log.append("Key released: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n"); + } + }); + } + + public void start() { + } + + public void stop() { + } + + public void destroy() { + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/font/LineBreakMeasurer/AllFontsLBM.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8012617 + * @summary ArrayIndexOutOfBoundsException in LineBreakMeasurer + */ + +import java.awt.*; +import java.awt.image.*; +import java.awt.font.*; +import java.awt.geom.*; +import java.text.*; +import java.util.Hashtable; + +public class AllFontsLBM { + + public static void main(String[] args) { + Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); + for (int i=0;i<allFonts.length; i++) { + try { + Font f = allFonts[i].deriveFont(Font.PLAIN, 20); + + if ( f.getFontName().startsWith("HiraKaku") ) { + continue; + } + + System.out.println("Try : " + f.getFontName()); + System.out.flush(); + breakLines(f); + } catch (Exception e) { + System.out.println(allFonts[i]); + } + } + } + + static void breakLines(Font font) { + AttributedString vanGogh = new AttributedString( + "Many people believe that Vincent van Gogh painted his best works " + + "during the two-year period he spent in Provence. Here is where he " + + "painted The Starry Night--which some consider to be his greatest " + + "work of all. However, as his artistic brilliance reached new " + + "heights in Provence, his physical and mental health plummeted. ", + new Hashtable()); + vanGogh.addAttribute(TextAttribute.FONT, font); + BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = bi.createGraphics(); + AttributedCharacterIterator aci = vanGogh.getIterator(); + FontRenderContext frc = new FontRenderContext(null, false, false); + LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc); + lbm.setPosition(aci.getBeginIndex()); + while (lbm.getPosition() < aci.getEndIndex()) { + lbm.nextLayout(100f); + } + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/font/TextLayout/TestKerning.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @summary Test Kerning is working. + * @bug 8009530 + */ + +import java.applet.*; +import java.awt.*; +import java.awt.event.*; +import java.awt.font.*; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; + +public class TestKerning extends Applet { + private Panel panel; + + static public void main(String[] args) { +System.out.println(System.getProperty("os.name")); + + Applet test = new TestKerning(); + test.init(); + test.start(); + + Frame f = new Frame("Test Kerning"); + f.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + f.add("Center", test); + f.pack(); + f.setVisible(true); + } + + public Dimension getPreferredSize() { + return new Dimension(500, 200); + } + + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + private static final String testString = "To WAVA 1,45 office glyph."; + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; + Font f = new Font("Arial", Font.PLAIN, 36); + // testing Arial on Solaris. + if (!("SunOS".equals(System.getProperty("os.name")))) { + return; + } + if (!("Arial".equals(f.getFamily(Locale.ENGLISH)))) { + return; + } + Map m = new HashMap(); + m.put(TextAttribute.KERNING, TextAttribute.KERNING_ON); + Font kf = f.deriveFont(m); + g.setFont(f); + FontMetrics fm1 = g.getFontMetrics(); + int sw1 = fm1.stringWidth(testString); + g.drawString(testString, 10, 50); + g.setFont(kf); + FontMetrics fm2 = g.getFontMetrics(); + int sw2 = fm2.stringWidth(testString); + g.drawString(testString, 10, 90); + if (sw1 == sw2) { + System.out.println(sw1+" " + sw2); + throw new RuntimeException("No kerning"); + } + } +}
--- a/test/java/awt/image/mlib/MlibOpsTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/awt/image/mlib/MlibOpsTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,7 +23,7 @@ /* * @test - * @bug 6556332 + * @bug 6556332 8011992 8012112 * @summary Test verifies that on-demnad loading of medialib library does * not break imageing ops based on this library. * @run main MlibOpsTest
--- a/test/java/io/FileInputStream/LargeFileAvailable.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/io/FileInputStream/LargeFileAvailable.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,7 +23,7 @@ /* * @test - * @bug 6402006 + * @bug 6402006 7030573 * @summary Test if available returns correct value when reading * a large file. */ @@ -35,23 +35,35 @@ import static java.nio.file.StandardOpenOption.*; public class LargeFileAvailable { - private static final long FILESIZE = 7405576182L; public static void main(String args[]) throws Exception { - File file = createLargeFile(FILESIZE); + // Create a temporary file in the current directory. + // Use it to check if we have 7G available for + // a large sparse file test. As a fallback use whatever + // space is available, so the test can proceed. + File file = File.createTempFile("largefile", null, new File(".")); + long spaceavailable = file.getUsableSpace(); + long filesize = Math.min(spaceavailable, 7405576182L); + if (spaceavailable == 0L) { + // A full disk is considered fatal. + throw new RuntimeException("No space available for temp file."); + } + + createLargeFile(filesize, file); + try (FileInputStream fis = new FileInputStream(file)) { - if (file.length() != FILESIZE) { - throw new RuntimeException("unexpected file size = " + file.length()); + if (file.length() != filesize) { + throw new RuntimeException("unexpected file size = " + + file.length()); } - long bigSkip = 3110608882L; - long remaining = FILESIZE; + long bigSkip = Math.min(filesize/2, 3110608882L); + long remaining = filesize; remaining -= skipBytes(fis, bigSkip, remaining); remaining -= skipBytes(fis, 10L, remaining); remaining -= skipBytes(fis, bigSkip, remaining); if (fis.available() != (int) remaining) { - throw new RuntimeException("available() returns " + - fis.available() + - " but expected " + remaining); + throw new RuntimeException("available() returns " + + fis.available() + " but expected " + remaining); } } finally { file.delete(); @@ -64,39 +76,41 @@ throws IOException { long skip = is.skip(toSkip); if (skip != toSkip) { - throw new RuntimeException("skip() returns " + skip + - " but expected " + toSkip); + throw new RuntimeException("skip() returns " + skip + + " but expected " + toSkip); } long remaining = avail - skip; int expected = remaining >= Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) remaining; - System.out.println("Skipped " + skip + " bytes " + - " available() returns " + expected + + System.out.println("Skipped " + skip + " bytes " + + " available() returns " + expected + " remaining=" + remaining); if (is.available() != expected) { - throw new RuntimeException("available() returns " + - is.available() + " but expected " + expected); + throw new RuntimeException("available() returns " + + is.available() + " but expected " + expected); } return skip; } - private static File createLargeFile(long filesize) throws Exception { - // Create a large file as a sparse file if possible - File largefile = File.createTempFile("largefile", null); - // re-create as a sparse file - Files.delete(largefile.toPath()); + private static void createLargeFile(long filesize, + File file) throws Exception { + // Recreate a large file as a sparse file if possible + Files.delete(file.toPath()); + try (FileChannel fc = - FileChannel.open(largefile.toPath(), - CREATE_NEW, WRITE, SPARSE)) { + FileChannel.open(file.toPath(), + CREATE_NEW, WRITE, SPARSE)) { ByteBuffer bb = ByteBuffer.allocate(1).put((byte)1); bb.rewind(); - int rc = fc.write(bb, filesize-1); + int rc = fc.write(bb, filesize - 1); + if (rc != 1) { - throw new RuntimeException("Failed to write 1 byte to the large file"); + throw new RuntimeException("Failed to write 1 byte" + + " to the large file"); } } - return largefile; + return; } }
--- a/test/java/io/Serializable/resolveClass/deserializeButton/Foo.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/io/Serializable/resolveClass/deserializeButton/Foo.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 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 @@ -26,27 +26,26 @@ * @summary Verify that class loaded outside of application class loader is * correctly resolved during deserialization when read in by custom * readObject() method of a bootstrap class (in this case, - * java.awt.Button). + * java.util.Vector). */ -import java.awt.Button; -import java.awt.event.MouseAdapter; import java.io.*; +import java.util.Vector; public class Foo implements Runnable { - static class Adapter extends MouseAdapter implements Serializable {} + static class TestElement extends Object implements Serializable {} public void run() { try { - Button button = new Button(); - button.addMouseListener(new Adapter()); + Vector<TestElement> container = new Vector<TestElement>(); + container.add(new TestElement()); // iterate to trigger java.lang.reflect code generation for (int i = 0; i < 100; i++) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); - oout.writeObject(button); + oout.writeObject(container); oout.close(); ObjectInputStream oin = new ObjectInputStream( new ByteArrayInputStream(bout.toByteArray())); @@ -54,7 +53,7 @@ } } catch (Exception ex) { throw new Error( - "Error occured while (de)serializing Button: " + ex); + "Error occured while (de)serializing container: ", ex); } } }
--- a/test/java/io/Serializable/resolveClass/deserializeButton/Test.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/io/Serializable/resolveClass/deserializeButton/Test.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 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 @@ -26,7 +26,7 @@ * @summary Verify that class loaded outside of application class loader is * correctly resolved during deserialization when read in by custom * readObject() method of a bootstrap class (in this case, - * java.awt.Button). + * java.util.Vector). */ import java.io.*;
--- a/test/java/io/Serializable/resolveClass/deserializeButton/run.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/io/Serializable/resolveClass/deserializeButton/run.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 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 @@ -26,7 +26,7 @@ # @summary Verify that class loaded outside of application class loader is # correctly resolved during deserialization when read in by custom # readObject() method of a bootstrap class (in this case, -# java.awt.Button). +# java.util.Vector). if [ "${TESTJAVA}" = "" ] then
--- a/test/java/lang/ProcessBuilder/Basic.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/lang/ProcessBuilder/Basic.java Fri Jun 21 15:46:14 2013 -0500 @@ -36,9 +36,11 @@ import static java.lang.ProcessBuilder.Redirect.*; import java.io.*; +import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.CountDownLatch; import java.security.*; +import sun.misc.Unsafe; import java.util.regex.Pattern; import java.util.regex.Matcher; import static java.lang.System.getenv; @@ -1908,17 +1910,21 @@ final byte[] bytes = new byte[10]; final Process p = new ProcessBuilder(childArgs).start(); final CountDownLatch latch = new CountDownLatch(1); + final InputStream s; + switch (action & 0x1) { + case 0: s = p.getInputStream(); break; + case 1: s = p.getErrorStream(); break; + default: throw new Error(); + } final Thread thread = new Thread() { public void run() { try { + int r; latch.countDown(); - int r; - switch (action) { - case 0: r = p.getInputStream().read(); break; - case 1: r = p.getErrorStream().read(); break; - case 2: r = p.getInputStream().read(bytes); break; - case 3: r = p.getErrorStream().read(bytes); break; - default: throw new Error(); + switch (action & 0x2) { + case 0: r = s.read(); break; + case 2: r = s.read(bytes); break; + default: throw new Error(); } equal(-1, r); } catch (Throwable t) { unexpected(t); }}}; @@ -1926,6 +1932,40 @@ thread.start(); latch.await(); Thread.sleep(10); + + String os = System.getProperty("os.name"); + if (os.equalsIgnoreCase("Solaris") || + os.equalsIgnoreCase("SunOS")) + { + final Object deferred; + Class<?> c = s.getClass(); + if (c.getName().equals( + "java.lang.UNIXProcess$DeferredCloseInputStream")) + { + deferred = s; + } else { + Field deferredField = p.getClass(). + getDeclaredField("stdout_inner_stream"); + deferredField.setAccessible(true); + deferred = deferredField.get(p); + } + Field useCountField = deferred.getClass(). + getDeclaredField("useCount"); + useCountField.setAccessible(true); + + while (useCountField.getInt(deferred) <= 0) { + Thread.yield(); + } + } else if (s instanceof BufferedInputStream) { + Field f = Unsafe.class.getDeclaredField("theUnsafe"); + f.setAccessible(true); + Unsafe unsafe = (Unsafe)f.get(null); + + while (unsafe.tryMonitorEnter(s)) { + unsafe.monitorExit(s); + Thread.sleep(1); + } + } p.destroy(); thread.join(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/Runtime/exec/ExecCommand.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/** + * @test + * @bug 8012453 + * @run main/othervm ExecCommand + * @summary workaround for legacy applications with Runtime.getRuntime().exec(String command) + */ + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.security.AccessControlException; + +public class ExecCommand { + static class SecurityMan extends SecurityManager { + public static String unquote(String str) + { + int length = (str == null) + ? 0 + : str.length(); + + if (length > 1 + && str.charAt(0) == '\"' + && str.charAt(length - 1) == '\"') + { + return str.substring(1, length - 1); + } + return str; + } + + @Override public void checkExec(String cmd) { + String ncmd = (new File(unquote(cmd))).getPath(); + if ( ncmd.equals(".\\Program") + || ncmd.equals("\".\\Program") + || ncmd.equals(".\\Program Files\\do.cmd") + || ncmd.equals(".\\Program.cmd")) + { + return; + } + super.checkExec(cmd); + } + } + + // Parameters for the Runtime.exec calls + private static final String TEST_RTE_ARG[] = { + ".\\Program Files\\do.cmd", + "\".\\Program Files\\doNot.cmd\" arg", + "\".\\Program Files\\do.cmd\" arg", + // compatibility + "\".\\Program.cmd\" arg", + ".\\Program.cmd arg", + }; + + private static final String doCmdCopy[] = { + ".\\Program.cmd", + ".\\Program Files\\doNot.cmd", + ".\\Program Files\\do.cmd", + }; + + // Golden image for results + private static final String TEST_RTE_GI[][] = { + //Pure system | Legacy mode | Legacy mode & SM + // [.\Program File\do.cmd] + new String[]{"IOException", // [.\Program] not found + "Success", + "IOException"}, //SM - no legacy mode [.\Program] - OK + + // [".\Program File\doNot.cmd" arg] + new String[]{"Success", + "Success", + "AccessControlException"}, //SM - [".\Program] - OK, + // [.\\Program Files\\doNot.cmd] - Fail + + // [".\Program File\do.cmd" arg] + // AccessControlException + new String[]{"Success", + "Success", + "Success"}, //SM - [".\Program] - OK, + // [.\\Program Files\\do.cmd] - OK + + // compatibility + new String[]{"Success", "Success", "Success"}, //[".\Program.cmd"] + new String[]{"Success", "Success", "Success"} //[.\Program.cmd] + }; + + public static void main(String[] _args) throws Exception { + if (!System.getProperty("os.name").startsWith("Windows")) { + return; + } + + // tear up + try { + new File(".\\Program Files").mkdirs(); + for (int i = 0; i < doCmdCopy.length; ++i) { + try (BufferedWriter outCmd = new BufferedWriter( + new FileWriter(doCmdCopy[i]))) { + outCmd.write("@echo %1"); + } + } + } catch (IOException e) { + throw new Error(e.getMessage()); + } + + // action + for (int k = 0; k < 3; ++k) { + switch (k) { + case 1: + System.setProperty("jdk.lang.Process.allowAmbigousCommands", ""); + break; + case 2: + System.setSecurityManager( new SecurityMan() ); + break; + } + for (int i = 0; i < TEST_RTE_ARG.length; ++i) { + String outRes; + try { + Process exec = Runtime.getRuntime().exec(TEST_RTE_ARG[i]); + exec.waitFor(); + outRes = "Success"; + } catch (IOException ioe) { + outRes = "IOException: " + ioe.getMessage(); + } catch (IllegalArgumentException iae) { + outRes = "IllegalArgumentException: " + iae.getMessage(); + } catch (AccessControlException se) { + outRes = "AccessControlException: " + se.getMessage(); + } + + if (!outRes.startsWith(TEST_RTE_GI[i][k])) { + throw new Error("Unexpected output! Step" + k + "" + i + + " \nArgument: " + TEST_RTE_ARG[i] + + "\nExpected: " + TEST_RTE_GI[i][k] + + "\n Output: " + outRes); + } else { + System.out.println("RTE OK:" + TEST_RTE_ARG[i]); + } + } + } + } +}
--- a/test/java/lang/Runtime/exec/StreamsSurviveDestroy.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/lang/Runtime/exec/StreamsSurviveDestroy.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,6 +28,7 @@ */ import java.io.*; +import java.util.concurrent.*; public class StreamsSurviveDestroy { @@ -40,15 +41,17 @@ boolean wantInterrupt; boolean acceptException; Exception exc = null; + CountDownLatch latch; Copier(String name, InputStream in, OutputStream out, - boolean ae, boolean wi) + boolean ae, boolean wi, CountDownLatch l) { this.name = name; this.in = in; this.out = out; this.acceptException = ae; this.wantInterrupt = wi; + this.latch = l; setName(name); start(); } @@ -59,6 +62,7 @@ public void run() { byte[] buf = new byte[4242]; + latch.countDown(); for (;;) { try { int n = in.read(buf); @@ -95,13 +99,17 @@ } static void test() throws Exception { + CountDownLatch latch = new CountDownLatch(2); + System.err.println("test"); Process p = Runtime.getRuntime().exec("/bin/cat"); Copier cp1 = new Copier("out", p.getInputStream(), System.err, - false, false); + false, false, latch); Copier cp2 = new Copier("err", p.getErrorStream(), System.err, - false, false); - Thread.sleep(100); + false, false, latch); + latch.await(); // Wait till both Copiers about to read + Thread.sleep(100);// Give both Copiers a chance to start read + p.destroy(); System.err.println(" exit: " + p.waitFor()); cp1.join(); @@ -111,13 +119,17 @@ } static void testCloseBeforeDestroy() throws Exception { + CountDownLatch latch = new CountDownLatch(2); + System.err.println("testCloseBeforeDestroy"); Process p = Runtime.getRuntime().exec("/bin/cat"); Copier cp1 = new Copier("out", p.getInputStream(), System.err, - true, false); + true, false, latch); Copier cp2 = new Copier("err", p.getErrorStream(), System.err, - true, false); - Thread.sleep(100); + true, false, latch); + latch.await(); // Wait till both Copiers about to read + Thread.sleep(100);// Give both Copiers a chance to start read + p.getInputStream().close(); p.getErrorStream().close(); p.destroy(); @@ -129,13 +141,17 @@ } static void testCloseAfterDestroy() throws Exception { + CountDownLatch latch = new CountDownLatch(2); System.err.println("testCloseAfterDestroy"); Process p = Runtime.getRuntime().exec("/bin/cat"); Copier cp1 = new Copier("out", p.getInputStream(), System.err, - true, false); + true, false,latch); Copier cp2 = new Copier("err", p.getErrorStream(), System.err, - true, false); - Thread.sleep(100); + true, false, latch); + + latch.await(); // Wait till both Copiers about to read + Thread.sleep(100);// Give both Copiers a chance to start read + p.destroy(); p.getInputStream().close(); p.getErrorStream().close(); @@ -147,13 +163,16 @@ } static void testInterrupt() throws Exception { + CountDownLatch latch = new CountDownLatch(2); System.err.println("testInterrupt"); Process p = Runtime.getRuntime().exec("/bin/cat"); Copier cp1 = new Copier("out", p.getInputStream(), System.err, - false, true); + false, true, latch); Copier cp2 = new Copier("err", p.getErrorStream(), System.err, - false, true); - Thread.sleep(100); + false, true, latch); + latch.await(); // Wait till both Copiers about to read + Thread.sleep(100);// Give both Copiers a chance to start read + cp1.interrupt(); cp2.interrupt(); Thread.sleep(100); @@ -176,7 +195,5 @@ testCloseBeforeDestroy(); testCloseAfterDestroy(); testInterrupt(); - } - }
--- a/test/java/lang/ThreadGroup/NullThreadName.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/lang/ThreadGroup/NullThreadName.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,7 +24,6 @@ /* * @test * @bug 6576763 - * @ignore until hotspot 6776144 bug is resolved * @summary (thread) Thread constructors throw undocumented NPE for null name */ @@ -64,8 +63,8 @@ try { Thread.sleep(2000); } catch (InterruptedException unused) {} - /* do not wait forever */ - if (count++ > 5) + /* do not wait forever - allow 120 seconds same as jtreg default timeout. */ + if (count++ > 60) throw new AssertionError("GoodThread is still alive!"); }
--- a/test/java/lang/ThreadGroup/Stop.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/lang/ThreadGroup/Stop.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,37 +29,58 @@ */ public class Stop implements Runnable { - private static Thread first=null; - private static Thread second=null; - private static ThreadGroup group = new ThreadGroup(""); + private static boolean groupStopped = false ; + private static final Object lock = new Object(); - Stop() { - Thread thread = new Thread(group, this); - if (first == null) - first = thread; - else - second = thread; - - thread.start(); - } + private static final ThreadGroup group = new ThreadGroup(""); + private static final Thread first = new Thread(group, new Stop()); + private static final Thread second = new Thread(group, new Stop()); public void run() { while (true) { + // Give the other thread a chance to start try { - Thread.sleep(1000); // Give other thread a chance to start - if (Thread.currentThread() == first) - group.stop(); - } catch(InterruptedException e){ + Thread.sleep(1000); + } catch (InterruptedException e) { + } + + // When the first thread runs, it will stop the group. + if (Thread.currentThread() == first) { + synchronized (lock) { + try { + group.stop(); + } finally { + // Signal the main thread it is time to check + // that the stopped thread group was successful + groupStopped = true; + lock.notifyAll(); + } + } } } } public static void main(String[] args) throws Exception { - for (int i=0; i<2; i++) - new Stop(); - Thread.sleep(3000); + // Launch two threads as part of the same thread group + first.start(); + second.start(); + + // Wait for the thread group stop to be issued + synchronized(lock){ + while (!groupStopped) { + lock.wait(); + // Give the other thread a chance to stop + Thread.sleep(1000); + } + } + + // Check that the second thread is terminated when the + // first thread terminates the thread group. boolean failed = second.isAlive(); - first.stop(); second.stop(); + + // Clean up any threads that may have not been terminated + first.stop(); + second.stop(); if (failed) throw new RuntimeException("Failure."); }
--- a/test/java/lang/instrument/ManifestTest.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/lang/instrument/ManifestTest.sh Fri Jun 21 15:46:14 2013 -0500 @@ -26,7 +26,7 @@ # @summary JLI JAR manifest processing should ignore leading and trailing white space. # @author Daniel D. Daugherty # -# @run build ManifestTestApp +# @run build ManifestTestApp ExampleForBootClassPath # @run shell/timeout=900 ManifestTest.sh # @@ -42,6 +42,9 @@ expect_retrans_line="isRetransformClassesSupported()=false" can_set_nmp_line="" expect_set_nmp_line="isNativeMethodPrefixSupported()=false" + # some tests create directories with spaces in their name, + # explicitly delete these. + to_be_deleted="" while [ $# != 0 ] ; do case "$1" in @@ -59,30 +62,33 @@ boot_cp_line2) boot_cp_line="Boot-Class-Path: has_leading_blank" expect_boot_cp_line="ExampleForBootClassPath was loaded." + to_be_deleted=" has_leading_blank" mkdir -p has_leading_blank " has_leading_blank" # the good class is in the directory without the blank cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class \ has_leading_blank # the bad class is in the directory with the blank cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \ - " has_leading_blank"/ExampleForBootClassPath.class + " has_leading_blank/ExampleForBootClassPath.class" ;; boot_cp_line3) boot_cp_line="Boot-Class-Path: has_trailing_blank " expect_boot_cp_line="ExampleForBootClassPath was loaded." + to_be_deleted="has_trailing_blank " mkdir -p has_trailing_blank "has_trailing_blank " # the good class is in the directory without the blank cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class \ has_trailing_blank # the bad class is in the directory with the blank cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \ - "has_trailing_blank "/ExampleForBootClassPath.class + "has_trailing_blank /ExampleForBootClassPath.class" ;; boot_cp_line4) boot_cp_line="Boot-Class-Path: has_leading_and_trailing_blank " expect_boot_cp_line="ExampleForBootClassPath was loaded." + to_be_deleted=" has_leading_and_trailing_blank " mkdir -p has_leading_and_trailing_blank \ " has_leading_and_trailing_blank " # the good class is in the directory without the blanks @@ -90,18 +96,19 @@ has_leading_and_trailing_blank # the bad class is in the directory with the blanks cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \ - " has_leading_and_trailing_blank "/ExampleForBootClassPath.class + " has_leading_and_trailing_blank /ExampleForBootClassPath.class" ;; boot_cp_line5) boot_cp_line="Boot-Class-Path: has_embedded blank" expect_boot_cp_line="ExampleForBootClassPath was loaded." + to_be_deleted="has_embedded blank" mkdir -p has_embedded "has_embedded blank" # the good class is in the first blank separated word cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class has_embedded # the bad class is in the directory with the blank cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \ - "has_embedded blank"/ExampleForBootClassPath.class + "has_embedded blank/ExampleForBootClassPath.class" ;; can_redef_line1) @@ -429,6 +436,12 @@ touch $FAIL_MARKER fi + #clean up any problematic directories + if [ -n "$to_be_deleted" ]; then + echo "Test removing [$to_be_deleted]" + rm -rf "$to_be_deleted" + fi + echo "===== end test case: $token =====" echo done << EOF
--- a/test/java/lang/invoke/InvokeGenericTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/lang/invoke/InvokeGenericTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandle.invoke - * @compile -target 7 InvokeGenericTest.java + * @compile InvokeGenericTest.java * @run junit/othervm test.java.lang.invoke.InvokeGenericTest */
--- a/test/java/net/BindException/Test.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/net/BindException/Test.java Fri Jun 21 15:46:14 2013 -0500 @@ -46,7 +46,7 @@ static int failures; static void doTest(Object test[], InetAddress ia1, InetAddress ia2, - boolean silent) { + boolean silent) throws Exception { String s1_type = (String)test[0]; String s2_type = (String)test[1]; int port = 0; @@ -64,11 +64,10 @@ boolean failed = false; Exception failed_exc = null; + Socket sock1 = null; + ServerSocket ss = null; + DatagramSocket dsock1 = null; try { - Socket sock1, sock2; - ServerSocket ss; - DatagramSocket dsock1, dsock2; - /* bind the first socket */ if (s1_type.equals("Socket")) { @@ -90,16 +89,18 @@ /* bind the second socket */ if (s2_type.equals("Socket")) { - sock2 = new Socket(); - sock2.bind( new InetSocketAddress(ia2, port)); + try (Socket sock2 = new Socket()) { + sock2.bind( new InetSocketAddress(ia2, port)); + } } if (s2_type.equals("ServerSocket")) { - ss = new ServerSocket(port, 0, ia2); + try (ServerSocket ss2 = new ServerSocket(port, 0, ia2)) { } } if (s2_type.equals("DatagramSocket")) { - dsock2 = new DatagramSocket( new InetSocketAddress(ia2, port) ); + try (DatagramSocket ds = + new DatagramSocket(new InetSocketAddress(ia2, port))) { } } } catch (BindException be) { @@ -107,6 +108,10 @@ } catch (Exception e) { failed = true; failed_exc = e; + } finally { + if (sock1 != null) sock1.close(); + if (ss != null) ss.close(); + if (dsock1 != null) dsock1.close(); } /*
--- a/test/java/net/InetAddress/GetLocalHostWithSM.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/net/InetAddress/GetLocalHostWithSM.java Fri Jun 21 15:46:14 2013 -0500 @@ -41,14 +41,13 @@ public static void main(String[] args) throws Exception { // try setting the local hostname - try { - System.setProperty("host.name", InetAddress. - getLocalHost(). - getHostName()); - } catch (UnknownHostException e) { - System.out.println("Cannot find the local hostname, " + - "no nameserver entry found"); + InetAddress localHost = InetAddress.getLocalHost(); + if (localHost.isLoopbackAddress()) { + System.err.println("Local host name is resolved into a loopback address. Quit now!"); + return; } + System.setProperty("host.name", localHost. + getHostName()); String policyFileName = System.getProperty("test.src", ".") + "/" + "policy.file"; System.setProperty("java.security.policy", policyFileName); @@ -66,6 +65,7 @@ new MyAction(), null); if (localHost1.equals(localHost2)) { + System.out.println("localHost1 = " + localHost1); throw new RuntimeException("InetAddress.getLocalHost() test " + " fails. localHost2 should be " + " the real address instead of " +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/net/ResponseCache/Test.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @summary Fixed a potential NullPointerException when setting a ResponseCache that returns a null CacheRequest + * @bug 4837267 + * @author Michael McMahon + */ + +import com.sun.net.httpserver.*; +import java.net.*; +import java.io.*; +import java.util.*; + +public class Test +{ + + static class MyHandler implements HttpHandler { + public void handle(HttpExchange t) throws IOException { + byte[] b = new byte[1024]; + int r = 0; + InputStream is = t.getRequestBody(); + while (is.read(b) != -1) ; + String response = "This is the response"; + t.sendResponseHeaders(200, response.length()); + OutputStream os = t.getResponseBody(); + os.write(response.getBytes()); + os.close(); + } + } + + public static void main(String args[]) throws Exception { + HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + server.createContext("/", new MyHandler()); + server.start(); + ResponseCache bak = ResponseCache.getDefault(); + + try { + ResponseCache.setDefault (new ResponseCache() { + public CacheResponse get (URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders) + throws IOException { + return null; + } + public CacheRequest put(URI uri, URLConnection conn) throws IOException + { + return null; + } + }); + + URL url = new URL ("http://localhost:" + server.getAddress().getPort() + "/"); + URLConnection urlc = url.openConnection (); + InputStream is = urlc.getInputStream(); + while (is.read() != -1) ; + is.close(); + } finally { + ResponseCache.setDefault(bak); + server.stop(0); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/net/Socket/B6210227.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 6210227 + * @summary REGRESSION: Socket.getLocalAddress() returns address of 0.0.0.0 on outbound TCP + */ + +import java.util.*; +import java.net.*; + +public class B6210227 { + public static void main(String[] args) throws Exception + { + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); + + byte[] bad = {0,0,0,0}; + try { + InetSocketAddress isa = new InetSocketAddress(InetAddress.getLocalHost(), port); + Socket s = new Socket(); + s.connect( isa, 1000 ); + InetAddress iaLocal = s.getLocalAddress(); // if this comes back as 0.0. 0.0 this would demonstrate issue + String sLocalHostname = iaLocal.getHostName(); + if (Arrays.equals (iaLocal.getAddress(), bad)) { + throw new RuntimeException ("0.0.0.0 returned"); + } + System.out.println("local hostname is "+sLocalHostname ); + } catch(Exception e) { + System.out.println("Exception happened"); + throw e; + } finally { + ss.close(); + } + } +} +
--- a/test/java/net/Socks/SocksServer.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/net/Socks/SocksServer.java Fri Jun 21 15:46:14 2013 -0500 @@ -22,13 +22,14 @@ */ import java.net.*; import java.io.*; +import java.util.HashMap; public class SocksServer extends Thread { // Some useful SOCKS constant - static final int PROTO_VERS4 = 4; + static final int PROTO_VERS4 = 4; static final int PROTO_VERS = 5; - static final int DEFAULT_PORT = 1080; + static final int DEFAULT_PORT = 1080; static final int NO_AUTH = 0; static final int GSSAPI = 1; @@ -36,28 +37,28 @@ static final int NO_METHODS = -1; static final int CONNECT = 1; - static final int BIND = 2; + static final int BIND = 2; static final int UDP_ASSOC = 3; - static final int IPV4 = 1; - static final int DOMAIN_NAME = 3; - static final int IPV6 = 4; + static final int IPV4 = 1; + static final int DOMAIN_NAME = 3; + static final int IPV6 = 4; static final int REQUEST_OK = 0; static final int GENERAL_FAILURE = 1; - static final int NOT_ALLOWED = 2; + static final int NOT_ALLOWED = 2; static final int NET_UNREACHABLE = 3; static final int HOST_UNREACHABLE = 4; - static final int CONN_REFUSED = 5; - static final int TTL_EXPIRED = 6; + static final int CONN_REFUSED = 5; + static final int TTL_EXPIRED = 6; static final int CMD_NOT_SUPPORTED = 7; static final int ADDR_TYPE_NOT_SUP = 8; private int port; private ServerSocket server; private boolean useV4 = false; - private java.util.Hashtable users = new java.util.Hashtable(); - private boolean done = false; + private HashMap<String,String> users = new HashMap<>(); + private volatile boolean done = false; // Inner class to handle protocol with client // This is the bulk of the work (protocol handler) class ClientHandler extends Thread { @@ -136,7 +137,7 @@ System.err.println("User: '" + uname); System.err.println("PSWD: '" + password); if (users.containsKey(uname)) { - String p1 = (String) users.get(uname); + String p1 = users.get(uname); System.err.println("p1 = " + p1); if (p1.equals(password)) { out.write(PROTO_VERS); @@ -492,7 +493,12 @@ public SocksServer(int port) throws IOException { this.port = port; server = new ServerSocket(); - server.bind(new InetSocketAddress(port)); + if (port == 0) { + server.bind(null); + this.port = server.getLocalPort(); + } else { + server.bind(new InetSocketAddress(port)); + } } public SocksServer() throws IOException { @@ -503,8 +509,13 @@ users.put(user, passwd); } - public synchronized void terminate() { + public int getPort() { + return port; + } + + public void terminate() { done = true; + try { server.close(); } catch (IOException unused) {} } public void run() {
--- a/test/java/net/Socks/SocksV4Test.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/net/Socks/SocksV4Test.java Fri Jun 21 15:46:14 2013 -0500 @@ -26,23 +26,29 @@ * @bug 4727547 * @summary SocksSocketImpl throws NullPointerException * @build SocksServer + * @run main SocksV4Test */ import java.net.*; -import java.io.*; public class SocksV4Test { - public static void main(String[] args) throws IOException { - // Create a SOCKS V4 proxy on port 8888 - SocksServer srvr = new SocksServer(8888, true); + + // An unresolvable host + static final String HOSTNAME = "doesnot.exist.invalid"; + + public static void main(String[] args) throws Exception { + // sanity before running the test + assertUnresolvableHost(HOSTNAME); + + // Create a SOCKS V4 proxy + SocksServer srvr = new SocksServer(0, true); srvr.start(); - System.setProperty("socksProxyHost", "localhost"); - System.setProperty("socksProxyPort", "8888"); + Proxy sp = new Proxy(Proxy.Type.SOCKS, + new InetSocketAddress("localhost", srvr.getPort())); // Let's create an unresolved address - InetSocketAddress ad = new InetSocketAddress("doesnt.exist.name", 1234); - Socket s = new Socket(); - try { - s.connect(ad,10000); + InetSocketAddress ad = new InetSocketAddress(HOSTNAME, 1234); + try (Socket s = new Socket(sp)) { + s.connect(ad, 10000); } catch (UnknownHostException ex) { // OK, that's what we expected } catch (NullPointerException npe) { @@ -50,7 +56,17 @@ throw new RuntimeException("Got a NUllPointerException"); } finally { srvr.terminate(); - srvr.interrupt(); } } + + static void assertUnresolvableHost(String host) { + InetAddress addr = null; + try { + addr = InetAddress.getByName(host); + } catch (UnknownHostException x) { + // OK, expected + } + if (addr != null) + throw new RuntimeException("Test cannot run. resolvable address:" + addr); + } }
--- a/test/java/net/ipv6tests/B6521014.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/net/ipv6tests/B6521014.java Fri Jun 21 15:46:14 2013 -0500 @@ -95,14 +95,12 @@ Socket sock; ServerSocket ssock; int port; - int localport; ssock = new ServerSocket(0); ssock.setSoTimeout(100); port = ssock.getLocalPort(); - localport = port + 1; sock = new Socket(); - sock.bind(new InetSocketAddress(sin, localport)); + sock.bind(new InetSocketAddress(sin, 0)); try { sock.connect(new InetSocketAddress(sin, port), 100); } catch (SocketTimeoutException e) {
--- a/test/java/nio/channels/AsynchronousSocketChannel/Basic.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/AsynchronousSocketChannel/Basic.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,7 +24,7 @@ /* @test * @bug 4607272 6842687 6878369 6944810 7023403 * @summary Unit test for AsynchronousSocketChannel - * @run main/timeout=600 Basic + * @run main Basic -skipSlowConnectTest */ import java.nio.ByteBuffer; @@ -34,12 +34,25 @@ import java.util.Random; import java.util.concurrent.*; import java.util.concurrent.atomic.*; +import java.io.Closeable; import java.io.IOException; public class Basic { static final Random rand = new Random(); + static boolean skipSlowConnectTest = false; + public static void main(String[] args) throws Exception { + for (String arg: args) { + switch (arg) { + case "-skipSlowConnectTest" : + skipSlowConnectTest = true; + break; + default: + throw new RuntimeException("Unrecognized argument: " + arg); + } + } + testBind(); testSocketOptions(); testConnect(); @@ -54,7 +67,7 @@ testShutdown(); } - static class Server { + static class Server implements Closeable { private final ServerSocketChannel ssc; private final InetSocketAddress address; @@ -74,10 +87,8 @@ return ssc.accept(); } - void close() { - try { - ssc.close(); - } catch (IOException ignore) { } + public void close() throws IOException { + ssc.close(); } } @@ -85,28 +96,28 @@ static void testBind() throws Exception { System.out.println("-- bind --"); - AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - if (ch.getLocalAddress() != null) - throw new RuntimeException("Local address should be 'null'"); - ch.bind(new InetSocketAddress(0)); + try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) { + if (ch.getLocalAddress() != null) + throw new RuntimeException("Local address should be 'null'"); + ch.bind(new InetSocketAddress(0)); - // check local address after binding - InetSocketAddress local = (InetSocketAddress)ch.getLocalAddress(); - if (local.getPort() == 0) - throw new RuntimeException("Unexpected port"); - if (!local.getAddress().isAnyLocalAddress()) - throw new RuntimeException("Not bound to a wildcard address"); + // check local address after binding + InetSocketAddress local = (InetSocketAddress)ch.getLocalAddress(); + if (local.getPort() == 0) + throw new RuntimeException("Unexpected port"); + if (!local.getAddress().isAnyLocalAddress()) + throw new RuntimeException("Not bound to a wildcard address"); - // try to re-bind - try { - ch.bind(new InetSocketAddress(0)); - throw new RuntimeException("AlreadyBoundException expected"); - } catch (AlreadyBoundException x) { + // try to re-bind + try { + ch.bind(new InetSocketAddress(0)); + throw new RuntimeException("AlreadyBoundException expected"); + } catch (AlreadyBoundException x) { + } } - ch.close(); // check ClosedChannelException - ch = AsynchronousSocketChannel.open(); + AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); ch.close(); try { ch.bind(new InetSocketAddress(0)); @@ -118,109 +129,124 @@ static void testSocketOptions() throws Exception { System.out.println("-- socket options --"); - AsynchronousSocketChannel ch = AsynchronousSocketChannel.open() - .setOption(SO_RCVBUF, 128*1024) - .setOption(SO_SNDBUF, 128*1024) - .setOption(SO_REUSEADDR, true); + try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) { + ch.setOption(SO_RCVBUF, 128*1024) + .setOption(SO_SNDBUF, 128*1024) + .setOption(SO_REUSEADDR, true); - // check SO_SNDBUF/SO_RCVBUF limits - int before, after; - before = ch.getOption(SO_SNDBUF); - after = ch.setOption(SO_SNDBUF, Integer.MAX_VALUE).getOption(SO_SNDBUF); - if (after < before) - throw new RuntimeException("setOption caused SO_SNDBUF to decrease"); - before = ch.getOption(SO_RCVBUF); - after = ch.setOption(SO_RCVBUF, Integer.MAX_VALUE).getOption(SO_RCVBUF); - if (after < before) - throw new RuntimeException("setOption caused SO_RCVBUF to decrease"); - - ch.bind(new InetSocketAddress(0)); + // check SO_SNDBUF/SO_RCVBUF limits + int before, after; + before = ch.getOption(SO_SNDBUF); + after = ch.setOption(SO_SNDBUF, Integer.MAX_VALUE).getOption(SO_SNDBUF); + if (after < before) + throw new RuntimeException("setOption caused SO_SNDBUF to decrease"); + before = ch.getOption(SO_RCVBUF); + after = ch.setOption(SO_RCVBUF, Integer.MAX_VALUE).getOption(SO_RCVBUF); + if (after < before) + throw new RuntimeException("setOption caused SO_RCVBUF to decrease"); - // default values - if ((Boolean)ch.getOption(SO_KEEPALIVE)) - throw new RuntimeException("Default of SO_KEEPALIVE should be 'false'"); - if ((Boolean)ch.getOption(TCP_NODELAY)) - throw new RuntimeException("Default of TCP_NODELAY should be 'false'"); + ch.bind(new InetSocketAddress(0)); + + // default values + if (ch.getOption(SO_KEEPALIVE)) + throw new RuntimeException("Default of SO_KEEPALIVE should be 'false'"); + if (ch.getOption(TCP_NODELAY)) + throw new RuntimeException("Default of TCP_NODELAY should be 'false'"); - // set and check - if (!(Boolean)ch.setOption(SO_KEEPALIVE, true).getOption(SO_KEEPALIVE)) - throw new RuntimeException("SO_KEEPALIVE did not change"); - if (!(Boolean)ch.setOption(TCP_NODELAY, true).getOption(TCP_NODELAY)) - throw new RuntimeException("SO_KEEPALIVE did not change"); + // set and check + if (!ch.setOption(SO_KEEPALIVE, true).getOption(SO_KEEPALIVE)) + throw new RuntimeException("SO_KEEPALIVE did not change"); + if (!ch.setOption(TCP_NODELAY, true).getOption(TCP_NODELAY)) + throw new RuntimeException("SO_KEEPALIVE did not change"); - // read others (can't check as actual value is implementation dependent) - ch.getOption(SO_RCVBUF); - ch.getOption(SO_SNDBUF); - - ch.close(); + // read others (can't check as actual value is implementation dependent) + ch.getOption(SO_RCVBUF); + ch.getOption(SO_SNDBUF); + } } static void testConnect() throws Exception { System.out.println("-- connect --"); - Server server = new Server(); - AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); + SocketAddress address; + + try (Server server = new Server()) { + address = server.address(); - // check local address - if (ch.getLocalAddress() == null) - throw new RuntimeException("Not bound to local address"); + // connect to server and check local/remote addresses + try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) { + ch.connect(address).get(); + // check local address + if (ch.getLocalAddress() == null) + throw new RuntimeException("Not bound to local address"); - // check remote address - InetSocketAddress remote = (InetSocketAddress)ch.getRemoteAddress(); - if (remote.getPort() != server.address().getPort()) - throw new RuntimeException("Connected to unexpected port"); - if (!remote.getAddress().equals(server.address().getAddress())) - throw new RuntimeException("Connected to unexpected address"); + // check remote address + InetSocketAddress remote = (InetSocketAddress)ch.getRemoteAddress(); + if (remote.getPort() != server.address().getPort()) + throw new RuntimeException("Connected to unexpected port"); + if (!remote.getAddress().equals(server.address().getAddress())) + throw new RuntimeException("Connected to unexpected address"); - // try to connect again - try { - ch.connect(server.address()).get(); - throw new RuntimeException("AlreadyConnectedException expected"); - } catch (AlreadyConnectedException x) { - } - ch.close(); + // try to connect again + try { + ch.connect(server.address()).get(); + throw new RuntimeException("AlreadyConnectedException expected"); + } catch (AlreadyConnectedException x) { + } - // check that connect fails with ClosedChannelException) - ch = AsynchronousSocketChannel.open(); - ch.close(); - try { - ch.connect(server.address()).get(); - throw new RuntimeException("ExecutionException expected"); - } catch (ExecutionException x) { - if (!(x.getCause() instanceof ClosedChannelException)) - throw new RuntimeException("Cause of ClosedChannelException expected"); + // clean-up + server.accept().close(); + } + + // check that connect fails with ClosedChannelException + AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.close(); + try { + ch.connect(server.address()).get(); + throw new RuntimeException("ExecutionException expected"); + } catch (ExecutionException x) { + if (!(x.getCause() instanceof ClosedChannelException)) + throw new RuntimeException("Cause of ClosedChannelException expected"); + } + final AtomicReference<Throwable> connectException = new AtomicReference<>(); + ch.connect(server.address(), (Void)null, new CompletionHandler<Void,Void>() { + public void completed(Void result, Void att) { + } + public void failed(Throwable exc, Void att) { + connectException.set(exc); + } + }); + while (connectException.get() == null) { + Thread.sleep(100); + } + if (!(connectException.get() instanceof ClosedChannelException)) + throw new RuntimeException("ClosedChannelException expected"); } - final AtomicReference<Throwable> connectException = - new AtomicReference<Throwable>(); - ch.connect(server.address(), (Void)null, new CompletionHandler<Void,Void>() { - public void completed(Void result, Void att) { - } - public void failed(Throwable exc, Void att) { - connectException.set(exc); - } - }); - while (connectException.get() == null) { - Thread.sleep(100); - } - if (!(connectException.get() instanceof ClosedChannelException)) - throw new RuntimeException("ClosedChannelException expected"); - - System.out.println("-- connect to non-existent host --"); // test that failure to connect closes the channel - ch = AsynchronousSocketChannel.open(); - try { - ch.connect(genSocketAddress()).get(); - } catch (ExecutionException x) { - // failed to establish connection - if (ch.isOpen()) - throw new RuntimeException("Channel should be closed"); - } finally { - ch.close(); + try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) { + try { + ch.connect(address).get(); + } catch (ExecutionException x) { + // failed to establish connection + if (ch.isOpen()) + throw new RuntimeException("Channel should be closed"); + } } - server.close(); + // repeat test by connecting to a (probably) non-existent host. This + // improves the chance that the connect will not fail immediately. + if (!skipSlowConnectTest) { + try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) { + try { + ch.connect(genSocketAddress()).get(); + } catch (ExecutionException x) { + // failed to establish connection + if (ch.isOpen()) + throw new RuntimeException("Channel should be closed"); + } + } + } } static void testCloseWhenPending() throws Exception { @@ -249,466 +275,460 @@ System.out.println("-- asynchronous close when reading --"); - Server server = new Server(); - ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); + try (Server server = new Server()) { + ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); - ByteBuffer dst = ByteBuffer.allocateDirect(100); - Future<Integer> result = ch.read(dst); + ByteBuffer dst = ByteBuffer.allocateDirect(100); + Future<Integer> result = ch.read(dst); - // attempt a second read - should fail with ReadPendingException - ByteBuffer buf = ByteBuffer.allocateDirect(100); - try { - ch.read(buf); - throw new RuntimeException("ReadPendingException expected"); - } catch (ReadPendingException x) { - } + // attempt a second read - should fail with ReadPendingException + ByteBuffer buf = ByteBuffer.allocateDirect(100); + try { + ch.read(buf); + throw new RuntimeException("ReadPendingException expected"); + } catch (ReadPendingException x) { + } - // close channel (should cause initial read to complete) - ch.close(); + // close channel (should cause initial read to complete) + ch.close(); + server.accept().close(); - // check that AsynchronousCloseException is thrown - try { - result.get(); - throw new RuntimeException("Should not read"); - } catch (ExecutionException x) { - if (!(x.getCause() instanceof AsynchronousCloseException)) - throw new RuntimeException(x); - } + // check that AsynchronousCloseException is thrown + try { + result.get(); + throw new RuntimeException("Should not read"); + } catch (ExecutionException x) { + if (!(x.getCause() instanceof AsynchronousCloseException)) + throw new RuntimeException(x); + } - System.out.println("-- asynchronous close when writing --"); + System.out.println("-- asynchronous close when writing --"); - ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); + ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); - final AtomicReference<Throwable> writeException = - new AtomicReference<Throwable>(); + final AtomicReference<Throwable> writeException = + new AtomicReference<Throwable>(); - // write bytes to fill socket buffer - ch.write(genBuffer(), ch, new CompletionHandler<Integer,AsynchronousSocketChannel>() { - public void completed(Integer result, AsynchronousSocketChannel ch) { - ch.write(genBuffer(), ch, this); - } - public void failed(Throwable x, AsynchronousSocketChannel ch) { - writeException.set(x); - } - }); + // write bytes to fill socket buffer + ch.write(genBuffer(), ch, new CompletionHandler<Integer,AsynchronousSocketChannel>() { + public void completed(Integer result, AsynchronousSocketChannel ch) { + ch.write(genBuffer(), ch, this); + } + public void failed(Throwable x, AsynchronousSocketChannel ch) { + writeException.set(x); + } + }); - // give time for socket buffer to fill up. - Thread.sleep(5*1000); + // give time for socket buffer to fill up. + Thread.sleep(5*1000); - // attempt a concurrent write - should fail with WritePendingException - try { - ch.write(genBuffer()); - throw new RuntimeException("WritePendingException expected"); - } catch (WritePendingException x) { - } + // attempt a concurrent write - should fail with WritePendingException + try { + ch.write(genBuffer()); + throw new RuntimeException("WritePendingException expected"); + } catch (WritePendingException x) { + } - // close channel - should cause initial write to complete - ch.close(); + // close channel - should cause initial write to complete + ch.close(); + server.accept().close(); - // wait for exception - while (writeException.get() == null) { - Thread.sleep(100); + // wait for exception + while (writeException.get() == null) { + Thread.sleep(100); + } + if (!(writeException.get() instanceof AsynchronousCloseException)) + throw new RuntimeException("AsynchronousCloseException expected"); } - if (!(writeException.get() instanceof AsynchronousCloseException)) - throw new RuntimeException("AsynchronousCloseException expected"); - - server.close(); } static void testCancel() throws Exception { System.out.println("-- cancel --"); - Server server = new Server(); - - for (int i=0; i<2; i++) { - boolean mayInterruptIfRunning = (i == 0) ? false : true; + try (Server server = new Server()) { + for (int i=0; i<2; i++) { + boolean mayInterruptIfRunning = (i == 0) ? false : true; - // establish loopback connection - AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); - SocketChannel peer = server.accept(); + // establish loopback connection + AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); + SocketChannel peer = server.accept(); - // start read operation - ByteBuffer buf = ByteBuffer.allocate(1); - Future<Integer> res = ch.read(buf); + // start read operation + ByteBuffer buf = ByteBuffer.allocate(1); + Future<Integer> res = ch.read(buf); - // cancel operation - boolean cancelled = res.cancel(mayInterruptIfRunning); + // cancel operation + boolean cancelled = res.cancel(mayInterruptIfRunning); - // check post-conditions - if (!res.isDone()) - throw new RuntimeException("isDone should return true"); - if (res.isCancelled() != cancelled) - throw new RuntimeException("isCancelled not consistent"); - try { - res.get(); - throw new RuntimeException("CancellationException expected"); - } catch (CancellationException x) { + // check post-conditions + if (!res.isDone()) + throw new RuntimeException("isDone should return true"); + if (res.isCancelled() != cancelled) + throw new RuntimeException("isCancelled not consistent"); + try { + res.get(); + throw new RuntimeException("CancellationException expected"); + } catch (CancellationException x) { + } + try { + res.get(1, TimeUnit.SECONDS); + throw new RuntimeException("CancellationException expected"); + } catch (CancellationException x) { + } + + // check that the cancel doesn't impact writing to the channel + if (!mayInterruptIfRunning) { + buf = ByteBuffer.wrap("a".getBytes()); + ch.write(buf).get(); + } + + ch.close(); + peer.close(); } - try { - res.get(1, TimeUnit.SECONDS); - throw new RuntimeException("CancellationException expected"); - } catch (CancellationException x) { - } - - // check that the cancel doesn't impact writing to the channel - if (!mayInterruptIfRunning) { - buf = ByteBuffer.wrap("a".getBytes()); - ch.write(buf).get(); - } - - ch.close(); - peer.close(); } - - server.close(); } static void testRead1() throws Exception { System.out.println("-- read (1) --"); - Server server = new Server(); - final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); + try (Server server = new Server()) { + final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); - // read with 0 bytes remaining should complete immediately - ByteBuffer buf = ByteBuffer.allocate(1); - buf.put((byte)0); - int n = ch.read(buf).get(); - if (n != 0) - throw new RuntimeException("0 expected"); + // read with 0 bytes remaining should complete immediately + ByteBuffer buf = ByteBuffer.allocate(1); + buf.put((byte)0); + int n = ch.read(buf).get(); + if (n != 0) + throw new RuntimeException("0 expected"); - // write bytes and close connection - SocketChannel sc = server.accept(); - ByteBuffer src = genBuffer(); - sc.setOption(StandardSocketOptions.SO_SNDBUF, src.remaining()); - while (src.hasRemaining()) - sc.write(src); - sc.close(); + // write bytes and close connection + ByteBuffer src = genBuffer(); + try (SocketChannel sc = server.accept()) { + sc.setOption(SO_SNDBUF, src.remaining()); + while (src.hasRemaining()) + sc.write(src); + } - // reads should complete immediately - final ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity() + 100); - final CountDownLatch latch = new CountDownLatch(1); - ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() { - public void completed(Integer result, Void att) { - int n = result; - if (n > 0) { - ch.read(dst, (Void)null, this); - } else { - latch.countDown(); + // reads should complete immediately + final ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity() + 100); + final CountDownLatch latch = new CountDownLatch(1); + ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() { + public void completed(Integer result, Void att) { + int n = result; + if (n > 0) { + ch.read(dst, (Void)null, this); + } else { + latch.countDown(); + } } - } - public void failed(Throwable exc, Void att) { - } - }); + public void failed(Throwable exc, Void att) { + } + }); - latch.await(); + latch.await(); - // check buffers - src.flip(); - dst.flip(); - if (!src.equals(dst)) { - throw new RuntimeException("Contents differ"); - } + // check buffers + src.flip(); + dst.flip(); + if (!src.equals(dst)) { + throw new RuntimeException("Contents differ"); + } - // close channel - ch.close(); + // close channel + ch.close(); - // check read fails with ClosedChannelException - try { - ch.read(dst).get(); - throw new RuntimeException("ExecutionException expected"); - } catch (ExecutionException x) { - if (!(x.getCause() instanceof ClosedChannelException)) - throw new RuntimeException("Cause of ClosedChannelException expected"); + // check read fails with ClosedChannelException + try { + ch.read(dst).get(); + throw new RuntimeException("ExecutionException expected"); + } catch (ExecutionException x) { + if (!(x.getCause() instanceof ClosedChannelException)) + throw new RuntimeException("Cause of ClosedChannelException expected"); + } } - - server.close(); } static void testRead2() throws Exception { System.out.println("-- read (2) --"); - Server server = new Server(); + try (Server server = new Server()) { + final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); + SocketChannel sc = server.accept(); - final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); - SocketChannel sc = server.accept(); - - ByteBuffer src = genBuffer(); + ByteBuffer src = genBuffer(); - // read until the buffer is full - final ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity()); - final CountDownLatch latch = new CountDownLatch(1); - ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() { - public void completed(Integer result, Void att) { - if (dst.hasRemaining()) { - ch.read(dst, (Void)null, this); - } else { - latch.countDown(); + // read until the buffer is full + final ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity()); + final CountDownLatch latch = new CountDownLatch(1); + ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() { + public void completed(Integer result, Void att) { + if (dst.hasRemaining()) { + ch.read(dst, (Void)null, this); + } else { + latch.countDown(); + } } - } - public void failed(Throwable exc, Void att) { - } - }); + public void failed(Throwable exc, Void att) { + } + }); - // trickle the writing - do { - int rem = src.remaining(); - int size = (rem <= 100) ? rem : 50 + rand.nextInt(rem - 100); - ByteBuffer buf = ByteBuffer.allocate(size); - for (int i=0; i<size; i++) - buf.put(src.get()); - buf.flip(); - Thread.sleep(50 + rand.nextInt(1500)); - while (buf.hasRemaining()) - sc.write(buf); - } while (src.hasRemaining()); + // trickle the writing + do { + int rem = src.remaining(); + int size = (rem <= 100) ? rem : 50 + rand.nextInt(rem - 100); + ByteBuffer buf = ByteBuffer.allocate(size); + for (int i=0; i<size; i++) + buf.put(src.get()); + buf.flip(); + Thread.sleep(50 + rand.nextInt(1500)); + while (buf.hasRemaining()) + sc.write(buf); + } while (src.hasRemaining()); - // wait until ascynrhonous reading has completed - latch.await(); + // wait until ascynrhonous reading has completed + latch.await(); - // check buffers - src.flip(); - dst.flip(); - if (!src.equals(dst)) { - throw new RuntimeException("Contents differ"); + // check buffers + src.flip(); + dst.flip(); + if (!src.equals(dst)) { + throw new RuntimeException("Contents differ"); + } + + sc.close(); + ch.close(); } - - sc.close(); - ch.close(); - server.close(); } // exercise scattering read static void testRead3() throws Exception { System.out.println("-- read (3) --"); - Server server = new Server(); - final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); - SocketChannel sc = server.accept(); + try (Server server = new Server()) { + final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); + SocketChannel sc = server.accept(); - ByteBuffer[] dsts = new ByteBuffer[3]; - for (int i=0; i<dsts.length; i++) { - dsts[i] = ByteBuffer.allocateDirect(100); - } + ByteBuffer[] dsts = new ByteBuffer[3]; + for (int i=0; i<dsts.length; i++) { + dsts[i] = ByteBuffer.allocateDirect(100); + } - // scattering read that completes ascynhronously - final CountDownLatch l1 = new CountDownLatch(1); - ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null, - new CompletionHandler<Long,Void>() { - public void completed(Long result, Void att) { - long n = result; - if (n <= 0) - throw new RuntimeException("No bytes read"); - l1.countDown(); - } - public void failed(Throwable exc, Void att) { - } - }); + // scattering read that completes ascynhronously + final CountDownLatch l1 = new CountDownLatch(1); + ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null, + new CompletionHandler<Long,Void>() { + public void completed(Long result, Void att) { + long n = result; + if (n <= 0) + throw new RuntimeException("No bytes read"); + l1.countDown(); + } + public void failed(Throwable exc, Void att) { + } + }); - // write some bytes - sc.write(genBuffer()); + // write some bytes + sc.write(genBuffer()); - // read should now complete - l1.await(); + // read should now complete + l1.await(); - // write more bytes - sc.write(genBuffer()); + // write more bytes + sc.write(genBuffer()); - // read should complete immediately - for (int i=0; i<dsts.length; i++) { - dsts[i].rewind(); - } + // read should complete immediately + for (int i=0; i<dsts.length; i++) { + dsts[i].rewind(); + } - final CountDownLatch l2 = new CountDownLatch(1); - ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null, - new CompletionHandler<Long,Void>() { - public void completed(Long result, Void att) { - long n = result; - if (n <= 0) - throw new RuntimeException("No bytes read"); - l2.countDown(); - } - public void failed(Throwable exc, Void att) { - } - }); - l2.await(); + final CountDownLatch l2 = new CountDownLatch(1); + ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null, + new CompletionHandler<Long,Void>() { + public void completed(Long result, Void att) { + long n = result; + if (n <= 0) + throw new RuntimeException("No bytes read"); + l2.countDown(); + } + public void failed(Throwable exc, Void att) { + } + }); + l2.await(); - ch.close(); - sc.close(); - server.close(); + ch.close(); + sc.close(); + } } static void testWrite1() throws Exception { System.out.println("-- write (1) --"); - Server server = new Server(); - final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); - SocketChannel sc = server.accept(); + try (Server server = new Server()) { + final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); + SocketChannel sc = server.accept(); - // write with 0 bytes remaining should complete immediately - ByteBuffer buf = ByteBuffer.allocate(1); - buf.put((byte)0); - int n = ch.write(buf).get(); - if (n != 0) - throw new RuntimeException("0 expected"); + // write with 0 bytes remaining should complete immediately + ByteBuffer buf = ByteBuffer.allocate(1); + buf.put((byte)0); + int n = ch.write(buf).get(); + if (n != 0) + throw new RuntimeException("0 expected"); - // write all bytes and close connection when done - final ByteBuffer src = genBuffer(); - ch.write(src, (Void)null, new CompletionHandler<Integer,Void>() { - public void completed(Integer result, Void att) { - if (src.hasRemaining()) { - ch.write(src, (Void)null, this); - } else { - try { - ch.close(); - } catch (IOException ignore) { } + // write all bytes and close connection when done + final ByteBuffer src = genBuffer(); + ch.write(src, (Void)null, new CompletionHandler<Integer,Void>() { + public void completed(Integer result, Void att) { + if (src.hasRemaining()) { + ch.write(src, (Void)null, this); + } else { + try { + ch.close(); + } catch (IOException ignore) { } + } + } + public void failed(Throwable exc, Void att) { } - } - public void failed(Throwable exc, Void att) { + }); + + // read to EOF or buffer full + ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity() + 100); + do { + n = sc.read(dst); + } while (n > 0); + sc.close(); + + // check buffers + src.flip(); + dst.flip(); + if (!src.equals(dst)) { + throw new RuntimeException("Contents differ"); } - }); - // read to EOF or buffer full - ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity() + 100); - do { - n = sc.read(dst); - } while (n > 0); - sc.close(); - - // check buffers - src.flip(); - dst.flip(); - if (!src.equals(dst)) { - throw new RuntimeException("Contents differ"); + // check write fails with ClosedChannelException + try { + ch.read(dst).get(); + throw new RuntimeException("ExecutionException expected"); + } catch (ExecutionException x) { + if (!(x.getCause() instanceof ClosedChannelException)) + throw new RuntimeException("Cause of ClosedChannelException expected"); + } } - - // check write fails with ClosedChannelException - try { - ch.read(dst).get(); - throw new RuntimeException("ExecutionException expected"); - } catch (ExecutionException x) { - if (!(x.getCause() instanceof ClosedChannelException)) - throw new RuntimeException("Cause of ClosedChannelException expected"); - } - - server.close(); } // exercise gathering write static void testWrite2() throws Exception { System.out.println("-- write (2) --"); - Server server = new Server(); - final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); - SocketChannel sc = server.accept(); + try (Server server = new Server()) { + final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); + SocketChannel sc = server.accept(); - // number of bytes written - final AtomicLong bytesWritten = new AtomicLong(0); + // number of bytes written + final AtomicLong bytesWritten = new AtomicLong(0); - // write buffers (should complete immediately) - ByteBuffer[] srcs = genBuffers(1); - final CountDownLatch l1 = new CountDownLatch(1); - ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null, - new CompletionHandler<Long,Void>() { - public void completed(Long result, Void att) { - long n = result; - if (n <= 0) - throw new RuntimeException("No bytes read"); - bytesWritten.addAndGet(n); - l1.countDown(); - } - public void failed(Throwable exc, Void att) { - } - }); - l1.await(); + // write buffers (should complete immediately) + ByteBuffer[] srcs = genBuffers(1); + final CountDownLatch l1 = new CountDownLatch(1); + ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null, + new CompletionHandler<Long,Void>() { + public void completed(Long result, Void att) { + long n = result; + if (n <= 0) + throw new RuntimeException("No bytes read"); + bytesWritten.addAndGet(n); + l1.countDown(); + } + public void failed(Throwable exc, Void att) { + } + }); + l1.await(); - // set to true to signal that no more buffers should be written - final AtomicBoolean continueWriting = new AtomicBoolean(true); + // set to true to signal that no more buffers should be written + final AtomicBoolean continueWriting = new AtomicBoolean(true); - // write until socket buffer is full so as to create the conditions - // for when a write does not complete immediately - srcs = genBuffers(1); - ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null, - new CompletionHandler<Long,Void>() { - public void completed(Long result, Void att) { - long n = result; - if (n <= 0) - throw new RuntimeException("No bytes written"); - bytesWritten.addAndGet(n); - if (continueWriting.get()) { - ByteBuffer[] srcs = genBuffers(8); - ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, - (Void)null, this); + // write until socket buffer is full so as to create the conditions + // for when a write does not complete immediately + srcs = genBuffers(1); + ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null, + new CompletionHandler<Long,Void>() { + public void completed(Long result, Void att) { + long n = result; + if (n <= 0) + throw new RuntimeException("No bytes written"); + bytesWritten.addAndGet(n); + if (continueWriting.get()) { + ByteBuffer[] srcs = genBuffers(8); + ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, + (Void)null, this); + } } - } - public void failed(Throwable exc, Void att) { - } - }); + public void failed(Throwable exc, Void att) { + } + }); - // give time for socket buffer to fill up. - Thread.sleep(5*1000); + // give time for socket buffer to fill up. + Thread.sleep(5*1000); - // signal handler to stop further writing - continueWriting.set(false); + // signal handler to stop further writing + continueWriting.set(false); - // read until done - ByteBuffer buf = ByteBuffer.allocateDirect(4096); - long total = 0L; - do { - int n = sc.read(buf); - if (n <= 0) - throw new RuntimeException("No bytes read"); - buf.rewind(); - total += n; - } while (total < bytesWritten.get()); + // read until done + ByteBuffer buf = ByteBuffer.allocateDirect(4096); + long total = 0L; + do { + int n = sc.read(buf); + if (n <= 0) + throw new RuntimeException("No bytes read"); + buf.rewind(); + total += n; + } while (total < bytesWritten.get()); - ch.close(); - sc.close(); - server.close(); + ch.close(); + sc.close(); + } } static void testShutdown() throws Exception { System.out.println("-- shutdown--"); - Server server = new Server(); - AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); - SocketChannel sc = server.accept(); - - ByteBuffer buf = ByteBuffer.allocateDirect(1000); - int n; + try (Server server = new Server(); + AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) + { + ch.connect(server.address()).get(); + try (SocketChannel peer = server.accept()) { + ByteBuffer buf = ByteBuffer.allocateDirect(1000); + int n; - // check read - ch.shutdownInput(); - n = ch.read(buf).get(); - if (n != -1) - throw new RuntimeException("-1 expected"); - // check full with full buffer - buf.put(new byte[100]); - n = ch.read(buf).get(); - if (n != -1) - throw new RuntimeException("-1 expected"); + // check read + ch.shutdownInput(); + n = ch.read(buf).get(); + if (n != -1) + throw new RuntimeException("-1 expected"); + // check full with full buffer + buf.put(new byte[100]); + n = ch.read(buf).get(); + if (n != -1) + throw new RuntimeException("-1 expected"); - // check write - ch.shutdownOutput(); - try { - ch.write(buf).get(); - throw new RuntimeException("ClosedChannelException expected"); - } catch (ExecutionException x) { - if (!(x.getCause() instanceof ClosedChannelException)) - throw new RuntimeException("ClosedChannelException expected"); + // check write + ch.shutdownOutput(); + try { + ch.write(buf).get(); + throw new RuntimeException("ClosedChannelException expected"); + } catch (ExecutionException x) { + if (!(x.getCause() instanceof ClosedChannelException)) + throw new RuntimeException("ClosedChannelException expected"); + } + } } - - sc.close(); - ch.close(); - server.close(); } static void testTimeout() throws Exception { @@ -720,88 +740,88 @@ } static void testTimeout(final long timeout, final TimeUnit unit) throws Exception { - Server server = new Server(); - AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); - ch.connect(server.address()).get(); + try (Server server = new Server()) { + AsynchronousSocketChannel ch = AsynchronousSocketChannel.open(); + ch.connect(server.address()).get(); - ByteBuffer dst = ByteBuffer.allocate(512); + ByteBuffer dst = ByteBuffer.allocate(512); - final AtomicReference<Throwable> readException = new AtomicReference<Throwable>(); + final AtomicReference<Throwable> readException = new AtomicReference<Throwable>(); - // this read should timeout if value is > 0 - ch.read(dst, timeout, unit, null, new CompletionHandler<Integer,Void>() { - public void completed(Integer result, Void att) { - readException.set(new RuntimeException("Should not complete")); - } - public void failed(Throwable exc, Void att) { - readException.set(exc); + // this read should timeout if value is > 0 + ch.read(dst, timeout, unit, null, new CompletionHandler<Integer,Void>() { + public void completed(Integer result, Void att) { + readException.set(new RuntimeException("Should not complete")); + } + public void failed(Throwable exc, Void att) { + readException.set(exc); + } + }); + if (timeout > 0L) { + // wait for exception + while (readException.get() == null) { + Thread.sleep(100); + } + if (!(readException.get() instanceof InterruptedByTimeoutException)) + throw new RuntimeException("InterruptedByTimeoutException expected"); + + // after a timeout then further reading should throw unspecified runtime exception + boolean exceptionThrown = false; + try { + ch.read(dst); + } catch (RuntimeException x) { + exceptionThrown = true; + } + if (!exceptionThrown) + throw new RuntimeException("RuntimeException expected after timeout."); + } else { + Thread.sleep(1000); + Throwable exc = readException.get(); + if (exc != null) + throw new RuntimeException(exc); } - }); - if (timeout > 0L) { - // wait for exception - while (readException.get() == null) { - Thread.sleep(100); - } - if (!(readException.get() instanceof InterruptedByTimeoutException)) - throw new RuntimeException("InterruptedByTimeoutException expected"); - - // after a timeout then further reading should throw unspecified runtime exception - boolean exceptionThrown = false; - try { - ch.read(dst); - } catch (RuntimeException x) { - exceptionThrown = true; - } - if (!exceptionThrown) - throw new RuntimeException("RuntimeException expected after timeout."); - } else { - Thread.sleep(1000); - Throwable exc = readException.get(); - if (exc != null) - throw new RuntimeException(exc); - } - final AtomicReference<Throwable> writeException = new AtomicReference<Throwable>(); + final AtomicReference<Throwable> writeException = new AtomicReference<Throwable>(); - // write bytes to fill socket buffer - ch.write(genBuffer(), timeout, unit, ch, - new CompletionHandler<Integer,AsynchronousSocketChannel>() - { - public void completed(Integer result, AsynchronousSocketChannel ch) { - ch.write(genBuffer(), timeout, unit, ch, this); - } - public void failed(Throwable exc, AsynchronousSocketChannel ch) { - writeException.set(exc); - } - }); - if (timeout > 0) { - // wait for exception - while (writeException.get() == null) { - Thread.sleep(100); - } - if (!(writeException.get() instanceof InterruptedByTimeoutException)) - throw new RuntimeException("InterruptedByTimeoutException expected"); + // write bytes to fill socket buffer + ch.write(genBuffer(), timeout, unit, ch, + new CompletionHandler<Integer,AsynchronousSocketChannel>() + { + public void completed(Integer result, AsynchronousSocketChannel ch) { + ch.write(genBuffer(), timeout, unit, ch, this); + } + public void failed(Throwable exc, AsynchronousSocketChannel ch) { + writeException.set(exc); + } + }); + if (timeout > 0) { + // wait for exception + while (writeException.get() == null) { + Thread.sleep(100); + } + if (!(writeException.get() instanceof InterruptedByTimeoutException)) + throw new RuntimeException("InterruptedByTimeoutException expected"); - // after a timeout then further writing should throw unspecified runtime exception - boolean exceptionThrown = false; - try { - ch.write(genBuffer()); - } catch (RuntimeException x) { - exceptionThrown = true; + // after a timeout then further writing should throw unspecified runtime exception + boolean exceptionThrown = false; + try { + ch.write(genBuffer()); + } catch (RuntimeException x) { + exceptionThrown = true; + } + if (!exceptionThrown) + throw new RuntimeException("RuntimeException expected after timeout."); + } else { + Thread.sleep(1000); + Throwable exc = writeException.get(); + if (exc != null) + throw new RuntimeException(exc); } - if (!exceptionThrown) - throw new RuntimeException("RuntimeException expected after timeout."); - } else { - Thread.sleep(1000); - Throwable exc = writeException.get(); - if (exc != null) - throw new RuntimeException(exc); + + // clean-up + server.accept().close(); + ch.close(); } - - // clean-up - server.accept().close(); - ch.close(); - server.close(); } // returns ByteBuffer with random bytes
--- a/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ /* @test - * @bug 4607272 6999915 + * @bug 4607272 6999915 7185340 * @summary Unit test for AsynchronousSocketChannel - * @run main/othervm -XX:+DisableExplicitGC -XX:MaxDirectMemorySize=64m Leaky + * @run main/othervm -XX:+DisableExplicitGC -XX:MaxDirectMemorySize=75m Leaky */ import java.nio.ByteBuffer;
--- a/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,29 +27,16 @@ * @library .. */ -import java.io.*; import java.net.*; -import java.nio.*; import java.nio.channels.*; -import java.nio.charset.*; import java.util.*; public class AdaptDatagramSocket { static java.io.PrintStream out = System.out; - static Random rand = new Random(); - static final int ECHO_PORT = 7; - static final int DISCARD_PORT = 9; - static final String REMOTE_HOST = TestUtil.HOST; - - static final InetSocketAddress echoAddress - = new InetSocketAddress(REMOTE_HOST, ECHO_PORT); - static final InetSocketAddress discardAddress - = new InetSocketAddress(REMOTE_HOST, DISCARD_PORT); - static String toString(DatagramPacket dp) { return ("DatagramPacket[off=" + dp.getOffset() + ", len=" + dp.getLength() @@ -88,10 +75,11 @@ out.println("rtt: " + (System.currentTimeMillis() - start)); out.println("post op: " + toString(op) + " ip: " + toString(ip)); - for (int i = 0; i < ip.getLength(); i++) + for (int i = 0; i < ip.getLength(); i++) { if (ip.getData()[ip.getOffset() + i] != op.getData()[op.getOffset() + i]) throw new Exception("Incorrect data received"); + } if (!(ip.getSocketAddress().equals(dst))) { throw new Exception("Incorrect sender address, expected: " + dst @@ -130,8 +118,9 @@ ds.setSoTimeout(timeout); out.println("timeout: " + ds.getSoTimeout()); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { test(ds, dst, shouldTimeout); + } // Leave the socket open so that we don't reuse the old src address //ds.close(); @@ -139,10 +128,23 @@ } public static void main(String[] args) throws Exception { - test(echoAddress, 0, false, false); - test(echoAddress, 0, false, true); - test(echoAddress, 5000, false, false); - test(discardAddress, 10, true, false); + // need an UDP echo server + try (TestServers.UdpEchoServer echoServer + = TestServers.UdpEchoServer.startNewServer(100)) { + final InetSocketAddress address + = new InetSocketAddress(echoServer.getAddress(), + echoServer.getPort()); + test(address, 0, false, false); + test(address, 0, false, true); + test(address, 5000, false, false); + } + try (TestServers.UdpDiscardServer discardServer + = TestServers.UdpDiscardServer.startNewServer()) { + final InetSocketAddress address + = new InetSocketAddress(discardServer.getAddress(), + discardServer.getPort()); + test(address, 10, true, false); + } } }
--- a/test/java/nio/channels/DatagramChannel/IsBound.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/DatagramChannel/IsBound.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,21 +34,25 @@ public class IsBound { public static void main(String argv[]) throws Exception { - InetSocketAddress isa = new InetSocketAddress( - InetAddress.getByName(TestUtil.HOST), 13); - ByteBuffer bb = ByteBuffer.allocateDirect(256); - bb.put("hello".getBytes()); - bb.flip(); + try (TestServers.UdpDayTimeServer daytimeServer + = TestServers.UdpDayTimeServer.startNewServer(100)) { + InetSocketAddress isa = new InetSocketAddress( + daytimeServer.getAddress(), + daytimeServer.getPort()); + ByteBuffer bb = ByteBuffer.allocateDirect(256); + bb.put("hello".getBytes()); + bb.flip(); - DatagramChannel dc = DatagramChannel.open(); - dc.send(bb, isa); - if(!dc.socket().isBound()) - throw new Exception("Test failed"); - dc.close(); + DatagramChannel dc = DatagramChannel.open(); + dc.send(bb, isa); + if(!dc.socket().isBound()) + throw new Exception("Test failed"); + dc.close(); - dc = DatagramChannel.open(); - if(dc.socket().isBound()) - throw new Exception("Test failed"); - dc.close(); + dc = DatagramChannel.open(); + if(dc.socket().isBound()) + throw new Exception("Test failed"); + dc.close(); + } } }
--- a/test/java/nio/channels/DatagramChannel/IsConnected.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/DatagramChannel/IsConnected.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,21 +28,23 @@ */ import java.net.*; -import java.nio.*; import java.nio.channels.*; public class IsConnected { public static void main(String argv[]) throws Exception { - InetSocketAddress isa = new InetSocketAddress( - InetAddress.getByName(TestUtil.HOST), 13); - DatagramChannel dc = DatagramChannel.open(); - dc.configureBlocking(true); - dc.connect(isa); - if (!dc.isConnected()) - throw new RuntimeException("channel.isConnected inconsistent"); - if (!dc.socket().isConnected()) - throw new RuntimeException("socket.isConnected inconsistent"); - dc.close(); + try (TestServers.UdpDayTimeServer daytimeServer + = TestServers.UdpDayTimeServer.startNewServer(100)) { + InetSocketAddress isa = new InetSocketAddress( + daytimeServer.getAddress(), daytimeServer.getPort()); + DatagramChannel dc = DatagramChannel.open(); + dc.configureBlocking(true); + dc.connect(isa); + if (!dc.isConnected()) + throw new RuntimeException("channel.isConnected inconsistent"); + if (!dc.socket().isConnected()) + throw new RuntimeException("socket.isConnected inconsistent"); + dc.close(); + } } }
--- a/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java Fri Jun 21 15:46:14 2013 -0500 @@ -22,7 +22,7 @@ */ /* @test - * @bug 6935563 + * @bug 6935563 7044870 * @summary Test that Selector does not select an unconnected DatagramChannel when * ICMP port unreachable received */ @@ -35,14 +35,15 @@ public class SelectWhenRefused { public static void main(String[] args) throws IOException { - DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0)); - int port = dc.socket().getLocalPort(); - dc.close(); + DatagramChannel dc1 = DatagramChannel.open().bind(new InetSocketAddress(0)); + int port = dc1.socket().getLocalPort(); // datagram sent to this address should be refused SocketAddress refuser = new InetSocketAddress(InetAddress.getLocalHost(), port); - dc = DatagramChannel.open().bind(new InetSocketAddress(0)); + DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0)); + dc1.close(); + Selector sel = Selector.open(); try { dc.configureBlocking(false); @@ -52,6 +53,10 @@ sendDatagram(dc, refuser); int n = sel.select(2000); if (n > 0) { + sel.selectedKeys().clear(); + // BindException will be thrown if another service is using + // our expected refuser port, cannot run just exit. + DatagramChannel.open().bind(refuser).close(); throw new RuntimeException("Unexpected wakeup"); } @@ -80,6 +85,8 @@ throw new RuntimeException("Unexpected wakeup after disconnect"); } + } catch(BindException e) { + // Do nothing, some other test has used this port } finally { sel.close(); dc.close();
--- a/test/java/nio/channels/Selector/Alias.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/Selector/Alias.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,12 +27,11 @@ * @library .. */ -import java.io.*; import java.net.*; import java.nio.*; import java.nio.channels.*; +import java.nio.channels.spi.SelectorProvider; import java.util.*; -import java.nio.channels.spi.SelectorProvider; public class Alias { @@ -40,18 +39,26 @@ static int LIMIT = 20; // Hangs after just 1 if problem is present public static void main(String[] args) throws Exception { - test1(); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + test1(daytimeServer); + } } - public static void test1() throws Exception { + static void test1(TestServers.DayTimeServer daytimeServer) throws Exception { Selector selector = SelectorProvider.provider().openSelector(); - InetAddress myAddress=InetAddress.getByName(TestUtil.HOST); - InetSocketAddress isa = new InetSocketAddress(myAddress,13); + InetAddress myAddress = daytimeServer.getAddress(); + InetSocketAddress isa + = new InetSocketAddress(myAddress, + daytimeServer.getPort()); for (int j=0; j<LIMIT; j++) { SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); boolean result = sc.connect(isa); + + // On some platforms - given that we're using a local server, + // we may not enter into the if () { } statement below... if (!result) { SelectionKey key = sc.register(selector, SelectionKey.OP_CONNECT);
--- a/test/java/nio/channels/Selector/BasicConnect.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/Selector/BasicConnect.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,12 +27,10 @@ * @library .. */ -import java.io.*; import java.net.*; import java.nio.*; import java.nio.channels.*; import java.nio.channels.spi.SelectorProvider; -import java.nio.charset.*; import java.util.*; @@ -44,52 +42,57 @@ public class BasicConnect { - static final int PORT = 7; // echo - static final String HOST = TestUtil.HOST; - public static void main(String[] args) throws Exception { Selector connectSelector = SelectorProvider.provider().openSelector(); - InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(HOST), PORT); - SocketChannel sc = SocketChannel.open(); - sc.configureBlocking(false); - boolean result = sc.connect(isa); - while (!result) { - SelectionKey connectKey = sc.register(connectSelector, - SelectionKey.OP_CONNECT); - int keysAdded = connectSelector.select(); - if (keysAdded > 0) { - Set readyKeys = connectSelector.selectedKeys(); - Iterator i = readyKeys.iterator(); - while (i.hasNext()) { - SelectionKey sk = (SelectionKey)i.next(); - i.remove(); - SocketChannel nextReady = (SocketChannel)sk.channel(); - result = nextReady.finishConnect(); - if (result) - sk.cancel(); + try (TestServers.EchoServer echoServer + = TestServers.EchoServer.startNewServer(100)) { + InetSocketAddress isa + = new InetSocketAddress(echoServer.getAddress(), + echoServer.getPort()); + SocketChannel sc = SocketChannel.open(); + sc.configureBlocking(false); + boolean result = sc.connect(isa); + if (result) { + System.out.println("Socket immediately connected on " + + System.getProperty("os.name") + + ": " + sc); + } + while (!result) { + SelectionKey connectKey = sc.register(connectSelector, + SelectionKey.OP_CONNECT); + int keysAdded = connectSelector.select(); + if (keysAdded > 0) { + Set readyKeys = connectSelector.selectedKeys(); + Iterator i = readyKeys.iterator(); + while (i.hasNext()) { + SelectionKey sk = (SelectionKey)i.next(); + i.remove(); + SocketChannel nextReady = (SocketChannel)sk.channel(); + result = nextReady.finishConnect(); + if (result) + sk.cancel(); + } } } - } - byte[] bs = new byte[] { (byte)0xca, (byte)0xfe, - (byte)0xba, (byte)0xbe }; - ByteBuffer bb = ByteBuffer.wrap(bs); - sc.configureBlocking(true); - sc.write(bb); - bb.rewind(); + byte[] bs = new byte[] { (byte)0xca, (byte)0xfe, + (byte)0xba, (byte)0xbe }; + ByteBuffer bb = ByteBuffer.wrap(bs); + sc.configureBlocking(true); + sc.write(bb); + bb.rewind(); - ByteBuffer bb2 = ByteBuffer.allocateDirect(100); - int n = sc.read(bb2); - bb2.flip(); + ByteBuffer bb2 = ByteBuffer.allocateDirect(100); + int n = sc.read(bb2); + bb2.flip(); - sc.close(); - connectSelector.close(); + sc.close(); + connectSelector.close(); - if (!bb.equals(bb2)) - throw new Exception("Echoed bytes incorrect: Sent " - + bb + ", got " + bb2); + if (!bb.equals(bb2)) + throw new Exception("Echoed bytes incorrect: Sent " + + bb + ", got " + bb2); + } } - }
--- a/test/java/nio/channels/Selector/Connect.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/Selector/Connect.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,12 +27,11 @@ * @library .. */ -import java.io.*; import java.net.*; import java.nio.*; import java.nio.channels.*; +import java.nio.channels.spi.SelectorProvider; import java.util.*; -import java.nio.channels.spi.SelectorProvider; public class Connect { @@ -40,12 +39,18 @@ static int LIMIT = 100; public static void main(String[] args) throws Exception { - scaleTest(); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(50)) { + scaleTest(daytimeServer); + } } - public static void scaleTest() throws Exception { - InetAddress myAddress=InetAddress.getByName(TestUtil.HOST); - InetSocketAddress isa = new InetSocketAddress(myAddress,13); + static void scaleTest(TestServers.DayTimeServer daytimeServer) + throws Exception + { + InetAddress myAddress = daytimeServer.getAddress(); + InetSocketAddress isa + = new InetSocketAddress(myAddress, daytimeServer.getPort()); for (int j=0; j<LIMIT; j++) { SocketChannel sc = SocketChannel.open();
--- a/test/java/nio/channels/Selector/ConnectWrite.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/Selector/ConnectWrite.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,23 +27,25 @@ * @library .. */ -import java.io.*; import java.net.*; -import java.nio.*; import java.nio.channels.*; +import java.nio.channels.spi.SelectorProvider; import java.util.*; -import java.nio.channels.spi.SelectorProvider; public class ConnectWrite { public static void main(String[] args) throws Exception { - test1(13); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(25)) { + test1(daytimeServer); + } } - public static void test1(int port) throws Exception { + static void test1(TestServers.DayTimeServer daytimeServer) throws Exception { Selector selector = SelectorProvider.provider().openSelector(); - InetAddress myAddress=InetAddress.getByName(TestUtil.HOST); - InetSocketAddress isa = new InetSocketAddress(myAddress, port); + InetAddress myAddress = daytimeServer.getAddress(); + InetSocketAddress isa + = new InetSocketAddress(myAddress, daytimeServer.getPort()); SocketChannel sc = SocketChannel.open(); try { sc.configureBlocking(false);
--- a/test/java/nio/channels/Selector/KeysReady.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/Selector/KeysReady.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,21 +28,15 @@ */ import java.net.*; -import java.io.*; -import java.nio.*; import java.nio.channels.*; -import java.nio.charset.*; import java.nio.channels.spi.SelectorProvider; public class KeysReady { - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; - - static void test() throws Exception { + static void test(TestServers.DayTimeServer dayTimeServer) throws Exception { InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + = new InetSocketAddress(dayTimeServer.getAddress(), + dayTimeServer.getPort()); SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); sc.connect(isa); @@ -64,7 +58,10 @@ } public static void main(String[] args) throws Exception { - test(); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(50)) { + test(daytimeServer); + } } }
--- a/test/java/nio/channels/SocketChannel/AdaptSocket.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/AdaptSocket.java Fri Jun 21 15:46:14 2013 -0500 @@ -35,19 +35,16 @@ static java.io.PrintStream out = System.out; - static final int ECHO_PORT = 7; - static final int DAYTIME_PORT = 13; - static final String REMOTE_HOST = TestUtil.HOST; - static final String VERY_REMOTE_HOST = TestUtil.FAR_HOST; - - static void test(String hn, int timeout, boolean shouldTimeout) + static void test(TestServers.DayTimeServer dayTimeServer, + int timeout, + boolean shouldTimeout) throws Exception { out.println(); InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(hn), - DAYTIME_PORT); + = new InetSocketAddress(dayTimeServer.getAddress(), + dayTimeServer.getPort()); SocketChannel sc = SocketChannel.open(); Socket so = sc.socket(); out.println("opened: " + so); @@ -116,13 +113,16 @@ } } - static void testRead(String hn, int timeout, boolean shouldTimeout) + static void testRead(TestServers.EchoServer echoServer, + int timeout, + boolean shouldTimeout) throws Exception { out.println(); InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(hn), ECHO_PORT); + = new InetSocketAddress(echoServer.getAddress(), + echoServer.getPort()); SocketChannel sc = SocketChannel.open(); sc.connect(isa); Socket so = sc.socket(); @@ -134,22 +134,38 @@ out.println("timeout: " + so.getSoTimeout()); testRead(so, shouldTimeout); - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { testRead(so, shouldTimeout); + } sc.close(); } public static void main(String[] args) throws Exception { - test(REMOTE_HOST, 0, false); - test(REMOTE_HOST, 1000, false); - test(VERY_REMOTE_HOST, 10, true); + try (TestServers.DayTimeServer dayTimeServer + = TestServers.DayTimeServer.startNewServer()) { + test(dayTimeServer, 0, false); + test(dayTimeServer, 1000, false); + } - testRead(REMOTE_HOST, 0, false); - testRead(REMOTE_HOST, 8000, false); - testRead(VERY_REMOTE_HOST, 10, true); + try (TestServers.DayTimeServer lingerDayTimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + // this test no longer really test the connection timeout + // since there is no way to prevent the server from eagerly + // accepting connection... + test(lingerDayTimeServer, 10, true); + } - } + try (TestServers.EchoServer echoServer + = TestServers.EchoServer.startNewServer()) { + testRead(echoServer, 0, false); + testRead(echoServer, 8000, false); + } + try (TestServers.EchoServer lingerEchoServer + = TestServers.EchoServer.startNewServer(100)) { + testRead(lingerEchoServer, 10, true); + } + } }
--- a/test/java/nio/channels/SocketChannel/Basic.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/Basic.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,13 +36,10 @@ static java.io.PrintStream out = System.out; - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; - - static void test() throws Exception { + static void test(TestServers.DayTimeServer daytimeServer) throws Exception { InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); SocketChannel sc = SocketChannel.open(isa); out.println("opened: " + sc); /* @@ -76,7 +73,10 @@ } public static void main(String[] args) throws Exception { - test(); + try (TestServers.DayTimeServer dayTimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + test(dayTimeServer); + } } }
--- a/test/java/nio/channels/SocketChannel/BufferSize.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/BufferSize.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,17 +28,10 @@ */ import java.nio.channels.*; -import java.net.*; public class BufferSize { - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; - public static void main(String[] args) throws Exception { - InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); ServerSocketChannel sc = ServerSocketChannel.open(); try { sc.socket().setReceiveBufferSize(-1);
--- a/test/java/nio/channels/SocketChannel/Connect.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/Connect.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,9 +27,9 @@ * @library .. */ +import java.net.*; import java.nio.*; import java.nio.channels.*; -import java.net.*; import java.util.*; public class Connect { @@ -37,21 +37,26 @@ private static final long INCREMENTAL_DELAY = 30L * 1000L; public static void main(String args[]) throws Exception { - test1(TestUtil.HOST); + try (TestServers.EchoServer echoServer + = TestServers.EchoServer.startNewServer(1000)) { + test1(echoServer); + } try { - test1(TestUtil.REFUSING_HOST); + TestServers.RefusingServer refusingServer + = TestServers.RefusingServer.startNewServer(); + test1(refusingServer); throw new Exception("Refused connection throws no exception"); } catch (ConnectException ce) { // Correct result } } - static void test1(String hostname) throws Exception { + static void test1(TestServers.AbstractServer server) throws Exception { Selector selector; SocketChannel sc; SelectionKey sk; InetSocketAddress isa = new InetSocketAddress( - InetAddress.getByName (hostname), 80); + server.getAddress(), server.getPort()); sc = SocketChannel.open(); sc.configureBlocking(false);
--- a/test/java/nio/channels/SocketChannel/ConnectState.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/ConnectState.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,20 +30,39 @@ import java.net.*; import java.nio.*; import java.nio.channels.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; public class ConnectState { static PrintStream log = System.err; - static String REMOTE_HOST = TestUtil.HOST; - static int REMOTE_PORT = 7; // echo static InetSocketAddress remote; final static int ST_UNCONNECTED = 0; final static int ST_PENDING = 1; final static int ST_CONNECTED = 2; final static int ST_CLOSED = 3; + final static int ST_PENDING_OR_CONNECTED = 4; + // NO exceptions expected + final static Collection<Class<?>> NONE = Collections.emptySet(); + + // make a set of expected exception. + static Collection<Class<?>> expectedExceptions(Class<?>... expected) { + final Collection<Class<?>> exceptions; + if (expected.length == 0) { + exceptions = NONE; + } else if (expected.length == 1) { + assert expected[0] != null; + exceptions = Collections.<Class<?>>singleton(expected[0]); + } else { + exceptions = new HashSet<>(Arrays.asList(expected)); + } + return exceptions; + } static abstract class Test { @@ -76,37 +95,65 @@ check(!sc.isConnectionPending(), "!isConnectionPending"); check(sc.isOpen(), "isOpen"); break; + case ST_PENDING_OR_CONNECTED: + check(sc.isConnected() || sc.isConnectionPending(), + "isConnected || isConnectionPending"); + check(sc.isOpen(), "isOpen"); + break; } } - Test(String name, Class exception, int state) throws Exception { + Test(String name, Class<?> exception, int state) throws Exception { + this(name, expectedExceptions(exception), state); + } + + // On some architecture we may need to accept several exceptions. + // For instance on Solaris, when using a server colocated on the + // machine we cannot guarantee that we will get a + // ConnectionPendingException when connecting twice on the same + // non-blocking socket. We may instead get a an + // AlreadyConnectedException, which is also valid: it simply means + // that the first connection has been immediately accepted. + Test(String name, Collection<Class<?>> exceptions, int state) + throws Exception { SocketChannel sc = SocketChannel.open(); - String note = null; + String note; try { try { note = go(sc); } catch (Exception x) { - if (exception != null) { + Class<?> expectedExceptionClass = null; + for (Class<?> exception : exceptions) { if (exception.isInstance(x)) { log.println(name + ": As expected: " + x); + expectedExceptionClass = exception; check(sc, state); - return; - } else { - throw new Exception(name + break; + } + } + if (expectedExceptionClass == null + && !exceptions.isEmpty()) { + // we had an exception, but it's not of the set of + // exceptions we expected. + throw new Exception(name + ": Incorrect exception", x); - } - } else { + } else if (exceptions.isEmpty()) { + // we didn't expect any exception throw new Exception(name + ": Unexpected exception", x); } + // if we reach here, we have our expected exception + assert expectedExceptionClass != null; + return; } - if (exception != null) + if (!exceptions.isEmpty()) { throw new Exception(name + ": Expected exception not thrown: " - + exception); + + exceptions.iterator().next()); + } check(sc, state); log.println(name + ": Returned normally" + ((note != null) ? ": " + note : "")); @@ -123,6 +170,7 @@ new Test("Read unconnected", NotYetConnectedException.class, ST_UNCONNECTED) { + @Override String go(SocketChannel sc) throws Exception { ByteBuffer b = ByteBuffer.allocateDirect(1024); sc.read(b); @@ -131,19 +179,22 @@ new Test("Write unconnected", NotYetConnectedException.class, ST_UNCONNECTED) { + @Override String go(SocketChannel sc) throws Exception { ByteBuffer b = ByteBuffer.allocateDirect(1024); sc.write(b); return null; }}; - new Test("Simple connect", null, ST_CONNECTED) { + new Test("Simple connect", NONE, ST_CONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.connect(remote); return null; }}; - new Test("Simple connect & finish", null, ST_CONNECTED) { + new Test("Simple connect & finish", NONE, ST_CONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.connect(remote); if (!sc.finishConnect()) @@ -153,6 +204,7 @@ new Test("Double connect", AlreadyConnectedException.class, ST_CONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.connect(remote); sc.connect(remote); @@ -161,12 +213,16 @@ new Test("Finish w/o start", NoConnectionPendingException.class, ST_UNCONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.finishConnect(); return null; }}; - new Test("NB simple connect", null, ST_CONNECTED) { + // Note: using our local EchoServer rather than echo on a distant + // host - we see that Tries to finish = 0 (instead of ~ 18). + new Test("NB simple connect", NONE, ST_CONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.configureBlocking(false); sc.connect(remote); @@ -179,8 +235,15 @@ return ("Tries to finish = " + n); }}; + // Note: using our local EchoServer rather than echo on a distant + // host - we cannot guarantee that this test will get a + // a ConnectionPendingException: it may get an + // AlreadyConnectedException, so we should allow for both. new Test("NB double connect", - ConnectionPendingException.class, ST_PENDING) { + expectedExceptions(ConnectionPendingException.class, + AlreadyConnectedException.class), + ST_PENDING_OR_CONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.configureBlocking(false); sc.connect(remote); @@ -190,13 +253,15 @@ new Test("NB finish w/o start", NoConnectionPendingException.class, ST_UNCONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.configureBlocking(false); sc.finishConnect(); return null; }}; - new Test("NB connect, B finish", null, ST_CONNECTED) { + new Test("NB connect, B finish", NONE, ST_CONNECTED) { + @Override String go(SocketChannel sc) throws Exception { sc.configureBlocking(false); sc.connect(remote); @@ -208,9 +273,12 @@ } public static void main(String[] args) throws Exception { - remote = new InetSocketAddress(InetAddress.getByName(REMOTE_HOST), - REMOTE_PORT); - tests(); + try (TestServers.EchoServer echoServer + = TestServers.EchoServer.startNewServer(500)) { + remote = new InetSocketAddress(echoServer.getAddress(), + echoServer.getPort()); + tests(); + } } }
--- a/test/java/nio/channels/SocketChannel/FinishConnect.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/FinishConnect.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,21 +36,25 @@ public class FinishConnect { - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; - public static void main(String[] args) throws Exception { - test1(true, true); - test1(true, false); - test1(false, true); - test1(false, false); - test2(); + try (TestServers.DayTimeServer dayTimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + test1(dayTimeServer, true, true); + test1(dayTimeServer, true, false); + test1(dayTimeServer, false, true); + test1(dayTimeServer, false, false); + test2(dayTimeServer); + } } - static void test1(boolean select, boolean setBlocking) throws Exception { + static void test1(TestServers.DayTimeServer daytimeServer, + boolean select, + boolean setBlocking) + throws Exception + { InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); boolean connected = sc.connect(isa); @@ -109,15 +113,27 @@ sc.close(); } - static void test2() throws Exception { + static void test2(TestServers.DayTimeServer daytimeServer) throws Exception { InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); boolean done = false; int globalAttempts = 0; + int connectSuccess = 0; while (!done) { - if (globalAttempts++ > 50) + // When using a local daytime server it is not always possible + // to get a pending connection, as sc.connect(isa) may always + // return true. + // So we're going to throw the exception only if there was + // at least 1 case where we did not manage to connect. + if (globalAttempts++ > 50) { + if (globalAttempts == connectSuccess + 1) { + System.out.println("Can't fully test on " + + System.getProperty("os.name")); + break; + } throw new RuntimeException("Failed to connect"); + } SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); boolean connected = sc.connect(isa); @@ -132,6 +148,9 @@ } Thread.sleep(10); } + if (connected) { + connectSuccess++; + } sc.close(); } }
--- a/test/java/nio/channels/SocketChannel/IsConnectable.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/IsConnectable.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,24 +28,19 @@ */ import java.net.*; -import java.io.*; -import java.nio.*; import java.nio.channels.*; import java.nio.channels.spi.SelectorProvider; import java.util.*; public class IsConnectable { - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; - - static void test() throws Exception { + static void test(TestServers.DayTimeServer daytimeServer) throws Exception { InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); - sc.connect(isa); + final boolean immediatelyConnected = sc.connect(isa); Selector selector = SelectorProvider.provider().openSelector(); try { @@ -67,7 +62,12 @@ throw new Exception("Test failed: 4737146 detected"); } } else { - throw new Exception("Select failed"); + if (!immediatelyConnected) { + throw new Exception("Select failed"); + } else { + System.out.println("IsConnectable couldn't be fully tested for " + + System.getProperty("os.name")); + } } } finally { sc.close(); @@ -76,7 +76,10 @@ } public static void main(String[] args) throws Exception { - test(); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + test(daytimeServer); + } } }
--- a/test/java/nio/channels/SocketChannel/LocalAddress.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/LocalAddress.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,18 +28,20 @@ */ import java.net.*; -import java.nio.*; import java.nio.channels.*; public class LocalAddress { public static void main(String[] args) throws Exception { - test1(); + try (TestServers.EchoServer echoServer + = TestServers.EchoServer.startNewServer()) { + test1(echoServer); + } } - static void test1() throws Exception { + static void test1(TestServers.AbstractServer server) throws Exception { InetAddress bogus = InetAddress.getByName("0.0.0.0"); InetSocketAddress saddr = new InetSocketAddress( - InetAddress.getByName(TestUtil.HOST), 7); + server.getAddress(), server.getPort()); //Test1: connect only SocketChannel sc = SocketChannel.open();
--- a/test/java/nio/channels/SocketChannel/Stream.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/Stream.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,22 +27,17 @@ * @library .. */ +import java.io.*; import java.net.*; -import java.io.*; -import java.nio.*; import java.nio.channels.*; -import java.nio.charset.*; public class Stream { - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; - - static void test() throws Exception { + static void test(TestServers.DayTimeServer daytimeServer) throws Exception { InetSocketAddress isa - = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); SocketChannel sc = SocketChannel.open(); sc.connect(isa); sc.configureBlocking(false); @@ -58,7 +53,9 @@ } public static void main(String[] args) throws Exception { - test(); + try (TestServers.DayTimeServer dayTimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + test(dayTimeServer); + } } - }
--- a/test/java/nio/channels/SocketChannel/VectorParams.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/SocketChannel/VectorParams.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,31 +27,31 @@ * @library .. */ +import java.io.*; import java.net.*; -import java.io.*; import java.nio.*; import java.nio.channels.*; -import java.nio.charset.*; public class VectorParams { static java.io.PrintStream out = System.out; - static final int DAYTIME_PORT = 13; - static final String DAYTIME_HOST = TestUtil.HOST; static final int testSize = 10; static ByteBuffer[] bufs = null; static InetSocketAddress isa = null; public static void main(String[] args) throws Exception { - initBufs(); - testSocketChannelVectorParams(); - testDatagramChannelVectorParams(); - testPipeVectorParams(); - testFileVectorParams(); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + initBufs(daytimeServer); + testSocketChannelVectorParams(); + testDatagramChannelVectorParams(); + testPipeVectorParams(); + testFileVectorParams(); + } } - static void initBufs() throws Exception { + static void initBufs(TestServers.DayTimeServer daytimeServer) throws Exception { bufs = new ByteBuffer[testSize]; for(int i=0; i<testSize; i++) { String source = "buffer" + i; @@ -59,8 +59,8 @@ bufs[i].put(source.getBytes("8859_1")); bufs[i].flip(); } - isa = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), - DAYTIME_PORT); + isa = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); } static void testSocketChannelVectorParams() throws Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/nio/channels/TestServers.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,849 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* Test utility classes + * + */ + +import java.io.*; +import java.net.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +public class TestServers { + + private TestServers() { } + + /** + * An abstract server identifies a server which listens on a port on on a + * given machine. + */ + static abstract class AbstractServer { + + private AbstractServer() { + } + + public abstract int getPort(); + + public abstract InetAddress getAddress(); + } + + /** + * A downgraded type of AbstractServer which will refuse connections. Note: + * use it once and throw it away - this implementation opens an anonymous + * socket and closes it, returning the address of the closed socket. If + * other servers are started afterwards, the address/port might get reused + * and become connectable again - so it's not a good idea to assume that + * connections using this address/port will always be refused. Connections + * will be refused as long as the address/port of the refusing server has + * not been reused. + */ + static class RefusingServer extends AbstractServer { + + final InetAddress address; + final int port; + + private RefusingServer(InetAddress address, int port) { + this.address = address; + this.port = port; + } + + @Override + public int getPort() { + return port; + } + + @Override + public InetAddress getAddress() { + return address; + } + + public static RefusingServer startNewServer() throws IOException { + ServerSocket socket = new ServerSocket(0, 100, + InetAddress.getLocalHost()); + RefusingServer server = new RefusingServer(socket.getInetAddress(), + socket.getLocalPort()); + socket.close(); + return server; + } + } + + /** + * An abstract class for implementing small TCP servers for the nio tests + * purposes. Disclaimer: This is a naive implementation that uses the old + * networking APIs (not those from {@code java.nio.*}) and shamelessly + * extends/creates Threads instead of using an executor service. + */ + static abstract class AbstractTcpServer extends AbstractServer + implements Runnable, Closeable { + + protected final long linger; // #of ms to wait before responding + private Thread acceptThread; // thread waiting for accept + // list of opened connections that should be closed on close. + private List<TcpConnectionThread> connections = new ArrayList<>(); + private ServerSocket serverSocket; // the server socket + private boolean started = false; // whether the server is started + Throwable error = null; + + /** + * Creates a new abstract TCP server. + * + * @param linger the amount of time the server should wait before + * responding to requests. + */ + protected AbstractTcpServer(long linger) { + this.linger = linger; + } + + /** + * The local port to which the server is bound. + * + * @return The local port to which the server is bound. + * @exception IllegalStateException is thrown if the server is not + * started. + */ + @Override + public final synchronized int getPort() { + if (!started) { + throw new IllegalStateException("Not started"); + } + return serverSocket.getLocalPort(); + } + + /** + * The local address to which the server is bound. + * + * @return The local address to which the server is bound. + * @exception IllegalStateException is thrown if the server is not + * started. + */ + @Override + public final synchronized InetAddress getAddress() { + if (!started) { + throw new IllegalStateException("Not started"); + } + return serverSocket.getInetAddress(); + } + + /** + * Tells whether the server is started. + * + * @return true if the server is started. + */ + public final synchronized boolean isStarted() { + return started; + } + + /** + * Creates a new server socket. + * + * @param port local port to bind to. + * @param backlog requested maximum length of the queue of incoming + * connections. + * @param address local address to bind to. + * @return a new bound server socket ready to accept connections. + * @throws IOException if the socket cannot be created or bound. + */ + protected ServerSocket newServerSocket(int port, int backlog, + InetAddress address) + throws IOException { + return new ServerSocket(port, backlog, address); + } + + /** + * Starts listening for connections. + * + * @throws IOException if the server socket cannot be created or bound. + */ + public final synchronized void start() throws IOException { + if (started) { + return; + } + final ServerSocket socket = + newServerSocket(0, 100, InetAddress.getLocalHost()); + serverSocket = socket; + acceptThread = new Thread(this); + acceptThread.setDaemon(true); + acceptThread.start(); + started = true; + } + + /** + * Calls {@code Thread.sleep(linger);} + */ + protected final void lingerIfRequired() { + if (linger > 0) { + try { + Thread.sleep(linger); + } catch (InterruptedException x) { + Thread.interrupted(); + final ServerSocket socket = serverSocket(); + if (socket != null && !socket.isClosed()) { + System.err.println("Thread interrupted..."); + } + } + } + } + + final synchronized ServerSocket serverSocket() { + return this.serverSocket; + } + + /** + * The main accept loop. + */ + @Override + public final void run() { + final ServerSocket sSocket = serverSocket(); + try { + Socket s; + while (isStarted() && !Thread.interrupted() + && (s = sSocket.accept()) != null) { + lingerIfRequired(); + listen(s); + } + } catch (Exception x) { + error = x; + } finally { + synchronized (this) { + if (!sSocket.isClosed()) { + try { + sSocket.close(); + } catch (IOException x) { + System.err.println("Failed to close server socket"); + } + } + if (started && this.serverSocket == sSocket) { + started = false; + this.serverSocket = null; + this.acceptThread = null; + } + } + } + } + + /** + * Represents a connection accepted by the server. + */ + protected abstract class TcpConnectionThread extends Thread { + + protected final Socket socket; + + protected TcpConnectionThread(Socket socket) { + this.socket = socket; + this.setDaemon(true); + } + + public void close() throws IOException { + socket.close(); + interrupt(); + } + } + + /** + * Creates a new TcpConnnectionThread to handle the connection through + * an accepted socket. + * + * @param s the socket returned by {@code serverSocket.accept()}. + * @return a new TcpConnnectionThread to handle the connection through + * an accepted socket. + */ + protected abstract TcpConnectionThread createConnection(Socket s); + + /** + * Creates and starts a new TcpConnectionThread to handle the accepted + * socket. + * + * @param s the socket returned by {@code serverSocket.accept()}. + */ + private synchronized void listen(Socket s) { + TcpConnectionThread c = createConnection(s); + c.start(); + addConnection(c); + } + + /** + * Add the connection to the list of accepted connections. + * + * @param connection an accepted connection. + */ + protected synchronized void addConnection( + TcpConnectionThread connection) { + connections.add(connection); + } + + /** + * Remove the connection from the list of accepted connections. + * + * @param connection an accepted connection. + */ + protected synchronized void removeConnection( + TcpConnectionThread connection) { + connections.remove(connection); + } + + /** + * Close the server socket and all the connections present in the list + * of accepted connections. + * + * @throws IOException + */ + @Override + public synchronized void close() throws IOException { + if (serverSocket != null && !serverSocket.isClosed()) { + serverSocket.close(); + } + if (acceptThread != null) { + acceptThread.interrupt(); + } + int failed = 0; + for (TcpConnectionThread c : connections) { + try { + c.close(); + } catch (IOException x) { + // no matter - we're closing. + failed++; + } + } + connections.clear(); + if (failed > 0) { + throw new IOException("Failed to close some connections"); + } + } + } + + /** + * A small TCP Server that emulates the echo service for tests purposes. See + * http://en.wikipedia.org/wiki/Echo_Protocol This server uses an anonymous + * port - NOT the standard port 7. We don't guarantee that its behavior + * exactly matches the RFC - the only purpose of this server is to have + * something that responds to nio tests... + */ + static final class EchoServer extends AbstractTcpServer { + + public EchoServer() { + this(0L); + } + + public EchoServer(long linger) { + super(linger); + } + + @Override + protected TcpConnectionThread createConnection(Socket s) { + return new EchoConnection(s); + } + + private final class EchoConnection extends TcpConnectionThread { + + public EchoConnection(Socket socket) { + super(socket); + } + + @Override + public void run() { + try { + final InputStream is = socket.getInputStream(); + final OutputStream out = socket.getOutputStream(); + byte[] b = new byte[255]; + int n; + while ((n = is.read(b)) > 0) { + lingerIfRequired(); + out.write(b, 0, n); + } + } catch (IOException io) { + // fall through to finally + } finally { + if (!socket.isClosed()) { + try { + socket.close(); + } catch (IOException x) { + System.err.println( + "Failed to close echo connection socket"); + } + } + removeConnection(this); + } + } + } + + public static EchoServer startNewServer() throws IOException { + return startNewServer(0); + } + + public static EchoServer startNewServer(long linger) throws IOException { + final EchoServer echoServer = new EchoServer(linger); + echoServer.start(); + return echoServer; + } + } + + /** + * A small TCP server that emulates the Day & Time service for tests + * purposes. See http://en.wikipedia.org/wiki/Daytime_Protocol This server + * uses an anonymous port - NOT the standard port 13. We don't guarantee + * that its behavior exactly matches the RFC - the only purpose of this + * server is to have something that responds to nio tests... + */ + static final class DayTimeServer extends AbstractTcpServer { + + public DayTimeServer() { + this(0L); + } + + public DayTimeServer(long linger) { + super(linger); + } + + @Override + protected TcpConnectionThread createConnection(Socket s) { + return new DayTimeServerConnection(s); + } + + @Override + protected void addConnection(TcpConnectionThread connection) { + // do nothing - the connection just write the date and terminates. + } + + @Override + protected void removeConnection(TcpConnectionThread connection) { + // do nothing - we're not adding connections to the list... + } + + private final class DayTimeServerConnection extends TcpConnectionThread { + + public DayTimeServerConnection(Socket socket) { + super(socket); + } + + @Override + public void run() { + try { + final OutputStream out = socket.getOutputStream(); + lingerIfRequired(); + out.write(new Date(System.currentTimeMillis()) + .toString().getBytes("US-ASCII")); + out.flush(); + } catch (IOException io) { + // fall through to finally + } finally { + if (!socket.isClosed()) { + try { + socket.close(); + } catch (IOException x) { + System.err.println( + "Failed to close echo connection socket"); + } + } + } + } + } + + public static DayTimeServer startNewServer() + throws IOException { + return startNewServer(0); + } + + public static DayTimeServer startNewServer(long linger) + throws IOException { + final DayTimeServer daytimeServer = new DayTimeServer(linger); + daytimeServer.start(); + return daytimeServer; + } + } + + /** + * An abstract class for implementing small UDP Servers for the nio tests + * purposes. Disclaimer: This is a naive implementation that uses the old + * networking APIs (not those from {@code java.nio.*}) and shamelessly + * extends/creates Threads instead of using an executor service. + */ + static abstract class AbstractUdpServer extends AbstractServer + implements Runnable, Closeable { + + protected final long linger; // #of ms to wait before responding + private Thread acceptThread; // thread waiting for packets + private DatagramSocket serverSocket; // the server socket + private boolean started = false; // whether the server is started + Throwable error = null; + + /** + * Creates a new abstract UDP server. + * + * @param linger the amount of time the server should wait before + * responding to requests. + */ + protected AbstractUdpServer(long linger) { + this.linger = linger; + } + + /** + * The local port to which the server is bound. + * + * @return The local port to which the server is bound. + * @exception IllegalStateException is thrown if the server is not + * started. + */ + @Override + public final synchronized int getPort() { + if (!started) { + throw new IllegalStateException("Not started"); + } + return serverSocket.getLocalPort(); + } + + /** + * The local address to which the server is bound. + * + * @return The local address to which the server is bound. + * @exception IllegalStateException is thrown if the server is not + * started. + */ + @Override + public final synchronized InetAddress getAddress() { + if (!started) { + throw new IllegalStateException("Not started"); + } + return serverSocket.getLocalAddress(); + } + + /** + * Tells whether the server is started. + * + * @return true if the server is started. + */ + public final synchronized boolean isStarted() { + return started; + } + + /** + * Creates a new datagram socket. + * + * @param port local port to bind to. + * @param address local address to bind to. + * @return a new bound server socket ready to listen for packets. + * @throws IOException if the socket cannot be created or bound. + */ + protected DatagramSocket newDatagramSocket(int port, + InetAddress address) + throws IOException { + return new DatagramSocket(port, address); + } + + /** + * Starts listening for connections. + * + * @throws IOException if the server socket cannot be created or bound. + */ + public final synchronized void start() throws IOException { + if (started) { + return; + } + final DatagramSocket socket = + newDatagramSocket(0, InetAddress.getLocalHost()); + serverSocket = socket; + acceptThread = new Thread(this); + acceptThread.setDaemon(true); + acceptThread.start(); + started = true; + } + + /** + * Calls {@code Thread.sleep(linger);} + */ + protected final void lingerIfRequired() { + if (linger > 0) { + try { + Thread.sleep(linger); + } catch (InterruptedException x) { + Thread.interrupted(); + final DatagramSocket socket = serverSocket(); + if (socket != null && !socket.isClosed()) { + System.err.println("Thread interrupted..."); + } + } + } + } + + final synchronized DatagramSocket serverSocket() { + return this.serverSocket; + } + + final synchronized boolean send(DatagramSocket socket, + DatagramPacket response) throws IOException { + if (!socket.isClosed()) { + socket.send(response); + return true; + } else { + return false; + } + } + + /** + * The main receive loop. + */ + @Override + public final void run() { + final DatagramSocket sSocket = serverSocket(); + try { + final int size = Math.max(1024, sSocket.getReceiveBufferSize()); + if (size > sSocket.getReceiveBufferSize()) { + sSocket.setReceiveBufferSize(size); + } + while (isStarted() && !Thread.interrupted() && !sSocket.isClosed()) { + final byte[] buf = new byte[size]; + final DatagramPacket packet = + new DatagramPacket(buf, buf.length); + lingerIfRequired(); + sSocket.receive(packet); + //System.out.println("Received packet from: " + // + packet.getAddress()+":"+packet.getPort()); + handle(sSocket, packet); + } + } catch (Exception x) { + error = x; + } finally { + synchronized (this) { + if (!sSocket.isClosed()) { + sSocket.close(); + } + if (started && this.serverSocket == sSocket) { + started = false; + this.serverSocket = null; + this.acceptThread = null; + } + } + } + } + + /** + * Represents an UDP request received by the server. + */ + protected abstract class UdpRequestThread extends Thread { + + protected final DatagramPacket request; + protected final DatagramSocket socket; + + protected UdpRequestThread(DatagramSocket socket, DatagramPacket request) { + this.socket = socket; + this.request = request; + this.setDaemon(true); + } + } + + /** + * Creates a new UdpRequestThread to handle a DatagramPacket received + * through a DatagramSocket. + * + * @param socket the socket through which the request was received. + * @param request the datagram packet received through the socket. + * @return a new UdpRequestThread to handle the request received through + * a DatagramSocket. + */ + protected abstract UdpRequestThread createConnection(DatagramSocket socket, + DatagramPacket request); + + /** + * Creates and starts a new UdpRequestThread to handle the received + * datagram packet. + * + * @param socket the socket through which the request was received. + * @param request the datagram packet received through the socket. + */ + private synchronized void handle(DatagramSocket socket, + DatagramPacket request) { + UdpRequestThread c = createConnection(socket, request); + // c can be null if the request requires no response. + if (c != null) { + c.start(); + } + } + + /** + * Close the server socket. + * + * @throws IOException + */ + @Override + public synchronized void close() throws IOException { + if (serverSocket != null && !serverSocket.isClosed()) { + serverSocket.close(); + } + if (acceptThread != null) { + acceptThread.interrupt(); + } + } + } + + /** + * A small UDP Server that emulates the discard service for tests purposes. + * See http://en.wikipedia.org/wiki/Discard_Protocol This server uses an + * anonymous port - NOT the standard port 9. We don't guarantee that its + * behavior exactly matches the RFC - the only purpose of this server is to + * have something that responds to nio tests... + */ + static final class UdpDiscardServer extends AbstractUdpServer { + + public UdpDiscardServer() { + this(0L); + } + + public UdpDiscardServer(long linger) { + super(linger); + } + + @Override + protected UdpRequestThread createConnection(DatagramSocket socket, + DatagramPacket request) { + // no response required + return null; + } + + public static UdpDiscardServer startNewServer() throws IOException { + return startNewServer(0); + } + + public static UdpDiscardServer startNewServer(long linger) throws IOException { + final UdpDiscardServer discardServer = new UdpDiscardServer(linger); + discardServer.start(); + return discardServer; + } + } + + /** + * A small UDP Server that emulates the echo service for tests purposes. See + * http://en.wikipedia.org/wiki/Echo_Protocol This server uses an anonymous + * port - NOT the standard port 7. We don't guarantee that its behavior + * exactly matches the RFC - the only purpose of this server is to have + * something that responds to nio tests... + */ + static final class UdpEchoServer extends AbstractUdpServer { + + public UdpEchoServer() { + this(0L); + } + + public UdpEchoServer(long linger) { + super(linger); + } + + @Override + protected UdpEchoRequest createConnection(DatagramSocket socket, + DatagramPacket request) { + return new UdpEchoRequest(socket, request); + } + + private final class UdpEchoRequest extends UdpRequestThread { + + public UdpEchoRequest(DatagramSocket socket, DatagramPacket request) { + super(socket, request); + } + + @Override + public void run() { + try { + lingerIfRequired(); + final DatagramPacket response = + new DatagramPacket(request.getData(), + request.getOffset(), request.getLength(), + request.getAddress(), request.getPort()); + send(socket, response); + } catch (IOException io) { + System.err.println("Failed to send response: " + io); + io.printStackTrace(System.err); + } + } + } + + public static UdpEchoServer startNewServer() throws IOException { + return startNewServer(0); + } + + public static UdpEchoServer startNewServer(long linger) throws IOException { + final UdpEchoServer echoServer = new UdpEchoServer(linger); + echoServer.start(); + return echoServer; + } + } + + /** + * A small UDP server that emulates the Day & Time service for tests + * purposes. See http://en.wikipedia.org/wiki/Daytime_Protocol This server + * uses an anonymous port - NOT the standard port 13. We don't guarantee + * that its behavior exactly matches the RFC - the only purpose of this + * server is to have something that responds to nio tests... + */ + static final class UdpDayTimeServer extends AbstractUdpServer { + + public UdpDayTimeServer() { + this(0L); + } + + public UdpDayTimeServer(long linger) { + super(linger); + } + + @Override + protected UdpDayTimeRequestThread createConnection(DatagramSocket socket, + DatagramPacket request) { + return new UdpDayTimeRequestThread(socket, request); + } + + private final class UdpDayTimeRequestThread extends UdpRequestThread { + + public UdpDayTimeRequestThread(DatagramSocket socket, + DatagramPacket request) { + super(socket, request); + } + + @Override + public void run() { + try { + lingerIfRequired(); + final byte[] data = new Date(System.currentTimeMillis()) + .toString().getBytes("US-ASCII"); + final DatagramPacket response = + new DatagramPacket(data, 0, data.length, + request.getAddress(), request.getPort()); + send(socket, response); + } catch (IOException io) { + System.err.println("Failed to send response: " + io); + io.printStackTrace(System.err); + } + } + } + + public static UdpDayTimeServer startNewServer() throws IOException { + return startNewServer(0); + } + + public static UdpDayTimeServer startNewServer(long linger) + throws IOException { + final UdpDayTimeServer echoServer = new UdpDayTimeServer(linger); + echoServer.start(); + return echoServer; + } + } +}
--- a/test/java/nio/channels/TestUtil.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/nio/channels/TestUtil.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,6 @@ import java.io.*; import java.net.*; -import java.nio.*; import java.nio.channels.*; import java.util.Random; @@ -36,9 +35,6 @@ // Test hosts used by the channels tests - change these when // executing in a different network. - public static final String HOST = "icedtea.classpath.org"; - public static final String REFUSING_HOST = "ns1.gnu.org"; - public static final String FAR_HOST = "developer.classpath.org"; public static final String UNRESOLVABLE_HOST = "blah-blah.blah-blah.blah"; private TestUtil() { }
--- a/test/java/rmi/MarshalledObject/compare/Compare.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/MarshalledObject/compare/Compare.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,7 +29,6 @@ * not involved in location should be compared. * @author Ken Arnold * - * @build Compare * @run main Compare 11 annotatedRef */
--- a/test/java/rmi/MarshalledObject/compare/HashCode.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/MarshalledObject/compare/HashCode.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,6 @@ * @summary MarshalledObject with null throws NullPointerException * @author Ken Arnold * - * @build HashCode * @run main HashCode 11 annotatedRef */
--- a/test/java/rmi/MarshalledObject/compare/NullReference.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/MarshalledObject/compare/NullReference.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,6 @@ * @summary MarshalledObject with null throws NullPointerException * @author Ken Arnold * - * @build NullReference * @run main NullReference */
--- a/test/java/rmi/Naming/DefaultRegistryPort.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/Naming/DefaultRegistryPort.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,7 +28,6 @@ * @author Dana Burns * @library ../testlibrary * @build TestLibrary - * @build DefaultRegistryPort * @run main DefaultRegistryPort */
--- a/test/java/rmi/Naming/LookupIPv6.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/Naming/LookupIPv6.java Fri Jun 21 15:46:14 2013 -0500 @@ -22,12 +22,11 @@ */ /* @test + * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing + * IPv6 addresses. * @bug 4402708 * * @run main/othervm -Djava.net.preferIPv6Addresses=true LookupIPv6 - * - * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing - * IPv6 addresses. */ import java.net.InetAddress;
--- a/test/java/rmi/Naming/RmiIsNoScheme.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/Naming/RmiIsNoScheme.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,6 @@ * * @library ../testlibrary * @build TestLibrary - * @build RmiIsNoScheme * @run main/othervm RmiIsNoScheme */
--- a/test/java/rmi/Naming/UnderscoreHost.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/Naming/UnderscoreHost.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,8 +29,7 @@ * @author Vinod Johnson * * @library ../testlibrary - * @build TestLibrary - * @build UnderscoreHost UnderscoreHost_Stub + * @build TestLibrary UnderscoreHost_Stub * @run main/othervm UnderscoreHost */
--- a/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,14 +21,13 @@ * questions. */ -/** +/* * @test * @bug 4254808 * @summary Naming assumes '/' is present in relative URL; change in URL causes regression * @author Dana Burns * @library ../../testlibrary - * @build TestLibrary - * @build Legal LegalRegistryNames LegalRegistryNames_Stub + * @build TestLibrary Legal LegalRegistryNames_Stub * @run main LegalRegistryNames */
--- a/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,10 +28,9 @@ * as when the default java.lang.SecurityManager is set, which with the * default "java.security" file in the JDK means that access to packages in * the sun.* package hierarchy is denied (without explicit runtime permission - * "accessClassInPackge.*"). + * "accessClassInPackage.*"). * @author Peter Jones * - * @build CheckPackageAccess * @run main/othervm CheckPackageAccess */
--- a/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java Fri Jun 21 15:46:14 2013 -0500 @@ -36,8 +36,7 @@ * functionality is in place * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe CheckActivateRef_Stub CheckActivateRef + * @build TestLibrary RMID ActivateMe CheckActivateRef_Stub * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef */
--- a/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,10 +28,7 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build MyRMI - * @build CheckAnnotations - * @build CheckAnnotations_Stub + * @build TestLibrary RMID MyRMI CheckAnnotations_Stub * @run main/othervm/policy=security.policy/timeout=480 CheckAnnotations */
--- a/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,14 +24,11 @@ /* @test * @bug 4289544 * @summary ActivationGroupImpl.newInstance does not set context classloader for impl - * * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build MyRMI - * @build CheckImplClassLoader ActivatableImpl - * @build ActivatableImpl ActivatableImpl_Stub + * @build TestLibrary RMID + * MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub * @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader */
--- a/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,8 +27,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build RMID ActivationLibrary TestLibrary - * @build ActivateMe CheckRegisterInLog CheckRegisterInLog_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe CheckRegisterInLog_Stub * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog */
--- a/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java Fri Jun 21 15:46:14 2013 -0500 @@ -22,14 +22,12 @@ */ /* @test - * @author Laird Dornin * @bug 4164971 * @summary allow non-public activatable class and/or constructor + * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe - * @build CreatePrivateActivatable + * @build TestLibrary RMID ActivateMe * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable */
--- a/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,11 +32,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build DownloadParameterClass - * @build Foo - * @build FooReceiverImpl - * @build FooReceiverImpl_Stub - * @build Bar + * Foo FooReceiverImpl FooReceiverImpl_Stub Bar * @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass */
--- a/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,14 +23,11 @@ /* @test * @bug 4128620 - * * @summary synopsis: NoSuchMethodError should be elucidated - * * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe ElucidateNoSuchMethod ElucidateNoSuchMethod_Stub + * @build TestLibrary RMID ActivateMe ElucidateNoSuchMethod_Stub * @run main/othervm/policy=security.policy/timeout=240 ElucidateNoSuchMethod */
--- a/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -28,11 +28,25 @@ # set to the impl's class loader) when the impl is activated. # @library ../../../testlibrary # @build TestLibrary RMID ActivationLibrary -# @build ExtLoadedImplTest ExtLoadedImpl ExtLoadedImpl_Stub CheckLoader +# ExtLoadedImplTest ExtLoadedImpl ExtLoadedImpl_Stub CheckLoader # @run shell ext.sh +OS=`uname -s` +case "$OS" in + SunOS | Linux | Darwin ) + PS=":" + ;; + Windows* | CYGWIN* ) + PS=";" + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; +esac + mkdir -p classes -cp $TESTCLASSES/*.class classes +for dir in `echo ${TESTCLASSPATH:-$TESTCLASSES} | sed -e "s/$PS/ /"` ; do cp $dir/*.class classes ; done rm classes/ExtLoadedImpl.class classes/ExtLoadedImpl_Stub.class classes/CheckLoader.class mkdir -p ext $TESTJAVA/bin/jar cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class
--- a/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,9 +27,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build ActivateMe - * @build ForceLogSnapshot - * @build ForceLogSnapshot_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ForceLogSnapshot_Stub * @run main/othervm/policy=security.policy/timeout=640 ForceLogSnapshot */
--- a/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,10 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build InactiveGroup - * @build InactiveGroup_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe InactiveGroup_Stub * @run main/othervm/policy=security.policy/timeout=240 InactiveGroup */
--- a/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,14 +24,12 @@ /* * @test * @bug 6245733 - * * @summary synopsis: rmid's registry's list operation doesn't include * activation system * @author Ann Wollrath * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build LookupActivationSystem * @run main/othervm/timeout=240 LookupActivationSystem */
--- a/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,15 +23,11 @@ /* @test * @bug 4138056 - * * @summary synopsis: Activating objects from an Activatable constructor causes deadlock * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build NestedActivate - * @build NestedActivate_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe NestedActivate_Stub * @run main/othervm/policy=security.policy/timeout=240 NestedActivate */
--- a/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,16 +23,13 @@ /* @test * @bug 4115296 - * * @summary synopsis: NoSuchObjectException not thrown for non-existent * activatable objects * @author Ann Wollrath * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build NonExistentActivatable - * @build NonExistentActivatable_Stub + * ActivateMe NonExistentActivatable_Stub * @run main/othervm/policy=security.policy/timeout=240 NonExistentActivatable */
--- a/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,10 +28,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe - * @build RestartCrashedService - * @build RestartCrashedService_Stub + * @build TestLibrary RMID ActivateMe RestartCrashedService_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService */
--- a/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,8 +28,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build RestartLatecomer - * @build RestartLatecomer_Stub + * RestartLatecomer RestartLatecomer_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer */
--- a/test/java/rmi/activation/Activatable/restartService/RestartService.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/restartService/RestartService.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,15 +23,11 @@ /* @test * @bug 4095165 4321151 - * @summary synopsis: activator should restart daemon services * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build RestartService - * @build RestartService_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe RestartService_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartService */
--- a/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -28,11 +28,8 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build TestSecurityManager - * @build RegisteringActivatable - * @build ShutdownGracefully - * @build ShutdownGracefully_Stub + * @build TestLibrary RMID + * TestSecurityManager RegisteringActivatable ShutdownGracefully_Stub * @run main/othervm/policy=security.policy/timeout=700 ShutdownGracefully */ @@ -171,7 +168,7 @@ registering = null; // Need to make sure that rmid goes away by itself - Process rmidProcess = rmid.getVM(); + JavaVM rmidProcess = rmid; if (rmidProcess != null) { try { Runnable waitThread = @@ -208,9 +205,9 @@ * class that waits for rmid to exit */ private static class ShutdownDetectThread implements Runnable { - private Process rmidProcess = null; + private JavaVM rmidProcess = null; - ShutdownDetectThread(Process rmidProcess) { + ShutdownDetectThread(JavaVM rmidProcess) { this.rmidProcess = rmidProcess; } public void run() {
--- a/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,16 +23,12 @@ /* @test * @bug 4115331 - * @summary synopsis: activatable object fails to go inactive after * unregister/inactive sequence. * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build UnregisterInactive - * @build UnregisterInactive_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe UnregisterInactive_Stub * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive */
--- a/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,11 +31,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe - * @build ActivateFails - * @build ActivateFails_Stub - * @build ShutdownThread + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ActivateFails_Stub ShutdownThread * @run main/othervm/policy=security.policy/timeout=240 ActivateFails */
--- a/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Fri Jun 21 15:46:14 2013 -0500 @@ -33,9 +33,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build MyActivationGroupImpl - * @build DownloadActivationGroup - * @build DownloadActivationGroup_Stub + * DownloadActivationGroup MyActivationGroupImpl DownloadActivationGroup_Stub * @run main/othervm/policy=security.policy/timeout=240 DownloadActivationGroup */
--- a/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,16 +21,15 @@ * questions. */ -/** +/* * @test * @bug 4252236 * @summary ActivationGroupDesc should not do early binding of default classname - * @library ../../../testlibrary + * @author Laird Dornin * - * @build CheckDefaultGroupName - * + * @library ../../../testlibrary + * @build TestLibrary * @run main CheckDefaultGroupName - * @author Laird Dornin */ import java.rmi.activation.*;
--- a/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,15 +23,13 @@ /* @test * @bug 4720528 - * * @summary synopsis: (spec) ActivationSystem.activeGroup spec should be * relaxed (duplicate call to activeGroup with same instantiator and * incarnation should not throw ActivationException; it should succeed) * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build IdempotentActiveGroup + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/policy=security.policy/timeout=480 IdempotentActiveGroup */
--- a/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,9 +29,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build ActivateMe - * @build ModifyDescriptor - * @build ModifyDescriptor_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ModifyDescriptor_Stub * @run main/othervm/policy=security.policy/timeout=240 ModifyDescriptor */
--- a/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,14 +24,11 @@ /* @test * @bug 4179055 * @summary Some java apps need to have access to read "accessClassInPackage.sun.rmi.server" - * * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe ActivationLibrary - * @build CanCreateStubs - * @build StubClassesPermitted - * @build StubClassesPermitted_Stub + * @build TestLibrary RMID ActivationLibrary + * CanCreateStubs StubClassesPermitted_Stub * @run main/othervm/policy=security.policy/secure=java.lang.SecurityManager/timeout=240 StubClassesPermitted */
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -28,7 +28,5 @@ import java.rmi.RemoteException; interface ActivateMe extends Remote { public void ping() throws RemoteException; - public void unregister() throws Exception; public void shutdown() throws Exception; - public void justGoAway() throws RemoteException; }
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/CallbackInterface.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.rmi.Remote; -import java.rmi.RemoteException; -public interface CallbackInterface extends Remote { - public void inc() throws RemoteException; - public int getNumDeactivated() throws RemoteException; -}
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/Callback_Stub.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class Callback_Stub - extends java.rmi.server.RemoteStub - implements CallbackInterface, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("int getNumDeactivated()"), - new java.rmi.server.Operation("void inc()") - }; - - private static final long interfaceHash = -1008194523112388035L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_getNumDeactivated_0; - private static java.lang.reflect.Method $method_inc_1; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_getNumDeactivated_0 = CallbackInterface.class.getMethod("getNumDeactivated", new java.lang.Class[] {}); - $method_inc_1 = CallbackInterface.class.getMethod("inc", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public Callback_Stub() { - super(); - } - public Callback_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of getNumDeactivated() - public int getNumDeactivated() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - Object $result = ref.invoke(this, $method_getNumDeactivated_0, null, -761062487639949912L); - return ((java.lang.Integer) $result).intValue(); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - int $result; - try { - java.io.ObjectInput in = call.getInputStream(); - $result = in.readInt(); - } catch (java.io.IOException e) { - throw new java.rmi.UnmarshalException("error unmarshalling return", e); - } finally { - ref.done(call); - } - return $result; - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of inc() - public void inc() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_inc_1, null, 4394985085384332959L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } -}
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -24,57 +24,26 @@ /* @test * @bug 4134233 * @bug 4213186 - * * @summary synopsis: ActivationSystem.unregisterGroup should unregister objects in group * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe CallbackInterface - * @build UnregisterGroup - * @build UnregisterGroup_Stub - * @build Callback_Stub - * @run main/othervm/policy=security.policy/timeout=480 UnregisterGroup + * @build TestLibrary RMID ActivationLibrary ActivateMe + * @run main/othervm/policy=security.policy UnregisterGroup */ import java.io.*; import java.rmi.*; import java.rmi.activation.*; import java.rmi.server.*; -import java.rmi.registry.*; import java.util.Properties; -class Callback extends UnicastRemoteObject implements CallbackInterface { - - public static int num_deactivated = 0; - - public Callback() throws RemoteException { super(); } - - public void inc() throws RemoteException { - incNumDeactivated(); - } - - public synchronized int getNumDeactivated() throws RemoteException { - return(num_deactivated); - } - - public synchronized void incNumDeactivated() { - num_deactivated++; - } - -} - -public class UnregisterGroup - extends Activatable - implements ActivateMe, Runnable +public class UnregisterGroup extends Activatable implements ActivateMe { - - private static Exception exception = null; - private static String error = null; - private static boolean done = false; - private static ActivateMe lastResortExitObj = null; + private static volatile Exception exception = null; + private static volatile String error = null; + private static volatile boolean done = false; private static final int NUM_OBJECTS = 10; - private static int registryPort = -1; public UnregisterGroup(ActivationID id, MarshalledObject mobj) throws Exception @@ -82,55 +51,22 @@ super(id, 0); } - public void ping() - {} - - public void unregister() throws Exception { - super.unregister(super.getID()); - } - /** - * Spawns a thread to deactivate the object. + * Does nothing, but serves to activate this object. */ - public void shutdown() throws Exception { - (new Thread(this,"UnregisterGroup")).start(); - } - - /** - * To support exiting of group VM as a last resort - */ - public void justGoAway() { - System.exit(0); - } + public void ping() { } /** - * Thread to deactivate object. First attempts to make object - * inactive (via the inactive method). If that fails (the - * object may still have pending/executing calls), then - * unexport the object forcibly. + * Deactivates the object. We need to unexport forcibly because + * this call is in-progress on this object, which is the same object + * that we are trying to deactivate. */ - public void run() { - + public void shutdown() throws Exception { + Activatable.unexportObject(this, true); ActivationLibrary.deactivate(this, getID()); - System.err.println("\tActivationLibrary.deactivate returned"); - - try { - CallbackInterface cobj = - (CallbackInterface)Naming.lookup("//:" + registryPort + "/Callback"); - cobj.inc(); - } catch (Exception e) { - System.err.println("cobj.inc exception"); - e.printStackTrace(); - } - } - public static void main(String[] args) { - - Registry registry; - - System.err.println("\nRegression test for bug 4134233\n"); - + public static void main(String[] args) throws RemoteException { TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); RMID rmid = null; @@ -145,12 +81,8 @@ final Properties p = new Properties(); // this test must always set policies/managers in its // activation groups - p.put("java.security.policy", - TestParams.defaultGroupPolicy); - p.put("java.security.manager", - TestParams.defaultSecurityManager); - - //final int NUM_OBJECTS = 10; + p.put("java.security.policy", TestParams.defaultGroupPolicy); + p.put("java.security.manager", TestParams.defaultSecurityManager); Thread t = new Thread() { public void run () { @@ -174,7 +106,6 @@ System.err.println("Activating object: " + i); obj[i].ping(); } - lastResortExitObj = obj[0]; System.err.println("Unregistering group"); system.unregisterGroup(groupID); @@ -188,7 +119,6 @@ "group unregistered"); } - /* * Deactivate objects so group VM will exit. */ @@ -197,7 +127,7 @@ obj[i].shutdown(); obj[i] = null; } - lastResortExitObj = null; + System.err.println("Successfully deactivated all objects."); } catch (Exception e) { exception = e; @@ -208,7 +138,11 @@ }; t.start(); - t.join(120000); + + // Default jtreg timeout is two minutes. + // Timeout ourselves after one minute so that + // we can clean up. + t.join(60000); if (exception != null) { TestLibrary.bomb("test failed", exception); @@ -219,43 +153,9 @@ } else { System.err.println("Test passed"); } - - } catch (Exception e) { TestLibrary.bomb("test failed", e); } finally { - if (lastResortExitObj != null) { - try { - lastResortExitObj.justGoAway(); - } catch (Exception munch) { - } - } - - // Wait for the object deactivation to take place first - try { - - // create reg and export callback object - registry = TestLibrary.createRegistryOnUnusedPort(); - registryPort = TestLibrary.getRegistryPort(registry); - Callback robj = new Callback(); - registry.bind("Callback", robj); - - //get the callback object - int maxwait=30; - int nd = robj.getNumDeactivated(); - while ((nd < NUM_OBJECTS) && (maxwait> 0)) { - System.err.println("num_deactivated="+nd); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) {} - maxwait--; - nd = robj.getNumDeactivated(); - } - } catch (Exception ce) { - System.err.println("E:"+ce); - ce.printStackTrace(); - } - ActivationLibrary.rmidCleanup(rmid); } }
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup_Stub.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -public final class UnregisterGroup_Stub - extends java.rmi.server.RemoteStub - implements ActivateMe, java.rmi.Remote -{ - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("void justGoAway()"), - new java.rmi.server.Operation("void ping()"), - new java.rmi.server.Operation("void shutdown()"), - new java.rmi.server.Operation("void unregister()") - }; - - private static final long interfaceHash = -4733924075192691630L; - - private static final long serialVersionUID = 2; - - private static boolean useNewInvoke; - private static java.lang.reflect.Method $method_justGoAway_0; - private static java.lang.reflect.Method $method_ping_1; - private static java.lang.reflect.Method $method_shutdown_2; - private static java.lang.reflect.Method $method_unregister_3; - - static { - try { - java.rmi.server.RemoteRef.class.getMethod("invoke", - new java.lang.Class[] { - java.rmi.Remote.class, - java.lang.reflect.Method.class, - java.lang.Object[].class, - long.class - }); - useNewInvoke = true; - $method_justGoAway_0 = ActivateMe.class.getMethod("justGoAway", new java.lang.Class[] {}); - $method_ping_1 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {}); - $method_shutdown_2 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {}); - $method_unregister_3 = ActivateMe.class.getMethod("unregister", new java.lang.Class[] {}); - } catch (java.lang.NoSuchMethodException e) { - useNewInvoke = false; - } - } - - // constructors - public UnregisterGroup_Stub() { - super(); - } - public UnregisterGroup_Stub(java.rmi.server.RemoteRef ref) { - super(ref); - } - - // methods from remote interfaces - - // implementation of justGoAway() - public void justGoAway() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_justGoAway_0, null, -5382478058620783904L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of ping() - public void ping() - throws java.rmi.RemoteException - { - try { - if (useNewInvoke) { - ref.invoke(this, $method_ping_1, null, 5866401369815527589L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.rmi.RemoteException e) { - throw e; - } catch (java.lang.Exception e) { - throw new java.rmi.UnexpectedException("undeclared checked exception", e); - } - } - - // implementation of shutdown() - public void shutdown() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_shutdown_2, null, -7207851917985848402L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } - - // implementation of unregister() - public void unregister() - throws java.lang.Exception - { - if (useNewInvoke) { - ref.invoke(this, $method_unregister_3, null, -5366864281862648102L); - } else { - java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash); - ref.invoke(call); - ref.done(call); - } - } -}
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy Fri Jun 21 15:46:14 2013 -0500 @@ -7,4 +7,5 @@ // test needs to communicate with the activation system permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; + permission java.util.PropertyPermission "unregisterGroup.port", "read"; };
--- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy Fri Jun 21 15:46:14 2013 -0500 @@ -33,4 +33,10 @@ // test needs to export rmid and communicate with objects on arbitrary ports permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; + + // required for test to get the registry port + permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp"; };
--- a/test/java/rmi/activation/CommandEnvironment/NullOptions.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/CommandEnvironment/NullOptions.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,6 @@ * ActivationGroupDesc.CommandEnvironment * @author Ann Wollrath * - * @build NullOptions * @run main/othervm/timeout=240 NullOptions */
--- a/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java Fri Jun 21 15:46:14 2013 -0500 @@ -35,9 +35,10 @@ * @author Adrian Colley * * @library ../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build Eliza Retireable Doctor Doctor_Stub SetChildEnv - * @run main/othervm/timeout=240/policy=security.policy -Djava.compiler=NONE SetChildEnv + * @build TestLibrary RMID ActivationLibrary + * Eliza Retireable Doctor Doctor_Stub + * @run main/othervm/timeout=240/policy=security.policy + * -Djava.compiler=NONE SetChildEnv */ import java.rmi.*; import java.util.Properties;
--- a/test/java/rmi/activation/checkusage/CheckUsage.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/checkusage/CheckUsage.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -23,9 +23,10 @@ /* @test * @bug 4259564 + * @summary RMID's usage message is incomplete and inconsistent with other tools * * @library ../../testlibrary - * @build TestLibrary JavaVM CheckUsage + * @build TestLibrary JavaVM * @run main/othervm CheckUsage */ @@ -37,28 +38,18 @@ */ public class CheckUsage { public static void main(String[] args) { - - System.err.println("\nregression test for 4259564\n"); - - JavaVM rmidVM = null; - try { - // make sure the registry exits with a proper usage statement ByteArrayOutputStream berr = new ByteArrayOutputStream(); - // run a VM to start the registry - rmidVM = new JavaVM("sun.rmi.server.Activation", "", "foo", - System.out, berr); + // create rmid with incorrect command line args + JavaVM rmidVM = new JavaVM("sun.rmi.server.Activation", "", "foo", + System.out, berr); System.err.println("starting rmid"); - rmidVM.start(); - // wait for registry exit + // run the subprocess and wait for it to exit + int rmidVMExitStatus = rmidVM.execute(); System.err.println("rmid exited with status: " + - rmidVM.getVM().waitFor()); - try { - Thread.sleep(7000); - } catch (InterruptedException ie) { - } + rmidVMExitStatus); String usage = new String(berr.toByteArray()); @@ -69,12 +60,8 @@ } else { System.err.println("test passed"); } - } catch (Exception e) { TestLibrary.bomb(e); - } finally { - rmidVM.destroy(); - rmidVM = null; } } }
--- a/test/java/rmi/activation/log/LogTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/log/LogTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,7 +29,6 @@ * boundaries * @author Ann Wollrath * - * @build LogTest * @run main/othervm/timeout=240 LogTest */
--- a/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,8 +29,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build RMID ActivationLibrary - * @build InheritedChannelNotServerSocket + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/timeout=240 InheritedChannelNotServerSocket */
--- a/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,9 +27,7 @@ * @author Ann Wollrath * * @library ../../testlibrary - * @build RMID ActivationLibrary - * @build RmidViaInheritedChannel - * @build TestLibrary + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/timeout=240 RmidViaInheritedChannel */
--- a/test/java/rmi/dgc/VMID/CheckVMID.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/dgc/VMID/CheckVMID.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ * @author Ann Wollrath * * @library ../../testlibrary - * @build CheckVMID + * @build TestLibrary * @run main/othervm/policy=security.policy CheckVMID */
--- a/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,8 +30,7 @@ * rather than pinning it indefinitely. * @author Peter Jones * - * @build DGCAckFailure - * @build DGCAckFailure_Stub + * @build DGCAckFailure DGCAckFailure_Stub * @run main/othervm DGCAckFailure */
--- a/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,9 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build TestLibrary - * @build DGCImplInsulation - * @build DGCImplInsulation_Stub + * @build TestLibrary DGCImplInsulation_Stub * @run main/othervm/policy=security.policy DGCImplInsulation */
--- a/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,8 +29,7 @@ * renewing that lease at all after the first failure. * @author Peter Jones (inspired by Adrian Colley's test case in 4268258) * - * @build RetryDirtyCalls - * @build RetryDirtyCalls_Stub + * @build RetryDirtyCalls RetryDirtyCalls_Stub * @run main/othervm RetryDirtyCalls */
--- a/test/java/rmi/invalidName/InvalidName.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/invalidName/InvalidName.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,7 +32,7 @@ * @author Laird Dornin * * @library ../testlibrary - * @build InvalidName + * @build TestLibrary * @run main/othervm InvalidName */
--- a/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -27,8 +27,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build StreamPipe TestParams TestLibrary JavaVM RMID - * @build AltSecurityManager TestSecurityManager + * @build TestLibrary JavaVM RMID TestSecurityManager * @run main/othervm AltSecurityManager */ @@ -77,8 +76,7 @@ } System.err.println("starting " + utilityToStart); - vm.start(); - vm.getVM().waitFor(); + vm.execute(); } catch (Exception e) { TestLibrary.bomb(e);
--- a/test/java/rmi/registry/checkusage/CheckUsage.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/checkusage/CheckUsage.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -27,7 +27,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build TestLibrary JavaVM CheckUsage + * @build TestLibrary JavaVM * @run main/othervm CheckUsage */ @@ -35,34 +35,21 @@ /** * Make sure that the rmiregistry prints out a correct usage statement - * when run with an incorrect command line; test written to conform to - * new tighter bug fix/regression test guidelines. + * when run with an incorrect command line. */ public class CheckUsage { public static void main(String[] args) { - System.err.println("\nregression test for 4151966\n"); - - JavaVM registryVM = null; - try { - // make sure the registry exits with a proper usage statement ByteArrayOutputStream berr = new ByteArrayOutputStream(); // run a VM to start the registry - registryVM = new JavaVM("sun.rmi.registry.RegistryImpl", - "", "foo", - System.out, berr); + JavaVM registryVM = new JavaVM("sun.rmi.registry.RegistryImpl", + "", "foo", + System.out, berr); System.err.println("starting registry"); - registryVM.start(); - - // wait for registry exit System.err.println(" registry exited with status: " + - registryVM.getVM().waitFor()); - try { - Thread.sleep(7000); - } catch (InterruptedException ie) { - } + registryVM.execute()); String usage = new String(berr.toByteArray()); @@ -75,9 +62,6 @@ } } catch (Exception e) { TestLibrary.bomb(e); - } finally { - registryVM.destroy(); - registryVM = null; } } }
--- a/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build ClassPathCodebase Dummy TestLibrary + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy * -Djava.rmi.server.useCodebaseOnly=false ClassPathCodebase */
--- a/test/java/rmi/registry/interfaceHash/InterfaceHash.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/interfaceHash/InterfaceHash.java Fri Jun 21 15:46:14 2013 -0500 @@ -36,9 +36,7 @@ * * @author Peter Jones * @library ../../testlibrary - * @build InterfaceHash - * @build ReferenceRegistryStub - * @build TestLibrary + * @build TestLibrary ReferenceRegistryStub * @run main/othervm InterfaceHash */
--- a/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,7 +28,6 @@ * * @library ../../testlibrary * @build TestLibrary - * @build MultipleRegistries * @run main/othervm/timeout=240 MultipleRegistries */
--- a/test/java/rmi/registry/readTest/readTest.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/readTest/readTest.sh Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,7 @@ # @bug 7102369 7094468 7100592 # @library ../../testlibrary # @build TestLibrary -# @summary remove java.rmi.server.codebase property parsing from registyimpl +# @summary remove java.rmi.server.codebase property parsing from RegistryImpl # @run shell readTest.sh OS=`uname -s` @@ -35,20 +35,26 @@ FS="/" FILEURL="file:" ;; - Windows* | CYGWIN* ) + Windows* ) PS=";" FS="\\" FILEURL="file:/" ;; + CYGWIN* ) + PS=";" + FS="/" + FILEURL="file:/" + ;; * ) echo "Unrecognized system!" exit 1; ;; esac +TEST_CLASSPATH=.$PS${TESTCLASSPATH:-$TESTCLASSES} cp -r ${TESTSRC}${FS}* . ${TESTJAVA}${FS}bin${FS}javac testPkg${FS}*java -${TESTJAVA}${FS}bin${FS}javac readTest.java +${TESTJAVA}${FS}bin${FS}javac -cp $TEST_CLASSPATH readTest.java mkdir rmi_tmp RMIREG_OUT=rmi.out @@ -62,8 +68,16 @@ sleep 3 cd .. +case "$OS" in + CYGWIN* ) + CODEBASE=`cygpath -w $PWD` + ;; + * ) + CODEBASE=`pwd` + ;; +esac # trailing / after code base is important for rmi codebase property. -${TESTJAVA}${FS}bin${FS}java -Djava.rmi.server.codebase=${FILEURL}`pwd`/ readTest > OUT.TXT 2>&1 & +${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 & TEST_PID=$! #bulk of testcase - let it run for a while sleep 5
--- a/test/java/rmi/registry/reexport/Reexport.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/registry/reexport/Reexport.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,7 @@ * @bug 4120329 * @summary RMI registry creation is impossible if first attempt fails. * @library ../../testlibrary - * @build StreamPipe TestParams TestLibrary JavaVM - * @build RegistryRunner RegistryRunner_Stub - * @build Reexport + * @build TestLibrary JavaVM RegistryRunner RegistryRunner_Stub * @run main/othervm Reexport */ @@ -124,8 +122,7 @@ try { JavaVM jvm = new JavaVM("RegistryRunner", "", Integer.toString(p)); jvm.start(); - Reexport.subreg = jvm.getVM(); - + Reexport.subreg = jvm; } catch (IOException e) { // one of these is summarily dropped, can't remember which one System.out.println ("Test setup failed - cannot run rmiregistry"); @@ -137,7 +134,8 @@ } catch (Exception whatever) { } } - private static Process subreg = null; + + private static JavaVM subreg = null; public static void killRegistry(int port) { if (Reexport.subreg != null) {
--- a/test/java/rmi/reliability/benchmark/runRmiBench.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/reliability/benchmark/runRmiBench.sh Fri Jun 21 15:46:14 2013 -0500 @@ -27,20 +27,20 @@ # used to run the test under JTREG. # # @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark -# @build bench.Reporter bench.XmlReporter bench.ConfigFormatException -# @build bench.Harness bench.TextReporter bench.rmi.BenchServer -# @build bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls -# @build bench.rmi.BenchServerImpl bench.rmi.DoubleCalls -# @build bench.rmi.Main bench.rmi.SmallObjTreeCalls -# @build bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls -# @build bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs -# @build bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls -# @build bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls -# @build bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls -# @build bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls -# @build bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls -# @build bench.rmi.ClassLoading bench.rmi.LongArrayCalls -# @build bench.rmi.ShortArrayCalls bench.rmi.altroot.Node +# bench.Reporter bench.XmlReporter bench.ConfigFormatException +# bench.Harness bench.TextReporter bench.rmi.BenchServer +# bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls +# bench.rmi.BenchServerImpl bench.rmi.DoubleCalls +# bench.rmi.Main bench.rmi.SmallObjTreeCalls +# bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls +# bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs +# bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls +# bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls +# bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls +# bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls +# bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls +# bench.rmi.ClassLoading bench.rmi.LongArrayCalls +# bench.rmi.ShortArrayCalls bench.rmi.altroot.Node # # @run shell/timeout=1800 runRmiBench.sh #
--- a/test/java/rmi/reliability/benchmark/runSerialBench.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/reliability/benchmark/runSerialBench.sh Fri Jun 21 15:46:14 2013 -0500 @@ -27,22 +27,22 @@ # used to run the test under JTREG. # # @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark -# @build bench.Reporter bench.XmlReporter bench.ConfigFormatException -# @build bench.Harness bench.TextReporter -# @build bench.serial.BooleanArrays bench.serial.Booleans -# @build bench.serial.ByteArrays bench.serial.Bytes bench.serial.CharArrays -# @build bench.serial.Chars bench.serial.ClassDesc bench.serial.Cons -# @build bench.serial.CustomDefaultObjTrees bench.serial.CustomObjTrees -# @build bench.serial.DoubleArrays bench.serial.Doubles -# @build bench.serial.ExternObjTrees bench.serial.FloatArrays -# @build bench.serial.Floats bench.serial.GetPutFieldTrees -# @build bench.serial.IntArrays bench.serial.Ints bench.serial.LongArrays -# @build bench.serial.Longs bench.serial.Main bench.serial.ObjArrays -# @build bench.serial.ObjTrees bench.serial.ProxyArrays -# @build bench.serial.ProxyClassDesc bench.serial.RepeatObjs -# @build bench.serial.ReplaceTrees bench.serial.ShortArrays -# @build bench.serial.Shorts bench.serial.SmallObjTrees -# @build bench.serial.StreamBuffer bench.serial.Strings +# bench.Reporter bench.XmlReporter bench.ConfigFormatException +# bench.Harness bench.TextReporter +# bench.serial.BooleanArrays bench.serial.Booleans +# bench.serial.ByteArrays bench.serial.Bytes bench.serial.CharArrays +# bench.serial.Chars bench.serial.ClassDesc bench.serial.Cons +# bench.serial.CustomDefaultObjTrees bench.serial.CustomObjTrees +# bench.serial.DoubleArrays bench.serial.Doubles +# bench.serial.ExternObjTrees bench.serial.FloatArrays +# bench.serial.Floats bench.serial.GetPutFieldTrees +# bench.serial.IntArrays bench.serial.Ints bench.serial.LongArrays +# bench.serial.Longs bench.serial.Main bench.serial.ObjArrays +# bench.serial.ObjTrees bench.serial.ProxyArrays +# bench.serial.ProxyClassDesc bench.serial.RepeatObjs +# bench.serial.ReplaceTrees bench.serial.ShortArrays +# bench.serial.Shorts bench.serial.SmallObjTrees +# bench.serial.StreamBuffer bench.serial.Strings # # @run shell/timeout=1800 runSerialBench.sh #
--- a/test/java/rmi/reliability/juicer/AppleUserImpl.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/reliability/juicer/AppleUserImpl.java Fri Jun 21 15:46:14 2013 -0500 @@ -55,11 +55,10 @@ * has been reached. * * @library ../../testlibrary - * - * @build Apple AppleEvent AppleImpl AppleUserImpl - * @build Orange OrangeEcho OrangeEchoImpl OrangeImpl - * @build ApplicationServer * @build TestLibrary + * Apple AppleEvent AppleImpl + * Orange OrangeEcho OrangeEchoImpl OrangeImpl + * ApplicationServer * * @run main/othervm/policy=security.policy AppleUserImpl -seconds 30 *
--- a/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,6 @@ * ObjID() should still generate sequential object numbers. * @author Peter Jones * - * @build RandomIDs * @run main/othervm RandomIDs random * @run main/othervm -Djava.rmi.server.randomIDs=true RandomIDs random * @run main/othervm -Djava.rmi.server.randomIDs=false RandomIDs sequential
--- a/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java Fri Jun 21 15:46:14 2013 -0500 @@ -33,9 +33,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build DelegateBeforePermissionCheck - * @build Foo + * @build TestLibrary Foo * @run main/othervm DelegateBeforePermissionCheck */
--- a/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,7 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build DelegateToContextLoader Dummy + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy/timeout=120 DelegateToContextLoader */
--- a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,11 +31,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Receiver - * @build DownloadArrayClass - * @build DownloadArrayClass_Stub - * @build Foo + * @build TestLibrary Receiver DownloadArrayClass_Stub Foo * @run main/othervm/policy=security.policy DownloadArrayClass */
--- a/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,7 +29,6 @@ * * @library ../../../testlibrary * @build TestLibrary - * @build NullClass * @run main/othervm NullClass */
--- a/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,9 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary - * @build GetClassLoader - * @build Foo + * @build TestLibrary Foo * @run main/othervm/policy=security.policy GetClassLoader */
--- a/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,8 +30,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary FnnClass FnnUnmarshal LoadProxyClasses NonpublicInterface - * @build NonpublicInterface1 PublicInterface PublicInterface1 + * @build TestLibrary FnnClass FnnUnmarshal NonpublicInterface + * NonpublicInterface1 PublicInterface PublicInterface1 * @run main/othervm/policy=security.policy * -Djava.rmi.server.useCodebaseOnly=false LoadProxyClasses */
--- a/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,7 +30,7 @@ * been used for the RMI class loader instance. * @author Peter Jones * - * @build NoSecurityManager Dummy LocalDummy + * @build Dummy LocalDummy * @run main/othervm/timeout=120 NoSecurityManager */
--- a/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,11 +30,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build ContextInsulation - * @build ServiceConfiguration - * @build TestProvider - * @build TestProvider2 + * @build TestLibrary ServiceConfiguration TestProvider TestProvider2 * @run main/othervm/policy=security.policy ContextInsulation */
--- a/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,10 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build DefaultProperty - * @build ServiceConfiguration - * @build Foo + * @build TestLibrary ServiceConfiguration Foo * @run main/othervm/policy=security.policy DefaultProperty */
--- a/test/java/rmi/server/RMIClassLoader/spi/Installed.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/spi/Installed.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,11 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Installed - * @build ServiceConfiguration - * @build TestProvider - * @build TestProvider2 + * @build TestLibrary ServiceConfiguration TestProvider TestProvider2 * @run main/othervm/policy=security.policy Installed */
--- a/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,9 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build InvalidProperty - * @build ServiceConfiguration + * @build TestLibrary ServiceConfiguration * @run main/othervm/policy=security.policy InvalidProperty */
--- a/test/java/rmi/server/RMIClassLoader/spi/Property.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/spi/Property.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,10 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Property - * @build ServiceConfiguration - * @build TestProvider + * @build TestLibrary ServiceConfiguration TestProvider * @run main/othervm/policy=security.policy Property */
--- a/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,12 +31,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Receiver - * @build UseCodebaseOnly - * @build UseCodebaseOnly_Stub - * @build Foo - * @build Bar + * @build TestLibrary Receiver UseCodebaseOnly_Stub Foo Bar * @run main/othervm/policy=security.policy UseCodebaseOnly */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/rmi/server/RMIClassLoader/useCodebaseOnlyDefault/UseCodebaseOnlyDefault.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8001040 + * @summary Tests proper parsing and defaulting of the + * "java.rmi.server.useCodebaseOnly" property. + * + * @run main/othervm UseCodebaseOnlyDefault true + * @run main/othervm -Djava.rmi.server.useCodebaseOnly=xyzzy UseCodebaseOnlyDefault true + * @run main/othervm -Djava.rmi.server.useCodebaseOnly UseCodebaseOnlyDefault true + * @run main/othervm -Djava.rmi.server.useCodebaseOnly=true UseCodebaseOnlyDefault true + * @run main/othervm -Djava.rmi.server.useCodebaseOnly=false UseCodebaseOnlyDefault false + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; +import java.lang.reflect.Field; +import sun.rmi.server.MarshalInputStream; + +/** + * usage: UseCodebaseOnlyDefault expected + * + * 'expected' is the expected value of useCodebaseOnly, which + * must be "true" or "false". + */ +public class UseCodebaseOnlyDefault { + static final String USAGE = "usage: UseCodebaseOnlyDefault boolean"; + static final String PROPNAME = "java.rmi.server.useCodebaseOnly"; + + /** + * Gets the actual useCodebaseOnly value by creating an instance + * of MarshalInputStream and reflecting on the useCodebaseOnly field. + */ + static boolean getActualValue() throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject("foo"); + oos.close(); + + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + MarshalInputStream mis = new MarshalInputStream(bais); + + Field f = MarshalInputStream.class.getDeclaredField("useCodebaseOnly"); + f.setAccessible(true); + return f.getBoolean(mis); + } + + public static void main(String[] args) throws Exception { + if (args.length != 1) { + throw new IllegalArgumentException(USAGE); + } + + boolean expected; + if (args[0].equals("true")) { + expected = true; + } else if (args[0].equals("false")) { + expected = false; + } else { + throw new IllegalArgumentException(USAGE); + } + System.out.println("expected = " + expected); + + String prop = System.getProperty(PROPNAME); + System.out.print("Property " + PROPNAME); + if (prop == null) { + System.out.println(" is not set"); + } else { + System.out.println(" = '" + prop + "'"); + } + + boolean actual = getActualValue(); + System.out.println("actual = " + actual); + + if (expected != actual) + throw new AssertionError("actual does not match expected value"); + } +}
--- a/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,8 +30,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build UseGetURLs Dummy + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy/timeout=120 UseGetURLs */
--- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,11 +28,7 @@ * @author Ann Wollrath * * @library ../../../../testlibrary - * @build Echo - * @build EchoImpl - * @build EchoImpl_Stub - * @build UseCustomSocketFactory - * @build TestLibrary + * @build TestLibrary Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=360 UseCustomSocketFactory */
--- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,12 +29,7 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../../testlibrary - * @build Hello - * @build HelloImpl - * @build HelloImpl_Stub - * @build TestLibrary - * @build UseCustomSocketFactory - * @build Compress + * @build TestLibrary Compress Hello HelloImpl HelloImpl_Stub * @run main/othervm/policy=security.policy/timeout=240 UseCustomSocketFactory */
--- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,11 +29,7 @@ * @author Ann Wollrath * * @library ../../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build Echo - * @build EchoImpl - * @build EchoImpl_Stub - * @build UseCustomSocketFactory + * @build TestLibrary RMID JavaVM Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=120 UseCustomSocketFactory */
--- a/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,9 +29,7 @@ * (specifically: stubs) that contain the instance's RemoteRef. * @author Peter Jones * - * @build NotExtending - * @build NotExtending_Stub - * @build NotExtending_Skel + * @build NotExtending_Stub NotExtending_Skel * @run main/othervm/timeout=240 NotExtending */
--- a/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,16 +21,16 @@ * questions. */ -/** +/* * @test * @bug 4251010 * @summary equals does not works on stub objects created with * custom socket AndFactory - * @library ../../../testlibrary + * @author Laird Dornin * - * @build VerifyRemoteEquals + * @library ../../../testlibrary + * @build TestLibrary * @run main/othervm/timeout=40 VerifyRemoteEquals - * @author Laird Dornin */ import java.io.*;
--- a/test/java/rmi/server/RemoteServer/AddrInUse.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/RemoteServer/AddrInUse.java Fri Jun 21 15:46:14 2013 -0500 @@ -26,8 +26,6 @@ * @summary retryServerSocket should not retry on BindException * @author Ann Wollrath * - * @library ../../testlibrary - * @build AddrInUse * @run main/othervm AddrInUse */
--- a/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,8 +31,7 @@ * * @author Ann Wollrath * - * @build ChangeHostName - * @build ChangeHostName_Stub + * @build ChangeHostName ChangeHostName_Stub * @run main/othervm ChangeHostName */
--- a/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,6 +30,7 @@ * @bug 6597112 * @summary GC'ing objects whilst being exported to RMI should not cause exceptions * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com> + * @run main GcDuringExport */ import java.rmi.Remote;
--- a/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,14 +32,8 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build JavaVM - * @build KeepAliveDuringCall - * @build KeepAliveDuringCall_Stub - * @build ShutdownMonitor - * @build Shutdown - * @build ShutdownImpl - * @build ShutdownImpl_Stub + * @build TestLibrary JavaVM KeepAliveDuringCall_Stub + * ShutdownMonitor Shutdown ShutdownImpl ShutdownImpl_Stub * @run main/othervm KeepAliveDuringCall */
--- a/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,8 +31,7 @@ * IOException (see fix for bugid 4017232). * @author Peter Jones * - * @build MarshalAfterUnexport - * @build MarshalAfterUnexport_Stub + * @build MarshalAfterUnexport MarshalAfterUnexport_Stub * @run main/othervm MarshalAfterUnexport */
--- a/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java Fri Jun 21 15:46:14 2013 -0500 @@ -33,8 +33,7 @@ * @author Peter Jones * @author Ann Wollrath * - * @build MarshalAfterUnexport2 - * @build MarshalAfterUnexport2_Stub + * @build MarshalAfterUnexport2 MarshalAfterUnexport2_Stub * @run main/othervm MarshalAfterUnexport2 */
--- a/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,10 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build UnexportLeak - * @build UnexportLeak_Stub - * @build TestLibrary - * @build Ping + * @build TestLibrary UnexportLeak_Stub Ping * @run main/othervm UnexportLeak */
--- a/test/java/rmi/server/Unmarshal/PrimitiveClasses.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/Unmarshal/PrimitiveClasses.java Fri Jun 21 15:46:14 2013 -0500 @@ -25,6 +25,7 @@ * @bug 4442373 * @summary Verify that RMI can successfully unmarshal Class objects for * primitive types. + * @run main PrimitiveClasses */ import java.rmi.MarshalledObject;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshal.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * + */ +import java.rmi.Remote; +import java.rmi.RemoteException; + /* + * Interface with methods to exercise RMI parameter marshalling + * and unmarshalling. + */ + interface CheckUnmarshal extends java.rmi.Remote { + public PoisonPill getPoisonPill() throws RemoteException; + public Object ping() throws RemoteException; + public void passRuntimeExceptionParameter( + RuntimeExceptionParameter rep) + throws RemoteException; + }
--- a/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,10 +31,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build CheckUnmarshall PoisonPill RuntimeExceptionParameter - * @build CheckUnmarshalOnStopThread - * @build CheckUnmarshalOnStopThread_Stub + * @build TestLibrary CheckUnmarshal CheckUnmarshalOnStopThread_Stub + * PoisonPill RuntimeExceptionParameter * @run main/othervm/timeout=480 CheckUnmarshalOnStopThread */
--- a/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * - */ -import java.rmi.Remote; -import java.rmi.RemoteException; - /* - * Interface with methods to exercise RMI parameter marshalling - * and unmarshalling. - */ - interface CheckUnmarshal extends java.rmi.Remote { - public PoisonPill getPoisonPill() throws RemoteException; - public Object ping() throws RemoteException; - public void passRuntimeExceptionParameter( - RuntimeExceptionParameter rep) - throws RemoteException; - }
--- a/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java Fri Jun 21 15:46:14 2013 -0500 @@ -35,9 +35,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build FiniteGCLatency - * @build FiniteGCLatency_Stub - * @build TestLibrary + * @build TestLibrary FiniteGCLatency_Stub * @run main/othervm/timeout=120 FiniteGCLatency */
--- a/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java Fri Jun 21 15:46:14 2013 -0500 @@ -37,11 +37,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build JavaVM - * @build LeaseCheckInterval - * @build LeaseCheckInterval_Stub - * @build SelfTerminator + * @build TestLibrary JavaVM LeaseCheckInterval_Stub SelfTerminator * @run main/othervm LeaseCheckInterval */
--- a/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,8 +30,6 @@ * invoked. * @author Peter Jones * - * @library ../../../testlibrary - * @build MarshalledObjectGet * @build MarshalledObjectGet_Stub * @run main/othervm/timeout=120 MarshalledObjectGet */
--- a/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java Fri Jun 21 15:46:14 2013 -0500 @@ -39,9 +39,7 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build UnreferencedContext - * @build UnreferencedContext_Stub - * @build TestLibrary + * @build TestLibrary UnreferencedContext_Stub * @run main/othervm/timeout=120 UnreferencedContext */
--- a/test/java/rmi/server/clientStackTrace/ClientStackTrace.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/clientStackTrace/ClientStackTrace.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,7 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build ClientStackTrace MyRemoteObject_Stub TestLibrary TestParams + * @build TestLibrary ClientStackTrace MyRemoteObject_Stub * @run main/othervm/policy=security.policy/timeout=120 ClientStackTrace */
--- a/test/java/rmi/server/getRemoteClass/GetRemoteClass.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/getRemoteClass/GetRemoteClass.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,7 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build GetRemoteClass TestLibrary TestParams + * @build TestLibrary * @run main/othervm GetRemoteClass */
--- a/test/java/rmi/server/serverStackTrace/ServerStackTrace.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/serverStackTrace/ServerStackTrace.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,8 +29,7 @@ * serialized with the Throwable from the server. * @author Peter Jones * - * @build ServerStackTrace - * @build ServerStackTrace_Stub + * @build ServerStackTrace ServerStackTrace_Stub * @run main/othervm ServerStackTrace */
--- a/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java Fri Jun 21 15:46:14 2013 -0500 @@ -36,10 +36,7 @@ * for reasons of performance or confidentiality requirements. * @author Peter Jones * - * @build SuppressStackTraces - * @build Impl2_Stub - * @build Impl1_Stub - * @build Impl1_Skel + * @build SuppressStackTraces Impl2_Stub Impl1_Stub Impl1_Skel * @run main/othervm SuppressStackTraces */
--- a/test/java/rmi/server/useCustomRef/UseCustomRef.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/server/useCustomRef/UseCustomRef.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,11 +31,7 @@ * 4180392 * * @library ../../testlibrary - * @build UseCustomRef - * @build Ping - * @build UseCustomRef_Stub - * @build UseCustomRef_Skel - * @build TestLibrary + * @build TestLibrary Ping UseCustomRef_Stub UseCustomRef_Skel * @run main/othervm/policy=security.policy/secure=java.rmi.RMISecurityManager/timeout=120 UseCustomRef * * This test was failing to run because the synthetic access
--- a/test/java/rmi/testlibrary/ActivationLibrary.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/testlibrary/ActivationLibrary.java Fri Jun 21 15:46:14 2013 -0500 @@ -63,19 +63,30 @@ */ public static void deactivate(Remote remote, ActivationID id) { - for (int i = 0; i < 5; i ++) { + // We do as much as 50 deactivation trials, each separated by + // at least 100 milliseconds sleep time (max sleep time of 5 secs). + final long deactivateSleepTime = 100; + for (int i = 0; i < 50; i ++) { try { if (Activatable.inactive(id) == true) { mesg("inactive successful"); return; } else { - Thread.sleep(1000); + mesg("inactive trial failed. Sleeping " + + deactivateSleepTime + + " milliseconds before next trial"); + Thread.sleep(deactivateSleepTime); } } catch (InterruptedException e) { - continue; + Thread.currentThread().interrupt(); + mesg("Thread interrupted while trying to deactivate activatable. Exiting deactivation"); + return; } catch (Exception e) { try { // forcibly unexport the object + mesg("Unexpected exception. Have to forcibly unexport the object." + + " Exception was :"); + e.printStackTrace(); Activatable.unexportObject(remote, true); } catch (NoSuchObjectException ex) { } @@ -99,37 +110,61 @@ * activation system. */ public static boolean rmidRunning(int port) { - int allowedNotReady = 10; + int allowedNotReady = 50; int connectionRefusedExceptions = 0; - for (int i = 0; i < 15 ; i++) { + /* We wait as much as a total of 7.5 secs trying to see Rmid running. + * We do this by pausing steps of 100 milliseconds (so up to 75 steps), + * right after trying to lookup and find RMID running in the other vm. + */ + final long rmidWaitingStepTime = 100; + for (int i = 0; i <= 74; i++) { try { - Thread.sleep(500); LocateRegistry.getRegistry(port).lookup(SYSTEM_NAME); + mesg("Activation System available after " + + (i * rmidWaitingStepTime) + " milliseconds"); return true; } catch (java.rmi.ConnectException e) { + mesg("Remote connection refused after " + + (i * rmidWaitingStepTime) + " milliseconds"); + // ignore connect exceptions until we decide rmid is not up - if ((connectionRefusedExceptions ++) >= allowedNotReady) { return false; } + } catch (java.rmi.NoSuchObjectException nsoe) { + /* Activation System still unavailable. + * Ignore this since we are just waiting for its availibility. + * Just signal unavailibility. + */ + mesg("Activation System still unavailable after more than " + + (i * rmidWaitingStepTime) + " milliseconds"); + } catch (NotBoundException e) { - return false; } catch (Exception e) { - // print out other types of exceptions as an FYI. - // test should not fail as rmid is likely to be in an - // undetermined state at this point. - + /* print out other types of exceptions as an FYI. + * test should not fail as rmid is likely to be in an + * undetermined state at this point. + */ mesg("caught an exception trying to" + " start rmid, last exception was: " + e.getMessage()); e.printStackTrace(); } + + // Waiting for another 100 milliseconds. + try { + Thread.sleep(100); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking if Activation System is running. Exiting check"); + return false; + } } return false; }
--- a/test/java/rmi/testlibrary/JavaVM.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/testlibrary/JavaVM.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, 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 @@ -21,13 +21,10 @@ * questions. */ -/** - * - */ - -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; import java.util.Arrays; -import java.util.Properties; import java.util.StringTokenizer; /** @@ -36,7 +33,6 @@ */ public class JavaVM { - // need to protected Process vm = null; private String classname = ""; @@ -45,6 +41,8 @@ private OutputStream outputStream = System.out; private OutputStream errorStream = System.err; private String policyFileName = null; + private StreamPipe outPipe; + private StreamPipe errPipe; private static void mesg(Object mesg) { System.err.println("JAVAVM: " + mesg.toString()); @@ -79,6 +77,7 @@ this.errorStream = err; } + // Prepends passed opts array to current options public void addOptions(String[] opts) { String newOpts = ""; for (int i = 0 ; i < opts.length ; i ++) { @@ -87,6 +86,8 @@ newOpts += " "; options = newOpts + options; } + + // Prepends passed arguments array to current args public void addArguments(String[] arguments) { String newArgs = ""; for (int i = 0 ; i < arguments.length ; i ++) { @@ -123,7 +124,8 @@ */ public void start() throws IOException { - if (vm != null) return; + if (vm != null) + throw new IllegalStateException("JavaVM already started"); /* * If specified, add option for policy file @@ -153,20 +155,12 @@ } mesg("command = " + Arrays.asList(javaCommand).toString()); - System.err.println(""); vm = Runtime.getRuntime().exec(javaCommand); /* output from the execed process may optionally be captured. */ - StreamPipe.plugTogether(vm.getInputStream(), this.outputStream); - StreamPipe.plugTogether(vm.getErrorStream(), this.errorStream); - - try { - Thread.sleep(2000); - } catch (Exception ignore) { - } - - mesg("finished starting vm."); + outPipe = StreamPipe.plugTogether(vm.getInputStream(), this.outputStream); + errPipe = StreamPipe.plugTogether(vm.getErrorStream(), this.errorStream); } public void destroy() { @@ -176,8 +170,26 @@ vm = null; } - protected Process getVM() { - return vm; + /** + * Waits for the subprocess to exit, joins the pipe threads to ensure that + * all output is collected, and returns its exit status. + */ + public int waitFor() throws InterruptedException { + if (vm == null) + throw new IllegalStateException("can't wait for JavaVM that hasn't started"); + + int status = vm.waitFor(); + outPipe.join(); + errPipe.join(); + return status; + } + + /** + * Starts the subprocess, waits for it to exit, and returns its exit status. + */ + public int execute() throws IOException, InterruptedException { + start(); + return waitFor(); } /**
--- a/test/java/rmi/testlibrary/RMID.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/testlibrary/RMID.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -205,8 +205,6 @@ public void start(long waitTime) throws IOException { - if (getVM() != null) return; - // if rmid is already running, then the test will fail with // a well recognized exception (port already in use...). @@ -220,16 +218,22 @@ } catch (NumberFormatException ignore) {} waitTime = waitTime * slopFactor; - // give rmid time to come up + // We check several times (as many as provides passed waitTime) to + // see if Rmid is currently running. Waiting steps last 100 msecs. + final long rmidStartSleepTime = 100; do { + // Sleeping for another rmidStartSleepTime time slice. try { - Thread.sleep(Math.min(waitTime, 10000)); + Thread.sleep(Math.min(waitTime, rmidStartSleepTime)); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking for start of Activation System. Giving up check."); + mesg("Activation System state unknown"); + return; } - waitTime -= 10000; + waitTime -= rmidStartSleepTime; - // is rmid present? + // Checking if rmid is present if (ActivationLibrary.rmidRunning(port)) { /** * We need to set the java.rmi.activation.port value as the @@ -242,6 +246,10 @@ mesg("finished starting rmid."); return; } + else { + mesg("rmid still not started"); + } + } while (waitTime > 0); TestLibrary.bomb("start rmid failed... giving up", null); } @@ -270,6 +278,8 @@ port + "/java.rmi.activation.ActivationSystem"); mesg("obtained a reference to the activation system"); + } catch (RemoteException re) { + mesg("could not contact registry while trying to shutdown activation system"); } catch (java.net.MalformedURLException mue) { } @@ -278,19 +288,14 @@ } system.shutdown(); + } catch (RemoteException re) { + mesg("shutting down the activation daemon failed"); } catch (Exception e) { mesg("caught exception trying to shutdown rmid"); mesg(e.getMessage()); e.printStackTrace(); } - try { - // wait for the shutdown to happen - Thread.sleep(5000); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - } - mesg("testlibrary finished shutting down rmid"); } @@ -305,18 +310,47 @@ if (vm != null) { try { - // destroy rmid if it is still running... - try { - vm.exitValue(); - mesg("rmid exited on shutdown request"); - } catch (IllegalThreadStateException illegal) { - mesg("Had to destroy RMID's process " + - "using Process.destroy()"); + /* Waiting for distant RMID process to shutdown. + * Waiting is bounded at a hardcoded max of 60 secs (1 min). + * Waiting by steps of 200 msecs, thus at most 300 such attempts + * for termination of distant RMID process. If process is not + * known to be terminated properly after that time, + * we give up for a gracefull termination, and thus go for + * forcibly destroying the process. + */ + boolean vmEnded = false; + int waitingTrials = 0; + final int maxTrials = 300; + final long vmProcessEndWaitInterval = 200; + int vmExitValue; + do { + try { + Thread.sleep(vmProcessEndWaitInterval); + waitingTrials++; + vmExitValue = vm.exitValue(); + mesg("rmid exited on shutdown request"); + vmEnded = true; + } catch (IllegalThreadStateException illegal) { + mesg("RMID's process still not terminated after more than " + + (waitingTrials * vmProcessEndWaitInterval) + " milliseconds"); + } + } + while (!vmEnded && + (waitingTrials < maxTrials)); + + if (waitingTrials >= maxTrials) { + mesg("RMID's process still not terminated after more than " + + (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." + + "Givinp up gracefull termination..."); + mesg("destroying RMID's process using Process.destroy()"); super.destroy(); } + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check."); } catch (Exception e) { - mesg("caught exception trying to destroy rmid: " + + mesg("caught unexpected exception trying to destroy rmid: " + e.getMessage()); e.printStackTrace(); }
--- a/test/java/rmi/testlibrary/StreamPipe.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/testlibrary/StreamPipe.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,10 @@ * questions. */ -/** - * - */ - -import java.io.*; +import java.io.InputStream; +import java.io.InterruptedIOException; +import java.io.IOException; +import java.io.OutputStream; /** * Pipe output of one stream into input of another. @@ -34,47 +33,51 @@ private InputStream in; private OutputStream out; - private String preamble; - private static Object lock = new Object(); + + private static Object countLock = new Object(); private static int count = 0; - public StreamPipe(InputStream in, OutputStream out, String name) { + /** + * StreamPipe constructor : should only be called by plugTogether() method. + */ + private StreamPipe(InputStream in, OutputStream out, String name) { super(name); this.in = in; this.out = out; - this.preamble = "# "; } + /** + * Creates a StreamPipe thread that copies in to out and returns + * the created instance. + */ + public static StreamPipe plugTogether(InputStream in, OutputStream out) { + String name; + + synchronized (countLock) { + name = "java.rmi.testlibrary.StreamPipe-" + (count++); + } + + StreamPipe pipe = new StreamPipe(in, out, name); + pipe.setDaemon(true); + pipe.start(); + return pipe; + } + + // Starts redirection of streams. public void run() { - BufferedReader r = new BufferedReader(new InputStreamReader(in), 1); - BufferedWriter w = new BufferedWriter(new OutputStreamWriter(out)); - byte[] buf = new byte[256]; - boolean bol = true; // beginning-of-line - int count; - try { - String line; - while ((line = r.readLine()) != null) { - w.write(preamble); - w.write(line); - w.newLine(); - w.flush(); + byte[] buf = new byte[1024]; + + while (true) { + int nr = in.read(buf); + if (nr == -1) + break; + out.write(buf, 0, nr); } + } catch (IOException e) { System.err.println("*** IOException in StreamPipe.run:"); e.printStackTrace(); } } - - public static void plugTogether(InputStream in, OutputStream out) { - String name = null; - - synchronized (lock) { - name = "TestLibrary: StreamPipe-" + (count ++ ); - } - - Thread pipe = new StreamPipe(in, out, name); - pipe.setDaemon(true); - pipe.start(); - } }
--- a/test/java/rmi/testlibrary/TestLibrary.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/testlibrary/TestLibrary.java Fri Jun 21 15:46:14 2013 -0500 @@ -54,6 +54,7 @@ import java.rmi.server.UnicastRemoteObject; import java.util.Enumeration; import java.util.Properties; + import sun.rmi.registry.RegistryImpl; import sun.rmi.server.UnicastServerRef; import sun.rmi.transport.Endpoint; @@ -92,6 +93,7 @@ public final static int INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT = 64003; public final static int INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT = 64004; public final static int READTEST_REGISTRY_PORT = 64005; + private final static int MAX_SERVER_SOCKET_TRIES = 2*(FIXED_PORT_MAX-FIXED_PORT_MIN+1); static void mesg(Object mesg) { System.err.println("TEST_LIBRARY: " + mesg.toString()); @@ -125,36 +127,15 @@ bomb(null, e); } - /** - * Property accessors - */ - private static boolean getBoolean(String name) { - return (new Boolean(getProperty(name, "false")).booleanValue()); - } - private static Integer getInteger(String name) { - int val = 0; - Integer value = null; - - String propVal = getProperty(name, null); - if (propVal == null) { - return null; - } - - try { - value = new Integer(Integer.parseInt(propVal)); - } catch (NumberFormatException nfe) { - } - return value; - } public static String getProperty(String property, String defaultVal) { final String prop = property; final String def = defaultVal; - return ((String) java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Object run() { + return java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<String>() { + public String run() { return System.getProperty(prop, def); } - })); + }); } /** @@ -169,9 +150,9 @@ public static void setProperty(String property, String value) { final String prop = property; final String val = value; - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Object run() { + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<Void>() { + public Void run() { System.setProperty(prop, val); return null; } @@ -188,7 +169,7 @@ out.println("-------------------Test environment----------" + "---------"); - for(Enumeration keys = System.getProperties().keys(); + for(Enumeration<?> keys = System.getProperties().keys(); keys.hasMoreElements();) { String property = (String) keys.nextElement(); @@ -252,7 +233,7 @@ /* * Obtain the URL for the codebase. */ - URL codebaseURL = dstDir.toURL(); + URL codebaseURL = dstDir.toURI().toURL(); /* * Specify where we will copy the class definition from, if @@ -407,26 +388,46 @@ */ public static int getUnusedRandomPort() { int numTries = 0; - int unusedRandomPort = FIXED_PORT_MIN; - Exception ex = null; + IOException ex = null; - while (numTries++ < 10) { + while (numTries++ < MAX_SERVER_SOCKET_TRIES) { + int unusedRandomPort = -1; ex = null; //reset try (ServerSocket ss = new ServerSocket(0)) { unusedRandomPort = ss.getLocalPort(); - } catch (Exception e) { + } catch (IOException e) { ex = e; + // temporarily print stack trace here until we find out why + // tests are failing. + System.err.println("TestLibrary.getUnusedRandomPort() caught " + + "exception on iteration " + numTries + + (numTries==MAX_SERVER_SOCKET_TRIES ? " (the final try)." + : ".")); + ex.printStackTrace(); } - if (!isReservedPort(unusedRandomPort)) { - return unusedRandomPort; + if (unusedRandomPort >= 0) { + if (isReservedPort(unusedRandomPort)) { + System.out.println("INFO: On try # " + numTries + + (numTries==MAX_SERVER_SOCKET_TRIES ? ", the final try, ": ",") + + " ServerSocket(0) returned the reserved port " + + unusedRandomPort + + " in TestLibrary.getUnusedRandomPort() "); + } else { + return unusedRandomPort; + } } } // If we're here, then either an exception was thrown or the port is // a reserved port. - throw new RuntimeException("Error getting unused random port.", ex); + if (ex==null) { + throw new RuntimeException("Error getting unused random port. The" + +" last port returned by ServerSocket(0) was a reserved port"); + } else { + throw new RuntimeException("Error getting unused random port.", ex); + } } /**
--- a/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,7 +31,6 @@ * exception for which it doesn't even consult the RMIFailureHandler. * @author Peter Jones * - * @build CloseServerSocketOnTermination * @run main/othervm CloseServerSocketOnTermination */
--- a/test/java/rmi/transport/checkFQDN/CheckFQDN.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/checkFQDN/CheckFQDN.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -33,8 +33,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build CheckFQDN CheckFQDNClient CheckFQDN_Stub TellServerName - * @build TestLibrary + * @build TestLibrary CheckFQDNClient CheckFQDN_Stub TellServerName * @run main/othervm/timeout=120 CheckFQDN */ @@ -115,6 +114,7 @@ equal = "="; } + // create a client to tell checkFQDN what its rmi name is. JavaVM jvm = new JavaVM("CheckFQDNClient", propOption + property + equal + @@ -126,10 +126,7 @@ propertyBeingTested=property; propertyBeingTestedValue=propertyValue; - // create a client to tell checkFQDN what its rmi name is. */ - jvm.start(); - - if (jvm.getVM().waitFor() != 0 ) { + if (jvm.execute() != 0) { TestLibrary.bomb("Test failed, error in client."); }
--- a/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -28,8 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build CheckLeaseLeak CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak - * @build TestLibrary + * @build TestLibrary CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak * @run main/othervm/timeout=240 CheckLeaseLeak * */ @@ -103,9 +102,8 @@ " -Drmi.registry.port=" + registryPort, ""); - jvm.start(); - if (jvm.getVM().waitFor() == 1 ) { + if (jvm.execute() != 0) { TestLibrary.bomb("Client process failed"); } }
--- a/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,7 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build CloseServerSocket TestLibrary + * @build TestLibrary * @run main/othervm CloseServerSocket */
--- a/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,11 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build DGCDeadLock - * @build Test - * @build TestImpl - * @build TestImpl_Stub - * @build TestLibrary + * @build TestLibrary Test TestImpl TestImpl_Stub * @run main/othervm/policy=security.policy/timeout=360 DGCDeadLock */
--- a/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,7 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build HandshakeFailure TestLibrary + * @build TestLibrary * @run main/othervm HandshakeFailure */
--- a/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Fri Jun 21 15:46:14 2013 -0500 @@ -34,7 +34,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build HandshakeTimeout TestLibrary + * @build TestLibrary * @run main/othervm HandshakeTimeout */
--- a/test/java/rmi/transport/httpSocket/HttpSocketTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/httpSocket/HttpSocketTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,7 @@ * @author Dana Burns * * @library ../../testlibrary - * @build HttpSocketTest HttpSocketTest_Stub TestLibrary + * @build TestLibrary HttpSocketTest HttpSocketTest_Stub * @run main/othervm/policy=security.policy HttpSocketTest */
--- a/test/java/rmi/transport/pinLastArguments/PinLastArguments.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/pinLastArguments/PinLastArguments.java Fri Jun 21 15:46:14 2013 -0500 @@ -78,10 +78,15 @@ } impl = null; - System.gc(); - - if (ref.get() != null) { - throw new Error("TEST FAILED: impl not garbage collected"); + // Might require multiple calls to System.gc() for weak-references + // processing to be complete. If the weak-reference is not cleared as + // expected we will hang here until timed out by the test harness. + while (true) { + System.gc(); + Thread.sleep(20); + if (ref.get() == null) { + break; + } } System.err.println("TEST PASSED");
--- a/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,7 +32,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build TestLibrary RapidExportUnexport + * @build TestLibrary * @run main/othervm RapidExportUnexport */
--- a/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,12 +27,9 @@ * @summary Incoming connections should be subject to timeout * @author Adrian Colley * - * @library ../../testlibrary - * @build TestIface - * @build TestImpl - * @build TestImpl_Stub - * @build ReadTimeoutTest - * @run main/othervm/policy=security.policy/timeout=60 -Dsun.rmi.transport.tcp.readTimeout=5000 ReadTimeoutTest + * @build TestIface TestImpl TestImpl_Stub + * @run main/othervm/policy=security.policy/timeout=60 + * -Dsun.rmi.transport.tcp.readTimeout=5000 ReadTimeoutTest */ /* This test sets a very short read timeout, exports an object, and then
--- a/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java Fri Jun 21 15:46:14 2013 -0500 @@ -34,7 +34,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build ReuseDefaultPort TestLibrary + * @build TestLibrary * @run main/othervm ReuseDefaultPort */
--- a/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java Fri Jun 21 15:46:14 2013 -0500 @@ -38,7 +38,6 @@ * subsystems also not holding on to the loader in their daemon threads.] * @author Peter Jones * - * @build RuntimeThreadInheritanceLeak * @build RuntimeThreadInheritanceLeak_Stub * @run main/othervm RuntimeThreadInheritanceLeak */
--- a/test/java/security/BasicPermission/PermClass.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/BasicPermission/PermClass.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4511601 + * @bug 4511601 7054918 * @summary BasicPermissionCollection does not set permClass * during deserialization */ @@ -55,59 +55,66 @@ // read in a 1.2.1 BasicPermissionCollection File sFile = new File(dir, "PermClass.1.2.1"); - ObjectInputStream ois = new ObjectInputStream - (new FileInputStream(sFile)); - PermissionCollection pc = (PermissionCollection)ois.readObject(); - System.out.println("1.2.1 collection = " + pc); + try (FileInputStream fis = new FileInputStream(sFile); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection) ois.readObject(); + System.out.println("1.2.1 collection = " + pc); - if (pc.implies(mp)) { - System.out.println("JDK 1.2.1 test passed"); - } else { - throw new Exception("JDK 1.2.1 test failed"); + if (pc.implies(mp)) { + System.out.println("JDK 1.2.1 test passed"); + } else { + throw new Exception("JDK 1.2.1 test failed"); + } } // read in a 1.3.1 BasicPermissionCollection sFile = new File(dir, "PermClass.1.3.1"); - ois = new ObjectInputStream(new FileInputStream(sFile)); - pc = (PermissionCollection)ois.readObject(); - System.out.println("1.3.1 collection = " + pc); + try (FileInputStream fis = new FileInputStream(sFile); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("1.3.1 collection = " + pc); - if (pc.implies(mp)) { - System.out.println("JDK 1.3.1 test passed"); - } else { - throw new Exception("JDK 1.3.1 test failed"); + if (pc.implies(mp)) { + System.out.println("JDK 1.3.1 test passed"); + } else { + throw new Exception("JDK 1.3.1 test failed"); + } } // read in a 1.4 BasicPermissionCollection sFile = new File(dir, "PermClass.1.4"); - ois = new ObjectInputStream(new FileInputStream(sFile)); - pc = (PermissionCollection)ois.readObject(); - System.out.println("1.4 collection = " + pc); + try (FileInputStream fis = new FileInputStream(sFile); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("1.4 collection = " + pc); - if (pc.implies(mp)) { - System.out.println("JDK 1.4 test 1 passed"); - } else { - throw new Exception("JDK 1.4 test 1 failed"); + if (pc.implies(mp)) { + System.out.println("JDK 1.4 test 1 passed"); + } else { + throw new Exception("JDK 1.4 test 1 failed"); + } } // write out current BasicPermissionCollection PermissionCollection bpc = mp.newPermissionCollection(); bpc.add(mp); sFile = new File(dir, "PermClass.current"); - ObjectOutputStream oos = new ObjectOutputStream - (new FileOutputStream("PermClass.current")); - oos.writeObject(bpc); - oos.close(); + try (FileOutputStream fos = new FileOutputStream("PermClass.current"); + ObjectOutputStream oos = new ObjectOutputStream(fos)) { + oos.writeObject(bpc); + } // read in current BasicPermissionCollection - ois = new ObjectInputStream(new FileInputStream("PermClass.current")); - pc = (PermissionCollection)ois.readObject(); - System.out.println("current collection = " + pc); + try (FileInputStream fis = new FileInputStream("PermClass.current"); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("current collection = " + pc); - if (pc.implies(mp)) { - System.out.println("JDK 1.4 test 2 passed"); - } else { - throw new Exception("JDK 1.4 test 2 failed"); + if (pc.implies(mp)) { + System.out.println("JDK 1.4 test 2 passed"); + } else { + throw new Exception("JDK 1.4 test 2 failed"); + } } } }
--- a/test/java/security/BasicPermission/SerialVersion.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/BasicPermission/SerialVersion.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4502729 + * @bug 4502729 7054918 * @summary BasicPermissionCollection serial version UID incorrect */ @@ -36,40 +36,44 @@ String dir = System.getProperty("test.src"); File sFile = new File (dir,"SerialVersion.1.2.1"); // read in a 1.2.1 BasicPermissionCollection - ObjectInputStream ois = new ObjectInputStream - (new FileInputStream(sFile)); - PermissionCollection pc = (PermissionCollection)ois.readObject(); - System.out.println("1.2.1 collection = " + pc); + try (FileInputStream fis = new FileInputStream(sFile); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("1.2.1 collection = " + pc); + } // read in a 1.3.1 BasicPermissionCollection sFile = new File (dir,"SerialVersion.1.3.1"); - ois = new ObjectInputStream - (new FileInputStream(sFile)); - pc = (PermissionCollection)ois.readObject(); - System.out.println("1.3.1 collection = " + pc); + try (FileInputStream fis = new FileInputStream(sFile); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("1.3.1 collection = " + pc); + } // read in a 1.4 BasicPermissionCollection sFile = new File (dir,"SerialVersion.1.4"); - ois = new ObjectInputStream - (new FileInputStream(sFile)); - pc = (PermissionCollection)ois.readObject(); - System.out.println("1.4 collection = " + pc); + try (FileInputStream fis = new FileInputStream(sFile); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("1.4 collection = " + pc); + } // write out current BasicPermissionCollection MyPermission mp = new MyPermission("SerialVersionTest"); PermissionCollection bpc = mp.newPermissionCollection(); sFile = new File (dir,"SerialVersion.current"); - ObjectOutputStream oos = new ObjectOutputStream - (new FileOutputStream("SerialVersion.current")); - oos.writeObject(bpc); - oos.close(); + try (FileOutputStream fos = new FileOutputStream("SerialVersion.current"); + ObjectOutputStream oos = new ObjectOutputStream(fos)) { + oos.writeObject(bpc); + } // read in current BasicPermissionCollection - ois = new ObjectInputStream - (new FileInputStream("SerialVersion.current")); - pc = (PermissionCollection)ois.readObject(); - System.out.println("current collection = " + pc); + try (FileInputStream fis = new FileInputStream("SerialVersion.current"); + ObjectInputStream ois = new ObjectInputStream(fis)) { + PermissionCollection pc = (PermissionCollection)ois.readObject(); + System.out.println("current collection = " + pc); + } } }
--- a/test/java/security/KeyFactory/Failover.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/KeyFactory/Failover.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /** * @test - * @bug 4894125 + * @bug 4894125 7054918 + * @library ../testlibrary * @summary test that failover for KeyFactory works * @author Andreas Sterbenz */ @@ -37,6 +38,15 @@ public class Failover { public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { Security.insertProviderAt(new ProviderFail(), 1); Security.addProvider(new ProviderPass()); System.out.println(Arrays.asList(Security.getProviders()));
--- a/test/java/security/KeyPairGenerator/Failover.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/KeyPairGenerator/Failover.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /** * @test - * @bug 4894125 + * @bug 4894125 7054918 + * @library ../testlibrary * @summary test that failover for KeyPairGenerator works * @author Andreas Sterbenz */ @@ -37,6 +38,15 @@ public class Failover { public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { Security.insertProviderAt(new ProviderFail(), 1); Security.addProvider(new ProviderPass()); System.out.println(Arrays.asList(Security.getProviders()));
--- a/test/java/security/Provider/ChangeProviders.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Provider/ChangeProviders.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 4856968 + * @bug 4856968 7054918 + * @library ../testlibrary * @summary make sure add/insert/removeProvider() work correctly * @author Andreas Sterbenz */ @@ -43,6 +44,15 @@ } public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { long start = System.currentTimeMillis(); Provider p = new ChangeProviders();
--- a/test/java/security/Provider/GetInstance.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Provider/GetInstance.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 4856968 + * @bug 4856968 7054918 + * @library ../testlibrary * @summary make sure getInstance() works correctly, including failover * and delayed provider selection for Signatures * @author Andreas Sterbenz @@ -43,6 +44,15 @@ } public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { long start = System.currentTimeMillis(); Provider foo = new FooProvider();
--- a/test/java/security/Provider/RemoveProvider.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Provider/RemoveProvider.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 4190873 + * @bug 4190873 7054918 + * @library ../testlibrary * @summary Make sure provider instance can be removed from list of registered * providers, and "entrySet", "keySet", and "values" methods don't loop * indefinitely. @@ -34,6 +35,15 @@ public class RemoveProvider { public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { // Add provider 1 Provider p1 = new MyProvider("name1",1,"");
--- a/test/java/security/Provider/Turkish.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Provider/Turkish.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,8 @@ /** * @test - * @bug 6220064 + * @bug 6220064 7054918 * @summary make sure everything works ok in the Turkish local (dotted/dotless i problem) - * @run main/othervm Turkish * @author Andreas Sterbenz */ @@ -41,54 +40,59 @@ Provider p1 = new TProvider("T1"); System.out.println(p1.getServices()); // trigger service parsing - Locale.setDefault(new Locale("tr", "TR")); + Locale loc = Locale.getDefault(); + try { + Locale.setDefault(new Locale("tr", "TR")); - Provider p2 = new TProvider("T2"); - System.out.println(p2.getServices()); // trigger service parsing + Provider p2 = new TProvider("T2"); + System.out.println(p2.getServices()); // trigger service parsing - System.out.println(Signature.getInstance("MD5withRSA")); - System.out.println(Signature.getInstance("md5withrsa")); - System.out.println(Signature.getInstance("MD5WITHRSA")); - Service s1, s2; - s1 = p1.getService("Signature", "MD5withRSA"); - check(s1, null); - check(s1, p1.getService("Signature", "md5withrsa")); - check(s1, p1.getService("Signature", "MD5WITHRSA")); - check(s1, p1.getService("Signature", "MD5RSA")); - check(s1, p1.getService("Signature", "md5rsa")); - check(s1, p1.getService("Signature", "MD5rsa")); + System.out.println(Signature.getInstance("MD5withRSA")); + System.out.println(Signature.getInstance("md5withrsa")); + System.out.println(Signature.getInstance("MD5WITHRSA")); + Service s1, s2; + s1 = p1.getService("Signature", "MD5withRSA"); + check(s1, null); + check(s1, p1.getService("Signature", "md5withrsa")); + check(s1, p1.getService("Signature", "MD5WITHRSA")); + check(s1, p1.getService("Signature", "MD5RSA")); + check(s1, p1.getService("Signature", "md5rsa")); + check(s1, p1.getService("Signature", "MD5rsa")); - s1 = p1.getService("Signature", "SHAwithRSA"); - check(s1, null); - check(s1, p1.getService("Signature", "shawithrsa")); - check(s1, p1.getService("Signature", "SHAWITHRSA")); - check(s1, p1.getService("Signature", "SHARSA")); - check(s1, p1.getService("Signature", "sharsa")); - check(s1, p1.getService("Signature", "SHArsa")); - check(s1, p1.getService("Signature", "SHA1RSA")); - check(s1, p1.getService("Signature", "sha1rsa")); - check(s1, p1.getService("Signature", "SHA1rsa")); + s1 = p1.getService("Signature", "SHAwithRSA"); + check(s1, null); + check(s1, p1.getService("Signature", "shawithrsa")); + check(s1, p1.getService("Signature", "SHAWITHRSA")); + check(s1, p1.getService("Signature", "SHARSA")); + check(s1, p1.getService("Signature", "sharsa")); + check(s1, p1.getService("Signature", "SHArsa")); + check(s1, p1.getService("Signature", "SHA1RSA")); + check(s1, p1.getService("Signature", "sha1rsa")); + check(s1, p1.getService("Signature", "SHA1rsa")); - s1 = p2.getService("Signature", "MD5withRSA"); - check(s1, null); - check(s1, p2.getService("Signature", "md5withrsa")); - check(s1, p2.getService("Signature", "MD5WITHRSA")); - check(s1, p2.getService("Signature", "MD5RSA")); - check(s1, p2.getService("Signature", "md5rsa")); - check(s1, p2.getService("Signature", "MD5rsa")); + s1 = p2.getService("Signature", "MD5withRSA"); + check(s1, null); + check(s1, p2.getService("Signature", "md5withrsa")); + check(s1, p2.getService("Signature", "MD5WITHRSA")); + check(s1, p2.getService("Signature", "MD5RSA")); + check(s1, p2.getService("Signature", "md5rsa")); + check(s1, p2.getService("Signature", "MD5rsa")); - s1 = p2.getService("Signature", "SHAwithRSA"); - check(s1, null); - check(s1, p2.getService("Signature", "shawithrsa")); - check(s1, p2.getService("Signature", "SHAWITHRSA")); - check(s1, p2.getService("Signature", "SHARSA")); - check(s1, p2.getService("Signature", "sharsa")); - check(s1, p2.getService("Signature", "SHArsa")); - check(s1, p2.getService("Signature", "SHA1RSA")); - check(s1, p2.getService("Signature", "sha1rsa")); - check(s1, p2.getService("Signature", "SHA1rsa")); + s1 = p2.getService("Signature", "SHAwithRSA"); + check(s1, null); + check(s1, p2.getService("Signature", "shawithrsa")); + check(s1, p2.getService("Signature", "SHAWITHRSA")); + check(s1, p2.getService("Signature", "SHARSA")); + check(s1, p2.getService("Signature", "sharsa")); + check(s1, p2.getService("Signature", "SHArsa")); + check(s1, p2.getService("Signature", "SHA1RSA")); + check(s1, p2.getService("Signature", "sha1rsa")); + check(s1, p2.getService("Signature", "SHA1rsa")); - System.out.println("OK"); + System.out.println("OK"); + } finally { + Locale.setDefault(loc); + } } private static void check(Service s1, Service s2) throws Exception {
--- a/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh Fri Jun 21 15:46:14 2013 -0500 @@ -89,6 +89,7 @@ # run the test ${TESTJAVA}${FILESEP}bin${FILESEP}java \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \ + -Djava.awt.headless=true \ ClassLoaderDeadlock STATUS=$?
--- a/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -58,6 +58,10 @@ PATHSEP=":" FILESEP="/" ;; + CYGWIN* ) + PATHSEP=";" + FILESEP="/" + ;; Darwin ) PATHSEP=":" FILESEP="/"
--- a/test/java/security/Security/NoInstalledProviders.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Security/NoInstalledProviders.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 4273454 7052537 + * @bug 4273454 7054918 7052537 + * @library ../testlibrary * @summary Make sure getProviders(filter) doesn't throw NPE * @run main/othervm NoInstalledProviders */ @@ -32,7 +33,16 @@ public class NoInstalledProviders { - public static void main(String[] argv) { + public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { Provider[] provs = Security.getProviders(); // make sure there are no providers in the system
--- a/test/java/security/Security/SynchronizedAccess.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Security/SynchronizedAccess.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 4162583 + * @bug 4162583 7054918 + * @library ../testlibrary * @summary Make sure Provider api implementations are synchronized properly */ @@ -31,7 +32,16 @@ public class SynchronizedAccess { - public static void main(String[] args) { + public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { AccessorThread[] acc = new AccessorThread[200]; for (int i=0; i < acc.length; i++) acc[i] = new AccessorThread("thread"+i);
--- a/test/java/security/Security/removing/RemoveProviders.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/Security/removing/RemoveProviders.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /** * @test - * @bug 4963416 + * @bug 4963416 7054918 + * @library ../../testlibrary * @summary make sure removeProvider() always works correctly * @author Andreas Sterbenz */ @@ -35,6 +36,15 @@ public class RemoveProviders { public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { Provider[] providers = Security.getProviders(); System.out.println("Providers: " + Arrays.asList(providers));
--- a/test/java/security/UnresolvedPermission/Equals.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/UnresolvedPermission/Equals.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 4513737 + * @run main/othervm Equals * @summary UnresolvedPermission.equals() throws NullPointerException */
--- a/test/java/security/spec/EllipticCurveMatch.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/security/spec/EllipticCurveMatch.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,12 @@ * @test * @bug 6738532 * @summary Check EllipticCurve.equals() does not compare seed value of curve. - * @run main/othervm EllipticCurveMatch * @author Mike StJohns */ import java.security.spec.*; import java.math.BigInteger; -import java.security.SecureRandom; +import java.util.Random; public class EllipticCurveMatch { static String primeP256 = @@ -45,7 +44,7 @@ private static EllipticCurve addSeedToCurve(EllipticCurve curve) { - SecureRandom rand = new SecureRandom(); + Random rand = new Random(); byte[] seed = new byte[12]; rand.nextBytes(seed);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/security/testlibrary/Providers.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.Provider; +import java.security.Security; + +public class Providers { + public static void setAt(Provider p, int pos) throws Exception { + if (Security.getProvider(p.getName()) != null) { + Security.removeProvider(p.getName()); + } + if (Security.insertProviderAt(p, pos) == -1) { + throw new Exception("cannot setAt"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/security/testlibrary/ProvidersSnapshot.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.Provider; +import java.security.Security; + +public class ProvidersSnapshot { + + private Provider[] oldProviders; + + private ProvidersSnapshot() { + oldProviders = Security.getProviders(); + } + + public static ProvidersSnapshot create() { + return new ProvidersSnapshot(); + } + + public void restore() { + Provider[] newProviders = Security.getProviders(); + for (Provider p: newProviders) { + Security.removeProvider(p.getName()); + } + for (Provider p: oldProviders) { + Security.addProvider(p); + } + } +}
--- a/test/java/util/Timer/KillThread.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/util/Timer/KillThread.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,20 +32,25 @@ public class KillThread { public static void main (String[] args) throws Exception { + final Thread[] tdThread = new Thread[1]; Timer t = new Timer(); // Start a mean event that kills the timer thread t.schedule(new TimerTask() { public void run() { + tdThread[0] = Thread.currentThread(); throw new ThreadDeath(); } }, 0); // Wait for mean event to do the deed and thread to die. try { - Thread.sleep(100); + do { + Thread.sleep(100); + } while(tdThread[0] == null); } catch(InterruptedException e) { } + tdThread[0].join(); // Try to start another event try {
--- a/test/java/util/concurrent/FutureTask/BlockingTaskExecutor.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/util/concurrent/FutureTask/BlockingTaskExecutor.java Fri Jun 21 15:46:14 2013 -0500 @@ -75,10 +75,10 @@ throw new Error("Executor stuck"); // Wait for the invocation thread to complete. - thread.join(1000); + thread.join(5000); if (thread.isAlive()) { thread.interrupt(); - thread.join(1000); + thread.join(5000); throw new Error("invokeAll stuck"); } }
--- a/test/java/util/concurrent/Phaser/Basic.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/util/concurrent/Phaser/Basic.java Fri Jun 21 15:46:14 2013 -0500 @@ -96,7 +96,7 @@ int phase = atTheStartingGate.getPhase(); equal(phase, atTheStartingGate.arrive()); int awaitPhase = atTheStartingGate.awaitAdvanceInterruptibly - (phase, 10, SECONDS); + (phase, 30, SECONDS); if (expectNextPhase) check(awaitPhase == (phase + 1)); pass(); @@ -188,7 +188,7 @@ case 2: case 6: case 7: return awaiter(phaser, -1, SECONDS); default: - return awaiter(phaser, 10, SECONDS); }} + return awaiter(phaser, 30, SECONDS); }} public void remove() {throw new UnsupportedOperationException();}}; } @@ -204,7 +204,7 @@ case 2: case 5: return awaiter(phaser, -1, SECONDS); default: - return awaiter(phaser, 10, SECONDS); }} + return awaiter(phaser, 30, SECONDS); }} public void remove() {throw new UnsupportedOperationException();}}; } @@ -251,9 +251,11 @@ int phase = phaser.getPhase(); for (int i = 0; i < 4; i++) { check(phaser.getPhase() == phase); - Awaiter a1 = awaiter(phaser, 10, SECONDS); a1.start(); + Awaiter a1 = awaiter(phaser, 30, SECONDS); a1.start(); Arriver a2 = arrivers.next(); a2.start(); toTheStartingGate(); + // allow a1 to block in awaitAdvanceInterruptibly + Thread.sleep(2000); a1.interrupt(); a1.join(); phaser.arriveAndAwaitAdvance();
--- a/test/java/util/concurrent/ThreadPoolExecutor/Custom.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/util/concurrent/ThreadPoolExecutor/Custom.java Fri Jun 21 15:46:14 2013 -0500 @@ -100,8 +100,8 @@ equal(countExecutorThreads(), threadCount); equal(CustomTask.births.get(), threadCount); tpe.shutdown(); - tpe.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); - Thread.sleep(10); + tpe.awaitTermination(120, TimeUnit.SECONDS); + Thread.sleep(1000); equal(countExecutorThreads(), 0); CustomSTPE stpe = new CustomSTPE(); @@ -110,8 +110,8 @@ equal(CustomSTPE.decorations.get(), threadCount); equal(countExecutorThreads(), threadCount); stpe.shutdown(); - stpe.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); - Thread.sleep(10); + stpe.awaitTermination(120, TimeUnit.SECONDS); + Thread.sleep(1000); equal(countExecutorThreads(), 0); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
--- a/test/java/util/concurrent/locks/Lock/FlakyMutex.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/java/util/concurrent/locks/Lock/FlakyMutex.java Fri Jun 21 15:46:14 2013 -0500 @@ -86,7 +86,7 @@ } catch (Throwable t) { unexpected(t); }}});} barrier.await(); es.shutdown(); - check(es.awaitTermination(10, TimeUnit.SECONDS)); + check(es.awaitTermination(30, TimeUnit.SECONDS)); } private static class FlakySync extends AbstractQueuedLongSynchronizer {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/DrainFindDeadlockTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.lang.management.ThreadInfo; +import java.lang.management.ThreadMXBean; +import java.lang.Thread.State; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.util.logging.LogManager; +import java.util.logging.Logger; +import java.util.Map; + +/** + * @test + * @bug 8010939 + * @summary check for deadlock between findLogger() and drainLoggerRefQueueBounded() + * @author jim.gish@oracle.com + * @build DrainFindDeadlockTest + * @run main/othervm/timeout=10 DrainFindDeadlockTest + */ + +/** + * This test is checking for a deadlock between + * LogManager$LoggerContext.findLogger() and + * LogManager.drainLoggerRefQueueBounded() (which could happen by calling + * Logger.getLogger() and LogManager.readConfiguration() in different threads) + */ +public class DrainFindDeadlockTest { + private LogManager mgr = LogManager.getLogManager(); + private final static int MAX_ITERATIONS = 100; + + // Get a ThreadMXBean so we can check for deadlock. N.B. this may + // not be supported on all platforms, which means we will have to + // resort to the traditional test timeout method. However, if + // we have the support we'll get the deadlock details if one + // is detected. + private final static ThreadMXBean threadMXBean = + ManagementFactory.getThreadMXBean(); + private final boolean threadMXBeanDeadlockSupported = + threadMXBean.isSynchronizerUsageSupported(); + + public static void main(String... args) throws IOException, Exception { + new DrainFindDeadlockTest().testForDeadlock(); + } + + public static void randomDelay() { + int runs = (int) Math.random() * 1000000; + int c = 0; + + for (int i=0; i<runs; ++i) { + c=c+i; + } + } + + public void testForDeadlock() throws IOException, Exception { + System.out.println("Deadlock detection " + + (threadMXBeanDeadlockSupported ? "is" : "is not") + + " available."); + Thread setup = new Thread(new SetupLogger(), "SetupLogger"); + Thread readConfig = new Thread(new ReadConfig(), "ReadConfig"); + Thread check = new Thread(new DeadlockChecker(setup, readConfig), + "DeadlockChecker"); + + // make the threads daemon threads so they will go away when the + // test exits + setup.setDaemon(true); + readConfig.setDaemon(true); + check.setDaemon(true); + + check.start(); setup.start(); readConfig.start(); + try { + check.join(); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + try { + readConfig.join(); + setup.join(); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + System.out.println("Test passed"); + } + + class SetupLogger implements Runnable { + Logger logger = null; + + @Override + public void run() { + System.out.println("Running " + Thread.currentThread().getName()); + + for (int i=0; i < MAX_ITERATIONS; i++) { + logger = Logger.getLogger("DrainFindDeadlockTest"+i); + DrainFindDeadlockTest.randomDelay(); + } + } + } + + class ReadConfig implements Runnable { + @Override + public void run() { + System.out.println("Running " + Thread.currentThread().getName()); + for (int i=0; i < MAX_ITERATIONS; i++) { + try { + mgr.readConfiguration(); + } catch (IOException | SecurityException ex) { + throw new RuntimeException("FAILED: test setup problem", ex); + } + DrainFindDeadlockTest.randomDelay(); + } + } + } + + class DeadlockChecker implements Runnable { + Thread t1, t2; + + DeadlockChecker(Thread t1, Thread t2) { + this.t1 = t1; + this.t2 = t2; + } + + void checkState(Thread x, Thread y) { + // System.out.println("checkstate"); + boolean isXblocked = x.getState().equals(State.BLOCKED); + boolean isYblocked = y.getState().equals(State.BLOCKED); + long[] deadlockedThreads = null; + + if (isXblocked && isYblocked) { + System.out.println("threads blocked"); + // they are both blocked, but this doesn't necessarily mean + // they are deadlocked + if (threadMXBeanDeadlockSupported) { + System.out.println("checking for deadlock"); + deadlockedThreads = threadMXBean.findDeadlockedThreads(); + } else { + System.out.println("Can't check for deadlock"); + } + if (deadlockedThreads != null) { + System.out.println("We detected a deadlock! "); + ThreadInfo[] threadInfos = threadMXBean.getThreadInfo( + deadlockedThreads, true, true); + for (ThreadInfo threadInfo: threadInfos) { + System.out.println(threadInfo); + } + throw new RuntimeException("TEST FAILED: Deadlock detected"); + } + System.out.println("We may have a deadlock"); + Map<Thread, StackTraceElement[]> threadMap = + Thread.getAllStackTraces(); + dumpStack(threadMap.get(x), x); + dumpStack(threadMap.get(y), y); + } + } + + private void dumpStack(StackTraceElement[] aStackElt, Thread aThread) { + if (aStackElt != null) { + System.out.println("Thread:" + aThread.getName() + ": " + + aThread.getState()); + for (StackTraceElement element: aStackElt) { + System.out.println(" " + element); + } + } + } + + @Override + public void run() { + System.out.println("Running " + Thread.currentThread().getName()); + for (int i=0; i < MAX_ITERATIONS*2; i++) { + checkState(t1, t2); + try { + Thread.sleep(10); + } catch (InterruptedException ex) { + }; + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/LogManagerInstanceTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.logging.*; + +/* + * @test + * @bug 8010727 + * @summary LogManager.addLogger should succeed to add a logger named "" + * if LogManager.getLogger("") returns null. + * + * @run main LogManagerInstanceTest + */ + +public class LogManagerInstanceTest { + public static void main(String[] argv) { + LogManager mgr = LogManager.getLogManager(); + if (getRootLogger(mgr) == null) { + throw new RuntimeException("Root logger not exist"); + } + + SecondLogManager mgr2 = new SecondLogManager(); + Logger root = getRootLogger(mgr2); + if (mgr2.base != root) { + throw new RuntimeException(mgr2.base + " is not the root logger"); + } + } + + private static Logger getRootLogger(LogManager mgr) { + Logger l = mgr.getLogger(""); + if (l != null && !l.getName().isEmpty()) { + throw new RuntimeException(l.getName() + " is not an invalid root logger"); + } + return l; + } + + static class SecondLogManager extends LogManager { + final Logger base; + private SecondLogManager() { + Logger root = getLogger(""); + if (root == null) { + root = new BaseLogger("", null); + if (!super.addLogger(root)) + throw new RuntimeException("Fail to addLogger " + root); + } else { + System.out.println("Root logger already exists"); + } + this.base = root; + } + } + static class BaseLogger extends Logger { + BaseLogger(String name, String rbname) { + super(name, rbname); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/ClassPathTestBundle_en.properties Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +sample1=translation #2 for sample1 +sample2=translation #2 for sample2 +supports-test=ResourceBundleSearchTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Paths; +import java.util.logging.Logger; + +/** + * This class is used to ensure that a resource bundle loadable by a classloader + * is on the caller's stack, but not on the classpath or TCCL. It tests that + * Logger.getLogger() can load the bundle via the immediate caller's classloader + * + * @author Jim Gish + */ +public class IndirectlyLoadABundle { + + private final static String rbName = "CallerSearchableResource"; + + public boolean loadAndTest() throws Throwable { + // Make sure we can find it via the URLClassLoader + URLClassLoader yetAnotherResourceCL = new URLClassLoader(getURLs(), null); + if (!testForValidResourceSetup(yetAnotherResourceCL)) { + throw new Exception("Couldn't directly load bundle " + rbName + + " as expected. Test config problem"); + } + // But it shouldn't be available via the system classloader + ClassLoader myCL = this.getClass().getClassLoader(); + if (testForValidResourceSetup(myCL)) { + throw new Exception("Was able to directly load bundle " + rbName + + " from " + myCL + " but shouldn't have been" + + " able to. Test config problem"); + } + + Class<?> loadItUpClazz = Class.forName("LoadItUp1", true, + yetAnotherResourceCL); + ClassLoader actual = loadItUpClazz.getClassLoader(); + if (actual != yetAnotherResourceCL) { + throw new Exception("LoadItUp1 was loaded by an unexpected CL: " + actual); + } + Object loadItUp = loadItUpClazz.newInstance(); + Method testMethod = loadItUpClazz.getMethod("getLogger", String.class, String.class); + try { + return (Logger)testMethod.invoke(loadItUp, "NestedLogger1", rbName) != null; + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + } + + public boolean testGetAnonymousLogger() throws Throwable { + // Test getAnonymousLogger() + URLClassLoader loadItUpCL = new URLClassLoader(getURLs(), null); + Class<?> loadItUpClazz = Class.forName("LoadItUp1", true, loadItUpCL); + ClassLoader actual = loadItUpClazz.getClassLoader(); + if (actual != loadItUpCL) { + throw new Exception("LoadItUp1 was loaded by an unexpected CL: " + + actual); + } + Object loadItUpAnon = loadItUpClazz.newInstance(); + Method testAnonMethod = loadItUpClazz.getMethod("getAnonymousLogger", + String.class); + try { + return (Logger)testAnonMethod.invoke(loadItUpAnon, rbName) != null; + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + } + + + public boolean testGetLoggerGetLoggerWithBundle() throws Throwable { + // test getLogger("NestedLogger2"); followed by + // getLogger("NestedLogger2", rbName) to see if the bundle is found + // + URL[] urls = getURLs(); + if (getLoggerWithNewCL(urls, "NestedLogger2", null)) { + return getLoggerWithNewCL(urls, "NestedLogger2", rbName); + + } else { + throw new Exception("TEST FAILED: first call to getLogger() failed " + + " in IndirectlyLoadABundle." + + "testGetLoggerGetLoggerWithBundle"); + } + } + + private URL[] getURLs() throws MalformedURLException { + // Find out where we are running from so we can setup the URLClassLoader URLs + // test.src and test.classes will be set if running in jtreg, but probably + // not otherwise + String testDir = System.getProperty("test.src", System.getProperty("user.dir")); + String testClassesDir = System.getProperty("test.classes", + System.getProperty("user.dir")); + URL[] urls = new URL[2]; + // Allow for both jtreg and standalone cases here + urls[0] = Paths.get(testDir, "resources").toUri().toURL(); + urls[1] = Paths.get(testClassesDir).toUri().toURL(); + + return urls; + } + + private boolean getLoggerWithNewCL(URL[] urls, String loggerName, + String bundleName) throws Throwable { + Logger result = null;; + // Test getLogger("foo"); getLogger("foo", "rbName"); + // First do the getLogger() call with no bundle name + URLClassLoader getLoggerCL = new URLClassLoader(urls, null); + Class<?> loadItUpClazz1 = Class.forName("LoadItUp1", true, getLoggerCL); + ClassLoader actual = loadItUpClazz1.getClassLoader(); + if (actual != getLoggerCL) { + throw new Exception("LoadItUp1 was loaded by an unexpected CL: " + + actual); + } + Object loadItUp1 = loadItUpClazz1.newInstance(); + if (bundleName != null) { + Method getLoggerMethod = loadItUpClazz1.getMethod("getLogger", + String.class, + String.class); + try { + result = (Logger) getLoggerMethod.invoke(loadItUp1, loggerName, + bundleName); + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + } else { + Method getLoggerMethod = loadItUpClazz1.getMethod("getLogger", + String.class); + try { + result = (Logger) getLoggerMethod.invoke(loadItUp1, loggerName); + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + } + return result != null; + } + + private boolean testForValidResourceSetup(ClassLoader cl) { + // First make sure the test environment is setup properly and the bundle + // actually exists + return ResourceBundleSearchTest.isOnClassPath(rbName, cl); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/LoadItUp1.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.util.logging.Logger; + +/* + * This class is loaded onto the call stack when the getLogger methods are + * called and then the classes classloader can be used to find a bundle in + * the same directory as the class. However, Logger is not allowed + * to find the bundle by looking up the stack for this classloader. + * We verify that this cannot happen. + * + * @author Jim Gish + */ +public class LoadItUp1 { + public Logger getAnonymousLogger(String rbName) throws Exception { + // we should not be able to find the resource in this directory via + // getLogger calls. The only way that would be possible given this setup + // is that if Logger.getLogger searched up the call stack + return Logger.getAnonymousLogger(rbName); + } + + public Logger getLogger(String loggerName) { + return Logger.getLogger(loggerName); + } + + public Logger getLogger(String loggerName,String bundleName) { + return Logger.getLogger(loggerName, bundleName); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/LoadItUp2.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.util.MissingResourceException; +import java.util.logging.Logger; + +/* + * This class is loaded onto the call stack by LoadItUp2Invoker from a separate + * classloader. LoadItUp2Invoker was loaded by a class loader that does have + * access to the bundle, but the class loader used to load this class does not. + * Thus the logging code should not be able to see the resource bundle unless + * it has more than a single level stack crawl, which is not allowed. + * + * @author Jim Gish + */ +public class LoadItUp2 { + + private final static boolean DEBUG = false; + + public Boolean test(String rbName) throws Exception { + // we should not be able to find the resource in this directory via + // getLogger calls. The only way that would be possible given this setup + // is that if Logger.getLogger searched up the call stack + return lookupBundle(rbName); + } + + private boolean lookupBundle(String rbName) { + // See if Logger.getLogger can find the resource in this directory + try { + Logger aLogger = Logger.getLogger("NestedLogger2", rbName); + } catch (MissingResourceException re) { + if (DEBUG) { + System.out.println( + "As expected, LoadItUp2.lookupBundle() did not find the bundle " + + rbName); + } + return false; + } + System.out.println("FAILED: LoadItUp2.lookupBundle() found the bundle " + + rbName + " using a stack search."); + return true; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/LoadItUp2Invoker.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; + +/** + * This class is loaded by a class loader that can see the resource. It creates + * a new classloader for LoadItUp2 which cannot see the resource. So, 2 levels + * up the call chain we have a class/classloader that can see the resource, but + * 1 level up the class/classloader cannot. + * + * @author Jim Gish + */ +public class LoadItUp2Invoker { + private URLClassLoader cl; + private String rbName; + private Object loadItUp2; + private Method testMethod; + + public void setup(URL[] urls, String rbName) throws + ReflectiveOperationException { + this.cl = new URLClassLoader(urls, null); + this.rbName = rbName; + // Using this new classloader, load the actual test class + // which is now two levels removed from the original caller + Class<?> loadItUp2Clazz = Class.forName("LoadItUp2", true , cl); + this.loadItUp2 = loadItUp2Clazz.newInstance(); + this.testMethod = loadItUp2Clazz.getMethod("test", String.class); + } + + public Boolean test() throws Throwable { + try { + return (Boolean) testMethod.invoke(loadItUp2, rbName); + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8010127 8013380 + * @summary Remove the stack search for a resource bundle Logger to use + * @author Jim Gish + * @build ResourceBundleSearchTest IndirectlyLoadABundle LoadItUp1 LoadItUp2 TwiceIndirectlyLoadABundle LoadItUp2Invoker + * @run main/othervm ResourceBundleSearchTest + * @run main/othervm -Djdk.logging.allowStackWalkSearch=true ResourceBundleSearchTest + */ +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.logging.Logger; + +/** + * This class tests various scenarios of loading resource bundles from + * java.util.logging. Since jtreg uses the logging system, it is necessary to + * run these tests using othervm mode to ensure no interference from logging + * initialization by jtreg + */ +public class ResourceBundleSearchTest { + + private final static boolean DEBUG = false; + private final static String LOGGER_PREFIX = "myLogger."; + private static int loggerNum = 0; + private final static String PROP_RB_NAME = "ClassPathTestBundle"; + private final static String TCCL_TEST_BUNDLE = "ContextClassLoaderTestBundle"; + + private static int numPass = 0; + private static int numFail = 0; + private static List<String> msgs = new ArrayList<>(); + + public static void main(String[] args) throws Throwable { + ResourceBundleSearchTest test = new ResourceBundleSearchTest(); + test.runTests(); + } + + private void runTests() throws Throwable { + // ensure we are using en as the default Locale so we can find the resource + Locale.setDefault(Locale.ENGLISH); + + ClassLoader myClassLoader = ClassLoader.getSystemClassLoader(); + + // Find out where we are running from so we can setup the URLClassLoader URL + String userDir = System.getProperty("user.dir"); + String testDir = System.getProperty("test.src", userDir); + + URL[] urls = new URL[1]; + + urls[0] = Paths.get(testDir, "resources").toUri().toURL(); + URLClassLoader rbClassLoader = new URLClassLoader(urls); + + // Test 1 - can we find a Logger bundle from doing a stack search? + // We shouldn't be able to + // unless -Djdk.logging.allowStackWalkSearch=true is set + + boolean allowStackWalkSearch = Boolean.getBoolean("jdk.logging.allowStackWalkSearch"); + if (allowStackWalkSearch) { + assertTrue(testGetBundleFromStackSearch(), "1-testGetBundleFromStackSearch"); + } else { + // default behavior + assertFalse(testGetBundleFromStackSearch(), "1-testGetBundleFromStackSearch"); + } + + // Test 2 - can we find a Logger bundle off of the Thread context class + // loader? We should be able to. + assertTrue(testGetBundleFromTCCL(TCCL_TEST_BUNDLE, rbClassLoader), + "2-testGetBundleFromTCCL"); + + // Test 3 - Can we find a Logger bundle from the classpath? We should be + // able to. We'll first check to make sure the setup is correct and + // it actually is on the classpath before checking whether logging + // can see it there. + if (isOnClassPath(PROP_RB_NAME, myClassLoader)) { + debug("We should be able to see " + PROP_RB_NAME + " on the classpath"); + assertTrue(testGetBundleFromSystemClassLoader(PROP_RB_NAME), + "3-testGetBundleFromSystemClassLoader"); + } else { + throw new Exception("TEST SETUP FAILURE: Cannot see " + PROP_RB_NAME + + " on the classpath"); + } + + // Test 4 - we should be able to find a bundle from the caller's + // classloader, but only one level up. + assertTrue(testGetBundleFromCallersClassLoader(), + "4-testGetBundleFromCallersClassLoader"); + + // Test 5 - this ensures that getAnonymousLogger(String rbName) + // can find the bundle from the caller's classloader + assertTrue(testGetAnonymousLogger(), "5-testGetAnonymousLogger"); + + // Test 6 - first call getLogger("myLogger"). + // Then call getLogger("myLogger","bundleName") from a different ClassLoader + // Make sure we find the bundle + if (!allowStackWalkSearch) { + assertTrue(testGetBundleFromSecondCallersClassLoader(), + "6-testGetBundleFromSecondCallersClassLoader"); + } + + report(); + } + + private void report() throws Exception { + System.out.println("Num passed = " + numPass + " Num failed = " + numFail); + if (numFail > 0) { + // We only care about the messages if they were errors + for (String msg : msgs) { + System.out.println(msg); + } + throw new Exception(numFail + " out of " + (numPass + numFail) + + " tests failed."); + } + } + + public void assertTrue(boolean testResult, String testName) { + if (testResult) { + numPass++; + } else { + numFail++; + System.out.println("FAILED: " + testName + + " was supposed to return true but did NOT!"); + } + } + + public void assertFalse(boolean testResult, String testName) { + if (!testResult) { + numPass++; + } else { + numFail++; + System.out.println("FAILED: " + testName + + " was supposed to return false but did NOT!"); + } + } + + public boolean testGetBundleFromStackSearch() throws Throwable { + // This should fail. This was the old functionality to search up the + // caller's call stack + TwiceIndirectlyLoadABundle indirectLoader = new TwiceIndirectlyLoadABundle(); + return indirectLoader.loadAndTest(); + } + + public boolean testGetBundleFromCallersClassLoader() throws Throwable { + // This should pass. This exercises getting the bundle using the + // class loader of the caller (one level up) + IndirectlyLoadABundle indirectLoader = new IndirectlyLoadABundle(); + return indirectLoader.loadAndTest(); + } + + public boolean testGetBundleFromTCCL(String bundleName, + ClassLoader setOnTCCL) throws InterruptedException { + // This should succeed. We should be able to get the bundle from the + // thread context class loader + debug("Looking for " + bundleName + " using TCCL"); + LoggingThread lr = new LoggingThread(bundleName, setOnTCCL); + lr.start(); + synchronized (lr) { + try { + lr.wait(); + } catch (InterruptedException ex) { + throw ex; + } + } + msgs.add(lr.msg); + return lr.foundBundle; + } + + /* + * @param String bundleClass + * @param ClassLoader to use for search + * @return true iff bundleClass is on system classpath + */ + public static boolean isOnClassPath(String baseName, ClassLoader cl) { + ResourceBundle rb = null; + try { + rb = ResourceBundle.getBundle(baseName, Locale.getDefault(), cl); + System.out.println("INFO: Found bundle " + baseName + " on " + cl); + } catch (MissingResourceException e) { + System.out.println("INFO: Could not find bundle " + baseName + " on " + cl); + return false; + } + return (rb != null); + } + + private static String newLoggerName() { + // we need a new logger name every time we attempt to find a bundle via + // the Logger.getLogger call, so we'll simply tack on an integer which + // we increment each time this is called + loggerNum++; + return LOGGER_PREFIX + loggerNum; + } + + public boolean testGetBundleFromSystemClassLoader(String bundleName) { + // this should succeed if the bundle is on the system classpath. + try { + Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(), + bundleName); + } catch (MissingResourceException re) { + msgs.add("INFO: testGetBundleFromSystemClassLoader() did not find bundle " + + bundleName); + return false; + } + msgs.add("INFO: testGetBundleFromSystemClassLoader() found the bundle " + + bundleName); + return true; + } + + private boolean testGetAnonymousLogger() throws Throwable { + // This should pass. This exercises getting the bundle using the + // class loader of the caller (one level up) when calling + // Logger.getAnonymousLogger(String rbName) + IndirectlyLoadABundle indirectLoader = new IndirectlyLoadABundle(); + return indirectLoader.testGetAnonymousLogger(); + } + + private boolean testGetBundleFromSecondCallersClassLoader() throws Throwable { + // This should pass. This exercises getting the bundle using the + // class loader of the caller (one level up) + IndirectlyLoadABundle indirectLoader = new IndirectlyLoadABundle(); + return indirectLoader.testGetLoggerGetLoggerWithBundle(); + } + + public static class LoggingThread extends Thread { + + boolean foundBundle = false; + String msg = null; + ClassLoader clToSetOnTCCL = null; + String bundleName = null; + + public LoggingThread(String bundleName) { + this.bundleName = bundleName; + } + + public LoggingThread(String bundleName, ClassLoader setOnTCCL) { + this.clToSetOnTCCL = setOnTCCL; + this.bundleName = bundleName; + } + + public void run() { + boolean setTCCL = false; + try { + if (clToSetOnTCCL != null) { + Thread.currentThread().setContextClassLoader(clToSetOnTCCL); + setTCCL = true; + } + // this should succeed if the bundle is on the system classpath. + try { + Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(), + bundleName); + msg = "INFO: LoggingThread.run() found the bundle " + bundleName + + (setTCCL ? " with " : " without ") + "setting the TCCL"; + foundBundle = true; + } catch (MissingResourceException re) { + msg = "INFO: LoggingThread.run() did not find the bundle " + bundleName + + (setTCCL ? " with " : " without ") + "setting the TCCL"; + foundBundle = false; + } + } catch (Throwable e) { + e.printStackTrace(); + System.exit(1); + } + } + } + + private void debug(String msg) { + if (DEBUG) { + System.out.println(msg); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/TwiceIndirectlyLoadABundle.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Paths; + +/** + * This class constructs a scenario where a bundle is accessible on the call + * stack two levels up from the call to getLogger(), but not on the immediate + * caller. This tests that getLogger() isn't doing a stack crawl more than one + * level up to find a bundle. + * + * @author Jim Gish + */ +public class TwiceIndirectlyLoadABundle { + + private final static String rbName = "StackSearchableResource"; + + public boolean loadAndTest() throws Throwable { + // Find out where we are running from so we can setup the URLClassLoader URLs + // test.src and test.classes will be set if running in jtreg, but probably + // not otherwise + String testDir = System.getProperty("test.src", System.getProperty("user.dir")); + String testClassesDir = System.getProperty("test.classes", + System.getProperty("user.dir")); + URL[] urls = new URL[2]; + + // Allow for both jtreg and standalone cases here + // Unlike the 1-level test where we can get the bundle from the caller's + // class loader, for this one we don't want to expose the resource directory + // to the next class. That way we're invoking the LoadItUp2Invoker class + // from this class that does have access to the resources (two levels + // up the call stack), but the Invoker itself won't have access to resource + urls[0] = Paths.get(testDir,"resources").toUri().toURL(); + urls[1] = Paths.get(testClassesDir).toUri().toURL(); + + // Make sure we can find it via the URLClassLoader + URLClassLoader yetAnotherResourceCL = new URLClassLoader(urls, null); + Class<?> loadItUp2InvokerClazz = Class.forName("LoadItUp2Invoker", true, + yetAnotherResourceCL); + ClassLoader actual = loadItUp2InvokerClazz.getClassLoader(); + if (actual != yetAnotherResourceCL) { + throw new Exception("LoadItUp2Invoker was loaded by an unexpected CL: " + + actual); + } + Object loadItUp2Invoker = loadItUp2InvokerClazz.newInstance(); + + Method setupMethod = loadItUp2InvokerClazz.getMethod("setup", + urls.getClass(), String.class); + try { + // For the next class loader we create, we want to leave off + // the resources. That way loadItUp2Invoker will have access to + // them, but the next class won't. + URL[] noResourceUrl = new URL[1]; + noResourceUrl[0] = urls[1]; // from above -- just the test classes + setupMethod.invoke(loadItUp2Invoker, noResourceUrl, rbName); + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + + Method testMethod = loadItUp2InvokerClazz.getMethod("test"); + try { + return (Boolean) testMethod.invoke(loadItUp2Invoker); + } catch (InvocationTargetException ex) { + throw ex.getTargetException(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/resources/CallerSearchableResource_en.properties Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +sample1=translation #4 for sample1 +sample2=translation #4 for sample2 +supports-test=ResourceBundleSearchTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/resources/ContextClassLoaderTestBundle_en.properties Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +sample1=translation #3 for sample1 +sample2=translation #3 for sample2 +supports-test=ResourceBundleSearchTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/bundlesearch/resources/StackSearchableResource_en.properties Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +sample1=translation #4 for sample1 +sample2=translation #4 for sample2 +supports-test=ResourceBundleSearchTest
--- a/test/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /** * @test - * @bug 4508341 + * @bug 4508341 7055362 + * @library ../../../java/security/testlibrary * @summary Test the error conditions of * EncryptedPrivateKeyInfo.getKeySpec(...) methods. * @author Valerie Peng @@ -97,7 +98,16 @@ } } - public static void main(String[] argv) throws Exception { + public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { if ((GOOD_PARAMS == null) || (BAD_PARAMS == null)) { throw new Exception("Static parameter generation failed"); }
--- a/test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @bug 6377058 + * @bug 6377058 7055362 + * @library ../../../java/security/testlibrary * @summary SunJCE depends on sun.security.provider.SignatureImpl * behaviour, BC can't load into 1st slot. * @author Brad R. Wetmore @@ -35,7 +36,16 @@ public class SunJCE_BC_LoadOrdering { - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { /* * Generate a random key, and encrypt the data */
--- a/test/javax/imageio/stream/StreamCloserLeak/run_test.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/imageio/stream/StreamCloserLeak/run_test.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,6 +1,6 @@ #!/bin/ksh -p # -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -78,28 +78,44 @@ case "$OS" in SunOS ) VAR="One value for Sun" - DEFAULT_JDK=/usr/local/java/jdk1.2/solaris + DEFAULT_JDK=/ + FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + + Linux ) + VAR="A different value for Linux" + DEFAULT_JDK=/ FILESEP="/" PATHSEP=":" TMP="/tmp" ;; - Linux | Darwin ) - VAR="A different value for Linux" - DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 + Darwin ) + VAR="A different value for MacOSX" + DEFAULT_JDK=/usr FILESEP="/" PATHSEP=":" TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN* ) + Windows* ) VAR="A different value for Win32" - DEFAULT_JDK=/usr/local/java/jdk1.2/win32 + DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" FILESEP="\\" PATHSEP=";" TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; + CYGWIN* ) + VAR="A different value for Cygwin" + DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" + FILESEP="/" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` + ;; + # catch all other OSs * ) echo "Unrecognized system! $OS"
--- a/test/javax/rmi/ssl/SocketFactoryTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/rmi/ssl/SocketFactoryTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -26,8 +26,7 @@ * @bug 4932837 6582235 * @summary Test SslRMI[Client|Server]SocketFactory equals() and hashCode(). * @author Daniel Fuchs - * @run clean SocketFactoryTest - * @run build SocketFactoryTest + * * @run main SocketFactoryTest */
--- a/test/javax/security/auth/login/LoginContext/ResetConfigModule.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/security/auth/login/LoginContext/ResetConfigModule.java Fri Jun 21 15:46:14 2013 -0500 @@ -25,7 +25,6 @@ * @test * @bug 4633622 * @summary bug in LoginContext when Configuration is subclassed - * * @build ResetConfigModule ResetModule * @run main ResetConfigModule */ @@ -40,32 +39,42 @@ public static void main(String[] args) throws Exception { - Configuration.setConfiguration(new MyConfig()); + Configuration previousConf = Configuration.getConfiguration(); + ClassLoader previousCL = Thread.currentThread().getContextClassLoader(); - LoginContext lc = new LoginContext("test"); try { - lc.login(); - throw new SecurityException("test 1 failed"); - } catch (LoginException le) { - if (le.getCause() != null && - le.getCause() instanceof SecurityException) { - System.out.println("good so far"); - } else { - throw le; + Thread.currentThread().setContextClassLoader( + ResetConfigModule.class.getClassLoader()); + Configuration.setConfiguration(new MyConfig()); + + LoginContext lc = new LoginContext("test"); + try { + lc.login(); + throw new SecurityException("test 1 failed"); + } catch (LoginException le) { + if (le.getCause() != null && + le.getCause() instanceof SecurityException) { + System.out.println("good so far"); + } else { + throw le; + } } - } - LoginContext lc2 = new LoginContext("test2"); - try { - lc2.login(); - throw new SecurityException("test 2 failed"); - } catch (LoginException le) { - if (le.getCause() != null && - le.getCause() instanceof SecurityException) { - System.out.println("test succeeded"); - } else { - throw le; + LoginContext lc2 = new LoginContext("test2"); + try { + lc2.login(); + throw new SecurityException("test 2 failed"); + } catch (LoginException le) { + if (le.getCause() != null && + le.getCause() instanceof SecurityException) { + System.out.println("test succeeded"); + } else { + throw le; + } } + } finally { + Configuration.setConfiguration(previousConf); + Thread.currentThread().setContextClassLoader(previousCL); } } }
--- a/test/javax/swing/AncestorNotifier/7193219/bug7193219.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/swing/AncestorNotifier/7193219/bug7193219.java Fri Jun 21 15:46:14 2013 -0500 @@ -30,6 +30,7 @@ import java.io.*; import javax.swing.*; +import javax.swing.plaf.metal.*; public class bug7193219 { private static byte[] serializeGUI() { @@ -73,6 +74,7 @@ } public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new MetalLookAndFeel()); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JColorChooser/Test6827032.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6827032 + * @summary Color chooser with drag enabled shouldn't throw NPE + * @author Peter Zhelezniakov + * @library ../regtesthelpers + */ + +import sun.awt.SunToolkit; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; +import javax.swing.plaf.nimbus.NimbusLookAndFeel; + + +public class Test6827032 { + + private static volatile Point point; + private static JColorChooser cc; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new NimbusLookAndFeel()); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel"); + point = previewPanel.getLocationOnScreen(); + } + }); + + point.translate(5, 5); + + robot.mouseMove(point.x, point.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + } + + + private static void createAndShowGUI() { + JFrame frame = new JFrame(Test6827032.class.getName()); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + cc = new JColorChooser(); + cc.setDragEnabled(true); + frame.add(cc); + frame.pack(); + frame.setVisible(true); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 8006417 + @summary JComboBox.showPopup(), hidePopup() fails in JRE 1.7 on OS X + @author Anton Litvinov +*/ + +import java.awt.*; + +import javax.swing.*; +import javax.swing.plaf.metal.*; + +import sun.awt.SunToolkit; + +public class ShowPopupAfterHidePopupTest { + private static JFrame frame = null; + private static JComboBox comboBox = null; + private static boolean popupIsVisible = false; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new MetalLookAndFeel()); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("Popup Menu of JComboBox"); + comboBox = new JComboBox(new String[]{"Item1", "Item2", "Item3"}); + frame.getContentPane().add(comboBox); + frame.pack(); + frame.setVisible(true); + } + }); + final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + comboBox.showPopup(); + comboBox.hidePopup(); + comboBox.showPopup(); + } + }); + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + popupIsVisible = comboBox.isPopupVisible(); + frame.dispose(); + } + }); + if (!popupIsVisible) { + throw new RuntimeException("Calling hidePopup() affected the next call to showPopup()."); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JFrame/4962534/bug4962534.html Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,43 @@ +<html> +<!-- + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. + --> + +<!-- + @test + @bug 4962534 + @summary JFrame dances very badly + @author dav@sparc.spb.su area= + @run applet bug4962534.html + --> +<head> +<title> </title> +</head> +<body> + +<h1>bug4962534<br>Bug ID: 4962534 </h1> + +<p> This is an AUTOMATIC test, simply wait for completion </p> + +<APPLET CODE="bug4962534.class" WIDTH=200 HEIGHT=200></APPLET> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JFrame/4962534/bug4962534.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + test + @bug 4962534 7104594 + @summary JFrame dances very badly + @author dav@sparc.spb.su area= + @run applet bug4962534.html + */ +import java.applet.Applet; +import java.awt.*; +import java.awt.event.*; +import java.util.Random; +import javax.swing.*; +import sun.awt.SunToolkit; + +public class bug4962534 extends Applet { + + Robot robot; + volatile Point framePosition; + volatile Point newFrameLocation; + JFrame frame; + Rectangle gcBounds; + Component titleComponent; + JLayeredPane lPane; + volatile boolean titleFound = false; + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + public static Object LOCK = new Object(); + + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + } catch (Exception ex) { + throw new RuntimeException("Init failed. " + ex.getMessage()); + } + }//End init() + + @Override + public void start() { + validate(); + + try { + setJLayeredPaneEDT(); + setTitleComponentEDT(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Test failed. " + ex.getMessage()); + } + + if (!titleFound) { + throw new RuntimeException("Test Failed. Unable to determine title's size."); + } + + Random r = new Random(); + + for (int iteration = 0; iteration < 10; iteration++) { + try { + setFramePosEDT(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Test failed."); + } + try { + robot = new Robot(); + robot.setAutoDelay(70); + + toolkit.realSync(); + + robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2, + framePosition.y + titleComponent.getHeight() / 2); + robot.mousePress(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + + gcBounds = + GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0].getConfigurations()[0].getBounds(); + + robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2, + framePosition.y + titleComponent.getHeight() / 2); + + toolkit.realSync(); + + int multier = gcBounds.height / 2 - 10; //we will not go out the borders + for (int i = 0; i < 10; i++) { + robot.mouseMove(gcBounds.width / 2 - (int) (r.nextDouble() * multier), gcBounds.height / 2 - (int) (r.nextDouble() * multier)); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + + } catch (AWTException e) { + throw new RuntimeException("Test Failed. AWTException thrown." + e.getMessage()); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test Failed."); + } + System.out.println("Mouse lies in " + MouseInfo.getPointerInfo().getLocation()); + boolean frameIsOutOfScreen = false; + try { + setNewFrameLocationEDT(); + System.out.println("Now Frame lies in " + newFrameLocation); + frameIsOutOfScreen = checkFrameIsOutOfScreenEDT(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Test Failed."); + } + + if (frameIsOutOfScreen) { + throw new RuntimeException("Test failed. JFrame is out of screen."); + } + + } //for iteration + System.out.println("Test passed."); + }// start() + + private void createAndShowGUI() { + try { + UIManager.setLookAndFeel( + "javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception ex) { + throw new RuntimeException(ex.getMessage()); + } + JFrame.setDefaultLookAndFeelDecorated(true); + frame = new JFrame("JFrame Dance Test"); + frame.pack(); + frame.setSize(450, 260); + frame.setVisible(true); + } + + private void setJLayeredPaneEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + lPane = frame.getLayeredPane(); + System.out.println("JFrame's LayeredPane " + lPane); + } + }); + } + + private void setTitleComponentEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + for (int j = 0; j < lPane.getComponentsInLayer(JLayeredPane.FRAME_CONTENT_LAYER.intValue()).length; j++) { + titleComponent = lPane.getComponentsInLayer(JLayeredPane.FRAME_CONTENT_LAYER.intValue())[j]; + if (titleComponent.getClass().getName().equals("javax.swing.plaf.metal.MetalTitlePane")) { + titleFound = true; + break; + } + } + } + }); + } + + private void setFramePosEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + framePosition = frame.getLocationOnScreen(); + } + }); + } + + private boolean checkFrameIsOutOfScreenEDT() throws Exception { + + final boolean[] result = new boolean[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + if (newFrameLocation.x > gcBounds.width || newFrameLocation.x < 0 + || newFrameLocation.y > gcBounds.height || newFrameLocation.y + < 0) { + result[0] = true; + } + } + }); + return result[0]; + } + + private void setNewFrameLocationEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + newFrameLocation = new Point(frame.getLocationOnScreen().x + + frame.getWidth() / 2, frame.getLocationOnScreen().y + titleComponent.getHeight() / 2); + } + }); + } + + private int getJFrameWidthEDT() throws Exception { + + final int[] result = new int[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + result[0] = frame.getWidth(); + } + }); + + return result[0]; + } +}// class
--- a/test/javax/swing/JSlider/4252173/bug4252173.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/swing/JSlider/4252173/bug4252173.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,11 +22,11 @@ */ /* @test - @bug 4252173 - @summary Inability to reuse the HorizontalSliderThumbIcon - @author Pavel Porvatov - @run main bug4252173 -*/ + * @bug 4252173 7077259 + * @summary Inability to reuse the HorizontalSliderThumbIcon + * @author Pavel Porvatov + * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel bug4252173 + */ import javax.swing.*; import javax.swing.plaf.metal.DefaultMetalTheme;
--- a/test/javax/swing/JSpinner/6532833/bug6532833.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/swing/JSpinner/6532833/bug6532833.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -22,10 +22,11 @@ */ /* @test - @bug 6532833 - @summary PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons - @author Pavel Porvatov -*/ + * @bug 6532833 7077259 + * @summary PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons + * @author Pavel Porvatov + * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel bug6532833 + */ import javax.swing.*; import java.awt.*;
--- a/test/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -23,22 +23,21 @@ /* * @test - * @bug 6657026 + * @bug 6657026 7077259 * @summary Tests shared MetalSliderUI in different application contexts * @author Sergey Malenkov + * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel Test6657026 */ -import sun.awt.SunToolkit; - import javax.swing.JSlider; import javax.swing.UIManager; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalSliderUI; +import sun.awt.SunToolkit; public class Test6657026 extends MetalSliderUI implements Runnable { public static void main(String[] args) throws Exception { - UIManager.setLookAndFeel(new MetalLookAndFeel()); JSlider slider = new JSlider(); test(slider);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.html Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,28 @@ +<!-- + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. +--> + +<Html> +<Body> +<APPLET code="bug4506788.class" WIDTH = 600 HEIGHT = 400></APPLET> +</Body> +</Html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 4506788 7147408 + @summary Tests if cursor gets stuck after insertion a character + @author Denis Sharypov + @run applet bug4506788.html + */ +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.InvocationTargetException; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.text.*; +import sun.awt.SunToolkit; + +public class bug4506788 extends JApplet { + + private volatile boolean passed = false; + private JEditorPane jep; + private SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + } catch (InterruptedException | InvocationTargetException ex) { + ex.printStackTrace(); + throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI"); + } + } + + @Override + public void start() { + Robot robot; + try { + robot = new Robot(); + } catch (AWTException e) { + throw new RuntimeException("Robot could not be created"); + } + + toolkit.realSync(); + + Point p; + try { + p = getJEPLocOnScreen(); + } catch (Exception e) { + throw new RuntimeException("Could not get JEditorPane location on screen"); + } + + robot.setAutoDelay(50); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + robot.keyPress(KeyEvent.VK_X); + robot.keyRelease(KeyEvent.VK_X); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + + toolkit.realSync(); + + if (!passed) { + throw new RuntimeException("Test failed."); + } + } + + private Point getJEPLocOnScreen() throws Exception { + + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + result[0] = jep.getLocationOnScreen(); + } + }); + + return result[0]; + } + + private void createAndShowGUI() { + jep = new JEditorPane(); + String text = "abc"; + JFrame f = new JFrame(); + jep.setEditorKit(new StyledEditorKit()); + jep.setText(text); + jep.addCaretListener(new CaretListener() { + @Override + public void caretUpdate(CaretEvent e) { + passed = (e.getDot() == 3); + } + }); + + DefaultStyledDocument doc = (DefaultStyledDocument) jep.getDocument(); + MutableAttributeSet atr = new SimpleAttributeSet(); + StyleConstants.setBold(atr, true); + doc.setCharacterAttributes(1, 1, atr, false); + + f.getContentPane().add(jep); + f.setSize(100, 100); + f.setVisible(true); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/testlibrary/ClassFileInstaller.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +/** + * Dump a class file for a class on the class path in the current directory + */ +public class ClassFileInstaller { + /** + * @param args The names of the classes to dump + * @throws Exception + */ + public static void main(String... args) throws Exception { + for (String arg : args) { + ClassLoader cl = ClassFileInstaller.class.getClassLoader(); + + // Convert dotted class name to a path to a class file + String pathName = arg.replace('.', '/').concat(".class"); + InputStream is = cl.getResourceAsStream(pathName); + + // Create the class file's package directory + Path p = Paths.get(pathName); + Files.createDirectories(p.getParent()); + // Create the class file + Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/awt/AppContext/8012933/Test8012933.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8012933 + * @summary Tests (although somewhat indirectly) that createNewAppContext() + * immediately followed by dispose() works correctly + * @author Leonid Romanov + */ + +import sun.awt.SunToolkit; +import sun.awt.AppContext; + +public class Test8012933 { + private AppContext appContext = null; + final ThreadGroup threadGroup = new ThreadGroup("test thread group"); + final Object lock = new Object(); + boolean isCreated = false; + + public static void main(String[] args) throws Exception { + SunToolkit.createNewAppContext(); + new Test8012933().test(); + } + + private void test() throws Exception { + createAppContext(); + long startTime = System.currentTimeMillis(); + appContext.dispose(); + long endTime = System.currentTimeMillis(); + + // In case of the bug, calling dispose() when there is no EQ + // dispatch thread running fails to create it, so it takes + // almost 10 sec to return from dispose(), which is spent + // waiting on the notificationLock. + if ((endTime - startTime) > 9000) { + throw new RuntimeException("Returning from dispose() took too much time, probably a bug"); + } + } + + private void createAppContext() { + isCreated = false; + final Runnable runnable = new Runnable() { + public void run() { + appContext = SunToolkit.createNewAppContext(); + synchronized (lock) { + isCreated = true; + lock.notifyAll(); + } + } + }; + + final Thread thread = new Thread(threadGroup, runnable, "creates app context"); + synchronized (lock) { + thread.start(); + while (!isCreated) { + try { + lock.wait(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + } + + if (appContext == null) { + throw new RuntimeException("failed to create app context."); + } else { + System.out.println("app context was created."); + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/java2d/OpenGL/CustomCompositeTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7124347 + * @summary Verifies that rendering with XOR composite, and arbitraty + * custom composite doesn not cause internal errors. + * + * @run main/othervm -Dsun.java2d.opengl=True CustomCompositeTest + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.Composite; +import java.awt.CompositeContext; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.ImageCapabilities; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.DataBufferInt; +import java.awt.image.Raster; +import java.awt.image.SinglePixelPackedSampleModel; +import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; +import java.util.concurrent.CountDownLatch; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class CustomCompositeTest { + + private static JFrame frame; + private static CountDownLatch paintLatch; + private static Throwable paintError; + + public static void main(String[] args) { + + paintLatch = new CountDownLatch(1); + paintError = null; + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + initGUI(); + } + }); + + try { + paintLatch.await(); + } catch (InterruptedException e) { + }; + System.out.println("Paint is done!"); + if (paintError != null) { + frame.dispose(); + throw new RuntimeException("Test FAILED.", paintError); + } + + System.out.println("Phase 1: PASSED."); + + // now resise the frame in order to cause re-paint with accelerated + // source images. + paintError = null; + paintLatch = new CountDownLatch(1); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + Dimension size = frame.getSize(); + size.width += 50; + size.height += 50; + + frame.setSize(size); + } + }); + + try { + paintLatch.await(); + } catch (InterruptedException e) { + }; + if (paintError != null) { + frame.dispose(); + throw new RuntimeException("Resize test FAILED.", paintError); + } + frame.dispose(); + System.out.println("Phase 2: PASSED."); + + GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration cfg = env.getDefaultScreenDevice().getDefaultConfiguration(); + // test rendering to accelerated volatile image + testVolatileImage(cfg, true); + System.out.println("Phase 3: PASSED."); + + // test rendering to unaccelerated volatile image + testVolatileImage(cfg, false); + System.out.println("Phase 4: PASSED."); + } + + private static void testVolatileImage(GraphicsConfiguration cfg, + boolean accelerated) + { + VolatileImage dst = null; + try { + dst = cfg.createCompatibleVolatileImage(640, 480, + new ImageCapabilities(accelerated)); + } catch (AWTException e) { + System.out.println("Unable to create volatile image, skip the test."); + return; + } + renderToVolatileImage(dst); + } + + private static void renderToVolatileImage(VolatileImage dst) { + Graphics2D g = dst.createGraphics(); + do { + System.out.println("Render to volatile image.."); + try { + MyComp.renderTest(g, dst.getHeight(), dst.getHeight()); + } catch (Throwable e) { + throw new RuntimeException("Test FAILED.", e); + } + } while (dst.contentsLost()); + System.out.println("Done."); + } + + private static void initGUI() { + frame = new JFrame("Silly composite"); + frame.getContentPane().add(new MyComp()); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + + private static class MyComp extends JComponent { + + private static BufferedImage theImage; + + public MyComp() { + } + + private static BufferedImage getTestImage() { + if (theImage == null) { + theImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = theImage.createGraphics(); + g2d.setColor(Color.red); + g2d.fillRect(0, 0, 256, 256); + + g2d.setPaint(new GradientPaint(0, 0, Color.red, 256, 256, Color.blue)); + g2d.fillRect(0, 100, 256, 256); + g2d.dispose(); + } + return theImage; + } + + public Dimension getPreferredSize() { + return new Dimension(640, 375); + } + + public void paintComponent(Graphics g) { + + + Graphics2D g2d = (Graphics2D) g; + try { + renderTest(g2d, getWidth(), getHeight()); + } catch (Throwable e) { + paintError = e; + } + if (paintLatch != null) { + paintLatch.countDown(); + } + } + + public static void renderTest(Graphics2D g2d, int w, int h) { + g2d.setColor(Color.yellow); + g2d.fillRect(0, 0, w, h); + + BufferedImage image = getTestImage(); + // draw original image + g2d.drawRenderedImage(image, null); + + // draw image with custom composite + g2d.translate(175, 25); + Composite currentComposite = g2d.getComposite(); + g2d.setComposite(new TestComposite()); + g2d.drawRenderedImage(image, null); + g2d.setComposite(currentComposite); + + // draw image with XOR + g2d.translate(175, 25); + g2d.setXORMode(Color.red); + g2d.drawRenderedImage(image, null); + + + System.out.println("Painting is done..."); + } + } + + // A silly custom Composite to demonstrate the problem - just inverts the RGB + private static class TestComposite implements Composite { + + public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { + return new TestCompositeContext(); + } + } + + private static class TestCompositeContext implements CompositeContext { + + public void dispose() { + } + + public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { + int w = src.getWidth(); + int h = src.getHeight(); + + DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); + DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); + int srcRGB[] = srcDB.getBankData()[0]; + int dstOutRGB[] = dstOutDB.getBankData()[0]; + int srcOffset = srcDB.getOffset(); + int dstOutOffset = dstOutDB.getOffset(); + int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); + int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); + int srcAdjust = srcScanStride - w; + int dstOutAdjust = dstOutScanStride - w; + + int si = srcOffset; + int doi = dstOutOffset; + + for (int i = 0; i < h; i++) { + for (int j = 0; j < w; j++) { + dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; + si++; + doi++; + } + + si += srcAdjust; + doi += dstOutAdjust; + } + } + } +}
--- a/test/sun/misc/Version/Version.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/misc/Version/Version.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,11 +29,13 @@ * @run main Version */ +import java.util.regex.*; import static sun.misc.Version.*; + public class Version { public static void main(String[] args) throws Exception { - VersionInfo jdk = newVersionInfo(System.getProperty("java.runtime.version")); + VersionInfo jdk = jdkVersionInfo(System.getProperty("java.runtime.version")); VersionInfo v1 = new VersionInfo(jdkMajorVersion(), jdkMinorVersion(), jdkMicroVersion(), @@ -44,7 +46,7 @@ if (!jdk.equals(v1)) { throw new RuntimeException("Unmatched version: " + jdk + " vs " + v1); } - VersionInfo jvm = newVersionInfo(System.getProperty("java.vm.version")); + VersionInfo jvm = jvmVersionInfo(System.getProperty("java.vm.version")); VersionInfo v2 = new VersionInfo(jvmMajorVersion(), jvmMinorVersion(), jvmMicroVersion(), @@ -95,68 +97,68 @@ } } - private static VersionInfo newVersionInfo(String version) throws Exception { + private static VersionInfo jdkVersionInfo(String version) throws Exception { // valid format of the version string is: - // n.n.n[_uu[c]][-<identifer>]-bxx + // <major>.<minor>[.<micro>][_uu[c]][-<identifier>]-bxx int major = 0; int minor = 0; int micro = 0; int update = 0; String special = ""; int build = 0; - CharSequence cs = version; - if (cs.length() >= 5) { - if (Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' && - Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' && - Character.isDigit(cs.charAt(4))) { - major = Character.digit(cs.charAt(0), 10); - minor = Character.digit(cs.charAt(2), 10); - micro = Character.digit(cs.charAt(4), 10); - cs = cs.subSequence(5, cs.length()); - } else if (Character.isDigit(cs.charAt(0)) && - Character.isDigit(cs.charAt(1)) && cs.charAt(2) == '.' && - Character.isDigit(cs.charAt(3))) { - // HSX has nn.n (major.minor) version - major = Integer.valueOf(version.substring(0, 2)).intValue(); - minor = Character.digit(cs.charAt(3), 10); - cs = cs.subSequence(4, cs.length()); - } - if (cs.charAt(0) == '_' && cs.length() >= 3 && - Character.isDigit(cs.charAt(1)) && - Character.isDigit(cs.charAt(2))) { - int nextChar = 3; - String uu = cs.subSequence(1, 3).toString(); - update = Integer.valueOf(uu).intValue(); - if (cs.length() >= 4) { - char c = cs.charAt(3); - if (c >= 'a' && c <= 'z') { - special = Character.toString(c); - nextChar++; - } - } - cs = cs.subSequence(nextChar, cs.length()); - } - if (cs.charAt(0) == '-') { - // skip the first character - // valid format: <identifier>-bxx or bxx - // non-product VM will have -debug|-release appended - cs = cs.subSequence(1, cs.length()); - String[] res = cs.toString().split("-"); - for (int i = res.length - 1; i >= 0; i--) { - String s = res[i]; - if (s.charAt(0) == 'b') { - try { - build = Integer.parseInt(s.substring(1, s.length())); - break; - } catch (NumberFormatException nfe) { - // ignore - } - } - } - } - } + + String regex = "^([0-9]{1,2})"; // major + regex += "\\."; // separator + regex += "([0-9]{1,2})"; // minor + regex += "(\\."; // separator + regex += "([0-9]{1,2})"; // micro + regex += ")?"; // micro is optional + regex += "(_"; + regex += "([0-9]{2})"; // update + regex += "([a-z])?"; // special char (optional) + regex += ")?"; // _uu[c] is optional + regex += ".*"; // -<identifier> + regex += "(\\-b([0-9]{1,3}$))"; // JDK -bxx + + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(version); + m.matches(); + + major = Integer.parseInt(m.group(1)); + minor = Integer.parseInt(m.group(2)); + micro = (m.group(4) == null) ? 0 : Integer.parseInt(m.group(4)); + update = (m.group(6) == null) ? 0 : Integer.parseInt(m.group(6)); + special = (m.group(7) == null) ? "" : m.group(7); + build = Integer.parseInt(m.group(9)); + VersionInfo vi = new VersionInfo(major, minor, micro, update, special, build); System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi); return vi; } + + private static VersionInfo jvmVersionInfo(String version) throws Exception { + // valid format of the version string is: + // <major>.<minor>-bxx[-<identifier>][-<debug_flavor>] + int major = 0; + int minor = 0; + int build = 0; + + String regex = "^([0-9]{1,2})"; // major + regex += "\\."; // separator + regex += "([0-9]{1,2})"; // minor + regex += "(\\-b([0-9]{1,3}))"; // JVM -bxx + regex += ".*"; + + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(version); + m.matches(); + + major = Integer.parseInt(m.group(1)); + minor = Integer.parseInt(m.group(2)); + build = Integer.parseInt(m.group(4)); + + VersionInfo vi = new VersionInfo(major, minor, 0, 0, "", build); + System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi); + return vi; + } }
--- a/test/sun/net/www/protocol/http/StackTraceTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/net/www/protocol/http/StackTraceTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -32,26 +32,28 @@ import java.io.IOException; public class StackTraceTest { - public static void main(String[] args) { - try { - URL url = new URL("http://localhost:8080/"); - URLConnection uc = url.openConnection(); - System.out.println("key = "+uc.getHeaderFieldKey(20)); - uc.getInputStream(); - } catch (IOException ioe) { - ioe.printStackTrace(); + public static void main(String[] args) throws Exception { + URL url; + try (ServerSocket ss = new ServerSocket(0)) { // refusing socket + url = new URL("http://localhost:" + ss.getLocalPort() + "/"); + } + URLConnection uc = url.openConnection(); + + // Trigger implicit connection by trying to retrieve bogus + // response header, and force remembered exception + uc.getHeaderFieldKey(20); - if (!(ioe instanceof ConnectException)) { - throw new RuntimeException("Expect ConnectException, got "+ioe); - } - if (ioe.getMessage() == null) { + try { + uc.getInputStream(); // expect to throw + throw new RuntimeException("Expected getInputStream to throw"); + } catch (IOException ioe) { + if (!(ioe instanceof ConnectException)) + throw new RuntimeException("Expect ConnectException, got " + ioe); + if (ioe.getMessage() == null) throw new RuntimeException("Exception message is null"); - } - - // this exception should be a chained exception - if (ioe.getCause() == null) { - throw new RuntimeException("Excepting a chained exception, but got: ", ioe); - } + if (ioe.getCause() == null) + throw new RuntimeException("Excepting a chained exception, but got: ", + ioe); } } }
--- a/test/sun/net/www/protocol/jar/B4957695.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/net/www/protocol/jar/B4957695.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,6 @@ /** * @test * @bug 4957695 - * @library ../../httptest/ - * @build HttpCallback HttpServer ClosedChannelList HttpTransaction AbstractCallback * @summary URLJarFile.retrieve does not delete tmpFile on IOException */ @@ -34,8 +32,57 @@ public class B4957695 { - static int count = 0; - static boolean error = false; + static Server server; + + static class Server extends Thread { + final ServerSocket srv; + static final byte[] requestEnd = new byte[] {'\r', '\n', '\r', '\n'}; + + Server(ServerSocket s) { + srv = s; + } + + void readOneRequest(InputStream is) throws IOException { + int requestEndCount = 0, r; + while ((r = is.read()) != -1) { + if (r == requestEnd[requestEndCount]) { + requestEndCount++; + if (requestEndCount == 4) { + break; + } + } else { + requestEndCount = 0; + } + } + } + + public void run() { + try (Socket s = srv.accept()) { + // read HTTP request from client + readOneRequest(s.getInputStream()); + try (OutputStreamWriter ow = + new OutputStreamWriter((s.getOutputStream()))) { + FileInputStream fin = new FileInputStream(new File( + System.getProperty("test.src", "."), "foo1.jar")); + int length = fin.available(); + byte[] b = new byte[length-10]; + fin.read(b, 0, length-10); + ow.write("HTTP/1.0 200 OK\r\n"); + + // Note: The client expects length bytes. + ow.write("Content-Length: " + length + "\r\n"); + ow.write("Content-Type: text/html\r\n"); + ow.write("\r\n"); + + // Note: The (buggy) server only sends length-10 bytes. + ow.write(new String(b)); + ow.flush(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } static void read (InputStream is) throws IOException { int c,len=0; @@ -45,32 +92,13 @@ System.out.println ("read " + len + " bytes"); } - static class CallBack extends AbstractCallback { - - public void request (HttpTransaction req, int count) { - try { - System.out.println ("Request received"); - req.setResponseEntityBody (new FileInputStream ("foo1.jar")); - System.out.println ("content length " + req.getResponseHeader ( - "Content-length" - )); - req.sendPartialResponse (200, "Ok"); - req.abortiveClose(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - }; - - static HttpServer server; - public static void main (String[] args) throws Exception { String tmpdir = System.getProperty("java.io.tmpdir"); String[] list1 = listTmpFiles(tmpdir); - //server = new HttpServer (new CallBack(), 10, 1, 0); - server = new HttpServer (new CallBack(), 1, 5, 0); - int port = server.getLocalPort(); + ServerSocket serverSocket = new ServerSocket(0); + server = new Server(serverSocket); + server.start(); + int port = serverSocket.getLocalPort(); System.out.println ("Server: listening on port: " + port); URL url = new URL ("jar:http://localhost:"+port+"!/COPYRIGHT"); try { @@ -81,14 +109,12 @@ } catch (IOException e) { System.out.println ("Received IOException as expected"); } - server.terminate(); String[] list2 = listTmpFiles(tmpdir); if (!sameList (list1, list2)) { throw new RuntimeException ("some jar_cache files left behind"); } } - static String[] listTmpFiles (String d) { File dir = new File (d); return dir.list (new FilenameFilter () {
--- a/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -22,8 +22,10 @@ */ /* @test - @bug 4094889 - @summary rmid can have a corrupted log + * @bug 4094889 + * @summary rmid can have a corrupted log + * + * @run main LogAlignmentTest */ /* Fault: ReliableLog used RandomAccessFile.skipBytes() to seek past the end
--- a/test/sun/rmi/log/ReliableLog/SnapshotSize.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/log/ReliableLog/SnapshotSize.java Fri Jun 21 15:46:14 2013 -0500 @@ -25,6 +25,8 @@ * @bug 4319866 * @summary Verify that ReliableLog.snapshotSize() returns correct snapshot * file size even if LogHandler doesn't flush. + * + * @run main SnapshotSize */ import java.io.ByteArrayOutputStream;
--- a/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,7 +28,6 @@ * @library ../../../../java/rmi/testlibrary * * @build StreamPipe - * @build RmicDefault * @run main RmicDefault */
--- a/test/sun/rmi/rmic/newrmic/equivalence/run.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/rmic/newrmic/equivalence/run.sh Fri Jun 21 15:46:14 2013 -0500 @@ -30,18 +30,22 @@ # @build TestLibrary # @author Peter Jones # -# @build AgentServerImpl -# @build AppleImpl -# @build AppleUserImpl -# @build ComputeServerImpl -# @build CountServerImpl -# @build DayTimeServerImpl -# @build G1Impl -# @build MyObjectImpl -# @build NotActivatableServerImpl -# @build OrangeEchoImpl -# @build OrangeImpl -# @build ServerImpl +# @library ../../../../../java/rmi/testlibrary +# +# @build TestLibrary +# AgentServerImpl +# AppleImpl +# AppleUserImpl +# ComputeServerImpl +# CountServerImpl +# DayTimeServerImpl +# G1Impl +# MyObjectImpl +# NotActivatableServerImpl +# OrangeEchoImpl +# OrangeImpl +# ServerImpl +# # @run shell run.sh if [ "${TESTJAVA}" = "" ]
--- a/test/sun/rmi/runtime/Log/4504153/Test4504153.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/runtime/Log/4504153/Test4504153.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -48,8 +48,7 @@ ByteArrayOutputStream err = new ByteArrayOutputStream(); JavaVM vm = new JavaVM(StartRegistry.class.getName(), "-Dsun.rmi.transport.logLevel=v", "", out, err); - vm.start(); - vm.getVM().waitFor(); + vm.execute(); String errString = err.toString();
--- a/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -31,8 +31,7 @@ * @author Peter Jones * * @library ../../../../../java/rmi/testlibrary - * @build JavaVM - * @build NoConsoleOutput + * @build TestLibrary JavaVM * @run main/othervm NoConsoleOutput */ @@ -60,11 +59,13 @@ File.separatorChar + "logging.properties"; ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); + + // We instantiate a JavaVM that should not produce any console output + // (neither on standard output, nor on standard err streams). JavaVM vm = new JavaVM(DoRMIStuff.class.getName(), "-Djava.util.logging.config.file=" + loggingPropertiesFile, "", out, err); - vm.start(); - vm.getVM().waitFor(); + vm.execute(); /* * Verify that the subprocess had no System.out or System.err
--- a/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,11 +28,7 @@ * @author Laird Dornin * * @library ../../../../../java/rmi/testlibrary - * @build TestLibrary - * @build TestParams - * @build TestFailedException - * @build CheckLogging - * @build CheckLogStreams + * @build TestLibrary CheckLogging * @run main/othervm -Dsun.rmi.log.useOld=true CheckLogStreams */
--- a/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java Fri Jun 21 15:46:14 2013 -0500 @@ -29,9 +29,6 @@ * * @library ../../../../../java/rmi/testlibrary * @build TestLibrary - * @build TestParams - * @build TestFailedException - * @build CheckLogging * @run main/othervm CheckLogging */
--- a/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java Fri Jun 21 15:46:14 2013 -0500 @@ -31,11 +31,7 @@ * @author Ann Wollrath * * @library ../../../../../java/rmi/testlibrary - * @build TestLibrary - * @build TestFailedException - * @build MarshalForeignStub - * @build Receiver - * @build MarshalForeignStub_Stub + * @build TestLibrary Receiver MarshalForeignStub_Stub * @run main/othervm/policy=security.policy MarshalForeignStub */
--- a/test/sun/rmi/transport/proxy/EagerHttpFallback.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/transport/proxy/EagerHttpFallback.java Fri Jun 21 15:46:14 2013 -0500 @@ -25,6 +25,7 @@ * @bug 4290727 * @summary Verify that ConnectException will trigger HTTP fallback if * sun.rmi.transport.proxy.eagerHttpFallback system property is set. + * * @library ../../../../java/rmi/testlibrary * @build TestLibrary * @run main/othervm EagerHttpFallback
--- a/test/sun/rmi/transport/tcp/DeadCachedConnection.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/transport/tcp/DeadCachedConnection.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ -25,9 +25,7 @@ * @bug 4094891 * @summary unable to retry call if cached connection to server is used * @library ../../../../java/rmi/testlibrary - * @build DeadCachedConnection - * @build JavaVM - * @build TestLibrary + * @build TestLibrary JavaVM * @run main/othervm DeadCachedConnection */ @@ -106,7 +104,7 @@ JavaVM jvm = new JavaVM("sun.rmi.registry.RegistryImpl", "", Integer.toString(p)); jvm.start(); - DeadCachedConnection.subreg = jvm.getVM(); + DeadCachedConnection.subreg = jvm; } catch (IOException e) { // one of these is summarily dropped, can't remember which one @@ -119,7 +117,7 @@ } catch (Exception whatever) { } } - private static Process subreg = null; + private static JavaVM subreg = null; public static void killRegistry() { if (DeadCachedConnection.subreg != null) {
--- a/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,11 +27,8 @@ * @summary RMI blocks in HttpAwareServerSocket.accept() if you telnet to it * @author Adrian Colley * - * @library ../../../../../java/rmi/testlibrary/ - * @build TestIface - * @build TestImpl - * @build TestImpl_Stub - * @build BlockAcceptTest + * @library ../../../../../java/rmi/testlibrary + * @build TestIface TestImpl TestImpl_Stub * @run main/othervm/policy=security.policy/timeout=60 BlockAcceptTest */
--- a/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,7 +28,6 @@ * on that port, rather than engage in the deprecated "multiplexing protocol". * @author Peter Jones * - * @build DisableMultiplexing * @build DisableMultiplexing_Stub * @run main/othervm DisableMultiplexing */
--- a/test/sun/security/ec/TestEC.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ec/TestEC.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,11 +28,13 @@ * @library ../pkcs11 * @library ../pkcs11/ec * @library ../pkcs11/sslecc + * @library ../../../java/security/testlibrary * @compile -XDignore.symbol.file TestEC.java * @run main TestEC */ import java.security.Provider; +import java.security.Security; /* * Leverage the collection of EC tests used by PKCS11 @@ -51,6 +53,15 @@ public class TestEC { public static void main(String[] args) throws Exception { + ProvidersSnapshot snapshot = ProvidersSnapshot.create(); + try { + main0(args); + } finally { + snapshot.restore(); + } + } + + public static void main0(String[] args) throws Exception { Provider p = new sun.security.ec.SunEC(); System.out.println("Running tests with " + p.getName() + " provider...\n"); @@ -67,6 +78,11 @@ new TestECGenSpec().main(p); new ReadPKCS12().main(p); new ReadCertificates().main(p); + + // ClientJSSEServerJSSE fails on Solaris 11 when both SunEC and + // SunPKCS11-Solaris providers are enabled. + // Workaround: + // Security.removeProvider("SunPKCS11-Solaris"); new ClientJSSEServerJSSE().main(p); long stop = System.currentTimeMillis();
--- a/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java Fri Jun 21 15:46:14 2013 -0500 @@ -36,7 +36,7 @@ public static void main(String[] argv) throws Exception { System.setProperty("sun.security.jgss.mechanism", GSSUtil.GSS_SPNEGO_MECH_OID.toString()); try { - GSSManager.getInstance().createName("service@host", GSSName.NT_HOSTBASED_SERVICE, new Oid("1.3.6.1.5.5.2")); + GSSManager.getInstance().createName("service@localhost", GSSName.NT_HOSTBASED_SERVICE, new Oid("1.3.6.1.5.5.2")); } catch (GSSException e) { // This is OK, for example, krb5.conf is missing or other problems }
--- a/test/sun/security/krb5/auto/BadKdc.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/krb5/auto/BadKdc.java Fri Jun 21 15:46:14 2013 -0500 @@ -67,7 +67,7 @@ * This is tough. * c. Feed the KDC a UDP packet first. The current "solution". */ - public static void go(int[]... expected) + public static void go(String... expected) throws Exception { try { go0(expected); @@ -83,7 +83,7 @@ } } - public static void go0(int[]... expected) + public static void go0(String... expected) throws Exception { System.setProperty("sun.security.krb5.debug", "true"); @@ -135,8 +135,9 @@ return k; } - private static void test(int... expected) throws Exception { + private static void test(String expected) throws Exception { ByteArrayOutputStream bo = new ByteArrayOutputStream(); + System.out.println("----------------- TEST -----------------"); try { test0(bo, expected); } catch (Exception e) { @@ -151,31 +152,34 @@ * One round of test for max_retries and timeout. * @param expected the expected kdc# timeout kdc# timeout... */ - private static void test0(ByteArrayOutputStream bo, int... expected) + private static void test0(ByteArrayOutputStream bo, String expected) throws Exception { PrintStream oldout = System.out; + boolean failed = false; System.setOut(new PrintStream(bo)); try { Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + } catch (Exception e) { + failed = true; } finally { System.setOut(oldout); } String[] lines = new String(bo.toByteArray()).split("\n"); - System.out.println("----------------- TEST -----------------"); - int count = 0; + StringBuilder sb = new StringBuilder(); for (String line: lines) { Matcher m = re.matcher(line); if (m.find()) { System.out.println(line); - if (Integer.parseInt(m.group(1)) != expected[count++] || - Integer.parseInt(m.group(2)) != expected[count++]) { - throw new Exception("Fail here"); - } + sb.append(m.group(1)).append(m.group(2)); } } - if (count != expected.length) { - throw new Exception("Less rounds"); + if (failed) sb.append('-'); + + String output = sb.toString(); + System.out.println("Expected: " + expected + ", actual " + output); + if (!output.matches(expected)) { + throw new Exception("Does not match"); } } }
--- a/test/sun/security/krb5/auto/BadKdc1.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/krb5/auto/BadKdc1.java Fri Jun 21 15:46:14 2013 -0500 @@ -37,16 +37,16 @@ throws Exception { Security.setProperty("krb5.kdc.bad.policy", "tryLess"); BadKdc.go( - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,2,2,3,2}, // 1, 2 - // The above line means try kdc1 for 2 seconds, then kdc1 - // for 2 seconds,..., finally kdc3 for 2 seconds. - new int[]{1,2,2,2,3,2,1,2,2,2,3,2}, // 1, 2 + "121212222222(32){1,2}1222(32){1,2}", // 1 2 + // The above line means try kdc1 for 2 seconds then kdc1 + // for 2 seconds... finally kdc3 for 2 seconds. + "1222(32){1,2}1222(32){1,2}", // 1 2 // refresh - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,2,2,3,2}, // 1, 2 - // k3 off, k2 on - new int[]{1,2,2,2,1,2,2,2}, // 1 + "121212222222(32){1,2}1222(32){1,2}", // 1 2 + // k3 off k2 on + "(122212(22){1,2}|1222323232-)", // 1 // k1 on - new int[]{1,2,1,2} // empty + "(12(12){1,2}|122232-)" // empty ); } }
--- a/test/sun/security/krb5/auto/BadKdc2.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/krb5/auto/BadKdc2.java Fri Jun 21 15:46:14 2013 -0500 @@ -37,14 +37,14 @@ throws Exception { Security.setProperty("krb5.kdc.bad.policy", "tryLess:2,1000"); BadKdc.go( - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,1,1,1,2,1,2,1,3,2}, // 1, 2 - new int[]{1,1,1,1,2,1,2,1,3,2,1,1,1,1,2,1,2,1,3,2}, // 1, 2 + "121212222222(32){1,2}11112121(32){1,2}", // 1 2 + "11112121(32){1,2}11112121(32){1,2}", // 1 2 // refresh - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,1,1,1,2,1,2,1,3,2}, // 1, 2 - // k3 off, k2 on - new int[]{1,1,1,1,2,1,1,1,1,1,2,2}, // 1 + "121212222222(32){1,2}11112121(32){1,2}", // 1 2 + // k3 off k2 on + "1111(21){1,2}1111(22){1,2}", // 1 // k1 on - new int[]{1,1,1,2} // empty + "(11){1,2}(12){1,2}" // empty ); } }
--- a/test/sun/security/krb5/auto/BadKdc3.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/krb5/auto/BadKdc3.java Fri Jun 21 15:46:14 2013 -0500 @@ -37,14 +37,14 @@ throws Exception { Security.setProperty("krb5.kdc.bad.policy", "tryLast"); BadKdc.go( - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,3,2}, // 1, 2 - new int[]{3,2,3,2}, // 1, 2 + "121212222222(32){2,4}", // 1 2 + "(32){2,4}", // 1 2 // refresh - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,3,2}, // 1, 2 - // k3 off, k2 on - new int[]{3,2,3,2,3,2,1,2,1,2,1,2,2,2,2,2}, // 1, 3 + "121212222222(32){2,4}", // 1 2 + // k3 off k2 on + "323232121212(22){2,4}", // 1 3 // k1 on - new int[]{2,2,2,2} // 1, 3 + "(22){2,4}" // 1 3 ); } }
--- a/test/sun/security/krb5/auto/BadKdc4.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/krb5/auto/BadKdc4.java Fri Jun 21 15:46:14 2013 -0500 @@ -37,14 +37,14 @@ throws Exception { Security.setProperty("krb5.kdc.bad.policy", ""); BadKdc.go( - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,1,2,1,2,2,2,2,2,2,2,3,2}, - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,1,2,1,2,2,2,2,2,2,2,3,2}, + "121212222222(32){1,2}121212222222(32){1,2}", + "121212222222(32){1,2}121212222222(32){1,2}", // refresh - new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,1,2,1,2,2,2,2,2,2,2,3,2}, - // k3 off, k2 on - new int[]{1,2,1,2,1,2,2,2,1,2,1,2,1,2,2,2}, + "121212222222(32){1,2}121212222222(32){1,2}", + // k3 off k2 on + "121212(22){1,2}121212(22){1,2}", // k1 on - new int[]{1,2,1,2} + "(12){2,4}" ); } }
--- a/test/sun/security/mscapi/ShortRSAKey1024.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/mscapi/ShortRSAKey1024.sh Fri Jun 21 15:46:14 2013 -0500 @@ -27,7 +27,9 @@ # @test # @bug 7106773 # @summary 512 bits RSA key cannot work with SHA384 and SHA512 -# @run shell ShortRSAKey1024.sh +# @run shell ShortRSAKey1024.sh 1024 +# @run shell ShortRSAKey1024.sh 768 +# @run shell ShortRSAKey1024.sh 512 # set a few environment variables so that the shell-script can run stand-alone # in the source directory @@ -45,24 +47,39 @@ exit 1 fi +BITS=$1 + OS=`uname -s` case "$OS" in Windows* | CYGWIN* ) + echo "Removing the keypair if it already exists (for unknown reason)..." + ${TESTJAVA}/bin/keytool \ + -delete \ + -storetype Windows-My \ + -debug \ + -alias 7106773.$BITS + echo "Creating a temporary RSA keypair in the Windows-My store..." ${TESTJAVA}/bin/keytool \ -genkeypair \ -storetype Windows-My \ -keyalg RSA \ - -alias 7106773.1024 \ - -keysize 1024 \ + -alias 7106773.$BITS \ + -keysize $BITS \ -dname "cn=localhost,c=US" \ + -debug \ -noprompt + if [ "$?" -ne "0" ]; then + echo "Unable to generate key pair in Windows-My keystore" + exit 1 + fi + echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java - ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.1024 1024 \ + ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.$BITS $BITS \ TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA rc=$? @@ -72,7 +89,8 @@ ${TESTJAVA}/bin/keytool \ -delete \ -storetype Windows-My \ - -alias 7106773.1024 + -debug \ + -alias 7106773.$BITS echo done. exit $rc
--- a/test/sun/security/mscapi/ShortRSAKey512.sh Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - - -# @test -# @bug 7106773 -# @summary 512 bits RSA key cannot work with SHA384 and SHA512 -# @run shell ShortRSAKey512.sh - -# set a few environment variables so that the shell-script can run stand-alone -# in the source directory -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi - -if [ "${TESTCLASSES}" = "" ] ; then - TESTCLASSES="." -fi - -if [ "${TESTJAVA}" = "" ] ; then - echo "TESTJAVA not set. Test cannot execute." - echo "FAILED!!!" - exit 1 -fi - -OS=`uname -s` -case "$OS" in - Windows* | CYGWIN* ) - - echo "Creating a temporary RSA keypair in the Windows-My store..." - ${TESTJAVA}/bin/keytool \ - -genkeypair \ - -storetype Windows-My \ - -keyalg RSA \ - -alias 7106773.512 \ - -keysize 512 \ - -dname "cn=localhost,c=US" \ - -noprompt - - echo - echo "Running the test..." - ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java - ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.512 512 \ - TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA - - - rc=$? - - echo - echo "Removing the temporary RSA keypair from the Windows-My store..." - ${TESTJAVA}/bin/keytool \ - -delete \ - -storetype Windows-My \ - -alias 7106773.512 - - echo done. - exit $rc - ;; - - * ) - echo "This test is not intended for '$OS' - passing test" - exit 0 - ;; -esac
--- a/test/sun/security/mscapi/ShortRSAKey768.sh Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - - -# @test -# @bug 7106773 -# @summary 512 bits RSA key cannot work with SHA384 and SHA512 -# @run shell ShortRSAKey768.sh - -# set a few environment variables so that the shell-script can run stand-alone -# in the source directory -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi - -if [ "${TESTCLASSES}" = "" ] ; then - TESTCLASSES="." -fi - -if [ "${TESTJAVA}" = "" ] ; then - echo "TESTJAVA not set. Test cannot execute." - echo "FAILED!!!" - exit 1 -fi - -OS=`uname -s` -case "$OS" in - Windows* | CYGWIN* ) - - echo "Creating a temporary RSA keypair in the Windows-My store..." - ${TESTJAVA}/bin/keytool \ - -genkeypair \ - -storetype Windows-My \ - -keyalg RSA \ - -alias 7106773.768 \ - -keysize 768 \ - -dname "cn=localhost,c=US" \ - -noprompt - - echo - echo "Running the test..." - ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java - ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.768 768 \ - TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA - - rc=$? - - echo - echo "Removing the temporary RSA keypair from the Windows-My store..." - ${TESTJAVA}/bin/keytool \ - -delete \ - -storetype Windows-My \ - -alias 7106773.768 - - echo done. - exit $rc - ;; - - * ) - echo "This test is not intended for '$OS' - passing test" - exit 0 - ;; -esac
--- a/test/sun/security/pkcs11/PKCS11Test.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/PKCS11Test.java Fri Jun 21 15:46:14 2013 -0500 @@ -72,10 +72,33 @@ } public static void main(PKCS11Test test) throws Exception { - System.out.println("Beginning test run " + test.getClass().getName() + "..."); - testDefault(test); - testNSS(test); - testDeimos(test); + Provider[] oldProviders = Security.getProviders(); + try { + System.out.println("Beginning test run " + test.getClass().getName() + "..."); + testDefault(test); + testNSS(test); + testDeimos(test); + } finally { + Provider[] newProviders = Security.getProviders(); + // Do not restore providers if nothing changed. This is especailly + // useful for ./Provider/Login.sh, where a SecurityManager exists. + if (oldProviders.length == newProviders.length) { + boolean found = false; + for (int i = 0; i<oldProviders.length; i++) { + if (oldProviders[i] != newProviders[i]) { + found = true; + break; + } + } + if (!found) return; + } + for (Provider p: newProviders) { + Security.removeProvider(p.getName()); + } + for (Provider p: oldProviders) { + Security.addProvider(p); + } + } } public static void testDeimos(PKCS11Test test) throws Exception { @@ -153,21 +176,21 @@ return libdir; } + protected static void safeReload(String lib) throws Exception { + try { + System.load(lib); + } catch (UnsatisfiedLinkError e) { + if (e.getMessage().contains("already loaded")) { + return; + } + } + } + static boolean loadNSPR(String libdir) throws Exception { // load NSS softoken dependencies in advance to avoid resolver issues - try { - System.load(libdir + System.mapLibraryName(NSPR_PREFIX + "nspr4")); - } catch (UnsatisfiedLinkError e) { - // GLIBC problem on older linux-amd64 machines - if (libdir.contains("linux-amd64")) { - System.out.println(e); - System.out.println("NSS does not work on this platform, skipping."); - return false; - } - throw e; - } - System.load(libdir + System.mapLibraryName(NSPR_PREFIX + "plc4")); - System.load(libdir + System.mapLibraryName(NSPR_PREFIX + "plds4")); + safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "nspr4")); + safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "plc4")); + safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "plds4")); return true; }
--- a/test/sun/security/pkcs11/Secmod/AddPrivateKey.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/Secmod/AddPrivateKey.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary Test that the PKCS#11 KeyStore handles RSA, DSA, and EC keys * @author Andreas Sterbenz * @library .. + * @run main/othervm AddPrivateKey */ import java.io.*;
--- a/test/sun/security/pkcs11/Secmod/AddTrustedCert.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/Secmod/AddTrustedCert.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary make sure we can add a trusted cert to the NSS KeyStore module * @author Andreas Sterbenz * @library .. + * @run main/othervm AddTrustedCert */ import java.io.*;
--- a/test/sun/security/pkcs11/Secmod/Crypto.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/Secmod/Crypto.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary verify that NSS no-db mode works correctly * @author Andreas Sterbenz * @library .. + * @run main/othervm Crypto */ import java.util.*;
--- a/test/sun/security/pkcs11/Secmod/GetPrivateKey.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/Secmod/GetPrivateKey.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary make sure we can access the NSS softtoken KeyStore and use a private key * @author Andreas Sterbenz * @library .. + * @run main/othervm GetPrivateKey */ import java.util.*;
--- a/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/Secmod/JksSetPrivateKey.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary store a NSS PKCS11 PrivateKeyEntry to JKS KeyStore throws confusing NPE * @author Wang Weijun * @library .. + * @run main/othervm JksSetPrivateKey */ import java.util.*;
--- a/test/sun/security/pkcs11/Secmod/TrustAnchors.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/Secmod/TrustAnchors.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary make sure we can access the NSS trust anchor module * @author Andreas Sterbenz * @library .. + * @run main/othervm TrustAnchors */ import java.util.*;
--- a/test/sun/security/pkcs11/SecmodTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/SecmodTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -44,8 +44,8 @@ if (loadNSPR(LIBPATH) == false) { return false; } - System.load(LIBPATH + System.mapLibraryName("softokn3")); - System.load(LIBPATH + System.mapLibraryName("nssckbi")); + safeReload(LIBPATH + System.mapLibraryName("softokn3")); + safeReload(LIBPATH + System.mapLibraryName("nssckbi")); DBDIR = System.getProperty("test.classes", ".") + SEP + "tmpdb"; System.setProperty("pkcs11test.nss.db", DBDIR);
--- a/test/sun/security/pkcs11/ec/ReadCertificates.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/ec/ReadCertificates.java Fri Jun 21 15:46:14 2013 -0500 @@ -28,6 +28,7 @@ * and verify their signatures * @author Andreas Sterbenz * @library .. + * @library ../../../../java/security/testlibrary */ import java.io.*; @@ -62,7 +63,7 @@ System.out.println("Provider does not support ECDSA, skipping..."); return; } - Security.insertProviderAt(p, 1); + Providers.setAt(p, 1); random = new SecureRandom(); factory = CertificateFactory.getInstance("X.509");
--- a/test/sun/security/pkcs11/ec/ReadPKCS12.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/ec/ReadPKCS12.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary Verify that we can parse ECPrivateKeys from PKCS#12 and use them * @author Andreas Sterbenz * @library .. + * @library ../../../../java/security/testlibrary */ import java.io.*; @@ -52,7 +53,7 @@ System.out.println("Provider does not support ECDSA, skipping..."); return; } - Security.insertProviderAt(p, 1); + Providers.setAt(p, 1); CertificateFactory factory = CertificateFactory.getInstance("X.509"); try {
--- a/test/sun/security/pkcs11/ec/TestECDH.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/ec/TestECDH.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary Basic known answer test for ECDH * @author Andreas Sterbenz * @library .. + * @library ../../../../java/security/testlibrary */ import java.io.*; @@ -59,7 +60,7 @@ System.out.println("Provider does not support ECDH, skipping"); return; } - Security.insertProviderAt(p, 1); + Providers.setAt(p, 1); if (false) { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
--- a/test/sun/security/pkcs11/ec/TestECDSA.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/ec/TestECDSA.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying * @author Andreas Sterbenz * @library .. + * @library ../../../../java/security/testlibrary */ import java.io.*; @@ -115,7 +116,7 @@ System.out.println("ECDSA not supported, skipping"); return; } - Security.insertProviderAt(provider, 1); + Providers.setAt(provider, 1); if (false) { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider);
--- a/test/sun/security/pkcs11/fips/CipherTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/fips/CipherTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -394,47 +394,52 @@ public static void main(PeerFactory peerFactory, KeyStore keyStore, String[] args) throws Exception { + SSLContext reservedSSLContext = SSLContext.getDefault(); + try { + long time = System.currentTimeMillis(); + String relPath; + if ((args != null) && (args.length > 0) && args[0].equals("sh")) { + relPath = pathToStoresSH; + } else { + relPath = pathToStores; + } + PATH = new File(System.getProperty("test.src", "."), relPath); + CipherTest.peerFactory = peerFactory; + System.out.print( + "Initializing test '" + peerFactory.getName() + "'..."); +// secureRandom = new SecureRandom(); +// secureRandom.nextInt(); +// trustStore = readKeyStore(trustStoreFile); + CipherTest.keyStore = keyStore; +// keyStore = readKeyStore(keyStoreFile); + KeyManagerFactory keyFactory = + KeyManagerFactory.getInstance( + KeyManagerFactory.getDefaultAlgorithm()); + keyFactory.init(keyStore, "test12".toCharArray()); + keyManager = (X509ExtendedKeyManager)keyFactory.getKeyManagers()[0]; - long time = System.currentTimeMillis(); - String relPath; - if ((args != null) && (args.length > 0) && args[0].equals("sh")) { - relPath = pathToStoresSH; - } else { - relPath = pathToStores; + TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(keyStore); + trustManager = (X509TrustManager)tmf.getTrustManagers()[0]; + +// trustManager = new AlwaysTrustManager(); + SSLContext context = SSLContext.getInstance("TLS"); + context.init(new KeyManager[] {keyManager}, + new TrustManager[] {trustManager}, null); + SSLContext.setDefault(context); + + CipherTest cipherTest = new CipherTest(peerFactory); + Thread serverThread = new Thread(peerFactory.newServer(cipherTest), + "Server"); + serverThread.setDaemon(true); + serverThread.start(); + System.out.println("Done"); + cipherTest.run(); + time = System.currentTimeMillis() - time; + System.out.println("Done. (" + time + " ms)"); + } finally { + SSLContext.setDefault(reservedSSLContext); } - PATH = new File(System.getProperty("test.src", "."), relPath); - CipherTest.peerFactory = peerFactory; - System.out.print( - "Initializing test '" + peerFactory.getName() + "'..."); -// secureRandom = new SecureRandom(); -// secureRandom.nextInt(); -// trustStore = readKeyStore(trustStoreFile); - CipherTest.keyStore = keyStore; -// keyStore = readKeyStore(keyStoreFile); - KeyManagerFactory keyFactory = - KeyManagerFactory.getInstance( - KeyManagerFactory.getDefaultAlgorithm()); - keyFactory.init(keyStore, "test12".toCharArray()); - keyManager = (X509ExtendedKeyManager)keyFactory.getKeyManagers()[0]; - - TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - tmf.init(keyStore); - trustManager = (X509TrustManager)tmf.getTrustManagers()[0]; - -// trustManager = new AlwaysTrustManager(); - SSLContext context = SSLContext.getInstance("TLS"); - context.init(new KeyManager[] {keyManager}, new TrustManager[] {trustManager}, null); - SSLContext.setDefault(context); - - CipherTest cipherTest = new CipherTest(peerFactory); - Thread serverThread = new Thread(peerFactory.newServer(cipherTest), - "Server"); - serverThread.setDaemon(true); - serverThread.start(); - System.out.println("Done"); - cipherTest.run(); - time = System.currentTimeMillis() - time; - System.out.println("Done. (" + time + " ms)"); } static abstract class PeerFactory {
--- a/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ * @library .. * @ignore JSSE supported cipher suites are changed with CR 6916074, * need to update this test case in JDK 7 soon + * @run main/othervm ClientJSSEServerJSSE * @author Andreas Sterbenz */
--- a/test/sun/security/pkcs11/fips/TrustManagerTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/fips/TrustManagerTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary Verify that the SunJSSE trustmanager works correctly in FIPS mode * @author Andreas Sterbenz * @library .. + * @run main/othervm TrustManagerTest */ import java.io.*;
--- a/test/sun/security/pkcs11/rsa/TestCACerts.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/rsa/TestCACerts.java Fri Jun 21 15:46:14 2013 -0500 @@ -48,32 +48,35 @@ public void main(Provider p) throws Exception { long start = System.currentTimeMillis(); Security.addProvider(p); - String PROVIDER = p.getName(); - String javaHome = System.getProperty("java.home"); - String caCerts = javaHome + SEP + "lib" + SEP + "security" + SEP + "cacerts"; - InputStream in = new FileInputStream(caCerts); - KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); - ks.load(in, null); - in.close(); - for (Enumeration e = ks.aliases(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); - if (ks.isCertificateEntry(alias)) { - System.out.println("* Testing " + alias + "..."); - X509Certificate cert = (X509Certificate)ks.getCertificate(alias); - PublicKey key = cert.getPublicKey(); - String alg = key.getAlgorithm(); - if (alg.equals("RSA")) { - System.out.println("Signature algorithm: " + cert.getSigAlgName()); - cert.verify(key, PROVIDER); + try { + String PROVIDER = p.getName(); + String javaHome = System.getProperty("java.home"); + String caCerts = javaHome + SEP + "lib" + SEP + "security" + SEP + "cacerts"; + InputStream in = new FileInputStream(caCerts); + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); + ks.load(in, null); + in.close(); + for (Enumeration e = ks.aliases(); e.hasMoreElements(); ) { + String alias = (String)e.nextElement(); + if (ks.isCertificateEntry(alias)) { + System.out.println("* Testing " + alias + "..."); + X509Certificate cert = (X509Certificate)ks.getCertificate(alias); + PublicKey key = cert.getPublicKey(); + String alg = key.getAlgorithm(); + if (alg.equals("RSA")) { + System.out.println("Signature algorithm: " + cert.getSigAlgName()); + cert.verify(key, PROVIDER); + } else { + System.out.println("Skipping cert with key: " + alg); + } } else { - System.out.println("Skipping cert with key: " + alg); + System.out.println("Skipping alias " + alias); } - } else { - System.out.println("Skipping alias " + alias); } + long stop = System.currentTimeMillis(); + System.out.println("All tests passed (" + (stop - start) + " ms)."); + } finally { + Security.removeProvider(p.getName()); } - long stop = System.currentTimeMillis(); - System.out.println("All tests passed (" + (stop - start) + " ms)."); } - }
--- a/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java Fri Jun 21 15:46:14 2013 -0500 @@ -27,6 +27,7 @@ * @summary Verify that all ciphersuites work (incl. ECC using NSS crypto) * @author Andreas Sterbenz * @library .. + * @library ../../../../java/security/testlibrary */ import java.security.*; @@ -45,7 +46,7 @@ System.out.println("Provider does not support EC, skipping"); return; } - Security.insertProviderAt(p, 1); + Providers.setAt(p, 1); CipherTest.main(new JSSEFactory(), cmdArgs); Security.removeProvider(p.getName()); }
--- a/test/sun/security/pkcs12/PKCS12SameKeyId.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/pkcs12/PKCS12SameKeyId.java Fri Jun 21 15:46:14 2013 -0500 @@ -86,7 +86,9 @@ // Reads from JKS keystore and pre-calculate KeyStore ks = KeyStore.getInstance("jks"); - ks.load(new FileInputStream(JKSFILE), PASSWORD); + try (FileInputStream fis = new FileInputStream(JKSFILE)) { + ks.load(fis, PASSWORD); + } for (int i=0; i<SIZE; i++) { aliases[i] = "p" + i; byte[] enckey = cipher.doFinal( @@ -103,11 +105,15 @@ for (int i=0; i<SIZE; i++) { p12.setKeyEntry(aliases[i], keys[i], certChains[i]); } - p12.store(new FileOutputStream(P12FILE), PASSWORD); + try (FileOutputStream fos = new FileOutputStream(P12FILE)) { + p12.store(fos, PASSWORD); + } // Check private keys still match certs p12 = KeyStore.getInstance("pkcs12"); - p12.load(new FileInputStream(P12FILE), PASSWORD); + try (FileInputStream fis = new FileInputStream(P12FILE)) { + p12.load(fis, PASSWORD); + } for (int i=0; i<SIZE; i++) { String a = "p" + i; X509Certificate x = (X509Certificate)p12.getCertificate(a);
--- a/test/sun/security/provider/PolicyFile/Comparator.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/provider/PolicyFile/Comparator.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,6 +24,7 @@ /* * @test * @bug 5037004 + * @run main/othervm Comparator * @summary Frivolous ClassCastExceptions thrown by SubjectCodeSource.implies * * Note: if you want to see the java.security.debug output,
--- a/test/sun/security/provider/certpath/X509CertPath/ForwardBuildCompromised.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 7123519 - * @summary Problem with java/classes_security - */ - -import java.net.*; -import java.util.*; -import java.io.*; -import javax.net.ssl.*; -import java.security.KeyStore; -import java.security.cert.*; -import java.security.spec.*; -import java.security.interfaces.*; - -public class ForwardBuildCompromised { - // DigiNotar Root CA, untrusted root certificate - static String trustedCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1\n" + - "MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE\n" + - "ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j\n" + - "b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF\n" + - "bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg\n" + - "U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA\n" + - "A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/\n" + - "I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3\n" + - "wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC\n" + - "AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb\n" + - "oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5\n" + - "BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p\n" + - "dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk\n" + - "MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp\n" + - "b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu\n" + - "dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0\n" + - "MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi\n" + - "E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa\n" + - "MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI\n" + - "hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN\n" + - "95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd\n" + - "2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Root CA, untrusted cross-certificate - static String untrustedCrossCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3\n" + - "MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n" + - "EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI\n" + - "hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + - "ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt\n" + - "OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx\n" + - "hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7\n" + - "gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D\n" + - "IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T\n" + - "BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs\n" + - "Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8\n" + - "5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf\n" + - "DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX\n" + - "9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e\n" + - "7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj\n" + - "ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB\n" + - "BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF\n" + - "BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD\n" + - "VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy\n" + - "bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G\n" + - "A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob\n" + - "BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh\n" + - "xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n" + - "ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n" + - "ZFdYf+hthc3m6IcJ\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Root CA, compromised certificate - static String compromisedCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n" + - "Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n" + - "HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES\n" + - "MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg\n" + - "MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB\n" + - "AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B\n" + - "8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY\n" + - "tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl\n" + - "HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj\n" + - "zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3AlnU\n" + - "JgEbjt+tUwbRrhjd4rI6y9eIOI6sWym5GdOY+RgDz0iChmYLG2kPyes4iHomGgVM\n" + - "ktck1JbyrFIto0fVUvY//s6EBnCmqj6i8rZWNBhXouSBbefK8GrTx5FrAoNBfBXv\n" + - "a5pkXuPQPOWx63tdhvvL5ndJzaNl3Pe5nLjkC1+Tz8wwGjIczhxjlaX56uF0i57p\n" + - "K6kwe6AYHw4YC+VbqdPRbB4HZ4+RS6mKvNJmqpMBiLKR+jFc1abBUggJzQpjotMi\n" + - "puih2TkGl/VujQKQjBR7P4DNG5y6xFhyI6+2Vp/GekIzKQc/gsnmHwUNzUwoNovT\n" + - "yD4cxojvXu6JZOkd69qJfjKmadHdzIif0dDJZiHcBmfFlHqabWJMfczgZICynkeO\n" + - "owIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" + - "HQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wDQYJKoZIhvcNAQEFBQADggIBADsC\n" + - "jcs8MOhuoK3yc7NfniUTBAXT9uOLuwt5zlPe5JbF0a9zvNXD0EBVfEB/zRtfCdXy\n" + - "fJ9oHbtdzno5wozWmHvFg1Wo1X1AyuAe94leY12hE8JdiraKfADzI8PthV9xdvBo\n" + - "Y6pFITlIYXg23PFDk9Qlx/KAZeFTAnVR/Ho67zerhChXDNjU1JlWbOOi/lmEtDHo\n" + - "M/hklJRRl6s5xUvt2t2AC298KQ3EjopyDedTFLJgQT2EkTFoPSdE2+Xe9PpjRchM\n" + - "Ppj1P0G6Tss3DbpmmPHdy59c91Q2gmssvBNhl0L4eLvMyKKfyvBovWsdst+Nbwed\n" + - "2o5nx0ceyrm/KkKRt2NTZvFCo+H0Wk1Ya7XkpDOtXHAd3ODy63MUkZoDweoAZbwH\n" + - "/M8SESIsrqC9OuCiKthZ6SnTGDWkrBFfGbW1G/8iSlzGeuQX7yCpp/Q/rYqnmgQl\n" + - "nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE\n" + - "O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU\n" + - "9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9\n" + - "j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Public CA 2025, intermediate certificate - static String intermediateCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIGAzCCA+ugAwIBAgIQHn16Uz1FMEGWQA9xSB9FBDANBgkqhkiG9w0BAQUFADBf\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n" + - "Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n" + - "HhcNMDYwMjA2MTYwNzAyWhcNMjUwMzI4MTYwNzAyWjBmMQswCQYDVQQGEwJOTDES\n" + - "MBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdpTm90YXIgUHVibGljIENB\n" + - "IDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5vdGFyLm5sMIIBIjANBgkq\n" + - "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/2eu/I5fMG8lbvPph3e8zfJpZQtg/72\n" + - "Yx29+ivtKehiF6A3n785XyoY6IT3vlCrhy1CbMOY3M0x1n4YQlv17B0XZ/DqHyBA\n" + - "SQvnDNbkM9j4NoSy/sRtGsP6PetIFFjrhE9whZuvuSUC1PY4PruEEJp8zOCx4+wU\n" + - "Zt9xvjy4Xra+bSia5rwccQ/R5FYTGKrYCthOy9C9ud5Fhd++rlVhgdA/78w+Cs2s\n" + - "xS4i0MAxG75P3/e/bATJKepbydHdDjkyz9o3RW/wdPUXhzEw4EwUjYg6XJrDzMad\n" + - "6aL9M/eaxDjgz6o48EaWRDrGptaE2uJRuErVz7oOO0p/wYKq/BU+/wIDAQABo4IB\n" + - "sjCCAa4wOgYIKwYBBQUHAQEELjAsMCoGCCsGAQUFBzABhh5odHRwOi8vdmFsaWRh\n" + - "dGlvbi5kaWdpbm90YXIubmwwHwYDVR0jBBgwFoAUiGi/4I41xDs4a2L3KDuEgcgM\n" + - "100wEgYDVR0TAQH/BAgwBgEB/wIBADCBxgYDVR0gBIG+MIG7MIG4Bg5ghBABh2kB\n" + - "AQEBBQIGBDCBpTAnBggrBgEFBQcCARYbaHR0cDovL3d3dy5kaWdpbm90YXIubmwv\n" + - "Y3BzMHoGCCsGAQUFBwICMG4abENvbmRpdGlvbnMsIGFzIG1lbnRpb25lZCBvbiBv\n" + - "dXIgd2Vic2l0ZSAod3d3LmRpZ2lub3Rhci5ubCksIGFyZSBhcHBsaWNhYmxlIHRv\n" + - "IGFsbCBvdXIgcHJvZHVjdHMgYW5kIHNlcnZpY2VzLjBDBgNVHR8EPDA6MDigNqA0\n" + - "hjJodHRwOi8vc2VydmljZS5kaWdpbm90YXIubmwvY3JsL3Jvb3QvbGF0ZXN0Q1JM\n" + - "LmNybDAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFN8zwK+S/jf8ttgWFtDZsZHV\n" + - "+m6lMA0GCSqGSIb3DQEBBQUAA4ICAQCfV1rmBd9QStEyQ40lT0tqby0/3ez0STuJ\n" + - "ESBQLQD56XYdb4VFSuqA6xTtiuSVHLoiv2xyISN9FvX3A5VtifkJ00JEaLQJiSsE\n" + - "wGDkYGl1DT7SsqtAVKdMAuCM+e0j0/RV3hZ6kcrM7/wFccHwM+/TiurR9lgZDzB4\n" + - "a7++A4XrYyKx9vc9ZwBEnD1nrAe7++gg9cuZgP7e+QL0FBHMjpw+gnCDjr2dzBZC\n" + - "4r+b8SOqlbPRPexBuNghlc7PfcPIyFis2LJXDRMWiAd3TcfdALwRsuKMR/T+cwyr\n" + - "asy69OEGHplLT57otQ524BDctDXNzlH9bHEh52QzqkWvIDqs42910IUy1nYNPIUG\n" + - "yYJV/T7H8Jb6vfMZWe47iUFvtNZCi8+b542gRUwdi+ca+hGviBC9Qr4Wv1pl7CBQ\n" + - "Hy1axTkHiQawUo/hgmoetCpftugl9yJTfvsBorUV1ZMxn9B1JLSGtWnbUsFRla7G\n" + - "fNa0IsUkzmmha8XCzvNu0d1PDGtcQyUqmDOE1Hx4cIBeuF8ipuIXkrVCr9zAZ4ZC\n" + - "hgz6aA1gDTW8whSRJqYEYEQ0pcMEFLyXE+Nz3O8NinO2AuxqKhjMk13203xA7lPY\n" + - "MnBQ0v7S3qqbp/pvPMiUhOz/VaYted6QmOY5EATBnFiLCuw87JXoAyp382eJ3WX1\n" + - "hOiR4IX9Tg==\n" + - "-----END CERTIFICATE-----"; - - // The fraudulent certificate issued by above compromised CA - static String targetCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdp\n" + - "Tm90YXIgUHVibGljIENBIDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5v\n" + - "dGFyLm5sMB4XDTExMDcxMDE5MDYzMFoXDTEzMDcwOTE5MDYzMFowajELMAkGA1UE\n" + - "BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxFjAUBgNVBAcTDU1vdW50YWluIFZp\n" + - "ZXcxFzAVBgNVBAUTDlBLMDAwMjI5MjAwMDAyMRUwEwYDVQQDEwwqLmdvb2dsZS5j\n" + - "b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNbeKubCV0aCxhOiOS\n" + - "CSQ/w9HXTYuD5BLKuiqXNw3setdTymeJz2L8aWOHo3nicFNDVwWTgwWomGNr2J6Q\n" + - "7g1iINNSW0rR4E1l2szRkcnAY6c6i/Eke93nF4i2hDsnIBveolF5yjpuRm73uQQD\n" + - "ulHjA3BFRF/PTi0fw2/Yt+8ieoMuNcMWN6Eou5Gqt5YZkWv176ofeCbsBmMrP87x\n" + - "OhhtTDckCapk4VQZG2XrfzZcV6tdzCp5TI8uHdu17cdzXm1imZ8tyvzFeiCEOQN8\n" + - "vPNzB/fIr3CJQ5q4uM5aKT3DD5PeVzf4rfJKQNgCTWiIBc9XcWEUuszwAsnmg7e2\n" + - "EJRdAgMBAAGjggHMMIIByDA6BggrBgEFBQcBAQQuMCwwKgYIKwYBBQUHMAGGHmh0\n" + - "dHA6Ly92YWxpZGF0aW9uLmRpZ2lub3Rhci5ubDAfBgNVHSMEGDAWgBTfM8Cvkv43\n" + - "/LbYFhbQ2bGR1fpupTAJBgNVHRMEAjAAMIHGBgNVHSAEgb4wgbswgbgGDmCEEAGH\n" + - "aQEBAQIEAQICMIGlMCcGCCsGAQUFBwIBFhtodHRwOi8vd3d3LmRpZ2lub3Rhci5u\n" + - "bC9jcHMwegYIKwYBBQUHAgIwbhpsQ29uZGl0aW9ucywgYXMgbWVudGlvbmVkIG9u\n" + - "IG91ciB3ZWJzaXRlICh3d3cuZGlnaW5vdGFyLm5sKSwgYXJlIGFwcGxpY2FibGUg\n" + - "dG8gYWxsIG91ciBwcm9kdWN0cyBhbmQgc2VydmljZXMuMEkGA1UdHwRCMEAwPqA8\n" + - "oDqGOGh0dHA6Ly9zZXJ2aWNlLmRpZ2lub3Rhci5ubC9jcmwvcHVibGljMjAyNS9s\n" + - "YXRlc3RDUkwuY3JsMA4GA1UdDwEB/wQEAwIEsDAbBgNVHREEFDASgRBhZG1pbkBn\n" + - "b29nbGUuY29tMB0GA1UdDgQWBBQHSn0WJzIo0eMBMQUNsMqN6eF/7TANBgkqhkiG\n" + - "9w0BAQUFAAOCAQEAAs5dL7N9wzRJkI4Aq4lC5t8j5ZadqnqUcgYLADzSv4ExytNH\n" + - "UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB\n" + - "pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM\n" + - "FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum\n" + - "U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK\n" + - "baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg==\n" + - "-----END CERTIFICATE-----"; - - public static void main(String args[]) throws Exception { - - Exception reservedException = null; - try { - build(); - } catch (CertPathBuilderException cpbe) { - reservedException = cpbe; - } - - if (reservedException == null) { - throw new Exception("Unable to block fraudulent certificate"); - } - - System.out.println( - "The expected untrusted cert exception: " + reservedException); - } - - private static X509CertSelector generateSelector() throws Exception { - - // generate certificate from cert strings - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - X509Certificate target = null; - try (ByteArrayInputStream is = - new ByteArrayInputStream(targetCertStr.getBytes())) { - target = (X509Certificate)cf.generateCertificate(is); - } - - X509CertSelector selector = new X509CertSelector(); - selector.setCertificate(target); - - return selector; - } - - - private static CertStore generateCertificateStore() throws Exception { - - // generate certificate from cert strings - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - // generate certification path - Set<Certificate> entries = new HashSet(); - - try (ByteArrayInputStream is = - new ByteArrayInputStream(targetCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(intermediateCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(compromisedCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(untrustedCrossCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - return CertStore.getInstance("Collection", - new CollectionCertStoreParameters(entries)); - } - - private static Set<TrustAnchor> generateTrustAnchors() - throws CertificateException, IOException { - // generate certificate from cert string - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - Certificate trustedCert = null; - try (ByteArrayInputStream is = - new ByteArrayInputStream(trustedCertStr.getBytes())) { - trustedCert = cf.generateCertificate(is); - } - - // generate a trust anchor - TrustAnchor anchor = - new TrustAnchor((X509Certificate)trustedCert, null); - - return Collections.singleton(anchor); - } - - private static void build() throws Exception { - X509CertSelector selector = generateSelector(); - Set<TrustAnchor> anchors = generateTrustAnchors(); - CertStore certs = generateCertificateStore(); - - PKIXBuilderParameters params = - new PKIXBuilderParameters(anchors, selector); - params.addCertStore(certs); - params.setRevocationEnabled(false); - params.setDate(new Date(111, 11, 25)); // 2011-12-25 - - CertPathBuilder builder = CertPathBuilder.getInstance("PKIX"); - PKIXCertPathBuilderResult result = - (PKIXCertPathBuilderResult)builder.build(params); - } -} -
--- a/test/sun/security/provider/certpath/X509CertPath/ReverseBuildCompromised.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 7123519 - * @summary Problem with java/classes_security - */ - -import java.net.*; -import java.util.*; -import java.io.*; -import javax.net.ssl.*; -import java.security.KeyStore; -import java.security.cert.*; -import java.security.spec.*; -import java.security.interfaces.*; -import sun.security.provider.certpath.SunCertPathBuilderParameters; - -public class ReverseBuildCompromised { - // DigiNotar Root CA, untrusted root certificate - static String trustedCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1\n" + - "MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE\n" + - "ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j\n" + - "b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF\n" + - "bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg\n" + - "U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA\n" + - "A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/\n" + - "I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3\n" + - "wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC\n" + - "AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb\n" + - "oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5\n" + - "BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p\n" + - "dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk\n" + - "MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp\n" + - "b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu\n" + - "dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0\n" + - "MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi\n" + - "E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa\n" + - "MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI\n" + - "hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN\n" + - "95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd\n" + - "2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Root CA, untrusted cross-certificate - static String untrustedCrossCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3\n" + - "MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n" + - "EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI\n" + - "hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + - "ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt\n" + - "OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx\n" + - "hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7\n" + - "gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D\n" + - "IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T\n" + - "BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs\n" + - "Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8\n" + - "5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf\n" + - "DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX\n" + - "9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e\n" + - "7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj\n" + - "ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB\n" + - "BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF\n" + - "BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD\n" + - "VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy\n" + - "bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G\n" + - "A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob\n" + - "BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh\n" + - "xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n" + - "ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n" + - "ZFdYf+hthc3m6IcJ\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Root CA, compromised certificate - static String compromisedCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n" + - "Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n" + - "HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES\n" + - "MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg\n" + - "MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB\n" + - "AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B\n" + - "8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY\n" + - "tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl\n" + - "HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj\n" + - "zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3AlnU\n" + - "JgEbjt+tUwbRrhjd4rI6y9eIOI6sWym5GdOY+RgDz0iChmYLG2kPyes4iHomGgVM\n" + - "ktck1JbyrFIto0fVUvY//s6EBnCmqj6i8rZWNBhXouSBbefK8GrTx5FrAoNBfBXv\n" + - "a5pkXuPQPOWx63tdhvvL5ndJzaNl3Pe5nLjkC1+Tz8wwGjIczhxjlaX56uF0i57p\n" + - "K6kwe6AYHw4YC+VbqdPRbB4HZ4+RS6mKvNJmqpMBiLKR+jFc1abBUggJzQpjotMi\n" + - "puih2TkGl/VujQKQjBR7P4DNG5y6xFhyI6+2Vp/GekIzKQc/gsnmHwUNzUwoNovT\n" + - "yD4cxojvXu6JZOkd69qJfjKmadHdzIif0dDJZiHcBmfFlHqabWJMfczgZICynkeO\n" + - "owIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" + - "HQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wDQYJKoZIhvcNAQEFBQADggIBADsC\n" + - "jcs8MOhuoK3yc7NfniUTBAXT9uOLuwt5zlPe5JbF0a9zvNXD0EBVfEB/zRtfCdXy\n" + - "fJ9oHbtdzno5wozWmHvFg1Wo1X1AyuAe94leY12hE8JdiraKfADzI8PthV9xdvBo\n" + - "Y6pFITlIYXg23PFDk9Qlx/KAZeFTAnVR/Ho67zerhChXDNjU1JlWbOOi/lmEtDHo\n" + - "M/hklJRRl6s5xUvt2t2AC298KQ3EjopyDedTFLJgQT2EkTFoPSdE2+Xe9PpjRchM\n" + - "Ppj1P0G6Tss3DbpmmPHdy59c91Q2gmssvBNhl0L4eLvMyKKfyvBovWsdst+Nbwed\n" + - "2o5nx0ceyrm/KkKRt2NTZvFCo+H0Wk1Ya7XkpDOtXHAd3ODy63MUkZoDweoAZbwH\n" + - "/M8SESIsrqC9OuCiKthZ6SnTGDWkrBFfGbW1G/8iSlzGeuQX7yCpp/Q/rYqnmgQl\n" + - "nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE\n" + - "O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU\n" + - "9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9\n" + - "j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Public CA 2025, intermediate certificate - static String intermediateCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIGAzCCA+ugAwIBAgIQHn16Uz1FMEGWQA9xSB9FBDANBgkqhkiG9w0BAQUFADBf\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n" + - "Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n" + - "HhcNMDYwMjA2MTYwNzAyWhcNMjUwMzI4MTYwNzAyWjBmMQswCQYDVQQGEwJOTDES\n" + - "MBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdpTm90YXIgUHVibGljIENB\n" + - "IDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5vdGFyLm5sMIIBIjANBgkq\n" + - "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/2eu/I5fMG8lbvPph3e8zfJpZQtg/72\n" + - "Yx29+ivtKehiF6A3n785XyoY6IT3vlCrhy1CbMOY3M0x1n4YQlv17B0XZ/DqHyBA\n" + - "SQvnDNbkM9j4NoSy/sRtGsP6PetIFFjrhE9whZuvuSUC1PY4PruEEJp8zOCx4+wU\n" + - "Zt9xvjy4Xra+bSia5rwccQ/R5FYTGKrYCthOy9C9ud5Fhd++rlVhgdA/78w+Cs2s\n" + - "xS4i0MAxG75P3/e/bATJKepbydHdDjkyz9o3RW/wdPUXhzEw4EwUjYg6XJrDzMad\n" + - "6aL9M/eaxDjgz6o48EaWRDrGptaE2uJRuErVz7oOO0p/wYKq/BU+/wIDAQABo4IB\n" + - "sjCCAa4wOgYIKwYBBQUHAQEELjAsMCoGCCsGAQUFBzABhh5odHRwOi8vdmFsaWRh\n" + - "dGlvbi5kaWdpbm90YXIubmwwHwYDVR0jBBgwFoAUiGi/4I41xDs4a2L3KDuEgcgM\n" + - "100wEgYDVR0TAQH/BAgwBgEB/wIBADCBxgYDVR0gBIG+MIG7MIG4Bg5ghBABh2kB\n" + - "AQEBBQIGBDCBpTAnBggrBgEFBQcCARYbaHR0cDovL3d3dy5kaWdpbm90YXIubmwv\n" + - "Y3BzMHoGCCsGAQUFBwICMG4abENvbmRpdGlvbnMsIGFzIG1lbnRpb25lZCBvbiBv\n" + - "dXIgd2Vic2l0ZSAod3d3LmRpZ2lub3Rhci5ubCksIGFyZSBhcHBsaWNhYmxlIHRv\n" + - "IGFsbCBvdXIgcHJvZHVjdHMgYW5kIHNlcnZpY2VzLjBDBgNVHR8EPDA6MDigNqA0\n" + - "hjJodHRwOi8vc2VydmljZS5kaWdpbm90YXIubmwvY3JsL3Jvb3QvbGF0ZXN0Q1JM\n" + - "LmNybDAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFN8zwK+S/jf8ttgWFtDZsZHV\n" + - "+m6lMA0GCSqGSIb3DQEBBQUAA4ICAQCfV1rmBd9QStEyQ40lT0tqby0/3ez0STuJ\n" + - "ESBQLQD56XYdb4VFSuqA6xTtiuSVHLoiv2xyISN9FvX3A5VtifkJ00JEaLQJiSsE\n" + - "wGDkYGl1DT7SsqtAVKdMAuCM+e0j0/RV3hZ6kcrM7/wFccHwM+/TiurR9lgZDzB4\n" + - "a7++A4XrYyKx9vc9ZwBEnD1nrAe7++gg9cuZgP7e+QL0FBHMjpw+gnCDjr2dzBZC\n" + - "4r+b8SOqlbPRPexBuNghlc7PfcPIyFis2LJXDRMWiAd3TcfdALwRsuKMR/T+cwyr\n" + - "asy69OEGHplLT57otQ524BDctDXNzlH9bHEh52QzqkWvIDqs42910IUy1nYNPIUG\n" + - "yYJV/T7H8Jb6vfMZWe47iUFvtNZCi8+b542gRUwdi+ca+hGviBC9Qr4Wv1pl7CBQ\n" + - "Hy1axTkHiQawUo/hgmoetCpftugl9yJTfvsBorUV1ZMxn9B1JLSGtWnbUsFRla7G\n" + - "fNa0IsUkzmmha8XCzvNu0d1PDGtcQyUqmDOE1Hx4cIBeuF8ipuIXkrVCr9zAZ4ZC\n" + - "hgz6aA1gDTW8whSRJqYEYEQ0pcMEFLyXE+Nz3O8NinO2AuxqKhjMk13203xA7lPY\n" + - "MnBQ0v7S3qqbp/pvPMiUhOz/VaYted6QmOY5EATBnFiLCuw87JXoAyp382eJ3WX1\n" + - "hOiR4IX9Tg==\n" + - "-----END CERTIFICATE-----"; - - // The fraudulent certificate issued by above compromised CA - static String targetCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdp\n" + - "Tm90YXIgUHVibGljIENBIDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5v\n" + - "dGFyLm5sMB4XDTExMDcxMDE5MDYzMFoXDTEzMDcwOTE5MDYzMFowajELMAkGA1UE\n" + - "BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxFjAUBgNVBAcTDU1vdW50YWluIFZp\n" + - "ZXcxFzAVBgNVBAUTDlBLMDAwMjI5MjAwMDAyMRUwEwYDVQQDEwwqLmdvb2dsZS5j\n" + - "b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNbeKubCV0aCxhOiOS\n" + - "CSQ/w9HXTYuD5BLKuiqXNw3setdTymeJz2L8aWOHo3nicFNDVwWTgwWomGNr2J6Q\n" + - "7g1iINNSW0rR4E1l2szRkcnAY6c6i/Eke93nF4i2hDsnIBveolF5yjpuRm73uQQD\n" + - "ulHjA3BFRF/PTi0fw2/Yt+8ieoMuNcMWN6Eou5Gqt5YZkWv176ofeCbsBmMrP87x\n" + - "OhhtTDckCapk4VQZG2XrfzZcV6tdzCp5TI8uHdu17cdzXm1imZ8tyvzFeiCEOQN8\n" + - "vPNzB/fIr3CJQ5q4uM5aKT3DD5PeVzf4rfJKQNgCTWiIBc9XcWEUuszwAsnmg7e2\n" + - "EJRdAgMBAAGjggHMMIIByDA6BggrBgEFBQcBAQQuMCwwKgYIKwYBBQUHMAGGHmh0\n" + - "dHA6Ly92YWxpZGF0aW9uLmRpZ2lub3Rhci5ubDAfBgNVHSMEGDAWgBTfM8Cvkv43\n" + - "/LbYFhbQ2bGR1fpupTAJBgNVHRMEAjAAMIHGBgNVHSAEgb4wgbswgbgGDmCEEAGH\n" + - "aQEBAQIEAQICMIGlMCcGCCsGAQUFBwIBFhtodHRwOi8vd3d3LmRpZ2lub3Rhci5u\n" + - "bC9jcHMwegYIKwYBBQUHAgIwbhpsQ29uZGl0aW9ucywgYXMgbWVudGlvbmVkIG9u\n" + - "IG91ciB3ZWJzaXRlICh3d3cuZGlnaW5vdGFyLm5sKSwgYXJlIGFwcGxpY2FibGUg\n" + - "dG8gYWxsIG91ciBwcm9kdWN0cyBhbmQgc2VydmljZXMuMEkGA1UdHwRCMEAwPqA8\n" + - "oDqGOGh0dHA6Ly9zZXJ2aWNlLmRpZ2lub3Rhci5ubC9jcmwvcHVibGljMjAyNS9s\n" + - "YXRlc3RDUkwuY3JsMA4GA1UdDwEB/wQEAwIEsDAbBgNVHREEFDASgRBhZG1pbkBn\n" + - "b29nbGUuY29tMB0GA1UdDgQWBBQHSn0WJzIo0eMBMQUNsMqN6eF/7TANBgkqhkiG\n" + - "9w0BAQUFAAOCAQEAAs5dL7N9wzRJkI4Aq4lC5t8j5ZadqnqUcgYLADzSv4ExytNH\n" + - "UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB\n" + - "pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM\n" + - "FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum\n" + - "U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK\n" + - "baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg==\n" + - "-----END CERTIFICATE-----"; - - public static void main(String args[]) throws Exception { - - Exception reservedException = null; - try { - build(); - } catch (CertPathBuilderException cpbe) { - reservedException = cpbe; - } - - if (reservedException == null) { - throw new Exception("Unable to block fraudulent certificate"); - } - - System.out.println( - "The expected untrusted cert exception: " + reservedException); - } - - private static X509CertSelector generateSelector() throws Exception { - - // generate certificate from cert strings - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - X509Certificate target = null; - try (ByteArrayInputStream is = - new ByteArrayInputStream(targetCertStr.getBytes())) { - target = (X509Certificate)cf.generateCertificate(is); - } - - X509CertSelector selector = new X509CertSelector(); - selector.setCertificate(target); - selector.setSubject(target.getSubjectX500Principal()); - - return selector; - } - - - private static CertStore generateCertificateStore() throws Exception { - - // generate certificate from cert strings - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - // generate certification path - Set<Certificate> entries = new HashSet(); - - try (ByteArrayInputStream is = - new ByteArrayInputStream(targetCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(intermediateCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(compromisedCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(untrustedCrossCertStr.getBytes())) { - entries.add(cf.generateCertificate(is)); - } - - return CertStore.getInstance("Collection", - new CollectionCertStoreParameters(entries)); - } - - private static Set<TrustAnchor> generateTrustAnchors() - throws CertificateException, IOException { - // generate certificate from cert string - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - Certificate trustedCert = null; - try (ByteArrayInputStream is = - new ByteArrayInputStream(trustedCertStr.getBytes())) { - trustedCert = cf.generateCertificate(is); - } - - // generate a trust anchor - TrustAnchor anchor = - new TrustAnchor((X509Certificate)trustedCert, null); - - return Collections.singleton(anchor); - } - - private static void build() throws Exception { - X509CertSelector selector = generateSelector(); - Set<TrustAnchor> anchors = generateTrustAnchors(); - CertStore certs = generateCertificateStore(); - - SunCertPathBuilderParameters params = - new SunCertPathBuilderParameters(anchors, selector); - params.setBuildForward(false); - params.addCertStore(certs); - params.setRevocationEnabled(false); - params.setDate(new Date(111, 11, 25)); // 2011-12-25 - - CertPathBuilder builder = CertPathBuilder.getInstance("PKIX"); - PKIXCertPathBuilderResult result = - (PKIXCertPathBuilderResult)builder.build(params); - } -} -
--- a/test/sun/security/provider/certpath/X509CertPath/ValidateCompromised.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 7123519 - * @summary Problem with java/classes_security - */ - -import java.net.*; -import java.util.*; -import java.io.*; -import javax.net.ssl.*; -import java.security.KeyStore; -import java.security.cert.*; -import java.security.spec.*; -import java.security.interfaces.*; - -public class ValidateCompromised { - // DigiNotar Root CA, untrusted root certificate - static String trustedCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1\n" + - "MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE\n" + - "ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j\n" + - "b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF\n" + - "bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg\n" + - "U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA\n" + - "A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/\n" + - "I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3\n" + - "wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC\n" + - "AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb\n" + - "oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5\n" + - "BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p\n" + - "dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk\n" + - "MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp\n" + - "b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu\n" + - "dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0\n" + - "MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi\n" + - "E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa\n" + - "MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI\n" + - "hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN\n" + - "95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd\n" + - "2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Root CA, untrusted cross-certificate - static String untrustedCrossCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n" + - "VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n" + - "ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n" + - "KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n" + - "ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3\n" + - "MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n" + - "EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI\n" + - "hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n" + - "ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt\n" + - "OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx\n" + - "hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7\n" + - "gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D\n" + - "IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T\n" + - "BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs\n" + - "Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8\n" + - "5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf\n" + - "DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX\n" + - "9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e\n" + - "7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj\n" + - "ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB\n" + - "BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF\n" + - "BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD\n" + - "VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy\n" + - "bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G\n" + - "A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob\n" + - "BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh\n" + - "xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n" + - "ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n" + - "ZFdYf+hthc3m6IcJ\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Root CA, compromised certificate - static String compromisedCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n" + - "Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n" + - "HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES\n" + - "MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg\n" + - "MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB\n" + - "AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B\n" + - "8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY\n" + - "tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl\n" + - "HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj\n" + - "zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3AlnU\n" + - "JgEbjt+tUwbRrhjd4rI6y9eIOI6sWym5GdOY+RgDz0iChmYLG2kPyes4iHomGgVM\n" + - "ktck1JbyrFIto0fVUvY//s6EBnCmqj6i8rZWNBhXouSBbefK8GrTx5FrAoNBfBXv\n" + - "a5pkXuPQPOWx63tdhvvL5ndJzaNl3Pe5nLjkC1+Tz8wwGjIczhxjlaX56uF0i57p\n" + - "K6kwe6AYHw4YC+VbqdPRbB4HZ4+RS6mKvNJmqpMBiLKR+jFc1abBUggJzQpjotMi\n" + - "puih2TkGl/VujQKQjBR7P4DNG5y6xFhyI6+2Vp/GekIzKQc/gsnmHwUNzUwoNovT\n" + - "yD4cxojvXu6JZOkd69qJfjKmadHdzIif0dDJZiHcBmfFlHqabWJMfczgZICynkeO\n" + - "owIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" + - "HQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wDQYJKoZIhvcNAQEFBQADggIBADsC\n" + - "jcs8MOhuoK3yc7NfniUTBAXT9uOLuwt5zlPe5JbF0a9zvNXD0EBVfEB/zRtfCdXy\n" + - "fJ9oHbtdzno5wozWmHvFg1Wo1X1AyuAe94leY12hE8JdiraKfADzI8PthV9xdvBo\n" + - "Y6pFITlIYXg23PFDk9Qlx/KAZeFTAnVR/Ho67zerhChXDNjU1JlWbOOi/lmEtDHo\n" + - "M/hklJRRl6s5xUvt2t2AC298KQ3EjopyDedTFLJgQT2EkTFoPSdE2+Xe9PpjRchM\n" + - "Ppj1P0G6Tss3DbpmmPHdy59c91Q2gmssvBNhl0L4eLvMyKKfyvBovWsdst+Nbwed\n" + - "2o5nx0ceyrm/KkKRt2NTZvFCo+H0Wk1Ya7XkpDOtXHAd3ODy63MUkZoDweoAZbwH\n" + - "/M8SESIsrqC9OuCiKthZ6SnTGDWkrBFfGbW1G/8iSlzGeuQX7yCpp/Q/rYqnmgQl\n" + - "nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE\n" + - "O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU\n" + - "9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9\n" + - "j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr\n" + - "-----END CERTIFICATE-----"; - - // DigiNotar Public CA 2025, intermediate certificate - static String intermediateCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIGAzCCA+ugAwIBAgIQHn16Uz1FMEGWQA9xSB9FBDANBgkqhkiG9w0BAQUFADBf\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n" + - "Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n" + - "HhcNMDYwMjA2MTYwNzAyWhcNMjUwMzI4MTYwNzAyWjBmMQswCQYDVQQGEwJOTDES\n" + - "MBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdpTm90YXIgUHVibGljIENB\n" + - "IDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5vdGFyLm5sMIIBIjANBgkq\n" + - "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/2eu/I5fMG8lbvPph3e8zfJpZQtg/72\n" + - "Yx29+ivtKehiF6A3n785XyoY6IT3vlCrhy1CbMOY3M0x1n4YQlv17B0XZ/DqHyBA\n" + - "SQvnDNbkM9j4NoSy/sRtGsP6PetIFFjrhE9whZuvuSUC1PY4PruEEJp8zOCx4+wU\n" + - "Zt9xvjy4Xra+bSia5rwccQ/R5FYTGKrYCthOy9C9ud5Fhd++rlVhgdA/78w+Cs2s\n" + - "xS4i0MAxG75P3/e/bATJKepbydHdDjkyz9o3RW/wdPUXhzEw4EwUjYg6XJrDzMad\n" + - "6aL9M/eaxDjgz6o48EaWRDrGptaE2uJRuErVz7oOO0p/wYKq/BU+/wIDAQABo4IB\n" + - "sjCCAa4wOgYIKwYBBQUHAQEELjAsMCoGCCsGAQUFBzABhh5odHRwOi8vdmFsaWRh\n" + - "dGlvbi5kaWdpbm90YXIubmwwHwYDVR0jBBgwFoAUiGi/4I41xDs4a2L3KDuEgcgM\n" + - "100wEgYDVR0TAQH/BAgwBgEB/wIBADCBxgYDVR0gBIG+MIG7MIG4Bg5ghBABh2kB\n" + - "AQEBBQIGBDCBpTAnBggrBgEFBQcCARYbaHR0cDovL3d3dy5kaWdpbm90YXIubmwv\n" + - "Y3BzMHoGCCsGAQUFBwICMG4abENvbmRpdGlvbnMsIGFzIG1lbnRpb25lZCBvbiBv\n" + - "dXIgd2Vic2l0ZSAod3d3LmRpZ2lub3Rhci5ubCksIGFyZSBhcHBsaWNhYmxlIHRv\n" + - "IGFsbCBvdXIgcHJvZHVjdHMgYW5kIHNlcnZpY2VzLjBDBgNVHR8EPDA6MDigNqA0\n" + - "hjJodHRwOi8vc2VydmljZS5kaWdpbm90YXIubmwvY3JsL3Jvb3QvbGF0ZXN0Q1JM\n" + - "LmNybDAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFN8zwK+S/jf8ttgWFtDZsZHV\n" + - "+m6lMA0GCSqGSIb3DQEBBQUAA4ICAQCfV1rmBd9QStEyQ40lT0tqby0/3ez0STuJ\n" + - "ESBQLQD56XYdb4VFSuqA6xTtiuSVHLoiv2xyISN9FvX3A5VtifkJ00JEaLQJiSsE\n" + - "wGDkYGl1DT7SsqtAVKdMAuCM+e0j0/RV3hZ6kcrM7/wFccHwM+/TiurR9lgZDzB4\n" + - "a7++A4XrYyKx9vc9ZwBEnD1nrAe7++gg9cuZgP7e+QL0FBHMjpw+gnCDjr2dzBZC\n" + - "4r+b8SOqlbPRPexBuNghlc7PfcPIyFis2LJXDRMWiAd3TcfdALwRsuKMR/T+cwyr\n" + - "asy69OEGHplLT57otQ524BDctDXNzlH9bHEh52QzqkWvIDqs42910IUy1nYNPIUG\n" + - "yYJV/T7H8Jb6vfMZWe47iUFvtNZCi8+b542gRUwdi+ca+hGviBC9Qr4Wv1pl7CBQ\n" + - "Hy1axTkHiQawUo/hgmoetCpftugl9yJTfvsBorUV1ZMxn9B1JLSGtWnbUsFRla7G\n" + - "fNa0IsUkzmmha8XCzvNu0d1PDGtcQyUqmDOE1Hx4cIBeuF8ipuIXkrVCr9zAZ4ZC\n" + - "hgz6aA1gDTW8whSRJqYEYEQ0pcMEFLyXE+Nz3O8NinO2AuxqKhjMk13203xA7lPY\n" + - "MnBQ0v7S3qqbp/pvPMiUhOz/VaYted6QmOY5EATBnFiLCuw87JXoAyp382eJ3WX1\n" + - "hOiR4IX9Tg==\n" + - "-----END CERTIFICATE-----"; - - // The fraudulent certificate issued by above compromised CA - static String targetCertStr = - "-----BEGIN CERTIFICATE-----\n" + - "MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm\n" + - "MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdp\n" + - "Tm90YXIgUHVibGljIENBIDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5v\n" + - "dGFyLm5sMB4XDTExMDcxMDE5MDYzMFoXDTEzMDcwOTE5MDYzMFowajELMAkGA1UE\n" + - "BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxFjAUBgNVBAcTDU1vdW50YWluIFZp\n" + - "ZXcxFzAVBgNVBAUTDlBLMDAwMjI5MjAwMDAyMRUwEwYDVQQDEwwqLmdvb2dsZS5j\n" + - "b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNbeKubCV0aCxhOiOS\n" + - "CSQ/w9HXTYuD5BLKuiqXNw3setdTymeJz2L8aWOHo3nicFNDVwWTgwWomGNr2J6Q\n" + - "7g1iINNSW0rR4E1l2szRkcnAY6c6i/Eke93nF4i2hDsnIBveolF5yjpuRm73uQQD\n" + - "ulHjA3BFRF/PTi0fw2/Yt+8ieoMuNcMWN6Eou5Gqt5YZkWv176ofeCbsBmMrP87x\n" + - "OhhtTDckCapk4VQZG2XrfzZcV6tdzCp5TI8uHdu17cdzXm1imZ8tyvzFeiCEOQN8\n" + - "vPNzB/fIr3CJQ5q4uM5aKT3DD5PeVzf4rfJKQNgCTWiIBc9XcWEUuszwAsnmg7e2\n" + - "EJRdAgMBAAGjggHMMIIByDA6BggrBgEFBQcBAQQuMCwwKgYIKwYBBQUHMAGGHmh0\n" + - "dHA6Ly92YWxpZGF0aW9uLmRpZ2lub3Rhci5ubDAfBgNVHSMEGDAWgBTfM8Cvkv43\n" + - "/LbYFhbQ2bGR1fpupTAJBgNVHRMEAjAAMIHGBgNVHSAEgb4wgbswgbgGDmCEEAGH\n" + - "aQEBAQIEAQICMIGlMCcGCCsGAQUFBwIBFhtodHRwOi8vd3d3LmRpZ2lub3Rhci5u\n" + - "bC9jcHMwegYIKwYBBQUHAgIwbhpsQ29uZGl0aW9ucywgYXMgbWVudGlvbmVkIG9u\n" + - "IG91ciB3ZWJzaXRlICh3d3cuZGlnaW5vdGFyLm5sKSwgYXJlIGFwcGxpY2FibGUg\n" + - "dG8gYWxsIG91ciBwcm9kdWN0cyBhbmQgc2VydmljZXMuMEkGA1UdHwRCMEAwPqA8\n" + - "oDqGOGh0dHA6Ly9zZXJ2aWNlLmRpZ2lub3Rhci5ubC9jcmwvcHVibGljMjAyNS9s\n" + - "YXRlc3RDUkwuY3JsMA4GA1UdDwEB/wQEAwIEsDAbBgNVHREEFDASgRBhZG1pbkBn\n" + - "b29nbGUuY29tMB0GA1UdDgQWBBQHSn0WJzIo0eMBMQUNsMqN6eF/7TANBgkqhkiG\n" + - "9w0BAQUFAAOCAQEAAs5dL7N9wzRJkI4Aq4lC5t8j5ZadqnqUcgYLADzSv4ExytNH\n" + - "UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB\n" + - "pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM\n" + - "FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum\n" + - "U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK\n" + - "baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg==\n" + - "-----END CERTIFICATE-----"; - - public static void main(String args[]) throws Exception { - - Exception reservedException = null; - try { - validate(); - } catch (CertPathValidatorException cpve) { - reservedException = cpve; - } - - if (reservedException == null) { - throw new Exception("Unable to block fraudulent certificate"); - } - - System.out.println( - "The expected untrusted cert exception: " + reservedException); - } - - private static CertPath generateCertificatePath() - throws CertificateException, IOException { - - // generate certificate from cert strings - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - // generate certification path - List<Certificate> list = new ArrayList(); - - try (ByteArrayInputStream is = - new ByteArrayInputStream(targetCertStr.getBytes())) { - list.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(intermediateCertStr.getBytes())) { - list.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(compromisedCertStr.getBytes())) { - list.add(cf.generateCertificate(is)); - } - - try (ByteArrayInputStream is = - new ByteArrayInputStream(untrustedCrossCertStr.getBytes())) { - list.add(cf.generateCertificate(is)); - } - - return cf.generateCertPath(list); - } - - private static Set<TrustAnchor> generateTrustAnchors() - throws CertificateException, IOException { - // generate certificate from cert string - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - Certificate trustedCert = null; - try (ByteArrayInputStream is = - new ByteArrayInputStream(trustedCertStr.getBytes())) { - trustedCert = cf.generateCertificate(is); - } - - // generate a trust anchor - TrustAnchor anchor = - new TrustAnchor((X509Certificate)trustedCert, null); - - return Collections.singleton(anchor); - } - - private static void validate() - throws CertPathValidatorException, Exception { - - CertPath path = generateCertificatePath(); - Set<TrustAnchor> anchors = generateTrustAnchors(); - - PKIXParameters params = new PKIXParameters(anchors); - - // disable certificate revocation checking - params.setRevocationEnabled(false); - - // set the validation time - params.setDate(new Date(111, 11, 25)); // 2011-12-25 - - CertPathValidator validator = CertPathValidator.getInstance("PKIX"); - - validator.validate(path, params); - } -} -
--- a/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -40,28 +40,32 @@ TrustManagerFactory tmf; KeyManagerFactory kmf; - Security.addProvider(new MyProvider()); - - System.out.println("getting a javax SSLContext"); - sslc = SSLContext.getInstance("javax"); - sslc.init(null, null, null); - System.out.println("\ngetting a com SSLContext"); - sslc = SSLContext.getInstance("com"); - sslc.init(null, null, null); + Provider extraProvider = new MyProvider(); + Security.addProvider(extraProvider); + try { + System.out.println("getting a javax SSLContext"); + sslc = SSLContext.getInstance("javax"); + sslc.init(null, null, null); + System.out.println("\ngetting a com SSLContext"); + sslc = SSLContext.getInstance("com"); + sslc.init(null, null, null); - System.out.println("\ngetting a javax TrustManagerFactory"); - tmf = TrustManagerFactory.getInstance("javax"); - tmf.init((KeyStore) null); - System.out.println("\ngetting a com TrustManagerFactory"); - tmf = TrustManagerFactory.getInstance("com"); - tmf.init((KeyStore) null); + System.out.println("\ngetting a javax TrustManagerFactory"); + tmf = TrustManagerFactory.getInstance("javax"); + tmf.init((KeyStore) null); + System.out.println("\ngetting a com TrustManagerFactory"); + tmf = TrustManagerFactory.getInstance("com"); + tmf.init((KeyStore) null); - System.out.println("\ngetting a javax KeyManagerFactory"); - kmf = KeyManagerFactory.getInstance("javax"); - kmf.init((KeyStore) null, null); - System.out.println("\ngetting a com KeyManagerFactory"); - kmf = KeyManagerFactory.getInstance("com"); - kmf.init((KeyStore) null, null); + System.out.println("\ngetting a javax KeyManagerFactory"); + kmf = KeyManagerFactory.getInstance("javax"); + kmf.init((KeyStore) null, null); + System.out.println("\ngetting a com KeyManagerFactory"); + kmf = KeyManagerFactory.getInstance("com"); + kmf.init((KeyStore) null, null); + } finally { + Security.removeProvider(extraProvider.getName()); + } } }
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadBlocksClose.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadBlocksClose.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to +// re-use system properties in samevm/agentvm mode. +// + /* * @test * @bug 4814140 * @summary AppInputStream: read can block a close + * @run main/othervm ReadBlocksClose * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadHandshake.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadHandshake.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4514971 * @summary Verify applications do not read handshake data after failure + * @run main/othervm ReadHandshake */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadZeroBytes.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/ReadZeroBytes.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6697270 * @summary Inputstream dosent behave correct + * @run main/othervm ReadZeroBytes */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/RemoveMarkReset.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppInputStream/RemoveMarkReset.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4413664 * @summary remove mark/reset functionality from AppInputStream + * @run main/othervm RemoveMarkReset * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppOutputStream/NoExceptionOnClose.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/AppOutputStream/NoExceptionOnClose.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test 1.3 01/03/08 * @bug 4378397 * @summary JSSE socket output stream doesn't throw after socket is closed + * @run main/othervm NoExceptionOnClose * @author Jaya Hangal */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/CipherSuiteOrder.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/CipherSuiteOrder.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test 1.3 01/03/08 * @bug 4330535 * @summary Client should follow suite order in * SSLSocket.setEnabledCipherSuites() + * @run main/othervm CipherSuiteOrder * @author Jaya Hangal */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6690018 * @summary RSAClientKeyExchange NullPointerException + * @run main/othervm RSAExport */ /*
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java Fri Jun 21 15:46:14 2013 -0500 @@ -5,8 +5,13 @@ * @summary Make sure that different configurations of SSL sockets work */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/HandshakeOutStream/NullCerts.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/HandshakeOutStream/NullCerts.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4453053 - * @summary If a server shuts down correctly during handshaking, the client doesn't see it. + * @summary If a server shuts down correctly during handshaking, the client + * doesn't see it. + * @run main/othervm NullCerts * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/ClientHelloRead.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/ClientHelloRead.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4432868 * @summary A client-hello message may not always be read correctly + * @run main/othervm ClientHelloRead */ import java.io.*; @@ -154,23 +160,29 @@ * we want to avoid URLspoofCheck failures in cases where the cert * DN name does not match the hostname in the URL. */ - HttpsURLConnection.setDefaultHostnameVerifier( - new NameVerifier()); - URL url = new URL("https://" + "localhost:" + serverPort - + "/index.html"); - BufferedReader in = null; + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { - in = new BufferedReader(new InputStreamReader( - url.openStream())); - String inputLine; - System.out.print("Client recieved from the server: "); - while ((inputLine = in.readLine()) != null) - System.out.println(inputLine); - in.close(); - } catch (SSLException e) { - if (in != null) + HttpsURLConnection.setDefaultHostnameVerifier( + new NameVerifier()); + URL url = new URL("https://" + "localhost:" + serverPort + + "/index.html"); + BufferedReader in = null; + try { + in = new BufferedReader(new InputStreamReader( + url.openStream())); + String inputLine; + System.out.print("Client recieved from the server: "); + while ((inputLine = in.readLine()) != null) + System.out.println(inputLine); in.close(); - throw e; + } catch (SSLException e) { + if (in != null) + in.close(); + throw e; + } + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } }
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,13 +21,18 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4456039 * @summary Setting timeouts on SSLSockets immediately return null * after timeout occurs. This bug was fixed as part of 4393337, * but this is another bug we want to check regressions against. - * @run main/timeout=140 SSLSocketTimeoutNulls + * @run main/othervm/timeout=140 SSLSocketTimeoutNulls * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ProtocolVersion/HttpsProtocols.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ProtocolVersion/HttpsProtocols.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -147,12 +147,18 @@ Thread.sleep(50); } - HttpsURLConnection.setDefaultHostnameVerifier(this); + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + HttpsURLConnection.setDefaultHostnameVerifier(this); - URL url = new URL("https://localhost:" + serverPort + "/"); - HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); + URL url = new URL("https://localhost:" + serverPort + "/"); + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); - System.out.println("response is " + urlc.getResponseCode()); + System.out.println("response is " + urlc.getResponseCode()); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); + } } public boolean verify(String hostname, SSLSession session) {
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadKSProvider.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadKSProvider.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4919147 * @summary Support for token-based KeyStores + * @run main/othervm BadKSProvider */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadTSProvider.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/BadTSProvider.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4919147 * @summary Support for token-based KeyStores + * @run main/othervm BadTSProvider */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/GoodProvider.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/GoodProvider.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4919147 * @summary Support for token-based KeyStores + * @run main/othervm GoodProvider */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/RehandshakeFinished.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/RehandshakeFinished.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,24 +21,31 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6207322 * @summary SSLEngine is returning a premature FINISHED message when doing * an abbreviated handshake. - * + * @run main/othervm RehandshakeFinished + * @author Brad Wetmore + */ + +/* * This test may need some updating if the messages change order. * Currently I'm expecting that there is a simple renegotiation, with * each message being contained in a single SSL packet. * - * ClientHello - * Server Hello - * CCS - * FINISHED - * CCS - * FINISHED - * - * @author Brad Wetmore + * ClientHello + * Server Hello + * CCS + * FINISHED + * CCS + * FINISHED */ /**
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6492872 * @summary Deadlock in SSLEngine - * + * @run main/othervm SSLEngineDeadlock * @author Brad R. Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSessionImpl/HashCodeMissing.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSessionImpl/HashCodeMissing.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4910892 * @summary 4518403 was not properly fixed. hashcode should be hashCode. + * @run main/othervm HashCodeMissing * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6447412 * @summary Issue with socket.close() for ssl sockets when poweroff on * other system + * @run main/othervm AsyncSSLSocketClose */ import javax.net.ssl.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientModeClientAuth.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientModeClientAuth.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4390659 - * @run main/othervm -Djavax.net.debug=all ClientModeClientAuth * @summary setNeedClientAuth() isn't working after a handshaker is established + * @run main/othervm ClientModeClientAuth * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4836493 * @summary Socket timeouts for SSLSockets causes data corruption. + * @run main/othervm ClientTimeout */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/CloseSocketException.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/CloseSocketException.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,16 +21,23 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4969799 * @summary javax.net.ssl.SSLSocket.SSLSocket(InetAddress,int) shouldn't * throw exception - * + * @run main/othervm CloseSocketException + * @author Brad Wetmore + */ + +/* * This is making sure that starting a new handshake throws the right * exception. There is a similar test for SSLEngine. - * - * @author Brad Wetmore */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4403428 * @summary Invalidating JSSE session on server causes SSLProtocolException + * @run main/othervm InvalidateServerSessionRenegotiate * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NewSocketMethods.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NewSocketMethods.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4429176 * @summary need to sync up SSL sockets with merlin java.net changes + * @run main/othervm NewSocketMethods */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NonAutoClose.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NonAutoClose.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4404399 * @summary When a layered SSL socket is closed, it should wait for close_notify + * @run main/othervm NonAutoClose * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReuseAddr.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReuseAddr.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4482446 * @summary java.net.SocketTimeoutException on 98, NT, 2000 for JSSE + * @run main/othervm ReuseAddr * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReverseNameLookup.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ReverseNameLookup.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4748292 * @summary Prevent/Disable reverse name lookups with JSSE SSL sockets + * @run main/othervm ReverseNameLookup */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4361124 4325806 * @summary SSLServerSocket isn't throwing exceptions when negotiations are * failing & java.net.SocketException: occures in Auth and clientmode + * @run main/othervm SSLSocketImplThrowsWrongExceptions * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4836493 * @summary Socket timeouts for SSLSockets causes data corruption. + * @run main/othervm ServerTimeout */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SetClientMode.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/SetClientMode.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6223624 * @summary SSLSocket.setUseClientMode() fails to throw expected * IllegalArgumentException + * @run main/othervm SetClientMode */ /*
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/UnconnectedSocketWrongExceptions.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/UnconnectedSocketWrongExceptions.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4480441 * @summary startHandshake giving wrong message when unconnected. + * @run main/othervm UnconnectedSocketWrongExceptions * @author Brad Wetmore */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/AnonCipherWithWantClientAuth.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/AnonCipherWithWantClientAuth.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4392475 * @summary Calling setWantClientAuth(true) disables anonymous suites - * @run main/timeout=180 AnonCipherWithWantClientAuth + * @run main/othervm/timeout=180 AnonCipherWithWantClientAuth */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHost.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ServerHandshaker/GetPeerHost.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /** - *@test - *@bug 4302026 - *@run main GetPeerHost - *@summary make sure the server side doesn't do DNS lookup. + * @test + * @bug 4302026 + * @run main/othervm GetPeerHost + * @summary make sure the server side doesn't do DNS lookup. */ import javax.net.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SocketCreation/SocketCreation.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SocketCreation/SocketCreation.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,13 +21,18 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4414843 * @summary This test tries all the different ways in which an SSL * connection can be established to exercise different SSLSocketImpl * constructors. - * @run main/timeout=300 SocketCreation + * @run main/othervm/timeout=300 SocketCreation */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/ClientServer.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/ClientServer.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4717766 * @summary 1.0.3 JsseX509TrustManager erroneously calls isClientTrusted() + * @run main/othervm ClientServer * @ignore JSSE supports algorithm constraints with CR 6916074, * need to update this test case in JDK 7 soon * @author Brad Wetmore
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/PKIXExtendedTM.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/PKIXExtendedTM.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// /* * @test * @bug 6916074 * @summary Add support for TLS 1.2 + * @run main/othervm PKIXExtendedTM */ import java.net.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SelfIssuedCert.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SelfIssuedCert.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6822460
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/SunX509ExtendedTM.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6916074 - * @run main/othervm -Djavax.net.debug=all SunX509ExtendedTM * @summary Add support for TLS 1.2 + * @run main/othervm SunX509ExtendedTM */ import java.net.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/X509ExtendedTMEnabled.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/X509TrustManagerImpl/X509ExtendedTMEnabled.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,12 +21,18 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// +// Ensure that the SunJSSE provider enables the X509ExtendedTrustManager. +// + /* * @test * @bug 6916074 * @summary Add support for TLS 1.2 - * - * Ensure that the SunJSSE provider enables the X509ExtendedTrustManager. + * @run main/othervm X509ExtendedTMEnabled */ import java.io.*;
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/spi/ProviderInit.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/spi/ProviderInit.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test 1.3 01/03/08 * @bug 4522550 * @summary SSLContext TrustMananagerFactory and KeyManagerFactory * should throw if not init + * @run main/othervm ProviderInit * @author Jaya Hangal */
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ProxyAuthTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ProxyAuthTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,11 @@ * @test * @bug 4323990 4413069 * @summary HttpsURLConnection doesn't send Proxy-Authorization on CONNECT - * Incorrect checking of proxy server response + * Incorrect checking of proxy server response + * @run main/othervm ProxyAuthTest + * + * No way to reserve and restore java.lang.Authenticator, need to run this + * test in othervm mode. */ import java.io.*; @@ -77,8 +81,7 @@ /* * Main method to create the server and the client */ - public static void main(String args[]) throws Exception - { + public static void main(String args[]) throws Exception { String keyFilename = System.getProperty("test.src", "./") + "/" + pathToStores + "/" + keyStoreFile; @@ -110,10 +113,9 @@ try { doClientSide(); } catch (Exception e) { - System.out.println("Client side failed: " + - e.getMessage()); + System.out.println("Client side failed: " + e.getMessage()); throw e; - } + } } private static ServerSocketFactory getServerSocketFactory
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ServerIdentityTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsClient/ServerIdentityTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4328195 * @summary Need to include the alternate subject DN for certs, * https should check for this + * @run main/othervm ServerIdentityTest * @author Yingxian Wang */ @@ -136,39 +142,45 @@ volatile Exception clientException = null; public static void main(String[] args) throws Exception { - for (int i = 0; i < keyStoreFiles.length; i++) { - String keyFilename = - System.getProperty("test.src", ".") + "/" + pathToStores + - "/" + keyStoreFiles[i]; - String trustFilename = - System.getProperty("test.src", ".") + "/" + pathToStores + - "/" + trustStoreFiles[i]; + SSLSocketFactory reservedSFactory = + HttpsURLConnection.getDefaultSSLSocketFactory(); + try { + for (int i = 0; i < keyStoreFiles.length; i++) { + String keyFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + keyStoreFiles[i]; + String trustFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + trustStoreFiles[i]; - System.setProperty("javax.net.ssl.keyStore", keyFilename); - System.setProperty("javax.net.ssl.keyStorePassword", passwd); - System.setProperty("javax.net.ssl.trustStore", trustFilename); - System.setProperty("javax.net.ssl.trustStorePassword", passwd); + System.setProperty("javax.net.ssl.keyStore", keyFilename); + System.setProperty("javax.net.ssl.keyStorePassword", passwd); + System.setProperty("javax.net.ssl.trustStore", trustFilename); + System.setProperty("javax.net.ssl.trustStorePassword", passwd); - if (debug) - System.setProperty("javax.net.debug", "all"); - SSLContext context = SSLContext.getInstance("SSL"); + if (debug) + System.setProperty("javax.net.debug", "all"); + SSLContext context = SSLContext.getInstance("SSL"); - KeyManager[] kms = new KeyManager[1]; - KeyStore ks = KeyStore.getInstance("JKS"); - FileInputStream fis = new FileInputStream(keyFilename); - ks.load(fis, passwd.toCharArray()); - fis.close(); - KeyManager km = new MyKeyManager(ks, passwd.toCharArray()); - kms[0] = km; - context.init(kms, null, null); - HttpsURLConnection.setDefaultSSLSocketFactory( - context.getSocketFactory()); + KeyManager[] kms = new KeyManager[1]; + KeyStore ks = KeyStore.getInstance("JKS"); + FileInputStream fis = new FileInputStream(keyFilename); + ks.load(fis, passwd.toCharArray()); + fis.close(); + KeyManager km = new MyKeyManager(ks, passwd.toCharArray()); + kms[0] = km; + context.init(kms, null, null); + HttpsURLConnection.setDefaultSSLSocketFactory( + context.getSocketFactory()); - /* - * Start the tests. - */ - System.out.println("Testing " + keyFilename); - new ServerIdentityTest(context, keyStoreFiles[i]); + /* + * Start the tests. + */ + System.out.println("Testing " + keyFilename); + new ServerIdentityTest(context, keyStoreFiles[i]); + } + } finally { + HttpsURLConnection.setDefaultSSLSocketFactory(reservedSFactory); } }
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/CriticalSubjectAltName.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/CriticalSubjectAltName.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6668231 * @summary Presence of a critical subjectAltName causes JSSE's SunX509 to * fail trusted checks + * @run main/othervm CriticalSubjectAltName * @author Xuelei Fan * * This test depends on binary keystore, crisubn.jks and trusted.jks. Because
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/GetResponseCode.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnection/GetResponseCode.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4482187 * @summary HttpsClient tests are failing for build 71 + * @run main/othervm GetResponseCode * @author Yingxian Wang */ import java.io.*;
--- a/test/sun/security/ssl/javax/net/ssl/Fix5070632.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/Fix5070632.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 5070632 * @summary Default SSLSockeFactory override createSocket() now + * @run main/othervm Fix5070632 * @author Weijun Wang */ @@ -35,8 +41,13 @@ public class Fix5070632 { public static void main(String[] args) throws Exception { + // reserve the security properties + String reservedSFacProvider = + Security.getProperty("ssl.SocketFactory.provider"); + // use a non-existing provider so that the DefaultSSLSocketFactory // will be used, and then test against it. + Security.setProperty("ssl.SocketFactory.provider", "foo.NonExistant"); SSLSocketFactory fac = (SSLSocketFactory)SSLSocketFactory.getDefault(); try { @@ -46,8 +57,16 @@ System.out.println("Throw SocketException"); se.printStackTrace(); return; + } finally { + // restore the security properties + if (reservedSFacProvider == null) { + reservedSFacProvider = ""; + } + Security.setProperty("ssl.SocketFactory.provider", + reservedSFacProvider); } + + // if not caught, or other exception caught, then it's error throw new Exception("should throw SocketException"); - // if not caught, or other exception caught, then it's error } }
--- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ComURLNulls.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ComURLNulls.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,12 +21,18 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4387882 4451038 * @summary Need to revisit the javadocs for JSSE, especially the * promoted classes, and HttpsURLConnection.getCipherSuite throws * NullPointerException + * @run main/othervm ComURLNulls * @author Brad Wetmore */ @@ -34,6 +40,7 @@ import java.io.*; import javax.net.ssl.*; import com.sun.net.ssl.HttpsURLConnection; +import com.sun.net.ssl.HostnameVerifier; /* * Tests that the com null argument changes made it in ok. @@ -42,59 +49,64 @@ public class ComURLNulls { public static void main(String[] args) throws Exception { - - System.setProperty("java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - /** - * This test does not establish any connection to the specified - * URL, hence a dummy URL is used. - */ - URL foobar = new URL("https://example.com/"); - - HttpsURLConnection urlc = - (HttpsURLConnection) foobar.openConnection(); - - try { - urlc.getCipherSuite(); - } catch (IllegalStateException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } - - try { - urlc.getServerCertificateChain(); - } catch (IllegalStateException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } - + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { - urlc.setDefaultHostnameVerifier(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } + System.setProperty("java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + /** + * This test does not establish any connection to the specified + * URL, hence a dummy URL is used. + */ + URL foobar = new URL("https://example.com/"); + + HttpsURLConnection urlc = + (HttpsURLConnection) foobar.openConnection(); - try { - urlc.setHostnameVerifier(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } + try { + urlc.getCipherSuite(); + } catch (IllegalStateException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.getServerCertificateChain(); + } catch (IllegalStateException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } - try { - urlc.setDefaultSSLSocketFactory(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } + try { + urlc.setDefaultHostnameVerifier(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.setHostnameVerifier(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } - try { - urlc.setSSLSocketFactory(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception"); - System.out.println(e.getMessage()); + try { + urlc.setDefaultSSLSocketFactory(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.setSSLSocketFactory(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception"); + System.out.println(e.getMessage()); + } + System.out.println("TESTS PASSED"); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } - System.out.println("TESTS PASSED"); } }
--- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ImplicitHandshake.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/ImplicitHandshake.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4387882 * @summary Need to revisit the javadocs for JSSE, especially the * promoted classes. + * @run main/othervm ImplicitHandshake * @author Brad Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/JavaxURLNulls.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/JavaxURLNulls.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,63 +42,69 @@ public static void main(String[] args) throws Exception { - /** - * This test does not establish any connection to the specified - * URL, hence a dummy URL is used. - */ - URL foobar = new URL("https://example.com/"); - - HttpsURLConnection urlc = - (HttpsURLConnection) foobar.openConnection(); - + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { - urlc.getCipherSuite(); - } catch (IllegalStateException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } + /** + * This test does not establish any connection to the specified + * URL, hence a dummy URL is used. + */ + URL foobar = new URL("https://example.com/"); + + HttpsURLConnection urlc = + (HttpsURLConnection) foobar.openConnection(); + + try { + urlc.getCipherSuite(); + } catch (IllegalStateException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.getLocalCertificates(); + } catch (IllegalStateException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.getServerCertificates(); + } catch (IllegalStateException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } - try { - urlc.getLocalCertificates(); - } catch (IllegalStateException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } + try { + urlc.setDefaultHostnameVerifier(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.setHostnameVerifier(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } - try { - urlc.getServerCertificates(); - } catch (IllegalStateException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); + try { + urlc.setDefaultSSLSocketFactory(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + + try { + urlc.setSSLSocketFactory(null); + } catch (IllegalArgumentException e) { + System.out.print("Caught proper exception: "); + System.out.println(e.getMessage()); + } + System.out.println("TESTS PASSED"); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } - - try { - urlc.setDefaultHostnameVerifier(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } - - try { - urlc.setHostnameVerifier(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } - - try { - urlc.setDefaultSSLSocketFactory(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } - - try { - urlc.setSSLSocketFactory(null); - } catch (IllegalArgumentException e) { - System.out.print("Caught proper exception: "); - System.out.println(e.getMessage()); - } - System.out.println("TESTS PASSED"); } }
--- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSessionNulls.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSessionNulls.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4387882 * @summary Need to revisit the javadocs for JSSE, especially the * promoted classes. + * @run main/othervm SSLSessionNulls * @author Brad Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSocketInherit.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/FixingJavadocs/SSLSocketInherit.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,12 +21,18 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4387882 * @summary Need to revisit the javadocs for JSSE, especially the * promoted classes. This test checks to see if the settings * on the server sockets get propagated to the sockets. + * @run main/othervm SSLSocketInherit * @author Brad Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/CheckMyTrustedKeystore.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/CheckMyTrustedKeystore.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4329114 * @summary Need better way of reflecting the reason when a chain is * rejected as untrusted. + * @run main/othervm CheckMyTrustedKeystore * @ignore JSSE supports algorithm constraints with CR 6916074, * need to update this test case in JDK 7 soon * This is a serious hack job!
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/HttpsURLConnectionLocalCertificateChain.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/HttpsURLConnectionLocalCertificateChain.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4395238 4354003 4387961 4395266 @@ -30,6 +35,7 @@ * Fixed 4354003: Need API to get client certificate chain * Fixed 4387961: HostnameVerifier needs to pass various hostnames * Fixed 4395266: HttpsURLConnection should be made protected + * @run main/othervm HttpsURLConnectionLocalCertificateChain * @author Brad Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/JSSERenegotiate.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/JSSERenegotiate.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,12 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4280338 * @summary "Unsupported SSL message version" SSLProtocolException * w/SSL_RSA_WITH_NULL_MD5 - * + * @run main/othervm JSSERenegotiate * @author Ram Marti * @author Brad Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/KeyManagerTrustManager.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/KeyManagerTrustManager.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4387949 4302197 4396290 4395286 @@ -35,6 +40,7 @@ * 4396290: Need a way to pass algorithm specific parameters to TM's and KM's * 4395286: The property for setting the default * KeyManagerFactory/TrustManagerFactory algorithms needs real name + * @run main/othervm KeyManagerTrustManager * @author Brad Wetmore */ @@ -77,17 +83,40 @@ String kmfAlg = null; String tmfAlg = null; - Security.setProperty("ssl.KeyManagerFactory.algorithm", "hello"); - Security.setProperty("ssl.TrustManagerFactory.algorithm", "goodbye"); + // reserve the security properties + String reservedKMFacAlg = + Security.getProperty("ssl.KeyManagerFactory.algorithm"); + String reservedTMFacAlg = + Security.getProperty("ssl.TrustManagerFactory.algorithm"); - kmfAlg = KeyManagerFactory.getDefaultAlgorithm(); - tmfAlg = TrustManagerFactory.getDefaultAlgorithm(); + try { + Security.setProperty("ssl.KeyManagerFactory.algorithm", "hello"); + Security.setProperty("ssl.TrustManagerFactory.algorithm", + "goodbye"); + + kmfAlg = KeyManagerFactory.getDefaultAlgorithm(); + tmfAlg = TrustManagerFactory.getDefaultAlgorithm(); - if (!kmfAlg.equals("hello")) { - throw new Exception("ssl.KeyManagerFactory.algorithm not set"); - } - if (!tmfAlg.equals("goodbye")) { - throw new Exception("ssl.TrustManagerFactory.algorithm not set"); + if (!kmfAlg.equals("hello")) { + throw new Exception("ssl.KeyManagerFactory.algorithm not set"); + } + if (!tmfAlg.equals("goodbye")) { + throw new Exception( + "ssl.TrustManagerFactory.algorithm not set"); + } + } finally { + // restore the security properties + if (reservedKMFacAlg == null) { + reservedKMFacAlg = ""; + } + + if (reservedTMFacAlg == null) { + reservedTMFacAlg = ""; + } + Security.setProperty("ssl.KeyManagerFactory.algorithm", + reservedKMFacAlg); + Security.setProperty("ssl.TrustManagerFactory.algorithm", + reservedTMFacAlg); } } }
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLCtxAccessToSessCtx.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4473210 * @summary SSLSessionContext should be accessible from SSLContext + * @run main/othervm SSLCtxAccessToSessCtx */ import java.io.*;
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/AcceptLargeFragments.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/AcceptLargeFragments.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,15 +21,22 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6388456 * @summary Need adjustable TLS max record size for interoperability * with non-compliant stacks - * + * @run main/othervm AcceptLargeFragments + * @author xuelei fan + */ + +/* * Check the system property "jsse.SSLEngine.acceptLargeFragments" - * - * @author xuelei fan */ import javax.net.ssl.SSLContext;
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/ExtendedKeySocket.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/ExtendedKeySocket.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4981697 * @summary Rework the X509KeyManager to avoid incompatibility issues + * @run main/othervm ExtendedKeySocket * @author Brad R. Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,13 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * * @bug 6388456 * @summary Need adjustable TLS max record size for interoperability * with non-compliant - * * @run main/othervm -Djsse.enableCBCProtection=false LargePacket * * @author Xuelei Fan
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/NoAuthClientAuth.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/NoAuthClientAuth.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4495742 * @summary Demonstrate SSLEngine switch from no client auth to client auth. - * + * @run main/othervm NoAuthClientAuth * @author Brad R. Wetmore */
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4366807 * @summary Need new APIs to get/set session timeout and session cache size. + * @run main/othervm SessionCacheSizeTests */ import java.io.*;
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4366807 * @summary Need new APIs to get/set session timeout and session cache size. + * @run main/othervm SessionTimeOutTests */ import java.io.*; @@ -207,7 +213,7 @@ timeout = sessCtx.getSessionTimeout(); System.out.println("timeout is changed to: " + timeout); System.out.println(); - } + } } // check the ids returned by the enumerator
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/testEnabledProtocols.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/testEnabledProtocols.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4416068 4478803 4479736 @@ -30,6 +35,7 @@ * session * 4701722 protocol mismatch exceptions should be consistent between * SSLv3 and TLSv1 + * @run main/othervm testEnabledProtocols * @author Ram Marti */
--- a/test/sun/security/ssl/javax/net/ssl/SSLServerSocket/DefaultSSLServSocketFac.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/SSLServerSocket/DefaultSSLServSocketFac.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /** * @test * @bug 6449579 * @summary DefaultSSLServerSocketFactory does not override createServerSocket() + * @run main/othervm DefaultSSLServSocketFac */ import java.security.Security; import javax.net.ServerSocketFactory; @@ -33,6 +39,10 @@ public class DefaultSSLServSocketFac { public static void main(String[] args) throws Exception { + // reserve the security properties + String reservedSSFacProvider = + Security.getProperty("ssl.ServerSocketFactory.provider"); + try { Security.setProperty("ssl.ServerSocketFactory.provider", "oops"); ServerSocketFactory ssocketFactory = @@ -44,6 +54,13 @@ throw e; } // get the expected exception + } finally { + // restore the security properties + if (reservedSSFacProvider == null) { + reservedSSFacProvider = ""; + } + Security.setProperty("ssl.ServerSocketFactory.provider", + reservedSSFacProvider); } } }
--- a/test/sun/security/ssl/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,12 +23,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4873188 * @summary Support TLS 1.1 - * @run main/othervm -Djavax.net.debug=all EmptyCertificateAuthorities - * + * @run main/othervm EmptyCertificateAuthorities * @author Xuelei Fan */
--- a/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableBlockCipher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableBlockCipher.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,12 +23,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4873188 * @summary Support TLS 1.1 - * @run main/othervm -Djavax.net.debug=all ExportableBlockCipher - * + * @run main/othervm ExportableBlockCipher * @author Xuelei Fan */
--- a/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableStreamCipher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/ExportableStreamCipher.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,12 +23,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4873188 * @summary Support TLS 1.1 - * @run main/othervm -Djavax.net.debug=all ExportableStreamCipher - * + * @run main/othervm ExportableStreamCipher * @author Xuelei Fan */
--- a/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericBlockCipher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericBlockCipher.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,12 +23,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4873188 * @summary Support TLS 1.1 - * @run main/othervm -Djavax.net.debug=all GenericBlockCipher - * + * @run main/othervm GenericBlockCipher * @author Xuelei Fan */
--- a/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericStreamCipher.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/javax/net/ssl/TLSv11/GenericStreamCipher.java Fri Jun 21 15:46:14 2013 -0500 @@ -23,12 +23,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4873188 * @summary Support TLS 1.1 - * @run main/othervm -Djavax.net.debug=all GenericStreamCipher - * + * @run main/othervm GenericStreamCipher * @author Xuelei Fan */
--- a/test/sun/security/ssl/sanity/pluggability/CheckSSLContextExport.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sanity/pluggability/CheckSSLContextExport.java Fri Jun 21 15:46:14 2013 -0500 @@ -64,8 +64,8 @@ default: throw new Exception("Internal Test Error!"); } - System.out.println("Testing with " + (standardCiphers ? "standard" : "custom") + - " cipher suites"); + System.out.println("Testing with " + + (standardCiphers ? "standard" : "custom") + " cipher suites"); for (int j = 0; j < 4; j++) { String clsName = null; try { @@ -107,11 +107,16 @@ public static void main(String[] argv) throws Exception { String protocols[] = { "SSL", "TLS" }; - Security.insertProviderAt(new CheckSSLContextExport(protocols), 1); - for (int i = 0; i < protocols.length; i++) { - System.out.println("Testing " + protocols[i] + "'s SSLContext"); - test(protocols[i]); + Provider extraProvider = new CheckSSLContextExport(protocols); + Security.insertProviderAt(extraProvider, 1); + try { + for (int i = 0; i < protocols.length; i++) { + System.out.println("Testing " + protocols[i] + "'s SSLContext"); + test(protocols[i]); + } + System.out.println("Test Passed"); + } finally { + Security.removeProvider(extraProvider.getName()); } - System.out.println("Test Passed"); } }
--- a/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport1.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport1.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4635454 6208022 * @summary Check pluggability of SSLSocketFactory and * SSLServerSocketFactory classes. + * @run main/othervm CheckSockFacExport1 */ import java.util.*; @@ -37,36 +43,57 @@ public class CheckSockFacExport1 { public static void main(String argv[]) throws Exception { - Security.setProperty("ssl.SocketFactory.provider", - "MySSLSocketFacImpl"); - MySSLSocketFacImpl.useCustomCipherSuites(); - Security.setProperty("ssl.ServerSocketFactory.provider", - "MySSLServerSocketFacImpl"); - MySSLServerSocketFacImpl.useCustomCipherSuites(); + // reserve the security properties + String reservedSFacAlg = + Security.getProperty("ssl.SocketFactory.provider"); + String reservedSSFacAlg = + Security.getProperty("ssl.ServerSocketFactory.provider"); + + try { + Security.setProperty("ssl.SocketFactory.provider", + "MySSLSocketFacImpl"); + MySSLSocketFacImpl.useCustomCipherSuites(); + Security.setProperty("ssl.ServerSocketFactory.provider", + "MySSLServerSocketFacImpl"); + MySSLServerSocketFacImpl.useCustomCipherSuites(); - String[] supportedCS = null; - for (int i = 0; i < 2; i++) { - switch (i) { - case 0: - System.out.println("Testing SSLSocketFactory:"); - SSLSocketFactory sf = (SSLSocketFactory) - SSLSocketFactory.getDefault(); - supportedCS = sf.getSupportedCipherSuites(); - break; - case 1: - System.out.println("Testing SSLServerSocketFactory:"); - SSLServerSocketFactory ssf = (SSLServerSocketFactory) - SSLServerSocketFactory.getDefault(); - supportedCS = ssf.getSupportedCipherSuites(); - break; - default: - throw new Exception("Internal Test Error"); + String[] supportedCS = null; + for (int i = 0; i < 2; i++) { + switch (i) { + case 0: + System.out.println("Testing SSLSocketFactory:"); + SSLSocketFactory sf = (SSLSocketFactory) + SSLSocketFactory.getDefault(); + supportedCS = sf.getSupportedCipherSuites(); + break; + case 1: + System.out.println("Testing SSLServerSocketFactory:"); + SSLServerSocketFactory ssf = (SSLServerSocketFactory) + SSLServerSocketFactory.getDefault(); + supportedCS = ssf.getSupportedCipherSuites(); + break; + default: + throw new Exception("Internal Test Error"); + } + System.out.println(Arrays.asList(supportedCS)); + if (supportedCS.length == 0) { + throw new Exception("supported ciphersuites are empty"); + } } - System.out.println(Arrays.asList(supportedCS)); - if (supportedCS.length == 0) { - throw new Exception("supported ciphersuites are empty"); + System.out.println("Test Passed"); + } finally { + // restore the security properties + if (reservedSFacAlg == null) { + reservedSFacAlg = ""; } + + if (reservedSSFacAlg == null) { + reservedSSFacAlg = ""; + } + Security.setProperty("ssl.SocketFactory.provider", + reservedSFacAlg); + Security.setProperty("ssl.ServerSocketFactory.provider", + reservedSSFacAlg); } - System.out.println("Test Passed"); } }
--- a/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport2.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sanity/pluggability/CheckSockFacExport2.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4635454 * @summary Check pluggability of SSLSocketFactory and - * SSLServerSocketFactory classes. + * SSLServerSocketFactory classes. + * @run main/othervm CheckSockFacExport2 */ import java.security.*; import java.net.*; @@ -34,38 +40,59 @@ public class CheckSockFacExport2 { public static void main(String argv[]) throws Exception { - Security.setProperty("ssl.SocketFactory.provider", - "MySSLSocketFacImpl"); - MySSLSocketFacImpl.useStandardCipherSuites(); - Security.setProperty("ssl.ServerSocketFactory.provider", - "MySSLServerSocketFacImpl"); - MySSLServerSocketFacImpl.useStandardCipherSuites(); + // reserve the security properties + String reservedSFacAlg = + Security.getProperty("ssl.SocketFactory.provider"); + String reservedSSFacAlg = + Security.getProperty("ssl.ServerSocketFactory.provider"); - boolean result = false; - for (int i = 0; i < 2; i++) { - switch (i) { - case 0: - System.out.println("Testing SSLSocketFactory:"); - SSLSocketFactory sf = (SSLSocketFactory) - SSLSocketFactory.getDefault(); - result = (sf instanceof MySSLSocketFacImpl); - break; + try { + Security.setProperty("ssl.SocketFactory.provider", + "MySSLSocketFacImpl"); + MySSLSocketFacImpl.useStandardCipherSuites(); + Security.setProperty("ssl.ServerSocketFactory.provider", + "MySSLServerSocketFacImpl"); + MySSLServerSocketFacImpl.useStandardCipherSuites(); + + boolean result = false; + for (int i = 0; i < 2; i++) { + switch (i) { + case 0: + System.out.println("Testing SSLSocketFactory:"); + SSLSocketFactory sf = (SSLSocketFactory) + SSLSocketFactory.getDefault(); + result = (sf instanceof MySSLSocketFacImpl); + break; - case 1: - System.out.println("Testing SSLServerSocketFactory:"); - SSLServerSocketFactory ssf = (SSLServerSocketFactory) - SSLServerSocketFactory.getDefault(); - result = (ssf instanceof MySSLServerSocketFacImpl); - break; - default: - throw new Exception("Internal Test Error"); + case 1: + System.out.println("Testing SSLServerSocketFactory:"); + SSLServerSocketFactory ssf = (SSLServerSocketFactory) + SSLServerSocketFactory.getDefault(); + result = (ssf instanceof MySSLServerSocketFacImpl); + break; + default: + throw new Exception("Internal Test Error"); + } + if (result) { + System.out.println("...accepted valid SFs"); + } else { + throw new Exception("...wrong SF is used"); + } } - if (result) { - System.out.println("...accepted valid SFs"); - } else { - throw new Exception("...wrong SF is used"); + System.out.println("Test Passed"); + } finally { + // restore the security properties + if (reservedSFacAlg == null) { + reservedSFacAlg = ""; } + + if (reservedSSFacAlg == null) { + reservedSSFacAlg = ""; + } + Security.setProperty("ssl.SocketFactory.provider", + reservedSFacAlg); + Security.setProperty("ssl.ServerSocketFactory.provider", + reservedSSFacAlg); } - System.out.println("Test Passed"); } }
--- a/test/sun/security/ssl/sun/net/www/http/ChunkedOutputStream/Test.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/http/ChunkedOutputStream/Test.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /** * @test * @bug 5026745 @@ -283,31 +288,37 @@ System.getProperty("test.src", "./") + "/" + pathToStores + "/" + trustStoreFile; - System.setProperty("javax.net.ssl.keyStore", keyFilename); - System.setProperty("javax.net.ssl.keyStorePassword", passwd); - System.setProperty("javax.net.ssl.trustStore", trustFilename); - System.setProperty("javax.net.ssl.trustStorePassword", passwd); - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); - + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { - server = new HttpServer (new Test(), 1, 10, 0); - System.out.println ("Server started: listening on port: " + server.getLocalPort()); - // the test server doesn't support keep-alive yet - // test1("http://localhost:"+server.getLocalPort()+"/d0"); - test1("https://localhost:"+server.getLocalPort()+"/d01"); - test3("https://localhost:"+server.getLocalPort()+"/d3"); - test4("https://localhost:"+server.getLocalPort()+"/d4"); - test5("https://localhost:"+server.getLocalPort()+"/d5"); - test6("https://localhost:"+server.getLocalPort()+"/d6"); - test7("https://localhost:"+server.getLocalPort()+"/d7"); - test8("https://localhost:"+server.getLocalPort()+"/d8"); - } catch (Exception e) { - if (server != null) { - server.terminate(); + System.setProperty("javax.net.ssl.keyStore", keyFilename); + System.setProperty("javax.net.ssl.keyStorePassword", passwd); + System.setProperty("javax.net.ssl.trustStore", trustFilename); + System.setProperty("javax.net.ssl.trustStorePassword", passwd); + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); + + try { + server = new HttpServer (new Test(), 1, 10, 0); + System.out.println ("Server started: listening on port: " + server.getLocalPort()); + // the test server doesn't support keep-alive yet + // test1("http://localhost:"+server.getLocalPort()+"/d0"); + test1("https://localhost:"+server.getLocalPort()+"/d01"); + test3("https://localhost:"+server.getLocalPort()+"/d3"); + test4("https://localhost:"+server.getLocalPort()+"/d4"); + test5("https://localhost:"+server.getLocalPort()+"/d5"); + test6("https://localhost:"+server.getLocalPort()+"/d6"); + test7("https://localhost:"+server.getLocalPort()+"/d7"); + test8("https://localhost:"+server.getLocalPort()+"/d8"); + } catch (Exception e) { + if (server != null) { + server.terminate(); + } + throw e; } - throw e; + server.terminate(); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } - server.terminate(); } static class NameVerifier implements HostnameVerifier {
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,14 +21,19 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6216082 * @library ../../../httpstest/ * @build HttpCallback HttpServer ClosedChannelList HttpTransaction TunnelProxy + * @summary Redirect problem with HttpsURLConnection using a proxy * @run main/othervm B6216082 - * @summary Redirect problem with HttpsURLConnection using a proxy -*/ + */ import java.io.*; import java.net.*; @@ -46,20 +51,27 @@ static InetAddress firstNonLoAddress = null; public static void main(String[] args) throws Exception { - // XXX workaround for CNFE - Class.forName("java.nio.channels.ClosedByInterruptException"); - setupEnv(); + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + // XXX workaround for CNFE + Class.forName("java.nio.channels.ClosedByInterruptException"); + setupEnv(); - startHttpServer(); + startHttpServer(); - // https.proxyPort can only be set after the TunnelProxy has been - // created as it will use an ephemeral port. - System.setProperty( "https.proxyPort", (new Integer(proxy.getLocalPort())).toString() ); + // https.proxyPort can only be set after the TunnelProxy has been + // created as it will use an ephemeral port. + System.setProperty("https.proxyPort", + (new Integer(proxy.getLocalPort())).toString() ); - makeHttpCall(); + makeHttpCall(); - if (httpTrans.hasBadRequest) { - throw new RuntimeException("Test failed : bad http request"); + if (httpTrans.hasBadRequest) { + throw new RuntimeException("Test failed : bad http request"); + } + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CloseKeepAliveCached.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CloseKeepAliveCached.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,13 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6618387 * @summary SSL client sessions do not close cleanly. A TCP reset occurs * instead of a close_notify alert. - * @run main/othervm -Djavax.net.debug=ssl CloseKeepAliveCached - * + * @run main/othervm CloseKeepAliveCached * @ignore * After run the test manually, at the end of the debug output, * if "MainThread, called close()" found, the test passed. Otherwise, @@ -140,13 +144,15 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - /* * Wait for server to get started. */ while (!serverReady) { Thread.sleep(50); } + + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { HttpsURLConnection http = null; @@ -180,6 +186,8 @@ if (sslServerSocket != null) sslServerSocket.close(); throw ioex; + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test + * @bug 4696506 4942650 * @summary Unit test for java.net.CookieHandler - * @bug 4696506 4942650 + * @run main/othervm CookieHandlerTest * @author Yingxian Wang */ @@ -182,26 +188,34 @@ System.getProperty("test.src", "./") + "/" + pathToStores + "/" + trustStoreFile; - System.setProperty("javax.net.ssl.keyStore", keyFilename); - System.setProperty("javax.net.ssl.keyStorePassword", passwd); - System.setProperty("javax.net.ssl.trustStore", trustFilename); - System.setProperty("javax.net.ssl.trustStorePassword", passwd); + CookieHandler reservedCookieHandler = CookieHandler.getDefault(); + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + System.setProperty("javax.net.ssl.keyStore", keyFilename); + System.setProperty("javax.net.ssl.keyStorePassword", passwd); + System.setProperty("javax.net.ssl.trustStore", trustFilename); + System.setProperty("javax.net.ssl.trustStorePassword", passwd); - if (debug) - System.setProperty("javax.net.debug", "all"); + if (debug) + System.setProperty("javax.net.debug", "all"); - /* - * Start the tests. - */ - cookies = new HashMap<String, String>(); - cookies.put("Cookie", - "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\""); - cookies.put("Set-Cookie2", - "$Version=\"1\"; Part_Number=\"Riding_Rocket_0023\"; " + - "$Path=\"/acme/ammo\"; Part_Number=\"Rocket_Launcher_0001\"; "+ - "$Path=\"/acme\""); - CookieHandler.setDefault(new MyCookieHandler()); - new CookieHandlerTest(); + /* + * Start the tests. + */ + cookies = new HashMap<String, String>(); + cookies.put("Cookie", + "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\""); + cookies.put("Set-Cookie2", + "$Version=\"1\"; Part_Number=\"Riding_Rocket_0023\"; " + + "$Path=\"/acme/ammo\"; Part_Number=\"Rocket_Launcher_0001\"; "+ + "$Path=\"/acme\""); + CookieHandler.setDefault(new MyCookieHandler()); + new CookieHandlerTest(); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); + CookieHandler.setDefault(reservedCookieHandler); + } } Thread clientThread = null;
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHttpsClientTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHttpsClientTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -26,6 +26,7 @@ * @bug 7129083 * @summary Cookiemanager does not store cookies if url is read * before setting cookiemanager + * @run main/othervm CookieHttpsClientTest */ import java.net.CookieHandler;
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test + * @bug 6766775 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10 - * @bug 6766775 + * @run main/othervm DNSIdentities * @author Xuelei Fan */ @@ -691,34 +697,39 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - SSLContext context = getSSLContext(trusedCertStr, clientCertStr, - clientModulus, clientPrivateExponent, passphrase); + SSLContext reservedSSLContext = SSLContext.getDefault(); + try { + SSLContext context = getSSLContext(trusedCertStr, clientCertStr, + clientModulus, clientPrivateExponent, passphrase); - SSLContext.setDefault(context); + SSLContext.setDefault(context); - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - HttpsURLConnection http = null; + HttpsURLConnection http = null; - /* establish http connection to server */ - URL url = new URL("https://localhost:" + serverPort+"/"); - System.out.println("url is "+url.toString()); + /* establish http connection to server */ + URL url = new URL("https://localhost:" + serverPort+"/"); + System.out.println("url is "+url.toString()); - try { - http = (HttpsURLConnection)url.openConnection(); + try { + http = (HttpsURLConnection)url.openConnection(); - int respCode = http.getResponseCode(); - System.out.println("respCode = "+respCode); + int respCode = http.getResponseCode(); + System.out.println("respCode = "+respCode); + } finally { + if (http != null) { + http.disconnect(); + } + closeReady = true; + } } finally { - if (http != null) { - http.disconnect(); - } - closeReady = true; + SSLContext.setDefault(reservedSSLContext); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /** * @test * @bug 6771432 - * @summary createSocket() - smpatch fails using 1.6.0_10 because of "Unconnected sockets not implemented" + * @summary createSocket() - smpatch fails using 1.6.0_10 because of + * "Unconnected sockets not implemented" + * @run main/othervm HttpsCreateSockTest */ import javax.net.SocketFactory;
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsPost.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsPost.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4423074 * @summary Need to rebase all the duplicated classes from Merlin. * This test will check out http POST + * @run main/othervm HttpsPost */ import java.io.*; @@ -140,34 +146,38 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } - - // Send HTTP POST request to server - URL url = new URL("https://localhost:"+serverPort); + // Send HTTP POST request to server + URL url = new URL("https://localhost:"+serverPort); - HttpsURLConnection.setDefaultHostnameVerifier( - new NameVerifier()); - HttpsURLConnection http = (HttpsURLConnection)url.openConnection(); - http.setDoOutput(true); + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); + HttpsURLConnection http = (HttpsURLConnection)url.openConnection(); + http.setDoOutput(true); - http.setRequestMethod("POST"); - PrintStream ps = new PrintStream(http.getOutputStream()); - try { - ps.println(postMsg); - ps.flush(); - if (http.getResponseCode() != 200) { - throw new RuntimeException("test Failed"); + http.setRequestMethod("POST"); + PrintStream ps = new PrintStream(http.getOutputStream()); + try { + ps.println(postMsg); + ps.flush(); + if (http.getResponseCode() != 200) { + throw new RuntimeException("test Failed"); + } + } finally { + ps.close(); + http.disconnect(); + closeReady = true; } } finally { - ps.close(); - http.disconnect(); - closeReady = true; + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,13 @@ * questions. */ +// No way to reserve default Authenticator, need to run in othervm mode. + /* * @test * @bug 6670868 * @summary StackOverFlow with bad authenticated Proxy tunnels + * @run main/othervm HttpsProxyStackOverflow */ import java.io.IOException;
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6614957
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test + * @bug 6766775 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10 - * @bug 6766775 + * @run main/othervm IPAddressDNSIdentities * @author Xuelei Fan */ @@ -691,43 +697,48 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - SSLContext context = getSSLContext(trusedCertStr, clientCertStr, - clientModulus, clientPrivateExponent, passphrase); - - SSLContext.setDefault(context); - - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } - - HttpsURLConnection http = null; - - /* establish http connection to server */ - URL url = new URL("https://127.0.0.1:" + serverPort+"/"); - System.out.println("url is "+url.toString()); - + SSLContext reservedSSLContext = SSLContext.getDefault(); try { - http = (HttpsURLConnection)url.openConnection(); + SSLContext context = getSSLContext(trusedCertStr, clientCertStr, + clientModulus, clientPrivateExponent, passphrase); + + SSLContext.setDefault(context); - int respCode = http.getResponseCode(); - System.out.println("respCode = " + respCode); + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } + + HttpsURLConnection http = null; + + /* establish http connection to server */ + URL url = new URL("https://127.0.0.1:" + serverPort+"/"); + System.out.println("url is "+url.toString()); - throw new Exception("Unexpectly found subject alternative name " + - "matching IP address"); - } catch (SSLHandshakeException sslhe) { - // no subject alternative names matching IP address 127.0.0.1 found - // that's the expected exception, ignore it. - } catch (IOException ioe) { - // HttpsClient may throw IOE during checking URL spoofing, - // that's the expected exception, ignore it. + try { + http = (HttpsURLConnection)url.openConnection(); + + int respCode = http.getResponseCode(); + System.out.println("respCode = " + respCode); + + throw new Exception("Unexpectly found " + + "subject alternative name matching IP address"); + } catch (SSLHandshakeException sslhe) { + // no subject alternative names matching IP address 127.0.0.1 + // found that's the expected exception, ignore it. + } catch (IOException ioe) { + // HttpsClient may throw IOE during checking URL spoofing, + // that's the expected exception, ignore it. + } finally { + if (http != null) { + http.disconnect(); + } + closeReady = true; + } } finally { - if (http != null) { - http.disconnect(); - } - closeReady = true; + SSLContext.setDefault(reservedSSLContext); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test * @summary X509 certificate hostname checking is broken in JDK1.6.0_10 * @bug 6766775 + * @run main/othervm IPAddressIPIdentities * @author Xuelei Fan */ @@ -692,34 +698,39 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - SSLContext context = getSSLContext(trusedCertStr, clientCertStr, - clientModulus, clientPrivateExponent, passphrase); + SSLContext reservedSSLContext = SSLContext.getDefault(); + try { + SSLContext context = getSSLContext(trusedCertStr, clientCertStr, + clientModulus, clientPrivateExponent, passphrase); - SSLContext.setDefault(context); + SSLContext.setDefault(context); - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - HttpsURLConnection http = null; + HttpsURLConnection http = null; - /* establish http connection to server */ - URL url = new URL("https://127.0.0.1:" + serverPort+"/"); - System.out.println("url is "+url.toString()); + /* establish http connection to server */ + URL url = new URL("https://127.0.0.1:" + serverPort+"/"); + System.out.println("url is "+url.toString()); - try { - http = (HttpsURLConnection)url.openConnection(); + try { + http = (HttpsURLConnection)url.openConnection(); - int respCode = http.getResponseCode(); - System.out.println("respCode = "+respCode); + int respCode = http.getResponseCode(); + System.out.println("respCode = "+respCode); + } finally { + if (http != null) { + http.disconnect(); + } + closeReady = true; + } } finally { - if (http != null) { - http.disconnect(); - } - closeReady = true; + SSLContext.setDefault(reservedSSLContext); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test * @summary X509 certificate hostname checking is broken in JDK1.6.0_10 * @bug 6766775 + * @run main/othervm IPIdentities * @author Xuelei Fan */ @@ -692,34 +698,38 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - SSLContext context = getSSLContext(trusedCertStr, clientCertStr, - clientModulus, clientPrivateExponent, passphrase); - - SSLContext.setDefault(context); + SSLContext reservedSSLContext = SSLContext.getDefault(); + try { + SSLContext context = getSSLContext(trusedCertStr, clientCertStr, + clientModulus, clientPrivateExponent, passphrase); + SSLContext.setDefault(context); - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - HttpsURLConnection http = null; + HttpsURLConnection http = null; - /* establish http connection to server */ - URL url = new URL("https://localhost:" + serverPort+"/"); - System.out.println("url is "+url.toString()); + /* establish http connection to server */ + URL url = new URL("https://localhost:" + serverPort+"/"); + System.out.println("url is "+url.toString()); - try { - http = (HttpsURLConnection)url.openConnection(); + try { + http = (HttpsURLConnection)url.openConnection(); - int respCode = http.getResponseCode(); - System.out.println("respCode = "+respCode); + int respCode = http.getResponseCode(); + System.out.println("respCode = "+respCode); + } finally { + if (http != null) { + http.disconnect(); + } + closeReady = true; + } } finally { - if (http != null) { - http.disconnect(); - } - closeReady = true; + SSLContext.setDefault(reservedSSLContext); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test + * @bug 6766775 * @summary X509 certificate hostname checking is broken in JDK1.6.0_10 - * @bug 6766775 + * @run main/othervm Identities * @author Xuelei Fan */ @@ -691,34 +697,39 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - SSLContext context = getSSLContext(trusedCertStr, clientCertStr, - clientModulus, clientPrivateExponent, passphrase); + SSLContext reservedSSLContext = SSLContext.getDefault(); + try { + SSLContext context = getSSLContext(trusedCertStr, clientCertStr, + clientModulus, clientPrivateExponent, passphrase); - SSLContext.setDefault(context); + SSLContext.setDefault(context); - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - HttpsURLConnection http = null; + HttpsURLConnection http = null; - /* establish http connection to server */ - URL url = new URL("https://localhost:" + serverPort+"/"); - System.out.println("url is "+url.toString()); + /* establish http connection to server */ + URL url = new URL("https://localhost:" + serverPort+"/"); + System.out.println("url is "+url.toString()); - try { - http = (HttpsURLConnection)url.openConnection(); + try { + http = (HttpsURLConnection)url.openConnection(); - int respCode = http.getResponseCode(); - System.out.println("respCode = "+respCode); + int respCode = http.getResponseCode(); + System.out.println("respCode = "+respCode); + } finally { + if (http != null) { + http.disconnect(); + } + closeReady = true; + } } finally { - if (http != null) { - http.disconnect(); - } - closeReady = true; + SSLContext.setDefault(reservedSSLContext); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -147,44 +147,51 @@ static String postMsg = "Testing HTTP post on a https server"; static void doClientSide(String hostname) throws Exception { - /* - * setup up a proxy - */ - setupProxy(); - - /* - * we want to avoid URLspoofCheck failures in cases where the cert - * DN name does not match the hostname in the URL. - */ - HttpsURLConnection.setDefaultHostnameVerifier( - new NameVerifier()); - URL url = new URL("https://" + hostname+ ":" + serverPort); - - HttpsURLConnection https = (HttpsURLConnection)url.openConnection(); - https.setDoOutput(true); - https.setRequestMethod("POST"); - PrintStream ps = null; + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { - ps = new PrintStream(https.getOutputStream()); - ps.println(postMsg); - ps.flush(); - if (https.getResponseCode() != 200) { - throw new RuntimeException("test Failed"); - } - ps.close(); + /* + * setup up a proxy + */ + SocketAddress pAddr = setupProxy(); + + /* + * we want to avoid URLspoofCheck failures in cases where the cert + * DN name does not match the hostname in the URL. + */ + HttpsURLConnection.setDefaultHostnameVerifier( + new NameVerifier()); + URL url = new URL("https://" + hostname+ ":" + serverPort); - // clear the pipe - BufferedReader in = new BufferedReader( - new InputStreamReader( - https.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) - System.out.println("Client received: " + inputLine); - in.close(); - } catch (SSLException e) { - if (ps != null) - ps.close(); - throw e; + Proxy p = new Proxy(Proxy.Type.HTTP, pAddr); + HttpsURLConnection https = (HttpsURLConnection)url.openConnection(p); + https.setDoOutput(true); + https.setRequestMethod("POST"); + PrintStream ps = null; + try { + ps = new PrintStream(https.getOutputStream()); + ps.println(postMsg); + ps.flush(); + if (https.getResponseCode() != 200) { + throw new RuntimeException("test Failed"); + } + ps.close(); + + // clear the pipe + BufferedReader in = new BufferedReader( + new InputStreamReader( + https.getInputStream())); + String inputLine; + while ((inputLine = in.readLine()) != null) + System.out.println("Client received: " + inputLine); + in.close(); + } catch (SSLException e) { + if (ps != null) + ps.close(); + throw e; + } + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } } @@ -194,14 +201,12 @@ } } - static void setupProxy() throws IOException { + static SocketAddress setupProxy() throws IOException { ProxyTunnelServer pserver = new ProxyTunnelServer(); // disable proxy authentication pserver.needUserAuth(false); pserver.start(); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", String.valueOf( - pserver.getPort())); + return new InetSocketAddress("localhost", pserver.getPort()); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java Fri Jun 21 15:46:14 2013 -0500 @@ -152,7 +152,7 @@ /* * setup up a proxy */ - setupProxy(); + SocketAddress pAddr = setupProxy(); /* * we want to avoid URLspoofCheck failures in cases where the cert @@ -162,7 +162,8 @@ new NameVerifier()); URL url = new URL("https://" + hostname + ":" + serverPort); - HttpsURLConnection https = (HttpsURLConnection)url.openConnection(); + Proxy p = new Proxy(Proxy.Type.HTTP, pAddr); + HttpsURLConnection https = (HttpsURLConnection)url.openConnection(p); https.setDoOutput(true); https.setRequestMethod("POST"); PrintStream ps = null; @@ -195,7 +196,7 @@ } } - static void setupProxy() throws IOException { + static SocketAddress setupProxy() throws IOException { ProxyTunnelServer pserver = new ProxyTunnelServer(); /* @@ -209,9 +210,8 @@ pserver.setUserAuth("Test", "test123"); pserver.start(); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", String.valueOf( - pserver.getPort())); + + return new InetSocketAddress("localhost", pserver.getPort()); } public static class TestAuthenticator extends Authenticator { @@ -220,6 +220,4 @@ "test123".toCharArray()); } } - - }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,18 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4811482 4700777 4905410 - * @summary sun.net.client.defaultConnectTimeout should work with HttpsURLConnection; HTTP client: Connect and read timeouts; Https needs to support new tiger features that went into http + * @summary sun.net.client.defaultConnectTimeout should work with + * HttpsURLConnection; HTTP client: Connect and read timeouts; + * Https needs to support new tiger features that went into http + * @run main/othervm ReadTimeout */ import java.io.*; @@ -143,44 +151,48 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } + HttpsURLConnection http = null; + try { + URL url = new URL("https://localhost:"+serverPort); - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } - HttpsURLConnection http = null; - try { - URL url = new URL("https://localhost:"+serverPort); - - // set read timeout through system property - System.setProperty("sun.net.client.defaultReadTimeout", "2000"); - HttpsURLConnection.setDefaultHostnameVerifier( - new NameVerifier()); - http = (HttpsURLConnection)url.openConnection(); + // set read timeout through system property + System.setProperty("sun.net.client.defaultReadTimeout", "2000"); + HttpsURLConnection.setDefaultHostnameVerifier( + new NameVerifier()); + http = (HttpsURLConnection)url.openConnection(); - InputStream is = http.getInputStream (); - } catch (SocketTimeoutException stex) { - done(); - http.disconnect(); - } + InputStream is = http.getInputStream (); + } catch (SocketTimeoutException stex) { + done(); + http.disconnect(); + } - try { - URL url = new URL("https://localhost:"+serverPort); + try { + URL url = new URL("https://localhost:"+serverPort); - HttpsURLConnection.setDefaultHostnameVerifier( - new NameVerifier()); - http = (HttpsURLConnection)url.openConnection(); - // set read timeout through API - http.setReadTimeout(2000); + HttpsURLConnection.setDefaultHostnameVerifier( + new NameVerifier()); + http = (HttpsURLConnection)url.openConnection(); + // set read timeout through API + http.setReadTimeout(2000); - InputStream is = http.getInputStream (); - } catch (SocketTimeoutException stex) { - done(); - http.disconnect(); + InputStream is = http.getInputStream (); + } catch (SocketTimeoutException stex) { + done(); + http.disconnect(); + } + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } - } static class NameVerifier implements HostnameVerifier {
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Redirect.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/Redirect.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,17 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4423074 * @summary Need to rebase all the duplicated classes from Merlin. * This test will check out http POST + * @run main/othervm Redirect */ import java.io.*; @@ -139,28 +145,33 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - // Send HTTP POST request to server - URL url = new URL("https://localhost:"+serverPort); + // Send HTTP POST request to server + URL url = new URL("https://localhost:"+serverPort); - HttpsURLConnection.setDefaultHostnameVerifier( - new NameVerifier()); - HttpsURLConnection http = (HttpsURLConnection)url.openConnection(); - try { - System.out.println("response header: "+http.getHeaderField(0)); - if (http.getResponseCode() != 200) { - throw new RuntimeException("test Failed"); + HttpsURLConnection.setDefaultHostnameVerifier( + new NameVerifier()); + HttpsURLConnection http = (HttpsURLConnection)url.openConnection(); + try { + System.out.println("response header: "+http.getHeaderField(0)); + if (http.getResponseCode() != 200) { + throw new RuntimeException("test Failed"); + } + } finally { + http.disconnect(); + closeReady = true; } } finally { - http.disconnect(); - closeReady = true; + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/RetryHttps.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/RetryHttps.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,15 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* @test + * @bug 4799427 * @summary Https can not retry request - * @bug 4799427 + * @run main/othervm RetryHttps * @author Yingxian Wang */ @@ -129,36 +135,41 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); try { - HttpsURLConnection http = null; - /* establish http connection to server */ - URL url = new URL("https://localhost:" + serverPort+"/file1"); - System.out.println("url is "+url.toString()); - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); - http = (HttpsURLConnection)url.openConnection(); - int respCode = http.getResponseCode(); - int cl = http.getContentLength(); - InputStream is = http.getInputStream (); - int count = 0; - while (is.read() != -1 && count++ < cl); - System.out.println("respCode1 = "+respCode); - Thread.sleep(2000); - url = new URL("https://localhost:" + serverPort+"/file2"); - http = (HttpsURLConnection)url.openConnection(); - respCode = http.getResponseCode(); - System.out.println("respCode2 = "+respCode); - - } catch (IOException ioex) { - if (sslServerSocket != null) - sslServerSocket.close(); - throw ioex; + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } + try { + HttpsURLConnection http = null; + /* establish http connection to server */ + URL url = new URL("https://localhost:" + serverPort+"/file1"); + System.out.println("url is "+url.toString()); + HttpsURLConnection.setDefaultHostnameVerifier( + new NameVerifier()); + http = (HttpsURLConnection)url.openConnection(); + int respCode = http.getResponseCode(); + int cl = http.getContentLength(); + InputStream is = http.getInputStream (); + int count = 0; + while (is.read() != -1 && count++ < cl); + System.out.println("respCode1 = "+respCode); + Thread.sleep(2000); + url = new URL("https://localhost:" + serverPort+"/file2"); + http = (HttpsURLConnection)url.openConnection(); + respCode = http.getResponseCode(); + System.out.println("respCode2 = "+respCode); + } catch (IOException ioex) { + if (sslServerSocket != null) + sslServerSocket.close(); + throw ioex; + } + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4474255 * @summary Can no longer obtain a com.sun.net.ssl.HttpsURLConnection + * @run main/othervm ComHTTPSConnection * @author Brad Wetmore */ @@ -198,44 +204,50 @@ Thread.sleep(50); } - System.setProperty("java.protocol.handler.pkgs", - "com.sun.net.ssl.internal.www.protocol"); - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); - - URL url = new URL("https://" + "localhost:" + serverPort + - "/etc/hosts"); - URLConnection urlc = url.openConnection(); - - if (!(urlc instanceof com.sun.net.ssl.HttpsURLConnection)) { - throw new Exception( - "URLConnection ! instanceof " + - "com.sun.net.ssl.HttpsURLConnection"); - } + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + System.setProperty("java.protocol.handler.pkgs", + "com.sun.net.ssl.internal.www.protocol"); + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); - BufferedReader in = null; - try { - in = new BufferedReader(new InputStreamReader( - urlc.getInputStream())); - String inputLine; - System.out.print("Client reading... "); - while ((inputLine = in.readLine()) != null) - System.out.println(inputLine); + URL url = new URL("https://" + "localhost:" + serverPort + + "/etc/hosts"); + URLConnection urlc = url.openConnection(); - System.out.println("Cipher Suite: " + - ((HttpsURLConnection)urlc).getCipherSuite()); - X509Certificate[] certs = - ((HttpsURLConnection)urlc).getServerCertificateChain(); - for (int i = 0; i < certs.length; i++) { - System.out.println(certs[0]); + if (!(urlc instanceof com.sun.net.ssl.HttpsURLConnection)) { + throw new Exception( + "URLConnection ! instanceof " + + "com.sun.net.ssl.HttpsURLConnection"); } - in.close(); - } catch (SSLException e) { - if (in != null) + BufferedReader in = null; + try { + in = new BufferedReader(new InputStreamReader( + urlc.getInputStream())); + String inputLine; + System.out.print("Client reading... "); + while ((inputLine = in.readLine()) != null) + System.out.println(inputLine); + + System.out.println("Cipher Suite: " + + ((HttpsURLConnection)urlc).getCipherSuite()); + X509Certificate[] certs = + ((HttpsURLConnection)urlc).getServerCertificateChain(); + for (int i = 0; i < certs.length; i++) { + System.out.println(certs[0]); + } + in.close(); - throw e; + } catch (SSLException e) { + if (in != null) + in.close(); + throw e; + } + System.out.println("Client reports: SUCCESS"); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } - System.out.println("Client reports: SUCCESS"); } static class NameVerifier implements HostnameVerifier {
--- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4474255 @@ -28,6 +33,7 @@ * @bug 4484246 * @summary When an application enables anonymous SSL cipher suite, * Hostname verification is not required + * @run main/othervm ComHostnameVerifier */ import java.io.*;
--- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHTTPSConnection.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHTTPSConnection.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4474255 * @summary Can no longer obtain a com.sun.net.ssl.HttpsURLConnection + * @run main/othervm JavaxHTTPSConnection * @author Brad Wetmore */ @@ -189,47 +195,53 @@ * to avoid infinite hangs. */ void doClientSide() throws Exception { - /* - * Wait for server to get started. - */ - while (!serverReady) { - Thread.sleep(50); - } - - HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); - URL url = new URL("https://" + "localhost:" + serverPort + - "/etc/hosts"); - URLConnection urlc = url.openConnection(); + HostnameVerifier reservedHV = + HttpsURLConnection.getDefaultHostnameVerifier(); + try { + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } - if (!(urlc instanceof javax.net.ssl.HttpsURLConnection)) { - throw new Exception( - "URLConnection ! instanceof javax.net.ssl.HttpsURLConnection"); - } + HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); + URL url = new URL("https://" + "localhost:" + serverPort + + "/etc/hosts"); + URLConnection urlc = url.openConnection(); - BufferedReader in = null; - try { - in = new BufferedReader(new InputStreamReader( - urlc.getInputStream())); - String inputLine; - System.out.print("Client reading... "); - while ((inputLine = in.readLine()) != null) - System.out.println(inputLine); - - System.out.println("Cipher Suite: " + - ((HttpsURLConnection)urlc).getCipherSuite()); - Certificate[] certs = - ((HttpsURLConnection)urlc).getServerCertificates(); - for (int i = 0; i < certs.length; i++) { - System.out.println(certs[0]); + if (!(urlc instanceof javax.net.ssl.HttpsURLConnection)) { + throw new Exception("URLConnection ! instanceof " + + "javax.net.ssl.HttpsURLConnection"); } - in.close(); - } catch (SSLException e) { - if (in != null) + BufferedReader in = null; + try { + in = new BufferedReader(new InputStreamReader( + urlc.getInputStream())); + String inputLine; + System.out.print("Client reading... "); + while ((inputLine = in.readLine()) != null) + System.out.println(inputLine); + + System.out.println("Cipher Suite: " + + ((HttpsURLConnection)urlc).getCipherSuite()); + Certificate[] certs = + ((HttpsURLConnection)urlc).getServerCertificates(); + for (int i = 0; i < certs.length; i++) { + System.out.println(certs[0]); + } + in.close(); - throw e; + } catch (SSLException e) { + if (in != null) + in.close(); + throw e; + } + System.out.println("Client reports: SUCCESS"); + } finally { + HttpsURLConnection.setDefaultHostnameVerifier(reservedHV); } - System.out.println("Client reports: SUCCESS"); } static class NameVerifier implements HostnameVerifier {
--- a/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHostnameVerifier.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/NewImpl/JavaxHostnameVerifier.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4474255 @@ -28,6 +33,7 @@ * @bug 4484246 * @summary When an application enables anonymous SSL cipher suite, * Hostname verification is not required + * @run main/othervm JavaxHostnameVerifier */ import java.io.*;
--- a/test/sun/security/ssl/templates/SSLEngineTemplate.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/templates/SSLEngineTemplate.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,11 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 1234567 * @summary SSLEngine has not yet caused Solaris kernel to panic - * + * @run main/othervm SSLEngineTemplate */ /**
--- a/test/sun/security/ssl/templates/SSLSocketTemplate.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/ssl/templates/SSLSocketTemplate.java Fri Jun 21 15:46:14 2013 -0500 @@ -21,10 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 1234567 * @summary Use this template to help speed your client/server tests. + * @run main/othervm SSLSocketTemplate * @author Brad Wetmore */
--- a/test/sun/security/tools/keytool/StartDateTest.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/tools/keytool/StartDateTest.java Fri Jun 21 15:46:14 2013 -0500 @@ -132,7 +132,9 @@ static Date getIssueDate() throws Exception { KeyStore ks = KeyStore.getInstance("jks"); - ks.load(new FileInputStream("jks"), "changeit".toCharArray()); + try (FileInputStream fis = new FileInputStream("jks")) { + ks.load(fis, "changeit".toCharArray()); + } X509Certificate cert = (X509Certificate)ks.getCertificate("me"); return cert.getNotBefore(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/util/Oid/S11N.java Fri Jun 21 15:46:14 2013 -0500 @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4811968 6908628 8006564 + * @run main S11N check + * @summary Serialization compatibility with old versions (and fixes) + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.HashMap; +import java.util.Map; +import sun.misc.BASE64Encoder; +import sun.security.util.ObjectIdentifier; + +public class S11N { + static String[] SMALL= { + "0.0", + "1.1", + "2.2", + "1.2.3456", + "1.2.2147483647.4", + "1.2.268435456.4", + }; + + static String[] HUGE = { + "2.16.764.1.3101555394.1.0.100.2.1", + "1.2.2147483648.4", + "2.3.4444444444444444444444", + "1.2.8888888888888888.33333333333333333.44444444444444", + }; + + // Do not use j.u.Base64, the test needs to run in jdk6 + static BASE64Encoder encoder = new BASE64Encoder() { + @Override + protected int bytesPerLine() { + return 48; + } + }; + + public static void main(String[] args) throws Exception { + if (args[0].equals("check")) { + int version = Integer.valueOf(System.getProperty("java.version") + .split("\\.")[1]); + System.out.println("version is " + version); + if (version >= 7) { + for (String oid: SMALL) { + // 7 -> 7 + check(out(oid), oid); + // 6 -> 7 + check(out6(oid), oid); + } + for (String oid: HUGE) { + // 7 -> 7 + check(out(oid), oid); + } + } else { + for (String oid: SMALL) { + // 6 -> 6 + check(out(oid), oid); + // 7 -> 6 + check(out7(oid), oid); + } + for (String oid: HUGE) { + // 7 -> 6 fails for HUGE oids + boolean ok = false; + try { + check(out7(oid), oid); + ok = true; + } catch (Exception e) { + System.out.println(e); + } + if (ok) { + throw new Exception(); + } + } + } + } else { + // Generates the JDK6 serialized string inside this test, call + // $JDK7/bin/java S11N dump7 + // $JDK6/bin/java S11N dump6 + // and paste the output at the end of this test. + dump(args[0], SMALL); + // For jdk6, the following line will throw an exception, ignore it + dump(args[0], HUGE); + } + } + + // Gets the serialized form for jdk6 + private static byte[] out6(String oid) throws Exception { + return new sun.misc.BASE64Decoder().decodeBuffer(dump6.get(oid)); + } + + // Gets the serialized form for jdk7 + private static byte[] out7(String oid) throws Exception { + return new sun.misc.BASE64Decoder().decodeBuffer(dump7.get(oid)); + } + + // Gets the serialized form for this java + private static byte[] out(String oid) throws Exception { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + new ObjectOutputStream(bout).writeObject(new ObjectIdentifier(oid)); + return bout.toByteArray(); + } + + // Makes sure serialized form can be deserialized + private static void check(byte[] in, String oid) throws Exception { + ObjectIdentifier o = (ObjectIdentifier) ( + new ObjectInputStream(new ByteArrayInputStream(in)).readObject()); + if (!o.toString().equals(oid)) { + throw new Exception("Read Fail " + o + ", not " + oid); + } + } + + // dump serialized form to java code style text + private static void dump(String title, String[] oids) throws Exception { + for (String oid: oids) { + String[] base64 = encoder.encodeBuffer(out(oid)).split("\n"); + System.out.println(" " + title + ".put(\"" + oid + "\","); + for (int i = 0; i<base64.length; i++) { + System.out.print(" \"" + base64[i] + "\""); + if (i == base64.length - 1) { + System.out.println(");"); + } else { + System.out.println(" +"); + } + } + } + } + + // Do not use diamond operator, this test is also meant to run in jdk6 + private static Map<String,String> dump7 = new HashMap<String,String>(); + private static Map<String,String> dump6 = new HashMap<String,String>(); + + static { + ////////////// PASTE BEGIN ////////////// + dump7.put("0.0", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" + + "AAACAAAAAAAAAAB1cgACW0Ks8xf4BghU4AIAAHhwAAAAAQB4"); + dump7.put("1.1", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" + + "AAACAAAAAQAAAAF1cgACW0Ks8xf4BghU4AIAAHhwAAAAASl4"); + dump7.put("2.2", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAAnVyAAJbSU26YCZ26rKlAgAAeHAA" + + "AAACAAAAAgAAAAJ1cgACW0Ks8xf4BghU4AIAAHhwAAAAAVJ4"); + dump7.put("1.2.3456", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAAA3VyAAJbSU26YCZ26rKlAgAAeHAA" + + "AAADAAAAAQAAAAIAAA2AdXIAAltCrPMX+AYIVOACAAB4cAAAAAMqmwB4"); + dump7.put("1.2.2147483647.4", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAABHVyAAJbSU26YCZ26rKlAgAAeHAA" + + "AAAEAAAAAQAAAAJ/////AAAABHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHKof///9/" + + "BHg="); + dump7.put("1.2.268435456.4", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhwAAAABHVyAAJbSU26YCZ26rKlAgAAeHAA" + + "AAAEAAAAAQAAAAIQAAAAAAAABHVyAAJbQqzzF/gGCFTgAgAAeHAAAAAHKoGAgIAA" + + "BHg="); + dump7.put("2.16.764.1.3101555394.1.0.100.2.1", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" + + "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" + + "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAADmCFfAGLxvf1QgEAZAIB" + + "eA=="); + dump7.put("1.2.2147483648.4", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" + + "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" + + "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAByqIgICAAAR4"); + dump7.put("2.3.4444444444444444444444", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" + + "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" + + "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAADFOD4e+HpNG968eOHHg="); + dump7.put("1.2.8888888888888888.33333333333333333.44444444444444", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4DAANJAAxjb21wb25lbnRMZW5MAApjb21wb25lbnRzdAASTGphdmEvbGFuZy9P" + + "YmplY3Q7WwAIZW5jb2Rpbmd0AAJbQnhw/////3NyAD5zdW4uc2VjdXJpdHkudXRp" + + "bC5PYmplY3RJZGVudGlmaWVyJEh1Z2VPaWROb3RTdXBwb3J0ZWRCeU9sZEpESwAA" + + "AAAAAAABAgAAeHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAGCqP5Yzbxa6cOLubj9ek" + + "japVio3AusuOHHg="); + + dump6.put("0.0", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" + + "W0lNumAmduqypQIAAHhwAAAAAgAAAAAAAAAA"); + dump6.put("1.1", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" + + "W0lNumAmduqypQIAAHhwAAAAAgAAAAEAAAAB"); + dump6.put("2.2", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAJ1cgAC" + + "W0lNumAmduqypQIAAHhwAAAAAgAAAAIAAAAC"); + dump6.put("1.2.3456", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAN1cgAC" + + "W0lNumAmduqypQIAAHhwAAAAAwAAAAEAAAACAAANgA=="); + dump6.put("1.2.2147483647.4", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAR1cgAC" + + "W0lNumAmduqypQIAAHhwAAAABAAAAAEAAAACf////wAAAAQ="); + dump6.put("1.2.268435456.4", + "rO0ABXNyACJzdW4uc2VjdXJpdHkudXRpbC5PYmplY3RJZGVudGlmaWVyeLIO7GQX" + + "fy4CAAJJAAxjb21wb25lbnRMZW5bAApjb21wb25lbnRzdAACW0l4cAAAAAR1cgAC" + + "W0lNumAmduqypQIAAHhwAAAABAAAAAEAAAACEAAAAAAAAAQ="); + ////////////// PASTE END ////////////// + } +}
--- a/test/sun/security/util/Oid/S11N.sh Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -# -# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# @test -# @bug 4811968 6908628 -# @summary Serialization compatibility with old versions (and fix) -# @author Weijun Wang -# -# set a few environment variables so that the shell-script can run stand-alone -# in the source directory - -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi -if [ "${TESTCLASSES}" = "" ] ; then - TESTCLASSES="." -fi -if [ "${TESTJAVA}" = "" ] ; then - echo "TESTJAVA not set. Test cannot execute." - echo "FAILED!!!" - exit 1 -fi - -# set platform-dependent variables -PF="" - -OS=`uname -s` -case "$OS" in - SunOS ) - FS="/" - ARCH=`isainfo` - case "$ARCH" in - sparc* ) - PF="solaris-sparc" - ;; - i[3-6]86 ) - PF="solaris-i586" - ;; - amd64* ) - PF="solaris-amd64" - ;; - * ) - echo "Unsupported System: Solaris ${ARCH}" - exit 0; - ;; - esac - ;; - Linux ) - ARCH=`uname -m` - FS="/" - case "$ARCH" in - i[3-6]86 ) - PF="linux-i586" - ;; - amd64* ) - PF="linux-amd64" - ;; - * ) - echo "Unsupported System: Linux ${ARCH}" - exit 0; - ;; - esac - ;; - Windows* ) - FS="\\" - PF="windows-i586" - - # 'uname -m' does not give us enough information - - # should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk), - # but JTREG does not pass this env variable when executing a shell script. - # - # execute test program - rely on it to exit if platform unsupported - - ;; - * ) - echo "Unsupported System: ${OS}" - exit 0; - ;; -esac - -# the test code - -${TESTJAVA}${FS}bin${FS}javac -target 1.4 -source 1.4 \ - -d . ${TESTSRC}${FS}SerialTest.java || exit 10 - -OLDJAVA=" - /java/re/j2se/1.6.0/latest/binaries/${PF} - /java/re/j2se/1.5.0/latest/binaries/${PF} - /java/re/j2se/1.4.2/latest/binaries/${PF} -" - -SMALL=" - 0.0 - 1.1 - 2.2 - 1.2.3456 - 1.2.2147483647.4 - 1.2.268435456.4 -" - -HUGE=" - 2.16.764.1.3101555394.1.0.100.2.1 - 1.2.2147483648.4 - 2.3.4444444444444444444444 - 1.2.888888888888888888.111111111111111.2222222222222.33333333333333333.44444444444444 -" - -for oid in ${SMALL}; do - echo ${oid} - # new -> - ${TESTJAVA}${FS}bin${FS}java SerialTest out ${oid} > tmp.oid.serial || exit 1 - # -> new - ${TESTJAVA}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial || exit 2 - for oldj in ${OLDJAVA}; do - if [ -d ${oldj} ]; then - echo ${oldj} - # -> old - ${oldj}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial || exit 3 - # old -> - ${oldj}${FS}bin${FS}java SerialTest out ${oid} > tmp.oid.serial.old || exit 4 - # -> new - ${TESTJAVA}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial.old || exit 5 - fi - done -done - -for oid in ${HUGE}; do - echo ${oid} - # new -> - ${TESTJAVA}${FS}bin${FS}java SerialTest out ${oid} > tmp.oid.serial || exit 1 - # -> new - ${TESTJAVA}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial || exit 2 - for oldj in ${OLDJAVA}; do - if [ -d ${oldj} ]; then - echo ${oldj} - # -> old - ${oldj}${FS}bin${FS}java SerialTest badin < tmp.oid.serial || exit 3 - fi - done -done - -rm -f tmp.oid.serial -rm -f tmp.oid.serial.old -rm -f SerialTest.class - -for oldj in ${OLDJAVA}; do - if [ ! -d ${oldj} ]; then - echo WARNING: ${oldj} is missing. Test incomplete! > /dev/stderr - fi -done - -exit 0
--- a/test/sun/security/util/Oid/SerialTest.java Tue Jun 18 14:04:33 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * read S11.sh - */ -import java.io.*; -import sun.security.util.*; - -/** - * Test OID serialization between versions - * - * java SerialTest out oid // write a OID into System.out - * java SerialTest in oid // read from System.in and compare it with oid - * java SerialTest badin // make sure *cannot* read from System.in - */ -class SerialTest { - public static void main(String[] args) throws Exception { - if (args[0].equals("out")) - out(args[1]); - else if (args[0].equals("in")) - in(args[1]); - else - badin(); - } - - static void in(String oid) throws Exception { - ObjectIdentifier o = (ObjectIdentifier) (new ObjectInputStream(System.in).readObject()); - if (!o.toString().equals(oid)) - throw new Exception("Read Fail " + o + ", not " + oid); - } - - static void badin() throws Exception { - boolean pass = true; - try { - new ObjectInputStream(System.in).readObject(); - } catch (Exception e) { - pass = false; - } - if (pass) throw new Exception("Should fail but not"); - } - - static void out(String oid) throws Exception { - new ObjectOutputStream(System.out).writeObject(new ObjectIdentifier(oid)); - } -}
--- a/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java Fri Jun 21 15:46:14 2013 -0500 @@ -24,9 +24,12 @@ /* * @test * @bug 4162868 + * @run main/othervm ExtensibleAlgorithmId * @summary Algorithm Name-to-OID mapping needs to be made extensible. */ +// Run in othervm, coz AlgorithmId.oidTable is only initialized once + import java.security.*; import sun.security.x509.AlgorithmId;
--- a/test/sun/tools/common/ApplicationSetup.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/common/ApplicationSetup.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ { appOutput="${TESTCLASSES}/Application.out" - ${JAVA} -XX:+UsePerfData -classpath "${TESTCLASSES}" "$@" > "$appOutput" 2>&1 & + ${JAVA} -XX:+UsePerfData -classpath "${TESTCLASSPATH:-${TESTCLASSES}}" "$@" > "$appOutput" 2>&1 & appJavaPid="$!" appOtherPid= appPidList="$appJavaPid" @@ -131,7 +131,7 @@ # stopApplication() { - $JAVA -XX:+UsePerfData -classpath "${TESTCLASSES}" ShutdownSimpleApplication $1 + $JAVA -XX:+UsePerfData -classpath "${TESTCLASSPATH:-${TESTCLASSES}}" ShutdownSimpleApplication $1 }
--- a/test/sun/tools/jcmd/jcmd-Defaults.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jcmd/jcmd-Defaults.sh Fri Jun 21 15:46:14 2013 -0500 @@ -28,6 +28,6 @@ JCMD="${TESTJAVA}/bin/jcmd" -${JCMD} 2>&1 | awk -f ${TESTSRC}/jcmd_Output1.awk +${JCMD} -J-XX:+UsePerfData 2>&1 | awk -f ${TESTSRC}/jcmd_Output1.awk -${JCMD} -l 2>&1 | awk -f ${TESTSRC}/jcmd_Output1.awk +${JCMD} -J-XX:+UsePerfData -l 2>&1 | awk -f ${TESTSRC}/jcmd_Output1.awk
--- a/test/sun/tools/jcmd/jcmd-f.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jcmd/jcmd-f.sh Fri Jun 21 15:46:14 2013 -0500 @@ -46,7 +46,7 @@ # -f <script> rm -f jcmd.out 2>/dev/null -${JCMD} $appJavaPid -f ${TESTSRC}/dcmd-script.txt | awk '{ if (NR>1) print $0;}' > jcmd.out 2>&1 +${JCMD} -J-XX:+UsePerfData $appJavaPid -f ${TESTSRC}/dcmd-script.txt | awk '{ if (NR>1) print $0;}' > jcmd.out 2>&1 echo jcmd.out diff -w jcmd.out ${TESTSRC}/help_help.out if [ $? != 0 ]; then
--- a/test/sun/tools/jcmd/jcmd-help-help.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jcmd/jcmd-help-help.sh Fri Jun 21 15:46:14 2013 -0500 @@ -46,7 +46,7 @@ # help help rm -f jcmd.out 2>/dev/null -${JCMD} $appJavaPid help help | awk '{ if (NR>1) print $0;}' > jcmd.out 2>&1 +${JCMD} -J-XX:+UsePerfData $appJavaPid help help | awk '{ if (NR>1) print $0;}' > jcmd.out 2>&1 echo jcmd.out diff -w jcmd.out ${TESTSRC}/help_help.out if [ $? != 0 ]; then
--- a/test/sun/tools/jcmd/jcmd-help.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jcmd/jcmd-help.sh Fri Jun 21 15:46:14 2013 -0500 @@ -29,7 +29,7 @@ JCMD="${TESTJAVA}/bin/jcmd" rm -f jcmd.out 2>/dev/null -${JCMD} -h > jcmd.out 2>&1 +${JCMD} -J-XX:+UsePerfData -h > jcmd.out 2>&1 diff -w jcmd.out ${TESTSRC}/usage.out if [ $? != 0 ] @@ -40,7 +40,7 @@ fi rm -f jcmd.out 2>/dev/null -${JCMD} -help > jcmd.out 2>&1 +${JCMD} -J-XX:+UsePerfData -help > jcmd.out 2>&1 diff -w jcmd.out ${TESTSRC}/usage.out if [ $? != 0 ]
--- a/test/sun/tools/jcmd/jcmd-pid.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jcmd/jcmd-pid.sh Fri Jun 21 15:46:14 2013 -0500 @@ -45,11 +45,11 @@ failed=0 # help command -${JCMD} $appJavaPid help 2>&1 | awk -f ${TESTSRC}/jcmd_pid_Output1.awk +${JCMD} -J-XX:+UsePerfData $appJavaPid help 2>&1 | awk -f ${TESTSRC}/jcmd_pid_Output1.awk if [ $? != 0 ]; then failed=1; fi # PerfCounter.list option -${JCMD} $appJavaPid PerfCounter.print 2>&1 | awk -f ${TESTSRC}/jcmd_pid_Output2.awk +${JCMD} -J-XX:+UsePerfData $appJavaPid PerfCounter.print 2>&1 | awk -f ${TESTSRC}/jcmd_pid_Output2.awk if [ $? != 0 ]; then failed=1; fi set -e
--- a/test/sun/tools/jcmd/jcmd_Output1.awk Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jcmd/jcmd_Output1.awk Fri Jun 21 15:46:14 2013 -0500 @@ -1,26 +1,31 @@ # BEGIN { - totallines=0; matched=0 + totallines=0; matched=0; current=0 } # match on a main class name followed by arbitrary arguments /^[0-9]+ [a-z|A-Z][a-z|A-Z|0-9|\.]*($| .*$)/ { - matched++; + current=1; } # or match on a path name to a jar file followed by arbitraty arguments # - note, jar files ending with ".jar" is only a convention, not a requirement. #Theoretically, any valid file name could occur here. /^[0-9]+ .*\.jar($| .*$)/ { - matched++; + current=1; } # or match on the condition that the class name is not available -/^[0-9]+ -- process information unavailable$/ { - matched++; +/^[0-9]+ -- .*$/ { + current=1; } - { totallines++; print $0 } +# or match an empty class name +/^[0-9]+ $/ { + current=1; + } + + { totallines++; matched+=current; current=0; print $0 } END { if ((totallines > 0) && (matched == totallines)) {
--- a/test/sun/tools/jinfo/Basic.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jinfo/Basic.sh Fri Jun 21 15:46:14 2013 -0500 @@ -44,7 +44,20 @@ failed=0 -if [ $isWindows = false ]; then +# Skip SA options for now, see 7175133 +runSA=false + +if [ $isLinux = true ]; then + # Some Linux systems disable non-child ptrace (see 7050524) + ptrace_scope=`/sbin/sysctl -n kernel.yama.ptrace_scope` + if [ $? = 0 ]; then + if [ $ptrace_scope = 1 ]; then + runSA=false + fi + fi +fi + +if [ $runSA = true ]; then # -sysprops option ${JINFO} -J-XX:+UsePerfData -sysprops $appJavaPid if [ $? != 0 ]; then failed=1; fi
--- a/test/sun/tools/jps/jps-Vvml_2.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jps/jps-Vvml_2.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ # and we can not set -XX:+UsePerfData as that invalidates the test premise of # there being no jvm flags -${JAVA} -cp ${TESTCLASSES} Sleeper & +${JAVA} -cp ${TESTCLASSPATH:-${TESTCLASSES}} Sleeper & SLEEPER_PID=$! ${JPS} -J-XX:Flags=${TESTSRC}/vmflags -Vvml | awk -f ${TESTSRC}/jps-Vvml_Output2.awk
--- a/test/sun/tools/jps/jps-l_Output1.awk Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jps/jps-l_Output1.awk Fri Jun 21 15:46:14 2013 -0500 @@ -16,7 +16,12 @@ } # or match on the condition that the class name is not available -/^[0-9]+ -- process information unavailable$/ { +/^[0-9]+ -- .*$/ { + matched++; + } + +# or match an empty class name +/^[0-9]+ $/ { matched++; }
--- a/test/sun/tools/jps/jps-m_2.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jps/jps-m_2.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ # any args to Sleeper.main(), as we need to inspect jps output # for the no args condition. # -${JAVA} -XX:+UsePerfData -cp ${TESTCLASSES} Sleeper & +${JAVA} -XX:+UsePerfData -cp ${TESTCLASSPATH:-${TESTCLASSES}} Sleeper & SLEEPER_PID=$! ${JPS} -J-XX:+UsePerfData -m | awk -f ${TESTSRC}/jps-m_Output2.awk
--- a/test/sun/tools/jps/jps_Output1.awk Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jps/jps_Output1.awk Fri Jun 21 15:46:14 2013 -0500 @@ -16,7 +16,12 @@ } # or match on the condition that the class name is not available -/^[0-9]+ -- process information unavailable$/ { +/^[0-9]+ -- .*$/ { + matched++; + } + +# or match an empty class name +/^[0-9]+ $/ { matched++; }
--- a/test/sun/tools/jstat/jstatClassOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatClassOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -class 0 2>&1 | awk -f ${TESTSRC}/classOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -class 0 2>&1 | awk -f ${TESTSRC}/classOutput1.awk
--- a/test/sun/tools/jstat/jstatClassloadOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatClassloadOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -classload -J-Djstat.showUnsupported=true 0 2>&1 | awk -f ${TESTSRC}/classloadOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -classload -J-Djstat.showUnsupported=true 0 2>&1 | awk -f ${TESTSRC}/classloadOutput1.awk
--- a/test/sun/tools/jstat/jstatCompilerOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatCompilerOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -compiler 0 2>&1 | awk -f ${TESTSRC}/compilerOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -compiler 0 2>&1 | awk -f ${TESTSRC}/compilerOutput1.awk
--- a/test/sun/tools/jstat/jstatFileURITest1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatFileURITest1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,12 +40,12 @@ # characters into forward slash characters in an effort to convert # TESTSRC into a canonical form useable as URI path. cp ${TESTSRC}/hsperfdata_3433 . - ${JSTAT} -J-XX:+UsePerfData -gcutil file:/`pwd`/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk + ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil file:/`pwd`/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk RC=$? rm -f hsperfdata_3433 2>&1 > /dev/null ;; *) - ${JSTAT} -J-XX:+UsePerfData -gcutil file:${TESTSRC}/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk + ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil file:${TESTSRC}/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk RC=$? ;; esac
--- a/test/sun/tools/jstat/jstatGcCapacityOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcCapacityOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk
--- a/test/sun/tools/jstat/jstatGcCauseOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcCauseOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -37,4 +37,4 @@ # class machine, ergonomics will automatically use UseParallelGC. # The UseParallelGC collector does not currently update the gc cause counters. -${JSTAT} -J-XX:+UsePerfData -J-XX:+UseSerialGC -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -J-XX:+UseSerialGC -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk
--- a/test/sun/tools/jstat/jstatGcNewCapacityOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcNewCapacityOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk
--- a/test/sun/tools/jstat/jstatGcNewOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcNewOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk
--- a/test/sun/tools/jstat/jstatGcOldCapacityOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcOldCapacityOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk
--- a/test/sun/tools/jstat/jstatGcOldOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcOldOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk
--- a/test/sun/tools/jstat/jstatGcOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk
--- a/test/sun/tools/jstat/jstatGcPermCapacityOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatGcPermCapacityOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcpermcapacity 0 2>&1 | awk -f ${TESTSRC}/gcPermCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcpermcapacity 0 2>&1 | awk -f ${TESTSRC}/gcPermCapacityOutput1.awk
--- a/test/sun/tools/jstat/jstatLineCounts1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatLineCounts1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk
--- a/test/sun/tools/jstat/jstatLineCounts2.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatLineCounts2.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk
--- a/test/sun/tools/jstat/jstatLineCounts3.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatLineCounts3.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk
--- a/test/sun/tools/jstat/jstatLineCounts4.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatLineCounts4.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk
--- a/test/sun/tools/jstat/jstatOptions1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatOptions1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,8 +33,8 @@ JSTAT="${TESTJAVA}/bin/jstat" rm -f jstat.out1 jstat.out2 2>/dev/null -${JSTAT} -J-XX:+UsePerfData -options > jstat.out1 2>&1 -${JSTAT} -J-XX:+UsePerfData -options -J-Djstat.showUnsupported=true > jstat.out2 2>&1 +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -options > jstat.out1 2>&1 +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -options -J-Djstat.showUnsupported=true > jstat.out2 2>&1 diff -w jstat.out1 ${TESTSRC}/options1.out diff -w jstat.out2 ${TESTSRC}/options2.out
--- a/test/sun/tools/jstat/jstatPrintCompilationOutput1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatPrintCompilationOutput1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -35,4 +35,4 @@ # run with -Xcomp as jstat may complete too quickly to assure # that compilation occurs. -${JSTAT} -J-XX:+UsePerfData -J-Xcomp -printcompilation 0 2>&1 | awk -f ${TESTSRC}/printCompilationOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -J-Xcomp -printcompilation 0 2>&1 | awk -f ${TESTSRC}/printCompilationOutput1.awk
--- a/test/sun/tools/jstat/jstatSnap1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatSnap1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -snap 0 2>&1 | awk -f ${TESTSRC}/snap1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -snap 0 2>&1 | awk -f ${TESTSRC}/snap1.awk
--- a/test/sun/tools/jstat/jstatSnap2.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatSnap2.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -J-Djstat.showUnsupported=true -snap 0 2>&1 | awk -f ${TESTSRC}/snap2.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -J-Djstat.showUnsupported=true -snap 0 2>&1 | awk -f ${TESTSRC}/snap2.awk
--- a/test/sun/tools/jstat/jstatTimeStamp1.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstat/jstatTimeStamp1.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -33,4 +33,4 @@ JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil -t 0 2>&1 | awk -f ${TESTSRC}/timeStamp1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil -t 0 2>&1 | awk -f ${TESTSRC}/timeStamp1.awk
--- a/test/sun/tools/jstatd/jpsOutput1.awk Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstatd/jpsOutput1.awk Fri Jun 21 15:46:14 2013 -0500 @@ -7,7 +7,11 @@ matched++; } -/^[0-9]+ -- process information unavailable$/ { +/^[0-9]+ -- .*$/ { + matched++; + } + +/^[0-9]+ $/ { matched++; }
--- a/test/sun/tools/jstatd/jstatdDefaults.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstatd/jstatdDefaults.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -60,7 +60,7 @@ exit 1 fi -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ]
--- a/test/sun/tools/jstatd/jstatdExternalRegistry.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstatd/jstatdExternalRegistry.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,7 @@ exit 1 fi -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ]
--- a/test/sun/tools/jstatd/jstatdPort.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstatd/jstatdPort.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ exit 1 fi -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ]
--- a/test/sun/tools/jstatd/jstatdServerName.sh Tue Jun 18 14:04:33 2013 +0100 +++ b/test/sun/tools/jstatd/jstatdServerName.sh Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -86,8 +86,8 @@ exit 1 fi -echo "running: ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5" -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5" +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ] @@ -95,8 +95,8 @@ echo "jstat output differs from expected output" fi -echo "running: ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5" -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5" +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ]
--- a/test/tools/launcher/Arrrghs.java Tue Jun 18 14:04:33 2013 +0100 +++ b/test/tools/launcher/Arrrghs.java Fri Jun 21 15:46:14 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -311,6 +311,7 @@ checkArgumentParsing("../../*", "../../*"); checkArgumentParsing("..\\..\\", "..\\..\\"); checkArgumentParsing("../../", "../../"); + checkArgumentParsing("a b\\ c", "a", "b\\", "c"); } private void initEmptyDir(File emptyDir) throws IOException {