diff --git a/jdk/make/java/security/Makefile b/jdk/make/java/security/Makefile index 95c56767fae..1d28b60f2ff 100644 --- a/jdk/make/java/security/Makefile +++ b/jdk/make/java/security/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1996, 2010 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1996, 2011 Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -65,6 +65,8 @@ CACERTS_BUILD = $(LIBDIR)/security/cacerts ifndef OPENJDK BLACKLIST_SRC = $(CLOSED_SHARE_SRC)/lib/security/blacklist BLACKLIST_BUILD = $(LIBDIR)/security/blacklist + TRUSTEDLIBS_SRC = $(CLOSED_SHARE_SRC)/lib/security/trusted.libraries + TRUSTEDLIBS_BUILD = $(LIBDIR)/security/trusted.libraries endif FILES_class = $(FILES_java:%.java=$(CLASSBINDIR)/%.class) @@ -77,7 +79,7 @@ include $(BUILDDIR)/common/Rules.gmk ifdef OPENJDK build: properties policy cacerts else -build: properties policy cacerts blacklist +build: properties policy cacerts blacklist trustedlibs endif install: all @@ -90,6 +92,8 @@ cacerts: classes $(CACERTS_BUILD) blacklist: classes $(BLACKLIST_BUILD) +trustedlibs: classes $(TRUSTEDLIBS_BUILD) + $(PROPS_BUILD): $(PROPS_SRC) $(install-file) @@ -102,9 +106,12 @@ $(CACERTS_BUILD): $(CACERTS_SRC) $(BLACKLIST_BUILD): $(BLACKLIST_SRC) $(install-file) +$(TRUSTEDLIBS_BUILD): $(TRUSTEDLIBS_SRC) + $(install-file) + clean clobber:: .delete.classlist $(RM) -r $(CLASSBINDIR)/java/security - $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(BLACKLIST_BUILD) + $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(BLACKLIST_BUILD) $(TRUSTEDLIBS_BUILD) # Additional Rule for building sun.security.util $(CLASSBINDIR)/%.class: $(SHARE_SRC)/sun/%.java diff --git a/jdk/make/sun/javazic/tzdata/VERSION b/jdk/make/sun/javazic/tzdata/VERSION index 5d158c9e6db..b82ee890a30 100644 --- a/jdk/make/sun/javazic/tzdata/VERSION +++ b/jdk/make/sun/javazic/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2010o +tzdata2011b diff --git a/jdk/make/sun/javazic/tzdata/australasia b/jdk/make/sun/javazic/tzdata/australasia index 35ab9cfc9b8..430a6f146f5 100644 --- a/jdk/make/sun/javazic/tzdata/australasia +++ b/jdk/make/sun/javazic/tzdata/australasia @@ -106,14 +106,13 @@ Rule AS 1986 only - Oct 19 2:00s 1:00 - Rule AS 1987 2007 - Oct lastSun 2:00s 1:00 - Rule AS 1972 only - Feb 27 2:00s 0 - Rule AS 1973 1985 - Mar Sun>=1 2:00s 0 - -Rule AS 1986 1989 - Mar Sun>=15 2:00s 0 - -Rule AS 1990 only - Mar Sun>=18 2:00s 0 - -Rule AS 1991 only - Mar Sun>=1 2:00s 0 - -Rule AS 1992 only - Mar Sun>=18 2:00s 0 - -Rule AS 1993 only - Mar Sun>=1 2:00s 0 - -Rule AS 1994 only - Mar Sun>=18 2:00s 0 - +Rule AS 1986 1990 - Mar Sun>=15 2:00s 0 - +Rule AS 1991 only - Mar 3 2:00s 0 - +Rule AS 1992 only - Mar 22 2:00s 0 - +Rule AS 1993 only - Mar 7 2:00s 0 - +Rule AS 1994 only - Mar 20 2:00s 0 - Rule AS 1995 2005 - Mar lastSun 2:00s 0 - -Rule AS 2006 only - Apr Sun>=1 2:00s 0 - +Rule AS 2006 only - Apr 2 2:00s 0 - Rule AS 2007 only - Mar lastSun 2:00s 0 - Rule AS 2008 max - Apr Sun>=1 2:00s 0 - Rule AS 2008 max - Oct Sun>=1 2:00s 1:00 - diff --git a/jdk/make/sun/javazic/tzdata/northamerica b/jdk/make/sun/javazic/tzdata/northamerica index d07c69c9b45..281ab4f6748 100644 --- a/jdk/make/sun/javazic/tzdata/northamerica +++ b/jdk/make/sun/javazic/tzdata/northamerica @@ -368,6 +368,27 @@ Zone America/North_Dakota/New_Salem -6:45:39 - LMT 1883 Nov 18 12:14:21 -7:00 US M%sT 2003 Oct 26 02:00 -6:00 US C%sT +# From Josh Findley (2011-01-21): +# ...it appears that Mercer County, North Dakota, changed from the +# mountain time zone to the central time zone at the last transition from +# daylight-saving to standard time (on Nov. 7, 2010): +# +# http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm +# +# +# http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html +# + +# From Andy Lipscomb (2011-01-24): +# ...according to the Census Bureau, the largest city is Beulah (although +# it's commonly referred to as Beulah-Hazen, with Hazen being the next +# largest city in Mercer County). Google Maps places Beulah's city hall +# at 4715'51" north, 10146'40" west, which yields an offset of 6h47'07". + +Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 Nov 18 12:12:53 + -7:00 US M%sT 2010 Nov 7 2:00 + -6:00 US C%sT + # US mountain time, represented by Denver # # Colorado, far western Kansas, Montana, western @@ -493,20 +514,50 @@ Zone America/Adak 12:13:21 - LMT 1867 Oct 18 # three votes for and one against." # Hawaii + +# From Arthur David Olson (2010-12-09): +# "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225 +# of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09, +# the article is available at +# +# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf +# +# and indicates that standard time was adopted effective noon, January +# 13, 1896 (page 218), that in "1933, the Legislature decreed daylight +# saving for the period between the last Sunday of each April and the +# last Sunday of each September, but less than a month later repealed the +# act," (page 220), that year-round daylight saving time was in effect +# from 1942-02-09 to 1945-09-30 (page 221, with no time of day given for +# when clocks changed) and that clocks were changed by 30 minutes +# effective the second Sunday of June, 1947 (page 219, with no time of +# day given for when clocks changed). A footnote for the 1933 changes +# cites Session Laws of Hawaii 1933, "Act. 90 (approved 26 Apr. 1933) +# and Act 163 (approved 21 May 1933)." + +# From Arthur David Olson (2011-01-19): +# The following is from "Laws of the Territory of Hawaii Passed by the +# Seventeenth Legislature: Regular Session 1933," available (as of +# 2011-01-19) at American University's Pence Law Library. Page 85: "Act +# 90...At 2 o'clock ante meridian of the last Sunday in April of each +# year, the standard time of this Territory shall be advanced one +# hour...This Act shall take effect upon its approval. Approved this 26th +# day of April, A. D. 1933. LAWRENCE M JUDD, Governor of the Territory of +# Hawaii." Page 172: "Act 163...Act 90 of the Session Laws of 1933 is +# hereby repealed...This Act shall take effect upon its approval, upon +# which date the standard time of this Territory shall be restored to +# that existing immediately prior to the taking effect of said Act 90. +# Approved this 21st day of May, A. D. 1933. LAWRENCE M. JUDD, Governor +# of the Territory of Hawaii." # -# From Arthur David Olson: -# And then there's Hawaii. -# DST was observed for one day in 1933; -# standard time was changed by half an hour in 1947; -# it's always standard as of 1986. -# -# From Paul Eggert: -# Shanks says the 1933 experiment lasted for three weeks. Go with Shanks. -# -Zone Pacific/Honolulu -10:31:26 - LMT 1900 Jan 1 12:00 - -10:30 - HST 1933 Apr 30 2:00 - -10:30 1:00 HDT 1933 May 21 2:00 - -10:30 US H%sT 1947 Jun 8 2:00 +# Note that 1933-05-21 was a Sunday. +# We're left to guess the time of day when Act 163 was approved; guess noon. + +Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 #Schmitt&Cox + -10:30 - HST 1933 Apr 30 2:00 #Laws 1933 + -10:30 1:00 HDT 1933 May 21 12:00 #Laws 1933+12 + -10:30 - HST 1942 Feb 09 2:00 #Schmitt&Cox+2 + -10:30 1:00 HDT 1945 Sep 30 2:00 #Schmitt&Fox+2 + -10:30 US H%sT 1947 Jun 8 2:00 #Schmitt&Fox+2 -10:00 - HST # Now we turn to US areas that have diverged from the consensus since 1970. diff --git a/jdk/make/sun/javazic/tzdata/zone.tab b/jdk/make/sun/javazic/tzdata/zone.tab index c1b3e0707eb..cddfedae509 100644 --- a/jdk/make/sun/javazic/tzdata/zone.tab +++ b/jdk/make/sun/javazic/tzdata/zone.tab @@ -233,8 +233,8 @@ HT +1832-07220 America/Port-au-Prince HU +4730+01905 Europe/Budapest ID -0610+10648 Asia/Jakarta Java & Sumatra ID -0002+10920 Asia/Pontianak west & central Borneo -ID -0507+11924 Asia/Makassar east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor -ID -0232+14042 Asia/Jayapura Irian Jaya & the Moluccas +ID -0507+11924 Asia/Makassar east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor +ID -0232+14042 Asia/Jayapura west New Guinea (Irian Jaya) & Malukus (Moluccas) IE +5320-00615 Europe/Dublin IL +3146+03514 Asia/Jerusalem IM +5409-00428 Europe/Isle_of_Man @@ -426,6 +426,7 @@ US +411745-0863730 America/Indiana/Knox Central Time - Indiana - Starke County US +450628-0873651 America/Menominee Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County US +465042-1012439 America/North_Dakota/New_Salem Central Time - North Dakota - Morton County (except Mandan area) +US +471551-1014640 America/North_Dakota/Beulah Central Time - North Dakota - Mercer County US +394421-1045903 America/Denver Mountain Time US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon US +364708-1084111 America/Shiprock Mountain Time - Navajo diff --git a/jdk/make/sun/jpeg/Makefile b/jdk/make/sun/jpeg/Makefile index b669ad48de2..b16ebea9f0f 100644 --- a/jdk/make/sun/jpeg/Makefile +++ b/jdk/make/sun/jpeg/Makefile @@ -65,6 +65,19 @@ ifeq ($(PLATFORM), solaris) FILES_reorder += reorder-$(ARCH) endif endif + +ifeq ($(PLATFORM), linux) + + # Suppress gcc warnings like "variable might be clobbered by 'longjmp' + # or 'vfork'": this warning indicates that some variable is placed to + # a register by optimized compiler and it's value might be lost on longjmp(). + # Recommended way to avoid such warning is to declare the variable as + # volatile to prevent the optimization. However, this approach does not + # work because we have to declare all variables as volatile in result. + + OTHER_CFLAGS += -Wno-clobbered +endif + include $(BUILDDIR)/common/Mapfile-vers.gmk include $(BUILDDIR)/common/Library.gmk diff --git a/jdk/make/sun/jpeg/reorder-i586 b/jdk/make/sun/jpeg/reorder-i586 index 3fe7ea991bf..47e18ca44d1 100644 --- a/jdk/make/sun/jpeg/reorder-i586 +++ b/jdk/make/sun/jpeg/reorder-i586 @@ -22,7 +22,7 @@ text: .text%jIMReader; text: .text%alloc_small: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o; text: .text%reset_marker_reader: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%jIInCtlr; -text: .text%GET_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o; +# text: .text%GET_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o; text: .text%jReadHeader; text: .text%jConsumeInput; text: .text%reset_input_controller: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; @@ -30,36 +30,36 @@ text: .text%reset_error_mgr: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o; text: .text%sun_jpeg_init_source; text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; -text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%sun_jpeg_fill_input_buffer; -text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o; -text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o; +# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o; -text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; -text: .text%examine_app0: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%examine_app0: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%skip_variable: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%sun_jpeg_skip_input_data; -text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%jAlcQTable; text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; -text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%jAlcHTable; text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; -text: .text%initial_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; +# text: .text%initial_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; text: .text%jDivRound; -text: .text%default_decompress_parms: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapimin.o; +# text: .text%default_decompress_parms: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapimin.o; text: .text%jHasMultScn; text: .text%jStrtDecompress; text: .text%jIDMaster; -text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; +# text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%jCalcDimensions; -text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; -text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; +# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; +# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%jIDColor; -text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; +# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; text: .text%jIUpsampler; text: .text%jRound; text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o; @@ -70,16 +70,16 @@ text: .text%jIIDCT; text: .text%jIHDecoder; text: .text%jIDCoefC; text: .text%jIDMainC; -text: .text%alloc_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; +# text: .text%alloc_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; text: .text%realize_virt_arrays: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o; text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; -text: .text%per_scan_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; -text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; +# text: .text%per_scan_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; +# text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o; text: .text%jMkDDerived; text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; -text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; -text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o; +# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; +# text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o; text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jddctmgr.o; text: .text%start_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; @@ -87,7 +87,7 @@ text: .text%start_pass_dcolor: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; text: .text%start_pass_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%start_pass_dpost: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdpostct.o; text: .text%start_pass_main: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; -text: .text%make_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; +# text: .text%make_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; text: .text%jReadScanlines; text: .text%process_data_context_main: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; text: .text%decompress_onepass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; @@ -100,11 +100,11 @@ text: .text%sep_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; -text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; -text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o; +# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; +# text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o; text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; -text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; +# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; text: .text%jFinDecompress; text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%sun_jpeg_term_source; diff --git a/jdk/make/sun/jpeg/reorder-sparc b/jdk/make/sun/jpeg/reorder-sparc index 3fe7ea991bf..a7b21edca43 100644 --- a/jdk/make/sun/jpeg/reorder-sparc +++ b/jdk/make/sun/jpeg/reorder-sparc @@ -30,10 +30,10 @@ text: .text%reset_error_mgr: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o; text: .text%sun_jpeg_init_source; text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; -text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%sun_jpeg_fill_input_buffer; text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o; -text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o; text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; @@ -44,7 +44,7 @@ text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%jAlcQTable; text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; -text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; +# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%jAlcHTable; text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; @@ -56,10 +56,10 @@ text: .text%jStrtDecompress; text: .text%jIDMaster; text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%jCalcDimensions; -text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; -text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; +# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; +# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%jIDColor; -text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; +# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; text: .text%jIUpsampler; text: .text%jRound; text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o; @@ -78,7 +78,7 @@ text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o; text: .text%jMkDDerived; text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; -text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; +# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o; text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o; text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jddctmgr.o; @@ -100,11 +100,11 @@ text: .text%sep_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o; text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o; -text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; -text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o; +# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; +#text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o; text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o; text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o; -text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; +# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o; text: .text%jFinDecompress; text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o; text: .text%sun_jpeg_term_source; diff --git a/jdk/make/sun/jpeg/reorder-sparcv9 b/jdk/make/sun/jpeg/reorder-sparcv9 index e5447a4f56f..3af1a21eb80 100644 --- a/jdk/make/sun/jpeg/reorder-sparcv9 +++ b/jdk/make/sun/jpeg/reorder-sparcv9 @@ -30,10 +30,10 @@ text: .text%reset_error_mgr: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jerror.o; text: .text%sun_jpeg_init_source; text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o; text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; -text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; +# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%sun_jpeg_fill_input_buffer; text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jpegdecoder.o; -text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; +# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jerror.o; text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; @@ -44,7 +44,7 @@ text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%jAlcQTable; text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; -text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; +# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%jAlcHTable; text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; @@ -56,10 +56,10 @@ text: .text%jStrtDecompress; text: .text%jIDMaster; text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; text: .text%jCalcDimensions; -text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; -text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; +# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; +# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; text: .text%jIDColor; -text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o; +# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o; text: .text%jIUpsampler; text: .text%jRound; text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jmemmgr.o; @@ -78,7 +78,7 @@ text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o; text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdhuff.o; text: .text%jMkDDerived; text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o; -text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o; +# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o; text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdapistd.o; text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jddctmgr.o; @@ -100,11 +100,11 @@ text: .text%sep_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o; text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o; text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o; text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o; -text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o; +# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o; text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdhuff.o; text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o; text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o; -text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o; +# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o; text: .text%jFinDecompress; text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o; text: .text%sun_jpeg_term_source; diff --git a/jdk/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider b/jdk/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider index 2ea4f8b8040..a92a6020d50 100644 --- a/jdk/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider +++ b/jdk/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider @@ -1,5 +1,5 @@ # Providers for FormatConversion +com.sun.media.sound.AudioFloatFormatConverter com.sun.media.sound.UlawCodec com.sun.media.sound.AlawCodec com.sun.media.sound.PCMtoPCMCodec -com.sun.media.sound.AudioFloatFormatConverter diff --git a/jdk/src/share/classes/java/io/Console.java b/jdk/src/share/classes/java/io/Console.java index 783dafd28e4..9bfbaf00497 100644 --- a/jdk/src/share/classes/java/io/Console.java +++ b/jdk/src/share/classes/java/io/Console.java @@ -308,17 +308,29 @@ public final class Console implements Flushable char[] passwd = null; synchronized (writeLock) { synchronized(readLock) { - if (fmt.length() != 0) - pw.format(fmt, args); try { echoOff = echo(false); - passwd = readline(true); } catch (IOException x) { throw new IOError(x); + } + IOError ioe = null; + try { + if (fmt.length() != 0) + pw.format(fmt, args); + passwd = readline(true); + } catch (IOException x) { + ioe = new IOError(x); } finally { try { echoOff = echo(true); - } catch (IOException xx) {} + } catch (IOException x) { + if (ioe == null) + ioe = new IOError(x); + else + ioe.addSuppressed(x); + } + if (ioe != null) + throw ioe; } pw.println(); } diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java index 59e15ee1d04..3eafd1b3cbb 100644 --- a/jdk/src/share/classes/java/lang/System.java +++ b/jdk/src/share/classes/java/lang/System.java @@ -1102,6 +1102,18 @@ public final class System { * Initialize the system class. Called after thread initialization. */ private static void initializeSystemClass() { + + // VM might invoke JNU_NewStringPlatform() to set those encoding + // sensitive properties (user.home, user.name, boot.class.path, etc.) + // during "props" initialization, in which it may need access, via + // System.getProperty(), to the related system encoding property that + // have been initialized (put into "props") at early stage of the + // initialization. So make sure the "props" is available at the + // very beginning of the initialization and all system properties to + // be put into it directly. + props = new Properties(); + initProperties(props); // initialized by the VM + // There are certain system configurations that may be controlled by // VM options such as the maximum amount of direct memory and // Integer cache size used to support the object identity semantics @@ -1112,7 +1124,12 @@ public final class System { // // See java.lang.Integer.IntegerCache and the // sun.misc.VM.saveAndRemoveProperties method for example. - props = initSystemProperties(); + // + // Save a private copy of the system properties object that + // can only be accessed by the internal implementation. Remove + // certain system properties that are not intended for public access. + sun.misc.VM.saveAndRemoveProperties(props); + lineSeparator = props.getProperty("line.separator"); sun.misc.Version.init(); @@ -1123,7 +1140,6 @@ public final class System { setIn0(new BufferedInputStream(fdIn)); setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true)); setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true)); - // Load the zip library now in order to keep java.util.zip.ZipFile // from trying to use itself to load this library later. loadLibrary("zip"); @@ -1151,18 +1167,6 @@ public final class System { setJavaLangAccess(); } - private static Properties initSystemProperties() { - Properties props = new Properties(); - initProperties(props); // initialized by the VM - - // Save a private copy of the system properties object that - // can only be accessed by the internal implementation. Remove - // certain system properties that are not intended for public access. - sun.misc.VM.saveAndRemoveProperties(props); - - return props; - } - private static void setJavaLangAccess() { // Allow privileged classes outside of java.lang sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){ diff --git a/jdk/src/share/classes/java/lang/Thread.java b/jdk/src/share/classes/java/lang/Thread.java index d35e082b844..d64d55b7404 100644 --- a/jdk/src/share/classes/java/lang/Thread.java +++ b/jdk/src/share/classes/java/lang/Thread.java @@ -254,12 +254,6 @@ class Thread implements Runnable { */ public final static int MAX_PRIORITY = 10; - /* If stop was called before start */ - private boolean stopBeforeStart; - - /* Remembered Throwable from stop before start */ - private Throwable throwableFromStop; - /** * Returns a reference to the currently executing thread object. * @@ -706,10 +700,6 @@ class Thread implements Runnable { it will be passed up the call stack */ } } - - if (stopBeforeStart) { - stop0(throwableFromStop); - } } private native void start0(); @@ -820,12 +810,7 @@ class Thread implements Runnable { */ @Deprecated public final void stop() { - // If the thread is already dead, return. - // A zero status value corresponds to "NEW". - if ((threadStatus != 0) && !isAlive()) { - return; - } - stop1(new ThreadDeath()); + stop(new ThreadDeath()); } /** @@ -879,36 +864,25 @@ class Thread implements Runnable { */ @Deprecated public final synchronized void stop(Throwable obj) { - stop1(obj); - } + if (obj == null) + throw new NullPointerException(); - /** - * Common impl for stop() and stop(Throwable). - */ - private final synchronized void stop1(Throwable th) { SecurityManager security = System.getSecurityManager(); if (security != null) { checkAccess(); if ((this != Thread.currentThread()) || - (!(th instanceof ThreadDeath))) { + (!(obj instanceof ThreadDeath))) { security.checkPermission(SecurityConstants.STOP_THREAD_PERMISSION); } } - // A zero status value corresponds to "NEW" + // A zero status value corresponds to "NEW", it can't change to + // not-NEW because we hold the lock. if (threadStatus != 0) { resume(); // Wake up thread if it was suspended; no-op otherwise - stop0(th); - } else { - - // Must do the null arg check that the VM would do with stop0 - if (th == null) { - throw new NullPointerException(); - } - - // Remember this stop attempt for if/when start is used - stopBeforeStart = true; - throwableFromStop = th; } + + // The VM can handle all thread states + stop0(obj); } /** diff --git a/jdk/src/share/classes/java/util/Hashtable.java b/jdk/src/share/classes/java/util/Hashtable.java index 63af5581cf7..b354bbc50f1 100644 --- a/jdk/src/share/classes/java/util/Hashtable.java +++ b/jdk/src/share/classes/java/util/Hashtable.java @@ -845,24 +845,36 @@ public class Hashtable * for each key-value mapping represented by the Hashtable * The key-value mappings are emitted in no particular order. */ - private synchronized void writeObject(java.io.ObjectOutputStream s) - throws IOException - { - // Write out the length, threshold, loadfactor - s.defaultWriteObject(); + private void writeObject(java.io.ObjectOutputStream s) + throws IOException { + Entry entryStack = null; - // Write out length, count of elements and then the key/value objects - s.writeInt(table.length); - s.writeInt(count); - for (int index = table.length-1; index >= 0; index--) { - Entry entry = table[index]; + synchronized (this) { + // Write out the length, threshold, loadfactor + s.defaultWriteObject(); - while (entry != null) { - s.writeObject(entry.key); - s.writeObject(entry.value); - entry = entry.next; + // Write out length, count of elements + s.writeInt(table.length); + s.writeInt(count); + + // Stack copies of the entries in the table + for (int index = 0; index < table.length; index++) { + Entry entry = table[index]; + + while (entry != null) { + entryStack = + new Entry<>(0, entry.key, entry.value, entryStack); + entry = entry.next; + } } } + + // Write out the key/value objects from the stacked entries + while (entryStack != null) { + s.writeObject(entryStack.key); + s.writeObject(entryStack.value); + entryStack = entryStack.next; + } } /** diff --git a/jdk/src/share/classes/java/util/SimpleTimeZone.java b/jdk/src/share/classes/java/util/SimpleTimeZone.java index 86427733290..ef70b960ee0 100644 --- a/jdk/src/share/classes/java/util/SimpleTimeZone.java +++ b/jdk/src/share/classes/java/util/SimpleTimeZone.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -825,10 +825,7 @@ public class SimpleTimeZone extends TimeZone { * @since 1.2 */ public int getDSTSavings() { - if (useDaylight) { - return dstSavings; - } - return 0; + return useDaylight ? dstSavings : 0; } /** @@ -841,6 +838,20 @@ public class SimpleTimeZone extends TimeZone { return useDaylight; } + /** + * Returns {@code true} if this {@code SimpleTimeZone} observes + * Daylight Saving Time. This method is equivalent to {@link + * #useDaylightTime()}. + * + * @return {@code true} if this {@code SimpleTimeZone} observes + * Daylight Saving Time; {@code false} otherwise. + * @since 1.7 + */ + @Override + public boolean observesDaylightTime() { + return useDaylightTime(); + } + /** * Queries if the given date is in daylight saving time. * @return true if daylight saving time is in effective at the diff --git a/jdk/src/share/classes/java/util/TimeZone.java b/jdk/src/share/classes/java/util/TimeZone.java index ca62e0ed7da..9799be601fe 100644 --- a/jdk/src/share/classes/java/util/TimeZone.java +++ b/jdk/src/share/classes/java/util/TimeZone.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -455,17 +455,28 @@ abstract public class TimeZone implements Serializable, Cloneable { /** * Returns the amount of time to be added to local standard time * to get local wall clock time. - *

