# HG changeset patch # User andrew # Date 1269896407 -3600 # Node ID 2b66e5f1a1de8cf20bf03613daab938621005b17 # Parent 871b70407a139c6bd42c200762ee1d302b31168f Add last two batches of security patches. diff -r 871b70407a13 -r 2b66e5f1a1de Makefile.am --- a/Makefile.am Wed May 28 11:07:23 2008 -0400 +++ b/Makefile.am Mon Mar 29 22:00:07 2010 +0100 @@ -315,6 +315,49 @@ patches/icedtea-hat-spl-gpl.patch \ patches/icedtea-sparc.patch \ patches/icedtea-override-redirect-metacity.patch \ + patches/icedtea-4486841.patch \ + patches/icedtea-6484091.patch \ + patches/icedtea-6497740.patch \ + patches/icedtea-6536193.patch \ + patches/icedtea-6588160.patch \ + patches/icedtea-6592792.patch \ + patches/icedtea-6610888.patch \ + patches/icedtea-6610896.patch \ + patches/icedtea-6630639.patch \ + patches/icedtea-6632886.patch \ + patches/icedtea-6636360.patch \ + patches/icedtea-6652463.patch \ + patches/icedtea-6656633.patch \ + patches/icedtea-6658158.patch \ + patches/icedtea-6691246.patch \ + patches/icedtea-6717680.patch \ + patches/icedtea-6721651.patch \ + patches/icedtea-6721753.patch \ + patches/icedtea-6726779.patch \ + patches/icedtea-6733959.patch \ + patches/icedtea-6734167.patch \ + patches/icedtea-6737315.patch \ + patches/icedtea-6755943.patch \ + patches/icedtea-6766136.patch \ + patches/icedtea-6792554.patch \ + patches/icedtea-6804996.patch \ + patches/icedtea-6804997.patch \ + patches/icedtea-6804998.patch \ + patches/icedtea-6824265.patch \ + patches/icedtea-6632445.patch \ + patches/icedtea-6636650.patch \ + patches/icedtea-6657026.patch \ + patches/icedtea-6657138.patch \ + patches/icedtea-6822057.patch \ + patches/icedtea-6631533.patch \ + patches/icedtea-6861062.patch \ + patches/icedtea-6862968.patch \ + patches/icedtea-6863503.patch \ + patches/icedtea-6864911.patch \ + patches/icedtea-6872357.patch \ + patches/icedtea-6872358.patch \ + patches/icedtea-6664512.patch \ + patches/icedtea-6874643.patch \ $(GCC_PATCH) \ $(DISTRIBUTION_PATCHES) @@ -342,7 +385,7 @@ do \ if test x$${all_patches_ok} == "xyes" \ && echo Checking $$p \ - && $(PATCH) -l -p0 --dry-run -s -t -f -F 0 < $$p ; \ + && $(PATCH) -l -p0 --dry-run -s -t -f < $$p ; \ then \ echo Applying $$p ; \ $(PATCH) -l -p0 < $$p ; \ diff -r 871b70407a13 -r 2b66e5f1a1de Makefile.in --- a/Makefile.in Wed May 28 11:07:23 2008 -0400 +++ b/Makefile.in Mon Mar 29 22:00:07 2010 +0100 @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,8 +16,9 @@ @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -70,15 +72,16 @@ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = javac javap platform_zero jvm.cfg ergo.c +CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print @@ -247,6 +250,7 @@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ OPENJDK_DATE = 11_apr_2008 @@ -417,7 +421,29 @@ patches/icedtea-fonts.patch patches/icedtea-gervill.patch \ patches/icedtea-directaudio-close-trick.patch \ patches/icedtea-hat-spl-gpl.patch patches/icedtea-sparc.patch \ - patches/icedtea-override-redirect-metacity.patch $(GCC_PATCH) \ + patches/icedtea-override-redirect-metacity.patch \ + patches/icedtea-4486841.patch patches/icedtea-6484091.patch \ + patches/icedtea-6497740.patch patches/icedtea-6536193.patch \ + patches/icedtea-6588160.patch patches/icedtea-6592792.patch \ + patches/icedtea-6610888.patch patches/icedtea-6610896.patch \ + patches/icedtea-6630639.patch patches/icedtea-6632886.patch \ + patches/icedtea-6636360.patch patches/icedtea-6652463.patch \ + patches/icedtea-6656633.patch patches/icedtea-6658158.patch \ + patches/icedtea-6691246.patch patches/icedtea-6717680.patch \ + patches/icedtea-6721651.patch patches/icedtea-6721753.patch \ + patches/icedtea-6726779.patch patches/icedtea-6733959.patch \ + patches/icedtea-6734167.patch patches/icedtea-6737315.patch \ + patches/icedtea-6755943.patch patches/icedtea-6766136.patch \ + patches/icedtea-6792554.patch patches/icedtea-6804996.patch \ + patches/icedtea-6804997.patch patches/icedtea-6804998.patch \ + patches/icedtea-6824265.patch patches/icedtea-6632445.patch \ + patches/icedtea-6636650.patch patches/icedtea-6657026.patch \ + patches/icedtea-6657138.patch patches/icedtea-6822057.patch \ + patches/icedtea-6631533.patch patches/icedtea-6861062.patch \ + patches/icedtea-6862968.patch patches/icedtea-6863503.patch \ + patches/icedtea-6864911.patch patches/icedtea-6872357.patch \ + patches/icedtea-6872358.patch patches/icedtea-6664512.patch \ + patches/icedtea-6874643.patch $(GCC_PATCH) \ $(DISTRIBUTION_PATCHES) $(am__append_7) # Patch OpenJDK for plug replacements and ecj. @@ -478,15 +504,15 @@ @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -502,9 +528,10 @@ $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) + $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): javac: $(top_builddir)/config.status $(srcdir)/javac.in cd $(top_builddir) && $(SHELL) ./config.status $@ javap: $(top_builddir)/config.status $(srcdir)/javap.in @@ -524,7 +551,7 @@ distdir: $(DISTFILES) $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) + test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -540,21 +567,26 @@ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) + || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) @@ -567,6 +599,10 @@ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -595,6 +631,8 @@ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -606,9 +644,11 @@ mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ @@ -630,13 +670,15 @@ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @cd $(distuninstallcheck_dir) \ + @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ @@ -677,6 +719,7 @@ distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -694,6 +737,8 @@ html: html-am +html-am: + info: info-am info-am: @@ -702,18 +747,28 @@ install-dvi: install-dvi-am +install-dvi-am: + install-exec-am: install-html: install-html-am +install-html-am: + install-info: install-info-am +install-info-am: + install-man: install-pdf: install-pdf-am +install-pdf-am: + install-ps: install-ps-am +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -736,20 +791,21 @@ uninstall-am: -.MAKE: install-am install-strip +.MAKE: check-am install-am install-strip .PHONY: all all-am all-local am--refresh check check-am check-local \ clean clean-generic dist dist-all dist-bzip2 dist-gzip \ - dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-local distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ + distclean distclean-generic distclean-local distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am # Top-Level Targets @@ -848,7 +904,7 @@ do \ if test x$${all_patches_ok} == "xyes" \ && echo Checking $$p \ - && $(PATCH) -l -p0 --dry-run -s -t -f -F 0 < $$p ; \ + && $(PATCH) -l -p0 --dry-run -s -t -f < $$p ; \ then \ echo Applying $$p ; \ $(PATCH) -l -p0 < $$p ; \ @@ -1460,6 +1516,7 @@ clean: distclean-local jtreg: stamps/jtreg.stamp + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-4486841.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-4486841.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,838 @@ +--- old/src/share/classes/sun/nio/cs/UTF_8.java Thu Oct 9 16:02:01 2008 ++++ openjdk/jdk/src/share/classes/sun/nio/cs/UTF_8.java Thu Oct 9 16:02:01 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,34 +25,36 @@ + + package sun.nio.cs; + ++import java.nio.Buffer; + import java.nio.ByteBuffer; + import java.nio.CharBuffer; +-import java.nio.BufferOverflowException; +-import java.nio.BufferUnderflowException; + import java.nio.charset.Charset; + import java.nio.charset.CharsetDecoder; + import java.nio.charset.CharsetEncoder; + import java.nio.charset.CoderResult; +-import java.nio.charset.CharacterCodingException; +-import java.nio.charset.MalformedInputException; +-import java.nio.charset.UnmappableCharacterException; + +- +-/* +- * # Bits Bit pattern +- * 1 7 0xxxxxxx +- * 2 11 110xxxxx 10xxxxxx +- * 3 16 1110xxxx 10xxxxxx 10xxxxxx +- * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx +- * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx +- * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx ++/* Legal UTF-8 Byte Sequences + * +- * UCS-2 uses 1-3, UTF-16 uses 1-4, UCS-4 uses 1-6 ++ * # Code Points Bits Bit/Byte pattern ++ * 1 7 0xxxxxxx ++ * U+0000..U+007F 00..7F ++ * ++ * 2 11 110xxxxx 10xxxxxx ++ * U+0080..U+07FF C2..DF 80..BF ++ * ++ * 3 16 1110xxxx 10xxxxxx 10xxxxxx ++ * U+0800..U+0FFF E0 A0..BF 80..BF ++ * U+1000..U+FFFF E1..EF 80..BF 80..BF ++ * ++ * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx ++ * U+10000..U+3FFFF F0 90..BF 80..BF 80..BF ++ * U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF ++ * U+100000..U10FFFF F4 80..8F 80..BF 80..BF ++ * + */ + + class UTF_8 extends Unicode + { +- + public UTF_8() { + super("UTF-8", StandardCharsets.aliases_UTF_8); + } +@@ -69,6 +71,11 @@ + return new Encoder(this); + } + ++ static final void updatePositions(Buffer src, int sp, ++ Buffer dst, int dp) { ++ src.position(sp - src.arrayOffset()); ++ dst.position(dp - dst.arrayOffset()); ++ } + + private static class Decoder extends CharsetDecoder { + private Decoder(Charset cs) { +@@ -75,161 +82,182 @@ + super(cs, 1.0f, 1.0f); + } + +- private boolean isContinuation(int b) { +- return ((b & 0xc0) == 0x80); ++ private static boolean isNotContinuation(int b) { ++ return (b & 0xc0) != 0x80; + } + +- private final Surrogate.Generator sgg = new Surrogate.Generator(); ++ // [C2..DF] [80..BF] ++ private static boolean isMalformed2(int b1, int b2) { ++ return (b1 & 0x1e) == 0x0 || (b2 & 0xc0) != 0x80; ++ } + ++ // [E0] [A0..BF] [80..BF] ++ // [E1..EF] [80..BF] [80..BF] ++ private static boolean isMalformed3(int b1, int b2, int b3) { ++ return (b1 == (byte)0xe0 && (b2 & 0xe0) == 0x80) || ++ (b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80; ++ } ++ ++ // [F0] [90..BF] [80..BF] [80..BF] ++ // [F1..F3] [80..BF] [80..BF] [80..BF] ++ // [F4] [80..8F] [80..BF] [80..BF] ++ // only check 80-be range here, the [0xf0,0x80...] and [0xf4,0x90-...] ++ // will be checked by Surrogate.neededFor(uc) ++ private static boolean isMalformed4(int b2, int b3, int b4) { ++ return (b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80 || ++ (b4 & 0xc0) != 0x80; ++ } ++ ++ private static CoderResult lookupN(ByteBuffer src, int n) ++ { ++ for (int i = 1; i < n; i++) { ++ if (isNotContinuation(src.get())) ++ return CoderResult.malformedForLength(i); ++ } ++ return CoderResult.malformedForLength(n); ++ } ++ ++ private static CoderResult malformedN(ByteBuffer src, int nb) { ++ switch (nb) { ++ case 1: ++ int b1 = src.get(); ++ if ((b1 >> 2) == -2) { ++ // 5 bytes 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx ++ if (src.remaining() < 4) ++ return CoderResult.UNDERFLOW; ++ return lookupN(src, 5); ++ } ++ if ((b1 >> 1) == -2) { ++ // 6 bytes 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx ++ if (src.remaining() < 5) ++ return CoderResult.UNDERFLOW; ++ return lookupN(src, 6); ++ } ++ return CoderResult.malformedForLength(1); ++ case 2: // always 1 ++ return CoderResult.malformedForLength(1); ++ case 3: ++ b1 = src.get(); ++ int b2 = src.get(); // no need to lookup b3 ++ return CoderResult.malformedForLength( ++ ((b1 == (byte)0xe0 && (b2 & 0xe0) == 0x80) || ++ isNotContinuation(b2))?1:2); ++ case 4: // we don't care the speed here ++ b1 = src.get() & 0xff; ++ b2 = src.get() & 0xff; ++ if (b1 > 0xf4 || ++ (b1 == 0xf0 && (b2 < 0x90 || b2 > 0xbf)) || ++ (b1 == 0xf4 && (b2 & 0xf0) != 0x80) || ++ isNotContinuation(b2)) ++ return CoderResult.malformedForLength(1); ++ if (isNotContinuation(src.get())) ++ return CoderResult.malformedForLength(2); ++ return CoderResult.malformedForLength(3); ++ default: ++ assert false; ++ return null; ++ } ++ } ++ ++ private static CoderResult malformed(ByteBuffer src, int sp, ++ CharBuffer dst, int dp, ++ int nb) ++ { ++ src.position(sp - src.arrayOffset()); ++ CoderResult cr = malformedN(src, nb); ++ updatePositions(src, sp, dst, dp); ++ return cr; ++ } ++ ++ private static CoderResult malformed(ByteBuffer src, ++ int mark, int nb) ++ { ++ src.position(mark); ++ CoderResult cr = malformedN(src, nb); ++ src.position(mark); ++ return cr; ++ } ++ ++ private static CoderResult xflow(Buffer src, int sp, int sl, ++ Buffer dst, int dp, int nb) { ++ updatePositions(src, sp, dst, dp); ++ return (nb == 0 || sl - sp < nb) ++ ?CoderResult.UNDERFLOW:CoderResult.OVERFLOW; ++ } ++ ++ private static CoderResult xflow(Buffer src, int mark, int nb) { ++ CoderResult cr = (nb == 0 || src.remaining() < (nb - 1)) ++ ?CoderResult.UNDERFLOW:CoderResult.OVERFLOW; ++ src.position(mark); ++ return cr; ++ } ++ + private CoderResult decodeArrayLoop(ByteBuffer src, + CharBuffer dst) + { ++ // This method is optimized for ASCII input. + byte[] sa = src.array(); + int sp = src.arrayOffset() + src.position(); + int sl = src.arrayOffset() + src.limit(); +- assert (sp <= sl); +- sp = (sp <= sl ? sp : sl); ++ + char[] da = dst.array(); + int dp = dst.arrayOffset() + dst.position(); + int dl = dst.arrayOffset() + dst.limit(); +- assert (dp <= dl); +- dp = (dp <= dl ? dp : dl); ++ int dlASCII = dp + Math.min(sl - sp, dl - dp); + +- try { +- while (sp < sl) { +- int b1 = sa[sp]; +- int b2, b3; +- switch ((b1 >> 4) & 0x0f) { ++ // ASCII only loop ++ while (dp < dlASCII && sa[sp] >= 0) ++ da[dp++] = (char)sa[sp++]; + +- case 0: case 1: case 2: case 3: +- case 4: case 5: case 6: case 7: +- // 1 byte, 7 bits: 0xxxxxxx +- if (dl - dp < 1) +- return CoderResult.OVERFLOW; +- da[dp++] = (char)(b1 & 0x7f); +- sp++; +- continue; +- +- case 12: case 13: +- // 2 bytes, 11 bits: 110xxxxx 10xxxxxx +- if (sl - sp < 2) +- return CoderResult.UNDERFLOW; +- if (dl - dp < 1) +- return CoderResult.OVERFLOW; +- if (!isContinuation(b2 = sa[sp + 1])) +- return CoderResult.malformedForLength(1); +- da[dp++] = ((char)(((b1 & 0x1f) << 6) | +- ((b2 & 0x3f) << 0))); +- sp += 2; +- continue; +- +- case 14: +- // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx +- if (sl - sp < 3) +- return CoderResult.UNDERFLOW; +- if (dl - dp < 1) +- return CoderResult.OVERFLOW; +- if (!isContinuation(b2 = sa[sp + 1])) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = sa[sp + 2])) +- return CoderResult.malformedForLength(2); +- da[dp++] = ((char)(((b1 & 0x0f) << 12) | +- ((b2 & 0x3f) << 06) | +- ((b3 & 0x3f) << 0))); +- sp += 3; +- continue; +- +- case 15: +- // 4, 5, or 6 bytes +- +- int b4, b5, b6, uc, n; +- switch (b1 & 0x0f) { +- +- case 0: case 1: case 2: case 3: +- case 4: case 5: case 6: case 7: +- // 4 bytes, 21 bits +- if (sl - sp < 4) +- return CoderResult.UNDERFLOW; +- if (!isContinuation(b2 = sa[sp + 1])) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = sa[sp + 2])) +- return CoderResult.malformedForLength(2); +- if (!isContinuation(b4 = sa[sp + 3])) +- return CoderResult.malformedForLength(3); +- uc = (((b1 & 0x07) << 18) | +- ((b2 & 0x3f) << 12) | +- ((b3 & 0x3f) << 06) | +- ((b4 & 0x3f) << 00)); +- n = 4; +- break; +- +- case 8: case 9: case 10: case 11: +- // 5 bytes, 26 bits +- if (sl - sp < 5) +- return CoderResult.UNDERFLOW; +- if (!isContinuation(b2 = sa[sp + 1])) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = sa[sp + 2])) +- return CoderResult.malformedForLength(2); +- if (!isContinuation(b4 = sa[sp + 3])) +- return CoderResult.malformedForLength(3); +- if (!isContinuation(b5 = sa[sp + 4])) +- return CoderResult.malformedForLength(4); +- uc = (((b1 & 0x03) << 24) | +- ((b2 & 0x3f) << 18) | +- ((b3 & 0x3f) << 12) | +- ((b4 & 0x3f) << 06) | +- ((b5 & 0x3f) << 00)); +- n = 5; +- break; +- +- case 12: case 13: +- // 6 bytes, 31 bits +- if (sl - sp < 6) +- return CoderResult.UNDERFLOW; +- if (!isContinuation(b2 = sa[sp + 1])) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = sa[sp + 2])) +- return CoderResult.malformedForLength(2); +- if (!isContinuation(b4 = sa[sp + 3])) +- return CoderResult.malformedForLength(3); +- if (!isContinuation(b5 = sa[sp + 4])) +- return CoderResult.malformedForLength(4); +- if (!isContinuation(b6 = sa[sp + 5])) +- return CoderResult.malformedForLength(5); +- uc = (((b1 & 0x01) << 30) | +- ((b2 & 0x3f) << 24) | +- ((b3 & 0x3f) << 18) | +- ((b4 & 0x3f) << 12) | +- ((b5 & 0x3f) << 06) | +- ((b6 & 0x3f))); +- n = 6; +- break; +- +- default: +- return CoderResult.malformedForLength(1); +- +- } +- +- int gn = sgg.generate(uc, n, da, dp, dl); +- if (gn < 0) +- return sgg.error(); +- dp += gn; +- sp += n; +- continue; +- +- default: +- return CoderResult.malformedForLength(1); +- ++ while (sp < sl) { ++ int b1 = sa[sp]; ++ if (b1 >= 0) { ++ // 1 byte, 7 bits: 0xxxxxxx ++ if (dp >= dl) ++ return xflow(src, sp, sl, dst, dp, 1); ++ da[dp++] = (char)b1; ++ sp++; ++ } else if ((b1 >> 5) == -2) { ++ // 2 bytes, 11 bits: 110xxxxx 10xxxxxx ++ if (sl - sp < 2 || dp >= dl) ++ return xflow(src, sp, sl, dst, dp, 2); ++ int b2 = sa[sp + 1]; ++ if (isMalformed2(b1, b2)) ++ return malformed(src, sp, dst, dp, 2); ++ da[dp++] = (char) (((b1 << 6) ^ b2) ^ 0x0f80); ++ sp += 2; ++ } else if ((b1 >> 4) == -2) { ++ // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx ++ if (sl - sp < 3 || dp >= dl) ++ return xflow(src, sp, sl, dst, dp, 3); ++ int b2 = sa[sp + 1]; ++ int b3 = sa[sp + 2]; ++ if (isMalformed3(b1, b2, b3)) ++ return malformed(src, sp, dst, dp, 3); ++ da[dp++] = (char) (((b1 << 12) ^ (b2 << 6) ^ b3) ^ 0x1f80); ++ sp += 3; ++ } else if ((b1 >> 3) == -2) { ++ // 4 bytes, 21 bits: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx ++ if (sl - sp < 4 || dl - dp < 2) ++ return xflow(src, sp, sl, dst, dp, 4); ++ int b2 = sa[sp + 1]; ++ int b3 = sa[sp + 2]; ++ int b4 = sa[sp + 3]; ++ int uc = ((b1 & 0x07) << 18) | ++ ((b2 & 0x3f) << 12) | ++ ((b3 & 0x3f) << 06) | ++ (b4 & 0x3f); ++ if (isMalformed4(b2, b3, b4) || ++ !Surrogate.neededFor(uc)) { ++ return malformed(src, sp, dst, dp, 4); + } +- +- } +- +- return CoderResult.UNDERFLOW; +- } finally { +- src.position(sp - src.arrayOffset()); +- dst.position(dp - dst.arrayOffset()); ++ da[dp++] = Surrogate.high(uc); ++ da[dp++] = Surrogate.low(uc); ++ sp += 4; ++ } else ++ return malformed(src, sp, dst, dp, 1); + } ++ return xflow(src, sp, sl, dst, dp, 0); + } + + private CoderResult decodeBufferLoop(ByteBuffer src, +@@ -236,137 +264,57 @@ + CharBuffer dst) + { + int mark = src.position(); +- try { +- while (src.hasRemaining()) { +- int b1 = src.get(); +- int b2, b3; +- switch ((b1 >> 4) & 0x0f) { +- +- case 0: case 1: case 2: case 3: +- case 4: case 5: case 6: case 7: +- // 1 byte, 7 bits: 0xxxxxxx +- if (dst.remaining() < 1) +- return CoderResult.OVERFLOW; +- dst.put((char)b1); +- mark++; +- continue; +- +- case 12: case 13: +- // 2 bytes, 11 bits: 110xxxxx 10xxxxxx +- if (src.remaining() < 1) +- return CoderResult.UNDERFLOW; +- if (dst.remaining() < 1) +- return CoderResult.OVERFLOW; +- if (!isContinuation(b2 = src.get())) +- return CoderResult.malformedForLength(1); +- dst.put((char)(((b1 & 0x1f) << 6) | +- ((b2 & 0x3f) << 0))); +- mark += 2; +- continue; +- +- case 14: +- // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx +- if (src.remaining() < 2) +- return CoderResult.UNDERFLOW; +- if (dst.remaining() < 1) +- return CoderResult.OVERFLOW; +- if (!isContinuation(b2 = src.get())) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = src.get())) +- return CoderResult.malformedForLength(2); +- dst.put((char)(((b1 & 0x0f) << 12) | +- ((b2 & 0x3f) << 06) | +- ((b3 & 0x3f) << 0))); +- mark += 3; +- continue; +- +- case 15: +- // 4, 5, or 6 bytes +- +- int b4, b5, b6, uc, n; +- switch (b1 & 0x0f) { +- +- case 0: case 1: case 2: case 3: +- case 4: case 5: case 6: case 7: +- // 4 bytes, 21 bits +- if (src.remaining() < 3) +- return CoderResult.UNDERFLOW; +- if (!isContinuation(b2 = src.get())) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = src.get())) +- return CoderResult.malformedForLength(2); +- if (!isContinuation(b4 = src.get())) +- return CoderResult.malformedForLength(3); +- uc = (((b1 & 0x07) << 18) | +- ((b2 & 0x3f) << 12) | +- ((b3 & 0x3f) << 06) | +- ((b4 & 0x3f) << 00)); +- n = 4; +- break; +- +- case 8: case 9: case 10: case 11: +- // 5 bytes, 26 bits +- if (src.remaining() < 4) +- return CoderResult.UNDERFLOW; +- if (!isContinuation(b2 = src.get())) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = src.get())) +- return CoderResult.malformedForLength(2); +- if (!isContinuation(b4 = src.get())) +- return CoderResult.malformedForLength(3); +- if (!isContinuation(b5 = src.get())) +- return CoderResult.malformedForLength(4); +- uc = (((b1 & 0x03) << 24) | +- ((b2 & 0x3f) << 18) | +- ((b3 & 0x3f) << 12) | +- ((b4 & 0x3f) << 06) | +- ((b5 & 0x3f) << 00)); +- n = 5; +- break; +- +- case 12: case 13: +- // 6 bytes, 31 bits +- if (src.remaining() < 4) +- return CoderResult.UNDERFLOW; +- if (!isContinuation(b2 = src.get())) +- return CoderResult.malformedForLength(1); +- if (!isContinuation(b3 = src.get())) +- return CoderResult.malformedForLength(2); +- if (!isContinuation(b4 = src.get())) +- return CoderResult.malformedForLength(3); +- if (!isContinuation(b5 = src.get())) +- return CoderResult.malformedForLength(4); +- if (!isContinuation(b6 = src.get())) +- return CoderResult.malformedForLength(5); +- uc = (((b1 & 0x01) << 30) | +- ((b2 & 0x3f) << 24) | +- ((b3 & 0x3f) << 18) | +- ((b4 & 0x3f) << 12) | +- ((b5 & 0x3f) << 06) | +- ((b6 & 0x3f))); +- n = 6; +- break; +- +- default: +- return CoderResult.malformedForLength(1); +- +- } +- +- if (sgg.generate(uc, n, dst) < 0) +- return sgg.error(); +- mark += n; +- continue; +- +- default: +- return CoderResult.malformedForLength(1); +- ++ int limit = src.limit(); ++ while (mark < limit) { ++ int b1 = src.get(); ++ if (b1 >= 0) { ++ // 1 byte, 7 bits: 0xxxxxxx ++ if (dst.remaining() < 1) ++ return xflow(src, mark, 1); //overflow ++ dst.put((char)b1); ++ mark++; ++ } else if ((b1 >> 5) == -2) { ++ // 2 bytes, 11 bits: 110xxxxx 10xxxxxx ++ if (limit - mark < 2|| dst.remaining() < 1) ++ return xflow(src, mark, 2); ++ int b2 = src.get(); ++ if (isMalformed2(b1, b2)) ++ return malformed(src, mark, 2); ++ dst.put((char) (((b1 << 6) ^ b2) ^ 0x0f80)); ++ mark += 2; ++ } else if ((b1 >> 4) == -2) { ++ // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx ++ if (limit - mark < 3 || dst.remaining() < 1) ++ return xflow(src, mark, 3); ++ int b2 = src.get(); ++ int b3 = src.get(); ++ if (isMalformed3(b1, b2, b3)) ++ return malformed(src, mark, 3); ++ dst.put((char) (((b1 << 12) ^ (b2 << 6) ^ b3) ^ 0x1f80)); ++ mark += 3; ++ } else if ((b1 >> 3) == -2) { ++ // 4 bytes, 21 bits: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx ++ if (limit - mark < 4 || dst.remaining() < 2) ++ return xflow(src, mark, 4); ++ int b2 = src.get(); ++ int b3 = src.get(); ++ int b4 = src.get(); ++ int uc = ((b1 & 0x07) << 18) | ++ ((b2 & 0x3f) << 12) | ++ ((b3 & 0x3f) << 06) | ++ (b4 & 0x3f); ++ if (isMalformed4(b2, b3, b4) || ++ !Surrogate.neededFor(uc)) { // shortest form check ++ return malformed(src, mark, 4); + } +- ++ dst.put(Surrogate.high(uc)); ++ dst.put(Surrogate.low(uc)); ++ mark += 4; ++ } else { ++ return malformed(src, mark, 1); + } +- return CoderResult.UNDERFLOW; +- } finally { +- src.position(mark); + } ++ return xflow(src, mark, 0); + } + + protected CoderResult decodeLoop(ByteBuffer src, +@@ -377,10 +325,8 @@ + else + return decodeBufferLoop(src, dst); + } +- + } + +- + private static class Encoder extends CharsetEncoder { + + private Encoder(Charset cs) { +@@ -391,8 +337,23 @@ + return !Surrogate.is(c); + } + +- private final Surrogate.Parser sgp = new Surrogate.Parser(); ++ public boolean isLegalReplacement(byte[] repl) { ++ return ((repl.length == 1 && repl[0] >= 0) || ++ super.isLegalReplacement(repl)); ++ } + ++ private static CoderResult overflow(CharBuffer src, int sp, ++ ByteBuffer dst, int dp) { ++ updatePositions(src, sp, dst, dp); ++ return CoderResult.OVERFLOW; ++ } ++ ++ private static CoderResult overflow(CharBuffer src, int mark) { ++ src.position(mark); ++ return CoderResult.OVERFLOW; ++ } ++ ++ private Surrogate.Parser sgp; + private CoderResult encodeArrayLoop(CharBuffer src, + ByteBuffer dst) + { +@@ -399,71 +360,56 @@ + char[] sa = src.array(); + int sp = src.arrayOffset() + src.position(); + int sl = src.arrayOffset() + src.limit(); +- assert (sp <= sl); +- sp = (sp <= sl ? sp : sl); ++ + byte[] da = dst.array(); + int dp = dst.arrayOffset() + dst.position(); + int dl = dst.arrayOffset() + dst.limit(); +- assert (dp <= dl); +- dp = (dp <= dl ? dp : dl); ++ int dlASCII = dp + Math.min(sl - sp, dl - dp); + +- try { +- while (sp < sl) { +- char c = sa[sp]; +- +- if (c < 0x80) { +- // Have at most seven bits +- if (dp >= dl) +- return CoderResult.OVERFLOW; +- da[dp++] = (byte)c; +- sp++; +- continue; +- } +- +- if (!Surrogate.is(c)) { +- // 2 bytes, 11 bits +- if (c < 0x800) { +- if (dl - dp < 2) +- return CoderResult.OVERFLOW; +- da[dp++] = (byte)(0xc0 | ((c >> 06))); +- da[dp++] = (byte)(0x80 | ((c >> 00) & 0x3f)); +- sp++; +- continue; +- } +- if (c <= '\uFFFF') { +- // 3 bytes, 16 bits +- if (dl - dp < 3) +- return CoderResult.OVERFLOW; +- da[dp++] = (byte)(0xe0 | ((c >> 12))); +- da[dp++] = (byte)(0x80 | ((c >> 06) & 0x3f)); +- da[dp++] = (byte)(0x80 | ((c >> 00) & 0x3f)); +- sp++; +- continue; +- } +- } +- ++ //ASCII only loop ++ while (dp < dlASCII && sa[sp] < '\u0080') ++ da[dp++] = (byte) sa[sp++]; ++ while (sp < sl) { ++ int c = sa[sp]; ++ if (c < 0x80) { ++ // Have at most seven bits ++ if (dp >= dl) ++ return overflow(src, sp, dst, dp); ++ da[dp++] = (byte)c; ++ } else if (c < 0x800) { ++ // 2 bytes, 11 bits ++ if (dl - dp < 2) ++ return overflow(src, sp, dst, dp); ++ da[dp++] = (byte)(0xc0 | ((c >> 06))); ++ da[dp++] = (byte)(0x80 | (c & 0x3f)); ++ } else if (Surrogate.is(c)) { + // Have a surrogate pair +- int uc = sgp.parse(c, sa, sp, sl); +- if (uc < 0) ++ if (sgp == null) ++ sgp = new Surrogate.Parser(); ++ int uc = sgp.parse((char)c, sa, sp, sl); ++ if (uc < 0) { ++ updatePositions(src, sp, dst, dp); + return sgp.error(); +- if (uc < 0x200000) { +- if (dl - dp < 4) +- return CoderResult.OVERFLOW; +- da[dp++] = (byte)(0xf0 | ((uc >> 18))); +- da[dp++] = (byte)(0x80 | ((uc >> 12) & 0x3f)); +- da[dp++] = (byte)(0x80 | ((uc >> 06) & 0x3f)); +- da[dp++] = (byte)(0x80 | ((uc >> 00) & 0x3f)); +- sp += sgp.increment(); +- continue; + } +- assert false; +- ++ if (dl - dp < 4) ++ return overflow(src, sp, dst, dp); ++ da[dp++] = (byte)(0xf0 | ((uc >> 18))); ++ da[dp++] = (byte)(0x80 | ((uc >> 12) & 0x3f)); ++ da[dp++] = (byte)(0x80 | ((uc >> 06) & 0x3f)); ++ da[dp++] = (byte)(0x80 | (uc & 0x3f)); ++ sp++; // 2 chars ++ } else { ++ // 3 bytes, 16 bits ++ if (dl - dp < 3) ++ return overflow(src, sp, dst, dp); ++ da[dp++] = (byte)(0xe0 | ((c >> 12))); ++ da[dp++] = (byte)(0x80 | ((c >> 06) & 0x3f)); ++ da[dp++] = (byte)(0x80 | (c & 0x3f)); + } +- return CoderResult.UNDERFLOW; +- } finally { +- src.position(sp - src.arrayOffset()); +- dst.position(dp - dst.arrayOffset()); ++ sp++; + } ++ updatePositions(src, sp, dst, dp); ++ return CoderResult.UNDERFLOW; + } + + private CoderResult encodeBufferLoop(CharBuffer src, +@@ -470,62 +416,47 @@ + ByteBuffer dst) + { + int mark = src.position(); +- try { +- while (src.hasRemaining()) { +- char c = src.get(); +- +- if (c < 0x80) { +- // Have at most seven bits +- if (!dst.hasRemaining()) +- return CoderResult.OVERFLOW; +- dst.put((byte)c); +- mark++; +- continue; +- } +- +- if (!Surrogate.is(c)) { +- if (c < 0x800) { +- // 2 bytes, 11 bits +- if (dst.remaining() < 2) +- return CoderResult.OVERFLOW; +- dst.put((byte)(0xc0 | ((c >> 06)))); +- dst.put((byte)(0x80 | ((c >> 00) & 0x3f))); +- mark++; +- continue; +- } +- if (c <= '\uFFFF') { +- // 3 bytes, 16 bits +- if (dst.remaining() < 3) +- return CoderResult.OVERFLOW; +- dst.put((byte)(0xe0 | ((c >> 12)))); +- dst.put((byte)(0x80 | ((c >> 06) & 0x3f))); +- dst.put((byte)(0x80 | ((c >> 00) & 0x3f))); +- mark++; +- continue; +- } +- } +- ++ while (src.hasRemaining()) { ++ int c = src.get(); ++ if (c < 0x80) { ++ // Have at most seven bits ++ if (!dst.hasRemaining()) ++ return overflow(src, mark); ++ dst.put((byte)c); ++ } else if (c < 0x800) { ++ // 2 bytes, 11 bits ++ if (dst.remaining() < 2) ++ return overflow(src, mark); ++ dst.put((byte)(0xc0 | ((c >> 06)))); ++ dst.put((byte)(0x80 | (c & 0x3f))); ++ } else if (Surrogate.is(c)) { + // Have a surrogate pair +- int uc = sgp.parse(c, src); +- if (uc < 0) ++ if (sgp == null) ++ sgp = new Surrogate.Parser(); ++ int uc = sgp.parse((char)c, src); ++ if (uc < 0) { ++ src.position(mark); + return sgp.error(); +- if (uc < 0x200000) { +- if (dst.remaining() < 4) +- return CoderResult.OVERFLOW; +- dst.put((byte)(0xf0 | ((uc >> 18)))); +- dst.put((byte)(0x80 | ((uc >> 12) & 0x3f))); +- dst.put((byte)(0x80 | ((uc >> 06) & 0x3f))); +- dst.put((byte)(0x80 | ((uc >> 00) & 0x3f))); +- mark += sgp.increment(); +- continue; + } +- assert false; +- ++ if (dst.remaining() < 4) ++ return overflow(src, mark); ++ dst.put((byte)(0xf0 | ((uc >> 18)))); ++ dst.put((byte)(0x80 | ((uc >> 12) & 0x3f))); ++ dst.put((byte)(0x80 | ((uc >> 06) & 0x3f))); ++ dst.put((byte)(0x80 | (uc & 0x3f))); ++ mark++; //2 chars ++ } else { ++ // 3 bytes, 16 bits ++ if (dst.remaining() < 3) ++ return overflow(src, mark); ++ dst.put((byte)(0xe0 | ((c >> 12)))); ++ dst.put((byte)(0x80 | ((c >> 06) & 0x3f))); ++ dst.put((byte)(0x80 | (c & 0x3f))); + } +- return CoderResult.UNDERFLOW; +- } finally { +- src.position(mark); ++ mark++; + } ++ src.position(mark); ++ return CoderResult.UNDERFLOW; + } + + protected final CoderResult encodeLoop(CharBuffer src, +@@ -536,7 +467,5 @@ + else + return encodeBufferLoop(src, dst); + } +- + } +- + } diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6484091.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6484091.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,86 @@ +--- old/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Tue Nov 18 10:35:29 2008 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Tue Nov 18 10:35:29 2008 +@@ -38,6 +38,8 @@ + import java.io.FileNotFoundException; + import java.io.IOException; + import java.util.*; ++import java.security.AccessController; ++import java.security.PrivilegedAction; + import javax.accessibility.*; + + import sun.awt.shell.ShellFolder; +@@ -957,7 +959,11 @@ + + File[] baseFolders; + if (useShellFolder) { +- baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders"); ++ baseFolders = AccessController.doPrivileged(new PrivilegedAction() { ++ public File[] run() { ++ return (File[]) ShellFolder.get("fileChooserComboBoxFolders"); ++ } ++ }); + } else { + baseFolders = fsv.getRoots(); + } +--- old/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java Tue Nov 18 10:35:30 2008 ++++ openjdk/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java Tue Nov 18 10:35:30 2008 +@@ -29,6 +29,8 @@ + import java.beans.*; + import java.io.*; + import java.util.*; ++import java.security.AccessController; ++import java.security.PrivilegedAction; + + import javax.swing.*; + import javax.swing.event.*; +@@ -769,7 +771,11 @@ + + File[] baseFolders; + if (useShellFolder) { +- baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders"); ++ baseFolders = AccessController.doPrivileged(new PrivilegedAction() { ++ public File[] run() { ++ return (File[]) ShellFolder.get("fileChooserComboBoxFolders"); ++ } ++ }); + } else { + baseFolders = fsv.getRoots(); + } +--- old/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Tue Nov 18 10:35:31 2008 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Tue Nov 18 10:35:31 2008 +@@ -39,6 +39,8 @@ + import java.io.FileNotFoundException; + import java.io.IOException; + import java.util.*; ++import java.security.AccessController; ++import java.security.PrivilegedAction; + + import sun.awt.shell.ShellFolder; + import sun.awt.OSInfo; +@@ -1165,7 +1167,11 @@ + + File[] baseFolders; + if (useShellFolder) { +- baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders"); ++ baseFolders = AccessController.doPrivileged(new PrivilegedAction() { ++ public File[] run() { ++ return (File[]) ShellFolder.get("fileChooserComboBoxFolders"); ++ } ++ }); + } else { + baseFolders = fsv.getRoots(); + } +--- old/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java Tue Nov 18 10:35:32 2008 ++++ openjdk/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java Tue Nov 18 10:35:32 2008 + +@@ -657,6 +657,10 @@ + * null if this shellfolder does not denote a directory. + */ + public File[] listFiles(final boolean includeHiddenFiles) { ++ SecurityManager security = System.getSecurityManager(); ++ if (security != null) { ++ security.checkRead(getPath()); ++ } + + return new ComTask() { + public File[] call() throws Exception { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6497740.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6497740.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,773 @@ +--- old/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java Fri Aug 22 18:58:20 2008 ++++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java Fri Aug 22 18:58:20 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -38,6 +38,8 @@ + import sun.security.pkcs11.wrapper.*; + import static sun.security.pkcs11.wrapper.PKCS11Constants.*; + ++import sun.security.rsa.RSAKeyFactory; ++ + /** + * KeyPairGenerator implementation class. This class currently supports + * RSA, DSA, DH, and EC. +@@ -66,7 +68,7 @@ + private AlgorithmParameterSpec params; + + // for RSA, selected or default value of public exponent, always valid +- private BigInteger rsaPublicExponent; ++ private BigInteger rsaPublicExponent = RSAKeyGenParameterSpec.F4; + + // SecureRandom instance, if specified in init + private SecureRandom random; +@@ -88,7 +90,7 @@ + public void initialize(int keySize, SecureRandom random) { + token.ensureValid(); + try { +- checkKeySize(keySize); ++ checkKeySize(keySize, null); + } catch (InvalidAlgorithmParameterException e) { + throw new InvalidParameterException(e.getMessage()); + } +@@ -95,12 +97,12 @@ + this.keySize = keySize; + this.params = null; + this.random = random; +- this.rsaPublicExponent = RSAKeyGenParameterSpec.F4; + if (algorithm.equals("EC")) { + params = P11ECKeyFactory.getECParameterSpec(keySize); + if (params == null) { +- throw new InvalidParameterException +- ("No EC parameters available for key size " + keySize + " bits"); ++ throw new InvalidParameterException( ++ "No EC parameters available for key size " ++ + keySize + " bits"); + } + } + } +@@ -115,8 +117,10 @@ + ("DHParameterSpec required for Diffie-Hellman"); + } + DHParameterSpec dhParams = (DHParameterSpec)params; +- this.keySize = dhParams.getP().bitLength(); +- this.params = params; ++ int tmpKeySize = dhParams.getP().bitLength(); ++ checkKeySize(tmpKeySize, dhParams); ++ this.keySize = tmpKeySize; ++ this.params = dhParams; + // XXX sanity check params + } else if (algorithm.equals("RSA")) { + if (params instanceof RSAKeyGenParameterSpec == false) { +@@ -124,7 +128,9 @@ + ("RSAKeyGenParameterSpec required for RSA"); + } + RSAKeyGenParameterSpec rsaParams = (RSAKeyGenParameterSpec)params; +- this.keySize = rsaParams.getKeysize(); ++ int tmpKeySize = rsaParams.getKeysize(); ++ checkKeySize(tmpKeySize, rsaParams); ++ this.keySize = tmpKeySize; + this.params = null; + this.rsaPublicExponent = rsaParams.getPublicExponent(); + // XXX sanity check params +@@ -134,13 +140,16 @@ + ("DSAParameterSpec required for DSA"); + } + DSAParameterSpec dsaParams = (DSAParameterSpec)params; +- this.keySize = dsaParams.getP().bitLength(); +- this.params = params; ++ int tmpKeySize = dsaParams.getP().bitLength(); ++ checkKeySize(tmpKeySize, dsaParams); ++ this.keySize = tmpKeySize; ++ this.params = dsaParams; + // XXX sanity check params + } else if (algorithm.equals("EC")) { + ECParameterSpec ecParams; + if (params instanceof ECParameterSpec) { +- ecParams = P11ECKeyFactory.getECParameterSpec((ECParameterSpec)params); ++ ecParams = P11ECKeyFactory.getECParameterSpec( ++ (ECParameterSpec)params); + if (ecParams == null) { + throw new InvalidAlgorithmParameterException + ("Unsupported curve: " + params); +@@ -156,16 +165,17 @@ + throw new InvalidAlgorithmParameterException + ("ECParameterSpec or ECGenParameterSpec required for EC"); + } +- this.keySize = ecParams.getCurve().getField().getFieldSize(); ++ int tmpKeySize = ecParams.getCurve().getField().getFieldSize(); ++ checkKeySize(tmpKeySize, ecParams); ++ this.keySize = tmpKeySize; + this.params = ecParams; + } else { + throw new ProviderException("Unknown algorithm: " + algorithm); + } + this.random = random; +- checkKeySize(keySize); + } + +- private void checkKeySize(int keySize) ++ private void checkKeySize(int keySize, AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException { + if (algorithm.equals("EC")) { + if (keySize < 112) { +@@ -178,13 +188,28 @@ + ("Key size must be at most 2048 bit"); + } + return; ++ } else if (algorithm.equals("RSA")) { ++ BigInteger tmpExponent = rsaPublicExponent; ++ if (params != null) { ++ // Already tested for instanceof RSAKeyGenParameterSpec above ++ tmpExponent = ++ ((RSAKeyGenParameterSpec)params).getPublicExponent(); ++ } ++ try { ++ // This provider supports 64K or less. ++ RSAKeyFactory.checkKeyLengths(keySize, tmpExponent, ++ 512, 64 * 1024); ++ } catch (InvalidKeyException e) { ++ throw new InvalidAlgorithmParameterException(e.getMessage()); ++ } ++ return; + } ++ + if (keySize < 512) { + throw new InvalidAlgorithmParameterException + ("Key size must be at least 512 bit"); + } +- if (algorithm.equals("RSA") || +- (algorithm.equals("DH") && (params != null))) { ++ if (algorithm.equals("DH") && (params != null)) { + // sanity check, nobody really wants keys this large + if (keySize > 64 * 1024) { + throw new InvalidAlgorithmParameterException +--- old/src/share/classes/sun/security/pkcs11/P11KeyStore.java Fri Aug 22 18:58:29 2008 ++++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11KeyStore.java Fri Aug 22 18:58:29 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -80,6 +80,8 @@ + import sun.security.pkcs11.wrapper.*; + import static sun.security.pkcs11.wrapper.PKCS11Constants.*; + ++import sun.security.rsa.RSAKeyFactory; ++ + final class P11KeyStore extends KeyStoreSpi { + + private static final CK_ATTRIBUTE ATTR_CLASS_CERT = +@@ -1335,6 +1337,15 @@ + BigInteger modulus = attrs[0].getBigInteger(); + keyLength = modulus.bitLength(); + ++ // This check will combine our "don't care" values here ++ // with the system-wide min/max values. ++ try { ++ RSAKeyFactory.checkKeyLengths(keyLength, null, ++ -1, Integer.MAX_VALUE); ++ } catch (InvalidKeyException e) { ++ throw new KeyStoreException(e.getMessage()); ++ } ++ + return P11Key.privateKey(session, + oHandle, + keyType, +--- old/src/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java Fri Aug 22 18:58:37 2008 ++++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java Fri Aug 22 18:58:37 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -35,6 +35,8 @@ + import sun.security.pkcs11.wrapper.*; + import static sun.security.pkcs11.wrapper.PKCS11Constants.*; + ++import sun.security.rsa.RSAKeyFactory; ++ + /** + * RSA KeyFactory implemenation. + * +@@ -131,6 +133,9 @@ + } catch (PKCS11Exception e) { + throw new InvalidKeySpecException + ("Could not create RSA public key", e); ++ } catch (InvalidKeyException e) { ++ throw new InvalidKeySpecException ++ ("Could not create RSA public key", e); + } + } + +@@ -175,11 +180,15 @@ + } catch (PKCS11Exception e) { + throw new InvalidKeySpecException + ("Could not create RSA private key", e); ++ } catch (InvalidKeyException e) { ++ throw new InvalidKeySpecException ++ ("Could not create RSA private key", e); + } + } + + private PublicKey generatePublic(BigInteger n, BigInteger e) +- throws PKCS11Exception { ++ throws PKCS11Exception, InvalidKeyException { ++ RSAKeyFactory.checkKeyLengths(n.bitLength(), e, -1, 64 * 1024); + CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { + new CK_ATTRIBUTE(CKA_CLASS, CKO_PUBLIC_KEY), + new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_RSA), +@@ -200,7 +209,8 @@ + } + + private PrivateKey generatePrivate(BigInteger n, BigInteger d) +- throws PKCS11Exception { ++ throws PKCS11Exception, InvalidKeyException { ++ RSAKeyFactory.checkKeyLengths(n.bitLength(), null, -1, 64 * 1024); + CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { + new CK_ATTRIBUTE(CKA_CLASS, CKO_PRIVATE_KEY), + new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_RSA), +@@ -222,7 +232,9 @@ + + private PrivateKey generatePrivate(BigInteger n, BigInteger e, + BigInteger d, BigInteger p, BigInteger q, BigInteger pe, +- BigInteger qe, BigInteger coeff) throws PKCS11Exception { ++ BigInteger qe, BigInteger coeff) throws PKCS11Exception, ++ InvalidKeyException { ++ RSAKeyFactory.checkKeyLengths(n.bitLength(), e, -1, 64 * 1024); + CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { + new CK_ATTRIBUTE(CKA_CLASS, CKO_PRIVATE_KEY), + new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_RSA), +--- old/src/share/classes/sun/security/rsa/RSAKeyFactory.java Fri Aug 22 18:58:44 2008 ++++ openjdk/jdk/src/share/classes/sun/security/rsa/RSAKeyFactory.java Fri Aug 22 18:58:43 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -31,6 +31,8 @@ + import java.security.interfaces.*; + import java.security.spec.*; + ++import sun.security.action.GetPropertyAction; ++ + /** + * KeyFactory for RSA keys. Keys must be instances of PublicKey or PrivateKey + * and getAlgorithm() must return "RSA". For such keys, it supports conversion +@@ -68,6 +70,24 @@ + private final static Class x509KeySpecClass = X509EncodedKeySpec.class; + private final static Class pkcs8KeySpecClass = PKCS8EncodedKeySpec.class; + ++ public final static int MIN_MODLEN = 512; ++ public final static int MAX_MODLEN = 16384; ++ ++ /* ++ * If the modulus length is above this value, restrict the size of ++ * the exponent to something that can be reasonably computed. We ++ * could simply hardcode the exp len to something like 64 bits, but ++ * this approach allows flexibility in case impls would like to use ++ * larger module and exponent values. ++ */ ++ public final static int MAX_MODLEN_RESTRICT_EXP = 3072; ++ public final static int MAX_RESTRICTED_EXPLEN = 64; ++ ++ private static final boolean restrictExpLen = ++ "true".equalsIgnoreCase(AccessController.doPrivileged( ++ new GetPropertyAction( ++ "sun.security.rsa.restrictRSAExponent", "true"))); ++ + // instance used for static translateKey(); + private final static RSAKeyFactory INSTANCE = new RSAKeyFactory(); + +@@ -76,75 +96,80 @@ + } + + /** +- * Static method to convert Key into a useable instance of +- * RSAPublicKey or RSAPrivate(Crt)Key. Check the key and convert it +- * to a SunRsaSign key if necessary. If the key is not an RSA key +- * or cannot be used, throw an InvalidKeyException. ++ * Static method to convert Key into an instance of RSAPublicKeyImpl ++ * or RSAPrivate(Crt)KeyImpl. If the key is not an RSA key or cannot be ++ * used, throw an InvalidKeyException. + * +- * The difference between this method and engineTranslateKey() is that +- * we do not convert keys of other providers that are already an +- * instance of RSAPublicKey or RSAPrivate(Crt)Key. +- * + * Used by RSASignature and RSACipher. + */ + public static RSAKey toRSAKey(Key key) throws InvalidKeyException { +- if (key instanceof RSAKey) { +- RSAKey rsaKey = (RSAKey)key; +- checkKey(rsaKey); +- return rsaKey; ++ if ((key instanceof RSAPrivateKeyImpl) || ++ (key instanceof RSAPrivateCrtKeyImpl) || ++ (key instanceof RSAPublicKeyImpl)) { ++ return (RSAKey)key; + } else { + return (RSAKey)INSTANCE.engineTranslateKey(key); + } + } + +- /** +- * Check that the given RSA key is valid. ++ /* ++ * Single test entry point for all of the mechanisms in the SunRsaSign ++ * provider (RSA*KeyImpls). All of the tests are the same. ++ * ++ * For compatibility, we round up to the nearest byte here: ++ * some Key impls might pass in a value within a byte of the ++ * real value. + */ +- private static void checkKey(RSAKey key) throws InvalidKeyException { +- // check for subinterfaces, omit additional checks for our keys +- if (key instanceof RSAPublicKey) { +- if (key instanceof RSAPublicKeyImpl) { +- return; +- } +- } else if (key instanceof RSAPrivateKey) { +- if ((key instanceof RSAPrivateCrtKeyImpl) +- || (key instanceof RSAPrivateKeyImpl)) { +- return; +- } +- } else { +- throw new InvalidKeyException("Neither a public nor a private key"); +- } +- // RSAKey does not extend Key, so we need to do a cast +- String keyAlg = ((Key)key).getAlgorithm(); +- if (keyAlg.equals("RSA") == false) { +- throw new InvalidKeyException("Not an RSA key: " + keyAlg); +- } +- BigInteger modulus; +- // some providers implement RSAKey for keys where the values are +- // not accessible (although they should). Detect those here +- // for a more graceful failure. +- try { +- modulus = key.getModulus(); +- if (modulus == null) { +- throw new InvalidKeyException("Modulus is missing"); +- } +- } catch (RuntimeException e) { +- throw new InvalidKeyException(e); +- } +- checkKeyLength(modulus); ++ static void checkRSAProviderKeyLengths(int modulusLen, BigInteger exponent) ++ throws InvalidKeyException { ++ checkKeyLengths(((modulusLen + 7) & ~7), exponent, ++ RSAKeyFactory.MIN_MODLEN, Integer.MAX_VALUE); + } + + /** +- * Check the length of the modulus of an RSA key. We only support keys +- * at least 505 bits long. ++ * Check the length of an RSA key modulus/exponent to make sure it ++ * is not too short or long. Some impls have their own min and ++ * max key sizes that may or may not match with a system defined value. ++ * ++ * @param modulusLen the bit length of the RSA modulus. ++ * @param exponent the RSA exponent ++ * @param minModulusLen if > 0, check to see if modulusLen is at ++ * least this long, otherwise unused. ++ * @param maxModulusLen caller will allow this max number of bits. ++ * Allow the smaller of the system-defined maximum and this param. ++ * ++ * @throws InvalidKeyException if any of the values are unacceptable. + */ +- static void checkKeyLength(BigInteger modulus) throws InvalidKeyException { +- if (modulus.bitLength() < 505) { +- // some providers may generate slightly shorter keys +- // accept them if the encoding is at least 64 bytes long +- throw new InvalidKeyException +- ("RSA keys must be at least 512 bits long"); ++ public static void checkKeyLengths(int modulusLen, BigInteger exponent, ++ int minModulusLen, int maxModulusLen) throws InvalidKeyException { ++ ++ if ((minModulusLen > 0) && (modulusLen < (minModulusLen))) { ++ throw new InvalidKeyException( "RSA keys must be at least " + ++ minModulusLen + " bits long"); + } ++ ++ // Even though our policy file may allow this, we don't want ++ // either value (mod/exp) to be too big. ++ ++ int maxLen = Math.min(maxModulusLen, MAX_MODLEN); ++ ++ // If a RSAPrivateKey/RSAPublicKey, make sure the ++ // modulus len isn't too big. ++ if (modulusLen > maxLen) { ++ throw new InvalidKeyException( ++ "RSA keys must be no longer than " + maxLen + " bits"); ++ } ++ ++ // If a RSAPublicKey, make sure the exponent isn't too big. ++ if (restrictExpLen && (exponent != null) && ++ (modulusLen > MAX_MODLEN_RESTRICT_EXP) && ++ (exponent.bitLength() > MAX_RESTRICTED_EXPLEN)) { ++ throw new InvalidKeyException( ++ "RSA exponents can be no longer than " + ++ MAX_RESTRICTED_EXPLEN + " bits " + ++ " if modulus is greater than " + ++ MAX_MODLEN_RESTRICT_EXP + " bits"); ++ } + } + + /** +--- old/src/share/classes/sun/security/rsa/RSAKeyPairGenerator.java Fri Aug 22 18:58:50 2008 ++++ openjdk/jdk/src/share/classes/sun/security/rsa/RSAKeyPairGenerator.java Fri Aug 22 18:58:49 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -47,7 +47,7 @@ + // public exponent to use + private BigInteger publicExponent; + +- // size of the key to generate, >= 512 ++ // size of the key to generate, >= RSAKeyFactory.MIN_MODLEN + private int keySize; + + // PRNG to use +@@ -60,15 +60,16 @@ + + // initialize the generator. See JCA doc + public void initialize(int keySize, SecureRandom random) { +- if (keySize < 512) { +- throw new InvalidParameterException +- ("Key size must be at least 512 bits"); ++ ++ // do not allow unreasonably small or large key sizes, ++ // probably user error ++ try { ++ RSAKeyFactory.checkKeyLengths(keySize, RSAKeyGenParameterSpec.F4, ++ 512, 64 * 1024); ++ } catch (InvalidKeyException e) { ++ throw new InvalidParameterException(e.getMessage()); + } +- if (keySize > 64 * 1024) { +- // do not allow unreasonably large key sizes, probably user error +- throw new InvalidParameterException +- ("Key size must be 65536 bits or less"); +- } ++ + this.keySize = keySize; + this.random = random; + this.publicExponent = RSAKeyGenParameterSpec.F4; +@@ -77,35 +78,41 @@ + // second initialize method. See JCA doc. + public void initialize(AlgorithmParameterSpec params, SecureRandom random) + throws InvalidAlgorithmParameterException { ++ + if (params instanceof RSAKeyGenParameterSpec == false) { + throw new InvalidAlgorithmParameterException + ("Params must be instance of RSAKeyGenParameterSpec"); + } ++ + RSAKeyGenParameterSpec rsaSpec = (RSAKeyGenParameterSpec)params; +- keySize = rsaSpec.getKeysize(); +- publicExponent = rsaSpec.getPublicExponent(); +- this.random = random; +- if (keySize < 512) { +- throw new InvalidAlgorithmParameterException +- ("Key size must be at least 512 bits"); +- } +- if (keySize > 64 * 1024) { +- // do not allow unreasonably large key sizes, probably user error +- throw new InvalidAlgorithmParameterException +- ("Key size must be 65536 bits or less"); +- } +- if (publicExponent == null) { +- publicExponent = RSAKeyGenParameterSpec.F4; ++ int tmpKeySize = rsaSpec.getKeysize(); ++ BigInteger tmpPublicExponent = rsaSpec.getPublicExponent(); ++ ++ if (tmpPublicExponent == null) { ++ tmpPublicExponent = RSAKeyGenParameterSpec.F4; + } else { +- if (publicExponent.compareTo(RSAKeyGenParameterSpec.F0) < 0) { ++ if (tmpPublicExponent.compareTo(RSAKeyGenParameterSpec.F0) < 0) { + throw new InvalidAlgorithmParameterException + ("Public exponent must be 3 or larger"); + } +- if (publicExponent.bitLength() > keySize) { ++ if (tmpPublicExponent.bitLength() > tmpKeySize) { + throw new InvalidAlgorithmParameterException + ("Public exponent must be smaller than key size"); + } + } ++ ++ // do not allow unreasonably large key sizes, probably user error ++ try { ++ RSAKeyFactory.checkKeyLengths(tmpKeySize, tmpPublicExponent, ++ 512, 64 * 1024); ++ } catch (InvalidKeyException e) { ++ throw new InvalidAlgorithmParameterException( ++ "Invalid key sizes", e); ++ } ++ ++ this.keySize = tmpKeySize; ++ this.publicExponent = tmpPublicExponent; ++ this.random = random; + } + + // generate the keypair. See JCA doc +--- old/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Fri Aug 22 18:58:56 2008 ++++ openjdk/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Fri Aug 22 18:58:56 2008 + +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -89,7 +89,7 @@ + */ + RSAPrivateCrtKeyImpl(byte[] encoded) throws InvalidKeyException { + decode(encoded); +- RSAKeyFactory.checkKeyLength(n); ++ RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e); + } + + /** +@@ -107,7 +107,8 @@ + this.pe = pe; + this.qe = qe; + this.coeff = coeff; +- RSAKeyFactory.checkKeyLength(n); ++ RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e); ++ + // generate the encoding + algid = rsaId; + try { +--- old/src/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java Fri Aug 22 18:59:02 2008 ++++ openjdk/jdk/src/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java Fri Aug 22 18:59:01 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -61,7 +61,7 @@ + RSAPrivateKeyImpl(BigInteger n, BigInteger d) throws InvalidKeyException { + this.n = n; + this.d = d; +- RSAKeyFactory.checkKeyLength(n); ++ RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), null); + // generate the encoding + algid = RSAPrivateCrtKeyImpl.rsaId; + try { +--- old/src/share/classes/sun/security/rsa/RSAPublicKeyImpl.java Fri Aug 22 18:59:07 2008 ++++ openjdk/jdk/src/share/classes/sun/security/rsa/RSAPublicKeyImpl.java Fri Aug 22 18:59:07 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -56,10 +56,11 @@ + * Construct a key from its components. Used by the + * RSAKeyFactory and the RSAKeyPairGenerator. + */ +- public RSAPublicKeyImpl(BigInteger n, BigInteger e) throws InvalidKeyException { ++ public RSAPublicKeyImpl(BigInteger n, BigInteger e) ++ throws InvalidKeyException { + this.n = n; + this.e = e; +- RSAKeyFactory.checkKeyLength(n); ++ RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e); + // generate the encoding + algid = RSAPrivateCrtKeyImpl.rsaId; + try { +@@ -80,7 +81,7 @@ + */ + public RSAPublicKeyImpl(byte[] encoded) throws InvalidKeyException { + decode(encoded); +- RSAKeyFactory.checkKeyLength(n); ++ RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e); + } + + // see JCA doc +--- old/src/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java Fri Aug 22 18:59:11 2008 ++++ openjdk/jdk/src/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java Fri Aug 22 18:59:11 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -31,6 +31,7 @@ + import java.security.spec.RSAKeyGenParameterSpec; + + import sun.security.jca.JCAUtil; ++import sun.security.rsa.RSAKeyFactory; + + /** + * RSA keypair generator. +@@ -43,8 +44,8 @@ + public final class RSAKeyPairGenerator extends KeyPairGeneratorSpi { + + // Supported by Microsoft Base, Strong and Enhanced Cryptographic Providers +- private static final int KEY_SIZE_MIN = 512; // disallow MSCAPI min. of 384 +- private static final int KEY_SIZE_MAX = 16384; ++ static final int KEY_SIZE_MIN = 512; // disallow MSCAPI min. of 384 ++ static final int KEY_SIZE_MAX = 16384; + private static final int KEY_SIZE_DEFAULT = 1024; + + // size of the key to generate, KEY_SIZE_MIN <= keySize <= KEY_SIZE_MAX +@@ -59,7 +60,14 @@ + // random is always ignored + public void initialize(int keySize, SecureRandom random) { + +- checkKeySize(keySize); ++ try { ++ RSAKeyFactory.checkKeyLengths(keySize, null, ++ KEY_SIZE_MIN, KEY_SIZE_MAX); ++ } catch (InvalidKeyException e) { ++ throw new InvalidParameterException(e.getMessage()); ++ } ++ ++ this.keySize = keySize; + } + + // second initialize method. See JCA doc +@@ -67,9 +75,9 @@ + public void initialize(AlgorithmParameterSpec params, SecureRandom random) + throws InvalidAlgorithmParameterException { + ++ int tmpSize; + if (params == null) { +- checkKeySize(KEY_SIZE_DEFAULT); +- ++ tmpSize = KEY_SIZE_DEFAULT; + } else if (params instanceof RSAKeyGenParameterSpec) { + + if (((RSAKeyGenParameterSpec) params).getPublicExponent() != null) { +@@ -76,12 +84,22 @@ + throw new InvalidAlgorithmParameterException + ("Exponent parameter is not supported"); + } +- checkKeySize(((RSAKeyGenParameterSpec) params).getKeysize()); ++ tmpSize = ((RSAKeyGenParameterSpec) params).getKeysize(); + + } else { + throw new InvalidAlgorithmParameterException + ("Params must be an instance of RSAKeyGenParameterSpec"); + } ++ ++ try { ++ RSAKeyFactory.checkKeyLengths(tmpSize, null, ++ KEY_SIZE_MIN, KEY_SIZE_MAX); ++ } catch (InvalidKeyException e) { ++ throw new InvalidAlgorithmParameterException( ++ "Invalid Key sizes", e); ++ } ++ ++ this.keySize = tmpSize; + } + + // generate the keypair. See JCA doc +@@ -95,18 +113,6 @@ + return new KeyPair(keys.getPublic(), keys.getPrivate()); + } + +- private void checkKeySize(int keySize) throws InvalidParameterException { +- if (keySize < KEY_SIZE_MIN) { +- throw new InvalidParameterException +- ("Key size must be at least " + KEY_SIZE_MIN + " bits"); +- } +- if (keySize > KEY_SIZE_MAX) { +- throw new InvalidParameterException +- ("Key size must be " + KEY_SIZE_MAX + " bits or less"); +- } +- this.keySize = keySize; +- } +- + private static native RSAKeyPair generateRSAKeyPair(int keySize, + String keyContainerName); + } +--- old/src/windows/classes/sun/security/mscapi/RSASignature.java Fri Aug 22 18:59:18 2008 ++++ openjdk/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java Fri Aug 22 18:59:17 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -38,7 +38,10 @@ + import java.security.Signature; + import java.security.SignatureSpi; + import java.security.SignatureException; ++import java.math.BigInteger; + ++import sun.security.rsa.RSAKeyFactory; ++ + /** + * RSA signature implementation. Supports RSA signing using PKCS#1 v1.5 padding. + * +@@ -124,8 +127,17 @@ + + // convert key to MSCAPI format + +- byte[] modulusBytes = rsaKey.getModulus().toByteArray(); ++ BigInteger modulus = rsaKey.getModulus(); ++ BigInteger exponent = rsaKey.getPublicExponent(); + ++ // Check against the local and global values to make sure ++ // the sizes are ok. Round up to the nearest byte. ++ RSAKeyFactory.checkKeyLengths(((modulus.bitLength() + 7) & ~7), ++ exponent, -1, RSAKeyPairGenerator.KEY_SIZE_MAX); ++ ++ byte[] modulusBytes = modulus.toByteArray(); ++ byte[] exponentBytes = exponent.toByteArray(); ++ + // Adjust key length due to sign bit + int keyBitLength = (modulusBytes[0] == 0) + ? (modulusBytes.length - 1) * 8 +@@ -132,8 +144,7 @@ + : modulusBytes.length * 8; + + byte[] keyBlob = generatePublicKeyBlob( +- keyBitLength, modulusBytes, +- rsaKey.getPublicExponent().toByteArray()); ++ keyBitLength, modulusBytes, exponentBytes); + + publicKey = importPublicKey(keyBlob, keyBitLength); + +@@ -166,13 +177,12 @@ + } + privateKey = (sun.security.mscapi.RSAPrivateKey) key; + +- // Determine byte length from bit length +- int keySize = (privateKey.bitLength() + 7) >> 3; ++ // Check against the local and global values to make sure ++ // the sizes are ok. Round up to nearest byte. ++ RSAKeyFactory.checkKeyLengths(((privateKey.bitLength() + 7) & ~7), ++ null, RSAKeyPairGenerator.KEY_SIZE_MIN, ++ RSAKeyPairGenerator.KEY_SIZE_MAX); + +- if (keySize < 64) +- throw new InvalidKeyException( +- "RSA keys must be at least 512 bits long"); +- + if (needsReset) { + messageDigest.reset(); + needsReset = false; diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6536193.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6536193.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,102 @@ +--- old/src/share/classes/com/sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java Tue Mar 3 11:34:51 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java Tue Mar 3 11:34:50 2009 +@@ -1,27 +1,3 @@ +-/* +- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. +- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +- * +- * This code is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License version 2 only, as +- * published by the Free Software Foundation. Sun designates this +- * particular file as subject to the "Classpath" exception as provided +- * by Sun in the LICENSE file that accompanied this code. +- * +- * This code is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +- * version 2 for more details (a copy is included in the LICENSE file that +- * accompanied this code). +- * +- * You should have received a copy of the GNU General Public License version +- * 2 along with this work; if not, write to the Free Software Foundation, +- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +- * +- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +- * CA 95054 USA or visit www.sun.com if you need additional information or +- * have any questions. +- */ + package com.sun.xml.internal.bind.v2.runtime.output; + + import java.io.IOException; +@@ -32,6 +8,7 @@ + import com.sun.xml.internal.bind.DatatypeConverterImpl; + import com.sun.xml.internal.bind.v2.runtime.Name; + import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; ++import com.sun.xml.internal.bind.v2.runtime.MarshallerImpl; + + import org.xml.sax.SAXException; + +@@ -81,6 +58,11 @@ + protected boolean closeStartTagPending = false; + + /** ++ * @see MarshallerImpl#header ++ */ ++ private String header; ++ ++ /** + * + * @param localNames + * local names encoded in UTF-8. +@@ -92,6 +74,10 @@ + prefixes[i] = new Encoded(); + } + ++ public void setHeader(String header) { ++ this.header = header; ++ } ++ + @Override + public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException { + super.startDocument(serializer, fragment,nsUriIndex2prefixIndex,nsContext); +@@ -100,6 +86,10 @@ + if(!fragment) { + write(XML_DECL); + } ++ if(header!=null) { ++ textBuffer.set(header); ++ textBuffer.write(this); ++ } + } + + public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { +@@ -383,11 +373,23 @@ + return buf; + } + +- private static final byte[] XMLNS_EQUALS = toBytes(" xmlns=\""); +- private static final byte[] XMLNS_COLON = toBytes(" xmlns:"); +- private static final byte[] EQUALS = toBytes("=\""); +- private static final byte[] CLOSE_TAG = toBytes(""); ++ // per instance copy to prevent an attack where malicious OutputStream ++ // rewrites the byte array. ++ private final byte[] XMLNS_EQUALS = _XMLNS_EQUALS.clone(); ++ private final byte[] XMLNS_COLON = _XMLNS_COLON.clone(); ++ private final byte[] EQUALS = _EQUALS.clone(); ++ private final byte[] CLOSE_TAG = _CLOSE_TAG.clone(); ++ private final byte[] EMPTY_TAG = _EMPTY_TAG.clone(); ++ private final byte[] XML_DECL = _XML_DECL.clone(); ++ ++ // masters ++ private static final byte[] _XMLNS_EQUALS = toBytes(" xmlns=\""); ++ private static final byte[] _XMLNS_COLON = toBytes(" xmlns:"); ++ private static final byte[] _EQUALS = toBytes("=\""); ++ private static final byte[] _CLOSE_TAG = toBytes(""); ++ private static final byte[] _XML_DECL = toBytes(""); ++ ++ // no need to copy + private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; +- private static final byte[] XML_DECL = toBytes(""); + } diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6588160.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6588160.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,42 @@ +--- /export/home/max/ws/jdk6-open/jdk/webrev/src/share/classes/sun/security/krb5/KrbKdcReq.java- Sun Aug 31 20:04:55 2008 ++++ openjdk/jdk/src/share/classes/sun/security/krb5/KrbKdcReq.java Sun Aug 31 19:33:19 2008 +@@ -271,10 +271,11 @@ + + port + ", timeout=" + + timeout + + ",Attempt =" + i + + ", #bytes=" + obuf.length); + } ++ try { + /* + * Send the data to the kdc. + */ + + kdcClient.send(obuf); +@@ -293,11 +294,14 @@ + if (i == DEFAULT_KDC_RETRY_LIMIT) { + ibuf = null; + throw se; + } + } ++ } finally { ++ kdcClient.close(); + } ++ } + } + return ibuf; + } + } + +--- /export/home/max/ws/jdk6-open/jdk/webrev/src/share/classes/sun/security/krb5/internal/UDPClient.java- Sun Aug 31 20:04:55 2008 ++++ openjdk/jdk/src/share/classes/sun/security/krb5/internal/UDPClient.java Sun Aug 31 20:02:07 2008 +@@ -90,6 +90,9 @@ + System.arraycopy(dgPacketIn.getData(), 0, data, 0, + dgPacketIn.getLength()); + return data; + } + ++ public void close() { ++ dgSocket.close(); ++ } + } + diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6592792.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6592792.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,228 @@ +--- old/src/share/classes/com/sun/xml/internal/ws/spi/ProviderImpl.java Tue Oct 21 15:06:46 2008 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/ws/spi/ProviderImpl.java Tue Oct 21 15:06:46 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -56,6 +56,8 @@ + import javax.xml.ws.spi.ServiceDelegate; + import javax.xml.ws.wsaddressing.W3CEndpointReference; + import java.net.URL; ++import java.security.AccessController; ++import java.security.PrivilegedAction; + import java.util.List; + + /** +@@ -94,14 +96,20 @@ + return endpoint; + } + +- public EndpointReference readEndpointReference(Source eprInfoset) { +- Unmarshaller unmarshaller; +- try { +- unmarshaller = eprjc.createUnmarshaller(); +- return (EndpointReference) unmarshaller.unmarshal(eprInfoset); +- } catch (JAXBException e) { +- throw new WebServiceException("Error creating Marshaller or marshalling.", e); +- } ++ public EndpointReference readEndpointReference(final Source eprInfoset) { ++ // EPR constructors are private, so we need privilege escalation. ++ // this unmarshalling can only access instances of a fixed, known set of classes, ++ // so doing that shouldn't introduce security vulnerability. ++ return AccessController.doPrivileged(new PrivilegedAction() { ++ public EndpointReference run() { ++ try { ++ Unmarshaller unmarshaller = eprjc.createUnmarshaller(); ++ return (EndpointReference) unmarshaller.unmarshal(eprInfoset); ++ } catch (JAXBException e) { ++ throw new WebServiceException("Error creating Marshaller or marshalling.", e); ++ } ++ } ++ }); + } + + public T getPort(EndpointReference endpointReference, Class clazz, WebServiceFeature... webServiceFeatures) { +@@ -185,10 +193,17 @@ + } + + private static JAXBContext getEPRJaxbContext() { +- try { +- return JAXBContext.newInstance(MemberSubmissionEndpointReference.class, W3CEndpointReference.class); +- } catch (JAXBException e) { +- throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e); +- } ++ // EPRs have package and private fields, so we need privilege escalation. ++ // this access only fixed, known set of classes, so doing that ++ // shouldn't introduce security vulnerability. ++ return AccessController.doPrivileged(new PrivilegedAction() { ++ public JAXBContext run() { ++ try { ++ return JAXBContext.newInstance(MemberSubmissionEndpointReference.class, W3CEndpointReference.class); ++ } catch (JAXBException e) { ++ throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e); ++ } ++ } ++ }); + } + } +--- old/src/share/classes/javax/xml/bind/ContextFinder.java Tue Oct 21 15:06:50 2008 ++++ openjdk/jaxws/src/share/classes/javax/xml/bind/ContextFinder.java Tue Oct 21 15:06:49 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -130,12 +130,7 @@ + throws JAXBException + { + try { +- Class spiClass; +- if (classLoader == null) { +- spiClass = Class.forName(className); +- } else { +- spiClass = classLoader.loadClass(className); +- } ++ Class spiClass = safeLoadClass(className,classLoader); + + /* + * javax.xml.bind.context.factory points to a class which has a +@@ -207,11 +202,7 @@ + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Class spi; + try { +- logger.fine("Trying to load "+className); +- if (cl != null) +- spi = cl.loadClass(className); +- else +- spi = Class.forName(className); ++ spi = safeLoadClass(className,cl); + } catch (ClassNotFoundException e) { + throw new JAXBException(e); + } +@@ -488,4 +479,31 @@ + * For this reason, we have to hard-code the class name into the API. + */ + private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory"; ++ ++ /** ++ * Loads the class, provided that the calling thread has an access to the class being loaded. ++ */ ++ private static Class safeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { ++ logger.fine("Trying to load "+className); ++ try { ++ // make sure that the current thread has an access to the package of the given name. ++ SecurityManager s = System.getSecurityManager(); ++ if (s != null) { ++ int i = className.lastIndexOf('.'); ++ if (i != -1) { ++ s.checkPackageAccess(className.substring(0,i)); ++ } ++ } ++ ++ if (classLoader == null) ++ return Class.forName(className); ++ else ++ return classLoader.loadClass(className); ++ } catch (SecurityException se) { ++ // anyone can access the platform default factory class without permission ++ if (PLATFORM_DEFAULT_FACTORY_CLASS.equals(className)) ++ return Class.forName(className); ++ throw se; ++ } ++ } + } +--- old/src/share/classes/javax/xml/ws/spi/FactoryFinder.java Tue Oct 21 15:06:52 2008 ++++ openjdk/jaxws/src/share/classes/javax/xml/ws/spi/FactoryFinder.java Tue Oct 21 15:06:52 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -47,12 +47,7 @@ + ClassLoader classLoader) + { + try { +- Class spiClass; +- if (classLoader == null) { +- spiClass = Class.forName(className); +- } else { +- spiClass = classLoader.loadClass(className); +- } ++ Class spiClass = safeLoadClass(className, classLoader); + return spiClass.newInstance(); + } catch (ClassNotFoundException x) { + throw new WebServiceException( +@@ -152,4 +147,33 @@ + + return newInstance(fallbackClassName, classLoader); + } ++ ++ ++ private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.ws.spi.ProviderImpl"; ++ ++ /** ++ * Loads the class, provided that the calling thread has an access to the class being loaded. ++ */ ++ private static Class safeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { ++ try { ++ // make sure that the current thread has an access to the package of the given name. ++ SecurityManager s = System.getSecurityManager(); ++ if (s != null) { ++ int i = className.lastIndexOf('.'); ++ if (i != -1) { ++ s.checkPackageAccess(className.substring(0,i)); ++ } ++ } ++ ++ if (classLoader == null) ++ return Class.forName(className); ++ else ++ return classLoader.loadClass(className); ++ } catch (SecurityException se) { ++ // anyone can access the platform default factory class without permission ++ if (PLATFORM_DEFAULT_FACTORY_CLASS.equals(className)) ++ return Class.forName(className); ++ throw se; ++ } ++ } + } +--- old/src/share/lib/security/java.security Tue Oct 21 15:09:46 2008 ++++ openjdk/jdk/src/share/lib/security/java.security Tue Oct 21 15:09:46 2008 +@@ -127,7 +127,7 @@ + # passed to checkPackageAccess unless the + # corresponding RuntimePermission ("accessClassInPackage."+package) has + # been granted. +-package.access=sun. ++package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind. + + # + # List of comma-separated packages that start with or equal this string +--- old/src/share/lib/security/java.security-solaris Tue Oct 21 15:09:49 2008 ++++ openjdk/jdk/src/share/lib/security/java.security-solaris Tue Oct 21 15:09:49 2008 +@@ -128,7 +128,7 @@ + # passed to checkPackageAccess unless the + # corresponding RuntimePermission ("accessClassInPackage."+package) has + # been granted. +-package.access=sun. ++package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind. + + # + # List of comma-separated packages that start with or equal this string +--- old/src/share/lib/security/java.security-windows Tue Oct 21 15:09:52 2008 ++++ openjdk/jdk/src/share/lib/security/java.security-windows Tue Oct 21 15:09:52 2008 +@@ -128,7 +128,7 @@ + # passed to checkPackageAccess unless the + # corresponding RuntimePermission ("accessClassInPackage."+package) has + # been granted. +-package.access=sun. ++package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind. + + # + # List of comma-separated packages that start with or equal this string diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6610888.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6610888.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,58 @@ +--- old/src/share/classes/javax/management/monitor/Monitor.java Mon Mar 9 17:21:12 2009 ++++ openjdk/jdk/src/share/classes/javax/management/monitor/Monitor.java Mon Mar 9 17:21:11 2009 +@@ -37,6 +37,7 @@ + import java.security.AccessControlContext; + import java.security.AccessController; + import java.security.PrivilegedAction; ++import java.security.ProtectionDomain; + import java.util.List; + import java.util.concurrent.CopyOnWriteArrayList; + import java.util.concurrent.ExecutorService; +@@ -170,7 +171,10 @@ + /** + * AccessControlContext of the Monitor.start() caller. + */ +- private AccessControlContext acc; ++ private static final AccessControlContext noPermissionsACC = ++ new AccessControlContext( ++ new ProtectionDomain[] {new ProtectionDomain(null, null)}); ++ private volatile AccessControlContext acc = noPermissionsACC; + + /** + * Scheduler Service. +@@ -755,7 +759,7 @@ + + // Reset the AccessControlContext. + // +- acc = null; ++ acc = noPermissionsACC; + + // Reset the complex type attribute information + // such that it is recalculated again. +@@ -1555,10 +1559,12 @@ + + public void run() { + final ScheduledFuture sf; ++ final AccessControlContext ac; + synchronized (Monitor.this) { + sf = Monitor.this.schedulerFuture; ++ ac = Monitor.this.acc; + } +- AccessController.doPrivileged(new PrivilegedAction() { ++ PrivilegedAction action = new PrivilegedAction() { + public Void run() { + if (Monitor.this.isActive()) { + final int an[] = alreadyNotifieds; +@@ -1571,7 +1577,11 @@ + } + return null; + } +- }, Monitor.this.acc); ++ }; ++ if (ac == null) { ++ throw new SecurityException("AccessControlContext cannot be null"); ++ } ++ AccessController.doPrivileged(action, ac); + synchronized (Monitor.this) { + if (Monitor.this.isActive() && + Monitor.this.schedulerFuture == sf) { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6610896.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6610896.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,189 @@ +--- old/src/share/classes/javax/management/monitor/Monitor.java Mon Mar 9 16:53:02 2009 ++++ openjdk/jdk/src/share/classes/javax/management/monitor/Monitor.java Mon Mar 9 16:53:01 2009 +@@ -38,8 +38,9 @@ + import java.security.AccessController; + import java.security.PrivilegedAction; + import java.util.List; ++import java.util.Map; ++import java.util.WeakHashMap; + import java.util.concurrent.CopyOnWriteArrayList; +-import java.util.concurrent.ExecutorService; + import java.util.concurrent.Executors; + import java.util.concurrent.Future; + import java.util.concurrent.LinkedBlockingQueue; +@@ -180,14 +181,20 @@ + new DaemonThreadFactory("Scheduler")); + + /** +- * Maximum Pool Size ++ * Map containing the thread pool executor per thread group. + */ +- private static final int maximumPoolSize; ++ private static final Map executors = ++ new WeakHashMap(); + + /** +- * Executor Service. ++ * Lock for executors map. + */ +- private static final ExecutorService executor; ++ private static final Object executorsLock = new Object(); ++ ++ /** ++ * Maximum Pool Size ++ */ ++ private static final int maximumPoolSize; + static { + final String maximumPoolSizeSysProp = "jmx.x.monitor.maximum.pool.size"; + final String maximumPoolSizeStr = AccessController.doPrivileged( +@@ -217,22 +224,9 @@ + maximumPoolSize = maximumPoolSizeTmp; + } + } +- executor = new ThreadPoolExecutor( +- maximumPoolSize, +- maximumPoolSize, +- 60L, +- TimeUnit.SECONDS, +- new LinkedBlockingQueue(), +- new DaemonThreadFactory("Executor")); +- ((ThreadPoolExecutor)executor).allowCoreThreadTimeOut(true); + } + + /** +- * Monitor task to be executed by the Executor Service. +- */ +- private final MonitorTask monitorTask = new MonitorTask(); +- +- /** + * Future associated to the current monitor task. + */ + private Future monitorFuture; +@@ -240,7 +234,7 @@ + /** + * Scheduler task to be executed by the Scheduler Service. + */ +- private final SchedulerTask schedulerTask = new SchedulerTask(monitorTask); ++ private final SchedulerTask schedulerTask = new SchedulerTask(); + + /** + * ScheduledFuture associated to the current scheduler task. +@@ -726,6 +720,7 @@ + // Start the scheduler. + // + cleanupFutures(); ++ schedulerTask.setMonitorTask(new MonitorTask()); + schedulerFuture = scheduler.schedule(schedulerTask, + getGranularityPeriod(), + TimeUnit.MILLISECONDS); +@@ -1505,7 +1500,7 @@ + */ + private class SchedulerTask implements Runnable { + +- private Runnable task = null; ++ private MonitorTask task; + + /* + * ------------------------------------------ +@@ -1513,7 +1508,16 @@ + * ------------------------------------------ + */ + +- public SchedulerTask(Runnable task) { ++ public SchedulerTask() { ++ } ++ ++ /* ++ * ------------------------------------------ ++ * GETTERS/SETTERS ++ * ------------------------------------------ ++ */ ++ ++ public void setMonitorTask(MonitorTask task) { + this.task = task; + } + +@@ -1525,7 +1529,7 @@ + + public void run() { + synchronized (Monitor.this) { +- Monitor.this.monitorFuture = executor.submit(task); ++ Monitor.this.monitorFuture = task.submit(); + } + } + } +@@ -1538,6 +1542,8 @@ + */ + private class MonitorTask implements Runnable { + ++ private ThreadPoolExecutor executor; ++ + /* + * ------------------------------------------ + * CONSTRUCTORS +@@ -1545,6 +1551,38 @@ + */ + + public MonitorTask() { ++ // Find out if there's already an existing executor for the calling ++ // thread and reuse it. Otherwise, create a new one and store it in ++ // the executors map. If there is a SecurityManager, the group of ++ // System.getSecurityManager() is used, else the group of the thread ++ // instantiating this MonitorTask, i.e. the group of the thread that ++ // calls "Monitor.start()". ++ SecurityManager s = System.getSecurityManager(); ++ ThreadGroup group = (s != null) ? s.getThreadGroup() : ++ Thread.currentThread().getThreadGroup(); ++ synchronized (executorsLock) { ++ for (ThreadPoolExecutor e : executors.keySet()) { ++ DaemonThreadFactory tf = ++ (DaemonThreadFactory) e.getThreadFactory(); ++ ThreadGroup tg = tf.getThreadGroup(); ++ if (tg == group) { ++ executor = e; ++ break; ++ } ++ } ++ if (executor == null) { ++ executor = new ThreadPoolExecutor( ++ maximumPoolSize, ++ maximumPoolSize, ++ 60L, ++ TimeUnit.SECONDS, ++ new LinkedBlockingQueue(), ++ new DaemonThreadFactory("ThreadGroup<" + ++ group.getName() + "> Executor", group)); ++ executor.allowCoreThreadTimeOut(true); ++ executors.put(executor, null); ++ } ++ } + } + + /* +@@ -1553,6 +1591,10 @@ + * ------------------------------------------ + */ + ++ public Future submit() { ++ return executor.submit(this); ++ } ++ + public void run() { + final ScheduledFuture sf; + synchronized (Monitor.this) { +@@ -1611,6 +1653,15 @@ + namePrefix = "JMX Monitor " + poolName + " Pool [Thread-"; + } + ++ public DaemonThreadFactory(String poolName, ThreadGroup threadGroup) { ++ group = threadGroup; ++ namePrefix = "JMX Monitor " + poolName + " Pool [Thread-"; ++ } ++ ++ public ThreadGroup getThreadGroup() { ++ return group; ++ } ++ + public Thread newThread(Runnable r) { + Thread t = new Thread(group, + r, diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6630639.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6630639.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,31 @@ +--- old/src/share/classes/sun/net/httpserver/Request.java Wed Mar 4 03:29:39 2009 ++++ openjdk/jdk/src/share/classes/sun/net/httpserver/Request.java Wed Mar 4 03:29:39 2009 +@@ -52,6 +52,9 @@ + os = rawout; + do { + startLine = readLine(); ++ if (startLine == null) { ++ return; ++ } + /* skip blank lines */ + } while (startLine.equals ("")); + } +--- old/src/share/classes/sun/net/httpserver/ServerImpl.java Wed Mar 4 03:29:41 2009 ++++ openjdk/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java Wed Mar 4 03:29:41 2009 +@@ -437,6 +437,7 @@ + rawin = sslStreams.getInputStream(); + rawout = sslStreams.getOutputStream(); + engine = sslStreams.getSSLEngine(); ++ connection.sslStreams = sslStreams; + } else { + rawin = new BufferedInputStream( + new Request.ReadStream ( +@@ -446,6 +447,8 @@ + ServerImpl.this, chan + ); + } ++ connection.raw = rawin; ++ connection.rawout = rawout; + } + Request req = new Request (rawin, rawout); + requestLine = req.requestLine(); diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6631533.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6631533.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,184 @@ +--- old/src/share/classes/java/awt/color/ICC_Profile.java 2009-07-29 13:31:14.948600000 +0400 ++++ openjdk/jdk/src/share/classes/java/awt/color/ICC_Profile.java 2009-07-29 13:31:14.153000000 +0400 +@@ -944,15 +944,15 @@ + * and it does not permit read access to the given file. + */ + public static ICC_Profile getInstance(String fileName) throws IOException { +- ICC_Profile thisProfile; +- FileInputStream fis; ++ ICC_Profile thisProfile; ++ FileInputStream fis = null; + +- SecurityManager security = System.getSecurityManager(); +- if (security != null) { +- security.checkRead(fileName); +- } + +- if ((fis = openProfile(fileName)) == null) { ++ File f = getProfileFile(fileName); ++ if (f != null) { ++ fis = new FileInputStream(f); ++ } ++ if (fis == null) { + throw new IOException("Cannot open file " + fileName); + } + +@@ -1064,13 +1064,24 @@ + + + void activateDeferredProfile() { +- byte profileData[]; +- FileInputStream fis; +- String fileName = deferralInfo.filename; ++ byte profileData[]; ++ FileInputStream fis; ++ final String fileName = deferralInfo.filename; + + profileActivator = null; + deferralInfo = null; +- if ((fis = openProfile(fileName)) == null) { ++ PrivilegedAction pa = new PrivilegedAction() { ++ public FileInputStream run() { ++ File f = getStandardProfileFile(fileName); ++ if (f != null) { ++ try { ++ return new FileInputStream(f); ++ } catch (FileNotFoundException e) {} ++ } ++ return null; ++ } ++ }; ++ if ((fis = AccessController.doPrivileged(pa)) == null) { + throw new IllegalArgumentException("Cannot open file " + fileName); + } + try { +@@ -1765,66 +1776,88 @@ + * available, such as a profile for sRGB. Built-in profiles use .pf as + * the file name extension for profiles, e.g. sRGB.pf. + */ +- private static FileInputStream openProfile(final String fileName) { +- return (FileInputStream)java.security.AccessController.doPrivileged( +- new java.security.PrivilegedAction() { +- public Object run() { +- return privilegedOpenProfile(fileName); +- } +- }); +- } +- +- /* +- * this version is called from doPrivileged in privilegedOpenProfile. +- * the whole method is privileged! +- */ +- private static FileInputStream privilegedOpenProfile(String fileName) { +- FileInputStream fis = null; ++ private static File getProfileFile(String fileName) { + String path, dir, fullPath; + + File f = new File(fileName); /* try absolute file name */ +- ++ if (f.isAbsolute()) { ++ /* Rest of code has little sense for an absolute pathname, ++ so return here. */ ++ return f.isFile() ? f : null; ++ } + if ((!f.isFile()) && + ((path = System.getProperty("java.iccprofile.path")) != null)){ + /* try relative to java.iccprofile.path */ +- StringTokenizer st = +- new StringTokenizer(path, File.pathSeparator); +- while (st.hasMoreTokens() && (!f.isFile())) { +- dir = st.nextToken(); +- fullPath = dir + File.separatorChar + fileName; +- f = new File(fullPath); ++ StringTokenizer st = ++ new StringTokenizer(path, File.pathSeparator); ++ while (st.hasMoreTokens() && ((f == null) || (!f.isFile()))) { ++ dir = st.nextToken(); ++ fullPath = dir + File.separatorChar + fileName; ++ f = new File(fullPath); ++ if (!isChildOf(f, dir)) { ++ f = null; + } + } ++ } + +- if ((!f.isFile()) && ++ if (((f == null) || (!f.isFile())) && + ((path = System.getProperty("java.class.path")) != null)) { + /* try relative to java.class.path */ +- StringTokenizer st = +- new StringTokenizer(path, File.pathSeparator); +- while (st.hasMoreTokens() && (!f.isFile())) { +- dir = st.nextToken(); +- fullPath = dir + File.separatorChar + fileName; +- f = new File(fullPath); +- } +- } +- +- if (!f.isFile()) { /* try the directory of built-in profiles */ +- dir = System.getProperty("java.home") + +- File.separatorChar + "lib" + File.separatorChar + "cmm"; ++ StringTokenizer st = ++ new StringTokenizer(path, File.pathSeparator); ++ while (st.hasMoreTokens() && ((f == null) || (!f.isFile()))) { ++ dir = st.nextToken(); + fullPath = dir + File.separatorChar + fileName; + f = new File(fullPath); ++ if (!isChildOf(f, dir)) { ++ f = null; ++ } + } ++ } ++ if ((f == null) || (!f.isFile())) { ++ /* try the directory of built-in profiles */ ++ f = getStandardProfileFile(fileName); ++ } ++ if (f != null && f.isFile()) { ++ return f; ++ } ++ return null; ++ } + +- if (f.isFile()) { +- try { +- fis = new FileInputStream(f); +- } catch (FileNotFoundException e) { ++ /** ++ * Returns a file object corresponding to a built-in profile ++ * specified by fileName. ++ * If there is no built-in profile with such name, then the method ++ * returns null. ++ */ ++ private static File getStandardProfileFile(String fileName) { ++ String dir = System.getProperty("java.home") + ++ File.separatorChar + "lib" + File.separatorChar + "cmm"; ++ String fullPath = dir + File.separatorChar + fileName; ++ File f = new File(fullPath); ++ return (f.isFile() && isChildOf(f, dir)) ? f : null; ++ } ++ ++ /** ++ * Checks whether given file resides inside give directory. ++ */ ++ private static boolean isChildOf(File f, String dirName) { ++ try { ++ File dir = new File(dirName); ++ String canonicalDirName = dir.getCanonicalPath(); ++ if (!canonicalDirName.endsWith(File.separator)) { ++ canonicalDirName += File.separator; + } ++ String canonicalFileName = f.getCanonicalPath(); ++ return canonicalFileName.startsWith(canonicalDirName); ++ } catch (IOException e) { ++ /* we do not expect the IOException here, because invocation ++ * of this function is always preceeded by isFile() call. ++ */ ++ return false; + } +- return fis; + } + +- + /* + * Serialization support. + * diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6632445.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6632445.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,103 @@ +--- old/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java 2009-07-28 17:06:52.144000000 +0400 ++++ openjdk/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java 2009-07-28 17:06:51.488000000 +0400 +@@ -62,6 +62,8 @@ + + import java.io.*; + import java.nio.*; ++import java.security.AccessController; ++import java.security.PrivilegedAction; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.StringTokenizer; +@@ -502,12 +504,18 @@ + iis.reset(); + + try { +- if (metadata.colorSpace == PROFILE_LINKED) ++ if (metadata.colorSpace == PROFILE_LINKED && ++ isLinkedProfileAllowed() && ++ !isUncOrDevicePath(profile)) ++ { ++ String path = new String(profile, "windows-1252"); ++ + colorSpace = +- new ICC_ColorSpace(ICC_Profile.getInstance(new String(profile))); +- else ++ new ICC_ColorSpace(ICC_Profile.getInstance(path)); ++ } else { + colorSpace = + new ICC_ColorSpace(ICC_Profile.getInstance(profile)); ++ } + } catch (Exception e) { + colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); + } +@@ -1745,4 +1753,69 @@ + public void sequenceStarted(ImageReader src, int minIndex) {} + public void readAborted(ImageReader src) {} + } ++ ++ private static Boolean isLinkedProfileDisabled = null; ++ ++ private static boolean isLinkedProfileAllowed() { ++ if (isLinkedProfileDisabled == null) { ++ PrivilegedAction a = new PrivilegedAction() { ++ public Boolean run() { ++ return Boolean.getBoolean("sun.imageio.plugins.bmp.disableLinkedProfiles"); ++ } ++ }; ++ isLinkedProfileDisabled = AccessController.doPrivileged(a); ++ } ++ return !isLinkedProfileDisabled; ++ } ++ ++ private static Boolean isWindowsPlatform = null; ++ ++ /** ++ * Verifies whether the byte array contans a unc path. ++ * Non-UNC path examples: ++ * c:\path\to\file - simple notation ++ * \\?\c:\path\to\file - long notation ++ * ++ * UNC path examples: ++ * \\server\share - a UNC path in simple notation ++ * \\?\UNC\server\share - a UNC path in long notation ++ * \\.\some\device - a path to device. ++ */ ++ private static boolean isUncOrDevicePath(byte[] p) { ++ if (isWindowsPlatform == null) { ++ PrivilegedAction a = new PrivilegedAction() { ++ public Boolean run() { ++ String osname = System.getProperty("os.name"); ++ return (osname != null && ++ osname.toLowerCase().startsWith("win")); ++ } ++ }; ++ isWindowsPlatform = AccessController.doPrivileged(a); ++ } ++ ++ if (!isWindowsPlatform) { ++ /* no need for the check on platforms except windows */ ++ return false; ++ } ++ ++ /* normalize prefix of the path */ ++ if (p[0] == '/') p[0] = '\\'; ++ if (p[1] == '/') p[1] = '\\'; ++ if (p[3] == '/') p[3] = '\\'; ++ ++ ++ if ((p[0] == '\\') && (p[1] == '\\')) { ++ if ((p[2] == '?') && (p[3] == '\\')) { ++ // long path: whether unc or local ++ return ((p[4] == 'U' || p[4] == 'u') && ++ (p[5] == 'N' || p[5] == 'n') && ++ (p[6] == 'C' || p[6] == 'c')); ++ } else { ++ // device path or short unc notation ++ return true; ++ } ++ } else { ++ return false; ++ } ++ } + } diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6632886.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6632886.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,502 @@ +--- old/src/share/classes/java/awt/Font.java Tue Mar 3 14:12:23 2009 ++++ openjdk/jdk/src/share/classes/java/awt/Font.java Tue Mar 3 14:12:23 2009 +@@ -37,6 +37,8 @@ + import java.awt.peer.FontPeer; + import java.io.*; + import java.lang.ref.SoftReference; ++import java.security.AccessController; ++import java.security.PrivilegedExceptionAction; + import java.text.AttributedCharacterIterator.Attribute; + import java.text.CharacterIterator; + import java.text.StringCharacterIterator; +@@ -51,6 +53,7 @@ + import sun.font.AttributeValues; + import sun.font.EAttribute; + import sun.font.CompositeFont; ++import sun.font.CreatedFontTracker; + import sun.font.Font2D; + import sun.font.Font2DHandle; + import sun.font.FontManager; +@@ -575,7 +578,8 @@ + } + + /* used to implement Font.createFont */ +- private Font(File fontFile, int fontFormat, boolean isCopy) ++ private Font(File fontFile, int fontFormat, ++ boolean isCopy, CreatedFontTracker tracker) + throws FontFormatException { + this.createdFont = true; + /* Font2D instances created by this method track their font file +@@ -582,7 +586,8 @@ + * so that when the Font2D is GC'd it can also remove the file. + */ + this.font2DHandle = +- FontManager.createFont2D(fontFile, fontFormat, isCopy).handle; ++ FontManager.createFont2D(fontFile, fontFormat, ++ isCopy, tracker).handle; + this.name = this.font2DHandle.font2D.getFontName(Locale.getDefault()); + this.style = Font.PLAIN; + this.size = 1; +@@ -788,6 +793,29 @@ + } + + /** ++ * Used with the byte count tracker for fonts created from streams. ++ * If a thread can create temp files anyway, no point in counting ++ * font bytes. ++ */ ++ private static boolean hasTempPermission() { ++ ++ if (System.getSecurityManager() == null) { ++ return true; ++ } ++ File f = null; ++ boolean hasPerm = false; ++ try { ++ f = File.createTempFile("+~JT", ".tmp", null); ++ f.delete(); ++ f = null; ++ hasPerm = true; ++ } catch (Throwable t) { ++ /* inc. any kind of SecurityException */ ++ } ++ return hasPerm; ++ } ++ ++ /** + * Returns a new Font using the specified font type + * and input data. The new Font is + * created with a point size of 1 and style {@link #PLAIN PLAIN}. +@@ -822,58 +850,96 @@ + fontFormat != Font.TYPE1_FONT) { + throw new IllegalArgumentException ("font format not recognized"); + } +- final InputStream fStream = fontStream; +- Object ret = java.security.AccessController.doPrivileged( +- new java.security.PrivilegedAction() { +- public Object run() { +- File tFile = null; +- FileOutputStream outStream = null; +- try { +- tFile = File.createTempFile("+~JF", ".tmp", null); +- /* Temp file deleted by font shutdown hook */ +- BufferedInputStream inStream = +- new BufferedInputStream(fStream); +- outStream = new FileOutputStream(tFile); +- int bytesRead = 0; +- int bufSize = 8192; +- byte [] buf = new byte[bufSize]; +- while (bytesRead != -1) { +- try { +- bytesRead = inStream.read(buf, 0, bufSize); +- } catch (Throwable t) { +- throw new IOException(); +- } +- if (bytesRead != -1) { +- outStream.write(buf, 0, bytesRead); +- } +- } +- /* don't close the input stream */ +- outStream.close(); +- } catch (IOException e) { +- if (outStream != null) { +- try { +- outStream.close(); +- } catch (Exception e1) { +- } +- } +- if (tFile != null) { +- try { +- tFile.delete(); +- } catch (Exception e2) { +- } +- } +- return e; +- } +- return tFile; +- } +- }); ++ boolean copiedFontData = false; + +- if (ret instanceof File) { +- return new Font((File)ret, fontFormat, true); +- } else if (ret instanceof IOException) { +- throw (IOException)ret; +- } else { +- throw new FontFormatException("Couldn't access font stream"); ++ try { ++ final File tFile = AccessController.doPrivileged( ++ new PrivilegedExceptionAction() { ++ public File run() throws IOException { ++ return File.createTempFile("+~JF", ".tmp", null); ++ } ++ } ++ ); ++ ++ int totalSize = 0; ++ CreatedFontTracker tracker = null; ++ try { ++ final OutputStream outStream = ++ AccessController.doPrivileged( ++ new PrivilegedExceptionAction() { ++ public OutputStream run() throws IOException { ++ return new FileOutputStream(tFile); ++ } ++ } ++ ); ++ if (!hasTempPermission()) { ++ tracker = CreatedFontTracker.getTracker(); ++ } ++ try { ++ byte[] buf = new byte[8192]; ++ for (;;) { ++ int bytesRead = fontStream.read(buf); ++ if (bytesRead < 0) { ++ break; ++ } ++ if (tracker != null) { ++ if (totalSize+bytesRead > tracker.MAX_FILE_SIZE) { ++ throw new IOException("File too big."); ++ } ++ if (totalSize+tracker.getNumBytes() > ++ tracker.MAX_TOTAL_BYTES) ++ { ++ throw new IOException("Total files too big."); ++ } ++ totalSize += bytesRead; ++ tracker.addBytes(bytesRead); ++ } ++ outStream.write(buf, 0, bytesRead); ++ } ++ /* don't close the input stream */ ++ } finally { ++ outStream.close(); ++ } ++ /* After all references to a Font2D are dropped, the file ++ * will be removed. To support long-lived AppContexts, ++ * we need to then decrement the byte count by the size ++ * of the file. ++ * If the data isn't a valid font, the implementation will ++ * delete the tmp file and decrement the byte count ++ * in the tracker object before returning from the ++ * constructor, so we can set 'copiedFontData' to true here ++ * without waiting for the results of that constructor. ++ */ ++ copiedFontData = true; ++ Font font = new Font(tFile, fontFormat, true, tracker); ++ return font; ++ } finally { ++ if (!copiedFontData) { ++ if (tracker != null) { ++ tracker.subBytes(totalSize); ++ } ++ AccessController.doPrivileged( ++ new PrivilegedExceptionAction() { ++ public Void run() { ++ tFile.delete(); ++ return null; ++ } ++ } ++ ); ++ } ++ } ++ } catch (Throwable t) { ++ if (t instanceof FontFormatException) { ++ throw (FontFormatException)t; ++ } ++ if (t instanceof IOException) { ++ throw (IOException)t; ++ } ++ Throwable cause = t.getCause(); ++ if (cause instanceof FontFormatException) { ++ throw (FontFormatException)cause; ++ } ++ throw new IOException("Problem reading font data."); + } + } + +@@ -913,6 +979,9 @@ + */ + public static Font createFont(int fontFormat, File fontFile) + throws java.awt.FontFormatException, java.io.IOException { ++ ++ fontFile = new File(fontFile.getPath()); ++ + if (fontFormat != Font.TRUETYPE_FONT && + fontFormat != Font.TYPE1_FONT) { + throw new IllegalArgumentException ("font format not recognized"); +@@ -926,7 +995,7 @@ + if (!fontFile.canRead()) { + throw new IOException("Can't read " + fontFile); + } +- return new Font(fontFile, fontFormat, false); ++ return new Font(fontFile, fontFormat, false, null); + } + + /** +--- old/src/share/classes/sun/font/FileFont.java Tue Mar 3 14:12:26 2009 ++++ openjdk/jdk/src/share/classes/sun/font/FileFont.java Tue Mar 3 14:12:25 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -125,9 +125,9 @@ + return true; + } + +- void setFileToRemove(File file) { ++ void setFileToRemove(File file, CreatedFontTracker tracker) { + Disposer.addObjectRecord(this, +- new CreatedFontFileDisposerRecord(file)); ++ new CreatedFontFileDisposerRecord(file, tracker)); + } + + /* This is called when a font scaler is determined to +@@ -246,12 +246,16 @@ + return getScaler().getUnitsPerEm(); + } + +- private static class CreatedFontFileDisposerRecord implements DisposerRecord { ++ private static class CreatedFontFileDisposerRecord ++ implements DisposerRecord { + + File fontFile = null; ++ CreatedFontTracker tracker; + +- private CreatedFontFileDisposerRecord(File file) { ++ private CreatedFontFileDisposerRecord(File file, ++ CreatedFontTracker tracker) { + fontFile = file; ++ this.tracker = tracker; + } + + public void dispose() { +@@ -260,6 +264,9 @@ + public Object run() { + if (fontFile != null) { + try { ++ if (tracker != null) { ++ tracker.subBytes((int)fontFile.length()); ++ } + /* REMIND: is it possible that the file is + * still open? It will be closed when the + * font2D is disposed but could this code +--- old/src/share/classes/sun/font/FontManager.java Tue Mar 3 14:12:29 2009 ++++ openjdk/jdk/src/share/classes/sun/font/FontManager.java Tue Mar 3 14:12:28 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -2331,12 +2331,14 @@ + static Vector tmpFontFiles = null; + + public static Font2D createFont2D(File fontFile, int fontFormat, +- boolean isCopy) ++ boolean isCopy, ++ CreatedFontTracker tracker) + throws FontFormatException { + + String fontFilePath = fontFile.getPath(); + FileFont font2D = null; + final File fFile = fontFile; ++ final CreatedFontTracker _tracker = tracker; + try { + switch (fontFormat) { + case Font.TRUETYPE_FONT: +@@ -2343,7 +2345,7 @@ + font2D = new TrueTypeFont(fontFilePath, null, 0, true); + break; + case Font.TYPE1_FONT: +- font2D = new Type1Font(fontFilePath, null); ++ font2D = new Type1Font(fontFilePath, null, isCopy); + break; + default: + throw new FontFormatException("Unrecognised Font Format"); +@@ -2353,6 +2355,9 @@ + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Object run() { ++ if (_tracker != null) { ++ _tracker.subBytes((int)fFile.length()); ++ } + fFile.delete(); + return null; + } +@@ -2361,7 +2366,7 @@ + throw(e); + } + if (isCopy) { +- font2D.setFileToRemove(fontFile); ++ font2D.setFileToRemove(fontFile, tracker); + synchronized (FontManager.class) { + + if (tmpFontFiles == null) { +--- /dev/null Tue Mar 3 14:12:32 2009 ++++ openjdk/jdk/src/share/classes/sun/font/CreatedFontTracker.java Tue Mar 3 14:12:31 2009 +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Sun designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Sun in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, ++ * CA 95054 USA or visit www.sun.com if you need additional information or ++ * have any questions. ++ */ ++ ++package sun.font; ++ ++public class CreatedFontTracker { ++ ++ public static final int MAX_FILE_SIZE = 32 * 1024 * 1024; ++ public static final int MAX_TOTAL_BYTES = 10 * MAX_FILE_SIZE; ++ ++ static int numBytes; ++ static CreatedFontTracker tracker; ++ ++ public static synchronized CreatedFontTracker getTracker() { ++ if (tracker == null) { ++ tracker = new CreatedFontTracker(); ++ } ++ return tracker; ++ } ++ ++ public synchronized int getNumBytes() { ++ return numBytes; ++ } ++ ++ public synchronized void addBytes(int sz) { ++ numBytes += sz; ++ } ++ ++ public synchronized void subBytes(int sz) { ++ numBytes -= sz; ++ } ++} +--- old/src/share/classes/sun/font/TrueTypeFont.java Tue Mar 3 14:12:34 2009 ++++ openjdk/jdk/src/share/classes/sun/font/TrueTypeFont.java Tue Mar 3 14:12:33 2009 +@@ -174,8 +174,17 @@ + super(platname, nativeNames); + useJavaRasterizer = javaRasterizer; + fontRank = Font2D.TTF_RANK; +- verify(); +- init(fIndex); ++ try { ++ verify(); ++ init(fIndex); ++ } catch (Throwable t) { ++ close(); ++ if (t instanceof FontFormatException) { ++ throw (FontFormatException)t; ++ } else { ++ throw new FontFormatException("Unexpected runtime exception."); ++ } ++ } + Disposer.addObjectRecord(this, disposerRecord); + } + +--- old/src/share/classes/sun/font/Type1Font.java Tue Mar 3 14:12:37 2009 ++++ openjdk/jdk/src/share/classes/sun/font/Type1Font.java Tue Mar 3 14:12:36 2009 +@@ -39,6 +39,7 @@ + import java.nio.channels.ClosedChannelException; + import java.nio.channels.FileChannel; + import sun.java2d.Disposer; ++import sun.java2d.DisposerRecord; + import java.util.HashSet; + import java.util.HashMap; + import java.awt.Font; +@@ -76,6 +77,27 @@ + */ + public class Type1Font extends FileFont { + ++ private static class T1DisposerRecord implements DisposerRecord { ++ String fileName = null; ++ ++ T1DisposerRecord(String name) { ++ fileName = name; ++ } ++ ++ public synchronized void dispose() { ++ java.security.AccessController.doPrivileged( ++ new java.security.PrivilegedAction() { ++ public Object run() { ++ ++ if (fileName != null) { ++ (new java.io.File(fileName)).delete(); ++ } ++ return null; ++ } ++ }); ++ } ++ } ++ + WeakReference bufferRef = new WeakReference(null); + + private String psName = null; +@@ -125,6 +147,17 @@ + + + /** ++ * Constructs a Type1 Font. ++ * @param platname - Platform identifier of the font. Typically file name. ++ * @param nativeNames - Native names - typically XLFDs on Unix. ++ */ ++ public Type1Font(String platname, Object nativeNames) ++ throws FontFormatException { ++ ++ this(platname, nativeNames, false); ++ } ++ ++ /** + * - does basic verification of the file + * - reads the names (full, family). + * - determines the style of the font. +@@ -131,12 +164,25 @@ + * @throws FontFormatException - if the font can't be opened + * or fails verification, or there's no usable cmap + */ +- public Type1Font(String platname, Object nativeNames) ++ public Type1Font(String platname, Object nativeNames, boolean createdCopy) + throws FontFormatException { + super(platname, nativeNames); + fontRank = Font2D.TYPE1_RANK; + checkedNatives = true; +- verify(); ++ try { ++ verify(); ++ } catch (Throwable t) { ++ if (createdCopy) { ++ T1DisposerRecord ref = new T1DisposerRecord(platname); ++ Disposer.addObjectRecord(bufferRef, ref); ++ bufferRef = null; ++ } ++ if (t instanceof FontFormatException) { ++ throw (FontFormatException)t; ++ } else { ++ throw new FontFormatException("Unexpected runtime exception."); ++ } ++ } + } + + private synchronized ByteBuffer getBuffer() throws FontFormatException { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6636360.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6636360.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,66 @@ +--- old/src/cpu/sparc/vm/vtableStubs_sparc.cpp Mon Mar 9 10:11:37 2009 ++++ openjdk/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp Mon Mar 9 10:11:37 2009 +@@ -1,5 +1,5 @@ + #ifdef USE_PRAGMA_IDENT_SRC +-#pragma ident "@(#)vtableStubs_sparc.cpp 1.58 07/07/19 12:19:09 JVM" ++#pragma ident "@(#)vtableStubs_sparc.cpp 1.58 07/07/19 12:19:09 JVM" + #endif + /* + * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. +@@ -22,7 +22,7 @@ + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. +- * ++ * + */ + + #include "incls/_precompiled.incl" +@@ -68,7 +68,7 @@ + // set methodOop (in case of interpreted method), and destination address + int entry_offset = instanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); + #ifndef PRODUCT +- if (DebugVtables) { ++ if (DebugVtables) { + Label L; + // check offset vs vtable length + __ ld(G3_scratch, instanceKlass::vtable_length_offset()*wordSize, G5); +@@ -155,7 +155,7 @@ + #endif /* PRODUCT */ + + // load start of itable entries into L0 register +- const int base = instanceKlass::vtable_start_offset() * wordSize; ++ const int base = instanceKlass::vtable_start_offset() * wordSize; + __ ld(Address(G3_klassOop, 0, instanceKlass::vtable_length_offset() * wordSize), L0); + + // %%% Could store the aligned, prescaled offset in the klassoop. +@@ -193,12 +193,16 @@ + // Compute itableMethodEntry and get methodOop(G5_method) and entrypoint(L0) for compiler + const int method_offset = (itableMethodEntry::size() * wordSize * vtable_index) + itableMethodEntry::method_offset_in_bytes(); + __ add(G3_klassOop, L0, L1); +- __ ld_ptr(L1, method_offset, G5_method); ++ if (__ is_simm13(method_offset)) { ++ __ ld_ptr(L1, method_offset, G5_method); ++ } else { ++ __ set(method_offset, G5_method); ++ __ ld_ptr(L1, G5_method, G5_method); ++ } + + #ifndef PRODUCT + if (DebugVtables) { + Label L01; +- __ ld_ptr(L1, method_offset, G5_method); + __ bpr(Assembler::rc_nz, false, Assembler::pt, G5_method, L01); + __ delayed()->nop(); + __ stop("methodOop is null"); +@@ -243,8 +247,8 @@ + const int basic = 5*BytesPerInstWord; // ld;ld;ld,jmp,nop + return basic + slop; + } else { +- // save, ld, ld, sll, and, add, add, ld, cmp, br, add, ld, add, ld, ld, jmp, restore, sethi, jmpl, restore +- const int basic = (20 LP64_ONLY(+ 6)) * BytesPerInstWord; ++ // save, ld, ld, sll, and, add, add, ld, cmp, br, add, ld, add, sethi, add, ld, ld, jmp, restore, sethi, jmpl, restore ++ const int basic = (22 LP64_ONLY(+ 12)) * BytesPerInstWord; // worst case extra 6 bytes for each sethi in 64-bit mode + return (basic + slop); + } + } diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6636650.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6636650.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,137 @@ +--- old/src/share/classes/java/lang/ClassLoader.java Fri Jul 31 15:59:47 2009 ++++ openjdk/jdk/src/share/classes/java/lang/ClassLoader.java Fri Jul 31 15:59:46 200 +@@ -163,11 +163,6 @@ + registerNatives(); + } + +- // If initialization succeed this is set to true and security checks will +- // succeed. Otherwise the object is not initialized and the object is +- // useless. +- private boolean initialized = false; +- + // The parent class loader for delegation + private ClassLoader parent; + +@@ -193,6 +188,18 @@ + // to its corresponding Package object. + private HashMap packages = new HashMap(); + ++ private static Void checkCreateClassLoader() { ++ SecurityManager security = System.getSecurityManager(); ++ if (security != null) { ++ security.checkCreateClassLoader(); ++ } ++ return null; ++ } ++ ++ private ClassLoader(Void unused, ClassLoader parent) { ++ this.parent = parent; ++ } ++ + /** + * Creates a new class loader using the specified parent class loader for + * delegation. +@@ -213,12 +220,7 @@ + * @since 1.2 + */ + protected ClassLoader(ClassLoader parent) { +- SecurityManager security = System.getSecurityManager(); +- if (security != null) { +- security.checkCreateClassLoader(); +- } +- this.parent = parent; +- initialized = true; ++ this(checkCreateClassLoader(), parent); + } + + /** +@@ -237,15 +239,9 @@ + * of a new class loader. + */ + protected ClassLoader() { +- SecurityManager security = System.getSecurityManager(); +- if (security != null) { +- security.checkCreateClassLoader(); +- } +- this.parent = getSystemClassLoader(); +- initialized = true; ++ this(checkCreateClassLoader(), getSystemClassLoader()); + } + +- + // -- Class -- + + /** +@@ -627,7 +623,6 @@ + ProtectionDomain protectionDomain) + throws ClassFormatError + { +- check(); + protectionDomain = preDefineClass(name, protectionDomain); + + Class c = null; +@@ -709,8 +704,6 @@ + ProtectionDomain protectionDomain) + throws ClassFormatError + { +- check(); +- + int len = b.remaining(); + + // Use byte[] if not a direct ByteBufer: +@@ -858,7 +851,6 @@ + * @see #defineClass(String, byte[], int, int) + */ + protected final void resolveClass(Class c) { +- check(); + resolveClass0(c); + } + +@@ -889,7 +881,6 @@ + protected final Class findSystemClass(String name) + throws ClassNotFoundException + { +- check(); + ClassLoader system = getSystemClassLoader(); + if (system == null) { + if (!checkName(name)) +@@ -902,7 +893,6 @@ + private Class findBootstrapClass0(String name) + throws ClassNotFoundException + { +- check(); + if (!checkName(name)) + throw new ClassNotFoundException(name); + return findBootstrapClass(name); +@@ -911,13 +901,6 @@ + private native Class findBootstrapClass(String name) + throws ClassNotFoundException; + +- // Check to make sure the class loader has been initialized. +- private void check() { +- if (!initialized) { +- throw new SecurityException("ClassLoader object not initialized"); +- } +- } +- + /** + * Returns the class with the given binary name if this + * loader has been recorded by the Java virtual machine as an initiating +@@ -933,7 +916,6 @@ + * @since 1.1 + */ + protected final Class findLoadedClass(String name) { +- check(); + if (!checkName(name)) + return null; + return findLoadedClass0(name); +@@ -954,11 +936,9 @@ + * @since 1.1 + */ + protected final void setSigners(Class c, Object[] signers) { +- check(); + c.setSigners(signers); + } + +- + // -- Resource -- diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6652463.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6652463.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,28 @@ +--- old/src/share/classes/javax/print/attribute/standard/MediaSize.java Tue Mar 3 10:16:15 2009 ++++ openjdk/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java Tue Mar 3 10:16:14 2009 +@@ -123,8 +123,10 @@ + if (x > y) { + throw new IllegalArgumentException("X dimension > Y dimension"); + } +- mediaName = media; +- mediaMap.put(mediaName, this); ++ if (media != null && mediaMap.get(media) == null) { ++ mediaName = media; ++ mediaMap.put(mediaName, this); ++ } + sizeVector.add(this); + } + +@@ -147,8 +149,10 @@ + if (x > y) { + throw new IllegalArgumentException("X dimension > Y dimension"); + } +- mediaName = media; +- mediaMap.put(mediaName, this); ++ if (media != null && mediaMap.get(media) == null) { ++ mediaName = media; ++ mediaMap.put(mediaName, this); ++ } + sizeVector.add(this); + } + diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6656633.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6656633.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,51 @@ +--- old/src/share/classes/javax/management/monitor/CounterMonitor.java Mon Mar 9 13:19:14 2009 ++++ openjdk/jdk/src/share/classes/javax/management/monitor/CounterMonitor.java Mon Mar 9 13:19:14 2009 +@@ -599,7 +599,7 @@ + */ + @Override + public MBeanNotificationInfo[] getNotificationInfo() { +- return notifsInfo; ++ return notifsInfo.clone(); + } + + /* +--- old/src/share/classes/javax/management/monitor/GaugeMonitor.java Mon Mar 9 13:19:16 2009 ++++ openjdk/jdk//src/share/classes/javax/management/monitor/GaugeMonitor.java Mon Mar 9 13:19:16 2009 +@@ -481,7 +481,7 @@ + */ + @Override + public MBeanNotificationInfo[] getNotificationInfo() { +- return notifsInfo; ++ return notifsInfo.clone(); + } + + /* +--- old/src/share/classes/javax/management/monitor/StringMonitor.java Mon Mar 9 13:19:18 2009 ++++ openjdk/jdk//src/share/classes/javax/management/monitor/StringMonitor.java Mon Mar 9 13:19:18 2009 +@@ -184,6 +184,7 @@ + * @return The derived gauge of the specified object. + * + */ ++ @Override + public synchronized String getDerivedGauge(ObjectName object) { + return (String) super.getDerivedGauge(object); + } +@@ -199,6 +200,7 @@ + * @return The derived gauge timestamp of the specified object. + * + */ ++ @Override + public synchronized long getDerivedGaugeTimeStamp(ObjectName object) { + return super.getDerivedGaugeTimeStamp(object); + } +@@ -341,8 +343,9 @@ + * the Java class of the notification and the notification types sent by + * the string monitor. + */ ++ @Override + public MBeanNotificationInfo[] getNotificationInfo() { +- return notifsInfo; ++ return notifsInfo.clone(); + } + + /* diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6657026.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6657026.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,1609 @@ +--- old/src/share/classes/javax/swing/ToolTipManager.java 2009-08-11 12:05:32.501050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/ToolTipManager.java 2009-08-11 12:05:31.670050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -27,10 +27,7 @@ + package javax.swing; + + import java.awt.event.*; +-import java.applet.*; + import java.awt.*; +-import java.io.Serializable; +-import sun.swing.UIAction; + + /** + * Manages all the ToolTips in the system. +@@ -60,7 +57,7 @@ + JComponent insideComponent; + MouseEvent mouseEvent; + boolean showImmediately; +- final static ToolTipManager sharedInstance = new ToolTipManager(); ++ private static final Object TOOL_TIP_MANAGER_KEY = new Object(); + transient Popup tipWindow; + /** The Window tip is being displayed in. This will be non-null if + * the Window tip is in differs from that of insideComponent's Window. +@@ -345,7 +342,13 @@ + * @return a shared ToolTipManager object + */ + public static ToolTipManager sharedInstance() { +- return sharedInstance; ++ Object value = SwingUtilities.appContextGet(TOOL_TIP_MANAGER_KEY); ++ if (value instanceof ToolTipManager) { ++ return (ToolTipManager) value; ++ } ++ ToolTipManager manager = new ToolTipManager(); ++ SwingUtilities.appContextPut(TOOL_TIP_MANAGER_KEY, manager); ++ return manager; + } + + // add keylistener here to trigger tip for access +--- old/src/share/classes/javax/swing/UIManager.java 2009-08-11 12:05:43.423050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/UIManager.java 2009-08-11 12:05:42.671050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -194,6 +194,8 @@ + Vector auxLookAndFeels = null; + SwingPropertyChangeSupport changeSupport; + ++ LookAndFeelInfo[] installedLAFs; ++ + UIDefaults getLookAndFeelDefaults() { return tables[0]; } + void setLookAndFeelDefaults(UIDefaults x) { tables[0] = x; } + +@@ -224,18 +226,6 @@ + */ + private static final Object classLock = new Object(); + +- +- /* Cache the last referenced LAFState to improve performance +- * when accessing it. The cache is based on last thread rather +- * than last AppContext because of the cost of looking up the +- * AppContext each time. Since most Swing UI work is on the +- * EventDispatchThread, this hits often enough to justify the +- * overhead. (4193032) +- */ +- private static Thread currentLAFStateThread = null; +- private static LAFState currentLAFState = null; +- +- + /** + * Return the LAFState object, lazily create one if necessary. + * All access to the LAFState fields is done via this method, +@@ -245,13 +235,6 @@ + * + */ + private static LAFState getLAFState() { +- // First check whether we're running on the same thread as +- // the last request. +- Thread thisThread = Thread.currentThread(); +- if (thisThread == currentLAFStateThread) { +- return currentLAFState; +- } +- + LAFState rv = (LAFState)SwingUtilities.appContextGet( + SwingUtilities2.LAF_STATE_KEY); + if (rv == null) { +@@ -265,10 +248,6 @@ + } + } + } +- +- currentLAFStateThread = thisThread; +- currentLAFState = rv; +- + return rv; + } + +@@ -427,7 +406,10 @@ + */ + public static LookAndFeelInfo[] getInstalledLookAndFeels() { + maybeInitialize(); +- LookAndFeelInfo[] ilafs = installedLAFs; ++ LookAndFeelInfo[] ilafs = getLAFState().installedLAFs; ++ if (ilafs == null) { ++ ilafs = installedLAFs; ++ } + LookAndFeelInfo[] rv = new LookAndFeelInfo[ilafs.length]; + System.arraycopy(ilafs, 0, rv, 0, ilafs.length); + return rv; +@@ -449,9 +431,10 @@ + public static void setInstalledLookAndFeels(LookAndFeelInfo[] infos) + throws SecurityException + { ++ maybeInitialize(); + LookAndFeelInfo[] newInfos = new LookAndFeelInfo[infos.length]; + System.arraycopy(infos, 0, newInfos, 0, infos.length); +- installedLAFs = newInfos; ++ getLAFState().installedLAFs = newInfos; + } + + +@@ -1304,10 +1287,11 @@ + } + } + +- installedLAFs = new LookAndFeelInfo[ilafs.size()]; ++ LookAndFeelInfo[] installedLAFs = new LookAndFeelInfo[ilafs.size()]; + for(int i = 0; i < ilafs.size(); i++) { + installedLAFs[i] = (LookAndFeelInfo)(ilafs.elementAt(i)); + } ++ getLAFState().installedLAFs = installedLAFs; + } + + +- +--- old/src/share/classes/javax/swing/plaf/metal/MetalBorders.java 2009-08-11 12:05:53.917050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java 2009-08-11 12:05:53.184050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -33,14 +33,11 @@ + + import java.awt.Component; + import java.awt.Insets; +-import java.awt.Dimension; +-import java.awt.Rectangle; + import java.awt.Color; + import java.awt.Dialog; + import java.awt.Frame; + import java.awt.Graphics; + import java.awt.Window; +-import java.io.Serializable; + + import sun.swing.StringUIClientPropertyKey; + +@@ -62,8 +59,6 @@ + + public static class Flush3DBorder extends AbstractBorder implements UIResource{ + +- private static final Insets insets = new Insets(2, 2, 2, 2); +- + public void paintBorder(Component c, Graphics g, int x, int y, + int w, int h) { + if (c.isEnabled()) { +@@ -73,13 +68,13 @@ + } + } + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(2, 2, 2, 2); + } + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = insets.top; +- newInsets.left = insets.left; +- newInsets.bottom = insets.bottom; +- newInsets.right = insets.right; ++ newInsets.top = 2; ++ newInsets.left = 2; ++ newInsets.bottom = 2; ++ newInsets.right = 2; + return newInsets; + } + } +@@ -190,21 +185,19 @@ + } + + public Insets getBorderInsets( Component c ) { +- return borderInsets; ++ return new Insets(3, 3, 3, 3); + } + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = borderInsets.top; +- newInsets.left = borderInsets.left; +- newInsets.bottom = borderInsets.bottom; +- newInsets.right = borderInsets.right; ++ newInsets.top = 3; ++ newInsets.left = 3; ++ newInsets.bottom = 3; ++ newInsets.right = 3; + return newInsets; + } + } + + public static class InternalFrameBorder extends AbstractBorder implements UIResource { + +- private static final Insets insets = new Insets(5, 5, 5, 5); +- + private static final int corner = 14; + + public void paintBorder(Component c, Graphics g, int x, int y, +@@ -256,13 +249,13 @@ + } + + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(5, 5, 5, 5); + } + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = insets.top; +- newInsets.left = insets.left; +- newInsets.bottom = insets.bottom; +- newInsets.right = insets.right; ++ newInsets.top = 5; ++ newInsets.left = 5; ++ newInsets.bottom = 5; ++ newInsets.right = 5; + return newInsets; + } + } +@@ -273,8 +266,6 @@ + */ + static class FrameBorder extends AbstractBorder implements UIResource { + +- private static final Insets insets = new Insets(5, 5, 5, 5); +- + private static final int corner = 14; + + public void paintBorder(Component c, Graphics g, int x, int y, +@@ -326,15 +317,15 @@ + } + + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(5, 5, 5, 5); + } + + public Insets getBorderInsets(Component c, Insets newInsets) + { +- newInsets.top = insets.top; +- newInsets.left = insets.left; +- newInsets.bottom = insets.bottom; +- newInsets.right = insets.right; ++ newInsets.top = 5; ++ newInsets.left = 5; ++ newInsets.bottom = 5; ++ newInsets.right = 5; + return newInsets; + } + } +@@ -345,7 +336,6 @@ + */ + static class DialogBorder extends AbstractBorder implements UIResource + { +- private static final Insets insets = new Insets(5, 5, 5, 5); + private static final int corner = 14; + + protected Color getActiveBackground() +@@ -427,15 +417,15 @@ + } + + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(5, 5, 5, 5); + } + + public Insets getBorderInsets(Component c, Insets newInsets) + { +- newInsets.top = insets.top; +- newInsets.left = insets.left; +- newInsets.bottom = insets.bottom; +- newInsets.right = insets.right; ++ newInsets.top = 5; ++ newInsets.left = 5; ++ newInsets.bottom = 5; ++ newInsets.right = 5; + return newInsets; + } + } +@@ -482,7 +472,6 @@ + * @since 1.3 + */ + public static class PaletteBorder extends AbstractBorder implements UIResource { +- private static final Insets insets = new Insets(1, 1, 1, 1); + int titleHeight = 0; + + public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { +@@ -499,20 +488,19 @@ + } + + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(1, 1, 1, 1); + } + + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = insets.top; +- newInsets.left = insets.left; +- newInsets.bottom = insets.bottom; +- newInsets.right = insets.right; ++ newInsets.top = 1; ++ newInsets.left = 1; ++ newInsets.bottom = 1; ++ newInsets.right = 1; + return newInsets; + } + } + + public static class OptionDialogBorder extends AbstractBorder implements UIResource { +- private static final Insets insets = new Insets(3, 3, 3, 3); + int titleHeight = 0; + + public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { +@@ -568,14 +556,14 @@ + } + + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(3, 3, 3, 3); + } + + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = insets.top; +- newInsets.left = insets.left; +- newInsets.bottom = insets.bottom; +- newInsets.right = insets.right; ++ newInsets.top = 3; ++ newInsets.left = 3; ++ newInsets.bottom = 3; ++ newInsets.right = 3; + return newInsets; + } + } +@@ -615,10 +603,10 @@ + newInsets.set(0, 0, 2, 0); + } + else { +- newInsets.top = borderInsets.top; +- newInsets.left = borderInsets.left; +- newInsets.bottom = borderInsets.bottom; +- newInsets.right = borderInsets.right; ++ newInsets.top = 1; ++ newInsets.left = 0; ++ newInsets.bottom = 1; ++ newInsets.right = 0; + } + return newInsets; + } +@@ -663,14 +651,14 @@ + } + + public Insets getBorderInsets( Component c ) { +- return borderInsets; ++ return new Insets(2, 2, 2, 2); + } + + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = borderInsets.top; +- newInsets.left = borderInsets.left; +- newInsets.bottom = borderInsets.bottom; +- newInsets.right = borderInsets.right; ++ newInsets.top = 2; ++ newInsets.left = 2; ++ newInsets.bottom = 2; ++ newInsets.right = 2; + return newInsets; + } + } +@@ -694,14 +682,14 @@ + } + + public Insets getBorderInsets( Component c ) { +- return borderInsets; ++ return new Insets(3, 1, 2, 1); + } + + public Insets getBorderInsets(Component c, Insets newInsets) { +- newInsets.top = borderInsets.top; +- newInsets.left = borderInsets.left; +- newInsets.bottom = borderInsets.bottom; +- newInsets.right = borderInsets.right; ++ newInsets.top = 3; ++ newInsets.left = 1; ++ newInsets.bottom = 2; ++ newInsets.right = 1; + return newInsets; + } + } +@@ -911,8 +899,6 @@ + + public static class ScrollPaneBorder extends AbstractBorder implements UIResource { + +- private static final Insets insets = new Insets(1, 1, 2, 2); +- + public void paintBorder(Component c, Graphics g, int x, int y, + int w, int h) { + +@@ -946,7 +932,7 @@ + } + + public Insets getBorderInsets(Component c) { +- return insets; ++ return new Insets(1, 1, 2, 2); + } + } + + +--- old/src/share/classes/javax/swing/plaf/metal/MetalBumps.java 2009-08-11 12:06:04.423050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalBumps.java 2009-08-11 12:06:03.678050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,11 +25,22 @@ + + package javax.swing.plaf.metal; + +-import java.awt.*; +-import java.awt.image.*; +-import javax.swing.*; +-import java.io.*; +-import java.util.*; ++import sun.awt.AppContext; ++ ++import java.awt.Color; ++import java.awt.Component; ++import java.awt.Dimension; ++import java.awt.Graphics; ++import java.awt.Graphics2D; ++import java.awt.GraphicsConfiguration; ++import java.awt.Image; ++import java.awt.Transparency; ++import java.awt.image.BufferedImage; ++import java.awt.image.DataBuffer; ++import java.awt.image.IndexColorModel; ++import java.util.ArrayList; ++import java.util.List; ++import javax.swing.Icon; + + /** + * Implements the bumps used throughout the Metal Look and Feel. +@@ -49,19 +60,9 @@ + protected Color shadowColor; + protected Color backColor; + +- protected static Vector buffers = new Vector(); ++ private static final Object METAL_BUMPS = new Object(); + protected BumpBuffer buffer; + +- public MetalBumps( Dimension bumpArea ) { +- this( bumpArea.width, bumpArea.height ); +- } +- +- public MetalBumps( int width, int height ) { +- this(width, height, MetalLookAndFeel.getPrimaryControlHighlight(), +- MetalLookAndFeel.getPrimaryControlDarkShadow(), +- MetalLookAndFeel.getPrimaryControlShadow()); +- } +- + /** + * Creates MetalBumps of the specified size with the specified colors. + * If newBackColor is null, the background will be +@@ -73,29 +74,22 @@ + setBumpColors( newTopColor, newShadowColor, newBackColor ); + } + +- private BumpBuffer getBuffer(GraphicsConfiguration gc, Color aTopColor, +- Color aShadowColor, Color aBackColor) { +- if (buffer != null && buffer.hasSameConfiguration( +- gc, aTopColor, aShadowColor, aBackColor)) { +- return buffer; +- } +- BumpBuffer result = null; +- +- Enumeration elements = buffers.elements(); +- +- while ( elements.hasMoreElements() ) { +- BumpBuffer aBuffer = (BumpBuffer)elements.nextElement(); +- if ( aBuffer.hasSameConfiguration(gc, aTopColor, aShadowColor, +- aBackColor)) { +- result = aBuffer; +- break; ++ private static BumpBuffer createBuffer(GraphicsConfiguration gc, ++ Color topColor, Color shadowColor, Color backColor) { ++ AppContext context = AppContext.getAppContext(); ++ List buffers = (List) context.get(METAL_BUMPS); ++ if (buffers == null) { ++ buffers = new ArrayList(); ++ context.put(METAL_BUMPS, buffers); ++ } ++ for (BumpBuffer buffer : buffers) { ++ if (buffer.hasSameConfiguration(gc, topColor, shadowColor, backColor)) { ++ return buffer; + } + } +- if (result == null) { +- result = new BumpBuffer(gc, topColor, shadowColor, backColor); +- buffers.addElement(result); +- } +- return result; ++ BumpBuffer buffer = new BumpBuffer(gc, topColor, shadowColor, backColor); ++ buffers.add(buffer); ++ return buffer; + } + + public void setBumpArea( Dimension bumpArea ) { +@@ -123,10 +117,12 @@ + (GraphicsConfiguration)((Graphics2D)g). + getDeviceConfiguration() : null; + +- buffer = getBuffer(gc, topColor, shadowColor, backColor); ++ if ((buffer == null) || !buffer.hasSameConfiguration(gc, topColor, shadowColor, backColor)) { ++ buffer = createBuffer(gc, topColor, shadowColor, backColor); ++ } + +- int bufferWidth = buffer.getImageSize().width; +- int bufferHeight = buffer.getImageSize().height; ++ int bufferWidth = BumpBuffer.IMAGE_SIZE; ++ int bufferHeight = BumpBuffer.IMAGE_SIZE; + int iconWidth = getIconWidth(); + int iconHeight = getIconHeight(); + int x2 = x + iconWidth; +@@ -159,7 +155,6 @@ + class BumpBuffer { + + static final int IMAGE_SIZE = 64; +- static Dimension imageSize = new Dimension( IMAGE_SIZE, IMAGE_SIZE ); + + transient Image image; + Color topColor; +@@ -201,10 +196,6 @@ + return image; + } + +- public Dimension getImageSize() { +- return imageSize; +- } +- + /** + * Paints the bumps into the current image. + */ + +--- old/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java 2009-08-11 12:06:14.763050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java 2009-08-11 12:06:14.053050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -31,10 +31,8 @@ + import javax.swing.event.*; + import javax.swing.border.*; + import javax.swing.plaf.basic.*; +-import java.util.EventListener; + import java.beans.PropertyChangeListener; + import java.beans.PropertyChangeEvent; +-import java.beans.PropertyVetoException; + import javax.swing.plaf.*; + + /** +@@ -51,7 +49,7 @@ + private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0); + + protected static String IS_PALETTE = "JInternalFrame.isPalette"; +- ++ private static String IS_PALETTE_KEY = "JInternalFrame.isPalette"; + private static String FRAME_TYPE = "JInternalFrame.frameType"; + private static String NORMAL_FRAME = "normal"; + private static String PALETTE_FRAME = "palette"; +@@ -68,7 +66,7 @@ + public void installUI(JComponent c) { + super.installUI(c); + +- Object paletteProp = c.getClientProperty( IS_PALETTE ); ++ Object paletteProp = c.getClientProperty(IS_PALETTE_KEY); + if ( paletteProp != null ) { + setPalette( ((Boolean)paletteProp).booleanValue() ); + } +@@ -187,7 +185,7 @@ + ui.setFrameType( (String) e.getNewValue() ); + } + } +- else if ( name.equals( IS_PALETTE ) ) ++ else if ( name.equals(IS_PALETTE_KEY) ) + { + if ( e.getNewValue() != null ) + { + +--- old/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java 2009-08-11 12:06:25.043050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java 2009-08-11 12:06:24.344050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -27,23 +27,12 @@ + + import javax.swing.plaf.basic.BasicSliderUI; + +-import java.awt.Component; +-import java.awt.Container; + import java.awt.Graphics; + import java.awt.Dimension; + import java.awt.Rectangle; +-import java.awt.Point; +-import java.awt.Insets; + import java.awt.Color; +-import java.io.Serializable; +-import java.awt.IllegalComponentStateException; +-import java.awt.Polygon; + import java.beans.*; +- +-import javax.swing.border.AbstractBorder; +- + import javax.swing.*; +-import javax.swing.event.*; + import javax.swing.plaf.*; + + /** +@@ -64,12 +53,13 @@ + + protected final int TICK_BUFFER = 4; + protected boolean filledSlider = false; +- // NOTE: these next three variables are currently unused. ++ // NOTE: these next five variables are currently unused. + protected static Color thumbColor; + protected static Color highlightColor; + protected static Color darkShadowColor; + protected static int trackWidth; + protected static int tickLength; ++ private int safeLength; + + /** + * A default horizontal thumb Icon. This field might not be +@@ -117,7 +107,7 @@ + + public void installUI( JComponent c ) { + trackWidth = ((Integer)UIManager.get( "Slider.trackWidth" )).intValue(); +- tickLength = ((Integer)UIManager.get( "Slider.majorTickLength" )).intValue(); ++ tickLength = safeLength = ((Integer)UIManager.get( "Slider.majorTickLength" )).intValue(); + horizThumbIcon = SAFE_HORIZ_THUMB_ICON = + UIManager.getIcon( "Slider.horizontalThumbIcon" ); + vertThumbIcon = SAFE_VERT_THUMB_ICON = +@@ -465,8 +455,8 @@ + * determine the tick area rectangle. + */ + public int getTickLength() { +- return slider.getOrientation() == JSlider.HORIZONTAL ? tickLength + TICK_BUFFER + 1 : +- tickLength + TICK_BUFFER + 3; ++ return slider.getOrientation() == JSlider.HORIZONTAL ? safeLength + TICK_BUFFER + 1 : ++ safeLength + TICK_BUFFER + 3; + } + + /** +@@ -511,22 +501,22 @@ + + protected void paintMinorTickForHorizSlider( Graphics g, Rectangle tickBounds, int x ) { + g.setColor( slider.isEnabled() ? slider.getForeground() : MetalLookAndFeel.getControlShadow() ); +- g.drawLine( x, TICK_BUFFER, x, TICK_BUFFER + (tickLength / 2) ); ++ g.drawLine( x, TICK_BUFFER, x, TICK_BUFFER + (safeLength / 2) ); + } + + protected void paintMajorTickForHorizSlider( Graphics g, Rectangle tickBounds, int x ) { + g.setColor( slider.isEnabled() ? slider.getForeground() : MetalLookAndFeel.getControlShadow() ); +- g.drawLine( x, TICK_BUFFER , x, TICK_BUFFER + (tickLength - 1) ); ++ g.drawLine( x, TICK_BUFFER , x, TICK_BUFFER + (safeLength - 1) ); + } + + protected void paintMinorTickForVertSlider( Graphics g, Rectangle tickBounds, int y ) { + g.setColor( slider.isEnabled() ? slider.getForeground() : MetalLookAndFeel.getControlShadow() ); + + if (MetalUtils.isLeftToRight(slider)) { +- g.drawLine( TICK_BUFFER, y, TICK_BUFFER + (tickLength / 2), y ); ++ g.drawLine( TICK_BUFFER, y, TICK_BUFFER + (safeLength / 2), y ); + } + else { +- g.drawLine( 0, y, tickLength/2, y ); ++ g.drawLine( 0, y, safeLength/2, y ); + } + } + +@@ -534,10 +524,10 @@ + g.setColor( slider.isEnabled() ? slider.getForeground() : MetalLookAndFeel.getControlShadow() ); + + if (MetalUtils.isLeftToRight(slider)) { +- g.drawLine( TICK_BUFFER, y, TICK_BUFFER + tickLength, y ); ++ g.drawLine( TICK_BUFFER, y, TICK_BUFFER + safeLength, y ); + } + else { +- g.drawLine( 0, y, tickLength, y ); ++ g.drawLine( 0, y, safeLength, y ); + } + } + } +- +--- old/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java 2009-08-11 12:06:35.519050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java 2009-08-11 12:06:34.752050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -31,14 +31,12 @@ + import sun.swing.UIAction; + import javax.swing.*; + import javax.swing.border.Border; +-import javax.swing.event.*; + import java.awt.*; + import java.awt.event.*; + import java.awt.peer.ComponentPeer; + import java.awt.peer.LightweightPeer; + import java.beans.*; + import java.util.*; +-import javax.swing.plaf.ActionMapUIResource; + import javax.swing.plaf.SplitPaneUI; + import javax.swing.plaf.ComponentUI; + import javax.swing.plaf.UIResource; +@@ -106,13 +104,13 @@ + * Keys to use for forward focus traversal when the JComponent is + * managing focus. + */ +- private static Set managingFocusForwardTraversalKeys; ++ private Set managingFocusForwardTraversalKeys; + + /** + * Keys to use for backward focus traversal when the JComponent is + * managing focus. + */ +- private static Set managingFocusBackwardTraversalKeys; ++ private Set managingFocusBackwardTraversalKeys; + + + /** +@@ -674,7 +672,7 @@ + * @return increment via keyboard methods. + */ + int getKeyboardMoveIncrement() { +- return KEYBOARD_DIVIDER_MOVE_OFFSET; ++ return 3; + } + + /** + +--- old/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java 2009-08-11 12:06:46.036050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java 2009-08-11 12:06:45.272050200 +0400 +@@ -65,6 +65,9 @@ + protected static BasicLabelUI labelUI = new BasicLabelUI(); + private final static BasicLabelUI SAFE_BASIC_LABEL_UI = new BasicLabelUI(); + ++ private Rectangle paintIconR = new Rectangle(); ++ private Rectangle paintTextR = new Rectangle(); ++ + static void loadActionMap(LazyActionMap map) { + map.put(new Actions(Actions.PRESS)); + map.put(new Actions(Actions.RELEASE)); +@@ -135,17 +138,6 @@ + textX, textY); + } + +- +- /* These rectangles/insets are allocated once for this shared LabelUI +- * implementation. Re-using rectangles rather than allocating +- * them in each paint call halved the time it took paint to run. +- */ +- private static Rectangle paintIconR = new Rectangle(); +- private static Rectangle paintTextR = new Rectangle(); +- private static Rectangle paintViewR = new Rectangle(); +- private static Insets paintViewInsets = new Insets(0, 0, 0, 0); +- +- + /** + * Paint the label text in the foreground color, if the label + * is opaque then paint the entire background with the background +@@ -194,10 +186,11 @@ + + private String layout(JLabel label, FontMetrics fm, + int width, int height) { +- Insets insets = label.getInsets(paintViewInsets); ++ Insets insets = label.getInsets(null); + String text = label.getText(); + Icon icon = (label.isEnabled()) ? label.getIcon() : + label.getDisabledIcon(); ++ Rectangle paintViewR = new Rectangle(); + paintViewR.x = insets.left; + paintViewR.y = insets.top; + paintViewR.width = width - (insets.left + insets.right); +@@ -208,24 +201,13 @@ + paintTextR); + } + +- +- /* These rectangles/insets are allocated once for this shared LabelUI +- * implementation. Re-using rectangles rather than allocating +- * them in each getPreferredSize call sped up the method substantially. +- */ +- private static Rectangle iconR = new Rectangle(); +- private static Rectangle textR = new Rectangle(); +- private static Rectangle viewR = new Rectangle(); +- private static Insets viewInsets = new Insets(0, 0, 0, 0); +- +- + public Dimension getPreferredSize(JComponent c) + { + JLabel label = (JLabel)c; + String text = label.getText(); + Icon icon = (label.isEnabled()) ? label.getIcon() : + label.getDisabledIcon(); +- Insets insets = label.getInsets(viewInsets); ++ Insets insets = label.getInsets(null); + Font font = label.getFont(); + + int dx = insets.left + insets.right; +@@ -243,6 +225,9 @@ + else { + FontMetrics fm = label.getFontMetrics(font); + ++ Rectangle iconR = new Rectangle(); ++ Rectangle textR = new Rectangle(); ++ Rectangle viewR = new Rectangle(); + iconR.x = iconR.y = iconR.width = iconR.height = 0; + textR.x = textR.y = textR.width = textR.height = 0; + viewR.x = dx; +--- old/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java 2009-08-11 12:06:52.019050200 +0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java 2009-08-11 12:06:51.308050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -27,7 +27,6 @@ + + import java.awt.*; + import java.lang.reflect.*; +-import java.security.*; + import java.util.*; + import javax.swing.*; + import javax.swing.plaf.*; +@@ -908,7 +907,7 @@ + + static class GTKStockIconInfo { + private static Map ICON_TYPE_MAP; +- private static final Object ICON_SIZE_KEY = new StringBuffer("IconSize"); ++ private static final Object ICON_SIZE_KEY = new Object(); // IconSize + + private static Dimension[] getIconSizesMap() { + AppContext appContext = AppContext.getAppContext(); +--- old/src/share/classes/javax/swing/JComponent.java 2009-08-11 12:06:58.204050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/JComponent.java 2009-08-11 12:06:57.513050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -27,22 +27,15 @@ + + import java.util.HashSet; + import java.util.Hashtable; +-import java.util.Dictionary; + import java.util.Enumeration; + import java.util.Locale; + import java.util.Vector; + import java.util.EventListener; + import java.util.Set; +-import java.util.Map; +-import java.util.HashMap; + + import java.awt.*; + import java.awt.event.*; +-import java.awt.image.VolatileImage; +-import java.awt.Graphics2D; + import java.awt.peer.LightweightPeer; +-import java.awt.dnd.DropTarget; +-import java.awt.font.FontRenderContext; + import java.beans.*; + + import java.applet.Applet; +@@ -220,8 +213,7 @@ + * indicates the EDT is calling into the InputVerifier from the + * returned component. + */ +- private static final Object INPUT_VERIFIER_SOURCE_KEY = +- new StringBuilder("InputVerifierSourceKey"); ++ private static final Object INPUT_VERIFIER_SOURCE_KEY = new Object(); // InputVerifierSourceKey + + /* The following fields support set methods for the corresponding + * java.awt.Component properties. +@@ -369,8 +361,7 @@ + private static final String defaultLocale = "JComponent.defaultLocale"; + + private static Component componentObtainingGraphicsFrom; +- private static Object componentObtainingGraphicsFromLock = new +- StringBuilder("componentObtainingGraphicsFrom"); ++ private static Object componentObtainingGraphicsFromLock = new Object(); // componentObtainingGraphicsFrom + + /** + * AA text hints. +--- old/src/share/classes/javax/swing/JDialog.java 2009-08-11 12:07:04.991050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/JDialog.java 2009-08-11 12:07:04.288050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -26,12 +26,7 @@ + + import java.awt.*; + import java.awt.event.*; +-import java.beans.PropertyChangeListener; +-import java.util.Locale; +-import java.util.Vector; +-import java.io.Serializable; + import javax.accessibility.*; +-import java.applet.Applet; + + /** + * The main class for creating a dialog window. You can use this class +@@ -108,8 +103,7 @@ + * Key into the AppContext, used to check if should provide decorations + * by default. + */ +- private static final Object defaultLookAndFeelDecoratedKey = +- new StringBuffer("JDialog.defaultLookAndFeelDecorated"); ++ private static final Object defaultLookAndFeelDecoratedKey = new Object(); // JDialog.defaultLookAndFeelDecorated + + private int defaultCloseOperation = HIDE_ON_CLOSE; + +--- old/src/share/classes/javax/swing/JEditorPane.java 2009-08-11 12:07:11.080050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/JEditorPane.java 2009-08-11 12:07:10.427050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,12 +25,10 @@ + package javax.swing; + + import java.awt.*; +-import java.awt.event.*; + import java.lang.reflect.*; + import java.net.*; + import java.util.*; + import java.io.*; +-import java.util.*; + + import javax.swing.plaf.*; + import javax.swing.text.*; +@@ -1598,12 +1596,9 @@ + /* + * Private AppContext keys for this class's static variables. + */ +- private static final Object kitRegistryKey = +- new StringBuffer("JEditorPane.kitRegistry"); +- private static final Object kitTypeRegistryKey = +- new StringBuffer("JEditorPane.kitTypeRegistry"); +- private static final Object kitLoaderRegistryKey = +- new StringBuffer("JEditorPane.kitLoaderRegistry"); ++ private static final Object kitRegistryKey = new Object(); // JEditorPane.kitRegistry ++ private static final Object kitTypeRegistryKey = new Object(); // JEditorPane.kitTypeRegistry ++ private static final Object kitLoaderRegistryKey = new Object(); // JEditorPane.kitLoaderRegistry + + /** + * @see #getUIClassID +--- old/src/share/classes/javax/swing/JFrame.java 2009-08-11 12:07:17.419050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/JFrame.java 2009-08-11 12:07:16.686050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -26,11 +26,6 @@ + + import java.awt.*; + import java.awt.event.*; +-import java.beans.PropertyChangeListener; +-import java.util.Locale; +-import java.util.Vector; +-import java.io.Serializable; +- + import javax.accessibility.*; + + +@@ -130,8 +125,7 @@ + * Key into the AppContext, used to check if should provide decorations + * by default. + */ +- private static final Object defaultLookAndFeelDecoratedKey = +- new StringBuffer("JFrame.defaultLookAndFeelDecorated"); ++ private static final Object defaultLookAndFeelDecoratedKey = new Object(); // JFrame.defaultLookAndFeelDecorated + + private int defaultCloseOperation = HIDE_ON_CLOSE; + +--- old/src/share/classes/javax/swing/JInternalFrame.java 2009-08-11 12:07:23.366050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/JInternalFrame.java 2009-08-11 12:07:22.658050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -26,13 +26,10 @@ + package javax.swing; + + import java.awt.*; +-import java.awt.event.*; + + import java.beans.PropertyVetoException; + import java.beans.PropertyChangeEvent; +-import java.util.EventListener; + +-import javax.swing.border.Border; + import javax.swing.event.InternalFrameEvent; + import javax.swing.event.InternalFrameListener; + import javax.swing.plaf.*; +@@ -40,9 +37,7 @@ + import javax.accessibility.*; + + import java.io.ObjectOutputStream; +-import java.io.ObjectInputStream; + import java.io.IOException; +-import java.lang.StringBuilder; + import java.beans.PropertyChangeListener; + import sun.awt.AppContext; + import sun.swing.SwingUtilities2; +@@ -226,8 +221,7 @@ + /** Constrained property name indicating that the internal frame is iconified. */ + public final static String IS_ICON_PROPERTY = "icon"; + +- private static final Object PROPERTY_CHANGE_LISTENER_KEY = +- new StringBuilder("InternalFramePropertyChangeListener"); ++ private static final Object PROPERTY_CHANGE_LISTENER_KEY = new Object(); // InternalFramePropertyChangeListener + + private static void addPropertyChangeListenerIfNecessary() { + if (AppContext.getAppContext().get(PROPERTY_CHANGE_LISTENER_KEY) == +--- old/src/share/classes/javax/swing/JPopupMenu.java 2009-08-11 12:07:29.900050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/JPopupMenu.java 2009-08-11 12:07:29.192050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -33,17 +33,12 @@ + import java.io.Serializable; + import java.beans.*; + +-import java.util.Locale; + import java.util.Vector; +-import java.util.Hashtable; + import javax.accessibility.*; + import javax.swing.plaf.PopupMenuUI; +-import javax.swing.plaf.ComponentUI; + import javax.swing.plaf.basic.BasicComboPopup; + import javax.swing.event.*; + +-import java.applet.Applet; +- + /** + * An implementation of a popup menu -- a small window that pops up + * and displays a series of choices. A JPopupMenu is used for the +@@ -91,8 +86,7 @@ + /** + * Key used in AppContext to determine if light way popups are the default. + */ +- private static final Object defaultLWPopupEnabledKey = +- new StringBuffer("JPopupMenu.defaultLWPopupEnabledKey"); ++ private static final Object defaultLWPopupEnabledKey = new Object(); // JPopupMenu.defaultLWPopupEnabledKey + + /** Bug#4425878-Property javax.swing.adjustPopupLocationToFit introduced */ + static boolean popupPostionFixDisabled = false; +--- old/src/share/classes/javax/swing/MenuSelectionManager.java 2009-08-11 12:07:36.023050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/MenuSelectionManager.java 2009-08-11 12:07:35.359050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -44,8 +44,7 @@ + private static final boolean VERBOSE = false; // show reuse hits/misses + private static final boolean DEBUG = false; // show bad params, misc. + +- private static final StringBuilder MENU_SELECTION_MANAGER_KEY = +- new StringBuilder("javax.swing.MenuSelectionManager"); ++ private static final Object MENU_SELECTION_MANAGER_KEY = new Object(); // javax.swing.MenuSelectionManager + + /** + * Returns the default menu selection manager. +--- old/src/share/classes/javax/swing/PopupFactory.java 2009-08-11 12:07:42.008050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/PopupFactory.java 2009-08-11 12:07:41.328050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -61,8 +61,7 @@ + * AppContext. This is the key used in the + * AppContext to locate the PopupFactory. + */ +- private static final Object SharedInstanceKey = +- new StringBuffer("PopupFactory.SharedInstanceKey"); ++ private static final Object SharedInstanceKey = new Object(); // PopupFactory.SharedInstanceKey + + /** + * Max number of items to store in any one particular cache. +@@ -291,8 +290,7 @@ + * Popup implementation that uses a Window as the popup. + */ + private static class HeavyWeightPopup extends Popup { +- private static final Object heavyWeightPopupCacheKey = +- new StringBuffer("PopupFactory.heavyWeightPopupCache"); ++ private static final Object heavyWeightPopupCacheKey = new Object(); // PopupFactory.heavyWeightPopupCache + + /** + * Returns either a new or recycled Popup containing +@@ -641,8 +639,7 @@ + * Popup implementation that uses a JPanel as the popup. + */ + private static class LightWeightPopup extends ContainerPopup { +- private static final Object lightWeightPopupCacheKey = +- new StringBuffer("PopupFactory.lightPopupCache"); ++ private static final Object lightWeightPopupCacheKey = new Object(); // PopupFactory.lightPopupCache + + /** + * Returns a light weight Popup implementation. If +@@ -796,8 +793,7 @@ + * Popup implementation that uses a Panel as the popup. + */ + private static class MediumWeightPopup extends ContainerPopup { +- private static final Object mediumWeightPopupCacheKey = +- new StringBuffer("PopupFactory.mediumPopupCache"); ++ private static final Object mediumWeightPopupCacheKey = new Object(); // PopupFactory.mediumPopupCache + + /** Child of the panel. The contents are added to this. */ + private JRootPane rootPane; +--- old/src/share/classes/javax/swing/SwingUtilities.java 2009-08-11 12:07:48.053050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/SwingUtilities.java 2009-08-11 12:07:47.366050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -33,9 +33,6 @@ + import java.awt.event.*; + import java.awt.dnd.DropTarget; + +-import java.util.Vector; +-import java.util.Hashtable; +- + import java.lang.reflect.*; + + import javax.accessibility.*; +@@ -1750,8 +1747,7 @@ + + + // Don't use String, as it's not guaranteed to be unique in a Hashtable. +- private static final Object sharedOwnerFrameKey = +- new StringBuffer("SwingUtilities.sharedOwnerFrame"); ++ private static final Object sharedOwnerFrameKey = new Object(); // SwingUtilities.sharedOwnerFrame + + static class SharedOwnerFrame extends Frame implements WindowListener { + public void addNotify() { +--- old/src/share/classes/javax/swing/SwingWorker.java 2009-08-11 12:07:54.496050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/SwingWorker.java 2009-08-11 12:07:53.575050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -28,16 +28,12 @@ + import java.beans.PropertyChangeSupport; + import java.beans.PropertyChangeEvent; + import java.util.List; +-import java.util.ArrayList; +-import java.util.Collections; + + import java.util.concurrent.*; + import java.util.concurrent.locks.*; + + import java.awt.event.*; + +-import javax.swing.SwingUtilities; +- + import sun.awt.AppContext; + import sun.swing.AccumulativeRunnable; + +@@ -860,7 +856,7 @@ + return (ExecutorService)obj; + } + +- private static final Object DO_SUBMIT_KEY = new StringBuilder("doSubmit"); ++ private static final Object DO_SUBMIT_KEY = new Object(); // doSubmit + private static AccumulativeRunnable getDoSubmit() { + synchronized (DO_SUBMIT_KEY) { + final AppContext appContext = AppContext.getAppContext(); +--- old/src/share/classes/javax/swing/TimerQueue.java 2009-08-11 12:08:00.562050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/TimerQueue.java 2009-08-11 12:07:59.868050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -29,7 +29,6 @@ + + + +-import java.util.*; + import java.util.concurrent.*; + import java.util.concurrent.atomic.AtomicLong; + import sun.awt.AppContext; +@@ -46,10 +45,7 @@ + */ + class TimerQueue implements Runnable + { +- private static final Object sharedInstanceKey = +- new StringBuffer("TimerQueue.sharedInstanceKey"); +- private static final Object expiredTimersKey = +- new StringBuffer("TimerQueue.expiredTimersKey"); ++ private static final Object sharedInstanceKey = new Object(); // TimerQueue.sharedInstanceKey + + private final DelayQueue queue; + volatile boolean running; +--- old/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java 2009-08-11 12:08:06.552050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java 2009-08-11 12:08:05.879050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -29,9 +29,7 @@ + import java.awt.event.*; + import javax.swing.*; + import javax.accessibility.*; +-import javax.swing.FocusManager; + import javax.swing.plaf.*; +-import javax.swing.border.*; + import javax.swing.text.*; + import javax.swing.event.*; + import java.beans.PropertyChangeListener; +@@ -176,11 +174,9 @@ + private Dimension cachedDisplaySize = new Dimension( 0, 0 ); + + // Key used for lookup of the DefaultListCellRenderer in the AppContext. +- private static final Object COMBO_UI_LIST_CELL_RENDERER_KEY = +- new StringBuffer("DefaultListCellRendererKey"); ++ private static final Object COMBO_UI_LIST_CELL_RENDERER_KEY = new Object(); // DefaultListCellRendererKey + +- static final StringBuffer HIDE_POPUP_KEY +- = new StringBuffer("HidePopupKey"); ++ static final Object HIDE_POPUP_KEY = new Object(); // HidePopupKey + + /** + * Whether or not all cells have the same baseline. +--- old/src/share/classes/javax/swing/plaf/basic/BasicListUI.java 2009-08-11 12:08:12.745050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java 2009-08-11 12:08:12.055050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -56,8 +56,7 @@ + */ + public class BasicListUI extends ListUI + { +- private static final StringBuilder BASELINE_COMPONENT_KEY = +- new StringBuilder("List.baselineComponent"); ++ private static final Object BASELINE_COMPONENT_KEY = new Object(); // List.baselineComponent + + protected JList list = null; + protected CellRendererPane rendererPane; +--- old/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java 2009-08-11 12:08:19.099050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java 2009-08-11 12:08:18.377050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -28,26 +28,18 @@ + import javax.swing.*; + import javax.swing.event.*; + import javax.swing.plaf.*; +-import javax.swing.plaf.basic.*; +-import javax.swing.border.*; + + import java.applet.Applet; + + import java.awt.Component; +-import java.awt.Container; +-import java.awt.Dimension; + import java.awt.KeyboardFocusManager; + import java.awt.Window; + import java.awt.event.*; + import java.awt.AWTEvent; + import java.awt.Toolkit; + +-import java.beans.PropertyChangeListener; +-import java.beans.PropertyChangeEvent; +- + import java.util.*; + +-import sun.swing.DefaultLookup; + import sun.swing.UIAction; + + import sun.awt.AppContext; +@@ -61,10 +53,8 @@ + * @author Arnaud Weber + */ + public class BasicPopupMenuUI extends PopupMenuUI { +- static final StringBuilder MOUSE_GRABBER_KEY = new StringBuilder( +- "javax.swing.plaf.basic.BasicPopupMenuUI.MouseGrabber"); +- static final StringBuilder MENU_KEYBOARD_HELPER_KEY = new StringBuilder( +- "javax.swing.plaf.basic.BasicPopupMenuUI.MenuKeyboardHelper"); ++ static final Object MOUSE_GRABBER_KEY = new Object(); // javax.swing.plaf.basic.BasicPopupMenuUI.MouseGrabber ++ static final Object MENU_KEYBOARD_HELPER_KEY = new Object(); // javax.swing.plaf.basic.BasicPopupMenuUI.MenuKeyboardHelper + + protected JPopupMenu popupMenu = null; + private transient PopupMenuListener popupMenuListener = null; +--- old/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java 2009-08-11 12:08:25.175050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java 2009-08-11 12:08:24.502050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -27,16 +27,11 @@ + + import java.awt.*; + import java.awt.datatransfer.*; +-import java.awt.dnd.*; + import java.awt.event.*; + import java.util.Enumeration; +-import java.util.EventObject; +-import java.util.Hashtable; +-import java.util.TooManyListenersException; + import javax.swing.*; + import javax.swing.event.*; + import javax.swing.plaf.*; +-import javax.swing.text.*; + import javax.swing.table.*; + import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag; + import sun.swing.SwingUtilities2; +@@ -56,8 +51,7 @@ + */ + public class BasicTableUI extends TableUI + { +- private static final StringBuilder BASELINE_COMPONENT_KEY = +- new StringBuilder("Table.baselineComponent"); ++ private static final Object BASELINE_COMPONENT_KEY = new Object(); // Table.baselineComponent + + // + // Instance Variables +--- old/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java 2009-08-11 12:08:32.053050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java 2009-08-11 12:08:30.695050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -30,16 +30,12 @@ + import java.awt.*; + import java.awt.event.*; + import java.awt.datatransfer.*; +-import java.awt.dnd.*; + import java.beans.*; +-import java.io.*; + import java.util.Enumeration; + import java.util.Hashtable; +-import java.util.TooManyListenersException; + import java.util.ArrayList; + import java.util.Collections; + import java.util.Comparator; +-import javax.swing.plaf.ActionMapUIResource; + import javax.swing.plaf.ComponentUI; + import javax.swing.plaf.UIResource; + import javax.swing.plaf.TreeUI; +@@ -61,8 +57,7 @@ + + public class BasicTreeUI extends TreeUI + { +- private static final StringBuilder BASELINE_COMPONENT_KEY = +- new StringBuilder("Tree.baselineComponent"); ++ private static final Object BASELINE_COMPONENT_KEY = new Object(); // Tree.baselineComponent + + // Old actions forward to an instance of this. + static private final Actions SHARED_ACTION = new Actions(); +--- old/src/share/classes/javax/swing/plaf/synth/ImagePainter.java 2009-08-11 12:08:38.675050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/synth/ImagePainter.java 2009-08-11 12:08:37.988050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -41,8 +41,7 @@ + * @author Scott Violet + */ + class ImagePainter extends SynthPainter { +- private static final StringBuffer CACHE_KEY = +- new StringBuffer("SynthCacheKey"); ++ private static final Object CACHE_KEY = new Object(); // SynthCacheKey + + private Image image; + private Insets sInsets; +--- old/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java 2009-08-11 12:08:44.720050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java 2009-08-11 12:08:44.005050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -73,8 +73,7 @@ + /** + * AppContext key to get the current SynthStyleFactory. + */ +- private static final Object STYLE_FACTORY_KEY = +- new StringBuffer("com.sun.java.swing.plaf.gtk.StyleCache"); ++ private static final Object STYLE_FACTORY_KEY = new Object(); // com.sun.java.swing.plaf.gtk.StyleCache + + /** + * The last SynthStyleFactory that was asked for from AppContext +--- old/src/share/classes/javax/swing/text/JTextComponent.java 2009-08-11 12:08:50.823050200 +0400 ++++ openjdk/jdk/src/share/classes/javax/swing/text/JTextComponent.java 2009-08-11 12:08:50.146050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -34,10 +34,7 @@ + import java.util.Hashtable; + import java.util.Enumeration; + import java.util.Vector; +-import java.util.Iterator; + import java.util.Map; +-import java.util.Map.Entry; +-import java.util.Set; + + import java.util.concurrent.*; + +@@ -4041,8 +4038,7 @@ + return modifiers; + } + +- private static final Object KEYMAP_TABLE = +- new StringBuilder("JTextComponent_KeymapTable"); ++ private static final Object KEYMAP_TABLE = new Object(); // JTextComponent_KeymapTable + private JTextComponent editor; + // + // member variables used for on-the-spot input method +@@ -4376,8 +4372,7 @@ + } + } + +- private static final Object FOCUSED_COMPONENT = +- new StringBuilder("JTextComponent_FocusedComponent"); ++ private static final Object FOCUSED_COMPONENT = new Object(); // JTextComponent_FocusedComponent + + /** + * The default keymap that will be shared by all +--- old/src/share/classes/sun/swing/DefaultLookup.java 2009-08-11 12:08:57.514050200 +0400 ++++ openjdk/jdk/src/share/classes/sun/swing/DefaultLookup.java 2009-08-11 12:08:56.800050200 +0400 +@@ -46,8 +46,7 @@ + /** + * Key used to store DefaultLookup for AppContext. + */ +- private static final Object DEFAULT_LOOKUP_KEY = new +- StringBuffer("DefaultLookup"); ++ private static final Object DEFAULT_LOOKUP_KEY = new Object(); // DefaultLookup + /** + * Thread that last asked for a default. + */ +--- old/src/share/classes/sun/swing/SwingUtilities2.java 2009-08-11 12:09:03.402050200 +0400 ++++ openjdk/jdk/src/share/classes/sun/swing/SwingUtilities2.java 2009-08-11 12:09:02.664050200 +0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -32,25 +32,18 @@ + import static java.awt.RenderingHints.*; + import java.awt.event.*; + import java.awt.font.*; +-import java.awt.geom.*; + import java.awt.print.PrinterGraphics; +-import java.text.Bidi; + import java.text.AttributedCharacterIterator; + import java.text.AttributedString; + + import javax.swing.*; +-import javax.swing.plaf.*; + import javax.swing.text.Highlighter; + import javax.swing.text.JTextComponent; + import javax.swing.text.DefaultHighlighter; + import javax.swing.text.DefaultCaret; + import javax.swing.table.TableCellRenderer; +-import sun.swing.PrintColorUIResource; +-import sun.swing.ImageIconUIResource; + import sun.print.ProxyPrintGraphics; + import sun.awt.*; +-import sun.security.action.GetPropertyAction; +-import sun.security.util.SecurityConstants; + import java.io.*; + import java.util.*; + import sun.font.FontDesignMetrics; +@@ -74,8 +67,7 @@ + * The AppContext key for our one LAFState + * instance. + */ +- public static final Object LAF_STATE_KEY = +- new StringBuffer("LookAndFeel State"); ++ public static final Object LAF_STATE_KEY = new Object(); // LookAndFeel State + + // Most of applications use 10 or less fonts simultaneously + private static final int STRONG_BEARING_CACHE_SIZE = 10; +@@ -97,15 +89,13 @@ + * To avoid having this property persist between look and feels changes + * the value of the property is set to null in JComponent.setUI + */ +- public static final Object AA_TEXT_PROPERTY_KEY = +- new StringBuffer("AATextInfoPropertyKey"); ++ public static final Object AA_TEXT_PROPERTY_KEY = new Object(); // AATextInfoPropertyKey + + /** + * Used to tell a text component, being used as an editor for table + * or tree, how many clicks it took to start editing. + */ +- private static final StringBuilder SKIP_CLICK_COUNT = +- new StringBuilder("skipClickCount"); ++ private static final Object SKIP_CLICK_COUNT = new Object(); // skipClickCount + + /* Presently this class assumes default fractional metrics. + * This may need to change to emulate future platform L&Fs. +@@ -165,8 +155,7 @@ + * Key used in client properties used to indicate that the + * ComponentUI of the JComponent instance should be returned. + */ +- public static final Object COMPONENT_UI_PROPERTY_KEY = +- new StringBuffer("ComponentUIPropertyKey"); ++ public static final Object COMPONENT_UI_PROPERTY_KEY = new Object(); // ComponentUIPropertyKey + + /** Client Property key for the text maximal offsets for BasicMenuItemUI */ + public static final StringUIClientPropertyKey BASICMENUITEMUI_MAX_TEXT_OFFSET = diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6657138.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6657138.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,729 @@ +--- old/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Tue Jul 14 16:21:58 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Tue Jul 14 16:21:58 2009 +@@ -8,6 +8,8 @@ + package javax.swing.plaf.basic; + + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; ++ + import java.awt.*; + import java.awt.event.*; + import java.io.Serializable; +@@ -27,9 +29,6 @@ + * @author Jeff Dinkins + */ + public class BasicButtonUI extends ButtonUI{ +- // Shared UI object +- private final static BasicButtonUI buttonUI = new BasicButtonUI(); +- + // Visual constants + // NOTE: This is not used or set any where. Were we allowed to remove + // fields, this would be removed. +@@ -43,11 +42,20 @@ + protected int defaultTextShiftOffset; + + private final static String propertyPrefix = "Button" + "."; ++ ++ private static final Object BASIC_BUTTON_UI_KEY = new Object(); + + // ******************************** + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c) { ++ AppContext appContext = AppContext.getAppContext(); ++ BasicButtonUI buttonUI = ++ (BasicButtonUI) appContext.get(BASIC_BUTTON_UI_KEY); ++ if (buttonUI == null) { ++ buttonUI = new BasicButtonUI(); ++ appContext.put(BASIC_BUTTON_UI_KEY, buttonUI); ++ } + return buttonUI; + } + +--- old/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Tue Jul 14 16:21:58 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Tue Jul 14 16:21:58 2009 +@@ -7,6 +7,8 @@ + + package javax.swing.plaf.basic; + ++import sun.awt.AppContext; ++ + import java.awt.*; + import java.awt.event.*; + +@@ -26,7 +28,7 @@ + */ + public class BasicToggleButtonUI extends BasicButtonUI { + +- private final static BasicToggleButtonUI toggleButtonUI = new BasicToggleButtonUI(); ++ private static final Object BASIC_TOGGLE_BUTTON_UI_KEY = new Object(); + + private final static String propertyPrefix = "ToggleButton" + "."; + +@@ -34,6 +36,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent b) { ++ AppContext appContext = AppContext.getAppContext(); ++ BasicToggleButtonUI toggleButtonUI = ++ (BasicToggleButtonUI) appContext.get(BASIC_TOGGLE_BUTTON_UI_KEY); ++ if (toggleButtonUI == null) { ++ toggleButtonUI = new BasicToggleButtonUI(); ++ appContext.put(BASIC_TOGGLE_BUTTON_UI_KEY, toggleButtonUI); ++ } + return toggleButtonUI; + } + +--- old/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java Tue Jul 14 16:21:59 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java Tue Jul 14 16:21:59 2009 +@@ -7,6 +7,8 @@ + + package javax.swing.plaf.basic; + ++import sun.awt.AppContext; ++ + import javax.swing.*; + + import java.awt.*; +@@ -32,7 +34,7 @@ + */ + public class BasicCheckBoxUI extends BasicRadioButtonUI { + +- private final static BasicCheckBoxUI checkboxUI = new BasicCheckBoxUI(); ++ private static final Object BASIC_CHECK_BOX_UI_KEY = new Object(); + + private final static String propertyPrefix = "CheckBox" + "."; + +@@ -40,6 +42,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent b) { ++ AppContext appContext = AppContext.getAppContext(); ++ BasicCheckBoxUI checkboxUI = ++ (BasicCheckBoxUI) appContext.get(BASIC_CHECK_BOX_UI_KEY); ++ if (checkboxUI == null) { ++ checkboxUI = new BasicCheckBoxUI(); ++ appContext.put(BASIC_CHECK_BOX_UI_KEY, checkboxUI); ++ } + return checkboxUI; + } + +--- old/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Jul 14 16:21:59 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Jul 14 16:21:59 2009 +@@ -14,6 +14,7 @@ + import javax.swing.plaf.*; + import javax.swing.text.View; + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; + + + /** +@@ -24,7 +25,7 @@ + */ + public class BasicRadioButtonUI extends BasicToggleButtonUI + { +- private final static BasicRadioButtonUI radioButtonUI = new BasicRadioButtonUI(); ++ private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object(); + + protected Icon icon; + +@@ -36,6 +37,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent b) { ++ AppContext appContext = AppContext.getAppContext(); ++ BasicRadioButtonUI radioButtonUI = ++ (BasicRadioButtonUI) appContext.get(BASIC_RADIO_BUTTON_UI_KEY); ++ if (radioButtonUI == null) { ++ radioButtonUI = new BasicRadioButtonUI(); ++ appContext.put(BASIC_RADIO_BUTTON_UI_KEY, radioButtonUI); ++ } + return radioButtonUI; + } + +--- old/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Tue Jul 14 16:22:00 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Tue Jul 14 16:22:00 2009 +@@ -10,6 +10,8 @@ + import sun.swing.SwingUtilities2; + import sun.swing.DefaultLookup; + import sun.swing.UIAction; ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.plaf.*; + import javax.swing.text.View; +@@ -46,7 +48,8 @@ + * name in defaults table under the key "LabelUI". + */ + protected static BasicLabelUI labelUI = new BasicLabelUI(); +- private final static BasicLabelUI SAFE_BASIC_LABEL_UI = new BasicLabelUI(); ++ ++ private static final Object BASIC_LABEL_UI_KEY = new Object(); + + static void loadActionMap(LazyActionMap map) { + map.put(new Actions(Actions.PRESS)); +@@ -392,10 +395,16 @@ + + public static ComponentUI createUI(JComponent c) { + if (System.getSecurityManager() != null) { +- return SAFE_BASIC_LABEL_UI; +- } else { +- return labelUI; +- } ++ AppContext appContext = AppContext.getAppContext(); ++ BasicLabelUI safeBasicLabelUI = ++ (BasicLabelUI) appContext.get(BASIC_LABEL_UI_KEY); ++ if (safeBasicLabelUI == null) { ++ safeBasicLabelUI = new BasicLabelUI(); ++ appContext.put(BASIC_LABEL_UI_KEY, safeBasicLabelUI); ++ } ++ return safeBasicLabelUI; ++ } ++ return labelUI; + } + + public void propertyChange(PropertyChangeEvent e) { +--- old/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java Tue Jul 14 16:22:01 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java Tue Jul 14 16:22:01 2009 +@@ -8,6 +8,8 @@ + package javax.swing.plaf.metal; + + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; ++ + import java.awt.*; + import java.awt.event.*; + import java.lang.ref.*; +@@ -38,7 +40,7 @@ + */ + public class MetalToggleButtonUI extends BasicToggleButtonUI { + +- private static final MetalToggleButtonUI metalToggleButtonUI = new MetalToggleButtonUI(); ++ private static final Object METAL_TOGGLE_BUTTON_UI_KEY = new Object(); + + protected Color focusColor; + protected Color selectColor; +@@ -50,6 +52,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent b) { ++ AppContext appContext = AppContext.getAppContext(); ++ MetalToggleButtonUI metalToggleButtonUI = ++ (MetalToggleButtonUI) appContext.get(METAL_TOGGLE_BUTTON_UI_KEY); ++ if (metalToggleButtonUI == null) { ++ metalToggleButtonUI = new MetalToggleButtonUI(); ++ appContext.put(METAL_TOGGLE_BUTTON_UI_KEY, metalToggleButtonUI); ++ } + return metalToggleButtonUI; + } + +--- old/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java Tue Jul 14 16:22:01 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java Tue Jul 14 16:22:01 2009 +@@ -7,6 +7,8 @@ + + package javax.swing.plaf.metal; + ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.plaf.basic.BasicCheckBoxUI; + +@@ -38,7 +40,7 @@ + // of BasicCheckBoxUI because we want to pick up all the + // painting changes made in MetalRadioButtonUI. + +- private final static MetalCheckBoxUI checkboxUI = new MetalCheckBoxUI(); ++ private static final Object METAL_CHECK_BOX_UI_KEY = new Object(); + + private final static String propertyPrefix = "CheckBox" + "."; + +@@ -48,6 +50,13 @@ + // Create PlAF + // ******************************** + public static ComponentUI createUI(JComponent b) { ++ AppContext appContext = AppContext.getAppContext(); ++ MetalCheckBoxUI checkboxUI = ++ (MetalCheckBoxUI) appContext.get(METAL_CHECK_BOX_UI_KEY); ++ if (checkboxUI == null) { ++ checkboxUI = new MetalCheckBoxUI(); ++ appContext.put(METAL_CHECK_BOX_UI_KEY, checkboxUI); ++ } + return checkboxUI; + } + +--- old/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java Tue Jul 14 16:22:02 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java Tue Jul 14 16:22:01 2009 +@@ -8,6 +8,8 @@ + package javax.swing.plaf.metal; + + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; ++ + import java.awt.*; + import java.awt.event.*; + import javax.swing.*; +@@ -36,7 +38,7 @@ + */ + public class MetalRadioButtonUI extends BasicRadioButtonUI { + +- private static final MetalRadioButtonUI metalRadioButtonUI = new MetalRadioButtonUI(); ++ private static final Object METAL_RADIO_BUTTON_UI_KEY = new Object(); + + protected Color focusColor; + protected Color selectColor; +@@ -48,6 +50,13 @@ + // Create PlAF + // ******************************** + public static ComponentUI createUI(JComponent c) { ++ AppContext appContext = AppContext.getAppContext(); ++ MetalRadioButtonUI metalRadioButtonUI = ++ (MetalRadioButtonUI) appContext.get(METAL_RADIO_BUTTON_UI_KEY); ++ if (metalRadioButtonUI == null) { ++ metalRadioButtonUI = new MetalRadioButtonUI(); ++ appContext.put(METAL_RADIO_BUTTON_UI_KEY, metalRadioButtonUI); ++ } + return metalRadioButtonUI; + } + +--- old/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java Tue Jul 14 16:22:05 2009 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java Tue Jul 14 16:22:05 2009 +@@ -8,6 +8,8 @@ + package javax.swing.plaf.metal; + + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.plaf.*; + import javax.swing.plaf.basic.*; +@@ -34,15 +36,21 @@ + * name in defaults table under the key "LabelUI". + */ + protected static MetalLabelUI metalLabelUI = new MetalLabelUI(); +- private final static MetalLabelUI SAFE_METAL_LABEL_UI = new MetalLabelUI(); ++ ++ private static final Object METAL_LABEL_UI_KEY = new Object(); + +- + public static ComponentUI createUI(JComponent c) { + if (System.getSecurityManager() != null) { +- return SAFE_METAL_LABEL_UI; +- } else { +- return metalLabelUI; +- } ++ AppContext appContext = AppContext.getAppContext(); ++ MetalLabelUI safeMetalLabelUI = ++ (MetalLabelUI) appContext.get(METAL_LABEL_UI_KEY); ++ if (safeMetalLabelUI == null) { ++ safeMetalLabelUI = new MetalLabelUI(); ++ appContext.put(METAL_LABEL_UI_KEY, safeMetalLabelUI); ++ } ++ return safeMetalLabelUI; ++ } ++ return metalLabelUI; + } + + /** +--- old/src/share/classes/com/sun/java/swing/plaf/motif/MotifLabelUI.java Tue Jul 14 16:22:09 2009 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLabelUI.java Tue Jul 14 16:22:09 2009 +@@ -7,6 +7,8 @@ + + package com.sun.java.swing.plaf.motif; + ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.plaf.basic.BasicLabelUI; + import javax.swing.plaf.ComponentUI; +@@ -27,9 +29,16 @@ + */ + public class MotifLabelUI extends BasicLabelUI + { +- static MotifLabelUI sharedInstance = new MotifLabelUI(); ++ private static final Object MOTIF_LABEL_UI_KEY = new Object(); + + public static ComponentUI createUI(JComponent c) { +- return sharedInstance; ++ AppContext appContext = AppContext.getAppContext(); ++ MotifLabelUI motifLabelUI = ++ (MotifLabelUI) appContext.get(MOTIF_LABEL_UI_KEY); ++ if (motifLabelUI == null) { ++ motifLabelUI = new MotifLabelUI(); ++ appContext.put(MOTIF_LABEL_UI_KEY, motifLabelUI); ++ } ++ return motifLabelUI; + } + } +--- old/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java 2008-04-11 04:16:09.000000000 -0400 ++++ openjdk/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java 2009-11-11 13:36:45.000000000 -0500 +@@ -26,6 +26,8 @@ + package javax.swing.plaf.metal; + + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.border.*; + import javax.swing.plaf.basic.*; +@@ -50,19 +52,26 @@ + */ + public class MetalButtonUI extends BasicButtonUI { + +- private final static MetalButtonUI metalButtonUI = new MetalButtonUI(); +- + // NOTE: These are not really needed, but at this point we can't pull + // them. Their values are updated purely for historical reasons. + protected Color focusColor; + protected Color selectColor; + protected Color disabledTextColor; + ++ private static final Object METAL_BUTTON_UI_KEY = new Object(); ++ + // ******************************** + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c) { +- return metalButtonUI; ++ AppContext appContext = AppContext.getAppContext(); ++ MetalButtonUI metalButtonUI = ++ (MetalButtonUI) appContext.get(METAL_BUTTON_UI_KEY); ++ if (metalButtonUI == null) { ++ metalButtonUI = new MetalButtonUI(); ++ appContext.put(METAL_BUTTON_UI_KEY, metalButtonUI); ++ } ++ return metalButtonUI; + } + + // ******************************** +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java 2008-04-11 04:14:41.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java 2009-11-11 13:48:37.000000000 -0500 +@@ -35,6 +35,7 @@ + import static com.sun.java.swing.plaf.windows.TMSchema.*; + import static com.sun.java.swing.plaf.windows.TMSchema.Part.*; + import static com.sun.java.swing.plaf.windows.XPStyle.Skin; ++import sun.awt.AppContext; + + + /** +@@ -52,8 +53,6 @@ + */ + public class WindowsButtonUI extends BasicButtonUI + { +- private final static WindowsButtonUI windowsButtonUI = new WindowsButtonUI(); +- + protected int dashedRectGapX; + protected int dashedRectGapY; + protected int dashedRectGapWidth; +@@ -64,11 +63,20 @@ + private boolean defaults_initialized = false; + + ++ private static final Object WINDOWS_BUTTON_UI_KEY = new Object(); ++ + // ******************************** + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c){ +- return windowsButtonUI; ++ AppContext appContext = AppContext.getAppContext(); ++ WindowsButtonUI windowsButtonUI = ++ (WindowsButtonUI) appContext.get(WINDOWS_BUTTON_UI_KEY); ++ if (windowsButtonUI == null) { ++ windowsButtonUI = new WindowsButtonUI(); ++ appContext.put(WINDOWS_BUTTON_UI_KEY, windowsButtonUI); ++ } ++ return windowsButtonUI; + } + + +@@ -151,7 +159,7 @@ + * allocating them in each paint call substantially reduced the time + * it took paint to run. Obviously, this method can't be re-entered. + */ +- private static Rectangle viewRect = new Rectangle(); ++ private Rectangle viewRect = new Rectangle(); + + public void paint(Graphics g, JComponent c) { + if (XPStyle.getXP() != null) { +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java 2008-04-11 04:14:41.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java 2009-11-11 13:54:39.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.windows; + ++import sun.awt.AppContext; ++ + import javax.swing.plaf.basic.*; + import javax.swing.border.*; + import javax.swing.plaf.*; +@@ -49,19 +51,26 @@ + */ + public class WindowsToggleButtonUI extends BasicToggleButtonUI + { +- protected static int dashedRectGapX; +- protected static int dashedRectGapY; +- protected static int dashedRectGapWidth; +- protected static int dashedRectGapHeight; ++ protected int dashedRectGapX; ++ protected int dashedRectGapY; ++ protected int dashedRectGapWidth; ++ protected int dashedRectGapHeight; + + protected Color focusColor; + +- private final static WindowsToggleButtonUI windowsToggleButtonUI = new WindowsToggleButtonUI(); ++ private static final Object WINDOWS_TOGGLE_BUTTON_UI_KEY = new Object(); + + private boolean defaults_initialized = false; + + public static ComponentUI createUI(JComponent b) { +- return windowsToggleButtonUI; ++ AppContext appContext = AppContext.getAppContext(); ++ WindowsToggleButtonUI windowsToggleButtonUI = ++ (WindowsToggleButtonUI) appContext.get(WINDOWS_TOGGLE_BUTTON_UI_KEY); ++ if (windowsToggleButtonUI == null) { ++ windowsToggleButtonUI = new WindowsToggleButtonUI(); ++ appContext.put(WINDOWS_TOGGLE_BUTTON_UI_KEY, windowsToggleButtonUI); ++ } ++ return windowsToggleButtonUI; + } + + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java 2008-04-11 04:14:41.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java 2009-11-11 13:57:54.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.windows; + ++import sun.awt.AppContext; ++ + import javax.swing.plaf.basic.*; + import javax.swing.*; + import javax.swing.plaf.*; +@@ -49,7 +51,7 @@ + // of BasicCheckBoxUI because we want to pick up all the + // painting changes made in MetalRadioButtonUI. + +- private static final WindowsCheckBoxUI windowsCheckBoxUI = new WindowsCheckBoxUI(); ++ private static final Object WINDOWS_CHECK_BOX_UI_KEY = new Object(); + + private final static String propertyPrefix = "CheckBox" + "."; + +@@ -59,6 +61,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c) { ++ AppContext appContext = AppContext.getAppContext(); ++ WindowsCheckBoxUI windowsCheckBoxUI = ++ (WindowsCheckBoxUI) appContext.get(WINDOWS_CHECK_BOX_UI_KEY); ++ if (windowsCheckBoxUI == null) { ++ windowsCheckBoxUI = new WindowsCheckBoxUI(); ++ appContext.put(WINDOWS_CHECK_BOX_UI_KEY, windowsCheckBoxUI); ++ } + return windowsCheckBoxUI; + } + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java 2008-04-11 04:14:41.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java 2009-11-11 14:04:04.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.windows; + ++import sun.awt.AppContext; ++ + import javax.swing.plaf.basic.*; + import javax.swing.*; + import javax.swing.plaf.*; +@@ -44,7 +46,7 @@ + */ + public class WindowsRadioButtonUI extends BasicRadioButtonUI + { +- private static final WindowsRadioButtonUI windowsRadioButtonUI = new WindowsRadioButtonUI(); ++ private static final Object WINDOWS_RADIO_BUTTON_UI_KEY = new Object(); + + protected int dashedRectGapX; + protected int dashedRectGapY; +@@ -59,6 +61,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c) { ++ AppContext appContext = AppContext.getAppContext(); ++ WindowsRadioButtonUI windowsRadioButtonUI = ++ (WindowsRadioButtonUI) appContext.get(WINDOWS_RADIO_BUTTON_UI_KEY); ++ if (windowsRadioButtonUI == null) { ++ windowsRadioButtonUI = new WindowsRadioButtonUI(); ++ appContext.put(WINDOWS_RADIO_BUTTON_UI_KEY, windowsRadioButtonUI); ++ } + return windowsRadioButtonUI; + } + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLabelUI.java 2008-04-11 04:14:41.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLabelUI.java 2009-11-11 14:09:34.000000000 -0500 +@@ -26,6 +26,8 @@ + package com.sun.java.swing.plaf.windows; + + import sun.swing.SwingUtilities2; ++import sun.awt.AppContext; ++ + import java.awt.Color; + import java.awt.Graphics; + +@@ -51,12 +53,19 @@ + */ + public class WindowsLabelUI extends BasicLabelUI { + +- private final static WindowsLabelUI windowsLabelUI = new WindowsLabelUI(); ++ private static final Object WINDOWS_LABEL_UI_KEY = new Object(); + + // ******************************** + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c){ ++ AppContext appContext = AppContext.getAppContext(); ++ WindowsLabelUI windowsLabelUI = ++ (WindowsLabelUI) appContext.get(WINDOWS_LABEL_UI_KEY); ++ if (windowsLabelUI == null) { ++ windowsLabelUI = new WindowsLabelUI(); ++ appContext.put(WINDOWS_LABEL_UI_KEY, windowsLabelUI); ++ } + return windowsLabelUI; + } + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifButtonUI.java 2008-04-11 04:14:39.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifButtonUI.java 2009-11-11 14:11:48.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.motif; + ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.border.*; + import javax.swing.plaf.basic.*; +@@ -46,7 +48,7 @@ + */ + public class MotifButtonUI extends BasicButtonUI { + +- private final static MotifButtonUI motifButtonUI = new MotifButtonUI(); ++ private static final Object MOTIF_BUTTON_UI_KEY = new Object(); + + protected Color selectColor; + +@@ -56,6 +58,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c){ ++ AppContext appContext = AppContext.getAppContext(); ++ MotifButtonUI motifButtonUI = ++ (MotifButtonUI) appContext.get(MOTIF_BUTTON_UI_KEY); ++ if (motifButtonUI == null) { ++ motifButtonUI = new MotifButtonUI(); ++ appContext.put(MOTIF_BUTTON_UI_KEY, motifButtonUI); ++ } + return motifButtonUI; + } + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifToggleButtonUI.java 2008-04-11 04:14:40.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifToggleButtonUI.java 2009-11-11 14:15:18.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.motif; + ++import sun.awt.AppContext; ++ + import java.awt.*; + import java.awt.event.*; + +@@ -48,7 +50,7 @@ + */ + public class MotifToggleButtonUI extends BasicToggleButtonUI + { +- private final static MotifToggleButtonUI motifToggleButtonUI = new MotifToggleButtonUI(); ++ private static final Object MOTIF_TOGGLE_BUTTON_UI_KEY = new Object(); + + protected Color selectColor; + +@@ -57,7 +59,14 @@ + // ******************************** + // Create PLAF + // ******************************** +- public static ComponentUI createUI(JComponent b) { ++ public static ComponentUI createUI(JComponent b) { ++ AppContext appContext = AppContext.getAppContext(); ++ MotifToggleButtonUI motifToggleButtonUI = ++ (MotifToggleButtonUI) appContext.get(MOTIF_TOGGLE_BUTTON_UI_KEY); ++ if (motifToggleButtonUI == null) { ++ motifToggleButtonUI = new MotifToggleButtonUI(); ++ appContext.put(MOTIF_TOGGLE_BUTTON_UI_KEY, motifToggleButtonUI); ++ } + return motifToggleButtonUI; + } + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifCheckBoxUI.java 2008-04-11 04:14:39.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifCheckBoxUI.java 2009-11-11 14:20:05.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.motif; + ++import sun.awt.AppContext; ++ + import javax.swing.*; + + import javax.swing.plaf.*; +@@ -45,7 +47,7 @@ + */ + public class MotifCheckBoxUI extends MotifRadioButtonUI { + +- private static final MotifCheckBoxUI motifCheckBoxUI = new MotifCheckBoxUI(); ++ private static final Object MOTIF_CHECK_BOX_UI_KEY = new Object(); + + private final static String propertyPrefix = "CheckBox" + "."; + +@@ -56,6 +58,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c){ ++ AppContext appContext = AppContext.getAppContext(); ++ MotifCheckBoxUI motifCheckBoxUI = ++ (MotifCheckBoxUI) appContext.get(MOTIF_CHECK_BOX_UI_KEY); ++ if (motifCheckBoxUI == null) { ++ motifCheckBoxUI = new MotifCheckBoxUI(); ++ appContext.put(MOTIF_CHECK_BOX_UI_KEY, motifCheckBoxUI); ++ } + return motifCheckBoxUI; + } + +--- openjdk-orig/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifRadioButtonUI.java 2008-04-11 04:14:40.000000000 -0400 ++++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifRadioButtonUI.java 2009-11-11 14:23:14.000000000 -0500 +@@ -25,6 +25,8 @@ + + package com.sun.java.swing.plaf.motif; + ++import sun.awt.AppContext; ++ + import javax.swing.*; + import javax.swing.border.*; + import javax.swing.plaf.basic.BasicRadioButtonUI; +@@ -47,7 +49,7 @@ + */ + public class MotifRadioButtonUI extends BasicRadioButtonUI { + +- private static final MotifRadioButtonUI motifRadioButtonUI = new MotifRadioButtonUI(); ++ private static final Object MOTIF_RADIO_BUTTON_UI_KEY = new Object(); + + protected Color focusColor; + +@@ -57,6 +59,13 @@ + // Create PLAF + // ******************************** + public static ComponentUI createUI(JComponent c) { ++ AppContext appContext = AppContext.getAppContext(); ++ MotifRadioButtonUI motifRadioButtonUI = ++ (MotifRadioButtonUI) appContext.get(MOTIF_RADIO_BUTTON_UI_KEY); ++ if (motifRadioButtonUI == null) { ++ motifRadioButtonUI = new MotifRadioButtonUI(); ++ appContext.put(MOTIF_RADIO_BUTTON_UI_KEY, motifRadioButtonUI); ++ } + return motifRadioButtonUI; + } + diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6658158.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6658158.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,815 @@ +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java Mon Mar 9 22:21:43 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java Mon Mar 9 22:21:42 2009 +@@ -54,13 +54,20 @@ + * + */ + public class HttpSOAPConnection extends SOAPConnection { ++ ++ public static final String vmVendor = System.getProperty("java.vendor.url"); ++ private static final String sunVmVendor = "http://java.sun.com/"; ++ private static final String ibmVmVendor = "http://www.ibm.com/"; ++ private static final boolean isSunVM = sunVmVendor.equals(vmVendor) ? true: false; ++ private static final boolean isIBMVM = ibmVmVendor.equals(vmVendor) ? true : false; ++ private static final String JAXM_URLENDPOINT="javax.xml.messaging.URLEndpoint"; + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.HTTP_CONN_DOMAIN, + "com.sun.xml.internal.messaging.saaj.client.p2p.LocalStrings"); + +- public static String defaultProxyHost = null; +- public static int defaultProxyPort = -1; ++ public static final String defaultProxyHost = null; ++ public static final int defaultProxyPort = -1; + + MessageFactory messageFactory = null; + +@@ -72,6 +79,9 @@ + + try { + messageFactory = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL); ++ } catch (NoSuchMethodError ex) { ++ //fallback to default SOAP 1.1 in this case for backward compatibility ++ messageFactory = MessageFactory.newInstance(); + } catch (Exception ex) { + log.log(Level.SEVERE, "SAAJ0001.p2p.cannot.create.msg.factory", ex); + throw new SOAPExceptionImpl("Unable to create message factory", ex); +@@ -95,14 +105,19 @@ + throw new SOAPExceptionImpl("Connection is closed"); + } + +- Class urlEndpointClass = null; ++ Class urlEndpointClass = null; ++ ClassLoader loader = Thread.currentThread().getContextClassLoader(); + + try { +- urlEndpointClass = Class.forName("javax.xml.messaging.URLEndpoint"); +- } catch (Exception ex) { +- //Do nothing. URLEndpoint is available only when JAXM is there. +- log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); +- } ++ if (loader != null) { ++ urlEndpointClass = loader.loadClass(JAXM_URLENDPOINT); ++ } else { ++ urlEndpointClass = Class.forName(JAXM_URLENDPOINT); ++ } ++ } catch (ClassNotFoundException ex) { ++ //Do nothing. URLEndpoint is available only when JAXM is there. ++ log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); ++ } + + if (urlEndpointClass != null) { + if (urlEndpointClass.isInstance(endPoint)) { +@@ -639,10 +654,23 @@ + + return ret; + } +- +- private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; +- private static String SSL_PROVIDER = +- "com.sun.net.ssl.internal.ssl.Provider"; ++ //private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; ++ //private static String SSL_PROVIDER = ++ // "com.sun.net.ssl.internal.ssl.Provider"; ++ private static final String SSL_PKG; ++ private static final String SSL_PROVIDER; ++ ++ ++ static { ++ if (isIBMVM) { ++ SSL_PKG ="com.ibm.net.ssl.internal.www.protocol"; ++ SSL_PROVIDER ="com.ibm.net.ssl.internal.ssl.Provider"; ++ } else { ++ //if not IBM VM default to Sun. ++ SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; ++ SSL_PROVIDER ="com.sun.net.ssl.internal.ssl.Provider"; ++ } ++ } + private void initHttps() { + //if(!setHttps) { + String pkgs = System.getProperty("java.protocol.handler.pkgs"); +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java Mon Mar 9 22:21:45 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java Mon Mar 9 22:21:45 2009 +@@ -70,7 +70,7 @@ + */ + public class AttachmentPartImpl extends AttachmentPart { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java Mon Mar 9 22:21:48 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java Mon Mar 9 22:21:47 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: EnvelopeFactory.java,v 1.24 2006/01/27 12:49:26 vj135062 Exp $ +- * $Revision: 1.24 $ +- * $Date: 2006/01/27 12:49:26 $ ++ * ++ * ++ * + */ + + +@@ -55,7 +55,7 @@ + */ + public class EnvelopeFactory { + +- protected static Logger ++ protected static final Logger + log = Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ImageDataContentHandler.java Mon Mar 9 22:21:50 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ImageDataContentHandler.java Mon Mar 9 22:21:50 2009 +@@ -49,7 +49,7 @@ + public class ImageDataContentHandler extends Component + implements DataContentHandler { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageFactoryImpl.java Mon Mar 9 22:21:53 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageFactoryImpl.java Mon Mar 9 22:21:52 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: MessageFactoryImpl.java,v 1.23 2006/01/27 12:49:27 vj135062 Exp $ +- * $Revision: 1.23 $ +- * $Date: 2006/01/27 12:49:27 $ ++ * ++ * ++ * + */ + + +@@ -54,15 +54,15 @@ + */ + public class MessageFactoryImpl extends MessageFactory { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +- protected static OutputStream listener; ++ protected OutputStream listener; + + protected boolean lazyAttachments = false; + +- public static OutputStream listen(OutputStream newListener) { ++ public OutputStream listen(OutputStream newListener) { + OutputStream oldListener = listener; + listener = newListener; + return oldListener; +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java Mon Mar 9 22:21:55 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java Mon Mar 9 22:21:54 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: MessageImpl.java,v 1.5 2006/12/12 10:16:33 kumarjayanti Exp $ +- * $Revision: 1.5 $ +- * $Date: 2006/12/12 10:16:33 $ ++ * ++ * ++ * + */ + + +@@ -69,7 +69,7 @@ + public static final String CONTENT_ID = "Content-ID"; + public static final String CONTENT_LOCATION = "Content-Location"; + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SAAJMetaFactoryImpl.java Mon Mar 9 22:21:58 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SAAJMetaFactoryImpl.java Mon Mar 9 22:21:57 2009 +@@ -37,7 +37,7 @@ + + public class SAAJMetaFactoryImpl extends SAAJMetaFactory { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java Mon Mar 9 22:22:00 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java Mon Mar 9 22:21:59 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: SOAPDocumentImpl.java,v 1.15 2006/01/27 12:49:29 vj135062 Exp $ ++ * + */ + + +@@ -45,7 +45,7 @@ + + public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPFactoryImpl.java Mon Mar 9 22:22:02 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPFactoryImpl.java Mon Mar 9 22:22:02 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: SOAPFactoryImpl.java,v 1.21 2006/01/27 12:49:29 vj135062 Exp $ +- * $Revision: 1.21 $ +- * $Date: 2006/01/27 12:49:29 $ ++ * ++ * ++ * + */ + + +@@ -50,7 +50,7 @@ + + public abstract class SOAPFactoryImpl extends SOAPFactory { + +- protected static Logger ++ protected static final Logger + log = Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java Mon Mar 9 22:22:05 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java Mon Mar 9 22:22:04 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: SOAPPartImpl.java,v 1.1.1.1 2006/01/27 13:10:55 kumarjayanti Exp $ +- * $Revision: 1.1.1.1 $ +- * $Date: 2006/01/27 13:10:55 $ ++ * ++ * ++ * + */ + + +@@ -59,7 +59,7 @@ + * @author Anil Vijendran (anil@sun.com) + */ + public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument { +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java Mon Mar 9 22:22:07 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CDATAImpl.java Mon Mar 9 22:22:07 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: CDATAImpl.java,v 1.19 2006/01/27 12:49:34 vj135062 Exp $ +- * $Revision: 1.19 $ +- * $Date: 2006/01/27 12:49:34 $ ++ * ++ * ++ * + */ + + +@@ -43,7 +43,7 @@ + extends com.sun.org.apache.xerces.internal.dom.CDATASectionImpl + implements javax.xml.soap.Text { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CommentImpl.java Mon Mar 9 22:22:10 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/CommentImpl.java Mon Mar 9 22:22:09 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: CommentImpl.java,v 1.17 2006/01/27 12:49:34 vj135062 Exp $ +- * $Revision: 1.17 $ +- * $Date: 2006/01/27 12:49:34 $ ++ * ++ * ++ * + */ + + +@@ -47,7 +47,7 @@ + extends com.sun.org.apache.xerces.internal.dom.CommentImpl + implements javax.xml.soap.Text, org.w3c.dom.Comment { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); + protected static ResourceBundle rb = +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java Mon Mar 9 22:22:12 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java Mon Mar 9 22:22:11 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: ElementImpl.java,v 1.6 2006/11/16 16:01:14 kumarjayanti Exp $ +- * $Revision: 1.6 $ +- * $Date: 2006/11/16 16:01:14 $ ++ * ++ * ++ * + */ + + +@@ -60,7 +60,7 @@ + + protected QName elementQName; + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/TextImpl.java Mon Mar 9 22:22:15 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/TextImpl.java Mon Mar 9 22:22:14 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: TextImpl.java,v 1.19 2006/01/27 12:49:36 vj135062 Exp $ +- * $Revision: 1.19 $ +- * $Date: 2006/01/27 12:49:36 $ ++ * ++ * ++ * + */ + + +@@ -43,7 +43,7 @@ + extends com.sun.org.apache.xerces.internal.dom.TextImpl + implements javax.xml.soap.Text, org.w3c.dom.Text { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/name/NameImpl.java Mon Mar 9 22:22:17 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/name/NameImpl.java Mon Mar 9 22:22:16 2009 +@@ -23,9 +23,9 @@ + * have any questions. + */ + /* +- * $Id: NameImpl.java,v 1.48 2006/01/27 12:49:38 vj135062 Exp $ +- * $Revision: 1.48 $ +- * $Date: 2006/01/27 12:49:38 $ ++ * ++ * ++ * + */ + + +@@ -63,7 +63,7 @@ + protected String prefix = ""; + private String qualifiedName = null; + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.NAMING_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.name.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Fault1_1Impl.java Mon Mar 9 22:22:19 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Fault1_1Impl.java Mon Mar 9 22:22:19 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Fault1_1Impl.java,v 1.1.1.1 2006/01/27 13:10:57 kumarjayanti Exp $ ++ * + */ + + +@@ -57,7 +57,7 @@ + + public class Fault1_1Impl extends FaultImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger( + LogDomainConstants.SOAP_VER1_1_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings"); +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Header1_1Impl.java Mon Mar 9 22:22:22 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Header1_1Impl.java Mon Mar 9 22:22:21 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Header1_1Impl.java,v 1.29 2006/01/27 12:49:41 vj135062 Exp $ ++ * + */ + + +@@ -50,7 +50,7 @@ + + public class Header1_1Impl extends HeaderImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/HeaderElement1_1Impl.java Mon Mar 9 22:22:24 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/HeaderElement1_1Impl.java Mon Mar 9 22:22:24 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: HeaderElement1_1Impl.java,v 1.29 2006/01/27 12:49:41 vj135062 Exp $ ++ * + */ + + +@@ -49,7 +49,7 @@ + + public class HeaderElement1_1Impl extends HeaderElementImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Message1_1Impl.java Mon Mar 9 22:22:27 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/Message1_1Impl.java Mon Mar 9 22:22:26 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Message1_1Impl.java,v 1.24 2006/01/27 12:49:41 vj135062 Exp $ ++ * + */ + + +@@ -48,7 +48,7 @@ + + public class Message1_1Impl extends MessageImpl implements SOAPConstants { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java Mon Mar 9 22:22:29 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java Mon Mar 9 22:22:28 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: SOAPPart1_1Impl.java,v 1.1.1.1 2006/01/27 13:10:57 kumarjayanti Exp $ ++ * + */ + + +@@ -48,7 +48,7 @@ + + public class SOAPPart1_1Impl extends SOAPPartImpl implements SOAPConstants { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Body1_2Impl.java Mon Mar 9 22:22:32 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Body1_2Impl.java Mon Mar 9 22:22:31 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Body1_2Impl.java,v 1.32 2006/01/27 12:49:44 vj135062 Exp $ ++ * + */ + + +@@ -50,7 +50,7 @@ + + public class Body1_2Impl extends BodyImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(Body1_2Impl.class.getName(), + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java Mon Mar 9 22:22:34 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Detail1_2Impl.java Mon Mar 9 22:22:34 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Detail1_2Impl.java,v 1.24 2006/01/27 12:49:45 vj135062 Exp $ ++ * + */ + + +@@ -47,7 +47,7 @@ + + public class Detail1_2Impl extends DetailImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(Detail1_2Impl.class.getName(), + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Envelope1_2Impl.java Mon Mar 9 22:22:37 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Envelope1_2Impl.java Mon Mar 9 22:22:36 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Envelope1_2Impl.java,v 1.26 2006/01/27 12:49:47 vj135062 Exp $ ++ * + */ + + +@@ -47,7 +47,7 @@ + + public class Envelope1_2Impl extends EnvelopeImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(Envelope1_2Impl.class.getName(), + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java Mon Mar 9 22:22:39 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java Mon Mar 9 22:22:38 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Fault1_2Impl.java,v 1.1.1.1 2006/01/27 13:10:57 kumarjayanti Exp $ ++ * + */ + + +@@ -51,7 +51,7 @@ + + public class Fault1_2Impl extends FaultImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger( + LogDomainConstants.SOAP_VER1_2_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Header1_2Impl.java Mon Mar 9 22:22:41 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Header1_2Impl.java Mon Mar 9 22:22:41 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: Header1_2Impl.java,v 1.36 2006/01/27 12:49:48 vj135062 Exp $ ++ * + */ + + +@@ -53,7 +53,7 @@ + + public class Header1_2Impl extends HeaderImpl { + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger( + LogDomainConstants.SOAP_VER1_2_DOMAIN, + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/HeaderElement1_2Impl.java Mon Mar 9 22:22:44 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/HeaderElement1_2Impl.java Mon Mar 9 22:22:43 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: HeaderElement1_2Impl.java,v 1.29 2006/01/27 12:49:48 vj135062 Exp $ ++ * + */ + + +@@ -47,7 +47,7 @@ + + public class HeaderElement1_2Impl extends HeaderElementImpl { + +- private static Logger log = ++ private static final Logger log = + Logger.getLogger(HeaderElement1_2Impl.class.getName(), + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPPart1_2Impl.java Mon Mar 9 22:22:46 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/SOAPPart1_2Impl.java Mon Mar 9 22:22:46 2009 +@@ -23,7 +23,7 @@ + * have any questions. + */ + /* +- * $Id: SOAPPart1_2Impl.java,v 1.1.1.1 2006/01/27 13:10:57 kumarjayanti Exp $ ++ * + */ + + +@@ -47,7 +47,7 @@ + + public class SOAPPart1_2Impl extends SOAPPartImpl implements SOAPConstants{ + +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(SOAPPart1_2Impl.class.getName(), + "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/util/RejectDoctypeSaxFilter.java Mon Mar 9 22:22:49 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/util/RejectDoctypeSaxFilter.java Mon Mar 9 22:22:48 2009 +@@ -45,12 +45,12 @@ + * because they are not legal in SOAP. If the user of this class sets a + * LexicalHandler, then it forwards events to that handler. + * +- * $Id: RejectDoctypeSaxFilter.java,v 1.13 2006/01/27 12:49:52 vj135062 Exp $ ++ * + * @author Edwin Goei + */ + + public class RejectDoctypeSaxFilter extends XMLFilterImpl implements XMLReader, LexicalHandler{ +- protected static Logger log = ++ protected static final Logger log = + Logger.getLogger(LogDomainConstants.UTIL_DOMAIN, + "com.sun.xml.internal.messaging.saaj.util.LocalStrings"); + +--- old/src/share/classes/com/sun/xml/internal/messaging/saaj/util/transform/EfficientStreamingTransformer.java Mon Mar 9 22:22:51 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/messaging/saaj/util/transform/EfficientStreamingTransformer.java Mon Mar 9 22:22:50 2009 +@@ -62,20 +62,22 @@ + public class EfficientStreamingTransformer + extends javax.xml.transform.Transformer { + +- static final String version; +- static final String vendor; ++ //static final String version; ++ //static final String vendor; + +- protected static TransformerFactory transformerFactory = TransformerFactory.newInstance(); ++ protected static final TransformerFactory transformerFactory = TransformerFactory.newInstance(); + +- static { +- version = System.getProperty("java.vm.version"); +- vendor = System.getProperty("java.vm.vendor"); +- if (vendor.startsWith("Sun") && +- (version.startsWith("1.4") || version.startsWith("1.3"))) { +- transformerFactory = +- new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl(); +- } +- } ++ //removing support for Java 1.4 and 1.3 : CR6658158 ++ /*static { ++ version = System.getProperty("java.vm.version"); ++ vendor = System.getProperty("java.vm.vendor"); ++ if (vendor.startsWith("Sun") && ++ (version.startsWith("1.4") || version.startsWith("1.3"))) { ++ transformerFactory = ++ new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl(); ++ } ++} ++*/ + + /** + * TransformerFactory instance. +--- old/src/share/classes/com/sun/xml/internal/txw2/DatatypeWriter.java Mon Mar 9 22:22:53 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/txw2/DatatypeWriter.java Mon Mar 9 22:22:53 2009 +@@ -25,6 +25,9 @@ + + package com.sun.xml.internal.txw2; + ++import java.util.AbstractList; ++import java.util.Collections; ++import java.util.List; + import javax.xml.namespace.QName; + + /** +@@ -53,50 +56,60 @@ + */ + void print(DT dt, NamespaceResolver resolver, StringBuilder buf); + +- +- static final DatatypeWriter[] BUILDIN = new DatatypeWriter[] { +- new DatatypeWriter() { +- public Class getType() { +- return String.class; ++ static final List> BUILTIN = Collections.unmodifiableList(new AbstractList() { ++ ++ private DatatypeWriter[] BUILTIN_ARRAY = new DatatypeWriter[] { ++ new DatatypeWriter() { ++ public Class getType() { ++ return String.class; ++ } ++ public void print(String s, NamespaceResolver resolver, StringBuilder buf) { ++ buf.append(s); ++ } ++ }, ++ new DatatypeWriter() { ++ public Class getType() { ++ return Integer.class; ++ } ++ public void print(Integer i, NamespaceResolver resolver, StringBuilder buf) { ++ buf.append(i); ++ } ++ }, ++ new DatatypeWriter() { ++ public Class getType() { ++ return Float.class; ++ } ++ public void print(Float f, NamespaceResolver resolver, StringBuilder buf) { ++ buf.append(f); ++ } ++ }, ++ new DatatypeWriter() { ++ public Class getType() { ++ return Double.class; ++ } ++ public void print(Double d, NamespaceResolver resolver, StringBuilder buf) { ++ buf.append(d); ++ } ++ }, ++ new DatatypeWriter() { ++ public Class getType() { ++ return QName.class; ++ } ++ public void print(QName qn, NamespaceResolver resolver, StringBuilder buf) { ++ String p = resolver.getPrefix(qn.getNamespaceURI()); ++ if(p.length()!=0) ++ buf.append(p).append(':'); ++ buf.append(qn.getLocalPart()); ++ } + } +- public void print(String s, NamespaceResolver resolver, StringBuilder buf) { +- buf.append(s); +- } +- }, +- new DatatypeWriter() { +- public Class getType() { +- return Integer.class; +- } +- public void print(Integer i, NamespaceResolver resolver, StringBuilder buf) { +- buf.append(i); +- } +- }, +- new DatatypeWriter() { +- public Class getType() { +- return Float.class; +- } +- public void print(Float f, NamespaceResolver resolver, StringBuilder buf) { +- buf.append(f); +- } +- }, +- new DatatypeWriter() { +- public Class getType() { +- return Double.class; +- } +- public void print(Double d, NamespaceResolver resolver, StringBuilder buf) { +- buf.append(d); +- } +- }, +- new DatatypeWriter() { +- public Class getType() { +- return QName.class; +- } +- public void print(QName qn, NamespaceResolver resolver, StringBuilder buf) { +- String p = resolver.getPrefix(qn.getNamespaceURI()); +- if(p.length()!=0) +- buf.append(p).append(':'); +- buf.append(qn.getLocalPart()); +- } ++ }; ++ ++ public DatatypeWriter get(int n) { ++ return BUILTIN_ARRAY[n]; + } +- }; ++ ++ public int size() { ++ return BUILTIN_ARRAY.length; ++ } ++ }); + } +--- old/src/share/classes/com/sun/xml/internal/txw2/Document.java Mon Mar 9 22:22:56 2009 ++++ openjdk/jaxws/src/share/classes/com/sun/xml/internal/txw2/Document.java Mon Mar 9 22:22:55 2009 +@@ -76,7 +76,7 @@ + + Document(XmlSerializer out) { + this.out = out; +- for( DatatypeWriter dw : DatatypeWriter.BUILDIN ) ++ for( DatatypeWriter dw : DatatypeWriter.BUILTIN ) + datatypeWriters.put(dw.getType(),dw); + } + diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6664512.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6664512.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,1194 @@ +--- old/src/share/classes/java/awt/Component.java 2009-07-23 13:47:51.000000000 +0400 ++++ openjdk/jdk/src/share/classes/java/awt/Component.java 2009-07-23 13:47:51.000000000 +0400 +@@ -4307,7 +4307,7 @@ + } + + if (eventLog.isLoggable(Level.FINEST)) { +- eventLog.log(Level.FINEST, "{0}", e); ++ eventLog.log(Level.FINEST, "{0}", String.valueOf(e)); + } + + /* +--- old/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2009-07-23 13:47:53.000000000 +0400 ++++ openjdk/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2009-07-23 13:47:53.000000000 +0400 +@@ -379,7 +379,7 @@ + // should receive focus first + if (focusLog.isLoggable(Level.FINER)) { + focusLog.log(Level.FINER, "tempLost {0}, toFocus {1}", +- new Object[]{tempLost, toFocus}); ++ new Object[]{String.valueOf(tempLost), String.valueOf(toFocus)}); + } + if (tempLost != null) { + tempLost.requestFocusInWindow(CausedFocusEvent.Cause.ACTIVATION); +@@ -447,7 +447,8 @@ + Component newFocusOwner = fe.getComponent(); + if (oldFocusOwner == newFocusOwner) { + if (focusLog.isLoggable(Level.FINE)) { +- focusLog.log(Level.FINE, "Skipping {0} because focus owner is the same", new Object[] {e}); ++ focusLog.log(Level.FINE, "Skipping {0} because focus owner is the same", ++ new Object[] {String.valueOf(e)}); + } + // We can't just drop the event - there could be + // type-ahead markers associated with it. +@@ -554,16 +555,20 @@ + FocusEvent fe = (FocusEvent)e; + Component currentFocusOwner = getGlobalFocusOwner(); + if (currentFocusOwner == null) { +- if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Skipping {0} because focus owner is null", +- new Object[] {e}); ++ if (focusLog.isLoggable(Level.FINE)) { ++ focusLog.log(Level.FINE, "Skipping {0} because focus owner is null", ++ new Object[] {String.valueOf(e)}); ++ } + break; + } + // Ignore cases where a Component loses focus to itself. + // If we make a mistake because of retargeting, then the + // FOCUS_GAINED handler will correct it. + if (currentFocusOwner == fe.getOppositeComponent()) { +- if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Skipping {0} because current focus owner is equal to opposite", +- new Object[] {e}); ++ if (focusLog.isLoggable(Level.FINE)) { ++ focusLog.log(Level.FINE, "Skipping {0} because current focus owner is equal to opposite", ++ new Object[] {String.valueOf(e)}); ++ } + break; + } + +@@ -631,9 +636,11 @@ + Window losingFocusWindow = we.getWindow(); + Window activeWindow = getGlobalActiveWindow(); + Window oppositeWindow = we.getOppositeWindow(); +- if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Active {0}, Current focused {1}, losing focus {2} opposite {3}", +- new Object[] {activeWindow, currentFocusedWindow, +- losingFocusWindow, oppositeWindow}); ++ if (focusLog.isLoggable(Level.FINE)) { ++ focusLog.log(Level.FINE, "Active {0}, Current focused {1}, losing focus {2} opposite {3}", ++ new Object[] {String.valueOf(activeWindow), String.valueOf(currentFocusedWindow), ++ String.valueOf(losingFocusWindow), String.valueOf(oppositeWindow)}); ++ } + if (currentFocusedWindow == null) { + break; + } +@@ -818,7 +825,10 @@ + } + } + if (ke != null) { +- focusLog.log(Level.FINER, "Pumping approved event {0}", new Object[] {ke}); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "Pumping approved event {0}", ++ new Object[] {String.valueOf(ke)}); ++ } + enqueuedKeyEvents.removeFirst(); + } + } +@@ -840,7 +850,7 @@ + Iterator iter = typeAheadMarkers.iterator(); + while (iter.hasNext()) { + TypeAheadMarker marker = (TypeAheadMarker)iter.next(); +- focusLog.log(Level.FINEST, " {0}", marker); ++ focusLog.log(Level.FINEST, " {0}", String.valueOf(marker)); + } + } + } +@@ -868,7 +878,10 @@ + // The fix is rolled out. + + if (ke.getWhen() > marker.after) { +- focusLog.log(Level.FINER, "Storing event {0} because of marker {1}", new Object[] {ke, marker}); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "Storing event {0} because of marker {1}", ++ new Object[] {String.valueOf(ke), String.valueOf(marker)}); ++ } + enqueuedKeyEvents.addLast(ke); + return true; + } +@@ -880,7 +893,10 @@ + } + + case FocusEvent.FOCUS_GAINED: +- focusLog.log(Level.FINEST, "Markers before FOCUS_GAINED on {0}", new Object[] {target}); ++ if (focusLog.isLoggable(Level.FINEST)) { ++ focusLog.log(Level.FINEST, "Markers before FOCUS_GAINED on {0}", ++ new Object[] {String.valueOf(target)}); ++ } + dumpMarkers(); + // Search the marker list for the first marker tied to + // the Component which just gained focus. Then remove +@@ -909,7 +925,9 @@ + } + } else { + // Exception condition - event without marker +- focusLog.log(Level.FINER, "Event without marker {0}", e); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "Event without marker {0}", String.valueOf(e)); ++ } + } + } + focusLog.log(Level.FINEST, "Markers after FOCUS_GAINED"); +@@ -1146,8 +1164,10 @@ + return; + } + +- focusLog.log(Level.FINER, "Enqueue at {0} for {1}", +- new Object[] {after, untilFocused}); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "Enqueue at {0} for {1}", ++ new Object[] {after, String.valueOf(untilFocused)}); ++ } + + int insertionIndex = 0, + i = typeAheadMarkers.size(); +@@ -1186,8 +1206,10 @@ + return; + } + +- focusLog.log(Level.FINER, "Dequeue at {0} for {1}", +- new Object[] {after, untilFocused}); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "Dequeue at {0} for {1}", ++ new Object[] {after, String.valueOf(untilFocused)}); ++ } + + TypeAheadMarker marker; + ListIterator iter = typeAheadMarkers.listIterator +--- old/src/share/classes/java/awt/KeyboardFocusManager.java 2009-07-23 13:47:54.000000000 +0400 ++++ openjdk/jdk/src/share/classes/java/awt/KeyboardFocusManager.java 2009-07-23 13:47:54.000000000 +0400 +@@ -586,7 +586,7 @@ + void setNativeFocusOwner(Component comp) { + if (focusLog.isLoggable(Level.FINEST)) { + focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}", +- new Object[] {peer, comp}); ++ new Object[] {String.valueOf(peer), String.valueOf(comp)}); + } + peer.setCurrentFocusOwner(comp); + } +@@ -2338,20 +2338,20 @@ + Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); + if (focusLog.isLoggable(Level.FINER)) { + focusLog.log(Level.FINER, "SNFH for {0} in {1}", +- new Object[] {descendant, heavyweight}); ++ new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)}); + } + if (focusLog.isLoggable(Level.FINEST)) { + focusLog.log(Level.FINEST, "0. Current focus owner {0}", +- currentFocusOwner); ++ String.valueOf(currentFocusOwner)); + focusLog.log(Level.FINEST, "0. Native focus owner {0}", +- nativeFocusOwner); ++ String.valueOf(nativeFocusOwner)); + focusLog.log(Level.FINEST, "0. Native focused window {0}", +- nativeFocusedWindow); ++ String.valueOf(nativeFocusedWindow)); + } + synchronized (heavyweightRequests) { + HeavyweightFocusRequest hwFocusRequest = getLastHWRequest(); + if (focusLog.isLoggable(Level.FINEST)) { +- focusLog.log(Level.FINEST, "Request {0}", hwFocusRequest); ++ focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest)); + } + if (hwFocusRequest == null && + heavyweight == nativeFocusOwner) +@@ -2360,7 +2360,7 @@ + // Redundant request. + if (focusLog.isLoggable(Level.FINEST)) + focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}", +- descendant); ++ String.valueOf(descendant)); + return SNFH_FAILURE; + } + +@@ -2393,7 +2393,7 @@ + SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent); + + if (focusLog.isLoggable(Level.FINEST)) +- focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", descendant); ++ focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant)); + return SNFH_SUCCESS_HANDLED; + } else if (hwFocusRequest != null && + hwFocusRequest.heavyweight == heavyweight) { +@@ -2900,11 +2900,11 @@ + KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); + if (focusLog.isLoggable(Level.FINER)) { + if (event instanceof FocusEvent || event instanceof WindowEvent) { +- focusLog.log(Level.FINER, ">>> {0}", new Object[] {event}); ++ focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)}); + } + if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) { +- focusLog.log(Level.FINER, " focus owner is {0}", new Object[] {manager.getGlobalFocusOwner()}); +- focusLog.log(Level.FINER, ">>> {0}", new Object[] {event}); ++ focusLog.log(Level.FINER, " focus owner is {0}", new Object[] {String.valueOf(manager.getGlobalFocusOwner())}); ++ focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)}); + } + } + +--- old/src/share/classes/sun/awt/DebugSettings.java 2009-07-23 13:47:56.000000000 +0400 ++++ openjdk/jdk/src/share/classes/sun/awt/DebugSettings.java 2009-07-23 13:47:56.000000000 +0400 +@@ -129,7 +129,7 @@ + + // echo the initial property settings to stdout + if (log.isLoggable(Level.FINE)) { +- log.log(Level.FINE, "DebugSettings:\n{0}", this); ++ log.log(Level.FINE, "DebugSettings:\n{0}", String.valueOf(this)); + } + } + +--- old/src/solaris/classes/sun/awt/X11/XBaseWindow.java 2009-07-23 13:47:57.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java 2009-07-23 13:47:57.000000000 +0400 +@@ -824,7 +824,9 @@ + * The active grab overrides activated automatic grab. + */ + public boolean grabInput() { +- grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {this}); ++ if (grabLog.isLoggable(Level.FINE)) { ++ grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {String.valueOf(this)}); ++ } + + XToolkit.awtLock(); + try { +@@ -879,7 +881,10 @@ + XToolkit.awtLock(); + try { + XBaseWindow grabWindow = XAwtState.getGrabWindow(); +- grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow}); ++ if (grabLog.isLoggable(Level.FINE)) { ++ grabLog.log(Level.FINE, "UnGrab input on {0}", ++ new Object[] {String.valueOf(grabWindow)}); ++ } + if (grabWindow != null) { + grabWindow.ungrabInputImpl(); + XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime); +@@ -930,7 +935,7 @@ + XPropertyCache.clearCache(window, XAtom.get(msg.get_atom())); + } + if (eventLog.isLoggable(Level.FINER)) { +- eventLog.log(Level.FINER, "{0}", new Object[] {msg}); ++ eventLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(msg)}); + } + } + +@@ -1000,8 +1005,10 @@ + } + public void handleConfigureNotifyEvent(XEvent xev) { + XConfigureEvent xe = xev.get_xconfigure(); +- insLog.log(Level.FINER, "Configure, {0}", +- new Object[] {xe}); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "Configure, {0}", ++ new Object[] {String.valueOf(xe)}); ++ } + x = xe.get_x(); + y = xe.get_y(); + width = xe.get_width(); +--- old/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java 2009-07-23 13:47:59.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java 2009-07-23 13:47:58.000000000 +0400 +@@ -29,8 +29,6 @@ + import java.awt.peer.*; + import java.awt.event.*; + +-import java.util.logging.*; +- + import java.lang.reflect.Field; + import sun.awt.SunToolkit; + +@@ -42,8 +40,6 @@ + * + ************************************************/ + +- private static Logger log = Logger.getLogger("sun.awt.X11.XCheckboxMenuItemPeer"); +- + /* + * CheckboxMenuItem's fields + */ +--- old/src/solaris/classes/sun/awt/X11/XComponentPeer.java 2009-07-23 13:48:00.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java 2009-07-23 13:47:59.000000000 +0400 +@@ -261,7 +261,9 @@ + * Called when component receives focus + */ + public void focusGained(FocusEvent e) { +- focusLog.log(Level.FINE, "{0}", new Object[] {e}); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(e)}); ++ } + bHasFocus = true; + } + +@@ -269,7 +271,9 @@ + * Called when component loses focus + */ + public void focusLost(FocusEvent e) { +- focusLog.log(Level.FINE, "{0}", new Object[] {e}); ++ if (focusLog.isLoggable(Level.FINE)) { ++ focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(e)}); ++ } + bHasFocus = false; + } + +@@ -511,7 +515,10 @@ + * @see java.awt.peer.ComponentPeer + */ + public void setEnabled(boolean value) { +- enableLog.log(Level.FINE, "{0}ing {1}", new Object[] {(value?"Enabl":"Disabl"), this}); ++ if (enableLog.isLoggable(Level.FINE)) { ++ enableLog.log(Level.FINE, "{0}ing {1}", ++ new Object[] {(value?"Enabl":"Disabl"), String.valueOf(this)}); ++ } + boolean repaintNeeded = (enabled != value); + enabled = value; + if (target instanceof Container) { +@@ -1346,7 +1353,10 @@ + * ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify + */ + protected boolean isEventDisabled(XEvent e) { +- enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")}); ++ if (enableLog.isLoggable(Level.FINEST)) { ++ enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", ++ new Object[] {String.valueOf(e), (isEnabled()?"enabled":"disable")}); ++ } + if (!isEnabled()) { + switch (e.get_type()) { + case ButtonPress: +@@ -1356,7 +1366,9 @@ + case EnterNotify: + case LeaveNotify: + case MotionNotify: +- enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e}); ++ if (enableLog.isLoggable(Level.FINER)) { ++ enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {String.valueOf(e)}); ++ } + return true; + } + } +--- old/src/solaris/classes/sun/awt/X11/XContentWindow.java 2009-07-23 13:48:01.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java 2009-07-23 13:48:01.000000000 +0400 +@@ -98,8 +98,10 @@ + if (in != null) { + newBounds.setLocation(-in.left, -in.top); + } +- if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}", +- new Object[] {newBounds, getBounds()}); ++ if (insLog.isLoggable(Level.FINE)) { ++ insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}", ++ new Object[] {String.valueOf(newBounds), String.valueOf(getBounds())}); ++ } + // Fix for 5023533: + // Change in the size of the content window means, well, change of the size + // Change in the location of the content window means change in insets +--- old/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java 2009-07-23 13:48:02.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java 2009-07-23 13:48:02.000000000 +0400 +@@ -84,7 +84,11 @@ + Rectangle bounds = (Rectangle)params.get(BOUNDS); + dimensions = new WindowDimensions(bounds, getRealInsets(), false); + params.put(BOUNDS, dimensions.getClientRect()); +- insLog.log(Level.FINE, "Initial dimensions {0}", new Object[] { dimensions }); ++ ++ if (insLog.isLoggable(Level.FINE)) { ++ insLog.log(Level.FINE, "Initial dimensions {0}", ++ new Object[] { String.valueOf(dimensions) }); ++ } + + // Deny default processing of these events on the shell - proxy will take care of + // them instead +@@ -313,7 +317,10 @@ + // Check if we have insets provided by the WM + Insets correctWM = getWMSetInsets(null); + if (correctWM != null) { +- insLog.log(Level.FINER, "wm-provided insets {0}", new Object[]{correctWM}); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "wm-provided insets {0}", ++ new Object[]{String.valueOf(correctWM)}); ++ } + // If these insets are equal to our current insets - no actions are necessary + Insets dimInsets = dimensions.getInsets(); + if (correctWM.equals(dimInsets)) { +@@ -327,7 +334,10 @@ + correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent()); + + if (correctWM != null) { +- insLog.log(Level.FINER, "correctWM {0}", new Object[] {correctWM}); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "correctWM {0}", ++ new Object[] {String.valueOf(correctWM)}); ++ } + } else { + insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify"); + } +@@ -350,7 +360,9 @@ + * initial insets were wrong (most likely they were). + */ + Insets correction = difference(correctWM, currentInsets); +- insLog.log(Level.FINEST, "Corrention {0}", new Object[] {correction}); ++ if (insLog.isLoggable(Level.FINEST)) { ++ insLog.log(Level.FINEST, "Corrention {0}", new Object[] {String.valueOf(correction)}); ++ } + if (!isNull(correction)) { + /* + * Actual insets account for menubar/warning label, +@@ -440,7 +452,10 @@ + public Insets getInsets() { + Insets in = copy(getRealInsets()); + in.top += getMenuBarHeight() + getWarningWindowHeight(); +- if (insLog.isLoggable(Level.FINEST)) insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in}); ++ if (insLog.isLoggable(Level.FINEST)) { ++ insLog.log(Level.FINEST, "Get insets returns {0}", ++ new Object[] {String.valueOf(in)}); ++ } + return in; + } + +@@ -589,8 +604,10 @@ + dims.setSize(width, height); + break; + } +- if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}", +- new Object[] {operationToString(operation), dims}); ++ if (insLog.isLoggable(Level.FINE)) { ++ insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}", ++ new Object[] {operationToString(operation), String.valueOf(dims)}); ++ } + + reshape(dims, operation, userReshape); + } +@@ -660,7 +677,10 @@ + public void handleConfigureNotifyEvent(XEvent xev) { + assert (SunToolkit.isAWTLockHeldByCurrentThread()); + XConfigureEvent xe = xev.get_xconfigure(); +- insLog.log(Level.FINE, "Configure notify {0}", new Object[] {xe}); ++ if (insLog.isLoggable(Level.FINE)) { ++ insLog.log(Level.FINE, "Configure notify {0}", ++ new Object[] {String.valueOf(xe)}); ++ } + + // XXX: should really only consider synthetic events, but + if (isReparented()) { +@@ -752,7 +772,9 @@ + case XWM.SAWFISH_WM: + { + Point xlocation = queryXLocation(); +- if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "New X location: {0}", new Object[]{xlocation}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "New X location: {0}", new Object[]{String.valueOf(xlocation)}); ++ } + if (xlocation != null) { + newLocation = xlocation; + } +@@ -769,8 +791,10 @@ + copy(currentInsets), + true); + +- insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}", +- new Object[] {currentInsets, newDimensions}); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}", ++ new Object[] {String.valueOf(currentInsets), String.valueOf(newDimensions)}); ++ } + + checkIfOnNewScreen(newDimensions.getBounds()); + +@@ -935,7 +959,7 @@ + Point location = target.getLocation(); + if (insLog.isLoggable(Level.FINE)) + insLog.log(Level.FINE, "getLocationOnScreen {0} not reparented: {1} ", +- new Object[] {this, location}); ++ new Object[] {String.valueOf(this), String.valueOf(location)}); + return location; + } + } finally { +@@ -972,7 +996,10 @@ + } + + public void setVisible(boolean vis) { +- log.log(Level.FINER, "Setting {0} to visible {1}", new Object[] {this, Boolean.valueOf(vis)}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "Setting {0} to visible {1}", ++ new Object[] {String.valueOf(this), Boolean.valueOf(vis)}); ++ } + if (vis && !isVisible()) { + XWM.setShellDecor(this); + super.setVisible(vis); +@@ -1027,7 +1054,10 @@ + } + + private void handleWmTakeFocus(XClientMessageEvent cl) { +- focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{this}); ++ if (focusLog.isLoggable(Level.FINE)) { ++ focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", ++ new Object[]{String.valueOf(this)}); ++ } + requestWindowFocus(cl.get_data(1), true); + } + +--- old/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java 2009-07-23 13:48:04.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java 2009-07-23 13:48:03.000000000 +0400 +@@ -117,7 +117,7 @@ + EmbedderRegistryEntry entry = getEmbedderRegistryEntry(toplevel); + + if (logger.isLoggable(Level.FINEST)) { +- logger.log(Level.FINEST, " entry={0}", new Object[] {entry}); ++ logger.log(Level.FINEST, " entry={0}", new Object[] {String.valueOf(entry)}); + } + // Window not registered as an embedder for this protocol. + if (entry == null) { +@@ -138,7 +138,8 @@ + long proxy = entry.getProxy(); + + if (logger.isLoggable(Level.FINEST)) { +- logger.log(Level.FINEST, " proxy={0} toplevel={1}", new Object[] {proxy, toplevel}); ++ logger.log(Level.FINEST, " proxy={0} toplevel={1}", ++ new Object[] {String.valueOf(proxy), String.valueOf(toplevel)}); + } + if (proxy == 0) { + proxy = toplevel; +--- old/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java 2009-07-23 13:48:05.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java 2009-07-23 13:48:05.000000000 +0400 +@@ -34,7 +34,6 @@ + * and therefore X doesn't control focus after we have set it to proxy. + */ + public class XFocusProxyWindow extends XBaseWindow { +- private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XFocusProxyWindow"); + XWindowPeer owner; + + public XFocusProxyWindow(XWindowPeer owner) { +--- old/src/solaris/classes/sun/awt/X11/XFramePeer.java 2009-07-23 13:48:06.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java 2009-07-23 13:48:06.000000000 +0400 +@@ -281,7 +281,10 @@ + super.handlePropertyNotify(xev); + XPropertyEvent ev = xev.get_xproperty(); + +- log.log(Level.FINER, "Property change {0}", new Object[] {ev}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "Property change {0}", new Object[] {String.valueOf(ev)}); ++ } ++ + /* + * Let's see if this is a window state protocol message, and + * if it is - decode a new state in terms of java constants. +--- old/src/solaris/classes/sun/awt/X11/XIconWindow.java 2009-07-23 13:48:08.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java 2009-07-23 13:48:07.000000000 +0400 +@@ -75,7 +75,10 @@ + XIconSize[] res = new XIconSize[count]; + for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) { + res[i] = new XIconSize(sizes_ptr); +- log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", new Object[] {res[i], Integer.valueOf(i)}); ++ if (log.isLoggable(Level.FINEST)) { ++ log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", ++ new Object[] {String.valueOf(res[i]), Integer.valueOf(i)}); ++ } + } + return res; + } finally { +@@ -92,7 +95,9 @@ + } + + XIconSize[] sizeList = getIconSizes(); +- log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {sizeList}); ++ if (log.isLoggable(Level.FINEST)) { ++ log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {String.valueOf(sizeList)}); ++ } + if (sizeList == null) { + // No icon sizes so we simply fall back to 16x16 + return new Dimension(16, 16); +@@ -444,7 +449,9 @@ + } + Dimension iconSize = getIconSize(width, height); + if (iconSize != null) { +- log.log(Level.FINEST, "Icon size: {0}", iconSize); ++ if (log.isLoggable(Level.FINEST)) { ++ log.log(Level.FINEST, "Icon size: {0}", String.valueOf(iconSize)); ++ } + iconWidth = iconSize.width; + iconHeight = iconSize.height; + } else { +--- old/src/solaris/classes/sun/awt/X11/XInputMethod.java 2009-07-23 13:48:09.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java 2009-07-23 13:48:08.000000000 +0400 +@@ -108,8 +108,10 @@ + client = getParent(client); + peer = (XComponentPeer)XToolkit.targetToPeer(client); + } +- log.log(Level.FINE, "Peer is {0}, client is {1}", new Object[] {peer, client}); +- ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Peer is {0}, client is {1}", ++ new Object[] {String.valueOf(peer), String.valueOf(client)}); ++ } + if (peer != null) + return peer; + +--- old/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java 2009-07-23 13:48:10.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java 2009-07-23 13:48:10.000000000 +0400 +@@ -43,8 +43,6 @@ + * + ************************************************/ + +- private static Logger log = Logger.getLogger("sun.awt.X11.XMenuItemPeer"); +- + /* + * Primary members + */ +--- old/src/solaris/classes/sun/awt/X11/XNETProtocol.java 2009-07-23 13:48:11.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java 2009-07-23 13:48:11.000000000 +0400 +@@ -56,7 +56,11 @@ + + private void setInitialState(XWindowPeer window, int state) { + XAtomList old_state = window.getNETWMState(); +- log.log(Level.FINE, "Current state of the window {0} is {1}", new Object[] {window, old_state}); ++ ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Current state of the window {0} is {1}", ++ new Object[] {String.valueOf(window), String.valueOf(old_state)}); ++ } + if ((state & Frame.MAXIMIZED_VERT) != 0) { + old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT); + } else { +@@ -67,7 +71,10 @@ + } else { + old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ); + } +- log.log(Level.FINE, "Setting initial state of the window {0} to {1}", new Object[] {window, old_state}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Setting initial state of the window {0} to {1}", ++ new Object[] {String.valueOf(window), String.valueOf(old_state)}); ++ } + window.setNETWMState(old_state); + } + +@@ -191,7 +198,10 @@ + req.set_format(32); + req.set_data(0, (!set) ? _NET_WM_STATE_REMOVE : _NET_WM_STATE_ADD); + req.set_data(1, state.getAtom()); +- log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", new Object[] {state, window, Boolean.valueOf(set)}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", ++ new Object[] {String.valueOf(state), String.valueOf(window), Boolean.valueOf(set)}); ++ } + XToolkit.awtLock(); + try { + XlibWrapper.XSendEvent(XToolkit.getDisplay(), +@@ -208,13 +218,19 @@ + } + } else { + XAtomList net_wm_state = window.getNETWMState(); +- log.log(Level.FINE, "Current state on {0} is {1}", new Object[] {window, net_wm_state}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Current state on {0} is {1}", ++ new Object[] {String.valueOf(window), String.valueOf(net_wm_state)}); ++ } + if (!set) { + net_wm_state.remove(state); + } else { + net_wm_state.add(state); + } +- log.log(Level.FINE, "Setting states on {0} to {1}", new Object[] {window, net_wm_state}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Setting states on {0} to {1}", ++ new Object[] {String.valueOf(window), String.valueOf(net_wm_state)}); ++ } + window.setNETWMState(net_wm_state); + } + XToolkit.XSync(); +--- old/src/solaris/classes/sun/awt/X11/XProtocol.java 2009-07-23 13:48:13.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java 2009-07-23 13:48:12.000000000 +0400 +@@ -68,7 +68,10 @@ + } finally { + if (firstCheck) { + firstCheck = false; +- log.log(Level.FINE, "{0}:{1} supports {2}", new Object[] {this, listName, protocols}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "{0}:{1} supports {2}", ++ new Object[] {String.valueOf(this), String.valueOf(listName), String.valueOf(protocols)}); ++ } + } + } + } +--- old/src/solaris/classes/sun/awt/X11/XQueryTree.java 2009-07-23 13:48:14.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java 2009-07-23 13:48:13.000000000 +0400 +@@ -32,7 +32,6 @@ + + public class XQueryTree { + private static Unsafe unsafe = XlibWrapper.unsafe; +- private static final Logger log = Logger.getLogger("sun.awt.X11.XQueryTree"); + private boolean __executed = false; + long _w; + long root_ptr = unsafe.allocateMemory(Native.getLongSize()); +--- old/src/solaris/classes/sun/awt/X11/XToolkit.java 2009-07-23 13:48:15.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java 2009-07-23 13:48:15.000000000 +0400 +@@ -555,7 +555,7 @@ + } + + if (eventLog.isLoggable(Level.FINER)) { +- eventLog.log(Level.FINER, "{0}", ev); ++ eventLog.log(Level.FINER, "{0}", String.valueOf(ev)); + } + + // Check if input method consumes the event +@@ -1668,8 +1668,10 @@ + if (timeoutTaskLog.isLoggable(Level.FINER)) { + timeoutTaskLog.log(Level.FINER, "XToolkit.schedule(): current time={0}" + + "; interval={1}" + +- "; task being added={2}" + "; tasks before addition={3}", new Object[] { +- Long.valueOf(System.currentTimeMillis()), Long.valueOf(interval), task, timeoutTasks}); ++ "; task being added={2}" + "; tasks before addition={3}", ++ new Object[] { Long.valueOf(System.currentTimeMillis()), ++ Long.valueOf(interval), String.valueOf(task), ++ String.valueOf(timeoutTasks)}); + } + + if (timeoutTasks == null) { +@@ -1714,7 +1716,8 @@ + private static void callTimeoutTasks() { + if (timeoutTaskLog.isLoggable(Level.FINER)) { + timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" + +- "; tasks={1}", new Object[] {Long.valueOf(System.currentTimeMillis()), timeoutTasks}); ++ "; tasks={1}", new Object[] {Long.valueOf(System.currentTimeMillis()), ++ String.valueOf(timeoutTasks)}); + } + + if (timeoutTasks == null || timeoutTasks.isEmpty()) { +@@ -1732,7 +1735,8 @@ + + if (timeoutTaskLog.isLoggable(Level.FINER)) { + timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" + +- "; about to run task={1}", new Object[] {Long.valueOf(currentTime), task}); ++ "; about to run task={1}", ++ new Object[] {Long.valueOf(currentTime), String.valueOf(task)}); + } + + try { +--- old/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java 2009-07-23 13:48:16.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java 2009-07-23 13:48:16.000000000 +0400 +@@ -106,10 +106,11 @@ + } + + XConfigureEvent ce = ev.get_xconfigure(); +- +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})", +- new Object[] { XTrayIconPeer.this, ce.get_width(), ce.get_height(), +- ce.get_x(), ce.get_y(), old_x, old_y }); ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})", ++ new Object[] { String.valueOf(XTrayIconPeer.this), ce.get_width(), ce.get_height(), ++ ce.get_x(), ce.get_y(), old_x, old_y }); ++ } + + // A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE). + // On Metacity the EmbeddedFrame's parent window bounds are larger +@@ -129,15 +130,17 @@ + // If both the height and the width differ from the fixed size then WM + // must level at least one side to the fixed size. For some reason it may take + // a few hops (even after reparenting) and we have to skip the intermediate ones. +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", +- XTrayIconPeer.this); ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", ++ String.valueOf(XTrayIconPeer.this)); ++ } + return; + + } else if (ce.get_height() > TRAY_ICON_HEIGHT) { +- +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".", +- XTrayIconPeer.this); +- ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".", ++ String.valueOf(XTrayIconPeer.this)); ++ } + XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, + ce.get_x(), + ce.get_y()+ce.get_height()/2-TRAY_ICON_HEIGHT/2, +@@ -147,10 +150,10 @@ + ex_width = 0; + + } else if (ce.get_width() > TRAY_ICON_WIDTH) { +- +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".", +- XTrayIconPeer.this); +- ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".", ++ String.valueOf(XTrayIconPeer.this)); ++ } + XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, + ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2, + ce.get_y(), +@@ -165,25 +168,27 @@ + // In this case the parent window also lose centering. We have to restore it. + + if (ex_height != 0) { +- +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", +- XTrayIconPeer.this); +- ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", ++ String.valueOf(XTrayIconPeer.this)); ++ } + XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, + ce.get_x(), + ce.get_y() + ex_height/2 - TRAY_ICON_HEIGHT/2); + + } else if (ex_width != 0) { +- +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", +- XTrayIconPeer.this); +- ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", ++ String.valueOf(XTrayIconPeer.this)); ++ } + XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, + ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2, + ce.get_y()); + } else { +- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Skipping.", +- XTrayIconPeer.this); ++ if (ctrLog.isLoggable(Level.FINE)) { ++ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Skipping.", ++ String.valueOf(XTrayIconPeer.this)); ++ } + } + } + old_x = ce.get_x(); +--- old/src/solaris/classes/sun/awt/X11/XWM.java 2009-07-23 13:48:18.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java 2009-07-23 13:48:17.000000000 +0400 +@@ -398,7 +398,10 @@ + static boolean isCDE() { + + if (!XA_DT_SM_WINDOW_INFO.isInterned()) { +- log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_WINDOW_INFO}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "{0} is not interned", ++ new Object[] {String.valueOf(XA_DT_SM_WINDOW_INFO)}); ++ } + return false; + } + +@@ -429,7 +432,10 @@ + + /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */ + if (!XA_DT_SM_STATE_INFO.isInterned()) { +- log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_STATE_INFO}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "{0} is not interned", ++ new Object[] {String.valueOf(XA_DT_SM_STATE_INFO)}); ++ } + return false; + } + WindowPropertyGetter getter2 = +@@ -608,7 +614,10 @@ + */ + + if (!XA_ICEWM_WINOPTHINT.isInterned()) { +- log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "{0} is not interned", ++ new Object[] {String.valueOf(XA_ICEWM_WINOPTHINT)}); ++ } + return false; + } + +@@ -641,7 +650,10 @@ + */ + static boolean isIceWM() { + if (!XA_ICEWM_WINOPTHINT.isInterned()) { +- log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "{0} is not interned", ++ new Object[] {String.valueOf(XA_ICEWM_WINOPTHINT)}); ++ } + return false; + } + +@@ -1376,8 +1388,9 @@ + XNETProtocol net_protocol = getWM().getNETProtocol(); + if (net_protocol != null && net_protocol.active()) { + Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS); +- insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", insets); +- ++ if (insLog.isLoggable(Level.FINE)) { ++ insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", String.valueOf(insets)); ++ } + if (insets != null) { + return insets; + } +@@ -1515,7 +1528,9 @@ + * [mwm, e!, kwin, fvwm2 ... ] + */ + Insets correctWM = XWM.getInsetsFromExtents(window); +- insLog.log(Level.FINER, "Got insets from property: {0}", correctWM); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "Got insets from property: {0}", String.valueOf(correctWM)); ++ } + + if (correctWM == null) { + correctWM = new Insets(0,0,0,0); +@@ -1576,7 +1591,10 @@ + } + case XWM.OTHER_WM: + default: { /* this is very similar to the E! case above */ +- insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}", parent); ++ if (insLog.isLoggable(Level.FINEST)) { ++ insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}", ++ String.valueOf(parent)); ++ } + syncTopLevelPos(parent, lwinAttr); + int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), + window, lwinAttr.pData); +@@ -1603,8 +1621,11 @@ + && lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width() + && lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height()) + { +- insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", +- new Object[] {lwinAttr, pattr, parent, window}); ++ if (insLog.isLoggable(Level.FINEST)) { ++ insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", ++ new Object[] {String.valueOf(lwinAttr), String.valueOf(pattr), ++ String.valueOf(parent), String.valueOf(window)}); ++ } + lwinAttr.set_x(pattr.get_x()); + lwinAttr.set_y(pattr.get_y()); + lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width()); +@@ -1631,8 +1652,11 @@ + * widths and inner/outer distinction, so for the time + * being, just ignore it. + */ +- insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", +- new Object[] {lwinAttr, pattr, parent, window}); ++ if (insLog.isLoggable(Level.FINEST)) { ++ insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", ++ new Object[] {String.valueOf(lwinAttr), String.valueOf(pattr), ++ String.valueOf(parent), String.valueOf(window)}); ++ } + correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(), + lwinAttr.get_x() + lwinAttr.get_border_width(), + pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()), +--- old/src/solaris/classes/sun/awt/X11/XWindow.java 2009-07-23 13:48:19.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindow.java 2009-07-23 13:48:19.000000000 +0400 +@@ -901,8 +901,10 @@ + Rectangle oldBounds = getBounds(); + + super.handleConfigureNotifyEvent(xev); +- insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}", +- new Object[] {xev, isEventDisabled(xev)}); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}", ++ new Object[] {String.valueOf(xev), isEventDisabled(xev)}); ++ } + if (isEventDisabled(xev)) { + return; + } +@@ -923,7 +925,9 @@ + + public void handleMapNotifyEvent(XEvent xev) { + super.handleMapNotifyEvent(xev); +- log.log(Level.FINE, "Mapped {0}", new Object[] {this}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "Mapped {0}", new Object[] {String.valueOf(this)}); ++ } + if (isEventDisabled(xev)) { + return; + } +@@ -1151,10 +1155,14 @@ + void updateSizeHints(int x, int y, int width, int height) { + long flags = XlibWrapper.PSize | (isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition)); + if (!isResizable()) { +- log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "Window {0} is not resizable", new Object[] {String.valueOf(this)}); ++ } + flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize; + } else { +- log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "Window {0} is resizable", new Object[] {String.valueOf(this)}); ++ } + } + setSizeHints(flags, x, y, width, height); + } +@@ -1162,10 +1170,14 @@ + void updateSizeHints(int x, int y) { + long flags = isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition); + if (!isResizable()) { +- log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "Window {0} is not resizable", new Object[] {String.valueOf(this)}); ++ } + flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize | XlibWrapper.PSize; + } else { +- log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); ++ if (log.isLoggable(Level.FINER)) { ++ log.log(Level.FINER, "Window {0} is resizable", new Object[] {String.valueOf(this)}); ++ } + } + setSizeHints(flags, x, y, width, height); + } +--- old/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2009-07-23 13:48:21.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2009-07-23 13:48:20.000000000 +0400 +@@ -376,7 +376,7 @@ + if (iconLog.isLoggable(Level.FINEST)) { + iconLog.log(Level.FINEST, ">>> Sizes of icon images:"); + for (Iterator i = icons.iterator(); i.hasNext(); ) { +- iconLog.log(Level.FINEST, " {0}", i.next()); ++ iconLog.log(Level.FINEST, " {0}", String.valueOf(i.next())); + } + } + } +@@ -826,7 +826,9 @@ + public void handleFocusEvent(XEvent xev) { + XFocusChangeEvent xfe = xev.get_xfocus(); + FocusEvent fe; +- focusLog.log(Level.FINE, "{0}", new Object[] {xfe}); ++ if (focusLog.isLoggable(Level.FINER)) { ++ focusLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(xfe)}); ++ } + if (isEventDisabled(xev)) { + return; + } +@@ -1438,7 +1440,10 @@ + synchronized(getStateLock()) { + XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d); + if (blocked) { +- log.log(Level.FINE, "{0} is blocked by {1}", new Object[] { this, blockerPeer}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "{0} is blocked by {1}", ++ new Object[] { String.valueOf(this), String.valueOf(blockerPeer)}); ++ } + modalBlocker = d; + + if (isReparented() || XWM.isNonReparentingWM()) { +@@ -1899,7 +1904,9 @@ + wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom); + } + +- insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets}); ++ if (insLog.isLoggable(Level.FINER)) { ++ insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{String.valueOf(wm_set_insets)}); ++ } + + if (wm_set_insets != null) { + handleWMSetInsets(wm_set_insets); +@@ -1942,7 +1949,8 @@ + XCrossingEvent xce = xev.get_xcrossing(); + if (grabLog.isLoggable(Level.FINE)) { + grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2}", +- new Object[] {xce, isGrabbed(), containsGlobal(xce.get_x_root(), xce.get_y_root())}); ++ new Object[] {String.valueOf(xce), isGrabbed(), ++ containsGlobal(xce.get_x_root(), xce.get_y_root())}); + } + if (isGrabbed()) { + // When window is grabbed, all events are dispatched to +@@ -1953,7 +1961,10 @@ + // since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog. + // (fix for 6390326) + XBaseWindow target = XToolkit.windowToXWindow(xce.get_window()); +- grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target}); ++ if (grabLog.isLoggable(Level.FINER)) { ++ grabLog.log(Level.FINER, " - Grab event target {0}", ++ new Object[] {String.valueOf(target)}); ++ } + if (target != null && target != this) { + target.dispatchEvent(xev); + return; +@@ -1966,7 +1977,8 @@ + XMotionEvent xme = xev.get_xmotion(); + if (grabLog.isLoggable(Level.FINE)) { + grabLog.log(Level.FINER, "{0}, when grabbed {1}, contains {2}", +- new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())}); ++ new Object[] {String.valueOf(xme), isGrabbed(), ++ containsGlobal(xme.get_x_root(), xme.get_y_root())}); + } + if (isGrabbed()) { + boolean dragging = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask)) != 0; +@@ -1986,7 +1998,10 @@ + xme.set_x(xme.get_x_root() - target.getX()); + xme.set_y(xme.get_y_root() - target.getY()); + } +- grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target}); ++ if (grabLog.isLoggable(Level.FINER)) { ++ grabLog.log(Level.FINER, " - Grab event target {0}", ++ new Object[] {String.valueOf(target)}); ++ } + if (target != null) { + if (target != getContentXWindow() && target != this) { + target.dispatchEvent(xev); +@@ -2011,7 +2026,8 @@ + XButtonEvent xbe = xev.get_xbutton(); + if (grabLog.isLoggable(Level.FINE)) { + grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})", +- new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()}); ++ new Object[] {String.valueOf(xbe), isGrabbed(), containsGlobal(xbe.get_x_root(), ++ xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()}); + } + if (isGrabbed()) { + // When window is grabbed, all events are dispatched to +@@ -2020,7 +2036,10 @@ + // translation) + XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window()); + try { +- grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", new Object[] {target, pressTarget}); ++ if (grabLog.isLoggable(Level.FINER)) { ++ grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", ++ new Object[] {String.valueOf(target), String.valueOf(pressTarget)}); ++ } + if (xbe.get_type() == XConstants.ButtonPress + && xbe.get_button() == XlibWrapper.Button1) + { +@@ -2052,7 +2071,10 @@ + // Outside this toplevel hierarchy + // According to the specification of UngrabEvent, post it + // when press occurs outside of the window and not on its owned windows +- grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell", this); ++ if (grabLog.isLoggable(Level.FINE)) { ++ grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell", ++ String.valueOf(this)); ++ } + postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); + return; + } +@@ -2070,18 +2092,27 @@ + // toplevel == null - outside of + // hierarchy, toplevel is Dialog - should + // send ungrab (but shouldn't for Window) +- grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended", this); ++ if (grabLog.isLoggable(Level.FINE)) { ++ grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended", ++ String.valueOf(this)); ++ } + postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); + } + } else { + // toplevel is null - outside of hierarchy +- grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null", this); ++ if (grabLog.isLoggable(Level.FINE)) { ++ grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null", ++ String.valueOf(this)); ++ } + postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); + return; + } + } else { + // target doesn't map to XAWT window - outside of hierarchy +- grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}", this); ++ if (grabLog.isLoggable(Level.FINE)) { ++ grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}", ++ String.valueOf(this)); ++ } + postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); + return; + } +--- old/src/solaris/classes/sun/awt/X11InputMethod.java 2009-07-23 13:48:22.000000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11InputMethod.java 2009-07-23 13:48:22.000000000 +0400 +@@ -324,8 +324,11 @@ + return; + + if (lastXICFocussedComponent != null){ +- if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "XICFocused {0}, AWTFocused {1}", new Object[] { +- lastXICFocussedComponent, awtFocussedComponent}); ++ if (log.isLoggable(Level.FINE)) { ++ log.log(Level.FINE, "XICFocused {0}, AWTFocused {1}", ++ new Object[] { String.valueOf(lastXICFocussedComponent), ++ String.valueOf(awtFocussedComponent)}); ++ } + } + + if (pData == 0) { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6691246.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6691246.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,166 @@ +--- old/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java Mon Mar 9 16:07:47 2009 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java Mon Mar 9 16:07:46 2009 +@@ -22,7 +22,6 @@ + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +- + package com.sun.jmx.remote.internal; + + import java.io.IOException; +@@ -34,6 +33,7 @@ + import java.util.Map; + import java.util.concurrent.Executor; + ++import java.security.AccessControlContext; + import java.security.AccessController; + import java.security.PrivilegedAction; + import javax.security.auth.Subject; +@@ -54,6 +54,9 @@ + + + public abstract class ClientNotifForwarder { ++ ++ private final AccessControlContext acc; ++ + public ClientNotifForwarder(Map env) { + this(null, env); + } +@@ -87,6 +90,8 @@ + this.command = command; + if (thread == null) { + thread = new Thread() { ++ ++ @Override + public void run() { + while (true) { + Runnable r; +@@ -130,6 +135,7 @@ + + this.defaultClassLoader = defaultClassLoader; + this.executor = ex; ++ this.acc = AccessController.getContext(); + } + + /** +@@ -390,28 +396,85 @@ + setState(TERMINATED); + } + +-// ------------------------------------------------- +-// private classes +-// ------------------------------------------------- ++ ++ // ------------------------------------------------- ++ // private classes ++ // ------------------------------------------------- + // ++ + private class NotifFetcher implements Runnable { ++ ++ private volatile boolean alreadyLogged = false; ++ ++ private void logOnce(String msg, SecurityException x) { ++ if (alreadyLogged) return; ++ // Log only once. ++ logger.config("setContextClassLoader",msg); ++ if (x != null) logger.fine("setContextClassLoader", x); ++ alreadyLogged = true; ++ } ++ ++ // Set new context class loader, returns previous one. ++ private final ClassLoader setContextClassLoader(final ClassLoader loader) { ++ final AccessControlContext ctxt = ClientNotifForwarder.this.acc; ++ // if ctxt is null, log a config message and throw a ++ // SecurityException. ++ if (ctxt == null) { ++ logOnce("AccessControlContext must not be null.",null); ++ throw new SecurityException("AccessControlContext must not be null"); ++ } ++ return AccessController.doPrivileged( ++ new PrivilegedAction() { ++ public ClassLoader run() { ++ try { ++ // get context class loader - may throw ++ // SecurityException - though unlikely. ++ final ClassLoader previous = ++ Thread.currentThread().getContextClassLoader(); ++ ++ // if nothing needs to be done, break here... ++ if (loader == previous) return previous; ++ ++ // reset context class loader - may throw ++ // SecurityException ++ Thread.currentThread().setContextClassLoader(loader); ++ return previous; ++ } catch (SecurityException x) { ++ logOnce("Permission to set ContextClassLoader missing. " + ++ "Notifications will not be dispatched. " + ++ "Please check your Java policy configuration: " + ++ x, x); ++ throw x; ++ } ++ } ++ }, ctxt); ++ } ++ + public void run() { ++ final ClassLoader previous; ++ if (defaultClassLoader != null) { ++ previous = setContextClassLoader(defaultClassLoader); ++ } else { ++ previous = null; ++ } ++ try { ++ doRun(); ++ } finally { ++ if (defaultClassLoader != null) { ++ setContextClassLoader(previous); ++ } ++ } ++ } ++ ++ private void doRun() { + synchronized (ClientNotifForwarder.this) { + currentFetchThread = Thread.currentThread(); + +- if (state == STARTING) ++ if (state == STARTING) { + setState(STARTED); ++ } + } + +- if (defaultClassLoader != null) { +- AccessController.doPrivileged(new PrivilegedAction() { +- public Void run() { +- Thread.currentThread(). +- setContextClassLoader(defaultClassLoader); +- return null; +- } +- }); +- } + + NotificationResult nr = null; + if (!shouldStop() && (nr = fetchNotifs()) != null) { +@@ -445,8 +508,9 @@ + // check if an mbean unregistration notif + if (!listenerID.equals(mbeanRemovedNotifID)) { + final ClientListenerInfo li = infoList.get(listenerID); +- if (li != null) +- listeners.put(listenerID,li); ++ if (li != null) { ++ listeners.put(listenerID, li); ++ } + continue; + } + final Notification notif = tn.getNotification(); +@@ -787,9 +851,7 @@ + private long clientSequenceNumber = -1; + private final int maxNotifications; + private final long timeout; +- + private Integer mbeanRemovedNotifID = null; +- + private Thread currentFetchThread; + + // admin stuff diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6717680.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6717680.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,27 @@ +--- old/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Tue Mar 3 14:42:48 2009 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Tue Mar 3 14:42:47 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -302,7 +302,16 @@ + + schemaTrees = new Hashtable(11, 0.75f); + initEnv(); +- connect(false); ++ try { ++ connect(false); ++ } catch (NamingException e) { ++ try { ++ close(); ++ } catch (Exception e2) { ++ // Nothing ++ } ++ throw e; ++ } + } + + LdapCtx(LdapCtx existing, String newDN) throws NamingException { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6721651.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6721651.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,735 @@ +--- old/src/share/classes/com/sun/jmx/remote/security/MBeanServerAccessController.java Mon Mar 9 18:11:01 2009 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/remote/security/MBeanServerAccessController.java Mon Mar 9 18:11:00 2009 +@@ -111,6 +111,22 @@ + */ + protected abstract void checkWrite(); + ++ /** ++ * Check if the caller can create the named class. The default ++ * implementation of this method calls {@link #checkWrite()}. ++ */ ++ protected void checkCreate(String className) { ++ checkWrite(); ++ } ++ ++ /** ++ * Check if the caller can unregister the named MBean. The default ++ * implementation of this method calls {@link #checkWrite()}. ++ */ ++ protected void checkUnregister(ObjectName name) { ++ checkWrite(); ++ } ++ + //-------------------------------------------- + //-------------------------------------------- + // +@@ -148,7 +164,7 @@ + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public ObjectInstance createMBean(String className, ObjectName name) +@@ -158,7 +174,7 @@ + MBeanRegistrationException, + MBeanException, + NotCompliantMBeanException { +- checkWrite(); ++ checkCreate(className); + SecurityManager sm = System.getSecurityManager(); + if (sm == null) { + Object object = getMBeanServer().instantiate(className); +@@ -170,7 +186,7 @@ + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public ObjectInstance createMBean(String className, ObjectName name, +@@ -181,7 +197,7 @@ + MBeanRegistrationException, + MBeanException, + NotCompliantMBeanException { +- checkWrite(); ++ checkCreate(className); + SecurityManager sm = System.getSecurityManager(); + if (sm == null) { + Object object = getMBeanServer().instantiate(className, +@@ -196,7 +212,7 @@ + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public ObjectInstance createMBean(String className, +@@ -209,7 +225,7 @@ + MBeanException, + NotCompliantMBeanException, + InstanceNotFoundException { +- checkWrite(); ++ checkCreate(className); + SecurityManager sm = System.getSecurityManager(); + if (sm == null) { + Object object = getMBeanServer().instantiate(className, +@@ -222,7 +238,7 @@ + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public ObjectInstance createMBean(String className, +@@ -237,7 +253,7 @@ + MBeanException, + NotCompliantMBeanException, + InstanceNotFoundException { +- checkWrite(); ++ checkCreate(className); + SecurityManager sm = System.getSecurityManager(); + if (sm == null) { + Object object = getMBeanServer().instantiate(className, +@@ -394,17 +410,17 @@ + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public Object instantiate(String className) + throws ReflectionException, MBeanException { +- checkWrite(); ++ checkCreate(className); + return getMBeanServer().instantiate(className); + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public Object instantiate(String className, +@@ -411,28 +427,28 @@ + Object params[], + String signature[]) + throws ReflectionException, MBeanException { +- checkWrite(); ++ checkCreate(className); + return getMBeanServer().instantiate(className, params, signature); + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public Object instantiate(String className, ObjectName loaderName) + throws ReflectionException, MBeanException, InstanceNotFoundException { +- checkWrite(); ++ checkCreate(className); + return getMBeanServer().instantiate(className, loaderName); + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkCreate(className), then forward this method to the + * wrapped object. + */ + public Object instantiate(String className, ObjectName loaderName, + Object params[], String signature[]) + throws ReflectionException, MBeanException, InstanceNotFoundException { +- checkWrite(); ++ checkCreate(className); + return getMBeanServer().instantiate(className, loaderName, + params, signature); + } +@@ -579,12 +595,12 @@ + } + + /** +- * Call checkWrite(), then forward this method to the ++ * Call checkUnregister(), then forward this method to the + * wrapped object. + */ + public void unregisterMBean(ObjectName name) + throws InstanceNotFoundException, MBeanRegistrationException { +- checkWrite(); ++ checkUnregister(name); + getMBeanServer().unregisterMBean(name); + } + +--- old/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java Mon Mar 9 18:11:03 2009 ++++ openjdk/jdk/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java Mon Mar 9 18:11:03 2009 +@@ -31,11 +31,17 @@ + import java.security.AccessController; + import java.security.Principal; + import java.security.PrivilegedAction; +-import java.util.Collection; ++import java.util.ArrayList; ++import java.util.HashMap; + import java.util.Iterator; ++import java.util.List; ++import java.util.Map; + import java.util.Properties; + import java.util.Set; ++import java.util.StringTokenizer; ++import java.util.regex.Pattern; + import javax.management.MBeanServer; ++import javax.management.ObjectName; + import javax.security.auth.Subject; + + /** +@@ -46,7 +52,8 @@ + * not allowed; in this case the request is not forwarded to the + * wrapped object.

+ * +- *

This class implements the {@link #checkRead()} and {@link #checkWrite()} ++ *

This class implements the {@link #checkRead()}, {@link #checkWrite()}, ++ * {@link #checkCreate(String)}, and {@link #checkUnregister(ObjectName)} + * methods based on an access level properties file containing username/access + * level pairs. The set of username/access level pairs is passed either as a + * filename which denotes a properties file on disk, or directly as an instance +@@ -56,15 +63,51 @@ + * has exactly one access level. The same access level can be shared by several + * usernames.

+ * +- *

The supported access level values are readonly and +- * readwrite.

++ *

The supported access level values are {@code readonly} and ++ * {@code readwrite}. The {@code readwrite} access level can be ++ * qualified by one or more clauses, where each clause looks ++ * like create classNamePattern or {@code ++ * unregister}. For example:

++ * ++ *
++ * monitorRole  readonly
++ * controlRole  readwrite \
++ *              create javax.management.timer.*,javax.management.monitor.* \
++ *              unregister
++ * 
++ * ++ *

(The continuation lines with {@code \} come from the parser for ++ * Properties files.)

+ */ + public class MBeanServerFileAccessController + extends MBeanServerAccessController { + +- public static final String READONLY = "readonly"; +- public static final String READWRITE = "readwrite"; ++ static final String READONLY = "readonly"; ++ static final String READWRITE = "readwrite"; + ++ static final String CREATE = "create"; ++ static final String UNREGISTER = "unregister"; ++ ++ private enum AccessType {READ, WRITE, CREATE, UNREGISTER}; ++ ++ private static class Access { ++ final boolean write; ++ final String[] createPatterns; ++ private boolean unregister; ++ ++ Access(boolean write, boolean unregister, List createPatternList) { ++ this.write = write; ++ int npats = (createPatternList == null) ? 0 : createPatternList.size(); ++ if (npats == 0) ++ this.createPatterns = NO_STRINGS; ++ else ++ this.createPatterns = createPatternList.toArray(new String[npats]); ++ this.unregister = unregister; ++ } ++ ++ private final String[] NO_STRINGS = new String[0]; ++ } ++ + /** + *

Create a new MBeanServerAccessController that forwards all the + * MBeanServer requests to the MBeanServer set by invoking the {@link +@@ -87,8 +130,8 @@ + throws IOException { + super(); + this.accessFileName = accessFileName; +- props = propertiesFromFile(accessFileName); +- checkValues(props); ++ Properties props = propertiesFromFile(accessFileName); ++ parseProperties(props); + } + + /** +@@ -123,14 +166,14 @@ + * #setMBeanServer} method after doing access checks based on read and + * write permissions.

+ * +- *

This instance is initialized from the specified properties instance. +- * This constructor makes a copy of the properties instance using its +- * clone method and it is the copy that is consulted to check +- * the username and access level of an incoming connection. The original +- * properties object can be modified without affecting the copy. If the +- * {@link #refresh} method is then called, the +- * MBeanServerFileAccessController will make a new copy of the +- * properties object at that time.

++ *

This instance is initialized from the specified properties ++ * instance. This constructor makes a copy of the properties ++ * instance and it is the copy that is consulted to check the ++ * username and access level of an incoming connection. The ++ * original properties object can be modified without affecting ++ * the copy. If the {@link #refresh} method is then called, the ++ * MBeanServerFileAccessController will make a new ++ * copy of the properties object at that time.

+ * + * @param accessFileProps properties list containing the username/access + * level entries. +@@ -145,8 +188,7 @@ + if (accessFileProps == null) + throw new IllegalArgumentException("Null properties"); + originalProps = accessFileProps; +- props = (Properties) accessFileProps.clone(); +- checkValues(props); ++ parseProperties(accessFileProps); + } + + /** +@@ -155,14 +197,14 @@ + * #setMBeanServer} method after doing access checks based on read and + * write permissions.

+ * +- *

This instance is initialized from the specified properties instance. +- * This constructor makes a copy of the properties instance using its +- * clone method and it is the copy that is consulted to check +- * the username and access level of an incoming connection. The original +- * properties object can be modified without affecting the copy. If the +- * {@link #refresh} method is then called, the +- * MBeanServerFileAccessController will make a new copy of the +- * properties object at that time.

++ *

This instance is initialized from the specified properties ++ * instance. This constructor makes a copy of the properties ++ * instance and it is the copy that is consulted to check the ++ * username and access level of an incoming connection. The ++ * original properties object can be modified without affecting ++ * the copy. If the {@link #refresh} method is then called, the ++ * MBeanServerFileAccessController will make a new ++ * copy of the properties object at that time.

+ * + * @param accessFileProps properties list containing the username/access + * level entries. +@@ -184,8 +226,9 @@ + * Check if the caller can do read operations. This method does + * nothing if so, otherwise throws SecurityException. + */ ++ @Override + public void checkRead() { +- checkAccessLevel(READONLY); ++ checkAccess(AccessType.READ, null); + } + + /** +@@ -192,11 +235,30 @@ + * Check if the caller can do write operations. This method does + * nothing if so, otherwise throws SecurityException. + */ ++ @Override + public void checkWrite() { +- checkAccessLevel(READWRITE); ++ checkAccess(AccessType.WRITE, null); + } + + /** ++ * Check if the caller can create MBeans or instances of the given class. ++ * This method does nothing if so, otherwise throws SecurityException. ++ */ ++ @Override ++ public void checkCreate(String className) { ++ checkAccess(AccessType.CREATE, className); ++ } ++ ++ /** ++ * Check if the caller can do unregister operations. This method does ++ * nothing if so, otherwise throws SecurityException. ++ */ ++ @Override ++ public void checkUnregister(ObjectName name) { ++ checkAccess(AccessType.UNREGISTER, null); ++ } ++ ++ /** + *

Refresh the set of username/access level entries.

+ * + *

If this instance was created using the +@@ -218,14 +280,13 @@ + * @exception IllegalArgumentException if any of the supplied access + * level values differs from "readonly" or "readwrite". + */ +- public void refresh() throws IOException { +- synchronized (props) { +- if (accessFileName == null) +- props = (Properties) originalProps.clone(); +- else +- props = propertiesFromFile(accessFileName); +- checkValues(props); +- } ++ public synchronized void refresh() throws IOException { ++ Properties props; ++ if (accessFileName == null) ++ props = (Properties) originalProps; ++ else ++ props = propertiesFromFile(accessFileName); ++ parseProperties(props); + } + + private static Properties propertiesFromFile(String fname) +@@ -233,11 +294,13 @@ + FileInputStream fin = new FileInputStream(fname); + Properties p = new Properties(); + p.load(fin); ++ // Properties.load does a buffered read so we don't need to wrap ++ // the FileInputStream in a BufferedInputStream. + fin.close(); + return p; + } + +- private void checkAccessLevel(String accessLevel) { ++ private synchronized void checkAccess(AccessType requiredAccess, String arg) { + final AccessControlContext acc = AccessController.getContext(); + final Subject s = + AccessController.doPrivileged(new PrivilegedAction() { +@@ -247,39 +310,234 @@ + }); + if (s == null) return; /* security has not been enabled */ + final Set principals = s.getPrincipals(); ++ String newPropertyValue = null; + for (Iterator i = principals.iterator(); i.hasNext(); ) { + final Principal p = (Principal) i.next(); +- String grantedAccessLevel; +- synchronized (props) { +- grantedAccessLevel = props.getProperty(p.getName()); +- } +- if (grantedAccessLevel != null) { +- if (accessLevel.equals(READONLY) && +- (grantedAccessLevel.equals(READONLY) || +- grantedAccessLevel.equals(READWRITE))) ++ Access access = accessMap.get(p.getName()); ++ if (access != null) { ++ boolean ok; ++ switch (requiredAccess) { ++ case READ: ++ ok = true; // all access entries imply read ++ break; ++ case WRITE: ++ ok = access.write; ++ break; ++ case UNREGISTER: ++ ok = access.unregister; ++ if (!ok && access.write) ++ newPropertyValue = "unregister"; ++ break; ++ case CREATE: ++ ok = checkCreateAccess(access, arg); ++ if (!ok && access.write) ++ newPropertyValue = "create " + arg; ++ break; ++ default: ++ throw new AssertionError(); ++ } ++ if (ok) + return; +- if (accessLevel.equals(READWRITE) && +- grantedAccessLevel.equals(READWRITE)) +- return; + } + } +- throw new SecurityException("Access denied! Invalid access level for " + +- "requested MBeanServer operation."); ++ SecurityException se = new SecurityException("Access denied! Invalid " + ++ "access level for requested MBeanServer operation."); ++ // Add some more information to help people with deployments that ++ // worked before we required explicit create clauses. We're not giving ++ // any information to the bad guys, other than that the access control ++ // is based on a file, which they could have worked out from the stack ++ // trace anyway. ++ if (newPropertyValue != null) { ++ SecurityException se2 = new SecurityException("Access property " + ++ "for this identity should be similar to: " + READWRITE + ++ " " + newPropertyValue); ++ se.initCause(se2); ++ } ++ throw se; + } + +- private void checkValues(Properties props) { +- Collection c = props.values(); +- for (Iterator i = c.iterator(); i.hasNext(); ) { +- final String accessLevel = (String) i.next(); +- if (!accessLevel.equals(READONLY) && +- !accessLevel.equals(READWRITE)) { +- throw new IllegalArgumentException( +- "Syntax error in access level entry [" + accessLevel + "]"); ++ private static boolean checkCreateAccess(Access access, String className) { ++ for (String classNamePattern : access.createPatterns) { ++ if (classNameMatch(classNamePattern, className)) ++ return true; ++ } ++ return false; ++ } ++ ++ private static boolean classNameMatch(String pattern, String className) { ++ // We studiously avoided regexes when parsing the properties file, ++ // because that is done whenever the VM is started with the ++ // appropriate -Dcom.sun.management options, even if nobody ever ++ // creates an MBean. We don't want to incur the overhead of loading ++ // all the regex code whenever those options are specified, but if we ++ // get as far as here then the VM is already running and somebody is ++ // doing the very unusual operation of remotely creating an MBean. ++ // Because that operation is so unusual, we don't try to optimize ++ // by hand-matching or by caching compiled Pattern objects. ++ StringBuilder sb = new StringBuilder(); ++ StringTokenizer stok = new StringTokenizer(pattern, "*", true); ++ while (stok.hasMoreTokens()) { ++ String tok = stok.nextToken(); ++ if (tok.equals("*")) ++ sb.append("[^.]*"); ++ else ++ sb.append(Pattern.quote(tok)); ++ } ++ return className.matches(sb.toString()); ++ } ++ ++ private void parseProperties(Properties props) { ++ this.accessMap = new HashMap(); ++ for (Map.Entry entry : props.entrySet()) { ++ String identity = (String) entry.getKey(); ++ String accessString = (String) entry.getValue(); ++ Access access = Parser.parseAccess(identity, accessString); ++ accessMap.put(identity, access); ++ } ++ } ++ ++ private static class Parser { ++ private final static int EOS = -1; // pseudo-codepoint "end of string" ++ static { ++ assert !Character.isWhitespace(EOS); ++ } ++ ++ private final String identity; // just for better error messages ++ private final String s; // the string we're parsing ++ private final int len; // s.length() ++ private int i; ++ private int c; ++ // At any point, either c is s.codePointAt(i), or i == len and ++ // c is EOS. We use int rather than char because it is conceivable ++ // (if unlikely) that a classname in a create clause might contain ++ // "supplementary characters", the ones that don't fit in the original ++ // 16 bits for Unicode. ++ ++ private Parser(String identity, String s) { ++ this.identity = identity; ++ this.s = s; ++ this.len = s.length(); ++ this.i = 0; ++ if (i < len) ++ this.c = s.codePointAt(i); ++ else ++ this.c = EOS; ++ } ++ ++ static Access parseAccess(String identity, String s) { ++ return new Parser(identity, s).parseAccess(); ++ } ++ ++ private Access parseAccess() { ++ skipSpace(); ++ String type = parseWord(); ++ Access access; ++ if (type.equals(READONLY)) ++ access = new Access(false, false, null); ++ else if (type.equals(READWRITE)) ++ access = parseReadWrite(); ++ else { ++ throw syntax("Expected " + READONLY + " or " + READWRITE + ++ ": " + type); + } ++ if (c != EOS) ++ throw syntax("Extra text at end of line"); ++ return access; + } ++ ++ private Access parseReadWrite() { ++ List createClasses = new ArrayList(); ++ boolean unregister = false; ++ while (true) { ++ skipSpace(); ++ if (c == EOS) ++ break; ++ String type = parseWord(); ++ if (type.equals(UNREGISTER)) ++ unregister = true; ++ else if (type.equals(CREATE)) ++ parseCreate(createClasses); ++ else ++ throw syntax("Unrecognized keyword " + type); ++ } ++ return new Access(true, unregister, createClasses); ++ } ++ ++ private void parseCreate(List createClasses) { ++ while (true) { ++ skipSpace(); ++ createClasses.add(parseClassName()); ++ skipSpace(); ++ if (c == ',') ++ next(); ++ else ++ break; ++ } ++ } ++ ++ private String parseClassName() { ++ // We don't check that classname components begin with suitable ++ // characters (so we accept 1.2.3 for example). This means that ++ // there are only two states, which we can call dotOK and !dotOK ++ // according as a dot (.) is legal or not. Initially we're in ++ // !dotOK since a classname can't start with a dot; after a dot ++ // we're in !dotOK again; and after any other characters we're in ++ // dotOK. The classname is only accepted if we end in dotOK, ++ // so we reject an empty name or a name that ends with a dot. ++ final int start = i; ++ boolean dotOK = false; ++ while (true) { ++ if (c == '.') { ++ if (!dotOK) ++ throw syntax("Bad . in class name"); ++ dotOK = false; ++ } else if (c == '*' || Character.isJavaIdentifierPart(c)) ++ dotOK = true; ++ else ++ break; ++ next(); ++ } ++ String className = s.substring(start, i); ++ if (!dotOK) ++ throw syntax("Bad class name " + className); ++ return className; ++ } ++ ++ // Advance c and i to the next character, unless already at EOS. ++ private void next() { ++ if (c != EOS) { ++ i += Character.charCount(c); ++ if (i < len) ++ c = s.codePointAt(i); ++ else ++ c = EOS; ++ } ++ } ++ ++ private void skipSpace() { ++ while (Character.isWhitespace(c)) ++ next(); ++ } ++ ++ private String parseWord() { ++ skipSpace(); ++ if (c == EOS) ++ throw syntax("Expected word at end of line"); ++ final int start = i; ++ while (c != EOS && !Character.isWhitespace(c)) ++ next(); ++ String word = s.substring(start, i); ++ skipSpace(); ++ return word; ++ } ++ ++ private IllegalArgumentException syntax(String msg) { ++ return new IllegalArgumentException( ++ msg + " [" + identity + " " + s + "]"); ++ } + } + +- private Properties props; ++ private Map accessMap; + private Properties originalProps; + private String accessFileName; + } +--- old/src/share/lib/management/jmxremote.access Mon Mar 9 18:11:05 2009 ++++ openjdk/jdk/src/share/lib/management/jmxremote.access Mon Mar 9 18:11:05 2009 +@@ -8,7 +8,7 @@ + # passwords. To be functional, a role must have an entry in + # both the password and the access files. + # +-# Default location of this file is $JRE/lib/management/jmxremote.access ++# The default location of this file is $JRE/lib/management/jmxremote.access + # You can specify an alternate location by specifying a property in + # the management config file $JRE/lib/management/management.properties + # (See that file for details) +@@ -16,7 +16,7 @@ + # The file format for password and access files is syntactically the same + # as the Properties file format. The syntax is described in the Javadoc + # for java.util.Properties.load. +-# Typical access file has multiple lines, where each line is blank, ++# A typical access file has multiple lines, where each line is blank, + # a comment (like this one), or an access control entry. + # + # An access control entry consists of a role name, and an +@@ -29,11 +29,39 @@ + # role can read measurements but cannot perform any action + # that changes the environment of the running program. + # "readwrite" grants access to read and write attributes of MBeans, +-# to invoke operations on them, and to create or remove them. +-# This access should be granted to only trusted clients, +-# since they can potentially interfere with the smooth +-# operation of a running program ++# to invoke operations on them, and optionally ++# to create or remove them. This access should be granted ++# only to trusted clients, since they can potentially ++# interfere with the smooth operation of a running program. + # ++# The "readwrite" access level can optionally be followed by the "create" and/or ++# "unregister" keywords. The "unregister" keyword grants access to unregister ++# (delete) MBeans. The "create" keyword grants access to create MBeans of a ++# particular class or of any class matching a particular pattern. Access ++# should only be granted to create MBeans of known and trusted classes. ++# ++# For example, the following entry would grant readwrite access ++# to "controlRole", as well as access to create MBeans of the class ++# javax.management.monitor.CounterMonitor and to unregister any MBean: ++# controlRole readwrite \ ++# create javax.management.monitor.CounterMonitorMBean \ ++# unregister ++# or equivalently: ++# controlRole readwrite unregister create javax.management.monitor.CounterMBean ++# ++# The following entry would grant readwrite access as well as access to create ++# MBeans of any class in the packages javax.management.monitor and ++# javax.management.timer: ++# controlRole readwrite \ ++# create javax.management.monitor.*,javax.management.timer.* \ ++# unregister ++# ++# The \ character is defined in the Properties file syntax to allow continuation ++# lines as shown here. A * in a class pattern matches a sequence of characters ++# other than dot (.), so javax.management.monitor.* matches ++# javax.management.monitor.CounterMonitor but not ++# javax.management.monitor.foo.Bar. ++# + # A given role should have at most one entry in this file. If a role + # has no entry, it has no access. + # If multiple entries are found for the same role name, then the last +@@ -42,7 +70,10 @@ + # + # Default access control entries: + # o The "monitorRole" role has readonly access. +-# o The "controlRole" role has readwrite access. ++# o The "controlRole" role has readwrite access and can create the standard ++# Timer and Monitor MBeans defined by the JMX API. + + monitorRole readonly +-controlRole readwrite ++controlRole readwrite \ ++ create javax.management.monitor.*,javax.management.timer.* \ ++ unregister diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6721753.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6721753.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,88 @@ +--- old/src/share/classes/java/io/File.java Thu Oct 9 16:11:01 2008 ++++ openjdk/jdk/src/share/classes/java/io/File.java Thu Oct 9 16:10:51 2008 +@@ -32,9 +32,9 @@ + import java.util.ArrayList; + import java.util.Map; + import java.util.Hashtable; +-import java.util.Random; + import java.security.AccessController; + import java.security.AccessControlException; ++import java.security.SecureRandom; + import sun.security.action.GetPropertyAction; + + +@@ -1676,30 +1676,30 @@ + + /* -- Temporary files -- */ + +- private static final Object tmpFileLock = new Object(); ++ // lazy initialization of SecureRandom and temporary file directory ++ private static class LazyInitialization { ++ static final SecureRandom random = new SecureRandom(); + +- private static int counter = -1; /* Protected by tmpFileLock */ ++ static final String temporaryDirectory = temporaryDirectory(); ++ static String temporaryDirectory() { ++ return fs.normalize( ++ AccessController.doPrivileged( ++ new GetPropertyAction("java.io.tmpdir"))); ++ } ++ } + + private static File generateFile(String prefix, String suffix, File dir) + throws IOException + { +- if (counter == -1) { +- counter = new Random().nextInt() & 0xffff; ++ long n = LazyInitialization.random.nextLong(); ++ if (n == Long.MIN_VALUE) { ++ n = 0; // corner case ++ } else { ++ n = Math.abs(n); + } +- counter++; +- return new File(dir, prefix + Integer.toString(counter) + suffix); ++ return new File(dir, prefix + Long.toString(n) + suffix); + } + +- private static String tmpdir; /* Protected by tmpFileLock */ +- +- private static String getTempDir() { +- if (tmpdir == null) +- tmpdir = fs.normalize( +- AccessController.doPrivileged( +- new GetPropertyAction("java.io.tmpdir"))); +- return tmpdir; +- } +- + private static boolean checkAndCreate(String filename, SecurityManager sm) + throws IOException + { +@@ -1793,18 +1793,16 @@ + if (prefix.length() < 3) + throw new IllegalArgumentException("Prefix string too short"); + String s = (suffix == null) ? ".tmp" : suffix; +- synchronized (tmpFileLock) { +- if (directory == null) { +- String tmpDir = getTempDir(); +- directory = new File(tmpDir, fs.prefixLength(tmpDir)); +- } +- SecurityManager sm = System.getSecurityManager(); +- File f; +- do { +- f = generateFile(prefix, s, directory); +- } while (!checkAndCreate(f.getPath(), sm)); +- return f; ++ if (directory == null) { ++ String tmpDir = LazyInitialization.temporaryDirectory(); ++ directory = new File(tmpDir, fs.prefixLength(tmpDir)); + } ++ SecurityManager sm = System.getSecurityManager(); ++ File f; ++ do { ++ f = generateFile(prefix, s, directory); ++ } while (!checkAndCreate(f.getPath(), sm)); ++ return f; + } + + /** diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6726779.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6726779.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,67 @@ +--- old/src/share/native/sun/awt/medialib/awt_ImagingLib.c Thu Aug 7 10:06:12 2008 ++++ openjdk/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c Thu Aug 7 10:06:12 2008 +@@ -216,6 +216,16 @@ + + #endif /* ! DEBUG */ + ++static int ++getMlibEdgeHint(jint edgeHint) { ++ switch (edgeHint) { ++ case java_awt_image_ConvolveOp_EDGE_NO_OP: ++ return MLIB_EDGE_DST_COPY_SRC; ++ case java_awt_image_ConvolveOp_EDGE_ZERO_FILL: ++ default: ++ return MLIB_EDGE_DST_FILL_ZERO; ++ } ++} + + /*************************************************************************** + * External Functions * +@@ -400,22 +410,10 @@ + } + } + +- if (edgeHint == java_awt_image_ConvolveOp_EDGE_NO_OP) { +- int kw2 = kwidth>>1; +- int kh2 = kheight>>1; +- int bsize = mlib_ImageGetChannels(src)* +- (mlib_ImageGetType(src) == MLIB_BYTE ? 1 : 2); +- +- void *dstDataP = mlib_ImageGetData(dst); +- void *srcDataP = mlib_ImageGetData(src); +- /* REMIND: Copy a smaller area */ +- memcpy(dstDataP, srcDataP, dst->width*dst->height*bsize); +- } +- + cmask = (1<channels)-1; + status = (*sMlibFns[MLIB_CONVMxN].fptr)(dst, src, kdata, w, h, + (w-1)/2, (h-1)/2, scale, cmask, +- MLIB_EDGE_DST_NO_WRITE); ++ getMlibEdgeHint(edgeHint)); + + if (status != MLIB_SUCCESS) { + printMedialibError(status); +@@ -660,22 +658,10 @@ + } + } + +- if (edgeHint == java_awt_image_ConvolveOp_EDGE_NO_OP) { +- int kw2 = kwidth>>1; +- int kh2 = kheight>>1; +- int bsize = mlib_ImageGetChannels(src)* +- (mlib_ImageGetType(src) == MLIB_BYTE ? 1 : 2); +- +- void *dstDataP = mlib_ImageGetData(dst); +- void *srcDataP = mlib_ImageGetData(src); +- /* REMIND: Copy a smaller area */ +- memcpy(dstDataP, srcDataP, dst->width*dst->height*bsize); +- } +- + cmask = (1<channels)-1; + status = (*sMlibFns[MLIB_CONVMxN].fptr)(dst, src, kdata, w, h, + (w-1)/2, (h-1)/2, scale, cmask, +- MLIB_EDGE_DST_NO_WRITE); ++ getMlibEdgeHint(edgeHint)); + + if (status != MLIB_SUCCESS) { + printMedialibError(status); diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6733959.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6733959.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,19 @@ +--- old/src/share/bin/java.c Tue Sep 30 13:28:32 2008 ++++ openjdk/jdk/src/share/bin/java.c Tue Sep 30 13:28:32 2008 +@@ -1056,8 +1056,14 @@ + * to avoid locating, expanding and parsing the manifest extra + * times. + */ +- if (info.main_class != NULL) +- (void)strcat(env_entry, info.main_class); ++ if (info.main_class != NULL) { ++ if (strlen(info.main_class) <= MAXNAMELEN) { ++ (void)strcat(env_entry, info.main_class); ++ } else { ++ ReportErrorMessage("Error: main-class: attribute exceeds system limits\n", JNI_TRUE); ++ exit(1); ++ } ++ } + (void)putenv(env_entry); + ExecJRE(jre, new_argv); + JLI_FreeManifest(); diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6734167.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6734167.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,89 @@ +--- old/src/share/classes/java/util/Calendar.java Fri Oct 3 00:27:50 2008 ++++ openjdk/jdk/src/share/classes/java/util/Calendar.java Fri Oct 3 00:27:50 2008 +@@ -41,9 +41,14 @@ + import java.io.IOException; + import java.io.ObjectInputStream; + import java.io.ObjectOutputStream; ++import java.io.OptionalDataException; + import java.io.Serializable; ++import java.security.AccessControlContext; + import java.security.AccessController; ++import java.security.PermissionCollection; ++import java.security.PrivilegedActionException; + import java.security.PrivilegedExceptionAction; ++import java.security.ProtectionDomain; + import java.text.DateFormat; + import java.text.DateFormatSymbols; + import sun.util.BuddhistCalendar; +@@ -2626,6 +2631,18 @@ + } + } + ++ private static class CalendarAccessControlContext { ++ private static final AccessControlContext INSTANCE; ++ static { ++ RuntimePermission perm = new RuntimePermission("accessClassInPackage.sun.util.calendar"); ++ PermissionCollection perms = perm.newPermissionCollection(); ++ perms.add(perm); ++ INSTANCE = new AccessControlContext(new ProtectionDomain[] { ++ new ProtectionDomain(null, perms) ++ }); ++ } ++ } ++ + /** + * Reconstitutes this object from a stream (i.e., deserialize it). + */ +@@ -2655,17 +2672,30 @@ + serialVersionOnStream = currentSerialVersion; + + // If there's a ZoneInfo object, use it for zone. ++ ZoneInfo zi = null; + try { +- ZoneInfo zi = (ZoneInfo) AccessController.doPrivileged( +- new PrivilegedExceptionAction() { +- public Object run() throws Exception { +- return input.readObject(); +- } +- }); +- if (zi != null) { +- zone = zi; ++ zi = AccessController.doPrivileged( ++ new PrivilegedExceptionAction() { ++ public ZoneInfo run() throws Exception { ++ return (ZoneInfo) input.readObject(); ++ } ++ }, ++ CalendarAccessControlContext.INSTANCE); ++ } catch (PrivilegedActionException pae) { ++ Exception e = pae.getException(); ++ if (!(e instanceof OptionalDataException)) { ++ if (e instanceof RuntimeException) { ++ throw (RuntimeException) e; ++ } else if (e instanceof IOException) { ++ throw (IOException) e; ++ } else if (e instanceof ClassNotFoundException) { ++ throw (ClassNotFoundException) e; ++ } ++ throw new RuntimeException(e); + } +- } catch (Exception e) { ++ } ++ if (zi != null) { ++ zone = zi; + } + + // If the deserialized object has a SimpleTimeZone, try to +@@ -2674,9 +2704,9 @@ + // implementation as much as possible. + if (zone instanceof SimpleTimeZone) { + String id = zone.getID(); +- TimeZone zi = TimeZone.getTimeZone(id); +- if (zi != null && zi.hasSameRules(zone) && zi.getID().equals(id)) { +- zone = zi; ++ TimeZone tz = TimeZone.getTimeZone(id); ++ if (tz != null && tz.hasSameRules(zone) && tz.getID().equals(id)) { ++ zone = tz; + } + } + } diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6737315.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6737315.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,44 @@ +--- old/./src/share/classes/com/sun/jndi/ldap/VersionHelper12.java Tue Mar 10 17:35:37 2009 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java Tue Mar 10 17:35:36 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -33,12 +33,33 @@ + + final class VersionHelper12 extends VersionHelper { + ++ // System property to control whether classes may be loaded from an ++ // arbitrary URL code base. ++ private static final String TRUST_URL_CODEBASE_PROPERTY = ++ "com.sun.jndi.ldap.object.trustURLCodebase"; ++ ++ // Determine whether classes may be loaded from an arbitrary URL code base. ++ private static final String trustURLCodebase = ++ AccessController.doPrivileged( ++ new PrivilegedAction() { ++ public String run() { ++ return System.getProperty(TRUST_URL_CODEBASE_PROPERTY, ++ "false"); ++ } ++ } ++ ); ++ + VersionHelper12() {} // Disallow external from creating one of these. + + ClassLoader getURLClassLoader(String[] url) + throws MalformedURLException { + ClassLoader parent = getContextClassLoader(); +- if (url != null) { ++ /* ++ * Classes may only be loaded from an arbitrary URL code base when ++ * the system property com.sun.jndi.ldap.object.trustURLCodebase ++ * has been set to "true". ++ */ ++ if (url != null && "true".equalsIgnoreCase(trustURLCodebase)) { + return URLClassLoader.newInstance(getUrlArray(url), parent); + } else { + return parent; diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6755943.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6755943.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,245 @@ +--- old/src/share/native/com/sun/java/util/jar/pack/bytes.cpp Fri Oct 17 10:50:38 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/bytes.cpp Fri Oct 17 10:50:38 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -56,7 +56,7 @@ + return; + } + byte* oldptr = ptr; +- ptr = (byte*)::realloc(ptr, len_+1); ++ ptr = (len_ >= PSIZE_MAX) ? null : (byte*)::realloc(ptr, len_+1); + if (ptr != null) { + mtrace('r', oldptr, 0); + mtrace('m', ptr, len_+1); +@@ -126,7 +126,7 @@ + // Make sure there are 'o' bytes beyond the fill pointer, + // advance the fill pointer, and return the old fill pointer. + byte* fillbytes::grow(size_t s) { +- size_t nlen = b.len+s; ++ size_t nlen = add_size(b.len, s); + if (nlen <= allocated) { + b.len = nlen; + return limit()-s; +--- old/src/share/native/com/sun/java/util/jar/pack/defines.h Fri Oct 17 10:50:38 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h Fri Oct 17 10:50:38 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -47,11 +47,13 @@ + #define NOT_PRODUCT(xxx) + #define assert(p) (0) + #define printcr false && ++#define VERSION_STRING "%s version %s\n" + #else + #define IF_PRODUCT(xxx) + #define NOT_PRODUCT(xxx) xxx + #define assert(p) ((p) || (assert_failed(#p), 1)) + #define printcr u->verbose && u->printcr_if_verbose ++#define VERSION_STRING "%s version non-product %s\n" + extern "C" void breakpoint(); + extern void assert_failed(const char*); + #define BREAK (breakpoint()) +@@ -79,9 +81,9 @@ + + #define lengthof(array) (sizeof(array)/sizeof(array[0])) + +-#define NEW(T, n) (T*) must_malloc(sizeof(T)*(n)) +-#define U_NEW(T, n) (T*) u->alloc(sizeof(T)*(n)) +-#define T_NEW(T, n) (T*) u->temp_alloc(sizeof(T)*(n)) ++#define NEW(T, n) (T*) must_malloc(scale_size(n, sizeof(T))) ++#define U_NEW(T, n) (T*) u->alloc(scale_size(n, sizeof(T))) ++#define T_NEW(T, n) (T*) u->temp_alloc(scale_size(n, sizeof(T))) + + + // bytes and byte arrays +--- old/src/share/native/com/sun/java/util/jar/pack/main.cpp Fri Oct 17 10:50:39 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp Fri Oct 17 10:50:39 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -300,7 +300,7 @@ + case 'J': argp += 1; break; // skip ignored -Jxxx parameter + + case 'V': +- fprintf(u.errstrm, "%s version %s\n", nbasename(argv[0]), sccsver); ++ fprintf(u.errstrm, VERSION_STRING, nbasename(argv[0]), sccsver); + exit(0); + + case 'h': +--- old/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Fri Oct 17 10:50:40 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Fri Oct 17 10:50:40 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -618,18 +618,17 @@ + if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) { + uint hi = hdr.getInt(); + uint lo = hdr.getInt(); +- archive_size = band::makeLong(hi, lo); ++ julong x = band::makeLong(hi, lo); ++ archive_size = (size_t) x; ++ if (archive_size != x) { ++ // Silly size specified; force overflow. ++ archive_size = PSIZE_MAX+1; ++ } + hdrVals += 2; + } else { + hdrValsSkipped += 2; + } + +- if (archive_size != (size_t)archive_size) { +- // Silly size specified. +- abort("archive too large"); +- return; +- } +- + // Now we can size the whole archive. + // Read everything else into a mega-buffer. + rp = hdr.rp; +@@ -643,8 +642,8 @@ + abort("EOF reading fixed input buffer"); + return; + } +- } else if (archive_size > 0) { +- input.set(U_NEW(byte, (size_t) header_size_0 + archive_size + C_SLOP), ++ } else if (archive_size != 0) { ++ input.set(U_NEW(byte, add_size(header_size_0, archive_size, C_SLOP)), + (size_t) header_size_0 + archive_size); + assert(input.limit()[0] == 0); + // Move all the bytes we read initially into the real buffer. +@@ -654,7 +653,6 @@ + } else { + // It's more complicated and painful. + // A zero archive_size means that we must read until EOF. +- assert(archive_size == 0); + input.init(CHUNK*2); + CHECK; + input.b.len = input.allocated; +@@ -664,7 +662,7 @@ + rplimit += header_size; + while (ensure_input(input.limit() - rp)) { + size_t dataSoFar = input_remaining(); +- size_t nextSize = dataSoFar + CHUNK; ++ size_t nextSize = add_size(dataSoFar, CHUNK); + input.ensureSize(nextSize); + CHECK; + input.b.len = input.allocated; +@@ -949,10 +947,12 @@ + // First band: Read lengths of shared prefixes. + if (len > PREFIX_SKIP_2) + cp_Utf8_prefix.readData(len - PREFIX_SKIP_2); ++ NOT_PRODUCT(else cp_Utf8_prefix.readData(0)); // for asserts + + // Second band: Read lengths of unshared suffixes: + if (len > SUFFIX_SKIP_1) + cp_Utf8_suffix.readData(len - SUFFIX_SKIP_1); ++ NOT_PRODUCT(else cp_Utf8_suffix.readData(0)); // for asserts + + bytes* allsuffixes = T_NEW(bytes, len); + CHECK; +--- old/src/share/native/com/sun/java/util/jar/pack/unpack.h Fri Oct 17 10:50:41 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h Fri Oct 17 10:50:41 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -204,7 +204,7 @@ + + // archive header fields + int magic, minver, majver; +- julong archive_size; ++ size_t archive_size; + int archive_next_count, archive_options, archive_modtime; + int band_headers_size; + int file_count, attr_definition_count, ic_count, class_count; +--- old/src/share/native/com/sun/java/util/jar/pack/utils.cpp Fri Oct 17 10:50:41 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp Fri Oct 17 10:50:41 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -46,14 +46,13 @@ + + #include "unpack.h" + +-void* must_malloc(int size) { +- int msize = size; +- assert(size >= 0); ++void* must_malloc(size_t size) { ++ size_t msize = size; + #ifdef USE_MTRACE +- if (msize < sizeof(int)) ++ if (msize >= 0 && msize < sizeof(int)) + msize = sizeof(int); // see 0xbaadf00d below + #endif +- void* ptr = malloc(msize); ++ void* ptr = (msize > PSIZE_MAX) ? null : malloc(msize); + if (ptr != null) { + memset(ptr, 0, size); + } else { +--- old/src/share/native/com/sun/java/util/jar/pack/utils.h Fri Oct 17 10:50:42 2008 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/utils.h Fri Oct 17 10:50:42 2008 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -25,7 +25,7 @@ + + //Definitions of our util functions + +-void* must_malloc(int size); ++void* must_malloc(size_t size); + #ifndef USE_MTRACE + #define mtrace(c, ptr, size) (0) + #else +@@ -32,6 +32,24 @@ + void mtrace(char c, void* ptr, size_t size); + #endif + ++// overflow management ++#define OVERFLOW ((size_t)-1) ++#define PSIZE_MAX (OVERFLOW/2) /* normal size limit */ ++ ++inline size_t scale_size(size_t size, size_t scale) { ++ return (size > PSIZE_MAX / scale) ? OVERFLOW : size * scale; ++} ++ ++inline size_t add_size(size_t size1, size_t size2) { ++ return ((size1 | size2 | (size1 + size2)) > PSIZE_MAX) ++ ? OVERFLOW ++ : size1 + size2; ++} ++ ++inline size_t add_size(size_t size1, size_t size2, int size3) { ++ return add_size(add_size(size1, size2), size3); ++} ++ + // These may be expensive, because they have to go via Java TSD, + // if the optional u argument is missing. + struct unpacker; diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6766136.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6766136.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,189 @@ +--- old/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h Wed Nov 12 12:25:11 2008 ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h Wed Nov 12 12:25:11 2008 +@@ -31,7 +31,7 @@ + /* here come some very simple macros */ + + /* advance a pointer p by sizeof(type)*n bytes */ +-#define INCPN(type,p,n) ((p) = (type*)(p)+n) ++#define INCPN(type,p,n) ((p) = (type*)(p)+(n)) + + /* advance a pointer by sizeof(type) */ + #define INCP(type,p) INCPN(type,(p),1) +--- old/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Wed Nov 12 12:25:12 2008 ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Wed Nov 12 12:25:12 2008 +@@ -53,6 +53,10 @@ + // convert libungif samples to our ones + #define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (a)) + ++#define SAFE_TO_ALLOC(c, sz) \ ++ (((c) > 0) && ((sz) > 0) && \ ++ ((0xffffffffu / ((unsigned int)(c))) > (unsigned int)(sz))) ++ + /* stdio FILE* and memory input functions for libungif */ + int + SplashStreamGifInputFunc(GifFileType * gif, GifByteType * buf, int n) +@@ -62,6 +66,15 @@ + return rc; + } + ++/* These macro help to ensure that we only take part of frame that fits into ++ logical screen. */ ++ ++/* Ensure that p belongs to [pmin, pmax) interval. Returns fixed point (if fix is needed) */ ++#define FIX_POINT(p, pmin, pmax) ( ((p) < (pmin)) ? (pmin) : (((p) > (pmax)) ? (pmax) : (p))) ++/* Ensures that line starting at point p does not exceed boundary pmax. ++ Returns fixed length (if fix is needed) */ ++#define FIX_LENGTH(p, len, pmax) ( ((p) + (len)) > (pmax) ? ((pmax) - (p)) : (len)) ++ + int + SplashDecodeGif(Splash * splash, GifFileType * gif) + { +@@ -70,6 +83,7 @@ + byte_t *pBitmapBits, *pOldBitmapBits; + int i, j; + int imageIndex; ++ int cx, cy, cw, ch; /* clamped coordinates */ + const int interlacedOffset[] = { 0, 4, 2, 1, 0 }; /* The way Interlaced image should. */ + const int interlacedJumps[] = { 8, 8, 4, 2, 1 }; /* be read - offsets and jumps... */ + +@@ -79,14 +93,31 @@ + + SplashCleanup(splash); + ++ if (!SAFE_TO_ALLOC(gif->SWidth, splash->imageFormat.depthBytes)) { ++ return 0; ++ } + stride = gif->SWidth * splash->imageFormat.depthBytes; + if (splash->byteAlignment > 1) + stride = + (stride + splash->byteAlignment - 1) & ~(splash->byteAlignment - 1); + ++ if (!SAFE_TO_ALLOC(gif->SHeight, stride)) { ++ return 0; ++ } ++ ++ if (!SAFE_TO_ALLOC(gif->ImageCount, sizeof(SplashImage*))) { ++ return 0; ++ } + bufferSize = stride * gif->SHeight; + pBitmapBits = (byte_t *) malloc(bufferSize); ++ if (!pBitmapBits) { ++ return 0; ++ } + pOldBitmapBits = (byte_t *) malloc(bufferSize); ++ if (!pOldBitmapBits) { ++ free(pBitmapBits); ++ return 0; ++ } + memset(pBitmapBits, 0, bufferSize); + + splash->width = gif->SWidth; +@@ -94,6 +125,11 @@ + splash->frameCount = gif->ImageCount; + splash->frames = (SplashImage *) + malloc(sizeof(SplashImage) * gif->ImageCount); ++ if (!splash->frames) { ++ free(pBitmapBits); ++ free(pOldBitmapBits); ++ return 0; ++ } + memset(splash->frames, 0, sizeof(SplashImage) * gif->ImageCount); + splash->loopCount = 1; + +@@ -109,6 +145,11 @@ + int colorCount = 0; + rgbquad_t colorMapBuf[SPLASH_COLOR_MAP_SIZE]; + ++ cx = FIX_POINT(desc->Left, 0, gif->SWidth); ++ cy = FIX_POINT(desc->Top, 0, gif->SHeight); ++ cw = FIX_LENGTH(desc->Left, desc->Width, gif->SWidth); ++ ch = FIX_LENGTH(desc->Top, desc->Height, gif->SHeight); ++ + if (colorMap) { + if (colorMap->ColorCount <= SPLASH_COLOR_MAP_SIZE) { + colorCount = colorMap->ColorCount; +@@ -195,13 +236,24 @@ + for (; pass < npass; ++pass) { + int jump = interlacedJumps[pass]; + int ofs = interlacedOffset[pass]; +- int numLines = (desc->Height + jump - 1 - ofs) / jump; ++ /* Number of source lines for current pass */ ++ int numPassLines = (desc->Height + jump - ofs - 1) / jump; ++ /* Number of lines that fits to dest buffer */ ++ int numLines = (ch + jump - ofs - 1) / jump; + ++ + initRect(&srcRect, 0, 0, desc->Width, numLines, 1, + desc->Width, pSrc, &srcFormat); +- initRect(&dstRect, desc->Left, desc->Top + ofs, desc->Width, +- numLines, jump, stride, pBitmapBits, &splash->imageFormat); +- pSrc += convertRect(&srcRect, &dstRect, CVT_ALPHATEST); ++ ++ if (numLines > 0) { ++ initRect(&dstRect, cx, cy + ofs, cw, ++ numLines, jump, stride, pBitmapBits, ++ &splash->imageFormat); ++ ++ pSrc += convertRect(&srcRect, &dstRect, CVT_ALPHATEST); ++ } ++ // skip extra source data ++ pSrc += (numPassLines - numLines) * srcRect.stride; + } + } + +@@ -209,6 +261,12 @@ + + splash->frames[imageIndex].bitmapBits = + (rgbquad_t *) malloc(bufferSize); ++ if (!splash->frames[imageIndex].bitmapBits) { ++ free(pBitmapBits); ++ free(pOldBitmapBits); ++ /* Assuming that callee will take care of splash frames we have already allocated */ ++ return 0; ++ } + memcpy(splash->frames[imageIndex].bitmapBits, pBitmapBits, bufferSize); + + SplashInitFrameShape(splash, imageIndex); +@@ -224,27 +282,29 @@ + { + ImageRect dstRect; + rgbquad_t fillColor = 0; // 0 is transparent +- if (transparentColor < 0) { ++ ++ if (transparentColor > 0) { + fillColor= MAKE_QUAD_GIF( + colorMap->Colors[gif->SBackGroundColor], 0xff); + } +- initRect(&dstRect, desc->Left, desc->Top, +- desc->Width, desc->Height, 1, stride, +- pBitmapBits, &splash->imageFormat); ++ initRect(&dstRect, ++ cx, cy, cw, ch, ++ 1, stride, ++ pBitmapBits, &splash->imageFormat); + fillRect(fillColor, &dstRect); + } + break; + case GIF_DISPOSE_RESTORE: + { +- +- int lineSize = desc->Width * splash->imageFormat.depthBytes; +- +- for (j = 0; j < desc->Height; j++) { +- int lineIndex = stride * (j + desc->Top) + +- desc->Left * splash->imageFormat.depthBytes; +- +- memcpy(pBitmapBits + lineIndex, pOldBitmapBits + lineIndex, +- lineSize); ++ int lineSize = cw * splash->imageFormat.depthBytes; ++ if (lineSize > 0) { ++ int lineOffset = cx * splash->imageFormat.depthBytes; ++ int lineIndex = cy * stride + lineOffset; ++ for (j=0; jisMalloc); + } + xvs.init(u->rp, u->rplimit, valc); ++ CHECK; + int X = xvs.getInt(); + if (valc->S() != 0) { + assert(valc->min <= -256); +@@ -117,6 +118,7 @@ + byte XB_byte = (byte) XB; + byte* XB_ptr = &XB_byte; + cm.init(u->rp, u->rplimit, XB_ptr, 0, defc, length, null); ++ CHECK; + } else { + NOT_PRODUCT(byte* meta_rp0 = u->meta_rp); + assert(u->meta_rp != null); +@@ -215,8 +217,19 @@ + if (length == 0) return 0; + if (total_memo > 0) return total_memo-1; + int total = getInt(); ++ // overflow checks require that none of the addends are <0, ++ // and that the partial sums never overflow (wrap negative) ++ if (total < 0) { ++ abort("overflow detected"); ++ return 0; ++ } + for (int k = length-1; k > 0; k--) { +- total += vs[0].getInt(); ++ int prev_total = total; ++ total += vs[0].getInt(); ++ if (total < prev_total) { ++ abort("overflow detected"); ++ return 0; ++ } + } + rewind(); + total_memo = total+1; +--- old/src/share/native/com/sun/java/util/jar/pack/coding.cpp Tue Mar 3 22:19:29 2009 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp Tue Mar 3 22:19:27 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -809,6 +809,7 @@ + } + band_rp = vs.rp; + } ++ CHECK; + + // Get an accurate upper limit now. + vs0.rplimit = band_rp; +--- old/src/share/native/com/sun/java/util/jar/pack/defines.h Tue Mar 3 22:19:33 2009 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h Tue Mar 3 22:19:31 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -155,6 +155,8 @@ + #define CHECK_NULL_(y,p) _CHECK_DO((p)==null, return y) + #define CHECK_NULL_0(p) _CHECK_DO((p)==null, return 0) + ++#define CHECK_COUNT(t) if (t < 0){abort("bad value count");} CHECK ++ + #define STR_TRUE "true" + #define STR_FALSE "false" + +--- old/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Tue Mar 3 22:19:37 2009 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Tue Mar 3 22:19:35 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -504,15 +504,40 @@ + enum { + MAGIC_BYTES = 4, + AH_LENGTH_0 = 3, //minver, majver, options are outside of archive_size ++ AH_LENGTH_0_MAX = AH_LENGTH_0 + 1, // options might have 2 bytes + AH_LENGTH = 26, //maximum archive header length (w/ all fields) + // Length contributions from optional header fields: + AH_FILE_HEADER_LEN = 5, // sizehi/lo/next/modtime/files ++ AH_ARCHIVE_SIZE_LEN = 2, // sizehi/lo only; part of AH_FILE_HEADER_LEN + AH_CP_NUMBER_LEN = 4, // int/float/long/double + AH_SPECIAL_FORMAT_LEN = 2, // layouts/band-headers + AH_LENGTH_MIN = AH_LENGTH + -(AH_FILE_HEADER_LEN+AH_SPECIAL_FORMAT_LEN+AH_CP_NUMBER_LEN), ++ ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - (AH_LENGTH_0 + AH_ARCHIVE_SIZE_LEN), + FIRST_READ = MAGIC_BYTES + AH_LENGTH_MIN + }; ++ ++ ++ assert(AH_LENGTH_MIN == 15); // # of UNSIGNED5 fields required after archive_magic ++ assert(ARCHIVE_SIZE_MIN == 10); // # of UNSIGNED5 fields required after archive_size ++ // An absolute minimum null archive is magic[4], {minver,majver,options}[3], ++ // archive_size[0], cp_counts[8], class_counts[4], for a total of 19 bytes. ++ // (Note that archive_size is optional; it may be 0..10 bytes in length.) ++ // The first read must capture everything up through the options field. ++ // This happens to work even if {minver,majver,options} is a pathological ++ // 15 bytes long. Legal pack files limit those three fields to 1+1+2 bytes. ++ assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0 * B_MAX); ++ ++ // Up through archive_size, the largest possible archive header is ++ // magic[4], {minver,majver,options}[4], archive_size[10]. ++ // (Note only the low 12 bits of options are allowed to be non-zero.) ++ // In order to parse archive_size, we need at least this many bytes ++ // in the first read. Of course, if archive_size_hi is more than ++ // a byte, we probably will fail to allocate the buffer, since it ++ // will be many gigabytes long. This is a practical, not an ++ // architectural limit to Pack200 archive sizes. ++ assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0_MAX + 2*B_MAX); ++ + bool foreign_buf = (read_input_fn == null); + byte initbuf[FIRST_READ + C_SLOP + 200]; // 200 is for JAR I/O + if (foreign_buf) { +@@ -528,7 +553,7 @@ + // There is no way to tell the caller that we used only part of them. + // Therefore, the caller must use only a bare minimum of read-ahead. + if (inbytes.len > FIRST_READ) { +- abort("too much pushback"); ++ abort("too much read-ahead"); + return; + } + input.set(initbuf, sizeof(initbuf)); +@@ -538,7 +563,7 @@ + rplimit += inbytes.len; + bytes_read += inbytes.len; + } +- // Read only 19 bytes, which is certain to contain #archive_size fields, ++ // Read only 19 bytes, which is certain to contain #archive_options fields, + // but is certain not to overflow past the archive_header. + input.b.len = FIRST_READ; + if (!ensure_input(FIRST_READ)) +@@ -611,8 +636,8 @@ + if ((archive_options & ~OPTION_LIMIT) != 0) { + fprintf(errstrm, "Warning: Illegal archive options 0x%x\n", + archive_options); +- // Do not abort. If the format really changes, version numbers will bump. +- //abort("illegal archive options"); ++ abort("illegal archive options"); ++ return; + } + + if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) { +@@ -643,8 +668,17 @@ + return; + } + } else if (archive_size != 0) { ++ if (archive_size < ARCHIVE_SIZE_MIN) { ++ abort("impossible archive size"); // bad input data ++ return; ++ } ++ if (archive_size < header_size_1) { ++ abort("too much read-ahead"); // somehow we pre-fetched too much? ++ return; ++ } + input.set(U_NEW(byte, add_size(header_size_0, archive_size, C_SLOP)), + (size_t) header_size_0 + archive_size); ++ CHECK; + assert(input.limit()[0] == 0); + // Move all the bytes we read initially into the real buffer. + input.b.copyFrom(initbuf, header_size); +@@ -659,6 +693,7 @@ + rp = rplimit = input.base(); + // Set up input buffer as if we already read the header: + input.b.copyFrom(initbuf, header_size); ++ CHECK; + rplimit += header_size; + while (ensure_input(input.limit() - rp)) { + size_t dataSoFar = input_remaining(); +@@ -694,8 +729,10 @@ + + if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) { + archive_next_count = hdr.getInt(); ++ CHECK_COUNT(archive_next_count); + archive_modtime = hdr.getInt(); + file_count = hdr.getInt(); ++ CHECK_COUNT(file_count); + hdrVals += 3; + } else { + hdrValsSkipped += 3; +@@ -703,7 +740,9 @@ + + if ((archive_options & AO_HAVE_SPECIAL_FORMATS) != 0) { + band_headers_size = hdr.getInt(); ++ CHECK_COUNT(band_headers_size); + attr_definition_count = hdr.getInt(); ++ CHECK_COUNT(attr_definition_count); + hdrVals += 2; + } else { + hdrValsSkipped += 2; +@@ -723,13 +762,16 @@ + } + } + cp_counts[k] = hdr.getInt(); ++ CHECK_COUNT(cp_counts[k]); + hdrVals += 1; + } + + ic_count = hdr.getInt(); ++ CHECK_COUNT(ic_count); + default_class_minver = hdr.getInt(); + default_class_majver = hdr.getInt(); + class_count = hdr.getInt(); ++ CHECK_COUNT(class_count); + hdrVals += 4; + + // done with archive_header +@@ -783,7 +825,6 @@ + bytes::of(band_headers.limit(), C_SLOP).clear(_meta_error); + } + +- + void unpacker::finish() { + if (verbose >= 1) { + fprintf(errstrm, +@@ -2089,13 +2130,14 @@ + + field_descr.readData(field_count); + read_attrs(ATTR_CONTEXT_FIELD, field_count); ++ CHECK; + + method_descr.readData(method_count); + read_attrs(ATTR_CONTEXT_METHOD, method_count); +- + CHECK; + + read_attrs(ATTR_CONTEXT_CLASS, class_count); ++ CHECK; + + read_code_headers(); + +@@ -2122,10 +2164,12 @@ + assert(endsWith(xxx_flags_hi.name, "_flags_hi")); + if (haveLongFlags) + xxx_flags_hi.readData(obj_count); ++ CHECK; + + band& xxx_flags_lo = ad.xxx_flags_lo(); + assert(endsWith(xxx_flags_lo.name, "_flags_lo")); + xxx_flags_lo.readData(obj_count); ++ CHECK; + + // pre-scan flags, counting occurrences of each index bit + julong indexMask = ad.flagIndexMask(); // which flag bits are index bits? +@@ -2148,11 +2192,13 @@ + assert(endsWith(xxx_attr_count.name, "_attr_count")); + // There is one count element for each 1<<16 bit set in flags: + xxx_attr_count.readData(ad.predefCount(X_ATTR_OVERFLOW)); ++ CHECK; + + band& xxx_attr_indexes = ad.xxx_attr_indexes(); + assert(endsWith(xxx_attr_indexes.name, "_attr_indexes")); + int overflowIndexCount = xxx_attr_count.getIntTotal(); + xxx_attr_indexes.readData(overflowIndexCount); ++ CHECK; + // pre-scan attr indexes, counting occurrences of each value + for (i = 0; i < overflowIndexCount; i++) { + idx = xxx_attr_indexes.getInt(); +@@ -2183,6 +2229,7 @@ + } + } + ad.xxx_attr_calls().readData(backwardCounts); ++ CHECK; + + // Read built-in bands. + // Mostly, these are hand-coded equivalents to readBandData(). +@@ -2191,13 +2238,16 @@ + + count = ad.predefCount(CLASS_ATTR_SourceFile); + class_SourceFile_RUN.readData(count); ++ CHECK; + + count = ad.predefCount(CLASS_ATTR_EnclosingMethod); + class_EnclosingMethod_RC.readData(count); + class_EnclosingMethod_RDN.readData(count); ++ CHECK; + + count = ad.predefCount(X_ATTR_Signature); + class_Signature_RS.readData(count); ++ CHECK; + + ad.readBandData(X_ATTR_RuntimeVisibleAnnotations); + ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations); +@@ -2204,17 +2254,22 @@ + + count = ad.predefCount(CLASS_ATTR_InnerClasses); + class_InnerClasses_N.readData(count); ++ CHECK; ++ + count = class_InnerClasses_N.getIntTotal(); + class_InnerClasses_RC.readData(count); + class_InnerClasses_F.readData(count); ++ CHECK; + // Drop remaining columns wherever flags are zero: + count -= class_InnerClasses_F.getIntCount(0); + class_InnerClasses_outer_RCN.readData(count); + class_InnerClasses_name_RUN.readData(count); ++ CHECK; + + count = ad.predefCount(CLASS_ATTR_ClassFile_version); + class_ClassFile_version_minor_H.readData(count); + class_ClassFile_version_major_H.readData(count); ++ CHECK; + break; + + case ATTR_CONTEXT_FIELD: +@@ -2221,12 +2276,15 @@ + + count = ad.predefCount(FIELD_ATTR_ConstantValue); + field_ConstantValue_KQ.readData(count); ++ CHECK; + + count = ad.predefCount(X_ATTR_Signature); + field_Signature_RS.readData(count); ++ CHECK; + + ad.readBandData(X_ATTR_RuntimeVisibleAnnotations); + ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations); ++ CHECK; + break; + + case ATTR_CONTEXT_METHOD: +@@ -2238,9 +2296,11 @@ + method_Exceptions_N.readData(count); + count = method_Exceptions_N.getIntTotal(); + method_Exceptions_RC.readData(count); ++ CHECK; + + count = ad.predefCount(X_ATTR_Signature); + method_Signature_RS.readData(count); ++ CHECK; + + ad.readBandData(X_ATTR_RuntimeVisibleAnnotations); + ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations); +@@ -2247,6 +2307,7 @@ + ad.readBandData(METHOD_ATTR_RuntimeVisibleParameterAnnotations); + ad.readBandData(METHOD_ATTR_RuntimeInvisibleParameterAnnotations); + ad.readBandData(METHOD_ATTR_AnnotationDefault); ++ CHECK; + break; + + case ATTR_CONTEXT_CODE: +@@ -2258,8 +2319,10 @@ + return; + } + code_StackMapTable_N.readData(count); ++ CHECK; + count = code_StackMapTable_N.getIntTotal(); + code_StackMapTable_frame_T.readData(count); ++ CHECK; + // the rest of it depends in a complicated way on frame tags + { + int fat_frame_count = 0; +@@ -2293,18 +2356,23 @@ + // deal completely with fat frames: + offset_count += fat_frame_count; + code_StackMapTable_local_N.readData(fat_frame_count); ++ CHECK; + type_count += code_StackMapTable_local_N.getIntTotal(); + code_StackMapTable_stack_N.readData(fat_frame_count); + type_count += code_StackMapTable_stack_N.getIntTotal(); ++ CHECK; + // read the rest: + code_StackMapTable_offset.readData(offset_count); + code_StackMapTable_T.readData(type_count); ++ CHECK; + // (7) [RCH] + count = code_StackMapTable_T.getIntCount(7); + code_StackMapTable_RC.readData(count); ++ CHECK; + // (8) [PH] + count = code_StackMapTable_T.getIntCount(8); + code_StackMapTable_P.readData(count); ++ CHECK; + } + + count = ad.predefCount(CODE_ATTR_LineNumberTable); +@@ -2626,7 +2694,9 @@ + code_max_na_locals.readData(); + code_handler_count.readData(); + totalHandlerCount += code_handler_count.getIntTotal(); ++ CHECK; + ++ + // Read handler specifications. + // Cf. PackageReader.readCodeHandlers. + code_handler_start_P.readData(totalHandlerCount); +@@ -2633,8 +2703,10 @@ + code_handler_end_PO.readData(totalHandlerCount); + code_handler_catch_PO.readData(totalHandlerCount); + code_handler_class_RCN.readData(totalHandlerCount); ++ CHECK; + + read_attrs(ATTR_CONTEXT_CODE, totalFlagsCount); ++ CHECK; + } + + static inline bool is_in_range(uint n, uint min, uint max) { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6804996.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6804996.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,75 @@ +--- old/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Thu Mar 5 16:18:35 2009 ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Thu Mar 5 16:18:34 2009 +@@ -53,10 +53,6 @@ + // convert libungif samples to our ones + #define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (a)) + +-#define SAFE_TO_ALLOC(c, sz) \ +- (((c) > 0) && ((sz) > 0) && \ +- ((0xffffffffu / ((unsigned int)(c))) > (unsigned int)(sz))) +- + /* stdio FILE* and memory input functions for libungif */ + int + SplashStreamGifInputFunc(GifFileType * gif, GifByteType * buf, int n) +--- old/src/share/native/sun/awt/splashscreen/splashscreen_impl.h Thu Mar 5 16:18:38 2009 ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.h Thu Mar 5 16:18:37 2009 +@@ -155,6 +155,10 @@ + + void SplashInitFrameShape(Splash * splash, int imageIndex); + ++#define SAFE_TO_ALLOC(c, sz) \ ++ (((c) > 0) && ((sz) > 0) && \ ++ ((0xffffffffu / ((unsigned int)(c))) > (unsigned int)(sz))) ++ + #define dbgprintf printf + + #endif +--- old/src/share/native/sun/awt/splashscreen/splashscreen_png.c Thu Mar 5 16:18:41 2009 ++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c Thu Mar 5 16:18:40 2009 +@@ -103,9 +103,17 @@ + + rowbytes = png_get_rowbytes(png_ptr, info_ptr); + ++ if (!SAFE_TO_ALLOC(rowbytes, height)) { ++ goto done; ++ } ++ + if ((image_data = (unsigned char *) malloc(rowbytes * height)) == NULL) { + goto done; + } ++ ++ if (!SAFE_TO_ALLOC(height, sizeof(png_bytep))) { ++ goto done; ++ } + if ((row_pointers = (png_bytepp) malloc(height * sizeof(png_bytep))) + == NULL) { + goto done; +@@ -121,13 +129,28 @@ + splash->width = width; + splash->height = height; + ++ if (!SAFE_TO_ALLOC(splash->width, splash->imageFormat.depthBytes)) { ++ goto done; ++ } + stride = splash->width * splash->imageFormat.depthBytes; + ++ if (!SAFE_TO_ALLOC(splash->height, stride)) { ++ goto done; ++ } + splash->frameCount = 1; + splash->frames = (SplashImage *) + malloc(sizeof(SplashImage) * splash->frameCount); ++ ++ if (splash->frames == NULL) { ++ goto done; ++ } ++ + splash->loopCount = 1; + splash->frames[0].bitmapBits = malloc(stride * splash->height); ++ if (splash->frames[0].bitmapBits == NULL) { ++ free(splash->frames); ++ goto done; ++ } + splash->frames[0].delay = 0; + + /* FIXME: sort out the real format */ diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6804997.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6804997.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,31 @@ +--- old/src/share/native/sun/awt/giflib/dgif_lib.c Thu Mar 5 16:33:17 2009 ++++ openjdk/jdk/src/share/native/sun/awt/giflib/dgif_lib.c Thu Mar 5 16:33:16 2009 +@@ -722,6 +722,10 @@ + GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; + + READ(GifFile, &CodeSize, 1); /* Read Code size from file. */ ++ if (CodeSize >= 12) { ++ /* Invalid initial code size: report failure */ ++ return GIF_ERROR; ++ } + BitsPerPixel = CodeSize; + + Private->Buf[0] = 0; /* Input Buffer empty. */ +@@ -964,10 +968,13 @@ + + /* If code cannot fit into RunningBits bits, must raise its size. Note + * however that codes above 4095 are used for special signaling. */ +- if (++Private->RunningCode > Private->MaxCode1 && +- Private->RunningBits < LZ_BITS) { +- Private->MaxCode1 <<= 1; +- Private->RunningBits++; ++ if (++Private->RunningCode > Private->MaxCode1) { ++ if (Private->RunningBits < LZ_BITS) { ++ Private->MaxCode1 <<= 1; ++ Private->RunningBits++; ++ } else { ++ Private->RunningCode = Private->MaxCode1; ++ } + } + return GIF_OK; + } diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6804998.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6804998.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,35 @@ +--- old/src/share/classes/sun/awt/image/GifImageDecoder.java Thu Mar 5 17:00:25 2009 ++++ openjdk/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java Thu Mar 5 17:00:24 2009 +@@ -585,9 +585,16 @@ + System.out.print("Reading a " + width + " by " + height + " " + + (interlace ? "" : "non-") + "interlaced image..."); + } +- ++ int initCodeSize = ExtractByte(block, 9); ++ if (initCodeSize >= 12) { ++ if (verbose) { ++ System.out.println("Invalid initial code size: " + ++ initCodeSize); ++ } ++ return false; ++ } + boolean ret = parseImage(x, y, width, height, +- interlace, ExtractByte(block, 9), ++ interlace, initCodeSize, + block, rasline, model); + + if (!ret) { +--- old/src/share/native/sun/awt/image/gif/gifdecoder.c Thu Mar 5 17:00:28 2009 ++++ openjdk/jdk/src/share/native/sun/awt/image/gif/gifdecoder.c Thu Mar 5 17:00:27 2009 +@@ -191,6 +191,11 @@ + int passht = passinc; + int len; + ++ /* We have verified the initial code size on the java layer. ++ * Here we just check bounds for particular indexes. */ ++ if (freeCode >= 4096 || maxCode >= 4096) { ++ return 0; ++ } + if (blockh == 0 || raslineh == 0 + || prefixh == 0 || suffixh == 0 + || outCodeh == 0) diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6822057.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6822057.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,32 @@ +--- old/src/solaris/classes/sun/awt/X11GraphicsDevice.java 2009-07-28 16:57:02.545000000 +0400 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java 2009-07-28 16:57:01.921000000 +0400 +@@ -134,7 +134,7 @@ + makeConfigurations(); + } + } +- return configs; ++ return configs.clone(); + } + + private void makeConfigurations() { +--- old/src/windows/classes/sun/awt/Win32GraphicsDevice.java 2009-07-28 16:57:08.184000000 +0400 ++++ openjdk/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java 2009-07-28 16:57:07.557000000 +0400 +@@ -170,7 +170,7 @@ + if (defaultConfig != null) { + configs = new GraphicsConfiguration[1]; + configs[0] = defaultConfig; +- return configs; ++ return configs.clone(); + } + } + +@@ -202,7 +202,7 @@ + configs = new GraphicsConfiguration[v.size()]; + v.copyInto(configs); + } +- return configs; ++ return configs.clone(); + } + + /** + diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6824265.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6824265.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,120 @@ +--- old/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2009-08-28 12:32:15.000000000 +0900 ++++ openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2009-08-28 12:32:14.000000000 +0900 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -472,6 +472,19 @@ + + private static Map zoneInfoObjects = null; + ++ private static final String ziDir; ++ static { ++ String zi = (String) AccessController.doPrivileged( ++ new sun.security.action.GetPropertyAction("java.home")) ++ + File.separator + "lib" + File.separator + "zi"; ++ try { ++ zi = new File(zi).getCanonicalPath(); ++ } catch (Exception e) { ++ } ++ ziDir = zi; ++ } ++ ++ + /** + * Converts the given time zone ID to a platform dependent path + * name. For example, "America/Los_Angeles" is converted to +@@ -576,20 +589,7 @@ + return null; + } + +- int index; +- for (index = 0; index < JAVAZI_LABEL.length; index++) { +- if (buf[index] != JAVAZI_LABEL[index]) { +- System.err.println("ZoneInfo: wrong magic number: " + id); +- return null; +- } +- } +- +- if (buf[index++] > JAVAZI_VERSION) { +- System.err.println("ZoneInfo: incompatible version (" +- + buf[index - 1] + "): " + id); +- return null; +- } +- ++ int index=0; + int filesize = buf.length; + int rawOffset = 0; + int dstSavings = 0; +@@ -600,6 +600,19 @@ + int[] simpleTimeZoneParams = null; + + try { ++ for (index = 0; index < JAVAZI_LABEL.length; index++) { ++ if (buf[index] != JAVAZI_LABEL[index]) { ++ System.err.println("ZoneInfo: wrong magic number: " + id); ++ return null; ++ } ++ } ++ if (buf[index++] > JAVAZI_VERSION) { ++ System.err.println("ZoneInfo: incompatible version (" ++ + buf[index - 1] + "): " + id); ++ return null; ++ } ++ ++ + while (index < filesize) { + byte tag = buf[index++]; + int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); +@@ -1018,7 +1018,7 @@ + * Reads the specified file under <java.home>/lib/zi into a buffer. + * @return the buffer, or null if any I/O error occurred. + */ +- private static byte[] readZoneInfoFile(String fileName) { ++ private static byte[] readZoneInfoFile(final String fileName) { + byte[] buffer = null; + + try { +@@ -1046,20 +1046,28 @@ + final String fname = zi_dir + File.separator + fileName; + buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException { +- File file = new File(fname); +- if (!file.canRead()) { ++ File file = new File(ziDir, fileName); ++ if (!file.exists() || !file.isFile()) { + return null; + } +- int filesize = (int)file.length(); +- byte[] buf = new byte[filesize]; ++ file = file.getCanonicalFile(); ++ String path = file.getCanonicalPath(); ++ byte[] buf = null; ++ if (path != null && path.startsWith(ziDir)) { ++ int filesize = (int)file.length(); ++ if (filesize > 0) { ++ FileInputStream fis = new FileInputStream(file); ++ buf = new byte[filesize]; ++ try { ++ if (fis.read(buf) != filesize) { ++ throw new IOException("read error on " + fileName); ++ } ++ } finally { ++ fis.close(); ++ } ++ } ++ } + +- FileInputStream fis = new FileInputStream(file); +- +- if (fis.read(buf) != filesize) { +- fis.close(); +- throw new IOException("read error on " + fname); +- } +- fis.close(); + return buf; + } + }); diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6861062.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6861062.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,341 @@ +--- old/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Tue Sep 22 05:44:00 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Tue Sep 22 05:43:59 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -308,6 +308,16 @@ + X500Name certIssuer = (X500Name) certImpl.getIssuerDN(); + X500Name crlIssuer = (X500Name) crlImpl.getIssuerDN(); + ++ // check the crl signature algorithm ++ try { ++ AlgorithmChecker.check(crl); ++ } catch (CertPathValidatorException cpve) { ++ if (debug != null) { ++ debug.println("CRL signature algorithm check failed: " + cpve); ++ } ++ return false; ++ } ++ + // if crlIssuer is set, verify that it matches the issuer of the + // CRL and the CRL contains an IDP extension with the indirectCRL + // boolean asserted. Otherwise, verify that the CRL issuer matches the +--- old/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java Tue Sep 22 05:44:02 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java Tue Sep 22 05:44:01 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -676,6 +676,11 @@ + /* we don't perform any validation of the trusted cert */ + if (!isTrustedCert) { + /* ++ * check that the signature algorithm is not disabled. ++ */ ++ AlgorithmChecker.check(cert); ++ ++ /* + * Check CRITICAL private extensions for user checkers that + * support forward checking (forwardCheckers) and remove + * ones we know how to check. +--- old/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Tue Sep 22 05:44:05 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Tue Sep 22 05:44:04 2009 +@@ -290,12 +290,29 @@ + } + if (filter != null) { + List certStores = pkixParams.getCertStores(); ++ AlgorithmChecker algChecker= ++ AlgorithmChecker.getInstance(); + for (CertStore certStore : certStores) { +- Iterator i = +- certStore.getCertificates(filter).iterator(); +- if (i.hasNext()) { +- responderCert = (X509Certificate) i.next(); +- seekResponderCert = false; // done ++ for (Certificate selected : ++ certStore.getCertificates(filter)) { ++ try { ++ // don't bother to trust algorithm disabled ++ // certificate as responder ++ algChecker.check(selected); ++ ++ responderCert = (X509Certificate)selected; ++ seekResponderCert = false; // done ++ break; ++ } catch (CertPathValidatorException cpve) { ++ if (DEBUG != null) { ++ DEBUG.println( ++ "OCSP responder certificate " + ++ "algorithm check failed: " + cpve); ++ } ++ } ++ } ++ ++ if (!seekResponderCert) { + break; + } + } +--- old/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Tue Sep 22 05:44:07 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Tue Sep 22 05:44:07 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -222,6 +222,10 @@ + new DerInputStream(derIn.getOctetString()); + + DerValue[] seqTmp = basicOCSPResponse.getSequence(2); ++ if (seqTmp.length < 3) { ++ throw new IOException("Unexpected BasicOCSPResponse value"); ++ } ++ + DerValue responseData = seqTmp[0]; + + // Need the DER encoded ResponseData to verify the signature later +@@ -304,6 +308,9 @@ + // signatureAlgorithmId + sigAlgId = AlgorithmId.parse(seqTmp[1]); + ++ // check that the signature algorithm is not disabled. ++ AlgorithmChecker.check(sigAlgId); ++ + // signature + byte[] signature = seqTmp[2].getBitString(); + X509CertImpl[] x509Certs = null; +@@ -337,6 +344,9 @@ + } else if (cert.getIssuerDN().equals( + responderCert.getSubjectDN())) { + ++ // check the certificate algorithm ++ AlgorithmChecker.check(cert); ++ + // Check for the OCSPSigning key purpose + List keyPurposes = cert.getExtendedKeyUsage(); + if (keyPurposes == null || +--- old/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java Tue Sep 22 05:44:09 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java Tue Sep 22 05:44:09 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -268,6 +268,7 @@ + int certPathLen = certList.size(); + + basicChecker = new BasicChecker(anchor, testDate, sigProvider, false); ++ AlgorithmChecker algorithmChecker= AlgorithmChecker.getInstance(); + KeyChecker keyChecker = new KeyChecker(certPathLen, + pkixParam.getTargetCertConstraints()); + ConstraintsChecker constraintsChecker = +@@ -282,6 +283,7 @@ + rootNode); + + // add standard checkers that we will be using ++ certPathCheckers.add(algorithmChecker); + certPathCheckers.add(keyChecker); + certPathCheckers.add(constraintsChecker); + certPathCheckers.add(policyChecker); +--- old/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java Tue Sep 22 05:44:11 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java Tue Sep 22 05:44:11 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -346,6 +346,9 @@ + return; + } + ++ /* check that the signature algorithm is not disabled. */ ++ AlgorithmChecker.check(cert); ++ + /* + * check for looping - abort a loop if + * ((we encounter the same certificate twice) AND +--- old/src/share/classes/sun/security/validator/SimpleValidator.java Tue Sep 22 05:44:14 2009 ++++ openjdk/jdk/src/share/classes/sun/security/validator/SimpleValidator.java Tue Sep 22 05:44:13 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -40,6 +40,8 @@ + import sun.security.util.DerOutputStream; + import sun.security.util.ObjectIdentifier; + ++import sun.security.provider.certpath.AlgorithmChecker; ++ + /** + * A simple validator implementation. It is based on code from the JSSE + * X509TrustManagerImpl. This implementation is designed for compatibility with +@@ -133,6 +135,13 @@ + X509Certificate issuerCert = chain[i + 1]; + X509Certificate cert = chain[i]; + ++ // check certificate algorithm ++ try { ++ AlgorithmChecker.check(cert); ++ } catch (CertPathValidatorException cpve) { ++ throw new ValidatorException ++ (ValidatorException.T_ALGORITHM_DISABLED, cert, cpve); ++ } + + // no validity check for code signing certs + if ((variant.equals(VAR_CODE_SIGNING) == false) +--- old/src/share/classes/sun/security/validator/ValidatorException.java Tue Sep 22 05:44:16 2009 ++++ openjdk/jdk/src/share/classes/sun/security/validator/ValidatorException.java Tue Sep 22 05:44:15 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -55,6 +55,9 @@ + public final static Object T_NAME_CHAINING = + "Certificate chaining error"; + ++ public final static Object T_ALGORITHM_DISABLED = ++ "Certificate signature algorithm disabled"; ++ + private Object type; + private X509Certificate cert; + +--- /dev/null Tue Sep 22 05:44:18 2009 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/AlgorithmChecker.java Tue Sep 22 05:44:17 2009 +@@ -0,0 +1,119 @@ ++/* ++ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Sun designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Sun in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, ++ * CA 95054 USA or visit www.sun.com if you need additional information or ++ * have any questions. ++ */ ++ ++package sun.security.provider.certpath; ++ ++import java.util.Set; ++import java.util.Collection; ++import java.util.Locale; ++import java.security.cert.Certificate; ++import java.security.cert.X509Certificate; ++import java.security.cert.X509CRL; ++import java.security.cert.CertPathValidatorException; ++import java.security.cert.PKIXCertPathChecker; ++ ++import sun.security.x509.AlgorithmId; ++ ++/** ++ * AlgorithmChecker is a PKIXCertPathChecker that checks that ++ * the signature algorithm of the specified certificate is not disabled. ++ * ++ * @author Xuelei Fan ++ */ ++final public class AlgorithmChecker extends PKIXCertPathChecker { ++ ++ // the disabled algorithms ++ private static final String[] disabledAlgorithms = new String[] {"md2"}; ++ ++ // singleton instance ++ static final AlgorithmChecker INSTANCE = new AlgorithmChecker(); ++ ++ /** ++ * Default Constructor ++ */ ++ private AlgorithmChecker() { ++ // do nothing ++ } ++ ++ /** ++ * Return a AlgorithmChecker instance. ++ */ ++ static AlgorithmChecker getInstance() { ++ return INSTANCE; ++ } ++ ++ /** ++ * Initializes the internal state of the checker from parameters ++ * specified in the constructor. ++ */ ++ public void init(boolean forward) throws CertPathValidatorException { ++ // do nothing ++ } ++ ++ public boolean isForwardCheckingSupported() { ++ return false; ++ } ++ ++ public Set getSupportedExtensions() { ++ return null; ++ } ++ ++ /** ++ * Checks the signature algorithm of the specified certificate. ++ */ ++ public void check(Certificate cert, Collection unresolvedCritExts) ++ throws CertPathValidatorException { ++ check(cert); ++ } ++ ++ public static void check(Certificate cert) ++ throws CertPathValidatorException { ++ X509Certificate xcert = (X509Certificate)cert; ++ check(xcert.getSigAlgName()); ++ } ++ ++ static void check(AlgorithmId aid) throws CertPathValidatorException { ++ check(aid.getName()); ++ } ++ ++ static void check(X509CRL crl) throws CertPathValidatorException { ++ check(crl.getSigAlgName()); ++ } ++ ++ private static void check(String algName) ++ throws CertPathValidatorException { ++ ++ String lowerCaseAlgName = algName.toLowerCase(Locale.ENGLISH); ++ ++ for (String disabled : disabledAlgorithms) { ++ // checking the signature algorithm name ++ if (lowerCaseAlgName.indexOf(disabled) != -1) { ++ throw new CertPathValidatorException( ++ "algorithm check failed: " + algName + " is disabled"); ++ } ++ } ++ } ++ ++} diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6862968.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6862968.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,60 @@ +--- old/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 2009-07-29 13:28:11.272200000 +0400 ++++ openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 2009-07-29 13:28:10.710600000 +0400 +@@ -685,6 +685,10 @@ + #ifdef DEBUG + printf("in setQTables, qlen = %d, write is %d\n", qlen, write); + #endif ++ if (qlen > NUM_QUANT_TBLS) { ++ /* Ignore extra qunterization tables. */ ++ qlen = NUM_QUANT_TBLS; ++ } + for (i = 0; i < qlen; i++) { + table = (*env)->GetObjectArrayElement(env, qtables, i); + qdata = (*env)->GetObjectField(env, table, JPEGQTable_tableID); +@@ -736,6 +740,11 @@ + hlensBody = (*env)->GetShortArrayElements(env, + huffLens, + NULL); ++ if (hlensLen > 16) { ++ /* Ignore extra elements of bits array. Only 16 elements can be ++ stored. 0-th element is not used. (see jpeglib.h, line 107) */ ++ hlensLen = 16; ++ } + for (i = 1; i <= hlensLen; i++) { + huff_ptr->bits[i] = (UINT8)hlensBody[i-1]; + } +@@ -752,6 +761,11 @@ + huffValues, + NULL); + ++ if (hvalsLen > 256) { ++ /* Ignore extra elements of hufval array. Only 256 elements ++ can be stored. (see jpeglib.h, line 109) */ ++ hlensLen = 256; ++ } + for (i = 0; i < hvalsLen; i++) { + huff_ptr->huffval[i] = (UINT8)hvalsBody[i]; + } +@@ -772,6 +786,11 @@ + j_compress_ptr comp; + j_decompress_ptr decomp; + jsize hlen = (*env)->GetArrayLength(env, DCHuffmanTables); ++ ++ if (hlen > NUM_HUFF_TBLS) { ++ /* Ignore extra DC huffman tables. */ ++ hlen = NUM_HUFF_TBLS; ++ } + for (i = 0; i < hlen; i++) { + if (cinfo->is_decompressor) { + decomp = (j_decompress_ptr) cinfo; +@@ -793,6 +812,10 @@ + huff_ptr->sent_table = !write; + } + hlen = (*env)->GetArrayLength(env, ACHuffmanTables); ++ if (hlen > NUM_HUFF_TBLS) { ++ /* Ignore extra AC huffman tables. */ ++ hlen = NUM_HUFF_TBLS; ++ } + for (i = 0; i < hlen; i++) { + if (cinfo->is_decompressor) { + decomp = (j_decompress_ptr) cinfo; diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6863503.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6863503.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,33 @@ +--- old/src/share/classes/java/security/MessageDigest.java Thu Sep 24 22:22:15 2009 ++++ openjdk/jdk/src/share/classes/java/security/MessageDigest.java Thu Sep 24 22:22:15 2009 +@@ -1,5 +1,5 @@ + /* +- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. ++ * Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -414,16 +414,17 @@ + * + * @return true if the digests are equal, false otherwise. + */ +- public static boolean isEqual(byte digesta[], byte digestb[]) { +- if (digesta.length != digestb.length) ++ public static boolean isEqual(byte[] digesta, byte[] digestb) { ++ if (digesta.length != digestb.length) { + return false; ++ } + ++ int result = 0; ++ // time-constant comparison + for (int i = 0; i < digesta.length; i++) { +- if (digesta[i] != digestb[i]) { +- return false; +- } ++ result |= digesta[i] ^ digestb[i]; + } +- return true; ++ return result == 0; + } + + /** diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6864911.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6864911.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,422 @@ +--- old/src/share/classes/com/sun/jndi/ldap/Connection.java 2009-08-18 09:35:56.595709900 +0800 ++++ openjdk/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java 2009-08-18 09:35:56.087195700 +0800 +@@ -32,12 +32,8 @@ + import java.io.OutputStream; + import java.io.InputStream; + import java.net.Socket; +-import java.util.Vector; +-import java.util.Hashtable; + + import javax.naming.CommunicationException; +-import javax.naming.AuthenticationException; +-import javax.naming.AuthenticationNotSupportedException; + import javax.naming.ServiceUnavailableException; + import javax.naming.NamingException; + import javax.naming.InterruptedNamingException; +@@ -47,6 +43,8 @@ + import java.lang.reflect.Method; + import java.lang.reflect.Constructor; + import java.lang.reflect.InvocationTargetException; ++import java.util.Arrays; ++import sun.misc.IOUtils; + //import javax.net.SocketFactory; + + /** +@@ -799,7 +797,6 @@ + byte inbuf[]; // Buffer for reading incoming bytes + int inMsgId; // Message id of incoming response + int bytesread; // Number of bytes in inbuf +- int bytesleft; // Number of bytes that need to read for completing resp + int br; // Temp; number of bytes read from stream + int offset; // Offset of where to store bytes in inbuf + int seqlen; // Length of ASN sequence +@@ -811,7 +808,7 @@ + try { + while (true) { + try { +- inbuf = new byte[2048]; ++ inbuf = new byte[10]; + + offset = 0; + seqlen = 0; +@@ -871,19 +868,10 @@ + } + + // read in seqlen bytes +- bytesleft = seqlen; +- if ((offset + bytesleft) > inbuf.length) { +- byte nbuf[] = new byte[offset + bytesleft]; +- System.arraycopy(inbuf, 0, nbuf, 0, offset); +- inbuf = nbuf; +- } +- while (bytesleft > 0) { +- bytesread = in.read(inbuf, offset, bytesleft); +- if (bytesread < 0) +- break; // EOF +- offset += bytesread; +- bytesleft -= bytesread; +- } ++ byte[] left = IOUtils.readFully(in, seqlen, false); ++ inbuf = Arrays.copyOf(inbuf, offset + left.length); ++ System.arraycopy(left, 0, inbuf, offset, left.length); ++ offset += left.length; + /* + if (dump > 0) { + System.err.println("seqlen: " + seqlen); +--- old/src/share/classes/sun/applet/AppletClassLoader.java 2009-08-18 09:36:00.901075900 +0800 ++++ openjdk/jdk/src/share/classes/sun/applet/AppletClassLoader.java 2009-08-18 09:35:59.999916100 +0800 +@@ -51,6 +51,7 @@ + import java.security.PermissionCollection; + import sun.awt.AppContext; + import sun.awt.SunToolkit; ++import sun.misc.IOUtils; + import sun.net.www.ParseUtil; + import sun.security.util.SecurityConstants; + +@@ -314,36 +315,7 @@ + + byte[] b; + try { +- if (len != -1) { +- // Read exactly len bytes from the input stream +- b = new byte[len]; +- while (len > 0) { +- int n = in.read(b, b.length - len, len); +- if (n == -1) { +- throw new IOException("unexpected EOF"); +- } +- len -= n; +- } +- } else { +- // Read until end of stream is reached - use 8K buffer +- // to speed up performance [stanleyh] +- b = new byte[8192]; +- int total = 0; +- while ((len = in.read(b, total, b.length - total)) != -1) { +- total += len; +- if (total >= b.length) { +- byte[] tmp = new byte[total * 2]; +- System.arraycopy(b, 0, tmp, 0, total); +- b = tmp; +- } +- } +- // Trim array to correct size, if necessary +- if (total != b.length) { +- byte[] tmp = new byte[total]; +- System.arraycopy(b, 0, tmp, 0, total); +- b = tmp; +- } +- } ++ b = IOUtils.readFully(in, len, true); + } finally { + in.close(); + } +--- old/src/share/classes/sun/misc/Resource.java 2009-08-18 09:36:03.965921700 +0800 ++++ openjdk/jdk/src/share/classes/sun/misc/Resource.java 2009-08-18 09:36:03.449689900 +0800 +@@ -25,14 +25,15 @@ + + package sun.misc; + ++import java.io.EOFException; + import java.net.URL; + import java.io.IOException; + import java.io.InterruptedIOException; + import java.io.InputStream; + import java.security.CodeSigner; + import java.util.jar.Manifest; +-import java.util.jar.Attributes; + import java.nio.ByteBuffer; ++import java.util.Arrays; + import sun.nio.ByteBuffered; + + /** +@@ -105,49 +106,37 @@ + } + + try { +- if (len != -1) { +- // Read exactly len bytes from the input stream +- b = new byte[len]; +- while (len > 0) { +- int n = 0; +- try { +- n = in.read(b, b.length - len, len); +- } catch (InterruptedIOException iioe) { +- Thread.interrupted(); +- isInterrupted = true; ++ b = new byte[0]; ++ if (len == -1) len = Integer.MAX_VALUE; ++ int pos = 0; ++ while (pos < len) { ++ int bytesToRead; ++ if (pos >= b.length) { // Only expand when there's no room ++ bytesToRead = Math.min(len - pos, b.length + 1024); ++ if (b.length < pos + bytesToRead) { ++ b = Arrays.copyOf(b, pos + bytesToRead); + } +- if (n == -1) { +- throw new IOException("unexpected EOF"); +- } +- len -= n; ++ } else { ++ bytesToRead = b.length - pos; + } +- } else { +- // Read until end of stream is reached +- b = new byte[1024]; +- int total = 0; +- for (;;) { +- len = 0; +- try { +- len = in.read(b, total, b.length - total); +- if (len == -1) +- break; +- } catch (InterruptedIOException iioe) { +- Thread.interrupted(); +- isInterrupted = true; +- } +- total += len; +- if (total >= b.length) { +- byte[] tmp = new byte[total * 2]; +- System.arraycopy(b, 0, tmp, 0, total); +- b = tmp; +- } ++ int cc = 0; ++ try { ++ cc = in.read(b, pos, bytesToRead); ++ } catch (InterruptedIOException iioe) { ++ Thread.interrupted(); ++ isInterrupted = true; + } +- // Trim array to correct size, if necessary +- if (total != b.length) { +- byte[] tmp = new byte[total]; +- System.arraycopy(b, 0, tmp, 0, total); +- b = tmp; ++ if (cc < 0) { ++ if (len != Integer.MAX_VALUE) { ++ throw new EOFException("Detect premature EOF"); ++ } else { ++ if (b.length != pos) { ++ b = Arrays.copyOf(b, pos); ++ } ++ break; ++ } + } ++ pos += cc; + } + } finally { + try { +--- old/src/share/classes/sun/reflect/misc/MethodUtil.java 2009-08-18 09:36:07.067128400 +0800 ++++ openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java 2009-08-18 09:36:06.464179700 +0800 +@@ -44,6 +44,7 @@ + import java.util.Collection; + import java.util.HashMap; + import java.util.Map; ++import sun.misc.IOUtils; + import sun.net.www.ParseUtil; + import sun.security.util.SecurityConstants; + +@@ -375,34 +376,7 @@ + + byte[] b; + try { +- if (len != -1) { +- // Read exactly len bytes from the input stream +- b = new byte[len]; +- while (len > 0) { +- int n = in.read(b, b.length - len, len); +- if (n == -1) { +- throw new IOException("unexpected EOF"); +- } +- len -= n; +- } +- } else { +- b = new byte[8192]; +- int total = 0; +- while ((len = in.read(b, total, b.length - total)) != -1) { +- total += len; +- if (total >= b.length) { +- byte[] tmp = new byte[total * 2]; +- System.arraycopy(b, 0, tmp, 0, total); +- b = tmp; +- } +- } +- // Trim array to correct size, if necessary +- if (total != b.length) { +- byte[] tmp = new byte[total]; +- System.arraycopy(b, 0, tmp, 0, total); +- b = tmp; +- } +- } ++ b = IOUtils.readFully(in, len, true); + } finally { + in.close(); + } +--- old/src/share/classes/sun/security/provider/certpath/OCSPChecker.java 2009-08-18 09:36:10.684391400 +0800 ++++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java 2009-08-18 09:36:10.088986300 +0800 +@@ -36,6 +36,7 @@ + import java.net.*; + import javax.security.auth.x500.X500Principal; + ++import sun.misc.IOUtils; + import sun.security.util.*; + import sun.security.x509.*; + +@@ -344,17 +345,7 @@ + in = con.getInputStream(); + + int contentLength = con.getContentLength(); +- if (contentLength == -1) { +- contentLength = Integer.MAX_VALUE; +- } +- +- byte[] response = new byte[contentLength]; +- int total = 0; +- int count = 0; +- while (count != -1 && total < contentLength) { +- count = in.read(response, total, response.length - total); +- total += count; +- } ++ byte[] response = IOUtils.readFully(in, contentLength, false); + + OCSPResponse ocspResponse = new OCSPResponse(response, pkixParams, + responderCert); +--- old/src/share/classes/sun/security/timestamp/HttpTimestamper.java 2009-08-18 09:36:13.859436200 +0800 ++++ openjdk/jdk/src/share/classes/sun/security/timestamp/HttpTimestamper.java 2009-08-18 09:36:13.165978900 +0800 +@@ -33,6 +33,7 @@ + import java.util.Iterator; + import java.util.Set; + ++import sun.misc.IOUtils; + import sun.security.pkcs.*; + + /** +@@ -138,19 +139,9 @@ + System.out.println(); + } + int contentLength = connection.getContentLength(); +- if (contentLength == -1) { +- contentLength = Integer.MAX_VALUE; +- } + verifyMimeType(connection.getContentType()); ++ replyBuffer = IOUtils.readFully(input, contentLength, false); + +- replyBuffer = new byte[contentLength]; +- int total = 0; +- int count = 0; +- while (count != -1 && total < contentLength) { +- count = input.read(replyBuffer, total, +- replyBuffer.length - total); +- total += count; +- } + if (DEBUG) { + System.out.println("received timestamp response (length=" + + replyBuffer.length + ")"); +--- old/src/share/classes/sun/security/util/DerValue.java 2009-08-18 09:36:18.392602400 +0800 ++++ openjdk/jdk/src/share/classes/sun/security/util/DerValue.java 2009-08-18 09:36:17.617711400 +0800 +@@ -28,6 +28,7 @@ + import java.io.*; + import java.math.BigInteger; + import java.util.Date; ++import sun.misc.IOUtils; + + /** + * Represents a single DER-encoded value. DER encoding rules are a subset +@@ -384,12 +385,8 @@ + if (fullyBuffered && in.available() != length) + throw new IOException("extra data given to DerValue constructor"); + +- byte[] bytes = new byte[length]; ++ byte[] bytes = IOUtils.readFully(in, length, true); + +- // n.b. readFully not needed in normal fullyBuffered case +- DataInputStream dis = new DataInputStream(in); +- +- dis.readFully(bytes); + buffer = new DerInputBuffer(bytes); + return new DerInputStream(buffer); + } +--- /dev/null 2009-07-23 00:25:50.000000000 +0800 ++++ openjdk/jdk/src/share/classes/sun/misc/IOUtils.java 2009-08-18 09:36:21.385422200 +0800 +@@ -0,0 +1,80 @@ ++/* ++ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Sun designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Sun in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, ++ * CA 95054 USA or visit www.sun.com if you need additional information or ++ * have any questions. ++ */ ++ ++/** ++ * IOUtils: A collection of IO-related public static methods. ++ */ ++ ++package sun.misc; ++ ++import java.io.EOFException; ++import java.io.IOException; ++import java.io.InputStream; ++import java.util.Arrays; ++ ++public class IOUtils { ++ ++ /** ++ * Read up to length of bytes from in ++ * until EOF is detected. ++ * @param in input stream, must not be null ++ * @param length number of bytes to read, -1 or Integer.MAX_VALUE means ++ * read as much as possible ++ * @param readAll if true, an EOFException will be thrown if not enough ++ * bytes are read. Ignored when length is -1 or Integer.MAX_VALUE ++ * @return bytes read ++ * @throws IOException Any IO error or a premature EOF is detected ++ */ ++ public static byte[] readFully(InputStream is, int length, boolean readAll) ++ throws IOException { ++ byte[] output = {}; ++ if (length == -1) length = Integer.MAX_VALUE; ++ int pos = 0; ++ while (pos < length) { ++ int bytesToRead; ++ if (pos >= output.length) { // Only expand when there's no room ++ bytesToRead = Math.min(length - pos, output.length + 1024); ++ if (output.length < pos + bytesToRead) { ++ output = Arrays.copyOf(output, pos + bytesToRead); ++ } ++ } else { ++ bytesToRead = output.length - pos; ++ } ++ int cc = is.read(output, pos, bytesToRead); ++ if (cc < 0) { ++ if (readAll && length != Integer.MAX_VALUE) { ++ throw new EOFException("Detect premature EOF"); ++ } else { ++ if (output.length != pos) { ++ output = Arrays.copyOf(output, pos); ++ } ++ break; ++ } ++ } ++ pos += cc; ++ } ++ return output; ++ } ++} diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6872357.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6872357.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,17 @@ +--- old/src/share/native/sun/awt/image/awt_ImageRep.c Mon Sep 7 14:46:10 2009 ++++ openjdk/jdk/src/share/native/sun/awt/image/awt_ImageRep.c Mon Sep 7 14:46:09 2009 +@@ -266,6 +266,14 @@ + jnewlut = (*env)->GetObjectField(env, jicm, g_ICMrgbID); + mapSize = (*env)->GetIntField(env, jicm, g_ICMmapSizeID); + ++ if (numLut < 0 || numLut > 256 || mapSize < 0 || mapSize > 256) { ++ /* Ether old or new ICM has a palette that exceeds capacity ++ of byte data type, so we have to convert the image data ++ to default representation. ++ */ ++ return 0; ++ } ++ + srcLUT = (unsigned int *) (*env)->GetPrimitiveArrayCritical(env, jlut, + NULL); + if (srcLUT == NULL) { diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6872358.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6872358.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,157 @@ +--- old/make/sun/awt/mapfile-vers Wed Sep 9 17:45:20 2009 ++++ openjdk/jdk/make/sun/awt/mapfile-vers Wed Sep 9 17:45:19 2009 +@@ -53,7 +53,6 @@ + Java_sun_awt_image_GifImageDecoder_initIDs; + Java_sun_awt_image_GifImageDecoder_parseImage; + Java_sun_awt_image_ImageRepresentation_initIDs; +- Java_sun_awt_image_ImageRepresentation_setBytePixels; + Java_sun_awt_image_ImageRepresentation_setDiffICM; + Java_sun_awt_image_ImageRepresentation_setICMpixels; + Java_sun_awt_image_ImagingLib_convolveBI; +--- old/make/sun/awt/mapfile-vers-linux Wed Sep 9 17:45:23 2009 ++++ openjdk/jdk/make/sun/awt/mapfile-vers-linux Wed Sep 9 17:45:22 2009 +@@ -55,7 +55,6 @@ + Java_sun_awt_image_GifImageDecoder_parseImage; + Java_sun_awt_image_Image_initIDs; + Java_sun_awt_image_ImageRepresentation_initIDs; +- Java_sun_awt_image_ImageRepresentation_setBytePixels; + Java_sun_awt_image_ImageRepresentation_setDiffICM; + Java_sun_awt_image_ImageRepresentation_setICMpixels; + Java_sun_awt_image_ImagingLib_convolveBI; +--- old/src/share/classes/sun/awt/image/ImageRepresentation.java Wed Sep 9 17:45:26 2009 ++++ openjdk/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java Wed Sep 9 17:45:25 2009 +@@ -336,10 +336,6 @@ + public native void setICMpixels(int x, int y, int w, int h, int[] lut, + byte[] pix, int off, int scansize, + IntegerComponentRaster ict); +- +- public native void setBytePixels(int x, int y, int w, int h, byte[] pix, +- int off, int scansize, +- ByteComponentRaster bct, int chanOff); + public native int setDiffICM(int x, int y, int w, int h, int[] lut, + int transPix, int numLut, IndexColorModel icm, + byte[] pix, int off, int scansize, +@@ -450,27 +446,17 @@ + (biRaster instanceof ByteComponentRaster) && + (biRaster.getNumDataElements() == 1)){ + ByteComponentRaster bt = (ByteComponentRaster) biRaster; +- if (w*h > 200) { +- if (off == 0 && scansize == w) { +- bt.putByteData(x, y, w, h, pix); +- } +- else { +- byte[] bpix = new byte[w]; +- poff = off; +- for (int yoff=y; yoff < y+h; yoff++) { +- System.arraycopy(pix, poff, bpix, 0, w); +- bt.putByteData(x, yoff, w, 1, bpix); +- poff += scansize; +- } +- } ++ if (off == 0 && scansize == w) { ++ bt.putByteData(x, y, w, h, pix); + } + else { +- // Only is faster if #pixels +- // Note that setBytePixels modifies the raster directly +- // so we must mark it as changed afterwards +- setBytePixels(x, y, w, h, pix, off, scansize, bt, +- bt.getDataOffset(0)); +- bt.markDirty(); ++ byte[] bpix = new byte[w]; ++ poff = off; ++ for (int yoff=y; yoff < y+h; yoff++) { ++ System.arraycopy(pix, poff, bpix, 0, w); ++ bt.putByteData(x, yoff, w, 1, bpix); ++ poff += scansize; ++ } + } + } + else { +--- old/src/share/native/sun/awt/image/awt_ImageRep.c Wed Sep 9 17:45:28 2009 ++++ openjdk/jdk/src/share/native/sun/awt/image/awt_ImageRep.c Wed Sep 9 17:45:28 2009 +@@ -142,84 +142,6 @@ + + } + +-JNIEXPORT void JNICALL +-Java_sun_awt_image_ImageRepresentation_setBytePixels(JNIEnv *env, jclass cls, +- jint x, jint y, jint w, +- jint h, jbyteArray jpix, +- jint off, jint scansize, +- jobject jbct, +- jint chanOffs) +-{ +- int sStride; +- int pixelStride; +- jobject jdata; +- unsigned char *srcData; +- unsigned char *dstData; +- unsigned char *dataP; +- unsigned char *pixP; +- int i; +- int j; +- +- +- if (JNU_IsNull(env, jpix)) { +- JNU_ThrowNullPointerException(env, "NullPointerException"); +- return; +- } +- +- sStride = (*env)->GetIntField(env, jbct, g_BCRscanstrID); +- pixelStride = (*env)->GetIntField(env, jbct, g_BCRpixstrID); +- jdata = (*env)->GetObjectField(env, jbct, g_BCRdataID); +- +- srcData = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, jpix, +- NULL); +- if (srcData == NULL) { +- /* out of memory error already thrown */ +- return; +- } +- +- dstData = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, jdata, +- NULL); +- if (dstData == NULL) { +- /* out of memory error already thrown */ +- (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); +- return; +- } +- +- dataP = dstData + chanOffs + y*sStride + x*pixelStride; +- pixP = srcData + off; +- if (pixelStride == 1) { +- if (sStride == scansize && scansize == w) { +- memcpy(dataP, pixP, w*h); +- } +- else { +- for (i=0; i < h; i++) { +- memcpy(dataP, pixP, w); +- dataP += sStride; +- pixP += scansize; +- } +- } +- } +- else { +- unsigned char *ydataP = dataP; +- unsigned char *ypixP = pixP; +- +- for (i=0; i < h; i++) { +- dataP = ydataP; +- pixP = ypixP; +- for (j=0; j < w; j++) { +- *dataP = *pixP++; +- dataP += pixelStride; +- } +- ydataP += sStride; +- ypixP += scansize; +- } +- } +- +- (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT); +- (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT); +- +-} +- + JNIEXPORT jint JNICALL + Java_sun_awt_image_ImageRepresentation_setDiffICM(JNIEnv *env, jclass cls, + jint x, jint y, jint w, diff -r 871b70407a13 -r 2b66e5f1a1de patches/icedtea-6874643.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-6874643.patch Mon Mar 29 22:00:07 2010 +0100 @@ -0,0 +1,16 @@ +--- old/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Mon Sep 7 13:25:13 2009 ++++ openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Mon Sep 7 13:25:12 2009 +@@ -1837,6 +1837,13 @@ + return JNI_FALSE; + } + ++ if (stepX > cinfo->image_width) { ++ stepX = cinfo->image_width; ++ } ++ if (stepY > cinfo->image_height) { ++ stepY = cinfo->image_height; ++ } ++ + /* + * First get the source bands array and copy it to our local array + * so we don't have to worry about pinning and unpinning it again.