Merge jdk7-b132
authorlana
Tue, 01 Mar 2011 14:04:59 -0800
changeset 36266bbc7a473495
parent 3567 f6cd84cfed70
parent 3625 094c70388ab0
child 3627 b88e4395c437
child 3635 f32f0ae3d873
Merge
test/java/lang/Thread/StopBeforeStart.java
     1.1 --- a/make/java/security/Makefile	Fri Feb 25 12:48:18 2011 -0800
     1.2 +++ b/make/java/security/Makefile	Tue Mar 01 14:04:59 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  #
     1.5 -# Copyright (c) 1996, 2010 Oracle and/or its affiliates. All rights reserved.
     1.6 +# Copyright (c) 1996, 2011 Oracle and/or its affiliates. All rights reserved.
     1.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8  #
     1.9  # This code is free software; you can redistribute it and/or modify it
    1.10 @@ -65,6 +65,8 @@
    1.11  ifndef OPENJDK
    1.12    BLACKLIST_SRC =	$(CLOSED_SHARE_SRC)/lib/security/blacklist
    1.13    BLACKLIST_BUILD = $(LIBDIR)/security/blacklist
    1.14 +  TRUSTEDLIBS_SRC = $(CLOSED_SHARE_SRC)/lib/security/trusted.libraries
    1.15 +  TRUSTEDLIBS_BUILD = $(LIBDIR)/security/trusted.libraries
    1.16  endif
    1.17  
    1.18  FILES_class = $(FILES_java:%.java=$(CLASSBINDIR)/%.class)
    1.19 @@ -77,7 +79,7 @@
    1.20  ifdef OPENJDK
    1.21  build: properties policy cacerts
    1.22  else
    1.23 -build: properties policy cacerts blacklist
    1.24 +build: properties policy cacerts blacklist trustedlibs
    1.25  endif
    1.26  
    1.27  install: all
    1.28 @@ -90,6 +92,8 @@
    1.29  
    1.30  blacklist: classes $(BLACKLIST_BUILD)
    1.31  
    1.32 +trustedlibs: classes $(TRUSTEDLIBS_BUILD)
    1.33 +
    1.34  $(PROPS_BUILD): $(PROPS_SRC)
    1.35  	$(install-file)
    1.36  
    1.37 @@ -102,9 +106,12 @@
    1.38  $(BLACKLIST_BUILD): $(BLACKLIST_SRC)
    1.39  	$(install-file)
    1.40  
    1.41 +$(TRUSTEDLIBS_BUILD): $(TRUSTEDLIBS_SRC)
    1.42 +	$(install-file)
    1.43 +
    1.44  clean clobber:: .delete.classlist
    1.45  	$(RM) -r $(CLASSBINDIR)/java/security
    1.46 -	$(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(BLACKLIST_BUILD)
    1.47 +	$(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(BLACKLIST_BUILD) $(TRUSTEDLIBS_BUILD)
    1.48  
    1.49  # Additional Rule for building sun.security.util
    1.50  $(CLASSBINDIR)/%.class: $(SHARE_SRC)/sun/%.java
     2.1 --- a/make/sun/javazic/tzdata/VERSION	Fri Feb 25 12:48:18 2011 -0800
     2.2 +++ b/make/sun/javazic/tzdata/VERSION	Tue Mar 01 14:04:59 2011 -0800
     2.3 @@ -21,4 +21,4 @@
     2.4  # or visit www.oracle.com if you need additional information or have any
     2.5  # questions.
     2.6  #
     2.7 -tzdata2010o
     2.8 +tzdata2011b
     3.1 --- a/make/sun/javazic/tzdata/australasia	Fri Feb 25 12:48:18 2011 -0800
     3.2 +++ b/make/sun/javazic/tzdata/australasia	Tue Mar 01 14:04:59 2011 -0800
     3.3 @@ -106,14 +106,13 @@
     3.4  Rule	AS	1987	2007	-	Oct	lastSun	2:00s	1:00	-
     3.5  Rule	AS	1972	only	-	Feb	27	2:00s	0	-
     3.6  Rule	AS	1973	1985	-	Mar	Sun>=1	2:00s	0	-
     3.7 -Rule	AS	1986	1989	-	Mar	Sun>=15	2:00s	0	-
     3.8 -Rule	AS	1990	only	-	Mar	Sun>=18	2:00s	0	-
     3.9 -Rule	AS	1991	only	-	Mar	Sun>=1	2:00s	0	-
    3.10 -Rule	AS	1992	only	-	Mar	Sun>=18	2:00s	0	-
    3.11 -Rule	AS	1993	only	-	Mar	Sun>=1	2:00s	0	-
    3.12 -Rule	AS	1994	only	-	Mar	Sun>=18	2:00s	0	-
    3.13 +Rule	AS	1986	1990	-	Mar	Sun>=15	2:00s	0	-
    3.14 +Rule	AS	1991	only	-	Mar	3	2:00s	0	-
    3.15 +Rule	AS	1992	only	-	Mar	22	2:00s	0	-
    3.16 +Rule	AS	1993	only	-	Mar	7	2:00s	0	-
    3.17 +Rule	AS	1994	only	-	Mar	20	2:00s	0	-
    3.18  Rule	AS	1995	2005	-	Mar	lastSun	2:00s	0	-
    3.19 -Rule	AS	2006	only	-	Apr	Sun>=1	2:00s	0	-
    3.20 +Rule	AS	2006	only	-	Apr	2	2:00s	0	-
    3.21  Rule	AS	2007	only	-	Mar	lastSun	2:00s	0	-
    3.22  Rule	AS	2008	max	-	Apr	Sun>=1	2:00s	0	-
    3.23  Rule	AS	2008	max	-	Oct	Sun>=1	2:00s	1:00	-
     4.1 --- a/make/sun/javazic/tzdata/northamerica	Fri Feb 25 12:48:18 2011 -0800
     4.2 +++ b/make/sun/javazic/tzdata/northamerica	Tue Mar 01 14:04:59 2011 -0800
     4.3 @@ -368,6 +368,27 @@
     4.4  			-7:00	US	M%sT	2003 Oct 26 02:00
     4.5  			-6:00	US	C%sT
     4.6  
     4.7 +# From Josh Findley (2011-01-21):
     4.8 +# ...it appears that Mercer County, North Dakota, changed from the
     4.9 +# mountain time zone to the central time zone at the last transition from
    4.10 +# daylight-saving to standard time (on Nov. 7, 2010):
    4.11 +# <a href="http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm">
    4.12 +# http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
    4.13 +# </a>
    4.14 +# <a href="http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html">
    4.15 +# http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html
    4.16 +# </a>
    4.17 +
    4.18 +# From Andy Lipscomb (2011-01-24):
    4.19 +# ...according to the Census Bureau, the largest city is Beulah (although
    4.20 +# it's commonly referred to as Beulah-Hazen, with Hazen being the next
    4.21 +# largest city in Mercer County).  Google Maps places Beulah's city hall
    4.22 +# at 4715'51" north, 10146'40" west, which yields an offset of 6h47'07".
    4.23 +
    4.24 +Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 Nov 18 12:12:53
    4.25 +			-7:00	US	M%sT	2010 Nov  7 2:00
    4.26 +			-6:00	US	C%sT
    4.27 +
    4.28  # US mountain time, represented by Denver
    4.29  #
    4.30  # Colorado, far western Kansas, Montana, western
    4.31 @@ -493,20 +514,50 @@
    4.32  #  three votes for and one against."
    4.33  
    4.34  # Hawaii
    4.35 +
    4.36 +# From Arthur David Olson (2010-12-09):
    4.37 +# "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225
    4.38 +# of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09,
    4.39 +# the article is available at
    4.40 +# <a href="http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf">
    4.41 +# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
    4.42 +# </a>
    4.43 +# and indicates that standard time was adopted effective noon, January
    4.44 +# 13, 1896 (page 218), that in "1933, the Legislature decreed daylight
    4.45 +# saving for the period between the last Sunday of each April and the
    4.46 +# last Sunday of each September, but less than a month later repealed the
    4.47 +# act," (page 220), that year-round daylight saving time was in effect
    4.48 +# from 1942-02-09 to 1945-09-30 (page 221, with no time of day given for
    4.49 +# when clocks changed) and that clocks were changed by 30 minutes
    4.50 +# effective the second Sunday of June, 1947 (page 219, with no time of
    4.51 +# day given for when clocks changed). A footnote for the 1933 changes
    4.52 +# cites Session Laws of Hawaii 1933, "Act. 90 (approved 26 Apr. 1933)
    4.53 +# and Act 163 (approved 21 May 1933)."
    4.54 +
    4.55 +# From Arthur David Olson (2011-01-19):
    4.56 +# The following is from "Laws of the Territory of Hawaii Passed by the
    4.57 +# Seventeenth Legislature: Regular Session 1933," available (as of
    4.58 +# 2011-01-19) at American University's Pence Law Library. Page 85: "Act
    4.59 +# 90...At 2 o'clock ante meridian of the last Sunday in April of each
    4.60 +# year, the standard time of this Territory shall be advanced one
    4.61 +# hour...This Act shall take effect upon its approval. Approved this 26th
    4.62 +# day of April, A. D. 1933. LAWRENCE M JUDD, Governor of the Territory of
    4.63 +# Hawaii." Page 172:  "Act 163...Act 90 of the Session Laws of 1933 is
    4.64 +# hereby repealed...This Act shall take effect upon its approval, upon
    4.65 +# which date the standard time of this Territory shall be restored to
    4.66 +# that existing immediately prior to the taking effect of said Act 90.
    4.67 +# Approved this 21st day of May, A. D. 1933. LAWRENCE M. JUDD, Governor
    4.68 +# of the Territory of Hawaii."
    4.69  #
    4.70 -# From Arthur David Olson:
    4.71 -# And then there's Hawaii.
    4.72 -# DST was observed for one day in 1933;
    4.73 -# standard time was changed by half an hour in 1947;
    4.74 -# it's always standard as of 1986.
    4.75 -#
    4.76 -# From Paul Eggert:
    4.77 -# Shanks says the 1933 experiment lasted for three weeks.  Go with Shanks.
    4.78 -#
    4.79 -Zone Pacific/Honolulu	-10:31:26 -	LMT	1900 Jan  1 12:00
    4.80 -			-10:30	-	HST	1933 Apr 30 2:00
    4.81 -			-10:30	1:00	HDT	1933 May 21 2:00
    4.82 -			-10:30	US	H%sT	1947 Jun  8 2:00
    4.83 +# Note that 1933-05-21 was a Sunday.
    4.84 +# We're left to guess the time of day when Act 163 was approved; guess noon.
    4.85 +
    4.86 +Zone Pacific/Honolulu	-10:31:26 -	LMT	1896 Jan 13 12:00 #Schmitt&Cox
    4.87 +			-10:30	-	HST	1933 Apr 30 2:00 #Laws 1933
    4.88 +			-10:30	1:00	HDT	1933 May 21 12:00 #Laws 1933+12
    4.89 +			-10:30	-	HST	1942 Feb 09 2:00 #Schmitt&Cox+2
    4.90 +			-10:30	1:00	HDT	1945 Sep 30 2:00 #Schmitt&Fox+2
    4.91 +			-10:30	US	H%sT	1947 Jun  8 2:00 #Schmitt&Fox+2
    4.92  			-10:00	-	HST
    4.93  
    4.94  # Now we turn to US areas that have diverged from the consensus since 1970.
     5.1 --- a/make/sun/javazic/tzdata/zone.tab	Fri Feb 25 12:48:18 2011 -0800
     5.2 +++ b/make/sun/javazic/tzdata/zone.tab	Tue Mar 01 14:04:59 2011 -0800
     5.3 @@ -233,8 +233,8 @@
     5.4  HU	+4730+01905	Europe/Budapest
     5.5  ID	-0610+10648	Asia/Jakarta	Java & Sumatra
     5.6  ID	-0002+10920	Asia/Pontianak	west & central Borneo
     5.7 -ID	-0507+11924	Asia/Makassar	east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor
     5.8 -ID	-0232+14042	Asia/Jayapura	Irian Jaya & the Moluccas
     5.9 +ID	-0507+11924	Asia/Makassar	east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
    5.10 +ID	-0232+14042	Asia/Jayapura	west New Guinea (Irian Jaya) & Malukus (Moluccas)
    5.11  IE	+5320-00615	Europe/Dublin
    5.12  IL	+3146+03514	Asia/Jerusalem
    5.13  IM	+5409-00428	Europe/Isle_of_Man
    5.14 @@ -426,6 +426,7 @@
    5.15  US	+450628-0873651	America/Menominee	Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
    5.16  US	+470659-1011757	America/North_Dakota/Center	Central Time - North Dakota - Oliver County
    5.17  US	+465042-1012439	America/North_Dakota/New_Salem	Central Time - North Dakota - Morton County (except Mandan area)
    5.18 +US	+471551-1014640	America/North_Dakota/Beulah	Central Time - North Dakota - Mercer County
    5.19  US	+394421-1045903	America/Denver	Mountain Time
    5.20  US	+433649-1161209	America/Boise	Mountain Time - south Idaho & east Oregon
    5.21  US	+364708-1084111	America/Shiprock	Mountain Time - Navajo
     6.1 --- a/make/sun/jpeg/Makefile	Fri Feb 25 12:48:18 2011 -0800
     6.2 +++ b/make/sun/jpeg/Makefile	Tue Mar 01 14:04:59 2011 -0800
     6.3 @@ -65,6 +65,19 @@
     6.4      FILES_reorder += reorder-$(ARCH)
     6.5    endif
     6.6  endif
     6.7 +
     6.8 +ifeq ($(PLATFORM), linux)
     6.9 +
    6.10 +  # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
    6.11 +  # or 'vfork'": this warning indicates that some variable is placed to
    6.12 +  # a register by optimized compiler and it's value might be lost on longjmp().
    6.13 +  # Recommended way to avoid such warning is to declare the variable as
    6.14 +  # volatile to prevent the optimization. However, this approach does not
    6.15 +  # work because we have to declare all variables as volatile in result.
    6.16 +
    6.17 +  OTHER_CFLAGS += -Wno-clobbered
    6.18 +endif
    6.19 +
    6.20  include $(BUILDDIR)/common/Mapfile-vers.gmk
    6.21  include $(BUILDDIR)/common/Library.gmk
    6.22  
     7.1 --- a/make/sun/jpeg/reorder-i586	Fri Feb 25 12:48:18 2011 -0800
     7.2 +++ b/make/sun/jpeg/reorder-i586	Tue Mar 01 14:04:59 2011 -0800
     7.3 @@ -22,7 +22,7 @@
     7.4  text: .text%alloc_small: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
     7.5  text: .text%reset_marker_reader: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
     7.6  text: .text%jIInCtlr;
     7.7 -text: .text%GET_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
     7.8 +# text: .text%GET_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
     7.9  text: .text%jReadHeader;
    7.10  text: .text%jConsumeInput;
    7.11  text: .text%reset_input_controller: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.12 @@ -30,36 +30,36 @@
    7.13  text: .text%sun_jpeg_init_source;
    7.14  text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.15  text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.16 -text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.17 +# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.18  text: .text%sun_jpeg_fill_input_buffer;
    7.19 -text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
    7.20 -text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.21 +# text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
    7.22 +# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.23  text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o;
    7.24 -text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.25 +# text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.26  text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.27 -text: .text%examine_app0: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.28 +# text: .text%examine_app0: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.29  text: .text%skip_variable: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.30  text: .text%sun_jpeg_skip_input_data;
    7.31 -text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.32 +# text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.33  text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.34  text: .text%jAlcQTable;
    7.35  text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.36 -text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.37 +# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.38  text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.39  text: .text%jAlcHTable;
    7.40  text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    7.41 -text: .text%initial_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.42 +# text: .text%initial_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.43  text: .text%jDivRound;
    7.44 -text: .text%default_decompress_parms: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapimin.o;
    7.45 +# text: .text%default_decompress_parms: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapimin.o;
    7.46  text: .text%jHasMultScn;
    7.47  text: .text%jStrtDecompress;
    7.48  text: .text%jIDMaster;
    7.49 -text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.50 +# text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.51  text: .text%jCalcDimensions;
    7.52 -text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.53 -text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.54 +# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.55 +# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.56  text: .text%jIDColor;
    7.57 -text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
    7.58 +# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
    7.59  text: .text%jIUpsampler;
    7.60  text: .text%jRound;
    7.61  text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
    7.62 @@ -70,16 +70,16 @@
    7.63  text: .text%jIHDecoder;
    7.64  text: .text%jIDCoefC;
    7.65  text: .text%jIDMainC;
    7.66 -text: .text%alloc_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.67 +# text: .text%alloc_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.68  text: .text%realize_virt_arrays: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
    7.69  text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.70 -text: .text%per_scan_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.71 -text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.72 +# text: .text%per_scan_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.73 +# text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    7.74  text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
    7.75  text: .text%jMkDDerived;
    7.76  text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    7.77 -text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    7.78 -text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o;
    7.79 +# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    7.80 +# text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o;
    7.81  text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    7.82  text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jddctmgr.o;
    7.83  text: .text%start_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    7.84 @@ -87,7 +87,7 @@
    7.85  text: .text%start_pass_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
    7.86  text: .text%start_pass_dpost: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdpostct.o;
    7.87  text: .text%start_pass_main: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.88 -text: .text%make_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.89 +# text: .text%make_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.90  text: .text%jReadScanlines;
    7.91  text: .text%process_data_context_main: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.92  text: .text%decompress_onepass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    7.93 @@ -100,11 +100,11 @@
    7.94  text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
    7.95  text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
    7.96  text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
    7.97 -text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    7.98 -text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
    7.99 +# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
   7.100 +# text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
   7.101  text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
   7.102  text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
   7.103 -text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
   7.104 +# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
   7.105  text: .text%jFinDecompress;
   7.106  text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
   7.107  text: .text%sun_jpeg_term_source;
     8.1 --- a/make/sun/jpeg/reorder-sparc	Fri Feb 25 12:48:18 2011 -0800
     8.2 +++ b/make/sun/jpeg/reorder-sparc	Tue Mar 01 14:04:59 2011 -0800
     8.3 @@ -30,10 +30,10 @@
     8.4  text: .text%sun_jpeg_init_source;
     8.5  text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
     8.6  text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
     8.7 -text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
     8.8 +# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
     8.9  text: .text%sun_jpeg_fill_input_buffer;
    8.10  text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
    8.11 -text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.12 +# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.13  text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o;
    8.14  text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.15  text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.16 @@ -44,7 +44,7 @@
    8.17  text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.18  text: .text%jAlcQTable;
    8.19  text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.20 -text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.21 +# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.22  text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.23  text: .text%jAlcHTable;
    8.24  text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.25 @@ -56,10 +56,10 @@
    8.26  text: .text%jIDMaster;
    8.27  text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.28  text: .text%jCalcDimensions;
    8.29 -text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.30 -text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.31 +# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.32 +# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.33  text: .text%jIDColor;
    8.34 -text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
    8.35 +# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
    8.36  text: .text%jIUpsampler;
    8.37  text: .text%jRound;
    8.38  text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
    8.39 @@ -78,7 +78,7 @@
    8.40  text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
    8.41  text: .text%jMkDDerived;
    8.42  text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    8.43 -text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    8.44 +# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
    8.45  text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o;
    8.46  text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.47  text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jddctmgr.o;
    8.48 @@ -100,11 +100,11 @@
    8.49  text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
    8.50  text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
    8.51  text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
    8.52 -text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    8.53 -text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
    8.54 +# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    8.55 +#text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
    8.56  text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
    8.57  text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
    8.58 -text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    8.59 +# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
    8.60  text: .text%jFinDecompress;
    8.61  text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
    8.62  text: .text%sun_jpeg_term_source;
     9.1 --- a/make/sun/jpeg/reorder-sparcv9	Fri Feb 25 12:48:18 2011 -0800
     9.2 +++ b/make/sun/jpeg/reorder-sparcv9	Tue Mar 01 14:04:59 2011 -0800
     9.3 @@ -30,10 +30,10 @@
     9.4  text: .text%sun_jpeg_init_source;
     9.5  text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o;
     9.6  text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
     9.7 -text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
     9.8 +# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
     9.9  text: .text%sun_jpeg_fill_input_buffer;
    9.10  text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jpegdecoder.o;
    9.11 -text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.12 +# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.13  text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jerror.o;
    9.14  text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.15  text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.16 @@ -44,7 +44,7 @@
    9.17  text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.18  text: .text%jAlcQTable;
    9.19  text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.20 -text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.21 +# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.22  text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.23  text: .text%jAlcHTable;
    9.24  text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.25 @@ -56,10 +56,10 @@
    9.26  text: .text%jIDMaster;
    9.27  text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.28  text: .text%jCalcDimensions;
    9.29 -text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.30 -text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.31 +# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.32 +# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.33  text: .text%jIDColor;
    9.34 -text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o;
    9.35 +# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o;
    9.36  text: .text%jIUpsampler;
    9.37  text: .text%jRound;
    9.38  text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jmemmgr.o;
    9.39 @@ -78,7 +78,7 @@
    9.40  text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdhuff.o;
    9.41  text: .text%jMkDDerived;
    9.42  text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o;
    9.43 -text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o;
    9.44 +# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o;
    9.45  text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdapistd.o;
    9.46  text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.47  text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jddctmgr.o;
    9.48 @@ -100,11 +100,11 @@
    9.49  text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o;
    9.50  text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o;
    9.51  text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o;
    9.52 -text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
    9.53 +# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
    9.54  text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdhuff.o;
    9.55  text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
    9.56  text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o;
    9.57 -text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
    9.58 +# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
    9.59  text: .text%jFinDecompress;
    9.60  text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
    9.61  text: .text%sun_jpeg_term_source;
    10.1 --- a/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider	Fri Feb 25 12:48:18 2011 -0800
    10.2 +++ b/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider	Tue Mar 01 14:04:59 2011 -0800
    10.3 @@ -1,5 +1,5 @@
    10.4  # Providers for FormatConversion
    10.5 +com.sun.media.sound.AudioFloatFormatConverter
    10.6  com.sun.media.sound.UlawCodec
    10.7  com.sun.media.sound.AlawCodec
    10.8  com.sun.media.sound.PCMtoPCMCodec
    10.9 -com.sun.media.sound.AudioFloatFormatConverter
    11.1 --- a/src/share/classes/java/io/Console.java	Fri Feb 25 12:48:18 2011 -0800
    11.2 +++ b/src/share/classes/java/io/Console.java	Tue Mar 01 14:04:59 2011 -0800
    11.3 @@ -308,17 +308,29 @@
    11.4          char[] passwd = null;
    11.5          synchronized (writeLock) {
    11.6              synchronized(readLock) {
    11.7 -                if (fmt.length() != 0)
    11.8 -                    pw.format(fmt, args);
    11.9                  try {
   11.10                      echoOff = echo(false);
   11.11 +                } catch (IOException x) {
   11.12 +                    throw new IOError(x);
   11.13 +                }
   11.14 +                IOError ioe = null;
   11.15 +                try {
   11.16 +                    if (fmt.length() != 0)
   11.17 +                        pw.format(fmt, args);
   11.18                      passwd = readline(true);
   11.19                  } catch (IOException x) {
   11.20 -                    throw new IOError(x);
   11.21 +                    ioe = new IOError(x);
   11.22                  } finally {
   11.23                      try {
   11.24                          echoOff = echo(true);
   11.25 -                    } catch (IOException xx) {}
   11.26 +                    } catch (IOException x) {
   11.27 +                        if (ioe == null)
   11.28 +                            ioe = new IOError(x);
   11.29 +                        else
   11.30 +                            ioe.addSuppressed(x);
   11.31 +                    }
   11.32 +                    if (ioe != null)
   11.33 +                        throw ioe;
   11.34                  }
   11.35                  pw.println();
   11.36              }
    12.1 --- a/src/share/classes/java/lang/System.java	Fri Feb 25 12:48:18 2011 -0800
    12.2 +++ b/src/share/classes/java/lang/System.java	Tue Mar 01 14:04:59 2011 -0800
    12.3 @@ -1102,6 +1102,18 @@
    12.4       * Initialize the system class.  Called after thread initialization.
    12.5       */
    12.6      private static void initializeSystemClass() {
    12.7 +
    12.8 +        // VM might invoke JNU_NewStringPlatform() to set those encoding
    12.9 +        // sensitive properties (user.home, user.name, boot.class.path, etc.)
   12.10 +        // during "props" initialization, in which it may need access, via
   12.11 +        // System.getProperty(), to the related system encoding property that
   12.12 +        // have been initialized (put into "props") at early stage of the
   12.13 +        // initialization. So make sure the "props" is available at the
   12.14 +        // very beginning of the initialization and all system properties to
   12.15 +        // be put into it directly.
   12.16 +        props = new Properties();
   12.17 +        initProperties(props);  // initialized by the VM
   12.18 +
   12.19          // There are certain system configurations that may be controlled by
   12.20          // VM options such as the maximum amount of direct memory and
   12.21          // Integer cache size used to support the object identity semantics
   12.22 @@ -1112,7 +1124,12 @@
   12.23          //
   12.24          // See java.lang.Integer.IntegerCache and the
   12.25          // sun.misc.VM.saveAndRemoveProperties method for example.
   12.26 -        props = initSystemProperties();
   12.27 +        //
   12.28 +        // Save a private copy of the system properties object that
   12.29 +        // can only be accessed by the internal implementation.  Remove
   12.30 +        // certain system properties that are not intended for public access.
   12.31 +        sun.misc.VM.saveAndRemoveProperties(props);
   12.32 +
   12.33  
   12.34          lineSeparator = props.getProperty("line.separator");
   12.35          sun.misc.Version.init();
   12.36 @@ -1123,7 +1140,6 @@
   12.37          setIn0(new BufferedInputStream(fdIn));
   12.38          setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true));
   12.39          setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true));
   12.40 -
   12.41          // Load the zip library now in order to keep java.util.zip.ZipFile
   12.42          // from trying to use itself to load this library later.
   12.43          loadLibrary("zip");
   12.44 @@ -1151,18 +1167,6 @@
   12.45          setJavaLangAccess();
   12.46      }
   12.47  
   12.48 -    private static Properties initSystemProperties() {
   12.49 -        Properties props = new Properties();
   12.50 -        initProperties(props);  // initialized by the VM
   12.51 -
   12.52 -        // Save a private copy of the system properties object that
   12.53 -        // can only be accessed by the internal implementation.  Remove
   12.54 -        // certain system properties that are not intended for public access.
   12.55 -        sun.misc.VM.saveAndRemoveProperties(props);
   12.56 -
   12.57 -        return props;
   12.58 -    }
   12.59 -
   12.60      private static void setJavaLangAccess() {
   12.61          // Allow privileged classes outside of java.lang
   12.62          sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
    13.1 --- a/src/share/classes/java/lang/Thread.java	Fri Feb 25 12:48:18 2011 -0800
    13.2 +++ b/src/share/classes/java/lang/Thread.java	Tue Mar 01 14:04:59 2011 -0800
    13.3 @@ -254,12 +254,6 @@
    13.4       */
    13.5      public final static int MAX_PRIORITY = 10;
    13.6  
    13.7 -    /* If stop was called before start */
    13.8 -    private boolean stopBeforeStart;
    13.9 -
   13.10 -    /* Remembered Throwable from stop before start */
   13.11 -    private Throwable throwableFromStop;
   13.12 -
   13.13      /**
   13.14       * Returns a reference to the currently executing thread object.
   13.15       *
   13.16 @@ -706,10 +700,6 @@
   13.17                    it will be passed up the call stack */
   13.18              }
   13.19          }
   13.20 -
   13.21 -        if (stopBeforeStart) {
   13.22 -            stop0(throwableFromStop);
   13.23 -        }
   13.24      }
   13.25  
   13.26      private native void start0();
   13.27 @@ -820,12 +810,7 @@
   13.28       */
   13.29      @Deprecated
   13.30      public final void stop() {
   13.31 -        // If the thread is already dead, return.
   13.32 -        // A zero status value corresponds to "NEW".
   13.33 -        if ((threadStatus != 0) && !isAlive()) {
   13.34 -            return;
   13.35 -        }
   13.36 -        stop1(new ThreadDeath());
   13.37 +        stop(new ThreadDeath());
   13.38      }
   13.39  
   13.40      /**
   13.41 @@ -879,36 +864,25 @@
   13.42       */
   13.43      @Deprecated
   13.44      public final synchronized void stop(Throwable obj) {
   13.45 -        stop1(obj);
   13.46 -    }
   13.47 +        if (obj == null)
   13.48 +            throw new NullPointerException();
   13.49  
   13.50 -    /**
   13.51 -     * Common impl for stop() and stop(Throwable).
   13.52 -     */
   13.53 -    private final synchronized void stop1(Throwable th) {
   13.54          SecurityManager security = System.getSecurityManager();
   13.55          if (security != null) {
   13.56              checkAccess();
   13.57              if ((this != Thread.currentThread()) ||
   13.58 -                (!(th instanceof ThreadDeath))) {
   13.59 +                (!(obj instanceof ThreadDeath))) {
   13.60                  security.checkPermission(SecurityConstants.STOP_THREAD_PERMISSION);
   13.61              }
   13.62          }
   13.63 -        // A zero status value corresponds to "NEW"
   13.64 +        // A zero status value corresponds to "NEW", it can't change to
   13.65 +        // not-NEW because we hold the lock.
   13.66          if (threadStatus != 0) {
   13.67              resume(); // Wake up thread if it was suspended; no-op otherwise
   13.68 -            stop0(th);
   13.69 -        } else {
   13.70 +        }
   13.71  
   13.72 -            // Must do the null arg check that the VM would do with stop0
   13.73 -            if (th == null) {
   13.74 -                throw new NullPointerException();
   13.75 -            }
   13.76 -
   13.77 -            // Remember this stop attempt for if/when start is used
   13.78 -            stopBeforeStart = true;
   13.79 -            throwableFromStop = th;
   13.80 -        }
   13.81 +        // The VM can handle all thread states
   13.82 +        stop0(obj);
   13.83      }
   13.84  
   13.85      /**
    14.1 --- a/src/share/classes/java/util/Hashtable.java	Fri Feb 25 12:48:18 2011 -0800
    14.2 +++ b/src/share/classes/java/util/Hashtable.java	Tue Mar 01 14:04:59 2011 -0800
    14.3 @@ -845,24 +845,36 @@
    14.4       *             for each key-value mapping represented by the Hashtable
    14.5       *             The key-value mappings are emitted in no particular order.
    14.6       */
    14.7 -    private synchronized void writeObject(java.io.ObjectOutputStream s)
    14.8 -        throws IOException
    14.9 -    {
   14.10 -        // Write out the length, threshold, loadfactor
   14.11 -        s.defaultWriteObject();
   14.12 +    private void writeObject(java.io.ObjectOutputStream s)
   14.13 +            throws IOException {
   14.14 +        Entry<Object, Object> entryStack = null;
   14.15  
   14.16 -        // Write out length, count of elements and then the key/value objects
   14.17 -        s.writeInt(table.length);
   14.18 -        s.writeInt(count);
   14.19 -        for (int index = table.length-1; index >= 0; index--) {
   14.20 -            Entry entry = table[index];
   14.21 +        synchronized (this) {
   14.22 +            // Write out the length, threshold, loadfactor
   14.23 +            s.defaultWriteObject();
   14.24  
   14.25 -            while (entry != null) {
   14.26 -                s.writeObject(entry.key);
   14.27 -                s.writeObject(entry.value);
   14.28 -                entry = entry.next;
   14.29 +            // Write out length, count of elements
   14.30 +            s.writeInt(table.length);
   14.31 +            s.writeInt(count);
   14.32 +
   14.33 +            // Stack copies of the entries in the table
   14.34 +            for (int index = 0; index < table.length; index++) {
   14.35 +                Entry entry = table[index];
   14.36 +
   14.37 +                while (entry != null) {
   14.38 +                    entryStack =
   14.39 +                        new Entry<>(0, entry.key, entry.value, entryStack);
   14.40 +                    entry = entry.next;
   14.41 +                }
   14.42              }
   14.43          }
   14.44 +
   14.45 +        // Write out the key/value objects from the stacked entries
   14.46 +        while (entryStack != null) {
   14.47 +            s.writeObject(entryStack.key);
   14.48 +            s.writeObject(entryStack.value);
   14.49 +            entryStack = entryStack.next;
   14.50 +        }
   14.51      }
   14.52  
   14.53      /**
    15.1 --- a/src/share/classes/java/util/SimpleTimeZone.java	Fri Feb 25 12:48:18 2011 -0800
    15.2 +++ b/src/share/classes/java/util/SimpleTimeZone.java	Tue Mar 01 14:04:59 2011 -0800
    15.3 @@ -1,5 +1,5 @@
    15.4  /*
    15.5 - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
    15.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
    15.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.8   *
    15.9   * This code is free software; you can redistribute it and/or modify it
   15.10 @@ -825,10 +825,7 @@
   15.11       * @since 1.2
   15.12       */
   15.13      public int getDSTSavings() {
   15.14 -        if (useDaylight) {
   15.15 -            return dstSavings;
   15.16 -        }
   15.17 -        return 0;
   15.18 +        return useDaylight ? dstSavings : 0;
   15.19      }
   15.20  
   15.21      /**
   15.22 @@ -842,6 +839,20 @@
   15.23      }
   15.24  
   15.25      /**
   15.26 +     * Returns {@code true} if this {@code SimpleTimeZone} observes
   15.27 +     * Daylight Saving Time. This method is equivalent to {@link
   15.28 +     * #useDaylightTime()}.
   15.29 +     *
   15.30 +     * @return {@code true} if this {@code SimpleTimeZone} observes
   15.31 +     * Daylight Saving Time; {@code false} otherwise.
   15.32 +     * @since 1.7
   15.33 +     */
   15.34 +    @Override
   15.35 +    public boolean observesDaylightTime() {
   15.36 +        return useDaylightTime();
   15.37 +    }
   15.38 +
   15.39 +    /**
   15.40       * Queries if the given date is in daylight saving time.
   15.41       * @return true if daylight saving time is in effective at the
   15.42       * given date; false otherwise.
    16.1 --- a/src/share/classes/java/util/TimeZone.java	Fri Feb 25 12:48:18 2011 -0800
    16.2 +++ b/src/share/classes/java/util/TimeZone.java	Tue Mar 01 14:04:59 2011 -0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -455,17 +455,28 @@
   16.11      /**
   16.12       * Returns the amount of time to be added to local standard time
   16.13       * to get local wall clock time.
   16.14 -     * <p>
   16.15 -     * The default implementation always returns 3600000 milliseconds
   16.16 -     * (i.e., one hour) if this time zone observes Daylight Saving
   16.17 -     * Time. Otherwise, 0 (zero) is returned.
   16.18 -     * <p>
   16.19 -     * If an underlying TimeZone implementation subclass supports
   16.20 -     * historical Daylight Saving Time changes, this method returns
   16.21 -     * the known latest daylight saving value.
   16.22 +     *
   16.23 +     * <p>The default implementation returns 3600000 milliseconds
   16.24 +     * (i.e., one hour) if a call to {@link #useDaylightTime()}
   16.25 +     * returns {@code true}. Otherwise, 0 (zero) is returned.
   16.26 +     *
   16.27 +     * <p>If an underlying {@code TimeZone} implementation subclass
   16.28 +     * supports historical and future Daylight Saving Time schedule
   16.29 +     * changes, this method returns the amount of saving time of the
   16.30 +     * last known Daylight Saving Time rule that can be a future
   16.31 +     * prediction.
   16.32 +     *
   16.33 +     * <p>If the amount of saving time at any given time stamp is
   16.34 +     * required, construct a {@link Calendar} with this {@code
   16.35 +     * TimeZone} and the time stamp, and call {@link Calendar#get(int)
   16.36 +     * Calendar.get}{@code (}{@link Calendar#DST_OFFSET}{@code )}.
   16.37       *
   16.38       * @return the amount of saving time in milliseconds
   16.39       * @since 1.4
   16.40 +     * @see #inDaylightTime(Date)
   16.41 +     * @see #getOffset(long)
   16.42 +     * @see #getOffset(int,int,int,int,int,int)
   16.43 +     * @see Calendar#ZONE_OFFSET
   16.44       */
   16.45      public int getDSTSavings() {
   16.46          if (useDaylightTime()) {
   16.47 @@ -475,24 +486,51 @@
   16.48      }
   16.49  
   16.50      /**
   16.51 -     * Queries if this time zone uses daylight savings time.
   16.52 -     * <p>
   16.53 -     * If an underlying <code>TimeZone</code> implementation subclass
   16.54 -     * supports historical Daylight Saving Time schedule changes, the
   16.55 -     * method refers to the latest Daylight Saving Time schedule
   16.56 -     * information.
   16.57 +     * Queries if this {@code TimeZone} uses Daylight Saving Time.
   16.58       *
   16.59 -     * @return true if this time zone uses daylight savings time,
   16.60 -     * false, otherwise.
   16.61 +     * <p>If an underlying {@code TimeZone} implementation subclass
   16.62 +     * supports historical and future Daylight Saving Time schedule
   16.63 +     * changes, this method refers to the last known Daylight Saving Time
   16.64 +     * rule that can be a future prediction and may not be the same as
   16.65 +     * the current rule. Consider calling {@link #observesDaylightTime()}
   16.66 +     * if the current rule should also be taken into account.
   16.67 +     *
   16.68 +     * @return {@code true} if this {@code TimeZone} uses Daylight Saving Time,
   16.69 +     *         {@code false}, otherwise.
   16.70 +     * @see #inDaylightTime(Date)
   16.71 +     * @see Calendar#DST_OFFSET
   16.72       */
   16.73      public abstract boolean useDaylightTime();
   16.74  
   16.75      /**
   16.76 -     * Queries if the given date is in daylight savings time in
   16.77 -     * this time zone.
   16.78 -     * @param date the given Date.
   16.79 -     * @return true if the given date is in daylight savings time,
   16.80 -     * false, otherwise.
   16.81 +     * Returns {@code true} if this {@code TimeZone} is currently in
   16.82 +     * Daylight Saving Time, or if a transition from Standard Time to
   16.83 +     * Daylight Saving Time occurs at any future time.
   16.84 +     *
   16.85 +     * <p>The default implementation returns {@code true} if
   16.86 +     * {@code useDaylightTime()} or {@code inDaylightTime(new Date())}
   16.87 +     * returns {@code true}.
   16.88 +     *
   16.89 +     * @return {@code true} if this {@code TimeZone} is currently in
   16.90 +     * Daylight Saving Time, or if a transition from Standard Time to
   16.91 +     * Daylight Saving Time occurs at any future time; {@code false}
   16.92 +     * otherwise.
   16.93 +     * @since 1.7
   16.94 +     * @see #useDaylightTime()
   16.95 +     * @see #inDaylightTime(Date)
   16.96 +     * @see Calendar#DST_OFFSET
   16.97 +     */
   16.98 +    public boolean observesDaylightTime() {
   16.99 +        return useDaylightTime() || inDaylightTime(new Date());
  16.100 +    }
  16.101 +
  16.102 +    /**
  16.103 +     * Queries if the given {@code date} is in Daylight Saving Time in
  16.104 +     * this {@code TimeZone}.
  16.105 +     *
  16.106 +     * @param date the given {@code Date}.
  16.107 +     * @return {@code true} if the given {@code date} is in Daylight Saving Time,
  16.108 +     *         {@code false}, otherwise.
  16.109       */
  16.110      abstract public boolean inDaylightTime(Date date);
  16.111  
    17.1 --- a/src/share/classes/java/util/Vector.java	Fri Feb 25 12:48:18 2011 -0800
    17.2 +++ b/src/share/classes/java/util/Vector.java	Tue Mar 01 14:04:59 2011 -0800
    17.3 @@ -1050,13 +1050,21 @@
    17.4  
    17.5      /**
    17.6       * Save the state of the {@code Vector} instance to a stream (that
    17.7 -     * is, serialize it).  This method is present merely for synchronization.
    17.8 -     * It just calls the default writeObject method.
    17.9 +     * is, serialize it).
   17.10 +     * This method performs synchronization to ensure the consistency
   17.11 +     * of the serialized data.
   17.12       */
   17.13 -    private synchronized void writeObject(java.io.ObjectOutputStream s)
   17.14 -        throws java.io.IOException
   17.15 -    {
   17.16 -        s.defaultWriteObject();
   17.17 +    private void writeObject(java.io.ObjectOutputStream s)
   17.18 +            throws java.io.IOException {
   17.19 +        final java.io.ObjectOutputStream.PutField fields = s.putFields();
   17.20 +        final Object[] data;
   17.21 +        synchronized (this) {
   17.22 +            fields.put("capacityIncrement", capacityIncrement);
   17.23 +            fields.put("elementCount", elementCount);
   17.24 +            data = elementData.clone();
   17.25 +        }
   17.26 +        fields.put("elementData", data);
   17.27 +        s.writeFields();
   17.28      }
   17.29  
   17.30      /**
    18.1 --- a/src/share/classes/java/util/jar/JarFile.java	Fri Feb 25 12:48:18 2011 -0800
    18.2 +++ b/src/share/classes/java/util/jar/JarFile.java	Tue Mar 01 14:04:59 2011 -0800
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -27,11 +27,13 @@
   18.11  
   18.12  import java.io.*;
   18.13  import java.lang.ref.SoftReference;
   18.14 +import java.net.URL;
   18.15  import java.util.*;
   18.16  import java.util.zip.*;
   18.17  import java.security.CodeSigner;
   18.18  import java.security.cert.Certificate;
   18.19  import java.security.AccessController;
   18.20 +import java.security.CodeSource;
   18.21  import sun.security.action.GetPropertyAction;
   18.22  import sun.security.util.ManifestEntryVerifier;
   18.23  import sun.misc.SharedSecrets;
   18.24 @@ -262,7 +264,7 @@
   18.25                  throw new RuntimeException(e);
   18.26              }
   18.27              if (certs == null && jv != null) {
   18.28 -                certs = jv.getCerts(getName());
   18.29 +                certs = jv.getCerts(JarFile.this, this);
   18.30              }
   18.31              return certs == null ? null : certs.clone();
   18.32          }
   18.33 @@ -273,7 +275,7 @@
   18.34                  throw new RuntimeException(e);
   18.35              }
   18.36              if (signers == null && jv != null) {
   18.37 -                signers = jv.getCodeSigners(getName());
   18.38 +                signers = jv.getCodeSigners(JarFile.this, this);
   18.39              }
   18.40              return signers == null ? null : signers.clone();
   18.41          }
   18.42 @@ -544,4 +546,191 @@
   18.43          }
   18.44          return false;
   18.45      }
   18.46 +
   18.47 +    private synchronized void ensureInitialization() {
   18.48 +        try {
   18.49 +            maybeInstantiateVerifier();
   18.50 +        } catch (IOException e) {
   18.51 +            throw new RuntimeException(e);
   18.52 +        }
   18.53 +        if (jv != null && !jvInitialized) {
   18.54 +            initializeVerifier();
   18.55 +            jvInitialized = true;
   18.56 +        }
   18.57 +    }
   18.58 +
   18.59 +    JarEntry newEntry(ZipEntry ze) {
   18.60 +        return new JarFileEntry(ze);
   18.61 +    }
   18.62 +
   18.63 +    Enumeration<String> entryNames(CodeSource[] cs) {
   18.64 +        ensureInitialization();
   18.65 +        if (jv != null) {
   18.66 +            return jv.entryNames(this, cs);
   18.67 +        }
   18.68 +
   18.69 +        /*
   18.70 +         * JAR file has no signed content. Is there a non-signing
   18.71 +         * code source?
   18.72 +         */
   18.73 +        boolean includeUnsigned = false;
   18.74 +        for (int i = 0; i < cs.length; i++) {
   18.75 +            if (cs[i].getCodeSigners() == null) {
   18.76 +                includeUnsigned = true;
   18.77 +                break;
   18.78 +            }
   18.79 +        }
   18.80 +        if (includeUnsigned) {
   18.81 +            return unsignedEntryNames();
   18.82 +        } else {
   18.83 +            return new Enumeration<String>() {
   18.84 +
   18.85 +                public boolean hasMoreElements() {
   18.86 +                    return false;
   18.87 +                }
   18.88 +
   18.89 +                public String nextElement() {
   18.90 +                    throw new NoSuchElementException();
   18.91 +                }
   18.92 +            };
   18.93 +        }
   18.94 +    }
   18.95 +
   18.96 +    /**
   18.97 +     * Returns an enumeration of the zip file entries
   18.98 +     * excluding internal JAR mechanism entries and including
   18.99 +     * signed entries missing from the ZIP directory.
  18.100 +     */
  18.101 +    Enumeration<JarEntry> entries2() {
  18.102 +        ensureInitialization();
  18.103 +        if (jv != null) {
  18.104 +            return jv.entries2(this, super.entries());
  18.105 +        }
  18.106 +
  18.107 +        // screen out entries which are never signed
  18.108 +        final Enumeration enum_ = super.entries();
  18.109 +        return new Enumeration<JarEntry>() {
  18.110 +
  18.111 +            ZipEntry entry;
  18.112 +
  18.113 +            public boolean hasMoreElements() {
  18.114 +                if (entry != null) {
  18.115 +                    return true;
  18.116 +                }
  18.117 +                while (enum_.hasMoreElements()) {
  18.118 +                    ZipEntry ze = (ZipEntry) enum_.nextElement();
  18.119 +                    if (JarVerifier.isSigningRelated(ze.getName())) {
  18.120 +                        continue;
  18.121 +                    }
  18.122 +                    entry = ze;
  18.123 +                    return true;
  18.124 +                }
  18.125 +                return false;
  18.126 +            }
  18.127 +
  18.128 +            public JarFileEntry nextElement() {
  18.129 +                if (hasMoreElements()) {
  18.130 +                    ZipEntry ze = entry;
  18.131 +                    entry = null;
  18.132 +                    return new JarFileEntry(ze);
  18.133 +                }
  18.134 +                throw new NoSuchElementException();
  18.135 +            }
  18.136 +        };
  18.137 +    }
  18.138 +
  18.139 +    CodeSource[] getCodeSources(URL url) {
  18.140 +        ensureInitialization();
  18.141 +        if (jv != null) {
  18.142 +            return jv.getCodeSources(this, url);
  18.143 +        }
  18.144 +
  18.145 +        /*
  18.146 +         * JAR file has no signed content. Is there a non-signing
  18.147 +         * code source?
  18.148 +         */
  18.149 +        Enumeration unsigned = unsignedEntryNames();
  18.150 +        if (unsigned.hasMoreElements()) {
  18.151 +            return new CodeSource[]{JarVerifier.getUnsignedCS(url)};
  18.152 +        } else {
  18.153 +            return null;
  18.154 +        }
  18.155 +    }
  18.156 +
  18.157 +    private Enumeration<String> unsignedEntryNames() {
  18.158 +        final Enumeration entries = entries();
  18.159 +        return new Enumeration<String>() {
  18.160 +
  18.161 +            String name;
  18.162 +
  18.163 +            /*
  18.164 +             * Grab entries from ZIP directory but screen out
  18.165 +             * metadata.
  18.166 +             */
  18.167 +            public boolean hasMoreElements() {
  18.168 +                if (name != null) {
  18.169 +                    return true;
  18.170 +                }
  18.171 +                while (entries.hasMoreElements()) {
  18.172 +                    String value;
  18.173 +                    ZipEntry e = (ZipEntry) entries.nextElement();
  18.174 +                    value = e.getName();
  18.175 +                    if (e.isDirectory() || JarVerifier.isSigningRelated(value)) {
  18.176 +                        continue;
  18.177 +                    }
  18.178 +                    name = value;
  18.179 +                    return true;
  18.180 +                }
  18.181 +                return false;
  18.182 +            }
  18.183 +
  18.184 +            public String nextElement() {
  18.185 +                if (hasMoreElements()) {
  18.186 +                    String value = name;
  18.187 +                    name = null;
  18.188 +                    return value;
  18.189 +                }
  18.190 +                throw new NoSuchElementException();
  18.191 +            }
  18.192 +        };
  18.193 +    }
  18.194 +
  18.195 +    CodeSource getCodeSource(URL url, String name) {
  18.196 +        ensureInitialization();
  18.197 +        if (jv != null) {
  18.198 +            if (jv.eagerValidation) {
  18.199 +                CodeSource cs = null;
  18.200 +                JarEntry je = getJarEntry(name);
  18.201 +                if (je != null) {
  18.202 +                    cs = jv.getCodeSource(url, this, je);
  18.203 +                } else {
  18.204 +                    cs = jv.getCodeSource(url, name);
  18.205 +                }
  18.206 +                return cs;
  18.207 +            } else {
  18.208 +                return jv.getCodeSource(url, name);
  18.209 +            }
  18.210 +        }
  18.211 +
  18.212 +        return JarVerifier.getUnsignedCS(url);
  18.213 +    }
  18.214 +
  18.215 +    void setEagerValidation(boolean eager) {
  18.216 +        try {
  18.217 +            maybeInstantiateVerifier();
  18.218 +        } catch (IOException e) {
  18.219 +            throw new RuntimeException(e);
  18.220 +        }
  18.221 +        if (jv != null) {
  18.222 +            jv.setEagerValidation(eager);
  18.223 +        }
  18.224 +    }
  18.225 +
  18.226 +    List getManifestDigests() {
  18.227 +        ensureInitialization();
  18.228 +        if (jv != null) {
  18.229 +            return jv.getManifestDigests();
  18.230 +        }
  18.231 +        return new ArrayList();
  18.232 +    }
  18.233  }
    19.1 --- a/src/share/classes/java/util/jar/JarVerifier.java	Fri Feb 25 12:48:18 2011 -0800
    19.2 +++ b/src/share/classes/java/util/jar/JarVerifier.java	Tue Mar 01 14:04:59 2011 -0800
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -26,9 +26,11 @@
   19.11  package java.util.jar;
   19.12  
   19.13  import java.io.*;
   19.14 +import java.net.URL;
   19.15  import java.util.*;
   19.16  import java.security.*;
   19.17  import java.security.cert.CertificateException;
   19.18 +import java.util.zip.ZipEntry;
   19.19  
   19.20  import sun.security.util.ManifestDigester;
   19.21  import sun.security.util.ManifestEntryVerifier;
   19.22 @@ -81,6 +83,15 @@
   19.23      /** the bytes for the manDig object */
   19.24      byte manifestRawBytes[] = null;
   19.25  
   19.26 +    /** controls eager signature validation */
   19.27 +    boolean eagerValidation;
   19.28 +
   19.29 +    /** makes code source singleton instances unique to us */
   19.30 +    private Object csdomain = new Object();
   19.31 +
   19.32 +    /** collect -DIGEST-MANIFEST values for blacklist */
   19.33 +    private List manifestDigests;
   19.34 +
   19.35      public JarVerifier(byte rawBytes[]) {
   19.36          manifestRawBytes = rawBytes;
   19.37          sigFileSigners = new Hashtable();
   19.38 @@ -88,6 +99,7 @@
   19.39          sigFileData = new Hashtable(11);
   19.40          pendingBlocks = new ArrayList();
   19.41          baos = new ByteArrayOutputStream();
   19.42 +        manifestDigests = new ArrayList();
   19.43      }
   19.44  
   19.45      /**
   19.46 @@ -247,7 +259,7 @@
   19.47                              }
   19.48  
   19.49                              sfv.setSignatureFile(bytes);
   19.50 -                            sfv.process(sigFileSigners);
   19.51 +                            sfv.process(sigFileSigners, manifestDigests);
   19.52                          }
   19.53                      }
   19.54                      return;
   19.55 @@ -290,7 +302,7 @@
   19.56                          sfv.setSignatureFile(bytes);
   19.57                      }
   19.58                  }
   19.59 -                sfv.process(sigFileSigners);
   19.60 +                sfv.process(sigFileSigners, manifestDigests);
   19.61  
   19.62              } catch (IOException ioe) {
   19.63                  // e.g. sun.security.pkcs.ParsingException
   19.64 @@ -312,12 +324,18 @@
   19.65      /**
   19.66       * Return an array of java.security.cert.Certificate objects for
   19.67       * the given file in the jar.
   19.68 +     * @deprecated
   19.69       */
   19.70      public java.security.cert.Certificate[] getCerts(String name)
   19.71      {
   19.72          return mapSignersToCertArray(getCodeSigners(name));
   19.73      }
   19.74  
   19.75 +    public java.security.cert.Certificate[] getCerts(JarFile jar, JarEntry entry)
   19.76 +    {
   19.77 +        return mapSignersToCertArray(getCodeSigners(jar, entry));
   19.78 +    }
   19.79 +
   19.80      /**
   19.81       * return an array of CodeSigner objects for
   19.82       * the given file in the jar. this array is not cloned.
   19.83 @@ -328,6 +346,28 @@
   19.84          return (CodeSigner[])verifiedSigners.get(name);
   19.85      }
   19.86  
   19.87 +    public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry)
   19.88 +    {
   19.89 +        String name = entry.getName();
   19.90 +        if (eagerValidation && sigFileSigners.get(name) != null) {
   19.91 +            /*
   19.92 +             * Force a read of the entry data to generate the
   19.93 +             * verification hash.
   19.94 +             */
   19.95 +            try {
   19.96 +                InputStream s = jar.getInputStream(entry);
   19.97 +                byte[] buffer = new byte[1024];
   19.98 +                int n = buffer.length;
   19.99 +                while (n != -1) {
  19.100 +                    n = s.read(buffer, 0, buffer.length);
  19.101 +                }
  19.102 +                s.close();
  19.103 +            } catch (IOException e) {
  19.104 +            }
  19.105 +        }
  19.106 +        return getCodeSigners(name);
  19.107 +    }
  19.108 +
  19.109      /*
  19.110       * Convert an array of signers into an array of concatenated certificate
  19.111       * arrays.
  19.112 @@ -444,4 +484,393 @@
  19.113          }
  19.114  
  19.115      }
  19.116 +
  19.117 +    // Extended JavaUtilJarAccess CodeSource API Support
  19.118 +
  19.119 +    private Map urlToCodeSourceMap = new HashMap();
  19.120 +    private Map signerToCodeSource = new HashMap();
  19.121 +    private URL lastURL;
  19.122 +    private Map lastURLMap;
  19.123 +
  19.124 +    /*
  19.125 +     * Create a unique mapping from codeSigner cache entries to CodeSource.
  19.126 +     * In theory, multiple URLs origins could map to a single locally cached
  19.127 +     * and shared JAR file although in practice there will be a single URL in use.
  19.128 +     */
  19.129 +    private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
  19.130 +        Map map;
  19.131 +        if (url == lastURL) {
  19.132 +            map = lastURLMap;
  19.133 +        } else {
  19.134 +            map = (Map) urlToCodeSourceMap.get(url);
  19.135 +            if (map == null) {
  19.136 +                map = new HashMap();
  19.137 +                urlToCodeSourceMap.put(url, map);
  19.138 +            }
  19.139 +            lastURLMap = map;
  19.140 +            lastURL = url;
  19.141 +        }
  19.142 +        CodeSource cs = (CodeSource) map.get(signers);
  19.143 +        if (cs == null) {
  19.144 +            cs = new VerifierCodeSource(csdomain, url, signers);
  19.145 +            signerToCodeSource.put(signers, cs);
  19.146 +        }
  19.147 +        return cs;
  19.148 +    }
  19.149 +
  19.150 +    private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) {
  19.151 +        List sources = new ArrayList();
  19.152 +
  19.153 +        for (int i = 0; i < signers.size(); i++) {
  19.154 +            sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i)));
  19.155 +        }
  19.156 +        if (unsigned) {
  19.157 +            sources.add(mapSignersToCodeSource(url, null));
  19.158 +        }
  19.159 +        return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]);
  19.160 +    }
  19.161 +    private CodeSigner[] emptySigner = new CodeSigner[0];
  19.162 +
  19.163 +    /*
  19.164 +     * Match CodeSource to a CodeSigner[] in the signer cache.
  19.165 +     */
  19.166 +    private CodeSigner[] findMatchingSigners(CodeSource cs) {
  19.167 +        if (cs instanceof VerifierCodeSource) {
  19.168 +            VerifierCodeSource vcs = (VerifierCodeSource) cs;
  19.169 +            if (vcs.isSameDomain(csdomain)) {
  19.170 +                return ((VerifierCodeSource) cs).getPrivateSigners();
  19.171 +            }
  19.172 +        }
  19.173 +
  19.174 +        /*
  19.175 +         * In practice signers should always be optimized above
  19.176 +         * but this handles a CodeSource of any type, just in case.
  19.177 +         */
  19.178 +        CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
  19.179 +        List sourceList = new ArrayList();
  19.180 +        for (int i = 0; i < sources.length; i++) {
  19.181 +            sourceList.add(sources[i]);
  19.182 +        }
  19.183 +        int j = sourceList.indexOf(cs);
  19.184 +        if (j != -1) {
  19.185 +            CodeSigner[] match;
  19.186 +            match = ((VerifierCodeSource) sourceList.get(j)).getPrivateSigners();
  19.187 +            if (match == null) {
  19.188 +                match = emptySigner;
  19.189 +            }
  19.190 +            return match;
  19.191 +        }
  19.192 +        return null;
  19.193 +    }
  19.194 +
  19.195 +    /*
  19.196 +     * Instances of this class hold uncopied references to internal
  19.197 +     * signing data that can be compared by object reference identity.
  19.198 +     */
  19.199 +    private static class VerifierCodeSource extends CodeSource {
  19.200 +
  19.201 +        URL vlocation;
  19.202 +        CodeSigner[] vsigners;
  19.203 +        java.security.cert.Certificate[] vcerts;
  19.204 +        Object csdomain;
  19.205 +
  19.206 +        VerifierCodeSource(Object csdomain, URL location, CodeSigner[] signers) {
  19.207 +            super(location, signers);
  19.208 +            this.csdomain = csdomain;
  19.209 +            vlocation = location;
  19.210 +            vsigners = signers; // from signerCache
  19.211 +        }
  19.212 +
  19.213 +        VerifierCodeSource(Object csdomain, URL location, java.security.cert.Certificate[] certs) {
  19.214 +            super(location, certs);
  19.215 +            this.csdomain = csdomain;
  19.216 +            vlocation = location;
  19.217 +            vcerts = certs; // from signerCache
  19.218 +        }
  19.219 +
  19.220 +        /*
  19.221 +         * All VerifierCodeSource instances are constructed based on
  19.222 +         * singleton signerCache or signerCacheCert entries for each unique signer.
  19.223 +         * No CodeSigner<->Certificate[] conversion is required.
  19.224 +         * We use these assumptions to optimize equality comparisons.
  19.225 +         */
  19.226 +        public boolean equals(Object obj) {
  19.227 +            if (obj == this) {
  19.228 +                return true;
  19.229 +            }
  19.230 +            if (obj instanceof VerifierCodeSource) {
  19.231 +                VerifierCodeSource that = (VerifierCodeSource) obj;
  19.232 +
  19.233 +                /*
  19.234 +                 * Only compare against other per-signer singletons constructed
  19.235 +                 * on behalf of the same JarFile instance. Otherwise, compare
  19.236 +                 * things the slower way.
  19.237 +                 */
  19.238 +                if (isSameDomain(that.csdomain)) {
  19.239 +                    if (that.vsigners != this.vsigners
  19.240 +                            || that.vcerts != this.vcerts) {
  19.241 +                        return false;
  19.242 +                    }
  19.243 +                    if (that.vlocation != null) {
  19.244 +                        return that.vlocation.equals(this.vlocation);
  19.245 +                    } else if (this.vlocation != null) {
  19.246 +                        return this.vlocation.equals(that.vlocation);
  19.247 +                    } else { // both null
  19.248 +                        return true;
  19.249 +                    }
  19.250 +                }
  19.251 +            }
  19.252 +            return super.equals(obj);
  19.253 +        }
  19.254 +
  19.255 +        boolean isSameDomain(Object csdomain) {
  19.256 +            return this.csdomain == csdomain;
  19.257 +        }
  19.258 +
  19.259 +        private CodeSigner[] getPrivateSigners() {
  19.260 +            return vsigners;
  19.261 +        }
  19.262 +
  19.263 +        private java.security.cert.Certificate[] getPrivateCertificates() {
  19.264 +            return vcerts;
  19.265 +        }
  19.266 +    }
  19.267 +    private Map signerMap;
  19.268 +
  19.269 +    private synchronized Map signerMap() {
  19.270 +        if (signerMap == null) {
  19.271 +            /*
  19.272 +             * Snapshot signer state so it doesn't change on us. We care
  19.273 +             * only about the asserted signatures. Verification of
  19.274 +             * signature validity happens via the JarEntry apis.
  19.275 +             */
  19.276 +            signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size());
  19.277 +            signerMap.putAll(verifiedSigners);
  19.278 +            signerMap.putAll(sigFileSigners);
  19.279 +        }
  19.280 +        return signerMap;
  19.281 +    }
  19.282 +
  19.283 +    public synchronized Enumeration<String> entryNames(JarFile jar, final CodeSource[] cs) {
  19.284 +        final Map map = signerMap();
  19.285 +        final Iterator itor = map.entrySet().iterator();
  19.286 +        boolean matchUnsigned = false;
  19.287 +
  19.288 +        /*
  19.289 +         * Grab a single copy of the CodeSigner arrays. Check
  19.290 +         * to see if we can optimize CodeSigner equality test.
  19.291 +         */
  19.292 +        List req = new ArrayList(cs.length);
  19.293 +        for (int i = 0; i < cs.length; i++) {
  19.294 +            CodeSigner[] match = findMatchingSigners(cs[i]);
  19.295 +            if (match != null) {
  19.296 +                if (match.length > 0) {
  19.297 +                    req.add(match);
  19.298 +                } else {
  19.299 +                    matchUnsigned = true;
  19.300 +                }
  19.301 +            }
  19.302 +        }
  19.303 +
  19.304 +        final List signersReq = req;
  19.305 +        final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
  19.306 +
  19.307 +        return new Enumeration<String>() {
  19.308 +
  19.309 +            String name;
  19.310 +
  19.311 +            public boolean hasMoreElements() {
  19.312 +                if (name != null) {
  19.313 +                    return true;
  19.314 +                }
  19.315 +
  19.316 +                while (itor.hasNext()) {
  19.317 +                    Map.Entry e = (Map.Entry) itor.next();
  19.318 +                    if (signersReq.contains((CodeSigner[]) e.getValue())) {
  19.319 +                        name = (String) e.getKey();
  19.320 +                        return true;
  19.321 +                    }
  19.322 +                }
  19.323 +                while (enum2.hasMoreElements()) {
  19.324 +                    name = (String) enum2.nextElement();
  19.325 +                    return true;
  19.326 +                }
  19.327 +                return false;
  19.328 +            }
  19.329 +
  19.330 +            public String nextElement() {
  19.331 +                if (hasMoreElements()) {
  19.332 +                    String value = name;
  19.333 +                    name = null;
  19.334 +                    return value;
  19.335 +                }
  19.336 +                throw new NoSuchElementException();
  19.337 +            }
  19.338 +        };
  19.339 +    }
  19.340 +
  19.341 +    /*
  19.342 +     * Like entries() but screens out internal JAR mechanism entries
  19.343 +     * and includes signed entries with no ZIP data.
  19.344 +     */
  19.345 +    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration e) {
  19.346 +        final Map map = new HashMap();
  19.347 +        map.putAll(signerMap());
  19.348 +        final Enumeration enum_ = e;
  19.349 +        return new Enumeration<JarEntry>() {
  19.350 +
  19.351 +            Enumeration signers = null;
  19.352 +            JarEntry entry;
  19.353 +
  19.354 +            public boolean hasMoreElements() {
  19.355 +                if (entry != null) {
  19.356 +                    return true;
  19.357 +                }
  19.358 +                while (enum_.hasMoreElements()) {
  19.359 +                    ZipEntry ze = (ZipEntry) enum_.nextElement();
  19.360 +                    if (JarVerifier.isSigningRelated(ze.getName())) {
  19.361 +                        continue;
  19.362 +                    }
  19.363 +                    entry = jar.newEntry(ze);
  19.364 +                    return true;
  19.365 +                }
  19.366 +                if (signers == null) {
  19.367 +                    signers = Collections.enumeration(map.keySet());
  19.368 +                }
  19.369 +                while (signers.hasMoreElements()) {
  19.370 +                    String name = (String) signers.nextElement();
  19.371 +                    entry = jar.newEntry(new ZipEntry(name));
  19.372 +                    return true;
  19.373 +                }
  19.374 +
  19.375 +                // Any map entries left?
  19.376 +                return false;
  19.377 +            }
  19.378 +
  19.379 +            public JarEntry nextElement() {
  19.380 +                if (hasMoreElements()) {
  19.381 +                    JarEntry je = entry;
  19.382 +                    map.remove(je.getName());
  19.383 +                    entry = null;
  19.384 +                    return je;
  19.385 +                }
  19.386 +                throw new NoSuchElementException();
  19.387 +            }
  19.388 +        };
  19.389 +    }
  19.390 +    private Enumeration emptyEnumeration = new Enumeration<String>() {
  19.391 +
  19.392 +        public boolean hasMoreElements() {
  19.393 +            return false;
  19.394 +        }
  19.395 +
  19.396 +        public String nextElement() {
  19.397 +            throw new NoSuchElementException();
  19.398 +        }
  19.399 +    };
  19.400 +
  19.401 +    // true if file is part of the signature mechanism itself
  19.402 +    static boolean isSigningRelated(String name) {
  19.403 +        name = name.toUpperCase(Locale.ENGLISH);
  19.404 +        if (!name.startsWith("META-INF/")) {
  19.405 +            return false;
  19.406 +        }
  19.407 +        name = name.substring(9);
  19.408 +        if (name.indexOf('/') != -1) {
  19.409 +            return false;
  19.410 +        }
  19.411 +        if (name.endsWith(".DSA")
  19.412 +                || name.endsWith(".RSA")
  19.413 +                || name.endsWith(".SF")
  19.414 +                || name.endsWith(".EC")
  19.415 +                || name.startsWith("SIG-")
  19.416 +                || name.equals("MANIFEST.MF")) {
  19.417 +            return true;
  19.418 +        }
  19.419 +        return false;
  19.420 +    }
  19.421 +
  19.422 +    private Enumeration<String> unsignedEntryNames(JarFile jar) {
  19.423 +        final Map map = signerMap();
  19.424 +        final Enumeration entries = jar.entries();
  19.425 +        return new Enumeration<String>() {
  19.426 +
  19.427 +            String name;
  19.428 +
  19.429 +            /*
  19.430 +             * Grab entries from ZIP directory but screen out
  19.431 +             * metadata.
  19.432 +             */
  19.433 +            public boolean hasMoreElements() {
  19.434 +                if (name != null) {
  19.435 +                    return true;
  19.436 +                }
  19.437 +                while (entries.hasMoreElements()) {
  19.438 +                    String value;
  19.439 +                    ZipEntry e = (ZipEntry) entries.nextElement();
  19.440 +                    value = e.getName();
  19.441 +                    if (e.isDirectory() || isSigningRelated(value)) {
  19.442 +                        continue;
  19.443 +                    }
  19.444 +                    if (map.get(value) == null) {
  19.445 +                        name = value;
  19.446 +                        return true;
  19.447 +                    }
  19.448 +                }
  19.449 +                return false;
  19.450 +            }
  19.451 +
  19.452 +            public String nextElement() {
  19.453 +                if (hasMoreElements()) {
  19.454 +                    String value = name;
  19.455 +                    name = null;
  19.456 +                    return value;
  19.457 +                }
  19.458 +                throw new NoSuchElementException();
  19.459 +            }
  19.460 +        };
  19.461 +    }
  19.462 +    private List jarCodeSigners;
  19.463 +
  19.464 +    private synchronized List getJarCodeSigners() {
  19.465 +        CodeSigner[] signers;
  19.466 +        if (jarCodeSigners == null) {
  19.467 +            HashSet set = new HashSet();
  19.468 +            set.addAll(signerMap().values());
  19.469 +            jarCodeSigners = new ArrayList();
  19.470 +            jarCodeSigners.addAll(set);
  19.471 +        }
  19.472 +        return jarCodeSigners;
  19.473 +    }
  19.474 +
  19.475 +    public synchronized CodeSource[] getCodeSources(JarFile jar, URL url) {
  19.476 +        boolean hasUnsigned = unsignedEntryNames(jar).hasMoreElements();
  19.477 +
  19.478 +        return mapSignersToCodeSources(url, getJarCodeSigners(), hasUnsigned);
  19.479 +    }
  19.480 +
  19.481 +    public CodeSource getCodeSource(URL url, String name) {
  19.482 +        CodeSigner[] signers;
  19.483 +
  19.484 +        signers = (CodeSigner[]) signerMap().get(name);
  19.485 +        return mapSignersToCodeSource(url, signers);
  19.486 +    }
  19.487 +
  19.488 +    public CodeSource getCodeSource(URL url, JarFile jar, JarEntry je) {
  19.489 +        CodeSigner[] signers;
  19.490 +
  19.491 +        return mapSignersToCodeSource(url, getCodeSigners(jar, je));
  19.492 +    }
  19.493 +
  19.494 +    public void setEagerValidation(boolean eager) {
  19.495 +        eagerValidation = eager;
  19.496 +    }
  19.497 +
  19.498 +    public synchronized List getManifestDigests() {
  19.499 +        return Collections.unmodifiableList(manifestDigests);
  19.500 +    }
  19.501 +
  19.502 +    static CodeSource getUnsignedCS(URL url) {
  19.503 +        return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null);
  19.504 +    }
  19.505  }
    20.1 --- a/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Fri Feb 25 12:48:18 2011 -0800
    20.2 +++ b/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Tue Mar 01 14:04:59 2011 -0800
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -26,10 +26,38 @@
   20.11  package java.util.jar;
   20.12  
   20.13  import java.io.IOException;
   20.14 +import java.net.URL;
   20.15 +import java.security.CodeSource;
   20.16 +import java.util.Enumeration;
   20.17 +import java.util.List;
   20.18  import sun.misc.JavaUtilJarAccess;
   20.19  
   20.20  class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
   20.21      public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException {
   20.22          return jar.hasClassPathAttribute();
   20.23      }
   20.24 +
   20.25 +    public CodeSource[] getCodeSources(JarFile jar, URL url) {
   20.26 +        return jar.getCodeSources(url);
   20.27 +    }
   20.28 +
   20.29 +    public CodeSource getCodeSource(JarFile jar, URL url, String name) {
   20.30 +        return jar.getCodeSource(url, name);
   20.31 +    }
   20.32 +
   20.33 +    public Enumeration<String> entryNames(JarFile jar, CodeSource[] cs) {
   20.34 +        return jar.entryNames(cs);
   20.35 +    }
   20.36 +
   20.37 +    public Enumeration<JarEntry> entries2(JarFile jar) {
   20.38 +        return jar.entries2();
   20.39 +    }
   20.40 +
   20.41 +    public void setEagerValidation(JarFile jar, boolean eager) {
   20.42 +        jar.setEagerValidation(eager);
   20.43 +    }
   20.44 +
   20.45 +    public List getManifestDigests(JarFile jar) {
   20.46 +        return jar.getManifestDigests();
   20.47 +    }
   20.48  }
    21.1 --- a/src/share/classes/javax/script/ScriptEngineFactory.java	Fri Feb 25 12:48:18 2011 -0800
    21.2 +++ b/src/share/classes/javax/script/ScriptEngineFactory.java	Tue Mar 01 14:04:59 2011 -0800
    21.3 @@ -115,20 +115,19 @@
    21.4       * with respect to concurrent execution of scripts and maintenance of state is also defined.
    21.5       * These values for the <code><b>THREADING</b></code> key are:<br><br>
    21.6       * <ul>
    21.7 -     * <p><code>null</code> - The engine implementation is not thread safe, and cannot
    21.8 +     * <li><code>null</code> - The engine implementation is not thread safe, and cannot
    21.9       * be used to execute scripts concurrently on multiple threads.
   21.10 -     * <p><code>&quot;MULTITHREADED&quot;</code> - The engine implementation is internally
   21.11 +     * <li><code>&quot;MULTITHREADED&quot;</code> - The engine implementation is internally
   21.12       * thread-safe and scripts may execute concurrently although effects of script execution
   21.13       * on one thread may be visible to scripts on other threads.
   21.14 -     * <p><code>&quot;THREAD-ISOLATED&quot;</code> - The implementation satisfies the requirements
   21.15 +     * <li><code>&quot;THREAD-ISOLATED&quot;</code> - The implementation satisfies the requirements
   21.16       * of &quot;MULTITHREADED&quot;, and also, the engine maintains independent values
   21.17       * for symbols in scripts executing on different threads.
   21.18 -     * <p><code>&quot;STATELESS&quot;</code> - The implementation satisfies the requirements of
   21.19 -     * <code>&quot;THREAD-ISOLATED&quot;</code>.  In addition, script executions do not alter the
   21.20 +     * <li><code>&quot;STATELESS&quot;</code> - The implementation satisfies the requirements of
   21.21 +     * <li><code>&quot;THREAD-ISOLATED&quot;</code>.  In addition, script executions do not alter the
   21.22       * mappings in the <code>Bindings</code> which is the engine scope of the
   21.23       * <code>ScriptEngine</code>.  In particular, the keys in the <code>Bindings</code>
   21.24       * and their associated values are the same before and after the execution of the script.
   21.25 -     * </li>
   21.26       * </ul>
   21.27       * <br><br>
   21.28       * Implementations may define implementation-specific keys.
   21.29 @@ -145,22 +144,23 @@
   21.30       * of the supported scripting language.  For instance, an implementaton for a Javascript
   21.31       * engine might be;
   21.32       * <p>
   21.33 -     * <code><pre>
   21.34 +     * <pre>
   21.35 +     * <code>
   21.36       * public String getMethodCallSyntax(String obj,
   21.37       *                                   String m, String... args) {
   21.38       *      String ret = obj;
   21.39       *      ret += "." + m + "(";
   21.40       *      for (int i = 0; i < args.length; i++) {
   21.41       *          ret += args[i];
   21.42 -     *          if (i == args.length - 1) {
   21.43 -     *              ret += ")";
   21.44 -     *          } else {
   21.45 +     *          if (i < args.length - 1) {
   21.46       *              ret += ",";
   21.47       *          }
   21.48       *      }
   21.49 +     *      ret += ")";
   21.50       *      return ret;
   21.51       * }
   21.52 -     *</pre></code>
   21.53 +     *</code>
   21.54 +     *</pre>
   21.55       * <p>
   21.56       *
   21.57       * @param obj The name representing the object whose method is to be invoked. The
    22.1 --- a/src/share/classes/javax/sound/sampled/AudioSystem.java	Fri Feb 25 12:48:18 2011 -0800
    22.2 +++ b/src/share/classes/javax/sound/sampled/AudioSystem.java	Tue Mar 01 14:04:59 2011 -0800
    22.3 @@ -670,6 +670,12 @@
    22.4       * <p>The returned <code>TargetDataLine</code>'s default
    22.5       * audio format will be initialized with <code>format</code>.
    22.6       *
    22.7 +     * <p>If the system property
    22.8 +     * {@code javax.sound.sampled.TargetDataLine}
    22.9 +     * is defined or it is defined in the file &quot;sound.properties&quot;,
   22.10 +     * it is used to retrieve the default target data line.
   22.11 +     * For details, refer to the {@link AudioSystem class description}.
   22.12 +     *
   22.13       * @param format an <code>AudioFormat</code> object specifying
   22.14       *        the supported audio format of the returned line,
   22.15       *        or <code>null</code> for any audio format
   22.16 @@ -712,12 +718,6 @@
   22.17       * <p>The returned <code>TargetDataLine</code>'s default
   22.18       * audio format will be initialized with <code>format</code>.
   22.19       *
   22.20 -     * <p>If the system property
   22.21 -     * <code>javax.sound.sampled.TargetDataLine</code>
   22.22 -     * is defined or it is defined in the file &quot;sound.properties&quot;,
   22.23 -     * it is used to retrieve the default target data line.
   22.24 -     * For details, refer to the {@link AudioSystem class description}.
   22.25 -     *
   22.26       * @param format an <code>AudioFormat</code> object specifying
   22.27       *        the supported audio format of the returned line,
   22.28       *        or <code>null</code> for any audio format
    23.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialClob.java	Fri Feb 25 12:48:18 2011 -0800
    23.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialClob.java	Tue Mar 01 14:04:59 2011 -0800
    23.3 @@ -57,10 +57,10 @@
    23.4      private char buf[];
    23.5  
    23.6      /**
    23.7 -     * Internal Clob representation if SerialClob is intialized with a
    23.8 -     * Clob
    23.9 +     * Internal Clob representation if SerialClob is initialized with a
   23.10 +     * Clob. Null if SerialClob is initialized with a char[].
   23.11       */
   23.12 -    private Clob clob;
   23.13 +    private final Clob clob;
   23.14  
   23.15      /**
   23.16       * The length in characters of this <code>SerialClob</code> object's
   23.17 @@ -71,12 +71,12 @@
   23.18      private long len;
   23.19  
   23.20      /**
   23.21 -     * The original length in characters of tgus <code>SerialClob</code>
   23.22 -     * objects internal array of characters.
   23.23 +     * The original length in characters of this <code>SerialClob</code>
   23.24 +     * object's internal array of characters.
   23.25       *
   23.26       * @serial
   23.27       */
   23.28 -    private long origLen;
   23.29 +    private final long origLen;
   23.30  
   23.31      /**
   23.32       * Constructs a <code>SerialClob</code> object that is a serialized version of
   23.33 @@ -104,6 +104,7 @@
   23.34             buf[i] = ch[i];
   23.35          }
   23.36          origLen = len;
   23.37 +        clob = null;
   23.38      }
   23.39  
   23.40      /**
   23.41 @@ -117,19 +118,19 @@
   23.42       * the database. Otherwise, the new <code>SerialClob</code> object
   23.43       * object will contain no data.
   23.44       * <p>
   23.45 -     * Note: The <code>Clob</code> object supplied to this constructor cannot
   23.46 -     * return <code>null</code> for the <code>Clob.getCharacterStream()</code>
   23.47 +     * Note: The <code>Clob</code> object supplied to this constructor must
   23.48 +     * return non-null for both the <code>Clob.getCharacterStream()</code>
   23.49       * and <code>Clob.getAsciiStream</code> methods. This <code>SerialClob</code>
   23.50 -     * constructor cannot  serialize a <code>Clob</code> object in this instance
   23.51 +     * constructor cannot serialize a <code>Clob</code> object in this instance
   23.52       * and will throw an <code>SQLException</code> object.
   23.53       *
   23.54       * @param  clob the <code>Clob</code> object from which this
   23.55       *     <code>SerialClob</code> object is to be constructed; cannot be null
   23.56       * @throws SerialException if an error occurs during serialization
   23.57       * @throws SQLException if a SQL error occurs in capturing the CLOB;
   23.58 -     *     if the <code>Clob</code> object is a null; or if both the
   23.59 +     *     if the <code>Clob</code> object is a null; or if either of the
   23.60       *     <code>Clob.getCharacterStream()</code> and <code>Clob.getAsciiStream()</code>
   23.61 -     *     methods on the <code>Clob</code> return a null
   23.62 +     *     methods on the <code>Clob</code> returns a null
   23.63       * @see java.sql.Clob
   23.64       */
   23.65      public SerialClob(Clob clob) throws SerialException, SQLException {
   23.66 @@ -144,19 +145,27 @@
   23.67          int read = 0;
   23.68          int offset = 0;
   23.69  
   23.70 -        BufferedReader reader;
   23.71 -        if ( (((reader = new BufferedReader(clob.getCharacterStream())) == null)) &&
   23.72 -            (clob.getAsciiStream() == null)) {
   23.73 -            throw new SQLException("Invalid Clob object. Calls to getCharacterStream " +
   23.74 -                "and getAsciiStream return null which cannot be serialized.");
   23.75 -        }
   23.76 +        try (Reader charStream = clob.getCharacterStream()) {
   23.77 +            if (charStream == null) {
   23.78 +                throw new SQLException("Invalid Clob object. The call to getCharacterStream " +
   23.79 +                    "returned null which cannot be serialized.");
   23.80 +            }
   23.81  
   23.82 -        try {
   23.83 -            do {
   23.84 -                read = reader.read(buf, offset, (int)(len - offset));
   23.85 -                offset += read;
   23.86 -            } while (read > 0);
   23.87 +            // Note: get an ASCII stream in order to null-check it,
   23.88 +            // even though we don't do anything with it.
   23.89 +            try (InputStream asciiStream = clob.getAsciiStream()) {
   23.90 +                if (asciiStream == null) {
   23.91 +                    throw new SQLException("Invalid Clob object. The call to getAsciiStream " +
   23.92 +                        "returned null which cannot be serialized.");
   23.93 +                }
   23.94 +            }
   23.95  
   23.96 +            try (Reader reader = new BufferedReader(charStream)) {
   23.97 +                do {
   23.98 +                    read = reader.read(buf, offset, (int)(len - offset));
   23.99 +                    offset += read;
  23.100 +                } while (read > 0);
  23.101 +            }
  23.102          } catch (java.io.IOException ex) {
  23.103              throw new SerialException("SerialClob: " + ex.getMessage());
  23.104          }
  23.105 @@ -207,13 +216,13 @@
  23.106       *     used to create this <code>SerialClob</code> object
  23.107       */
  23.108      public java.io.InputStream getAsciiStream() throws SerialException, SQLException {
  23.109 -       if (this.clob != null) {
  23.110 -             return this.clob.getAsciiStream();
  23.111 -         } else {
  23.112 -             throw new SerialException("Unsupported operation. SerialClob cannot " +
  23.113 +        if (this.clob != null) {
  23.114 +            return this.clob.getAsciiStream();
  23.115 +        } else {
  23.116 +            throw new SerialException("Unsupported operation. SerialClob cannot " +
  23.117                  "return a the CLOB value as an ascii stream, unless instantiated " +
  23.118                  "with a fully implemented Clob object.");
  23.119 -         }
  23.120 +        }
  23.121      }
  23.122  
  23.123      /**
    24.1 --- a/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Fri Feb 25 12:48:18 2011 -0800
    24.2 +++ b/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Tue Mar 01 14:04:59 2011 -0800
    24.3 @@ -32,6 +32,7 @@
    24.4  import javax.sql.*;
    24.5  
    24.6  import java.io.FileInputStream;
    24.7 +import java.io.InputStream;
    24.8  import java.io.IOException;
    24.9  import java.io.FileNotFoundException;
   24.10  
   24.11 @@ -366,7 +367,9 @@
   24.12                      // Load user's implementation of SyncProvider
   24.13                      // here. -Drowset.properties=/abc/def/pqr.txt
   24.14                      ROWSET_PROPERTIES = strRowsetProperties;
   24.15 -                    properties.load(new FileInputStream(ROWSET_PROPERTIES));
   24.16 +                    try (FileInputStream fis = new FileInputStream(ROWSET_PROPERTIES)) {
   24.17 +                        properties.load(fis);
   24.18 +                    }
   24.19                      parseProperties(properties);
   24.20                  }
   24.21  
   24.22 @@ -376,12 +379,19 @@
   24.23                  ROWSET_PROPERTIES = "javax" + strFileSep + "sql" +
   24.24                          strFileSep + "rowset" + strFileSep +
   24.25                          "rowset.properties";
   24.26 -                // properties.load(
   24.27 -                //                ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES));
   24.28  
   24.29                  ClassLoader cl = Thread.currentThread().getContextClassLoader();
   24.30  
   24.31 -                properties.load(cl.getResourceAsStream(ROWSET_PROPERTIES));
   24.32 +                try (InputStream stream =
   24.33 +                         (cl == null) ? ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES)
   24.34 +                                      : cl.getResourceAsStream(ROWSET_PROPERTIES)) {
   24.35 +                    if (stream == null) {
   24.36 +                        throw new SyncFactoryException(
   24.37 +                            "Resource " + ROWSET_PROPERTIES + " not found");
   24.38 +                    }
   24.39 +                    properties.load(stream);
   24.40 +                }
   24.41 +
   24.42                  parseProperties(properties);
   24.43  
   24.44              // removed else, has properties should sum together
    25.1 --- a/src/share/classes/javax/swing/JComponent.java	Fri Feb 25 12:48:18 2011 -0800
    25.2 +++ b/src/share/classes/javax/swing/JComponent.java	Tue Mar 01 14:04:59 2011 -0800
    25.3 @@ -4910,14 +4910,17 @@
    25.4       * Returns {@code true} if a paint triggered on a child component should cause
    25.5       * painting to originate from this Component, or one of its ancestors.
    25.6       * <p/>
    25.7 -     * Calling {@link JComponent#repaint} on a Swing component will be delegated to
    25.8 -     * the first ancestor which {@code isPaintingOrigin()} returns {@code true},
    25.9 -     * if there are any.
   25.10 +     * Calling {@link #repaint} or {@link #paintImmediately(int, int, int, int)}
   25.11 +     * on a Swing component will result in calling
   25.12 +     * the {@link JComponent#paintImmediately(int, int, int, int)} method of
   25.13 +     * the first ancestor which {@code isPaintingOrigin()} returns {@code true}, if there are any.
   25.14       * <p/>
   25.15 -     * {@code JComponent} subclasses that need to be repainted when any of their
   25.16 +     * {@code JComponent} subclasses that need to be painted when any of their
   25.17       * children are repainted should override this method to return {@code true}.
   25.18       *
   25.19       * @return always returns {@code false}
   25.20 +     *
   25.21 +     * @see #paintImmediately(int, int, int, int)
   25.22       */
   25.23      protected boolean isPaintingOrigin() {
   25.24          return false;
   25.25 @@ -4932,12 +4935,16 @@
   25.26       * and can collapse redundant requests into a single paint call.
   25.27       * This method is useful if one needs to update the display while
   25.28       * the current event is being dispatched.
   25.29 +     * <p>
   25.30 +     * This method is to be overridden when the dirty region needs to be changed
   25.31 +     * for components that are painting origins.
   25.32       *
   25.33       * @param x  the x value of the region to be painted
   25.34       * @param y  the y value of the region to be painted
   25.35       * @param w  the width of the region to be painted
   25.36       * @param h  the height of the region to be painted
   25.37       * @see #repaint
   25.38 +     * @see #isPaintingOrigin()
   25.39       */
   25.40      public void paintImmediately(int x,int y,int w, int h) {
   25.41          Component c = this;
   25.42 @@ -4946,6 +4953,15 @@
   25.43          if(!isShowing()) {
   25.44              return;
   25.45          }
   25.46 +
   25.47 +        JComponent paintingOigin = SwingUtilities.getPaintingOrigin(this);
   25.48 +        if (paintingOigin != null) {
   25.49 +            Rectangle rectangle = SwingUtilities.convertRectangle(
   25.50 +                    c, new Rectangle(x, y, w, h), paintingOigin);
   25.51 +            paintingOigin.paintImmediately(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
   25.52 +            return;
   25.53 +        }
   25.54 +
   25.55          while(!c.isOpaque()) {
   25.56              parent = c.getParent();
   25.57              if(parent != null) {
    26.1 --- a/src/share/classes/javax/swing/JLayer.java	Fri Feb 25 12:48:18 2011 -0800
    26.2 +++ b/src/share/classes/javax/swing/JLayer.java	Tue Mar 01 14:04:59 2011 -0800
    26.3 @@ -156,8 +156,9 @@
    26.4      // when layerUI is serializable
    26.5      private LayerUI<? super V> layerUI;
    26.6      private JPanel glassPane;
    26.7 -    private boolean isPainting;
    26.8      private long eventMask;
    26.9 +    private transient boolean isPainting;
   26.10 +    private transient boolean isPaintingImmediately;
   26.11  
   26.12      private static final LayerEventController eventController =
   26.13              new LayerEventController();
   26.14 @@ -393,17 +394,25 @@
   26.15      }
   26.16  
   26.17      /**
   26.18 -     * Delegates repainting to {@link javax.swing.plaf.LayerUI#repaint} method.
   26.19 +     * Delegates its functionality to the
   26.20 +     * {@link javax.swing.plaf.LayerUI#paintImmediately(int, int, int, int, JLayer)} method,
   26.21 +     * if {@code LayerUI} is set.
   26.22       *
   26.23 -     * @param tm  this parameter is not used
   26.24 -     * @param x  the x value of the dirty region
   26.25 -     * @param y  the y value of the dirty region
   26.26 -     * @param width  the width of the dirty region
   26.27 -     * @param height  the height of the dirty region
   26.28 +     * @param x  the x value of the region to be painted
   26.29 +     * @param y  the y value of the region to be painted
   26.30 +     * @param w  the width of the region to be painted
   26.31 +     * @param h  the height of the region to be painted
   26.32       */
   26.33 -    public void repaint(long tm, int x, int y, int width, int height) {
   26.34 -        if (getUI() != null) {
   26.35 -            getUI().repaint(tm, x, y, width, height, this);
   26.36 +    public void paintImmediately(int x, int y, int w, int h) {
   26.37 +        if (!isPaintingImmediately && getUI() != null) {
   26.38 +            isPaintingImmediately = true;
   26.39 +            try {
   26.40 +                getUI().paintImmediately(x, y, w, h, this);
   26.41 +            } finally {
   26.42 +                isPaintingImmediately = false;
   26.43 +            }
   26.44 +        } else {
   26.45 +            super.paintImmediately(x, y, w, h);
   26.46          }
   26.47      }
   26.48  
   26.49 @@ -415,8 +424,11 @@
   26.50      public void paint(Graphics g) {
   26.51          if (!isPainting) {
   26.52              isPainting = true;
   26.53 -            super.paintComponent(g);
   26.54 -            isPainting = false;
   26.55 +            try {
   26.56 +                super.paintComponent(g);
   26.57 +            } finally {
   26.58 +                isPainting = false;
   26.59 +            }
   26.60          } else {
   26.61              super.paint(g);
   26.62          }
    27.1 --- a/src/share/classes/javax/swing/LookAndFeel.java	Fri Feb 25 12:48:18 2011 -0800
    27.2 +++ b/src/share/classes/javax/swing/LookAndFeel.java	Tue Mar 01 14:04:59 2011 -0800
    27.3 @@ -332,12 +332,13 @@
    27.4      {
    27.5          JTextComponent.KeyBinding[] rv = new JTextComponent.KeyBinding[keyBindingList.length / 2];
    27.6  
    27.7 -        for(int i = 0; i < keyBindingList.length; i += 2) {
    27.8 -            KeyStroke keystroke = (keyBindingList[i] instanceof KeyStroke)
    27.9 -                ? (KeyStroke)keyBindingList[i]
   27.10 -                : KeyStroke.getKeyStroke((String)keyBindingList[i]);
   27.11 -            String action = (String)keyBindingList[i+1];
   27.12 -            rv[i / 2] = new JTextComponent.KeyBinding(keystroke, action);
   27.13 +        for(int i = 0; i < rv.length; i ++) {
   27.14 +            Object o = keyBindingList[2 * i];
   27.15 +            KeyStroke keystroke = (o instanceof KeyStroke)
   27.16 +                ? (KeyStroke) o
   27.17 +                : KeyStroke.getKeyStroke((String) o);
   27.18 +            String action = (String) keyBindingList[2 * i + 1];
   27.19 +            rv[i] = new JTextComponent.KeyBinding(keystroke, action);
   27.20          }
   27.21  
   27.22          return rv;
    28.1 --- a/src/share/classes/javax/swing/RepaintManager.java	Fri Feb 25 12:48:18 2011 -0800
    28.2 +++ b/src/share/classes/javax/swing/RepaintManager.java	Tue Mar 01 14:04:59 2011 -0800
    28.3 @@ -438,7 +438,6 @@
    28.4       * @param y Y coordinate of the region to repaint
    28.5       * @param w Width of the region to repaint
    28.6       * @param h Height of the region to repaint
    28.7 -     * @see JComponent#isPaintingOrigin()
    28.8       * @see JComponent#repaint
    28.9       */
   28.10      public void addDirtyRegion(JComponent c, int x, int y, int w, int h)
   28.11 @@ -448,16 +447,6 @@
   28.12              delegate.addDirtyRegion(c, x, y, w, h);
   28.13              return;
   28.14          }
   28.15 -        Container p = c;
   28.16 -        while ((p = p.getParent()) instanceof JComponent) {
   28.17 -            JComponent jp = (JComponent) p;
   28.18 -            if (jp.isPaintingOrigin()) {
   28.19 -                Rectangle rectangle = SwingUtilities.convertRectangle(
   28.20 -                        c, new Rectangle(x, y, w, h), jp);
   28.21 -                jp.repaint(0, rectangle.x, rectangle.y, rectangle.width, rectangle.height);
   28.22 -                return;
   28.23 -            }
   28.24 -        }
   28.25          addDirtyRegion0(c, x, y, w, h);
   28.26      }
   28.27  
    29.1 --- a/src/share/classes/javax/swing/SwingUtilities.java	Fri Feb 25 12:48:18 2011 -0800
    29.2 +++ b/src/share/classes/javax/swing/SwingUtilities.java	Tue Mar 01 14:04:59 2011 -0800
    29.3 @@ -1532,6 +1532,17 @@
    29.4          return applet;
    29.5      }
    29.6  
    29.7 +    static JComponent getPaintingOrigin(JComponent c) {
    29.8 +        Container p = c;
    29.9 +        while ((p = p.getParent()) instanceof JComponent) {
   29.10 +            JComponent jp = (JComponent) p;
   29.11 +            if (jp.isPaintingOrigin()) {
   29.12 +                return jp;
   29.13 +            }
   29.14 +        }
   29.15 +        return null;
   29.16 +    }
   29.17 +
   29.18      /**
   29.19       * Process the key bindings for the <code>Component</code> associated with
   29.20       * <code>event</code>. This method is only useful if
    30.1 --- a/src/share/classes/javax/swing/plaf/LayerUI.java	Fri Feb 25 12:48:18 2011 -0800
    30.2 +++ b/src/share/classes/javax/swing/plaf/LayerUI.java	Tue Mar 01 14:04:59 2011 -0800
    30.3 @@ -703,21 +703,19 @@
    30.4      }
    30.5  
    30.6      /**
    30.7 -     * Adds the specified region to the dirty region list if the component
    30.8 -     * is showing.  The component will be repainted after all of the
    30.9 -     * currently pending events have been dispatched.
   30.10 +     * Paints the specified region in the {@code JLayer} this {@code LayerUI} is set to, immediately.
   30.11       * <p/>
   30.12       * This method is to be overridden when the dirty region needs to be changed.
   30.13 +     * The default implementation delegates its functionality to {@link JComponent#paintImmediately(int, int, int, int)}.
   30.14       *
   30.15 -     * @param tm  this parameter is not used
   30.16 -     * @param x  the x value of the dirty region
   30.17 -     * @param y  the y value of the dirty region
   30.18 -     * @param width  the width of the dirty region
   30.19 -     * @param height  the height of the dirty region
   30.20 -     * @see java.awt.Component#isShowing
   30.21 -     * @see RepaintManager#addDirtyRegion
   30.22 +     * @param x  the x value of the region to be painted
   30.23 +     * @param y  the y value of the region to be painted
   30.24 +     * @param w  the width of the region to be painted
   30.25 +     * @param h  the height of the region to be painted
   30.26 +     *
   30.27 +     * @see JComponent#paintImmediately(int, int, int, int)
   30.28       */
   30.29 -    public void repaint(long tm, int x, int y, int width, int height, JLayer<? extends V> l) {
   30.30 -        RepaintManager.currentManager(l).addDirtyRegion(l, x, y, width, height);
   30.31 +    public void paintImmediately(int x, int y, int width, int height, JLayer<? extends V> l) {
   30.32 +        l.paintImmediately(x, y, width, height);
   30.33      }
   30.34  }
    31.1 --- a/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Fri Feb 25 12:48:18 2011 -0800
    31.2 +++ b/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Tue Mar 01 14:04:59 2011 -0800
    31.3 @@ -1965,18 +1965,18 @@
    31.4      }
    31.5  
    31.6      /** Returns the preferred size to properly display the tree,
    31.7 -      * this is a cover method for getPreferredSize(c, false).
    31.8 +      * this is a cover method for getPreferredSize(c, true).
    31.9        */
   31.10      public Dimension getPreferredSize(JComponent c) {
   31.11          return getPreferredSize(c, true);
   31.12      }
   31.13  
   31.14      /** Returns the preferred size to represent the tree in
   31.15 -      * <I>c</I>.  If <I>checkConsistancy</I> is true
   31.16 -      * <b>checkConsistancy</b> is messaged first.
   31.17 +      * <I>c</I>.  If <I>checkConsistency</I> is true
   31.18 +      * <b>checkConsistency</b> is messaged first.
   31.19        */
   31.20      public Dimension getPreferredSize(JComponent c,
   31.21 -                                      boolean checkConsistancy) {
   31.22 +                                      boolean checkConsistency) {
   31.23          Dimension       pSize = this.getPreferredMinSize();
   31.24  
   31.25          if(!validCachedPreferredSize)
    32.1 --- a/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Fri Feb 25 12:48:18 2011 -0800
    32.2 +++ b/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Tue Mar 01 14:04:59 2011 -0800
    32.3 @@ -510,7 +510,6 @@
    32.4          Font holdf = g.getFont();
    32.5          Color holdc = g.getColor();
    32.6  
    32.7 -        paintBackground(g, lh);
    32.8          paintCheckIcon(g, lh, lr);
    32.9          paintIcon(g, lh, lr);
   32.10          paintText(g, lh, lr);
    33.1 --- a/src/share/classes/sun/awt/image/ImageFetcher.java	Fri Feb 25 12:48:18 2011 -0800
    33.2 +++ b/src/share/classes/sun/awt/image/ImageFetcher.java	Tue Mar 01 14:04:59 2011 -0800
    33.3 @@ -61,8 +61,10 @@
    33.4      /**
    33.5        * Adds an ImageFetchable to the queue of items to fetch.  Instantiates
    33.6        * a new ImageFetcher if it's reasonable to do so.
    33.7 +      * If there is no available fetcher to process an ImageFetchable, then
    33.8 +      * reports failure to caller.
    33.9        */
   33.10 -    public static void add(ImageFetchable src) {
   33.11 +    public static boolean add(ImageFetchable src) {
   33.12          final FetcherInfo info = FetcherInfo.getFetcherInfo();
   33.13          synchronized(info.waitList) {
   33.14              if (!info.waitList.contains(src)) {
   33.15 @@ -71,9 +73,23 @@
   33.16                              info.numFetchers < info.fetchers.length) {
   33.17                      createFetchers(info);
   33.18                  }
   33.19 -                info.waitList.notify();
   33.20 +                /* Creation of new fetcher may fail due to high vm load
   33.21 +                 * or some other reason.
   33.22 +                 * If there is already exist, but busy, fetcher, we leave
   33.23 +                 * the src in queue (it will be handled by existing
   33.24 +                 * fetcher later).
   33.25 +                 * Otherwise, we report failure: there is no fetcher
   33.26 +                 * to handle the src.
   33.27 +                 */
   33.28 +                if (info.numFetchers > 0) {
   33.29 +                    info.waitList.notify();
   33.30 +                } else {
   33.31 +                    info.waitList.removeElement(src);
   33.32 +                    return false;
   33.33 +                }
   33.34              }
   33.35          }
   33.36 +        return true;
   33.37      }
   33.38  
   33.39      /**
   33.40 @@ -291,11 +307,15 @@
   33.41           public Object run() {
   33.42               for (int i = 0; i < info.fetchers.length; i++) {
   33.43                 if (info.fetchers[i] == null) {
   33.44 -                   info.fetchers[i] = new ImageFetcher(
   33.45 +                   ImageFetcher f = new ImageFetcher(
   33.46                             fetcherGroup, i);
   33.47 -                   info.fetchers[i].start();
   33.48 -                   info.numFetchers++;
   33.49 -                   break;
   33.50 +                   try {
   33.51 +                       f.start();
   33.52 +                       info.fetchers[i] = f;
   33.53 +                       info.numFetchers++;
   33.54 +                       break;
   33.55 +                   } catch (Error e) {
   33.56 +                   }
   33.57                 }
   33.58               }
   33.59            return null;
    34.1 --- a/src/share/classes/sun/awt/image/InputStreamImageSource.java	Fri Feb 25 12:48:18 2011 -0800
    34.2 +++ b/src/share/classes/sun/awt/image/InputStreamImageSource.java	Tue Mar 01 14:04:59 2011 -0800
    34.3 @@ -164,8 +164,13 @@
    34.4  
    34.5      private synchronized void startProduction() {
    34.6          if (!awaitingFetch) {
    34.7 -            ImageFetcher.add(this);
    34.8 -            awaitingFetch = true;
    34.9 +            if (ImageFetcher.add(this)) {
   34.10 +                awaitingFetch = true;
   34.11 +            } else {
   34.12 +                ImageConsumerQueue cq = consumers;
   34.13 +                consumers = null;
   34.14 +                errorAllConsumers(cq, false);
   34.15 +            }
   34.16          }
   34.17      }
   34.18  
    35.1 --- a/src/share/classes/sun/font/FontUtilities.java	Fri Feb 25 12:48:18 2011 -0800
    35.2 +++ b/src/share/classes/sun/font/FontUtilities.java	Tue Mar 01 14:04:59 2011 -0800
    35.3 @@ -30,6 +30,8 @@
    35.4  import java.io.File;
    35.5  import java.io.FileInputStream;
    35.6  import java.io.InputStreamReader;
    35.7 +import java.lang.ref.SoftReference;
    35.8 +import java.util.concurrent.ConcurrentHashMap;
    35.9  import java.security.AccessController;
   35.10  
   35.11  import java.security.PrivilegedAction;
   35.12 @@ -383,6 +385,10 @@
   35.13       * }
   35.14       * return fuir;
   35.15       */
   35.16 +    private static volatile
   35.17 +        SoftReference<ConcurrentHashMap<PhysicalFont, CompositeFont>>
   35.18 +        compMapRef = new SoftReference(null);
   35.19 +
   35.20      public static FontUIResource getCompositeFontUIResource(Font font) {
   35.21  
   35.22          FontUIResource fuir = new FontUIResource(font);
   35.23 @@ -402,12 +408,22 @@
   35.24  
   35.25          FontManager fm = FontManagerFactory.getInstance();
   35.26          CompositeFont dialog2D =
   35.27 -          (CompositeFont) fm.findFont2D("dialog", font.getStyle(), FontManager.NO_FALLBACK);
   35.28 +          (CompositeFont) fm.findFont2D("dialog", font.getStyle(),
   35.29 +                                        FontManager.NO_FALLBACK);
   35.30          if (dialog2D == null) { /* shouldn't happen */
   35.31              return fuir;
   35.32          }
   35.33          PhysicalFont physicalFont = (PhysicalFont)font2D;
   35.34 -        CompositeFont compFont = new CompositeFont(physicalFont, dialog2D);
   35.35 +        ConcurrentHashMap<PhysicalFont, CompositeFont> compMap = compMapRef.get();
   35.36 +        if (compMap == null) { // Its been collected.
   35.37 +            compMap = new ConcurrentHashMap<PhysicalFont, CompositeFont>();
   35.38 +            compMapRef = new SoftReference(compMap);
   35.39 +        }
   35.40 +        CompositeFont compFont = compMap.get(physicalFont);
   35.41 +        if (compFont == null) {
   35.42 +            compFont = new CompositeFont(physicalFont, dialog2D);
   35.43 +            compMap.put(physicalFont, compFont);
   35.44 +        }
   35.45          FontAccess.getFontAccess().setFont2D(fuir, compFont.handle);
   35.46          /* marking this as a created font is needed as only created fonts
   35.47           * copy their creator's handles.
    36.1 --- a/src/share/classes/sun/misc/JarIndex.java	Fri Feb 25 12:48:18 2011 -0800
    36.2 +++ b/src/share/classes/sun/misc/JarIndex.java	Tue Mar 01 14:04:59 2011 -0800
    36.3 @@ -106,6 +106,19 @@
    36.4      /**
    36.5       * Returns the jar index, or <code>null</code> if none.
    36.6       *
    36.7 +     * This single parameter version of the method is retained
    36.8 +     * for binary compatibility with earlier releases.
    36.9 +     *
   36.10 +     * @param jar the JAR file to get the index from.
   36.11 +     * @exception IOException if an I/O error has occurred.
   36.12 +     */
   36.13 +    public static JarIndex getJarIndex(JarFile jar) throws IOException {
   36.14 +        return getJarIndex(jar, null);
   36.15 +    }
   36.16 +
   36.17 +    /**
   36.18 +     * Returns the jar index, or <code>null</code> if none.
   36.19 +     *
   36.20       * @param jar the JAR file to get the index from.
   36.21       * @exception IOException if an I/O error has occurred.
   36.22       */
    37.1 --- a/src/share/classes/sun/misc/JavaUtilJarAccess.java	Fri Feb 25 12:48:18 2011 -0800
    37.2 +++ b/src/share/classes/sun/misc/JavaUtilJarAccess.java	Tue Mar 01 14:04:59 2011 -0800
    37.3 @@ -1,5 +1,5 @@
    37.4  /*
    37.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    37.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    37.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.8   *
    37.9   * This code is free software; you can redistribute it and/or modify it
   37.10 @@ -26,8 +26,19 @@
   37.11  package sun.misc;
   37.12  
   37.13  import java.io.IOException;
   37.14 +import java.net.URL;
   37.15 +import java.security.CodeSource;
   37.16 +import java.util.Enumeration;
   37.17 +import java.util.List;
   37.18 +import java.util.jar.JarEntry;
   37.19  import java.util.jar.JarFile;
   37.20  
   37.21  public interface JavaUtilJarAccess {
   37.22      public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException;
   37.23 +    public CodeSource[] getCodeSources(JarFile jar, URL url);
   37.24 +    public CodeSource getCodeSource(JarFile jar, URL url, String name);
   37.25 +    public Enumeration<String> entryNames(JarFile jar, CodeSource[] cs);
   37.26 +    public Enumeration<JarEntry> entries2(JarFile jar);
   37.27 +    public void setEagerValidation(JarFile jar, boolean eager);
   37.28 +    public List getManifestDigests(JarFile jar);
   37.29  }
    38.1 --- a/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	Fri Feb 25 12:48:18 2011 -0800
    38.2 +++ b/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	Tue Mar 01 14:04:59 2011 -0800
    38.3 @@ -27,6 +27,9 @@
    38.4  
    38.5  import java.io.*;
    38.6  import java.net.*;
    38.7 +import java.nio.file.Files;
    38.8 +import java.nio.file.Path;
    38.9 +import java.nio.file.StandardCopyOption;
   38.10  import java.util.*;
   38.11  import java.util.jar.*;
   38.12  import java.util.zip.ZipFile;
   38.13 @@ -208,38 +211,23 @@
   38.14              JarFile result = null;
   38.15  
   38.16              /* get the stream before asserting privileges */
   38.17 -            final InputStream in =  url.openConnection().getInputStream();
   38.18 -
   38.19 -            try {
   38.20 +            try (final InputStream in = url.openConnection().getInputStream()) {
   38.21                  result = AccessController.doPrivileged(
   38.22                      new PrivilegedExceptionAction<JarFile>() {
   38.23                          public JarFile run() throws IOException {
   38.24 -                            OutputStream out = null;
   38.25 -                            File tmpFile = null;
   38.26 +                            Path tmpFile = Files.createTempFile("jar_cache", null);
   38.27                              try {
   38.28 -                                tmpFile = File.createTempFile("jar_cache", null);
   38.29 -                                tmpFile.deleteOnExit();
   38.30 -                                out  = new FileOutputStream(tmpFile);
   38.31 -                                int read = 0;
   38.32 -                                byte[] buf = new byte[BUF_SIZE];
   38.33 -                                while ((read = in.read(buf)) != -1) {
   38.34 -                                    out.write(buf, 0, read);
   38.35 +                                Files.copy(in, tmpFile, StandardCopyOption.REPLACE_EXISTING);
   38.36 +                                JarFile jarFile = new URLJarFile(tmpFile.toFile(), closeController);
   38.37 +                                tmpFile.toFile().deleteOnExit();
   38.38 +                                return jarFile;
   38.39 +                            } catch (Throwable thr) {
   38.40 +                                try {
   38.41 +                                    Files.delete(tmpFile);
   38.42 +                                } catch (IOException ioe) {
   38.43 +                                    thr.addSuppressed(ioe);
   38.44                                  }
   38.45 -                                out.close();
   38.46 -                                out = null;
   38.47 -                                return new URLJarFile(tmpFile, closeController);
   38.48 -                            } catch (IOException e) {
   38.49 -                                if (tmpFile != null) {
   38.50 -                                    tmpFile.delete();
   38.51 -                                }
   38.52 -                                throw e;
   38.53 -                            } finally {
   38.54 -                                if (in != null) {
   38.55 -                                    in.close();
   38.56 -                                }
   38.57 -                                if (out != null) {
   38.58 -                                    out.close();
   38.59 -                                }
   38.60 +                                throw thr;
   38.61                              }
   38.62                          }
   38.63                      });
    39.1 --- a/src/share/classes/sun/nio/ch/FileChannelImpl.java	Fri Feb 25 12:48:18 2011 -0800
    39.2 +++ b/src/share/classes/sun/nio/ch/FileChannelImpl.java	Tue Mar 01 14:04:59 2011 -0800
    39.3 @@ -51,6 +51,7 @@
    39.4      // File access mode (immutable)
    39.5      private final boolean writable;
    39.6      private final boolean readable;
    39.7 +    private final boolean append;
    39.8  
    39.9      // Required to prevent finalization of creating stream (immutable)
   39.10      private final Object parent;
   39.11 @@ -67,6 +68,7 @@
   39.12          this.fd = fd;
   39.13          this.readable = readable;
   39.14          this.writable = writable;
   39.15 +        this.append = append;
   39.16          this.parent = parent;
   39.17          this.nd = new FileDispatcherImpl(append);
   39.18      }
   39.19 @@ -242,7 +244,8 @@
   39.20                  if (!isOpen())
   39.21                      return 0;
   39.22                  do {
   39.23 -                    p = position0(fd, -1);
   39.24 +                    // in append-mode then position is advanced to end before writing
   39.25 +                    p = (append) ? nd.size(fd) : position0(fd, -1);
   39.26                  } while ((p == IOStatus.INTERRUPTED) && isOpen());
   39.27                  return IOStatus.normalize(p);
   39.28              } finally {
    40.1 --- a/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Fri Feb 25 12:48:18 2011 -0800
    40.2 +++ b/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Tue Mar 01 14:04:59 2011 -0800
    40.3 @@ -87,6 +87,7 @@
    40.4                                  gssLibs = new String[]{
    40.5                                      "libgssapi.so",
    40.6                                      "libgssapi_krb5.so",
    40.7 +                                    "libgssapi_krb5.so.2",
    40.8                                  };
    40.9                              }
   40.10                          } else {
    41.1 --- a/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Fri Feb 25 12:48:18 2011 -0800
    41.2 +++ b/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Tue Mar 01 14:04:59 2011 -0800
    41.3 @@ -231,13 +231,6 @@
    41.4          AdaptableX509CertSelector issuerSelector =
    41.5                          new AdaptableX509CertSelector();
    41.6  
    41.7 -        // check trusted certificate's key usage
    41.8 -        boolean[] usages = trustedCert.getKeyUsage();
    41.9 -        if (usages != null) {
   41.10 -            usages[5] = true;    // keyCertSign
   41.11 -            issuerSelector.setKeyUsage(usages);
   41.12 -        }
   41.13 -
   41.14          // check trusted certificate's subject
   41.15          issuerSelector.setSubject(firstCert.getIssuerX500Principal());
   41.16  
    42.1 --- a/src/share/classes/sun/security/util/SignatureFileVerifier.java	Fri Feb 25 12:48:18 2011 -0800
    42.2 +++ b/src/share/classes/sun/security/util/SignatureFileVerifier.java	Tue Mar 01 14:04:59 2011 -0800
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
   42.10 @@ -181,7 +181,8 @@
   42.11       *
   42.12       *
   42.13       */
   42.14 -    public void process(Hashtable<String, CodeSigner[]> signers)
   42.15 +    public void process(Hashtable<String, CodeSigner[]> signers,
   42.16 +            List manifestDigests)
   42.17          throws IOException, SignatureException, NoSuchAlgorithmException,
   42.18              JarException, CertificateException
   42.19      {
   42.20 @@ -190,14 +191,15 @@
   42.21          Object obj = null;
   42.22          try {
   42.23              obj = Providers.startJarVerification();
   42.24 -            processImpl(signers);
   42.25 +            processImpl(signers, manifestDigests);
   42.26          } finally {
   42.27              Providers.stopJarVerification(obj);
   42.28          }
   42.29  
   42.30      }
   42.31  
   42.32 -    private void processImpl(Hashtable<String, CodeSigner[]> signers)
   42.33 +    private void processImpl(Hashtable<String, CodeSigner[]> signers,
   42.34 +            List manifestDigests)
   42.35          throws IOException, SignatureException, NoSuchAlgorithmException,
   42.36              JarException, CertificateException
   42.37      {
   42.38 @@ -232,7 +234,7 @@
   42.39                                  sf.getEntries().entrySet().iterator();
   42.40  
   42.41          // see if we can verify the whole manifest first
   42.42 -        boolean manifestSigned = verifyManifestHash(sf, md, decoder);
   42.43 +        boolean manifestSigned = verifyManifestHash(sf, md, decoder, manifestDigests);
   42.44  
   42.45          // verify manifest main attributes
   42.46          if (!manifestSigned && !verifyManifestMainAttrs(sf, md, decoder)) {
   42.47 @@ -275,7 +277,8 @@
   42.48       */
   42.49      private boolean verifyManifestHash(Manifest sf,
   42.50                                         ManifestDigester md,
   42.51 -                                       BASE64Decoder decoder)
   42.52 +                                       BASE64Decoder decoder,
   42.53 +                                       List manifestDigests)
   42.54           throws IOException
   42.55      {
   42.56          Attributes mattr = sf.getMainAttributes();
   42.57 @@ -290,6 +293,8 @@
   42.58                  // 16 is length of "-Digest-Manifest"
   42.59                  String algorithm = key.substring(0, key.length()-16);
   42.60  
   42.61 +                manifestDigests.add(key);
   42.62 +                manifestDigests.add(se.getValue());
   42.63                  MessageDigest digest = getDigest(algorithm);
   42.64                  if (digest != null) {
   42.65                      byte[] computedHash = md.manifestDigest(digest);
    43.1 --- a/src/share/classes/sun/tools/jps/Jps.java	Fri Feb 25 12:48:18 2011 -0800
    43.2 +++ b/src/share/classes/sun/tools/jps/Jps.java	Tue Mar 01 14:04:59 2011 -0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -77,9 +77,52 @@
   43.11                  MonitoredVm vm = null;
   43.12                  String vmidString = "//" + lvmid + "?mode=r";
   43.13  
   43.14 +                String errorString = null;
   43.15 +
   43.16                  try {
   43.17 +                    // Note: The VM associated with the current VM id may
   43.18 +                    // no longer be running so these queries may fail. We
   43.19 +                    // already added the VM id to the output stream above.
   43.20 +                    // If one of the queries fails, then we try to add a
   43.21 +                    // reasonable message to indicate that the requested
   43.22 +                    // info is not available.
   43.23 +
   43.24 +                    errorString = " -- process information unavailable";
   43.25                      VmIdentifier id = new VmIdentifier(vmidString);
   43.26                      vm = monitoredHost.getMonitoredVm(id, 0);
   43.27 +
   43.28 +                    errorString = " -- main class information unavailable";
   43.29 +                    output.append(" " + MonitoredVmUtil.mainClass(vm,
   43.30 +                            arguments.showLongPaths()));
   43.31 +
   43.32 +                    if (arguments.showMainArgs()) {
   43.33 +                        errorString = " -- main args information unavailable";
   43.34 +                        String mainArgs = MonitoredVmUtil.mainArgs(vm);
   43.35 +                        if (mainArgs != null && mainArgs.length() > 0) {
   43.36 +                            output.append(" " + mainArgs);
   43.37 +                        }
   43.38 +                    }
   43.39 +                    if (arguments.showVmArgs()) {
   43.40 +                        errorString = " -- jvm args information unavailable";
   43.41 +                        String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
   43.42 +                        if (jvmArgs != null && jvmArgs.length() > 0) {
   43.43 +                          output.append(" " + jvmArgs);
   43.44 +                        }
   43.45 +                    }
   43.46 +                    if (arguments.showVmFlags()) {
   43.47 +                        errorString = " -- jvm flags information unavailable";
   43.48 +                        String jvmFlags = MonitoredVmUtil.jvmFlags(vm);
   43.49 +                        if (jvmFlags != null && jvmFlags.length() > 0) {
   43.50 +                            output.append(" " + jvmFlags);
   43.51 +                        }
   43.52 +                    }
   43.53 +
   43.54 +                    errorString = " -- detach failed";
   43.55 +                    monitoredHost.detach(vm);
   43.56 +
   43.57 +                    System.out.println(output);
   43.58 +
   43.59 +                    errorString = null;
   43.60                  } catch (URISyntaxException e) {
   43.61                      // unexpected as vmidString is based on a validated hostid
   43.62                      lastError = e;
   43.63 @@ -87,7 +130,7 @@
   43.64                  } catch (Exception e) {
   43.65                      lastError = e;
   43.66                  } finally {
   43.67 -                    if (vm == null) {
   43.68 +                    if (errorString != null) {
   43.69                          /*
   43.70                           * we ignore most exceptions, as there are race
   43.71                           * conditions where a JVM in 'jvms' may terminate
   43.72 @@ -95,7 +138,7 @@
   43.73                           * Other errors, such as access and I/O exceptions
   43.74                           * should stop us from iterating over the complete set.
   43.75                           */
   43.76 -                        output.append(" -- process information unavailable");
   43.77 +                        output.append(errorString);
   43.78                          if (arguments.isDebug()) {
   43.79                              if ((lastError != null)
   43.80                                      && (lastError.getMessage() != null)) {
   43.81 @@ -110,33 +153,6 @@
   43.82                          continue;
   43.83                      }
   43.84                  }
   43.85 -
   43.86 -                output.append(" ");
   43.87 -                output.append(MonitoredVmUtil.mainClass(vm,
   43.88 -                        arguments.showLongPaths()));
   43.89 -
   43.90 -                if (arguments.showMainArgs()) {
   43.91 -                    String mainArgs = MonitoredVmUtil.mainArgs(vm);
   43.92 -                    if (mainArgs != null && mainArgs.length() > 0) {
   43.93 -                        output.append(" ").append(mainArgs);
   43.94 -                    }
   43.95 -                }
   43.96 -                if (arguments.showVmArgs()) {
   43.97 -                    String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
   43.98 -                    if (jvmArgs != null && jvmArgs.length() > 0) {
   43.99 -                      output.append(" ").append(jvmArgs);
  43.100 -                    }
  43.101 -                }
  43.102 -                if (arguments.showVmFlags()) {
  43.103 -                    String jvmFlags = MonitoredVmUtil.jvmFlags(vm);
  43.104 -                    if (jvmFlags != null && jvmFlags.length() > 0) {
  43.105 -                        output.append(" ").append(jvmFlags);
  43.106 -                    }
  43.107 -                }
  43.108 -
  43.109 -                System.out.println(output);
  43.110 -
  43.111 -                monitoredHost.detach(vm);
  43.112              }
  43.113          } catch (MonitorException e) {
  43.114              if (e.getMessage() != null) {
    44.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames.java	Fri Feb 25 12:48:18 2011 -0800
    44.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames.java	Tue Mar 01 14:04:59 2011 -0800
    44.3 @@ -405,6 +405,7 @@
    44.4              {"America/Nipigon", EST},
    44.5              {"America/Nome", AKST},
    44.6              {"America/Noronha", NORONHA},
    44.7 +            {"America/North_Dakota/Beulah", CST},
    44.8              {"America/North_Dakota/Center", CST},
    44.9              {"America/North_Dakota/New_Salem", CST},
   44.10              {"America/Ojinaga", MST},
    45.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Fri Feb 25 12:48:18 2011 -0800
    45.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Tue Mar 01 14:04:59 2011 -0800
    45.3 @@ -405,6 +405,7 @@
    45.4              {"America/Nipigon", EST},
    45.5              {"America/Nome", AKST},
    45.6              {"America/Noronha", NORONHA},
    45.7 +            {"America/North_Dakota/Beulah", CST},
    45.8              {"America/North_Dakota/Center", CST},
    45.9              {"America/North_Dakota/New_Salem", CST},
   45.10              {"America/Ojinaga", MST},
    46.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Fri Feb 25 12:48:18 2011 -0800
    46.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Tue Mar 01 14:04:59 2011 -0800
    46.3 @@ -405,6 +405,7 @@
    46.4              {"America/Nipigon", EST},
    46.5              {"America/Nome", AKST},
    46.6              {"America/Noronha", NORONHA},
    46.7 +            {"America/North_Dakota/Beulah", CST},
    46.8              {"America/North_Dakota/Center", CST},
    46.9              {"America/North_Dakota/New_Salem", CST},
   46.10              {"America/Ojinaga", MST},
    47.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Fri Feb 25 12:48:18 2011 -0800
    47.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Tue Mar 01 14:04:59 2011 -0800
    47.3 @@ -405,6 +405,7 @@
    47.4              {"America/Nipigon", EST},
    47.5              {"America/Nome", AKST},
    47.6              {"America/Noronha", NORONHA},
    47.7 +            {"America/North_Dakota/Beulah", CST},
    47.8              {"America/North_Dakota/Center", CST},
    47.9              {"America/North_Dakota/New_Salem", CST},
   47.10              {"America/Ojinaga", MST},
    48.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Fri Feb 25 12:48:18 2011 -0800
    48.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Tue Mar 01 14:04:59 2011 -0800
    48.3 @@ -405,6 +405,7 @@
    48.4              {"America/Nipigon", EST},
    48.5              {"America/Nome", AKST},
    48.6              {"America/Noronha", NORONHA},
    48.7 +            {"America/North_Dakota/Beulah", CST},
    48.8              {"America/North_Dakota/Center", CST},
    48.9              {"America/North_Dakota/New_Salem", CST},
   48.10              {"America/Ojinaga", MST},
    49.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Fri Feb 25 12:48:18 2011 -0800
    49.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Tue Mar 01 14:04:59 2011 -0800
    49.3 @@ -405,6 +405,7 @@
    49.4              {"America/Nipigon", EST},
    49.5              {"America/Nome", AKST},
    49.6              {"America/Noronha", NORONHA},
    49.7 +            {"America/North_Dakota/Beulah", CST},
    49.8              {"America/North_Dakota/Center", CST},
    49.9              {"America/North_Dakota/New_Salem", CST},
   49.10              {"America/Ojinaga", MST},
    50.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Fri Feb 25 12:48:18 2011 -0800
    50.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Tue Mar 01 14:04:59 2011 -0800
    50.3 @@ -405,6 +405,7 @@
    50.4              {"America/Nipigon", EST},
    50.5              {"America/Nome", AKST},
    50.6              {"America/Noronha", NORONHA},
    50.7 +            {"America/North_Dakota/Beulah", CST},
    50.8              {"America/North_Dakota/Center", CST},
    50.9              {"America/North_Dakota/New_Salem", CST},
   50.10              {"America/Ojinaga", MST},
    51.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java	Fri Feb 25 12:48:18 2011 -0800
    51.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java	Tue Mar 01 14:04:59 2011 -0800
    51.3 @@ -405,6 +405,7 @@
    51.4          {"America/Nipigon", EST},
    51.5          {"America/Nome", AKST},
    51.6          {"America/Noronha", NORONHA},
    51.7 +            {"America/North_Dakota/Beulah", CST},
    51.8          {"America/North_Dakota/Center", CST},
    51.9              {"America/North_Dakota/New_Salem", CST},
   51.10          {"America/Panama", EST},
    52.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Fri Feb 25 12:48:18 2011 -0800
    52.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Tue Mar 01 14:04:59 2011 -0800
    52.3 @@ -405,6 +405,7 @@
    52.4              {"America/Nipigon", EST},
    52.5              {"America/Nome", AKST},
    52.6              {"America/Noronha", NORONHA},
    52.7 +            {"America/North_Dakota/Beulah", CST},
    52.8              {"America/North_Dakota/Center", CST},
    52.9              {"America/North_Dakota/New_Salem", CST},
   52.10              {"America/Ojinaga", MST},
    53.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Fri Feb 25 12:48:18 2011 -0800
    53.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Tue Mar 01 14:04:59 2011 -0800
    53.3 @@ -405,6 +405,7 @@
    53.4              {"America/Nipigon", EST},
    53.5              {"America/Nome", AKST},
    53.6              {"America/Noronha", NORONHA},
    53.7 +            {"America/North_Dakota/Beulah", CST},
    53.8              {"America/North_Dakota/Center", CST},
    53.9              {"America/North_Dakota/New_Salem", CST},
   53.10              {"America/Ojinaga", MST},
    54.1 --- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Fri Feb 25 12:48:18 2011 -0800
    54.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Tue Mar 01 14:04:59 2011 -0800
    54.3 @@ -405,6 +405,7 @@
    54.4              {"America/Nipigon", EST},
    54.5              {"America/Nome", AKST},
    54.6              {"America/Noronha", NORONHA},
    54.7 +            {"America/North_Dakota/Beulah", CST},
    54.8              {"America/North_Dakota/Center", CST},
    54.9              {"America/North_Dakota/New_Salem", CST},
   54.10              {"America/Ojinaga", MST},
    55.1 --- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Fri Feb 25 12:48:18 2011 -0800
    55.2 +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Tue Mar 01 14:04:59 2011 -0800
    55.3 @@ -42,6 +42,7 @@
    55.4  import java.util.HashMap;
    55.5  import java.util.Map;
    55.6  import java.util.Set;
    55.7 +import java.util.zip.ZipError;
    55.8  import java.util.concurrent.ExecutorService;
    55.9  
   55.10  /*
   55.11 @@ -78,39 +79,60 @@
   55.12          }
   55.13      }
   55.14  
   55.15 +    private boolean ensureFile(Path path) {
   55.16 +        try {
   55.17 +            BasicFileAttributes attrs =
   55.18 +                Files.readAttributes(path, BasicFileAttributes.class);
   55.19 +            if (!attrs.isRegularFile())
   55.20 +                throw new UnsupportedOperationException();
   55.21 +            return true;
   55.22 +        } catch (IOException ioe) {
   55.23 +            return false;
   55.24 +        }
   55.25 +    }
   55.26 +
   55.27      @Override
   55.28      public FileSystem newFileSystem(URI uri, Map<String, ?> env)
   55.29          throws IOException
   55.30      {
   55.31 -        return newFileSystem(uriToPath(uri), env, true);
   55.32 +        Path path = uriToPath(uri);
   55.33 +        synchronized(filesystems) {
   55.34 +            Path realPath = null;
   55.35 +            if (ensureFile(path)) {
   55.36 +                realPath = path.toRealPath(true);
   55.37 +                if (filesystems.containsKey(realPath))
   55.38 +                    throw new FileSystemAlreadyExistsException();
   55.39 +            }
   55.40 +            ZipFileSystem zipfs = null;
   55.41 +            try {
   55.42 +                zipfs = new ZipFileSystem(this, path, env);
   55.43 +            } catch (ZipError ze) {
   55.44 +                String pname = path.toString();
   55.45 +                if (pname.endsWith(".zip") || pname.endsWith(".jar"))
   55.46 +                    throw ze;
   55.47 +                // assume NOT a zip/jar file
   55.48 +                throw new UnsupportedOperationException();
   55.49 +            }
   55.50 +            filesystems.put(realPath, zipfs);
   55.51 +            return zipfs;
   55.52 +        }
   55.53      }
   55.54  
   55.55      @Override
   55.56      public FileSystem newFileSystem(Path path, Map<String, ?> env)
   55.57          throws IOException
   55.58      {
   55.59 -        if (!path.toUri().getScheme().equalsIgnoreCase("file")) {
   55.60 +        if (path.getFileSystem() != FileSystems.getDefault()) {
   55.61              throw new UnsupportedOperationException();
   55.62          }
   55.63 -        return newFileSystem(path, env, false);
   55.64 -    }
   55.65 -
   55.66 -    private FileSystem newFileSystem(Path path, Map<String, ?> env, boolean checkIfFSExists)
   55.67 -        throws IOException
   55.68 -    {
   55.69 -        synchronized(filesystems) {
   55.70 -            Path realPath = null;
   55.71 -            if (checkIfFSExists && Files.exists(path)) {
   55.72 -                realPath = path.toRealPath(true);
   55.73 -                if (filesystems.containsKey(realPath))
   55.74 -                    throw new FileSystemAlreadyExistsException();
   55.75 -            }
   55.76 -            ZipFileSystem zipfs = new ZipFileSystem(this, path, env);
   55.77 -            if (realPath == null)
   55.78 -                realPath = path.toRealPath(true);
   55.79 -            if (!filesystems.containsKey(realPath))
   55.80 -                filesystems.put(realPath, zipfs);
   55.81 -            return zipfs;
   55.82 +        ensureFile(path);
   55.83 +        try {
   55.84 +            return new ZipFileSystem(this, path, env);
   55.85 +        } catch (ZipError ze) {
   55.86 +            String pname = path.toString();
   55.87 +            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
   55.88 +                throw ze;
   55.89 +            throw new UnsupportedOperationException();
   55.90          }
   55.91      }
   55.92  
    56.1 --- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Fri Feb 25 12:48:18 2011 -0800
    56.2 +++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Tue Mar 01 14:04:59 2011 -0800
    56.3 @@ -109,8 +109,8 @@
    56.4      jobject stream;            // ImageInputStream or ImageOutputStream
    56.5      jbyteArray hstreamBuffer;  // Handle to a Java buffer for the stream
    56.6      JOCTET *buf;               // Pinned buffer pointer */
    56.7 -    int bufferOffset;          // holds offset between unpin and the next pin
    56.8 -    int bufferLength;          // Allocated, nut just used
    56.9 +    size_t bufferOffset;          // holds offset between unpin and the next pin
   56.10 +    size_t bufferLength;          // Allocated, nut just used
   56.11      int suspendable;           // Set to true to suspend input
   56.12      long remaining_skip;       // Used only on input
   56.13  } streamBuffer, *streamBufferPtr;
   56.14 @@ -129,7 +129,7 @@
   56.15   * Used to signal that no data need be restored from an unpin to a pin.
   56.16   * I.e. the buffer is empty.
   56.17   */
   56.18 -#define NO_DATA -1
   56.19 +#define NO_DATA ((size_t)-1)
   56.20  
   56.21  // Forward reference
   56.22  static void resetStreamBuffer(JNIEnv *env, streamBufferPtr sb);
   56.23 @@ -389,7 +389,6 @@
   56.24  static imageIODataPtr initImageioData (JNIEnv *env,
   56.25                                         j_common_ptr cinfo,
   56.26                                         jobject obj) {
   56.27 -    int i, j;
   56.28  
   56.29      imageIODataPtr data = (imageIODataPtr) malloc (sizeof(imageIOData));
   56.30      if (data == NULL) {
   56.31 @@ -982,7 +981,7 @@
   56.32      streamBufferPtr sb = &data->streamBuf;
   56.33      JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
   56.34      jint ret;
   56.35 -    int offset, buflen;
   56.36 +    size_t offset, buflen;
   56.37  
   56.38      /*
   56.39       * The original (jpegdecoder.c) had code here that called
   56.40 @@ -1520,7 +1519,7 @@
   56.41          imageio_dispose((j_common_ptr)cinfo);
   56.42          return 0;
   56.43      }
   56.44 -    return (jlong) ret;
   56.45 +    return ptr_to_jlong(ret);
   56.46  }
   56.47  
   56.48  /*
   56.49 @@ -1535,7 +1534,7 @@
   56.50       jlong ptr,
   56.51       jobject source) {
   56.52  
   56.53 -    imageIODataPtr data = (imageIODataPtr) ptr;
   56.54 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
   56.55      j_common_ptr cinfo;
   56.56  
   56.57      if (data == NULL) {
   56.58 @@ -1574,7 +1573,7 @@
   56.59      int h_samp0, h_samp1, h_samp2;
   56.60      int v_samp0, v_samp1, v_samp2;
   56.61      jboolean retval = JNI_FALSE;
   56.62 -    imageIODataPtr data = (imageIODataPtr) ptr;
   56.63 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
   56.64      j_decompress_ptr cinfo;
   56.65      struct jpeg_source_mgr *src;
   56.66      sun_jpeg_error_ptr jerr;
   56.67 @@ -1772,7 +1771,7 @@
   56.68       jlong ptr,
   56.69       jint code) {
   56.70  
   56.71 -    imageIODataPtr data = (imageIODataPtr) ptr;
   56.72 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
   56.73      j_decompress_ptr cinfo;
   56.74  
   56.75      if (data == NULL) {
   56.76 @@ -1814,7 +1813,7 @@
   56.77      struct jpeg_source_mgr *src;
   56.78      JSAMPROW scanLinePtr = NULL;
   56.79      jint bands[MAX_BANDS];
   56.80 -    int i, j;
   56.81 +    int i;
   56.82      jint *body;
   56.83      int scanlineLimit;
   56.84      int pixelStride;
   56.85 @@ -1824,14 +1823,12 @@
   56.86      pixelBufferPtr pb;
   56.87      sun_jpeg_error_ptr jerr;
   56.88      boolean done;
   56.89 -    jint *bandSize;
   56.90 -    int maxBandValue, halfMaxBandValue;
   56.91      boolean mustScale = FALSE;
   56.92      boolean progressive = FALSE;
   56.93      boolean orderedBands = TRUE;
   56.94 -    imageIODataPtr data = (imageIODataPtr) ptr;
   56.95 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
   56.96      j_decompress_ptr cinfo;
   56.97 -    unsigned int numBytes;
   56.98 +    size_t numBytes;
   56.99  
  56.100      /* verify the inputs */
  56.101  
  56.102 @@ -1849,7 +1846,7 @@
  56.103  
  56.104      cinfo = (j_decompress_ptr) data->jpegObj;
  56.105  
  56.106 -    if ((numBands < 1) ||
  56.107 +    if ((numBands < 1) || (numBands > MAX_BANDS) ||
  56.108          (sourceXStart < 0) || (sourceXStart >= (jint)cinfo->image_width) ||
  56.109          (sourceYStart < 0) || (sourceYStart >= (jint)cinfo->image_height) ||
  56.110          (sourceWidth < 1) || (sourceWidth > (jint)cinfo->image_width) ||
  56.111 @@ -1863,10 +1860,10 @@
  56.112          return JNI_FALSE;
  56.113      }
  56.114  
  56.115 -    if (stepX > cinfo->image_width) {
  56.116 +    if (stepX > (jint)cinfo->image_width) {
  56.117          stepX = cinfo->image_width;
  56.118      }
  56.119 -    if (stepY > cinfo->image_height) {
  56.120 +    if (stepY > (jint)cinfo->image_height) {
  56.121          stepY = cinfo->image_height;
  56.122      }
  56.123  
  56.124 @@ -2119,7 +2116,7 @@
  56.125       jobject this,
  56.126       jlong ptr) {
  56.127  
  56.128 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.129 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.130  
  56.131      if (data == NULL) {
  56.132          JNU_ThrowByName(env,
  56.133 @@ -2137,7 +2134,7 @@
  56.134      (JNIEnv *env,
  56.135       jobject this,
  56.136       jlong ptr) {
  56.137 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.138 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.139      j_decompress_ptr cinfo;
  56.140  
  56.141      if (data == NULL) {
  56.142 @@ -2159,7 +2156,7 @@
  56.143       jobject this,
  56.144       jlong ptr) {
  56.145  
  56.146 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.147 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.148      j_decompress_ptr cinfo;
  56.149      sun_jpeg_error_ptr jerr;
  56.150  
  56.151 @@ -2232,7 +2229,7 @@
  56.152       jclass reader,
  56.153       jlong ptr) {
  56.154  
  56.155 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.156 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.157      j_common_ptr info = destroyImageioData(env, data);
  56.158  
  56.159      imageio_dispose(info);
  56.160 @@ -2317,8 +2314,8 @@
  56.161      JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  56.162  
  56.163      /* find out how much needs to be written */
  56.164 -    jint datacount = sb->bufferLength - dest->free_in_buffer;
  56.165 -
  56.166 +    /* this conversion from size_t to jint is safe, because the lenght of the buffer is limited by jint */
  56.167 +    jint datacount = (jint)(sb->bufferLength - dest->free_in_buffer);
  56.168      if (datacount != 0) {
  56.169          RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
  56.170  
  56.171 @@ -2485,7 +2482,7 @@
  56.172          imageio_dispose((j_common_ptr)cinfo);
  56.173          return 0;
  56.174      }
  56.175 -    return (jlong) ret;
  56.176 +    return ptr_to_jlong(ret);
  56.177  }
  56.178  
  56.179  JNIEXPORT void JNICALL
  56.180 @@ -2495,7 +2492,7 @@
  56.181       jlong ptr,
  56.182       jobject destination) {
  56.183  
  56.184 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.185 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.186      j_compress_ptr cinfo;
  56.187  
  56.188      if (data == NULL) {
  56.189 @@ -2526,7 +2523,7 @@
  56.190  
  56.191      struct jpeg_destination_mgr *dest;
  56.192      sun_jpeg_error_ptr jerr;
  56.193 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.194 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.195      j_compress_ptr cinfo;
  56.196  
  56.197      if (data == NULL) {
  56.198 @@ -2625,10 +2622,11 @@
  56.199      jint *scanData;
  56.200      jint *bandSize;
  56.201      int maxBandValue, halfMaxBandValue;
  56.202 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.203 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.204      j_compress_ptr cinfo;
  56.205      UINT8** scale = NULL;
  56.206  
  56.207 +
  56.208      /* verify the inputs */
  56.209  
  56.210      if (data == NULL) {
  56.211 @@ -2740,6 +2738,16 @@
  56.212                                            buffer);
  56.213              JNU_ThrowByName(env, "javax/imageio/IIOException", buffer);
  56.214          }
  56.215 +
  56.216 +        if (scale != NULL) {
  56.217 +            for (i = 0; i < numBands; i++) {
  56.218 +                if (scale[i] != NULL) {
  56.219 +                    free(scale[i]);
  56.220 +                }
  56.221 +            }
  56.222 +            free(scale);
  56.223 +        }
  56.224 +
  56.225          free(scanLinePtr);
  56.226          return data->abortFlag;
  56.227      }
  56.228 @@ -2953,7 +2961,7 @@
  56.229       jobject this,
  56.230       jlong ptr) {
  56.231  
  56.232 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.233 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.234  
  56.235      if (data == NULL) {
  56.236          JNU_ThrowByName(env,
  56.237 @@ -2970,7 +2978,7 @@
  56.238      (JNIEnv *env,
  56.239       jobject this,
  56.240       jlong ptr) {
  56.241 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.242 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.243      j_compress_ptr cinfo;
  56.244  
  56.245      if (data == NULL) {
  56.246 @@ -3002,7 +3010,7 @@
  56.247       jclass writer,
  56.248       jlong ptr) {
  56.249  
  56.250 -    imageIODataPtr data = (imageIODataPtr) ptr;
  56.251 +    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
  56.252      j_common_ptr info = destroyImageioData(env, data);
  56.253  
  56.254      imageio_dispose(info);
    57.1 --- a/src/share/native/sun/awt/image/jpeg/jdmarker.c	Fri Feb 25 12:48:18 2011 -0800
    57.2 +++ b/src/share/native/sun/awt/image/jpeg/jdmarker.c	Tue Mar 01 14:04:59 2011 -0800
    57.3 @@ -1325,14 +1325,14 @@
    57.4                     unsigned int length_limit)
    57.5  {
    57.6    my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
    57.7 -  long maxlength;
    57.8 +  size_t maxlength;
    57.9    jpeg_marker_parser_method processor;
   57.10  
   57.11    /* Length limit mustn't be larger than what we can allocate
   57.12     * (should only be a concern in a 16-bit environment).
   57.13     */
   57.14    maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct);
   57.15 -  if (((long) length_limit) > maxlength)
   57.16 +  if (length_limit > maxlength)
   57.17      length_limit = (unsigned int) maxlength;
   57.18  
   57.19    /* Choose processor routine to use.
    58.1 --- a/src/share/native/sun/awt/image/jpeg/jmemmgr.c	Fri Feb 25 12:48:18 2011 -0800
    58.2 +++ b/src/share/native/sun/awt/image/jpeg/jmemmgr.c	Tue Mar 01 14:04:59 2011 -0800
    58.3 @@ -133,7 +133,7 @@
    58.4    jvirt_barray_ptr virt_barray_list;
    58.5  
    58.6    /* This counts total space obtained from jpeg_get_small/large */
    58.7 -  long total_space_allocated;
    58.8 +  size_t total_space_allocated;
    58.9  
   58.10    /* alloc_sarray and alloc_barray set this value for use by virtual
   58.11     * array routines.
   58.12 @@ -588,8 +588,8 @@
   58.13  /* Allocate the in-memory buffers for any unrealized virtual arrays */
   58.14  {
   58.15    my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
   58.16 -  long space_per_minheight, maximum_space, avail_mem;
   58.17 -  long minheights, max_minheights;
   58.18 +  size_t space_per_minheight, maximum_space, avail_mem;
   58.19 +  size_t minheights, max_minheights;
   58.20    jvirt_sarray_ptr sptr;
   58.21    jvirt_barray_ptr bptr;
   58.22  
   58.23 @@ -1032,7 +1032,7 @@
   58.24  jinit_memory_mgr (j_common_ptr cinfo)
   58.25  {
   58.26    my_mem_ptr mem;
   58.27 -  long max_to_use;
   58.28 +  size_t max_to_use;
   58.29    int pool;
   58.30    size_t test_mac;
   58.31  
   58.32 @@ -1109,8 +1109,10 @@
   58.33  
   58.34      if ((memenv = getenv("JPEGMEM")) != NULL) {
   58.35        char ch = 'x';
   58.36 +      unsigned int mem_max = 0u;
   58.37  
   58.38 -      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
   58.39 +      if (sscanf(memenv, "%u%c", &mem_max, &ch) > 0) {
   58.40 +        max_to_use = (size_t)mem_max;
   58.41          if (ch == 'm' || ch == 'M')
   58.42            max_to_use *= 1000L;
   58.43          mem->pub.max_memory_to_use = max_to_use * 1000L;
    59.1 --- a/src/share/native/sun/awt/image/jpeg/jmemnobs.c	Fri Feb 25 12:48:18 2011 -0800
    59.2 +++ b/src/share/native/sun/awt/image/jpeg/jmemnobs.c	Tue Mar 01 14:04:59 2011 -0800
    59.3 @@ -73,9 +73,9 @@
    59.4   * Here we always say, "we got all you want bud!"
    59.5   */
    59.6  
    59.7 -GLOBAL(long)
    59.8 -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
    59.9 -                    long max_bytes_needed, long already_allocated)
   59.10 +GLOBAL(size_t)
   59.11 +jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
   59.12 +                    size_t max_bytes_needed, size_t already_allocated)
   59.13  {
   59.14    return max_bytes_needed;
   59.15  }
   59.16 @@ -100,7 +100,7 @@
   59.17   * cleanup required.  Here, there isn't any.
   59.18   */
   59.19  
   59.20 -GLOBAL(long)
   59.21 +GLOBAL(size_t)
   59.22  jpeg_mem_init (j_common_ptr cinfo)
   59.23  {
   59.24    return 0;                     /* just set max_memory_to_use to 0 */
    60.1 --- a/src/share/native/sun/awt/image/jpeg/jmemsys.h	Fri Feb 25 12:48:18 2011 -0800
    60.2 +++ b/src/share/native/sun/awt/image/jpeg/jmemsys.h	Tue Mar 01 14:04:59 2011 -0800
    60.3 @@ -104,10 +104,10 @@
    60.4   * Conversely, zero may be returned to always use the minimum amount of memory.
    60.5   */
    60.6  
    60.7 -EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
    60.8 -                                     long min_bytes_needed,
    60.9 -                                     long max_bytes_needed,
   60.10 -                                     long already_allocated));
   60.11 +EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo,
   60.12 +                                     size_t min_bytes_needed,
   60.13 +                                     size_t max_bytes_needed,
   60.14 +                                     size_t already_allocated));
   60.15  
   60.16  
   60.17  /*
   60.18 @@ -198,5 +198,5 @@
   60.19   * all opened backing-store objects have been closed.
   60.20   */
   60.21  
   60.22 -EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo));
   60.23 +EXTERN(size_t) jpeg_mem_init JPP((j_common_ptr cinfo));
   60.24  EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo));
    61.1 --- a/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Fri Feb 25 12:48:18 2011 -0800
    61.2 +++ b/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Tue Mar 01 14:04:59 2011 -0800
    61.3 @@ -328,7 +328,7 @@
    61.4      if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
    61.5          cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
    61.6      }
    61.7 -    if (ret <= src->remaining_skip) {
    61.8 +    if (ret < 0 || (unsigned int)ret <= src->remaining_skip) {
    61.9          return;
   61.10      }
   61.11      if (src->remaining_skip) {
   61.12 @@ -397,7 +397,7 @@
   61.13      }
   61.14      num_bytes += src->remaining_skip;
   61.15      src->remaining_skip = 0;
   61.16 -    ret = src->pub.bytes_in_buffer;
   61.17 +    ret = (int)src->pub.bytes_in_buffer; /* this conversion is safe, because capacity of the buffer is limited by jnit */
   61.18      if (ret >= num_bytes) {
   61.19          src->pub.next_input_byte += num_bytes;
   61.20          src->pub.bytes_in_buffer -= num_bytes;
    62.1 --- a/src/share/native/sun/awt/image/jpeg/jpeglib.h	Fri Feb 25 12:48:18 2011 -0800
    62.2 +++ b/src/share/native/sun/awt/image/jpeg/jpeglib.h	Tue Mar 01 14:04:59 2011 -0800
    62.3 @@ -800,10 +800,10 @@
    62.4     * used for virtual-array buffers.)  May be changed by outer application
    62.5     * after creating the JPEG object.
    62.6     */
    62.7 -  long max_memory_to_use;
    62.8 +  size_t max_memory_to_use;
    62.9  
   62.10    /* Maximum allocation request accepted by alloc_large. */
   62.11 -  long max_alloc_chunk;
   62.12 +  size_t max_alloc_chunk;
   62.13  };
   62.14  
   62.15  
    63.1 --- a/src/solaris/classes/sun/awt/X11/XDesktopPeer.java	Fri Feb 25 12:48:18 2011 -0800
    63.2 +++ b/src/solaris/classes/sun/awt/X11/XDesktopPeer.java	Tue Mar 01 14:04:59 2011 -0800
    63.3 @@ -44,11 +44,27 @@
    63.4  public class XDesktopPeer implements DesktopPeer {
    63.5  
    63.6      private static boolean nativeLibraryLoaded = false;
    63.7 -    static {
    63.8 -        nativeLibraryLoaded = init();
    63.9 +    private static boolean initExecuted = false;
   63.10 +
   63.11 +    private static void initWithLock(){
   63.12 +        XToolkit.awtLock();
   63.13 +        try {
   63.14 +            if (!initExecuted) {
   63.15 +                nativeLibraryLoaded = init();
   63.16 +            }
   63.17 +        } finally {
   63.18 +            initExecuted = true;
   63.19 +            XToolkit.awtUnlock();
   63.20 +        }
   63.21 +    }
   63.22 +
   63.23 +    //package-private
   63.24 +    XDesktopPeer(){
   63.25 +        initWithLock();
   63.26      }
   63.27  
   63.28      static boolean isDesktopSupported() {
   63.29 +        initWithLock();
   63.30          return nativeLibraryLoaded;
   63.31      }
   63.32  
   63.33 @@ -83,12 +99,17 @@
   63.34      }
   63.35  
   63.36      private void launch(URI uri) throws IOException {
   63.37 -        if (!nativeLibraryLoaded) {
   63.38 -            throw new IOException("Failed to load native libraries.");
   63.39 +        byte[] uriByteArray = ( uri.toString() + '\0' ).getBytes();
   63.40 +        boolean result = false;
   63.41 +        XToolkit.awtLock();
   63.42 +        try {
   63.43 +            if (!nativeLibraryLoaded) {
   63.44 +                throw new IOException("Failed to load native libraries.");
   63.45 +            }
   63.46 +            result = gnome_url_show(uriByteArray);
   63.47 +        } finally {
   63.48 +            XToolkit.awtUnlock();
   63.49          }
   63.50 -
   63.51 -        byte[] uriByteArray = ( uri.toString() + '\0' ).getBytes();
   63.52 -        boolean result = gnome_url_show(uriByteArray);
   63.53          if (!result) {
   63.54              throw new IOException("Failed to show URI:" + uri);
   63.55          }
    64.1 --- a/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Fri Feb 25 12:48:18 2011 -0800
    64.2 +++ b/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Tue Mar 01 14:04:59 2011 -0800
    64.3 @@ -479,8 +479,7 @@
    64.4          if (xrpipe == null) {
    64.5              try {
    64.6                  SunToolkit.awtLock();
    64.7 -                xgc = renderQueue.createGC(xid); // TODO: GC leak? where to
    64.8 -                // clean up?
    64.9 +                xgc = XCreateGC(getNativeOps());
   64.10  
   64.11                  xrpipe = new XRRenderer(maskBuffer.getMaskBuffer());
   64.12                  xrtxpipe = new PixelToShapeConverter(xrpipe);
    65.1 --- a/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Fri Feb 25 12:48:18 2011 -0800
    65.2 +++ b/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Tue Mar 01 14:04:59 2011 -0800
    65.3 @@ -136,7 +136,7 @@
    65.4              throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
    65.5  
    65.6          FileDescriptor fdObj = open(dfd, path, pathForPermissionCheck, flags, mode);
    65.7 -        return FileChannelImpl.open(fdObj, flags.read, flags.write, null);
    65.8 +        return FileChannelImpl.open(fdObj, flags.read, flags.write, flags.append, null);
    65.9      }
   65.10  
   65.11      /**
    66.1 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Fri Feb 25 12:48:18 2011 -0800
    66.2 +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Mar 01 14:04:59 2011 -0800
    66.3 @@ -595,15 +595,16 @@
    66.4  }
    66.5  
    66.6  XImage* X11SD_GetSharedImage(X11SDOps *xsdo, jint width, jint height,
    66.7 -                             jboolean readBits)
    66.8 +                             jint maxWidth, jint maxHeight, jboolean readBits)
    66.9  {
   66.10      XImage * retImage = NULL;
   66.11      if (cachedXImage != NULL &&
   66.12 -        X11SD_CachedXImageFits(width, height, xsdo->depth, readBits)) {
   66.13 -            /* sync so previous data gets flushed */
   66.14 -            XSync(awt_display, False);
   66.15 -            retImage = cachedXImage;
   66.16 -            cachedXImage = (XImage *)NULL;
   66.17 +        X11SD_CachedXImageFits(width, height, maxWidth, maxHeight,
   66.18 +                               xsdo->depth, readBits)) {
   66.19 +        /* sync so previous data gets flushed */
   66.20 +        XSync(awt_display, False);
   66.21 +        retImage = cachedXImage;
   66.22 +        cachedXImage = (XImage *)NULL;
   66.23      } else if (width * height * xsdo->depth > 0x10000) {
   66.24          retImage = X11SD_CreateSharedImage(xsdo, width, height);
   66.25      }
   66.26 @@ -728,8 +729,8 @@
   66.27   * it must be close enough to avoid excessive reading from the screen;
   66.28   * otherwise it should just be at least the size requested.
   66.29   */
   66.30 -jboolean X11SD_CachedXImageFits(jint width, jint height, jint depth,
   66.31 -                                jboolean readBits)
   66.32 +jboolean X11SD_CachedXImageFits(jint width, jint height, jint maxWidth,
   66.33 +                                jint maxHeight, jint depth, jboolean readBits)
   66.34  {
   66.35      /* we assume here that the cached image exists */
   66.36      jint imgWidth = cachedXImage->width;
   66.37 @@ -747,10 +748,14 @@
   66.38          return JNI_TRUE;
   66.39      }
   66.40  
   66.41 -    if ((imgWidth < width + 64) && (imgHeight < height + 64)) {
   66.42 +    if ((imgWidth < width + 64) && (imgHeight < height + 64)
   66.43 +         && imgWidth <= maxWidth && imgHeight <= maxHeight)
   66.44 +    {
   66.45          /* Cached image's width/height shouldn't be more than 64 pixels
   66.46           * larger than requested, because the region in XShmGetImage
   66.47           * can't be specified and we don't want to read too much.
   66.48 +         * Furthermore it has to be smaller than maxWidth/Height
   66.49 +         * so drawables are not read out of bounds.
   66.50           */
   66.51          return JNI_TRUE;
   66.52      }
   66.53 @@ -1295,7 +1300,7 @@
   66.54                                 SurfaceDataBounds *bounds,
   66.55                                 jint lockFlags)
   66.56  {
   66.57 -    int x, y, w, h;
   66.58 +    int x, y, w, h, maxWidth, maxHeight;
   66.59      int scan;
   66.60      XImage * img = NULL;
   66.61      Drawable drawable;
   66.62 @@ -1311,10 +1316,31 @@
   66.63  
   66.64  #ifdef MITSHM
   66.65      if (useMitShmExt == CAN_USE_MITSHM) {
   66.66 -        if (xsdo->isPixmap && readBits) {
   66.67 -            X11SD_PuntPixmap(xsdo, w, h);
   66.68 +        if (xsdo->isPixmap) {
   66.69 +            if (readBits) {
   66.70 +                X11SD_PuntPixmap(xsdo, w, h);
   66.71 +            }
   66.72 +            maxWidth = xsdo->pmWidth;
   66.73 +            maxHeight = xsdo->pmHeight;
   66.74 +        } else {
   66.75 +            XWindowAttributes winAttr;
   66.76 +            if (XGetWindowAttributes(awt_display,
   66.77 +                                     (Window) xsdo->drawable, &winAttr) != 0) {
   66.78 +                maxWidth = winAttr.width;
   66.79 +                maxHeight = winAttr.height;
   66.80 +           } else {
   66.81 +                /* XGWA failed which isn't a good thing. Defaulting to using
   66.82 +                 * x,y means that after the subtraction of these we will use
   66.83 +                 * w=0, h=0 which is a reasonable default on such a failure.
   66.84 +                 */
   66.85 +                maxWidth = x;
   66.86 +                maxHeight = y;
   66.87 +           }
   66.88          }
   66.89 -        img = X11SD_GetSharedImage(xsdo, w, h, readBits);
   66.90 +        maxWidth -= x;
   66.91 +        maxHeight -= y;
   66.92 +
   66.93 +        img = X11SD_GetSharedImage(xsdo, w, h, maxWidth, maxHeight, readBits);
   66.94      }
   66.95  #endif /* MITSHM */
   66.96      drawable = xsdo->drawable;
    67.1 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.h	Fri Feb 25 12:48:18 2011 -0800
    67.2 +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.h	Tue Mar 01 14:04:59 2011 -0800
    67.3 @@ -125,15 +125,21 @@
    67.4  #define X11SD_LOCK_BY_SHMEM     4       /* surface locked by ShMemExt */
    67.5  
    67.6  #ifdef MITSHM
    67.7 -XImage * X11SD_GetSharedImage       (X11SDOps *xsdo, jint width, jint height, jboolean readBits);
    67.8 +XImage * X11SD_GetSharedImage       (X11SDOps *xsdo,
    67.9 +                                     jint width, jint height,
   67.10 +                                     jint maxWidth, jint maxHeight,
   67.11 +                                     jboolean readBits);
   67.12  XImage * X11SD_CreateSharedImage    (X11SDOps *xsdo, jint width, jint height);
   67.13  Drawable X11SD_CreateSharedPixmap   (X11SDOps *xsdo);
   67.14  void     X11SD_DropSharedSegment    (XShmSegmentInfo *shminfo);
   67.15  void     X11SD_PuntPixmap           (X11SDOps *xsdo, jint width, jint height);
   67.16  void     X11SD_UnPuntPixmap         (X11SDOps *xsdo);
   67.17 -jboolean X11SD_CachedXImageFits     (jint width, jint height, jint depth, jboolean readBits);
   67.18 +jboolean X11SD_CachedXImageFits     (jint width, jint height,
   67.19 +                                     jint maxWidth, jint maxHeight,
   67.20 +                                     jint depth, jboolean readBits);
   67.21  XImage * X11SD_GetCachedXImage      (jint width, jint height, jboolean readBits);
   67.22  #endif /* MITSHM */
   67.23 +jint     X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo);
   67.24  void     X11SD_DisposeOrCacheXImage (XImage * image);
   67.25  void     X11SD_DisposeXImage(XImage * image);
   67.26  void     X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo);
    68.1 --- a/src/solaris/native/sun/xawt/awt_Desktop.c	Fri Feb 25 12:48:18 2011 -0800
    68.2 +++ b/src/solaris/native/sun/xawt/awt_Desktop.c	Tue Mar 01 14:04:59 2011 -0800
    68.3 @@ -48,9 +48,15 @@
    68.4      }
    68.5      dlerror(); /* Clear errors */
    68.6      gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
    68.7 +    if (gnome_vfs_init == NULL){
    68.8 +#ifdef INTERNAL_BUILD
    68.9 +        fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
   68.10 +#endif
   68.11 +        return 0;
   68.12 +    }
   68.13      if ((errmsg = dlerror()) != NULL) {
   68.14  #ifdef INTERNAL_BUILD
   68.15 -        fprintf(stderr, "can not find symble gnome_vfs_init\n");
   68.16 +        fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
   68.17  #endif
   68.18          return 0;
   68.19      }
    69.1 --- a/src/windows/classes/sun/awt/windows/WPathGraphics.java	Fri Feb 25 12:48:18 2011 -0800
    69.2 +++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java	Tue Mar 01 14:04:59 2011 -0800
    69.3 @@ -51,9 +51,12 @@
    69.4  import java.awt.image.DataBuffer;
    69.5  import java.awt.image.IndexColorModel;
    69.6  import java.awt.image.WritableRaster;
    69.7 +import java.awt.image.ComponentSampleModel;
    69.8 +import java.awt.image.MultiPixelPackedSampleModel;
    69.9 +import java.awt.image.SampleModel;
   69.10 +
   69.11  import sun.awt.image.ByteComponentRaster;
   69.12  import sun.awt.image.BytePackedRaster;
   69.13 -
   69.14  import java.awt.print.PageFormat;
   69.15  import java.awt.print.Printable;
   69.16  import java.awt.print.PrinterException;
   69.17 @@ -1272,6 +1275,25 @@
   69.18                          return false;
   69.19                      }
   69.20  
   69.21 +                    int bitsPerPixel = 24;
   69.22 +                    SampleModel sm = deepImage.getSampleModel();
   69.23 +                    if (sm instanceof ComponentSampleModel) {
   69.24 +                        ComponentSampleModel csm = (ComponentSampleModel)sm;
   69.25 +                        bitsPerPixel = csm.getPixelStride() * 8;
   69.26 +                    } else if (sm instanceof MultiPixelPackedSampleModel) {
   69.27 +                        MultiPixelPackedSampleModel mppsm =
   69.28 +                            (MultiPixelPackedSampleModel)sm;
   69.29 +                        bitsPerPixel = mppsm.getPixelBitStride();
   69.30 +                    } else {
   69.31 +                        if (icm != null) {
   69.32 +                            int diw = deepImage.getWidth();
   69.33 +                            int dih = deepImage.getHeight();
   69.34 +                            if (diw > 0 && dih > 0) {
   69.35 +                                bitsPerPixel = data.length*8/diw/dih;
   69.36 +                            }
   69.37 +                        }
   69.38 +                    }
   69.39 +
   69.40                      /* Because the caller's image has been rotated
   69.41                       * and sheared into our BufferedImage and because
   69.42                       * we will be handing that BufferedImage directly to
   69.43 @@ -1289,7 +1311,7 @@
   69.44                           (float)Math.rint(scaledBounds.height+0.5),
   69.45                           0f, 0f,
   69.46                           deepImage.getWidth(), deepImage.getHeight(),
   69.47 -                         icm);
   69.48 +                         bitsPerPixel, icm);
   69.49  
   69.50                      setClip(holdClip);
   69.51                  }
    70.1 --- a/src/windows/classes/sun/awt/windows/WPrinterJob.java	Fri Feb 25 12:48:18 2011 -0800
    70.2 +++ b/src/windows/classes/sun/awt/windows/WPrinterJob.java	Tue Mar 01 14:04:59 2011 -0800
    70.3 @@ -1212,13 +1212,14 @@
    70.4                                  float destWidth, float destHeight,
    70.5                                  float srcX, float srcY,
    70.6                                  float srcWidth, float srcHeight,
    70.7 +                                int sampleBitsPerPixel,
    70.8                                  IndexColorModel icm) {
    70.9          int bitCount = 24;
   70.10          byte[] bmiColors = null;
   70.11  
   70.12          if (icm != null) {
   70.13 -            bitCount = icm.getPixelSize();
   70.14 -            bmiColors = new byte[(1<<bitCount)*4];
   70.15 +            bitCount = sampleBitsPerPixel;
   70.16 +            bmiColors = new byte[(1<<icm.getPixelSize())*4];
   70.17              for (int i=0;i<icm.getMapSize(); i++) {
   70.18                  bmiColors[i*4+0]=(byte)(icm.getBlue(i)&0xff);
   70.19                  bmiColors[i*4+1]=(byte)(icm.getGreen(i)&0xff);
    71.1 --- a/src/windows/classes/sun/print/Win32PrintService.java	Fri Feb 25 12:48:18 2011 -0800
    71.2 +++ b/src/windows/classes/sun/print/Win32PrintService.java	Tue Mar 01 14:04:59 2011 -0800
    71.3 @@ -31,6 +31,7 @@
    71.4  import java.net.URL;
    71.5  
    71.6  import java.util.Vector;
    71.7 +import java.util.HashMap;
    71.8  
    71.9  import javax.print.DocFlavor;
   71.10  import javax.print.DocPrintJob;
   71.11 @@ -205,6 +206,7 @@
   71.12      private MediaPrintableArea[] mediaPrintables;
   71.13      private MediaTray[] mediaTrays;
   71.14      private PrinterResolution[] printRes;
   71.15 +    private HashMap mpaMap;
   71.16      private int nCopies;
   71.17      private int prnCaps;
   71.18      private int[] defaultSettings;
   71.19 @@ -212,6 +214,7 @@
   71.20      private boolean gotTrays;
   71.21      private boolean gotCopies;
   71.22      private boolean mediaInitialized;
   71.23 +    private boolean mpaListInitialized;
   71.24  
   71.25      private ArrayList idList;
   71.26      private MediaSize[] mediaSizes;
   71.27 @@ -270,6 +273,20 @@
   71.28                  return DMPAPER_B6_JIS;
   71.29              }
   71.30          }
   71.31 +
   71.32 +        // If not found in predefined Windows ID, then we search through
   71.33 +        // the returned IDs of the driver because they can define their own
   71.34 +        // unique IDs.
   71.35 +        initMedia();
   71.36 +
   71.37 +        if ((idList != null) && (mediaSizes != null) &&
   71.38 +            (idList.size() == mediaSizes.length)) {
   71.39 +            for (int i=0; i< idList.size(); i++) {
   71.40 +                if (mediaSizes[i].getMediaSizeName() == msn) {
   71.41 +                    return ((Integer)idList.get(i)).intValue();
   71.42 +                }
   71.43 +            }
   71.44 +        }
   71.45          return 0;
   71.46      }
   71.47  
   71.48 @@ -380,43 +397,115 @@
   71.49              // Add mediaName to the msnList
   71.50              if (mediaName != null) {
   71.51                  added = addToUniqueList(msnList, mediaName);
   71.52 -
   71.53 -                // get MediaPrintableArea only for supported MediaSizeName ?
   71.54 -                if (added && !queryFailure) {
   71.55 -                    prnArea=getMediaPrintableArea(printer,
   71.56 -                                                  ((Integer)idList.get(i)).intValue());
   71.57 -                    if (prnArea != null) {
   71.58 -                        try {
   71.59 -                            MediaPrintableArea mpa =
   71.60 -                                new MediaPrintableArea(prnArea[0],
   71.61 -                                                       prnArea[1],
   71.62 -                                                       prnArea[2],
   71.63 -                                                       prnArea[3],
   71.64 -                                                       MediaPrintableArea.INCH);
   71.65 -                            printableList.add(mpa);
   71.66 -                        } catch (IllegalArgumentException iae) {
   71.67 -                        }
   71.68 -                    } else {
   71.69 -                        // Calling getMediaPrintableArea causes
   71.70 -                        // much overhead so if first attempt failed, we should
   71.71 -                        // just bail out.
   71.72 -                        if (i==0) {
   71.73 -                            queryFailure = true;
   71.74 -                        }
   71.75 -                    }
   71.76 -                }
   71.77              }
   71.78          }
   71.79  
   71.80          // init mediaSizeNames
   71.81          mediaSizeNames = new MediaSizeName[msnList.size()];
   71.82          msnList.toArray(mediaSizeNames);
   71.83 +    }
   71.84  
   71.85 -        // init mediaPrintables
   71.86 -        mediaPrintables = new MediaPrintableArea[printableList.size()];
   71.87 -        printableList.toArray(mediaPrintables);
   71.88 +
   71.89 +    /*
   71.90 +     * Gets a list of MediaPrintableAreas using a call to native function.
   71.91 +     *  msn is MediaSizeName used to get a specific printable area.  If null,
   71.92 +     *  it will get all the supported MediPrintableAreas.
   71.93 +     */
   71.94 +    private synchronized MediaPrintableArea[] getMediaPrintables(MediaSizeName msn)
   71.95 +    {
   71.96 +        if (msn == null)  {
   71.97 +            if (mpaListInitialized == true) {
   71.98 +                return mediaPrintables;
   71.99 +            }
  71.100 +        } else {
  71.101 +            // get from cached mapping of MPAs
  71.102 +            if (mpaMap != null && (mpaMap.get(msn) != null)) {
  71.103 +                MediaPrintableArea[] mpaArr = new MediaPrintableArea[1];
  71.104 +                mpaArr[0] = (MediaPrintableArea)mpaMap.get(msn);
  71.105 +                return mpaArr;
  71.106 +            }
  71.107 +        }
  71.108 +
  71.109 +        initMedia();
  71.110 +
  71.111 +        if ((mediaSizeNames == null) && (mediaSizeNames.length == 0)) {
  71.112 +            return null;
  71.113 +        }
  71.114 +
  71.115 +        MediaSizeName[] loopNames;
  71.116 +        if (msn != null) {
  71.117 +            loopNames = new MediaSizeName[1];
  71.118 +            loopNames[0] = msn;
  71.119 +        } else {
  71.120 +            loopNames = mediaSizeNames;
  71.121 +        }
  71.122 +
  71.123 +        if (mpaMap == null) {
  71.124 +            mpaMap = new HashMap();
  71.125 +        }
  71.126 +
  71.127 +        for (int i=0; i < loopNames.length; i++) {
  71.128 +            MediaSizeName mediaName = loopNames[i];
  71.129 +
  71.130 +            if (mpaMap.get(mediaName) != null) {
  71.131 +                continue;
  71.132 +             }
  71.133 +
  71.134 +            if (mediaName != null) {
  71.135 +                int defPaper = findPaperID(mediaName);
  71.136 +                float[] prnArea = (defPaper != 0) ? getMediaPrintableArea(printer, defPaper) : null;
  71.137 +                MediaPrintableArea printableArea = null;
  71.138 +                if (prnArea != null) {
  71.139 +                    try {
  71.140 +                        printableArea = new MediaPrintableArea(prnArea[0],
  71.141 +                                                               prnArea[1],
  71.142 +                                                               prnArea[2],
  71.143 +                                                               prnArea[3],
  71.144 +                                                 MediaPrintableArea.INCH);
  71.145 +
  71.146 +                        mpaMap.put(mediaName, printableArea);
  71.147 +                    }
  71.148 +                    catch (IllegalArgumentException e) {
  71.149 +                    }
  71.150 +                } else {
  71.151 +                    // if getting  MPA failed, we use MediaSize
  71.152 +                    MediaSize ms =
  71.153 +                        MediaSize.getMediaSizeForName((MediaSizeName)mediaName);
  71.154 +
  71.155 +                    if (ms != null) {
  71.156 +                        try {
  71.157 +                            printableArea = new MediaPrintableArea(0, 0,
  71.158 +                                                     ms.getX(MediaSize.INCH),
  71.159 +                                                     ms.getY(MediaSize.INCH),
  71.160 +                                                     MediaPrintableArea.INCH);
  71.161 +                            mpaMap.put(mediaName, printableArea);
  71.162 +                        } catch (IllegalArgumentException e) {
  71.163 +                        }
  71.164 +                    }
  71.165 +                }
  71.166 +            } //mediaName != null
  71.167 +        }
  71.168 +
  71.169 +       if (mpaMap.size() == 0) {
  71.170 +           return null;
  71.171 +       }
  71.172 +
  71.173 +       if (msn != null) {
  71.174 +           if (mpaMap.get(msn) == null) {
  71.175 +               return null;
  71.176 +           }
  71.177 +           MediaPrintableArea[] mpaArr = new MediaPrintableArea[1];
  71.178 +           // by this time, we've already gotten the desired MPA
  71.179 +           mpaArr[0] = (MediaPrintableArea)mpaMap.get(msn);
  71.180 +           return mpaArr;
  71.181 +       } else {
  71.182 +           mediaPrintables = (MediaPrintableArea[])mpaMap.values().toArray(new MediaPrintableArea[0]);
  71.183 +           mpaListInitialized = true;
  71.184 +           return mediaPrintables;
  71.185 +       }
  71.186      }
  71.187  
  71.188 +
  71.189      private synchronized MediaTray[] getMediaTrays() {
  71.190          if (gotTrays == true && mediaTrays != null) {
  71.191              return mediaTrays;
  71.192 @@ -626,7 +715,7 @@
  71.193  
  71.194      private boolean isSupportedMediaPrintableArea(MediaPrintableArea mpa) {
  71.195  
  71.196 -        initMedia();
  71.197 +        getMediaPrintables(null);
  71.198  
  71.199          if (mediaPrintables != null) {
  71.200              for (int i=0; i<mediaPrintables.length; i++) {
  71.201 @@ -1250,57 +1339,32 @@
  71.202              }
  71.203              if (trays != null) {
  71.204                  System.arraycopy(trays, 0, arr,
  71.205 -                                 mediaSizeNames.length, trays.length);
  71.206 +                                 len - trays.length, trays.length);
  71.207              }
  71.208              return arr;
  71.209          } else if (category == MediaPrintableArea.class) {
  71.210 -            initMedia();
  71.211 -
  71.212 -            if (mediaPrintables == null) {
  71.213 -                return null;
  71.214 -            }
  71.215 -
  71.216              // if getting printable area for a specific media size
  71.217 -            Media mediaName;
  71.218 +            Media mediaName = null;
  71.219              if ((attributes != null) &&
  71.220                  ((mediaName =
  71.221                    (Media)attributes.get(Media.class)) != null)) {
  71.222  
  71.223 -                if (mediaName instanceof MediaSizeName) {
  71.224 -                    MediaPrintableArea []arr = new MediaPrintableArea[1];
  71.225 -
  71.226 -                    if (mediaSizeNames.length == mediaPrintables.length) {
  71.227 -
  71.228 -                        for (int j=0; j < mediaSizeNames.length; j++) {
  71.229 -
  71.230 -                            if (mediaName.equals(mediaSizeNames[j])) {
  71.231 -                                arr[0] = mediaPrintables[j];
  71.232 -                                return arr;
  71.233 -                            }
  71.234 -                        }
  71.235 -                    }
  71.236 -
  71.237 -                    MediaSize ms =
  71.238 -                      MediaSize.getMediaSizeForName((MediaSizeName)mediaName);
  71.239 -
  71.240 -                    if (ms != null) {
  71.241 -                        arr[0] = new MediaPrintableArea(0, 0,
  71.242 -                                                        ms.getX(MediaSize.INCH),
  71.243 -                                                        ms.getY(MediaSize.INCH),
  71.244 -                                                        MediaPrintableArea.INCH);
  71.245 -                        return arr;
  71.246 -                    } else {
  71.247 -                        return null;
  71.248 -                    }
  71.249 +                if (!(mediaName instanceof MediaSizeName)) {
  71.250 +                    // if an instance of MediaTray, fall thru returning
  71.251 +                    // all MediaPrintableAreas
  71.252 +                    mediaName = null;
  71.253                  }
  71.254 -                // else an instance of MediaTray, fall thru returning
  71.255 -                // all MediaPrintableAreas
  71.256              }
  71.257  
  71.258 -            MediaPrintableArea []arr =
  71.259 -                new MediaPrintableArea[mediaPrintables.length];
  71.260 -            System.arraycopy(mediaPrintables, 0, arr, 0, mediaPrintables.length);
  71.261 -            return arr;
  71.262 +            MediaPrintableArea[] mpas =
  71.263 +                                  getMediaPrintables((MediaSizeName)mediaName);
  71.264 +            if (mpas != null) {
  71.265 +                MediaPrintableArea[] arr = new MediaPrintableArea[mpas.length];
  71.266 +                System.arraycopy(mpas, 0, arr, 0, mpas.length);
  71.267 +                return arr;
  71.268 +            } else {
  71.269 +                return null;
  71.270 +            }
  71.271          } else if (category == SunAlternateMedia.class) {
  71.272              return new SunAlternateMedia(
  71.273                                (Media)getDefaultAttributeValue(Media.class));
    72.1 --- a/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp	Fri Feb 25 12:48:18 2011 -0800
    72.2 +++ b/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp	Tue Mar 01 14:04:59 2011 -0800
    72.3 @@ -107,8 +107,16 @@
    72.4          // could retain their own DIB info and we would not need to
    72.5          // recreate it every time.
    72.6  
    72.7 +        // GetRasInfo implicitly calls GetPrimitiveArrayCritical
    72.8 +        // and since GetDC uses JNI it needs to be called first.
    72.9 +        HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
   72.10 +        if (hDC == NULL) {
   72.11 +            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
   72.12 +            return;
   72.13 +        }
   72.14          srcOps->GetRasInfo(env, srcOps, &srcInfo);
   72.15          if (srcInfo.rasBase == NULL) {
   72.16 +            dstOps->ReleaseDC(env, dstOps, hDC);
   72.17              SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
   72.18              return;
   72.19          }
   72.20 @@ -174,13 +182,6 @@
   72.21              bmi.colors.dwMasks[2] = bmask;
   72.22          }
   72.23  
   72.24 -        HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
   72.25 -        if (hDC == NULL) {
   72.26 -            SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
   72.27 -            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
   72.28 -            return;
   72.29 -        }
   72.30 -
   72.31          if (fastBlt) {
   72.32              // Window could go away at any time, leaving bits on the screen
   72.33              // from this GDI call, so make sure window still exists
    73.1 --- a/test/ProblemList.txt	Fri Feb 25 12:48:18 2011 -0800
    73.2 +++ b/test/ProblemList.txt	Tue Mar 01 14:04:59 2011 -0800
    73.3 @@ -41,14 +41,14 @@
    73.4  #
    73.5  # Shell tests are othervm by default.
    73.6  #
    73.7 -# List items  are testnames followed by labels, all MUST BE commented 
    73.8 +# List items  are testnames followed by labels, all MUST BE commented
    73.9  #   as to why they are here and use a label:
   73.10  #     generic-all	Problems on all platforms
   73.11  #     generic-ARCH	Where ARCH is one of: sparc, sparcv9, x64, i586, etc.
   73.12  #     OSNAME-all	Where OSNAME is one of: solaris, linux, windows
   73.13  #     OSNAME-ARCH	Specific on to one OSNAME and ARCH, e.g. solaris-x64
   73.14  #     OSNAME-REV	Specific on to one OSNAME and REV, e.g. solaris-5.8
   73.15 -#	 
   73.16 +#
   73.17  # More than one label is allowed but must be on the same line.
   73.18  #
   73.19  #############################################################################
   73.20 @@ -234,7 +234,7 @@
   73.21  # Linux 32bit Fedora 9, IllegalStateException
   73.22  javax/management/monitor/RuntimeExceptionTest.java		generic-all
   73.23  
   73.24 -# Problems with rmi connection, othervm  
   73.25 +# Problems with rmi connection, othervm
   73.26  javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java generic-all
   73.27  
   73.28  # Fails with port already in use
   73.29 @@ -411,7 +411,7 @@
   73.30  com/sun/nio/sctp/SctpChannel/Send.java				generic-all
   73.31  com/sun/nio/sctp/SctpChannel/Shutdown.java			generic-all
   73.32  
   73.33 -# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses 
   73.34 +# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses
   73.35  #    from a channel that is bound to the wildcard address
   73.36  com/sun/nio/sctp/SctpChannel/Bind.java				generic-all
   73.37  
   73.38 @@ -456,10 +456,10 @@
   73.39  java/rmi/server/RemoteServer/AddrInUse.java			generic-all
   73.40  
   73.41  # Connection error on Windows i586 -server
   73.42 -#  Also connection errors in othervm on Solaris 10 sparc, same port??? 
   73.43 +#  Also connection errors in othervm on Solaris 10 sparc, same port???
   73.44  sun/rmi/transport/tcp/DeadCachedConnection.java 	 	generic-all
   73.45  
   73.46 -# Connection errors in othervm on Solaris 10 sparc, same port??? 
   73.47 +# Connection errors in othervm on Solaris 10 sparc, same port???
   73.48  java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java generic-all
   73.49  java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java generic-all
   73.50  java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java generic-all
   73.51 @@ -532,7 +532,7 @@
   73.52  java/security/Security/SynchronizedAccess.java			generic-all
   73.53  
   73.54  # Failing on Solaris X64 (-d64 -server) with:
   73.55 -#  GSSException: Failure unspecified at GSS-API level 
   73.56 +#  GSSException: Failure unspecified at GSS-API level
   73.57  #    (Mechanism level: Specified version of key is not available (44))
   73.58  sun/security/krb5/auto/BasicKrb5Test.java			generic-all
   73.59  
   73.60 @@ -546,14 +546,14 @@
   73.61  sun/security/krb5/auto/HttpNegotiateServer.java			generic-all
   73.62  
   73.63  # Fails on almost all platforms
   73.64 -#   java.lang.UnsupportedClassVersionError: SerialTest : 
   73.65 +#   java.lang.UnsupportedClassVersionError: SerialTest :
   73.66  #      Unsupported major.minor version 51.0
   73.67  #    at java.lang.ClassLoader.defineClass1(Native Method)
   73.68  sun/security/util/Oid/S11N.sh					generic-all
   73.69  
   73.70  # Fails on Fedora 9 32bit
   73.71 -#  GSSException: Failure unspecified at GSS-API level (Mechanism level: 
   73.72 -#    Invalid argument (400) - Cannot find key of appropriate type to decrypt 
   73.73 +#  GSSException: Failure unspecified at GSS-API level (Mechanism level:
   73.74 +#    Invalid argument (400) - Cannot find key of appropriate type to decrypt
   73.75  #    AP REP - DES CBC mode with MD5)
   73.76  #  at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778)
   73.77  sun/security/krb5/auto/NonMutualSpnego.java			generic-all
   73.78 @@ -673,7 +673,7 @@
   73.79  # Timeout on solaris-sparc and i586 and x64, -client and -server
   73.80  sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java solaris-all
   73.81  
   73.82 -# Do not seem to run on windows machines? dll missing? 
   73.83 +# Do not seem to run on windows machines? dll missing?
   73.84  sun/security/tools/jarsigner/emptymanifest.sh		 	windows-all
   73.85  
   73.86  # Files does not exist or no encoding? solaris-sparcv9
   73.87 @@ -734,8 +734,5 @@
   73.88  # Problems on windows, jmap.exe hangs? (these run jmap), fails on Solaris 10 x86
   73.89  java/util/concurrent/locks/Lock/TimedAcquireLeak.java		generic-all
   73.90  
   73.91 -# Fails on solaris-sparc -server (Set not equal to copy. 1)
   73.92 -java/util/EnumSet/EnumSetBash.java			 	solaris-sparc
   73.93 -
   73.94  ############################################################################
   73.95  
    74.1 --- a/test/demo/zipfs/ZipFSTester.java	Fri Feb 25 12:48:18 2011 -0800
    74.2 +++ b/test/demo/zipfs/ZipFSTester.java	Tue Mar 01 14:04:59 2011 -0800
    74.3 @@ -105,6 +105,18 @@
    74.4              os.write(bits);
    74.5              os.close();
    74.6  
    74.7 +            try {
    74.8 +                provider.newFileSystem(new File(System.getProperty("test.src", ".")).toPath(),
    74.9 +                                       new HashMap<String, Object>());
   74.10 +                throw new RuntimeException("newFileSystem() opens a directory as zipfs");
   74.11 +            } catch (UnsupportedOperationException uoe) {}
   74.12 +
   74.13 +            try {
   74.14 +                provider.newFileSystem(src, new HashMap<String, Object>());
   74.15 +                throw new RuntimeException("newFileSystem() opens a non-zip file as zipfs");
   74.16 +            } catch (UnsupportedOperationException uoe) {}
   74.17 +
   74.18 +
   74.19              // copyin
   74.20              Path dst = getPathWithParents(fs, tmpName);
   74.21              Files.copy(src, dst);
    75.1 --- a/test/demo/zipfs/basic.sh	Fri Feb 25 12:48:18 2011 -0800
    75.2 +++ b/test/demo/zipfs/basic.sh	Tue Mar 01 14:04:59 2011 -0800
    75.3 @@ -21,7 +21,7 @@
    75.4  # questions.
    75.5  #
    75.6  # @test
    75.7 -# @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840
    75.8 +# @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596
    75.9  # @summary Test ZipFileSystem demo
   75.10  # @build Basic PathOps ZipFSTester
   75.11  # @run shell basic.sh
    76.1 --- a/test/java/awt/PrintJob/Text/StringWidth.java	Fri Feb 25 12:48:18 2011 -0800
    76.2 +++ b/test/java/awt/PrintJob/Text/StringWidth.java	Tue Mar 01 14:04:59 2011 -0800
    76.3 @@ -63,7 +63,8 @@
    76.4    }
    76.5  
    76.6    public static void main(String[] args) {
    76.7 -    new StringWidth();
    76.8 +    StringWidth sw = new StringWidth();
    76.9 +    sw.dispose();
   76.10    }
   76.11  
   76.12  }
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/java/awt/font/StyledMetrics/BoldSpace.java	Tue Mar 01 14:04:59 2011 -0800
    77.3 @@ -0,0 +1,102 @@
    77.4 +/*
    77.5 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 + *
    77.8 + * This code is free software; you can redistribute it and/or modify it
    77.9 + * under the terms of the GNU General Public License version 2 only, as
   77.10 + * published by the Free Software Foundation.
   77.11 + *
   77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 + * version 2 for more details (a copy is included in the LICENSE file that
   77.16 + * accompanied this code).
   77.17 + *
   77.18 + * You should have received a copy of the GNU General Public License version
   77.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 + *
   77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 + * or visit www.oracle.com if you need additional information or have any
   77.24 + * questions.
   77.25 + */
   77.26 +
   77.27 +/*
   77.28 +  @test
   77.29 +  @bug 6686365 7017637
   77.30 +  @summary Confirm that styling does not affect metrics of zero advance glyphs
   77.31 +*/
   77.32 +
   77.33 +import java.awt.*;
   77.34 +import java.awt.image.*;
   77.35 +
   77.36 +public class BoldSpace {
   77.37 +    public static void main(String[] s) {
   77.38 +        BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
   77.39 +
   77.40 +        String errMsg = "ZWJ Space char should have 0 advance\n";
   77.41 +
   77.42 +        Graphics g = bi.getGraphics();
   77.43 +
   77.44 +        // It turns out that some fonts inexplicably treat this as
   77.45 +        // a standard character. In this 14 pt font, if we see an advance
   77.46 +        // that's clearly bigger than we'd have introduced in bolding we'll
   77.47 +        // not error out this test, presuming that its a consequence of
   77.48 +        // the actual font data. A Linux font 'TLwg Type Bold' is the case
   77.49 +        // in point.
   77.50 +        int errorMargin = 4;
   77.51 +        g.setFont(new Font("monospaced", Font.BOLD, 14));
   77.52 +        //g.setFont(new Font("Lucida Sans Regular", Font.BOLD, 14));
   77.53 +        FontMetrics fm = g.getFontMetrics();
   77.54 +        System.out.println("Bold: " + fm.charWidth('\u200b'));
   77.55 +        int cwid = fm.charWidth('\u200b');
   77.56 +        if (cwid > 0 && cwid < errorMargin) {
   77.57 +            throw new RuntimeException(errMsg);
   77.58 +        }
   77.59 +
   77.60 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
   77.61 +                                 RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
   77.62 +        fm = g.getFontMetrics();
   77.63 +        System.out.println("Bold + LCD: "+fm.charWidth('\u200b'));
   77.64 +        cwid = fm.charWidth('\u200b');
   77.65 +        if (cwid > 0 && cwid < errorMargin) {
   77.66 +            throw new RuntimeException(errMsg);
   77.67 +        }
   77.68 +
   77.69 +
   77.70 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
   77.71 +                                 RenderingHints.VALUE_FRACTIONALMETRICS_ON);
   77.72 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
   77.73 +                                 RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
   77.74 +        fm = g.getFontMetrics();
   77.75 +        System.out.println("Bold FM OFF + AA: " + fm.charWidth('\u200b'));
   77.76 +        cwid = fm.charWidth('\u200b');
   77.77 +        if (cwid > 0 && cwid < errorMargin) {
   77.78 +            throw new RuntimeException(errMsg);
   77.79 +        }
   77.80 +
   77.81 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
   77.82 +                                 RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
   77.83 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
   77.84 +                                 RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
   77.85 +        fm = g.getFontMetrics();
   77.86 +        System.out.println("Bold FM ON + AA: " + fm.charWidth('\u200b'));
   77.87 +        cwid = fm.charWidth('\u200b');
   77.88 +        if (cwid > 0 && cwid < errorMargin) {
   77.89 +            throw new RuntimeException(errMsg);
   77.90 +        }
   77.91 +
   77.92 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
   77.93 +                                 RenderingHints.VALUE_FRACTIONALMETRICS_ON);
   77.94 +        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
   77.95 +                                 RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
   77.96 +        fm = g.getFontMetrics();
   77.97 +        System.out.println("Bold FM ON + nonAA: " + fm.charWidth('\u200b'));
   77.98 +        cwid = fm.charWidth('\u200b');
   77.99 +        if (cwid > 0 && cwid < errorMargin) {
  77.100 +            throw new RuntimeException(errMsg);
  77.101 +        }
  77.102 +
  77.103 +        System.out.println("All printed values should be 0 to PASS");
  77.104 +    }
  77.105 +}
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/test/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java	Tue Mar 01 14:04:59 2011 -0800
    78.3 @@ -0,0 +1,272 @@
    78.4 +/*
    78.5 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
    78.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    78.7 + *
    78.8 + * This code is free software; you can redistribute it and/or modify it
    78.9 + * under the terms of the GNU General Public License version 2 only, as
   78.10 + * published by the Free Software Foundation.
   78.11 + *
   78.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   78.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   78.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   78.15 + * version 2 for more details (a copy is included in the LICENSE file that
   78.16 + * accompanied this code).
   78.17 + *
   78.18 + * You should have received a copy of the GNU General Public License version
   78.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   78.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   78.21 + *
   78.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   78.23 + * or visit www.oracle.com if you need additional information or have any
   78.24 + * questions.
   78.25 + */
   78.26 +
   78.27 +/**
   78.28 + *
   78.29 + * @test
   78.30 + * @bug 4521945 7006865
   78.31 + * @summary Test printing images of different types.
   78.32 + * @author prr
   78.33 + * @run main/manual=yesno/timeout=900 ImageTypes
   78.34 + */
   78.35 +
   78.36 +import java.io.*;
   78.37 +import static java.awt.Color.*;
   78.38 +import java.awt.*;
   78.39 +import java.awt.geom.*;
   78.40 +import java.awt.event.*;
   78.41 +import java.awt.print.*;
   78.42 +import java.awt.image.*;
   78.43 +import static java.awt.image.BufferedImage.*;
   78.44 +import javax.print.*;
   78.45 +import javax.print.attribute.*;
   78.46 +import javax.print.attribute.standard.*;
   78.47 +
   78.48 +public class ImageTypes extends Frame implements ActionListener {
   78.49 +
   78.50 +    private ImageCanvas c;
   78.51 +
   78.52 +    public static void main(String args[]) {
   78.53 +
   78.54 +        ImageTypes f = new ImageTypes();
   78.55 +        f.show();
   78.56 +    }
   78.57 +
   78.58 +    public ImageTypes () {
   78.59 +        super("Image Types Printing Test");
   78.60 +        c = new ImageCanvas();
   78.61 +        add("Center", c);
   78.62 +
   78.63 +        Button printThisButton = new Button("Print");
   78.64 +        printThisButton.addActionListener(this);
   78.65 +        Panel p = new Panel();
   78.66 +        p.add(printThisButton);
   78.67 +        add("South", p);
   78.68 +        add("North", getInstructions());
   78.69 +        addWindowListener(new WindowAdapter() {
   78.70 +                public void windowClosing(WindowEvent e) {
   78.71 +                    System.exit(0);
   78.72 +                }
   78.73 +            });
   78.74 +
   78.75 +        pack();
   78.76 +    }
   78.77 +
   78.78 +    private TextArea getInstructions() {
   78.79 +        TextArea ta = new TextArea(10, 60);
   78.80 +        ta.setFont(new Font("Dialog", Font.PLAIN, 11));
   78.81 +        ta.setText
   78.82 +            ("This is a manual test as it requires that you compare "+
   78.83 +             "the on-screen rendering with the printed output.\n"+
   78.84 +             "Select the 'Print' button to print out the test.\n"+
   78.85 +             "For each image compare the printed one to the on-screen one.\n"+
   78.86 +             "The test PASSES if the onscreen and printed rendering match.");
   78.87 +        return ta;
   78.88 +    }
   78.89 +
   78.90 +    public void actionPerformed(ActionEvent e) {
   78.91 +        PrinterJob pj = PrinterJob.getPrinterJob();
   78.92 +
   78.93 +        PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
   78.94 +        if (pj != null && pj.printDialog(attrs)) {
   78.95 +            pj.setPrintable(c);
   78.96 +            try {
   78.97 +                pj.print(attrs);
   78.98 +            } catch (PrinterException pe) {
   78.99 +                pe.printStackTrace();
  78.100 +                throw new RuntimeException("Exception whilst printing.");
  78.101 +            } finally {
  78.102 +                System.out.println("PRINT RETURNED OK.");
  78.103 +            }
  78.104 +        }
  78.105 +    }
  78.106 +}
  78.107 +
  78.108 +class ImageCanvas extends Component implements Printable {
  78.109 +
  78.110 +    IndexColorModel icm2 = null;
  78.111 +    IndexColorModel icm4 = null;
  78.112 +    BufferedImage opaqueImg = null;
  78.113 +    BufferedImage transImg = null;
  78.114 +    int sw=99, sh=99;
  78.115 +
  78.116 +    void paintImage(BufferedImage bi, Color c1, Color c2) {
  78.117 +
  78.118 +        GradientPaint tp= new GradientPaint(0.0f, 0.0f, c1, 10f, 8f, c2, true);
  78.119 +        Graphics2D g2d = (Graphics2D)bi.getGraphics();
  78.120 +        g2d.setPaint(tp);
  78.121 +        g2d.fillRect(0, 0, sw, sh);
  78.122 +        g2d.setColor(gray);
  78.123 +        int cnt=0;
  78.124 +        Font font = new Font("Serif", Font.PLAIN, 11);
  78.125 +        g2d.setFont(font);
  78.126 +        FontMetrics fm = g2d.getFontMetrics();
  78.127 +        for (int y=12;y<sh;y+=12) {
  78.128 +            int x = 0;
  78.129 +            while (x < sw) {
  78.130 +                String s = (new Integer(++cnt)).toString();
  78.131 +                g2d.drawString(s, x, y);
  78.132 +                x+= fm.stringWidth(s);
  78.133 +            }
  78.134 +        }
  78.135 +    }
  78.136 +
  78.137 +    ImageCanvas() {
  78.138 +
  78.139 +        opaqueImg = new BufferedImage(sw, sh, TYPE_INT_RGB);
  78.140 +        Color o1 = new Color(0, 0, 0);
  78.141 +        Color o2 = new Color(255, 255, 255);
  78.142 +        paintImage(opaqueImg, o1, o2);
  78.143 +
  78.144 +        transImg = new BufferedImage(sw, sh, TYPE_INT_ARGB);
  78.145 +        Color t1 = new Color(255, 255, 255, 220);
  78.146 +        Color t2 = new Color(255, 200, 0, 220);
  78.147 +        paintImage(transImg, t1, t2);
  78.148 +
  78.149 +        /* greyscale 2bpp */
  78.150 +        byte[] arr2bpp =  {(byte)0, (byte)0x55, (byte)0xaa, (byte)0xff};
  78.151 +        icm2 = new IndexColorModel(2, 4, arr2bpp, arr2bpp, arr2bpp);
  78.152 +
  78.153 +        /* color 4bpp */
  78.154 +        int[] cmap = new int[16];
  78.155 +        cmap[0] = black.getRGB();
  78.156 +        cmap[1] = white.getRGB();
  78.157 +        cmap[2] = gray.getRGB();
  78.158 +        cmap[3] = lightGray.getRGB();
  78.159 +        cmap[4] = red.getRGB();
  78.160 +        cmap[5] = green.getRGB();
  78.161 +        cmap[6] = blue.getRGB();
  78.162 +        cmap[7] = yellow.getRGB();
  78.163 +        cmap[8] = cyan.getRGB();
  78.164 +        cmap[9] = magenta.getRGB();
  78.165 +        cmap[10] = orange.getRGB();
  78.166 +        cmap[11] = pink.getRGB();
  78.167 +        cmap[12] = darkGray.getRGB();
  78.168 +        cmap[13] = 192 << 16 ; // dark red.
  78.169 +        cmap[14] = 192 << 8; // dark green
  78.170 +        cmap[15] = 192; // dark blue
  78.171 +
  78.172 +        icm4 = new IndexColorModel(4, 16, cmap, 0, false, -1,
  78.173 +                                   DataBuffer.TYPE_BYTE);
  78.174 +
  78.175 +    }
  78.176 +
  78.177 +
  78.178 +    public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
  78.179 +
  78.180 +        if (pgIndex > 0) {
  78.181 +            return Printable.NO_SUCH_PAGE;
  78.182 +        }
  78.183 +        Graphics2D g2d = (Graphics2D)g;
  78.184 +        g2d.translate(pgFmt.getImageableX(), pgFmt.getImageableY());
  78.185 +        paint(g2d);
  78.186 +        return Printable.PAGE_EXISTS;
  78.187 +    }
  78.188 +
  78.189 +    private void drawImage(Graphics g, int biType, IndexColorModel icm) {
  78.190 +
  78.191 +        BufferedImage bi;
  78.192 +        if (icm != null) {
  78.193 +            bi = new BufferedImage(sw, sh, biType, icm);
  78.194 +        } else {
  78.195 +            bi = new BufferedImage(sw, sh, biType);
  78.196 +        }
  78.197 +
  78.198 +        Graphics big = bi.getGraphics();
  78.199 +        if (bi.getColorModel().getPixelSize() <=2) {
  78.200 +            big.drawImage(opaqueImg, 0, 0, null);
  78.201 +        } else {
  78.202 +            big.drawImage(transImg, 0, 0, null);
  78.203 +        }
  78.204 +        g.drawImage(bi, 0, 0, null);
  78.205 +    }
  78.206 +
  78.207 +    public void paint(Graphics g) {
  78.208 +
  78.209 +        int incX = sw+10, incY = sh+10;
  78.210 +
  78.211 +        g.translate(10, 10);
  78.212 +
  78.213 +        drawImage(g, TYPE_INT_RGB, null);
  78.214 +        g.translate(incX, 0);
  78.215 +
  78.216 +        drawImage(g, TYPE_INT_BGR, null);
  78.217 +        g.translate(incX, 0);
  78.218 +
  78.219 +        drawImage(g, TYPE_INT_ARGB, null);
  78.220 +        g.translate(incX, 0);
  78.221 +
  78.222 +        drawImage(g, TYPE_INT_ARGB_PRE, null);
  78.223 +        g.translate(-3*incX, incY);
  78.224 +
  78.225 +        drawImage(g, TYPE_3BYTE_BGR, null);
  78.226 +        g.translate(incX, 0);
  78.227 +
  78.228 +        drawImage(g, TYPE_4BYTE_ABGR, null);
  78.229 +        g.translate(incX, 0);
  78.230 +
  78.231 +        drawImage(g, TYPE_4BYTE_ABGR_PRE, null);
  78.232 +        g.translate(incX, 0);
  78.233 +
  78.234 +        drawImage(g, TYPE_USHORT_555_RGB, null);
  78.235 +        g.translate(-3*incX, incY);
  78.236 +
  78.237 +        drawImage(g, TYPE_USHORT_555_RGB, null);
  78.238 +        g.translate(incX, 0);
  78.239 +
  78.240 +        drawImage(g, TYPE_USHORT_GRAY, null);
  78.241 +        g.translate(incX, 0);
  78.242 +
  78.243 +        drawImage(g, TYPE_BYTE_GRAY, null);
  78.244 +        g.translate(incX, 0);
  78.245 +
  78.246 +        drawImage(g, TYPE_BYTE_INDEXED, null);
  78.247 +        g.translate(-3*incX, incY);
  78.248 +
  78.249 +        drawImage(g, TYPE_BYTE_BINARY, null);
  78.250 +        g.translate(incX, 0);
  78.251 +
  78.252 +        drawImage(g, TYPE_BYTE_BINARY, icm2);
  78.253 +        g.translate(incX, 0);
  78.254 +
  78.255 +        drawImage(g, TYPE_BYTE_BINARY, icm4);
  78.256 +        g.translate(incX, 0);
  78.257 +
  78.258 +        drawImage(g, TYPE_BYTE_INDEXED, icm2);
  78.259 +        g.translate(-3*incX, incY);
  78.260 +
  78.261 +        drawImage(g, TYPE_BYTE_INDEXED, icm4);
  78.262 +        g.translate(incX, 0);
  78.263 +    }
  78.264 +
  78.265 +
  78.266 +
  78.267 +     /* Size is chosen to match default imageable width of a NA letter
  78.268 +      * page. This means there will be clipping, what is clipped will
  78.269 +      * depend on PageFormat orientation.
  78.270 +      */
  78.271 +     public Dimension getPreferredSize() {
  78.272 +        return new Dimension(468, 600);
  78.273 +    }
  78.274 +
  78.275 +}
    79.1 --- a/test/java/lang/Thread/StopBeforeStart.java	Fri Feb 25 12:48:18 2011 -0800
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,132 +0,0 @@
    79.4 -/*
    79.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    79.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    79.7 - *
    79.8 - * This code is free software; you can redistribute it and/or modify it
    79.9 - * under the terms of the GNU General Public License version 2 only, as
   79.10 - * published by the Free Software Foundation.
   79.11 - *
   79.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   79.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   79.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   79.15 - * version 2 for more details (a copy is included in the LICENSE file that
   79.16 - * accompanied this code).
   79.17 - *
   79.18 - * You should have received a copy of the GNU General Public License version
   79.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   79.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   79.21 - *
   79.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   79.23 - * or visit www.oracle.com if you need additional information or have any
   79.24 - * questions.
   79.25 - */
   79.26 -
   79.27 -/*
   79.28 - * @test
   79.29 - * @bug     4519200
   79.30 - * @summary Confirm a Thread.stop before start complies with the spec
   79.31 - * @author  Pete Soper
   79.32 - *
   79.33 - * Confirm that a thread that had its stop method invoked before start
   79.34 - * does properly terminate with expected exception behavior. NOTE that
   79.35 - * arbitrary application threads could return from their run methods faster
   79.36 - * than the VM can throw an async exception.
   79.37 - */
   79.38 -public class StopBeforeStart {
   79.39 -
   79.40 -    private static final int JOIN_TIMEOUT=10000;
   79.41 -
   79.42 -    private class MyThrowable extends Throwable {
   79.43 -    }
   79.44 -
   79.45 -    private class Catcher implements Thread.UncaughtExceptionHandler {
   79.46 -        private boolean nullaryStop;
   79.47 -        private Throwable theThrowable;
   79.48 -        private Throwable expectedThrowable;
   79.49 -        private boolean exceptionThrown;
   79.50 -
   79.51 -        Catcher(boolean nullaryStop) {
   79.52 -            this.nullaryStop = nullaryStop;
   79.53 -            if (!nullaryStop) {
   79.54 -                expectedThrowable = new MyThrowable();
   79.55 -            }
   79.56 -        }
   79.57 -
   79.58 -        public void uncaughtException(Thread t, Throwable th) {
   79.59 -            exceptionThrown = true;
   79.60 -            theThrowable = th;
   79.61 -        }
   79.62 -
   79.63 -        void check(String label) throws Throwable {
   79.64 -            if (!exceptionThrown) {
   79.65 -                throw new RuntimeException(label +
   79.66 -                        " test:" + " missing uncaught exception");
   79.67 -            }
   79.68 -
   79.69 -            if (nullaryStop) {
   79.70 -                if (! (theThrowable instanceof ThreadDeath)) {
   79.71 -                    throw new RuntimeException(label +
   79.72 -                        " test:" + " expected ThreadDeath in uncaught handler");
   79.73 -                }
   79.74 -            } else if (theThrowable != expectedThrowable) {
   79.75 -                throw new RuntimeException(label +
   79.76 -                        " test:" + " wrong Throwable in uncaught handler");
   79.77 -            }
   79.78 -        }
   79.79 -    }
   79.80 -
   79.81 -    private class MyRunnable implements Runnable {
   79.82 -        public void run() {
   79.83 -            while(true)
   79.84 -                ;
   79.85 -        }
   79.86 -    }
   79.87 -
   79.88 -    private class MyThread extends Thread {
   79.89 -        public void run() {
   79.90 -            while(true)
   79.91 -                ;
   79.92 -        }
   79.93 -    }
   79.94 -
   79.95 -
   79.96 -    public static void main(String args[]) throws Throwable {
   79.97 -        (new StopBeforeStart()).doit();
   79.98 -        System.out.println("Test passed");
   79.99 -    }
  79.100 -
  79.101 -    private void doit() throws Throwable {
  79.102 -
  79.103 -        runit(false, new Thread(new MyRunnable()),"Thread");
  79.104 -        runit(true, new Thread(new MyRunnable()),"Thread");
  79.105 -        runit(false, new MyThread(),"Runnable");
  79.106 -        runit(true, new MyThread(),"Runnable");
  79.107 -    }
  79.108 -
  79.109 -    private void runit(boolean nullaryStop, Thread thread,
  79.110 -                        String type) throws Throwable {
  79.111 -
  79.112 -        Catcher c = new Catcher(nullaryStop);
  79.113 -        thread.setUncaughtExceptionHandler(c);
  79.114 -
  79.115 -        if (nullaryStop) {
  79.116 -            thread.stop();
  79.117 -        } else {
  79.118 -            thread.stop(c.expectedThrowable);
  79.119 -        }
  79.120 -
  79.121 -        thread.start();
  79.122 -        thread.join(JOIN_TIMEOUT);
  79.123 -
  79.124 -        if (thread.getState() != Thread.State.TERMINATED) {
  79.125 -
  79.126 -            thread.stop();
  79.127 -
  79.128 -            // Under high load this could be a false positive
  79.129 -            throw new RuntimeException(type +
  79.130 -                        " test:" + " app thread did not terminate");
  79.131 -        }
  79.132 -
  79.133 -        c.check(type);
  79.134 -    }
  79.135 -}
    80.1 --- a/test/java/nio/channels/FileChannel/Position.java	Fri Feb 25 12:48:18 2011 -0800
    80.2 +++ b/test/java/nio/channels/FileChannel/Position.java	Tue Mar 01 14:04:59 2011 -0800
    80.3 @@ -22,13 +22,16 @@
    80.4   */
    80.5  
    80.6  /* @test
    80.7 + * @bug 4429043 6526860
    80.8   * @summary Test position method of FileChannel
    80.9   */
   80.10  
   80.11  import java.io.*;
   80.12 -import java.nio.MappedByteBuffer;
   80.13 -import java.nio.channels.*;
   80.14 +import java.nio.ByteBuffer;
   80.15  import java.nio.channels.FileChannel;
   80.16 +import java.nio.file.*;
   80.17 +import static java.nio.file.StandardOpenOption.*;
   80.18 +import java.nio.charset.Charset;
   80.19  import java.util.Random;
   80.20  
   80.21  
   80.22 @@ -38,32 +41,42 @@
   80.23  
   80.24  public class Position {
   80.25  
   80.26 -    private static PrintStream err = System.err;
   80.27 +    private static final Charset ISO8859_1 = Charset.forName("8859_1");
   80.28  
   80.29 -    private static Random generator = new Random();
   80.30 -
   80.31 -    private static int CHARS_PER_LINE = File.separatorChar == '/' ? 5 : 6;
   80.32 -
   80.33 -    private static File blah;
   80.34 +    private static final Random generator = new Random();
   80.35  
   80.36      public static void main(String[] args) throws Exception {
   80.37 -        blah = File.createTempFile("blah", null);
   80.38 -        blah.deleteOnExit();
   80.39 +        Path blah = Files.createTempFile("blah", null);
   80.40 +        blah.toFile().deleteOnExit();
   80.41          initTestFile(blah);
   80.42  
   80.43 -        FileInputStream fis = new FileInputStream(blah);
   80.44 -        FileChannel c = fis.getChannel();
   80.45 -
   80.46 -        for(int i=0; i<100; i++) {
   80.47 -            long newPos = generator.nextInt(1000);
   80.48 -            c.position(newPos);
   80.49 -            if (c.position() != newPos)
   80.50 -                throw new RuntimeException("Position failed");
   80.51 +        for (int i=0; i<10; i++) {
   80.52 +            try (FileChannel fc = (generator.nextBoolean()) ?
   80.53 +                    FileChannel.open(blah, READ) :
   80.54 +                    new FileInputStream(blah.toFile()).getChannel()) {
   80.55 +                for (int j=0; j<100; j++) {
   80.56 +                    long newPos = generator.nextInt(1000);
   80.57 +                    fc.position(newPos);
   80.58 +                    if (fc.position() != newPos)
   80.59 +                        throw new RuntimeException("Position failed");
   80.60 +                }
   80.61 +            }
   80.62          }
   80.63  
   80.64 -        c.close();
   80.65 -        fis.close();
   80.66 -        blah.delete();
   80.67 +        for (int i=0; i<10; i++) {
   80.68 +            try (FileChannel fc = (generator.nextBoolean()) ?
   80.69 +                     FileChannel.open(blah, APPEND) :
   80.70 +                     new FileOutputStream(blah.toFile(), true).getChannel()) {
   80.71 +                for (int j=0; j<10; j++) {
   80.72 +                    if (fc.position() != fc.size())
   80.73 +                        throw new RuntimeException("Position expected to be size");
   80.74 +                    byte[] buf = new byte[generator.nextInt(100)];
   80.75 +                    fc.write(ByteBuffer.wrap(buf));
   80.76 +                }
   80.77 +            }
   80.78 +        }
   80.79 +
   80.80 +        Files.delete(blah);
   80.81      }
   80.82  
   80.83      /**
   80.84 @@ -78,19 +91,15 @@
   80.85       * 3999
   80.86       *
   80.87       */
   80.88 -    private static void initTestFile(File blah) throws Exception {
   80.89 -        FileOutputStream fos = new FileOutputStream(blah);
   80.90 -        BufferedWriter awriter
   80.91 -            = new BufferedWriter(new OutputStreamWriter(fos, "8859_1"));
   80.92 -
   80.93 -        for(int i=0; i<4000; i++) {
   80.94 -            String number = new Integer(i).toString();
   80.95 -            for (int h=0; h<4-number.length(); h++)
   80.96 -                awriter.write("0");
   80.97 -            awriter.write(""+i);
   80.98 -            awriter.newLine();
   80.99 +    private static void initTestFile(Path blah) throws IOException {
  80.100 +        try (BufferedWriter awriter = Files.newBufferedWriter(blah, ISO8859_1)) {
  80.101 +            for(int i=0; i<4000; i++) {
  80.102 +                String number = new Integer(i).toString();
  80.103 +                for (int h=0; h<4-number.length(); h++)
  80.104 +                    awriter.write("0");
  80.105 +                awriter.write(""+i);
  80.106 +                awriter.newLine();
  80.107 +            }
  80.108          }
  80.109 -       awriter.flush();
  80.110 -       awriter.close();
  80.111      }
  80.112  }
    81.1 --- a/test/java/nio/file/Files/walkFileTree/PrintFileTree.java	Fri Feb 25 12:48:18 2011 -0800
    81.2 +++ b/test/java/nio/file/Files/walkFileTree/PrintFileTree.java	Tue Mar 01 14:04:59 2011 -0800
    81.3 @@ -54,6 +54,7 @@
    81.4          if (followLinks)
    81.5              options.add(FileVisitOption.FOLLOW_LINKS);
    81.6  
    81.7 +        final boolean follow = followLinks;
    81.8          final boolean reportCycles = printCycles;
    81.9          Files.walkFileTree(dir, options, Integer.MAX_VALUE, new FileVisitor<Path>() {
   81.10              @Override
   81.11 @@ -63,8 +64,7 @@
   81.12              }
   81.13              @Override
   81.14              public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
   81.15 -                if (!attrs.isDirectory() || reportCycles)
   81.16 -                    System.out.println(file);
   81.17 +                System.out.println(file);
   81.18                  return FileVisitResult.CONTINUE;
   81.19              }
   81.20              @Override
   81.21 @@ -79,11 +79,13 @@
   81.22              public FileVisitResult visitFileFailed(Path file, IOException exc)
   81.23                  throws IOException
   81.24              {
   81.25 -                if (reportCycles && (exc instanceof FileSystemLoopException)) {
   81.26 -                    System.out.println(file);
   81.27 +                if (follow && (exc instanceof FileSystemLoopException)) {
   81.28 +                    if (reportCycles)
   81.29 +                        System.out.println(file);
   81.30                      return FileVisitResult.CONTINUE;
   81.31 +                } else {
   81.32 +                    throw exc;
   81.33                  }
   81.34 -                throw exc;
   81.35              }
   81.36          });
   81.37      }
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/test/java/util/Hashtable/SerializationDeadlock.java	Tue Mar 01 14:04:59 2011 -0800
    82.3 @@ -0,0 +1,156 @@
    82.4 +/*
    82.5 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
    82.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    82.7 + *
    82.8 + * This code is free software; you can redistribute it and/or modify it
    82.9 + * under the terms of the GNU General Public License version 2 only, as
   82.10 + * published by the Free Software Foundation.
   82.11 + *
   82.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   82.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   82.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   82.15 + * version 2 for more details (a copy is included in the LICENSE file that
   82.16 + * accompanied this code).
   82.17 + *
   82.18 + * You should have received a copy of the GNU General Public License version
   82.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   82.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   82.21 + *
   82.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   82.23 + * or visit www.oracle.com if you need additional information or have any
   82.24 + * questions.
   82.25 + *
   82.26 + * -------------------------------------------
   82.27 + *
   82.28 + * Portions Copyright (c) 2010, 2011 IBM Corporation
   82.29 + */
   82.30 +
   82.31 +/*
   82.32 + * @test
   82.33 + * @bug 6927486
   82.34 + * @summary Serializing Hashtable objects which refer to each other should not be able to deadlock.
   82.35 + * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
   82.36 + */
   82.37 +
   82.38 +import java.io.ByteArrayOutputStream;
   82.39 +import java.io.IOException;
   82.40 +import java.io.ObjectOutputStream;
   82.41 +import java.io.PrintWriter;
   82.42 +import java.io.Serializable;
   82.43 +import java.io.StringWriter;
   82.44 +import java.util.ArrayList;
   82.45 +import java.util.Hashtable;
   82.46 +import java.util.List;
   82.47 +import java.util.concurrent.CyclicBarrier;
   82.48 +
   82.49 +public class SerializationDeadlock {
   82.50 +    public static void main(final String[] args) throws Exception {
   82.51 +        // Test for Hashtable serialization deadlock
   82.52 +        final Hashtable<Object, Object> h1 = new Hashtable<>();
   82.53 +        final Hashtable<Object, Object> h2 = new Hashtable<>();
   82.54 +        final TestBarrier testStart = new TestBarrier(3);
   82.55 +
   82.56 +        // Populate the hashtables so that they refer to each other
   82.57 +        h1.put(testStart, h2);
   82.58 +        h2.put(testStart, h1);
   82.59 +
   82.60 +        final CyclicBarrier testEnd = new CyclicBarrier(3);
   82.61 +        final TestThread t1 = new TestThread(h1, testEnd);
   82.62 +        final TestThread t2 = new TestThread(h2, testEnd);
   82.63 +
   82.64 +        t1.start();
   82.65 +        t2.start();
   82.66 +
   82.67 +        // Wait for both test threads to have initiated serialization
   82.68 +        // of the 'testStart' object (and hence of both 'h1' and 'h2')
   82.69 +        testStart.await();
   82.70 +
   82.71 +        // Wait for both test threads to successfully finish serialization
   82.72 +        // of 'h1' and 'h2'.
   82.73 +        System.out.println("Waiting for Hashtable serialization to complete ...");
   82.74 +        System.out.println("(This test will hang if serialization deadlocks)");
   82.75 +        testEnd.await();
   82.76 +        System.out.println("Test PASSED: serialization completed successfully");
   82.77 +
   82.78 +        TestThread.handleExceptions();
   82.79 +    }
   82.80 +
   82.81 +    static final class TestBarrier extends CyclicBarrier
   82.82 +            implements Serializable {
   82.83 +        public TestBarrier(final int count) {
   82.84 +            super(count);
   82.85 +        }
   82.86 +
   82.87 +        private void writeObject(final ObjectOutputStream oos)
   82.88 +                throws IOException {
   82.89 +            oos.defaultWriteObject();
   82.90 +            // Wait until all test threads have started serializing data
   82.91 +            try {
   82.92 +                await();
   82.93 +            } catch (final Exception e) {
   82.94 +                throw new IOException("Test ERROR: Unexpected exception caught", e);
   82.95 +            }
   82.96 +        }
   82.97 +    }
   82.98 +
   82.99 +    static final class TestThread extends Thread {
  82.100 +        private static final List<Exception> exceptions = new ArrayList<>();
  82.101 +
  82.102 +        private final Hashtable<Object, Object> hashtable;
  82.103 +        private final CyclicBarrier testEnd;
  82.104 +
  82.105 +        public TestThread(final Hashtable<Object, Object> hashtable,
  82.106 +                final CyclicBarrier testEnd) {
  82.107 +            this.hashtable = hashtable;
  82.108 +            this.testEnd = testEnd;
  82.109 +            setDaemon(true);
  82.110 +        }
  82.111 +
  82.112 +        public void run() {
  82.113 +            try {
  82.114 +                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
  82.115 +                final ObjectOutputStream oos = new ObjectOutputStream(baos);
  82.116 +
  82.117 +                oos.writeObject(hashtable);
  82.118 +                oos.close();
  82.119 +            } catch (final IOException ioe) {
  82.120 +                addException(ioe);
  82.121 +            } finally {
  82.122 +                try {
  82.123 +                    testEnd.await();
  82.124 +                } catch (Exception e) {
  82.125 +                    addException(e);
  82.126 +                }
  82.127 +            }
  82.128 +        }
  82.129 +
  82.130 +        private static synchronized void addException(final Exception exception) {
  82.131 +            exceptions.add(exception);
  82.132 +        }
  82.133 +
  82.134 +        public static synchronized void handleExceptions() {
  82.135 +            if (false == exceptions.isEmpty()) {
  82.136 +                throw new RuntimeException(getErrorText(exceptions));
  82.137 +            }
  82.138 +        }
  82.139 +
  82.140 +        private static String getErrorText(final List<Exception> exceptions) {
  82.141 +            final StringWriter sw = new StringWriter();
  82.142 +            final PrintWriter pw = new PrintWriter(sw);
  82.143 +
  82.144 +            pw.println("Test ERROR: Unexpected exceptions thrown on test threads:");
  82.145 +            for (Exception exception : exceptions) {
  82.146 +                pw.print("\t");
  82.147 +                pw.println(exception);
  82.148 +                for (StackTraceElement element : exception.getStackTrace()) {
  82.149 +                    pw.print("\t\tat ");
  82.150 +                    pw.println(element);
  82.151 +                }
  82.152 +            }
  82.153 +
  82.154 +            pw.close();
  82.155 +            return sw.toString();
  82.156 +        }
  82.157 +    }
  82.158 +}
  82.159 +
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/test/java/util/Hashtable/SimpleSerialization.java	Tue Mar 01 14:04:59 2011 -0800
    83.3 @@ -0,0 +1,86 @@
    83.4 +/*
    83.5 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
    83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.7 + *
    83.8 + * This code is free software; you can redistribute it and/or modify it
    83.9 + * under the terms of the GNU General Public License version 2 only, as
   83.10 + * published by the Free Software Foundation.
   83.11 + *
   83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   83.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   83.15 + * version 2 for more details (a copy is included in the LICENSE file that
   83.16 + * accompanied this code).
   83.17 + *
   83.18 + * You should have received a copy of the GNU General Public License version
   83.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   83.21 + *
   83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   83.23 + * or visit www.oracle.com if you need additional information or have any
   83.24 + * questions.
   83.25 + *
   83.26 + * -------------------------------------------
   83.27 + *
   83.28 + * Portions Copyright (c) 2010, 2011 IBM Corporation
   83.29 + */
   83.30 +
   83.31 +/*
   83.32 + * @test
   83.33 + * @bug 6927486
   83.34 + * @summary A serialized Hashtable can be de-serialized properly.
   83.35 + * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
   83.36 + */
   83.37 +
   83.38 +import java.io.ByteArrayInputStream;
   83.39 +import java.io.ByteArrayOutputStream;
   83.40 +import java.io.IOException;
   83.41 +import java.io.ObjectInputStream;
   83.42 +import java.io.ObjectOutputStream;
   83.43 +import java.io.PrintWriter;
   83.44 +import java.io.StringWriter;
   83.45 +import java.util.Hashtable;
   83.46 +
   83.47 +public class SimpleSerialization {
   83.48 +    public static void main(final String[] args) throws Exception {
   83.49 +        Hashtable<String, String> h1 = new Hashtable<>();
   83.50 +
   83.51 +        h1.put("key", "value");
   83.52 +
   83.53 +        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
   83.54 +        final ObjectOutputStream oos = new ObjectOutputStream(baos);
   83.55 +
   83.56 +        oos.writeObject(h1);
   83.57 +        oos.close();
   83.58 +
   83.59 +        final byte[] data = baos.toByteArray();
   83.60 +        final ByteArrayInputStream bais = new ByteArrayInputStream(data);
   83.61 +        final ObjectInputStream ois = new ObjectInputStream(bais);
   83.62 +
   83.63 +        final Object deserializedObject = ois.readObject();
   83.64 +        ois.close();
   83.65 +
   83.66 +        if (false == h1.equals(deserializedObject)) {
   83.67 +            throw new RuntimeException(getFailureText(h1, deserializedObject));
   83.68 +        }
   83.69 +    }
   83.70 +
   83.71 +    private static String getFailureText(final Object orig, final Object copy) {
   83.72 +        final StringWriter sw = new StringWriter();
   83.73 +        final PrintWriter pw = new PrintWriter(sw);
   83.74 +
   83.75 +        pw.println("Test FAILED: Deserialized object is not equal to the original object");
   83.76 +        pw.print("\tOriginal: ");
   83.77 +        printObject(pw, orig).println();
   83.78 +        pw.print("\tCopy:     ");
   83.79 +        printObject(pw, copy).println();
   83.80 +
   83.81 +        pw.close();
   83.82 +        return sw.toString();
   83.83 +    }
   83.84 +
   83.85 +    private static PrintWriter printObject(final PrintWriter pw, final Object o) {
   83.86 +        pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o));
   83.87 +        return pw;
   83.88 +    }
   83.89 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/java/util/TimeZone/DaylightTimeTest.java	Tue Mar 01 14:04:59 2011 -0800
    84.3 @@ -0,0 +1,103 @@
    84.4 +/*
    84.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.7 + *
    84.8 + * This code is free software; you can redistribute it and/or modify it
    84.9 + * under the terms of the GNU General Public License version 2 only, as
   84.10 + * published by the Free Software Foundation.
   84.11 + *
   84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   84.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   84.15 + * version 2 for more details (a copy is included in the LICENSE file that
   84.16 + * accompanied this code).
   84.17 + *
   84.18 + * You should have received a copy of the GNU General Public License version
   84.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   84.21 + *
   84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   84.23 + * or visit www.oracle.com if you need additional information or have any
   84.24 + * questions.
   84.25 + */
   84.26 +
   84.27 +/*
   84.28 + * @test
   84.29 + * @bug 6936350
   84.30 + * @summary Test case for TimeZone.observesDaylightTime()
   84.31 + */
   84.32 +
   84.33 +import java.util.*;
   84.34 +import static java.util.GregorianCalendar.*;
   84.35 +
   84.36 +public class DaylightTimeTest {
   84.37 +    private static final int ONE_HOUR = 60 * 60 * 1000; // one hour
   84.38 +    private static final int INTERVAL = 24 * ONE_HOUR;  // one day
   84.39 +    private static final String[] ZONES = TimeZone.getAvailableIDs();
   84.40 +    private static int errors = 0;
   84.41 +
   84.42 +    public static void main(String[] args) {
   84.43 +
   84.44 +        // Test default TimeZone
   84.45 +        for (String id : ZONES) {
   84.46 +            TimeZone tz = TimeZone.getTimeZone(id);
   84.47 +            long now = System.currentTimeMillis();
   84.48 +            boolean observes = tz.observesDaylightTime();
   84.49 +            boolean found = findDSTTransition(tz, now);
   84.50 +            if (observes != found) {
   84.51 +                // There's a critical section. If DST ends after the
   84.52 +                // System.currentTimeMills() call, there should be
   84.53 +                // inconsistency in the determination. Try the same
   84.54 +                // thing again to see the inconsistency was due to the
   84.55 +                // critical section.
   84.56 +                now = System.currentTimeMillis();
   84.57 +                observes = tz.observesDaylightTime();
   84.58 +                found = findDSTTransition(tz, now);
   84.59 +                if (observes != found) {
   84.60 +                    System.err.printf("%s: observesDaylightTime() should return %s at %d%n",
   84.61 +                                      tz.getID(), found, now);
   84.62 +                    errors++;
   84.63 +                }
   84.64 +            }
   84.65 +        }
   84.66 +
   84.67 +        // Test SimpleTimeZone in which observesDaylightTime() is
   84.68 +        // equivalent to useDaylightTime().
   84.69 +        testSimpleTimeZone(new SimpleTimeZone(-8*ONE_HOUR, "X",
   84.70 +                                              APRIL, 1, -SUNDAY, 2*ONE_HOUR,
   84.71 +                                              OCTOBER, -1, SUNDAY, 2*ONE_HOUR,
   84.72 +                                              1*ONE_HOUR));
   84.73 +        testSimpleTimeZone(new SimpleTimeZone(-8*ONE_HOUR, "Y"));
   84.74 +
   84.75 +        if (errors > 0) {
   84.76 +            throw new RuntimeException("DaylightTimeTest: failed");
   84.77 +        }
   84.78 +    }
   84.79 +
   84.80 +    /**
   84.81 +     * Returns true if it's `now' in DST or there's any
   84.82 +     * standard-to-daylight transition within 50 years after `now'.
   84.83 +     */
   84.84 +    private static boolean findDSTTransition(TimeZone tz, long now) {
   84.85 +        GregorianCalendar cal = new GregorianCalendar(tz, Locale.US);
   84.86 +        cal.setTimeInMillis(now);
   84.87 +        cal.add(YEAR, 50);
   84.88 +        long end = cal.getTimeInMillis();
   84.89 +
   84.90 +        for (long t = now; t < end; t += INTERVAL) {
   84.91 +            cal.setTimeInMillis(t);
   84.92 +            if (cal.get(DST_OFFSET) > 0) {
   84.93 +                return true;
   84.94 +            }
   84.95 +        }
   84.96 +        return false;
   84.97 +    }
   84.98 +
   84.99 +    private static void testSimpleTimeZone(SimpleTimeZone stz) {
  84.100 +        if (stz.useDaylightTime() != stz.observesDaylightTime()) {
  84.101 +            System.err.printf("Failed: useDaylightTime=%b, observesDaylightTime()=%b%n\t%s%n",
  84.102 +                              stz.useDaylightTime(),stz.observesDaylightTime(), stz);
  84.103 +            errors++;
  84.104 +        }
  84.105 +    }
  84.106 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/test/java/util/Vector/SerializationDeadlock.java	Tue Mar 01 14:04:59 2011 -0800
    85.3 @@ -0,0 +1,157 @@
    85.4 +/*
    85.5 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
    85.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.7 + *
    85.8 + * This code is free software; you can redistribute it and/or modify it
    85.9 + * under the terms of the GNU General Public License version 2 only, as
   85.10 + * published by the Free Software Foundation.
   85.11 + *
   85.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   85.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   85.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   85.15 + * version 2 for more details (a copy is included in the LICENSE file that
   85.16 + * accompanied this code).
   85.17 + *
   85.18 + * You should have received a copy of the GNU General Public License version
   85.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   85.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   85.21 + *
   85.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   85.23 + * or visit www.oracle.com if you need additional information or have any
   85.24 + * questions.
   85.25 + */
   85.26 +
   85.27 +/*
   85.28 + * Portions Copyright (c) 2010, 2011 IBM Corporation
   85.29 + */
   85.30 +
   85.31 +/*
   85.32 + * @test
   85.33 + * @bug 6934356
   85.34 + * @summary Serializing Vector objects which refer to each other should not be able to deadlock.
   85.35 + * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
   85.36 + */
   85.37 +
   85.38 +import java.io.ByteArrayOutputStream;
   85.39 +import java.io.IOException;
   85.40 +import java.io.ObjectOutputStream;
   85.41 +import java.io.PrintWriter;
   85.42 +import java.io.Serializable;
   85.43 +import java.io.StringWriter;
   85.44 +import java.util.ArrayList;
   85.45 +import java.util.List;
   85.46 +import java.util.Vector;
   85.47 +import java.util.concurrent.CyclicBarrier;
   85.48 +
   85.49 +public class SerializationDeadlock {
   85.50 +    public static void main(final String[] args) throws Exception {
   85.51 +        // Test for Vector serialization deadlock
   85.52 +        final Vector<Object> v1 = new Vector<>();
   85.53 +        final Vector<Object> v2 = new Vector<>();
   85.54 +        final TestBarrier testStart = new TestBarrier(3);
   85.55 +
   85.56 +        // Populate the vectors so that they refer to each other
   85.57 +        v1.add(testStart);
   85.58 +        v1.add(v2);
   85.59 +        v2.add(testStart);
   85.60 +        v2.add(v1);
   85.61 +
   85.62 +        final CyclicBarrier testEnd = new CyclicBarrier(3);
   85.63 +        final TestThread t1 = new TestThread(v1, testEnd);
   85.64 +        final TestThread t2 = new TestThread(v2, testEnd);
   85.65 +
   85.66 +        t1.start();
   85.67 +        t2.start();
   85.68 +
   85.69 +        // Wait for both test threads to have initiated serialization
   85.70 +        // of the 'testStart' object (and hence of both 'v1' and 'v2')
   85.71 +        testStart.await();
   85.72 +
   85.73 +        // Wait for both test threads to successfully finish serialization
   85.74 +        // of 'v1' and 'v2'.
   85.75 +        System.out.println("Waiting for Vector serialization to complete ...");
   85.76 +        System.out.println("(This test will hang if serialization deadlocks)");
   85.77 +        testEnd.await();
   85.78 +        System.out.println("Test PASSED: serialization completed successfully");
   85.79 +
   85.80 +        TestThread.handleExceptions();
   85.81 +    }
   85.82 +
   85.83 +    static final class TestBarrier extends CyclicBarrier
   85.84 +            implements Serializable {
   85.85 +        public TestBarrier(final int count) {
   85.86 +            super(count);
   85.87 +        }
   85.88 +
   85.89 +        private void writeObject(final ObjectOutputStream oos)
   85.90 +                throws IOException {
   85.91 +            oos.defaultWriteObject();
   85.92 +            // Wait until all test threads have started serializing data
   85.93 +            try {
   85.94 +                await();
   85.95 +            } catch (final Exception e) {
   85.96 +                throw new IOException("Test ERROR: Unexpected exception caught", e);
   85.97 +            }
   85.98 +        }
   85.99 +    }
  85.100 +
  85.101 +    static final class TestThread extends Thread {
  85.102 +        private static final List<Exception> exceptions = new ArrayList<>();
  85.103 +
  85.104 +        private final Vector vector;
  85.105 +        private final CyclicBarrier testEnd;
  85.106 +
  85.107 +        public TestThread(final Vector vector, final CyclicBarrier testEnd) {
  85.108 +            this.vector = vector;
  85.109 +            this.testEnd = testEnd;
  85.110 +            setDaemon(true);
  85.111 +        }
  85.112 +
  85.113 +        public void run() {
  85.114 +            try {
  85.115 +                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
  85.116 +                final ObjectOutputStream oos = new ObjectOutputStream(baos);
  85.117 +
  85.118 +                oos.writeObject(vector);
  85.119 +                oos.close();
  85.120 +            } catch (final IOException ioe) {
  85.121 +                addException(ioe);
  85.122 +            } finally {
  85.123 +                try {
  85.124 +                    testEnd.await();
  85.125 +                } catch (Exception e) {
  85.126 +                    addException(e);
  85.127 +                }
  85.128 +            }
  85.129 +        }
  85.130 +
  85.131 +        private static synchronized void addException(final Exception exception) {
  85.132 +            exceptions.add(exception);
  85.133 +        }
  85.134 +
  85.135 +        public static synchronized void handleExceptions() {
  85.136 +            if (false == exceptions.isEmpty()) {
  85.137 +                throw new RuntimeException(getErrorText(exceptions));
  85.138 +            }
  85.139 +        }
  85.140 +
  85.141 +        private static String getErrorText(final List<Exception> exceptions) {
  85.142 +            final StringWriter sw = new StringWriter();
  85.143 +            final PrintWriter pw = new PrintWriter(sw);
  85.144 +
  85.145 +            pw.println("Test ERROR: Unexpected exceptions thrown on test threads:");
  85.146 +            for (Exception exception : exceptions) {
  85.147 +                pw.print("\t");
  85.148 +                pw.println(exception);
  85.149 +                for (StackTraceElement element : exception.getStackTrace()) {
  85.150 +                    pw.print("\t\tat ");
  85.151 +                    pw.println(element);
  85.152 +                }
  85.153 +            }
  85.154 +
  85.155 +            pw.close();
  85.156 +            return sw.toString();
  85.157 +        }
  85.158 +    }
  85.159 +}
  85.160 +
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/test/java/util/Vector/SimpleSerialization.java	Tue Mar 01 14:04:59 2011 -0800
    86.3 @@ -0,0 +1,87 @@
    86.4 +/*
    86.5 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
    86.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    86.7 + *
    86.8 + * This code is free software; you can redistribute it and/or modify it
    86.9 + * under the terms of the GNU General Public License version 2 only, as
   86.10 + * published by the Free Software Foundation.
   86.11 + *
   86.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   86.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   86.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   86.15 + * version 2 for more details (a copy is included in the LICENSE file that
   86.16 + * accompanied this code).
   86.17 + *
   86.18 + * You should have received a copy of the GNU General Public License version
   86.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   86.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   86.21 + *
   86.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   86.23 + * or visit www.oracle.com if you need additional information or have any
   86.24 + * questions.
   86.25 + */
   86.26 +
   86.27 +/*
   86.28 + * Portions Copyright (c) 2010, 2011 IBM Corporation
   86.29 + */
   86.30 +
   86.31 +/*
   86.32 + * @test
   86.33 + * @bug 6934356
   86.34 + * @summary A serialized Vector can be successfully de-serialized.
   86.35 + * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
   86.36 + */
   86.37 +
   86.38 +import java.io.ByteArrayInputStream;
   86.39 +import java.io.ByteArrayOutputStream;
   86.40 +import java.io.IOException;
   86.41 +import java.io.ObjectInputStream;
   86.42 +import java.io.ObjectOutputStream;
   86.43 +import java.io.PrintWriter;
   86.44 +import java.io.StringWriter;
   86.45 +import java.util.Vector;
   86.46 +
   86.47 +public class SimpleSerialization {
   86.48 +    public static void main(final String[] args) throws Exception {
   86.49 +        final Vector<String> v1 = new Vector<>();
   86.50 +
   86.51 +        v1.add("entry1");
   86.52 +        v1.add("entry2");
   86.53 +
   86.54 +        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
   86.55 +        final ObjectOutputStream oos = new ObjectOutputStream(baos);
   86.56 +
   86.57 +        oos.writeObject(v1);
   86.58 +        oos.close();
   86.59 +
   86.60 +        final byte[] data = baos.toByteArray();
   86.61 +        final ByteArrayInputStream bais = new ByteArrayInputStream(data);
   86.62 +        final ObjectInputStream ois = new ObjectInputStream(bais);
   86.63 +
   86.64 +        final Object deserializedObject = ois.readObject();
   86.65 +        ois.close();
   86.66 +
   86.67 +        if (false == v1.equals(deserializedObject)) {
   86.68 +            throw new RuntimeException(getFailureText(v1, deserializedObject));
   86.69 +        }
   86.70 +    }
   86.71 +
   86.72 +    private static String getFailureText(final Object orig, final Object copy) {
   86.73 +        final StringWriter sw = new StringWriter();
   86.74 +        final PrintWriter pw = new PrintWriter(sw);
   86.75 +
   86.76 +        pw.println("Test FAILED: Deserialized object is not equal to the original object");
   86.77 +        pw.print("\tOriginal: ");
   86.78 +        printObject(pw, orig).println();
   86.79 +        pw.print("\tCopy:     ");
   86.80 +        printObject(pw, copy).println();
   86.81 +
   86.82 +        pw.close();
   86.83 +        return sw.toString();
   86.84 +    }
   86.85 +
   86.86 +    private static PrintWriter printObject(final PrintWriter pw, final Object o) {
   86.87 +        pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o));
   86.88 +        return pw;
   86.89 +    }
   86.90 +}
    87.1 --- a/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Fri Feb 25 12:48:18 2011 -0800
    87.2 +++ b/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Tue Mar 01 14:04:59 2011 -0800
    87.3 @@ -124,11 +124,11 @@
    87.4          oneRun(new ArrayBlockingQueue<Integer>(CAPACITY), pairs, iters);
    87.5          oneRun(new LinkedBlockingQueue<Integer>(CAPACITY), pairs, iters);
    87.6          oneRun(new LinkedBlockingDeque<Integer>(CAPACITY), pairs, iters);
    87.7 -        oneRun(new LinkedTransferQueue<Integer>(), pairs, iters);
    87.8          oneRun(new SynchronousQueue<Integer>(), pairs, iters / 8);
    87.9  
   87.10 -        /* PriorityBlockingQueue is unbounded
   87.11 +        /* unbounded queue implementations are prone to OOME
   87.12          oneRun(new PriorityBlockingQueue<Integer>(iters / 2 * pairs), pairs, iters / 4);
   87.13 +        oneRun(new LinkedTransferQueue<Integer>(), pairs, iters);
   87.14          */
   87.15      }
   87.16  
    88.1 --- a/test/javax/print/attribute/ServiceDialogTest.java	Fri Feb 25 12:48:18 2011 -0800
    88.2 +++ b/test/javax/print/attribute/ServiceDialogTest.java	Tue Mar 01 14:04:59 2011 -0800
    88.3 @@ -71,7 +71,7 @@
    88.4                          if (factories.length > 0) {
    88.5                                  services[0] = factories[0].getPrintService(fos);
    88.6                          } else {
    88.7 -                                throw new RuntimeException("No StreamPrintService available which would support "+flavor");
    88.8 +                                throw new RuntimeException("No StreamPrintService available which would support "+flavor);
    88.9                          }
   88.10  
   88.11                          services[2] = new TestPrintService("Test Printer");
    89.1 --- a/test/javax/swing/JComponent/6989617/bug6989617.java	Fri Feb 25 12:48:18 2011 -0800
    89.2 +++ b/test/javax/swing/JComponent/6989617/bug6989617.java	Tue Mar 01 14:04:59 2011 -0800
    89.3 @@ -1,5 +1,5 @@
    89.4  /*
    89.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    89.6 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    89.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.8   *
    89.9   * This code is free software; you can redistribute it and/or modify it
   89.10 @@ -28,76 +28,107 @@
   89.11     @run main bug6989617
   89.12  */
   89.13  
   89.14 +import sun.awt.SunToolkit;
   89.15 +
   89.16  import javax.swing.*;
   89.17  import java.awt.*;
   89.18  
   89.19  public class bug6989617 {
   89.20 +    private static MyPanel panel;
   89.21 +    private static JButton button;
   89.22  
   89.23 -    private boolean isPaintingOrigin;
   89.24 -    private boolean innerPanelRepainted, outerPanelRepainted;
   89.25 +    public static void main(String... args) throws Exception {
   89.26 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
   89.27 +        SwingUtilities.invokeAndWait(new Runnable() {
   89.28 +            public void run() {
   89.29 +                JFrame frame = new JFrame();
   89.30 +                frame. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   89.31 +                panel = new MyPanel();
   89.32  
   89.33 -    public bug6989617() {
   89.34 +                button = new JButton("Hello");
   89.35 +                panel.add(button);
   89.36 +                frame.add(panel);
   89.37  
   89.38 -        final JButton button = new JButton("button");
   89.39 +                frame.setSize(200, 300);
   89.40 +                frame.setVisible(true);
   89.41 +            }
   89.42 +        });
   89.43 +        // Testing the panel as a painting origin,
   89.44 +        // the panel.paintImmediately() must be triggered
   89.45 +        // when button.repaint() is called
   89.46 +        toolkit.realSync();
   89.47 +        SwingUtilities.invokeAndWait(new Runnable() {
   89.48 +            public void run() {
   89.49 +                if (panel.getPaintRectangle() != null) {
   89.50 +                    throw new RuntimeException("paint rectangle is not null");
   89.51 +                }
   89.52 +                button.repaint();
   89.53 +            }
   89.54 +        });
   89.55 +        toolkit.realSync();
   89.56 +        SwingUtilities.invokeAndWait(new Runnable() {
   89.57 +            public void run() {
   89.58 +                Rectangle pr = panel.getPaintRectangle();
   89.59 +                if (!pr.getSize().equals(button.getSize())) {
   89.60 +                    throw new RuntimeException("wrong size of the dirty area");
   89.61 +                }
   89.62 +                if (!pr.getLocation().equals(button.getLocation())) {
   89.63 +                    throw new RuntimeException("wrong location of the dirty area");
   89.64 +                }
   89.65 +            }
   89.66 +        });
   89.67 +        // Testing the panel as NOT a painting origin
   89.68 +        // the panel.paintImmediately() must NOT be triggered
   89.69 +        // when button.repaint() is called
   89.70 +        toolkit.realSync();
   89.71 +        SwingUtilities.invokeAndWait(new Runnable() {
   89.72 +            public void run() {
   89.73 +                panel.resetPaintRectangle();
   89.74 +                panel.setPaintingOrigin(false);
   89.75 +                if (panel.getPaintRectangle() != null) {
   89.76 +                    throw new RuntimeException("paint rectangle is not null");
   89.77 +                }
   89.78 +                button.repaint();
   89.79 +            }
   89.80 +        });
   89.81 +        toolkit.realSync();
   89.82 +        SwingUtilities.invokeAndWait(new Runnable() {
   89.83 +            public void run() {
   89.84 +                if(panel.getPaintRectangle() != null) {
   89.85 +                    throw new RuntimeException("paint rectangle is not null");
   89.86 +                }
   89.87 +                System.out.println("Test passed...");
   89.88 +            }
   89.89 +        });
   89.90 +    }
   89.91  
   89.92 -        JPanel innerPanel = new JPanel() {
   89.93 -            protected boolean isPaintingOrigin() {
   89.94 -                return isPaintingOrigin;
   89.95 -            }
   89.96 +    static class MyPanel extends JPanel {
   89.97 +        private boolean isPaintingOrigin = true;
   89.98 +        private Rectangle paintRectangle;
   89.99  
  89.100 -            public void repaint(long tm, int x, int y, int width, int height) {
  89.101 -                if (button.getParent() != null) {
  89.102 -                    innerPanelRepainted = true;
  89.103 -                    if (!button.getSize().equals(new Dimension(width, height))) {
  89.104 -                        throw new RuntimeException("Wrong size of the dirty area");
  89.105 -                    }
  89.106 -                    if (!button.getLocation().equals(new Point(x, y))) {
  89.107 -                        throw new RuntimeException("Wrong location of the dirty area");
  89.108 -                    }
  89.109 -                }
  89.110 -                super.repaint(tm, x, y, width, height);
  89.111 -            }
  89.112 -        };
  89.113 +        {
  89.114 +            setLayout(new GridBagLayout());
  89.115 +        }
  89.116  
  89.117 -        JPanel outerPanel = new JPanel() {
  89.118 -            protected boolean isPaintingOrigin() {
  89.119 -                return isPaintingOrigin;
  89.120 -            }
  89.121 +        public boolean isPaintingOrigin() {
  89.122 +            return isPaintingOrigin;
  89.123 +        }
  89.124  
  89.125 -            public void repaint(long tm, int x, int y, int width, int height) {
  89.126 -                if (button.getParent() != null) {
  89.127 -                    outerPanelRepainted = true;
  89.128 -                    if (!button.getSize().equals(new Dimension(width, height))) {
  89.129 -                        throw new RuntimeException("Wrong size of the dirty area");
  89.130 -                    }
  89.131 -                }
  89.132 -                super.repaint(tm, x, y, width, height);
  89.133 -            }
  89.134 -        };
  89.135 +        public void setPaintingOrigin(boolean paintingOrigin) {
  89.136 +            isPaintingOrigin = paintingOrigin;
  89.137 +        }
  89.138  
  89.139 +        public void paintImmediately(int x, int y, int w, int h) {
  89.140 +            super.paintImmediately(x, y, w, h);
  89.141 +            paintRectangle = new Rectangle(x, y, w, h);
  89.142 +        }
  89.143  
  89.144 -        outerPanel.add(innerPanel);
  89.145 -        innerPanel.add(button);
  89.146 +        public Rectangle getPaintRectangle() {
  89.147 +            return paintRectangle == null? null: new Rectangle(paintRectangle);
  89.148 +        }
  89.149  
  89.150 -        outerPanel.setSize(100, 100);
  89.151 -        innerPanel.setBounds(10, 10, 50, 50);
  89.152 -        button.setBounds(10, 10, 20, 20);
  89.153 -
  89.154 -        if (innerPanelRepainted || outerPanelRepainted) {
  89.155 -            throw new RuntimeException("Repainted flag is unexpectedly on");
  89.156 -        }
  89.157 -        button.repaint();
  89.158 -        if (innerPanelRepainted || outerPanelRepainted) {
  89.159 -            throw new RuntimeException("Repainted flag is unexpectedly on");
  89.160 -        }
  89.161 -        isPaintingOrigin = true;
  89.162 -        button.repaint();
  89.163 -        if (!innerPanelRepainted || !outerPanelRepainted) {
  89.164 -            throw new RuntimeException("Repainted flag is unexpectedly off");
  89.165 +        public void resetPaintRectangle() {
  89.166 +            this.paintRectangle = null;
  89.167          }
  89.168      }
  89.169 -
  89.170 -    public static void main(String... args) throws Exception {
  89.171 -        new bug6989617();
  89.172 -    }
  89.173  }
    90.1 --- a/test/javax/swing/JFileChooser/6798062/bug6798062.html	Fri Feb 25 12:48:18 2011 -0800
    90.2 +++ b/test/javax/swing/JFileChooser/6798062/bug6798062.html	Tue Mar 01 14:04:59 2011 -0800
    90.3 @@ -1,6 +1,8 @@
    90.4  <html>
    90.5  <body>
    90.6  <applet  code="bug6798062.class" width=400 height=300></applet>
    90.7 +The test is suitable only for Windows
    90.8 +
    90.9  1. Create a link
   90.10  2. Copy path to the link into TextField
   90.11  3. Run the Windows Task Manager. Select the Processes tab and find the java process
    91.1 --- a/test/javax/swing/JFileChooser/6798062/bug6798062.java	Fri Feb 25 12:48:18 2011 -0800
    91.2 +++ b/test/javax/swing/JFileChooser/6798062/bug6798062.java	Tue Mar 01 14:04:59 2011 -0800
    91.3 @@ -28,6 +28,7 @@
    91.4     @run applet/manual=done bug6798062.html
    91.5  */
    91.6  
    91.7 +import sun.awt.OSInfo;
    91.8  import sun.awt.shell.ShellFolder;
    91.9  
   91.10  import javax.swing.*;
   91.11 @@ -68,13 +69,23 @@
   91.12          add(initialize());
   91.13      }
   91.14  
   91.15 -    private JPanel initialize() {
   91.16 -        File file = new File("c:/");
   91.17 +    private JComponent initialize() {
   91.18 +        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
   91.19 +            return new JLabel("The test is suitable only for Windows");
   91.20 +        }
   91.21 +
   91.22 +        String tempDir = System.getProperty("java.io.tmpdir");
   91.23 +
   91.24 +        if (tempDir.length() == 0) { // 'java.io.tmpdir' isn't guaranteed to be defined
   91.25 +            tempDir = System.getProperty("user.home");
   91.26 +        }
   91.27 +
   91.28 +        System.out.println("Temp directory: " + tempDir);
   91.29  
   91.30          try {
   91.31 -            folder = ShellFolder.getShellFolder(file);
   91.32 +            folder = ShellFolder.getShellFolder(new File(tempDir));
   91.33          } catch (FileNotFoundException e) {
   91.34 -            fail("Directory " + file.getPath() + " not found");
   91.35 +            fail("Directory " + tempDir + " not found");
   91.36          }
   91.37  
   91.38          slider.setMajorTickSpacing(10);
    92.1 --- a/test/javax/swing/JScrollBar/6542335/bug6542335.java	Fri Feb 25 12:48:18 2011 -0800
    92.2 +++ b/test/javax/swing/JScrollBar/6542335/bug6542335.java	Tue Mar 01 14:04:59 2011 -0800
    92.3 @@ -69,8 +69,6 @@
    92.4  
    92.5                  frame.setSize(200, 100);
    92.6                  frame.setVisible(true);
    92.7 -
    92.8 -                thumbBounds[0] = new Rectangle(ui.getThumbBounds());
    92.9              }
   92.10          });
   92.11  
   92.12 @@ -78,6 +76,8 @@
   92.13  
   92.14          SwingUtilities.invokeAndWait(new Runnable() {
   92.15              public void run() {
   92.16 +                thumbBounds[0] = new Rectangle(ui.getThumbBounds());
   92.17 +
   92.18                  Point l = sb.getLocationOnScreen();
   92.19  
   92.20                  robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight() / 2);
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/test/javax/swing/LookAndFeel/6474153/bug6474153.java	Tue Mar 01 14:04:59 2011 -0800
    93.3 @@ -0,0 +1,53 @@
    93.4 +/*
    93.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    93.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    93.7 + *
    93.8 + * This code is free software; you can redistribute it and/or modify it
    93.9 + * under the terms of the GNU General Public License version 2 only, as
   93.10 + * published by the Free Software Foundation.
   93.11 + *
   93.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   93.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   93.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   93.15 + * version 2 for more details (a copy is included in the LICENSE file that
   93.16 + * accompanied this code).
   93.17 + *
   93.18 + * You should have received a copy of the GNU General Public License version
   93.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   93.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   93.21 + *
   93.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   93.23 + * or visit www.oracle.com if you need additional information or have any
   93.24 + * questions.
   93.25 + */
   93.26 +
   93.27 +/* @test
   93.28 + * @bug 6474153
   93.29 + * @summary LookAndFeel.makeKeyBindings(...) doesn't ignore last element in keyBindingList with odd size
   93.30 + * @author Alexander Potochkin
   93.31 + */
   93.32 +
   93.33 +import javax.swing.KeyStroke;
   93.34 +import javax.swing.LookAndFeel;
   93.35 +import javax.swing.text.DefaultEditorKit;
   93.36 +import javax.swing.text.JTextComponent;
   93.37 +
   93.38 +public class bug6474153 {
   93.39 +
   93.40 +    public static void main(String... args) throws Exception {
   93.41 +        checkArray(LookAndFeel.makeKeyBindings(new Object[] {"UP", DefaultEditorKit.upAction} ));
   93.42 +        checkArray(LookAndFeel.makeKeyBindings(new Object[] {"UP", DefaultEditorKit.upAction, "PAGE_UP"} ));
   93.43 +    }
   93.44 +
   93.45 +    private static void checkArray(JTextComponent.KeyBinding[] keyActionArray) {
   93.46 +        if (keyActionArray.length != 1) {
   93.47 +            throw new RuntimeException("Wrong array lenght!");
   93.48 +        }
   93.49 +        if (!DefaultEditorKit.upAction.equals(keyActionArray[0].actionName)) {
   93.50 +            throw new RuntimeException("Wrong action name!");
   93.51 +        }
   93.52 +        if (!KeyStroke.getKeyStroke("UP").equals(keyActionArray[0].key)) {
   93.53 +            throw new RuntimeException("Wrong keystroke!");
   93.54 +        }
   93.55 +    }
   93.56 +}
    94.1 --- a/test/sun/java2d/pipe/RegionOps.java	Fri Feb 25 12:48:18 2011 -0800
    94.2 +++ b/test/sun/java2d/pipe/RegionOps.java	Tue Mar 01 14:04:59 2011 -0800
    94.3 @@ -1,3 +1,26 @@
    94.4 +/*
    94.5 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    94.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    94.7 + *
    94.8 + * This code is free software; you can redistribute it and/or modify it
    94.9 + * under the terms of the GNU General Public License version 2 only, as
   94.10 + * published by the Free Software Foundation.
   94.11 + *
   94.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   94.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   94.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   94.15 + * version 2 for more details (a copy is included in the LICENSE file that
   94.16 + * accompanied this code).
   94.17 + *
   94.18 + * You should have received a copy of the GNU General Public License version
   94.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   94.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   94.21 + *
   94.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   94.23 + * or visit www.oracle.com if you need additional information or have any
   94.24 + * questions.
   94.25 + */
   94.26 +
   94.27  /*
   94.28   * @test %W% %E%
   94.29   * @bug 6504874
    95.1 --- a/test/sun/security/krb5/auto/BadKdc1.java	Fri Feb 25 12:48:18 2011 -0800
    95.2 +++ b/test/sun/security/krb5/auto/BadKdc1.java	Tue Mar 01 14:04:59 2011 -0800
    95.3 @@ -1,5 +1,5 @@
    95.4  /*
    95.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    95.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    95.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    95.8   *
    95.9   * This code is free software; you can redistribute it and/or modify it
   95.10 @@ -24,7 +24,7 @@
   95.11  /*
   95.12   * @test
   95.13   * @bug 6843127
   95.14 - * @run main/timeout=300 BadKdc1
   95.15 + * @run main/othervm/timeout=300 BadKdc1
   95.16   * @summary krb5 should not try to access unavailable kdc too often
   95.17   */
   95.18  
    96.1 --- a/test/sun/security/krb5/auto/BadKdc2.java	Fri Feb 25 12:48:18 2011 -0800
    96.2 +++ b/test/sun/security/krb5/auto/BadKdc2.java	Tue Mar 01 14:04:59 2011 -0800
    96.3 @@ -1,5 +1,5 @@
    96.4  /*
    96.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    96.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    96.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    96.8   *
    96.9   * This code is free software; you can redistribute it and/or modify it
   96.10 @@ -24,7 +24,7 @@
   96.11  /*
   96.12   * @test
   96.13   * @bug 6843127
   96.14 - * @run main/timeout=300 BadKdc2
   96.15 + * @run main/othervm/timeout=300 BadKdc2
   96.16   * @summary krb5 should not try to access unavailable kdc too often
   96.17   */
   96.18  
    97.1 --- a/test/sun/security/krb5/auto/BadKdc3.java	Fri Feb 25 12:48:18 2011 -0800
    97.2 +++ b/test/sun/security/krb5/auto/BadKdc3.java	Tue Mar 01 14:04:59 2011 -0800
    97.3 @@ -1,5 +1,5 @@
    97.4  /*
    97.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    97.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    97.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.8   *
    97.9   * This code is free software; you can redistribute it and/or modify it
   97.10 @@ -24,7 +24,7 @@
   97.11  /*
   97.12   * @test
   97.13   * @bug 6843127
   97.14 - * @run main/timeout=300 BadKdc3
   97.15 + * @run main/othervm/timeout=300 BadKdc3
   97.16   * @summary krb5 should not try to access unavailable kdc too often
   97.17   */
   97.18  
    98.1 --- a/test/sun/security/krb5/auto/BadKdc4.java	Fri Feb 25 12:48:18 2011 -0800
    98.2 +++ b/test/sun/security/krb5/auto/BadKdc4.java	Tue Mar 01 14:04:59 2011 -0800
    98.3 @@ -1,5 +1,5 @@
    98.4  /*
    98.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    98.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    98.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    98.8   *
    98.9   * This code is free software; you can redistribute it and/or modify it
   98.10 @@ -24,7 +24,7 @@
   98.11  /*
   98.12   * @test
   98.13   * @bug 6843127
   98.14 - * @run main/timeout=300 BadKdc4
   98.15 + * @run main/othervm/timeout=300 BadKdc4
   98.16   * @summary krb5 should not try to access unavailable kdc too often
   98.17   */
   98.18  
    99.1 --- a/test/sun/security/krb5/auto/CleanState.java	Fri Feb 25 12:48:18 2011 -0800
    99.2 +++ b/test/sun/security/krb5/auto/CleanState.java	Tue Mar 01 14:04:59 2011 -0800
    99.3 @@ -1,5 +1,5 @@
    99.4  /*
    99.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    99.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    99.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    99.8   *
    99.9   * This code is free software; you can redistribute it and/or modify it
   99.10 @@ -24,6 +24,7 @@
   99.11  /*
   99.12   * @test
   99.13   * @bug 6716534
   99.14 + * @run main/othervm CleanState
   99.15   * @summary Krb5LoginModule has not cleaned temp info between authentication attempts
   99.16   */
   99.17  import com.sun.security.auth.module.Krb5LoginModule;
   100.1 --- a/test/sun/security/krb5/auto/CrossRealm.java	Fri Feb 25 12:48:18 2011 -0800
   100.2 +++ b/test/sun/security/krb5/auto/CrossRealm.java	Tue Mar 01 14:04:59 2011 -0800
   100.3 @@ -1,5 +1,5 @@
   100.4  /*
   100.5 - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
   100.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
   100.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   100.8   *
   100.9   * This code is free software; you can redistribute it and/or modify it
  100.10 @@ -24,6 +24,7 @@
  100.11  /*
  100.12   * @test
  100.13   * @bug 6706974
  100.14 + * @run main/othervm CrossRealm
  100.15   * @summary Add krb5 test infrastructure
  100.16   */
  100.17  import java.io.File;
   101.1 --- a/test/sun/security/krb5/auto/HttpNegotiateServer.java	Fri Feb 25 12:48:18 2011 -0800
   101.2 +++ b/test/sun/security/krb5/auto/HttpNegotiateServer.java	Tue Mar 01 14:04:59 2011 -0800
   101.3 @@ -1,5 +1,5 @@
   101.4  /*
   101.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
   101.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   101.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   101.8   *
   101.9   * This code is free software; you can redistribute it and/or modify it
  101.10 @@ -24,6 +24,7 @@
  101.11  /*
  101.12   * @test
  101.13   * @bug 6578647 6829283
  101.14 + * @run main/othervm HttpNegotiateServer
  101.15   * @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
  101.16   * @summary HTTP/Negotiate: Authenticator triggered again when user cancels the first one
  101.17   */
   102.1 --- a/test/sun/security/krb5/auto/IgnoreChannelBinding.java	Fri Feb 25 12:48:18 2011 -0800
   102.2 +++ b/test/sun/security/krb5/auto/IgnoreChannelBinding.java	Tue Mar 01 14:04:59 2011 -0800
   102.3 @@ -1,5 +1,5 @@
   102.4  /*
   102.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   102.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   102.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   102.8   *
   102.9   * This code is free software; you can redistribute it and/or modify it
  102.10 @@ -24,6 +24,7 @@
  102.11  /*
  102.12   * @test
  102.13   * @bug 6851973
  102.14 + * @run main/othervm IgnoreChannelBinding
  102.15   * @summary ignore incoming channel binding if acceptor does not set one
  102.16   */
  102.17  
   103.1 --- a/test/sun/security/krb5/auto/KerberosHashEqualsTest.java	Fri Feb 25 12:48:18 2011 -0800
   103.2 +++ b/test/sun/security/krb5/auto/KerberosHashEqualsTest.java	Tue Mar 01 14:04:59 2011 -0800
   103.3 @@ -1,5 +1,5 @@
   103.4  /*
   103.5 - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
   103.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   103.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   103.8   *
   103.9   * This code is free software; you can redistribute it and/or modify it
  103.10 @@ -24,6 +24,7 @@
  103.11  /*
  103.12   * @test
  103.13   * @bug 4641821
  103.14 + * @run main/othervm KerberosHashEqualsTest
  103.15   * @summary hashCode() and equals() for KerberosKey and KerberosTicket
  103.16   */
  103.17  
   104.1 --- a/test/sun/security/krb5/auto/LifeTimeInSeconds.java	Fri Feb 25 12:48:18 2011 -0800
   104.2 +++ b/test/sun/security/krb5/auto/LifeTimeInSeconds.java	Tue Mar 01 14:04:59 2011 -0800
   104.3 @@ -1,5 +1,5 @@
   104.4  /*
   104.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   104.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   104.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   104.8   *
   104.9   * This code is free software; you can redistribute it and/or modify it
  104.10 @@ -24,6 +24,7 @@
  104.11  /*
  104.12   * @test
  104.13   * @bug 6857802
  104.14 + * @run main/othervm LifeTimeInSeconds
  104.15   * @summary GSS getRemainingInitLifetime method returns milliseconds not seconds
  104.16   */
  104.17  import org.ietf.jgss.GSSCredential;
   105.1 --- a/test/sun/security/krb5/auto/LoginModuleOptions.java	Fri Feb 25 12:48:18 2011 -0800
   105.2 +++ b/test/sun/security/krb5/auto/LoginModuleOptions.java	Tue Mar 01 14:04:59 2011 -0800
   105.3 @@ -1,5 +1,5 @@
   105.4  /*
   105.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
   105.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
   105.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   105.8   *
   105.9   * This code is free software; you can redistribute it and/or modify it
  105.10 @@ -24,6 +24,7 @@
  105.11  /*
  105.12   * @test
  105.13   * @bug 6765491
  105.14 + * @run main/othervm LoginModuleOptions
  105.15   * @summary Krb5LoginModule a little too restrictive, and the doc is not clear.
  105.16   */
  105.17  import com.sun.security.auth.module.Krb5LoginModule;
   106.1 --- a/test/sun/security/krb5/auto/MaxRetries.java	Fri Feb 25 12:48:18 2011 -0800
   106.2 +++ b/test/sun/security/krb5/auto/MaxRetries.java	Tue Mar 01 14:04:59 2011 -0800
   106.3 @@ -1,5 +1,5 @@
   106.4  /*
   106.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   106.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   106.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   106.8   *
   106.9   * This code is free software; you can redistribute it and/or modify it
  106.10 @@ -24,7 +24,7 @@
  106.11  /*
  106.12   * @test
  106.13   * @bug 6844193
  106.14 - * @run main/timeout=300 MaxRetries
  106.15 + * @run main/othervm/timeout=300 MaxRetries
  106.16   * @summary support max_retries in krb5.conf
  106.17   */
  106.18  
   107.1 --- a/test/sun/security/krb5/auto/MoreKvno.java	Fri Feb 25 12:48:18 2011 -0800
   107.2 +++ b/test/sun/security/krb5/auto/MoreKvno.java	Tue Mar 01 14:04:59 2011 -0800
   107.3 @@ -1,5 +1,5 @@
   107.4  /*
   107.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
   107.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   107.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   107.8   *
   107.9   * This code is free software; you can redistribute it and/or modify it
  107.10 @@ -25,6 +25,7 @@
  107.11   * @test
  107.12   * @bug 6893158
  107.13   * @bug 6907425
  107.14 + * @run main/othervm MoreKvno
  107.15   * @summary AP_REQ check should use key version number
  107.16   */
  107.17  
   108.1 --- a/test/sun/security/krb5/auto/NewSalt.java	Fri Feb 25 12:48:18 2011 -0800
   108.2 +++ b/test/sun/security/krb5/auto/NewSalt.java	Tue Mar 01 14:04:59 2011 -0800
   108.3 @@ -1,5 +1,5 @@
   108.4  /*
   108.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   108.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   108.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   108.8   *
   108.9   * This code is free software; you can redistribute it and/or modify it
  108.10 @@ -25,7 +25,7 @@
  108.11   * @test
  108.12   * @bug 6960894
  108.13   * @summary Better AS-REQ creation and processing
  108.14 - * @run main NewSalt
  108.15 + * @run main/othervm NewSalt
  108.16   * @run main/othervm -Dnopreauth NewSalt
  108.17   * @run main/othervm -Donlyonepreauth NewSalt
  108.18   */
   109.1 --- a/test/sun/security/krb5/auto/NonMutualSpnego.java	Fri Feb 25 12:48:18 2011 -0800
   109.2 +++ b/test/sun/security/krb5/auto/NonMutualSpnego.java	Tue Mar 01 14:04:59 2011 -0800
   109.3 @@ -1,5 +1,5 @@
   109.4  /*
   109.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
   109.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
   109.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   109.8   *
   109.9   * This code is free software; you can redistribute it and/or modify it
  109.10 @@ -24,6 +24,7 @@
  109.11  /*
  109.12   * @test
  109.13   * @bug 6733095
  109.14 + * @run main/othervm NonMutualSpnego
  109.15   * @summary Failure when SPNEGO request non-Mutual
  109.16   */
  109.17  
   110.1 --- a/test/sun/security/krb5/auto/SSL.java	Fri Feb 25 12:48:18 2011 -0800
   110.2 +++ b/test/sun/security/krb5/auto/SSL.java	Tue Mar 01 14:04:59 2011 -0800
   110.3 @@ -1,5 +1,5 @@
   110.4  /*
   110.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
   110.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   110.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   110.8   *
   110.9   * This code is free software; you can redistribute it and/or modify it
  110.10 @@ -25,16 +25,16 @@
  110.11   * @test
  110.12   * @bug 6894643 6913636
  110.13   * @summary Test JSSE Kerberos ciphersuite
  110.14 - * @run main SSL TLS_KRB5_WITH_RC4_128_SHA
  110.15 - * @run main SSL TLS_KRB5_WITH_RC4_128_MD5
  110.16 - * @run main SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA
  110.17 - * @run main SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5
  110.18 - * @run main SSL TLS_KRB5_WITH_DES_CBC_SHA
  110.19 - * @run main SSL TLS_KRB5_WITH_DES_CBC_MD5
  110.20 - * @run main SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA
  110.21 - * @run main SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5
  110.22 - * @run main SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA
  110.23 - * @run main SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5
  110.24 + * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA
  110.25 + * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_MD5
  110.26 + * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA
  110.27 + * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5
  110.28 + * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_SHA
  110.29 + * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_MD5
  110.30 + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA
  110.31 + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5
  110.32 + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA
  110.33 + * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5
  110.34   */
  110.35  import java.io.*;
  110.36  import java.net.InetAddress;
   111.1 --- a/test/sun/security/krb5/auto/SpnegoReqFlags.java	Fri Feb 25 12:48:18 2011 -0800
   111.2 +++ b/test/sun/security/krb5/auto/SpnegoReqFlags.java	Tue Mar 01 14:04:59 2011 -0800
   111.3 @@ -1,5 +1,5 @@
   111.4  /*
   111.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   111.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   111.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   111.8   *
   111.9   * This code is free software; you can redistribute it and/or modify it
  111.10 @@ -24,6 +24,7 @@
  111.11  /*
  111.12   * @test
  111.13   * @bug 6815182
  111.14 + * @run main/othervm SpnegoReqFlags
  111.15   * @summary GSSAPI/SPNEGO does not work with server using MIT Kerberos library
  111.16   */
  111.17  
   112.1 --- a/test/sun/security/krb5/auto/Test5653.java	Fri Feb 25 12:48:18 2011 -0800
   112.2 +++ b/test/sun/security/krb5/auto/Test5653.java	Tue Mar 01 14:04:59 2011 -0800
   112.3 @@ -1,5 +1,5 @@
   112.4  /*
   112.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   112.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   112.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   112.8   *
   112.9   * This code is free software; you can redistribute it and/or modify it
  112.10 @@ -24,6 +24,7 @@
  112.11  /*
  112.12   * @test
  112.13   * @bug 6895424
  112.14 + * @run main/othervm Test5653
  112.15   * @summary RFC 5653
  112.16   */
  112.17