- * The default implementation always returns 3600000 milliseconds - * (i.e., one hour) if this time zone observes Daylight Saving - * Time. Otherwise, 0 (zero) is returned. - *

- * If an underlying TimeZone implementation subclass supports - * historical Daylight Saving Time changes, this method returns - * the known latest daylight saving value. + * + *

The default implementation returns 3600000 milliseconds + * (i.e., one hour) if a call to {@link #useDaylightTime()} + * returns {@code true}. Otherwise, 0 (zero) is returned. + * + *

If an underlying {@code TimeZone} implementation subclass + * supports historical and future Daylight Saving Time schedule + * changes, this method returns the amount of saving time of the + * last known Daylight Saving Time rule that can be a future + * prediction. + * + *

If the amount of saving time at any given time stamp is + * required, construct a {@link Calendar} with this {@code + * TimeZone} and the time stamp, and call {@link Calendar#get(int) + * Calendar.get}{@code (}{@link Calendar#DST_OFFSET}{@code )}. * * @return the amount of saving time in milliseconds * @since 1.4 + * @see #inDaylightTime(Date) + * @see #getOffset(long) + * @see #getOffset(int,int,int,int,int,int) + * @see Calendar#ZONE_OFFSET */ public int getDSTSavings() { if (useDaylightTime()) { @@ -475,24 +486,51 @@ abstract public class TimeZone implements Serializable, Cloneable { } /** - * Queries if this time zone uses daylight savings time. - *

- * If an underlying TimeZone implementation subclass - * supports historical Daylight Saving Time schedule changes, the - * method refers to the latest Daylight Saving Time schedule - * information. + * Queries if this {@code TimeZone} uses Daylight Saving Time. * - * @return true if this time zone uses daylight savings time, - * false, otherwise. + *

If an underlying {@code TimeZone} implementation subclass + * supports historical and future Daylight Saving Time schedule + * changes, this method refers to the last known Daylight Saving Time + * rule that can be a future prediction and may not be the same as + * the current rule. Consider calling {@link #observesDaylightTime()} + * if the current rule should also be taken into account. + * + * @return {@code true} if this {@code TimeZone} uses Daylight Saving Time, + * {@code false}, otherwise. + * @see #inDaylightTime(Date) + * @see Calendar#DST_OFFSET */ public abstract boolean useDaylightTime(); /** - * Queries if the given date is in daylight savings time in - * this time zone. - * @param date the given Date. - * @return true if the given date is in daylight savings time, - * false, otherwise. + * Returns {@code true} if this {@code TimeZone} is currently in + * Daylight Saving Time, or if a transition from Standard Time to + * Daylight Saving Time occurs at any future time. + * + *

The default implementation returns {@code true} if + * {@code useDaylightTime()} or {@code inDaylightTime(new Date())} + * returns {@code true}. + * + * @return {@code true} if this {@code TimeZone} is currently in + * Daylight Saving Time, or if a transition from Standard Time to + * Daylight Saving Time occurs at any future time; {@code false} + * otherwise. + * @since 1.7 + * @see #useDaylightTime() + * @see #inDaylightTime(Date) + * @see Calendar#DST_OFFSET + */ + public boolean observesDaylightTime() { + return useDaylightTime() || inDaylightTime(new Date()); + } + + /** + * Queries if the given {@code date} is in Daylight Saving Time in + * this {@code TimeZone}. + * + * @param date the given {@code Date}. + * @return {@code true} if the given {@code date} is in Daylight Saving Time, + * {@code false}, otherwise. */ abstract public boolean inDaylightTime(Date date); diff --git a/jdk/src/share/classes/java/util/Vector.java b/jdk/src/share/classes/java/util/Vector.java index 1ce0abf86f3..11c0c60a481 100644 --- a/jdk/src/share/classes/java/util/Vector.java +++ b/jdk/src/share/classes/java/util/Vector.java @@ -1050,13 +1050,21 @@ public class Vector /** * Save the state of the {@code Vector} instance to a stream (that - * is, serialize it). This method is present merely for synchronization. - * It just calls the default writeObject method. + * is, serialize it). + * This method performs synchronization to ensure the consistency + * of the serialized data. */ - private synchronized void writeObject(java.io.ObjectOutputStream s) - throws java.io.IOException - { - s.defaultWriteObject(); + private void writeObject(java.io.ObjectOutputStream s) + throws java.io.IOException { + final java.io.ObjectOutputStream.PutField fields = s.putFields(); + final Object[] data; + synchronized (this) { + fields.put("capacityIncrement", capacityIncrement); + fields.put("elementCount", elementCount); + data = elementData.clone(); + } + fields.put("elementData", data); + s.writeFields(); } /** diff --git a/jdk/src/share/classes/java/util/jar/JarFile.java b/jdk/src/share/classes/java/util/jar/JarFile.java index e42d41fb799..a5795c72763 100644 --- a/jdk/src/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/share/classes/java/util/jar/JarFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,11 +27,13 @@ package java.util.jar; import java.io.*; import java.lang.ref.SoftReference; +import java.net.URL; import java.util.*; import java.util.zip.*; import java.security.CodeSigner; import java.security.cert.Certificate; import java.security.AccessController; +import java.security.CodeSource; import sun.security.action.GetPropertyAction; import sun.security.util.ManifestEntryVerifier; import sun.misc.SharedSecrets; @@ -262,7 +264,7 @@ class JarFile extends ZipFile { throw new RuntimeException(e); } if (certs == null && jv != null) { - certs = jv.getCerts(getName()); + certs = jv.getCerts(JarFile.this, this); } return certs == null ? null : certs.clone(); } @@ -273,7 +275,7 @@ class JarFile extends ZipFile { throw new RuntimeException(e); } if (signers == null && jv != null) { - signers = jv.getCodeSigners(getName()); + signers = jv.getCodeSigners(JarFile.this, this); } return signers == null ? null : signers.clone(); } @@ -544,4 +546,191 @@ class JarFile extends ZipFile { } return false; } + + private synchronized void ensureInitialization() { + try { + maybeInstantiateVerifier(); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (jv != null && !jvInitialized) { + initializeVerifier(); + jvInitialized = true; + } + } + + JarEntry newEntry(ZipEntry ze) { + return new JarFileEntry(ze); + } + + Enumeration entryNames(CodeSource[] cs) { + ensureInitialization(); + if (jv != null) { + return jv.entryNames(this, cs); + } + + /* + * JAR file has no signed content. Is there a non-signing + * code source? + */ + boolean includeUnsigned = false; + for (int i = 0; i < cs.length; i++) { + if (cs[i].getCodeSigners() == null) { + includeUnsigned = true; + break; + } + } + if (includeUnsigned) { + return unsignedEntryNames(); + } else { + return new Enumeration() { + + public boolean hasMoreElements() { + return false; + } + + public String nextElement() { + throw new NoSuchElementException(); + } + }; + } + } + + /** + * Returns an enumeration of the zip file entries + * excluding internal JAR mechanism entries and including + * signed entries missing from the ZIP directory. + */ + Enumeration entries2() { + ensureInitialization(); + if (jv != null) { + return jv.entries2(this, super.entries()); + } + + // screen out entries which are never signed + final Enumeration enum_ = super.entries(); + return new Enumeration() { + + ZipEntry entry; + + public boolean hasMoreElements() { + if (entry != null) { + return true; + } + while (enum_.hasMoreElements()) { + ZipEntry ze = (ZipEntry) enum_.nextElement(); + if (JarVerifier.isSigningRelated(ze.getName())) { + continue; + } + entry = ze; + return true; + } + return false; + } + + public JarFileEntry nextElement() { + if (hasMoreElements()) { + ZipEntry ze = entry; + entry = null; + return new JarFileEntry(ze); + } + throw new NoSuchElementException(); + } + }; + } + + CodeSource[] getCodeSources(URL url) { + ensureInitialization(); + if (jv != null) { + return jv.getCodeSources(this, url); + } + + /* + * JAR file has no signed content. Is there a non-signing + * code source? + */ + Enumeration unsigned = unsignedEntryNames(); + if (unsigned.hasMoreElements()) { + return new CodeSource[]{JarVerifier.getUnsignedCS(url)}; + } else { + return null; + } + } + + private Enumeration unsignedEntryNames() { + final Enumeration entries = entries(); + return new Enumeration() { + + String name; + + /* + * Grab entries from ZIP directory but screen out + * metadata. + */ + public boolean hasMoreElements() { + if (name != null) { + return true; + } + while (entries.hasMoreElements()) { + String value; + ZipEntry e = (ZipEntry) entries.nextElement(); + value = e.getName(); + if (e.isDirectory() || JarVerifier.isSigningRelated(value)) { + continue; + } + name = value; + return true; + } + return false; + } + + public String nextElement() { + if (hasMoreElements()) { + String value = name; + name = null; + return value; + } + throw new NoSuchElementException(); + } + }; + } + + CodeSource getCodeSource(URL url, String name) { + ensureInitialization(); + if (jv != null) { + if (jv.eagerValidation) { + CodeSource cs = null; + JarEntry je = getJarEntry(name); + if (je != null) { + cs = jv.getCodeSource(url, this, je); + } else { + cs = jv.getCodeSource(url, name); + } + return cs; + } else { + return jv.getCodeSource(url, name); + } + } + + return JarVerifier.getUnsignedCS(url); + } + + void setEagerValidation(boolean eager) { + try { + maybeInstantiateVerifier(); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (jv != null) { + jv.setEagerValidation(eager); + } + } + + List getManifestDigests() { + ensureInitialization(); + if (jv != null) { + return jv.getManifestDigests(); + } + return new ArrayList(); + } } diff --git a/jdk/src/share/classes/java/util/jar/JarVerifier.java b/jdk/src/share/classes/java/util/jar/JarVerifier.java index 33c67c15a6d..abbb85e3768 100644 --- a/jdk/src/share/classes/java/util/jar/JarVerifier.java +++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,9 +26,11 @@ package java.util.jar; import java.io.*; +import java.net.URL; import java.util.*; import java.security.*; import java.security.cert.CertificateException; +import java.util.zip.ZipEntry; import sun.security.util.ManifestDigester; import sun.security.util.ManifestEntryVerifier; @@ -81,6 +83,15 @@ class JarVerifier { /** the bytes for the manDig object */ byte manifestRawBytes[] = null; + /** controls eager signature validation */ + boolean eagerValidation; + + /** makes code source singleton instances unique to us */ + private Object csdomain = new Object(); + + /** collect -DIGEST-MANIFEST values for blacklist */ + private List manifestDigests; + public JarVerifier(byte rawBytes[]) { manifestRawBytes = rawBytes; sigFileSigners = new Hashtable(); @@ -88,6 +99,7 @@ class JarVerifier { sigFileData = new Hashtable(11); pendingBlocks = new ArrayList(); baos = new ByteArrayOutputStream(); + manifestDigests = new ArrayList(); } /** @@ -247,7 +259,7 @@ class JarVerifier { } sfv.setSignatureFile(bytes); - sfv.process(sigFileSigners); + sfv.process(sigFileSigners, manifestDigests); } } return; @@ -290,7 +302,7 @@ class JarVerifier { sfv.setSignatureFile(bytes); } } - sfv.process(sigFileSigners); + sfv.process(sigFileSigners, manifestDigests); } catch (IOException ioe) { // e.g. sun.security.pkcs.ParsingException @@ -312,12 +324,18 @@ class JarVerifier { /** * Return an array of java.security.cert.Certificate objects for * the given file in the jar. + * @deprecated */ public java.security.cert.Certificate[] getCerts(String name) { return mapSignersToCertArray(getCodeSigners(name)); } + public java.security.cert.Certificate[] getCerts(JarFile jar, JarEntry entry) + { + return mapSignersToCertArray(getCodeSigners(jar, entry)); + } + /** * return an array of CodeSigner objects for * the given file in the jar. this array is not cloned. @@ -328,6 +346,28 @@ class JarVerifier { return (CodeSigner[])verifiedSigners.get(name); } + public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry) + { + String name = entry.getName(); + if (eagerValidation && sigFileSigners.get(name) != null) { + /* + * Force a read of the entry data to generate the + * verification hash. + */ + try { + InputStream s = jar.getInputStream(entry); + byte[] buffer = new byte[1024]; + int n = buffer.length; + while (n != -1) { + n = s.read(buffer, 0, buffer.length); + } + s.close(); + } catch (IOException e) { + } + } + return getCodeSigners(name); + } + /* * Convert an array of signers into an array of concatenated certificate * arrays. @@ -444,4 +484,393 @@ class JarVerifier { } } + + // Extended JavaUtilJarAccess CodeSource API Support + + private Map urlToCodeSourceMap = new HashMap(); + private Map signerToCodeSource = new HashMap(); + private URL lastURL; + private Map lastURLMap; + + /* + * Create a unique mapping from codeSigner cache entries to CodeSource. + * In theory, multiple URLs origins could map to a single locally cached + * and shared JAR file although in practice there will be a single URL in use. + */ + private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) { + Map map; + if (url == lastURL) { + map = lastURLMap; + } else { + map = (Map) urlToCodeSourceMap.get(url); + if (map == null) { + map = new HashMap(); + urlToCodeSourceMap.put(url, map); + } + lastURLMap = map; + lastURL = url; + } + CodeSource cs = (CodeSource) map.get(signers); + if (cs == null) { + cs = new VerifierCodeSource(csdomain, url, signers); + signerToCodeSource.put(signers, cs); + } + return cs; + } + + private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) { + List sources = new ArrayList(); + + for (int i = 0; i < signers.size(); i++) { + sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i))); + } + if (unsigned) { + sources.add(mapSignersToCodeSource(url, null)); + } + return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]); + } + private CodeSigner[] emptySigner = new CodeSigner[0]; + + /* + * Match CodeSource to a CodeSigner[] in the signer cache. + */ + private CodeSigner[] findMatchingSigners(CodeSource cs) { + if (cs instanceof VerifierCodeSource) { + VerifierCodeSource vcs = (VerifierCodeSource) cs; + if (vcs.isSameDomain(csdomain)) { + return ((VerifierCodeSource) cs).getPrivateSigners(); + } + } + + /* + * In practice signers should always be optimized above + * but this handles a CodeSource of any type, just in case. + */ + CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true); + List sourceList = new ArrayList(); + for (int i = 0; i < sources.length; i++) { + sourceList.add(sources[i]); + } + int j = sourceList.indexOf(cs); + if (j != -1) { + CodeSigner[] match; + match = ((VerifierCodeSource) sourceList.get(j)).getPrivateSigners(); + if (match == null) { + match = emptySigner; + } + return match; + } + return null; + } + + /* + * Instances of this class hold uncopied references to internal + * signing data that can be compared by object reference identity. + */ + private static class VerifierCodeSource extends CodeSource { + + URL vlocation; + CodeSigner[] vsigners; + java.security.cert.Certificate[] vcerts; + Object csdomain; + + VerifierCodeSource(Object csdomain, URL location, CodeSigner[] signers) { + super(location, signers); + this.csdomain = csdomain; + vlocation = location; + vsigners = signers; // from signerCache + } + + VerifierCodeSource(Object csdomain, URL location, java.security.cert.Certificate[] certs) { + super(location, certs); + this.csdomain = csdomain; + vlocation = location; + vcerts = certs; // from signerCache + } + + /* + * All VerifierCodeSource instances are constructed based on + * singleton signerCache or signerCacheCert entries for each unique signer. + * No CodeSigner<->Certificate[] conversion is required. + * We use these assumptions to optimize equality comparisons. + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof VerifierCodeSource) { + VerifierCodeSource that = (VerifierCodeSource) obj; + + /* + * Only compare against other per-signer singletons constructed + * on behalf of the same JarFile instance. Otherwise, compare + * things the slower way. + */ + if (isSameDomain(that.csdomain)) { + if (that.vsigners != this.vsigners + || that.vcerts != this.vcerts) { + return false; + } + if (that.vlocation != null) { + return that.vlocation.equals(this.vlocation); + } else if (this.vlocation != null) { + return this.vlocation.equals(that.vlocation); + } else { // both null + return true; + } + } + } + return super.equals(obj); + } + + boolean isSameDomain(Object csdomain) { + return this.csdomain == csdomain; + } + + private CodeSigner[] getPrivateSigners() { + return vsigners; + } + + private java.security.cert.Certificate[] getPrivateCertificates() { + return vcerts; + } + } + private Map signerMap; + + private synchronized Map signerMap() { + if (signerMap == null) { + /* + * Snapshot signer state so it doesn't change on us. We care + * only about the asserted signatures. Verification of + * signature validity happens via the JarEntry apis. + */ + signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size()); + signerMap.putAll(verifiedSigners); + signerMap.putAll(sigFileSigners); + } + return signerMap; + } + + public synchronized Enumeration entryNames(JarFile jar, final CodeSource[] cs) { + final Map map = signerMap(); + final Iterator itor = map.entrySet().iterator(); + boolean matchUnsigned = false; + + /* + * Grab a single copy of the CodeSigner arrays. Check + * to see if we can optimize CodeSigner equality test. + */ + List req = new ArrayList(cs.length); + for (int i = 0; i < cs.length; i++) { + CodeSigner[] match = findMatchingSigners(cs[i]); + if (match != null) { + if (match.length > 0) { + req.add(match); + } else { + matchUnsigned = true; + } + } + } + + final List signersReq = req; + final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration; + + return new Enumeration() { + + String name; + + public boolean hasMoreElements() { + if (name != null) { + return true; + } + + while (itor.hasNext()) { + Map.Entry e = (Map.Entry) itor.next(); + if (signersReq.contains((CodeSigner[]) e.getValue())) { + name = (String) e.getKey(); + return true; + } + } + while (enum2.hasMoreElements()) { + name = (String) enum2.nextElement(); + return true; + } + return false; + } + + public String nextElement() { + if (hasMoreElements()) { + String value = name; + name = null; + return value; + } + throw new NoSuchElementException(); + } + }; + } + + /* + * Like entries() but screens out internal JAR mechanism entries + * and includes signed entries with no ZIP data. + */ + public Enumeration entries2(final JarFile jar, Enumeration e) { + final Map map = new HashMap(); + map.putAll(signerMap()); + final Enumeration enum_ = e; + return new Enumeration() { + + Enumeration signers = null; + JarEntry entry; + + public boolean hasMoreElements() { + if (entry != null) { + return true; + } + while (enum_.hasMoreElements()) { + ZipEntry ze = (ZipEntry) enum_.nextElement(); + if (JarVerifier.isSigningRelated(ze.getName())) { + continue; + } + entry = jar.newEntry(ze); + return true; + } + if (signers == null) { + signers = Collections.enumeration(map.keySet()); + } + while (signers.hasMoreElements()) { + String name = (String) signers.nextElement(); + entry = jar.newEntry(new ZipEntry(name)); + return true; + } + + // Any map entries left? + return false; + } + + public JarEntry nextElement() { + if (hasMoreElements()) { + JarEntry je = entry; + map.remove(je.getName()); + entry = null; + return je; + } + throw new NoSuchElementException(); + } + }; + } + private Enumeration emptyEnumeration = new Enumeration() { + + public boolean hasMoreElements() { + return false; + } + + public String nextElement() { + throw new NoSuchElementException(); + } + }; + + // true if file is part of the signature mechanism itself + static boolean isSigningRelated(String name) { + name = name.toUpperCase(Locale.ENGLISH); + if (!name.startsWith("META-INF/")) { + return false; + } + name = name.substring(9); + if (name.indexOf('/') != -1) { + return false; + } + if (name.endsWith(".DSA") + || name.endsWith(".RSA") + || name.endsWith(".SF") + || name.endsWith(".EC") + || name.startsWith("SIG-") + || name.equals("MANIFEST.MF")) { + return true; + } + return false; + } + + private Enumeration unsignedEntryNames(JarFile jar) { + final Map map = signerMap(); + final Enumeration entries = jar.entries(); + return new Enumeration() { + + String name; + + /* + * Grab entries from ZIP directory but screen out + * metadata. + */ + public boolean hasMoreElements() { + if (name != null) { + return true; + } + while (entries.hasMoreElements()) { + String value; + ZipEntry e = (ZipEntry) entries.nextElement(); + value = e.getName(); + if (e.isDirectory() || isSigningRelated(value)) { + continue; + } + if (map.get(value) == null) { + name = value; + return true; + } + } + return false; + } + + public String nextElement() { + if (hasMoreElements()) { + String value = name; + name = null; + return value; + } + throw new NoSuchElementException(); + } + }; + } + private List jarCodeSigners; + + private synchronized List getJarCodeSigners() { + CodeSigner[] signers; + if (jarCodeSigners == null) { + HashSet set = new HashSet(); + set.addAll(signerMap().values()); + jarCodeSigners = new ArrayList(); + jarCodeSigners.addAll(set); + } + return jarCodeSigners; + } + + public synchronized CodeSource[] getCodeSources(JarFile jar, URL url) { + boolean hasUnsigned = unsignedEntryNames(jar).hasMoreElements(); + + return mapSignersToCodeSources(url, getJarCodeSigners(), hasUnsigned); + } + + public CodeSource getCodeSource(URL url, String name) { + CodeSigner[] signers; + + signers = (CodeSigner[]) signerMap().get(name); + return mapSignersToCodeSource(url, signers); + } + + public CodeSource getCodeSource(URL url, JarFile jar, JarEntry je) { + CodeSigner[] signers; + + return mapSignersToCodeSource(url, getCodeSigners(jar, je)); + } + + public void setEagerValidation(boolean eager) { + eagerValidation = eager; + } + + public synchronized List getManifestDigests() { + return Collections.unmodifiableList(manifestDigests); + } + + static CodeSource getUnsignedCS(URL url) { + return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null); + } } diff --git a/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java b/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java index bed2b5a77e5..c53ba0c6f52 100644 --- a/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java +++ b/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,38 @@ package java.util.jar; import java.io.IOException; +import java.net.URL; +import java.security.CodeSource; +import java.util.Enumeration; +import java.util.List; import sun.misc.JavaUtilJarAccess; class JavaUtilJarAccessImpl implements JavaUtilJarAccess { public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException { return jar.hasClassPathAttribute(); } + + public CodeSource[] getCodeSources(JarFile jar, URL url) { + return jar.getCodeSources(url); + } + + public CodeSource getCodeSource(JarFile jar, URL url, String name) { + return jar.getCodeSource(url, name); + } + + public Enumeration entryNames(JarFile jar, CodeSource[] cs) { + return jar.entryNames(cs); + } + + public Enumeration entries2(JarFile jar) { + return jar.entries2(); + } + + public void setEagerValidation(JarFile jar, boolean eager) { + jar.setEagerValidation(eager); + } + + public List getManifestDigests(JarFile jar) { + return jar.getManifestDigests(); + } } diff --git a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java index 9fc08a92bbd..f39f33de4c0 100644 --- a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java +++ b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java @@ -115,20 +115,19 @@ public interface ScriptEngineFactory { * with respect to concurrent execution of scripts and maintenance of state is also defined. * These values for the THREADING key are:

*

*

* Implementations may define implementation-specific keys. @@ -145,22 +144,23 @@ public interface ScriptEngineFactory { * of the supported scripting language. For instance, an implementaton for a Javascript * engine might be; *

- *

+     * 
+     * 
      * public String getMethodCallSyntax(String obj,
      *                                   String m, String... args) {
      *      String ret = obj;
      *      ret += "." + m + "(";
      *      for (int i = 0; i < args.length; i++) {
      *          ret += args[i];
-     *          if (i == args.length - 1) {
-     *              ret += ")";
-     *          } else {
+     *          if (i < args.length - 1) {
      *              ret += ",";
      *          }
      *      }
+     *      ret += ")";
      *      return ret;
      * }
-     *
+ *
+ *
*

* * @param obj The name representing the object whose method is to be invoked. The diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java index 3724cc2cdac..fe3347540ff 100644 --- a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java +++ b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java @@ -670,6 +670,12 @@ public class AudioSystem { *

The returned TargetDataLine's default * audio format will be initialized with format. * + *

If the system property + * {@code javax.sound.sampled.TargetDataLine} + * is defined or it is defined in the file "sound.properties", + * it is used to retrieve the default target data line. + * For details, refer to the {@link AudioSystem class description}. + * * @param format an AudioFormat object specifying * the supported audio format of the returned line, * or null for any audio format @@ -712,12 +718,6 @@ public class AudioSystem { *

The returned TargetDataLine's default * audio format will be initialized with format. * - *

If the system property - * javax.sound.sampled.TargetDataLine - * is defined or it is defined in the file "sound.properties", - * it is used to retrieve the default target data line. - * For details, refer to the {@link AudioSystem class description}. - * * @param format an AudioFormat object specifying * the supported audio format of the returned line, * or null for any audio format diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java index ff482082e7c..ad7238d1baf 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java @@ -57,10 +57,10 @@ public class SerialClob implements Clob, Serializable, Cloneable { private char buf[]; /** - * Internal Clob representation if SerialClob is intialized with a - * Clob + * Internal Clob representation if SerialClob is initialized with a + * Clob. Null if SerialClob is initialized with a char[]. */ - private Clob clob; + private final Clob clob; /** * The length in characters of this SerialClob object's @@ -71,12 +71,12 @@ public class SerialClob implements Clob, Serializable, Cloneable { private long len; /** - * The original length in characters of tgus SerialClob - * objects internal array of characters. + * The original length in characters of this SerialClob + * object's internal array of characters. * * @serial */ - private long origLen; + private final long origLen; /** * Constructs a SerialClob object that is a serialized version of @@ -104,6 +104,7 @@ public class SerialClob implements Clob, Serializable, Cloneable { buf[i] = ch[i]; } origLen = len; + clob = null; } /** @@ -117,19 +118,19 @@ public class SerialClob implements Clob, Serializable, Cloneable { * the database. Otherwise, the new SerialClob object * object will contain no data. *

- * Note: The Clob object supplied to this constructor cannot - * return null for the Clob.getCharacterStream() + * Note: The Clob object supplied to this constructor must + * return non-null for both the Clob.getCharacterStream() * and Clob.getAsciiStream methods. This SerialClob - * constructor cannot serialize a Clob object in this instance + * constructor cannot serialize a Clob object in this instance * and will throw an SQLException object. * * @param clob the Clob object from which this * SerialClob object is to be constructed; cannot be null * @throws SerialException if an error occurs during serialization * @throws SQLException if a SQL error occurs in capturing the CLOB; - * if the Clob object is a null; or if both the + * if the Clob object is a null; or if either of the * Clob.getCharacterStream() and Clob.getAsciiStream() - * methods on the Clob return a null + * methods on the Clob returns a null * @see java.sql.Clob */ public SerialClob(Clob clob) throws SerialException, SQLException { @@ -144,19 +145,27 @@ public class SerialClob implements Clob, Serializable, Cloneable { int read = 0; int offset = 0; - BufferedReader reader; - if ( (((reader = new BufferedReader(clob.getCharacterStream())) == null)) && - (clob.getAsciiStream() == null)) { - throw new SQLException("Invalid Clob object. Calls to getCharacterStream " + - "and getAsciiStream return null which cannot be serialized."); - } + try (Reader charStream = clob.getCharacterStream()) { + if (charStream == null) { + throw new SQLException("Invalid Clob object. The call to getCharacterStream " + + "returned null which cannot be serialized."); + } - try { - do { - read = reader.read(buf, offset, (int)(len - offset)); - offset += read; - } while (read > 0); + // Note: get an ASCII stream in order to null-check it, + // even though we don't do anything with it. + try (InputStream asciiStream = clob.getAsciiStream()) { + if (asciiStream == null) { + throw new SQLException("Invalid Clob object. The call to getAsciiStream " + + "returned null which cannot be serialized."); + } + } + try (Reader reader = new BufferedReader(charStream)) { + do { + read = reader.read(buf, offset, (int)(len - offset)); + offset += read; + } while (read > 0); + } } catch (java.io.IOException ex) { throw new SerialException("SerialClob: " + ex.getMessage()); } @@ -207,13 +216,13 @@ public class SerialClob implements Clob, Serializable, Cloneable { * used to create this SerialClob object */ public java.io.InputStream getAsciiStream() throws SerialException, SQLException { - if (this.clob != null) { - return this.clob.getAsciiStream(); - } else { - throw new SerialException("Unsupported operation. SerialClob cannot " + + if (this.clob != null) { + return this.clob.getAsciiStream(); + } else { + throw new SerialException("Unsupported operation. SerialClob cannot " + "return a the CLOB value as an ascii stream, unless instantiated " + "with a fully implemented Clob object."); - } + } } /** diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java index f3358e0fb12..b52f345caf5 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java @@ -32,6 +32,7 @@ import java.sql.*; import javax.sql.*; import java.io.FileInputStream; +import java.io.InputStream; import java.io.IOException; import java.io.FileNotFoundException; @@ -366,7 +367,9 @@ public class SyncFactory { // Load user's implementation of SyncProvider // here. -Drowset.properties=/abc/def/pqr.txt ROWSET_PROPERTIES = strRowsetProperties; - properties.load(new FileInputStream(ROWSET_PROPERTIES)); + try (FileInputStream fis = new FileInputStream(ROWSET_PROPERTIES)) { + properties.load(fis); + } parseProperties(properties); } @@ -376,12 +379,19 @@ public class SyncFactory { ROWSET_PROPERTIES = "javax" + strFileSep + "sql" + strFileSep + "rowset" + strFileSep + "rowset.properties"; - // properties.load( - // ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES)); ClassLoader cl = Thread.currentThread().getContextClassLoader(); - properties.load(cl.getResourceAsStream(ROWSET_PROPERTIES)); + try (InputStream stream = + (cl == null) ? ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES) + : cl.getResourceAsStream(ROWSET_PROPERTIES)) { + if (stream == null) { + throw new SyncFactoryException( + "Resource " + ROWSET_PROPERTIES + " not found"); + } + properties.load(stream); + } + parseProperties(properties); // removed else, has properties should sum together diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 7bed584dca6..eff194ca212 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -4910,14 +4910,17 @@ public abstract class JComponent extends Container implements Serializable, * Returns {@code true} if a paint triggered on a child component should cause * painting to originate from this Component, or one of its ancestors. *

- * Calling {@link JComponent#repaint} on a Swing component will be delegated to - * the first ancestor which {@code isPaintingOrigin()} returns {@code true}, - * if there are any. + * Calling {@link #repaint} or {@link #paintImmediately(int, int, int, int)} + * on a Swing component will result in calling + * the {@link JComponent#paintImmediately(int, int, int, int)} method of + * the first ancestor which {@code isPaintingOrigin()} returns {@code true}, if there are any. *

- * {@code JComponent} subclasses that need to be repainted when any of their + * {@code JComponent} subclasses that need to be painted when any of their * children are repainted should override this method to return {@code true}. * * @return always returns {@code false} + * + * @see #paintImmediately(int, int, int, int) */ protected boolean isPaintingOrigin() { return false; @@ -4932,12 +4935,16 @@ public abstract class JComponent extends Container implements Serializable, * and can collapse redundant requests into a single paint call. * This method is useful if one needs to update the display while * the current event is being dispatched. + *

+ * This method is to be overridden when the dirty region needs to be changed + * for components that are painting origins. * * @param x the x value of the region to be painted * @param y the y value of the region to be painted * @param w the width of the region to be painted * @param h the height of the region to be painted * @see #repaint + * @see #isPaintingOrigin() */ public void paintImmediately(int x,int y,int w, int h) { Component c = this; @@ -4946,6 +4953,15 @@ public abstract class JComponent extends Container implements Serializable, if(!isShowing()) { return; } + + JComponent paintingOigin = SwingUtilities.getPaintingOrigin(this); + if (paintingOigin != null) { + Rectangle rectangle = SwingUtilities.convertRectangle( + c, new Rectangle(x, y, w, h), paintingOigin); + paintingOigin.paintImmediately(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + return; + } + while(!c.isOpaque()) { parent = c.getParent(); if(parent != null) { diff --git a/jdk/src/share/classes/javax/swing/JLayer.java b/jdk/src/share/classes/javax/swing/JLayer.java index 764e553fd61..592fe82e24c 100644 --- a/jdk/src/share/classes/javax/swing/JLayer.java +++ b/jdk/src/share/classes/javax/swing/JLayer.java @@ -156,8 +156,9 @@ public final class JLayer // when layerUI is serializable private LayerUI layerUI; private JPanel glassPane; - private boolean isPainting; private long eventMask; + private transient boolean isPainting; + private transient boolean isPaintingImmediately; private static final LayerEventController eventController = new LayerEventController(); @@ -393,17 +394,25 @@ public final class JLayer } /** - * Delegates repainting to {@link javax.swing.plaf.LayerUI#repaint} method. + * Delegates its functionality to the + * {@link javax.swing.plaf.LayerUI#paintImmediately(int, int, int, int, JLayer)} method, + * if {@code LayerUI} is set. * - * @param tm this parameter is not used - * @param x the x value of the dirty region - * @param y the y value of the dirty region - * @param width the width of the dirty region - * @param height the height of the dirty region + * @param x the x value of the region to be painted + * @param y the y value of the region to be painted + * @param w the width of the region to be painted + * @param h the height of the region to be painted */ - public void repaint(long tm, int x, int y, int width, int height) { - if (getUI() != null) { - getUI().repaint(tm, x, y, width, height, this); + public void paintImmediately(int x, int y, int w, int h) { + if (!isPaintingImmediately && getUI() != null) { + isPaintingImmediately = true; + try { + getUI().paintImmediately(x, y, w, h, this); + } finally { + isPaintingImmediately = false; + } + } else { + super.paintImmediately(x, y, w, h); } } @@ -415,8 +424,11 @@ public final class JLayer public void paint(Graphics g) { if (!isPainting) { isPainting = true; - super.paintComponent(g); - isPainting = false; + try { + super.paintComponent(g); + } finally { + isPainting = false; + } } else { super.paint(g); } diff --git a/jdk/src/share/classes/javax/swing/LookAndFeel.java b/jdk/src/share/classes/javax/swing/LookAndFeel.java index 8c61c18f96a..bcaa06247b9 100644 --- a/jdk/src/share/classes/javax/swing/LookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/LookAndFeel.java @@ -332,12 +332,13 @@ public abstract class LookAndFeel { JTextComponent.KeyBinding[] rv = new JTextComponent.KeyBinding[keyBindingList.length / 2]; - for(int i = 0; i < keyBindingList.length; i += 2) { - KeyStroke keystroke = (keyBindingList[i] instanceof KeyStroke) - ? (KeyStroke)keyBindingList[i] - : KeyStroke.getKeyStroke((String)keyBindingList[i]); - String action = (String)keyBindingList[i+1]; - rv[i / 2] = new JTextComponent.KeyBinding(keystroke, action); + for(int i = 0; i < rv.length; i ++) { + Object o = keyBindingList[2 * i]; + KeyStroke keystroke = (o instanceof KeyStroke) + ? (KeyStroke) o + : KeyStroke.getKeyStroke((String) o); + String action = (String) keyBindingList[2 * i + 1]; + rv[i] = new JTextComponent.KeyBinding(keystroke, action); } return rv; diff --git a/jdk/src/share/classes/javax/swing/RepaintManager.java b/jdk/src/share/classes/javax/swing/RepaintManager.java index 062d2e70b09..361e863a518 100644 --- a/jdk/src/share/classes/javax/swing/RepaintManager.java +++ b/jdk/src/share/classes/javax/swing/RepaintManager.java @@ -438,7 +438,6 @@ public class RepaintManager * @param y Y coordinate of the region to repaint * @param w Width of the region to repaint * @param h Height of the region to repaint - * @see JComponent#isPaintingOrigin() * @see JComponent#repaint */ public void addDirtyRegion(JComponent c, int x, int y, int w, int h) @@ -448,16 +447,6 @@ public class RepaintManager delegate.addDirtyRegion(c, x, y, w, h); return; } - Container p = c; - while ((p = p.getParent()) instanceof JComponent) { - JComponent jp = (JComponent) p; - if (jp.isPaintingOrigin()) { - Rectangle rectangle = SwingUtilities.convertRectangle( - c, new Rectangle(x, y, w, h), jp); - jp.repaint(0, rectangle.x, rectangle.y, rectangle.width, rectangle.height); - return; - } - } addDirtyRegion0(c, x, y, w, h); } diff --git a/jdk/src/share/classes/javax/swing/SwingUtilities.java b/jdk/src/share/classes/javax/swing/SwingUtilities.java index 61dde01e93c..86948132cea 100644 --- a/jdk/src/share/classes/javax/swing/SwingUtilities.java +++ b/jdk/src/share/classes/javax/swing/SwingUtilities.java @@ -1532,6 +1532,17 @@ public class SwingUtilities implements SwingConstants return applet; } + static JComponent getPaintingOrigin(JComponent c) { + Container p = c; + while ((p = p.getParent()) instanceof JComponent) { + JComponent jp = (JComponent) p; + if (jp.isPaintingOrigin()) { + return jp; + } + } + return null; + } + /** * Process the key bindings for the Component associated with * event. This method is only useful if diff --git a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java index 655d9f27177..e118467aa99 100644 --- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java @@ -703,21 +703,19 @@ public class LayerUI } /** - * Adds the specified region to the dirty region list if the component - * is showing. The component will be repainted after all of the - * currently pending events have been dispatched. + * Paints the specified region in the {@code JLayer} this {@code LayerUI} is set to, immediately. *

* This method is to be overridden when the dirty region needs to be changed. + * The default implementation delegates its functionality to {@link JComponent#paintImmediately(int, int, int, int)}. * - * @param tm this parameter is not used - * @param x the x value of the dirty region - * @param y the y value of the dirty region - * @param width the width of the dirty region - * @param height the height of the dirty region - * @see java.awt.Component#isShowing - * @see RepaintManager#addDirtyRegion + * @param x the x value of the region to be painted + * @param y the y value of the region to be painted + * @param w the width of the region to be painted + * @param h the height of the region to be painted + * + * @see JComponent#paintImmediately(int, int, int, int) */ - public void repaint(long tm, int x, int y, int width, int height, JLayer l) { - RepaintManager.currentManager(l).addDirtyRegion(l, x, y, width, height); + public void paintImmediately(int x, int y, int width, int height, JLayer l) { + l.paintImmediately(x, y, width, height); } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java index 23e8f7dce79..fb97f12eb8c 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java @@ -1965,18 +1965,18 @@ public class BasicTreeUI extends TreeUI } /** Returns the preferred size to properly display the tree, - * this is a cover method for getPreferredSize(c, false). + * this is a cover method for getPreferredSize(c, true). */ public Dimension getPreferredSize(JComponent c) { return getPreferredSize(c, true); } /** Returns the preferred size to represent the tree in - * c. If checkConsistancy is true - * checkConsistancy is messaged first. + * c. If checkConsistency is true + * checkConsistency is messaged first. */ public Dimension getPreferredSize(JComponent c, - boolean checkConsistancy) { + boolean checkConsistency) { Dimension pSize = this.getPreferredMinSize(); if(!validCachedPreferredSize) diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java index 0a4fa276752..63a8f377cea 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java @@ -510,7 +510,6 @@ public class SynthGraphicsUtils { Font holdf = g.getFont(); Color holdc = g.getColor(); - paintBackground(g, lh); paintCheckIcon(g, lh, lr); paintIcon(g, lh, lr); paintText(g, lh, lr); diff --git a/jdk/src/share/classes/sun/awt/image/ImageFetcher.java b/jdk/src/share/classes/sun/awt/image/ImageFetcher.java index 083ba79841b..5b1293fb043 100644 --- a/jdk/src/share/classes/sun/awt/image/ImageFetcher.java +++ b/jdk/src/share/classes/sun/awt/image/ImageFetcher.java @@ -61,8 +61,10 @@ class ImageFetcher extends Thread { /** * Adds an ImageFetchable to the queue of items to fetch. Instantiates * a new ImageFetcher if it's reasonable to do so. + * If there is no available fetcher to process an ImageFetchable, then + * reports failure to caller. */ - public static void add(ImageFetchable src) { + public static boolean add(ImageFetchable src) { final FetcherInfo info = FetcherInfo.getFetcherInfo(); synchronized(info.waitList) { if (!info.waitList.contains(src)) { @@ -71,9 +73,23 @@ class ImageFetcher extends Thread { info.numFetchers < info.fetchers.length) { createFetchers(info); } - info.waitList.notify(); + /* Creation of new fetcher may fail due to high vm load + * or some other reason. + * If there is already exist, but busy, fetcher, we leave + * the src in queue (it will be handled by existing + * fetcher later). + * Otherwise, we report failure: there is no fetcher + * to handle the src. + */ + if (info.numFetchers > 0) { + info.waitList.notify(); + } else { + info.waitList.removeElement(src); + return false; + } } } + return true; } /** @@ -291,11 +307,15 @@ class ImageFetcher extends Thread { public Object run() { for (int i = 0; i < info.fetchers.length; i++) { if (info.fetchers[i] == null) { - info.fetchers[i] = new ImageFetcher( + ImageFetcher f = new ImageFetcher( fetcherGroup, i); - info.fetchers[i].start(); - info.numFetchers++; - break; + try { + f.start(); + info.fetchers[i] = f; + info.numFetchers++; + break; + } catch (Error e) { + } } } return null; diff --git a/jdk/src/share/classes/sun/awt/image/InputStreamImageSource.java b/jdk/src/share/classes/sun/awt/image/InputStreamImageSource.java index e2aecb3073c..7d0b7eaf43b 100644 --- a/jdk/src/share/classes/sun/awt/image/InputStreamImageSource.java +++ b/jdk/src/share/classes/sun/awt/image/InputStreamImageSource.java @@ -164,8 +164,13 @@ public abstract class InputStreamImageSource implements ImageProducer, private synchronized void startProduction() { if (!awaitingFetch) { - ImageFetcher.add(this); - awaitingFetch = true; + if (ImageFetcher.add(this)) { + awaitingFetch = true; + } else { + ImageConsumerQueue cq = consumers; + consumers = null; + errorAllConsumers(cq, false); + } } } diff --git a/jdk/src/share/classes/sun/font/FontUtilities.java b/jdk/src/share/classes/sun/font/FontUtilities.java index ef53c60de08..6f3c6d12a14 100644 --- a/jdk/src/share/classes/sun/font/FontUtilities.java +++ b/jdk/src/share/classes/sun/font/FontUtilities.java @@ -30,6 +30,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; +import java.lang.ref.SoftReference; +import java.util.concurrent.ConcurrentHashMap; import java.security.AccessController; import java.security.PrivilegedAction; @@ -383,6 +385,10 @@ public final class FontUtilities { * } * return fuir; */ + private static volatile + SoftReference> + compMapRef = new SoftReference(null); + public static FontUIResource getCompositeFontUIResource(Font font) { FontUIResource fuir = new FontUIResource(font); @@ -402,12 +408,22 @@ public final class FontUtilities { FontManager fm = FontManagerFactory.getInstance(); CompositeFont dialog2D = - (CompositeFont) fm.findFont2D("dialog", font.getStyle(), FontManager.NO_FALLBACK); + (CompositeFont) fm.findFont2D("dialog", font.getStyle(), + FontManager.NO_FALLBACK); if (dialog2D == null) { /* shouldn't happen */ return fuir; } PhysicalFont physicalFont = (PhysicalFont)font2D; - CompositeFont compFont = new CompositeFont(physicalFont, dialog2D); + ConcurrentHashMap compMap = compMapRef.get(); + if (compMap == null) { // Its been collected. + compMap = new ConcurrentHashMap(); + compMapRef = new SoftReference(compMap); + } + CompositeFont compFont = compMap.get(physicalFont); + if (compFont == null) { + compFont = new CompositeFont(physicalFont, dialog2D); + compMap.put(physicalFont, compFont); + } FontAccess.getFontAccess().setFont2D(fuir, compFont.handle); /* marking this as a created font is needed as only created fonts * copy their creator's handles. diff --git a/jdk/src/share/classes/sun/misc/JarIndex.java b/jdk/src/share/classes/sun/misc/JarIndex.java index 39e2eca91d8..f9781d65a0d 100644 --- a/jdk/src/share/classes/sun/misc/JarIndex.java +++ b/jdk/src/share/classes/sun/misc/JarIndex.java @@ -103,6 +103,19 @@ public class JarIndex { parseJars(files); } + /** + * Returns the jar index, or null if none. + * + * This single parameter version of the method is retained + * for binary compatibility with earlier releases. + * + * @param jar the JAR file to get the index from. + * @exception IOException if an I/O error has occurred. + */ + public static JarIndex getJarIndex(JarFile jar) throws IOException { + return getJarIndex(jar, null); + } + /** * Returns the jar index, or null if none. * diff --git a/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java b/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java index e5e6b608ee8..0f1efd1d2cb 100644 --- a/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java +++ b/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,19 @@ package sun.misc; import java.io.IOException; +import java.net.URL; +import java.security.CodeSource; +import java.util.Enumeration; +import java.util.List; +import java.util.jar.JarEntry; import java.util.jar.JarFile; public interface JavaUtilJarAccess { public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException; + public CodeSource[] getCodeSources(JarFile jar, URL url); + public CodeSource getCodeSource(JarFile jar, URL url, String name); + public Enumeration entryNames(JarFile jar, CodeSource[] cs); + public Enumeration entries2(JarFile jar); + public void setEagerValidation(JarFile jar, boolean eager); + public List getManifestDigests(JarFile jar); } diff --git a/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java b/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java index 36acd9cc381..f32141d5030 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java +++ b/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java @@ -27,6 +27,9 @@ package sun.net.www.protocol.jar; import java.io.*; import java.net.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; import java.util.*; import java.util.jar.*; import java.util.zip.ZipFile; @@ -208,38 +211,23 @@ public class URLJarFile extends JarFile { JarFile result = null; /* get the stream before asserting privileges */ - final InputStream in = url.openConnection().getInputStream(); - - try { + try (final InputStream in = url.openConnection().getInputStream()) { result = AccessController.doPrivileged( new PrivilegedExceptionAction() { public JarFile run() throws IOException { - OutputStream out = null; - File tmpFile = null; + Path tmpFile = Files.createTempFile("jar_cache", null); try { - tmpFile = File.createTempFile("jar_cache", null); - tmpFile.deleteOnExit(); - out = new FileOutputStream(tmpFile); - int read = 0; - byte[] buf = new byte[BUF_SIZE]; - while ((read = in.read(buf)) != -1) { - out.write(buf, 0, read); - } - out.close(); - out = null; - return new URLJarFile(tmpFile, closeController); - } catch (IOException e) { - if (tmpFile != null) { - tmpFile.delete(); - } - throw e; - } finally { - if (in != null) { - in.close(); - } - if (out != null) { - out.close(); + Files.copy(in, tmpFile, StandardCopyOption.REPLACE_EXISTING); + JarFile jarFile = new URLJarFile(tmpFile.toFile(), closeController); + tmpFile.toFile().deleteOnExit(); + return jarFile; + } catch (Throwable thr) { + try { + Files.delete(tmpFile); + } catch (IOException ioe) { + thr.addSuppressed(ioe); } + throw thr; } } }); diff --git a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java index e9344cdab64..b15086eab12 100644 --- a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java +++ b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java @@ -51,6 +51,7 @@ public class FileChannelImpl // File access mode (immutable) private final boolean writable; private final boolean readable; + private final boolean append; // Required to prevent finalization of creating stream (immutable) private final Object parent; @@ -67,6 +68,7 @@ public class FileChannelImpl this.fd = fd; this.readable = readable; this.writable = writable; + this.append = append; this.parent = parent; this.nd = new FileDispatcherImpl(append); } @@ -242,7 +244,8 @@ public class FileChannelImpl if (!isOpen()) return 0; do { - p = position0(fd, -1); + // in append-mode then position is advanced to end before writing + p = (append) ? nd.size(fd) : position0(fd, -1); } while ((p == IOStatus.INTERRUPTED) && isOpen()); return IOStatus.normalize(p); } finally { diff --git a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java index 328aadf7f5d..c7694023d6b 100644 --- a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java +++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java @@ -87,6 +87,7 @@ public final class SunNativeProvider extends Provider { gssLibs = new String[]{ "libgssapi.so", "libgssapi_krb5.so", + "libgssapi_krb5.so.2", }; } } else { diff --git a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java index a4f83c87bbb..63989de46ee 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java @@ -231,13 +231,6 @@ public class PKIXCertPathValidator extends CertPathValidatorSpi { AdaptableX509CertSelector issuerSelector = new AdaptableX509CertSelector(); - // check trusted certificate's key usage - boolean[] usages = trustedCert.getKeyUsage(); - if (usages != null) { - usages[5] = true; // keyCertSign - issuerSelector.setKeyUsage(usages); - } - // check trusted certificate's subject issuerSelector.setSubject(firstCert.getIssuerX500Principal()); diff --git a/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java b/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java index d3ce9013e15..f60fcb75f8b 100644 --- a/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java +++ b/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -181,7 +181,8 @@ public class SignatureFileVerifier { * * */ - public void process(Hashtable signers) + public void process(Hashtable signers, + List manifestDigests) throws IOException, SignatureException, NoSuchAlgorithmException, JarException, CertificateException { @@ -190,14 +191,15 @@ public class SignatureFileVerifier { Object obj = null; try { obj = Providers.startJarVerification(); - processImpl(signers); + processImpl(signers, manifestDigests); } finally { Providers.stopJarVerification(obj); } } - private void processImpl(Hashtable signers) + private void processImpl(Hashtable signers, + List manifestDigests) throws IOException, SignatureException, NoSuchAlgorithmException, JarException, CertificateException { @@ -232,7 +234,7 @@ public class SignatureFileVerifier { sf.getEntries().entrySet().iterator(); // see if we can verify the whole manifest first - boolean manifestSigned = verifyManifestHash(sf, md, decoder); + boolean manifestSigned = verifyManifestHash(sf, md, decoder, manifestDigests); // verify manifest main attributes if (!manifestSigned && !verifyManifestMainAttrs(sf, md, decoder)) { @@ -275,7 +277,8 @@ public class SignatureFileVerifier { */ private boolean verifyManifestHash(Manifest sf, ManifestDigester md, - BASE64Decoder decoder) + BASE64Decoder decoder, + List manifestDigests) throws IOException { Attributes mattr = sf.getMainAttributes(); @@ -290,6 +293,8 @@ public class SignatureFileVerifier { // 16 is length of "-Digest-Manifest" String algorithm = key.substring(0, key.length()-16); + manifestDigests.add(key); + manifestDigests.add(se.getValue()); MessageDigest digest = getDigest(algorithm); if (digest != null) { byte[] computedHash = md.manifestDigest(digest); diff --git a/jdk/src/share/classes/sun/tools/jps/Jps.java b/jdk/src/share/classes/sun/tools/jps/Jps.java index 7850f9656c2..9611dd3a007 100644 --- a/jdk/src/share/classes/sun/tools/jps/Jps.java +++ b/jdk/src/share/classes/sun/tools/jps/Jps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,9 +77,52 @@ public class Jps { MonitoredVm vm = null; String vmidString = "//" + lvmid + "?mode=r"; + String errorString = null; + try { + // Note: The VM associated with the current VM id may + // no longer be running so these queries may fail. We + // already added the VM id to the output stream above. + // If one of the queries fails, then we try to add a + // reasonable message to indicate that the requested + // info is not available. + + errorString = " -- process information unavailable"; VmIdentifier id = new VmIdentifier(vmidString); vm = monitoredHost.getMonitoredVm(id, 0); + + errorString = " -- main class information unavailable"; + output.append(" " + MonitoredVmUtil.mainClass(vm, + arguments.showLongPaths())); + + if (arguments.showMainArgs()) { + errorString = " -- main args information unavailable"; + String mainArgs = MonitoredVmUtil.mainArgs(vm); + if (mainArgs != null && mainArgs.length() > 0) { + output.append(" " + mainArgs); + } + } + if (arguments.showVmArgs()) { + errorString = " -- jvm args information unavailable"; + String jvmArgs = MonitoredVmUtil.jvmArgs(vm); + if (jvmArgs != null && jvmArgs.length() > 0) { + output.append(" " + jvmArgs); + } + } + if (arguments.showVmFlags()) { + errorString = " -- jvm flags information unavailable"; + String jvmFlags = MonitoredVmUtil.jvmFlags(vm); + if (jvmFlags != null && jvmFlags.length() > 0) { + output.append(" " + jvmFlags); + } + } + + errorString = " -- detach failed"; + monitoredHost.detach(vm); + + System.out.println(output); + + errorString = null; } catch (URISyntaxException e) { // unexpected as vmidString is based on a validated hostid lastError = e; @@ -87,7 +130,7 @@ public class Jps { } catch (Exception e) { lastError = e; } finally { - if (vm == null) { + if (errorString != null) { /* * we ignore most exceptions, as there are race * conditions where a JVM in 'jvms' may terminate @@ -95,7 +138,7 @@ public class Jps { * Other errors, such as access and I/O exceptions * should stop us from iterating over the complete set. */ - output.append(" -- process information unavailable"); + output.append(errorString); if (arguments.isDebug()) { if ((lastError != null) && (lastError.getMessage() != null)) { @@ -110,33 +153,6 @@ public class Jps { continue; } } - - output.append(" "); - output.append(MonitoredVmUtil.mainClass(vm, - arguments.showLongPaths())); - - if (arguments.showMainArgs()) { - String mainArgs = MonitoredVmUtil.mainArgs(vm); - if (mainArgs != null && mainArgs.length() > 0) { - output.append(" ").append(mainArgs); - } - } - if (arguments.showVmArgs()) { - String jvmArgs = MonitoredVmUtil.jvmArgs(vm); - if (jvmArgs != null && jvmArgs.length() > 0) { - output.append(" ").append(jvmArgs); - } - } - if (arguments.showVmFlags()) { - String jvmFlags = MonitoredVmUtil.jvmFlags(vm); - if (jvmFlags != null && jvmFlags.length() > 0) { - output.append(" ").append(jvmFlags); - } - } - - System.out.println(output); - - monitoredHost.detach(vm); } } catch (MonitorException e) { if (e.getMessage() != null) { diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java index 17d9fae84a9..a5c73549809 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java @@ -405,6 +405,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java index 45705ec799d..b3cb23224fa 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java index eecb3e31e55..613cc6419fb 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java index c39a001aaca..f1dc5300c25 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java index 1bbfc5d44a0..e983872e7a1 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java index f38a8e02537..56330acf91d 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java index 5186d42ef99..82edcce1ec5 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java index 981281217f7..d9b83fe0491 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Panama", EST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java index 2813a181680..14108065241 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java index c79c6f2f69c..4f80a1b739c 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java index 679ce531f83..5218bed7ed6 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java @@ -405,6 +405,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { {"America/Nipigon", EST}, {"America/Nome", AKST}, {"America/Noronha", NORONHA}, + {"America/North_Dakota/Beulah", CST}, {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, {"America/Ojinaga", MST}, diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java index 60c8fed9291..d8aa305d29b 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java @@ -42,6 +42,7 @@ import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.zip.ZipError; import java.util.concurrent.ExecutorService; /* @@ -78,39 +79,60 @@ public class ZipFileSystemProvider extends FileSystemProvider { } } + private boolean ensureFile(Path path) { + try { + BasicFileAttributes attrs = + Files.readAttributes(path, BasicFileAttributes.class); + if (!attrs.isRegularFile()) + throw new UnsupportedOperationException(); + return true; + } catch (IOException ioe) { + return false; + } + } + @Override public FileSystem newFileSystem(URI uri, Map env) throws IOException { - return newFileSystem(uriToPath(uri), env, true); + Path path = uriToPath(uri); + synchronized(filesystems) { + Path realPath = null; + if (ensureFile(path)) { + realPath = path.toRealPath(true); + if (filesystems.containsKey(realPath)) + throw new FileSystemAlreadyExistsException(); + } + ZipFileSystem zipfs = null; + try { + zipfs = new ZipFileSystem(this, path, env); + } catch (ZipError ze) { + String pname = path.toString(); + if (pname.endsWith(".zip") || pname.endsWith(".jar")) + throw ze; + // assume NOT a zip/jar file + throw new UnsupportedOperationException(); + } + filesystems.put(realPath, zipfs); + return zipfs; + } } @Override public FileSystem newFileSystem(Path path, Map env) throws IOException { - if (!path.toUri().getScheme().equalsIgnoreCase("file")) { + if (path.getFileSystem() != FileSystems.getDefault()) { throw new UnsupportedOperationException(); } - return newFileSystem(path, env, false); - } - - private FileSystem newFileSystem(Path path, Map env, boolean checkIfFSExists) - throws IOException - { - synchronized(filesystems) { - Path realPath = null; - if (checkIfFSExists && Files.exists(path)) { - realPath = path.toRealPath(true); - if (filesystems.containsKey(realPath)) - throw new FileSystemAlreadyExistsException(); - } - ZipFileSystem zipfs = new ZipFileSystem(this, path, env); - if (realPath == null) - realPath = path.toRealPath(true); - if (!filesystems.containsKey(realPath)) - filesystems.put(realPath, zipfs); - return zipfs; + ensureFile(path); + try { + return new ZipFileSystem(this, path, env); + } catch (ZipError ze) { + String pname = path.toString(); + if (pname.endsWith(".zip") || pname.endsWith(".jar")) + throw ze; + throw new UnsupportedOperationException(); } } diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c index bfbef221dbd..04a87fd1cac 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c @@ -109,8 +109,8 @@ typedef struct streamBufferStruct { jobject stream; // ImageInputStream or ImageOutputStream jbyteArray hstreamBuffer; // Handle to a Java buffer for the stream JOCTET *buf; // Pinned buffer pointer */ - int bufferOffset; // holds offset between unpin and the next pin - int bufferLength; // Allocated, nut just used + size_t bufferOffset; // holds offset between unpin and the next pin + size_t bufferLength; // Allocated, nut just used int suspendable; // Set to true to suspend input long remaining_skip; // Used only on input } streamBuffer, *streamBufferPtr; @@ -129,7 +129,7 @@ typedef struct streamBufferStruct { * Used to signal that no data need be restored from an unpin to a pin. * I.e. the buffer is empty. */ -#define NO_DATA -1 +#define NO_DATA ((size_t)-1) // Forward reference static void resetStreamBuffer(JNIEnv *env, streamBufferPtr sb); @@ -389,7 +389,6 @@ typedef struct imageIODataStruct { static imageIODataPtr initImageioData (JNIEnv *env, j_common_ptr cinfo, jobject obj) { - int i, j; imageIODataPtr data = (imageIODataPtr) malloc (sizeof(imageIOData)); if (data == NULL) { @@ -982,7 +981,7 @@ imageio_fill_suspended_buffer(j_decompress_ptr cinfo) streamBufferPtr sb = &data->streamBuf; JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); jint ret; - int offset, buflen; + size_t offset, buflen; /* * The original (jpegdecoder.c) had code here that called @@ -1520,7 +1519,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader imageio_dispose((j_common_ptr)cinfo); return 0; } - return (jlong) ret; + return ptr_to_jlong(ret); } /* @@ -1535,7 +1534,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource jlong ptr, jobject source) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_common_ptr cinfo; if (data == NULL) { @@ -1574,7 +1573,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader int h_samp0, h_samp1, h_samp2; int v_samp0, v_samp1, v_samp2; jboolean retval = JNI_FALSE; - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_decompress_ptr cinfo; struct jpeg_source_mgr *src; sun_jpeg_error_ptr jerr; @@ -1772,7 +1771,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setOutColorSpace jlong ptr, jint code) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_decompress_ptr cinfo; if (data == NULL) { @@ -1814,7 +1813,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage struct jpeg_source_mgr *src; JSAMPROW scanLinePtr = NULL; jint bands[MAX_BANDS]; - int i, j; + int i; jint *body; int scanlineLimit; int pixelStride; @@ -1824,14 +1823,12 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage pixelBufferPtr pb; sun_jpeg_error_ptr jerr; boolean done; - jint *bandSize; - int maxBandValue, halfMaxBandValue; boolean mustScale = FALSE; boolean progressive = FALSE; boolean orderedBands = TRUE; - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_decompress_ptr cinfo; - unsigned int numBytes; + size_t numBytes; /* verify the inputs */ @@ -1849,7 +1846,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage cinfo = (j_decompress_ptr) data->jpegObj; - if ((numBands < 1) || + if ((numBands < 1) || (numBands > MAX_BANDS) || (sourceXStart < 0) || (sourceXStart >= (jint)cinfo->image_width) || (sourceYStart < 0) || (sourceYStart >= (jint)cinfo->image_height) || (sourceWidth < 1) || (sourceWidth > (jint)cinfo->image_width) || @@ -1863,10 +1860,10 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage return JNI_FALSE; } - if (stepX > cinfo->image_width) { + if (stepX > (jint)cinfo->image_width) { stepX = cinfo->image_width; } - if (stepY > cinfo->image_height) { + if (stepY > (jint)cinfo->image_height) { stepY = cinfo->image_height; } @@ -2119,7 +2116,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead jobject this, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); if (data == NULL) { JNU_ThrowByName(env, @@ -2137,7 +2134,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState (JNIEnv *env, jobject this, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_decompress_ptr cinfo; if (data == NULL) { @@ -2159,7 +2156,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetReader jobject this, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_decompress_ptr cinfo; sun_jpeg_error_ptr jerr; @@ -2232,7 +2229,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_disposeReader jclass reader, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_common_ptr info = destroyImageioData(env, data); imageio_dispose(info); @@ -2317,8 +2314,8 @@ imageio_term_destination (j_compress_ptr cinfo) JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); /* find out how much needs to be written */ - jint datacount = sb->bufferLength - dest->free_in_buffer; - + /* this conversion from size_t to jint is safe, because the lenght of the buffer is limited by jint */ + jint datacount = (jint)(sb->bufferLength - dest->free_in_buffer); if (datacount != 0) { RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); @@ -2485,7 +2482,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter imageio_dispose((j_common_ptr)cinfo); return 0; } - return (jlong) ret; + return ptr_to_jlong(ret); } JNIEXPORT void JNICALL @@ -2495,7 +2492,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest jlong ptr, jobject destination) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_compress_ptr cinfo; if (data == NULL) { @@ -2526,7 +2523,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables struct jpeg_destination_mgr *dest; sun_jpeg_error_ptr jerr; - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_compress_ptr cinfo; if (data == NULL) { @@ -2625,10 +2622,11 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage jint *scanData; jint *bandSize; int maxBandValue, halfMaxBandValue; - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_compress_ptr cinfo; UINT8** scale = NULL; + /* verify the inputs */ if (data == NULL) { @@ -2740,6 +2738,16 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage buffer); JNU_ThrowByName(env, "javax/imageio/IIOException", buffer); } + + if (scale != NULL) { + for (i = 0; i < numBands; i++) { + if (scale[i] != NULL) { + free(scale[i]); + } + } + free(scale); + } + free(scanLinePtr); return data->abortFlag; } @@ -2953,7 +2961,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_abortWrite jobject this, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); if (data == NULL) { JNU_ThrowByName(env, @@ -2970,7 +2978,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_resetWriter (JNIEnv *env, jobject this, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_compress_ptr cinfo; if (data == NULL) { @@ -3002,7 +3010,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_disposeWriter jclass writer, jlong ptr) { - imageIODataPtr data = (imageIODataPtr) ptr; + imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr); j_common_ptr info = destroyImageioData(env, data); imageio_dispose(info); diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c b/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c index e52661f6645..eeb9b64fd1e 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c @@ -1325,14 +1325,14 @@ jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, unsigned int length_limit) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - long maxlength; + size_t maxlength; jpeg_marker_parser_method processor; /* Length limit mustn't be larger than what we can allocate * (should only be a concern in a 16-bit environment). */ maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct); - if (((long) length_limit) > maxlength) + if (length_limit > maxlength) length_limit = (unsigned int) maxlength; /* Choose processor routine to use. diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c b/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c index 778a1f186f7..5ee681333c1 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c @@ -133,7 +133,7 @@ typedef struct { jvirt_barray_ptr virt_barray_list; /* This counts total space obtained from jpeg_get_small/large */ - long total_space_allocated; + size_t total_space_allocated; /* alloc_sarray and alloc_barray set this value for use by virtual * array routines. @@ -588,8 +588,8 @@ realize_virt_arrays (j_common_ptr cinfo) /* Allocate the in-memory buffers for any unrealized virtual arrays */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; - long space_per_minheight, maximum_space, avail_mem; - long minheights, max_minheights; + size_t space_per_minheight, maximum_space, avail_mem; + size_t minheights, max_minheights; jvirt_sarray_ptr sptr; jvirt_barray_ptr bptr; @@ -1032,7 +1032,7 @@ GLOBAL(void) jinit_memory_mgr (j_common_ptr cinfo) { my_mem_ptr mem; - long max_to_use; + size_t max_to_use; int pool; size_t test_mac; @@ -1109,8 +1109,10 @@ jinit_memory_mgr (j_common_ptr cinfo) if ((memenv = getenv("JPEGMEM")) != NULL) { char ch = 'x'; + unsigned int mem_max = 0u; - if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) { + if (sscanf(memenv, "%u%c", &mem_max, &ch) > 0) { + max_to_use = (size_t)mem_max; if (ch == 'm' || ch == 'M') max_to_use *= 1000L; mem->pub.max_memory_to_use = max_to_use * 1000L; diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c b/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c index bf4936d02d1..884c5a16830 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c @@ -73,9 +73,9 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) * Here we always say, "we got all you want bud!" */ -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) +GLOBAL(size_t) +jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed, + size_t max_bytes_needed, size_t already_allocated) { return max_bytes_needed; } @@ -100,7 +100,7 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, * cleanup required. Here, there isn't any. */ -GLOBAL(long) +GLOBAL(size_t) jpeg_mem_init (j_common_ptr cinfo) { return 0; /* just set max_memory_to_use to 0 */ diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jmemsys.h b/jdk/src/share/native/sun/awt/image/jpeg/jmemsys.h index b427da0f352..c5c64b31886 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jmemsys.h +++ b/jdk/src/share/native/sun/awt/image/jpeg/jmemsys.h @@ -104,10 +104,10 @@ EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, * Conversely, zero may be returned to always use the minimum amount of memory. */ -EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo, - long min_bytes_needed, - long max_bytes_needed, - long already_allocated)); +EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo, + size_t min_bytes_needed, + size_t max_bytes_needed, + size_t already_allocated)); /* @@ -198,5 +198,5 @@ EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, * all opened backing-store objects have been closed. */ -EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); +EXTERN(size_t) jpeg_mem_init JPP((j_common_ptr cinfo)); EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c index d896231b5f4..2b0992b5151 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c @@ -328,7 +328,7 @@ sun_jpeg_fill_suspended_buffer(j_decompress_ptr cinfo) if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) { cinfo->err->error_exit((struct jpeg_common_struct *) cinfo); } - if (ret <= src->remaining_skip) { + if (ret < 0 || (unsigned int)ret <= src->remaining_skip) { return; } if (src->remaining_skip) { @@ -397,7 +397,7 @@ sun_jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) } num_bytes += src->remaining_skip; src->remaining_skip = 0; - ret = src->pub.bytes_in_buffer; + ret = (int)src->pub.bytes_in_buffer; /* this conversion is safe, because capacity of the buffer is limited by jnit */ if (ret >= num_bytes) { src->pub.next_input_byte += num_bytes; src->pub.bytes_in_buffer -= num_bytes; diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpeglib.h b/jdk/src/share/native/sun/awt/image/jpeg/jpeglib.h index 49c67e28935..d3821f36158 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jpeglib.h +++ b/jdk/src/share/native/sun/awt/image/jpeg/jpeglib.h @@ -800,10 +800,10 @@ struct jpeg_memory_mgr { * used for virtual-array buffers.) May be changed by outer application * after creating the JPEG object. */ - long max_memory_to_use; + size_t max_memory_to_use; /* Maximum allocation request accepted by alloc_large. */ - long max_alloc_chunk; + size_t max_alloc_chunk; }; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java index ce6ae164154..740eabac485 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java @@ -44,11 +44,27 @@ import java.awt.peer.DesktopPeer; public class XDesktopPeer implements DesktopPeer { private static boolean nativeLibraryLoaded = false; - static { - nativeLibraryLoaded = init(); + private static boolean initExecuted = false; + + private static void initWithLock(){ + XToolkit.awtLock(); + try { + if (!initExecuted) { + nativeLibraryLoaded = init(); + } + } finally { + initExecuted = true; + XToolkit.awtUnlock(); + } + } + + //package-private + XDesktopPeer(){ + initWithLock(); } static boolean isDesktopSupported() { + initWithLock(); return nativeLibraryLoaded; } @@ -83,12 +99,17 @@ public class XDesktopPeer implements DesktopPeer { } private void launch(URI uri) throws IOException { - if (!nativeLibraryLoaded) { - throw new IOException("Failed to load native libraries."); - } - byte[] uriByteArray = ( uri.toString() + '\0' ).getBytes(); - boolean result = gnome_url_show(uriByteArray); + boolean result = false; + XToolkit.awtLock(); + try { + if (!nativeLibraryLoaded) { + throw new IOException("Failed to load native libraries."); + } + result = gnome_url_show(uriByteArray); + } finally { + XToolkit.awtUnlock(); + } if (!result) { throw new IOException("Failed to show URI:" + uri); } diff --git a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java index 0491e719c59..f09d0f3de4f 100644 --- a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java +++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java @@ -479,8 +479,7 @@ public abstract class XRSurfaceData extends XSurfaceData { if (xrpipe == null) { try { SunToolkit.awtLock(); - xgc = renderQueue.createGC(xid); // TODO: GC leak? where to - // clean up? + xgc = XCreateGC(getNativeOps()); xrpipe = new XRRenderer(maskBuffer.getMaskBuffer()); xrtxpipe = new PixelToShapeConverter(xrpipe); diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java index 7bb58c73638..21c69ae4f4c 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java @@ -136,7 +136,7 @@ class UnixChannelFactory { throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed"); FileDescriptor fdObj = open(dfd, path, pathForPermissionCheck, flags, mode); - return FileChannelImpl.open(fdObj, flags.read, flags.write, null); + return FileChannelImpl.open(fdObj, flags.read, flags.write, flags.append, null); } /** diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index 7b1d717008f..1a715ca1369 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -595,15 +595,16 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, } XImage* X11SD_GetSharedImage(X11SDOps *xsdo, jint width, jint height, - jboolean readBits) + jint maxWidth, jint maxHeight, jboolean readBits) { XImage * retImage = NULL; if (cachedXImage != NULL && - X11SD_CachedXImageFits(width, height, xsdo->depth, readBits)) { - /* sync so previous data gets flushed */ - XSync(awt_display, False); - retImage = cachedXImage; - cachedXImage = (XImage *)NULL; + X11SD_CachedXImageFits(width, height, maxWidth, maxHeight, + xsdo->depth, readBits)) { + /* sync so previous data gets flushed */ + XSync(awt_display, False); + retImage = cachedXImage; + cachedXImage = (XImage *)NULL; } else if (width * height * xsdo->depth > 0x10000) { retImage = X11SD_CreateSharedImage(xsdo, width, height); } @@ -728,8 +729,8 @@ void X11SD_UnPuntPixmap(X11SDOps *xsdo) * it must be close enough to avoid excessive reading from the screen; * otherwise it should just be at least the size requested. */ -jboolean X11SD_CachedXImageFits(jint width, jint height, jint depth, - jboolean readBits) +jboolean X11SD_CachedXImageFits(jint width, jint height, jint maxWidth, + jint maxHeight, jint depth, jboolean readBits) { /* we assume here that the cached image exists */ jint imgWidth = cachedXImage->width; @@ -747,10 +748,14 @@ jboolean X11SD_CachedXImageFits(jint width, jint height, jint depth, return JNI_TRUE; } - if ((imgWidth < width + 64) && (imgHeight < height + 64)) { + if ((imgWidth < width + 64) && (imgHeight < height + 64) + && imgWidth <= maxWidth && imgHeight <= maxHeight) + { /* Cached image's width/height shouldn't be more than 64 pixels * larger than requested, because the region in XShmGetImage * can't be specified and we don't want to read too much. + * Furthermore it has to be smaller than maxWidth/Height + * so drawables are not read out of bounds. */ return JNI_TRUE; } @@ -1295,7 +1300,7 @@ static XImage * X11SD_GetImage(JNIEnv *env, X11SDOps *xsdo, SurfaceDataBounds *bounds, jint lockFlags) { - int x, y, w, h; + int x, y, w, h, maxWidth, maxHeight; int scan; XImage * img = NULL; Drawable drawable; @@ -1311,10 +1316,31 @@ static XImage * X11SD_GetImage(JNIEnv *env, X11SDOps *xsdo, #ifdef MITSHM if (useMitShmExt == CAN_USE_MITSHM) { - if (xsdo->isPixmap && readBits) { - X11SD_PuntPixmap(xsdo, w, h); + if (xsdo->isPixmap) { + if (readBits) { + X11SD_PuntPixmap(xsdo, w, h); + } + maxWidth = xsdo->pmWidth; + maxHeight = xsdo->pmHeight; + } else { + XWindowAttributes winAttr; + if (XGetWindowAttributes(awt_display, + (Window) xsdo->drawable, &winAttr) != 0) { + maxWidth = winAttr.width; + maxHeight = winAttr.height; + } else { + /* XGWA failed which isn't a good thing. Defaulting to using + * x,y means that after the subtraction of these we will use + * w=0, h=0 which is a reasonable default on such a failure. + */ + maxWidth = x; + maxHeight = y; + } } - img = X11SD_GetSharedImage(xsdo, w, h, readBits); + maxWidth -= x; + maxHeight -= y; + + img = X11SD_GetSharedImage(xsdo, w, h, maxWidth, maxHeight, readBits); } #endif /* MITSHM */ drawable = xsdo->drawable; diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h index 818688e31e7..104d7b1021a 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h +++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h @@ -125,15 +125,21 @@ struct _X11SDOps { #define X11SD_LOCK_BY_SHMEM 4 /* surface locked by ShMemExt */ #ifdef MITSHM -XImage * X11SD_GetSharedImage (X11SDOps *xsdo, jint width, jint height, jboolean readBits); +XImage * X11SD_GetSharedImage (X11SDOps *xsdo, + jint width, jint height, + jint maxWidth, jint maxHeight, + jboolean readBits); XImage * X11SD_CreateSharedImage (X11SDOps *xsdo, jint width, jint height); Drawable X11SD_CreateSharedPixmap (X11SDOps *xsdo); void X11SD_DropSharedSegment (XShmSegmentInfo *shminfo); void X11SD_PuntPixmap (X11SDOps *xsdo, jint width, jint height); void X11SD_UnPuntPixmap (X11SDOps *xsdo); -jboolean X11SD_CachedXImageFits (jint width, jint height, jint depth, jboolean readBits); +jboolean X11SD_CachedXImageFits (jint width, jint height, + jint maxWidth, jint maxHeight, + jint depth, jboolean readBits); XImage * X11SD_GetCachedXImage (jint width, jint height, jboolean readBits); #endif /* MITSHM */ +jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo); void X11SD_DisposeOrCacheXImage (XImage * image); void X11SD_DisposeXImage(XImage * image); void X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo); diff --git a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c index d9f9be2bf1c..69b9207bc99 100644 --- a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c +++ b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c @@ -48,9 +48,15 @@ int init(){ } dlerror(); /* Clear errors */ gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init"); + if (gnome_vfs_init == NULL){ +#ifdef INTERNAL_BUILD + fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n"); +#endif + return 0; + } if ((errmsg = dlerror()) != NULL) { #ifdef INTERNAL_BUILD - fprintf(stderr, "can not find symble gnome_vfs_init\n"); + fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg); #endif return 0; } diff --git a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java index d2700a1c91d..180341f20f3 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java +++ b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java @@ -51,9 +51,12 @@ import java.awt.image.ColorModel; import java.awt.image.DataBuffer; import java.awt.image.IndexColorModel; import java.awt.image.WritableRaster; +import java.awt.image.ComponentSampleModel; +import java.awt.image.MultiPixelPackedSampleModel; +import java.awt.image.SampleModel; + import sun.awt.image.ByteComponentRaster; import sun.awt.image.BytePackedRaster; - import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; @@ -1272,6 +1275,25 @@ class WPathGraphics extends PathGraphics { return false; } + int bitsPerPixel = 24; + SampleModel sm = deepImage.getSampleModel(); + if (sm instanceof ComponentSampleModel) { + ComponentSampleModel csm = (ComponentSampleModel)sm; + bitsPerPixel = csm.getPixelStride() * 8; + } else if (sm instanceof MultiPixelPackedSampleModel) { + MultiPixelPackedSampleModel mppsm = + (MultiPixelPackedSampleModel)sm; + bitsPerPixel = mppsm.getPixelBitStride(); + } else { + if (icm != null) { + int diw = deepImage.getWidth(); + int dih = deepImage.getHeight(); + if (diw > 0 && dih > 0) { + bitsPerPixel = data.length*8/diw/dih; + } + } + } + /* Because the caller's image has been rotated * and sheared into our BufferedImage and because * we will be handing that BufferedImage directly to @@ -1289,7 +1311,7 @@ class WPathGraphics extends PathGraphics { (float)Math.rint(scaledBounds.height+0.5), 0f, 0f, deepImage.getWidth(), deepImage.getHeight(), - icm); + bitsPerPixel, icm); setClip(holdClip); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java index b73a1b51517..cf629bb0ae8 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java @@ -1212,13 +1212,14 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget { float destWidth, float destHeight, float srcX, float srcY, float srcWidth, float srcHeight, + int sampleBitsPerPixel, IndexColorModel icm) { int bitCount = 24; byte[] bmiColors = null; if (icm != null) { - bitCount = icm.getPixelSize(); - bmiColors = new byte[(1<GetDC(env, dstOps, 0, NULL, clip, NULL, 0); + if (hDC == NULL) { + SurfaceData_InvokeUnlock(env, srcOps, &srcInfo); + return; + } srcOps->GetRasInfo(env, srcOps, &srcInfo); if (srcInfo.rasBase == NULL) { + dstOps->ReleaseDC(env, dstOps, hDC); SurfaceData_InvokeUnlock(env, srcOps, &srcInfo); return; } @@ -174,13 +182,6 @@ Java_sun_java2d_windows_GDIBlitLoops_nativeBlit bmi.colors.dwMasks[2] = bmask; } - HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0); - if (hDC == NULL) { - SurfaceData_InvokeRelease(env, srcOps, &srcInfo); - SurfaceData_InvokeUnlock(env, srcOps, &srcInfo); - return; - } - if (fastBlt) { // Window could go away at any time, leaving bits on the screen // from this GDI call, so make sure window still exists diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index f2380764a1a..46b8cc1e855 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -41,14 +41,14 @@ # # Shell tests are othervm by default. # -# List items are testnames followed by labels, all MUST BE commented +# List items are testnames followed by labels, all MUST BE commented # as to why they are here and use a label: # generic-all Problems on all platforms # generic-ARCH Where ARCH is one of: sparc, sparcv9, x64, i586, etc. # OSNAME-all Where OSNAME is one of: solaris, linux, windows # OSNAME-ARCH Specific on to one OSNAME and ARCH, e.g. solaris-x64 # OSNAME-REV Specific on to one OSNAME and REV, e.g. solaris-5.8 -# +# # More than one label is allowed but must be on the same line. # ############################################################################# @@ -234,7 +234,7 @@ javax/management/remote/mandatory/threads/ExecutorTest.java generic-all # Linux 32bit Fedora 9, IllegalStateException javax/management/monitor/RuntimeExceptionTest.java generic-all -# Problems with rmi connection, othervm +# Problems with rmi connection, othervm javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java generic-all # Fails with port already in use @@ -411,7 +411,7 @@ com/sun/nio/sctp/SctpChannel/SocketOptionTests.java com/sun/nio/sctp/SctpChannel/Send.java generic-all com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all -# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses +# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses # from a channel that is bound to the wildcard address com/sun/nio/sctp/SctpChannel/Bind.java generic-all @@ -456,10 +456,10 @@ java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all java/rmi/server/RemoteServer/AddrInUse.java generic-all # Connection error on Windows i586 -server -# Also connection errors in othervm on Solaris 10 sparc, same port??? +# Also connection errors in othervm on Solaris 10 sparc, same port??? sun/rmi/transport/tcp/DeadCachedConnection.java generic-all -# Connection errors in othervm on Solaris 10 sparc, same port??? +# Connection errors in othervm on Solaris 10 sparc, same port??? java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java generic-all java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java generic-all java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java generic-all @@ -532,7 +532,7 @@ sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586 java/security/Security/SynchronizedAccess.java generic-all # Failing on Solaris X64 (-d64 -server) with: -# GSSException: Failure unspecified at GSS-API level +# GSSException: Failure unspecified at GSS-API level # (Mechanism level: Specified version of key is not available (44)) sun/security/krb5/auto/BasicKrb5Test.java generic-all @@ -546,14 +546,14 @@ sun/security/tools/keytool/standard.sh generic-all sun/security/krb5/auto/HttpNegotiateServer.java generic-all # Fails on almost all platforms -# java.lang.UnsupportedClassVersionError: SerialTest : +# java.lang.UnsupportedClassVersionError: SerialTest : # Unsupported major.minor version 51.0 # at java.lang.ClassLoader.defineClass1(Native Method) sun/security/util/Oid/S11N.sh generic-all # Fails on Fedora 9 32bit -# GSSException: Failure unspecified at GSS-API level (Mechanism level: -# Invalid argument (400) - Cannot find key of appropriate type to decrypt +# GSSException: Failure unspecified at GSS-API level (Mechanism level: +# Invalid argument (400) - Cannot find key of appropriate type to decrypt # AP REP - DES CBC mode with MD5) # at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778) sun/security/krb5/auto/NonMutualSpnego.java generic-all @@ -673,7 +673,7 @@ sun/security/rsa/TestSignatures.java solaris-all # Timeout on solaris-sparc and i586 and x64, -client and -server sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java solaris-all -# Do not seem to run on windows machines? dll missing? +# Do not seem to run on windows machines? dll missing? sun/security/tools/jarsigner/emptymanifest.sh windows-all # Files does not exist or no encoding? solaris-sparcv9 @@ -734,8 +734,5 @@ java/util/concurrent/FutureTask/BlockingTaskExecutor.java generic-all # Problems on windows, jmap.exe hangs? (these run jmap), fails on Solaris 10 x86 java/util/concurrent/locks/Lock/TimedAcquireLeak.java generic-all -# Fails on solaris-sparc -server (Set not equal to copy. 1) -java/util/EnumSet/EnumSetBash.java solaris-sparc - ############################################################################ diff --git a/jdk/test/demo/zipfs/ZipFSTester.java b/jdk/test/demo/zipfs/ZipFSTester.java index 14aebbdf685..4969c21f361 100644 --- a/jdk/test/demo/zipfs/ZipFSTester.java +++ b/jdk/test/demo/zipfs/ZipFSTester.java @@ -105,6 +105,18 @@ public class ZipFSTester { os.write(bits); os.close(); + try { + provider.newFileSystem(new File(System.getProperty("test.src", ".")).toPath(), + new HashMap()); + throw new RuntimeException("newFileSystem() opens a directory as zipfs"); + } catch (UnsupportedOperationException uoe) {} + + try { + provider.newFileSystem(src, new HashMap()); + throw new RuntimeException("newFileSystem() opens a non-zip file as zipfs"); + } catch (UnsupportedOperationException uoe) {} + + // copyin Path dst = getPathWithParents(fs, tmpName); Files.copy(src, dst); diff --git a/jdk/test/demo/zipfs/basic.sh b/jdk/test/demo/zipfs/basic.sh index 832a75d4fb4..06353dfa761 100644 --- a/jdk/test/demo/zipfs/basic.sh +++ b/jdk/test/demo/zipfs/basic.sh @@ -21,7 +21,7 @@ # questions. # # @test -# @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 +# @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596 # @summary Test ZipFileSystem demo # @build Basic PathOps ZipFSTester # @run shell basic.sh diff --git a/jdk/test/java/awt/PrintJob/Text/StringWidth.java b/jdk/test/java/awt/PrintJob/Text/StringWidth.java index 4c2250a21dd..e16229eba27 100644 --- a/jdk/test/java/awt/PrintJob/Text/StringWidth.java +++ b/jdk/test/java/awt/PrintJob/Text/StringWidth.java @@ -63,7 +63,8 @@ public class StringWidth extends Frame { } public static void main(String[] args) { - new StringWidth(); + StringWidth sw = new StringWidth(); + sw.dispose(); } } diff --git a/jdk/test/java/awt/font/StyledMetrics/BoldSpace.java b/jdk/test/java/awt/font/StyledMetrics/BoldSpace.java new file mode 100644 index 00000000000..bbdff5feebe --- /dev/null +++ b/jdk/test/java/awt/font/StyledMetrics/BoldSpace.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 6686365 7017637 + @summary Confirm that styling does not affect metrics of zero advance glyphs +*/ + +import java.awt.*; +import java.awt.image.*; + +public class BoldSpace { + public static void main(String[] s) { + BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); + + String errMsg = "ZWJ Space char should have 0 advance\n"; + + Graphics g = bi.getGraphics(); + + // It turns out that some fonts inexplicably treat this as + // a standard character. In this 14 pt font, if we see an advance + // that's clearly bigger than we'd have introduced in bolding we'll + // not error out this test, presuming that its a consequence of + // the actual font data. A Linux font 'TLwg Type Bold' is the case + // in point. + int errorMargin = 4; + g.setFont(new Font("monospaced", Font.BOLD, 14)); + //g.setFont(new Font("Lucida Sans Regular", Font.BOLD, 14)); + FontMetrics fm = g.getFontMetrics(); + System.out.println("Bold: " + fm.charWidth('\u200b')); + int cwid = fm.charWidth('\u200b'); + if (cwid > 0 && cwid < errorMargin) { + throw new RuntimeException(errMsg); + } + + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + fm = g.getFontMetrics(); + System.out.println("Bold + LCD: "+fm.charWidth('\u200b')); + cwid = fm.charWidth('\u200b'); + if (cwid > 0 && cwid < errorMargin) { + throw new RuntimeException(errMsg); + } + + + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_ON); + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + fm = g.getFontMetrics(); + System.out.println("Bold FM OFF + AA: " + fm.charWidth('\u200b')); + cwid = fm.charWidth('\u200b'); + if (cwid > 0 && cwid < errorMargin) { + throw new RuntimeException(errMsg); + } + + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + fm = g.getFontMetrics(); + System.out.println("Bold FM ON + AA: " + fm.charWidth('\u200b')); + cwid = fm.charWidth('\u200b'); + if (cwid > 0 && cwid < errorMargin) { + throw new RuntimeException(errMsg); + } + + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_ON); + ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + fm = g.getFontMetrics(); + System.out.println("Bold FM ON + nonAA: " + fm.charWidth('\u200b')); + cwid = fm.charWidth('\u200b'); + if (cwid > 0 && cwid < errorMargin) { + throw new RuntimeException(errMsg); + } + + System.out.println("All printed values should be 0 to PASS"); + } +} diff --git a/jdk/test/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java b/jdk/test/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java new file mode 100644 index 00000000000..b8536c09e9c --- /dev/null +++ b/jdk/test/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * + * @test + * @bug 4521945 7006865 + * @summary Test printing images of different types. + * @author prr + * @run main/manual=yesno/timeout=900 ImageTypes + */ + +import java.io.*; +import static java.awt.Color.*; +import java.awt.*; +import java.awt.geom.*; +import java.awt.event.*; +import java.awt.print.*; +import java.awt.image.*; +import static java.awt.image.BufferedImage.*; +import javax.print.*; +import javax.print.attribute.*; +import javax.print.attribute.standard.*; + +public class ImageTypes extends Frame implements ActionListener { + + private ImageCanvas c; + + public static void main(String args[]) { + + ImageTypes f = new ImageTypes(); + f.show(); + } + + public ImageTypes () { + super("Image Types Printing Test"); + c = new ImageCanvas(); + add("Center", c); + + Button printThisButton = new Button("Print"); + printThisButton.addActionListener(this); + Panel p = new Panel(); + p.add(printThisButton); + add("South", p); + add("North", getInstructions()); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + + pack(); + } + + private TextArea getInstructions() { + TextArea ta = new TextArea(10, 60); + ta.setFont(new Font("Dialog", Font.PLAIN, 11)); + ta.setText + ("This is a manual test as it requires that you compare "+ + "the on-screen rendering with the printed output.\n"+ + "Select the 'Print' button to print out the test.\n"+ + "For each image compare the printed one to the on-screen one.\n"+ + "The test PASSES if the onscreen and printed rendering match."); + return ta; + } + + public void actionPerformed(ActionEvent e) { + PrinterJob pj = PrinterJob.getPrinterJob(); + + PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet(); + if (pj != null && pj.printDialog(attrs)) { + pj.setPrintable(c); + try { + pj.print(attrs); + } catch (PrinterException pe) { + pe.printStackTrace(); + throw new RuntimeException("Exception whilst printing."); + } finally { + System.out.println("PRINT RETURNED OK."); + } + } + } +} + +class ImageCanvas extends Component implements Printable { + + IndexColorModel icm2 = null; + IndexColorModel icm4 = null; + BufferedImage opaqueImg = null; + BufferedImage transImg = null; + int sw=99, sh=99; + + void paintImage(BufferedImage bi, Color c1, Color c2) { + + GradientPaint tp= new GradientPaint(0.0f, 0.0f, c1, 10f, 8f, c2, true); + Graphics2D g2d = (Graphics2D)bi.getGraphics(); + g2d.setPaint(tp); + g2d.fillRect(0, 0, sw, sh); + g2d.setColor(gray); + int cnt=0; + Font font = new Font("Serif", Font.PLAIN, 11); + g2d.setFont(font); + FontMetrics fm = g2d.getFontMetrics(); + for (int y=12;y 0) { + return Printable.NO_SUCH_PAGE; + } + Graphics2D g2d = (Graphics2D)g; + g2d.translate(pgFmt.getImageableX(), pgFmt.getImageableY()); + paint(g2d); + return Printable.PAGE_EXISTS; + } + + private void drawImage(Graphics g, int biType, IndexColorModel icm) { + + BufferedImage bi; + if (icm != null) { + bi = new BufferedImage(sw, sh, biType, icm); + } else { + bi = new BufferedImage(sw, sh, biType); + } + + Graphics big = bi.getGraphics(); + if (bi.getColorModel().getPixelSize() <=2) { + big.drawImage(opaqueImg, 0, 0, null); + } else { + big.drawImage(transImg, 0, 0, null); + } + g.drawImage(bi, 0, 0, null); + } + + public void paint(Graphics g) { + + int incX = sw+10, incY = sh+10; + + g.translate(10, 10); + + drawImage(g, TYPE_INT_RGB, null); + g.translate(incX, 0); + + drawImage(g, TYPE_INT_BGR, null); + g.translate(incX, 0); + + drawImage(g, TYPE_INT_ARGB, null); + g.translate(incX, 0); + + drawImage(g, TYPE_INT_ARGB_PRE, null); + g.translate(-3*incX, incY); + + drawImage(g, TYPE_3BYTE_BGR, null); + g.translate(incX, 0); + + drawImage(g, TYPE_4BYTE_ABGR, null); + g.translate(incX, 0); + + drawImage(g, TYPE_4BYTE_ABGR_PRE, null); + g.translate(incX, 0); + + drawImage(g, TYPE_USHORT_555_RGB, null); + g.translate(-3*incX, incY); + + drawImage(g, TYPE_USHORT_555_RGB, null); + g.translate(incX, 0); + + drawImage(g, TYPE_USHORT_GRAY, null); + g.translate(incX, 0); + + drawImage(g, TYPE_BYTE_GRAY, null); + g.translate(incX, 0); + + drawImage(g, TYPE_BYTE_INDEXED, null); + g.translate(-3*incX, incY); + + drawImage(g, TYPE_BYTE_BINARY, null); + g.translate(incX, 0); + + drawImage(g, TYPE_BYTE_BINARY, icm2); + g.translate(incX, 0); + + drawImage(g, TYPE_BYTE_BINARY, icm4); + g.translate(incX, 0); + + drawImage(g, TYPE_BYTE_INDEXED, icm2); + g.translate(-3*incX, incY); + + drawImage(g, TYPE_BYTE_INDEXED, icm4); + g.translate(incX, 0); + } + + + + /* Size is chosen to match default imageable width of a NA letter + * page. This means there will be clipping, what is clipped will + * depend on PageFormat orientation. + */ + public Dimension getPreferredSize() { + return new Dimension(468, 600); + } + +} diff --git a/jdk/test/java/lang/Thread/StopBeforeStart.java b/jdk/test/java/lang/Thread/StopBeforeStart.java deleted file mode 100644 index 91b62597cb6..00000000000 --- a/jdk/test/java/lang/Thread/StopBeforeStart.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * 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 4519200 - * @summary Confirm a Thread.stop before start complies with the spec - * @author Pete Soper - * - * Confirm that a thread that had its stop method invoked before start - * does properly terminate with expected exception behavior. NOTE that - * arbitrary application threads could return from their run methods faster - * than the VM can throw an async exception. - */ -public class StopBeforeStart { - - private static final int JOIN_TIMEOUT=10000; - - private class MyThrowable extends Throwable { - } - - private class Catcher implements Thread.UncaughtExceptionHandler { - private boolean nullaryStop; - private Throwable theThrowable; - private Throwable expectedThrowable; - private boolean exceptionThrown; - - Catcher(boolean nullaryStop) { - this.nullaryStop = nullaryStop; - if (!nullaryStop) { - expectedThrowable = new MyThrowable(); - } - } - - public void uncaughtException(Thread t, Throwable th) { - exceptionThrown = true; - theThrowable = th; - } - - void check(String label) throws Throwable { - if (!exceptionThrown) { - throw new RuntimeException(label + - " test:" + " missing uncaught exception"); - } - - if (nullaryStop) { - if (! (theThrowable instanceof ThreadDeath)) { - throw new RuntimeException(label + - " test:" + " expected ThreadDeath in uncaught handler"); - } - } else if (theThrowable != expectedThrowable) { - throw new RuntimeException(label + - " test:" + " wrong Throwable in uncaught handler"); - } - } - } - - private class MyRunnable implements Runnable { - public void run() { - while(true) - ; - } - } - - private class MyThread extends Thread { - public void run() { - while(true) - ; - } - } - - - public static void main(String args[]) throws Throwable { - (new StopBeforeStart()).doit(); - System.out.println("Test passed"); - } - - private void doit() throws Throwable { - - runit(false, new Thread(new MyRunnable()),"Thread"); - runit(true, new Thread(new MyRunnable()),"Thread"); - runit(false, new MyThread(),"Runnable"); - runit(true, new MyThread(),"Runnable"); - } - - private void runit(boolean nullaryStop, Thread thread, - String type) throws Throwable { - - Catcher c = new Catcher(nullaryStop); - thread.setUncaughtExceptionHandler(c); - - if (nullaryStop) { - thread.stop(); - } else { - thread.stop(c.expectedThrowable); - } - - thread.start(); - thread.join(JOIN_TIMEOUT); - - if (thread.getState() != Thread.State.TERMINATED) { - - thread.stop(); - - // Under high load this could be a false positive - throw new RuntimeException(type + - " test:" + " app thread did not terminate"); - } - - c.check(type); - } -} diff --git a/jdk/test/java/nio/channels/FileChannel/Position.java b/jdk/test/java/nio/channels/FileChannel/Position.java index dc10f27afd2..c6c674d9f4f 100644 --- a/jdk/test/java/nio/channels/FileChannel/Position.java +++ b/jdk/test/java/nio/channels/FileChannel/Position.java @@ -22,13 +22,16 @@ */ /* @test + * @bug 4429043 6526860 * @summary Test position method of FileChannel */ import java.io.*; -import java.nio.MappedByteBuffer; -import java.nio.channels.*; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.nio.file.*; +import static java.nio.file.StandardOpenOption.*; +import java.nio.charset.Charset; import java.util.Random; @@ -38,32 +41,42 @@ import java.util.Random; public class Position { - private static PrintStream err = System.err; + private static final Charset ISO8859_1 = Charset.forName("8859_1"); - private static Random generator = new Random(); - - private static int CHARS_PER_LINE = File.separatorChar == '/' ? 5 : 6; - - private static File blah; + private static final Random generator = new Random(); public static void main(String[] args) throws Exception { - blah = File.createTempFile("blah", null); - blah.deleteOnExit(); + Path blah = Files.createTempFile("blah", null); + blah.toFile().deleteOnExit(); initTestFile(blah); - FileInputStream fis = new FileInputStream(blah); - FileChannel c = fis.getChannel(); - - for(int i=0; i<100; i++) { - long newPos = generator.nextInt(1000); - c.position(newPos); - if (c.position() != newPos) - throw new RuntimeException("Position failed"); + for (int i=0; i<10; i++) { + try (FileChannel fc = (generator.nextBoolean()) ? + FileChannel.open(blah, READ) : + new FileInputStream(blah.toFile()).getChannel()) { + for (int j=0; j<100; j++) { + long newPos = generator.nextInt(1000); + fc.position(newPos); + if (fc.position() != newPos) + throw new RuntimeException("Position failed"); + } + } } - c.close(); - fis.close(); - blah.delete(); + for (int i=0; i<10; i++) { + try (FileChannel fc = (generator.nextBoolean()) ? + FileChannel.open(blah, APPEND) : + new FileOutputStream(blah.toFile(), true).getChannel()) { + for (int j=0; j<10; j++) { + if (fc.position() != fc.size()) + throw new RuntimeException("Position expected to be size"); + byte[] buf = new byte[generator.nextInt(100)]; + fc.write(ByteBuffer.wrap(buf)); + } + } + } + + Files.delete(blah); } /** @@ -78,19 +91,15 @@ public class Position { * 3999 * */ - private static void initTestFile(File blah) throws Exception { - FileOutputStream fos = new FileOutputStream(blah); - BufferedWriter awriter - = new BufferedWriter(new OutputStreamWriter(fos, "8859_1")); - - for(int i=0; i<4000; i++) { - String number = new Integer(i).toString(); - for (int h=0; h<4-number.length(); h++) - awriter.write("0"); - awriter.write(""+i); - awriter.newLine(); + private static void initTestFile(Path blah) throws IOException { + try (BufferedWriter awriter = Files.newBufferedWriter(blah, ISO8859_1)) { + for(int i=0; i<4000; i++) { + String number = new Integer(i).toString(); + for (int h=0; h<4-number.length(); h++) + awriter.write("0"); + awriter.write(""+i); + awriter.newLine(); + } } - awriter.flush(); - awriter.close(); } } diff --git a/jdk/test/java/nio/file/Files/walkFileTree/PrintFileTree.java b/jdk/test/java/nio/file/Files/walkFileTree/PrintFileTree.java index 83d554dc689..048298bcb19 100644 --- a/jdk/test/java/nio/file/Files/walkFileTree/PrintFileTree.java +++ b/jdk/test/java/nio/file/Files/walkFileTree/PrintFileTree.java @@ -54,6 +54,7 @@ public class PrintFileTree { if (followLinks) options.add(FileVisitOption.FOLLOW_LINKS); + final boolean follow = followLinks; final boolean reportCycles = printCycles; Files.walkFileTree(dir, options, Integer.MAX_VALUE, new FileVisitor() { @Override @@ -63,8 +64,7 @@ public class PrintFileTree { } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { - if (!attrs.isDirectory() || reportCycles) - System.out.println(file); + System.out.println(file); return FileVisitResult.CONTINUE; } @Override @@ -79,11 +79,13 @@ public class PrintFileTree { public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { - if (reportCycles && (exc instanceof FileSystemLoopException)) { - System.out.println(file); + if (follow && (exc instanceof FileSystemLoopException)) { + if (reportCycles) + System.out.println(file); return FileVisitResult.CONTINUE; + } else { + throw exc; } - throw exc; } }); } diff --git a/jdk/test/java/util/Hashtable/SerializationDeadlock.java b/jdk/test/java/util/Hashtable/SerializationDeadlock.java new file mode 100644 index 00000000000..c9048fb691f --- /dev/null +++ b/jdk/test/java/util/Hashtable/SerializationDeadlock.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + * ------------------------------------------- + * + * Portions Copyright (c) 2010, 2011 IBM Corporation + */ + +/* + * @test + * @bug 6927486 + * @summary Serializing Hashtable objects which refer to each other should not be able to deadlock. + * @author Neil Richards , + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.CyclicBarrier; + +public class SerializationDeadlock { + public static void main(final String[] args) throws Exception { + // Test for Hashtable serialization deadlock + final Hashtable h1 = new Hashtable<>(); + final Hashtable h2 = new Hashtable<>(); + final TestBarrier testStart = new TestBarrier(3); + + // Populate the hashtables so that they refer to each other + h1.put(testStart, h2); + h2.put(testStart, h1); + + final CyclicBarrier testEnd = new CyclicBarrier(3); + final TestThread t1 = new TestThread(h1, testEnd); + final TestThread t2 = new TestThread(h2, testEnd); + + t1.start(); + t2.start(); + + // Wait for both test threads to have initiated serialization + // of the 'testStart' object (and hence of both 'h1' and 'h2') + testStart.await(); + + // Wait for both test threads to successfully finish serialization + // of 'h1' and 'h2'. + System.out.println("Waiting for Hashtable serialization to complete ..."); + System.out.println("(This test will hang if serialization deadlocks)"); + testEnd.await(); + System.out.println("Test PASSED: serialization completed successfully"); + + TestThread.handleExceptions(); + } + + static final class TestBarrier extends CyclicBarrier + implements Serializable { + public TestBarrier(final int count) { + super(count); + } + + private void writeObject(final ObjectOutputStream oos) + throws IOException { + oos.defaultWriteObject(); + // Wait until all test threads have started serializing data + try { + await(); + } catch (final Exception e) { + throw new IOException("Test ERROR: Unexpected exception caught", e); + } + } + } + + static final class TestThread extends Thread { + private static final List exceptions = new ArrayList<>(); + + private final Hashtable hashtable; + private final CyclicBarrier testEnd; + + public TestThread(final Hashtable hashtable, + final CyclicBarrier testEnd) { + this.hashtable = hashtable; + this.testEnd = testEnd; + setDaemon(true); + } + + public void run() { + try { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + + oos.writeObject(hashtable); + oos.close(); + } catch (final IOException ioe) { + addException(ioe); + } finally { + try { + testEnd.await(); + } catch (Exception e) { + addException(e); + } + } + } + + private static synchronized void addException(final Exception exception) { + exceptions.add(exception); + } + + public static synchronized void handleExceptions() { + if (false == exceptions.isEmpty()) { + throw new RuntimeException(getErrorText(exceptions)); + } + } + + private static String getErrorText(final List exceptions) { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + + pw.println("Test ERROR: Unexpected exceptions thrown on test threads:"); + for (Exception exception : exceptions) { + pw.print("\t"); + pw.println(exception); + for (StackTraceElement element : exception.getStackTrace()) { + pw.print("\t\tat "); + pw.println(element); + } + } + + pw.close(); + return sw.toString(); + } + } +} + diff --git a/jdk/test/java/util/Hashtable/SimpleSerialization.java b/jdk/test/java/util/Hashtable/SimpleSerialization.java new file mode 100644 index 00000000000..257cf105b57 --- /dev/null +++ b/jdk/test/java/util/Hashtable/SimpleSerialization.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + * ------------------------------------------- + * + * Portions Copyright (c) 2010, 2011 IBM Corporation + */ + +/* + * @test + * @bug 6927486 + * @summary A serialized Hashtable can be de-serialized properly. + * @author Neil Richards , + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Hashtable; + +public class SimpleSerialization { + public static void main(final String[] args) throws Exception { + Hashtable h1 = new Hashtable<>(); + + h1.put("key", "value"); + + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + + oos.writeObject(h1); + oos.close(); + + final byte[] data = baos.toByteArray(); + final ByteArrayInputStream bais = new ByteArrayInputStream(data); + final ObjectInputStream ois = new ObjectInputStream(bais); + + final Object deserializedObject = ois.readObject(); + ois.close(); + + if (false == h1.equals(deserializedObject)) { + throw new RuntimeException(getFailureText(h1, deserializedObject)); + } + } + + private static String getFailureText(final Object orig, final Object copy) { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + + pw.println("Test FAILED: Deserialized object is not equal to the original object"); + pw.print("\tOriginal: "); + printObject(pw, orig).println(); + pw.print("\tCopy: "); + printObject(pw, copy).println(); + + pw.close(); + return sw.toString(); + } + + private static PrintWriter printObject(final PrintWriter pw, final Object o) { + pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o)); + return pw; + } +} diff --git a/jdk/test/java/util/TimeZone/DaylightTimeTest.java b/jdk/test/java/util/TimeZone/DaylightTimeTest.java new file mode 100644 index 00000000000..4b637136f96 --- /dev/null +++ b/jdk/test/java/util/TimeZone/DaylightTimeTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6936350 + * @summary Test case for TimeZone.observesDaylightTime() + */ + +import java.util.*; +import static java.util.GregorianCalendar.*; + +public class DaylightTimeTest { + private static final int ONE_HOUR = 60 * 60 * 1000; // one hour + private static final int INTERVAL = 24 * ONE_HOUR; // one day + private static final String[] ZONES = TimeZone.getAvailableIDs(); + private static int errors = 0; + + public static void main(String[] args) { + + // Test default TimeZone + for (String id : ZONES) { + TimeZone tz = TimeZone.getTimeZone(id); + long now = System.currentTimeMillis(); + boolean observes = tz.observesDaylightTime(); + boolean found = findDSTTransition(tz, now); + if (observes != found) { + // There's a critical section. If DST ends after the + // System.currentTimeMills() call, there should be + // inconsistency in the determination. Try the same + // thing again to see the inconsistency was due to the + // critical section. + now = System.currentTimeMillis(); + observes = tz.observesDaylightTime(); + found = findDSTTransition(tz, now); + if (observes != found) { + System.err.printf("%s: observesDaylightTime() should return %s at %d%n", + tz.getID(), found, now); + errors++; + } + } + } + + // Test SimpleTimeZone in which observesDaylightTime() is + // equivalent to useDaylightTime(). + testSimpleTimeZone(new SimpleTimeZone(-8*ONE_HOUR, "X", + APRIL, 1, -SUNDAY, 2*ONE_HOUR, + OCTOBER, -1, SUNDAY, 2*ONE_HOUR, + 1*ONE_HOUR)); + testSimpleTimeZone(new SimpleTimeZone(-8*ONE_HOUR, "Y")); + + if (errors > 0) { + throw new RuntimeException("DaylightTimeTest: failed"); + } + } + + /** + * Returns true if it's `now' in DST or there's any + * standard-to-daylight transition within 50 years after `now'. + */ + private static boolean findDSTTransition(TimeZone tz, long now) { + GregorianCalendar cal = new GregorianCalendar(tz, Locale.US); + cal.setTimeInMillis(now); + cal.add(YEAR, 50); + long end = cal.getTimeInMillis(); + + for (long t = now; t < end; t += INTERVAL) { + cal.setTimeInMillis(t); + if (cal.get(DST_OFFSET) > 0) { + return true; + } + } + return false; + } + + private static void testSimpleTimeZone(SimpleTimeZone stz) { + if (stz.useDaylightTime() != stz.observesDaylightTime()) { + System.err.printf("Failed: useDaylightTime=%b, observesDaylightTime()=%b%n\t%s%n", + stz.useDaylightTime(),stz.observesDaylightTime(), stz); + errors++; + } + } +} diff --git a/jdk/test/java/util/Vector/SerializationDeadlock.java b/jdk/test/java/util/Vector/SerializationDeadlock.java new file mode 100644 index 00000000000..dd4471e0304 --- /dev/null +++ b/jdk/test/java/util/Vector/SerializationDeadlock.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2010, 2011 IBM Corporation + */ + +/* + * @test + * @bug 6934356 + * @summary Serializing Vector objects which refer to each other should not be able to deadlock. + * @author Neil Richards , + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; +import java.util.concurrent.CyclicBarrier; + +public class SerializationDeadlock { + public static void main(final String[] args) throws Exception { + // Test for Vector serialization deadlock + final Vector v1 = new Vector<>(); + final Vector v2 = new Vector<>(); + final TestBarrier testStart = new TestBarrier(3); + + // Populate the vectors so that they refer to each other + v1.add(testStart); + v1.add(v2); + v2.add(testStart); + v2.add(v1); + + final CyclicBarrier testEnd = new CyclicBarrier(3); + final TestThread t1 = new TestThread(v1, testEnd); + final TestThread t2 = new TestThread(v2, testEnd); + + t1.start(); + t2.start(); + + // Wait for both test threads to have initiated serialization + // of the 'testStart' object (and hence of both 'v1' and 'v2') + testStart.await(); + + // Wait for both test threads to successfully finish serialization + // of 'v1' and 'v2'. + System.out.println("Waiting for Vector serialization to complete ..."); + System.out.println("(This test will hang if serialization deadlocks)"); + testEnd.await(); + System.out.println("Test PASSED: serialization completed successfully"); + + TestThread.handleExceptions(); + } + + static final class TestBarrier extends CyclicBarrier + implements Serializable { + public TestBarrier(final int count) { + super(count); + } + + private void writeObject(final ObjectOutputStream oos) + throws IOException { + oos.defaultWriteObject(); + // Wait until all test threads have started serializing data + try { + await(); + } catch (final Exception e) { + throw new IOException("Test ERROR: Unexpected exception caught", e); + } + } + } + + static final class TestThread extends Thread { + private static final List exceptions = new ArrayList<>(); + + private final Vector vector; + private final CyclicBarrier testEnd; + + public TestThread(final Vector vector, final CyclicBarrier testEnd) { + this.vector = vector; + this.testEnd = testEnd; + setDaemon(true); + } + + public void run() { + try { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + + oos.writeObject(vector); + oos.close(); + } catch (final IOException ioe) { + addException(ioe); + } finally { + try { + testEnd.await(); + } catch (Exception e) { + addException(e); + } + } + } + + private static synchronized void addException(final Exception exception) { + exceptions.add(exception); + } + + public static synchronized void handleExceptions() { + if (false == exceptions.isEmpty()) { + throw new RuntimeException(getErrorText(exceptions)); + } + } + + private static String getErrorText(final List exceptions) { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + + pw.println("Test ERROR: Unexpected exceptions thrown on test threads:"); + for (Exception exception : exceptions) { + pw.print("\t"); + pw.println(exception); + for (StackTraceElement element : exception.getStackTrace()) { + pw.print("\t\tat "); + pw.println(element); + } + } + + pw.close(); + return sw.toString(); + } + } +} + diff --git a/jdk/test/java/util/Vector/SimpleSerialization.java b/jdk/test/java/util/Vector/SimpleSerialization.java new file mode 100644 index 00000000000..f7fe2e6199f --- /dev/null +++ b/jdk/test/java/util/Vector/SimpleSerialization.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2010, 2011 IBM Corporation + */ + +/* + * @test + * @bug 6934356 + * @summary A serialized Vector can be successfully de-serialized. + * @author Neil Richards , + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Vector; + +public class SimpleSerialization { + public static void main(final String[] args) throws Exception { + final Vector v1 = new Vector<>(); + + v1.add("entry1"); + v1.add("entry2"); + + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); + + oos.writeObject(v1); + oos.close(); + + final byte[] data = baos.toByteArray(); + final ByteArrayInputStream bais = new ByteArrayInputStream(data); + final ObjectInputStream ois = new ObjectInputStream(bais); + + final Object deserializedObject = ois.readObject(); + ois.close(); + + if (false == v1.equals(deserializedObject)) { + throw new RuntimeException(getFailureText(v1, deserializedObject)); + } + } + + private static String getFailureText(final Object orig, final Object copy) { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + + pw.println("Test FAILED: Deserialized object is not equal to the original object"); + pw.print("\tOriginal: "); + printObject(pw, orig).println(); + pw.print("\tCopy: "); + printObject(pw, copy).println(); + + pw.close(); + return sw.toString(); + } + + private static PrintWriter printObject(final PrintWriter pw, final Object o) { + pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o)); + return pw; + } +} diff --git a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java index 34f0722d8bd..755ff9c2d97 100644 --- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java +++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java @@ -124,11 +124,11 @@ public class CancelledProducerConsumerLoops { oneRun(new ArrayBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingDeque(CAPACITY), pairs, iters); - oneRun(new LinkedTransferQueue(), pairs, iters); oneRun(new SynchronousQueue(), pairs, iters / 8); - /* PriorityBlockingQueue is unbounded + /* unbounded queue implementations are prone to OOME oneRun(new PriorityBlockingQueue(iters / 2 * pairs), pairs, iters / 4); + oneRun(new LinkedTransferQueue(), pairs, iters); */ } diff --git a/jdk/test/javax/print/attribute/ServiceDialogTest.java b/jdk/test/javax/print/attribute/ServiceDialogTest.java index e5b6d2d969b..184c8c0687c 100644 --- a/jdk/test/javax/print/attribute/ServiceDialogTest.java +++ b/jdk/test/javax/print/attribute/ServiceDialogTest.java @@ -71,7 +71,7 @@ public class ServiceDialogTest { if (factories.length > 0) { services[0] = factories[0].getPrintService(fos); } else { - throw new RuntimeException("No StreamPrintService available which would support "+flavor"); + throw new RuntimeException("No StreamPrintService available which would support "+flavor); } services[2] = new TestPrintService("Test Printer"); diff --git a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java index 7f7aa958bf6..7c85e255f72 100644 --- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java +++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,76 +28,107 @@ @run main bug6989617 */ +import sun.awt.SunToolkit; + import javax.swing.*; import java.awt.*; public class bug6989617 { - - private boolean isPaintingOrigin; - private boolean innerPanelRepainted, outerPanelRepainted; - - public bug6989617() { - - final JButton button = new JButton("button"); - - JPanel innerPanel = new JPanel() { - protected boolean isPaintingOrigin() { - return isPaintingOrigin; - } - - public void repaint(long tm, int x, int y, int width, int height) { - if (button.getParent() != null) { - innerPanelRepainted = true; - if (!button.getSize().equals(new Dimension(width, height))) { - throw new RuntimeException("Wrong size of the dirty area"); - } - if (!button.getLocation().equals(new Point(x, y))) { - throw new RuntimeException("Wrong location of the dirty area"); - } - } - super.repaint(tm, x, y, width, height); - } - }; - - JPanel outerPanel = new JPanel() { - protected boolean isPaintingOrigin() { - return isPaintingOrigin; - } - - public void repaint(long tm, int x, int y, int width, int height) { - if (button.getParent() != null) { - outerPanelRepainted = true; - if (!button.getSize().equals(new Dimension(width, height))) { - throw new RuntimeException("Wrong size of the dirty area"); - } - } - super.repaint(tm, x, y, width, height); - } - }; - - - outerPanel.add(innerPanel); - innerPanel.add(button); - - outerPanel.setSize(100, 100); - innerPanel.setBounds(10, 10, 50, 50); - button.setBounds(10, 10, 20, 20); - - if (innerPanelRepainted || outerPanelRepainted) { - throw new RuntimeException("Repainted flag is unexpectedly on"); - } - button.repaint(); - if (innerPanelRepainted || outerPanelRepainted) { - throw new RuntimeException("Repainted flag is unexpectedly on"); - } - isPaintingOrigin = true; - button.repaint(); - if (!innerPanelRepainted || !outerPanelRepainted) { - throw new RuntimeException("Repainted flag is unexpectedly off"); - } - } + private static MyPanel panel; + private static JButton button; public static void main(String... args) throws Exception { - new bug6989617(); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JFrame frame = new JFrame(); + frame. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + panel = new MyPanel(); + + button = new JButton("Hello"); + panel.add(button); + frame.add(panel); + + frame.setSize(200, 300); + frame.setVisible(true); + } + }); + // Testing the panel as a painting origin, + // the panel.paintImmediately() must be triggered + // when button.repaint() is called + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (panel.getPaintRectangle() != null) { + throw new RuntimeException("paint rectangle is not null"); + } + button.repaint(); + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + Rectangle pr = panel.getPaintRectangle(); + if (!pr.getSize().equals(button.getSize())) { + throw new RuntimeException("wrong size of the dirty area"); + } + if (!pr.getLocation().equals(button.getLocation())) { + throw new RuntimeException("wrong location of the dirty area"); + } + } + }); + // Testing the panel as NOT a painting origin + // the panel.paintImmediately() must NOT be triggered + // when button.repaint() is called + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + panel.resetPaintRectangle(); + panel.setPaintingOrigin(false); + if (panel.getPaintRectangle() != null) { + throw new RuntimeException("paint rectangle is not null"); + } + button.repaint(); + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if(panel.getPaintRectangle() != null) { + throw new RuntimeException("paint rectangle is not null"); + } + System.out.println("Test passed..."); + } + }); + } + + static class MyPanel extends JPanel { + private boolean isPaintingOrigin = true; + private Rectangle paintRectangle; + + { + setLayout(new GridBagLayout()); + } + + public boolean isPaintingOrigin() { + return isPaintingOrigin; + } + + public void setPaintingOrigin(boolean paintingOrigin) { + isPaintingOrigin = paintingOrigin; + } + + public void paintImmediately(int x, int y, int w, int h) { + super.paintImmediately(x, y, w, h); + paintRectangle = new Rectangle(x, y, w, h); + } + + public Rectangle getPaintRectangle() { + return paintRectangle == null? null: new Rectangle(paintRectangle); + } + + public void resetPaintRectangle() { + this.paintRectangle = null; + } } } diff --git a/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.html b/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.html index 12955f6eee7..80a3e1c503d 100644 --- a/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.html +++ b/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.html @@ -1,6 +1,8 @@ +The test is suitable only for Windows + 1. Create a link 2. Copy path to the link into TextField 3. Run the Windows Task Manager. Select the Processes tab and find the java process diff --git a/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.java b/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.java index 44d59dc8278..45df0b643de 100644 --- a/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.java +++ b/jdk/test/javax/swing/JFileChooser/6798062/bug6798062.java @@ -28,6 +28,7 @@ @run applet/manual=done bug6798062.html */ +import sun.awt.OSInfo; import sun.awt.shell.ShellFolder; import javax.swing.*; @@ -68,13 +69,23 @@ public class bug6798062 extends JApplet { add(initialize()); } - private JPanel initialize() { - File file = new File("c:/"); + private JComponent initialize() { + if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) { + return new JLabel("The test is suitable only for Windows"); + } + + String tempDir = System.getProperty("java.io.tmpdir"); + + if (tempDir.length() == 0) { // 'java.io.tmpdir' isn't guaranteed to be defined + tempDir = System.getProperty("user.home"); + } + + System.out.println("Temp directory: " + tempDir); try { - folder = ShellFolder.getShellFolder(file); + folder = ShellFolder.getShellFolder(new File(tempDir)); } catch (FileNotFoundException e) { - fail("Directory " + file.getPath() + " not found"); + fail("Directory " + tempDir + " not found"); } slider.setMajorTickSpacing(10); diff --git a/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java index d4ed4736e34..b71ae1cde51 100644 --- a/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java +++ b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java @@ -69,8 +69,6 @@ public class bug6542335 { frame.setSize(200, 100); frame.setVisible(true); - - thumbBounds[0] = new Rectangle(ui.getThumbBounds()); } }); @@ -78,6 +76,8 @@ public class bug6542335 { SwingUtilities.invokeAndWait(new Runnable() { public void run() { + thumbBounds[0] = new Rectangle(ui.getThumbBounds()); + Point l = sb.getLocationOnScreen(); robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight() / 2); diff --git a/jdk/test/javax/swing/LookAndFeel/6474153/bug6474153.java b/jdk/test/javax/swing/LookAndFeel/6474153/bug6474153.java new file mode 100644 index 00000000000..4ee5198f4cb --- /dev/null +++ b/jdk/test/javax/swing/LookAndFeel/6474153/bug6474153.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 6474153 + * @summary LookAndFeel.makeKeyBindings(...) doesn't ignore last element in keyBindingList with odd size + * @author Alexander Potochkin + */ + +import javax.swing.KeyStroke; +import javax.swing.LookAndFeel; +import javax.swing.text.DefaultEditorKit; +import javax.swing.text.JTextComponent; + +public class bug6474153 { + + public static void main(String... args) throws Exception { + checkArray(LookAndFeel.makeKeyBindings(new Object[] {"UP", DefaultEditorKit.upAction} )); + checkArray(LookAndFeel.makeKeyBindings(new Object[] {"UP", DefaultEditorKit.upAction, "PAGE_UP"} )); + } + + private static void checkArray(JTextComponent.KeyBinding[] keyActionArray) { + if (keyActionArray.length != 1) { + throw new RuntimeException("Wrong array lenght!"); + } + if (!DefaultEditorKit.upAction.equals(keyActionArray[0].actionName)) { + throw new RuntimeException("Wrong action name!"); + } + if (!KeyStroke.getKeyStroke("UP").equals(keyActionArray[0].key)) { + throw new RuntimeException("Wrong keystroke!"); + } + } +} diff --git a/jdk/test/sun/java2d/pipe/RegionOps.java b/jdk/test/sun/java2d/pipe/RegionOps.java index 30f8c223a25..e02f280b1fe 100644 --- a/jdk/test/sun/java2d/pipe/RegionOps.java +++ b/jdk/test/sun/java2d/pipe/RegionOps.java @@ -1,3 +1,26 @@ +/* + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + /* * @test %W% %E% * @bug 6504874 diff --git a/jdk/test/sun/security/krb5/auto/BadKdc1.java b/jdk/test/sun/security/krb5/auto/BadKdc1.java index 524e6d32e67..a4f52b490e2 100644 --- a/jdk/test/sun/security/krb5/auto/BadKdc1.java +++ b/jdk/test/sun/security/krb5/auto/BadKdc1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/timeout=300 BadKdc1 + * @run main/othervm/timeout=300 BadKdc1 * @summary krb5 should not try to access unavailable kdc too often */ diff --git a/jdk/test/sun/security/krb5/auto/BadKdc2.java b/jdk/test/sun/security/krb5/auto/BadKdc2.java index 88b7b0cdf7b..9a556429293 100644 --- a/jdk/test/sun/security/krb5/auto/BadKdc2.java +++ b/jdk/test/sun/security/krb5/auto/BadKdc2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/timeout=300 BadKdc2 + * @run main/othervm/timeout=300 BadKdc2 * @summary krb5 should not try to access unavailable kdc too often */ diff --git a/jdk/test/sun/security/krb5/auto/BadKdc3.java b/jdk/test/sun/security/krb5/auto/BadKdc3.java index 95399b072c3..c9ce4db3827 100644 --- a/jdk/test/sun/security/krb5/auto/BadKdc3.java +++ b/jdk/test/sun/security/krb5/auto/BadKdc3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/timeout=300 BadKdc3 + * @run main/othervm/timeout=300 BadKdc3 * @summary krb5 should not try to access unavailable kdc too often */ diff --git a/jdk/test/sun/security/krb5/auto/BadKdc4.java b/jdk/test/sun/security/krb5/auto/BadKdc4.java index 3a148712c05..eef77f282c4 100644 --- a/jdk/test/sun/security/krb5/auto/BadKdc4.java +++ b/jdk/test/sun/security/krb5/auto/BadKdc4.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/timeout=300 BadKdc4 + * @run main/othervm/timeout=300 BadKdc4 * @summary krb5 should not try to access unavailable kdc too often */ diff --git a/jdk/test/sun/security/krb5/auto/CleanState.java b/jdk/test/sun/security/krb5/auto/CleanState.java index 316a730edfe..fbd8785cbab 100644 --- a/jdk/test/sun/security/krb5/auto/CleanState.java +++ b/jdk/test/sun/security/krb5/auto/CleanState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6716534 + * @run main/othervm CleanState * @summary Krb5LoginModule has not cleaned temp info between authentication attempts */ import com.sun.security.auth.module.Krb5LoginModule; diff --git a/jdk/test/sun/security/krb5/auto/CrossRealm.java b/jdk/test/sun/security/krb5/auto/CrossRealm.java index 8b7ecc3d6ee..ecaafedaa62 100644 --- a/jdk/test/sun/security/krb5/auto/CrossRealm.java +++ b/jdk/test/sun/security/krb5/auto/CrossRealm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6706974 + * @run main/othervm CrossRealm * @summary Add krb5 test infrastructure */ import java.io.File; diff --git a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java index e25e60d6ab5..423ef0d853d 100644 --- a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java +++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6578647 6829283 + * @run main/othervm HttpNegotiateServer * @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication() * @summary HTTP/Negotiate: Authenticator triggered again when user cancels the first one */ diff --git a/jdk/test/sun/security/krb5/auto/IgnoreChannelBinding.java b/jdk/test/sun/security/krb5/auto/IgnoreChannelBinding.java index 0995fd8ed61..e2641a9a4f9 100644 --- a/jdk/test/sun/security/krb5/auto/IgnoreChannelBinding.java +++ b/jdk/test/sun/security/krb5/auto/IgnoreChannelBinding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6851973 + * @run main/othervm IgnoreChannelBinding * @summary ignore incoming channel binding if acceptor does not set one */ diff --git a/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java b/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java index b6cd147f6cf..e7c026dab03 100644 --- a/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java +++ b/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 4641821 + * @run main/othervm KerberosHashEqualsTest * @summary hashCode() and equals() for KerberosKey and KerberosTicket */ diff --git a/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java b/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java index 9f948cc8e67..9c518ff6cbb 100644 --- a/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java +++ b/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6857802 + * @run main/othervm LifeTimeInSeconds * @summary GSS getRemainingInitLifetime method returns milliseconds not seconds */ import org.ietf.jgss.GSSCredential; diff --git a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java index f22f774316f..a6dd33b8029 100644 --- a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java +++ b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6765491 + * @run main/othervm LoginModuleOptions * @summary Krb5LoginModule a little too restrictive, and the doc is not clear. */ import com.sun.security.auth.module.Krb5LoginModule; diff --git a/jdk/test/sun/security/krb5/auto/MaxRetries.java b/jdk/test/sun/security/krb5/auto/MaxRetries.java index 4f13878c98d..fec1bec68a6 100644 --- a/jdk/test/sun/security/krb5/auto/MaxRetries.java +++ b/jdk/test/sun/security/krb5/auto/MaxRetries.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 6844193 - * @run main/timeout=300 MaxRetries + * @run main/othervm/timeout=300 MaxRetries * @summary support max_retries in krb5.conf */ diff --git a/jdk/test/sun/security/krb5/auto/MoreKvno.java b/jdk/test/sun/security/krb5/auto/MoreKvno.java index 84cfa362d0d..20cac93d0a0 100644 --- a/jdk/test/sun/security/krb5/auto/MoreKvno.java +++ b/jdk/test/sun/security/krb5/auto/MoreKvno.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 6893158 * @bug 6907425 + * @run main/othervm MoreKvno * @summary AP_REQ check should use key version number */ diff --git a/jdk/test/sun/security/krb5/auto/NewSalt.java b/jdk/test/sun/security/krb5/auto/NewSalt.java index 54cc9562f37..2a0a17fcd9f 100644 --- a/jdk/test/sun/security/krb5/auto/NewSalt.java +++ b/jdk/test/sun/security/krb5/auto/NewSalt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 6960894 * @summary Better AS-REQ creation and processing - * @run main NewSalt + * @run main/othervm NewSalt * @run main/othervm -Dnopreauth NewSalt * @run main/othervm -Donlyonepreauth NewSalt */ diff --git a/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java b/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java index f5b387b1186..304dca1be89 100644 --- a/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java +++ b/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6733095 + * @run main/othervm NonMutualSpnego * @summary Failure when SPNEGO request non-Mutual */ diff --git a/jdk/test/sun/security/krb5/auto/SSL.java b/jdk/test/sun/security/krb5/auto/SSL.java index 1deae8e6f16..7bd4601481e 100644 --- a/jdk/test/sun/security/krb5/auto/SSL.java +++ b/jdk/test/sun/security/krb5/auto/SSL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,16 +25,16 @@ * @test * @bug 6894643 6913636 * @summary Test JSSE Kerberos ciphersuite - * @run main SSL TLS_KRB5_WITH_RC4_128_SHA - * @run main SSL TLS_KRB5_WITH_RC4_128_MD5 - * @run main SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA - * @run main SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5 - * @run main SSL TLS_KRB5_WITH_DES_CBC_SHA - * @run main SSL TLS_KRB5_WITH_DES_CBC_MD5 - * @run main SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA - * @run main SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5 - * @run main SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA - * @run main SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 + * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA + * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_MD5 + * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA + * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5 + * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_SHA + * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_MD5 + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5 + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 */ import java.io.*; import java.net.InetAddress; diff --git a/jdk/test/sun/security/krb5/auto/SpnegoReqFlags.java b/jdk/test/sun/security/krb5/auto/SpnegoReqFlags.java index 75d6b884bbb..62c55048d1f 100644 --- a/jdk/test/sun/security/krb5/auto/SpnegoReqFlags.java +++ b/jdk/test/sun/security/krb5/auto/SpnegoReqFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6815182 + * @run main/othervm SpnegoReqFlags * @summary GSSAPI/SPNEGO does not work with server using MIT Kerberos library */ diff --git a/jdk/test/sun/security/krb5/auto/Test5653.java b/jdk/test/sun/security/krb5/auto/Test5653.java index 71fc92b823f..4384b87ee0b 100644 --- a/jdk/test/sun/security/krb5/auto/Test5653.java +++ b/jdk/test/sun/security/krb5/auto/Test5653.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 6895424 + * @run main/othervm Test5653 * @summary RFC 5653 */