Mercurial > hg > release > icedtea7-forest-2.3 > jdk
changeset 5749:5e57911564be icedtea-2.3.6
Merge jdk7u13-b20
line wrap: on
line diff
--- a/.hgtags Mon Feb 11 18:36:31 2013 +0000 +++ b/.hgtags Mon Feb 11 21:39:50 2013 +0000 @@ -223,3 +223,35 @@ ca6ee539c5f4f4dd9d5fb9b0604d94c5806c3e28 icedtea-2.3.6 ca6ee539c5f4f4dd9d5fb9b0604d94c5806c3e28 icedtea-2.3.6 0000000000000000000000000000000000000000 icedtea-2.3.6 +78e01a6ca8d30e8fc4eb297d297a098edfb3fec6 jdk7u7-b10 +9666d4e4bbf3f80614e246d5c15df86154544013 jdk7u7-b30 +94154c14973aee7c5ff4846af7bcb71fe7a82fa5 jdk7u7-b11 +f93d2e3b2610b612401c95dd56d1a1122d35f676 jdk7u7-b31 +94a7d51992ae6fd31f9adc15c4976d6354dca14d jdk7u7-b01 +901c290c9c8b495a2696f10a87523363239d001b jdk7u7-b02 +0e2200a8762c1fdbd1ea812ba3f6535245372c81 jdk7u9-b03 +0000000000000000000000000000000000000000 jdk7u7-b01 +94a7d51992ae6fd31f9adc15c4976d6354dca14d jdk7u9-b01 +0000000000000000000000000000000000000000 jdk7u7-b02 +901c290c9c8b495a2696f10a87523363239d001b jdk7u9-b02 +7302c386ca9c6cd20c27d0a2adb0b142f679d6b3 jdk7u9-b04 +ffad06d7009576c3098705e05452ebc309a59e56 jdk7u9-b05 +c1efb11d7db509dafd7882811b2562ba593f6431 jdk7u10-b10 +0243e41000c6f76654725cac31ffdc95633c63e7 jdk7u10-b11 +c86a49dd4a0dca3a56f00429cfcffb2ad5f2a224 jdk7u10-b12 +c6de70ed568d190c9c7d9641b88b9b5f1bc36fd5 jdk7u10-b13 +abe96e9e10f973cf0fdacc1475e69a274ef76fcf jdk7u10-b14 +c9a0e381cd8eaf62bcacfd59b01c249de81ae167 jdk7u10-b15 +ed59989fb0635f2d4461173e218c43494f06bb82 jdk7u10-b16 +a1c5bac982a6d4aa58f551cb46cde53f526aca48 jdk7u10-b17 +115d1e4365293846bbc911cf312886c471e37fbd jdk7u10-b18 +84218dff5e4c7bc00fd9266769c0d12bdde866f5 jdk7u10-b30 +ecc14534318c80dc7612c8b1d328a67849c5b07f jdk7u11-b20 +d9969a953f693f5760b1d2759f11a2cb222e4f20 jdk7u11-b21 +84da14fbd3ac12a3c6734fa4b6a366cfde1426af jdk7u11-b03 +932ef74edbf984299a68c126c70bbe04ffbde9b5 jdk7u11-b04 +fb35fb91f6478f8076993bcc4112746bcd9a2985 jdk7u11-b05 +f26def552d2c4873aeaee00241f60efc462a11a7 jdk7u11-b06 +1d14a3d7bac870423e52a889d2f5f60ee76ddc6a jdk7u11-b07 +ee61b528b3f866b20095f5e9593896d4ea4be468 jdk7u11-b08 +0b9564dab118d40bc5edc60269f736f97ab6f385 jdk7u13-b09
--- a/make/com/oracle/security/ucrypto/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/make/com/oracle/security/ucrypto/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -198,9 +198,9 @@ # # Build ucrypto.jar. # - $(UNSIGNED_DIR)/ucrypto.jar: build + $(UNSIGNED_DIR)/ucrypto.jar: build $(JCE_MANIFEST_FILE) $(prep-target) - $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \ + $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \ $(BOOT_JAR_JFLAGS) @$(java-vm-cleanup)
--- a/make/common/Program.gmk Mon Feb 11 18:36:31 2013 +0000 +++ b/make/common/Program.gmk Mon Feb 11 21:39:50 2013 +0000 @@ -178,7 +178,6 @@ ifndef LOCAL_RESOURCE_FILE @$(ECHO) $(OBJDIR)/$(PROGRAM).res >> $@ endif # LOCAL_RESOURCE_FILE - @$(ECHO) setargv.obj >> $@ @$(ECHO) Created $@ $(ACTUAL_PROGRAM):: $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
--- a/make/common/Release.gmk Mon Feb 11 18:36:31 2013 +0000 +++ b/make/common/Release.gmk Mon Feb 11 21:39:50 2013 +0000 @@ -402,10 +402,29 @@ sun/tools/jinfo \ sun/tools/jmap +JFR_SRCDIRS_EXIST := $(shell \ + if [ -d $(CLOSED_SHARE_SRC)/classes/com/oracle/jrockit/jfr ] ; then \ + echo true; \ + else \ + echo false; \ + fi) + +BUILD_JFR= +ifndef OPENJDK +ifndef JAVASE_EMBEDDED +ifeq ($(JFR_SRCDIRS_EXIST), true) +BUILD_JFR=true +endif +endif +endif + # classes that go into jfr.jar +JFR_CLASSES_DIRS= +ifdef BUILD_JFR JFR_CLASSES_DIRS= \ com/oracle/jrockit/jfr \ oracle/jrockit/jfr +endif # classes that go into jsse.jar JSSE_CLASSES_DIRS = \ @@ -609,8 +628,7 @@ $(ECHO) "sun/tools/jstack/" >> $@ $(ECHO) "sun/tools/jinfo/" >> $@ $(ECHO) "sun/tools/jmap/" >> $@ -ifndef OPENJDK -ifndef JAVASE_EMBEDDED +ifdef BUILD_JFR $(ECHO) "com/oracle/jrockit/jfr/" >> $@ $(ECHO) "com/oracle/jrockit/jfr/client/" >> $@ $(ECHO) "com/oracle/jrockit/jfr/management/" >> $@ @@ -621,7 +639,7 @@ $(ECHO) "oracle/jrockit/jfr/settings/" >> $@ $(ECHO) "oracle/jrockit/jfr/tools/" >> $@ endif -endif + # File order list for rt.jar @@ -648,8 +666,7 @@ # Create jfr.jar JFR_JAR= -ifndef OPENJDK -ifndef JAVASE_EMBEDDED +ifdef BUILD_JFR JFR_JAR=$(ABS_TEMPDIR)/jfr-orig.jar $(JFR_JAR): $(OTHER_JAR_MANIFEST_FILE) $(prep-target) @@ -658,7 +675,6 @@ $(JFR_CLASSES_DIRS) $(BOOT_JAR_JFLAGS) @$(CD) $(CLASSBINDIR) && $(java-vm-cleanup) endif -endif # Create the rt.jar file list & non-class files list
--- a/make/java/jli/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/make/java/jli/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -92,7 +92,8 @@ # add platform specific files ifeq ($(PLATFORM), windows) - FILES_c += java_md.c + FILES_c += java_md.c \ + cmdtoargs.c else # NIXES FILES_c += java_md_common.c ifeq ($(PLATFORM), macosx) @@ -151,7 +152,11 @@ -export:JLI_ReportErrorMessage \ -export:JLI_ReportErrorMessageSys \ -export:JLI_ReportMessage \ - -export:JLI_ReportExceptionDescription + -export:JLI_ReportExceptionDescription \ + -export:JLI_MemAlloc \ + -export:JLI_CmdToArgs \ + -export:JLI_GetStdArgc \ + -export:JLI_GetStdArgs endif # PLATFORM OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)
--- a/make/java/jli/mapfile-vers Mon Feb 11 18:36:31 2013 +0000 +++ b/make/java/jli/mapfile-vers Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2008, 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 @@ -35,9 +35,8 @@ JLI_ReportErrorMessageSys; JLI_ReportMessage; JLI_ReportExceptionDescription; -# JNI_CreateJavaVM; -# JNI_GetCreatedJavaVMs; -# JNI_GetDefaultJavaVMInitArgs; + JLI_GetStdArgs; + JLI_GetStdArgc; local: *; };
--- a/make/java/net/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/make/java/net/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -74,6 +74,7 @@ FILES_export += java/net/DualStackPlainSocketImpl.java FILES_export += java/net/TwoStacksPlainDatagramSocketImpl.java FILES_export += java/net/DualStackPlainDatagramSocketImpl.java + FILES_export += sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java else FILES_export += java/net/PlainDatagramSocketImpl.java endif
--- a/make/java/nio/mapfile-linux Mon Feb 11 18:36:31 2013 +0000 +++ b/make/java/nio/mapfile-linux Mon Feb 11 21:39:50 2013 +0000 @@ -88,6 +88,7 @@ Java_sun_nio_ch_IOUtil_drain; Java_sun_nio_ch_IOUtil_fdVal; Java_sun_nio_ch_IOUtil_initIDs; + Java_sun_nio_ch_IOUtil_iovMax; Java_sun_nio_ch_IOUtil_makePipe; Java_sun_nio_ch_IOUtil_randomBytes; Java_sun_nio_ch_IOUtil_setfdVal;
--- a/make/java/nio/mapfile-solaris Mon Feb 11 18:36:31 2013 +0000 +++ b/make/java/nio/mapfile-solaris Mon Feb 11 21:39:50 2013 +0000 @@ -76,6 +76,7 @@ Java_sun_nio_ch_IOUtil_drain; Java_sun_nio_ch_IOUtil_fdVal; Java_sun_nio_ch_IOUtil_initIDs; + Java_sun_nio_ch_IOUtil_iovMax; Java_sun_nio_ch_IOUtil_makePipe; Java_sun_nio_ch_IOUtil_randomBytes; Java_sun_nio_ch_IOUtil_setfdVal;
--- a/make/javax/crypto/Defs-jce.gmk Mon Feb 11 18:36:31 2013 +0000 +++ b/make/javax/crypto/Defs-jce.gmk Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2011, 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 @@ -31,7 +31,7 @@ JCE_MANIFEST_FILE = $(TEMPDIR)/manifest.mf $(JCE_MANIFEST_FILE): $(MAINMANIFEST) $(prep-target) - $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \ + $(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \ -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \ $(MAINMANIFEST) >> $@ $(ECHO) "Extension-Name: javax.crypto" >> $@
--- a/make/sun/javazic/tzdata/VERSION Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/VERSION Mon Feb 11 21:39:50 2013 +0000 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2012c +tzdata2012i
--- a/make/sun/javazic/tzdata/africa Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/africa Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)africa 8.35 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -261,7 +260,7 @@ # I received a mail from an airline which says that the daylight # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07. # From Jesper Norgaard Welen (2007-08-15): [The following agree:] -# http://www.nentjes.info/Bill/bill5.htm +# http://www.nentjes.info/Bill/bill5.htm # http://www.timeanddate.com/worldclock/city.html?n=53 # From Steffen Thorsen (2007-09-04): The official information...: # http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm @@ -315,18 +314,18 @@ # in September. # From Steffen Thorsen (2009-08-11): -# We have been able to confirm the August change with the Egyptian Cabinet +# We have been able to confirm the August change with the Egyptian Cabinet # Information and Decision Support Center: # <a href="http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html"> # http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html # </a> -# +# # The Middle East News Agency # <a href="http://www.mena.org.eg/index.aspx"> # http://www.mena.org.eg/index.aspx # </a> # also reports "Egypt starts winter time on August 21" -# today in article numbered "71, 11/08/2009 12:25 GMT." +# today in article numbered "71, 11/08/2009 12:25 GMT." # Only the title above is available without a subscription to their service, # and can be found by searching for "winter" in their search engine # (at least today). @@ -505,7 +504,7 @@ # From Steffen Thorsen (2008-06-25): # Mauritius plans to observe DST from 2008-11-01 to 2009-03-31 on a trial # basis.... -# It seems that Mauritius observed daylight saving time from 1982-10-10 to +# It seems that Mauritius observed daylight saving time from 1982-10-10 to # 1983-03-20 as well, but that was not successful.... # http://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html @@ -529,12 +528,12 @@ # than previously announced (2008-11-01 to 2009-03-31). The new start # date is 2008-10-26 at 02:00 and the new end date is 2009-03-27 (no time # given, but it is probably at either 2 or 3 wall clock time). -# -# A little strange though, since the article says that they moved the date -# to align itself with Europe and USA which also change time on that date, -# but that means they have not paid attention to what happened in -# USA/Canada last year (DST ends first Sunday in November). I also wonder -# why that they end on a Friday, instead of aligning with Europe which +# +# A little strange though, since the article says that they moved the date +# to align itself with Europe and USA which also change time on that date, +# but that means they have not paid attention to what happened in +# USA/Canada last year (DST ends first Sunday in November). I also wonder +# why that they end on a Friday, instead of aligning with Europe which # changes two days later. # From Alex Krivenyshev (2008-07-11): @@ -593,7 +592,7 @@ # </a> # From Arthur David Olson (2009-07-11): -# The "mauritius-dst-will-not-repeat" wrapup includes this: +# The "mauritius-dst-will-not-repeat" wrapup includes this: # "The trial ended on March 29, 2009, when the clocks moved back by one hour # at 2am (or 02:00) local time..." @@ -687,8 +686,8 @@ # XXX--guess that it is only Morocco for now; guess only 2008 for now. # From Steffen Thorsen (2008-08-27): -# Morocco will change the clocks back on the midnight between August 31 -# and September 1. They originally planned to observe DST to near the end +# Morocco will change the clocks back on the midnight between August 31 +# and September 1. They originally planned to observe DST to near the end # of September: # # One article about it (in French): @@ -822,6 +821,23 @@ # "...à partir du dernier dimance d'avril et non fins mars, # comme annoncé précédemment." +# From Milamber Space Network (2012-07-17): +# The official return to GMT is announced by the Moroccan government: +# <a href="http://www.mmsp.gov.ma/fr/actualites.aspx?id=288"> +# http://www.mmsp.gov.ma/fr/actualites.aspx?id=288 [in French] +# </a> +# +# Google translation, lightly edited: +# Back to the standard time of the Kingdom (GMT) +# Pursuant to Decree No. 2-12-126 issued on 26 Jumada (I) 1433 (April 18, +# 2012) and in accordance with the order of Mr. President of the +# Government No. 3-47-12 issued on 24 Sha'ban (11 July 2012), the Ministry +# of Public Service and Administration Modernization announces the return +# of the legal time of the Kingdom (GMT) from Friday, July 20, 2012 until +# Monday, August 20, 2012. So the time will be delayed by 60 minutes from +# 3:00 am Friday, July 20, 2012 and will again be advanced by 60 minutes +# August 20, 2012 from 2:00 am. + # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Morocco 1939 only - Sep 12 0:00 1:00 S @@ -849,6 +865,8 @@ Rule Morocco 2011 only - Jul 31 0 0 - Rule Morocco 2012 max - 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 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 @@ -877,7 +895,7 @@ # Forecasting Riaan van Zyl explained that the far eastern parts of # the country are close to 40 minutes earlier in sunrise than the rest # of the country. -# +# # From Paul Eggert (2007-03-31): # Apparently the Caprivi Strip informally observes Botswana time, but # we have no details. In the meantime people there can use Africa/Gaborone.
--- a/make/sun/javazic/tzdata/antarctica Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/antarctica Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)antarctica 8.10 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/asia Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/asia Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)asia 8.73 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -125,7 +124,7 @@ # From Alexander Krivenyshev (2012-02-10): # According to News Armenia, on Feb 9, 2012, # http://newsarmenia.ru/society/20120209/42609695.html -# +# # The Armenia National Assembly adopted final reading of Amendments to the # Law "On procedure of calculation time on the territory of the Republic of # Armenia" according to which Armenia [is] abolishing Daylight Saving Time. @@ -205,15 +204,15 @@ # </a> # From A. N. M. Kamrus Saadat (2009-06-15): -# Finally we've got the official mail regarding DST start time where DST start -# time is mentioned as Jun 19 2009, 23:00 from BTRC (Bangladesh -# Telecommunication Regulatory Commission). +# Finally we've got the official mail regarding DST start time where DST start +# time is mentioned as Jun 19 2009, 23:00 from BTRC (Bangladesh +# Telecommunication Regulatory Commission). # # No DST end date has been announced yet. # From Alexander Krivenyshev (2009-09-25): -# Bangladesh won't go back to Standard Time from October 1, 2009, -# instead it will continue DST measure till the cabinet makes a fresh decision. +# Bangladesh won't go back to Standard Time from October 1, 2009, +# instead it will continue DST measure till the cabinet makes a fresh decision. # # Following report by same newspaper-"The Daily Star Friday": # "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1" @@ -227,8 +226,8 @@ # From Steffen Thorsen (2009-10-13): # IANS (Indo-Asian News Service) now reports: -# Bangladesh has decided that the clock advanced by an hour to make -# maximum use of daylight hours as an energy saving measure would +# Bangladesh has decided that the clock advanced by an hour to make +# maximum use of daylight hours as an energy saving measure would # "continue for an indefinite period." # # One of many places where it is published: @@ -256,7 +255,7 @@ # From Alexander Krivenyshev (2010-03-22): # According to Bangladesh newspaper "The Daily Star," -# Cabinet cancels Daylight Saving Time +# Cabinet cancels Daylight Saving Time # <a href="http://www.thedailystar.net/newDesign/latest_news.php?nid=22817"> # http://www.thedailystar.net/newDesign/latest_news.php?nid=22817 # </a> @@ -384,11 +383,11 @@ # observing daylight saving time in 1986. # # From Thomas S. Mullaney (2008-02-11): -# I think you're combining two subjects that need to treated -# separately: daylight savings (which, you're correct, wasn't -# implemented until the 1980s) and the unified time zone centered near -# Beijing (which was implemented in 1949). Briefly, there was also a -# "Lhasa Time" in Tibet and "Urumqi Time" in Xinjiang. The first was +# I think you're combining two subjects that need to treated +# separately: daylight savings (which, you're correct, wasn't +# implemented until the 1980s) and the unified time zone centered near +# Beijing (which was implemented in 1949). Briefly, there was also a +# "Lhasa Time" in Tibet and "Urumqi Time" in Xinjiang. The first was # ceased, and the second eventually recognized (again, in the 1980s). # # From Paul Eggert (2008-06-30): @@ -525,7 +524,7 @@ # as of 2009-10-28: # Year Period # 1941 1 Apr to 30 Sep -# 1942 Whole year +# 1942 Whole year # 1943 Whole year # 1944 Whole year # 1945 Whole year @@ -616,16 +615,16 @@ # From Arthur David Olson (2010-04-07): # Here's Google's translation of the table at the bottom of the "summert.htm" page: # Decade Name Start and end date -# Republic of China 34 years to 40 years (AD 1945-1951 years) Summer Time May 1 to September 30 -# 41 years of the Republic of China (AD 1952) Daylight Saving Time March 1 to October 31 -# Republic of China 42 years to 43 years (AD 1953-1954 years) Daylight Saving Time April 1 to October 31 -# In the 44 years to 45 years (AD 1955-1956 years) Daylight Saving Time April 1 to September 30 -# Republic of China 46 years to 48 years (AD 1957-1959) Summer Time April 1 to September 30 -# Republic of China 49 years to 50 years (AD 1960-1961) Summer Time June 1 to September 30 -# Republic of China 51 years to 62 years (AD 1962-1973 years) Stop Summer Time -# Republic of China 63 years to 64 years (1974-1975 AD) Daylight Saving Time April 1 to September 30 -# Republic of China 65 years to 67 years (1976-1978 AD) Stop Daylight Saving Time -# Republic of China 68 years (AD 1979) Daylight Saving Time July 1 to September 30 +# Republic of China 34 years to 40 years (AD 1945-1951 years) Summer Time May 1 to September 30 +# 41 years of the Republic of China (AD 1952) Daylight Saving Time March 1 to October 31 +# Republic of China 42 years to 43 years (AD 1953-1954 years) Daylight Saving Time April 1 to October 31 +# In the 44 years to 45 years (AD 1955-1956 years) Daylight Saving Time April 1 to September 30 +# Republic of China 46 years to 48 years (AD 1957-1959) Summer Time April 1 to September 30 +# Republic of China 49 years to 50 years (AD 1960-1961) Summer Time June 1 to September 30 +# Republic of China 51 years to 62 years (AD 1962-1973 years) Stop Summer Time +# Republic of China 63 years to 64 years (1974-1975 AD) Daylight Saving Time April 1 to September 30 +# Republic of China 65 years to 67 years (1976-1978 AD) Stop Daylight Saving Time +# Republic of China 68 years (AD 1979) Daylight Saving Time July 1 to September 30 # Republic of China since 69 years (AD 1980) Stop Daylight Saving Time # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1194,15 +1193,15 @@ # # ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+beyond.ps -# From Paul Eggert (2005-02-22): +# From Paul Eggert (2012-10-26): # I used Ephraim Silverberg's dst-israel.el program # <ftp://ftp.cs.huji.ac.il/pub/tz/software/dst-israel.el> (2005-02-20) # along with Ed Reingold's cal-hebrew in GNU Emacs 21.4, -# to generate the transitions in this list. +# to generate the transitions from 2005 through 2012. # (I replaced "lastFri" with "Fri>=26" by hand.) -# The spring transitions below all correspond to the following Rule: +# The spring transitions all correspond to the following Rule: # -# Rule Zion 2005 max - Mar Fri>=26 2:00 1:00 D +# Rule Zion 2005 2012 - Mar Fri>=26 2:00 1:00 D # # but older zic implementations (e.g., Solaris 8) do not support # "Fri>=26" to mean April 1 in years like 2005, so for now we list the @@ -1219,39 +1218,36 @@ Rule Zion 2010 only - Sep 12 2:00 0 S Rule Zion 2011 only - Apr 1 2:00 1:00 D Rule Zion 2011 only - Oct 2 2:00 0 S -Rule Zion 2012 2015 - Mar Fri>=26 2:00 1:00 D +Rule Zion 2012 only - Mar Fri>=26 2:00 1:00 D Rule Zion 2012 only - Sep 23 2:00 0 S -Rule Zion 2013 only - Sep 8 2:00 0 S -Rule Zion 2014 only - Sep 28 2:00 0 S -Rule Zion 2015 only - Sep 20 2:00 0 S -Rule Zion 2016 only - Apr 1 2:00 1:00 D -Rule Zion 2016 only - Oct 9 2:00 0 S -Rule Zion 2017 2021 - Mar Fri>=26 2:00 1:00 D -Rule Zion 2017 only - Sep 24 2:00 0 S -Rule Zion 2018 only - Sep 16 2:00 0 S -Rule Zion 2019 only - Oct 6 2:00 0 S -Rule Zion 2020 only - Sep 27 2:00 0 S -Rule Zion 2021 only - Sep 12 2:00 0 S -Rule Zion 2022 only - Apr 1 2:00 1:00 D -Rule Zion 2022 only - Oct 2 2:00 0 S -Rule Zion 2023 2032 - Mar Fri>=26 2:00 1:00 D -Rule Zion 2023 only - Sep 24 2:00 0 S -Rule Zion 2024 only - Oct 6 2:00 0 S -Rule Zion 2025 only - Sep 28 2:00 0 S -Rule Zion 2026 only - Sep 20 2:00 0 S -Rule Zion 2027 only - Oct 10 2:00 0 S -Rule Zion 2028 only - Sep 24 2:00 0 S -Rule Zion 2029 only - Sep 16 2:00 0 S -Rule Zion 2030 only - Oct 6 2:00 0 S -Rule Zion 2031 only - Sep 21 2:00 0 S -Rule Zion 2032 only - Sep 12 2:00 0 S -Rule Zion 2033 only - Apr 1 2:00 1:00 D -Rule Zion 2033 only - Oct 2 2:00 0 S -Rule Zion 2034 2037 - Mar Fri>=26 2:00 1:00 D -Rule Zion 2034 only - Sep 17 2:00 0 S -Rule Zion 2035 only - Oct 7 2:00 0 S -Rule Zion 2036 only - Sep 28 2:00 0 S -Rule Zion 2037 only - Sep 13 2:00 0 S + +# From Ephraim Silverberg (2012-10-18): + +# Yesterday, the Interior Ministry Committee, after more than a year +# past, approved sending the proposed June 2011 changes to the Time +# Decree Law back to the Knesset for second and third (final) votes +# before the upcoming elections on Jan. 22, 2013. Hence, although the +# changes are not yet law, they are expected to be so before February 2013. +# +# As of 2013, DST starts at 02:00 on the Friday before the last Sunday in March. +# DST ends at 02:00 on the first Sunday after October 1, unless it occurs on the +# second day of the Jewish Rosh Hashana holiday, in which case DST ends a day +# later (i.e. at 02:00 the first Monday after October 2). +# [Rosh Hashana holidays are factored in until 2100.] + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Zion 2013 max - Mar Fri>=23 2:00 1:00 D +Rule Zion 2013 2026 - Oct Sun>=2 2:00 0 S +Rule Zion 2027 only - Oct Mon>=3 2:00 0 S +Rule Zion 2028 max - Oct Sun>=2 2:00 0 S +# The following rules are commented out for now, as they break older +# versions of zic that support only signed 32-bit timestamps, i.e., +# through 2038-01-19 03:14:07 UTC. +#Rule Zion 2028 2053 - Oct Sun>=2 2:00 0 S +#Rule Zion 2054 only - Oct Mon>=3 2:00 0 S +#Rule Zion 2055 2080 - Oct Sun>=2 2:00 0 S +#Rule Zion 2081 only - Oct Mon>=3 2:00 0 S +#Rule Zion 2082 max - Oct Sun>=2 2:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Jerusalem 2:20:56 - LMT 1880 @@ -1386,6 +1382,16 @@ # From Arthur David Olson (2009-04-06): # We still have Jordan switching to DST on Thursdays in 2000 and 2001. +# From Steffen Thorsen (2012-10-25): +# Yesterday the government in Jordan announced that they will not +# switch back to standard time this winter, so the will stay on DST +# until about the same time next year (at least). +# http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?NewsID=88950 +# +# From Paul Eggert (2012-10-25): +# For now, assume this is just a one-year measure. If it becomes +# permanent, we should move Jordan from EET to AST effective tomorrow. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S Rule Jordan 1973 1975 - Oct 1 0:00 0 - @@ -1414,7 +1420,8 @@ Rule Jordan 2003 only - Oct 24 0:00s 0 - Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - -Rule Jordan 2006 max - Oct lastFri 0:00s 0 - +Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - +Rule Jordan 2013 max - Oct lastFri 0:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT @@ -1859,15 +1866,15 @@ # shown 8 per cent higher consumption of electricity. # From Alex Krivenyshev (2008-05-15): -# -# Here is an article that Pakistan plan to introduce Daylight Saving Time +# +# Here is an article that Pakistan plan to introduce Daylight Saving Time # on June 1, 2008 for 3 months. -# -# "... The federal cabinet on Wednesday announced a new conservation plan to help -# reduce load shedding by approving the closure of commercial centres at 9pm and -# moving clocks forward by one hour for the next three months. +# +# "... The federal cabinet on Wednesday announced a new conservation plan to help +# reduce load shedding by approving the closure of commercial centres at 9pm and +# moving clocks forward by one hour for the next three months. # ...." -# +# # <a href="http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html"> # http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html # </a> @@ -1927,7 +1934,7 @@ # Government has decided to restore the previous time by moving the # clocks backward by one hour from October 1. A formal announcement to # this effect will be made after the Prime Minister grants approval in -# this regard." +# this regard." # <a href="http://www.thenews.com.pk/updates.asp?id=87168"> # http://www.thenews.com.pk/updates.asp?id=87168 # </a> @@ -2223,7 +2230,7 @@ # <a href="http://www.maannews.net/eng/ViewDetails.aspx?ID=306795"> # http://www.maannews.net/eng/ViewDetails.aspx?ID=306795 # </a> -# the clocks were set back one hour at 2010-08-11 00:00:00 local time in +# the clocks were set back one hour at 2010-08-11 00:00:00 local time in # Gaza and the West Bank. # Some more background info: # <a href="http://www.timeanddate.com/news/time/westbank-gaza-end-dst-2010.html"> @@ -2262,7 +2269,7 @@ # The rules for Egypt are stolen from the `africa' file. # From Steffen Thorsen (2011-09-30): -# West Bank did end Daylight Saving Time this morning/midnight (2011-09-30 +# West Bank did end Daylight Saving Time this morning/midnight (2011-09-30 # 00:00). # So West Bank and Gaza now have the same time again. # @@ -2317,6 +2324,8 @@ # From Arthur David Olson (2011-09-20): # 2011 transitions per http://www.timeanddate.com as of 2011-09-20. +# From Paul Eggert (2012-10-12): +# 2012 transitions per http://www.timeanddate.com as of 2012-10-12. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -2327,7 +2336,7 @@ 2:00 Palestine EE%sT 2011 Apr 2 12:01 2:00 1:00 EEST 2011 Aug 1 2:00 - EET 2012 Mar 30 - 2:00 1:00 EEST 2012 Sep 28 + 2:00 1:00 EEST 2012 Sep 21 1:00 2:00 - EET Zone Asia/Hebron 2:20:23 - LMT 1900 Oct @@ -2342,7 +2351,7 @@ 2:00 - EET 2011 Aug 30 2:00 1:00 EEST 2011 Sep 30 3:00 2:00 - EET 2012 Mar 30 - 2:00 1:00 EEST 2012 Sep 28 3:00 + 2:00 1:00 EEST 2012 Sep 21 1:00 2:00 - EET # Paracel Is @@ -2536,19 +2545,19 @@ # having it between Wednesday and Thursday (two workdays in Syria) since the # weekend in Syria is not Saturday and Sunday, but Friday and Saturday. So now # it is implemented at midnight of the last workday before weekend... -# +# # From Steffen Thorsen (2007-10-27): # Jesper Norgaard Welen wrote: -# +# # > "Winter local time in Syria will be observed at midnight of Thursday 1 # > November 2007, and the clock will be put back 1 hour." -# +# # I found confirmation on this in this gov.sy-article (Arabic): # http://wehda.alwehda.gov.sy/_print_veiw.asp?FileName=12521710520070926111247 -# +# # which using Google's translate tools says: -# Council of Ministers also approved the commencement of work on -# identifying the winter time as of Friday, 2/11/2007 where the 60th +# Council of Ministers also approved the commencement of work on +# identifying the winter time as of Friday, 2/11/2007 where the 60th # minute delay at midnight Thursday 1/11/2007. Rule Syria 2007 only - Nov Fri>=1 0:00 0 - @@ -2614,8 +2623,8 @@ # </a> # From Steffen Thorsen (2009-10-27): -# The Syrian Arab News Network on 2009-09-29 reported that Syria will -# revert back to winter (standard) time on midnight between Thursday +# The Syrian Arab News Network on 2009-09-29 reported that Syria will +# revert back to winter (standard) time on midnight between Thursday # 2009-10-29 and Friday 2009-10-30: # <a href="http://www.sana.sy/ara/2/2009/09/29/247012.htm"> # http://www.sana.sy/ara/2/2009/09/29/247012.htm (Arabic)
--- a/make/sun/javazic/tzdata/australasia Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/australasia Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)australasia 8.30 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -307,9 +306,9 @@ # </a> # From Alexander Krivenyshev (2010-10-24): -# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 +# According to Radio Fiji and Fiji Times online, Fiji will end DST 3 # weeks earlier than expected - on March 6, 2011, not March 27, 2011... -# Here is confirmation from Government of the Republic of the Fiji Islands, +# Here is confirmation from Government of the Republic of the Fiji Islands, # Ministry of Information (fiji.gov.fj) web site: # <a href="http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155"> # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155 @@ -320,15 +319,15 @@ # </a> # From Steffen Thorsen (2011-10-03): -# Now the dates have been confirmed, and at least our start date +# Now the dates have been confirmed, and at least our start date # assumption was correct (end date was one week wrong). # # <a href="http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=4966:daylight-saving-starts-in-fiji&catid=71:press-releases&Itemid=155"> # www.fiji.gov.fj/index.php?option=com_content&view=article&id=4966:daylight-saving-starts-in-fiji&catid=71:press-releases&Itemid=155 # </a> # which says -# Members of the public are reminded to change their time to one hour in -# advance at 2am to 3am on October 23, 2011 and one hour back at 3am to +# Members of the public are reminded to change their time to one hour in +# advance at 2am to 3am on October 23, 2011 and one hour back at 3am to # 2am on February 26 next year. # From Ken Rylander (2011-10-24) @@ -345,15 +344,23 @@ # The commencement of daylight saving will remain unchanged and start # on the 23rd of October, 2011. +# From the Fiji Government Online Portal (2012-08-21) via Steffen Thorsen: +# The Minister for Labour, Industrial Relations and Employment Mr Jone Usamate +# today confirmed that Fiji will start daylight savings at 2 am on Sunday 21st +# October 2012 and end at 3 am on Sunday 20th January 2013. +# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155 +# +# From Paul Eggert (2012-08-31): +# For now, guess a pattern of the penultimate Sundays in October and January. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S Rule Fiji 1999 2000 - Feb lastSun 3:00 0 - Rule Fiji 2009 only - Nov 29 2:00 1:00 S Rule Fiji 2010 only - Mar lastSun 3:00 0 - -Rule Fiji 2010 only - Oct 24 2:00 1:00 S +Rule Fiji 2010 max - Oct Sun>=18 2:00 1:00 S Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - -Rule Fiji 2011 only - Oct 23 2:00 1:00 S -Rule Fiji 2012 only - Jan 22 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 12:00 Fiji FJ%sT # Fiji Time @@ -582,7 +589,7 @@ # From David Zuelke (2011-05-09): # Subject: Samoa to move timezone from east to west of international date line -# +# # <a href="http://www.morningstar.co.uk/uk/markets/newsfeeditem.aspx?id=138501958347963"> # http://www.morningstar.co.uk/uk/markets/newsfeeditem.aspx?id=138501958347963 # </a> @@ -644,6 +651,23 @@ # Although Samoa has used Daylight Saving Time in the 2010-2011 and 2011-2012 # seasons, there is not yet any indication that this trend will continue on # a regular basis. For now, we have explicitly listed the transitions below. +# +# From Nicky (2012-09-10): +# Daylight Saving Time commences on Sunday 30th September 2012 and +# ends on Sunday 7th of April 2013. +# +# Please find link below for more information. +# http://www.mcil.gov.ws/mcil_publications.html +# +# That publication also includes dates for Summer of 2013/4 as well +# which give the impression of a pattern in selecting dates for the +# future, so for now, we will guess this will continue. + +# Western Samoa +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule WS 2012 max - Sep lastSun 3:00 1 D +Rule WS 2012 max - Apr Sun>=1 4:00 0 - +# Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5 -11:26:56 - LMT 1911 -11:30 - SAMT 1950 # Samoa Time @@ -651,8 +675,8 @@ -11:00 1:00 WSDT 2011 Apr 2 4:00 -11:00 - WST 2011 Sep 24 3:00 -11:00 1:00 WSDT 2011 Dec 30 - 13:00 1:00 WSDT 2012 Apr 1 4:00 - 13:00 - WST + 13:00 1:00 WSDT 2012 Apr Sun>=1 4:00 + 13:00 WS WS%sT # Solomon Is # excludes Bougainville, for which see Papua New Guinea @@ -664,25 +688,25 @@ # # From Gwillim Law (2011-12-29) # A correspondent informed me that Tokelau, like Samoa, will be skipping -# December 31 this year, thereby changing its time zone from UTC-10 to -# UTC+14. When I tried to verify this statement, I found a confirming -# article in Time magazine online -# <a href="http://www.time.com/time/world/article/0,8599,2103243,00.html"> -# (http://www.time.com/time/world/article/0,8599,2103243,00.html). -# </a> +# December 31 this year ... # -# From Jonathan Leffler (2011-12-29) -# Information from the BBC to the same effect: -# <a href="http://www.bbc.co.uk/news/world-asia-16351377"> -# http://www.bbc.co.uk/news/world-asia-16351377 -# </a> +# From Steffen Thorsen (2012-07-25) +# ... we double checked by calling hotels and offices based in Tokelau asking +# about the time there, and they all told a time that agrees with UTC+13.... +# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change +# actually was to UTC-11 back then. # -# Patch supplied by Tim Parenti (2011-12-29) +# From Paul Eggert (2012-07-25) +# A Google Books snippet of Appendix to the Journals of the House of +# Representatives of New Zealand, Session 1948, +# <http://books.google.com/books?id=ZaVCAQAAIAAJ>, page 65, says Tokelau +# was "11 hours slow on G.M.T." Go with Thorsen and assume Shanks & Pottenger +# are off by an hour starting in 1901. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fakaofo -11:24:56 - LMT 1901 - -10:00 - TKT 2011 Dec 30 # Tokelau Time - 14:00 - TKT + -11:00 - TKT 2011 Dec 30 # Tokelau Time + 13:00 - TKT # Tonga # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1363,22 +1387,22 @@ # See "southeast Australia" above for 2008 and later. # From Steffen Thorsen (2009-04-28): -# According to the official press release, South Australia's extended daylight -# saving period will continue with the same rules as used during the 2008-2009 +# According to the official press release, South Australia's extended daylight +# saving period will continue with the same rules as used during the 2008-2009 # summer (southern hemisphere). -# +# # From # <a href="http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf"> # http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf # </a> -# The extended daylight saving period that South Australia has been trialling +# The extended daylight saving period that South Australia has been trialling # for over the last year is now set to be ongoing. -# Daylight saving will continue to start on the first Sunday in October each +# Daylight saving will continue to start on the first Sunday in October each # year and finish on the first Sunday in April the following year. -# Industrial Relations Minister, Paul Caica, says this provides South Australia -# with a consistent half hour time difference with NSW, Victoria, Tasmania and +# Industrial Relations Minister, Paul Caica, says this provides South Australia +# with a consistent half hour time difference with NSW, Victoria, Tasmania and # the ACT for all 52 weeks of the year... -# +# # We have a wrap-up here: # <a href="http://www.timeanddate.com/news/time/south-australia-extends-dst.html"> # http://www.timeanddate.com/news/time/south-australia-extends-dst.html
--- a/make/sun/javazic/tzdata/backward Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/backward Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)backward 8.11 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/etcetera Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/etcetera Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)etcetera 8.3 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/europe Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/europe Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)europe 8.41 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -598,12 +597,12 @@ # According to Kremlin press service, Russian President Dmitry Medvedev # signed a federal law "On calculation of time" on June 9, 2011. # According to the law Russia is abolishing daylight saving time. -# -# Medvedev signed a law "On the Calculation of Time" (in russian): +# +# Medvedev signed a law "On the Calculation of Time" (in russian): # <a href="http://bmockbe.ru/events/?ID=7583"> # http://bmockbe.ru/events/?ID=7583 # </a> -# +# # Medvedev signed a law on the calculation of the time (in russian): # <a href="http://www.regnum.ru/news/polit/1413906.html"> # http://www.regnum.ru/news/polit/1413906.html @@ -1711,7 +1710,7 @@ # From Alexander Krivenyshev (2011-10-26) # NO need to divide Moldova into two timezones at this point. # As of today, Transnistria (Pridnestrovie)- Tiraspol reversed its own -# decision to abolish DST this winter. +# decision to abolish DST this winter. # Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)- # Tiraspol will go back to winter time on October 30, 2011. # News from Moldova (in russian): @@ -2601,11 +2600,11 @@ # http://www.alomaliye.com/bkk_2002_3769.htm # From Gökdeniz Karadağ (2011-03-10): -# +# # According to the articles linked below, Turkey will change into summer # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27. # This change is due to a nationwide exam on 27th. -# +# # <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872"> # http://www.worldbulletin.net/?aType=haber&ArticleID=70872 # </a> @@ -2722,7 +2721,7 @@ # time this year after all. # # From Udo Schwedt (2011-10-18): -# As far as I understand, the recent change to the Ukranian time zone +# As far as I understand, the recent change to the Ukranian time zone # (Europe/Kiev) to introduce permanent daylight saving time (similar # to Russia) was reverted today: #
--- a/make/sun/javazic/tzdata/factory Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/factory Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)factory 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/iso3166.tab Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/iso3166.tab Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)iso3166.tab 8.11 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # ISO 3166 alpha-2 country codes
--- a/make/sun/javazic/tzdata/leapseconds Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/leapseconds Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)leapseconds 8.13 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -101,8 +100,8 @@ # # # A positive leap second will be introduced at the end of June 2012. -# The sequence of dates of the UTC second markers will be: -# +# The sequence of dates of the UTC second markers will be: +# # 2012 June 30, 23h 59m 59s # 2012 June 30, 23h 59m 60s # 2012 July 1, 0h 0m 0s @@ -119,6 +118,6 @@ # # # Daniel GAMBIS -# Head +# Head # Earth Orientation Center of IERS # Observatoire de Paris, France
--- a/make/sun/javazic/tzdata/northamerica Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/northamerica Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)northamerica 8.54 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -502,7 +501,7 @@ -8:00 US P%sT 1946 -8:00 - PST 1969 -8:00 US P%sT 1980 Apr 27 2:00 - -9:00 US Y%sT 1980 Oct 26 2:00 + -9:00 US Y%sT 1980 Oct 26 2:00 -8:00 US P%sT 1983 Oct 30 2:00 -9:00 US Y%sT 1983 Nov 30 -9:00 US AK%sT @@ -1867,7 +1866,7 @@ # Here is a summary of the three clock change events in Creston's history: # 1. 1884 or 1885: adoption of Mountain Standard Time (GMT-7) # Exact date unknown -# 2. Oct 1916: switch to Pacific Standard Time (GMT-8) +# 2. Oct 1916: switch to Pacific Standard Time (GMT-8) # Exact date in October unknown; Sunday October 1 is a reasonable guess. # 3. June 1918: switch to Pacific Daylight Time (GMT-7) # Exact date in June unknown; Sunday June 2 is a reasonable guess. @@ -2697,20 +2696,20 @@ # except that it switches at midnight standard time as usual. # # From Steffen Thorsen (2007-10-25): -# Carlos Alberto Fonseca Arauz informed me that Cuba will end DST one week +# Carlos Alberto Fonseca Arauz informed me that Cuba will end DST one week # earlier - on the last Sunday of October, just like in 2006. -# +# # He supplied these references: -# +# # http://www.prensalatina.com.mx/article.asp?ID=%7B4CC32C1B-A9F7-42FB-8A07-8631AFC923AF%7D&language=ES # http://actualidad.terra.es/sociedad/articulo/cuba_llama_ahorrar_energia_cambio_1957044.htm -# +# # From Alex Kryvenishev (2007-10-25): # Here is also article from Granma (Cuba): -# +# # [Regira] el Horario Normal desde el [proximo] domingo 28 de octubre # http://www.granma.cubaweb.cu/2007/10/24/nacional/artic07.html -# +# # http://www.worldtimezone.com/dst_news/dst_news_cuba03.html # From Arthur David Olson (2008-03-09): @@ -2794,7 +2793,7 @@ # </a> # # From Steffen Thorsen (2011-10-30) -# Cuba will end DST two weeks later this year. Instead of going back +# Cuba will end DST two weeks later this year. Instead of going back # tonight, it has been delayed to 2011-11-13 at 01:00. # # One source (Spanish) @@ -2806,11 +2805,11 @@ # <a href="http://www.timeanddate.com/news/time/cuba-time-changes-2011.html"> # http://www.timeanddate.com/news/time/cuba-time-changes-2011.html # </a> -# +# # From Steffen Thorsen (2012-03-01) -# According to Radio Reloj, Cuba will start DST on Midnight between March +# According to Radio Reloj, Cuba will start DST on Midnight between March # 31 and April 1. -# +# # Radio Reloj has the following info (Spanish): # <a href="http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril"> # http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril @@ -2821,6 +2820,13 @@ # http://www.timeanddate.com/news/time/cuba-starts-dst-2012.html # </a> +# From Steffen Thorsen (2012-11-03): +# Radio Reloj and many other sources report that Cuba is changing back +# to standard time on 2012-11-04: +# http://www.radioreloj.cu/index.php/noticias-radio-reloj/36-nacionales/9961-regira-horario-normal-en-cuba-desde-el-domingo-cuatro-de-noviembre +# From Paul Eggert (2012-11-03): +# For now, assume the future rule is first Sunday in November. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Cuba 1928 only - Jun 10 0:00 1:00 D Rule Cuba 1928 only - Oct 10 0:00 0 S @@ -2858,7 +2864,7 @@ Rule Cuba 2011 only - Mar Sun>=15 0:00s 1:00 D Rule Cuba 2011 only - Nov 13 0:00s 0 S Rule Cuba 2012 only - Apr 1 0:00s 1:00 D -Rule Cuba 2012 max - Oct lastSun 0:00s 0 S +Rule Cuba 2012 max - Nov Sun>=1 0:00s 0 S Rule Cuba 2013 max - Mar Sun>=8 0:00s 1:00 D # Zone NAME GMTOFF RULES FORMAT [UNTIL]
--- a/make/sun/javazic/tzdata/pacificnew Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/pacificnew Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)pacificnew 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/solar87 Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/solar87 Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)solar87 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/solar88 Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/solar88 Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)solar88 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/solar89 Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/solar89 Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)solar89 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/southamerica Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/southamerica Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)southamerica 8.53 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -255,7 +254,7 @@ Rule Arg 2007 only - Dec 30 0:00 1:00 S Rule Arg 2008 2009 - Mar Sun>=15 0:00 0 - Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 S - + # From Mariano Absatz (2004-05-21): # Today it was officially published that the Province of Mendoza is changing # its timezone this winter... starting tomorrow night.... @@ -345,9 +344,9 @@ # confirms what Alex Krivenyshev has earlier sent to the tz # emailing list about that San Luis plans to return to standard # time much earlier than the rest of the country. It also -# confirms that upon request the provinces San Juan and Mendoza -# refused to follow San Luis in this change. -# +# confirms that upon request the provinces San Juan and Mendoza +# refused to follow San Luis in this change. +# # The change is supposed to take place Monday the 21.st at 0:00 # hours. As far as I understand it if this goes ahead, we need # a new timezone for San Luis (although there are also documented @@ -409,7 +408,7 @@ # <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912"> # 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. @@ -823,8 +822,8 @@ # # From Alexander Krivenyshev (2011-10-04): # State Bahia will return to Daylight savings time this year after 8 years off. -# The announcement was made by Governor Jaques Wagner in an interview to a -# television station in Salvador. +# The announcement was made by Governor Jaques Wagner in an interview to a +# television station in Salvador. # In Portuguese: # <a href="http://g1.globo.com/bahia/noticia/2011/10/governador-jaques-wagner-confirma-horario-de-verao-na-bahia.html"> @@ -853,6 +852,15 @@ # http://www.in.gov.br/visualiza/index.jsp?data=13/10/2011&jornal=1000&pagina=6&totalArquivos=6 # </a> +# From Kelley Cook (2012-10-16): +# The governor of state of Bahia in Brazil announced on Thursday that +# due to public pressure, he is reversing the DST policy they implemented +# last year and will not be going to Summer Time on October 21st.... +# http://www.correio24horas.com.br/r/artigo/apos-pressoes-wagner-suspende-horario-de-verao-na-bahia + +# From Rodrigo Severo (2012-10-16): +# Tocantins state will have DST. +# http://noticias.terra.com.br/brasil/noticias/0,,OI6232536-EI306.html # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Decree <a href="http://pcdsh01.on.br/HV20466.htm">20,466</a> (1931-10-01) @@ -1072,7 +1080,8 @@ -3:00 Brazil BR%sT 1990 Sep 17 -3:00 - BRT 1995 Sep 14 -3:00 Brazil BR%sT 2003 Sep 24 - -3:00 - BRT + -3:00 - BRT 2012 Oct 21 + -3:00 Brazil BR%sT # # Alagoas (AL), Sergipe (SE) Zone America/Maceio -2:22:52 - LMT 1914 @@ -1091,7 +1100,8 @@ Zone America/Bahia -2:34:04 - LMT 1914 -3:00 Brazil BR%sT 2003 Sep 24 -3:00 - BRT 2011 Oct 16 - -3:00 Brazil BR%sT + -3:00 Brazil BR%sT 2012 Oct 21 + -3:00 - BRT # # Goias (GO), Distrito Federal (DF), Minas Gerais (MG), # Espirito Santo (ES), Rio de Janeiro (RJ), Sao Paulo (SP), Parana (PR), @@ -1183,7 +1193,7 @@ # Due to drought, Chile extends Daylight Time in three weeks. This # is one-time change (Saturday 3/29 at 24:00 for America/Santiago # and Saturday 3/29 at 22:00 for Pacific/Easter) -# The Supreme Decree is located at +# The Supreme Decree is located at # <a href="http://www.shoa.cl/servicios/supremo316.pdf"> # http://www.shoa.cl/servicios/supremo316.pdf # </a> @@ -1194,7 +1204,7 @@ # From Jose Miguel Garrido (2008-03-05): # ... -# You could see the announces of the change on +# You could see the announces of the change on # <a href="http://www.shoa.cl/noticias/2008/04hora/hora.htm"> # http://www.shoa.cl/noticias/2008/04hora/hora.htm # </a>.
--- a/make/sun/javazic/tzdata/systemv Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/systemv Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)systemv 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson.
--- a/make/sun/javazic/tzdata/zone.tab Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/javazic/tzdata/zone.tab Mon Feb 11 21:39:50 2013 +0000 @@ -22,7 +22,6 @@ # questions. # # <pre> -# @(#)zone.tab 8.55 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. #
--- a/make/sun/security/ec/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/security/ec/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -245,9 +245,9 @@ # # Build sunec.jar. # -$(UNSIGNED_DIR)/sunec.jar: build +$(UNSIGNED_DIR)/sunec.jar: build $(JCE_MANIFEST_FILE) $(prep-target) - $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \ + $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \ $(BOOT_JAR_JFLAGS) @$(java-vm-cleanup)
--- a/make/sun/security/mscapi/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/security/mscapi/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -210,9 +210,9 @@ # # Build sunmscapi.jar. # -$(UNSIGNED_DIR)/sunmscapi.jar: build +$(UNSIGNED_DIR)/sunmscapi.jar: build $(JCE_MANIFEST_FILE) $(prep-target) - $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \ + $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \ $(BOOT_JAR_JFLAGS) @$(java-vm-cleanup)
--- a/make/sun/security/pkcs11/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/make/sun/security/pkcs11/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -224,9 +224,9 @@ # # Build sunpkcs11.jar. # -$(UNSIGNED_DIR)/sunpkcs11.jar: build +$(UNSIGNED_DIR)/sunpkcs11.jar: build $(JCE_MANIFEST_FILE) $(prep-target) - $(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \ + $(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@ $(JAR_DIRS) \ $(BOOT_JAR_JFLAGS) @$(java-vm-cleanup)
--- a/src/macosx/classes/com/apple/laf/ScreenMenuItem.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/com/apple/laf/ScreenMenuItem.java Mon Feb 11 21:39:50 2013 +0000 @@ -34,7 +34,7 @@ import sun.lwawt.macosx.CMenuItem; -class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler { +final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler { ScreenMenuPropertyListener fListener; JMenuItem fMenuItem; @@ -96,19 +96,32 @@ fMenuItem.removeComponentListener(this); } - public void setAccelerator(final KeyStroke ks) { - if (ks == null) { - setShortcut(null); + static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) { + final MenuComponentPeer peer = menuItem.getPeer(); + if (!(peer instanceof CMenuItem)) { + //Is it possible? return; } + final CMenuItem cmi = (CMenuItem) peer; + if (ks == null) { + cmi.setLabel(label); + } else { + cmi.setLabel(label, ks.getKeyChar(), ks.getKeyCode(), + ks.getModifiers()); + } + } - final MenuComponentPeer peer = getPeer(); - if (peer instanceof CMenuItem) { - final CMenuItem ourPeer = (CMenuItem)peer; - ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers()); - } else { - setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0)); - } + @Override + public synchronized void setLabel(final String label) { + syncLabelAndKS(this, label, fMenuItem.getAccelerator()); + } + + @Override + public void setAccelerator(final KeyStroke ks) { + // We call CMenuItem.setLabel(..,..,..) directly and does not initialize + // shortcut property. So shortcut property should not be used from the + // peers code directly or indirectly. + syncLabelAndKS(this, fMenuItem.getText(), ks); } public void actionPerformed(final ActionEvent e) {
--- a/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java Mon Feb 11 21:39:50 2013 +0000 @@ -36,7 +36,7 @@ import sun.lwawt.macosx.*; -class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener { +final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener { JMenuItem fMenuItem; MenuContainer fParent; @@ -110,19 +110,17 @@ super.removeNotify(); } - public void setAccelerator(final KeyStroke ks) { - if (ks == null) { - setShortcut(null); - return; - } + @Override + public synchronized void setLabel(final String label) { + ScreenMenuItem.syncLabelAndKS(this, label, fMenuItem.getAccelerator()); + } - final MenuComponentPeer peer = getPeer(); - if (peer instanceof CMenuItem) { - final CMenuItem ourPeer = (CMenuItem)peer; - ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers()); - } else { - setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0)); - } + @Override + public void setAccelerator(final KeyStroke ks) { + // We call CMenuItem.setLabel(..,..,..) directly and does not initialize + // shortcut property. So shortcut property should not be used from the + // peers code directly or indirectly. + ScreenMenuItem.syncLabelAndKS(this, fMenuItem.getText(), ks); } public void actionPerformed(final ActionEvent e) {
--- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Mon Feb 11 21:39:50 2013 +0000 @@ -31,8 +31,12 @@ import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.ImageCapabilities; +import java.awt.Rectangle; import java.awt.Transparency; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; @@ -44,6 +48,7 @@ import sun.awt.CGraphicsConfig; import sun.awt.CGraphicsDevice; +import sun.awt.TextureSizeConstraining; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; @@ -65,7 +70,7 @@ import sun.lwawt.macosx.CPlatformView; public class CGLGraphicsConfig extends CGraphicsConfig - implements OGLGraphicsConfig + implements OGLGraphicsConfig, TextureSizeConstraining { //private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; private static final int kOpenGLSwapInterval = 0; // TODO @@ -79,11 +84,14 @@ private OGLContext context; private Object disposerReferent = new Object(); + private final int cachedMaxTextureSize; + public static native int getDefaultPixFmt(int screennum); private static native boolean initCGL(); private static native long getCGLConfigInfo(int screennum, int visualnum, int swapInterval); private static native int getOGLCapabilities(long configInfo); + private static native int _getMaxTextureSize(); static { cglAvailable = initCGL(); @@ -103,6 +111,10 @@ // CGLGraphicsConfigInfo data when this object goes away Disposer.addRecord(disposerReferent, new CGLGCDisposerRecord(pConfigInfo)); + + // 7200762: Workaround a deadlock by caching the value + // A fix for JDK 8 will remove the workaround + this.cachedMaxTextureSize = _getMaxTextureSize(); } @Override @@ -242,6 +254,8 @@ } finally { rq.unlock(); } + + updateTotalDisplayBounds(); } @Override @@ -478,4 +492,53 @@ public void removeDeviceEventListener(AccelDeviceEventListener l) { AccelDeviceEventNotifier.removeListener(l); } + + private static final Rectangle totalDisplayBounds = new Rectangle(); + + private static void updateTotalDisplayBounds() { + synchronized (totalDisplayBounds) { + Rectangle virtualBounds = new Rectangle(); + for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) { + for (GraphicsConfiguration gc : gd.getConfigurations()) { + virtualBounds = virtualBounds.union(gc.getBounds()); + } + } + totalDisplayBounds.setBounds(virtualBounds); + } + } + + + // 7160609: GL still fails to create a square texture of this size, + // so we use this value to cap the total display bounds. + private int getMaxTextureSize() { + return cachedMaxTextureSize; + } + + @Override + public int getMaxTextureWidth() { + int width; + + synchronized (totalDisplayBounds) { + if (totalDisplayBounds.width == 0) { + updateTotalDisplayBounds(); + } + width = totalDisplayBounds.width; + } + + return Math.min(width, getMaxTextureSize()); + } + + @Override + public int getMaxTextureHeight() { + int height; + + synchronized (totalDisplayBounds) { + if (totalDisplayBounds.height == 0) { + updateTotalDisplayBounds(); + } + height = totalDisplayBounds.height; + } + + return Math.min(height, getMaxTextureSize()); + } }
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Mon Feb 11 21:39:50 2013 +0000 @@ -345,6 +345,18 @@ h = MINIMUM_HEIGHT; } + if (graphicsConfig instanceof TextureSizeConstraining) { + final int maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth(); + final int maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight(); + + if (w > maxW) { + w = maxW; + } + if (h > maxH) { + h = maxH; + } + } + // Don't post ComponentMoved/Resized and Paint events // until we've got a notification from the delegate setBounds(x, y, w, h, op, false, false); @@ -416,14 +428,33 @@ @Override public void updateMinimumSize() { - Dimension d = null; + final Dimension min; if (getTarget().isMinimumSizeSet()) { - d = getTarget().getMinimumSize(); + min = getTarget().getMinimumSize(); + min.width = Math.max(min.width, MINIMUM_WIDTH); + min.height = Math.max(min.height, MINIMUM_HEIGHT); + } else { + min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT); } - if (d == null) { - d = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT); + + final int maxW, maxH; + if (graphicsConfig instanceof TextureSizeConstraining) { + maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth(); + maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight(); + } else { + maxW = maxH = Integer.MAX_VALUE; } - platformWindow.setMinimumSize(d.width, d.height); + + final Dimension max; + if (getTarget().isMaximumSizeSet()) { + max = getTarget().getMaximumSize(); + max.width = Math.min(max.width, maxW); + max.height = Math.min(max.height, maxH); + } else { + max = new Dimension(maxW, maxH); + } + + platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height); } @Override
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java Mon Feb 11 21:39:50 2013 +0000 @@ -131,7 +131,10 @@ public void setResizable(boolean resizable); - public void setMinimumSize(int width, int height); + /** + * Applies the minimum and maximum size to the platform window. + */ + public void setSizeConstraints(int minW, int minH, int maxW, int maxH); /** * Transforms the given Graphics object according to the native
--- a/src/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java Mon Feb 11 21:39:50 2013 +0000 @@ -38,7 +38,7 @@ private long fNativeDropTransfer = 0; private long fNativeDataAvailable = 0; private Object fNativeData = null; - private boolean insideTarget = false; + private boolean insideTarget = true; Object awtLockAccess = new Object();
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Mon Feb 11 21:39:50 2013 +0000 @@ -180,7 +180,7 @@ public void setResizable(boolean resizable) {} @Override - public void setMinimumSize(int width, int height) {} + public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {} @Override public Graphics transformGraphics(Graphics g) {
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Feb 11 21:39:50 2013 +0000 @@ -670,20 +670,15 @@ // Re-apply the size constraints and the size to ensure the space // occupied by the grow box is counted properly - setMinimumSize(1, 1); // the method ignores its arguments + peer.updateMinimumSize(); Rectangle bounds = peer.getBounds(); setBounds(bounds.x, bounds.y, bounds.width, bounds.height); } @Override - public void setMinimumSize(int width, int height) { - //TODO width, height should be used - //NOTE: setResizable() calls setMinimumSize(1,1) relaying on the logic below - final long nsWindowPtr = getNSWindowPtr(); - final Dimension min = target.getMinimumSize(); - final Dimension max = target.getMaximumSize(); - nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight()); + public void setSizeConstraints(int minW, int minH, int maxW, int maxH) { + nativeSetNSWindowMinMax(getNSWindowPtr(), minW, minH, maxW, maxH); } @Override
--- a/src/macosx/native/sun/awt/AWTEvent.h Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/AWTEvent.h Mon Feb 11 21:39:50 2013 +0000 @@ -33,5 +33,7 @@ void DeliverJavaMouseEvent(JNIEnv *env, NSEvent *event, jobject peer); void SendAdditionalJavaEvents(JNIEnv *env, NSEvent *nsEvent, jobject peer); jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags); +jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods); +NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods); #endif /* __AWTEVENT_H */
--- a/src/macosx/native/sun/awt/AWTEvent.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/AWTEvent.m Mon Feb 11 21:39:50 2013 +0000 @@ -244,6 +244,7 @@ //NSUInteger cgsRightMask; unsigned short leftKeyCode; unsigned short rightKeyCode; + jint javaExtMask; jint javaMask; jint javaKey; } @@ -254,6 +255,7 @@ 0, 0, 0, // no Java equivalent + 0, // no Java equivalent java_awt_event_KeyEvent_VK_CAPS_LOCK }, { @@ -263,6 +265,7 @@ 56, 60, java_awt_event_InputEvent_SHIFT_DOWN_MASK, + java_awt_event_InputEvent_SHIFT_MASK, java_awt_event_KeyEvent_VK_SHIFT }, { @@ -272,6 +275,7 @@ 59, 62, java_awt_event_InputEvent_CTRL_DOWN_MASK, + java_awt_event_InputEvent_CTRL_MASK, java_awt_event_KeyEvent_VK_CONTROL }, { @@ -281,6 +285,7 @@ 58, 61, java_awt_event_InputEvent_ALT_DOWN_MASK, + java_awt_event_InputEvent_ALT_MASK, java_awt_event_KeyEvent_VK_ALT }, { @@ -290,6 +295,7 @@ 55, 54, java_awt_event_InputEvent_META_DOWN_MASK, + java_awt_event_InputEvent_META_MASK, java_awt_event_KeyEvent_VK_META }, // NSNumericPadKeyMask @@ -298,10 +304,11 @@ 0, 0, 0, // no Java equivalent + 0, // no Java equivalent java_awt_event_KeyEvent_VK_HELP }, // NSFunctionKeyMask - {0, 0, 0, 0, 0} + {0, 0, 0, 0, 0, 0} }; /* @@ -491,15 +498,14 @@ /* * This returns the java modifiers for a key NSEvent. */ -static jint -NsKeyModifiersToJavaModifiers(NSUInteger nsFlags) +jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods) { jint javaModifiers = 0; const struct _nsKeyToJavaModifier* cur; for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) { if ((cur->nsMask & nsFlags) != 0) { - javaModifiers |= cur->javaMask; + javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask; } } @@ -507,6 +513,33 @@ } /* + * This returns the NSEvent flags for java key modifiers. + */ +NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods) +{ + NSUInteger nsFlags = 0; + const struct _nsKeyToJavaModifier* cur; + + for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) { + jint mask = isExtMods? cur->javaExtMask : cur->javaMask; + if ((mask & javaModifiers) != 0) { + nsFlags |= cur->nsMask; + } + } + + // special case + jint mask = isExtMods? java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK : + java_awt_event_InputEvent_ALT_GRAPH_MASK; + + if ((mask & javaModifiers) != 0) { + nsFlags |= NSAlternateKeyMask; + } + + return nsFlags; +} + + +/* * Returns the correct java character for a key event. Most unicode * characters don't require any fussing, but a few seem to need adjusting, * see nsCharToJavaChar. @@ -517,7 +550,7 @@ unichar returnValue = java_awt_event_KeyEvent_CHAR_UNDEFINED; NSString *chars = nil; unichar testChar = 0, testDeadChar = 0; - jint javaModifiers = NsKeyModifiersToJavaModifiers([event modifierFlags]); + jint javaModifiers = NsKeyModifiersToJavaModifiers([event modifierFlags], TRUE); switch ([event type]) { case NSFlagsChanged: @@ -657,7 +690,7 @@ testChar = [chars characterAtIndex:0]; } - javaModifiers = NsKeyModifiersToJavaModifiers([event modifierFlags]); + javaModifiers = NsKeyModifiersToJavaModifiers([event modifierFlags], TRUE); if (javaModifiers == 0) { // TODO: dead key chars // testDeadChar = GetDeadKeyCharacter(event); @@ -692,7 +725,7 @@ jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags) { // Mousing needs the key modifiers - jint modifiers = NsKeyModifiersToJavaModifiers(modifierFlags); + jint modifiers = NsKeyModifiersToJavaModifiers(modifierFlags, TRUE); /* @@ -788,7 +821,7 @@ jint javaKeyCode, javaKeyLocation; BOOL postsTyped = NO; unichar testChar, testDeadChar = 0; - jint javaModifiers = NsKeyModifiersToJavaModifiers([nsEvent modifierFlags]); + jint javaModifiers = NsKeyModifiersToJavaModifiers([nsEvent modifierFlags], TRUE); if (javaModifiers == 0) { testDeadChar = [nsEvent deadKeyCharacter]; @@ -984,7 +1017,7 @@ JNF_COCOA_ENTER(env); - jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags); + jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags, TRUE); JNF_COCOA_EXIT(env);
--- a/src/macosx/native/sun/awt/CDragSource.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/CDragSource.m Mon Feb 11 21:39:50 2013 +0000 @@ -460,7 +460,7 @@ } // Convert fModifiers (extModifiers) to NS: - NSUInteger modifiers = [DnDUtilities mapJavaExtModifiersToNSKeyModifiers:fModifiers]; + NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); // Just a dummy value ... NSInteger eventNumber = 0; @@ -658,7 +658,7 @@ } // b) drag actions (key modifiers) have changed: - jint modifiers = [DnDUtilities currentJavaExtKeyModifiers]; + jint modifiers = NsKeyModifiersToJavaModifiers([NSEvent modifierFlags], YES); if (fDragKeyModifiers != modifiers) { NSDragOperation currentOp = [DnDUtilities nsDragOperationForModifiers:[NSEvent modifierFlags]]; NSDragOperation allowedOp = [DnDUtilities mapJavaDragOperationToNS:fSourceActions] & currentOp;
--- a/src/macosx/native/sun/awt/CMenuItem.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/CMenuItem.m Mon Feb 11 21:39:50 2013 +0000 @@ -70,6 +70,18 @@ JNIEnv *env = [ThreadUtilities getJNIEnv]; JNF_COCOA_ENTER(env); + // If we are called as a result of user pressing a shorcut, do nothing, + // because AWTView has already sent corresponding key event to the Java + // layer from performKeyEquivalent + NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; + if ([currEvent type] == NSKeyDown) { + NSString *menuKey = [sender keyEquivalent]; + NSString *eventKey = [currEvent charactersIgnoringModifiers]; + if ([menuKey isEqualToString:eventKey]) { + return; + } + } + if (fIsCheckbox) { static JNF_CLASS_CACHE(jc_CCheckboxMenuItem, "sun/lwawt/macosx/CCheckboxMenuItem"); static JNF_MEMBER_CACHE(jm_ckHandleAction, jc_CCheckboxMenuItem, "handleAction", "(Z)V"); @@ -83,14 +95,8 @@ static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem"); static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event) - NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; NSUInteger modifiers = [currEvent modifierFlags]; - jint javaModifiers = 0; - - if ((modifiers & NSCommandKeyMask) != 0) javaModifiers |= java_awt_Event_META_MASK; - if ((modifiers & NSShiftKeyMask) != 0) javaModifiers |= java_awt_Event_SHIFT_MASK; - if ((modifiers & NSControlKeyMask) != 0) javaModifiers |= java_awt_Event_CTRL_MASK; - if ((modifiers & NSAlternateKeyMask) != 0) javaModifiers |= java_awt_Event_ALT_MASK; + jint javaModifiers = NsKeyModifiersToJavaModifiers(modifiers, NO); JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event) } @@ -117,10 +123,7 @@ modifiers &= ~java_awt_event_KeyEvent_SHIFT_MASK; } - if ((modifiers & java_awt_event_KeyEvent_SHIFT_MASK) != 0) modifierMask |= NSShiftKeyMask; - if ((modifiers & java_awt_event_KeyEvent_CTRL_MASK) != 0) modifierMask |= NSControlKeyMask; - if ((modifiers & java_awt_event_KeyEvent_ALT_MASK) != 0) modifierMask |= NSAlternateKeyMask; - if ((modifiers & java_awt_event_KeyEvent_META_MASK) != 0) modifierMask |= NSCommandKeyMask; + modifierMask = JavaModifiersToNsKeyModifiers(modifiers, NO); } [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
--- a/src/macosx/native/sun/awt/DnDUtilities.h Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/DnDUtilities.h Mon Feb 11 21:39:50 2013 +0000 @@ -42,7 +42,6 @@ + (jint)narrowJavaDropActions:(jint)actions; // Mouse and key modifiers mapping: -+ (NSUInteger)mapJavaExtModifiersToNSKeyModifiers:(jint)modifiers; + (NSUInteger)mapJavaExtModifiersToNSMouseDownButtons:(jint)modifiers; + (NSUInteger)mapJavaExtModifiersToNSMouseUpButtons:(jint)modifiers; @@ -50,9 +49,6 @@ + (jint)extractJavaExtKeyModifiersFromJavaExtModifiers:(jint)modifiers; + (jint)extractJavaExtMouseModifiersFromJavaExtModifiers:(jint)modifiers; -// Get the current keyboard modifier keys as java modifiers (for operationChanged) -+ (jint)currentJavaExtKeyModifiers; - // Getting the state of the current Drag + (NSDragOperation)nsDragOperationForModifiers:(NSUInteger)modifiers; + (jint) javaKeyModifiersForNSDragOperation:(NSDragOperation)dragOp;
--- a/src/macosx/native/sun/awt/DnDUtilities.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/DnDUtilities.m Mon Feb 11 21:39:50 2013 +0000 @@ -161,28 +161,6 @@ } // Mouse and key modifiers mapping: -+ (NSUInteger)mapJavaExtModifiersToNSKeyModifiers:(jint)modifiers -{ - NSUInteger result = 0; - - if ((modifiers & java_awt_event_InputEvent_SHIFT_DOWN_MASK) != 0) - result |= NSShiftKeyMask; - - if ((modifiers & java_awt_event_InputEvent_CTRL_DOWN_MASK) != 0) - result |= NSControlKeyMask; - - if ((modifiers & java_awt_event_InputEvent_META_DOWN_MASK) != 0) - result |= NSCommandKeyMask; - - if ((modifiers & java_awt_event_InputEvent_ALT_DOWN_MASK) != 0) - result |= NSAlternateKeyMask; - - if ((modifiers & java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK) != 0) - result |= NSAlternateKeyMask; - - return result; -} - + (NSUInteger)mapJavaExtModifiersToNSMouseDownButtons:(jint)modifiers { NSUInteger result = NSLeftMouseDown; @@ -245,32 +223,6 @@ return modifiers & mask; } - -+ (jint)currentJavaExtKeyModifiers -{ - NSUInteger modifiers = [NSEvent modifierFlags]; - jint jmodifiers = 0; - - if(modifiers & NSShiftKeyMask) { - jmodifiers |= java_awt_event_InputEvent_SHIFT_DOWN_MASK; - } - - if(modifiers & NSControlKeyMask) { - jmodifiers |= java_awt_event_InputEvent_CTRL_DOWN_MASK; - } - - if(modifiers & NSAlternateKeyMask) { - jmodifiers |= java_awt_event_InputEvent_ALT_DOWN_MASK; - } - - if(modifiers & NSCommandKeyMask) { - jmodifiers |= java_awt_event_InputEvent_META_DOWN_MASK; - } - - return jmodifiers; -} - - + (NSDragOperation) nsDragOperationForModifiers:(NSUInteger)modifiers { // Java first
--- a/src/macosx/native/sun/awt/ImageSurfaceData.h Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/ImageSurfaceData.h Mon Feb 11 21:39:50 2013 +0000 @@ -41,7 +41,7 @@ // If there is an image present, this is a no-op void makeSureImageIsCreated(ImageSDOps* isdo); -struct _ContextInfo +typedef struct _ContextInfo { BOOL useWindowContextReference; BOOL canUseJavaPixelsAsContext; @@ -50,10 +50,9 @@ size_t bytesPerRow; CGImageAlphaInfo alphaInfo; CGColorSpaceRef colorSpace; -} -typedef ContextInfo; +} ContextInfo; -struct _ImageInfo +typedef struct _ImageInfo { size_t bitsPerComponent; size_t bitsPerPixel; @@ -61,8 +60,7 @@ size_t bytesPerRow; CGImageAlphaInfo alphaInfo; CGColorSpaceRef colorSpace; -} -typedef ImageInfo; +} ImageInfo; struct _ImageSDOps {
--- a/src/macosx/native/sun/awt/ImageSurfaceData.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/ImageSurfaceData.m Mon Feb 11 21:39:50 2013 +0000 @@ -53,10 +53,6 @@ // for vImage framework headers #include <Accelerate/Accelerate.h> - -// private Quartz routines needed here -CG_EXTERN void CGContextSetCTM(CGContextRef ref, CGAffineTransform tx); - static ContextInfo sDefaultContextInfo[sun_java2d_OSXOffScreenSurfaceData_TYPE_3BYTE_RGB+1] = { {YES, YES, 8, 4, 0, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, NULL}, // TYPE_CUSTOM // special case @@ -942,7 +938,6 @@ // intitalize the context to match the Java coordinate system // BG, since the context is created above, we can just concat - //CGContextSetCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, -1, 0, isdo->height)); CGContextConcatCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, -1, 0, isdo->height)); CGContextSaveGState(qsdo->cgRef); // this will make sure we don't go pass device context settings @@ -1114,7 +1109,9 @@ if (qsdo->cgRef != NULL) { CGContextSaveGState(qsdo->cgRef); - CGContextSetCTM(qsdo->cgRef, CGAffineTransformMake(1, 0, 0, 1, 0, 0)); + CGAffineTransform currCTM = CGContextGetCTM(qsdo->cgRef); + CGAffineTransform inverse = CGAffineTransformInvert(currCTM); + CGContextConcatCTM(qsdo->cgRef, inverse); CGContextSetBlendMode(qsdo->cgRef, kCGBlendModeCopy); CGContextSetAlpha(qsdo->cgRef, 1.0f); CGContextDrawImage(qsdo->cgRef, CGRectMake(0, 0, width, height), javaImg);
--- a/src/macosx/native/sun/awt/QuartzRenderer.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/QuartzRenderer.m Mon Feb 11 21:39:50 2013 +0000 @@ -50,9 +50,6 @@ // same value as defined in Sun's own code #define XOR_ALPHA_CUTOFF 128 -// private Quartz routines needed here -CG_EXTERN void CGContextSetCTM(CGContextRef ref, CGAffineTransform tx); - static CGFloat gRoundRectCtrlpts[10][12] = { @@ -536,7 +533,7 @@ makeSureImageIsCreated(isdo); - CGAffineTransform ctm = CGContextGetCTM(cgRef); + CGContextSaveGState(cgRef); CGContextConcatCTM(cgRef, CGAffineTransformMake(a, b, c, d, tx, ty)); jint alphaInfo = isdo->contextInfo.alphaInfo & kCGBitmapAlphaInfoMask; @@ -551,7 +548,7 @@ CGImageRelease(subImg); } - CGContextSetCTM(cgRef, ctm); + CGContextRestoreGState(cgRef); UnlockImage(env, isdo); }
--- a/src/macosx/native/sun/awt/QuartzSurfaceData.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/awt/QuartzSurfaceData.m Mon Feb 11 21:39:50 2013 +0000 @@ -40,9 +40,6 @@ #import <AppKit/AppKit.h> #import "ThreadUtilities.h" -// private Quartz routines needed here -CG_EXTERN void CGContextSetCTM(CGContextRef ref, CGAffineTransform tx); - //#define DEBUG #if defined DEBUG #define PRINT(msg) {fprintf(stderr, "%s\n", msg);} @@ -50,9 +47,6 @@ #define PRINT(msg) {} #endif -// from CGAffineTransformPrivate.h -extern CGPoint CGPointApplyInverseAffineTransform(CGPoint point, CGAffineTransform t); - #define kOffset (0.5f) BOOL gAdjustForJavaDrawing; @@ -608,7 +602,8 @@ // We need to flip both y coefficeints to flip the offset point into the java coordinate system. ctm.b = -ctm.b; ctm.d = -ctm.d; ctm.tx = 0.0f; ctm.ty = 0.0f; CGPoint offsets = {kOffset, kOffset}; - offsets = CGPointApplyInverseAffineTransform(offsets, ctm); + CGAffineTransform inverse = CGAffineTransformInvert(ctm); + offsets = CGPointApplyAffineTransform(offsets, inverse); qsdo->graphicsStateInfo.offsetX = offsets.x; qsdo->graphicsStateInfo.offsetY = offsets.y; }
--- a/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m Mon Feb 11 18:36:31 2013 +0000 +++ b/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m Mon Feb 11 21:39:50 2013 +0000 @@ -445,3 +445,20 @@ return cglinfo->context->caps; } } + +JNIEXPORT jint JNICALL +Java_sun_java2d_opengl_CGLGraphicsConfig__1getMaxTextureSize + (JNIEnv *env, jclass cglgc) +{ + J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig__1getMaxTextureSize"); + + __block int max = 0; + + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + [sharedContext makeCurrentContext]; + j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max); + }]; + + return (jint)max; +} +
--- a/src/share/bin/java.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/bin/java.c Mon Feb 11 21:39:50 2013 +0000 @@ -104,7 +104,6 @@ static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn); static jstring NewPlatformString(JNIEnv *env, char *s); -static jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc); static jclass LoadMainClass(JNIEnv *env, int mode, char *name); static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv); @@ -160,7 +159,7 @@ * Running Java code in primordial thread caused many problems. We will * create a new thread to invoke JVM. See 6316197 for more information. */ -static jlong threadStackSize = 0; /* stack size of the new thread */ +static jlong threadStackSize = 0; /* stack size of the new thread */ static jlong maxHeapSize = 0; /* max heap size */ static jlong initialHeapSize = 0; /* inital heap size */ @@ -202,6 +201,14 @@ InitLauncher(javaw); DumpState(); + if (JLI_IsTraceLauncher()) { + int i; + printf("Command line args:\n"); + for (i = 0; i < argc ; i++) { + printf("argv[%d] = %s\n", i, argv[i]); + } + AddOption("-Dsun.java.launcher.diag=true", NULL); + } /* * Make sure the specified version of the JRE is running. @@ -222,15 +229,6 @@ */ SelectVersion(argc, argv, &main_class); - if (JLI_IsTraceLauncher()) { - int i; - printf("Command line args:\n"); - for (i = 0; i < argc ; i++) { - printf("argv[%d] = %s\n", i, argv[i]); - } - AddOption("-Dsun.java.launcher.diag=true", NULL); - } - CreateExecutionEnvironment(&argc, &argv, jrepath, sizeof(jrepath), jvmpath, sizeof(jvmpath), @@ -435,8 +433,8 @@ "([Ljava/lang/String;)V"); CHECK_EXCEPTION_NULL_LEAVE(mainID); - /* Build argument array */ - mainArgs = NewPlatformStringArray(env, argv, argc); + /* Build platform specific argument array */ + mainArgs = CreateApplicationArgs(env, argv, argc); CHECK_EXCEPTION_NULL_LEAVE(mainArgs); /* Invoke main method. */ @@ -1119,8 +1117,9 @@ static jclass helperClass = NULL; -static jclass -GetLauncherHelperClass(JNIEnv *env) { +jclass +GetLauncherHelperClass(JNIEnv *env) +{ if (helperClass == NULL) { NULL_CHECK0(helperClass = FindBootStrapClass(env, "sun/launcher/LauncherHelper")); @@ -1164,7 +1163,7 @@ * Returns a new array of Java string objects for the specified * array of platform strings. */ -static jobjectArray +jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc) { jarray cls; @@ -1209,7 +1208,7 @@ end = CounterGet(); printf("%ld micro seconds to load main class\n", (long)(jint)Counter2Micros(end-start)); - printf("----_JAVA_LAUNCHER_DEBUG----\n"); + printf("----%s----\n", JLDEBUG_ENV_ENTRY); } return (jclass)result;
--- a/src/share/bin/java.h Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/bin/java.h Mon Feb 11 21:39:50 2013 +0000 @@ -219,6 +219,10 @@ const char *name)); jclass FindBootStrapClass(JNIEnv *env, const char *classname); +jobjectArray CreateApplicationArgs(JNIEnv *env, char **strv, int argc); +jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc); +jclass GetLauncherHelperClass(JNIEnv *env); + int JNICALL JavaMain(void * args); /* entry point */ enum LaunchMode { // cf. sun.launcher.LauncherHelper
--- a/src/share/bin/jli_util.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/bin/jli_util.c Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -102,9 +102,9 @@ void JLI_SetTraceLauncher() { - if (getenv("_JAVA_LAUNCHER_DEBUG") != 0) { + if (getenv(JLDEBUG_ENV_ENTRY) != 0) { _launcher_debug = JNI_TRUE; - JLI_TraceLauncher("----_JAVA_LAUNCHER_DEBUG----\n"); + JLI_TraceLauncher("----%s----\n", JLDEBUG_ENV_ENTRY); } }
--- a/src/share/bin/jli_util.h Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/bin/jli_util.h Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ /* - * 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 @@ -27,7 +27,10 @@ #define _JLI_UTIL_H #include <stdlib.h> +#include <string.h> +#include <stdio.h> #include <jni.h> +#define JLDEBUG_ENV_ENTRY "_JAVA_LAUNCHER_DEBUG" void *JLI_MemAlloc(size_t size); void *JLI_MemRealloc(void *ptr, size_t size); @@ -35,6 +38,14 @@ void JLI_MemFree(void *ptr); int JLI_StrCCmp(const char *s1, const char* s2); +typedef struct { + char *arg; + jboolean has_wildcard; +} StdArg; + +StdArg *JLI_GetStdArgs(); +int JLI_GetStdArgc(); + #define JLI_StrLen(p1) strlen((p1)) #define JLI_StrChr(p1, p2) strchr((p1), (p2)) #define JLI_StrRChr(p1, p2) strrchr((p1), (p2)) @@ -55,9 +66,11 @@ #include <io.h> #define JLI_StrCaseCmp(p1, p2) stricmp((p1), (p2)) #define JLI_StrNCaseCmp(p1, p2, p3) strnicmp((p1), (p2), (p3)) -size_t JLI_Snprintf(char *buffer, size_t size, const char *format, ...); +int JLI_Snprintf(char *buffer, size_t size, const char *format, ...); +void JLI_CmdToArgs(char *cmdline); #else #include <unistd.h> +#include <strings.h> #define JLI_StrCaseCmp(p1, p2) strcasecmp((p1), (p2)) #define JLI_StrNCaseCmp(p1, p2, p3) strncasecmp((p1), (p2), (p3)) #define JLI_Snprintf snprintf
--- a/src/share/bin/main.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/bin/main.c Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -87,22 +87,41 @@ const jboolean const_javaw = JNI_TRUE; __initenv = _environ; - margc = __argc; - margv = __argv; - #else /* JAVAW */ int -main(int argc, char ** argv) +main(int argc, char **argv) { int margc; char** margv; const jboolean const_javaw = JNI_FALSE; - +#endif /* JAVAW */ +#ifdef _WIN32 + { + int i = 0; + if (getenv(JLDEBUG_ENV_ENTRY) != NULL) { + printf("Windows original main args:\n"); + for (i = 0 ; i < __argc ; i++) { + printf("wwwd_args[%d] = %s\n", i, __argv[i]); + } + } + } + JLI_CmdToArgs(GetCommandLine()); + margc = JLI_GetStdArgc(); + // add one more to mark the end + margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *))); + { + int i = 0; + StdArg *stdargs = JLI_GetStdArgs(); + for (i = 0 ; i < margc ; i++) { + margv[i] = stdargs[i].arg; + } + margv[i] = NULL; + } +#else /* *NIXES */ margc = argc; margv = argv; -#endif /* JAVAW */ - +#endif /* WIN32 */ return JLI_Launch(margc, margv, sizeof(const_jargs) / sizeof(char *), const_jargs, sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
--- a/src/share/bin/wildcard.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/bin/wildcard.c Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -129,11 +129,11 @@ HANDLE handle; char *firstFile; /* Stupid FindFirstFile...FindNextFile */ }; - +// since this is used repeatedly we keep it here. +static WIN32_FIND_DATA find_data; static WildcardIterator WildcardIterator_for(const char *wildcard) { - WIN32_FIND_DATA find_data; WildcardIterator it = NEW_(WildcardIterator); HANDLE handle = FindFirstFile(wildcard, &find_data); if (handle == INVALID_HANDLE_VALUE) @@ -146,7 +146,6 @@ static char * WildcardIterator_next(WildcardIterator it) { - WIN32_FIND_DATA find_data; if (it->firstFile != NULL) { char *firstFile = it->firstFile; it->firstFile = NULL; @@ -412,7 +411,7 @@ FileList_expandWildcards(fl); expanded = FileList_join(fl, PATH_SEPARATOR); FileList_free(fl); - if (getenv("_JAVA_LAUNCHER_DEBUG") != 0) + if (getenv(JLDEBUG_ENV_ENTRY) != 0) printf("Expanded wildcards:\n" " before: \"%s\"\n" " after : \"%s\"\n",
--- a/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Mon Feb 11 21:39:50 2013 +0000 @@ -31,8 +31,6 @@ import static sun.reflect.misc.ReflectUtil.isPackageAccessible; -import sun.reflect.misc.ReflectUtil; - /** * This utility class provides {@code static} methods * to find a public constructor with specified parameter types
--- a/src/share/classes/com/sun/beans/finder/FieldFinder.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/beans/finder/FieldFinder.java Mon Feb 11 21:39:50 2013 +0000 @@ -29,8 +29,6 @@ import static sun.reflect.misc.ReflectUtil.isPackageAccessible; -import sun.reflect.misc.ReflectUtil; - /** * This utility class provides {@code static} methods * to find a public field with specified name
--- a/src/share/classes/com/sun/beans/finder/MethodFinder.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/beans/finder/MethodFinder.java Mon Feb 11 21:39:50 2013 +0000 @@ -35,8 +35,6 @@ import static sun.reflect.misc.ReflectUtil.isPackageAccessible; -import sun.reflect.misc.ReflectUtil; - /** * This utility class provides {@code static} methods * to find a public method with specified name and parameter types
--- a/src/share/classes/com/sun/crypto/provider/AESCrypt.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/crypto/provider/AESCrypt.java Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -37,6 +37,7 @@ package com.sun.crypto.provider; import java.security.InvalidKeyException; +import java.util.Arrays; /** * Rijndael --pronounced Reindaal-- is a symmetric cipher with a 128-bit @@ -54,7 +55,12 @@ private Object[] sessionK = null; private int[] K = null; - /** (ROUNDS-1) * 4 */ + /** Cipher encryption/decryption key */ + // skip re-generating Session and Sub keys if the cipher key is + // the same + private byte[] lastKey = null; + + /** ROUNDS * 4 */ private int limit = 0; AESCrypt() { @@ -82,41 +88,45 @@ key.length + " bytes"); } - // generate session key and reset sub key. - sessionK = makeKey(key); - setSubKey(decrypting); - } - - private void setSubKey(boolean decrypting) { - int[][] Kd = (int[][]) sessionK[decrypting ? 1 : 0]; - int rounds = Kd.length; - this.K = new int[rounds*4]; - for(int i=0; i<rounds; i++) { - for(int j=0; j<4; j++) { - K[i*4 + j] = Kd[i][j]; - } + if (!Arrays.equals(key, lastKey)) { + // re-generate session key 'sessionK' when cipher key changes + makeSessionKey(key); + lastKey = key.clone(); // save cipher key } + // set sub key to the corresponding session Key + this.K = (int[]) sessionK[(decrypting? 1:0)]; + } + + /** + * Expand an int[(ROUNDS+1)][4] into int[(ROUNDS+1)*4]. + * For decryption round keys, need to rotate right by 4 ints. + * @param kr The round keys for encryption or decryption. + * @param decrypting True if 'kr' is for decryption and false otherwise. + */ + private static final int[] expandToSubKey(int[][] kr, boolean decrypting) { + int total = kr.length; + int[] expK = new int[total*4]; if (decrypting) { - int j0 = K[K.length-4]; - int j1 = K[K.length-3]; - int j2 = K[K.length-2]; - int j3 = K[K.length-1]; - - for (int i=this.K.length-1; i>3; i--) { - this.K[i] = this.K[i-4]; + // decrypting, rotate right by 4 ints + // i.e. i==0 + for(int j=0; j<4; j++) { + expK[j] = kr[total-1][j]; } - K[0] = j0; - K[1] = j1; - K[2] = j2; - K[3] = j3; + for(int i=1; i<total; i++) { + for(int j=0; j<4; j++) { + expK[i*4 + j] = kr[i-1][j]; + } + } + } else { + // encrypting, straight expansion + for(int i=0; i<total; i++) { + for(int j=0; j<4; j++) { + expK[i*4 + j] = kr[i][j]; + } + } } - - ROUNDS_12 = (rounds>=13); - ROUNDS_14 = (rounds==15); - - rounds--; - limit=rounds*4; + return expK; } private static int[] @@ -566,10 +576,10 @@ /** * Expand a user-supplied key material into a session key. * - * @param key The 128/192/256-bit user-key to use. + * @param k The 128/192/256-bit cipher key to use. * @exception InvalidKeyException If the key is invalid. */ - private static Object[] makeKey(byte[] k) throws InvalidKeyException { + private void makeSessionKey(byte[] k) throws InvalidKeyException { if (k == null) { throw new InvalidKeyException("Empty key"); } @@ -639,10 +649,18 @@ U4[ tt & 0xFF]; } } - // assemble the encryption (Ke) and decryption (Kd) round keys into - // one sessionKey object - Object[] result = new Object[] {Ke, Kd}; - return result; + + // assemble the encryption (Ke) and decryption (Kd) round keys + // and expand them into arrays of ints. + int[] expandedKe = expandToSubKey(Ke, false); // decrypting==false + int[] expandedKd = expandToSubKey(Kd, true); // decrypting==true + + ROUNDS_12 = (ROUNDS>=12); + ROUNDS_14 = (ROUNDS==14); + limit = ROUNDS*4; + + // store the expanded sub keys into 'sessionK' + sessionK = new Object[] { expandedKe, expandedKd }; }
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java Mon Feb 11 21:39:50 2013 +0000 @@ -30,6 +30,8 @@ import java.awt.Event; import java.awt.KeyEventPostProcessor; import java.awt.Window; +import java.awt.Toolkit; +import sun.awt.SunToolkit; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -125,7 +127,19 @@ } JMenu menu = mbar != null ? mbar.getMenu(0) : null; - if (menu != null) { + // It might happen that the altRelease event is processed + // with a reasonable delay since it has been generated. + // Here we check the last deactivation time of the containing + // window. If this time appears to be greater than the altRelease + // event time the event is skipped to avoid unexpected menu + // activation. See 7121442. + boolean skip = false; + Toolkit tk = Toolkit.getDefaultToolkit(); + if (tk instanceof SunToolkit) { + skip = ev.getWhen() <= ((SunToolkit)tk).getWindowDeactivationTime(winAncestor); + } + + if (menu != null && !skip) { MenuElement[] path = new MenuElement[2]; path[0] = mbar; path[1] = menu;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java Mon Feb 11 21:39:50 2013 +0000 @@ -154,7 +154,7 @@ } } for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) { - if (!(el instanceof Element)) { + if (el.getNodeType() != Node.ELEMENT_NODE) { continue; } String tag=el.getLocalName();
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java Mon Feb 11 21:39:50 2013 +0000 @@ -202,7 +202,7 @@ try { NameSpaceSymbTable ns=new NameSpaceSymbTable(); int nodeLevel=NODE_BEFORE_DOCUMENT_ELEMENT; - if (rootNode instanceof Element) { + if (rootNode != null && rootNode.getNodeType() == Node.ELEMENT_NODE) { //Fills the nssymbtable with the definitions of the parent of the root subnode getParentNameSpaces((Element)rootNode,ns); nodeLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT; @@ -332,7 +332,7 @@ return; sibling=parentNode.getNextSibling(); parentNode=parentNode.getParentNode(); - if (!(parentNode instanceof Element)) { + if (parentNode !=null && parentNode.getNodeType() != Node.ELEMENT_NODE) { documentLevel=NODE_AFTER_DOCUMENT_ELEMENT; parentNode=null; } @@ -388,7 +388,7 @@ return; boolean currentNodeIsVisible = false; NameSpaceSymbTable ns=new NameSpaceSymbTable(); - if (currentNode instanceof Element) + if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) getParentNameSpaces((Element)currentNode,ns); Node sibling=null; Node parentNode=null; @@ -509,7 +509,7 @@ return; sibling=parentNode.getNextSibling(); parentNode=parentNode.getParentNode(); - if (!(parentNode instanceof Element)) { + if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) { parentNode=null; documentLevel=NODE_AFTER_DOCUMENT_ELEMENT; } @@ -591,18 +591,14 @@ final void getParentNameSpaces(Element el,NameSpaceSymbTable ns) { List parents=new ArrayList(10); Node n1=el.getParentNode(); - if (!(n1 instanceof Element)) { + if (n1 == null || n1.getNodeType() != Node.ELEMENT_NODE) { return; } //Obtain all the parents of the elemnt - Element parent=(Element) n1; - while (parent!=null) { - parents.add(parent); - Node n=parent.getParentNode(); - if (!(n instanceof Element )) { - break; - } - parent=(Element)n; + Node parent = n1; + while (parent!=null && parent.getNodeType() == Node.ELEMENT_NODE) { + parents.add((Element)parent); + parent = parent.getParentNode(); } //Visit them in reverse order. ListIterator it=parents.listIterator(parents.size());
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java Mon Feb 11 21:39:50 2013 +0000 @@ -1445,7 +1445,7 @@ // The de-serialiser returns a fragment whose children we need to // take on. - if (sourceParent instanceof Document) { + if (sourceParent != null && sourceParent.getNodeType() == Node.DOCUMENT_NODE) { // If this is a content decryption, this may have problems
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java Mon Feb 11 21:39:50 2013 +0000 @@ -283,7 +283,7 @@ Element e=null; while (it.hasNext()) { Node currentNode=(Node)it.next(); - if (currentNode instanceof Element) { + if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) { e=(Element)currentNode; break; } @@ -292,14 +292,14 @@ List parents=new ArrayList(10); //Obtain all the parents of the elemnt - do { + while (e != null) { parents.add(e); Node n=e.getParentNode(); - if (!(n instanceof Element )) { + if (n == null || n.getNodeType() != Node.ELEMENT_NODE) { break; } e=(Element)n; - } while (e!=null); + } //Visit them in reverse order. ListIterator it2=parents.listIterator(parents.size()-1); Element ele=null;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java Mon Feb 11 21:39:50 2013 +0000 @@ -223,7 +223,7 @@ } while (sibling==null && parentNode!=null) { sibling=parentNode.getNextSibling(); parentNode=parentNode.getParentNode(); - if (!(parentNode instanceof Element)) { + if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) { parentNode=null; } }
--- a/src/share/classes/java/awt/EventDispatchThread.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/awt/EventDispatchThread.java Mon Feb 11 21:39:50 2013 +0000 @@ -67,8 +67,7 @@ private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread"); private EventQueue theQueue; - private boolean doDispatch = true; - private volatile boolean shutdown = false; + private volatile boolean doDispatch = true; private static final int ANY_EVENT = -1; @@ -86,11 +85,6 @@ doDispatch = false; } - public void interrupt() { - shutdown = true; - super.interrupt(); - } - public void run() { while (true) { try { @@ -100,7 +94,12 @@ } }); } finally { - if(getEventQueue().detachDispatchThread(this, shutdown)) { + // 7189350: doDispatch is reset from stopDispatching(), + // on InterruptedException, or ThreadDeath. Either way, + // this indicates that we must force shutting down. + if (getEventQueue().detachDispatchThread(this, + !doDispatch || isInterrupted())) + { break; } } @@ -158,8 +157,7 @@ void pumpEventsForFilter(int id, Conditional cond, EventFilter filter) { addEventFilter(filter); doDispatch = true; - shutdown |= isInterrupted(); - while (doDispatch && !shutdown && cond.evaluate()) { + while (doDispatch && !isInterrupted() && cond.evaluate()) { pumpOneEventForFilters(id); } removeEventFilter(filter); @@ -247,12 +245,12 @@ } } catch (ThreadDeath death) { - shutdown = true; + doDispatch = false; throw death; } catch (InterruptedException interruptedException) { - shutdown = true; // AppContext.dispose() interrupts all - // Threads in the AppContext + doDispatch = false; // AppContext.dispose() interrupts all + // Threads in the AppContext } catch (Throwable e) { processException(e);
--- a/src/share/classes/java/awt/SequencedEvent.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/awt/SequencedEvent.java Mon Feb 11 21:39:50 2013 +0000 @@ -26,6 +26,7 @@ package java.awt; import java.util.LinkedList; +import sun.awt.AWTAccessor; import sun.awt.AppContext; import sun.awt.SunToolkit; @@ -54,6 +55,17 @@ private AppContext appContext; private boolean disposed; + static { + AWTAccessor.setSequencedEventAccessor(new AWTAccessor.SequencedEventAccessor() { + public AWTEvent getNested(AWTEvent sequencedEvent) { + return ((SequencedEvent)sequencedEvent).nested; + } + public boolean isSequencedEvent(AWTEvent event) { + return event instanceof SequencedEvent; + } + }); + } + /** * Constructs a new SequencedEvent which will dispatch the specified * nested event.
--- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java Mon Feb 11 21:39:50 2013 +0000 @@ -494,6 +494,16 @@ indexedReadMethodName = old.indexedReadMethodName; } + void updateGenericsFor(Class<?> type) { + super.updateGenericsFor(type); + try { + setIndexedPropertyType(findIndexedPropertyType(getIndexedReadMethod0(), getIndexedWriteMethod0())); + } + catch (IntrospectionException exception) { + setIndexedPropertyType(null); + } + } + /** * Returns a hash code value for the object. * See {@link java.lang.Object#hashCode} for a complete description.
--- a/src/share/classes/java/beans/Introspector.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/beans/Introspector.java Mon Feb 11 21:39:50 2013 +0000 @@ -572,26 +572,25 @@ // replace existing property descriptor // only if we have types to resolve // in the context of this.beanClass - try { - String name = pd.getName(); - Method read = pd.getReadMethod(); - Method write = pd.getWriteMethod(); - boolean cls = true; - if (read != null) cls = cls && read.getGenericReturnType() instanceof Class; - if (write != null) cls = cls && write.getGenericParameterTypes()[0] instanceof Class; - if (pd instanceof IndexedPropertyDescriptor) { - IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor)pd; - Method readI = ipd.getIndexedReadMethod(); - Method writeI = ipd.getIndexedWriteMethod(); - if (readI != null) cls = cls && readI.getGenericReturnType() instanceof Class; - if (writeI != null) cls = cls && writeI.getGenericParameterTypes()[1] instanceof Class; - if (!cls) { - pd = new IndexedPropertyDescriptor(this.beanClass, name, read, write, readI, writeI); - } - } else if (!cls) { - pd = new PropertyDescriptor(this.beanClass, name, read, write); + Method read = pd.getReadMethod(); + Method write = pd.getWriteMethod(); + boolean cls = true; + if (read != null) cls = cls && read.getGenericReturnType() instanceof Class; + if (write != null) cls = cls && write.getGenericParameterTypes()[0] instanceof Class; + if (pd instanceof IndexedPropertyDescriptor) { + IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; + Method readI = ipd.getIndexedReadMethod(); + Method writeI = ipd.getIndexedWriteMethod(); + if (readI != null) cls = cls && readI.getGenericReturnType() instanceof Class; + if (writeI != null) cls = cls && writeI.getGenericParameterTypes()[1] instanceof Class; + if (!cls) { + pd = new IndexedPropertyDescriptor((IndexedPropertyDescriptor) pd); + pd.updateGenericsFor(this.beanClass); } - } catch ( IntrospectionException e ) { + } + else if (!cls) { + pd = new PropertyDescriptor(pd); + pd.updateGenericsFor(this.beanClass); } } list.add(pd); @@ -1440,7 +1439,7 @@ private PropertyDescriptor[] properties; private int defaultProperty; private MethodDescriptor[] methods; - private final Reference<BeanInfo> targetBeanInfoRef; + private Reference<BeanInfo> targetBeanInfoRef; public GenericBeanInfo(BeanDescriptor beanDescriptor, EventSetDescriptor[] events, int defaultEvent, @@ -1452,7 +1451,9 @@ this.properties = properties; this.defaultProperty = defaultProperty; this.methods = methods; - this.targetBeanInfoRef = new SoftReference<BeanInfo>(targetBeanInfo); + this.targetBeanInfoRef = (targetBeanInfo != null) + ? new SoftReference<>(targetBeanInfo) + : null; } /** @@ -1519,10 +1520,25 @@ } public java.awt.Image getIcon(int iconKind) { - BeanInfo targetBeanInfo = this.targetBeanInfoRef.get(); + BeanInfo targetBeanInfo = getTargetBeanInfo(); if (targetBeanInfo != null) { return targetBeanInfo.getIcon(iconKind); } return super.getIcon(iconKind); } + + private BeanInfo getTargetBeanInfo() { + if (this.targetBeanInfoRef == null) { + return null; + } + BeanInfo targetBeanInfo = this.targetBeanInfoRef.get(); + if (targetBeanInfo == null) { + targetBeanInfo = ThreadGroupContext.getContext().getBeanInfoFinder() + .find(this.beanDescriptor.getBeanClass()); + if (targetBeanInfo != null) { + this.targetBeanInfoRef = new SoftReference<>(targetBeanInfo); + } + } + return targetBeanInfo; + } }
--- a/src/share/classes/java/beans/PropertyDescriptor.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/beans/PropertyDescriptor.java Mon Feb 11 21:39:50 2013 +0000 @@ -629,6 +629,16 @@ constrained = old.constrained; } + void updateGenericsFor(Class<?> type) { + setClass0(type); + try { + setPropertyType(findPropertyType(getReadMethod0(), getWriteMethod0())); + } + catch (IntrospectionException exception) { + setPropertyType(null); + } + } + /** * Returns the property type that corresponds to the read and write method. * The type precedence is given to the readMethod.
--- a/src/share/classes/java/beans/XMLEncoder.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/beans/XMLEncoder.java Mon Feb 11 21:39:50 2013 +0000 @@ -631,7 +631,12 @@ } if (d.name != null) { - outputXML(isArgument ? "object" : "void", " idref=" + quote(d.name), value); + if (isArgument) { + writeln("<object idref=" + quote(d.name) + "/>"); + } + else { + outputXML("void", " idref=" + quote(d.name), value); + } } else if (d.exp != null) { outputStatement(d.exp, outer, isArgument); @@ -710,12 +715,14 @@ } else { d.refs = 2; - getValueData(target).refs++; - List<Statement> statements = statementList(target); - if (!statements.contains(exp)) { - statements.add(exp); + if (d.name == null) { + getValueData(target).refs++; + List<Statement> statements = statementList(target); + if (!statements.contains(exp)) { + statements.add(exp); + } + outputValue(target, outer, false); } - outputValue(target, outer, false); if (expression) { outputValue(value, outer, isArgument); }
--- a/src/share/classes/java/util/logging/LogManager.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/java/util/logging/LogManager.java Mon Feb 11 21:39:50 2013 +0000 @@ -556,7 +556,6 @@ break; } String pname = name.substring(0, ix2); - if (manager.getProperty(pname + ".level") != null || manager.getProperty(pname + ".handlers") != null) { // This pname has a level/handlers definition. @@ -644,7 +643,7 @@ } }); } - return result; + return result; } } @@ -653,16 +652,16 @@ // be made based on the logging configuration, which can // only be modified by trusted code. private void loadLoggerHandlers(final Logger logger, final String name, - final String handlersPropertyName) { + final String handlersPropertyName) + { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - String names[] = parseClassNames(handlersPropertyName); for (int i = 0; i < names.length; i++) { String word = names[i]; try { Class clz = ClassLoader.getSystemClassLoader().loadClass(word); - Handler hdl = (Handler) clz.newInstance(); + Handler hdl = (Handler) clz.newInstance(); // Check if there is a property defining the // this handler's level. String levs = getProperty(word + ".level"); @@ -834,7 +833,6 @@ } } - // Private method to set a level on a logger. // If necessary, we raise privilege before doing the call. private static void doSetLevel(final Logger logger, final Level level) {
--- a/src/share/classes/javax/crypto/CryptoPermissions.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/javax/crypto/CryptoPermissions.java Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, 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 @@ -30,10 +30,16 @@ import java.util.Hashtable; import java.util.Vector; import java.util.NoSuchElementException; +import java.util.concurrent.ConcurrentHashMap; import java.io.Serializable; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; +import java.io.ObjectStreamField; +import java.io.ObjectInputStream; +import java.io.ObjectInputStream.GetField; +import java.io.ObjectOutputStream; +import java.io.ObjectOutputStream.PutField; import java.io.IOException; /** @@ -61,15 +67,24 @@ private static final long serialVersionUID = 4946547168093391015L; - // This class is similar to java.security.Permissions - private Hashtable perms; + /** + * @serialField perms java.util.Hashtable + */ + private static final ObjectStreamField[] serialPersistentFields = { + new ObjectStreamField("perms", Hashtable.class), + }; + + // Switched from Hashtable to ConcurrentHashMap to improve scalability. + // To maintain serialization compatibility, this field is made transient + // and custom readObject/writeObject methods are used. + private transient ConcurrentHashMap<String,PermissionCollection> perms; /** * Creates a new CryptoPermissions object containing * no CryptoPermissionCollections. */ CryptoPermissions() { - perms = new Hashtable(7); + perms = new ConcurrentHashMap<>(7); } /** @@ -132,9 +147,7 @@ getPermissionCollection(cryptoPerm); pc.add(cryptoPerm); String alg = cryptoPerm.getAlgorithm(); - if (!perms.containsKey(alg)) { - perms.put(alg, pc); - } + perms.putIfAbsent(alg, pc); } /** @@ -382,20 +395,17 @@ PermissionCollection getPermissionCollection(String alg) { // If this CryptoPermissions includes CryptoAllPermission, // we should return CryptoAllPermission. - if (perms.containsKey(CryptoAllPermission.ALG_NAME)) { - return - (PermissionCollection)(perms.get(CryptoAllPermission.ALG_NAME)); - } - - PermissionCollection pc = (PermissionCollection)perms.get(alg); + PermissionCollection pc = perms.get(CryptoAllPermission.ALG_NAME); + if (pc == null) { + pc = perms.get(alg); - // If there isn't a PermissionCollection for - // the given algorithm,we should return the - // PermissionCollection for the wildcard - // if there is one. - if (pc == null) { - pc = (PermissionCollection)perms.get( - CryptoPermission.ALG_NAME_WILDCARD); + // If there isn't a PermissionCollection for + // the given algorithm,we should return the + // PermissionCollection for the wildcard + // if there is one. + if (pc == null) { + pc = perms.get(CryptoPermission.ALG_NAME_WILDCARD); + } } return pc; } @@ -421,6 +431,28 @@ } return pc; } + + private void readObject(ObjectInputStream s) + throws IOException, ClassNotFoundException { + ObjectInputStream.GetField fields = s.readFields(); + @SuppressWarnings("unchecked") + Hashtable<String,PermissionCollection> permTable = + (Hashtable<String,PermissionCollection>) + (fields.get("perms", null)); + if (permTable != null) { + perms = new ConcurrentHashMap<>(permTable); + } else { + perms = new ConcurrentHashMap<>(); + } + } + + private void writeObject(ObjectOutputStream s) throws IOException { + Hashtable<String,PermissionCollection> permTable = + new Hashtable<>(perms); + ObjectOutputStream.PutField fields = s.putFields(); + fields.put("perms", permTable); + s.writeFields(); + } } final class PermissionsEnumerator implements Enumeration { @@ -463,7 +495,6 @@ } else { throw new NoSuchElementException("PermissionsEnumerator"); } - } private Enumeration getNextEnumWithMore() {
--- a/src/share/classes/javax/swing/AncestorNotifier.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/javax/swing/AncestorNotifier.java Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, 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 @@ -44,7 +44,7 @@ class AncestorNotifier implements ComponentListener, PropertyChangeListener, Serializable { - Component firstInvisibleAncestor; + transient Component firstInvisibleAncestor; EventListenerList listenerList = new EventListenerList(); JComponent root;
--- a/src/share/classes/sun/awt/AWTAccessor.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/awt/AWTAccessor.java Mon Feb 11 21:39:50 2013 +0000 @@ -675,6 +675,21 @@ } /* + * An accessor for the SequencedEventAccessor class + */ + public interface SequencedEventAccessor { + /* + * Returns the nested event. + */ + AWTEvent getNested(AWTEvent sequencedEvent); + + /* + * Returns true if the event is an instances of SequencedEvent. + */ + boolean isSequencedEvent(AWTEvent event); + } + + /* * Accessor instances are initialized in the static initializers of * corresponding AWT classes by using setters defined below. */ @@ -700,6 +715,7 @@ private static SystemTrayAccessor systemTrayAccessor; private static TrayIconAccessor trayIconAccessor; private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor; + private static SequencedEventAccessor sequencedEventAccessor; /* * Set an accessor object for the java.awt.Component class. @@ -1078,4 +1094,20 @@ return defaultKeyboardFocusManagerAccessor; } + /* + * Set an accessor object for the java.awt.SequencedEvent class. + */ + public static void setSequencedEventAccessor(SequencedEventAccessor sea) { + sequencedEventAccessor = sea; + } + + /* + * Get the accessor object for the java.awt.SequencedEvent class. + */ + public static SequencedEventAccessor getSequencedEventAccessor() { + // The class is not public. So we can't ensure it's initialized. + // Null returned value means it's not initialized + // (so not a single instance of the event has been created). + return sequencedEventAccessor; + } }
--- a/src/share/classes/sun/awt/SunToolkit.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/awt/SunToolkit.java Mon Feb 11 21:39:50 2013 +0000 @@ -462,6 +462,19 @@ if (event == null) { throw new NullPointerException(); } + + AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor(); + if (sea != null && sea.isSequencedEvent(event)) { + AWTEvent nested = sea.getNested(event); + if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS && + nested instanceof TimedWindowEvent) + { + TimedWindowEvent twe = (TimedWindowEvent)nested; + ((SunToolkit)Toolkit.getDefaultToolkit()). + setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen()); + } + } + // All events posted via this method are system-generated. // Placing the following call here reduces considerably the // number of places throughout the toolkit that would @@ -505,15 +518,19 @@ // Don't call flushPendingEvents() recursively if (!isFlushingPendingEvents) { isFlushingPendingEvents = true; - AppContext appContext = AppContext.getAppContext(); - PostEventQueue postEventQueue = - (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); - if (postEventQueue != null) { - postEventQueue.flush(); + try { + AppContext appContext = AppContext.getAppContext(); + PostEventQueue postEventQueue = + (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); + if (postEventQueue != null) { + postEventQueue.flush(); + } + } + finally { + isFlushingPendingEvents = false; } } } finally { - isFlushingPendingEvents = false; flushLock.unlock(); } } @@ -1853,6 +1870,28 @@ return false; } + private static final Object DEACTIVATION_TIMES_MAP_KEY = new Object(); + + public synchronized void setWindowDeactivationTime(Window w, long time) { + AppContext ctx = getAppContext(w); + WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY); + if (map == null) { + map = new WeakHashMap<Window, Long>(); + ctx.put(DEACTIVATION_TIMES_MAP_KEY, map); + } + map.put(w, time); + } + + public synchronized long getWindowDeactivationTime(Window w) { + AppContext ctx = getAppContext(w); + WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY); + if (map == null) { + return -1; + } + Long time = map.get(w); + return time == null ? -1 : time; + } + // Cosntant alpha public boolean isWindowOpacitySupported() { return false; @@ -1993,25 +2032,41 @@ private EventQueueItem queueTail = null; private final EventQueue eventQueue; + // For the case when queue is cleared but events are not posted + private volatile boolean isFlushing = false; + PostEventQueue(EventQueue eq) { eventQueue = eq; } public synchronized boolean noEvents() { - return queueHead == null; + return queueHead == null && !isFlushing; } /* * Continually post pending AWTEvents to the Java EventQueue. The method * is synchronized to ensure the flush is completed before a new event * can be posted to this queue. + * + * 7177040: The method couldn't be wholly synchronized because of calls + * of EventQueue.postEvent() that uses pushPopLock, otherwise it could + * potentially lead to deadlock */ - public synchronized void flush() { - EventQueueItem tempQueue = queueHead; - queueHead = queueTail = null; - while (tempQueue != null) { - eventQueue.postEvent(tempQueue.event); - tempQueue = tempQueue.next; + public void flush() { + EventQueueItem tempQueue; + synchronized (this) { + tempQueue = queueHead; + queueHead = queueTail = null; + isFlushing = (tempQueue != null); + } + try { + while (tempQueue != null) { + eventQueue.postEvent(tempQueue.event); + tempQueue = tempQueue.next; + } + } + finally { + isFlushing = false; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/TextureSizeConstraining.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.awt; + +/** + * A GraphicsConfiguration implements the TextureSizeConstraining + * interface to indicate that it imposes certain limitations on the + * maximum size of supported textures. + */ +public interface TextureSizeConstraining { + + /** + * Returns the maximum width of any texture image. + */ + public int getMaxTextureWidth(); + + /** + * Returns the maximum height of any texture image. + */ + public int getMaxTextureHeight(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/TimedWindowEvent.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.awt; + +import java.awt.event.WindowEvent; +import java.awt.Window; + +public class TimedWindowEvent extends WindowEvent { + + private long time; + + public long getWhen() { + return time; + } + + public TimedWindowEvent(Window source, int id, Window opposite, long time) { + super(source, id, opposite); + this.time = time; + } + + public TimedWindowEvent(Window source, int id, Window opposite, + int oldState, int newState, long time) + { + super(source, id, opposite, oldState, newState); + this.time = time; + } +} +
--- a/src/share/classes/sun/launcher/LauncherHelper.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/launcher/LauncherHelper.java Mon Feb 11 21:39:50 2013 +0000 @@ -48,6 +48,9 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.charset.Charset; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ResourceBundle; import java.text.MessageFormat; import java.util.ArrayList; @@ -69,8 +72,6 @@ private static StringBuilder outBuf = new StringBuilder(); - private static ResourceBundle javarb = null; - private static final String INDENT = " "; private static final String VM_SETTINGS = "VM settings:"; private static final String PROP_SETTINGS = "Property settings:"; @@ -78,6 +79,7 @@ // sync with java.c and sun.misc.VM private static final String diagprop = "sun.java.launcher.diag"; + final static boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null; private static final String defaultBundleName = "sun.launcher.resources.launcher"; @@ -428,11 +430,11 @@ if (msgKey != null) { ostream.println(getLocalizedMessage(msgKey, args)); } - if (sun.misc.VM.getSavedProperty(diagprop) != null) { + if (trace) { if (t != null) { t.printStackTrace(); } else { - Thread.currentThread().dumpStack(); + Thread.dumpStack(); } } System.exit(1); @@ -532,4 +534,82 @@ } return null; // keep the compiler happy } + + static String[] expandArgs(String[] argArray) { + List<StdArg> aList = new ArrayList<>(); + for (String x : argArray) { + aList.add(new StdArg(x)); + } + return expandArgs(aList); + } + + static String[] expandArgs(List<StdArg> argList) { + ArrayList<String> out = new ArrayList<>(); + if (trace) { + System.err.println("Incoming arguments:"); + } + for (StdArg a : argList) { + if (trace) { + System.err.println(a); + } + if (a.needsExpansion) { + File x = new File(a.arg); + File parent = x.getParentFile(); + String glob = x.getName(); + if (parent == null) { + parent = new File("."); + } + try (DirectoryStream<Path> dstream = + Files.newDirectoryStream(parent.toPath(), glob)) { + int entries = 0; + for (Path p : dstream) { + out.add(p.normalize().toString()); + entries++; + } + if (entries == 0) { + out.add(a.arg); + } + } catch (Exception e) { + out.add(a.arg); + if (trace) { + System.err.println("Warning: passing argument as-is " + a); + System.err.print(e); + } + } + } else { + out.add(a.arg); + } + } + String[] oarray = new String[out.size()]; + out.toArray(oarray); + + if (trace) { + System.err.println("Expanded arguments:"); + for (String x : oarray) { + System.err.println(x); + } + } + return oarray; + } + + /* duplicate of the native StdArg struct */ + private static class StdArg { + final String arg; + final boolean needsExpansion; + StdArg(String arg, boolean expand) { + this.arg = arg; + this.needsExpansion = expand; + } + // protocol: first char indicates whether expansion is required + // 'T' = true ; needs expansion + // 'F' = false; needs no expansion + StdArg(String in) { + this.arg = in.substring(1); + needsExpansion = in.charAt(0) == 'T'; + } + public String toString() { + return "StdArg{" + "arg=" + arg + ", needsExpansion=" + needsExpansion + '}'; + } + } } +
--- a/src/share/classes/sun/launcher/resources/launcher.properties Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/launcher/resources/launcher.properties Mon Feb 11 21:39:50 2013 +0000 @@ -43,7 +43,7 @@ \ and ZIP archives to search for class files.\n\ \ -D<name>=<value>\n\ \ set a system property\n\ -\ -verbose[:class|gc|jni]\n\ +\ -verbose:[class|gc|jni]\n\ \ enable verbose output\n\ \ -version print product version and exit\n\ \ -version:<value>\n\ @@ -136,3 +136,4 @@ Error: An unexpected error occurred while trying to open file {0} java.launcher.jar.error2=manifest not found in {0} java.launcher.jar.error3=no main manifest attribute, in {0} +java.launcher.init.error=initialization error
--- a/src/share/classes/sun/net/www/MessageHeader.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/net/www/MessageHeader.java Mon Feb 11 21:39:50 2013 +0000 @@ -138,6 +138,43 @@ return null; } + /** + * Removes bare Negotiate and Kerberos headers when an "NTLM ..." + * appears. All Performed on headers with key being k. + * @return true if there is a change + */ + public boolean filterNTLMResponses(String k) { + boolean found = false; + for (int i=0; i<nkeys; i++) { + if (k.equalsIgnoreCase(keys[i]) + && values[i] != null && values[i].length() > 5 + && values[i].substring(0, 5).equalsIgnoreCase("NTLM ")) { + found = true; + break; + } + } + if (found) { + int j = 0; + for (int i=0; i<nkeys; i++) { + if (k.equalsIgnoreCase(keys[i]) && ( + "Negotiate".equalsIgnoreCase(values[i]) || + "Kerberos".equalsIgnoreCase(values[i]))) { + continue; + } + if (i != j) { + keys[j] = keys[i]; + values[j] = values[i]; + } + j++; + } + if (j != nkeys) { + nkeys = j; + return true; + } + } + return false; + } + class HeaderIterator implements Iterator<String> { int index = 0; int next = -1;
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Feb 11 21:39:50 2013 +0000 @@ -1323,6 +1323,16 @@ if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(responses.toString()); } + + boolean b1 = responses.filterNTLMResponses("WWW-Authenticate"); + boolean b2 = responses.filterNTLMResponses("Proxy-Authenticate"); + if (b1 || b2) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + inputStream = http.getInputStream(); respCode = getResponseCode(); @@ -1782,6 +1792,13 @@ logger.fine(responses.toString()); } + if (responses.filterNTLMResponses("Proxy-Authenticate")) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + statusLine = responses.getValue(0); StringTokenizer st = new StringTokenizer(statusLine); st.nextToken();
--- a/src/share/classes/sun/nio/ch/IOUtil.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/nio/ch/IOUtil.java Mon Feb 11 21:39:50 2013 +0000 @@ -36,6 +36,11 @@ class IOUtil { + /** + * Max number of iovec structures that readv/writev supports + */ + static final int IOV_MAX; + private IOUtil() { } // No instantiation static int write(FileDescriptor fd, ByteBuffer src, long position, @@ -111,7 +116,8 @@ // Iterate over buffers to populate native iovec array. int count = offset + length; - for (int i=offset; i<count; i++) { + int i = offset; + while (i < count && iov_len < IOV_MAX) { ByteBuffer buf = bufs[i]; int pos = buf.position(); int lim = buf.limit(); @@ -135,6 +141,7 @@ vec.putLen(iov_len, rem); iov_len++; } + i++; } if (iov_len == 0) return 0L; @@ -240,7 +247,8 @@ // Iterate over buffers to populate native iovec array. int count = offset + length; - for (int i=offset; i<count; i++) { + int i = offset; + while (i < count && iov_len < IOV_MAX) { ByteBuffer buf = bufs[i]; if (buf.isReadOnly()) throw new IllegalArgumentException("Read-only buffer"); @@ -264,6 +272,7 @@ vec.putLen(iov_len, rem); iov_len++; } + i++; } if (iov_len == 0) return 0L; @@ -333,11 +342,14 @@ static native void setfdVal(FileDescriptor fd, int value); + static native int iovMax(); + static native void initIDs(); static { // Note that IOUtil.initIDs is called from within Util.load. Util.load(); + IOV_MAX = iovMax(); } }
--- a/src/share/classes/sun/nio/ch/Util.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/nio/ch/Util.java Mon Feb 11 21:39:50 2013 +0000 @@ -45,7 +45,7 @@ // -- Caches -- // The number of temp buffers in our pool - private static final int TEMP_BUF_POOL_SIZE = 8; + private static final int TEMP_BUF_POOL_SIZE = IOUtil.IOV_MAX; // Per-thread cache of temporary direct buffers private static ThreadLocal<BufferCache> bufferCache =
--- a/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Mon Feb 11 21:39:50 2013 +0000 @@ -257,18 +257,21 @@ } } - // Check that the key identifiers match + // Check that the key identifiers match, if both are present + byte[] anchorKeyId = null; if (certIssuerKeyId != null && - !Arrays.equals(certIssuerKeyId, getKeyId(anchorCert))) { + (anchorKeyId = + OCSPChecker.getKeyId(anchorCert)) != null) { + if (!Arrays.equals(certIssuerKeyId, anchorKeyId)) { + continue; // try next cert + } - continue; // try next cert - } - - if (DEBUG != null && certIssuerKeyId != null) { - DEBUG.println("Issuer certificate key ID: " + - String.format("0x%0" + - (certIssuerKeyId.length * 2) + "x", - new BigInteger(1, certIssuerKeyId))); + if (DEBUG != null) { + DEBUG.println("Issuer certificate key ID: " + + String.format("0x%0" + + (certIssuerKeyId.length * 2) + "x", + new BigInteger(1, certIssuerKeyId))); + } } issuerCert = anchorCert;
--- a/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Mon Feb 11 21:39:50 2013 +0000 @@ -264,6 +264,7 @@ DEBUG.println("OCSP Responder name: " + responderName); } } else if (tag == KEY_TAG) { + seq = seq.data.getDerValue(); // consume tag and length if (DEBUG != null) { byte[] responderKeyId = seq.getOctetString(); DEBUG.println("OCSP Responder key ID: " + @@ -392,21 +393,29 @@ // Retrieve the issuer's key identifier if (certIssuerKeyId == null) { certIssuerKeyId = signerCert.getIssuerKeyIdentifier(); + if (certIssuerKeyId == null) { + if (DEBUG != null) { + DEBUG.println("No issuer key identifier (AKID) " + + "in the signer certificate"); + } + } } - // Check that the key identifiers match - if (certIssuerKeyId == null || - !Arrays.equals(certIssuerKeyId, - OCSPChecker.getKeyId(responderCert))) { + // Check that the key identifiers match, if both are present + byte[] responderKeyId = null; + if (certIssuerKeyId != null && + (responderKeyId = + OCSPChecker.getKeyId(responderCert)) != null) { + if (!Arrays.equals(certIssuerKeyId, responderKeyId)) { + continue; // try next cert + } - continue; // try next cert - } - - if (DEBUG != null) { - DEBUG.println("Issuer certificate key ID: " + - String.format("0x%0" + - (certIssuerKeyId.length * 2) + "x", - new BigInteger(1, certIssuerKeyId))); + if (DEBUG != null) { + DEBUG.println("Issuer certificate key ID: " + + String.format("0x%0" + + (certIssuerKeyId.length * 2) + "x", + new BigInteger(1, certIssuerKeyId))); + } } // Check for the OCSPSigning key purpose @@ -433,15 +442,11 @@ // Check the date validity try { - if (dateCheckedAgainst == null) { - signerCert.checkValidity(); - } else { - signerCert.checkValidity(dateCheckedAgainst); - } + signerCert.checkValidity(); } catch (GeneralSecurityException e) { if (DEBUG != null) { DEBUG.println("Responder's certificate not within" + - " the validity period" + e); + " the validity period " + e); } continue; // try next cert }
--- a/src/share/lib/security/java.security Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/lib/security/java.security Mon Feb 11 21:39:50 2013 +0000 @@ -124,10 +124,12 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ com.sun.istack.internal.,\ - com.sun.jmx.default.,\ + com.sun.jmx.defaults.,\ com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ @@ -145,10 +147,12 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ com.sun.istack.internal.,\ - com.sun.jmx.default.,\ + com.sun.jmx.defaults.,\ com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\
--- a/src/share/lib/security/java.security-macosx Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/lib/security/java.security-macosx Mon Feb 11 21:39:50 2013 +0000 @@ -125,8 +125,13 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ + com.sun.istack.internal.,\ + com.sun.jmx.defaults.,\ + com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ com.sun.org.glassfish.external.,\ @@ -144,8 +149,13 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ + com.sun.istack.internal.,\ + com.sun.jmx.defaults.,\ + com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ com.sun.org.glassfish.external.,\
--- a/src/share/lib/security/java.security-solaris Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/lib/security/java.security-solaris Mon Feb 11 21:39:50 2013 +0000 @@ -126,8 +126,13 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ + com.sun.istack.internal.,\ + com.sun.jmx.defaults.,\ + com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ com.sun.org.glassfish.external.,\ @@ -144,8 +149,13 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ + com.sun.istack.internal.,\ + com.sun.jmx.defaults.,\ + com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ com.sun.org.glassfish.external.,\
--- a/src/share/lib/security/java.security-windows Mon Feb 11 18:36:31 2013 +0000 +++ b/src/share/lib/security/java.security-windows Mon Feb 11 21:39:50 2013 +0000 @@ -125,8 +125,13 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ + com.sun.istack.internal.,\ + com.sun.jmx.defaults.,\ + com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ com.sun.org.glassfish.external.,\ @@ -143,8 +148,13 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.xml.internal.,\ + com.sun.xml.internal.bind.,\ + com.sun.xml.internal.org.jvnet.staxex.,\ + com.sun.xml.internal.ws.,\ com.sun.imageio.,\ + com.sun.istack.internal.,\ + com.sun.jmx.defaults.,\ + com.sun.jmx.remote.util.,\ com.sun.org.apache.xerces.internal.utils.,\ com.sun.org.apache.xalan.internal.utils.,\ com.sun.org.glassfish.external.,\
--- a/src/solaris/bin/java_md_common.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/solaris/bin/java_md_common.c Mon Feb 11 21:39:50 2013 +0000 @@ -502,3 +502,19 @@ return findBootClass(env, classname); } +StdArg +*JLI_GetStdArgs() +{ + return NULL; +} + +int +JLI_GetStdArgc() { + return 0; +} + +jobjectArray +CreateApplicationArgs(JNIEnv *env, char **strv, int argc) +{ + return NewPlatformStringArray(env, strv, argc); +}
--- a/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2009, 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 @@ -68,7 +68,7 @@ static final short REVENT_OFFSET = 6; // Special value to indicate that an update should be ignored - static final byte CANCELLED = (byte)-1; + static final byte IGNORE = (byte)-1; // Maximum number of open file descriptors static final int OPEN_MAX = fdLimit(); @@ -192,15 +192,15 @@ // events are stored as bytes for efficiency reasons byte b = (byte)mask; - assert (b == mask) && (b != CANCELLED); + assert (b == mask) && (b != IGNORE); setUpdateEvents(fd, b); } } void release(int fd) { synchronized (updateLock) { - // cancel any pending update for this file descriptor - setUpdateEvents(fd, CANCELLED); + // ignore any pending update for this file descriptor + setUpdateEvents(fd, IGNORE); // remove from /dev/poll if (registered.get(fd)) { @@ -236,32 +236,40 @@ while (j < updateCount) { int fd = updateDescriptors[j]; short events = getUpdateEvents(fd); - boolean isRegistered = registered.get(fd); + boolean wasRegistered = registered.get(fd); // events = 0 => POLLREMOVE or do-nothing - if (events != CANCELLED) { + if (events != IGNORE) { if (events == 0) { - if (isRegistered) { + if (wasRegistered) { events = POLLREMOVE; registered.clear(fd); } else { - events = CANCELLED; + events = IGNORE; } } else { - if (!isRegistered) { + if (!wasRegistered) { registered.set(fd); } } } // populate pollfd array with updated event - if (events != CANCELLED) { + if (events != IGNORE) { + // insert POLLREMOVE if changing events + if (wasRegistered && events != POLLREMOVE) { + putPollFD(pollArray, index, fd, POLLREMOVE); + index++; + } putPollFD(pollArray, index, fd, events); index++; - if (index >= NUM_POLLFDS) { + if (index >= (NUM_POLLFDS-1)) { registerMultiple(wfd, pollArray.address(), index); index = 0; } + + // events for this fd now up to date + setUpdateEvents(fd, IGNORE); } j++; }
--- a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c Mon Feb 11 21:39:50 2013 +0000 @@ -94,9 +94,6 @@ { jint fd = fdval(env, fdo); struct iovec *iov = (struct iovec *)jlong_to_ptr(address); - if (len > 16) { - len = 16; - } return convertLongReturnVal(env, readv(fd, iov, len), JNI_TRUE); } @@ -126,9 +123,6 @@ { jint fd = fdval(env, fdo); struct iovec *iov = (struct iovec *)jlong_to_ptr(address); - if (len > 16) { - len = 16; - } return convertLongReturnVal(env, writev(fd, iov, len), JNI_FALSE); }
--- a/src/solaris/native/sun/nio/ch/IOUtil.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/solaris/native/sun/nio/ch/IOUtil.c Mon Feb 11 21:39:50 2013 +0000 @@ -144,6 +144,16 @@ } } +JNIEXPORT jint JNICALL +Java_sun_nio_ch_IOUtil_iovMax(JNIEnv *env, jclass this) +{ + jlong iov_max = sysconf(_SC_IOV_MAX); + if (iov_max == -1) + iov_max = 16; + return (jint)iov_max; +} + + /* Declared in nio_util.h for use elsewhere in NIO */ jlong
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/windows/bin/cmdtoargs.c Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,598 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * Converts a single string command line to the traditional argc, argv. + * There are rules which govern the breaking of the the arguments, and + * these rules are embodied in the regression tests below, and duplicated + * in the jdk regression tests. + */ + +#ifndef IDE_STANDALONE +#include "java.h" +#include "jli_util.h" +#else /* IDE_STANDALONE */ +// The defines we need for stand alone testing +#include <stdio.h> +#include <stdlib.h> +#include <Windows.h> +#define JNI_TRUE TRUE +#define JNI_FALSE FALSE +#define JLI_MemRealloc realloc +#define JLI_StringDup _strdup +#define JLI_MemFree free +#define jboolean boolean +typedef struct { + char* arg; + boolean has_wildcard; +} StdArg ; +#endif +static StdArg *stdargs; +static int stdargc; + +static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) { + + char* src = cmdline; + char* dest = arg; + jboolean separator = JNI_FALSE; + int quotes = 0; + int slashes = 0; + + char prev = 0; + char ch = 0; + int i; + jboolean done = JNI_FALSE; + + *wildcard = JNI_FALSE; + while ((ch = *src) != 0 && !done) { + switch (ch) { + case '"': + if (separator) { + done = JNI_TRUE; + break; + } + if (prev == '\\') { + for (i = 1; i < slashes; i += 2) { + *dest++ = prev; + } + if (slashes % 2 == 1) { + *dest++ = ch; + } else { + quotes++; + } + } else if (prev == '"' && quotes % 2 == 0) { + quotes++; + *dest++ = ch; // emit every other consecutive quote + } else if (quotes == 0) { + quotes++; // starting quote + } else { + quotes--; // matching quote + } + slashes = 0; + break; + + case '\\': + slashes++; + if (separator) { + done = JNI_TRUE; + separator = JNI_FALSE; + } + break; + + case ' ': + case '\t': + if (quotes % 2 == 1) { + *dest++ = ch; + } else { + separator = JNI_TRUE; + } + slashes = 0; + break; + + case '*': + case '?': + if (separator) { + done = JNI_TRUE; + separator = JNI_FALSE; + break; + } + if (quotes % 2 == 0) { + *wildcard = JNI_TRUE; + } + if (prev == '\\') { + *dest++ = prev; + } + *dest++ = ch; + break; + + default: + if (prev == '\\') { + for (i = 0 ; i < slashes ; i++) { + *dest++ = prev; + } + *dest++ = ch; + } else if (separator) { + done = JNI_TRUE; + } else { + *dest++ = ch; + } + slashes = 0; + } + + if (!done) { + prev = ch; + src++; + } + } + if (prev == '\\') { + for (i = 0; i < slashes; i++) { + *dest++ = prev; + } + } + *dest = 0; + return done ? src : NULL; +} + +int JLI_GetStdArgc() { + return stdargc; +} + +StdArg* JLI_GetStdArgs() { + return stdargs; +} + +void JLI_CmdToArgs(char* cmdline) { + int nargs = 0; + StdArg* argv = NULL; + jboolean wildcard = JNI_FALSE; + char* src = cmdline; + + // allocate arg buffer with sufficient space to receive the largest arg + char* arg = JLI_StringDup(cmdline); + + do { + src = next_arg(src, arg, &wildcard); + // resize to accommodate another Arg + argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg)); + argv[nargs].arg = JLI_StringDup(arg); + argv[nargs].has_wildcard = wildcard; + + nargs++; + } while (src != NULL); + + stdargc = nargs; + stdargs = argv; +} + +#ifdef IDE_STANDALONE +void doexit(int rv) { + printf("Hit any key to quit\n"); + int c = getchar(); + exit(rv); +} + +void doabort() { + doexit(1); +} + +class Vector { +public: + char* cmdline; + int argc; + char* argv[10]; + boolean wildcard[10]; + boolean enabled; + + Vector(){} + // Initialize our test vector with the program name, argv[0] + // and the single string command line. + Vector(char* pname, char* cline) { + argv[0] = pname; + wildcard[0] = FALSE; + cmdline = cline; + argc = 1; + enabled = TRUE; + } + + // add our expected strings, the program name has already been + // added so ignore that + void add(char* arg, boolean w) { + argv[argc] = arg; + wildcard[argc] = w; + argc++; + } + + void disable() { + enabled = FALSE; + } + + // validate the returned arguments with the expected arguments, using the + // new CmdToArgs method. + bool check() { + // "pgmname" rest of cmdline ie. pgmname + 2 double quotes + space + cmdline from windows + char* cptr = (char*) malloc(strlen(argv[0]) + sizeof(char) * 3 + strlen(cmdline) + 1); + _snprintf(cptr, MAX_PATH, "\"%s\" %s", argv[0], cmdline); + JLI_CmdToArgs(cptr); + free(cptr); + StdArg *kargv = JLI_GetStdArgs(); + int kargc = JLI_GetStdArgc(); + bool retval = true; + printf("\n===========================\n"); + printf("cmdline=%s\n", cmdline); + if (argc != kargc) { + printf("*** argument count does not match\n"); + printme(); + printtest(kargc, kargv); + doabort(); + } + for (int i = 0 ; i < argc && retval == true ; i++) { + if (strcmp(argv[i], kargv[i].arg) != 0) { + printf("*** argument at [%d] don't match\n got: %s\n exp: %s\n", + i, kargv[i].arg, argv[i]); + doabort(); + } + } + for (int i = 0 ; i < argc && retval == true ; i++) { + if (wildcard[i] != kargv[i].has_wildcard) { + printf("*** expansion flag at [%d] doesn't match\n got: %d\n exp: %d\n", + i, kargv[i].has_wildcard, wildcard[i]); + doabort(); + } + } + for (int i = 0 ; i < kargc ; i++) { + printf("k[%d]=%s\n", i, kargv[i].arg); + printf(" [%d]=%s\n", i, argv[i]); + } + return retval; + } + void printtest(int kargc, StdArg* kargv) { + for (int i = 0 ; i < kargc ; i++) { + printf("k[%d]=%s\n", i, kargv[i].arg); + } + } + void printme() { + for (int i = 0 ; i < argc ; i++) { + printf(" [%d]=%s\n", i, argv[i]); + } + } +}; + +void dotest(Vector** vectors) { + Vector* v = vectors[0]; + for (int i = 0 ; v != NULL;) { + if (v->enabled) { + v->check(); + } + v = vectors[++i]; + } +} + +#define MAXV 128 +int main(int argc, char* argv[]) { + + int n; + for (n=1; n < argc; n++) { + printf("%d %s\n", n, argv[n]); + } + if (n > 1) { + JLI_CmdToArgs(GetCommandLine()); + for (n = 0; n < stdargc; n++) { + printf(" [%d]=%s\n", n, stdargs[n].arg); + printf(" [%d]=%s\n", n, stdargs[n].has_wildcard ? "TRUE" : "FALSE"); + } + doexit(0); + } + + Vector *vectors[MAXV]; + + memset(vectors, 0, sizeof(vectors)); + int i = 0; + Vector* v = new Vector(argv[0], "abcd"); + v->add("abcd", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"a b c d\""); + v->add("a b c d", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a\"b c d\"e"); + v->add("ab c de", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "ab\\\"cd"); + v->add("ab\"cd", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"a b c d\\\\\""); + v->add("a b c d\\", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "ab\\\\\\\"cd"); + v->add("ab\\\"cd", FALSE); + // v->disable(); + vectors[i++] = v; + + + // Windows tests + v = new Vector(argv[0], "a\\\\\\c"); + v->add("a\\\\\\c", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"a\\\\\\d\""); + v->add("a\\\\\\d", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"a b c\" d e"); + v->add("a b c", FALSE); + v->add("d", FALSE); + v->add("e", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"ab\\\"c\" \"\\\\\" d"); + v->add("ab\"c", FALSE); + v->add("\\", FALSE); + v->add("d", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a\\\\\\c d\"e f\"g h"); + v->add("a\\\\\\c", FALSE); + v->add("de fg", FALSE); + v->add("h", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a\\\\\\\"b c d"); + v->add("a\\\"b", FALSE); // XXX "a\\\\\\\"b" + v->add("c", FALSE); + v->add("d", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a\\\\\\\\\"g c\" d e"); // XXX "a\\\\\\\\\"b c\" d e" + v->add("a\\\\\g c", FALSE); // XXX "a\\\\\\\\\"b c" + v->add("d", FALSE); + v->add("e", FALSE); + // v->disable(); + vectors[i++] = v; + + + // Additional tests + v = new Vector(argv[0], "\"a b c\"\""); + v->add("a b c\"", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"\"a b c\"\""); + v->add("a", FALSE); + v->add("b", FALSE); + v->add("c", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"\"\"a b c\"\"\""); + v->add("\"a b c\"", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"\"\"\"a b c\"\"\"\""); + v->add("\"a", FALSE); + v->add("b", FALSE); + v->add("c\"", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"\"\"\"\"a b c\"\"\"\"\""); + v->add("\"\"a b c\"\"", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"C:\\TEST A\\\\\""); + v->add("C:\\TEST A\\", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"\"C:\\TEST A\\\\\"\""); + v->add("C:\\TEST", FALSE); + v->add("A\\", FALSE); + // v->disable(); + vectors[i++] = v; + + + // test if a wildcard is present + v = new Vector(argv[0], "abc*def"); + v->add("abc*def", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"abc*def\""); + v->add("abc*def", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "*.abc"); + v->add("*.abc", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"*.abc\""); + v->add("*.abc", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "x.???"); + v->add("x.???", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\"x.???\""); + v->add("x.???", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "Debug\\*"); + v->add("Debug\\*", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "Debug\\f?a"); + v->add("Debug\\f?a", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "Debug\\?a.java"); + v->add("Debug\\?a.java", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "foo *.noexts"); + v->add("foo", FALSE); + v->add("*.noexts", TRUE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "X\\Y\\Z"); + v->add("X\\Y\\Z", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "\\X\\Y\\Z"); + v->add("\\X\\Y\\Z", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a b"); + v->add("a", FALSE); + v->add("b", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a\tb"); + v->add("a", FALSE); + v->add("b", FALSE); + // v->disable(); + vectors[i++] = v; + + + v = new Vector(argv[0], "a \t b"); + v->add("a", FALSE); + v->add("b", FALSE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "*\\"); + v->add("*\\", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "*/"); + v->add("*/", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], ".\\*"); + v->add(".\\*", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "./*"); + v->add("./*", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], ".\\*"); + v->add(".\\*", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], ".//*"); + v->add(".//*", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "..\\..\\*"); + v->add("..\\..\\*", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "../../*"); + v->add("../../*", TRUE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "..\\..\\"); + v->add("..\\..\\", FALSE); + // v->disable(); + vectors[i++] = v; + + v = new Vector(argv[0], "../../"); + v->add("../../", FALSE); + // v->disable(); + vectors[i++] = v; + + dotest(vectors); + printf("All tests pass [%d]\n", i); + doexit(0); +} +#endif /* IDE_STANDALONE */
--- a/src/windows/bin/java_md.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/bin/java_md.c Mon Feb 11 21:39:50 2013 +0000 @@ -526,6 +526,37 @@ } return (counts * 1000 * 1000)/counterFrequency.QuadPart; } +/* + * windows snprintf does not guarantee a null terminator in the buffer, + * if the computed size is equal to or greater than the buffer size, + * as well as error conditions. This function guarantees a null terminator + * under all these conditions. An unreasonable buffer or size will return + * an error value. Under all other conditions this function will return the + * size of the bytes actually written minus the null terminator, similar + * to ansi snprintf api. Thus when calling this function the caller must + * ensure storage for the null terminator. + */ +int +JLI_Snprintf(char* buffer, size_t size, const char* format, ...) { + int rc; + va_list vl; + if (size == 0 || buffer == NULL) + return -1; + buffer[0] = '\0'; + va_start(vl, format); + rc = vsnprintf(buffer, size, format, vl); + va_end(vl); + /* force a null terminator, if something is amiss */ + if (rc < 0) { + /* apply ansi semantics */ + buffer[size - 1] = '\0'; + return size; + } else if (rc == size) { + /* force a null terminator */ + buffer[size - 1] = '\0'; + } + return rc; +} /* * windows snprintf does not guarantee a null terminator in the buffer, @@ -1381,3 +1412,92 @@ { return JNI_FALSE; } + +/* + * At this point we have the arguments to the application, and we need to + * check with original stdargs in order to compare which of these truly + * needs expansion. cmdtoargs will specify this if it finds a bare + * (unquoted) argument containing a glob character(s) ie. * or ? + */ +jobjectArray +CreateApplicationArgs(JNIEnv *env, char **strv, int argc) +{ + int i, j, idx, tlen; + jobjectArray outArray, inArray; + char *ostart, *astart, **nargv; + jboolean needs_expansion = JNI_FALSE; + jmethodID mid; + int stdargc; + StdArg *stdargs; + jclass cls = GetLauncherHelperClass(env); + NULL_CHECK0(cls); + + if (argc == 0) { + return NewPlatformStringArray(env, strv, argc); + } + // the holy grail we need to compare with. + stdargs = JLI_GetStdArgs(); + stdargc = JLI_GetStdArgc(); + + // sanity check, this should never happen + if (argc > stdargc) { + JLI_TraceLauncher("Warning: app args is larger than the original, %d %d\n", argc, stdargc); + JLI_TraceLauncher("passing arguments as-is.\n"); + return NewPlatformStringArray(env, strv, argc); + } + + // sanity check, match the args we have, to the holy grail + idx = stdargc - argc; + ostart = stdargs[idx].arg; + astart = strv[0]; + // sanity check, ensure that the first argument of the arrays are the same + if (JLI_StrCmp(ostart, astart) != 0) { + // some thing is amiss the args don't match + JLI_TraceLauncher("Warning: app args parsing error\n"); + JLI_TraceLauncher("passing arguments as-is\n"); + return NewPlatformStringArray(env, strv, argc); + } + + // make a copy of the args which will be expanded in java if required. + nargv = (char **)JLI_MemAlloc(argc * sizeof(char*)); + for (i = 0, j = idx; i < argc; i++, j++) { + jboolean arg_expand = (JLI_StrCmp(stdargs[j].arg, strv[i]) == 0) + ? stdargs[j].has_wildcard + : JNI_FALSE; + if (needs_expansion == JNI_FALSE) + needs_expansion = arg_expand; + + // indicator char + String + NULL terminator, the java method will strip + // out the first character, the indicator character, so no matter what + // we add the indicator + tlen = 1 + JLI_StrLen(strv[i]) + 1; + nargv[i] = (char *) JLI_MemAlloc(tlen); + if (JLI_Snprintf(nargv[i], tlen, "%c%s", arg_expand ? 'T' : 'F', + strv[i]) < 0) { + return NULL; + } + JLI_TraceLauncher("%s\n", nargv[i]); + } + + if (!needs_expansion) { + // clean up any allocated memory and return back the old arguments + for (i = 0 ; i < argc ; i++) { + JLI_MemFree(nargv[i]); + } + JLI_MemFree(nargv); + return NewPlatformStringArray(env, strv, argc); + } + NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, + "expandArgs", + "([Ljava/lang/String;)[Ljava/lang/String;")); + + // expand the arguments that require expansion, the java method will strip + // out the indicator character. + inArray = NewPlatformStringArray(env, nargv, argc); + outArray = (*env)->CallStaticObjectMethod(env, cls, mid, inArray); + for (i = 0; i < argc; i++) { + JLI_MemFree(nargv[i]); + } + JLI_MemFree(nargv); + return outArray; +}
--- a/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Mon Feb 11 21:39:50 2013 +0000 @@ -45,15 +45,25 @@ private long ctxHandle; static { - initFirst(); + initFirst(Status.class); } + // Used by native code to indicate when a particular protocol sequence is completed + // and must not be re-used. + + class Status { + boolean sequenceComplete; + } + + Status status; + NTLMAuthSequence (String username, String password, String ntdomain) throws IOException { this.username = username; this.password = password; this.ntdomain = ntdomain; + this.status = new Status(); state = 0; crdHandle = getCredentialsHandle (username, ntdomain, password); if (crdHandle == 0) { @@ -63,19 +73,26 @@ public String getAuthHeader (String token) throws IOException { byte[] input = null; + + assert !status.sequenceComplete; + if (token != null) input = (new BASE64Decoder()).decodeBuffer(token); - byte[] b = getNextToken (crdHandle, input); + byte[] b = getNextToken (crdHandle, input, status); if (b == null) throw new IOException ("Internal authentication error"); return (new B64Encoder()).encode (b); } - private native static void initFirst (); + public boolean isComplete() { + return status.sequenceComplete; + } + + private native static void initFirst (Class<NTLMAuthSequence.Status> clazz); private native long getCredentialsHandle (String user, String domain, String password); - private native byte[] getNextToken (long crdHandle, byte[] lastToken); + private native byte[] getNextToken (long crdHandle, byte[] lastToken, Status returned); } class B64Encoder extends BASE64Encoder {
--- a/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -186,6 +186,7 @@ public synchronized boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { try { + NTLMAuthSequence seq = (NTLMAuthSequence)conn.authObj(); if (seq == null) { seq = new NTLMAuthSequence (username, password, ntdomain); @@ -193,8 +194,12 @@ } String response = "NTLM " + seq.getAuthHeader (raw.length()>6?raw.substring(5):null); conn.setAuthenticationProperty(getHeaderName(), response); + if (seq.isComplete()) { // 7200720 + conn.authObj(null); + } return true; } catch (IOException e) { + conn.authObj(null); // MMM 7200720 ?? return false; } }
--- a/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c Mon Feb 11 21:39:50 2013 +0000 @@ -41,18 +41,20 @@ #define SECURITY_WIN32 #include "sspi.h" -static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle); +static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle, JNIEnv *env, jobject status); static jfieldID ntlm_ctxHandleID; static jfieldID ntlm_crdHandleID; +static jfieldID status_seqCompleteID; static HINSTANCE lib = NULL; JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_initFirst -(JNIEnv *env, jclass clazz) +(JNIEnv *env, jclass authseq_clazz, jclass status_clazz) { - ntlm_ctxHandleID = (*env)->GetFieldID(env, clazz, "ctxHandle", "J"); - ntlm_crdHandleID = (*env)->GetFieldID(env, clazz, "crdHandle", "J"); + ntlm_ctxHandleID = (*env)->GetFieldID(env, authseq_clazz, "ctxHandle", "J"); + ntlm_crdHandleID = (*env)->GetFieldID(env, authseq_clazz, "crdHandle", "J"); + status_seqCompleteID = (*env)->GetFieldID(env, status_clazz, "sequenceComplete", "Z"); } /* @@ -145,8 +147,14 @@ } } + +/* + * Class: sun_net_www_protocol_http_ntlm_NTLMAuthSequence + * Method: getNextToken + * Signature: (J[BLsun/net/www/protocol/http/ntlm/NTLMAuthSequence/Status;)[B + */ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_getNextToken -(JNIEnv *env, jobject this, jlong crdHandle, jbyteArray lastToken) +(JNIEnv *env, jobject this, jlong crdHandle, jbyteArray lastToken, jobject status) { VOID *pInput = 0; @@ -217,7 +225,7 @@ } if (ss < 0) { - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); return 0; } @@ -225,7 +233,7 @@ ss = CompleteAuthToken( pCtx, &OutBuffDesc ); if (ss < 0) { - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); return 0; } } @@ -235,18 +243,18 @@ (*env)->SetByteArrayRegion(env, ret, 0, OutSecBuff.cbBuffer, OutSecBuff.pvBuffer); if (lastToken != 0) // 2nd stage - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); result = ret; } if ((ss != SEC_I_CONTINUE_NEEDED) && (ss == SEC_I_COMPLETE_AND_CONTINUE)) { - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); } return result; } -static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle) { +static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle, JNIEnv *env, jobject status) { if (credHand != 0) { FreeCredentialsHandle(credHand); free(credHand); @@ -256,4 +264,7 @@ DeleteSecurityContext(ctxHandle); free(ctxHandle); } + + /* Sequence is complete so set flag */ + (*env)->SetBooleanField(env, status, status_seqCompleteID, JNI_TRUE); }
--- a/src/windows/native/sun/nio/ch/IOUtil.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/native/sun/nio/ch/IOUtil.c Mon Feb 11 21:39:50 2013 +0000 @@ -41,9 +41,6 @@ /* field id for jint 'fd' in java.io.FileDescriptor used for socket fds */ static jfieldID fd_fdID; -/* false for 95/98/ME, true for NT/W2K */ -static jboolean onNT = JNI_FALSE; - JNIEXPORT jboolean JNICALL Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed (JNIEnv *env, jclass clazz, jbyteArray randArray); @@ -55,13 +52,6 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_IOUtil_initIDs(JNIEnv *env, jclass clazz) { - OSVERSIONINFO ver; - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx(&ver); - if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { - onNT = JNI_TRUE; - } - clazz = (*env)->FindClass(env, "java/io/FileDescriptor"); fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"); handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J"); @@ -80,6 +70,13 @@ randArray); } +JNIEXPORT jint JNICALL +Java_sun_nio_ch_IOUtil_iovMax(JNIEnv *env, jclass this) +{ + return 16; +} + + jint convertReturnVal(JNIEnv *env, jint n, jboolean reading) { @@ -205,9 +202,3 @@ { return (*env)->GetLongField(env, fdo, handle_fdID); } - -jboolean -isNT() -{ - return onNT; -}
--- a/src/windows/native/sun/nio/ch/SocketDispatcher.c Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/native/sun/nio/ch/SocketDispatcher.c Mon Feb 11 21:39:50 2013 +0000 @@ -97,10 +97,6 @@ return IOS_THROWN; } - if ((isNT() == JNI_FALSE) && (len > 16)) { - len = 16; - } - /* copy iovec into WSABUF */ for(i=0; i<len; i++) { jint iov_len = iovp[i].iov_len; @@ -208,10 +204,6 @@ return IOS_THROWN; } - if ((isNT() == JNI_FALSE) && (len > 16)) { - len = 16; - } - /* copy iovec into WSABUF */ for(i=0; i<len; i++) { jint iov_len = iovp[i].iov_len;
--- a/src/windows/native/sun/nio/ch/nio_util.h Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/native/sun/nio/ch/nio_util.h Mon Feb 11 21:39:50 2013 +0000 @@ -35,7 +35,6 @@ jint fdval(JNIEnv *env, jobject fdo); jlong handleval(JNIEnv *env, jobject fdo); -jboolean isNT(); jint convertReturnVal(JNIEnv *env, jint n, jboolean r); jlong convertLongReturnVal(JNIEnv *env, jlong n, jboolean r); jboolean purgeOutstandingICMP(JNIEnv *env, jclass clazz, jint fd);
--- a/src/windows/native/sun/windows/awt_Window.cpp Mon Feb 11 18:36:31 2013 +0000 +++ b/src/windows/native/sun/windows/awt_Window.cpp Mon Feb 11 21:39:50 2013 +0000 @@ -1477,7 +1477,7 @@ if (wClassEvent == NULL) { if (env->PushLocalFrame(1) < 0) return; - wClassEvent = env->FindClass("java/awt/event/WindowEvent"); + wClassEvent = env->FindClass("sun/awt/TimedWindowEvent"); if (wClassEvent != NULL) { wClassEvent = (jclass)env->NewGlobalRef(wClassEvent); } @@ -1491,7 +1491,7 @@ if (wEventInitMID == NULL) { wEventInitMID = env->GetMethodID(wClassEvent, "<init>", - "(Ljava/awt/Window;ILjava/awt/Window;II)V"); + "(Ljava/awt/Window;ILjava/awt/Window;IIJ)V"); DASSERT(wEventInitMID); if (wEventInitMID == NULL) { return; @@ -1532,7 +1532,7 @@ } } jobject event = env->NewObject(wClassEvent, wEventInitMID, target, id, - jOpposite, oldState, newState); + jOpposite, oldState, newState, TimeHelper::getMessageTimeUTC()); DASSERT(!safe_ExceptionOccurred(env)); DASSERT(event != NULL); if (jOpposite != NULL) { @@ -1559,21 +1559,8 @@ BOOL AwtWindow::AwtSetActiveWindow(BOOL isMouseEventCause, UINT hittest) { - // Fix for 6458497. - // Retreat if current foreground window is out of both our and embedder process. - // The exception is when activation is requested due to a mouse event. - if (!isMouseEventCause) { - HWND fgWindow = ::GetForegroundWindow(); - if (NULL != fgWindow) { - DWORD fgProcessID; - ::GetWindowThreadProcessId(fgWindow, &fgProcessID); - if (fgProcessID != ::GetCurrentProcessId() - && !AwtToolkit::GetInstance().IsEmbedderProcessId(fgProcessID)) - { - return FALSE; - } - } - } + // We used to reject non mouse window activation if our app wasn't active. + // This code since has been removed as the fix for 7185280 HWND proxyContainerHWnd = GetProxyToplevelContainer(); HWND proxyHWnd = GetProxyFocusOwner();
--- a/test/Makefile Mon Feb 11 18:36:31 2013 +0000 +++ b/test/Makefile Mon Feb 11 21:39:50 2013 +0000 @@ -512,7 +512,7 @@ JDK_ALL_TARGETS += jdk_misc jdk_misc: $(call TestDirs, \ demo/jvmti demo/zipfs javax/naming javax/script \ - javax/smartcardio com/sun/jndi com/sun/xml sun/misc) + javax/smartcardio javax/xml/soap com/sun/jndi com/sun/xml sun/misc) $(call RunAgentvmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST)
--- a/test/ProblemList.txt Mon Feb 11 18:36:31 2013 +0000 +++ b/test/ProblemList.txt Mon Feb 11 21:39:50 2013 +0000 @@ -114,83 +114,10 @@ # jdk_awt -# None of the awt tests are using samevm, might not be worth the effort due -# to the vm overhead not being enough to make a difference. -# In general, the awt tests are problematic with or without samevm, and there -# are issues with using a Xvfb display. - -# Fails on solaris sparc, timedout? in othervm mode -java/awt/event/MouseEvent/AcceptExtraButton/AcceptExtraButton.java generic-all - -# Causes hang in samevm mode??? Solaris 11 i586 -java/awt/FullScreen/SetFSWindow/FSFrame.java generic-all - -# Fails on solaris 11 i586, -client, in othervm mode not sure why -java/awt/Component/PrintAllXcheckJNI/PrintAllXcheckJNI.java generic-all -java/awt/Focus/CloseDialogActivateOwnerTest/CloseDialogActivateOwnerTest.java generic-all -java/awt/FontClass/FontAccess.java generic-all -java/awt/Mixing/HWDisappear.java generic-all -java/awt/Mixing/MixingInHwPanel.java generic-all -java/awt/Mouse/MaximizedFrameTest/MaximizedFrameTest.html generic-all -java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java generic-all -java/awt/Toolkit/SecurityTest/SecurityTest2.java generic-all -java/awt/image/mlib/MlibOpsTest.java generic-all - -# Fails on windows, othervm mode, various errors -java/awt/Focus/NonFocusableWindowTest/NonfocusableOwnerTest.java generic-all -java/awt/Focus/OwnedWindowFocusIMECrashTest/OwnedWindowFocusIMECrashTest.java generic-all -java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java generic-all -java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Standard.java generic-all -java/awt/event/KeyEvent/KeyTyped/CtrlASCII.html generic-all -java/awt/font/Threads/FontThread.java generic-all -java/awt/print/PrinterJob/PrtException.java generic-all - -# Fails with windows X64, othervm, -server -com/sun/awt/Translucency/WindowOpacity.java generic-all -java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java generic-all -java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html generic-all -java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.html generic-all -java/awt/Focus/FocusEmbeddedFrameTest/FocusEmbeddedFrameTest.java generic-all -java/awt/Frame/LayoutOnMaximizeTest/LayoutOnMaximizeTest.java generic-all -java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java generic-all -java/awt/Mixing/MixingOnShrinkingHWButton.java generic-all -java/awt/Mouse/MouseModifiersUnitTest/ExtraButtonDrag.java generic-all - ############################################################################ # jdk_beans -# A large set of the beans tests set the security manager, which would seem -# to indicate that a large number of them should be "othervm", yet are all -# very small tests and could greatly benefit from a samevm test run. -# So a large batch of beans tests are currently run with othervm mode. - -# Filed 6986807 -java/beans/Introspector/TestTypeResolver.java generic-all - -# Filed 6986813 -java/beans/Introspector/memory/Test4508780.java generic-all - -# Linux, some kind of problems with X11 display -java/beans/PropertyChangeSupport/Test4682386.java generic-all -java/beans/PropertyChangeSupport/TestSynchronization.java generic-all -java/beans/Statement/Test4653179.java generic-all - -# Runs REALLY slow on Solaris sparc for some reason, both -client and -server -java/beans/XMLEncoder/Test4625418.java solaris-sparc - -# Problems with samevm and setting security manager (speculation partially) -java/beans/Introspector/4168475/Test4168475.java generic-all -java/beans/Introspector/4520754/Test4520754.java generic-all -java/beans/Introspector/6380849/TestBeanInfo.java generic-all -java/beans/Introspector/Test4144543.java generic-all - -# Failed to call method solaris-sparc??? -java/beans/EventHandler/Test6788531.java generic-all - -# Jar or class not found??? -java/beans/XMLEncoder/6329581/Test6329581.java generic-all - ############################################################################ # jdk_lang @@ -304,95 +231,29 @@ # 6988950 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all -# 7162111 -demo/jvmti/mtrace/TraceJFrame.java macosx-all - -# Need to be marked othervm, or changed to be samevm safe +# 7056489 com/sun/jndi/ldap/ReadTimeoutTest.java generic-all -com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all - -# Need to be marked othervm, or changed to be samevm safe -com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java generic-all - -# Solaris sparc and others, exception in initializer -javax/imageio/CachePremissionsTest/CachePermissionsTest.java generic-all - -# Leaves file rgba_* open, fails with windows samevm -javax/imageio/plugins/png/PngOutputTypeTest.java generic-all - -# Suspect test.png file is left open, windows samevm problems -javax/imageio/plugins/png/ITXtTest.java generic-all - -# Solaris sparc and others, failed to compile testcase -javax/imageio/metadata/DOML3Node.java generic-all - -# One of these tests is leaving file IMGP1001.JPG open, windows samevm -javax/imageio/plugins/jpeg/ConcurrentReadingTest.java generic-all -javax/imageio/plugins/jpeg/ReadingInterruptionTest.java generic-all - -# One of these files is missing a close on writer_* files, windows samevm -javax/imageio/plugins/jpeg/ConcurrentWritingTest.java generic-all -javax/imageio/plugins/jpeg/WritingInterruptionTest.java generic-all - -# Leaving file test.jpg open, windows samevm -javax/imageio/plugins/jpeg/ReadAsGrayTest.java generic-all - -# Missing close on file wbmp*, windows samevm -javax/imageio/plugins/wbmp/CanDecodeTest.java generic-all - -# Failures on OpenSolaris, cannot read input files? samevm issues? -javax/imageio/metadata/BooleanAttributes.java generic-all -javax/imageio/plugins/bmp/BMPSubsamplingTest.java generic-all -javax/imageio/plugins/bmp/TopDownTest.java generic-all -javax/imageio/plugins/gif/EncodeSubImageTest.java generic-all -javax/imageio/plugins/gif/GifTransparencyTest.java generic-all -javax/imageio/plugins/png/GrayPngTest.java generic-all -javax/imageio/plugins/png/ItxtUtf8Test.java generic-all -javax/imageio/plugins/png/MergeStdCommentTest.java generic-all -javax/imageio/plugins/png/ShortHistogramTest.java generic-all -javax/imageio/plugins/shared/BitDepth.java generic-all - -# Exclude all javax/print tests, even if they passed, they may need samevm work - -# Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client -javax/print/attribute/autosense/PrintAutoSenseData.java generic-all -javax/print/attribute/Chroma.java generic-all -javax/print/attribute/CollateAttr.java generic-all -javax/print/attribute/PSCopiesFlavorTest.java generic-all -javax/print/LookupServices.java generic-all -javax/print/TestRaceCond.java generic-all - -# These tests really require a printer (might all be windows only tests?) -javax/print/CheckDupFlavor.java generic-all -javax/print/PrintSE/PrintSE.sh generic-all -javax/print/attribute/ChromaticityValues.java generic-all -javax/print/attribute/GetCopiesSupported.java generic-all -javax/print/attribute/SidesPageRangesTest.java generic-all -javax/print/attribute/SupportedPrintableAreas.java generic-all -javax/print/attribute/AttributeTest.java generic-all - -# Only print test left, excluding just because all print tests have been -javax/print/attribute/MediaMappingsTest.java generic-all # 7162111 -javax/script/CauseExceptionTest.java macosx-all -javax/script/GetInterfaceTest.java macosx-all -javax/script/JavaScriptScopeTest.java macosx-all -javax/script/NullUndefinedVarTest.java macosx-all -javax/script/PluggableContextTest.java macosx-all -javax/script/ProviderTest.sh macosx-all -javax/script/RhinoExceptionTest.java macosx-all -javax/script/StringWriterPrintTest.java macosx-all -javax/script/Test1.java macosx-all -javax/script/Test2.java macosx-all -javax/script/Test3.java macosx-all -javax/script/Test4.java macosx-all -javax/script/Test5.java macosx-all -javax/script/Test6.java macosx-all -javax/script/Test7.java macosx-all -javax/script/Test8.java macosx-all -javax/script/UnescapedBracketRegExTest.java macosx-all -javax/script/VersionTest.java macosx-all +demo/jvmti/mtrace/TraceJFrame.java macosx-all +javax/script/CauseExceptionTest.java macosx-all +javax/script/GetInterfaceTest.java macosx-all +javax/script/JavaScriptScopeTest.java macosx-all +javax/script/NullUndefinedVarTest.java macosx-all +javax/script/PluggableContextTest.java macosx-all +javax/script/ProviderTest.sh macosx-all +javax/script/RhinoExceptionTest.java macosx-all +javax/script/StringWriterPrintTest.java macosx-all +javax/script/Test1.java macosx-all +javax/script/Test2.java macosx-all +javax/script/Test3.java macosx-all +javax/script/Test4.java macosx-all +javax/script/Test5.java macosx-all +javax/script/Test6.java macosx-all +javax/script/Test7.java macosx-all +javax/script/Test8.java macosx-all +javax/script/UnescapedBracketRegExTest.java macosx-all +javax/script/VersionTest.java macosx-all ############################################################################ @@ -708,15 +569,12 @@ 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 + ############################################################################ -# jdk_swing (not using samevm) - -# Fails on solaris 11 i586, with othervm -javax/swing/JFileChooser/6570445/bug6570445.java generic-all -javax/swing/JFileChooser/6738668/bug6738668.java generic-all -javax/swing/JPopupMenu/6675802/bug6675802.java generic-all -javax/swing/system/6799345/TestShutdown.java generic-all +# jdk_swing ############################################################################ @@ -729,6 +587,9 @@ # jdk_tools +# 6461635 +com/sun/tools/attach/BasicTests.sh generic-all + # Filed 6952105 com/sun/jdi/SuspendThreadTest.java generic-all @@ -752,6 +613,13 @@ sun/tools/jrunscript/jrunscript-fTest.sh macosx-all sun/tools/jrunscript/jrunscriptTest.sh macosx-all +# 8001118 +sun/tools/jcmd/jcmd-f.sh generic-all +sun/tools/jcmd/jcmd-help-help.sh generic-all + +# 7175775 +sun/tools/jinfo/Basic.sh macosx-all + ############################################################################ # jdk_util @@ -785,6 +653,10 @@ # 7162111 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/java/awt/Frame/7024749/bug7024749.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/java/awt/Frame/7024749/bug7024749.java Mon Feb 11 21:39:50 2013 +0000 @@ -23,9 +23,9 @@ /* * @test - * @bug 7024749 + * @bug 7024749 7184326 * @summary JDK7 b131---a crash in: Java_sun_awt_windows_ThemeReader_isGetThemeTransitionDurationDefined+0x75 - * @library ../../../regtesthelpers + * @library ../../regtesthelpers * @build Util * @author Oleg Pekhovskiy: area=awt.toplevel @run main bug7024749
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/HugeFrame/HugeFrame.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,49 @@ +/* + * 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 7160609 + @summary A window with huge dimensions shouldn't crash JVM + @author anthony.petrov@oracle.com: area=awt.toplevel + @run main HugeFrame +*/ + +import java.awt.*; + +public class HugeFrame { + public static void main(String[] args) throws Exception { + Frame f = new Frame("Huge"); + + // 8193+ should already produce a crash, but let's go extreme... + f.setBounds(10, 10, 30000, 500000); + f.setVisible(true); + + // We would crash by now if the bug wasn't fixed + Thread.sleep(1000); + System.err.println(f.getBounds()); + + // Cleanup + f.dispose(); + } +}
--- a/test/java/beans/Introspector/6380849/TestBeanInfo.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/java/beans/Introspector/6380849/TestBeanInfo.java Mon Feb 11 21:39:50 2013 +0000 @@ -38,8 +38,7 @@ import java.beans.BeanInfo; import java.beans.Introspector; -import java.lang.ref.Reference; -import java.lang.reflect.Field; +import java.lang.reflect.Method; public class TestBeanInfo implements Runnable { @@ -60,10 +59,9 @@ try { actual = Introspector.getBeanInfo(type); type = actual.getClass(); - Field field = type.getDeclaredField("targetBeanInfoRef"); // NON-NLS: field name - field.setAccessible(true); - Reference ref = (Reference) field.get(actual); - actual = (BeanInfo) ref.get(); + Method method = type.getDeclaredMethod("getTargetBeanInfo"); // NON-NLS: method name + method.setAccessible(true); + actual = (BeanInfo) method.invoke(actual); } catch (Exception exception) { throw new Error("unexpected error", exception);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/Introspector/Test7193977.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,159 @@ +/* + * 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 7193977 + * @summary Tests that generified property descriptors do not loose additional info + * @author Sergey Malenkov + */ + +import java.awt.Image; +import java.beans.BeanDescriptor; +import java.beans.BeanInfo; +import java.beans.EventSetDescriptor; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.MethodDescriptor; +import java.beans.PropertyDescriptor; +import java.util.Arrays; +import java.util.List; + +public class Test7193977 { + + private static final List<String> names = Arrays.asList("listType", "list", "value"); + + public static void main(String args[]) { + for (String name : names) { + test(Abstract.class, name); + test(Concrete.class, name); + } + } + + private static void test(Class<?> type, String name) { + if (!Boolean.TRUE.equals(BeanUtils.getPropertyDescriptor(type, name).getValue("transient"))) { + throw new Error("property '" + name + "' is not transient"); + } + } + + public static final class Concrete extends Abstract<String> { + } + + public static abstract class Abstract<T> { + private List<T> list; + + public List<T> getList() { + return this.list; + } + + public void setList(List<T> list) { + this.list = list; + } + + public T getValue(int index) { + return (0 <= index) && (this.list != null) && (index < this.list.size()) + ? this.list.get(index) + : null; + } + + public void setValue(int index, T value) { + if ((0 <= index) && (this.list != null)) { + if (index == this.list.size()) { + this.list.add(value); + } + else if (index < this.list.size()) { + this.list.set(index, value); + } + } + } + + public String getListType() { + return (this.list != null) + ? this.list.getClass().getName() + : null; + } + + public void setListType(String type) throws Exception { + this.list = (type != null) + ? (List<T>) Class.forName(type).newInstance() + : null; + } + } + + public static final class ConcreteBeanInfo extends Wrapper { + public ConcreteBeanInfo() throws IntrospectionException { + super(Concrete.class); + } + } + + public static final class AbstractBeanInfo extends Wrapper { + public AbstractBeanInfo() throws IntrospectionException { + super(Abstract.class); + for (PropertyDescriptor pd : getPropertyDescriptors()) { + if (names.contains(pd.getName())) { + pd.setValue("transient", Boolean.TRUE); + } + } + } + } + + private static class Wrapper implements BeanInfo { + private final BeanInfo info; + + Wrapper(Class<?> type) throws IntrospectionException { + this.info = Introspector.getBeanInfo(type, Introspector.IGNORE_IMMEDIATE_BEANINFO); + } + + public BeanDescriptor getBeanDescriptor() { + return this.info.getBeanDescriptor(); + } + + public EventSetDescriptor[] getEventSetDescriptors() { + return this.info.getEventSetDescriptors(); + } + + public int getDefaultEventIndex() { + return this.info.getDefaultEventIndex(); + } + + public PropertyDescriptor[] getPropertyDescriptors() { + return this.info.getPropertyDescriptors(); + } + + public int getDefaultPropertyIndex() { + return this.info.getDefaultPropertyIndex(); + } + + public MethodDescriptor[] getMethodDescriptors() { + return this.info.getMethodDescriptors(); + } + + public BeanInfo[] getAdditionalBeanInfo() { + return this.info.getAdditionalBeanInfo(); + } + + public Image getIcon(int kind) { + return this.info.getIcon(kind); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/Introspector/Test7195106.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,67 @@ +/* + * 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 7195106 + * @summary Tests that explicit BeanInfo is not collected + * @author Sergey Malenkov + */ + +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.SimpleBeanInfo; + +public class Test7195106 { + + public static void main(String[] arg) throws Exception { + BeanInfo info = Introspector.getBeanInfo(My.class); + if (null == info.getIcon(BeanInfo.ICON_COLOR_16x16)) { + throw new Error("Unexpected behavior"); + } + try { + int[] array = new int[1024]; + while (true) { + array = new int[array.length << 1]; + } + } + catch (OutOfMemoryError error) { + System.gc(); + } + if (null == info.getIcon(BeanInfo.ICON_COLOR_16x16)) { + throw new Error("Explicit BeanInfo is collected"); + } + } + + public static class My { + } + + public static class MyBeanInfo extends SimpleBeanInfo { + @Override + public Image getIcon(int type) { + return new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/XMLEncoder/Test7169395.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,101 @@ +/* + * 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 7169395 + * @summary Tests that array list initialized correctly + * @author Sergey Malenkov + */ + +import java.beans.ConstructorProperties; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.TreeMap; + +public class Test7169395 extends AbstractTest { + + public static void main(String[] args) { + new Test7169395().test(true); + } + + protected Object getObject() { + Container container = new Container(); + container.add("test-null", null); + container.add("test-value", "value"); + container.add("test-other", "other"); + return container; + } + + public static class Component { + + private final Container container; + private final String name; + private String value; + + @ConstructorProperties({ "container", "name" }) + public Component(Container container, String name) { + this.container = container; + this.name = name; + } + + public Container getContainer() { + return this.container; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + } + + public static class Container { + + private final Map<String, Component> map = new TreeMap<String, Component>(); + + public Collection<Component> getComponents() { + return new ArrayList<Component>(this.map.values()); + } + + public void setComponents(Collection<Component> components) { + this.map.clear(); + for (Component component : components){ + this.map.put(component.getName(), component); + } + } + + public void add(String name, String value) { + Component list = new Component(this, name); + list.setValue(value); + this.map.put(name, list); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/net/URL/Gopher.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,74 @@ +/* + * 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 7189567 + * @summary java net obselete protocol + * @run main Gopher + * @run main/othervm -Djdk.net.registerGopherProtocol Gopher enabled + * @run main/othervm -Djdk.net.registerGopherProtocol=false Gopher + */ + +import java.net.MalformedURLException; +import java.net.URL; + +public class Gopher { + static final String GOPHER_PROP = "jdk.net.registerGopherProtocol"; + + public static void main(String[] args) throws Exception { + boolean expectEnabled = false; + if (args.length >= 1 && args[0].equals("enabled")) + expectEnabled = true; + + String prop = System.getProperty(GOPHER_PROP); + boolean gopherEnabled = prop == null ? false : + (prop.equalsIgnoreCase("false") ? false : true); + + // Validate system property reading + if (expectEnabled && !gopherEnabled) { + System.err.println(GOPHER_PROP + ": " + gopherEnabled); + throw new RuntimeException( + "Failed: expected system property to be enabled, but it is not"); + } + if (!expectEnabled && gopherEnabled) { + System.err.println(GOPHER_PROP + ": " + gopherEnabled); + throw new RuntimeException( + "Failed: expected system property to be disabled, but it is not"); + } + + try { + new URL("gopher://anyhost:70/[anydata]"); + if (!gopherEnabled) { + System.err.println(GOPHER_PROP + ": " + gopherEnabled); + throw new RuntimeException("Failed: gopher should NOT be enabled"); + } + } catch (MalformedURLException x) { + if (gopherEnabled) { + System.err.println(GOPHER_PROP + ": " + gopherEnabled); + x.printStackTrace(); + throw new RuntimeException("Failed: gopher should be enabled"); + } + } + } +}
--- a/test/java/nio/channels/DatagramChannel/SendToUnresolved.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/java/nio/channels/DatagramChannel/SendToUnresolved.java Mon Feb 11 21:39:50 2013 +0000 @@ -42,7 +42,7 @@ try { dc.send(bb, sa); throw new RuntimeException("Expected exception not thrown"); - } catch (IOException e) { + } catch (IOException | UnresolvedAddressException e) { // Correct result } dc.close();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/nio/channels/Selector/ChangingInterests.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,190 @@ +/* + * 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 7200742 + * @summary Test that Selector doesn't spin when changing interest ops + */ + +import java.net.*; +import java.nio.ByteBuffer; +import java.nio.channels.*; +import static java.nio.channels.SelectionKey.*; +import java.io.IOException; + +public class ChangingInterests { + + static int OPS[] = { 0, OP_WRITE, OP_READ, (OP_WRITE|OP_READ) }; + + static String toOpsString(int ops) { + String s = ""; + if ((ops & OP_READ) > 0) + s += "POLLIN"; + if ((ops & OP_WRITE) > 0) { + if (s.length() > 0) + s += "|"; + s += "POLLOUT"; + } + if (s.length() == 0) + s = "0"; + return "(" + s + ")"; + } + + static void write1(SocketChannel peer) throws IOException { + peer.write(ByteBuffer.wrap(new byte[1])); + // give time for other end to be readable + try { + Thread.sleep(50); + } catch (InterruptedException ignore) { } + } + + static void drain(SocketChannel sc) throws IOException { + ByteBuffer buf = ByteBuffer.allocate(100); + int n; + while ((n = sc.read(buf)) > 0) { + buf.rewind(); + } + } + + /** + * Changes the given key's interest set from one set to another and then + * checks the selected key set and the key's channel. + */ + static void testChange(SelectionKey key, int from, int to) throws IOException { + Selector sel = key.selector(); + assertTrue(sel.keys().size() == 1, "Only one channel should be registered"); + + // ensure that channel is registered with the "from" interest set + key.interestOps(from); + sel.selectNow(); + sel.selectedKeys().clear(); + + // change to the "to" interest set + key.interestOps(to); + System.out.println("select..."); + int selected = sel.selectNow(); + System.out.println("" + selected + " channel(s) selected"); + + int expected = (to == 0) ? 0 : 1; + assertTrue(selected == expected, "Expected " + expected); + + // check selected keys + for (SelectionKey k: sel.selectedKeys()) { + assertTrue(k == key, "Unexpected key selected"); + + boolean readable = k.isReadable(); + boolean writable = k.isWritable(); + + System.out.println("key readable: " + readable); + System.out.println("key writable: " + writable); + + if ((to & OP_READ) == 0) { + assertTrue(!readable, "Not expected to be readable"); + } else { + assertTrue(readable, "Expected to be readable"); + } + + if ((to & OP_WRITE) == 0) { + assertTrue(!writable, "Not expected to be writable"); + } else { + assertTrue(writable, "Expected to be writable"); + } + + sel.selectedKeys().clear(); + } + } + + /** + * Tests that given Selector's select method blocks. + */ + static void testForSpin(Selector sel) throws IOException { + System.out.println("Test for spin..."); + long start = System.currentTimeMillis(); + int count = 3; + while (count-- > 0) { + int selected = sel.select(1000); + System.out.println("" + selected + " channel(s) selected"); + assertTrue(selected == 0, "Channel should not be selected"); + } + long dur = System.currentTimeMillis() - start; + assertTrue(dur > 1000, "select was too short"); + } + + public static void main(String[] args) throws IOException { + InetAddress lh = InetAddress.getLocalHost(); + + // create loopback connection + ServerSocketChannel ssc = + ServerSocketChannel.open().bind(new InetSocketAddress(0)); + + final SocketChannel sc = SocketChannel.open(); + sc.connect(new InetSocketAddress(lh, ssc.socket().getLocalPort())); + SocketChannel peer = ssc.accept(); + + sc.configureBlocking(false); + + // ensure that channel "sc" is readable + write1(peer); + + try (Selector sel = Selector.open()) { + SelectionKey key = sc.register(sel, 0); + sel.selectNow(); + + // test all transitions + for (int from: OPS) { + for (int to: OPS) { + + System.out.println(toOpsString(from) + " -> " + toOpsString(to)); + + testChange(key, from, to); + + // if the interst ops is now 0 then Selector should not spin + if (to == 0) + testForSpin(sel); + + // if interest ops is now OP_READ then make non-readable + // and test that Selector does not spin. + if (to == OP_READ) { + System.out.println("Drain channel..."); + drain(sc); + testForSpin(sel); + System.out.println("Make channel readable again"); + write1(peer); + } + + System.out.println(); + } + } + + } finally { + sc.close(); + peer.close(); + ssc.close(); + } + } + + static void assertTrue(boolean v, String msg) { + if (!v) throw new RuntimeException(msg); + } + +}
--- a/test/java/rmi/server/RMIClassLoader/loadProxyClasses/security.policy Mon Feb 11 18:36:31 2013 +0000 +++ b/test/java/rmi/server/RMIClassLoader/loadProxyClasses/security.policy Mon Feb 11 21:39:50 2013 +0000 @@ -13,6 +13,7 @@ permission java.io.FilePermission ".${/}-", "read,write,delete"; permission java.lang.RuntimePermission "createClassLoader"; + permission java.lang.RuntimePermission "getClassLoader"; permission java.lang.RuntimePermission "setContextClassLoader"; // used by TestLibrary to determine test environment
--- a/test/java/rmi/testlibrary/JavaVM.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/java/rmi/testlibrary/JavaVM.java Mon Feb 11 21:39:50 2013 +0000 @@ -109,6 +109,14 @@ return TestLibrary.getExtraProperty("jcov.options",""); } + public void start(Runnable runnable) throws IOException { + if (runnable == null) { + throw new NullPointerException("Runnable cannot be null."); + } + + start(); + new JavaVMCallbackHandler(runnable).start(); + } /** * Exec the VM as specified in this object's constructor. @@ -171,4 +179,35 @@ protected Process getVM() { return vm; } + + /** + * Handles calling the callback. + */ + private class JavaVMCallbackHandler extends Thread { + Runnable runnable; + + JavaVMCallbackHandler(Runnable runnable) { + this.runnable = runnable; + } + + + /** + * Wait for the Process to terminate and notify the callback. + */ + @Override + public void run() { + if (vm != null) { + try { + vm.waitFor(); + } catch(InterruptedException ie) { + // Restore the interrupted status + Thread.currentThread().interrupt(); + } + } + + if (runnable != null) { + runnable.run(); + } + } + } }
--- a/test/java/util/concurrent/Executors/AutoShutdown.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/java/util/concurrent/Executors/AutoShutdown.java Mon Feb 11 21:39:50 2013 +0000 @@ -67,6 +67,11 @@ e1 = e2 = null; for (int i = 0; i < 10 && Thread.activeCount() > count0; i++) tryWaitForFinalizersToRun(); + for (int i = 0; i < 10; ++i) { // give JVM a chance to settle. + if (Thread.activeCount() == count0) + return; + Thread.sleep(1000); + } equal(Thread.activeCount(), count0); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/CustomLogManager.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,177 @@ +/* + * 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.*; +import java.util.*; +import java.util.logging.*; + +/* + * Custom LogManager implementation to verify that the implementation delegates + * to the LogManager subclass to register both system logger and user logger. + * + * The LogManager implementation is the one configuring the logger's property + * such as level, handler, etc. + */ +public class CustomLogManager extends LogManager { + static LogManager INSTANCE; + Map<String,Logger> namedLoggers = new HashMap<>(); + Properties props = initConfig(); + public CustomLogManager() { + if (INSTANCE != null) { + throw new RuntimeException("CustomLogManager already created"); + } + INSTANCE = this; + } + + public synchronized boolean addLogger(Logger logger) { + String name = logger.getName(); + if (namedLoggers.containsKey(name)) { + return false; + } + namedLoggers.put(name, logger); + // set level + if (props.get(name + ".level") != null) { + logger.setLevel(Level.parse(props.getProperty(name + ".level"))); + } + // add handlers + if (props.get(name + ".handlers") != null && logger.getHandlers().length == 0) { + logger.addHandler(new CustomHandler()); + } + // add parent loggers + int ix = 1; + for (;;) { + int ix2 = name.indexOf(".", ix); + if (ix2 < 0) { + break; + } + String pname = name.substring(0, ix2); + if (props.get(pname + ".level") != null || + props.get(pname + ".handlers") != null) { + // This pname has a level/handlers definition. + // Make sure it exists. + // + // The test doesn't set the parent for simplicity. + if (!namedLoggers.containsKey(pname)) { + Logger.getLogger(pname); + } + } + ix = ix2 + 1; + } + return true; + } + + public synchronized Logger getLogger(String name) { + return namedLoggers.get(name); + } + + public synchronized Enumeration<String> getLoggerNames() { + return Collections.enumeration(namedLoggers.keySet()); + } + + public String getProperty(String name) { + return props.getProperty(name); + } + + public void readConfiguration() { + // do nothing + } + + public void readConfiguration(InputStream ins) { + // do nothing + } + + private Properties initConfig() { + Properties props = new Properties(); + props.put(".level", "CONFIG"); + props.put("CustomLogManagerTest.level", "WARNING"); + props.put("CustomLogManagerTest.handlers", "CustomLogManager$CustomHandler"); + props.put("SimpleLogManager.level", "INFO"); + props.put("SimpleLogManager.handlers", "CustomLogManager$CustomHandler"); + props.put("CustomLogManager$CustomHandler.level", "WARNING"); + props.put(".handlers", "CustomLogManager$CustomHandler"); + props.put("org.foo.bar.level", "SEVERE"); + props.put("org.foo.handlers", "CustomLogManager$CustomHandler"); + props.put("org.openjdk.level", "SEVERE"); + props.put("org.openjdk.handlers", "CustomLogManager$CustomHandler"); + props.put("org.openjdk.core.level", "INFO"); + + return props; + } + + public static void checkLogger(String name) { + checkLogger(name, null); + } + + public static void checkLogger(String name, String resourceBundleName) { + Logger logger = INSTANCE.getLogger(name); + if (logger == null) { + throw new RuntimeException("Logger \"" + name + "\" not exist"); + } + System.out.format("Logger \"%s\" level=%s handlers=%s resourcebundle=%s%n", + name, logger.getLevel(), + Arrays.toString(logger.getHandlers()), + logger.getResourceBundleName()); + String rb = logger.getResourceBundleName(); + if (rb != resourceBundleName && (rb == null || rb.equals(resourceBundleName))) { + throw new RuntimeException("Logger \"" + name + + "\" unexpected resource bundle: " + rb); + } + + String value = INSTANCE.getProperty(name + ".level"); + String level = logger.getLevel() != null ? logger.getLevel().getName() : null; + if (level != value && (level == null || level.equals(value))) { + throw new RuntimeException("Logger \"" + name + "\" unexpected level: " + level); + } + + Handler[] handlers = logger.getHandlers(); + String hdl = INSTANCE.getProperty(name + ".handlers"); + if ((hdl == null && handlers.length != 0) || + (hdl != null && handlers.length != 1)) { + throw new RuntimeException("Logger \"" + name + "\" unexpected handler: " + + Arrays.toString(handlers)); + } + checkParents(name); + } + + private static void checkParents(String name) { + int ix = 1; + for (;;) { + int ix2 = name.indexOf(".", ix); + if (ix2 < 0) { + break; + } + String pname = name.substring(0, ix2); + if (INSTANCE.getProperty(pname + ".level") != null || + INSTANCE.getProperty(pname + ".handlers") != null) { + // This pname has a level/handlers definition. + // Make sure it exists. + checkLogger(pname); + } + ix = ix2 + 1; + } + } + + // only CustomLogManager can create an instance of CustomHandler + private class CustomHandler extends StreamHandler { + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/CustomLogManagerTest.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,63 @@ +/* + * 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.*; +import java.util.*; + +import java.util.logging.*; +import sun.util.logging.PlatformLogger; + +/* + * @test + * @bug 8005615 + * @summary Add loggers to custom log manager + * + * @compile -XDignore.symbol.file CustomLogManagerTest.java CustomLogManager.java + * @run main/othervm -Djava.util.logging.manager=CustomLogManager CustomLogManagerTest + */ +public class CustomLogManagerTest { + private static final String RESOURCE_BUNDLE = "sun.util.logging.resources.logging"; + public static void main(String[] args) { + String mgr = System.getProperty("java.util.logging.manager"); + if (!mgr.equals("CustomLogManager")) { + throw new RuntimeException("java.util.logging.manager not set"); + } + + Logger.getLogger(CustomLogManagerTest.class.getName()); + Logger.getLogger("org.foo.Foo"); + Logger.getLogger("org.foo.bar.Foo", RESOURCE_BUNDLE); + // platform logger will be set with the default system resource bundle + PlatformLogger.getLogger("org.openjdk.core.logger"); + + if (LogManager.getLogManager() != CustomLogManager.INSTANCE) { + throw new RuntimeException(LogManager.getLogManager() + " not CustomLogManager"); + } + + CustomLogManager.checkLogger(CustomLogManagerTest.class.getName()); + CustomLogManager.checkLogger("org.foo.Foo"); + CustomLogManager.checkLogger("org.foo.bar.Foo", RESOURCE_BUNDLE); + CustomLogManager.checkLogger(Logger.GLOBAL_LOGGER_NAME); + CustomLogManager.checkLogger(""); + CustomLogManager.checkLogger("org.openjdk.core.logger", RESOURCE_BUNDLE); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/SimpleLogManager.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,113 @@ +/* + * 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.*; +import java.util.logging.*; +import sun.util.logging.PlatformLogger; + +/* + * @test + * @bug 8005615 + * @summary A LogManager subclass overrides its own implementation of named + * logger (see the subclassing information in the Logger class specification) + * + * @compile -XDignore.symbol.file CustomLogManager.java SimpleLogManager.java + * @run main/othervm -Djava.util.logging.manager=SimpleLogManager SimpleLogManager + */ +public class SimpleLogManager extends CustomLogManager { + public static void main(String[] args) { + String classname = System.getProperty("java.util.logging.manager"); + if (!classname.equals("SimpleLogManager")) { + throw new RuntimeException("java.util.logging.manager not set"); + } + + Logger logger = Logger.getLogger(SimpleLogManager.class.getName()); + Logger.getLogger("org.foo.bar.Foo"); + + // a platform logger used by the system code is just a Logger instance. + PlatformLogger.getLogger("org.openjdk.core.logger"); + + LogManager mgr = LogManager.getLogManager(); + if (mgr != CustomLogManager.INSTANCE || !(mgr instanceof SimpleLogManager)) { + throw new RuntimeException(LogManager.getLogManager() + " not SimpleLogManager"); + } + + checkCustomLogger(SimpleLogManager.class.getName(), null); + checkCustomLogger("org.foo.bar.Foo", null); + checkCustomLogger("org.openjdk.core.logger", "sun.util.logging.resources.logging"); + + // ## The LogManager.demandLogger method does not handle custom log manager + // ## that overrides the getLogger method to return a custom logger + // ## (see the test case in 8005640). Logger.getLogger may return + // ## a Logger instance but LogManager overrides it with a custom Logger + // ## instance like this case. + // + // However, the specification of LogManager and Logger subclassing is + // not clear whether this is supported or not. The following check + // just captures the current behavior. + if (logger instanceof CustomLogger) { + throw new RuntimeException(logger + " not CustomLogger"); + } + } + + private static void checkCustomLogger(String name, String resourceBundleName) { + CustomLogManager.checkLogger(name, resourceBundleName); + Logger logger1 = Logger.getLogger(name); + Logger logger2 = LogManager.getLogManager().getLogger(name); + if (logger1 != logger2) { + throw new RuntimeException(logger1 + " != " + logger2); + } + if (!(logger1 instanceof CustomLogger)) { + throw new RuntimeException(logger1 + " not CustomLogger"); + } + } + + /* + * This SimpleLogManager overrides the addLogger method to replace + * the given logger with a custom logger. + * + * It's unclear what the recommended way to use custom logger is. + * A LogManager subclass might override the getLogger method to return + * a custom Logger and create a new custom logger if not exist so that + * Logger.getLogger() can return a custom Logger instance but that violates + * the LogManager.getLogger() spec which should return null if not found. + */ + public synchronized boolean addLogger(Logger logger) { + String name = logger.getName(); + if (namedLoggers.containsKey(name)) { + return false; + } + CustomLogger newLogger = new CustomLogger(logger); + super.addLogger(newLogger); + return true; + } + + public class CustomLogger extends Logger { + CustomLogger(Logger logger) { + super(logger.getName(), logger.getResourceBundleName()); + } + CustomLogger(String name) { + super(name, null); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/crypto/sanity/CheckManifestForRelease.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,187 @@ +/* + * 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 7195931 7197071 7198146 + * @summary UnsatisfiedLinkError on PKCS11.C_GetOperationState while + * using NSS from jre7u6+ + */ +import java.net.*; +import java.io.*; +import java.security.*; +import java.lang.reflect.*; + +/** + * When the Java specification version is incremented, all of the providers + * must be recompiled with the proper implementation version to match. + */ +public class CheckManifestForRelease { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws Exception { + checkP11MessageDigestClone(); + checkFileManifests(); + } + + /* + * Iterate over the files of interest: JCE framework and providers + */ + static private void checkFileManifests() throws Exception { + System.out.println("============="); + String libDirName = System.getProperty("java.home", ".") + "/lib"; + String extDirName = libDirName + "/ext"; + + System.out.println("Checking Manifest in directory: \n " + + extDirName); + + /* + * Current list of JCE providers, all of which currently live in + * the extensions directory. Add if more are created. + */ + String[] providers = new String[]{ + "sunjce_provider.jar", + "sunec.jar", + "sunmscapi.jar", + "sunpkcs11.jar", + "ucrypto.jar" + }; + + checkManifest(libDirName, "jce.jar"); + for (String provider : providers) { + checkManifest(extDirName, provider); + } + System.out.println("Passed."); + } + + // Helper method to format the URL properly. + static private String formatURL(String dir, String file) { + return "jar:file:///" + dir + "/" + file + "!/"; + } + + static private String specVersion = + System.getProperty("java.specification.version"); + + /* + * Test the root cause, which is that there were no manifest values + * for many of the providers, and for those that had them, there was + * no test to make sure that the impl version was appropriate for + * the spec version. + */ + static private void checkManifest(String dir, String file) + throws Exception { + + System.out.println("Checking: " + file); + + String url = formatURL(dir, file); + JarURLConnection urlc = + (JarURLConnection) (new URL(url).openConnection()); + + String implVersion; + try { + implVersion = urlc.getManifest().getMainAttributes().getValue( + "Implementation-Version"); + } catch (FileNotFoundException e) { + /* + * If the file doesn't exist (e.g. mscapi on solaris), + * skip it. If there are other problems, fail out. + */ + System.out.println(" " + file + " not found, skipping..."); + return; + } + + if (implVersion == null) { + throw new Exception( + "Implementation-Version not found in Manifest"); + } + + if (!implVersion.startsWith(specVersion)) { + throw new Exception( + "Implementation-Version does not match " + + "Specification-Version"); + } + } + + /* + * Workaround for unfortunately generified forName() API + */ + @SuppressWarnings("unchecked") + static private Class<Provider> getProviderClass(String name) + throws Exception { + return (Class<Provider>)Class.forName(name); + } + + /* + * Check the symptom, an UnsatisfiedLinkError in MessageDigests. + */ + static private void checkP11MessageDigestClone() throws Exception { + + System.out.println("============="); + System.out.println("Checking for UnsatisfiedLinkError"); + String os = System.getProperty("os.name"); + // Only run on Solaris + if (!os.equals("SunOS")) { + return; + } + + /* + * We have to do some gyrations here, since the code to exercise + * this is in the P11 MessageDigests, and most of those mechanisms + * are disabled by default. + */ + String customP11File = + System.getProperty("TESTSRC", ".") + "/p11-solaris.txt"; + + /* + * In 7u, we don't have a 64 PKCS11 windows build yet, so we + * have to do some dynamic checking to determine if there is + * a PKCS11 library available to test against. Otherwise, the + * windows 64 bit will throw a compilation error before the + * test is even run. + */ + Constructor<Provider> cons; + Provider provider; + try { + Class<Provider> clazz = + getProviderClass("sun.security.pkcs11.SunPKCS11"); + cons = clazz.getConstructor(new Class[]{String.class}); + provider = cons.newInstance(new Object[]{customP11File}); + } catch (Exception ex) { + System.out.println("Skipping test - no PKCS11 provider available"); + return; + } + + try { + MessageDigest md = MessageDigest.getInstance("SHA1", provider); + md.update((byte) 0x01); + System.out.println(md.getProvider()); + md.clone(); + } catch (Exception e) { + // These kinds of failure are ok. We're testing the + // UnsatisfiedLinkError here. + } + System.out.println("Passed."); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/crypto/sanity/p11-solaris.txt Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,21 @@ +# +# Configuration file to allow the SunPKCS11 provider to utilize +# the Solaris Cryptographic Framework, if it is available +# +# This is a temporary file only for testing. It does not contain the +# normal disabled PKCS11 mechanisms that we will use for this test. +# + +name = MyProvider + +description = SunPKCS11 accessing Solaris Cryptographic Framework + +library = /usr/lib/$ISA/libpkcs11.so + +handleStartupErrors = ignoreAll + +attributes = compatibility + +disabledMechanisms = { + CKM_MD2 +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/AncestorNotifier/7193219/bug7193219.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,83 @@ +/* + * 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 7193219 + @summary JComboBox serialization fails in JDK 1.7 + @author Anton Litvinov +*/ + +import java.io.*; + +import javax.swing.*; + +public class bug7193219 { + private static byte[] serializeGUI() { + // Create and set up the window. + JFrame frame = new JFrame("Serialization"); + JPanel mainPanel = new JPanel(); + + /** + * If JComboBox is replaced with other component like JLabel + * The issue does not happen. + */ + JComboBox status = new JComboBox(); + status.addItem("123"); + mainPanel.add(status); + frame.getContentPane().add(mainPanel); + frame.pack(); + + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(mainPanel); + oos.flush(); + frame.dispose(); + return baos.toByteArray(); + } catch (IOException ioe) { + throw new RuntimeException(ioe); + } + } + + private static void deserializeGUI(byte[] serializedData) { + try { + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serializedData)); + JPanel mainPanel = (JPanel)ois.readObject(); + JFrame frame = new JFrame("Deserialization"); + frame.getContentPane().add(mainPanel); + frame.pack(); + frame.dispose(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + deserializeGUI(serializeGUI()); + } + }); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,83 @@ +/* + * 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 7160951 + * @summary [macosx] ActionListener called twice for JMenuItem using ScreenMenuBar + * @author vera.akulova@oracle.com + * @run main ActionListenerCalledTwiceTest + */ + +import sun.awt.*; +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class ActionListenerCalledTwiceTest { + static volatile int listenerCallCounter = 0; + public static void main(String[] args) throws Exception { + if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + System.out.println("This test is for MacOS only. Automatically passed on other platforms."); + return; + } + System.setProperty("apple.laf.useScreenMenuBar", "true"); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(100); + robot.keyPress(KeyEvent.VK_META); + robot.keyPress(KeyEvent.VK_E); + robot.keyRelease(KeyEvent.VK_E); + robot.keyRelease(KeyEvent.VK_META); + toolkit.realSync(); + if (listenerCallCounter != 1) { + throw new Exception("Test failed: ActionListener called " + listenerCallCounter + " times instead of 1!"); + } + } + + private static void createAndShowGUI() { + JMenuItem newItem = new JMenuItem("Exit"); + newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK)); + newItem.addActionListener( + new ActionListener(){ + public void actionPerformed(ActionEvent e) { + listenerCallCounter++; + } + } + ); + JMenu menu = new JMenu("Menu"); + menu.add(newItem); + JMenuBar bar = new JMenuBar(); + bar.add(menu); + JFrame frame = new JFrame("Test"); + frame.setJMenuBar(bar); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,105 @@ +/* + * 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 7186371 + * @summary [macosx] Main menu shortcuts not displayed + * @author vera.akulova@oracle.com + * @run main/manual ShortcutNotDisplayedTest + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class ShortcutNotDisplayedTest { + static volatile boolean done = false; + static volatile boolean pass = false; + static final String PASS_COMMAND = "pass"; + + public static void main(String[] args) throws Exception { + if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + System.out.println("This test is for MacOS only. Automatically passed on other platforms."); + return; + } + System.setProperty("apple.laf.useScreenMenuBar", "true"); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + do { try { Thread.sleep(300); } catch (Exception e) {} } while (!done) ; + if (!pass) { + throw new Exception("Shortcuts not displayed as expected in the screen menu bar."); + } + } + + private static void createAndShowGUI() { + JMenuItem newItem = new JMenuItem("Exit"); + newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, java.awt.event.InputEvent.META_MASK)); + + JMenu menu = new JMenu("Test Frame Window Menu"); + menu.setMnemonic(KeyEvent.VK_M); + menu.add(newItem); + + JMenuBar bar = new JMenuBar(); + bar.add(menu); + JTextArea text = new JTextArea( + " Please follow instructions:\n" + + " 1. You should see \"Test Frame Window Menu\" menu on the screen menu bar.\n" + + " 2. Open \"Test Frame Window Menu\" menu. \n" + + " Check that menu item \"Exit\" has a shortcut with image for Command Key and symbol \"E\". \n" + + " If you see the shortcut press \"Passed\". Otherwise press \"Failed\".\n" + ); + text.setEditable(false); + + JScrollPane sp = new JScrollPane(text); + sp.setSize(300,200); + + JButton passBtn = new JButton("Pass"); + passBtn.setActionCommand(PASS_COMMAND); + JButton failBtn = new JButton("Fail"); + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals(PASS_COMMAND)) { + pass = true; + } + done = true; + } + }; + + JFrame testFrame = new JFrame("Test Frame Window"); + testFrame.setLayout(new FlowLayout()); + testFrame.setBounds(100, 100, 600, 180); + testFrame.setJMenuBar(bar); + testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + passBtn.addActionListener(listener); + failBtn.addActionListener(listener); + testFrame.getContentPane().add(sp); + testFrame.getContentPane().add(passBtn); + testFrame.getContentPane().add(failBtn); + testFrame.setVisible(true); + } +}
--- a/test/lib/security/java.policy/Ext_AllPolicy.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/lib/security/java.policy/Ext_AllPolicy.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2004, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4215035 +# @bug 4215035 7083664 # @summary standard extensions path is hard-coded in default system policy file # # @build Ext_AllPolicy @@ -54,19 +54,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" - TMP=/tmp ;; Windows_95 | Windows_98 | Windows_NT ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/0 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,4 @@ +HTTP/1.1 200 Ok +Foo: bar +Bar: foo +WWW-Authenticate: NTLM sdsds
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/1 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,4 @@ +HTTP/1.1 200 Ok +Foo: bar +Bar: foo +WWW-Authenticate:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/2 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,5 @@ +HTTP/1.1 200 Ok +Foo: bar +Bar: foo +WWW-Authenticate: NTLM sdsds +WWW-Authenticate: Negotiate
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/3 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,6 @@ +HTTP/1.1 200 Ok +Foo: bar +Bar: foo +WWW-Authenticate: NTLM sdsds +WWW-Authenticate: Negotiate +WWW-Authenticate: Kerberos
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/4 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,7 @@ +HTTP/1.1 200 Ok +WWW-Authenticate: Negotiate +Foo: bar +Bar: foo +WWW-Authenticate: NTLM sdsds +Bar: foo +WWW-Authenticate: Kerberos
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/5 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,7 @@ +HTTP/1.1 200 Ok +WWW-Authenticate: Negotiate +Foo: bar +Bar: foo +WWW-Authenticate: NTLM +Bar: foo +WWW-Authenticate: Kerberos
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/6 Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,5 @@ +HTTP/1.1 200 Ok +Foo: foo +Bar: +WWW-Authenticate: NTLM blob +Bar: foo blob
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/messageheader/HTest.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,73 @@ +/* + * 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 8003948 + * @run main HTest + */ +import java.io.*; +import sun.net.www.MessageHeader; + +public class HTest { + public static void main (String[] args) throws Exception { + String prefix = System.getProperty("test.src"); + System.out.println ("TEST.SRC = " + prefix); + for (int i=0; i<7; i++) { + File f = new File(prefix, Integer.toString(i)); + FileInputStream fis = new FileInputStream(f); + MessageHeader h = new MessageHeader(fis); + String before = h.toString(); + before = before.substring(before.indexOf('{')); + System.out.println ("Before"); + System.out.println (before); + boolean result = h.filterNTLMResponses("WWW-Authenticate"); + String after = h.toString(); + after = after.substring(after.indexOf('{')); + System.out.println ("After"); + System.out.println (after); + System.out.println ("Expected"); + System.out.println (expected[i]); + if (!expected[i].equals(after)) { + throw new RuntimeException(Integer.toString(i) + " expected != after"); + } + if (result != expectedResult[i]) { + throw new RuntimeException(Integer.toString(i) + " result != expectedResult"); + } + } + } + + static String expected[] = { + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: }", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}{Bar: foo}", + "{null: HTTP/1.1 200 Ok}{WWW-Authenticate: Negotiate}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM}{Bar: foo}{WWW-Authenticate: Kerberos}", + "{null: HTTP/1.1 200 Ok}{Foo: foo}{Bar: }{WWW-Authenticate: NTLM blob}{Bar: foo blob}" + }; + + static boolean[] expectedResult = { + false, false, true, true, true, false, false + }; +}
--- a/test/sun/security/mscapi/ShortRSAKeyWithinTLS.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/mscapi/ShortRSAKeyWithinTLS.java Mon Feb 11 21:39:50 2013 +0000 @@ -29,7 +29,7 @@ import javax.net.ssl.*; import java.lang.reflect.*; -import sun.security.util.KeyLength; +import sun.security.util.KeyUtil; public class ShortRSAKeyWithinTLS { @@ -175,13 +175,13 @@ privateKey = (PrivateKey)ks.getKey(keyAlias, null); publicKey = (PublicKey)ks.getCertificate(keyAlias).getPublicKey(); - int privateKeySize = KeyLength.getKeySize(privateKey); + int privateKeySize = KeyUtil.getKeySize(privateKey); if (privateKeySize != keySize) { throw new Exception("Expected key size is " + keySize + ", but the private key size is " + privateKeySize); } - int publicKeySize = KeyLength.getKeySize(publicKey); + int publicKeySize = KeyUtil.getKeySize(publicKey); if (publicKeySize != keySize) { throw new Exception("Expected key size is " + keySize + ", but the public key size is " + publicKeySize);
--- a/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Mon Feb 11 21:39:50 2013 +0000 @@ -25,10 +25,10 @@ * @test * @bug 6313675 6323647 * @summary Verify that all ciphersuites work in FIPS mode + * @library .. * @ignore JSSE supported cipher suites are changed with CR 6916074, * need to update this test case in JDK 7 soon * @author Andreas Sterbenz - * @library .. */ import java.security.*;
--- a/test/sun/security/tools/jarsigner/AlgOptions.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/jarsigner/AlgOptions.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 5094028 6219522 +# @bug 5094028 6219522 7083664 # @summary test new jarsigner -sigalg and -digestalg options # @author Sean Mullan # @@ -51,21 +51,18 @@ PS=":" FS="/" CP="${FS}bin${FS}cp -f" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" CP="cp -f" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" CP="cp -f" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/jarsigner/PercentSign.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/jarsigner/PercentSign.sh Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -22,7 +22,7 @@ # # @test -# @bug 6522933 +# @bug 6522933 7083664 # @summary jarsigner fails in a directory with a path contianing a % sign # @author Wang Weijun # @@ -51,21 +51,18 @@ PS=":" FS="/" CP="${FS}bin${FS}cp -f" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" CP="cp -f" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" CP="cp -f" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/jarsigner/diffend.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/jarsigner/diffend.sh Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -22,7 +22,7 @@ # # @test -# @bug 6948909 +# @bug 6948909 7083664 # @summary Jarsigner removes MANIFEST.MF info for badly packages jar's # @@ -46,21 +46,18 @@ PS=":" FS="/" CP="${FS}bin${FS}cp -f" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" CP="cp -f" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" CP="cp -f" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/jarsigner/oldsig.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/jarsigner/oldsig.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2010, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 6543940 6868865 +# @bug 6543940 6868865 7083664 # @summary Exception thrown when signing a jarfile in java 1.5 # # @run shell oldsig.sh @@ -47,21 +47,18 @@ PS=":" FS="/" CP="${FS}bin${FS}cp -f" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" CP="cp -f" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" CP="cp -f" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/keytool/AltProviderPath.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/keytool/AltProviderPath.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2005, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4906940 +# @bug 4906940 7083664 # @summary Add -providerPath option for keytool allowing one to specify # an additional classpath to search for providers. # @author Andrew Fan @@ -50,19 +50,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/keytool/SecretKeyKS.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/keytool/SecretKeyKS.sh Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -22,7 +22,7 @@ # # @test -# @bug 4694076 +# @bug 4694076 7083664 # @summary KeyTool throws ArrayIndexOutOfBoundsException for listing # SecretKey entries in non-verbose mode. # @author Valerie Peng @@ -49,19 +49,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/keytool/StandardAlgName.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/keytool/StandardAlgName.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2005, 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 @@ -22,7 +22,7 @@ # # @test 1.1 04/11/12 -# @bug 4909889 +# @bug 4909889 7083664 # @summary KeyTool accepts any input that user make as long as we can make some # sense out of it, but when comes to present the info the user, it # promotes a standard look. @@ -50,19 +50,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" - TMP=/tmp ;; Windows_* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!"
--- a/test/sun/security/tools/keytool/i18n.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/keytool/i18n.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2003, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4348369 +# @bug 4348369 7083664 # @summary keytool not i18n compliant # @author charlie lai # @@ -50,19 +50,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null PS=";" FS="/" - TMP=/tmp ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/keytool/resource.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/keytool/resource.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 6239297 +# @bug 6239297 7083664 # @summary keytool usage is broken after changing Resources.java # @author Max Wang # @@ -46,17 +46,14 @@ SunOS | Linux | Darwin ) NULL=/dev/null FS="/" - TMP=/tmp ;; CYGWIN* ) NULL=/dev/null FS="/" - TMP=/tmp ;; Windows_* ) NULL=NUL FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized operating system!" @@ -65,13 +62,11 @@ esac # the test code -${TESTJAVA}${FS}bin${FS}keytool > ${TMP}${FS}temp_file_40875602475 2> ${NULL} -grep MissingResourceException ${TMP}${FS}temp_file_40875602475 +${TESTJAVA}${FS}bin${FS}keytool > temp_file_40875602475 2> ${NULL} +grep MissingResourceException temp_file_40875602475 if [ $? -eq 0 ]; then - rm ${TMP}${FS}temp_file_40875602475 exit 1 fi -rm ${TMP}${FS}temp_file_40875602475 exit 0
--- a/test/sun/security/tools/policytool/Alias.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/Alias.sh Mon Feb 11 21:39:50 2013 +0000 @@ -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 @@ -22,7 +22,7 @@ # # @test -# @bug 4449491 +# @bug 4449491 7083664 # @summary policytool should allow principal type to be empty # (keystore alias substitution) # @@ -51,13 +51,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/policytool/ChangeUI.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/ChangeUI.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 6296772 6293981 6290216 +# @bug 6296772 6293981 6290216 7083664 # @summary FilePermission and DelegationPermission, and cancel button # # @run applet/manual=done ChangeUI.html @@ -50,13 +50,16 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp + ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/policytool/OpenPolicy.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/OpenPolicy.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2002, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4224186 +# @bug 4224186 7083664 # @summary missing File.separatorChar when initially opening policy file # # @run applet/manual=done OpenPolicy.html @@ -50,13 +50,17 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp + ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/policytool/SaveAs.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/SaveAs.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2002, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4252583 +# @bug 4252583 7083664 # @summary policytool throws FileNotFoundException when user tries to # save new policy file # @@ -51,13 +51,17 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp + ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/policytool/UpdatePermissions.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/UpdatePermissions.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2002, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4218206 +# @bug 4218206 7083664 # @summary missing or invalid permission target names in policy tool # # @run applet/manual=done UpdatePermissions.html @@ -50,13 +50,17 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp + ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/policytool/UsePolicy.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/UsePolicy.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2002, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4273771 +# @bug 4273771 7083664 # @summary Need to add "usePolicy" RuntimePermission to policytool # # @run applet/manual=done UsePolicy.html @@ -50,13 +50,17 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp + ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/sun/security/tools/policytool/i18n.sh Mon Feb 11 18:36:31 2013 +0000 +++ b/test/sun/security/tools/policytool/i18n.sh Mon Feb 11 21:39:50 2013 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2002, 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 @@ -22,7 +22,7 @@ # # @test -# @bug 4348370 +# @bug 4348370 7083664 # @summary policytool not i18n compliant # # @run applet/manual=done i18n.html @@ -50,13 +50,17 @@ NULL=/dev/null PS=":" FS="/" - TMP=/tmp + ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + CP="cp -f" ;; Windows* ) NULL=NUL PS=";" FS="\\" - TMP="c:/temp" ;; * ) echo "Unrecognized system!"
--- a/test/tools/launcher/Arrrghs.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/tools/launcher/Arrrghs.java Mon Feb 11 21:39:50 2013 +0000 @@ -36,7 +36,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class Arrrghs extends TestHelper { private Arrrghs(){} @@ -75,7 +81,7 @@ /* * This method detects the cookie in the output stream of the process. */ - private static boolean detectCookie(InputStream istream, + private boolean detectCookie(InputStream istream, String expectedArguments) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(istream)); boolean retval = false; @@ -105,7 +111,7 @@ return retval; } - private static boolean doTest0(ProcessBuilder pb, String expectedArguments) { + private boolean doReExecTest0(ProcessBuilder pb, String expectedArguments) { boolean retval = false; try { pb.redirectErrorStream(true); @@ -121,26 +127,27 @@ } /** - * This method return true if the expected and detected arguments are the same. + * This method returns true if the expected and detected arguments are the same. * Quoting could cause dissimilar testArguments and expected arguments. */ - static int doTest(String testArguments, String expectedPattern) { + int doReExecTest(String testArguments, String expectedPattern) { ProcessBuilder pb = new ProcessBuilder(javaCmd, VersionStr, testArguments); Map<String, String> env = pb.environment(); - env.put("_JAVA_LAUNCHER_DEBUG", "true"); - return doTest0(pb, testArguments) ? 0 : 1; + env.put(JLDEBUG_KEY, "true"); + return doReExecTest0(pb, testArguments) ? 0 : 1; } /** * A convenience method for identical test pattern and expected arguments */ - static int doTest(String testPattern) { - return doTest(testPattern, testPattern); + int doReExecTest(String testPattern) { + return doReExecTest(testPattern, testPattern); } - static void quoteParsingTests() { + @Test + void testQuoteParsingThroughReExec() { /* * Tests for 6214916 * These tests require that a JVM (any JVM) be installed in the system registry. @@ -155,96 +162,425 @@ // Basic test - testExitValue += doTest("-a -b -c -d"); + testExitValue += doReExecTest("-a -b -c -d"); // Basic test with many spaces - testExitValue += doTest("-a -b -c -d"); + testExitValue += doReExecTest("-a -b -c -d"); // Quoted whitespace does matter ? - testExitValue += doTest("-a \"\"-b -c\"\" -d"); + testExitValue += doReExecTest("-a \"\"-b -c\"\" -d"); // Escaped quotes outside of quotes as literals - testExitValue += doTest("-a \\\"-b -c\\\" -d"); + testExitValue += doReExecTest("-a \\\"-b -c\\\" -d"); // Check for escaped quotes inside of quotes as literal - testExitValue += doTest("-a \"-b \\\"stuff\\\"\" -c -d"); + testExitValue += doReExecTest("-a \"-b \\\"stuff\\\"\" -c -d"); // A quote preceeded by an odd number of slashes is a literal quote - testExitValue += doTest("-a -b\\\\\\\" -c -d"); + testExitValue += doReExecTest("-a -b\\\\\\\" -c -d"); // A quote preceeded by an even number of slashes is a literal quote // see 6214916. - testExitValue += doTest("-a -b\\\\\\\\\" -c -d"); + testExitValue += doReExecTest("-a -b\\\\\\\\\" -c -d"); // Make sure that whitespace doesn't interfere with the removal of the // appropriate tokens. (space-tab-space preceeds -jre-restict-search). - testExitValue += doTest("-a -b \t -jre-restrict-search -c -d","-a -b -c -d"); + testExitValue += doReExecTest("-a -b \t -jre-restrict-search -c -d", "-a -b -c -d"); // Make sure that the mJRE tokens being stripped, aren't stripped if // they happen to appear as arguments to the main class. - testExitValue += doTest("foo -version:1.1+"); + testExitValue += doReExecTest("foo -version:1.1+"); + + System.out.println("Completed arguments quoting tests with " + + testExitValue + " errors"); + } + // the pattern we hope to see in the output + static final Pattern ArgPattern = Pattern.compile("\\s*argv\\[[0-9]*\\].*=.*"); + + void checkArgumentParsing(String inArgs, String... expArgs) throws IOException { + List<String> scratchpad = new ArrayList<>(); + scratchpad.add("set " + JLDEBUG_KEY + "=true"); + // GAK, -version needs to be added so that windows can flush its stderr + // exiting the process prematurely can terminate the stderr. + scratchpad.add(javaCmd + " -version " + inArgs); + File batFile = new File("atest.bat"); + java.nio.file.Files.deleteIfExists(batFile.toPath()); + createFile(batFile, scratchpad); + + TestResult tr = doExec(batFile.getName()); + + ArrayList<String> expList = new ArrayList<>(); + expList.add(javaCmd); + expList.add("-version"); + expList.addAll(Arrays.asList(expArgs)); + + List<String> gotList = new ArrayList<>(); + for (String x : tr.testOutput) { + Matcher m = ArgPattern.matcher(x); + if (m.matches()) { + String a[] = x.split("="); + gotList.add(a[a.length - 1].trim()); + } + } + if (!gotList.equals(expList)) { + System.out.println(tr); + System.out.println("Expected args:"); + System.out.println(expList); + System.out.println("Obtained args:"); + System.out.println(gotList); + throw new RuntimeException("Error: args do not match"); + } + System.out.println("\'" + inArgs + "\'" + " - Test passed"); + } + + /* + * This tests general quoting and are specific to Windows, *nixes + * need not worry about this, these have been tested with Windows + * implementation and those that are known to work are used against + * the java implementation. Note that the ProcessBuilder gets in the + * way when testing some of these arguments, therefore we need to + * create and execute a .bat file containing the arguments. + */ + @Test + void testArgumentParsing() throws IOException { + if (!isWindows) + return; + // no quotes + checkArgumentParsing("a b c d", "a", "b", "c", "d"); + + // single quotes + checkArgumentParsing("\"a b c d\"", "a b c d"); + + //double quotes + checkArgumentParsing("\"\"a b c d\"\"", "a", "b", "c", "d"); + + // triple quotes + checkArgumentParsing("\"\"\"a b c d\"\"\"", "\"a b c d\""); + + // a literal within single quotes + checkArgumentParsing("\"a\"b c d\"e\"", "ab", "c", "de"); + + // a literal within double quotes + checkArgumentParsing("\"\"a\"b c d\"e\"\"", "ab c de"); + + // a literal quote + checkArgumentParsing("a\\\"b", "a\"b"); + + // double back-slash + checkArgumentParsing("\"a b c d\\\\\"", "a b c d\\"); + + // triple back-slash + checkArgumentParsing("a\\\\\\\"b", "a\\\"b"); + + // dangling quote + checkArgumentParsing("\"a b c\"\"", "a b c\""); + + // expansions of white space separators + checkArgumentParsing("a b", "a", "b"); + checkArgumentParsing("a\tb", "a", "b"); + checkArgumentParsing("a \t b", "a", "b"); + + checkArgumentParsing("\"C:\\TEST A\\\\\"", "C:\\TEST A\\"); + checkArgumentParsing("\"\"C:\\TEST A\\\\\"\"", "C:\\TEST", "A\\"); + + // MS Windows tests + // triple back-slash + checkArgumentParsing("a\\\\\\d", "a\\\\\\d"); + + // triple back-slash in quotes + checkArgumentParsing("\"a\\\\\\d\"", "a\\\\\\d"); + + // slashes separating characters + checkArgumentParsing("X\\Y\\Z", "X\\Y\\Z"); + checkArgumentParsing("\\X\\Y\\Z", "\\X\\Y\\Z"); + + // literals within dangling quotes, etc. + checkArgumentParsing("\"a b c\" d e", "a b c", "d", "e"); + checkArgumentParsing("\"ab\\\"c\" \"\\\\\" d", "ab\"c", "\\", "d"); + checkArgumentParsing("a\\\\\\c d\"e f\"g h", "a\\\\\\c", "de fg", "h"); + checkArgumentParsing("a\\\\\\\"b c d", "a\\\"b", "c", "d"); + checkArgumentParsing("a\\\\\\\\\"g c\" d e", "a\\\\g c", "d", "e"); + + // treatment of back-slashes + checkArgumentParsing("*\\", "*\\"); + checkArgumentParsing("*/", "*/"); + checkArgumentParsing(".\\*", ".\\*"); + checkArgumentParsing("./*", "./*"); + checkArgumentParsing("..\\..\\*", "..\\..\\*"); + checkArgumentParsing("../../*", "../../*"); + checkArgumentParsing("..\\..\\", "..\\..\\"); + checkArgumentParsing("../../", "../../"); + } + + private void initEmptyDir(File emptyDir) throws IOException { + if (emptyDir.exists()) { + recursiveDelete(emptyDir); + } + emptyDir.mkdir(); + } + + private void initDirWithJavaFiles(File libDir) throws IOException { + + if (libDir.exists()) { + recursiveDelete(libDir); + } + libDir.mkdirs(); + ArrayList<String> scratchpad = new ArrayList<>(); + scratchpad.add("package lib;"); + scratchpad.add("public class Fbo {"); + scratchpad.add("public static void main(String... args){Foo.f();}"); + scratchpad.add("public static void f(){}"); + scratchpad.add("}"); + createFile(new File(libDir, "Fbo.java"), scratchpad); + + scratchpad.clear(); + scratchpad.add("package lib;"); + scratchpad.add("public class Foo {"); + scratchpad.add("public static void main(String... args){"); + scratchpad.add("for (String x : args) {"); + scratchpad.add("System.out.println(x);"); + scratchpad.add("}"); + scratchpad.add("Fbo.f();"); + scratchpad.add("}"); + scratchpad.add("public static void f(){}"); + scratchpad.add("}"); + createFile(new File(libDir, "Foo.java"), scratchpad); + } + + void checkArgumentWildcard(String inArgs, String... expArgs) throws IOException { + String[] in = {inArgs}; + checkArgumentWildcard(in, expArgs); - System.out.println("Completed arguments quoting tests with " + - testExitValue + " errors"); + // now add arbitrary arguments before and after + String[] outInArgs = { "-Q", inArgs, "-R"}; + + String[] outExpArgs = new String[expArgs.length + 2]; + outExpArgs[0] = "-Q"; + System.arraycopy(expArgs, 0, outExpArgs, 1, expArgs.length); + outExpArgs[expArgs.length + 1] = "-R"; + checkArgumentWildcard(outInArgs, outExpArgs); + } + + void checkArgumentWildcard(String[] inArgs, String[] expArgs) throws IOException { + ArrayList<String> argList = new ArrayList<>(); + argList.add(javaCmd); + argList.add("-cp"); + argList.add("lib" + File.separator + "*"); + argList.add("lib.Foo"); + argList.addAll(Arrays.asList(inArgs)); + String[] cmds = new String[argList.size()]; + argList.toArray(cmds); + TestResult tr = doExec(cmds); + if (!tr.isOK()) { + System.out.println(tr); + throw new RuntimeException("Error: classpath single entry wildcard entry"); + } + + ArrayList<String> expList = new ArrayList<>(); + expList.addAll(Arrays.asList(expArgs)); + + List<String> gotList = new ArrayList<>(); + for (String x : tr.testOutput) { + gotList.add(x.trim()); + } + if (!gotList.equals(expList)) { + System.out.println(tr); + System.out.println("Expected args:"); + System.out.println(expList); + System.out.println("Obtained args:"); + System.out.println(gotList); + throw new RuntimeException("Error: args do not match"); + } + System.out.print("\'"); + for (String x : inArgs) { + System.out.print(x + " "); + } + System.out.println("\'" + " - Test passed"); } /* + * These tests are not expected to work on *nixes, and are ignored. + */ + @Test + void testWildCardArgumentProcessing() throws IOException { + if (!isWindows) + return; + File cwd = new File("."); + File libDir = new File(cwd, "lib"); + initDirWithJavaFiles(libDir); + initEmptyDir(new File(cwd, "empty")); + + // test if javac (the command) can compile *.java + TestResult tr = doExec(javacCmd, libDir.getName() + File.separator + "*.java"); + if (!tr.isOK()) { + System.out.println(tr); + throw new RuntimeException("Error: compiling java wildcards"); + } + + // use the jar cmd to create jars using the ? wildcard + File jarFoo = new File(libDir, "Foo.jar"); + tr = doExec(jarCmd, "cvf", jarFoo.getAbsolutePath(), "lib" + File.separator + "F?o.class"); + if (!tr.isOK()) { + System.out.println(tr); + throw new RuntimeException("Error: creating jar with wildcards"); + } + + // now the litmus test!, this should work + checkArgumentWildcard("a", "a"); + + // test for basic expansion + checkArgumentWildcard("lib\\F*java", "lib\\Fbo.java", "lib\\Foo.java"); + + // basic expansion in quotes + checkArgumentWildcard("\"lib\\F*java\"", "lib\\F*java"); + + checkArgumentWildcard("lib\\**", "lib\\Fbo.class", "lib\\Fbo.java", + "lib\\Foo.class", "lib\\Foo.jar", "lib\\Foo.java"); + + checkArgumentWildcard("lib\\*?", "lib\\Fbo.class", "lib\\Fbo.java", + "lib\\Foo.class", "lib\\Foo.jar", "lib\\Foo.java"); + + checkArgumentWildcard("lib\\?*", "lib\\Fbo.class", "lib\\Fbo.java", + "lib\\Foo.class", "lib\\Foo.jar", "lib\\Foo.java"); + + checkArgumentWildcard("lib\\?", "lib\\?"); + + // test for basic expansion + checkArgumentWildcard("lib\\*java", "lib\\Fbo.java", "lib\\Foo.java"); + + // basic expansion in quotes + checkArgumentWildcard("\"lib\\*.java\"", "lib\\*.java"); + + // suffix expansion + checkArgumentWildcard("lib\\*.class", "lib\\Fbo.class", "lib\\Foo.class"); + + // suffix expansion in quotes + checkArgumentWildcard("\"lib\\*.class\"", "lib\\*.class"); + + // check for ? expansion now + checkArgumentWildcard("lib\\F?o.java", "lib\\Fbo.java", "lib\\Foo.java"); + + // check ? in quotes + checkArgumentWildcard("\"lib\\F?o.java\"", "lib\\F?o.java"); + + // check ? as suffixes + checkArgumentWildcard("lib\\F?o.????", "lib\\Fbo.java", "lib\\Foo.java"); + + // check ? in a leading role + checkArgumentWildcard("lib\\???.java", "lib\\Fbo.java", "lib\\Foo.java"); + checkArgumentWildcard("\"lib\\???.java\"", "lib\\???.java"); + + // check ? prefixed with - + checkArgumentWildcard("-?", "-?"); + + // check * prefixed with - + checkArgumentWildcard("-*", "-*"); + + // check on empty directory + checkArgumentWildcard("empty\\*", "empty\\*"); + checkArgumentWildcard("empty\\**", "empty\\**"); + checkArgumentWildcard("empty\\?", "empty\\?"); + checkArgumentWildcard("empty\\??", "empty\\??"); + checkArgumentWildcard("empty\\*?", "empty\\*?"); + checkArgumentWildcard("empty\\?*", "empty\\?*"); + + } + + void doArgumentCheck(String inArgs, String... expArgs) { + Map<String, String> env = new HashMap<>(); + env.put(JLDEBUG_KEY, "true"); + TestResult tr = doExec(env, javaCmd, inArgs); + System.out.println(tr); + int sindex = tr.testOutput.indexOf("Command line args:"); + if (sindex < 0) { + System.out.println(tr); + throw new RuntimeException("Error: no output"); + } + sindex++; // skip over the tag + List<String> gotList = new ArrayList<>(); + for (String x : tr.testOutput.subList(sindex, sindex + expArgs.length)) { + String a[] = x.split("="); + gotList.add(a[a.length - 1].trim()); + } + List<String> expList = Arrays.asList(expArgs); + if (!gotList.equals(expList)) { + System.out.println(tr); + System.out.println("Expected args:"); + System.out.println(expList); + System.out.println("Obtained args:"); + System.out.println(gotList); + throw new RuntimeException("Error: args do not match"); + } + } + + + /* * These tests are usually run on non-existent targets to check error results */ - static void runBasicErrorMessageTests() { + @Test + void testBasicErrorMessages() { // Tests for 5030233 TestResult tr = doExec(javaCmd, "-cp"); tr.checkNegative(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); tr = doExec(javaCmd, "-classpath"); tr.checkNegative(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); tr = doExec(javaCmd, "-jar"); tr.checkNegative(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); tr = doExec(javacCmd, "-cp"); tr.checkNegative(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // Test for 6356475 "REGRESSION:"java -X" from cmdline fails" tr = doExec(javaCmd, "-X"); tr.checkPositive(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); tr = doExec(javaCmd, "-help"); tr.checkPositive(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // 6753938, test for non-negative exit value for an incorrectly formed // command line, '% java' tr = doExec(javaCmd); tr.checkNegative(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // 6753938, test for non-negative exit value for an incorrectly formed // command line, '% java -Xcomp' tr = doExec(javaCmd, "-Xcomp"); tr.checkNegative(); tr.isNotZeroOutput(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); } /* * Tests various dispositions of the main method, these tests are limited * to English locales as they check for error messages that are localized. */ - static void runMainMethodTests() throws FileNotFoundException { + @Test + void testMainMethod() throws FileNotFoundException { if (!isEnglishLocale()) { return; } @@ -256,55 +592,65 @@ (String[])null); tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Could not find or load main class MIA"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-cp", "some.jar", "MIA"); tr.contains("Error: Could not find or load main class MIA"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // incorrect method access createJar(new File("some.jar"), new File("Foo"), "private static void main(String[] args){}"); tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method not found in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method not found in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // incorrect return type createJar(new File("some.jar"), new File("Foo"), "public static int main(String[] args){return 1;}"); tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method must return a value of type void in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method must return a value of type void in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // incorrect parameter type createJar(new File("some.jar"), new File("Foo"), "public static void main(Object[] args){}"); tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method not found in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method not found in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // incorrect method type - non-static createJar(new File("some.jar"), new File("Foo"), "public void main(String[] args){}"); tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method is not static in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method is not static in class Foo"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // amongst a potpourri of kindred main methods, is the right one chosen ? createJar(new File("some.jar"), new File("Foo"), @@ -316,25 +662,29 @@ "public static void main(String[] args) {System.out.println(\"THE_CHOSEN_ONE\");}"); tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("THE_CHOSEN_ONE"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("THE_CHOSEN_ONE"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // test for extraneous whitespace in the Main-Class attribute createJar(" Foo ", new File("some.jar"), new File("Foo"), "public static void main(String... args){}"); tr = doExec(javaCmd, "-jar", "some.jar"); tr.checkPositive(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); } /* * tests 6968053, ie. we turn on the -Xdiag (for now) flag and check if * the suppressed stack traces are exposed, ignore these tests for localized * locales, limiting to English only. */ - static void runDiagOptionTests() throws FileNotFoundException { + @Test + void testDiagOptions() throws FileNotFoundException { if (!isEnglishLocale()) { // only english version return; } @@ -345,48 +695,51 @@ tr = doExec(javaCmd, "-Xdiag", "-jar", "some.jar"); tr.contains("Error: Could not find or load main class MIA"); tr.contains("java.lang.ClassNotFoundException: MIA"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // use classpath to check tr = doExec(javaCmd, "-Xdiag", "-cp", "some.jar", "MIA"); tr.contains("Error: Could not find or load main class MIA"); tr.contains("java.lang.ClassNotFoundException: MIA"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); // a missing class on the classpath tr = doExec(javaCmd, "-Xdiag", "NonExistentClass"); tr.contains("Error: Could not find or load main class NonExistentClass"); tr.contains("java.lang.ClassNotFoundException: NonExistentClass"); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); } - static void test6894719() { + @Test + static void testJreRestrictSearchFlag() { // test both arguments to ensure they exist TestResult tr = null; tr = doExec(javaCmd, "-no-jre-restrict-search", "-version"); tr.checkPositive(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); tr = doExec(javaCmd, "-jre-restrict-search", "-version"); tr.checkPositive(); - System.out.println(tr); + if (!tr.testStatus) + System.out.println(tr); } /** * @param args the command line arguments * @throws java.io.FileNotFoundException */ - public static void main(String[] args) throws FileNotFoundException { + public static void main(String[] args) throws Exception { if (debug) { System.out.println("Starting Arrrghs tests"); } - quoteParsingTests(); - runBasicErrorMessageTests(); - runMainMethodTests(); - test6894719(); - runDiagOptionTests(); + Arrrghs a = new Arrrghs(); + a.run(args); if (testExitValue > 0) { System.out.println("Total of " + testExitValue + " failed"); System.exit(1);
--- a/test/tools/launcher/TestHelper.java Mon Feb 11 18:36:31 2013 +0000 +++ b/test/tools/launcher/TestHelper.java Mon Feb 11 21:39:50 2013 +0000 @@ -21,6 +21,14 @@ * questions. */ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.Method; +import java.util.regex.Pattern; +import java.io.StringWriter; +import java.io.PrintWriter; import java.util.Set; import java.io.BufferedReader; import java.io.File; @@ -55,11 +63,14 @@ static final File TEST_SOURCES_DIR; static final String JAVAHOME = System.getProperty("java.home"); + static final String JAVA_BIN; static final boolean isSDK = JAVAHOME.endsWith("jre"); static final String javaCmd; static final String javawCmd; static final String java64Cmd; static final String javacCmd; + static final String jarCmd; + static final JavaCompiler compiler; static final boolean debug = Boolean.getBoolean("TestHelper.Debug"); @@ -84,8 +95,10 @@ static final String JAVA_FILE_EXT = ".java"; static final String CLASS_FILE_EXT = ".class"; static final String JAR_FILE_EXT = ".jar"; + static final String EXE_FILE_EXT = ".exe"; static final String JLDEBUG_KEY = "_JAVA_LAUNCHER_DEBUG"; static final String EXPECTED_MARKER = "TRACER_MARKER:About to EXEC"; + static final String TEST_PREFIX = "###TestError###: "; static int testExitValue = 0; @@ -111,6 +124,7 @@ compiler = ToolProvider.getSystemJavaCompiler(); File binDir = (isSDK) ? new File((new File(JAVAHOME)).getParentFile(), "bin") : new File(JAVAHOME, "bin"); + JAVA_BIN = binDir.getAbsolutePath(); File javaCmdFile = (isWindows) ? new File(binDir, "java.exe") : new File(binDir, "java"); @@ -125,6 +139,15 @@ : new File(binDir, "javac"); javacCmd = javacCmdFile.getAbsolutePath(); + File jarCmdFile = (isWindows) + ? new File(binDir, "jar.exe") + : new File(binDir, "jar"); + jarCmd = jarCmdFile.getAbsolutePath(); + if (!jarCmdFile.canExecute()) { + throw new RuntimeException("java <" + TestHelper.jarCmd + + "> must exist and should be executable"); + } + if (isWindows) { File javawCmdFile = new File(binDir, "javaw.exe"); javawCmd = javawCmdFile.getAbsolutePath(); @@ -152,6 +175,35 @@ java64Cmd = null; } } + void run(String[] args) throws Exception { + int passed = 0, failed = 0; + final Pattern p = (args != null && args.length > 0) + ? Pattern.compile(args[0]) + : null; + for (Method m : this.getClass().getDeclaredMethods()) { + boolean selected = (p == null) + ? m.isAnnotationPresent(Test.class) + : p.matcher(m.getName()).matches(); + if (selected) { + try { + m.invoke(this, (Object[]) null); + System.out.println(m.getName() + ": OK"); + passed++; + } catch (Throwable ex) { + System.out.printf("Test %s failed: %s %n", m, ex.getCause()); + failed++; + } + } + } + System.out.printf("Passed: %d, Failed %d%n", passed, failed); + if (failed > 0) { + throw new RuntimeException("Tests failed: " + failed); + } + if (passed == 0 && failed == 0) { + throw new AssertionError("No test(s) selected: passed = " + + passed + ", failed = " + failed + " ??????????"); + } + } /* * is a dual mode available in the test jdk @@ -383,35 +435,46 @@ * of use methods to check the test results. */ static class TestResult { - StringBuilder status; + PrintWriter status; + StringWriter sw; int exitValue; List<String> testOutput; Map<String, String> env; Throwable t; + boolean testStatus; public TestResult(String str, int rv, List<String> oList, Map<String, String> env, Throwable t) { - status = new StringBuilder("Executed command: " + str + "\n"); + sw = new StringWriter(); + status = new PrintWriter(sw); + status.println("Executed command: " + str + "\n"); exitValue = rv; testOutput = oList; this.env = env; this.t = t; + testStatus = true; } - void appendStatus(String x) { - status = status.append(" " + x + "\n"); + void appendError(String x) { + status.println(TEST_PREFIX + x); + } + + void indentStatus(String x) { + status.println(" " + x); } void checkNegative() { if (exitValue == 0) { - appendStatus("Error: test must not return 0 exit value"); + appendError("test must not return 0 exit value"); + testStatus = false; testExitValue++; } } void checkPositive() { if (exitValue != 0) { - appendStatus("Error: test did not return 0 exit value"); + testStatus = false; + appendError("test did not return 0 exit value"); testExitValue++; } } @@ -422,7 +485,8 @@ boolean isZeroOutput() { if (!testOutput.isEmpty()) { - appendStatus("Error: No message from cmd please"); + testStatus = false; + appendError("No message from cmd please"); testExitValue++; return false; } @@ -431,7 +495,8 @@ boolean isNotZeroOutput() { if (testOutput.isEmpty()) { - appendStatus("Error: Missing message"); + testStatus = false; + appendError("Missing message"); testExitValue++; return false; } @@ -440,22 +505,26 @@ @Override public String toString() { - status.append("++++Begin Test Info++++\n"); - status.append("++++Test Environment++++\n"); + status.println("++++Begin Test Info++++"); + status.println("Test Status: " + (testStatus ? "PASS" : "FAIL")); + status.println("++++Test Environment++++"); for (String x : env.keySet()) { - status.append(x).append("=").append(env.get(x)).append("\n"); + indentStatus(x + "=" + env.get(x)); } - status.append("++++Test Output++++\n"); + status.println("++++Test Output++++"); for (String x : testOutput) { - appendStatus(x); + indentStatus(x); } - status.append("++++Test Stack Trace++++\n"); - status.append(t.toString()); + status.println("++++Test Stack Trace++++"); + status.println(t.toString()); for (StackTraceElement e : t.getStackTrace()) { - status.append(e.toString()); + indentStatus(e.toString()); } - status.append("++++End of Test Info++++\n"); - return status.toString(); + status.println("++++End of Test Info++++"); + status.flush(); + String out = sw.toString(); + status.close(); + return out; } boolean contains(String str) { @@ -464,7 +533,7 @@ return true; } } - appendStatus("Error: string <" + str + "> not found"); + appendError("string <" + str + "> not found"); testExitValue++; return false; } @@ -475,9 +544,15 @@ return true; } } - appendStatus("Error: string <" + stringToMatch + "> not found"); + appendError("string <" + stringToMatch + "> not found"); testExitValue++; return false; } } + /** + * Indicates that the annotated method is a test method. + */ + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + public @interface Test {} }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/launcher/ToolsOpts.java Mon Feb 11 21:39:50 2013 +0000 @@ -0,0 +1,218 @@ +/* + * 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 8002091 + * @summary Test options patterns for javac,javah,javap and javadoc using + * javac as a test launcher. Create a dummy javac and intercept options to check + * reception of options as passed through the launcher without having to launch + * javac. Only -J and -cp ./* options should be consumed by the launcher. + * @run main ToolsOpts + * @author ssides + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class ToolsOpts extends TestHelper { + static final String JBCP_PREPEND = "-J-Xbootclasspath/p:"; + private static File testJar = null; + static String[][] optionPatterns = { + {"-J-Xmx128m"}, + {"-J-version"}, + {"-J-XshowSettings:vm"}, + {"-J-Xdiag"}, + {"-J-showversion"}, + {"-J-version", "-option"}, + {"-option"}, + {"-option:sub"}, + {"-option:sub-"}, + {"-option:sub1,sub2"}, // -option:list + {"-option:{sub1,sub2,sub3}"}, // -option:{list} + {"-option:{{sub1,sub2,sub3}}"},// -option:{{list}} + {"-option/c:/export/date/tmp"}, + {"-option=value"}, + {"-Dpk1.pk2.pk3"}, // dot in option + {"-Dpk1.pk2=value"}, // dot in option followed by =value + {"@<filename>"}, + {"-option", "http://site.com", "http://site.org"}, + {"-option", "name", "p1:p2.."}, + {"-All these non-options show launchers pass options as is to tool."}, + {"-option"}, + {"-option:sub"}, + {"-option:sub-"}, + {"-option", "<path>"}, + {"-option", "<file>"}, + {"-option", "<dir>"}, + {"-option", "http://a/b/c/g;x?y#s"}, + {"-option", "<html code>"}, + {"-option", "name1:name2"}, + {"-option", "3"}, + {"option1", "-J-version", "option2"}, + {"option1", "-J-version", "-J-XshowSettings:vm", "option2"},}; + + static void init() throws IOException { + if (testJar != null) { + return; + } + + // A tool which simulates com.sun.tools.javac.Main argument processing, + // intercepts options passed via the javac launcher. + final String mainJava = "Main" + JAVA_FILE_EXT; + testJar = new File("test" + JAR_FILE_EXT); + List<String> contents = new ArrayList<>(); + contents.add("package com.sun.tools.javac;"); + contents.add("public class Main {"); + contents.add(" public static void main(String... args) {\n"); + contents.add(" for (String x : args) {\n"); + contents.add(" if(x.compareTo(\" \")!=0)\n"); + contents.add(" System.out.println(x);\n"); + contents.add(" }\n"); + contents.add(" }\n"); + contents.add("}\n"); + createFile(new File(mainJava), contents); + + // compile and jar Main.java into test.jar + compile("-d", ".", mainJava); + createJar("cvf", testJar.getAbsolutePath(), "com"); + } + + static void pass(String msg) { + System.out.println("pass: " + msg); + } + + static void errout(String msg) { + System.err.println(msg); + } + + // Return position of -J option or -1 is does not contain a -J option. + static int indexOfJoption(String[] opts) { + for (int i = 0; i < opts.length; i++) { + if (opts[i].startsWith("-J")) { + return i; + } + } + return -1; + } + + /* + * Check that J options a) are not passed to tool, and b) do the right thing, + * that is, they should be passed to java launcher and work as expected. + */ + static void checkJoptionOutput(TestResult tr, String[] opts) throws IOException { + // Check -J-version options are not passed but do what they should. + String jopts = ""; + for (String pat : opts) { + jopts = jopts.concat(pat + " "); + if (tr.contains("-J")) { + throw new RuntimeException( + "failed: output should not contain option " + pat); + } + if (pat.compareTo("-J-version") == 0 || + pat.compareTo("-J-showversion") == 0) { + if (!tr.contains("java version") && + !tr.contains("openjdk version")) { + throw new RuntimeException("failed: " + pat + + " should display a version string."); + } + } else if (pat.compareTo("-J-XshowSettings:VM") == 0) { + if (!tr.contains("VM settings")) { + throw new RuntimeException("failed: " + pat + + " should have display VM settings."); + } + } + } + pass("Joption check: " + jopts); + } + + /* + * Feed each option pattern in optionPatterns array to javac launcher with + * checking program preempting javac. Check that option received by 'dummy' + * javac is the one passed on the command line. + */ + static void runTestOptions() throws IOException { + init(); + TestResult tr = null; + String sTestJar = testJar.getAbsolutePath(); + int jpos = -1; + for (String arg[] : optionPatterns) { + jpos = indexOfJoption(arg); + //Build a cmd string for output in results reporting. + String cmdString = javacCmd + " " + JBCP_PREPEND + sTestJar; + for (String opt : arg) { + cmdString = cmdString.concat(" " + opt); + } + switch (arg.length) { + case 1: + tr = doExec(javacCmd, JBCP_PREPEND + sTestJar, + arg[0]); + break; + case 2: + tr = doExec(javacCmd, JBCP_PREPEND + sTestJar, + arg[0], arg[1]); + break; + case 3: + tr = doExec(javacCmd, JBCP_PREPEND + sTestJar, + arg[0], arg[1], arg[2]); + break; + case 4: + tr = doExec(javacCmd, JBCP_PREPEND + sTestJar, + arg[0], arg[1], arg[2], arg[3]); + break; + default: + tr = null; + break; + } + + String[] output = tr.testOutput.toArray(new String[tr.testOutput.size()]); + //-Joptions should not be passed to tool + if (jpos > -1) { + checkJoptionOutput(tr, arg); + if (tr.contains(arg[jpos])) { + throw new RuntimeException( + "failed! Should not have passed -J option to tool.\n" + + "CMD: " + cmdString); + } + } else { + //check that each non -J option was passed to tool. + for (int i = 0; i < arg.length; i++) { + if (output[i].compareTo(arg[i]) != 0) { + throw new RuntimeException( + "failed! CMD: " + cmdString + "\n case:" + + output[i] + " != " + arg[i]); + } else { + pass("check " + output[i] + " == " + arg[i]); + } + } + } + pass(cmdString); + } + } + + public static void main(String... args) throws IOException { + runTestOptions(); + } +}