Mercurial > hg > icedtea7-forest > jdk
changeset 6465:204390009589 jdk7u40-b28
Merge
author | lana |
---|---|
date | Fri, 31 May 2013 15:42:54 -0700 |
parents | 4e22a3ec8e36 (current diff) df33fcb65568 (diff) |
children | d3186a0676db |
files | src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java src/share/classes/sun/tools/jconsole/resources/JConsoleResources_ja.java src/share/classes/sun/tools/jconsole/resources/JConsoleResources_zh_CN.java test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java test/java/io/File/isDirectory/Applet.html test/java/io/Serializable/accessConstants/AccessConstants.java test/sun/nio/cs/OLD/TestX11CS.java |
diffstat | 115 files changed, 4198 insertions(+), 2520 deletions(-) [+] |
line wrap: on
line diff
--- a/make/common/Release.gmk Wed May 29 13:24:33 2013 -0700 +++ b/make/common/Release.gmk Fri May 31 15:42:54 2013 -0700 @@ -170,20 +170,12 @@ endif ifeq ($(PLATFORM), solaris) - ifndef OPENJDK - MANBASEDIRS=$(CLOSED_SRC)/solaris/doc $(IMPORTDOCDIR) - else - MANBASEDIRS=$(JDK_TOPDIR)/src/solaris/doc $(IMPORTDOCDIR) - endif + MANBASEDIRS=$(JDK_TOPDIR)/src/solaris/doc $(IMPORTDOCDIR) MAN1SUBDIR=sun/man/man1 endif # solaris ifeq ($(PLATFORM), linux) - ifndef OPENJDK - MANBASEDIRS=$(CLOSED_SRC)/linux/doc $(IMPORTDOCDIR) - else - MANBASEDIRS=$(JDK_TOPDIR)/src/linux/doc $(IMPORTDOCDIR) - endif + MANBASEDIRS=$(JDK_TOPDIR)/src/linux/doc $(IMPORTDOCDIR) MAN1SUBDIR=man JA_DIRNAME=ja_JP.UTF-8 endif # linux @@ -1239,7 +1231,6 @@ define echo-java-info $(CAT) $1 endef --include $(JDK_TOPDIR)/make/closed/common/release.gmk # Values to emit MINIMUM_OS_NAME := $(REQUIRED_OS_NAME) @@ -1436,3 +1427,4 @@ # Force rule FRC: +-include $(JDK_TOPDIR)/make/closed/common/release.gmk
--- a/make/sun/javazic/tzdata/VERSION Wed May 29 13:24:33 2013 -0700 +++ b/make/sun/javazic/tzdata/VERSION Fri May 31 15:42:54 2013 -0700 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2013b +tzdata2013c
--- a/make/sun/javazic/tzdata/antarctica Wed May 29 13:24:33 2013 -0700 +++ b/make/sun/javazic/tzdata/antarctica Fri May 31 15:42:54 2013 -0700 @@ -76,34 +76,6 @@ Rule ChileAQ 2012 max - Apr Sun>=23 3:00u 0 - Rule ChileAQ 2012 max - Sep Sun>=2 4:00u 1:00 S -# These rules are stolen from the `australasia' file. -Rule AusAQ 1917 only - Jan 1 0:01 1:00 - -Rule AusAQ 1917 only - Mar 25 2:00 0 - -Rule AusAQ 1942 only - Jan 1 2:00 1:00 - -Rule AusAQ 1942 only - Mar 29 2:00 0 - -Rule AusAQ 1942 only - Sep 27 2:00 1:00 - -Rule AusAQ 1943 1944 - Mar lastSun 2:00 0 - -Rule AusAQ 1943 only - Oct 3 2:00 1:00 - -Rule ATAQ 1967 only - Oct Sun>=1 2:00s 1:00 - -Rule ATAQ 1968 only - Mar lastSun 2:00s 0 - -Rule ATAQ 1968 1985 - Oct lastSun 2:00s 1:00 - -Rule ATAQ 1969 1971 - Mar Sun>=8 2:00s 0 - -Rule ATAQ 1972 only - Feb lastSun 2:00s 0 - -Rule ATAQ 1973 1981 - Mar Sun>=1 2:00s 0 - -Rule ATAQ 1982 1983 - Mar lastSun 2:00s 0 - -Rule ATAQ 1984 1986 - Mar Sun>=1 2:00s 0 - -Rule ATAQ 1986 only - Oct Sun>=15 2:00s 1:00 - -Rule ATAQ 1987 1990 - Mar Sun>=15 2:00s 0 - -Rule ATAQ 1987 only - Oct Sun>=22 2:00s 1:00 - -Rule ATAQ 1988 1990 - Oct lastSun 2:00s 1:00 - -Rule ATAQ 1991 1999 - Oct Sun>=1 2:00s 1:00 - -Rule ATAQ 1991 2005 - Mar lastSun 2:00s 0 - -Rule ATAQ 2000 only - Aug lastSun 2:00s 1:00 - -Rule ATAQ 2001 max - Oct Sun>=1 2:00s 1:00 - -Rule ATAQ 2006 only - Apr Sun>=1 2:00s 0 - -Rule ATAQ 2007 only - Mar lastSun 2:00s 0 - -Rule ATAQ 2008 max - Apr Sun>=1 2:00s 0 - - # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 # Esperanza, San Martin Land, -6323-05659, since 1952-12-17 @@ -145,10 +117,7 @@ # </a> # From Steffen Thorsen (2010-03-10): -# We got these changes from the Australian Antarctic Division: -# - Macquarie Island will stay on UTC+11 for winter and therefore not -# switch back from daylight savings time when other parts of Australia do -# on 4 April. +# We got these changes from the Australian Antarctic Division: ... # # - Casey station reverted to its normal time of UTC+8 on 5 March 2010. # The change to UTC+11 is being considered as a regular summer thing but @@ -159,9 +128,6 @@ # # - Mawson station stays on UTC+5. # -# In addition to the Rule changes for Casey/Davis, it means that Macquarie -# will no longer be like Hobart and will have to have its own Zone created. -# # Background: # <a href="http://www.timeanddate.com/news/time/antartica-time-changes-2010.html"> # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html @@ -188,12 +154,6 @@ 6:00 - MAWT 2009 Oct 18 2:00 # Mawson Time 5:00 - MAWT -Zone Antarctica/Macquarie 0 - zzz 1911 - 10:00 - EST 1916 Oct 1 2:00 - 10:00 1:00 EST 1917 Feb - 10:00 AusAQ EST 1967 - 10:00 ATAQ EST 2010 Apr 4 3:00 - 11:00 - MIST # Macquarie Island Time # References: # <a href="http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html"> # Casey Weather (1998-02-26)
--- a/make/sun/javazic/tzdata/asia Wed May 29 13:24:33 2013 -0700 +++ b/make/sun/javazic/tzdata/asia Fri May 31 15:42:54 2013 -0700 @@ -2314,11 +2314,20 @@ # http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html # </a> -# From Arthur David Olson (2012-03-27): -# The timeanddate article for 2012 says that "the end date has not yet been -# announced" and that "Last year, both...paused daylight saving time during... -# Ramadan. It is not yet known [for] 2012." -# For now, assume both switch back on the last Friday in September. XXX +# From Steffen Thorsen (2013-03-26): +# The following news sources tells that Palestine will "start daylight saving +# time from midnight on Friday, March 29, 2013" (translated). +# [These are in Arabic and are for Gaza and for Ramallah, respectively.] +# http://www.samanews.com/index.php?act=Show&id=154120 +# http://safa.ps/details/news/99844/%D8%B1%D8%A7%D9%85-%D8%A7%D9%84%D9%84%D9%87-%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-29-%D8%A7%D9%84%D8%AC%D8%A7%D8%B1%D9%8A.html + +# From Paul Eggert (2013-04-15): +# For future dates, guess the last Thursday in March at 24:00 through +# the first Friday on or after September 21 at 01:00. This is consistent with +# the predictions in today's editions of the following URLs, +# which are for Gaza and Hebron respectively: +# http://www.timeanddate.com/worldclock/timezone.html?n=702 +# http://www.timeanddate.com/worldclock/timezone.html?n=2364 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S @@ -2332,19 +2341,20 @@ Rule Palestine 1999 2003 - Oct Fri>=15 0:00 0 - Rule Palestine 2004 only - Oct 1 1:00 0 - Rule Palestine 2005 only - Oct 4 2:00 0 - -Rule Palestine 2006 2008 - Apr 1 0:00 1:00 S +Rule Palestine 2006 2007 - Apr 1 0:00 1:00 S Rule Palestine 2006 only - Sep 22 0:00 0 - Rule Palestine 2007 only - Sep Thu>=8 2:00 0 - -Rule Palestine 2008 only - Aug lastFri 0:00 0 - -Rule Palestine 2009 only - Mar lastFri 0:00 1:00 S -Rule Palestine 2009 only - Sep Fri>=1 2:00 0 - -Rule Palestine 2010 only - Mar lastSat 0:01 1:00 S +Rule Palestine 2008 2009 - Mar lastFri 0:00 1:00 S +Rule Palestine 2008 only - Sep 1 0:00 0 - +Rule Palestine 2009 only - Sep Fri>=1 1:00 0 - +Rule Palestine 2010 only - Mar 26 0:00 1:00 S Rule Palestine 2010 only - Aug 11 0:00 0 - - -# From Arthur David Olson (2011-09-20): -# 2011 transitions per http://www.timeanddate.com as of 2011-09-20. -# From Paul Eggert (2012-10-12): -# 2012 transitions per http://www.timeanddate.com as of 2012-10-12. +Rule Palestine 2011 only - Apr 1 0:01 1:00 S +Rule Palestine 2011 only - Aug 1 0:00 0 - +Rule Palestine 2011 only - Aug 30 0:00 1:00 S +Rule Palestine 2011 only - Sep 30 0:00 0 - +Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S +Rule Palestine 2012 max - Sep Fri>=21 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -2352,26 +2362,20 @@ 2:00 EgyptAsia EE%sT 1967 Jun 5 2:00 Zion I%sT 1996 2:00 Jordan EE%sT 1999 - 2:00 Palestine EE%sT 2011 Apr 2 12:01 - 2:00 1:00 EEST 2011 Aug 1 - 2:00 - EET 2012 Mar 30 - 2:00 1:00 EEST 2012 Sep 21 1:00 - 2:00 - EET + 2:00 Palestine EE%sT 2008 Aug 29 0:00 + 2:00 - EET 2008 Sep + 2:00 Palestine EE%sT 2010 + 2:00 - EET 2010 Mar 27 0:01 + 2:00 Palestine EE%sT 2011 Aug 1 + 2:00 - EET 2012 + 2:00 Palestine EE%sT Zone Asia/Hebron 2:20:23 - LMT 1900 Oct 2:00 Zion EET 1948 May 15 2:00 EgyptAsia EE%sT 1967 Jun 5 2:00 Zion I%sT 1996 2:00 Jordan EE%sT 1999 - 2:00 Palestine EE%sT 2008 Aug - 2:00 1:00 EEST 2008 Sep - 2:00 Palestine EE%sT 2011 Apr 1 12:01 - 2:00 1:00 EEST 2011 Aug 1 - 2:00 - EET 2011 Aug 30 - 2:00 1:00 EEST 2011 Sep 30 3:00 - 2:00 - EET 2012 Mar 30 - 2:00 1:00 EEST 2012 Sep 21 1:00 - 2:00 - EET + 2:00 Palestine EE%sT # Paracel Is # no information
--- a/make/sun/javazic/tzdata/australasia Wed May 29 13:24:33 2013 -0700 +++ b/make/sun/javazic/tzdata/australasia Fri May 31 15:42:54 2013 -0700 @@ -241,9 +241,26 @@ # no times are set # # Macquarie -# permanent occupation (scientific station) since 1948; -# sealing and penguin oil station operated 1888/1917 -# like Australia/Hobart +# Permanent occupation (scientific station) 1911-1915 and since 25 March 1948; +# sealing and penguin oil station operated Nov 1899 to Apr 1919. See the +# Tasmania Parks & Wildlife Service history of sealing at Macquarie Island +# <http://www.parks.tas.gov.au/index.aspx?base=1828> +# <http://www.parks.tas.gov.au/index.aspx?base=1831>. +# Guess that it was like Australia/Hobart while inhabited before 2010. +# +# From Steffen Thorsen (2010-03-10): +# We got these changes from the Australian Antarctic Division: +# - Macquarie Island will stay on UTC+11 for winter and therefore not +# switch back from daylight savings time when other parts of Australia do +# on 4 April. +Zone Antarctica/Macquarie 0 - zzz 1899 Nov + 10:00 - EST 1916 Oct 1 2:00 + 10:00 1:00 EST 1917 Feb + 10:00 Aus EST 1919 Apr + 0 - zzz 1948 Mar 25 + 10:00 Aus EST 1967 + 10:00 AT EST 2010 Apr 4 3:00 + 11:00 - MIST # Macquarie I Standard Time # Christmas # Zone NAME GMTOFF RULES FORMAT [UNTIL]
--- a/make/sun/javazic/tzdata/southamerica Wed May 29 13:24:33 2013 -0700 +++ b/make/sun/javazic/tzdata/southamerica Fri May 31 15:42:54 2013 -0700 @@ -1589,16 +1589,16 @@ # forward 60 minutes, in all the territory of the Paraguayan Republic. # ... Rule Para 2010 max - Oct Sun>=1 0:00 1:00 S -Rule Para 2010 max - Apr Sun>=8 0:00 0 - +Rule Para 2010 2012 - Apr Sun>=8 0:00 0 - # # From Steffen Thorsen (2013-03-07): # Paraguay will end DST on 2013-03-24 00:00.... -# They do not tell if this will be a permanent change or just this year.... # http://www.ande.gov.py/interna.php?id=1075 # -# From Paul Eggert (2013-03-07): -# For now, assume it's just this year. -Rule Para 2013 only - Mar 24 0:00 0 - +# From Carlos Raul Perasso (2013-03-15): +# The change in Paraguay is now final. Decree number 10780 +# http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf +Rule Para 2013 max - Mar Sun>=22 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890
--- a/make/sun/javazic/tzdata/zone.tab Wed May 29 13:24:33 2013 -0700 +++ b/make/sun/javazic/tzdata/zone.tab Fri May 31 15:42:54 2013 -0700 @@ -65,7 +65,6 @@ AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I -AQ -5430+15857 Antarctica/Macquarie Macquarie Island Station, Macquarie Island AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF) AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF) AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN) @@ -81,6 +80,7 @@ AS -1416-17042 Pacific/Pago_Pago AT +4813+01620 Europe/Vienna AU -3133+15905 Australia/Lord_Howe Lord Howe Island +AU -5430+15857 Antarctica/Macquarie Macquarie Island AU -4253+14719 Australia/Hobart Tasmania - most locations AU -3956+14352 Australia/Currie Tasmania - King Island AU -3749+14458 Australia/Melbourne Victoria
--- a/make/tools/src/build/tools/javazic/Rule.java Wed May 29 13:24:33 2013 -0700 +++ b/make/tools/src/build/tools/javazic/Rule.java Fri May 31 15:42:54 2013 -0700 @@ -119,7 +119,7 @@ r1.getDay(), r1.getTime().getTime()); long t2 = Time.getLocalTime(y, r2.getMonth(), r2.getDay(), r2.getTime().getTime()); - return (int)(t1 - t2); + return (t1 > t2) ? 1 : (t1 < t2) ? -1 : 0; } public boolean equals(Object o) { return this == o;
--- a/src/macosx/classes/com/apple/laf/AquaPainter.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/com/apple/laf/AquaPainter.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,15 +41,15 @@ abstract class AquaPainter <T extends JRSUIState> { static <T extends JRSUIState> AquaPainter<T> create(final T state) { - return new AquaSingleImagePainter<T>(state); + return new AquaSingleImagePainter<>(state); } static <T extends JRSUIState> AquaPainter<T> create(final T state, final int minWidth, final int minHeight, final int westCut, final int eastCut, final int northCut, final int southCut) { - return AquaPainter.create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, true); + return create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, true); } static <T extends JRSUIState> AquaPainter<T> create(final T state, final int minWidth, final int minHeight, final int westCut, final int eastCut, final int northCut, final int southCut, final boolean useMiddle) { - return AquaPainter.create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, useMiddle, true, true); + return create(state, minWidth, minHeight, westCut, eastCut, northCut, southCut, useMiddle, true, true); } static <T extends JRSUIState> AquaPainter<T> create(final T state, final int minWidth, final int minHeight, final int westCut, final int eastCut, final int northCut, final int southCut, final boolean useMiddle, final boolean stretchHorizontally, final boolean stretchVertically) { @@ -65,7 +65,7 @@ return new AquaNineSlicingImagePainter<>(state, metricsProvider); } - abstract void paint(final Graphics2D g, final T stateToPaint, final Component c); + abstract void paint(Graphics2D g, T stateToPaint); final Rectangle boundsRect = new Rectangle(); final JRSUIControl control; @@ -75,23 +75,26 @@ this.state = state; } - JRSUIControl getControl() { - control.set(state = (T)state.derive()); + final JRSUIControl getControl() { + control.set(state = state.derive()); return control; } - void paint(final Graphics g, final Component c, final int x, final int y, final int w, final int h) { + final void paint(final Graphics g, final Component c, final int x, + final int y, final int w, final int h) { boundsRect.setBounds(x, y, w, h); - final T nextState = (T)state.derive(); + final T nextState = state.derive(); final Graphics2D g2d = getGraphics2D(g); - if (g2d != null) paint(g2d, nextState, c); + if (g2d != null) paint(g2d, nextState); state = nextState; } - static class AquaNineSlicingImagePainter<T extends JRSUIState> extends AquaPainter<T> { - protected final HashMap<T, RecyclableJRSUISlicedImageControl> slicedControlImages; - protected final NineSliceMetricsProvider metricsProvider; + private static class AquaNineSlicingImagePainter<T extends JRSUIState> + extends AquaPainter<T> { + + private final HashMap<T, RecyclableJRSUISlicedImageControl> slicedControlImages; + private final NineSliceMetricsProvider metricsProvider; AquaNineSlicingImagePainter(final T state) { this(state, null); @@ -104,9 +107,9 @@ } @Override - void paint(final Graphics2D g, final T stateToPaint, final Component c) { + void paint(final Graphics2D g, final T stateToPaint) { if (metricsProvider == null) { - AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, c, boundsRect); + AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, boundsRect); return; } @@ -114,7 +117,7 @@ if (slicesRef == null) { final NineSliceMetrics metrics = metricsProvider.getNineSliceMetricsForState(stateToPaint); if (metrics == null) { - AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, c, boundsRect); + AquaSingleImagePainter.paintFromSingleCachedImage(g, control, stateToPaint, boundsRect); return; } slicesRef = new RecyclableJRSUISlicedImageControl(control, stateToPaint, metrics); @@ -125,47 +128,55 @@ } } - static class AquaSingleImagePainter<T extends JRSUIState> extends AquaPainter<T> { + private static final class AquaSingleImagePainter<T extends JRSUIState> + extends AquaPainter<T> { + AquaSingleImagePainter(final T state) { super(new JRSUIControl(false), state); } @Override - void paint(Graphics2D g, T stateToPaint, Component c) { - paintFromSingleCachedImage(g, control, stateToPaint, c, boundsRect); + void paint(final Graphics2D g, final T stateToPaint) { + paintFromSingleCachedImage(g, control, stateToPaint, boundsRect); } - static void paintFromSingleCachedImage(final Graphics2D g, final JRSUIControl control, final JRSUIState controlState, final Component c, final Rectangle boundsRect) { - final Rectangle clipRect = g.getClipBounds(); - final Rectangle intersection = boundsRect.intersection(clipRect); - if (intersection.width <= 0 || intersection.height <= 0) return; + static void paintFromSingleCachedImage(final Graphics2D g, + final JRSUIControl control, final JRSUIState controlState, + final Rectangle bounds) { + if (bounds.width <= 0 || bounds.height <= 0) { + return; + } - final int imgX1 = intersection.x - boundsRect.x; - final int imgY1 = intersection.y - boundsRect.y; - + int scale = 1; + if (g instanceof SunGraphics2D) { + scale = ((SunGraphics2D) g).surfaceData.getDefaultScale(); + } final GraphicsConfiguration config = g.getDeviceConfiguration(); final ImageCache cache = ImageCache.getInstance(); - BufferedImage image = (BufferedImage)cache.getImage(config, boundsRect.width, boundsRect.height, controlState); - if (image == null) { - image = new BufferedImage(boundsRect.width, boundsRect.height, BufferedImage.TYPE_INT_ARGB_PRE); - cache.setImage(image, config, boundsRect.width, boundsRect.height, controlState); - final WritableRaster raster = image.getRaster(); - final DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer(); + final int imgW = bounds.width * scale; + final int imgH = bounds.height * scale; + BufferedImage img = (BufferedImage) cache.getImage(config, imgW, imgH, scale, controlState); + if (img == null) { + img = new BufferedImage(imgW, imgH, BufferedImage.TYPE_INT_ARGB_PRE); + cache.setImage(img, config, imgW, imgH, scale, controlState); + final WritableRaster raster = img.getRaster(); + final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer(); control.set(controlState); control.paint(SunWritableRaster.stealData(buffer, 0), - image.getWidth(), image.getHeight(), 0, 0, boundsRect.width, boundsRect.height); + imgW, imgH, 0, 0, bounds.width, bounds.height); SunWritableRaster.markDirty(buffer); } - g.drawImage(image, intersection.x, intersection.y, intersection.x + intersection.width, intersection.y + intersection.height, - imgX1, imgY1, imgX1 + intersection.width, imgY1 + intersection.height, null); + g.drawImage(img, bounds.x, bounds.y, bounds.width, bounds.height, null); } } - static class RecyclableJRSUISlicedImageControl extends RecyclableSlicedImageControl { - final JRSUIControl control; - final JRSUIState state; + private static class RecyclableJRSUISlicedImageControl + extends RecyclableSlicedImageControl { + + private final JRSUIControl control; + private final JRSUIState state; RecyclableJRSUISlicedImageControl(final JRSUIControl control, final JRSUIState state, final NineSliceMetrics metrics) { super(metrics); @@ -189,17 +200,19 @@ } } - protected Graphics2D getGraphics2D(final Graphics g) { + private Graphics2D getGraphics2D(final Graphics g) { try { return (SunGraphics2D)g; // doing a blind try is faster than checking instanceof - } catch (Exception e) { + } catch (Exception ignored) { if (g instanceof PeekGraphics) { // if it is a peek just dirty the region g.fillRect(boundsRect.x, boundsRect.y, boundsRect.width, boundsRect.height); } else if (g instanceof ProxyGraphics2D) { final ProxyGraphics2D pg = (ProxyGraphics2D)g; final Graphics2D g2d = pg.getDelegate(); - if (g2d instanceof SunGraphics2D) { return (SunGraphics2D)g2d; } + if (g2d instanceof SunGraphics2D) { + return g2d; + } } else if (g instanceof Graphics2D) { return (Graphics2D) g; }
--- a/src/macosx/classes/com/apple/laf/ImageCache.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/com/apple/laf/ImageCache.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,16 +81,23 @@ } } - public Image getImage(final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) { + public Image getImage(final GraphicsConfiguration config, final int w, + final int h, final int scale, + final JRSUIState state) { + final int hash = hash(config, w, h, scale, state); + final PixelCountSoftReference ref; lock.readLock().lock(); try { - final PixelCountSoftReference ref = map.get(hash(config, w, h, state)); - // check reference has not been lost and the key truly matches, in case of false positive hash match - if (ref != null && ref.equals(config, w, h, state)) return ref.get(); - return null; + ref = map.get(hash); } finally { lock.readLock().unlock(); } + // check reference has not been lost and the key truly matches, + // in case of false positive hash match + if (ref != null && ref.equals(config, w, h, scale, state)) { + return ref.get(); + } + return null; } /** @@ -100,14 +107,17 @@ * @param config The graphics configuration, needed if cached image is a Volatile Image. Used as part of cache key * @param w The image width, used as part of cache key * @param h The image height, used as part of cache key + * @param scale The image scale factor, used as part of cache key * @return true if the image could be cached, false otherwise. */ - public boolean setImage(final Image image, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) { + public boolean setImage(final Image image, + final GraphicsConfiguration config, final int w, final int h, + final int scale, final JRSUIState state) { if (state.is(JRSUIConstants.Animating.YES)) { return false; } - final int hash = hash(config, w, h, state); + final int hash = hash(config, w, h, scale, state); lock.writeLock().lock(); try { @@ -145,44 +155,60 @@ } } // finally put new in map - map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, state)); + map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, scale, state)); return true; } finally { lock.writeLock().unlock(); } } - private int hash(final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) { - int hash = (config != null ? config.hashCode() : 0); + private static int hash(final GraphicsConfiguration config, final int w, + final int h, final int scale, + final JRSUIState state) { + int hash = config != null ? config.hashCode() : 0; hash = 31 * hash + w; hash = 31 * hash + h; + hash = 31 * hash + scale; hash = 31 * hash + state.hashCode(); return hash; } - /** Extended SoftReference that stores the pixel count even after the image is lost */ + /** + * Extended SoftReference that stores the pixel count even after the image + * is lost. + */ private static class PixelCountSoftReference extends SoftReference<Image> { - private final int pixelCount; - private final int hash; + + // default access, because access to these fields shouldn't be emulated + // by a synthetic accessor. + final int pixelCount; + final int hash; // key parts private final GraphicsConfiguration config; private final int w; private final int h; + private final int scale; private final JRSUIState state; - PixelCountSoftReference(final Image referent, final ReferenceQueue<? super Image> q, final int pixelCount, final int hash, final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) { + PixelCountSoftReference(final Image referent, + final ReferenceQueue<? super Image> q, final int pixelCount, + final int hash, final GraphicsConfiguration config, final int w, + final int h, final int scale, final JRSUIState state) { super(referent, q); this.pixelCount = pixelCount; this.hash = hash; this.config = config; this.w = w; this.h = h; + this.scale = scale; this.state = state; } - public boolean equals(final GraphicsConfiguration config, final int w, final int h, final JRSUIState state) { - return config == this.config && w == this.w && h == this.h && state.equals(this.state); + boolean equals(final GraphicsConfiguration config, final int w, + final int h, final int scale, final JRSUIState state) { + return config == this.config && w == this.w && h == this.h + && scale == this.scale && state.equals(this.state); } }
--- a/src/macosx/classes/sun/awt/CGraphicsDevice.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/awt/CGraphicsDevice.java Fri May 31 15:42:54 2013 -0700 @@ -35,10 +35,18 @@ import sun.java2d.opengl.CGLGraphicsConfig; -public final class CGraphicsDevice extends GraphicsDevice { +public final class CGraphicsDevice extends GraphicsDevice + implements DisplayChangedListener { - // CoreGraphics display ID - private final int displayID; + /** + * CoreGraphics display ID. This identifier can become non-valid at any time + * therefore methods, which is using this id should be ready to it. + */ + private volatile int displayID; + private volatile Insets screenInsets; + private volatile double xResolution; + private volatile double yResolution; + private volatile int scale; // Array of all GraphicsConfig instances for this device private final GraphicsConfiguration[] configs; @@ -51,7 +59,7 @@ // Save/restore DisplayMode for the Full Screen mode private DisplayMode originalMode; - public CGraphicsDevice(int displayID) { + public CGraphicsDevice(final int displayID) { this.displayID = displayID; configs = new GraphicsConfiguration[] { CGLGraphicsConfig.getConfig(this, 0) @@ -89,7 +97,7 @@ */ @Override public String getIDstring() { - return "Display " + this.displayID; + return "Display " + displayID; } /** @@ -104,15 +112,37 @@ } public double getXResolution() { - return nativeGetXResolution(displayID); + return xResolution; } public double getYResolution() { - return nativeGetYResolution(displayID); + return yResolution; } public Insets getScreenInsets() { - return nativeGetScreenInsets(displayID); + return screenInsets; + } + + public int getScaleFactor() { + return scale; + } + + public void invalidate(final int defaultDisplayID) { + displayID = defaultDisplayID; + } + + @Override + public void displayChanged() { + xResolution = nativeGetXResolution(displayID); + yResolution = nativeGetYResolution(displayID); + screenInsets = nativeGetScreenInsets(displayID); + scale = (int) nativeGetScaleFactor(displayID); + //TODO configs/fullscreenWindow/modes? + } + + @Override + public void paletteChanged() { + // devices do not need to react to this event. } /** @@ -219,6 +249,8 @@ return nativeGetDisplayModes(displayID); } + private static native double nativeGetScaleFactor(int displayID); + private static native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate); private static native DisplayMode nativeGetDisplayMode(int displayID);
--- a/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,19 +26,20 @@ package sun.awt; import java.awt.*; -import java.awt.print.*; import java.util.*; import sun.java2d.*; /** - * This is an implementation of a GraphicsEnvironment object for the default local GraphicsEnvironment used by the Java - * Runtime Environment for Mac OS X GUI environments. + * This is an implementation of a GraphicsEnvironment object for the default + * local GraphicsEnvironment used by the Java Runtime Environment for Mac OS X + * GUI environments. * * @see GraphicsDevice * @see GraphicsConfiguration */ -public class CGraphicsEnvironment extends SunGraphicsEnvironment { +public final class CGraphicsEnvironment extends SunGraphicsEnvironment { + // Global initialization of the Cocoa runtime. private static native void initCocoa(); @@ -53,7 +54,8 @@ private static native int getMainDisplayID(); /** - * Noop function that just acts as an entry point for someone to force a static initialization of this class. + * Noop function that just acts as an entry point for someone to force a + * static initialization of this class. */ public static void init() { } @@ -72,8 +74,9 @@ } /** - * Register the instance with CGDisplayRegisterReconfigurationCallback() - * The registration uses a weak global reference -- if our instance is garbage collected, the reference will be dropped. + * Register the instance with CGDisplayRegisterReconfigurationCallback(). + * The registration uses a weak global reference -- if our instance is + * garbage collected, the reference will be dropped. * * @return Return the registration context (a pointer). */ @@ -85,7 +88,7 @@ private native void deregisterDisplayReconfiguration(long context); /** Available CoreGraphics displays. */ - private final Map<Integer, CGraphicsDevice> devices = new HashMap<Integer, CGraphicsDevice>(); + private final Map<Integer, CGraphicsDevice> devices = new HashMap<>(5); /** Reference to the display reconfiguration callback context. */ private final long displayReconfigContext; @@ -112,11 +115,18 @@ /** * Called by the CoreGraphics Display Reconfiguration Callback. * - * @param displayId - * CoreGraphics displayId + * @param displayId CoreGraphics displayId + * @param removed true if displayId was removed, false otherwise. */ - void _displayReconfiguration(long displayId) { - displayChanged(); + void _displayReconfiguration(final int displayId, final boolean removed) { + synchronized (this) { + if (removed && devices.containsKey(displayId)) { + final CGraphicsDevice gd = devices.remove(displayId); + gd.invalidate(getMainDisplayID()); + gd.displayChanged(); + } + } + initDevices(); } @Override @@ -129,31 +139,30 @@ } /** - * (Re)create all CGraphicsDevices - * - * @return + * (Re)create all CGraphicsDevices, reuses a devices if it is possible. */ - private synchronized void initDevices() { - devices.clear(); + private void initDevices() { + synchronized (this) { + final Map<Integer, CGraphicsDevice> old = new HashMap<>(devices); + devices.clear(); - int mainID = getMainDisplayID(); + int mainID = getMainDisplayID(); - // initialization of the graphics device may change - // list of displays on hybrid systems via an activation - // of discrete video. - // So, we initialize the main display first, and then - // retrieve actual list of displays. - CGraphicsDevice mainDevice = new CGraphicsDevice(mainID); + // initialization of the graphics device may change + // list of displays on hybrid systems via an activation + // of discrete video. + // So, we initialize the main display first, and then + // retrieve actual list of displays. + if (!old.containsKey(mainID)) { + old.put(mainID, new CGraphicsDevice(mainID)); + } - final int[] displayIDs = getDisplayIDs(); - - for (int displayID : displayIDs) { - if (displayID != mainID) { - devices.put(displayID, new CGraphicsDevice(displayID)); - } else { - devices.put(mainID, mainDevice); + for (final int id : getDisplayIDs()) { + devices.put(id, old.containsKey(id) ? old.get(id) + : new CGraphicsDevice(id)); } } + displayChanged(); } @Override @@ -161,7 +170,7 @@ final int mainDisplayID = getMainDisplayID(); CGraphicsDevice d = devices.get(mainDisplayID); if (d == null) { - // we do not exepct that this may happen, the only responce + // we do not expect that this may happen, the only response // is to re-initialize the list of devices initDevices();
--- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Fri May 31 15:42:54 2013 -0700 @@ -515,29 +515,37 @@ @Override public int getMaxTextureWidth() { - int width; + //Temporary disable this logic and use some magic constrain. + /* + int width; - synchronized (totalDisplayBounds) { - if (totalDisplayBounds.width == 0) { - updateTotalDisplayBounds(); - } - width = totalDisplayBounds.width; - } + synchronized (totalDisplayBounds) { + if (totalDisplayBounds.width == 0) { + updateTotalDisplayBounds(); + } + width = totalDisplayBounds.width; + } - return Math.min(width, getMaxTextureSize()); + return Math.min(width, getMaxTextureSize()); + */ + return getMaxTextureSize() / (getDevice().getScaleFactor() * 2); } @Override public int getMaxTextureHeight() { - int height; + //Temporary disable this logic and use some magic constrain. + /* + int height; - synchronized (totalDisplayBounds) { - if (totalDisplayBounds.height == 0) { - updateTotalDisplayBounds(); - } - height = totalDisplayBounds.height; - } + synchronized (totalDisplayBounds) { + if (totalDisplayBounds.height == 0) { + updateTotalDisplayBounds(); + } + height = totalDisplayBounds.height; + } - return Math.min(height, getMaxTextureSize()); + return Math.min(height, getMaxTextureSize()); + */ + return getMaxTextureSize() / (getDevice().getScaleFactor() * 2); } }
--- a/src/macosx/classes/sun/java2d/opengl/CGLLayer.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java Fri May 31 15:42:54 2013 -0700 @@ -40,11 +40,12 @@ public class CGLLayer extends CFRetainedResource { private native long nativeCreateLayer(); - + private static native void nativeSetScale(long layerPtr, double scale); private static native void validate(long layerPtr, CGLSurfaceData cglsd); private static native void blitTexture(long layerPtr); private LWWindowPeer peer; + private int scale = 1; private SurfaceData surfaceData; // represents intermediate buffer (texture) @@ -90,7 +91,7 @@ // and blits the buffer to the layer surface (in drawInCGLContext callback) CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration(); surfaceData = gc.createSurfaceData(this); - + setScale(gc.getDevice().getScaleFactor()); // the layer holds a reference to the buffer, which in // turn has a reference back to this layer if (surfaceData instanceof CGLSurfaceData) { @@ -121,6 +122,13 @@ super.dispose(); } + private void setScale(final int _scale) { + if (scale != _scale) { + scale = _scale; + nativeSetScale(getPointer(), scale); + } + } + // ---------------------------------------------------------------------- // NATIVE CALLBACKS // ----------------------------------------------------------------------
--- a/src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Fri May 31 15:42:54 2013 -0700 @@ -30,7 +30,6 @@ import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Image; -import java.awt.Insets; import java.awt.Rectangle; import java.awt.image.ColorModel; @@ -41,6 +40,9 @@ public abstract class CGLSurfaceData extends OGLSurfaceData { + protected final int scale; + protected final int width; + protected final int height; protected CPlatformView pView; private CGLGraphicsConfig graphicsConfig; @@ -52,10 +54,19 @@ protected native boolean initPbuffer(long pData, long pConfigInfo, boolean isOpaque, int width, int height); + protected CGLSurfaceData(CGLGraphicsConfig gc, ColorModel cm, int type, + int width, int height) { + super(gc, cm, type); + // TEXTURE shouldn't be scaled, it is used for managed BufferedImages. + scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor(); + this.width = width * scale; + this.height = height * scale; + } + protected CGLSurfaceData(CPlatformView pView, CGLGraphicsConfig gc, - ColorModel cm, int type) + ColorModel cm, int type,int width, int height) { - super(gc, cm, type); + this(gc, cm, type, width, height); this.pView = pView; this.graphicsConfig = gc; @@ -70,9 +81,9 @@ } protected CGLSurfaceData(CGLLayer layer, CGLGraphicsConfig gc, - ColorModel cm, int type) + ColorModel cm, int type,int width, int height) { - super(gc, cm, type); + this(gc, cm, type, width, height); this.graphicsConfig = gc; long pConfigInfo = gc.getNativeConfigInfo(); @@ -157,13 +168,43 @@ // Overridden in CGLWindowSurfaceData below } + @Override + public int getDefaultScale() { + return scale; + } + + @Override + public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, + int dx, int dy) { + final int state = sg2d.transformState; + if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE + || sg2d.compositeState >= SunGraphics2D.COMP_XOR) { + return false; + } + if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) { + x += sg2d.transX; + y += sg2d.transY; + } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) { + final double[] coords = {x, y, x + w, y + h, x + dx, y + dy}; + sg2d.transform.transform(coords, 0, coords, 0, 3); + x = (int) Math.ceil(coords[0] - 0.5); + y = (int) Math.ceil(coords[1] - 0.5); + w = ((int) Math.ceil(coords[2] - 0.5)) - x; + h = ((int) Math.ceil(coords[3] - 0.5)) - y; + dx = ((int) Math.ceil(coords[4] - 0.5)) - x; + dy = ((int) Math.ceil(coords[5] - 0.5)) - y; + } + oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy); + return true; + } + protected native void clearWindow(); public static class CGLWindowSurfaceData extends CGLSurfaceData { public CGLWindowSurfaceData(CPlatformView pView, CGLGraphicsConfig gc) { - super(pView, gc, gc.getColorModel(), WINDOW); + super(pView, gc, gc.getColorModel(), WINDOW, 0, 0); } @Override @@ -217,17 +258,12 @@ public static class CGLLayerSurfaceData extends CGLSurfaceData { private CGLLayer layer; - private int width, height; public CGLLayerSurfaceData(CGLLayer layer, CGLGraphicsConfig gc, int width, int height) { - super(layer, gc, gc.getColorModel(), FBOBJECT); - - this.width = width; - this.height = height; + super(layer, gc, gc.getColorModel(), FBOBJECT, width, height); this.layer = layer; - - initSurface(width, height); + initSurface(this.width, this.height); } @Override @@ -296,18 +332,13 @@ public static class CGLOffScreenSurfaceData extends CGLSurfaceData { private Image offscreenImage; - private int width, height; public CGLOffScreenSurfaceData(CPlatformView pView, CGLGraphicsConfig gc, int width, int height, Image image, ColorModel cm, int type) { - super(pView, gc, cm, type); - - this.width = width; - this.height = height; + super(pView, gc, cm, type, width, height); offscreenImage = image; - - initSurface(width, height); + initSurface(this.width, this.height); } @Override
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java Fri May 31 15:42:54 2013 -0700 @@ -448,35 +448,8 @@ private void applyConstrain(final Graphics g) { final SunGraphics2D sg2d = (SunGraphics2D) g; - final Rectangle constr = localToWindow(getSize()); - // translate and set rectangle constrain. - sg2d.constrain(constr.x, constr.y, constr.width, constr.height); - // set region constrain. - //sg2d.constrain(getVisibleRegion()); - SG2DConstraint(sg2d, getVisibleRegion()); - } - - //TODO Move this method to SG2D? - void SG2DConstraint(final SunGraphics2D sg2d, Region r) { - sg2d.constrainX = sg2d.transX; - sg2d.constrainY = sg2d.transY; - - Region c = sg2d.constrainClip; - if ((sg2d.constrainX | sg2d.constrainY) != 0) { - r = r.getTranslatedRegion(sg2d.constrainX, sg2d.constrainY); - } - if (c == null) { - c = r; - } else { - c = c.getIntersection(r); - if (c == sg2d.constrainClip) { - // Common case to ignore - return; - } - } - sg2d.constrainClip = c; - //validateCompClip() forced call. - sg2d.setDevClip(r.getLoX(), r.getLoY(), r.getWidth(), r.getHeight()); + final Rectangle size = localToWindow(getSize()); + sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion()); } public Region getVisibleRegion() {
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Fri May 31 15:42:54 2013 -0700 @@ -42,7 +42,7 @@ public class LWWindowPeer extends LWContainerPeer<Window, JComponent> - implements WindowPeer, FramePeer, DialogPeer, FullScreenCapable + implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener { public static enum PeerType { SIMPLEWINDOW, @@ -194,6 +194,7 @@ if (getSurfaceData() == null) { replaceSurfaceData(false); } + activateDisplayListener(); } // Just a helper method @@ -215,6 +216,7 @@ @Override protected void disposeImpl() { + deactivateDisplayListener(); SurfaceData oldData = getSurfaceData(); synchronized (surfaceDataLock){ surfaceData = null; @@ -656,17 +658,16 @@ setBounds(x, y, w, h, SET_BOUNDS, false, false); // Second, update the graphics config and surface data - checkIfOnNewScreen(); - if (resized) { + final boolean isNewDevice = updateGraphicsDevice(); + if (resized || isNewDevice) { replaceSurfaceData(); - flushOnscreenGraphics(); } // Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events if (moved || invalid) { handleMove(x, y, true); } - if (resized || invalid) { + if (resized || invalid || isNewDevice) { handleResize(w, h, true); repaintPeer(); } @@ -686,7 +687,7 @@ } if (!isTextured()) { if (g instanceof SunGraphics2D) { - SG2DConstraint((SunGraphics2D) g, getRegion()); + ((SunGraphics2D) g).constrain(0, 0, w, h, getRegion()); } g.setColor(getBackground()); g.fillRect(0, 0, w, h); @@ -701,8 +702,9 @@ getLWToolkit().getCursorManager().updateCursorLater(this); } - public void notifyActivation(boolean activation) { - changeFocusedWindow(activation); + public void notifyActivation(boolean activation, LWWindowPeer opposite) { + Window oppositeWindow = (opposite == null)? null : opposite.getTarget(); + changeFocusedWindow(activation, oppositeWindow); } // MouseDown in non-client area @@ -920,6 +922,18 @@ // ---- UTILITY METHODS ---- // + private void activateDisplayListener() { + final GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + ((SunGraphicsEnvironment) ge).addDisplayChangedListener(this); + } + + private void deactivateDisplayListener() { + final GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + ((SunGraphicsEnvironment) ge).removeDisplayChangedListener(this); + } + private void postWindowStateChangedEvent(int newWindowState) { if (getTarget() instanceof Frame) { AWTAccessor.getFrameAccessor().setExtendedState( @@ -961,7 +975,7 @@ } // If window's graphics config is changed from the app code, the // config correspond to the same device as before; when the window - // is moved by user, graphicsDevice is updated in checkIfOnNewScreen(). + // is moved by user, graphicsDevice is updated in notifyReshape(). // In either case, there's nothing to do with screenOn here graphicsConfig = gc; } @@ -969,25 +983,42 @@ return true; } - private void checkIfOnNewScreen() { + /** + * Returns true if the GraphicsDevice has been changed, false otherwise. + */ + public boolean updateGraphicsDevice() { GraphicsDevice newGraphicsDevice = platformWindow.getGraphicsDevice(); synchronized (getStateLock()) { if (graphicsDevice == newGraphicsDevice) { - return; + return false; } graphicsDevice = newGraphicsDevice; } - // TODO: DisplayChangedListener stuff final GraphicsConfiguration newGC = newGraphicsDevice.getDefaultConfiguration(); - if (!setGraphicsConfig(newGC)) return; + if (!setGraphicsConfig(newGC)) return false; SunToolkit.executeOnEventHandlerThread(getTarget(), new Runnable() { public void run() { AWTAccessor.getComponentAccessor().setGraphicsConfiguration(getTarget(), newGC); } }); + return true; + } + + @Override + public final void displayChanged() { + updateGraphicsDevice(); + // Replace surface unconditionally, because internal state of the + // GraphicsDevice could be changed. + replaceSurfaceData(); + repaintPeer(); + } + + @Override + public final void paletteChanged() { + // components do not need to react to this event. } /* @@ -1046,7 +1077,7 @@ g.setColor(nonOpaqueBackground); g.fillRect(0, 0, r.width, r.height); if (g instanceof SunGraphics2D) { - SG2DConstraint((SunGraphics2D) g, getRegion()); + ((SunGraphics2D) g).constrain(0, 0, r.width, r.height, getRegion()); } if (!isTextured()) { g.setColor(getBackground()); @@ -1062,6 +1093,7 @@ } } } + flushOnscreenGraphics(); } private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) { @@ -1069,14 +1101,15 @@ if (src != dst && src != null && dst != null && !(dst instanceof NullSurfaceData) && !(src instanceof NullSurfaceData) - && src.getSurfaceType().equals(dst.getSurfaceType())) { - final Rectangle size = getSize(); + && src.getSurfaceType().equals(dst.getSurfaceType()) + && src.getDefaultScale() == dst.getDefaultScale()) { + final Rectangle size = src.getBounds(); final Blit blit = Blit.locate(src.getSurfaceType(), CompositeType.Src, dst.getSurfaceType()); if (blit != null) { - blit.Blit(src, dst, AlphaComposite.Src, - getRegion(), 0, 0, 0, 0, size.width, size.height); + blit.Blit(src, dst, AlphaComposite.Src, null, 0, 0, 0, 0, + size.width, size.height); } } } @@ -1135,6 +1168,9 @@ Window currentActive = KeyboardFocusManager. getCurrentKeyboardFocusManager().getActiveWindow(); + Window opposite = LWKeyboardFocusManagerPeer.getInstance(). + getCurrentFocusedWindow(); + // Make the owner active window. if (isSimpleWindow()) { LWWindowPeer owner = getOwnerFrameDialog(this); @@ -1161,16 +1197,17 @@ } // DKFM will synthesize all the focus/activation events correctly. - changeFocusedWindow(true); + changeFocusedWindow(true, opposite); return true; // In case the toplevel is active but not focused, change focus directly, // as requesting native focus on it will not have effect. } else if (getTarget() == currentActive && !getTarget().hasFocus()) { - changeFocusedWindow(true); + changeFocusedWindow(true, opposite); return true; } + return platformWindow.requestWindowFocus(); } @@ -1200,7 +1237,7 @@ /* * Changes focused window on java level. */ - private void changeFocusedWindow(boolean becomesFocused) { + private void changeFocusedWindow(boolean becomesFocused, Window opposite) { if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this); } @@ -1224,9 +1261,6 @@ } } - KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); - Window oppositeWindow = becomesFocused ? kfmPeer.getCurrentFocusedWindow() : null; - // Note, the method is not called: // - when the opposite (gaining focus) window is an owned/owner window. // - for a simple window in any case. @@ -1238,10 +1272,11 @@ grabbingWindow.ungrab(); } + KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null); int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; - WindowEvent windowEvent = new WindowEvent(getTarget(), eventID, oppositeWindow); + WindowEvent windowEvent = new WindowEvent(getTarget(), eventID, opposite); // TODO: wrap in SequencedEvent postEvent(windowEvent);
--- a/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Fri May 31 15:42:54 2013 -0700 @@ -88,40 +88,25 @@ DragGestureEvent trigger = getTrigger(); InputEvent triggerEvent = trigger.getTriggerEvent(); - Point dragOrigin = trigger.getDragOrigin(); + Point dragOrigin = new Point(trigger.getDragOrigin()); int extModifiers = (triggerEvent.getModifiers() | triggerEvent.getModifiersEx()); long timestamp = triggerEvent.getWhen(); int clickCount = ((triggerEvent instanceof MouseEvent) ? (((MouseEvent) triggerEvent).getClickCount()) : 1); - // Get drag source component and its peer: Component component = trigger.getComponent(); - Point componentOffset = new Point(); - ComponentPeer peer = component.getPeer(); - - // For a lightweight component traverse up the hierarchy to the first heavyweight - // which will be used as the ComponentModel for the native drag source. - if (component.isLightweight()) { - Point loc = component.getLocation(); - componentOffset.translate(loc.x, loc.y); - - for (Component parent = component.getParent(); parent != null; parent = parent.getParent()) { - if (parent.isLightweight() == false) { - peer = parent.getPeer(); - break; - } - - loc = parent.getLocation(); - componentOffset.translate(loc.x, loc.y); - } + // For a lightweight component traverse up the hierarchy to the root + Point loc = component.getLocation(); + Component rootComponent = component; + while (!(rootComponent instanceof Window)) { + dragOrigin.translate(loc.x, loc.y); + rootComponent = rootComponent.getParent(); + loc = rootComponent.getLocation(); } - // Make sure the drop target is a ComponentModel: - if (!(peer instanceof LWComponentPeer)) - throw new IllegalArgumentException("DragSource's peer must be a ComponentModel."); - - // Get model pointer (CButton.m and such) and its native peer: - LWComponentPeer model = (LWComponentPeer) peer; - CPlatformWindow platformWindow = (CPlatformWindow) model.getPlatformWindow(); + //It sure will be LWComponentPeer instance as rootComponent is a Window + LWComponentPeer peer = (LWComponentPeer)rootComponent.getPeer(); + //Get a pointer to a native window + CPlatformWindow platformWindow = (CPlatformWindow) peer.getPlatformWindow(); long nativeWindowPtr = platformWindow.getNSWindowPtr(); // Get drag cursor: @@ -155,7 +140,7 @@ try { // Create native dragging source: final long nativeDragSource = createNativeDragSource(component, peer, nativeWindowPtr, transferable, triggerEvent, - (int) (dragOrigin.getX() + componentOffset.x), (int) (dragOrigin.getY() + componentOffset.y), extModifiers, + (int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers, clickCount, timestamp, cursor, fDragCImage, dragImageOffset.x, dragImageOffset.y, getDragSourceContext().getSourceActions(), formats, formatMap); @@ -165,8 +150,8 @@ setNativeContext(nativeDragSource); CCursorManager.getInstance().startDrag( - (int) (dragOrigin.getX() + componentOffset.x), - (int) (dragOrigin.getY() + componentOffset.y)); + (int) (dragOrigin.getX()), + (int) (dragOrigin.getY())); } catch (Exception e) {
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Fri May 31 15:42:54 2013 -0700 @@ -121,7 +121,7 @@ clipboard.checkPasteboard(); } if (parentWindowActive) { - responder.handleWindowFocusEvent(focused); + responder.handleWindowFocusEvent(focused, null); } } @@ -130,7 +130,7 @@ // ignore focus "lost" native request as it may mistakenly // deactivate active window (see 8001161) if (focused && parentWindowActive) { - responder.handleWindowFocusEvent(parentWindowActive); + responder.handleWindowFocusEvent(parentWindowActive, null); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Fri May 31 15:42:54 2013 -0700 @@ -218,7 +218,7 @@ } } - void handleWindowFocusEvent(boolean gained) { - peer.notifyActivation(gained); + void handleWindowFocusEvent(boolean gained, LWWindowPeer opposite) { + peer.notifyActivation(gained, opposite); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri May 31 15:42:54 2013 -0700 @@ -33,6 +33,7 @@ import java.beans.*; import java.lang.reflect.InvocationTargetException; import java.util.List; +import java.util.Objects; import javax.swing.*; @@ -884,8 +885,8 @@ } } - private void flushBuffers() { - if (isVisible() && !nativeBounds.isEmpty()) { + void flushBuffers() { + if (isVisible() && !nativeBounds.isEmpty() && !isFullScreenMode) { try { LWCToolkit.invokeAndWait(new Runnable() { @Override @@ -902,13 +903,15 @@ /************************************************************* * Callbacks from the AWTWindow and AWTView objc classes. *************************************************************/ - private void deliverWindowFocusEvent(boolean gained){ + private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){ // Fix for 7150349: ingore "gained" notifications when the app is inactive. if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) { focusLogger.fine("the app is inactive, so the notification is ignored"); return; } - responder.handleWindowFocusEvent(gained); + + LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer(); + responder.handleWindowFocusEvent(gained, oppositePeer); } private void deliverMoveResizeEvent(int x, int y, int width, int height, @@ -923,9 +926,12 @@ final Rectangle oldB = nativeBounds; nativeBounds = new Rectangle(x, y, width, height); + final GraphicsConfiguration oldGC = peer.getGraphicsConfiguration(); peer.notifyReshape(x, y, width, height); + final GraphicsConfiguration newGC = peer.getGraphicsConfiguration(); + // System-dependent appearance optimization. if ((byUser && !oldB.getSize().equals(nativeBounds.getSize())) - || isFullScreenAnimationOn) { + || isFullScreenAnimationOn || !Objects.equals(newGC, oldGC)) { flushBuffers(); } } @@ -972,6 +978,10 @@ return false; } + if (blocker instanceof CPrinterDialogPeer) { + return true; + } + CPlatformWindow pWindow = (CPlatformWindow)blocker.getPlatformWindow(); pWindow.orderAboveSiblings();
--- a/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java Fri May 31 15:42:54 2013 -0700 @@ -77,7 +77,7 @@ public void synthesizeWindowActivation(boolean activated) { if (isActive != activated) { isActive = activated; - ((LWWindowPeer)getPeer()).notifyActivation(activated); + ((LWWindowPeer)getPeer()).notifyActivation(activated, null); } }
--- a/src/macosx/native/com/apple/laf/JRSUIController.m Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/com/apple/laf/JRSUIController.m Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,6 +199,7 @@ CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CGContextRef cgRef = CGBitmapContextCreate(rawPixelData, imgW, imgH, 8, imgW * 4, colorspace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); CGColorSpaceRelease(colorspace); + CGContextScaleCTM(cgRef, imgW/w , imgH/h); jint status = doPaintCGContext(cgRef, controlPtr, oldProperties, newProperties, x, y, w, h); CGContextRelease(cgRef);
--- a/src/macosx/native/sun/awt/AWTWindow.h Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/sun/awt/AWTWindow.h Fri May 31 15:42:54 2013 -0700 @@ -72,6 +72,9 @@ - (BOOL) worksWhenModal; - (void)sendEvent:(NSEvent *)event; ++ (void) setLastKeyWindow:(AWTWindow *)window; ++ (AWTWindow *) lastKeyWindow; + @end @interface AWTWindow_Normal : NSWindow
--- a/src/macosx/native/sun/awt/AWTWindow.m Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/sun/awt/AWTWindow.m Fri May 31 15:42:54 2013 -0700 @@ -70,6 +70,14 @@ } @end +// Cocoa windowDidBecomeKey/windowDidResignKey notifications +// doesn't provide information about "opposite" window, so we +// have to do a bit of tracking. This variable points to a window +// which had been the key window just before a new key window +// was set. It would be nil if the new key window isn't an AWT +// window or the app currently has no key window. +static AWTWindow* lastKeyWindow = nil; + // -------------------------------------------------------------- // NSWindow/NSPanel descendants implementation #define AWT_NS_WINDOW_IMPLEMENTATION \ @@ -298,6 +306,10 @@ return self; } ++ (BOOL) isAWTWindow:(NSWindow *)window { + return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]]; +} + // checks that this window is under the mouse cursor and this point is not overlapped by others windows - (BOOL) isTopmostWindowUnderMouse { @@ -551,15 +563,17 @@ [self _deliverIconify:JNI_FALSE]; } -- (void) _deliverWindowFocusEvent:(BOOL)focused { +- (void) _deliverWindowFocusEvent:(BOOL)focused oppositeWindow:(AWTWindow *)opposite { //AWT_ASSERT_APPKIT_THREAD; - JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; if (platformWindow != NULL) { - static JNF_MEMBER_CACHE(jm_deliverWindowFocusEvent, jc_CPlatformWindow, "deliverWindowFocusEvent", "(Z)V"); - JNFCallVoidMethod(env, platformWindow, jm_deliverWindowFocusEvent, (jboolean)focused); + jobject oppositeWindow = [opposite.javaPlatformWindow jObjectWithEnv:env]; + + static JNF_MEMBER_CACHE(jm_deliverWindowFocusEvent, jc_CPlatformWindow, "deliverWindowFocusEvent", "(ZLsun/lwawt/macosx/CPlatformWindow;)V"); + JNFCallVoidMethod(env, platformWindow, jm_deliverWindowFocusEvent, (jboolean)focused, oppositeWindow); (*env)->DeleteLocalRef(env, platformWindow); + (*env)->DeleteLocalRef(env, oppositeWindow); } } @@ -568,7 +582,10 @@ AWT_ASSERT_APPKIT_THREAD; [AWTToolkit eventCountPlusPlus]; [CMenuBar activate:self.javaMenuBar modallyDisabled:NO]; - [self _deliverWindowFocusEvent:YES]; + AWTWindow *opposite = [AWTWindow lastKeyWindow]; + [AWTWindow setLastKeyWindow:nil]; + + [self _deliverWindowFocusEvent:YES oppositeWindow: opposite]; } - (void) windowDidResignKey: (NSNotification *) notification { @@ -576,7 +593,18 @@ AWT_ASSERT_APPKIT_THREAD; [AWTToolkit eventCountPlusPlus]; [self.javaMenuBar deactivate]; - [self _deliverWindowFocusEvent:NO]; + + // the new key window + NSWindow *keyWindow = [NSApp keyWindow]; + AWTWindow *opposite = nil; + if ([AWTWindow isAWTWindow: keyWindow]) { + opposite = (AWTWindow *)[keyWindow delegate]; + [AWTWindow setLastKeyWindow: self]; + } else { + [AWTWindow setLastKeyWindow: nil]; + } + + [self _deliverWindowFocusEvent:NO oppositeWindow: opposite]; } - (void) windowDidBecomeMain: (NSNotification *) notification { @@ -735,6 +763,17 @@ } } ++ (void) setLastKeyWindow:(AWTWindow *)window { + [window retain]; + [lastKeyWindow release]; + lastKeyWindow = window; +} + ++ (AWTWindow *) lastKeyWindow { + return lastKeyWindow; +} + + @end // AWTWindow @@ -1141,6 +1180,10 @@ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + if ([AWTWindow lastKeyWindow] == window) { + [AWTWindow setLastKeyWindow: nil]; + } + // AWTWindow holds a reference to the NSWindow in its nsWindow // property. Unsetting the delegate allows it to be deallocated // which releases the reference. This, in turn, allows the window
--- a/src/macosx/native/sun/awt/CDragSource.m Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/sun/awt/CDragSource.m Fri May 31 15:42:54 2013 -0700 @@ -443,9 +443,9 @@ NSGraphicsContext* graphicsContext = [NSGraphicsContext graphicsContextWithWindow:window]; // Convert mouse coordinates to NS: - NSPoint location = NSMakePoint(fDragPos.x, fDragPos.y); - NSPoint eventLocation = [fView convertPoint:location toView:nil]; - + NSPoint eventLocation = [fView convertPoint:NSMakePoint(fDragPos.x, fDragPos.y) toView:nil]; + eventLocation.y = [[fView window] frame].size.height - eventLocation.y; + // Convert fTriggerEventTimeStamp to NS - AWTEvent.h defines UTC(nsEvent) as ((jlong)[event timestamp] * 1000): NSTimeInterval timeStamp = fTriggerEventTimeStamp / 1000; @@ -497,12 +497,9 @@ NSImage* dragImage = fDragImage; // Get drag origin and offset: - NSPoint dragOrigin; - dragOrigin.x = fDragPos.x; - dragOrigin.y = fDragPos.y; - dragOrigin = [view convertPoint:[dragEvent locationInWindow] fromView:nil]; + NSPoint dragOrigin = [dragEvent locationInWindow]; dragOrigin.x += fDragImageOffset.x; - dragOrigin.y += [dragImage size].height + fDragImageOffset.y; + dragOrigin.y -= fDragImageOffset.y + [dragImage size].height; // Drag offset values don't seem to matter: NSSize dragOffset = NSMakeSize(0, 0); @@ -516,7 +513,6 @@ DLog5(@" - drag image: %f, %f (%f x %f)", fDragImageOffset.x, fDragImageOffset.y, [dragImage size].width, [dragImage size].height); DLog3(@" - event point (window) %f, %f", [dragEvent locationInWindow].x, [dragEvent locationInWindow].y); DLog3(@" - drag point (view) %f, %f", dragOrigin.x, dragOrigin.y); - // Set up the fDragKeyModifier, so we know if the operation has changed // Set up the fDragMouseModifier, so we can |= it later (since CoreDrag doesn't tell us mouse states during a drag) fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers];
--- a/src/macosx/native/sun/awt/CGraphicsDevice.m Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/sun/awt/CGraphicsDevice.m Fri May 31 15:42:54 2013 -0700 @@ -276,3 +276,34 @@ return jreturnArray; } + +/* + * Class: sun_awt_CGraphicsDevice + * Method: nativeGetScaleFactor + * Signature: (I)D + */ +JNIEXPORT jdouble JNICALL +Java_sun_awt_CGraphicsDevice_nativeGetScaleFactor +(JNIEnv *env, jclass class, jint displayID) +{ + __block jdouble ret = 1.0f; + +JNF_COCOA_ENTER(env); + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + NSArray *screens = [NSScreen screens]; + for (NSScreen *screen in screens) { + NSDictionary *screenInfo = [screen deviceDescription]; + NSNumber *screenID = [screenInfo objectForKey:@"NSScreenNumber"]; + if ([screenID pointerValue] == displayID){ + if ([screen respondsToSelector:@selector(backingScaleFactor)]) { + ret = [screen backingScaleFactor]; + } + break; + } + } + }]; + +JNF_COCOA_EXIT(env); + return ret; +}
--- a/src/macosx/native/sun/awt/CGraphicsEnv.m Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/sun/awt/CGraphicsEnv.m Fri May 31 15:42:54 2013 -0700 @@ -124,10 +124,11 @@ jobject graphicsEnv = [wrapper jObjectWithEnv:env]; if (graphicsEnv == NULL) return; // ref already GC'd - static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment"); - static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(J)V"); - JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration); + static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V"); + JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration, + (jint) display, + (jboolean) flags & kCGDisplayRemoveFlag); }); }
--- a/src/macosx/native/sun/java2d/opengl/CGLLayer.m Wed May 29 13:24:33 2013 -0700 +++ b/src/macosx/native/sun/java2d/opengl/CGLLayer.m Fri May 31 15:42:54 2013 -0700 @@ -61,6 +61,19 @@ //Layer backed view //self.needsDisplayOnBoundsChange = YES; //self.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; + + //Disable CALayer's default animation + NSMutableDictionary * actions = [[NSMutableDictionary alloc] initWithObjectsAndKeys: + [NSNull null], @"bounds", + [NSNull null], @"contents", + [NSNull null], @"contentsScale", + [NSNull null], @"onOrderIn", + [NSNull null], @"onOrderOut", + [NSNull null], @"sublayers", + nil]; + self.actions = actions; + [actions release]; + textureID = 0; // texture will be created by rendering pipe target = 0; @@ -121,8 +134,12 @@ // Set the current context to the one given to us. CGLSetCurrentContext(glContext); + // Should clear the whole CALayer, because it can be larger than our texture. + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, textureWidth, textureHeight); - + JNIEnv *env = [ThreadUtilities getJNIEnv]; static JNF_CLASS_CACHE(jc_JavaLayer, "sun/java2d/opengl/CGLLayer"); static JNF_MEMBER_CACHE(jm_drawInCGLContext, jc_JavaLayer, "drawInCGLContext", "()V"); @@ -168,7 +185,7 @@ // Must be called under the RQ lock. JNIEXPORT void JNICALL Java_sun_java2d_opengl_CGLLayer_validate -(JNIEnv *env, jobject obj, jlong layerPtr, jobject surfaceData) +(JNIEnv *env, jclass cls, jlong layerPtr, jobject surfaceData) { CGLLayer *layer = OBJC(layerPtr); @@ -186,9 +203,25 @@ // Must be called on the AppKit thread and under the RQ lock. JNIEXPORT void JNICALL Java_sun_java2d_opengl_CGLLayer_blitTexture -(JNIEnv *env, jobject obj, jlong layerPtr) +(JNIEnv *env, jclass cls, jlong layerPtr) { CGLLayer *layer = jlong_to_ptr(layerPtr); [layer blitTexture]; } + +JNIEXPORT void JNICALL +Java_sun_java2d_opengl_CGLLayer_nativeSetScale +(JNIEnv *env, jclass cls, jlong layerPtr, jdouble scale) +{ + JNF_COCOA_ENTER(env); + CGLLayer *layer = jlong_to_ptr(layerPtr); + // We always call all setXX methods asynchronously, exception is only in + // this method where we need to change native texture size and layer's scale + // in one call on appkit, otherwise we'll get window's contents blinking, + // during screen-2-screen moving. + [ThreadUtilities performOnMainThreadWaiting:[NSThread isMainThread] block:^(){ + layer.contentsScale = scale; + }]; + JNF_COCOA_EXIT(env); +}
--- a/src/share/classes/com/sun/beans/finder/AbstractFinder.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/com/sun/beans/finder/AbstractFinder.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,9 @@ */ package com.sun.beans.finder; +import java.lang.reflect.Member; +import java.lang.reflect.Modifier; + import java.util.HashMap; import java.util.Map; @@ -37,7 +40,7 @@ * * @author Sergey A. Malenkov */ -abstract class AbstractFinder<T> { +abstract class AbstractFinder<T extends Member> { private final Class<?>[] args; /** @@ -81,7 +84,9 @@ * @return {@code true} if the method is valid, * {@code false} otherwise */ - protected abstract boolean isValid(T method); + protected boolean isValid(T method) { + return Modifier.isPublic(method.getModifiers()); + } /** * Performs a search in the {@code methods} array. @@ -120,6 +125,11 @@ boolean useNew = isAssignable(oldParams, newParams); boolean useOld = isAssignable(newParams, oldParams); + if (useOld && useNew) { + // only if parameters are equal + useNew = !newMethod.isSynthetic(); + useOld = !oldMethod.isSynthetic(); + } if (useOld == useNew) { ambiguous = true; } else if (useNew) { @@ -160,6 +170,11 @@ boolean useNew = isAssignable(oldParams, newParams); boolean useOld = isAssignable(newParams, oldParams); + if (useOld && useNew) { + // only if parameters are equal + useNew = !newMethod.isSynthetic(); + useOld = !oldMethod.isSynthetic(); + } if (useOld == useNew) { if (oldParams == map.get(oldMethod)) { ambiguous = true;
--- a/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/com/sun/beans/finder/ConstructorFinder.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -113,17 +113,4 @@ protected boolean isVarArgs(Constructor<?> constructor) { return constructor.isVarArgs(); } - - /** - * Checks validness of the constructor. - * The valid constructor should be public. - * - * @param constructor the object that represents constructor - * @return {@code true} if the constructor is valid, - * {@code false} otherwise - */ - @Override - protected boolean isValid(Constructor<?> constructor) { - return Modifier.isPublic(constructor.getModifiers()); - } }
--- a/src/share/classes/com/sun/beans/finder/MethodFinder.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/com/sun/beans/finder/MethodFinder.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -233,6 +233,6 @@ */ @Override protected boolean isValid(Method method) { - return !method.isBridge() && Modifier.isPublic(method.getModifiers()) && method.getName().equals(this.name); + return super.isValid(method) && method.getName().equals(this.name); } }
--- a/src/share/classes/java/io/File.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/java/io/File.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -156,7 +156,7 @@ static private FileSystem fs = FileSystem.getFileSystem(); /** - * This abstract pathname's normalized pathname string. A normalized + * This abstract pathname's normalized pathname string. A normalized * pathname string uses the default name-separator character and does not * contain any duplicate or redundant separators. * @@ -165,6 +165,32 @@ private String path; /** + * Enum type that indicates the status of a file path. + */ + private static enum PathStatus { INVALID, CHECKED }; + + /** + * The flag indicating whether the file path is invalid. + */ + private transient PathStatus status = null; + + /** + * Check if the file has an invalid path. Currently, the inspection of + * a file path is very limited, and it only covers Nul character check. + * Returning true means the path is definitely invalid/garbage. But + * returning false does not guarantee that the path is valid. + * + * @return true if the file path is invalid. + */ + final boolean isInvalid() { + if (status == null) { + status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED + : PathStatus.INVALID; + } + return status == PathStatus.INVALID; + } + + /** * The length of this abstract pathname's prefix, or zero if it has no * prefix. */ @@ -586,6 +612,9 @@ * @see Path#toRealPath */ public String getCanonicalPath() throws IOException { + if (isInvalid()) { + throw new IOException("Invalid file path"); + } return fs.canonicalize(fs.resolve(this)); } @@ -651,6 +680,9 @@ */ @Deprecated public URL toURL() throws MalformedURLException { + if (isInvalid()) { + throw new MalformedURLException("Invalid file path"); + } return new URL("file", "", slashify(getAbsolutePath(), isDirectory())); } @@ -727,6 +759,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return false; + } return fs.checkAccess(this, FileSystem.ACCESS_READ); } @@ -749,6 +784,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.checkAccess(this, FileSystem.ACCESS_WRITE); } @@ -769,6 +807,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return false; + } return ((fs.getBooleanAttributes(this) & FileSystem.BA_EXISTS) != 0); } @@ -796,6 +837,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return false; + } return ((fs.getBooleanAttributes(this) & FileSystem.BA_DIRECTORY) != 0); } @@ -826,6 +870,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return false; + } return ((fs.getBooleanAttributes(this) & FileSystem.BA_REGULAR) != 0); } @@ -852,6 +899,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return false; + } return ((fs.getBooleanAttributes(this) & FileSystem.BA_HIDDEN) != 0); } @@ -881,6 +931,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return 0L; + } return fs.getLastModifiedTime(this); } @@ -909,6 +962,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return 0L; + } return fs.getLength(this); } @@ -944,6 +1000,9 @@ public boolean createNewFile() throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) security.checkWrite(path); + if (isInvalid()) { + throw new IOException("Invalid file path"); + } return fs.createFileExclusively(path); } @@ -970,6 +1029,9 @@ if (security != null) { security.checkDelete(path); } + if (isInvalid()) { + return false; + } return fs.delete(this); } @@ -1005,6 +1067,9 @@ if (security != null) { security.checkDelete(path); } + if (isInvalid()) { + return; + } DeleteOnExitHook.add(path); } @@ -1045,6 +1110,9 @@ if (security != null) { security.checkRead(path); } + if (isInvalid()) { + return null; + } return fs.list(this); } @@ -1236,6 +1304,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.createDirectory(this); } @@ -1311,6 +1382,12 @@ security.checkWrite(path); security.checkWrite(dest.path); } + if (dest == null) { + throw new NullPointerException(); + } + if (this.isInvalid() || dest.isInvalid()) { + return false; + } return fs.rename(this, dest); } @@ -1346,6 +1423,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.setLastModifiedTime(this, time); } @@ -1371,6 +1451,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.setReadOnly(this); } @@ -1409,6 +1492,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.setPermission(this, FileSystem.ACCESS_WRITE, writable, ownerOnly); } @@ -1479,6 +1565,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.setPermission(this, FileSystem.ACCESS_READ, readable, ownerOnly); } @@ -1552,6 +1641,9 @@ if (security != null) { security.checkWrite(path); } + if (isInvalid()) { + return false; + } return fs.setPermission(this, FileSystem.ACCESS_EXECUTE, executable, ownerOnly); } @@ -1606,6 +1698,9 @@ if (security != null) { security.checkExec(path); } + if (isInvalid()) { + return false; + } return fs.checkAccess(this, FileSystem.ACCESS_EXECUTE); } @@ -1682,6 +1777,9 @@ sm.checkPermission(new RuntimePermission("getFileSystemAttributes")); sm.checkRead(path); } + if (isInvalid()) { + return 0L; + } return fs.getSpace(this, FileSystem.SPACE_TOTAL); } @@ -1698,7 +1796,7 @@ * makes no guarantee that write operations to this file system * will succeed. * - * @return The number of unallocated bytes on the partition <tt>0L</tt> + * @return The number of unallocated bytes on the partition or <tt>0L</tt> * if the abstract pathname does not name a partition. This * value will be less than or equal to the total file system size * returned by {@link #getTotalSpace}. @@ -1717,6 +1815,9 @@ sm.checkPermission(new RuntimePermission("getFileSystemAttributes")); sm.checkRead(path); } + if (isInvalid()) { + return 0L; + } return fs.getSpace(this, FileSystem.SPACE_FREE); } @@ -1755,6 +1856,9 @@ sm.checkPermission(new RuntimePermission("getFileSystemAttributes")); sm.checkRead(path); } + if (isInvalid()) { + return 0L; + } return fs.getSpace(this, FileSystem.SPACE_USABLE); } @@ -1764,8 +1868,8 @@ private TempDirectory() { } // temporary directory location - private static final File tmpdir = new File(fs.normalize(AccessController - .doPrivileged(new GetPropertyAction("java.io.tmpdir")))); + private static final File tmpdir = new File(AccessController + .doPrivileged(new GetPropertyAction("java.io.tmpdir"))); static File location() { return tmpdir; } @@ -1876,6 +1980,9 @@ throw se; } } + if (f.isInvalid()) { + throw new IOException("Unable to create temporary file"); + } } while (!fs.createFileExclusively(f.getPath())); return f; }
--- a/src/share/classes/java/io/FileInputStream.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/java/io/FileInputStream.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -137,6 +137,9 @@ if (name == null) { throw new NullPointerException(); } + if (file.isInvalid()) { + throw new FileNotFoundException("Invalid file path"); + } fd = new FileDescriptor(); fd.incrementAndGetUseCount(); this.path = name;
--- a/src/share/classes/java/io/FileOutputStream.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/java/io/FileOutputStream.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,6 +211,9 @@ if (name == null) { throw new NullPointerException(); } + if (file.isInvalid()) { + throw new FileNotFoundException("Invalid file path"); + } this.fd = new FileDescriptor(); this.append = append; this.path = name;
--- a/src/share/classes/java/io/RandomAccessFile.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/java/io/RandomAccessFile.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -232,6 +232,9 @@ if (name == null) { throw new NullPointerException(); } + if (file.isInvalid()) { + throw new FileNotFoundException("Invalid file path"); + } fd = new FileDescriptor(); fd.incrementAndGetUseCount(); this.path = name;
--- a/src/share/classes/java/util/LocaleISOData.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/java/util/LocaleISOData.java Fri May 31 15:42:54 2013 -0700 @@ -404,7 +404,7 @@ + "PG" + "PNG" // Papua New Guinea + "PH" + "PHL" // Philippines, Republic of the + "PK" + "PAK" // Pakistan, Islamic Republic of - + "PL" + "POL" // Poland, Polish People's Republic + + "PL" + "POL" // Poland, Republic of Poland + "PM" + "SPM" // St. Pierre and Miquelon + "PN" + "PCN" // Pitcairn Island + "PR" + "PRI" // Puerto Rico
--- a/src/share/classes/javax/swing/JDesktopPane.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/javax/swing/JDesktopPane.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -428,6 +428,15 @@ } /** + * {@inheritDoc} + */ + @Override + public void remove(Component comp) { + super.remove(comp); + updateFramesCache(); + } + + /** * Selects the next <code>JInternalFrame</code> in this desktop pane. * * @param forward a boolean indicating which direction to select in;
--- a/src/share/classes/javax/swing/JToolTip.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/javax/swing/JToolTip.java Fri May 31 15:42:54 2013 -0700 @@ -31,6 +31,7 @@ import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; +import java.util.Objects; /** @@ -127,6 +128,11 @@ String oldValue = this.tipText; this.tipText = tipText; firePropertyChange("tiptext", oldValue, tipText); + + if (!Objects.equals(oldValue, tipText)) { + revalidate(); + repaint(); + } } /**
--- a/src/share/classes/javax/swing/text/html/FormView.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/javax/swing/text/html/FormView.java Fri May 31 15:42:54 2013 -0700 @@ -159,6 +159,10 @@ attr.getAttribute(StyleConstants.NameAttribute); JComponent c = null; Object model = attr.getAttribute(StyleConstants.ModelAttribute); + + // Remove listeners previously registered in shared model + // when a new UI component is replaced. See bug 8008289. + removeStaleListenerForModel(model); if (t == HTML.Tag.INPUT) { c = createInputComponent(attr, model); } else if (t == HTML.Tag.SELECT) { @@ -310,6 +314,63 @@ return c; } + private void removeStaleListenerForModel(Object model) { + if (model instanceof DefaultButtonModel) { + // case of JButton whose model is DefaultButtonModel + // Need to remove stale ActionListener, ChangeListener and + // ItemListener that are instance of AbstractButton$Handler. + DefaultButtonModel buttonModel = (DefaultButtonModel) model; + String listenerClass = "javax.swing.AbstractButton$Handler"; + for (ActionListener listener : buttonModel.getActionListeners()) { + if (listenerClass.equals(listener.getClass().getName())) { + buttonModel.removeActionListener(listener); + } + } + for (ChangeListener listener : buttonModel.getChangeListeners()) { + if (listenerClass.equals(listener.getClass().getName())) { + buttonModel.removeChangeListener(listener); + } + } + for (ItemListener listener : buttonModel.getItemListeners()) { + if (listenerClass.equals(listener.getClass().getName())) { + buttonModel.removeItemListener(listener); + } + } + } else if (model instanceof AbstractListModel) { + // case of JComboBox and JList + // For JList, the stale ListDataListener is instance + // BasicListUI$Handler. + // For JComboBox, there are 2 stale ListDataListeners, which are + // BasicListUI$Handler and BasicComboBoxUI$Handler. + AbstractListModel listModel = (AbstractListModel) model; + String listenerClass1 = + "javax.swing.plaf.basic.BasicListUI$Handler"; + String listenerClass2 = + "javax.swing.plaf.basic.BasicComboBoxUI$Handler"; + for (ListDataListener listener : listModel.getListDataListeners()) { + if (listenerClass1.equals(listener.getClass().getName()) + || listenerClass2.equals(listener.getClass().getName())) + { + listModel.removeListDataListener(listener); + } + } + } else if (model instanceof AbstractDocument) { + // case of JPasswordField, JTextField and JTextArea + // All have 2 stale DocumentListeners. + String listenerClass1 = + "javax.swing.plaf.basic.BasicTextUI$UpdateHandler"; + String listenerClass2 = + "javax.swing.text.DefaultCaret$Handler"; + AbstractDocument docModel = (AbstractDocument) model; + for (DocumentListener listener : docModel.getDocumentListeners()) { + if (listenerClass1.equals(listener.getClass().getName()) + || listenerClass2.equals(listener.getClass().getName())) + { + docModel.removeDocumentListener(listener); + } + } + } + } /** * Determines the maximum span for this view along an @@ -347,7 +408,7 @@ /** - * Responsible for processeing the ActionEvent. + * Responsible for processing the ActionEvent. * If the element associated with the FormView, * has a type of "submit", "reset", "text" or "password" * then the action is processed. In the case of a "submit"
--- a/src/share/classes/sun/awt/image/SurfaceManager.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/awt/image/SurfaceManager.java Fri May 31 15:42:54 2013 -0700 @@ -31,6 +31,7 @@ import java.awt.Image; import java.awt.ImageCapabilities; import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; import java.util.concurrent.ConcurrentHashMap; import java.util.Iterator; import sun.java2d.SurfaceData; @@ -287,4 +288,18 @@ flush(true); } } + + /** + * Returns a scale factor of the image. This is utility method, which + * fetches information from the SurfaceData of the image. + * + * @see SurfaceData#getDefaultScale + */ + public static int getImageScale(final Image img) { + if (!(img instanceof VolatileImage)) { + return 1; + } + final SurfaceManager sm = getManager(img); + return sm.getPrimarySurfaceData().getDefaultScale(); + } }
--- a/src/share/classes/sun/java2d/SunGraphics2D.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/java2d/SunGraphics2D.java Fri May 31 15:42:54 2013 -0700 @@ -65,6 +65,8 @@ import java.awt.Transparency; import java.awt.font.GlyphVector; import java.awt.font.TextLayout; + +import sun.awt.image.SurfaceManager; import sun.font.FontDesignMetrics; import sun.font.FontUtilities; import sun.java2d.pipe.PixelDrawPipe; @@ -82,14 +84,12 @@ import sun.java2d.loops.SurfaceType; import sun.java2d.loops.Blit; import sun.java2d.loops.MaskFill; -import sun.font.FontManager; import java.awt.font.FontRenderContext; import sun.java2d.loops.XORComposite; import sun.awt.ConstrainableGraphics; import sun.awt.SunHints; import java.util.Map; import java.util.Iterator; -import sun.java2d.DestSurfaceProvider; import sun.misc.PerformanceLogger; /** @@ -203,13 +203,15 @@ public RenderingHints hints; - public Region constrainClip; // lightweight bounds + public Region constrainClip; // lightweight bounds in pixels public int constrainX; public int constrainY; public Region clipRegion; public Shape usrClip; - protected Region devClip; // Actual physical drawable + protected Region devClip; // Actual physical drawable in pixels + + private final int devScale; // Actual physical scale factor // cached state for text rendering private boolean validFontInfo; @@ -252,6 +254,12 @@ validateColor(); + devScale = sd.getDefaultScale(); + if (devScale != 1) { + transform.setToScale(devScale, devScale); + invalidateTransform(); + } + font = f; if (font == null) { font = defaultFont; @@ -316,6 +324,49 @@ /** * Constrain rendering for lightweight objects. + */ + public void constrain(int x, int y, int w, int h, Region region) { + if ((x | y) != 0) { + translate(x, y); + } + if (transformState > TRANSFORM_TRANSLATESCALE) { + clipRect(0, 0, w, h); + return; + } + // changes parameters according to the current scale and translate. + final double scaleX = transform.getScaleX(); + final double scaleY = transform.getScaleY(); + x = constrainX = (int) transform.getTranslateX(); + y = constrainY = (int) transform.getTranslateY(); + w = Region.dimAdd(x, Region.clipScale(w, scaleX)); + h = Region.dimAdd(y, Region.clipScale(h, scaleY)); + + Region c = constrainClip; + if (c == null) { + c = Region.getInstanceXYXY(x, y, w, h); + } else { + c = c.getIntersectionXYXY(x, y, w, h); + } + if (region != null) { + region = region.getScaledRegion(scaleX, scaleY); + region = region.getTranslatedRegion(x, y); + c = c.getIntersection(region); + } + + if (c == constrainClip) { + // Common case to ignore + return; + } + + constrainClip = c; + if (!devClip.isInsideQuickCheck(c)) { + devClip = devClip.getIntersection(c); + validateCompClip(); + } + } + + /** + * Constrain rendering for lightweight objects. * * REMIND: This method will back off to the "workaround" * of using translate and clipRect if the Graphics @@ -326,33 +377,9 @@ * @exception IllegalStateException If the Graphics * to be constrained has a complex transform. */ + @Override public void constrain(int x, int y, int w, int h) { - if ((x|y) != 0) { - translate(x, y); - } - if (transformState >= TRANSFORM_TRANSLATESCALE) { - clipRect(0, 0, w, h); - return; - } - x = constrainX = transX; - y = constrainY = transY; - w = Region.dimAdd(x, w); - h = Region.dimAdd(y, h); - Region c = constrainClip; - if (c == null) { - c = Region.getInstanceXYXY(x, y, w, h); - } else { - c = c.getIntersectionXYXY(x, y, w, h); - if (c == constrainClip) { - // Common case to ignore - return; - } - } - constrainClip = c; - if (!devClip.isInsideQuickCheck(c)) { - devClip = devClip.getIntersection(c); - validateCompClip(); - } + constrain(x, y, w, h, null); } protected static ValidatePipe invalidpipe = new ValidatePipe(); @@ -1536,11 +1563,13 @@ * @see TransformChain * @see AffineTransform */ + @Override public void setTransform(AffineTransform Tx) { - if ((constrainX|constrainY) == 0) { + if ((constrainX | constrainY) == 0 && devScale == 1) { transform.setTransform(Tx); } else { - transform.setToTranslation(constrainX, constrainY); + transform.setTransform(devScale, 0, 0, devScale, constrainX, + constrainY); transform.concatenate(Tx); } invalidateTransform(); @@ -1598,12 +1627,15 @@ * @see #transform * @see #setTransform */ + @Override public AffineTransform getTransform() { - if ((constrainX|constrainY) == 0) { + if ((constrainX | constrainY) == 0 && devScale == 1) { return new AffineTransform(transform); } - AffineTransform tx = - AffineTransform.getTranslateInstance(-constrainX, -constrainY); + final double invScale = 1.0 / devScale; + AffineTransform tx = new AffineTransform(invScale, 0, 0, invScale, + -constrainX * invScale, + -constrainY * invScale); tx.concatenate(transform); return tx; } @@ -2987,6 +3019,37 @@ } // end of text rendering methods + private static boolean isHiDPIImage(final Image img) { + return SurfaceManager.getImageScale(img) != 1; + } + + private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2, + int dy2, int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { + final int scale = SurfaceManager.getImageScale(img); + sx1 = Region.clipScale(sx1, scale); + sx2 = Region.clipScale(sx2, scale); + sy1 = Region.clipScale(sy1, scale); + sy2 = Region.clipScale(sy2, scale); + try { + return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1, + sx2, sy2, bgcolor, observer); + } catch (InvalidPipeException e) { + try { + revalidateAll(); + return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, + sy1, sx2, sy2, bgcolor, observer); + } catch (InvalidPipeException e2) { + // Still catching the exception; we are not yet ready to + // validate the surfaceData correctly. Fail for now and + // try again next time around. + return false; + } + } finally { + surfaceData.markDirty(); + } + } + /** * Draws an image scaled to x,y,w,h in nonblocking mode with a * callback object. @@ -3000,8 +3063,9 @@ * Not part of the advertised API but a useful utility method * to call internally. This is for the case where we are * drawing to/from given coordinates using a given width/height, - * but we guarantee that the weidth/height of the src and dest - * areas are equal (no scale needed). + * but we guarantee that the surfaceData's width/height of the src and dest + * areas are equal (no scale needed). Note that this method intentionally + * ignore scale factor of the source image, and copy it as is. */ public boolean copyImage(Image img, int dx, int dy, int sx, int sy, int width, int height, Color bgcolor, @@ -3039,7 +3103,15 @@ if ((width == 0) || (height == 0)) { return true; } - if (width == img.getWidth(null) && height == img.getHeight(null)) { + + final int imgW = img.getWidth(null); + final int imgH = img.getHeight(null); + if (isHiDPIImage(img)) { + return drawHiDPIImage(img, x, y, x + width, y + height, 0, 0, imgW, + imgH, bg, observer); + } + + if (width == imgW && height == imgH) { return copyImage(img, x, y, 0, 0, width, height, bg, observer); } @@ -3080,6 +3152,13 @@ return true; } + if (isHiDPIImage(img)) { + final int imgW = img.getWidth(null); + final int imgH = img.getHeight(null); + return drawHiDPIImage(img, x, y, x + imgW, y + imgH, 0, 0, imgW, + imgH, bg, observer); + } + try { return imagepipe.copyImage(this, img, x, y, bg, observer); } catch (InvalidPipeException e) { @@ -3128,6 +3207,11 @@ return true; } + if (isHiDPIImage(img)) { + return drawHiDPIImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, + bgcolor, observer); + } + if (((sx2 - sx1) == (dx2 - dx1)) && ((sy2 - sy1) == (dy2 - dy1))) { @@ -3206,6 +3290,18 @@ return drawImage(img, 0, 0, null, observer); } + if (isHiDPIImage(img)) { + final int w = img.getWidth(null); + final int h = img.getHeight(null); + final AffineTransform tx = new AffineTransform(transform); + transform(xform); + boolean result = drawHiDPIImage(img, 0, 0, w, h, 0, 0, w, h, null, + observer); + transform.setTransform(tx); + invalidateTransform(); + return result; + } + try { return imagepipe.transformImage(this, img, xform, observer); } catch (InvalidPipeException e) {
--- a/src/share/classes/sun/java2d/SurfaceData.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/java2d/SurfaceData.java Fri May 31 15:42:54 2013 -0700 @@ -1057,4 +1057,14 @@ * responsible for returning the appropriate object. */ public abstract Object getDestination(); + + /** + * Returns default scale factor of the destination surface. Scale factor + * describes the mapping between virtual and physical coordinates of the + * SurfaceData. If the scale is 2 then virtual pixel coordinates need to be + * doubled for physical pixels. + */ + public int getDefaultScale() { + return 1; + } }
--- a/src/share/classes/sun/java2d/pipe/BufferedContext.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/java2d/pipe/BufferedContext.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,8 +95,7 @@ private int validatedRGB; private int validatedFlags; private boolean xformInUse; - private int transX; - private int transY; + private AffineTransform transform; protected BufferedContext(RenderQueue rq) { this.rq = rq; @@ -273,14 +272,11 @@ resetTransform(); xformInUse = false; txChanged = true; - } else if (sg2d != null) { - if (transX != sg2d.transX || transY != sg2d.transY) { - txChanged = true; - } + } else if (sg2d != null && !sg2d.transform.equals(transform)) { + txChanged = true; } - if (sg2d != null) { - transX = sg2d.transX; - transY = sg2d.transY; + if (sg2d != null && txChanged) { + transform = new AffineTransform(sg2d.transform); } } else { setTransform(xform);
--- a/src/share/classes/sun/java2d/pipe/DrawImage.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/java2d/pipe/DrawImage.java Fri May 31 15:42:54 2013 -0700 @@ -27,9 +27,7 @@ import java.awt.AlphaComposite; import java.awt.Color; -import java.awt.Graphics2D; import java.awt.Image; -import java.awt.Rectangle; import java.awt.Transparency; import java.awt.geom.AffineTransform; import java.awt.geom.NoninvertibleTransformException; @@ -38,15 +36,13 @@ import java.awt.image.BufferedImageOp; import java.awt.image.ColorModel; import java.awt.image.DataBuffer; -import java.awt.image.DirectColorModel; import java.awt.image.ImageObserver; import java.awt.image.IndexColorModel; import java.awt.image.Raster; import java.awt.image.VolatileImage; -import java.awt.image.WritableRaster; -import java.awt.image.ImagingOpException; import sun.awt.SunHints; import sun.awt.image.ImageRepresentation; +import sun.awt.image.SurfaceManager; import sun.awt.image.ToolkitImage; import sun.java2d.InvalidPipeException; import sun.java2d.SunGraphics2D; @@ -323,15 +319,17 @@ BufferedImage makeBufferedImage(Image img, Color bgColor, int type, int sx1, int sy1, int sx2, int sy2) { - BufferedImage bimg = new BufferedImage(sx2-sx1, sy2-sy1, type); - Graphics2D g2d = bimg.createGraphics(); + final int width = sx2 - sx1; + final int height = sy2 - sy1; + final BufferedImage bimg = new BufferedImage(width, height, type); + final SunGraphics2D g2d = (SunGraphics2D) bimg.createGraphics(); g2d.setComposite(AlphaComposite.Src); if (bgColor != null) { g2d.setColor(bgColor); - g2d.fillRect(0, 0, sx2-sx1, sy2-sy1); + g2d.fillRect(0, 0, width, height); g2d.setComposite(AlphaComposite.SrcOver); } - g2d.drawImage(img, -sx1, -sy1, null); + g2d.copyImage(img, 0, 0, sx1, sy1, width, height, null, null); g2d.dispose(); return bimg; } @@ -737,8 +735,9 @@ atfm.scale(m00, m11); atfm.translate(srcX-sx1, srcY-sy1); - int imgW = img.getWidth(null); - int imgH = img.getHeight(null); + final int scale = SurfaceManager.getImageScale(img); + final int imgW = img.getWidth(null) * scale; + final int imgH = img.getHeight(null) * scale; srcW += srcX; srcH += srcY; // Make sure we are not out of bounds
--- a/src/share/classes/sun/java2d/pipe/Region.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/java2d/pipe/Region.java Fri May 31 15:42:54 2013 -0700 @@ -131,6 +131,28 @@ return newv; } + /** + * Multiply the scale factor {@code sv} and the value {@code v} with + * appropriate clipping to the bounds of Integer resolution. If the answer + * would be greater than {@code Integer.MAX_VALUE} then {@code + * Integer.MAX_VALUE} is returned. If the answer would be less than {@code + * Integer.MIN_VALUE} then {@code Integer.MIN_VALUE} is returned. Otherwise + * the multiplication is returned. + */ + public static int clipScale(final int v, final double sv) { + if (sv == 1.0) { + return v; + } + final double newv = v * sv; + if (newv < Integer.MIN_VALUE) { + return Integer.MIN_VALUE; + } + if (newv > Integer.MAX_VALUE) { + return Integer.MAX_VALUE; + } + return (int) Math.round(newv); + } + protected Region(int lox, int loy, int hix, int hiy) { this.lox = lox; this.loy = loy; @@ -349,6 +371,79 @@ } /** + * Returns a Region object that represents the same list of rectangles as + * the current Region object, scaled by the specified sx, sy factors. + */ + public Region getScaledRegion(final double sx, final double sy) { + if (sx == 0 || sy == 0 || this == EMPTY_REGION) { + return EMPTY_REGION; + } + if ((sx == 1.0 && sy == 1.0) || (this == WHOLE_REGION)) { + return this; + } + + int tlox = clipScale(lox, sx); + int tloy = clipScale(loy, sy); + int thix = clipScale(hix, sx); + int thiy = clipScale(hiy, sy); + Region ret = new Region(tlox, tloy, thix, thiy); + int bands[] = this.bands; + if (bands != null) { + int end = endIndex; + int newbands[] = new int[end]; + int i = 0; // index for source bands + int j = 0; // index for translated newbands + int ncol; + while (i < end) { + int y1, y2; + newbands[j++] = y1 = clipScale(bands[i++], sy); + newbands[j++] = y2 = clipScale(bands[i++], sy); + newbands[j++] = ncol = bands[i++]; + int savej = j; + if (y1 < y2) { + while (--ncol >= 0) { + int x1 = clipScale(bands[i++], sx); + int x2 = clipScale(bands[i++], sx); + if (x1 < x2) { + newbands[j++] = x1; + newbands[j++] = x2; + } + } + } else { + i += ncol * 2; + } + // Did we get any non-empty bands in this row? + if (j > savej) { + newbands[savej-1] = (j - savej) / 2; + } else { + j = savej - 3; + } + } + if (j <= 5) { + if (j < 5) { + // No rows or bands were generated... + ret.lox = ret.loy = ret.hix = ret.hiy = 0; + } else { + // Only generated one single rect in the end... + ret.loy = newbands[0]; + ret.hiy = newbands[1]; + ret.lox = newbands[3]; + ret.hix = newbands[4]; + } + // ret.endIndex and ret.bands were never initialized... + // ret.endIndex = 0; + // ret.newbands = null; + } else { + // Generated multiple bands and/or multiple rows... + ret.endIndex = j; + ret.bands = newbands; + } + } + return ret; + } + + + /** * Returns a Region object that represents the same list of * rectangles as the current Region object, translated by * the specified dx, dy translation factors.
--- a/src/share/classes/sun/management/Agent.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/management/Agent.java Fri May 31 15:42:54 2013 -0700 @@ -82,7 +82,7 @@ private static final String SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME = "sun.management.snmp.AdaptorBootstrap"; - private static final String JDP_DEFAULT_ADDRESS = "239.255.255.225"; + private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178"; private static final int JDP_DEFAULT_PORT = 7095; // The only active agent allowed
--- a/src/share/classes/sun/management/jdp/package-info.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/management/jdp/package-info.java Fri May 31 15:42:54 2013 -0700 @@ -60,7 +60,7 @@ * * - `INSTANCE_NAME` -- The user-provided name of the running instance * - * The protocol sends packets to 239.255.255.225:7095 by default. + * The protocol sends packets to 224.0.23.178:7095 by default. * * The protocol uses system properties to control it's behaviour: * - `com.sun.management.jdp.port` -- override default port
--- a/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Fri May 31 15:42:54 2013 -0700 @@ -77,7 +77,7 @@ private final String tabName; private long lastModified; - private int kt_vno; + private int kt_vno = KRB5_KT_VNO; private Vector<KeyTabEntry> entries = new Vector<>();
--- a/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java Fri May 31 15:42:54 2013 -0700 @@ -38,8 +38,27 @@ import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; -import java.security.cert.*; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateRevokedException; +import java.security.cert.CertPathBuilder; +import java.security.cert.CertPathBuilderException; +import java.security.cert.CertPathValidatorException; import java.security.cert.CertPathValidatorException.BasicReason; +import java.security.cert.CertStore; +import java.security.cert.CollectionCertStoreParameters; +import java.security.cert.CRLException; +import java.security.cert.CRLReason; +import java.security.cert.PKIXBuilderParameters; +import java.security.cert.PKIXCertPathBuilderResult; +import java.security.cert.PKIXCertPathChecker; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.security.cert.X509CertSelector; +import java.security.cert.X509CRL; +import java.security.cert.X509CRLEntry; +import java.security.cert.X509CRLSelector; import java.security.interfaces.DSAPublicKey; import javax.security.auth.x500.X500Principal; import sun.security.util.Debug;
--- a/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/security/provider/certpath/OCSPChecker.java Fri May 31 15:42:54 2013 -0700 @@ -31,8 +31,19 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.Security; -import java.security.cert.*; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateRevokedException; +import java.security.cert.CertPath; +import java.security.cert.CertPathValidatorException; import java.security.cert.CertPathValidatorException.BasicReason; +import java.security.cert.CertStore; +import java.security.cert.CertStoreException; +import java.security.cert.PKIXCertPathChecker; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.security.cert.X509CertSelector; import java.net.URI; import java.net.URISyntaxException; import javax.security.auth.x500.X500Principal;
--- a/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/security/provider/certpath/OCSPResponse.java Fri May 31 15:42:54 2013 -0700 @@ -553,7 +553,7 @@ try { Signature respSignature = Signature.getInstance(sigAlgId.getName()); - respSignature.initVerify(cert); + respSignature.initVerify(cert.getPublicKey()); respSignature.update(responseData); if (respSignature.verify(signBytes)) {
--- a/src/share/classes/sun/tools/jconsole/AboutDialog.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/tools/jconsole/AboutDialog.java Fri May 31 15:42:54 2013 -0700 @@ -34,6 +34,7 @@ import javax.swing.border.*; import javax.swing.event.*; +import static sun.misc.Version.jdkMinorVersion; import static java.awt.BorderLayout.*; import static sun.tools.jconsole.Utilities.*; @@ -73,7 +74,7 @@ String jConsoleVersion = Version.getVersion(); String vmName = System.getProperty("java.vm.name"); String vmVersion = System.getProperty("java.vm.version"); - String urlStr = Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL; + String urlStr = getOnlineDocUrl(); if (isBrowseSupported()) { urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; } @@ -86,8 +87,7 @@ "<html><font color=#"+ colorStr + ">" + Resources.format(Messages.HELP_ABOUT_DIALOG_JCONSOLE_VERSION, jConsoleVersion) + "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_JAVA_VERSION, (vmName +", "+ vmVersion)) + - "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK, urlStr) + - "</html>"); + "<p>" + urlStr + "</html>"); helpLink.setOpaque(false); helpLink.setEditable(false); helpLink.setForeground(textColor); @@ -153,7 +153,7 @@ } static void browseUserGuide(JConsole jConsole) { - getAboutDialog(jConsole).browse(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL); + getAboutDialog(jConsole).browse(getOnlineDocUrl()); } static boolean isBrowseSupported() { @@ -182,6 +182,12 @@ }; } + private static String getOnlineDocUrl() { + String version = Integer.toString(jdkMinorVersion()); + return Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL, + version); + } + private static class TPanel extends JPanel { TPanel(int hgap, int vgap) { super(new BorderLayout(hgap, vgap));
--- a/src/share/classes/sun/tools/jconsole/VMPanel.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/tools/jconsole/VMPanel.java Fri May 31 15:42:54 2013 -0700 @@ -55,6 +55,7 @@ private VMInternalFrame vmIF = null; private static ArrayList<TabInfo> tabInfos = new ArrayList<TabInfo>(); private boolean wasConnected = false; + private boolean userDisconnected = false; // The everConnected flag keeps track of whether the window can be // closed if the user clicks Cancel after a failed connection attempt. @@ -125,6 +126,7 @@ if (connectedIconBounds != null && (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && connectedIconBounds.contains(e.getPoint())) { if (isConnected()) { + userDisconnected = true; disconnect(); wasConnected = false; } else { @@ -452,6 +454,11 @@ private void vmPanelDied() { disconnect(); + if (userDisconnected) { + userDisconnected = false; + return; + } + JOptionPane optionPane; String msgTitle, msgExplanation, buttonStr;
--- a/src/share/classes/sun/tools/jconsole/resources/JConsoleResources.java Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,462 +0,0 @@ -/* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.tools.jconsole.resources; - -import java.util.*; - -import static java.awt.event.KeyEvent.*; - -/** - * <p> This class represents the <code>ResourceBundle</code> - * for the following package(s): - * - * <ol> - * <li> sun.tools.jconsole - * </ol> - * - * <P> - * Subclasses must override <code>getContents0</code> and provide an array, - * where each item in the array consists of a <code>String</code> key, - * and either a <code>String</code> value associated with that key, - * or if the keys ends with ".mnemonic", an element - * representing a mnemomic keycode <code>int</code> or <code>char</code>. - */ -public class JConsoleResources extends ListResourceBundle { - - /** - * Returns the contents of this <code>ResourceBundle</code>. - * - * <p> - * - * @return the contents of this <code>ResourceBundle</code>. - */ - protected Object[][] getContents0() { - Object[][] temp = new Object[][] { - // NOTE 1: The value strings in this file containing "{0}" are - // processed by the java.text.MessageFormat class. Any - // single quotes appearing in these strings need to be - // doubled up. - // - // NOTE 2: To make working with this file a bit easier, please - // maintain these messages in ASCII sorted order by - // message key. - // - // LOCALIZE THIS - {" 1 day"," 1 day"}, - {" 1 hour"," 1 hour"}, - {" 1 min"," 1 min"}, - {" 1 month"," 1 month"}, - {" 1 year"," 1 year"}, - {" 2 hours"," 2 hours"}, - {" 3 hours"," 3 hours"}, - {" 3 months"," 3 months"}, - {" 5 min"," 5 min"}, - {" 6 hours"," 6 hours"}, - {" 6 months"," 6 months"}, - {" 7 days"," 7 days"}, - {"10 min","10 min"}, - {"12 hours","12 hours"}, - {"30 min","30 min"}, - {"<","<"}, - {"<<","<<"}, - {">",">"}, - {"ACTION","ACTION"}, - {"ACTION_INFO","ACTION_INFO"}, - {"All","All"}, - {"Apply","Apply"}, - {"Architecture","Architecture"}, - {"Array, OpenType", "Array, OpenType"}, - {"Array, OpenType, Numeric value viewer","Array, OpenType, Numeric value viewer"}, - {"Attribute","Attribute"}, - {"Attribute value","Attribute value"}, - {"Attribute values","Attribute values"}, - {"Attributes","Attributes"}, - {"Blank", "Blank"}, - {"BlockedCount WaitedCount", - "Total blocked: {0} Total waited: {1}\n"}, - {"Boot class path","Boot class path"}, - {"BorderedComponent.moreOrLessButton.toolTip", "Toggle to show more or less information"}, - {"CPU Usage","CPU Usage"}, - {"CPUUsageFormat","CPU Usage: {0}%"}, - {"Cancel","Cancel"}, - {"Cascade", "Cascade"}, - {"Cascade.mnemonic", 'C'}, - {"Chart:", "Chart:"}, - {"Chart:.mnemonic", 'C'}, - {"Class path","Class path"}, - {"Class","Class"}, - {"ClassName","ClassName"}, - {"ClassTab.infoLabelFormat", "<html>Loaded: {0} Unloaded: {1} Total: {2}</html>"}, - {"ClassTab.loadedClassesPlotter.accessibleName", "Chart for Loaded Classes."}, - {"Classes","Classes"}, - {"Close","Close"}, - {"Column.Name", "Name"}, - {"Column.PID", "PID"}, - {"Committed memory","Committed memory"}, - {"Committed virtual memory","Committed virtual memory"}, - {"Committed", "Committed"}, - {"Compiler","Compiler"}, - {"CompositeData","CompositeData"}, - {"Config","Config"}, - {"Connect", "Connect"}, - {"Connect.mnemonic", 'C'}, - {"Connect...","Connect..."}, - {"ConnectDialog.connectButton.toolTip", "Connect to Java Virtual Machine"}, - {"ConnectDialog.accessibleDescription", "Dialog for making a new connection to a local or remote Java Virtual Machine"}, - {"ConnectDialog.masthead.accessibleName", "Masthead Graphic"}, - {"ConnectDialog.masthead.title", "New Connection"}, - {"ConnectDialog.statusBar.accessibleName", "Status Bar"}, - {"ConnectDialog.title", "JConsole: New Connection"}, - {"Connected. Click to disconnect.","Connected. Click to disconnect."}, - {"Connection failed","Connection failed"}, - {"Connection", "Connection"}, - {"Connection.mnemonic", 'C'}, - {"Connection name", "Connection name"}, - {"ConnectionName (disconnected)","{0} (disconnected)"}, - {"Constructor","Constructor"}, - {"Current classes loaded", "Current classes loaded"}, - {"Current heap size","Current heap size"}, - {"Current value","Current value: {0}"}, - {"Create", "Create"}, - {"Daemon threads","Daemon threads"}, - {"Disconnected. Click to connect.","Disconnected. Click to connect."}, - {"Double click to expand/collapse","Double click to expand/collapse"}, - {"Double click to visualize", "Double click to visualize"}, - {"Description", "Description"}, - {"Description: ", "Description: "}, - {"Descriptor", "Descriptor"}, - {"Details", "Details"}, - {"Detect Deadlock", "Detect Deadlock"}, - {"Detect Deadlock.mnemonic", 'D'}, - {"Detect Deadlock.toolTip", "Detect deadlocked threads"}, - {"Dimension is not supported:","Dimension is not supported:"}, - {"Discard chart", "Discard chart"}, - {"DurationDaysHoursMinutes","{0,choice,1#{0,number,integer} day |1.0<{0,number,integer} days }" + - "{1,choice,0<{1,number,integer} hours |1#{1,number,integer} hour |1<{1,number,integer} hours }" + - "{2,choice,0<{2,number,integer} minutes|1#{2,number,integer} minute|1.0<{2,number,integer} minutes}"}, - - {"DurationHoursMinutes","{0,choice,1#{0,number,integer} hour |1<{0,number,integer} hours }" + - "{1,choice,0<{1,number,integer} minutes|1#{1,number,integer} minute|1.0<{1,number,integer} minutes}"}, - - {"DurationMinutes","{0,choice,1#{0,number,integer} minute|1.0<{0,number,integer} minutes}"}, - {"DurationSeconds","{0} seconds"}, - {"Empty array", "Empty array"}, - {"Empty opentype viewer", "Empty opentype viewer"}, - {"Error","Error"}, - {"Error: MBeans already exist","Error: MBeans already exist"}, - {"Error: MBeans do not exist","Error: MBeans do not exist"}, - {"Error:","Error:"}, - {"Event","Event"}, - {"Exit", "Exit"}, - {"Exit.mnemonic", 'x'}, - {"Fail to load plugin", "Warning: Fail to load plugin: {0}"}, - {"FileChooser.fileExists.cancelOption", "Cancel"}, - {"FileChooser.fileExists.message", "<html><center>File already exists:<br>{0}<br>Do you want to replace it?"}, - {"FileChooser.fileExists.okOption", "Replace"}, - {"FileChooser.fileExists.title", "File Exists"}, - {"FileChooser.savedFile", "<html>Saved to file:<br>{0}<br>({1} bytes)"}, - {"FileChooser.saveFailed.message", "<html><center>Save to file failed:<br>{0}<br>{1}"}, - {"FileChooser.saveFailed.title", "Save Failed"}, - {"Free physical memory","Free physical memory"}, - {"Free swap space","Free swap space"}, - {"Garbage collector","Garbage collector"}, - {"GTK","GTK"}, - {"GcInfo","Name = ''{0}'', Collections = {1,choice,-1#Unavailable|0#{1,number,integer}}, Total time spent = {2}"}, - {"GC time","GC time"}, - {"GC time details","{0} on {1} ({2} collections)"}, - {"Heap Memory Usage","Heap Memory Usage"}, - {"Heap", "Heap"}, - {"Help.AboutDialog.accessibleDescription", "Dialog containing information about JConsole and JDK versions"}, - {"Help.AboutDialog.jConsoleVersion", "JConsole version:<br>{0}"}, - {"Help.AboutDialog.javaVersion", "Java VM version:<br>{0}"}, - {"Help.AboutDialog.masthead.accessibleName", "Masthead Graphic"}, - {"Help.AboutDialog.masthead.title", "About JConsole"}, - {"Help.AboutDialog.title", "JConsole: About"}, - {"Help.AboutDialog.userGuideLink", "JConsole User Guide:<br>{0}"}, - {"Help.AboutDialog.userGuideLink.mnemonic", 'U'}, - {"Help.AboutDialog.userGuideLink.url", "http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"}, - {"HelpMenu.About.title", "About JConsole"}, - {"HelpMenu.About.title.mnemonic", 'A'}, - {"HelpMenu.UserGuide.title", "Online User Guide"}, - {"HelpMenu.UserGuide.title.mnemonic", 'U'}, - {"HelpMenu.title", "Help"}, - {"HelpMenu.title.mnemonic", 'H'}, - {"Hotspot MBeans...", "Hotspot MBeans..."}, - {"Hotspot MBeans....mnemonic", 'H'}, - {"Hotspot MBeans.dialog.accessibleDescription", "Dialog for managing Hotspot MBeans"}, - {"Impact","Impact"}, - {"Info","Info"}, - {"INFO","INFO"}, - {"Invalid plugin path", "Warning: Invalid plugin path: {0}"}, - {"Invalid URL", "Invalid URL: {0}"}, - {"Is","Is"}, - {"Java Monitoring & Management Console", "Java Monitoring & Management Console"}, - {"JConsole: ","JConsole: {0}"}, - {"JConsole version","JConsole version \"{0}\""}, - {"JConsole.accessibleDescription", "Java Monitoring & Management Console"}, - {"JIT compiler","JIT compiler"}, - {"Java Virtual Machine","Java Virtual Machine"}, - {"Java","Java"}, - {"Library path","Library path"}, - {"Listeners","Listeners"}, - {"Live Threads","Live threads"}, - {"Loaded", "Loaded"}, - {"Local Process:", "Local Process:"}, - {"Local Process:.mnemonic", 'L'}, - {"Look and Feel","Look and Feel"}, - {"Masthead.font", "Dialog-PLAIN-25"}, - {"Management Not Enabled","<b>Note</b>: The management agent is not enabled on this process."}, - {"Management Will Be Enabled","<b>Note</b>: The management agent will be enabled on this process."}, - {"MBeanAttributeInfo","MBeanAttributeInfo"}, - {"MBeanInfo","MBeanInfo"}, - {"MBeanNotificationInfo","MBeanNotificationInfo"}, - {"MBeanOperationInfo","MBeanOperationInfo"}, - {"MBeans","MBeans"}, - {"MBeansTab.clearNotificationsButton", "Clear"}, - {"MBeansTab.clearNotificationsButton.mnemonic", 'C'}, - {"MBeansTab.clearNotificationsButton.toolTip", "Clear notifications"}, - {"MBeansTab.compositeNavigationMultiple", "Composite Navigation {0}/{1}"}, - {"MBeansTab.compositeNavigationSingle", "Composite Navigation"}, - {"MBeansTab.refreshAttributesButton", "Refresh"}, - {"MBeansTab.refreshAttributesButton.mnemonic", 'R'}, - {"MBeansTab.refreshAttributesButton.toolTip", "Refresh attributes"}, - {"MBeansTab.subscribeNotificationsButton", "Subscribe"}, - {"MBeansTab.subscribeNotificationsButton.mnemonic", 'S'}, - {"MBeansTab.subscribeNotificationsButton.toolTip", "Start listening for notifications"}, - {"MBeansTab.tabularNavigationMultiple", "Tabular Navigation {0}/{1}"}, - {"MBeansTab.tabularNavigationSingle", "Tabular Navigation"}, - {"MBeansTab.unsubscribeNotificationsButton", "Unsubscribe"}, - {"MBeansTab.unsubscribeNotificationsButton.mnemonic", 'U'}, - {"MBeansTab.unsubscribeNotificationsButton.toolTip", "Stop listening for notifications"}, - {"Manage Hotspot MBeans in: ", "Manage Hotspot MBeans in: "}, - {"Max","Max"}, - {"Maximum heap size","Maximum heap size"}, - {"Memory","Memory"}, - {"MemoryPoolLabel", "Memory Pool \"{0}\""}, - {"MemoryTab.heapPlotter.accessibleName", "Memory usage chart for heap."}, - {"MemoryTab.infoLabelFormat", "<html>Used: {0} Committed: {1} Max: {2}</html>"}, - {"MemoryTab.nonHeapPlotter.accessibleName", "Memory usage chart for non heap."}, - {"MemoryTab.poolChart.aboveThreshold", "which is above the threshold of {0}.\n"}, - {"MemoryTab.poolChart.accessibleName", "Memory Pool Usage Chart."}, - {"MemoryTab.poolChart.belowThreshold", "which is below the threshold of {0}.\n"}, - {"MemoryTab.poolPlotter.accessibleName", "Memory usage chart for {0}."}, - {"Message","Message"}, - {"Method successfully invoked", "Method successfully invoked"}, - {"Minimize All", "Minimize All"}, - {"Minimize All.mnemonic", 'M'}, - {"Minus Version", "This is {0} version {1}"}, - {"Monitor locked", - " - locked {0}\n"}, - {"Motif","Motif"}, - {"Name Build and Mode","{0} (build {1}, {2})"}, - {"Name and Build","{0} (build {1})"}, - {"Name","Name"}, - {"Name: ","Name: "}, - {"Name State", - "Name: {0}\n" + - "State: {1}\n"}, - {"Name State LockName", - "Name: {0}\n" + - "State: {1} on {2}\n"}, - {"Name State LockName LockOwner", - "Name: {0}\n" + - "State: {1} on {2} owned by: {3}\n"}, - {"New Connection...", "New Connection..."}, - {"New Connection....mnemonic", 'N'}, - {"New value applied","New value applied"}, - {"No attribute selected","No attribute selected"}, - {"No deadlock detected","No deadlock detected"}, - {"No value selected","No value selected"}, - {"Non-Heap Memory Usage","Non-Heap Memory Usage"}, - {"Non-Heap", "Non-Heap"}, - {"Not Yet Implemented","Not Yet Implemented"}, - {"Not a valid event broadcaster", "Not a valid event broadcaster"}, - {"Notification","Notification"}, - {"Notification buffer","Notification buffer"}, - {"Notifications","Notifications"}, - {"NotifTypes", "NotifTypes"}, - {"Number of Threads","Number of Threads"}, - {"Number of Loaded Classes","Number of Loaded Classes"}, - {"Number of processors","Number of processors"}, - {"ObjectName","ObjectName"}, - {"Operating System","Operating System"}, - {"Operation","Operation"}, - {"Operation invocation","Operation invocation"}, - {"Operation return value", "Operation return value"}, - {"Operations","Operations"}, - {"Overview","Overview"}, - {"OverviewPanel.plotter.accessibleName", "Chart for {0}."}, - {"Parameter", "Parameter"}, - {"Password: ", "Password: "}, - {"Password: .mnemonic", 'P'}, - {"Password.accessibleName", "Password"}, - {"Peak","Peak"}, - {"Perform GC", "Perform GC"}, - {"Perform GC.mnemonic", 'G'}, - {"Perform GC.toolTip", "Request Garbage Collection"}, - {"Plotter.accessibleName", "Chart"}, - {"Plotter.accessibleName.keyAndValue", "{0}={1}\n"}, - {"Plotter.accessibleName.noData", "No data plotted."}, - {"Plotter.saveAsMenuItem", "Save data as..."}, - {"Plotter.saveAsMenuItem.mnemonic", 'a'}, - {"Plotter.timeRangeMenu", "Time Range"}, - {"Plotter.timeRangeMenu.mnemonic", 'T'}, - {"Problem adding listener","Problem adding listener"}, - {"Problem displaying MBean", "Problem displaying MBean"}, - {"Problem invoking", "Problem invoking"}, - {"Problem removing listener","Problem removing listener"}, - {"Problem setting attribute","Problem setting attribute"}, - {"Process CPU time","Process CPU time"}, - {"R/W","R/W"}, - {"Readable","Readable"}, - {"Received","Received"}, - {"Reconnect","Reconnect"}, - {"Remote Process:", "Remote Process:"}, - {"Remote Process:.mnemonic", 'R'}, - {"Remote Process.textField.accessibleName", "Remote Process"}, - {"Remove","Remove"}, - {"Restore All", "Restore All"}, - {"Restore All.mnemonic", 'R'}, - {"Return value", "Return value"}, - {"ReturnType", "ReturnType"}, - {"SeqNum","SeqNum"}, - {"Size Bytes", "{0,number,integer} bytes"}, - {"Size Gb","{0} Gb"}, - {"Size Kb","{0} Kb"}, - {"Size Mb","{0} Mb"}, - {"Source","Source"}, - {"Stack trace", - "\nStack trace: \n"}, - {"Success:","Success:"}, - // Note: SummaryTab.headerDateTimeFormat can be one the following: - // 1. A combination of two styles for date and time, using the - // constants from class DateFormat: SHORT, MEDIUM, LONG, FULL. - // Example: "MEDIUM,MEDIUM" or "FULL,SHORT" - // 2. An explicit string pattern used for creating an instance - // of the class SimpleDateFormat. - // Example: "yyyy-MM-dd HH:mm:ss" or "M/d/yyyy h:mm:ss a" - {"SummaryTab.headerDateTimeFormat", "FULL,FULL"}, - {"SummaryTab.pendingFinalization.label", "Pending finalization"}, - {"SummaryTab.pendingFinalization.value", "{0} objects"}, - {"SummaryTab.tabName", "VM Summary"}, - {"SummaryTab.vmVersion","{0} version {1}"}, - {"TabularData are not supported", "TabularData are not supported"}, - {"Threads","Threads"}, - {"ThreadTab.infoLabelFormat", "<html>Live: {0} Peak: {1} Total: {2}</html>"}, - {"ThreadTab.threadInfo.accessibleName", "Thread Information"}, - {"ThreadTab.threadPlotter.accessibleName", "Chart for number of threads."}, - {"Threshold","Threshold"}, - {"Tile", "Tile"}, - {"Tile.mnemonic", 'T'}, - {"Time Range:", "Time Range:"}, - {"Time Range:.mnemonic", 'T'}, - {"Time", "Time"}, - {"TimeStamp","TimeStamp"}, - {"Total Loaded", "Total Loaded"}, - {"Total classes loaded","Total classes loaded"}, - {"Total classes unloaded","Total classes unloaded"}, - {"Total compile time","Total compile time"}, - {"Total physical memory","Total physical memory"}, - {"Total threads started","Total threads started"}, - {"Total swap space","Total swap space"}, - {"Type","Type"}, - {"Unavailable","Unavailable"}, - {"UNKNOWN","UNKNOWN"}, - {"Unknown Host","Unknown Host: {0}"}, - {"Unregister", "Unregister"}, - {"Uptime","Uptime"}, - {"Uptime: ","Uptime: "}, - {"Usage Threshold","Usage Threshold"}, - {"remoteTF.usage","<b>Usage</b>: <hostname>:<port> OR service:jmx:<protocol>:<sap>"}, - {"Used","Used"}, - {"Username: ", "Username: "}, - {"Username: .mnemonic", 'U'}, - {"Username.accessibleName", "User Name"}, - {"UserData","UserData"}, - {"Virtual Machine","Virtual Machine"}, - {"VM arguments","VM arguments"}, - {"VM","VM"}, - {"VMInternalFrame.accessibleDescription", "Internal frame for monitoring a Java Virtual Machine"}, - {"Value","Value"}, - {"Vendor", "Vendor"}, - {"Verbose Output","Verbose Output"}, - {"Verbose Output.toolTip", "Enable verbose output for class loading system"}, - {"View value", "View value"}, - {"View","View"}, - {"Window", "Window"}, - {"Window.mnemonic", 'W'}, - {"Windows","Windows"}, - {"Writable","Writable"}, - {"You cannot drop a class here", "You cannot drop a class here"}, - {"collapse", "collapse"}, - {"connectionFailed1","Connection Failed: Retry?"}, - {"connectionFailed2","The connection to {0} did not succeed.<br>" + - "Would you like to try again?"}, - {"connectionLost1","Connection Lost: Reconnect?"}, - {"connectionLost2","The connection to {0} has been lost " + - "because the remote process has been terminated.<br>" + - "Would you like to reconnect?"}, - {"connectingTo1","Connecting to {0}"}, - {"connectingTo2","You are currently being connected to {0}.<br>" + - "This will take a few moments."}, - {"deadlockAllTab","All"}, - {"deadlockTab","Deadlock"}, - {"deadlockTabN","Deadlock {0}"}, - {"expand", "expand"}, - {"kbytes","{0} kbytes"}, - {"operation","operation"}, - {"plot", "plot"}, - {"visualize","visualize"}, - {"zz usage text", - "Usage: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n" + - " -interval Set the update interval to n seconds (default is 4 seconds)\n" + - " -notile Do not tile windows initially (for two or more connections)\n" + - " -pluginpath Specify the path that jconsole uses to look up the plugins\n" + - " -version Print program version\n\n" + - " connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n" + - " pid The process id of a target process\n" + - " host A remote host name or IP address\n" + - " port The port number for the remote connection\n\n" + - " -J Specify the input arguments to the Java virtual machine\n" + - " on which jconsole is running"}, - // END OF MATERIAL TO LOCALIZE - }; - - String ls = System.getProperty("line.separator"); - for(int i=0;i<temp.length;i++) { - if (temp[i][1] instanceof String){ - temp[i][1] = temp[i][1].toString().replaceAll("\n",ls); - } - } - - return temp; - - } - - public synchronized Object[][] getContents() { - return getContents0(); - } -}
--- a/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_ja.java Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.tools.jconsole.resources; - -import java.util.*; - -import static java.awt.event.KeyEvent.*; - -/** - * <p> This class represents the <code>ResourceBundle</code> - * for the following package(s): - * - * <ol> - * <li> sun.tools.jconsole - * </ol> - * - * <P> - * Subclasses must override <code>getContents0</code> and provide an array, - * where each item in the array consists of a <code>String</code> key, - * and either a <code>String</code> value associated with that key, - * or if the keys ends with ".mnemonic", an element - * representing a mnemomic keycode <code>int</code> or <code>char</code>. - */ -public class JConsoleResources_ja extends JConsoleResources { - - /** - * Returns the contents of this <code>ResourceBundle</code>. - * - * <p> - * - * @return the contents of this <code>ResourceBundle</code>. - */ - protected Object[][] getContents0() { - Object[][] temp = new Object[][] { - // NOTE 1: The value strings in this file containing "{0}" are - // processed by the java.text.MessageFormat class. Any - // single quotes appearing in these strings need to be - // doubled up. - // - // NOTE 2: To make working with this file a bit easier, please - // maintain these messages in ASCII sorted order by - // message key. - // - // LOCALIZE THIS - {" 1 day"," 1\u65E5"}, - {" 1 hour"," 1\u6642\u9593"}, - {" 1 min"," 1\u5206"}, - {" 1 month"," 1\u304B\u6708"}, - {" 1 year"," 1\u5E74"}, - {" 2 hours"," 2\u6642\u9593"}, - {" 3 hours"," 3\u6642\u9593"}, - {" 3 months"," 3\u304B\u6708"}, - {" 5 min"," 5\u5206"}, - {" 6 hours"," 6\u6642\u9593"}, - {" 6 months"," 6\u304B\u6708"}, - {" 7 days"," 7\u65E5"}, - {"10 min","10\u5206"}, - {"12 hours","12\u6642\u9593"}, - {"30 min","30\u5206"}, - {"<","<"}, - {"<<","<<"}, - {">",">"}, - {"ACTION","ACTION"}, - {"ACTION_INFO","ACTION_INFO"}, - {"All","\u3059\u3079\u3066"}, - {"Apply","\u9069\u7528"}, - {"Architecture","\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3"}, - {"Array, OpenType", "\u914D\u5217\u3001OpenType"}, - {"Array, OpenType, Numeric value viewer","\u914D\u5217\u3001OpenType\u3001\u6570\u5024\u30D3\u30E5\u30FC\u30A2"}, - {"Attribute","\u5C5E\u6027"}, - {"Attribute value","\u5C5E\u6027\u5024"}, - {"Attribute values","\u5C5E\u6027\u5024"}, - {"Attributes","\u5C5E\u6027"}, - {"Blank", "\u30D6\u30E9\u30F3\u30AF"}, - {"BlockedCount WaitedCount", - "\u30D6\u30ED\u30C3\u30AF\u6E08\u5408\u8A08: {0} \u5F85\u6A5F\u6E08\u5408\u8A08: {1}\n"}, - {"Boot class path","\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9"}, - {"BorderedComponent.moreOrLessButton.toolTip", "\u8868\u793A\u3059\u308B\u60C5\u5831\u91CF\u3092\u5897\u6E1B\u3059\u308B\u30C8\u30B0\u30EB"}, - {"CPU Usage","CPU\u4F7F\u7528\u7387"}, - {"CPUUsageFormat","CPU\u4F7F\u7528\u7387: {0}%"}, - {"Cancel","\u53D6\u6D88"}, - {"Cascade", "\u91CD\u306D\u3066\u8868\u793A(C)"}, - {"Cascade.mnemonic", 'C'}, - {"Chart:", "\u30C1\u30E3\u30FC\u30C8(C):"}, - {"Chart:.mnemonic", 'C'}, - {"Class path","\u30AF\u30E9\u30B9\u30D1\u30B9"}, - {"Class","\u30AF\u30E9\u30B9"}, - {"ClassName","ClassName"}, - {"ClassTab.infoLabelFormat", "<html>\u30ED\u30FC\u30C9\u6E08: {0} \u672A\u30ED\u30FC\u30C9: {1} \u5408\u8A08: {2}</html>"}, - {"ClassTab.loadedClassesPlotter.accessibleName", "\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u306E\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"Classes","\u30AF\u30E9\u30B9"}, - {"Close","\u9589\u3058\u308B"}, - {"Column.Name", "\u540D\u524D"}, - {"Column.PID", "PID"}, - {"Committed memory","\u30B3\u30DF\u30C3\u30C8\u6E08\u30E1\u30E2\u30EA\u30FC"}, - {"Committed virtual memory","\u30B3\u30DF\u30C3\u30C8\u6E08\u4EEE\u60F3\u30E1\u30E2\u30EA\u30FC"}, - {"Committed", "\u30B3\u30DF\u30C3\u30C8\u6E08"}, - {"Compiler","\u30B3\u30F3\u30D1\u30A4\u30E9"}, - {"CompositeData","CompositeData"}, - {"Config","\u69CB\u6210"}, - {"Connect", "\u63A5\u7D9A(C)"}, - {"Connect.mnemonic", 'C'}, - {"Connect...","\u63A5\u7D9A..."}, - {"ConnectDialog.connectButton.toolTip", "Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306B\u63A5\u7D9A"}, - {"ConnectDialog.accessibleDescription", "\u30ED\u30FC\u30AB\u30EB\u307E\u305F\u306F\u30EA\u30E2\u30FC\u30C8\u306EJava\u4EEE\u60F3\u30DE\u30B7\u30F3\u3078\u306E\u65B0\u898F\u63A5\u7D9A\u3092\u884C\u3046\u30C0\u30A4\u30A2\u30ED\u30B0"}, - {"ConnectDialog.masthead.accessibleName", "\u30DE\u30B9\u30C8\u30D8\u30C3\u30C9\u56F3\u5F62"}, - {"ConnectDialog.masthead.title", "\u65B0\u898F\u63A5\u7D9A"}, - {"ConnectDialog.statusBar.accessibleName", "\u30B9\u30C6\u30FC\u30BF\u30B9\u30FB\u30D0\u30FC"}, - {"ConnectDialog.title", "JConsole: \u65B0\u898F\u63A5\u7D9A"}, - {"Connected. Click to disconnect.","\u63A5\u7D9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u5207\u65AD\u3057\u307E\u3059\u3002"}, - {"Connection failed","\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F"}, - {"Connection", "\u63A5\u7D9A(C)"}, - {"Connection.mnemonic", 'C'}, - {"Connection name", "\u63A5\u7D9A\u540D"}, - {"ConnectionName (disconnected)","{0} (\u5207\u65AD\u6E08)"}, - {"Constructor","\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF"}, - {"Current classes loaded", "\u30ED\u30FC\u30C9\u6E08\u306E\u73FE\u5728\u306E\u30AF\u30E9\u30B9"}, - {"Current heap size","\u73FE\u5728\u306E\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA"}, - {"Current value","\u73FE\u5728\u5024: {0}"}, - {"Create", "\u4F5C\u6210"}, - {"Daemon threads","\u30C7\u30FC\u30E2\u30F3\u30FB\u30B9\u30EC\u30C3\u30C9"}, - {"Disconnected. Click to connect.","\u5207\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u63A5\u7D9A\u3057\u307E\u3059\u3002"}, - {"Double click to expand/collapse","\u5C55\u958B\u307E\u305F\u306F\u7E2E\u5C0F\u3059\u308B\u306B\u306F\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044"}, - {"Double click to visualize", "\u8996\u899A\u5316\u3059\u308B\u306B\u306F\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044"}, - {"Description", "\u8AAC\u660E"}, - {"Description: ", "\u8AAC\u660E: "}, - {"Descriptor", "\u8A18\u8FF0\u5B50"}, - {"Details", "\u8A73\u7D30"}, - {"Detect Deadlock", "\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u306E\u691C\u51FA(D)"}, - {"Detect Deadlock.mnemonic", 'D'}, - {"Detect Deadlock.toolTip", "\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u6E08\u30B9\u30EC\u30C3\u30C9\u306E\u691C\u51FA"}, - {"Dimension is not supported:","\u6B21\u5143\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093:"}, - {"Discard chart", "\u30C1\u30E3\u30FC\u30C8\u306E\u7834\u68C4"}, - {"DurationDaysHoursMinutes","{0,choice,1#{0,number,integer}\u65E5|1.0<{0,number,integer}\u65E5}{1,choice,0<{1,number,integer}\u6642\u9593|1#{1,number,integer}\u6642\u9593|1<{1,number,integer}\u6642\u9593}{2,choice,0<{2,number,integer}\u5206|1#{2,number,integer}\u5206|1.0<{2,number,integer}\u5206}"}, - - {"DurationHoursMinutes","{0,choice,1#{0,number,integer}\u6642\u9593|1<{0,number,integer}\u6642\u9593}{1,choice,0<{1,number,integer}\u5206|1#{1,number,integer}\u5206|1.0<{1,number,integer}\u5206}"}, - - {"DurationMinutes","{0,choice,1#{0,number,integer}\u5206|1.0<{0,number,integer}\u5206}"}, - {"DurationSeconds","{0}\u79D2"}, - {"Empty array", "\u7A7A\u306E\u914D\u5217"}, - {"Empty opentype viewer", "\u7A7A\u306Eopentype\u30D3\u30E5\u30FC\u30A2"}, - {"Error","\u30A8\u30E9\u30FC"}, - {"Error: MBeans already exist","\u30A8\u30E9\u30FC: MBeans\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059"}, - {"Error: MBeans do not exist","\u30A8\u30E9\u30FC: MBeans\u306F\u5B58\u5728\u3057\u307E\u305B\u3093"}, - {"Error:","\u30A8\u30E9\u30FC:"}, - {"Event","\u30A4\u30D9\u30F3\u30C8"}, - {"Exit", "\u7D42\u4E86(X)"}, - {"Exit.mnemonic", 'X'}, - {"Fail to load plugin", "\u8B66\u544A: \u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F: {0}"}, - {"FileChooser.fileExists.cancelOption", "\u53D6\u6D88"}, - {"FileChooser.fileExists.message", "<html><center>\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059:<br>{0}<br>\u7F6E\u63DB\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\u3002"}, - {"FileChooser.fileExists.okOption", "\u7F6E\u63DB"}, - {"FileChooser.fileExists.title", "\u30D5\u30A1\u30A4\u30EB\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u3059"}, - {"FileChooser.savedFile", "<html>\u30D5\u30A1\u30A4\u30EB\u306B\u4FDD\u5B58\u3057\u307E\u3057\u305F:<br>{0}<br>({1}\u30D0\u30A4\u30C8)"}, - {"FileChooser.saveFailed.message", "<html><center>\u30D5\u30A1\u30A4\u30EB\u3078\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F:<br>{0}<br>{1}"}, - {"FileChooser.saveFailed.title", "\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F"}, - {"Free physical memory","\u7A7A\u304D\u7269\u7406\u30E1\u30E2\u30EA\u30FC"}, - {"Free swap space","\u7A7A\u304D\u30B9\u30EF\u30C3\u30D7\u30FB\u30B9\u30DA\u30FC\u30B9"}, - {"Garbage collector","\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30BF"}, - {"GTK","GTK"}, - {"GcInfo","\u540D\u524D= ''{0}''\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3= {1,choice,-1#\u3042\u308A\u307E\u305B\u3093|0#{1,number,integer}\u500B}\u3001\u5408\u8A08\u6D88\u8CBB\u6642\u9593= {2}"}, - {"GC time","GC\u6642\u9593"}, - {"GC time details","{1}\u3067{0} ({2}\u500B\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3)"}, - {"Heap Memory Usage","\u30D2\u30FC\u30D7\u30FB\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387"}, - {"Heap", "\u30D2\u30FC\u30D7"}, - {"Help.AboutDialog.accessibleDescription", "JConsole\u3068JDK\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306B\u3064\u3044\u3066\u306E\u60C5\u5831\u3092\u542B\u3080\u30C0\u30A4\u30A2\u30ED\u30B0"}, - {"Help.AboutDialog.jConsoleVersion", "JConsole\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}"}, - {"Help.AboutDialog.javaVersion", "Java VM\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}"}, - {"Help.AboutDialog.masthead.accessibleName", "\u30DE\u30B9\u30C8\u30D8\u30C3\u30C9\u56F3\u5F62"}, - {"Help.AboutDialog.masthead.title", "JConsole\u306B\u3064\u3044\u3066"}, - {"Help.AboutDialog.title", "JConsole: \u8A73\u7D30"}, - {"Help.AboutDialog.userGuideLink", "JConsole\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(U):<br>{0}"}, - {"Help.AboutDialog.userGuideLink.mnemonic", 'U'}, - {"Help.AboutDialog.userGuideLink.url", "http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"}, - {"HelpMenu.About.title", "JConsole\u306B\u3064\u3044\u3066(A)"}, - {"HelpMenu.About.title.mnemonic", 'A'}, - {"HelpMenu.UserGuide.title", "\u30AA\u30F3\u30E9\u30A4\u30F3\u30FB\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9"}, - {"HelpMenu.UserGuide.title.mnemonic", 'U'}, - {"HelpMenu.title", "\u30D8\u30EB\u30D7(H)"}, - {"HelpMenu.title.mnemonic", 'H'}, - {"Hotspot MBeans...", "Hotspot MBeans(H)..."}, - {"Hotspot MBeans....mnemonic", 'H'}, - {"Hotspot MBeans.dialog.accessibleDescription", "Hotspot MBeans\u306E\u7BA1\u7406\u7528\u30C0\u30A4\u30A2\u30ED\u30B0"}, - {"Impact","\u5F71\u97FF"}, - {"Info","\u60C5\u5831"}, - {"INFO","\u60C5\u5831"}, - {"Invalid plugin path", "\u8B66\u544A: \u7121\u52B9\u306A\u30D7\u30E9\u30B0\u30A4\u30F3\u30FB\u30D1\u30B9: {0}"}, - {"Invalid URL", "\u7121\u52B9\u306AURL: {0}"}, - {"Is","\u6B21\u306B\u4E00\u81F4\u3059\u308B"}, - {"Java Monitoring & Management Console", "Java Monitoring & Management Console"}, - {"JConsole: ","JConsole: {0}"}, - {"JConsole version","JConsole\u30D0\u30FC\u30B8\u30E7\u30F3\"{0}\""}, - {"JConsole.accessibleDescription", "Java Monitoring & Management Console"}, - {"JIT compiler","JIT\u30B3\u30F3\u30D1\u30A4\u30E9"}, - {"Java Virtual Machine","Java\u4EEE\u60F3\u30DE\u30B7\u30F3"}, - {"Java","Java"}, - {"Library path","\u30E9\u30A4\u30D6\u30E9\u30EA\u30FB\u30D1\u30B9"}, - {"Listeners","\u30EA\u30B9\u30CA\u30FC"}, - {"Live Threads","\u5B9F\u884C\u4E2D\u306E\u30B9\u30EC\u30C3\u30C9"}, - {"Loaded", "\u30ED\u30FC\u30C9\u6E08"}, - {"Local Process:", "\u30ED\u30FC\u30AB\u30EB\u30FB\u30D7\u30ED\u30BB\u30B9(L):"}, - {"Local Process:.mnemonic", 'L'}, - {"Look and Feel","Look&Feel"}, - {"Masthead.font", "Dialog-PLAIN-25"}, - {"Management Not Enabled","<b>\u6CE8\u610F</b>: \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u3053\u306E\u30D7\u30ED\u30BB\u30B9\u3067\u306F\u6709\u52B9\u5316\u3055\u308C\u307E\u305B\u3093\u3002"}, - {"Management Will Be Enabled","<b>\u6CE8\u610F</b>: \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u3053\u306E\u30D7\u30ED\u30BB\u30B9\u3067\u6709\u52B9\u5316\u3055\u308C\u307E\u3059\u3002"}, - {"MBeanAttributeInfo","MBeanAttributeInfo"}, - {"MBeanInfo","MBeanInfo"}, - {"MBeanNotificationInfo","MBeanNotificationInfo"}, - {"MBeanOperationInfo","MBeanOperationInfo"}, - {"MBeans","MBeans"}, - {"MBeansTab.clearNotificationsButton", "\u30AF\u30EA\u30A2(C)"}, - {"MBeansTab.clearNotificationsButton.mnemonic", 'C'}, - {"MBeansTab.clearNotificationsButton.toolTip", "\u901A\u77E5\u306E\u30AF\u30EA\u30A2"}, - {"MBeansTab.compositeNavigationMultiple", "\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1}"}, - {"MBeansTab.compositeNavigationSingle", "\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3"}, - {"MBeansTab.refreshAttributesButton", "\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5(R)"}, - {"MBeansTab.refreshAttributesButton.mnemonic", 'R'}, - {"MBeansTab.refreshAttributesButton.toolTip", "\u5C5E\u6027\u306E\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5"}, - {"MBeansTab.subscribeNotificationsButton", "\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6(S)"}, - {"MBeansTab.subscribeNotificationsButton.mnemonic", 'S'}, - {"MBeansTab.subscribeNotificationsButton.toolTip", "\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u958B\u59CB"}, - {"MBeansTab.tabularNavigationMultiple", "\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1}"}, - {"MBeansTab.tabularNavigationSingle", "\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3"}, - {"MBeansTab.unsubscribeNotificationsButton", "\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6\u89E3\u9664(U)"}, - {"MBeansTab.unsubscribeNotificationsButton.mnemonic", 'U'}, - {"MBeansTab.unsubscribeNotificationsButton.toolTip", "\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u505C\u6B62"}, - {"Manage Hotspot MBeans in: ", "Hotspot MBeans\u306E\u7BA1\u7406: "}, - {"Max","\u6700\u5927"}, - {"Maximum heap size","\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA"}, - {"Memory","\u30E1\u30E2\u30EA\u30FC"}, - {"MemoryPoolLabel", "\u30E1\u30E2\u30EA\u30FC\u30FB\u30D7\u30FC\u30EB\"{0}\""}, - {"MemoryTab.heapPlotter.accessibleName", "\u30D2\u30FC\u30D7\u7528\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"MemoryTab.infoLabelFormat", "<html>\u4F7F\u7528\u6E08: {0} \u30B3\u30DF\u30C3\u30C8\u6E08: {1} \u6700\u5927: {2}</html>"}, - {"MemoryTab.nonHeapPlotter.accessibleName", "\u975E\u30D2\u30FC\u30D7\u7528\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"MemoryTab.poolChart.aboveThreshold", "{0}\u306E\u3057\u304D\u3044\u5024\u3088\u308A\u4E0A\u3067\u3059\u3002\n"}, - {"MemoryTab.poolChart.accessibleName", "\u30E1\u30E2\u30EA\u30FC\u30FB\u30D7\u30FC\u30EB\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"MemoryTab.poolChart.belowThreshold", "{0}\u306E\u3057\u304D\u3044\u5024\u3088\u308A\u4E0B\u3067\u3059\u3002\n"}, - {"MemoryTab.poolPlotter.accessibleName", "{0}\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"Message","\u30E1\u30C3\u30BB\u30FC\u30B8"}, - {"Method successfully invoked", "\u30E1\u30BD\u30C3\u30C9\u304C\u6B63\u5E38\u306B\u8D77\u52D5\u3055\u308C\u307E\u3057\u305F"}, - {"Minimize All", "\u3059\u3079\u3066\u6700\u5C0F\u5316(M)"}, - {"Minimize All.mnemonic", 'M'}, - {"Minus Version", "\u3053\u308C\u306F{0}\u306E\u30D0\u30FC\u30B8\u30E7\u30F3{1}\u3067\u3059"}, - {"Monitor locked", - " - \u30ED\u30C3\u30AF\u6E08{0}\n"}, - {"Motif","Motif"}, - {"Name Build and Mode","{0} (\u30D3\u30EB\u30C9{1}, {2})"}, - {"Name and Build","{0} (\u30D3\u30EB\u30C9{1})"}, - {"Name","\u540D\u524D"}, - {"Name: ","\u540D\u524D: "}, - {"Name State", - "\u540D\u524D: {0}\n\u72B6\u614B: {1}\n"}, - {"Name State LockName", - "\u540D\u524D: {0}\n\u72B6\u614B: {2}\u306E{1}\n"}, - {"Name State LockName LockOwner", - "\u540D\u524D: {0}\n\u72B6\u614B: {2}\u306E{1}\u3001\u6240\u6709\u8005: {3}\n"}, - {"New Connection...", "\u65B0\u898F\u63A5\u7D9A(N)..."}, - {"New Connection....mnemonic", 'N'}, - {"New value applied","\u9069\u7528\u3055\u308C\u305F\u65B0\u898F\u5024"}, - {"No attribute selected","\u5C5E\u6027\u304C\u9078\u629E\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F"}, - {"No deadlock detected","\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u304C\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F"}, - {"No value selected","\u5024\u304C\u9078\u629E\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F"}, - {"Non-Heap Memory Usage","\u975E\u30D2\u30FC\u30D7\u30FB\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387"}, - {"Non-Heap", "\u975E\u30D2\u30FC\u30D7"}, - {"Not Yet Implemented","\u307E\u3060\u5B9F\u88C5\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}, - {"Not a valid event broadcaster", "\u6709\u52B9\u306A\u30A4\u30D9\u30F3\u30C8\u30FB\u30D6\u30ED\u30FC\u30C9\u30AD\u30E3\u30B9\u30BF\u3067\u306F\u3042\u308A\u307E\u305B\u3093"}, - {"Notification","\u901A\u77E5"}, - {"Notification buffer","\u901A\u77E5\u30D0\u30C3\u30D5\u30A1"}, - {"Notifications","\u901A\u77E5"}, - {"NotifTypes", "NotifTypes"}, - {"Number of Threads","\u30B9\u30EC\u30C3\u30C9\u6570"}, - {"Number of Loaded Classes","\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u6570"}, - {"Number of processors","\u30D7\u30ED\u30BB\u30C3\u30B5\u6570"}, - {"ObjectName","ObjectName"}, - {"Operating System","\u30AA\u30DA\u30EC\u30FC\u30C6\u30A3\u30F3\u30B0\u30FB\u30B7\u30B9\u30C6\u30E0"}, - {"Operation","\u64CD\u4F5C"}, - {"Operation invocation","\u64CD\u4F5C\u306E\u547C\u51FA\u3057"}, - {"Operation return value", "\u64CD\u4F5C\u306E\u623B\u308A\u5024"}, - {"Operations","\u64CD\u4F5C"}, - {"Overview","\u6982\u8981"}, - {"OverviewPanel.plotter.accessibleName", "{0}\u306E\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"Parameter", "\u30D1\u30E9\u30E1\u30FC\u30BF"}, - {"Password: ", "\u30D1\u30B9\u30EF\u30FC\u30C9(P): "}, - {"Password: .mnemonic", 'P'}, - {"Password.accessibleName", "\u30D1\u30B9\u30EF\u30FC\u30C9"}, - {"Peak","\u30D4\u30FC\u30AF"}, - {"Perform GC", "GC\u306E\u5B9F\u884C"}, - {"Perform GC.mnemonic", 'G'}, - {"Perform GC.toolTip", "\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"}, - {"Plotter.accessibleName", "\u30C1\u30E3\u30FC\u30C8"}, - {"Plotter.accessibleName.keyAndValue", "{0}={1}\n"}, - {"Plotter.accessibleName.noData", "\u30C7\u30FC\u30BF\u304C\u30D7\u30ED\u30C3\u30C8\u3055\u308C\u307E\u305B\u3093\u3002"}, - {"Plotter.saveAsMenuItem", "\u540D\u524D\u3092\u4ED8\u3051\u3066\u30C7\u30FC\u30BF\u3092\u4FDD\u5B58(A)..."}, - {"Plotter.saveAsMenuItem.mnemonic", 'A'}, - {"Plotter.timeRangeMenu", "\u6642\u9593\u7BC4\u56F2(T)"}, - {"Plotter.timeRangeMenu.mnemonic", 'T'}, - {"Problem adding listener","\u30EA\u30B9\u30CA\u30FC\u8FFD\u52A0\u4E2D\u306E\u554F\u984C"}, - {"Problem displaying MBean", "MBean\u8868\u793A\u4E2D\u306E\u554F\u984C"}, - {"Problem invoking", "\u547C\u51FA\u3057\u4E2D\u306E\u554F\u984C"}, - {"Problem removing listener","\u30EA\u30B9\u30CA\u30FC\u524A\u9664\u4E2D\u306E\u554F\u984C"}, - {"Problem setting attribute","\u5C5E\u6027\u8A2D\u5B9A\u4E2D\u306E\u554F\u984C"}, - {"Process CPU time","\u30D7\u30ED\u30BB\u30B9CPU\u6642\u9593"}, - {"R/W","R/W"}, - {"Readable","\u8AAD\u53D6\u308A\u53EF\u80FD"}, - {"Received","\u53D7\u4FE1\u6E08"}, - {"Reconnect","\u518D\u63A5\u7D9A"}, - {"Remote Process:", "\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9(R):"}, - {"Remote Process:.mnemonic", 'R'}, - {"Remote Process.textField.accessibleName", "\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9"}, - {"Remove","\u524A\u9664"}, - {"Restore All", "\u3059\u3079\u3066\u5FA9\u5143(R)"}, - {"Restore All.mnemonic", 'R'}, - {"Return value", "\u623B\u308A\u5024"}, - {"ReturnType", "ReturnType"}, - {"SeqNum","SeqNum"}, - {"Size Bytes", "{0,number,integer}\u30D0\u30A4\u30C8"}, - {"Size Gb","{0} Gb"}, - {"Size Kb","{0} Kb"}, - {"Size Mb","{0} Mb"}, - {"Source","\u30BD\u30FC\u30B9"}, - {"Stack trace", - "\n\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9: \n"}, - {"Success:","\u6210\u529F:"}, - // Note: SummaryTab.headerDateTimeFormat can be one the following: - // 1. A combination of two styles for date and time, using the - // constants from class DateFormat: SHORT, MEDIUM, LONG, FULL. - // Example: "MEDIUM,MEDIUM" or "FULL,SHORT" - // 2. An explicit string pattern used for creating an instance - // of the class SimpleDateFormat. - // Example: "yyyy-MM-dd HH:mm:ss" or "M/d/yyyy h:mm:ss a" - {"SummaryTab.headerDateTimeFormat", "FULL,FULL"}, - {"SummaryTab.pendingFinalization.label", "\u30D5\u30A1\u30A4\u30CA\u30E9\u30A4\u30BA\u306E\u30DA\u30F3\u30C7\u30A3\u30F3\u30B0"}, - {"SummaryTab.pendingFinalization.value", "{0}\u500B\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8"}, - {"SummaryTab.tabName", "VM\u30B5\u30DE\u30EA\u30FC"}, - {"SummaryTab.vmVersion","{0}\u30D0\u30FC\u30B8\u30E7\u30F3{1}"}, - {"TabularData are not supported", "TabularData \u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}, - {"Threads","\u30B9\u30EC\u30C3\u30C9"}, - {"ThreadTab.infoLabelFormat", "<html>\u5B9F\u884C\u4E2D: {0} \u30D4\u30FC\u30AF: {1} \u5408\u8A08: {2}</html>"}, - {"ThreadTab.threadInfo.accessibleName", "\u30B9\u30EC\u30C3\u30C9\u60C5\u5831"}, - {"ThreadTab.threadPlotter.accessibleName", "\u30B9\u30EC\u30C3\u30C9\u6570\u306E\u30C1\u30E3\u30FC\u30C8\u3002"}, - {"Threshold","\u3057\u304D\u3044\u5024"}, - {"Tile", "\u4E26\u3079\u3066\u8868\u793A(T)"}, - {"Tile.mnemonic", 'T'}, - {"Time Range:", "\u6642\u9593\u7BC4\u56F2(T):"}, - {"Time Range:.mnemonic", 'T'}, - {"Time", "\u6642\u9593"}, - {"TimeStamp","TimeStamp"}, - {"Total Loaded", "\u30ED\u30FC\u30C9\u6E08\u5408\u8A08"}, - {"Total classes loaded","\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u5408\u8A08"}, - {"Total classes unloaded","\u30A2\u30F3\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u5408\u8A08"}, - {"Total compile time","\u5408\u8A08\u30B3\u30F3\u30D1\u30A4\u30EB\u6642\u9593"}, - {"Total physical memory","\u5408\u8A08\u7269\u7406\u30E1\u30E2\u30EA\u30FC"}, - {"Total threads started","\u958B\u59CB\u6E08\u5408\u8A08\u30B9\u30EC\u30C3\u30C9"}, - {"Total swap space","\u5408\u8A08\u30B9\u30EF\u30C3\u30D7\u30FB\u30B9\u30DA\u30FC\u30B9"}, - {"Type","\u578B"}, - {"Unavailable","\u5229\u7528\u4E0D\u53EF"}, - {"UNKNOWN","UNKNOWN"}, - {"Unknown Host","\u4E0D\u660E\u306A\u30DB\u30B9\u30C8: {0}"}, - {"Unregister", "\u767B\u9332\u89E3\u9664"}, - {"Uptime","\u7A3C\u50CD\u6642\u9593"}, - {"Uptime: ","\u7A3C\u50CD\u6642\u9593: "}, - {"Usage Threshold","\u4F7F\u7528\u3057\u304D\u3044\u5024"}, - {"remoteTF.usage","<b>\u4F7F\u7528\u65B9\u6CD5</b>: <hostname>:<port>\u307E\u305F\u306Fservice:jmx:<protocol>:<sap>"}, - {"Used","\u4F7F\u7528\u6E08"}, - {"Username: ", "\u30E6\u30FC\u30B6\u30FC\u540D(U): "}, - {"Username: .mnemonic", 'U'}, - {"Username.accessibleName", "\u30E6\u30FC\u30B6\u30FC\u540D"}, - {"UserData","UserData"}, - {"Virtual Machine","\u4EEE\u60F3\u30DE\u30B7\u30F3"}, - {"VM arguments","VM\u5F15\u6570"}, - {"VM","VM"}, - {"VMInternalFrame.accessibleDescription", "Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306E\u30E2\u30CB\u30BF\u30FC\u7528\u306E\u5185\u90E8\u30D5\u30EC\u30FC\u30E0"}, - {"Value","\u5024"}, - {"Vendor", "\u30D9\u30F3\u30C0\u30FC"}, - {"Verbose Output","\u8A73\u7D30\u51FA\u529B"}, - {"Verbose Output.toolTip", "\u30AF\u30E9\u30B9\u8AAD\u8FBC\u307F\u30B7\u30B9\u30C6\u30E0\u3067\u8A73\u7D30\u51FA\u529B\u3092\u6709\u52B9\u306B\u3059\u308B"}, - {"View value", "\u5024\u306E\u8868\u793A"}, - {"View","\u8868\u793A"}, - {"Window", "\u30A6\u30A3\u30F3\u30C9\u30A6(W)"}, - {"Window.mnemonic", 'W'}, - {"Windows","\u30A6\u30A3\u30F3\u30C9\u30A6"}, - {"Writable","\u66F8\u8FBC\u307F\u53EF\u80FD"}, - {"You cannot drop a class here", "\u30AF\u30E9\u30B9\u3092\u3053\u3053\u306B\u30C9\u30ED\u30C3\u30D7\u3067\u304D\u307E\u305B\u3093"}, - {"collapse", "\u7E2E\u5C0F"}, - {"connectionFailed1","\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F: \u518D\u8A66\u884C\u3057\u307E\u3059\u304B\u3002"}, - {"connectionFailed2","{0}\u3078\u306E\u63A5\u7D9A\u304C\u6210\u529F\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002<br>\u3082\u3046\u4E00\u5EA6\u8A66\u3057\u307E\u3059\u304B\u3002"}, - {"connectionLost1","\u63A5\u7D9A\u304C\u5931\u308F\u308C\u307E\u3057\u305F: \u518D\u63A5\u7D9A\u3057\u307E\u3059\u304B\u3002"}, - {"connectionLost2","\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9\u304C\u7D42\u4E86\u3057\u305F\u305F\u3081{0}\u3078\u306E\u63A5\u7D9A\u304C\u5931\u308F\u308C\u307E\u3057\u305F\u3002<br>\u518D\u63A5\u7D9A\u3057\u307E\u3059\u304B\u3002"}, - {"connectingTo1","{0}\u306B\u63A5\u7D9A\u4E2D"}, - {"connectingTo2","{0}\u306B\u73FE\u5728\u63A5\u7D9A\u4E2D\u3067\u3059\u3002<br>\u3053\u308C\u306B\u306F\u6570\u5206\u304B\u304B\u308A\u307E\u3059\u3002"}, - {"deadlockAllTab","\u3059\u3079\u3066"}, - {"deadlockTab","\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF"}, - {"deadlockTabN","\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF{0}"}, - {"expand", "\u5C55\u958B"}, - {"kbytes","{0} KB"}, - {"operation","\u64CD\u4F5C"}, - {"plot", "\u30D7\u30ED\u30C3\u30C8"}, - {"visualize","\u8996\u899A\u5316"}, - {"zz usage text", - "\u4F7F\u7528\u65B9\u6CD5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n -interval \u66F4\u65B0\u9593\u9694\u3092n\u79D2\u306B\u8A2D\u5B9A\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8\u306F4\u79D2)\n -notile \u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u6700\u521D\u306B\u4E26\u3079\u3066\u8868\u793A\u3057\u306A\u3044(2\u3064\u4EE5\u4E0A\u306E\u63A5\u7D9A\u306B\u3064\u3044\u3066)\n -pluginpath JConsole\u304C\u30D7\u30E9\u30B0\u30A4\u30F3\u3092\u53C2\u7167\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3059\u308B\u30D1\u30B9\u3092\u6307\u5B9A\u3059\u308B\n -version \u30D7\u30ED\u30B0\u30E9\u30E0\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5370\u5237\u3059\u308B\n\n connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n pid \u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9\u306E\u30D7\u30ED\u30BB\u30B9ID\n host \u30EA\u30E2\u30FC\u30C8\u30FB\u30DB\u30B9\u30C8\u540D\u307E\u305F\u306FIP\u30A2\u30C9\u30EC\u30B9\n port \u30EA\u30E2\u30FC\u30C8\u63A5\u7D9A\u7528\u306E\u30DD\u30FC\u30C8\u756A\u53F7\n\n -J JConsole\u304C\u5B9F\u884C\u4E2D\u306EJava\u4EEE\u60F3\u30DE\u30B7\u30F3\u3078\u306E\n \u5165\u529B\u5F15\u6570\u3092\u6307\u5B9A\u3059\u308B"}, - // END OF MATERIAL TO LOCALIZE - }; - - String ls = System.getProperty("line.separator"); - for(int i=0;i<temp.length;i++) { - if (temp[i][1] instanceof String){ - temp[i][1] = temp[i][1].toString().replaceAll("\n",ls); - } - } - - return temp; - - } - - public synchronized Object[][] getContents() { - return getContents0(); - } -}
--- a/src/share/classes/sun/tools/jconsole/resources/JConsoleResources_zh_CN.java Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.tools.jconsole.resources; - -import java.util.*; - -import static java.awt.event.KeyEvent.*; - -/** - * <p> This class represents the <code>ResourceBundle</code> - * for the following package(s): - * - * <ol> - * <li> sun.tools.jconsole - * </ol> - * - * <P> - * Subclasses must override <code>getContents0</code> and provide an array, - * where each item in the array consists of a <code>String</code> key, - * and either a <code>String</code> value associated with that key, - * or if the keys ends with ".mnemonic", an element - * representing a mnemomic keycode <code>int</code> or <code>char</code>. - */ -public class JConsoleResources_zh_CN extends JConsoleResources { - - /** - * Returns the contents of this <code>ResourceBundle</code>. - * - * <p> - * - * @return the contents of this <code>ResourceBundle</code>. - */ - protected Object[][] getContents0() { - Object[][] temp = new Object[][] { - // NOTE 1: The value strings in this file containing "{0}" are - // processed by the java.text.MessageFormat class. Any - // single quotes appearing in these strings need to be - // doubled up. - // - // NOTE 2: To make working with this file a bit easier, please - // maintain these messages in ASCII sorted order by - // message key. - // - // LOCALIZE THIS - {" 1 day"," 1 \u5929"}, - {" 1 hour"," 1 \u5C0F\u65F6"}, - {" 1 min"," 1 \u5206\u949F"}, - {" 1 month"," 1 \u4E2A\u6708"}, - {" 1 year"," 1 \u5E74"}, - {" 2 hours"," 2 \u5C0F\u65F6"}, - {" 3 hours"," 3 \u5C0F\u65F6"}, - {" 3 months"," 3 \u4E2A\u6708"}, - {" 5 min"," 5 \u5206\u949F"}, - {" 6 hours"," 6 \u5C0F\u65F6"}, - {" 6 months"," 6 \u4E2A\u6708"}, - {" 7 days"," 7 \u5929"}, - {"10 min","10 \u5206\u949F"}, - {"12 hours","12 \u5C0F\u65F6"}, - {"30 min","30 \u5206\u949F"}, - {"<","<"}, - {"<<","<<"}, - {">",">"}, - {"ACTION","ACTION"}, - {"ACTION_INFO","ACTION_INFO"}, - {"All","\u5168\u90E8"}, - {"Apply","\u5E94\u7528"}, - {"Architecture","\u4F53\u7CFB\u7ED3\u6784"}, - {"Array, OpenType", "\u6570\u7EC4, OpenType"}, - {"Array, OpenType, Numeric value viewer","\u6570\u7EC4, OpenType, \u6570\u503C\u67E5\u770B\u5668"}, - {"Attribute","\u5C5E\u6027"}, - {"Attribute value","\u5C5E\u6027\u503C"}, - {"Attribute values","\u5C5E\u6027\u503C"}, - {"Attributes","\u5C5E\u6027"}, - {"Blank", "\u7A7A\u767D"}, - {"BlockedCount WaitedCount", - "\u603B\u963B\u6B62\u6570: {0}, \u603B\u7B49\u5F85\u6570: {1}\n"}, - {"Boot class path","\u5F15\u5BFC\u7C7B\u8DEF\u5F84"}, - {"BorderedComponent.moreOrLessButton.toolTip", "\u5207\u6362\u4EE5\u663E\u793A\u66F4\u591A\u6216\u66F4\u5C11\u4FE1\u606F"}, - {"CPU Usage","CPU \u5360\u7528\u7387"}, - {"CPUUsageFormat","CPU \u5360\u7528\u7387: {0}%"}, - {"Cancel","\u53D6\u6D88"}, - {"Cascade", "\u5C42\u53E0(C)"}, - {"Cascade.mnemonic", 'C'}, - {"Chart:", "\u56FE\u8868(C):"}, - {"Chart:.mnemonic", 'C'}, - {"Class path","\u7C7B\u8DEF\u5F84"}, - {"Class","\u7C7B"}, - {"ClassName","ClassName"}, - {"ClassTab.infoLabelFormat", "<html>\u5DF2\u52A0\u8F7D: {0} \u5DF2\u5378\u8F7D: {1} \u603B\u8BA1: {2}</html>"}, - {"ClassTab.loadedClassesPlotter.accessibleName", "\u5DF2\u52A0\u8F7D\u7C7B\u7684\u56FE\u8868\u3002"}, - {"Classes","\u7C7B"}, - {"Close","\u5173\u95ED"}, - {"Column.Name", "\u540D\u79F0"}, - {"Column.PID", "PID"}, - {"Committed memory","\u63D0\u4EA4\u7684\u5185\u5B58"}, - {"Committed virtual memory","\u63D0\u4EA4\u7684\u865A\u62DF\u5185\u5B58"}, - {"Committed", "\u5DF2\u63D0\u4EA4"}, - {"Compiler","\u7F16\u8BD1\u5668"}, - {"CompositeData","CompositeData"}, - {"Config","\u914D\u7F6E"}, - {"Connect", "\u8FDE\u63A5(C)"}, - {"Connect.mnemonic", 'C'}, - {"Connect...","\u8FDE\u63A5..."}, - {"ConnectDialog.connectButton.toolTip", "\u8FDE\u63A5\u5230 Java \u865A\u62DF\u673A"}, - {"ConnectDialog.accessibleDescription", "\u7528\u4E8E\u4E0E\u672C\u5730\u6216\u8FDC\u7A0B Java \u865A\u62DF\u673A\u5EFA\u7ACB\u65B0\u8FDE\u63A5\u7684\u5BF9\u8BDD\u6846"}, - {"ConnectDialog.masthead.accessibleName", "\u62A5\u5934\u56FE"}, - {"ConnectDialog.masthead.title", "\u65B0\u5EFA\u8FDE\u63A5"}, - {"ConnectDialog.statusBar.accessibleName", "\u72B6\u6001\u680F"}, - {"ConnectDialog.title", "JConsole: \u65B0\u5EFA\u8FDE\u63A5"}, - {"Connected. Click to disconnect.","\u5DF2\u8FDE\u63A5\u3002\u5355\u51FB\u53EF\u65AD\u5F00\u8FDE\u63A5\u3002"}, - {"Connection failed","\u8FDE\u63A5\u5931\u8D25"}, - {"Connection", "\u8FDE\u63A5(C)"}, - {"Connection.mnemonic", 'C'}, - {"Connection name", "\u8FDE\u63A5\u540D\u79F0"}, - {"ConnectionName (disconnected)","{0} (\u5DF2\u65AD\u5F00\u8FDE\u63A5)"}, - {"Constructor","\u6784\u9020\u5668"}, - {"Current classes loaded", "\u5DF2\u52A0\u88C5\u5F53\u524D\u7C7B"}, - {"Current heap size","\u5F53\u524D\u5806\u5927\u5C0F"}, - {"Current value","\u5F53\u524D\u503C: {0}"}, - {"Create", "\u521B\u5EFA"}, - {"Daemon threads","\u5B88\u62A4\u7A0B\u5E8F\u7EBF\u7A0B"}, - {"Disconnected. Click to connect.","\u5DF2\u65AD\u5F00\u8FDE\u63A5\u3002\u5355\u51FB\u53EF\u8FDE\u63A5\u3002"}, - {"Double click to expand/collapse","\u53CC\u51FB\u4EE5\u5C55\u5F00/\u9690\u85CF"}, - {"Double click to visualize", "\u53CC\u51FB\u4EE5\u4F7F\u5176\u53EF\u89C1"}, - {"Description", "\u8BF4\u660E"}, - {"Description: ", "\u8BF4\u660E: "}, - {"Descriptor", "\u63CF\u8FF0\u7B26"}, - {"Details", "\u8BE6\u7EC6\u8D44\u6599"}, - {"Detect Deadlock", "\u68C0\u6D4B\u6B7B\u9501(D)"}, - {"Detect Deadlock.mnemonic", 'D'}, - {"Detect Deadlock.toolTip", "\u68C0\u6D4B\u5904\u4E8E\u6B7B\u9501\u72B6\u6001\u7684\u7EBF\u7A0B"}, - {"Dimension is not supported:","\u4E0D\u652F\u6301\u7EF4:"}, - {"Discard chart", "\u653E\u5F03\u56FE\u8868"}, - {"DurationDaysHoursMinutes","{0,choice,1#{0,number,integer} \u5929 |1.0<{0,number,integer} \u5929 }{1,choice,0<{1,number,integer} \u5C0F\u65F6 |1#{1,number,integer} \u5C0F\u65F6 |1<{1,number,integer} \u5C0F\u65F6 }{2,choice,0<{2,number,integer} \u5206\u949F|1#{2,number,integer} \u5206\u949F|1.0<{2,number,integer} \u5206\u949F}"}, - - {"DurationHoursMinutes","{0,choice,1#{0,number,integer} \u5C0F\u65F6 |1<{0,number,integer} \u5C0F\u65F6 }{1,choice,0<{1,number,integer} \u5206\u949F|1#{1,number,integer} \u5206\u949F|1.0<{1,number,integer} \u5206\u949F}"}, - - {"DurationMinutes","{0,choice,1#{0,number,integer} \u5206\u949F|1.0<{0,number,integer} \u5206\u949F}"}, - {"DurationSeconds","{0} \u79D2"}, - {"Empty array", "\u7A7A\u6570\u7EC4"}, - {"Empty opentype viewer", "\u7A7A opentype \u67E5\u770B\u5668"}, - {"Error","\u9519\u8BEF"}, - {"Error: MBeans already exist","\u9519\u8BEF: MBean \u5DF2\u5B58\u5728"}, - {"Error: MBeans do not exist","\u9519\u8BEF: MBean \u4E0D\u5B58\u5728"}, - {"Error:","\u9519\u8BEF:"}, - {"Event","\u4E8B\u4EF6"}, - {"Exit", "\u9000\u51FA(X)"}, - {"Exit.mnemonic", 'X'}, - {"Fail to load plugin", "\u8B66\u544A: \u65E0\u6CD5\u52A0\u8F7D\u63D2\u4EF6: {0}"}, - {"FileChooser.fileExists.cancelOption", "\u53D6\u6D88"}, - {"FileChooser.fileExists.message", "<html><center>\u6587\u4EF6\u5DF2\u5B58\u5728:<br>{0}<br>\u662F\u5426\u8981\u66FF\u6362?"}, - {"FileChooser.fileExists.okOption", "\u66FF\u6362"}, - {"FileChooser.fileExists.title", "\u6587\u4EF6\u5DF2\u5B58\u5728"}, - {"FileChooser.savedFile", "<html>\u5DF2\u4FDD\u5B58\u5230\u6587\u4EF6:<br>{0}<br>({1} \u5B57\u8282)"}, - {"FileChooser.saveFailed.message", "<html><center>\u672A\u80FD\u4FDD\u5B58\u5230\u6587\u4EF6:<br>{0}<br>{1}"}, - {"FileChooser.saveFailed.title", "\u4FDD\u5B58\u5931\u8D25"}, - {"Free physical memory","\u7A7A\u95F2\u7269\u7406\u5185\u5B58"}, - {"Free swap space","\u7A7A\u95F2\u4EA4\u6362\u7A7A\u95F4"}, - {"Garbage collector","\u5783\u573E\u6536\u96C6\u5668"}, - {"GTK","GTK"}, - {"GcInfo","\u540D\u79F0 = ''{0}'', \u6536\u96C6 = {1,choice,-1#Unavailable|0#{1,number,integer}}, \u603B\u82B1\u8D39\u65F6\u95F4 = {2}"}, - {"GC time","GC \u65F6\u95F4"}, - {"GC time details","{1}\u4E0A\u7684{0} ({2}\u6536\u96C6)"}, - {"Heap Memory Usage","\u5806\u5185\u5B58\u4F7F\u7528\u91CF"}, - {"Heap", "\u5806"}, - {"Help.AboutDialog.accessibleDescription", "\u5305\u542B\u6709\u5173 JConsole \u548C JDK \u7248\u672C\u4FE1\u606F\u7684\u5BF9\u8BDD\u6846"}, - {"Help.AboutDialog.jConsoleVersion", "JConsole \u7248\u672C:<br>{0}"}, - {"Help.AboutDialog.javaVersion", "Java VM \u7248\u672C:<br>{0}"}, - {"Help.AboutDialog.masthead.accessibleName", "\u62A5\u5934\u56FE"}, - {"Help.AboutDialog.masthead.title", "\u5173\u4E8E JConsole"}, - {"Help.AboutDialog.title", "JConsole: \u5173\u4E8E"}, - {"Help.AboutDialog.userGuideLink", "JConsole \u7528\u6237\u6307\u5357(U):<br>{0}"}, - {"Help.AboutDialog.userGuideLink.mnemonic", 'U'}, - {"Help.AboutDialog.userGuideLink.url", "http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"}, - {"HelpMenu.About.title", "\u5173\u4E8E JConsole(A)"}, - {"HelpMenu.About.title.mnemonic", 'A'}, - {"HelpMenu.UserGuide.title", "\u8054\u673A\u7528\u6237\u6307\u5357"}, - {"HelpMenu.UserGuide.title.mnemonic", 'U'}, - {"HelpMenu.title", "\u5E2E\u52A9(H)"}, - {"HelpMenu.title.mnemonic", 'H'}, - {"Hotspot MBeans...", "HotSpot MBean(H)..."}, - {"Hotspot MBeans....mnemonic", 'H'}, - {"Hotspot MBeans.dialog.accessibleDescription", "\u7528\u4E8E\u7BA1\u7406 HotSpot MBean \u7684\u5BF9\u8BDD\u6846"}, - {"Impact","\u5F71\u54CD"}, - {"Info","\u4FE1\u606F"}, - {"INFO","INFO"}, - {"Invalid plugin path", "\u8B66\u544A: \u63D2\u4EF6\u8DEF\u5F84\u65E0\u6548: {0}"}, - {"Invalid URL", "URL \u65E0\u6548: {0}"}, - {"Is","\u662F"}, - {"Java Monitoring & Management Console", "Java \u76D1\u89C6\u548C\u7BA1\u7406\u63A7\u5236\u53F0"}, - {"JConsole: ","JConsole: {0}"}, - {"JConsole version","JConsole \u7248\u672C \"{0}\""}, - {"JConsole.accessibleDescription", "Java \u76D1\u89C6\u548C\u7BA1\u7406\u63A7\u5236\u53F0"}, - {"JIT compiler","JIT \u7F16\u8BD1\u5668"}, - {"Java Virtual Machine","Java \u865A\u62DF\u673A"}, - {"Java","Java"}, - {"Library path","\u5E93\u8DEF\u5F84"}, - {"Listeners","\u76D1\u542C\u7A0B\u5E8F"}, - {"Live Threads","\u6D3B\u52A8\u7EBF\u7A0B"}, - {"Loaded", "\u5DF2\u52A0\u8F7D"}, - {"Local Process:", "\u672C\u5730\u8FDB\u7A0B(L):"}, - {"Local Process:.mnemonic", 'L'}, - {"Look and Feel","\u5916\u89C2"}, - {"Masthead.font", "Dialog-PLAIN-25"}, - {"Management Not Enabled","<b>\u6CE8</b>: \u672A\u5BF9\u6B64\u8FDB\u7A0B\u542F\u7528\u7BA1\u7406\u4EE3\u7406\u3002"}, - {"Management Will Be Enabled","<b>\u6CE8</b>: \u5C06\u5BF9\u6B64\u8FDB\u7A0B\u542F\u7528\u7BA1\u7406\u4EE3\u7406\u3002"}, - {"MBeanAttributeInfo","MBeanAttributeInfo"}, - {"MBeanInfo","MBeanInfo"}, - {"MBeanNotificationInfo","MBeanNotificationInfo"}, - {"MBeanOperationInfo","MBeanOperationInfo"}, - {"MBeans","MBean"}, - {"MBeansTab.clearNotificationsButton", "\u6E05\u9664(C)"}, - {"MBeansTab.clearNotificationsButton.mnemonic", 'C'}, - {"MBeansTab.clearNotificationsButton.toolTip", "\u6E05\u9664\u901A\u77E5"}, - {"MBeansTab.compositeNavigationMultiple", "\u7EC4\u5408\u5BFC\u822A{0}/{1}"}, - {"MBeansTab.compositeNavigationSingle", "\u7EC4\u5408\u5BFC\u822A"}, - {"MBeansTab.refreshAttributesButton", "\u5237\u65B0(R)"}, - {"MBeansTab.refreshAttributesButton.mnemonic", 'R'}, - {"MBeansTab.refreshAttributesButton.toolTip", "\u5237\u65B0\u5C5E\u6027"}, - {"MBeansTab.subscribeNotificationsButton", "\u8BA2\u9605(S)"}, - {"MBeansTab.subscribeNotificationsButton.mnemonic", 'S'}, - {"MBeansTab.subscribeNotificationsButton.toolTip", "\u5F00\u59CB\u76D1\u542C\u901A\u77E5"}, - {"MBeansTab.tabularNavigationMultiple", "\u8868\u683C\u5F0F\u5BFC\u822A{0}/{1}"}, - {"MBeansTab.tabularNavigationSingle", "\u8868\u683C\u5F0F\u5BFC\u822A"}, - {"MBeansTab.unsubscribeNotificationsButton", "\u53D6\u6D88\u8BA2\u9605(U)"}, - {"MBeansTab.unsubscribeNotificationsButton.mnemonic", 'U'}, - {"MBeansTab.unsubscribeNotificationsButton.toolTip", "\u505C\u6B62\u76D1\u542C\u901A\u77E5"}, - {"Manage Hotspot MBeans in: ", "\u7BA1\u7406\u4EE5\u4E0B\u4F4D\u7F6E\u7684 HotSpot MBean: "}, - {"Max","\u6700\u5927\u503C"}, - {"Maximum heap size","\u6700\u5927\u5806\u5927\u5C0F"}, - {"Memory","\u5185\u5B58"}, - {"MemoryPoolLabel", "\u5185\u5B58\u6C60 \"{0}\""}, - {"MemoryTab.heapPlotter.accessibleName", "\u5806\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002"}, - {"MemoryTab.infoLabelFormat", "<html>\u5DF2\u7528: {0} \u5DF2\u63D0\u4EA4: {1} \u6700\u5927: {2}</html>"}, - {"MemoryTab.nonHeapPlotter.accessibleName", "\u975E\u5806\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002"}, - {"MemoryTab.poolChart.aboveThreshold", "\u5927\u4E8E{0}\u7684\u9608\u503C\u3002\n"}, - {"MemoryTab.poolChart.accessibleName", "\u5185\u5B58\u6C60\u4F7F\u7528\u91CF\u56FE\u8868\u3002"}, - {"MemoryTab.poolChart.belowThreshold", "\u4F4E\u4E8E{0}\u7684\u9608\u503C\u3002\n"}, - {"MemoryTab.poolPlotter.accessibleName", "{0}\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002"}, - {"Message","\u6D88\u606F"}, - {"Method successfully invoked", "\u5DF2\u6210\u529F\u8C03\u7528\u65B9\u6CD5"}, - {"Minimize All", "\u5168\u90E8\u6700\u5C0F\u5316(M)"}, - {"Minimize All.mnemonic", 'M'}, - {"Minus Version", "\u8FD9\u662F{0}\u7248\u672C {1}"}, - {"Monitor locked", - " - \u5DF2\u9501\u5B9A{0}\n"}, - {"Motif","Motif"}, - {"Name Build and Mode","{0} (\u5DE5\u4F5C\u7248\u672C {1}, {2})"}, - {"Name and Build","{0} (\u5DE5\u4F5C\u7248\u672C {1})"}, - {"Name","\u540D\u79F0"}, - {"Name: ","\u540D\u79F0: "}, - {"Name State", - "\u540D\u79F0: {0}\n\u72B6\u6001: {1}\n"}, - {"Name State LockName", - "\u540D\u79F0: {0}\n\u72B6\u6001: {2}\u4E0A\u7684{1}\n"}, - {"Name State LockName LockOwner", - "\u540D\u79F0: {0}\n\u72B6\u6001: {2}\u4E0A\u7684{1}, \u62E5\u6709\u8005: {3}\n"}, - {"New Connection...", "\u65B0\u5EFA\u8FDE\u63A5(N)..."}, - {"New Connection....mnemonic", 'N'}, - {"New value applied","\u5DF2\u5E94\u7528\u65B0\u503C"}, - {"No attribute selected","\u672A\u9009\u62E9\u5C5E\u6027"}, - {"No deadlock detected","\u672A\u68C0\u6D4B\u5230\u6B7B\u9501"}, - {"No value selected","\u672A\u9009\u62E9\u503C"}, - {"Non-Heap Memory Usage","\u975E\u5806\u5185\u5B58\u4F7F\u7528\u91CF"}, - {"Non-Heap", "\u975E\u5806"}, - {"Not Yet Implemented","\u5C1A\u672A\u5B9E\u73B0"}, - {"Not a valid event broadcaster", "\u4E0D\u662F\u6709\u6548\u7684\u4E8B\u4EF6\u5E7F\u64AD\u8005"}, - {"Notification","\u901A\u77E5"}, - {"Notification buffer","\u901A\u77E5\u7F13\u51B2\u533A"}, - {"Notifications","\u901A\u77E5"}, - {"NotifTypes", "NotifTypes"}, - {"Number of Threads","\u7EBF\u7A0B\u6570"}, - {"Number of Loaded Classes","\u5DF2\u52A0\u8F7D\u7C7B\u6570"}, - {"Number of processors","\u5904\u7406\u7A0B\u5E8F\u6570"}, - {"ObjectName","ObjectName"}, - {"Operating System","\u64CD\u4F5C\u7CFB\u7EDF"}, - {"Operation","\u64CD\u4F5C"}, - {"Operation invocation","\u64CD\u4F5C\u8C03\u7528"}, - {"Operation return value", "\u64CD\u4F5C\u8FD4\u56DE\u503C"}, - {"Operations","\u64CD\u4F5C"}, - {"Overview","\u6982\u89C8"}, - {"OverviewPanel.plotter.accessibleName", "{0}\u7684\u56FE\u8868\u3002"}, - {"Parameter", "\u53C2\u6570"}, - {"Password: ", "\u53E3\u4EE4(P): "}, - {"Password: .mnemonic", 'P'}, - {"Password.accessibleName", "\u53E3\u4EE4"}, - {"Peak","\u5CF0\u503C"}, - {"Perform GC", "\u6267\u884C GC"}, - {"Perform GC.mnemonic", 'G'}, - {"Perform GC.toolTip", "\u8BF7\u6C42\u5783\u573E\u6536\u96C6"}, - {"Plotter.accessibleName", "\u56FE\u8868"}, - {"Plotter.accessibleName.keyAndValue", "{0}={1}\n"}, - {"Plotter.accessibleName.noData", "\u672A\u7ED8\u5236\u6570\u636E\u3002"}, - {"Plotter.saveAsMenuItem", "\u5C06\u6570\u636E\u53E6\u5B58\u4E3A(A)..."}, - {"Plotter.saveAsMenuItem.mnemonic", 'A'}, - {"Plotter.timeRangeMenu", "\u65F6\u95F4\u8303\u56F4(T)"}, - {"Plotter.timeRangeMenu.mnemonic", 'T'}, - {"Problem adding listener","\u6DFB\u52A0\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898"}, - {"Problem displaying MBean", "\u663E\u793A MBean \u65F6\u51FA\u73B0\u95EE\u9898"}, - {"Problem invoking", "\u8C03\u7528\u65F6\u51FA\u73B0\u95EE\u9898"}, - {"Problem removing listener","\u5220\u9664\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898"}, - {"Problem setting attribute","\u8BBE\u7F6E\u5C5E\u6027\u65F6\u51FA\u73B0\u95EE\u9898"}, - {"Process CPU time","\u8FDB\u7A0B CPU \u65F6\u95F4"}, - {"R/W","\u8BFB\u5199"}, - {"Readable","\u53EF\u8BFB"}, - {"Received","\u6536\u5230"}, - {"Reconnect","\u91CD\u65B0\u8FDE\u63A5"}, - {"Remote Process:", "\u8FDC\u7A0B\u8FDB\u7A0B(R):"}, - {"Remote Process:.mnemonic", 'R'}, - {"Remote Process.textField.accessibleName", "\u8FDC\u7A0B\u8FDB\u7A0B"}, - {"Remove","\u5220\u9664"}, - {"Restore All", "\u5168\u90E8\u8FD8\u539F(R)"}, - {"Restore All.mnemonic", 'R'}, - {"Return value", "\u8FD4\u56DE\u503C"}, - {"ReturnType", "ReturnType"}, - {"SeqNum","SeqNum"}, - {"Size Bytes", "{0,number,integer} \u5B57\u8282"}, - {"Size Gb","{0} GB"}, - {"Size Kb","{0} KB"}, - {"Size Mb","{0} MB"}, - {"Source","\u6E90"}, - {"Stack trace", - "\n\u5806\u6808\u8DDF\u8E2A: \n"}, - {"Success:","\u6210\u529F:"}, - // Note: SummaryTab.headerDateTimeFormat can be one the following: - // 1. A combination of two styles for date and time, using the - // constants from class DateFormat: SHORT, MEDIUM, LONG, FULL. - // Example: "MEDIUM,MEDIUM" or "FULL,SHORT" - // 2. An explicit string pattern used for creating an instance - // of the class SimpleDateFormat. - // Example: "yyyy-MM-dd HH:mm:ss" or "M/d/yyyy h:mm:ss a" - {"SummaryTab.headerDateTimeFormat", "FULL,FULL"}, - {"SummaryTab.pendingFinalization.label", "\u6682\u6302\u6700\u7EC8\u5904\u7406"}, - {"SummaryTab.pendingFinalization.value", "{0}\u5BF9\u8C61"}, - {"SummaryTab.tabName", "VM \u6982\u8981"}, - {"SummaryTab.vmVersion","{0}\u7248\u672C {1}"}, - {"TabularData are not supported", "\u4E0D\u652F\u6301 TabularData"}, - {"Threads","\u7EBF\u7A0B"}, - {"ThreadTab.infoLabelFormat", "<html>\u6D3B\u52A8: {0} \u5CF0\u503C: {1} \u603B\u8BA1: {2}</html>"}, - {"ThreadTab.threadInfo.accessibleName", "\u7EBF\u7A0B\u4FE1\u606F"}, - {"ThreadTab.threadPlotter.accessibleName", "\u8868\u793A\u7EBF\u7A0B\u6570\u7684\u56FE\u8868\u3002"}, - {"Threshold","\u9608\u503C"}, - {"Tile", "\u5E73\u94FA(T)"}, - {"Tile.mnemonic", 'T'}, - {"Time Range:", "\u65F6\u95F4\u8303\u56F4(T):"}, - {"Time Range:.mnemonic", 'T'}, - {"Time", "\u65F6\u95F4"}, - {"TimeStamp","TimeStamp"}, - {"Total Loaded", "\u52A0\u8F7D\u603B\u6570"}, - {"Total classes loaded","\u5DF2\u52A0\u8F7D\u7C7B\u603B\u6570"}, - {"Total classes unloaded","\u5DF2\u5378\u8F7D\u7C7B\u603B\u6570"}, - {"Total compile time","\u603B\u7F16\u8BD1\u65F6\u95F4"}, - {"Total physical memory","\u603B\u7269\u7406\u5185\u5B58"}, - {"Total threads started","\u542F\u52A8\u7684\u7EBF\u7A0B\u603B\u6570"}, - {"Total swap space","\u603B\u4EA4\u6362\u7A7A\u95F4"}, - {"Type","\u7C7B\u578B"}, - {"Unavailable","\u4E0D\u53EF\u7528"}, - {"UNKNOWN","UNKNOWN"}, - {"Unknown Host","\u672A\u77E5\u4E3B\u673A: {0}"}, - {"Unregister", "\u6CE8\u9500"}, - {"Uptime","\u8FD0\u884C\u65F6\u95F4"}, - {"Uptime: ","\u8FD0\u884C\u65F6\u95F4: "}, - {"Usage Threshold","\u7528\u6CD5\u9608\u503C"}, - {"remoteTF.usage","<b>\u7528\u6CD5</b>: <hostname>:<port> \u6216 service:jmx:<protocol>:<sap>"}, - {"Used","\u5DF2\u7528"}, - {"Username: ", "\u7528\u6237\u540D(U): "}, - {"Username: .mnemonic", 'U'}, - {"Username.accessibleName", "\u7528\u6237\u540D"}, - {"UserData","UserData"}, - {"Virtual Machine","\u865A\u62DF\u673A"}, - {"VM arguments","VM \u53C2\u6570"}, - {"VM","VM"}, - {"VMInternalFrame.accessibleDescription", "\u7528\u4E8E\u76D1\u89C6 Java \u865A\u62DF\u673A\u7684\u5185\u90E8\u6846\u67B6"}, - {"Value","\u503C"}, - {"Vendor", "\u5382\u5546"}, - {"Verbose Output","\u8BE6\u7EC6\u8F93\u51FA"}, - {"Verbose Output.toolTip", "\u4E3A\u7C7B\u52A0\u8F7D\u7CFB\u7EDF\u542F\u7528\u8BE6\u7EC6\u8F93\u51FA"}, - {"View value", "\u89C6\u56FE\u503C"}, - {"View","\u89C6\u56FE"}, - {"Window", "\u7A97\u53E3(W)"}, - {"Window.mnemonic", 'W'}, - {"Windows","Windows"}, - {"Writable","\u53EF\u5199"}, - {"You cannot drop a class here", "\u65E0\u6CD5\u5220\u9664\u6B64\u5904\u7684\u7C7B"}, - {"collapse", "\u9690\u85CF"}, - {"connectionFailed1","\u8FDE\u63A5\u5931\u8D25: \u662F\u5426\u91CD\u8BD5?"}, - {"connectionFailed2","\u672A\u6210\u529F\u8FDE\u63A5\u5230{0}\u3002<br>\u662F\u5426\u8981\u91CD\u8BD5?"}, - {"connectionLost1","\u8FDE\u63A5\u4E22\u5931: \u662F\u5426\u91CD\u65B0\u8FDE\u63A5?"}, - {"connectionLost2","\u7531\u4E8E\u8FDC\u7A0B\u8FDB\u7A0B\u5DF2\u7EC8\u6B62, \u4E0E{0}\u7684\u8FDE\u63A5\u4E22\u5931\u3002<br>\u662F\u5426\u8981\u91CD\u65B0\u8FDE\u63A5?"}, - {"connectingTo1","\u6B63\u5728\u8FDE\u63A5\u5230{0}"}, - {"connectingTo2","\u60A8\u5F53\u524D\u6B63\u5728\u8FDE\u63A5\u5230{0}\u3002<br>\u8FD9\u5C06\u9700\u8981\u51E0\u5206\u949F\u7684\u65F6\u95F4\u3002"}, - {"deadlockAllTab","\u5168\u90E8"}, - {"deadlockTab","\u6B7B\u9501"}, - {"deadlockTabN","\u6B7B\u9501{0}"}, - {"expand", "\u5C55\u5F00"}, - {"kbytes","{0} KB"}, - {"operation","\u64CD\u4F5C"}, - {"plot", "\u7ED8\u56FE"}, - {"visualize","\u53EF\u89C6\u5316"}, - {"zz usage text", - "\u7528\u6CD5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n -interval \u5C06\u66F4\u65B0\u95F4\u9694\u8BBE\u7F6E\u4E3A n \u79D2 (\u9ED8\u8BA4\u503C\u4E3A 4 \u79D2)\n -notile \u521D\u59CB\u4E0D\u5E73\u94FA\u7A97\u53E3 (\u5BF9\u4E8E\u4E24\u4E2A\u6216\u591A\u4E2A\u8FDE\u63A5)\n -pluginpath \u6307\u5B9A jconsole \u7528\u4E8E\u67E5\u627E\u63D2\u4EF6\u7684\u8DEF\u5F84\n -version \u8F93\u51FA\u7A0B\u5E8F\u7248\u672C\n\n connection = pid || host:port || JMX URL (service:jmx:<\u534F\u8BAE>://...)\n pid \u76EE\u6807\u8FDB\u7A0B\u7684\u8FDB\u7A0B ID\n host \u8FDC\u7A0B\u4E3B\u673A\u540D\u6216 IP \u5730\u5740\n port \u8FDC\u7A0B\u8FDE\u63A5\u7684\u7AEF\u53E3\u53F7\n\n -J \u6307\u5B9A\u8FD0\u884C jconsole \u7684 Java \u865A\u62DF\u673A\n \u7684\u8F93\u5165\u53C2\u6570"}, - // END OF MATERIAL TO LOCALIZE - }; - - String ls = System.getProperty("line.separator"); - for(int i=0;i<temp.length;i++) { - if (temp[i][1] instanceof String){ - temp[i][1] = temp[i][1].toString().replaceAll("\n",ls); - } - } - - return temp; - - } - - public synchronized Object[][] getContents() { - return getContents0(); - } -}
--- a/src/share/classes/sun/tools/jconsole/resources/messages.properties Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/tools/jconsole/resources/messages.properties Fri May 31 15:42:54 2013 -0700 @@ -105,7 +105,7 @@ HELP_ABOUT_DIALOG_MASTHEAD_TITLE=About JConsole HELP_ABOUT_DIALOG_TITLE=JConsole: About HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole &User Guide:<br>{0} -HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html +HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html HELP_MENU_ABOUT_TITLE=&About JConsole HELP_MENU_USER_GUIDE_TITLE=Online &User Guide HELP_MENU_TITLE=&Help
--- a/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties Fri May 31 15:42:54 2013 -0700 @@ -105,7 +105,7 @@ HELP_ABOUT_DIALOG_MASTHEAD_TITLE=JConsole\u306B\u3064\u3044\u3066 HELP_ABOUT_DIALOG_TITLE=JConsole: \u8A73\u7D30 HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(&U):<br>{0} -HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html +HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html HELP_MENU_ABOUT_TITLE=JConsole\u306B\u3064\u3044\u3066(&A) HELP_MENU_USER_GUIDE_TITLE=\u30AA\u30F3\u30E9\u30A4\u30F3\u30FB\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(&U) HELP_MENU_TITLE=\u30D8\u30EB\u30D7(&H)
--- a/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties Wed May 29 13:24:33 2013 -0700 +++ b/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties Fri May 31 15:42:54 2013 -0700 @@ -105,7 +105,7 @@ HELP_ABOUT_DIALOG_MASTHEAD_TITLE=\u5173\u4E8E JConsole HELP_ABOUT_DIALOG_TITLE=JConsole: \u5173\u4E8E HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole \u7528\u6237\u6307\u5357(&U):<br>{0} -HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html +HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html HELP_MENU_ABOUT_TITLE=\u5173\u4E8E JConsole(&A) HELP_MENU_USER_GUIDE_TITLE=\u8054\u673A\u7528\u6237\u6307\u5357(&U) HELP_MENU_TITLE=\u5E2E\u52A9(&H)
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java Wed May 29 13:24:33 2013 -0700 +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java Fri May 31 15:42:54 2013 -0700 @@ -466,7 +466,10 @@ if (eSrc.type == Entry.NEW || eSrc.type == Entry.FILECH) { u.type = eSrc.type; // make it the same type - if (!deletesrc) { // if it's not "rename", just take the data + if (deletesrc) { // if it's a "rename", take the data + u.bytes = eSrc.bytes; + u.file = eSrc.file; + } else { // if it's not "rename", copy the data if (eSrc.bytes != null) u.bytes = Arrays.copyOf(eSrc.bytes, eSrc.bytes.length); else if (eSrc.file != null) { @@ -651,7 +654,11 @@ } public int read(ByteBuffer dst) throws IOException { - return rbc.read(dst); + int n = rbc.read(dst); + if (n > 0) { + read += n; + } + return n; } public SeekableByteChannel truncate(long size) @@ -1114,7 +1121,7 @@ if (old != null) { removeFromTree(old); } - if (e.type == Entry.NEW || e.type == Entry.FILECH) { + if (e.type == Entry.NEW || e.type == Entry.FILECH || e.type == Entry.COPY) { IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(e.name))); e.sibling = parent.child; parent.child = e; @@ -2322,12 +2329,12 @@ private void removeFromTree(IndexNode inode) { IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(inode.name))); IndexNode child = parent.child; - if (child == inode) { + if (child.equals(inode)) { parent.child = child.sibling; } else { IndexNode last = child; while ((child = child.sibling) != null) { - if (child == inode) { + if (child.equals(inode)) { last.sibling = child.sibling; break; } else {
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed May 29 13:24:33 2013 -0700 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Fri May 31 15:42:54 2013 -0700 @@ -1876,7 +1876,9 @@ switch (getWindowType()) { case NORMAL: - typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_NORMAL; + typeAtom = (ownerPeer == null) ? + protocol.XA_NET_WM_WINDOW_TYPE_NORMAL : + protocol.XA_NET_WM_WINDOW_TYPE_DIALOG; break; case UTILITY: typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
--- a/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java Wed May 29 13:24:33 2013 -0700 +++ b/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java Fri May 31 15:42:54 2013 -0700 @@ -26,9 +26,9 @@ package sun.nio.ch; import java.io.IOException; -import java.util.LinkedList; -import java.util.HashSet; -import java.util.Iterator; +import java.util.BitSet; +import java.util.HashMap; +import java.util.Map; /** * Manipulates a native array of epoll_event structs on Linux: @@ -52,37 +52,78 @@ * this implementation we set data.fd to be the file descriptor that we * register. That way, we have the file descriptor available when we * process the events. - * - * All file descriptors registered with epoll have the POLLHUP and POLLERR - * events enabled even when registered with an event set of 0. To ensure - * that epoll_wait doesn't poll an idle file descriptor when the underlying - * connection is closed or reset then its registration is deleted from - * epoll (it will be re-added again if the event set is changed) */ class EPollArrayWrapper { // EPOLL_EVENTS - static final int EPOLLIN = 0x001; + private static final int EPOLLIN = 0x001; // opcodes - static final int EPOLL_CTL_ADD = 1; - static final int EPOLL_CTL_DEL = 2; - static final int EPOLL_CTL_MOD = 3; + private static final int EPOLL_CTL_ADD = 1; + private static final int EPOLL_CTL_DEL = 2; + private static final int EPOLL_CTL_MOD = 3; // Miscellaneous constants - static final int SIZE_EPOLLEVENT = sizeofEPollEvent(); - static final int EVENT_OFFSET = 0; - static final int DATA_OFFSET = offsetofData(); - static final int FD_OFFSET = DATA_OFFSET; - static final int NUM_EPOLLEVENTS = Math.min(IOUtil.fdLimit(), 8192); + private static final int SIZE_EPOLLEVENT = sizeofEPollEvent(); + private static final int EVENT_OFFSET = 0; + private static final int DATA_OFFSET = offsetofData(); + private static final int FD_OFFSET = DATA_OFFSET; + private static final int OPEN_MAX = IOUtil.fdLimit(); + private static final int NUM_EPOLLEVENTS = Math.min(OPEN_MAX, 8192); + + // Special value to indicate that an update should be ignored + private static final byte KILLED = (byte)-1; - // Base address of the native pollArray + // Initial size of arrays for fd registration changes + private static final int INITIAL_PENDING_UPDATE_SIZE = 64; + + // maximum size of updatesLow + private static final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024); + + + // The fd of the epoll driver + private final int epfd; + + // The epoll_event array for results from epoll_wait + private final AllocatedNativeObject pollArray; + + // Base address of the epoll_event array private final long pollArrayAddress; - // Set of "idle" channels - private final HashSet<SelChImpl> idleSet; + // The fd of the interrupt line going out + private int outgoingInterruptFD; + + // The fd of the interrupt line coming in + private int incomingInterruptFD; + + // The index of the interrupt FD + private int interruptedIndex; + + // Number of updated pollfd entries + int updated; + + // object to synchronize fd registration changes + private final Object updateLock = new Object(); - EPollArrayWrapper() { + // number of file descriptors with registration changes pending + private int updateCount; + + // file descriptors with registration changes pending + private int[] updateDescriptors = new int[INITIAL_PENDING_UPDATE_SIZE]; + + // events for file descriptors with registration changes pending, indexed + // by file descriptor and stored as bytes for efficiency reasons. For + // file descriptors higher than MAX_UPDATE_ARRAY_SIZE (unlimited case at + // least) then the update is stored in a map. + private final byte[] eventsLow = new byte[MAX_UPDATE_ARRAY_SIZE]; + private Map<Integer,Byte> eventsHigh; + + // Used by release and updateRegistrations to track whether a file + // descriptor is registered with epoll. + private final BitSet registered = new BitSet(); + + + EPollArrayWrapper() throws IOException { // creates the epoll file descriptor epfd = epollCreate(); @@ -91,50 +132,11 @@ pollArray = new AllocatedNativeObject(allocationSize, true); pollArrayAddress = pollArray.address(); - for (int i=0; i<NUM_EPOLLEVENTS; i++) { - putEventOps(i, 0); - putData(i, 0L); - } - - // create idle set - idleSet = new HashSet<SelChImpl>(); + // eventHigh needed when using file descriptors > 64k + if (OPEN_MAX > MAX_UPDATE_ARRAY_SIZE) + eventsHigh = new HashMap<>(); } - // Used to update file description registrations - private static class Updator { - SelChImpl channel; - int opcode; - int events; - Updator(SelChImpl channel, int opcode, int events) { - this.channel = channel; - this.opcode = opcode; - this.events = events; - } - Updator(SelChImpl channel, int opcode) { - this(channel, opcode, 0); - } - } - - private LinkedList<Updator> updateList = new LinkedList<Updator>(); - - // The epoll_event array for results from epoll_wait - private AllocatedNativeObject pollArray; - - // The fd of the epoll driver - final int epfd; - - // The fd of the interrupt line going out - int outgoingInterruptFD; - - // The fd of the interrupt line coming in - int incomingInterruptFD; - - // The index of the interrupt FD - int interruptedIndex; - - // Number of updated pollfd entries - int updated; - void initInterrupt(int fd0, int fd1) { outgoingInterruptFD = fd1; incomingInterruptFD = fd0; @@ -146,11 +148,6 @@ pollArray.putInt(offset, event); } - void putData(int i, long value) { - int offset = SIZE_EPOLLEVENT * i + DATA_OFFSET; - pollArray.putLong(offset, value); - } - void putDescriptor(int i, int fd) { int offset = SIZE_EPOLLEVENT * i + FD_OFFSET; pollArray.putInt(offset, fd); @@ -167,51 +164,83 @@ } /** - * Update the events for a given channel. + * Sets the pending update events for the given file descriptor. This + * method has no effect if the update events is already set to KILLED, + * unless {@code force} is {@code true}. */ - void setInterest(SelChImpl channel, int mask) { - synchronized (updateList) { - // if the previous pending operation is to add this file descriptor - // to epoll then update its event set - if (updateList.size() > 0) { - Updator last = updateList.getLast(); - if (last.channel == channel && last.opcode == EPOLL_CTL_ADD) { - last.events = mask; - return; - } + private void setUpdateEvents(int fd, byte events, boolean force) { + if (fd < MAX_UPDATE_ARRAY_SIZE) { + if ((eventsLow[fd] != KILLED) || force) { + eventsLow[fd] = events; + } + } else { + Integer key = Integer.valueOf(fd); + if ((eventsHigh.get(key) != KILLED) || force) { + eventsHigh.put(key, Byte.valueOf(events)); } + } + } - // update existing registration - updateList.add(new Updator(channel, EPOLL_CTL_MOD, mask)); + /** + * Returns the pending update events for the given file descriptor. + */ + private byte getUpdateEvents(int fd) { + if (fd < MAX_UPDATE_ARRAY_SIZE) { + return eventsLow[fd]; + } else { + Byte result = eventsHigh.get(Integer.valueOf(fd)); + // result should never be null + return result.byteValue(); } } /** - * Add a channel's file descriptor to epoll + * Update the events for a given file descriptor */ - void add(SelChImpl channel) { - synchronized (updateList) { - updateList.add(new Updator(channel, EPOLL_CTL_ADD)); + void setInterest(int fd, int mask) { + synchronized (updateLock) { + // record the file descriptor and events + int oldCapacity = updateDescriptors.length; + if (updateCount == oldCapacity) { + int newCapacity = oldCapacity + INITIAL_PENDING_UPDATE_SIZE; + int[] newDescriptors = new int[newCapacity]; + System.arraycopy(updateDescriptors, 0, newDescriptors, 0, oldCapacity); + updateDescriptors = newDescriptors; + } + updateDescriptors[updateCount++] = fd; + + // events are stored as bytes for efficiency reasons + byte b = (byte)mask; + assert (b == mask) && (b != KILLED); + setUpdateEvents(fd, b, false); } } /** - * Remove a channel's file descriptor from epoll + * Add a file descriptor */ - void release(SelChImpl channel) { - synchronized (updateList) { - // flush any pending updates - for (Iterator<Updator> it = updateList.iterator(); it.hasNext();) { - if (it.next().channel == channel) { - it.remove(); - } + void add(int fd) { + // force the initial update events to 0 as it may be KILLED by a + // previous registration. + synchronized (updateLock) { + assert !registered.get(fd); + setUpdateEvents(fd, (byte)0, true); + } + } + + /** + * Remove a file descriptor + */ + void remove(int fd) { + synchronized (updateLock) { + // kill pending and future update for this file descriptor + setUpdateEvents(fd, KILLED, false); + + // remove from epoll + if (registered.get(fd)) { + epollCtl(epfd, EPOLL_CTL_DEL, fd, 0); + registered.clear(fd); } - - // remove from the idle set (if present) - idleSet.remove(channel); - - // remove from epoll (if registered) - epollCtl(epfd, EPOLL_CTL_DEL, channel.getFDVal(), 0); } } @@ -239,36 +268,38 @@ /** * Update the pending registrations. */ - void updateRegistrations() { - synchronized (updateList) { - Updator u = null; - while ((u = updateList.poll()) != null) { - SelChImpl ch = u.channel; - if (!ch.isOpen()) - continue; + private void updateRegistrations() { + synchronized (updateLock) { + int j = 0; + while (j < updateCount) { + int fd = updateDescriptors[j]; + short events = getUpdateEvents(fd); + boolean isRegistered = registered.get(fd); + int opcode = 0; - // if the events are 0 then file descriptor is put into "idle - // set" to prevent it being polled - if (u.events == 0) { - boolean added = idleSet.add(u.channel); - // if added to idle set then remove from epoll if registered - if (added && (u.opcode == EPOLL_CTL_MOD)) - epollCtl(epfd, EPOLL_CTL_DEL, ch.getFDVal(), 0); - } else { - // events are specified. If file descriptor was in idle set - // it must be re-registered (by converting opcode to ADD) - boolean idle = false; - if (!idleSet.isEmpty()) - idle = idleSet.remove(u.channel); - int opcode = (idle) ? EPOLL_CTL_ADD : u.opcode; - epollCtl(epfd, opcode, ch.getFDVal(), u.events); + if (events != KILLED) { + if (isRegistered) { + opcode = (events != 0) ? EPOLL_CTL_MOD : EPOLL_CTL_DEL; + } else { + opcode = (events != 0) ? EPOLL_CTL_ADD : 0; + } + if (opcode != 0) { + epollCtl(epfd, opcode, fd, events); + if (opcode == EPOLL_CTL_ADD) { + registered.set(fd); + } else if (opcode == EPOLL_CTL_DEL) { + registered.clear(fd); + } + } } + j++; } + updateCount = 0; } } // interrupt support - boolean interrupted = false; + private boolean interrupted = false; public void interrupt() { interrupt(outgoingInterruptFD);
--- a/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java Wed May 29 13:24:33 2013 -0700 +++ b/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java Fri May 31 15:42:54 2013 -0700 @@ -53,26 +53,24 @@ private volatile boolean closed = false; // Lock for interrupt triggering and clearing - private Object interruptLock = new Object(); + private final Object interruptLock = new Object(); private boolean interruptTriggered = false; /** * Package private constructor called by factory method in * the abstract superclass Selector. */ - EPollSelectorImpl(SelectorProvider sp) { + EPollSelectorImpl(SelectorProvider sp) throws IOException { super(sp); long pipeFds = IOUtil.makePipe(false); fd0 = (int) (pipeFds >>> 32); fd1 = (int) pipeFds; pollWrapper = new EPollArrayWrapper(); pollWrapper.initInterrupt(fd0, fd1); - fdToKey = new HashMap<Integer,SelectionKeyImpl>(); + fdToKey = new HashMap<>(); } - protected int doSelect(long timeout) - throws IOException - { + protected int doSelect(long timeout) throws IOException { if (closed) throw new ClosedSelectorException(); processDeregisterQueue(); @@ -161,8 +159,9 @@ if (closed) throw new ClosedSelectorException(); SelChImpl ch = ski.channel; - fdToKey.put(Integer.valueOf(ch.getFDVal()), ski); - pollWrapper.add(ch); + int fd = Integer.valueOf(ch.getFDVal()); + fdToKey.put(fd, ski); + pollWrapper.add(fd); keys.add(ski); } @@ -171,7 +170,7 @@ SelChImpl ch = ski.channel; int fd = ch.getFDVal(); fdToKey.remove(Integer.valueOf(fd)); - pollWrapper.release(ch); + pollWrapper.remove(fd); ski.setIndex(-1); keys.remove(ski); selectedKeys.remove(ski); @@ -181,10 +180,11 @@ ((SelChImpl)selch).kill(); } - void putEventOps(SelectionKeyImpl sk, int ops) { + void putEventOps(SelectionKeyImpl ski, int ops) { if (closed) throw new ClosedSelectorException(); - pollWrapper.setInterest(sk.channel, ops); + SelChImpl ch = ski.channel; + pollWrapper.setInterest(ch.getFDVal(), ops); } public Selector wakeup() { @@ -200,5 +200,4 @@ static { Util.load(); } - }
--- a/src/windows/bin/cmdtoargs.c Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/bin/cmdtoargs.c Fri May 31 15:42:54 2013 -0700 @@ -128,7 +128,9 @@ *wildcard = JNI_TRUE; } if (prev == '\\') { - *dest++ = prev; + for (i = 0 ; i < slashes ; i++) { + *dest++ = prev; + } } *dest++ = ch; break; @@ -184,7 +186,7 @@ argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg)); argv[nargs].arg = JLI_StringDup(arg); argv[nargs].has_wildcard = wildcard; - + *arg = NULL; nargs++; } while (src != NULL); @@ -602,6 +604,14 @@ v->add("d", FALSE); vectors[i++] = v; + v= new Vector(argv[0], "\\\\?"); + v->add("\\\\?", TRUE); + vectors[i++] = v; + + v= new Vector(argv[0], "\\\\*"); + v->add("\\\\*", TRUE); + vectors[i++] = v; + dotest(vectors); printf("All tests pass [%d]\n", i); doexit(0);
--- a/src/windows/classes/sun/awt/windows/WPathGraphics.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java Fri May 31 15:42:54 2013 -0700 @@ -549,6 +549,8 @@ userx += xAdvance; userpos.x += xAdvance; deviceTransform.transform(userpos, devpos); + devx = devpos.x; + devy = devpos.y; } } else { super.drawString(str, x, y, font, frc, targetW);
--- a/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import java.nio.channels.Pipe; import java.nio.channels.SelectableChannel; import java.io.IOException; +import java.nio.channels.CancelledKeyException; import java.util.List; import java.util.ArrayList; import java.util.HashMap; @@ -561,17 +562,19 @@ protected void implDereg(SelectionKeyImpl ski) throws IOException{ int i = ski.getIndex(); assert (i >= 0); - if (i != totalChannels - 1) { - // Copy end one over it - SelectionKeyImpl endChannel = channelArray[totalChannels-1]; - channelArray[i] = endChannel; - endChannel.setIndex(i); - pollWrapper.replaceEntry(pollWrapper, totalChannels - 1, + synchronized (closeLock) { + if (i != totalChannels - 1) { + // Copy end one over it + SelectionKeyImpl endChannel = channelArray[totalChannels-1]; + channelArray[i] = endChannel; + endChannel.setIndex(i); + pollWrapper.replaceEntry(pollWrapper, totalChannels - 1, pollWrapper, i); + } + ski.setIndex(-1); } channelArray[totalChannels - 1] = null; totalChannels--; - ski.setIndex(-1); if ( totalChannels != 1 && totalChannels % MAX_SELECTABLE_FDS == 1) { totalChannels--; threadsCount--; // The last thread has become redundant. @@ -589,7 +592,11 @@ synchronized (closeLock) { if (pollWrapper == null) throw new ClosedSelectorException(); - pollWrapper.putEventOps(sk.getIndex(), ops); + // make sure this sk has not been removed yet + int index = sk.getIndex(); + if (index == -1) + throw new CancelledKeyException(); + pollWrapper.putEventOps(index, ops); } }
--- a/src/windows/classes/sun/nio/fs/WindowsConstants.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/nio/fs/WindowsConstants.java Fri May 31 15:42:54 2013 -0700 @@ -181,6 +181,11 @@ public static final int FILE_READ_ATTRIBUTES = 0x0080; public static final int FILE_WRITE_ATTRIBUTES = 0x0100; + public static final int FILE_GENERIC_READ = 0x00120089; + public static final int FILE_GENERIC_WRITE = 0x00120116; + public static final int FILE_GENERIC_EXECUTE = 0x001200a0; + public static final int FILE_ALL_ACCESS = 0x001f01ff; + // operating system security public static final int TOKEN_DUPLICATE = 0x0002; public static final int TOKEN_IMPERSONATE = 0x0004;
--- a/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java Fri May 31 15:42:54 2013 -0700 @@ -38,6 +38,7 @@ import sun.security.util.SecurityConstants; import static sun.nio.fs.WindowsNativeDispatcher.*; +import static sun.nio.fs.WindowsSecurity.*; import static sun.nio.fs.WindowsConstants.*; public class WindowsFileSystemProvider @@ -289,67 +290,29 @@ } /** - * Returns buffer with SID_AND_ATTRIBUTES structure representing the user - * associated with the current thread access token. - * FIXME - this should be cached. + * Checks the file security against desired access. */ - private static NativeBuffer getUserInfo(WindowsPath file) throws IOException { - try { - long hToken = WindowsSecurity.processTokenWithQueryAccess; - int size = GetTokenInformation(hToken, TokenUser, 0L, 0); - assert size > 0; - - NativeBuffer buffer = NativeBuffers.getNativeBuffer(size); - try { - int newsize = GetTokenInformation(hToken, TokenUser, - buffer.address(), size); - if (newsize != size) - throw new AssertionError(); - return buffer; - } catch (WindowsException x) { - buffer.release(); - throw x; - } - } catch (WindowsException x) { - throw new IOException(x.getMessage()); - } - } - - /** - * Reads the file ACL and return the effective access as ACCESS_MASK - */ - private static int getEffectiveAccess(WindowsPath file) throws IOException { - // read security descriptor continaing ACL (symlinks are followed) + private static boolean hasDesiredAccess(WindowsPath file, int rights) throws IOException { + // read security descriptor containing ACL (symlinks are followed) + boolean hasRights = false; String target = WindowsLinkSupport.getFinalPath(file, true); NativeBuffer aclBuffer = WindowsAclFileAttributeView - .getFileSecurity(target, DACL_SECURITY_INFORMATION); - - // retrieves DACL from security descriptor - long pAcl = GetSecurityDescriptorDacl(aclBuffer.address()); - - // Use GetEffectiveRightsFromAcl to get effective access to file + .getFileSecurity(target, + DACL_SECURITY_INFORMATION + | OWNER_SECURITY_INFORMATION + | GROUP_SECURITY_INFORMATION); try { - NativeBuffer userBuffer = getUserInfo(file); - try { - try { - // SID_AND_ATTRIBUTES->pSid - long pSid = unsafe.getAddress(userBuffer.address()); - long pTrustee = BuildTrusteeWithSid(pSid); - try { - return GetEffectiveRightsFromAcl(pAcl, pTrustee); - } finally { - LocalFree(pTrustee); - } - } catch (WindowsException x) { - throw new IOException("Unable to get effective rights from ACL: " + - x.getMessage()); - } - } finally { - userBuffer.release(); - } + hasRights = checkAccessMask(aclBuffer.address(), rights, + FILE_GENERIC_READ, + FILE_GENERIC_WRITE, + FILE_GENERIC_EXECUTE, + FILE_ALL_ACCESS); + } catch (WindowsException exc) { + exc.rethrowAsIOException(file); } finally { aclBuffer.release(); } + return hasRights; } /** @@ -416,10 +379,10 @@ mask |= FILE_EXECUTE; } - if ((getEffectiveAccess(file) & mask) == 0) + if (!hasDesiredAccess(file, mask)) throw new AccessDeniedException( file.getPathForExceptionMessage(), null, - "Effective permissions does not allow requested access"); + "Permissions does not allow requested access"); // for write access we neeed to check if the DOS readonly attribute // and if the volume is read-only @@ -438,7 +401,6 @@ throw new AccessDeniedException( file.getPathForExceptionMessage(), null, "Read-only file system"); } - return; } }
--- a/src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java Fri May 31 15:42:54 2013 -0700 @@ -844,6 +844,23 @@ static native void AdjustTokenPrivileges(long token, long luid, int attributes) throws WindowsException; + + /** + * AccessCheck( + * PSECURITY_DESCRIPTOR pSecurityDescriptor, + * HANDLE ClientToken, + * DWORD DesiredAccess, + * PGENERIC_MAPPING GenericMapping, + * PPRIVILEGE_SET PrivilegeSet, + * LPDWORD PrivilegeSetLength, + * LPDWORD GrantedAccess, + * LPBOOL AccessStatus + * ) + */ + static native boolean AccessCheck(long token, long securityInfo, int accessMask, + int genericRead, int genericWrite, int genericExecute, int genericAll) + throws WindowsException; + /** */ static long LookupPrivilegeValue(String name) throws WindowsException { @@ -858,28 +875,6 @@ throws WindowsException; /** - * BuildTrusteeWithSid( - * PTRUSTEE pTrustee, - * PSID pSid - * ) - * - * @return pTrustee - */ - static native long BuildTrusteeWithSid(long pSid); - - /** - * GetEffectiveRightsFromAcl( - * PACL pacl, - * PTRUSTEE pTrustee, - * PACCESS_MASK pAccessRights - * ) - * - * @return AccessRights - */ - static native int GetEffectiveRightsFromAcl(long pAcl, long pTrustee) - throws WindowsException; - - /** * CreateSymbolicLink( * LPCWSTR lpSymlinkFileName, * LPCWSTR lpTargetFileName,
--- a/src/windows/classes/sun/nio/fs/WindowsSecurity.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/nio/fs/WindowsSecurity.java Fri May 31 15:42:54 2013 -0700 @@ -105,19 +105,46 @@ return new Privilege() { @Override public void drop() { - try { - if (stopImpersontating) { - SetThreadToken(0L, 0L); - } else { - if (needToRevert) { + if (token != 0L) { + try { + if (stopImpersontating) + SetThreadToken(0L, 0L); + else if (needToRevert) AdjustTokenPrivileges(token, pLuid, 0); - } + } catch (WindowsException x) { + // should not happen + throw new AssertionError(x); + } finally { + CloseHandle(token); } - } catch (WindowsException x) { - // should not happen - throw new AssertionError(x); } } }; } + + /** + * Check the access right against the securityInfo in the current thread. + */ + static boolean checkAccessMask(long securityInfo, int accessMask, + int genericRead, int genericWrite, int genericExecute, int genericAll) + throws WindowsException + { + int privilegies = TOKEN_QUERY; + long hToken = OpenThreadToken(GetCurrentThread(), privilegies, false); + if (hToken == 0L && processTokenWithDuplicateAccess != 0L) + hToken = DuplicateTokenEx(processTokenWithDuplicateAccess, + privilegies); + + boolean hasRight = false; + if (hToken != 0L) { + try { + hasRight = AccessCheck(hToken, securityInfo, accessMask, + genericRead, genericWrite, genericExecute, genericAll); + } finally { + CloseHandle(hToken); + } + } + return hasRight; + } + }
--- a/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java Fri May 31 15:42:54 2013 -0700 @@ -80,42 +80,24 @@ } else { ktab.processArgs(args); } - try { + ktab.table = KeyTab.getInstance(ktab.name); + if (ktab.table.isMissing() && ktab.action != 'a') { if (ktab.name == null) { - // ktab.admin = new KeyTabAdmin(); // use the default keytab. - ktab.table = KeyTab.getInstance(); - if (ktab.table == null) { - if (ktab.action == 'a') { - ktab.table = KeyTab.create(); - } else { - System.out.println("No default key table exists."); - System.exit(-1); - } - } + System.out.println("No default key table exists."); } else { - if ((ktab.action != 'a') && - !(new File(ktab.name)).exists()) { - System.out.println("Key table " + - ktab.name + " does not exist."); - System.exit(-1); - } else { - ktab.table = KeyTab.getInstance(ktab.name); - } - if (ktab.table == null) { - if (ktab.action == 'a') { - ktab.table = KeyTab.create(ktab.name); - } else { - System.out.println("The format of key table " + - ktab.name + " is incorrect."); - System.exit(-1); - } - } + System.out.println("Key table " + + ktab.name + " does not exist."); } - } catch (RealmException e) { - System.err.println("Error loading key table."); System.exit(-1); - } catch (IOException e) { - System.err.println("Error loading key table."); + } + if (!ktab.table.isValid()) { + if (ktab.name == null) { + System.out.println("The format of the default key table " + + " is incorrect."); + } else { + System.out.println("The format of key table " + + ktab.name + " is incorrect."); + } System.exit(-1); } switch (ktab.action) {
--- a/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Fri May 31 15:42:54 2013 -0700 @@ -89,6 +89,7 @@ rv = setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &opt, sizeof(opt)); if (rv == SOCKET_ERROR) { NET_ThrowNew(env, WSAGetLastError(), "Socket creation failed"); + closesocket(fd); return -1; }
--- a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c Wed May 29 13:24:33 2013 -0700 +++ b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c Fri May 31 15:42:54 2013 -0700 @@ -1021,6 +1021,33 @@ throwWindowsException(env, GetLastError()); } +JNIEXPORT jboolean JNICALL +Java_sun_nio_fs_WindowsNativeDispatcher_AccessCheck(JNIEnv* env, + jclass this, jlong token, jlong securityInfo, jint accessMask, + jint genericRead, jint genericWrite, jint genericExecute, jint genericAll) +{ + HANDLE hImpersonatedToken = (HANDLE)jlong_to_ptr(token); + PSECURITY_DESCRIPTOR security = (PSECURITY_DESCRIPTOR)jlong_to_ptr(securityInfo); + DWORD checkAccessRights = (DWORD)accessMask; + GENERIC_MAPPING mapping = { + genericRead, + genericWrite, + genericExecute, + genericAll}; + PRIVILEGE_SET privileges = {0}; + DWORD privilegesLength = sizeof(privileges); + DWORD grantedAccess = 0; + BOOL result = FALSE; + + /* checkAccessRights is in-out parameter */ + MapGenericMask(&checkAccessRights, &mapping); + if (AccessCheck(security, hImpersonatedToken, checkAccessRights, + &mapping, &privileges, &privilegesLength, &grantedAccess, &result) == 0) + throwWindowsException(env, GetLastError()); + + return (result == FALSE) ? JNI_FALSE : JNI_TRUE; +} + JNIEXPORT jlong JNICALL Java_sun_nio_fs_WindowsNativeDispatcher_LookupPrivilegeValue0(JNIEnv* env, jclass this, jlong name) @@ -1037,35 +1064,6 @@ return ptr_to_jlong(pLuid); } -JNIEXPORT jlong JNICALL -Java_sun_nio_fs_WindowsNativeDispatcher_BuildTrusteeWithSid(JNIEnv* env, - jclass this, jlong sid) -{ - PSID pSid = (HANDLE)jlong_to_ptr(sid); - PTRUSTEE_W pTrustee = LocalAlloc(0, sizeof(TRUSTEE_W)); - - if (pTrustee == NULL) { - JNU_ThrowInternalError(env, "Unable to allocate TRUSTEE_W structure"); - } else { - BuildTrusteeWithSidW(pTrustee, pSid); - } - return ptr_to_jlong(pTrustee); -} - -JNIEXPORT jint JNICALL -Java_sun_nio_fs_WindowsNativeDispatcher_GetEffectiveRightsFromAcl(JNIEnv* env, - jclass this, jlong acl, jlong trustee) -{ - ACCESS_MASK access; - PACL pAcl = (PACL)jlong_to_ptr(acl); - PTRUSTEE pTrustee = (PTRUSTEE)jlong_to_ptr(trustee); - - if (GetEffectiveRightsFromAcl(pAcl, pTrustee, &access) != ERROR_SUCCESS) { - throwWindowsException(env, GetLastError()); - } - return (jint)access; -} - JNIEXPORT void JNICALL Java_sun_nio_fs_WindowsNativeDispatcher_CreateSymbolicLink0(JNIEnv* env, jclass this, jlong linkAddress, jlong targetAddress, jint flags)
--- a/test/Makefile Wed May 29 13:24:33 2013 -0700 +++ b/test/Makefile Fri May 31 15:42:54 2013 -0700 @@ -513,6 +513,7 @@ java/sql javax/sql \ javax/smartcardio \ javax/xml/soap \ + javax/xml/jaxp \ com/sun/xml \ javax/xml/ws com/sun/internal/ws \ com/sun/org/apache/xerces \
--- a/test/demo/zipfs/ZipFSTester.java Wed May 29 13:24:33 2013 -0700 +++ b/test/demo/zipfs/ZipFSTester.java Fri May 31 15:42:54 2013 -0700 @@ -138,14 +138,31 @@ Path dst3 = Paths.get(tmpName + "_Tmp"); Files.move(dst2, dst3); checkEqual(src, dst3); + if (Files.exists(dst2)) + throw new RuntimeException("Failed!"); + + // copyback + move + Files.copy(dst3, dst); + Path dst4 = getPathWithParents(fs, tmpName + "_Tmp0"); + Files.move(dst, dst4); + checkEqual(src, dst4); // delete - if (Files.exists(dst2)) + Files.delete(dst4); + if (Files.exists(dst4)) throw new RuntimeException("Failed!"); Files.delete(dst3); if (Files.exists(dst3)) throw new RuntimeException("Failed!"); + // move (existing entry) + Path dst5 = fs.getPath("META-INF/MANIFEST.MF"); + if (Files.exists(dst5)) { + Path dst6 = fs.getPath("META-INF/MANIFEST.MF_TMP"); + Files.move(dst5, dst6); + walk(fs.getPath("/")); + } + // newInputStream on dir Path parent = dst2.getParent(); try { @@ -540,6 +557,20 @@ bbSrc.flip(); bbDst.flip(); } + + // Check if source read position is at the end + if (chSrc.position() != chSrc.size()) { + System.out.printf("src[%s]: size=%d, position=%d%n", + chSrc.toString(), chSrc.size(), chSrc.position()); + throw new RuntimeException("CHECK FAILED!"); + } + + // Check if destination read position is at the end + if (chDst.position() != chDst.size()) { + System.out.printf("dst[%s]: size=%d, position=%d%n", + chDst.toString(), chDst.size(), chDst.position()); + throw new RuntimeException("CHECK FAILED!"); + } } catch (IOException x) { x.printStackTrace(); } @@ -587,6 +618,20 @@ dstCh.write(bb); bb.clear(); } + + // Check if source read position is at the end + if (srcCh.position() != srcCh.size()) { + System.out.printf("src[%s]: size=%d, position=%d%n", + srcCh.toString(), srcCh.size(), srcCh.position()); + throw new RuntimeException("CHECK FAILED!"); + } + + // Check if destination write position is at the end + if (dstCh.position() != dstCh.size()) { + System.out.printf("dst[%s]: size=%d, position=%d%n", + dstCh.toString(), dstCh.size(), dstCh.position()); + throw new RuntimeException("CHECK FAILED!"); + } } } @@ -616,10 +661,17 @@ try (SeekableByteChannel sbc = Files.newByteChannel(path)) { System.out.printf(" sbc[0]: pos=%d, size=%d%n", sbc.position(), sbc.size()); + if (sbc.position() != 0) { + throw new RuntimeException("CHECK FAILED!"); + } + bb = ByteBuffer.allocate((int)sbc.size()); n = sbc.read(bb); System.out.printf(" sbc[1]: read=%d, pos=%d, size=%d%n", n, sbc.position(), sbc.size()); + if (sbc.position() != sbc.size()) { + throw new RuntimeException("CHECK FAILED!"); + } bb2 = ByteBuffer.allocate((int)sbc.size()); } @@ -629,10 +681,16 @@ sbc.position(N); System.out.printf(" sbc[2]: pos=%d, size=%d%n", sbc.position(), sbc.size()); + if (sbc.position() != N) { + throw new RuntimeException("CHECK FAILED!"); + } bb2.limit(100); n = sbc.read(bb2); System.out.printf(" sbc[3]: read=%d, pos=%d, size=%d%n", n, sbc.position(), sbc.size()); + if (n < 0 || sbc.position() != (N + n)) { + throw new RuntimeException("CHECK FAILED!"); + } System.out.printf(" sbc[4]: bb[%d]=%d, bb1[0]=%d%n", N, bb.get(N) & 0xff, bb2.get(0) & 0xff); }
--- a/test/demo/zipfs/basic.sh Wed May 29 13:24:33 2013 -0700 +++ b/test/demo/zipfs/basic.sh Fri May 31 15:42:54 2013 -0700 @@ -22,6 +22,7 @@ # # @test # @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596 +# 7157656 8002390 # @summary Test ZipFileSystem demo # @build Basic PathOps ZipFSTester # @run shell basic.sh
--- a/test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6385277 - * @summary Tests that override redirect window gets activated on click. - * @author anton.tarasov@sun.com: area=awt.focus - * @library ../../regtesthelpers - * @build Util - * @run main OverrideRedirectWindowActivationTest - */ -import java.awt.*; -import java.awt.event.*; -import java.util.concurrent.Callable; -import javax.swing.SwingUtilities; -import sun.awt.SunToolkit; -import test.java.awt.regtesthelpers.Util; - -public class OverrideRedirectWindowActivationTest { - - private static Frame frame; - private static Window window; - private static Button fbutton; - private static Button wbutton; - private static Label label; - private static Robot robot; - private static SunToolkit toolkit; - - public static void main(String[] args) throws Exception { - - if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) { - System.out.println("No testing on Motif. Test passed."); - return; - } - - toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); - robot = new Robot(); - robot.setAutoDelay(50); - - Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { - - public void eventDispatched(AWTEvent e) { - System.out.println(e); - } - }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK); - - createAndShowWindow(); - toolkit.realSync(); - - createAndShowFrame(); - toolkit.realSync(); - - // click on Frame - clickOn(getClickPoint(frame)); - - if (!frame.isFocused()) { - throw new RuntimeException("Error: a frame couldn't be focused by click."); - } - - //click on Label in Window - clickOn(getClickPoint(label)); - - if (!window.isFocused()) { - throw new RuntimeException("Test failed: the window couldn't be activated by click!"); - } - - // bring focus back to the frame - clickOn(getClickPoint(fbutton)); - - if (!frame.isFocused()) { - throw new RuntimeException("Error: a frame couldn't be focused by click."); - } - - // Test 2. Verifies that clicking on a component of unfocusable Window - // won't activate it. - - window.setFocusableWindowState(false); - toolkit.realSync(); - - - clickOn(getClickPoint(label)); - - if (window.isFocused()) { - throw new RuntimeException("Test failed: unfocusable window got activated by click!"); - } - System.out.println("Test passed."); - - } - - private static void createAndShowWindow() { - - frame = new Frame("Test Frame"); - window = new Window(frame); - wbutton = new Button("wbutton"); - label = new Label("label"); - - window.setBounds(800, 200, 200, 100); - window.setLayout(new FlowLayout()); - window.add(wbutton); - window.add(label); - window.setVisible(true); - - } - - private static void createAndShowFrame() { - fbutton = new Button("fbutton"); - - frame.setBounds(800, 0, 200, 100); - frame.setLayout(new FlowLayout()); - frame.add(fbutton); - frame.setVisible(true); - - } - - static void clickOn(Point point) { - - robot.mouseMove(point.x, point.y); - - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); - - toolkit.realSync(); - } - - static Point getClickPoint(Component c) { - Point p = c.getLocationOnScreen(); - Dimension d = c.getSize(); - return new Point(p.x + (int) (d.getWidth() / 2), p.y + (int) (d.getHeight() / 2)); - } - - static Point getClickPoint(Frame frame) { - Point p = frame.getLocationOnScreen(); - Dimension d = frame.getSize(); - return new Point(p.x + (int) (d.getWidth() / 2), p.y + (frame.getInsets().top / 2)); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6385277 + * @summary Tests that override redirect window gets activated on click. + * @author anton.tarasov@sun.com: area=awt.focus + * @library ../../regtesthelpers + * @build Util + * @run main SimpleWindowActivationTest + */ +import java.awt.*; +import java.awt.event.*; +import java.util.concurrent.Callable; +import javax.swing.SwingUtilities; +import sun.awt.SunToolkit; +import test.java.awt.regtesthelpers.Util; + +public class SimpleWindowActivationTest { + + private static Frame frame; + private static Window window; + private static Button fbutton; + private static Button wbutton; + private static Label label; + private static Robot robot; + private static SunToolkit toolkit; + + public static void main(String[] args) throws Exception { + + if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) { + System.out.println("No testing on Motif. Test passed."); + return; + } + + toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + robot = new Robot(); + robot.setAutoDelay(50); + + Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { + + public void eventDispatched(AWTEvent e) { + System.out.println(e); + } + }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK); + + createAndShowWindow(); + toolkit.realSync(); + + createAndShowFrame(); + toolkit.realSync(); + + // click on Frame + clickOn(getClickPoint(frame)); + + if (!frame.isFocused()) { + throw new RuntimeException("Error: a frame couldn't be focused by click."); + } + + //click on Label in Window + clickOn(getClickPoint(label)); + + if (!window.isFocused()) { + throw new RuntimeException("Test failed: the window couldn't be activated by click!"); + } + + // bring focus back to the frame + clickOn(getClickPoint(fbutton)); + + if (!frame.isFocused()) { + throw new RuntimeException("Error: a frame couldn't be focused by click."); + } + + // Test 2. Verifies that clicking on a component of unfocusable Window + // won't activate it. + + window.setFocusableWindowState(false); + toolkit.realSync(); + + + clickOn(getClickPoint(label)); + + if (window.isFocused()) { + throw new RuntimeException("Test failed: unfocusable window got activated by click!"); + } + System.out.println("Test passed."); + + } + + private static void createAndShowWindow() { + + frame = new Frame("Test Frame"); + window = new Window(frame); + wbutton = new Button("wbutton"); + label = new Label("label"); + + window.setBounds(800, 200, 300, 100); + window.setLayout(new FlowLayout()); + window.add(wbutton); + window.add(label); + window.setVisible(true); + + } + + private static void createAndShowFrame() { + fbutton = new Button("fbutton"); + + frame.setBounds(800, 0, 300, 100); + frame.setLayout(new FlowLayout()); + frame.add(fbutton); + frame.setVisible(true); + + } + + static void clickOn(Point point) { + + robot.mouseMove(point.x, point.y); + + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + } + + static Point getClickPoint(Component c) { + Point p = c.getLocationOnScreen(); + Dimension d = c.getSize(); + return new Point(p.x + (int) (d.getWidth() / 2), p.y + (int) (d.getHeight() / 2)); + } + + static Point getClickPoint(Frame frame) { + Point p = frame.getLocationOnScreen(); + Dimension d = frame.getSize(); + return new Point(p.x + (int) (d.getWidth() / 2), p.y + (frame.getInsets().top / 2)); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Graphics2D/FillTexturePaint/FillTexturePaint.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.awt.TexturePaint; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; + +/** + * @test + * @bug 8000629 + * @summary TexturePaint areas shouldn't separates. + * @author Sergey Bylokhov + */ +public class FillTexturePaint { + + private static TexturePaint shape; + private static final int size = 400; + + static { + BufferedImage bi = new BufferedImage(50, 50, + BufferedImage.TYPE_INT_RGB); + Graphics2D gi = bi.createGraphics(); + gi.setBackground(Color.GREEN); + gi.clearRect(0, 0, 50, 50); + shape = new TexturePaint(bi, new Rectangle(0, 0, 50, 50)); + } + + public static void main(final String[] args) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = + ge.getDefaultScreenDevice().getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(size, size); + while (true) { + vi.validate(gc); + Graphics2D g2d = vi.createGraphics(); + g2d.setComposite(AlphaComposite.Src); + g2d.setPaint(shape); + g2d.fill(new Rectangle(0, 0, size, size)); + g2d.dispose(); + + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + BufferedImage bi = vi.getSnapshot(); + + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + for (int x = 0; x < size; ++x) { + for (int y = 0; y < size; ++y) { + if (bi.getRGB(x, y) != Color.GREEN.getRGB()) { + throw new RuntimeException("Test failed."); + } + } + } + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Graphics2D/FlipDrawImage/FlipDrawImage.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; + +/** + * @test + * @bug 8000629 + * @author Sergey Bylokhov + */ +public final class FlipDrawImage { + + private static final int width = 400; + private static final int height = 400; + + public static void main(final String[] args) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = + ge.getDefaultScreenDevice().getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(width, height); + final BufferedImage bi = new BufferedImage(width, height, + BufferedImage.TYPE_INT_ARGB); + while (true) { + vi.validate(gc); + Graphics2D g2d = vi.createGraphics(); + g2d.setColor(Color.red); + g2d.fillRect(0, 0, width, height); + g2d.setColor(Color.green); + g2d.fillRect(0, 0, width / 2, height / 2); + g2d.dispose(); + + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + Graphics2D g = bi.createGraphics(); + g.setComposite(AlphaComposite.Src); + g.setColor(Color.BLUE); + g.fillRect(0, 0, width, height); + // destination width and height are flipped and scale is used. + g.drawImage(vi, width / 2, height / 2, -width / 2, -height / 2, + null, null); + g.dispose(); + + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + for (int x = 0; x < width; ++x) { + for (int y = 0; y < height; ++y) { + if (x < width / 2 && y < height / 2) { + if (x >= width / 4 && y >= height / 4) { + if (bi.getRGB(x, y) != Color.green.getRGB()) { + throw new RuntimeException("Test failed."); + } + } else if (bi.getRGB(x, y) != Color.red.getRGB()) { + throw new RuntimeException("Test failed."); + } + } else { + if (bi.getRGB(x, y) != Color.BLUE.getRGB()) { + throw new RuntimeException("Test failed."); + } + } + } + } + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Graphics2D/TransformSetGet/TransformSetGet.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.geom.AffineTransform; +import java.awt.image.VolatileImage; + +import sun.java2d.SunGraphics2D; + +/** + * @test + * @bug 8000629 + * @summary Set/get transform should work on constrained graphics. + * @author Sergey Bylokhov + */ +public class TransformSetGet { + + public static void main(final String[] args) { + final GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + final GraphicsConfiguration gc = + ge.getDefaultScreenDevice().getDefaultConfiguration(); + final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); + final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); + + sg2d.constrain(0, 61, 100, 100); + final AffineTransform expected = sg2d.cloneTransform(); + sg2d.setTransform(sg2d.getTransform()); + final AffineTransform actual = sg2d.cloneTransform(); + sg2d.dispose(); + vi.flush(); + if (!expected.equals(actual)) { + System.out.println("Expected = " + expected); + System.out.println("Actual = " + actual); + throw new RuntimeException("Wrong transform"); + } + } +}
--- a/test/java/awt/TrayIcon/DragEventSource/DragEventSource.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/awt/TrayIcon/DragEventSource/DragEventSource.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,6 +64,21 @@ } private static void init() { + + boolean isSupported = tray.isSupported(); + System.out.println("is SysTray Supported: " + isSupported); + + if (!isSupported) { + String[] instructions = + { + "The test cannot be run because SystemTray is not supported.", + "Simply press PASS button." + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + return; + } + String[] instructions = { "Use see a Frame with a button in it.", @@ -79,8 +94,8 @@ frame.setLayout(new FlowLayout()); tray = SystemTray.getSystemTray(); - boolean isSupported = tray.isSupported(); - System.out.println("is SysTray Supported: " + isSupported); + + TrayIcon icons[] = tray.getTrayIcons(); System.out.println(icons.length);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/WMSpecificTests/Metacity/FullscreenDialogModality.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8012586 + * @summary verify that modal dialog will appeared above fullscreen window under Metacity WM. + * @library ../../regtesthelpers + * @build Util + * @run main FullscreenDialogModality + * @run main/othervm FullscreenDialogModality + * @author vkravets + */ + +import test.java.awt.regtesthelpers.Util; + +import java.awt.*; +import java.lang.reflect.InvocationTargetException; + +public class FullscreenDialogModality extends Frame { + + static Robot robot = null; + + public void enterFS() { + GraphicsDevice gd = getGraphicsConfiguration().getDevice(); + final boolean fs = gd.isFullScreenSupported(); + System.out.println("FullscreenSupported: " + (fs ? "yes" : "no")); + gd.setFullScreenWindow(this); + try { + // Give the system time to set the FS window and display it + // properly + Thread.sleep(2000); + } catch (Exception e) {} + } + + public void exitFS() { + GraphicsDevice gd = getGraphicsConfiguration().getDevice(); + // reset window + gd.setFullScreenWindow(null); + try { + // Give the system time to set the FS window and display it + // properly + Thread.sleep(2000); + } catch (Exception e) {} + } + + public void checkDialogModality() throws InvocationTargetException, InterruptedException { + // Dialog + final Dialog d = new Dialog(FullscreenDialogModality.this, "Modal dialog", Dialog.ModalityType.APPLICATION_MODAL); + d.setBounds(500, 500, 160, 160); + d.setModal(true); + d.setBackground(Color.red); + EventQueue.invokeLater(new Runnable() + { + public void run() + { + d.setVisible(true); + } + }); + // Wait until the dialog is shown + EventQueue.invokeLater(new Runnable() { + public void run() { + // Empty + } + }); + + Util.waitForIdle(robot); + try { + //Check color + Point checkPoint = new Point(d.getX() + d.getWidth() / 2, d.getY() + d.getHeight() / 2); + Color actual = robot.getPixelColor(checkPoint.x, checkPoint.y); + System.out.println("Color = " + actual); + if (actual.getRGB() == Color.GREEN.getRGB()) { + throw new RuntimeException("Test FAILED: Modal dialog shown below fullscreen window"); + } else if (actual.getRGB() == Color.RED.getRGB()) { + System.out.println("Test PASSED: Modal dialog shown above fullscreen window"); + } else { + System.out.println("pixelColor " + + Integer.toHexString(actual.getRGB()) + + " at coordinates (" + checkPoint.x + ", " + checkPoint.y + ")"); + throw new RuntimeException("Test FAILED: Unexpected behavior"); + } + + robot.delay(2000); + Util.waitForIdle(robot); + } finally { + d.dispose(); + } + } + + public static void main(String args[]) throws InvocationTargetException, InterruptedException { + if (Util.getWMID() != Util.METACITY_WM) { + System.out.println("This test is only useful on Metacity"); + return; + } + robot = Util.createRobot(); + Util.waitForIdle(robot); + final FullscreenDialogModality frame = new FullscreenDialogModality(); + frame.setUndecorated(true); + frame.setBackground(Color.green); + frame.setSize(500, 500); + frame.setVisible(true); + try { + robot.delay(100); + Util.waitForIdle(robot); + + EventQueue.invokeAndWait(new Runnable() { + public void run() { + frame.enterFS(); + } + }); + robot.delay(200); + Util.waitForIdle(robot); + + frame.checkDialogModality(); + + EventQueue.invokeAndWait(new Runnable() { + public void run() { + frame.exitFS(); + } + }); + } finally { + frame.dispose(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/DrawImage/IncorrectBounds.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; + +/** + * @test + * @bug 8000629 + * @summary Temporary backbuffer in the DrawImage should not fill background + * outside of source image bounds. + * @author Sergey Bylokhov + */ +public final class IncorrectBounds { + + private static final int width = 400; + private static final int height = 400; + + public static void main(final String[] args) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = + ge.getDefaultScreenDevice().getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(width / 4, + height / 4); + final BufferedImage bi = new BufferedImage(width, height, + BufferedImage.TYPE_INT_ARGB); + while (true) { + vi.validate(gc); + Graphics2D g2d = vi.createGraphics(); + g2d.setColor(Color.green); + g2d.fillRect(0, 0, width / 4, height / 4); + g2d.dispose(); + + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + Graphics2D g = bi.createGraphics(); + g.setComposite(AlphaComposite.Src); + g.setColor(Color.red); + g.fillRect(0, 0, width, height); + // Use sx and sy outside of VI bounds. + g.drawImage(vi, 0, 0, width / 2, height / 2, 0, 0, width * 2, + height * 2, null); + g.dispose(); + + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + for (int x = 0; x < width; ++x) { + for (int y = 0; y < height; ++y) { + if (x < width / 16 && y < height / 16) { + if (bi.getRGB(x, y) != Color.green.getRGB()) { + throw new RuntimeException("Test failed."); + } + } else { + if (bi.getRGB(x, y) != Color.red.getRGB()) { + throw new RuntimeException("Test failed."); + } + } + } + } + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/image/DrawImage/IncorrectOffset.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; + +/** + * @test + * @bug 8000629 + * @summary Temporary backbuffer in the DrawImage should have correct offset. + * @author Sergey Bylokhov + */ +public final class IncorrectOffset { + + private static final int width = 400; + private static final int height = 400; + + public static void main(final String[] args) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration gc = + ge.getDefaultScreenDevice().getDefaultConfiguration(); + VolatileImage vi = gc.createCompatibleVolatileImage(width, height); + BufferedImage bi = new BufferedImage(width / 4, height / 4, + BufferedImage.TYPE_INT_ARGB); + while (true) { + vi.validate(gc); + Graphics2D g2d = vi.createGraphics(); + g2d.setColor(Color.black); + g2d.fillRect(0, 0, width, height); + g2d.setColor(Color.green); + g2d.fillRect(width / 4, height / 4, width / 2, height / 2); + g2d.dispose(); + + if (vi.validate(gc) != VolatileImage.IMAGE_OK) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + Graphics2D g = bi.createGraphics(); + g.setComposite(AlphaComposite.Src); + // Scale part of VI to BI. Only green area should be copied. + g.drawImage(vi, 0, 0, width / 4, height / 4, width / 4, height / 4, + width / 4 + width / 2, height / 4 + height / 2, null); + g.dispose(); + + if (vi.contentsLost()) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + continue; + } + + for (int x = 0; x < width / 4; ++x) { + for (int y = 0; y < height / 4; ++y) { + if (bi.getRGB(x, y) != Color.green.getRGB()) { + throw new RuntimeException("Test failed."); + } + } + } + break; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 800535 + * @summary JDK7 Printing: CJK and Latin Text in string overlap + * @run main/manual=yesno PrintLatinCJKTest + */ + +import java.awt.Font; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.print.PageFormat; +import java.awt.print.Pageable; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JTextArea; + +import javax.swing.SwingUtilities; + +public class PrintLatinCJKTest implements Printable, ActionListener { + + static PrintLatinCJKTest testInstance = new PrintLatinCJKTest(); + private PageFormat pf; + + static String info = + "You need a printer for this test. If you have none, let "+ + "the test pass. If there is a printer, press Print, send "+ + "the output to the printer, and examine it. It should have "+ + "text looking like this : \u4e00\u4e01\u4e02\u4e03\u4e04English."; + + public static void showFrame() { + JFrame f = new JFrame(); + JTextArea jta = new JTextArea(info, 4, 30); + jta.setLineWrap(true); + jta.setWrapStyleWord(true); + f.add("Center", jta); + JButton b = new JButton("Print"); + b.addActionListener(testInstance); + f.add("South", b); + f.pack(); + f.setVisible(true); + } + + public int print(Graphics g, PageFormat pf, int pageIndex) + throws PrinterException { + + if (pageIndex > 0) { + return Printable.NO_SUCH_PAGE; + } + g.translate((int) pf.getImageableX(), (int) pf.getImageableY()); + g.setFont(new Font("Dialog", Font.PLAIN, 36)); + g.drawString("\u4e00\u4e01\u4e02\u4e03\u4e04English", 20, 100); + return Printable.PAGE_EXISTS; + } + + public void actionPerformed(ActionEvent e) { + try { + PrinterJob job = PrinterJob.getPrinterJob(); + job.setPrintable(testInstance); + if (job.printDialog()) { + job.print(); + } + } catch (PrinterException ex) { + ex.printStackTrace(); + } + } + + public static void main(String[] args) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + showFrame(); + } + }); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/XMLEncoder/Test8013416.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8013416 + * @summary Tests public synthetic methods + * @author Sergey Malenkov + */ + +import java.beans.DefaultPersistenceDelegate; +import java.beans.Encoder; +import java.beans.Expression; +import java.beans.Statement; +import java.beans.XMLEncoder; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Set; + +public class Test8013416 extends AbstractTest { + public static void main(String[] args) { + new Test8013416().test(true); + } + + protected Object getObject() { + Public<String, String> map = new Public<String, String>(); + map.put(" pz1 ", " pz2 "); + map.put(" pz3 ", " pz4 "); + return map; + } + + @Override + protected void initialize(XMLEncoder encoder) { + super.initialize(encoder); + encoder.setPersistenceDelegate(Public.class, new PublicPersistenceDelegate()); + } + + private static final class PublicPersistenceDelegate extends DefaultPersistenceDelegate { + @Override + protected Expression instantiate(Object oldInstance, Encoder out) { + return new Expression(oldInstance, oldInstance.getClass(), "new", null); + } + + @Override + protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) { + super.initialize(type, oldInstance, newInstance, out); + + Public<String, String> map = (Public) oldInstance; + for (Entry<String, String> entry : map.getAll()) { + String[] args = {entry.getKey(), entry.getValue()}; + out.writeStatement(new Statement(oldInstance, "put", args)); + } + } + } + + public static final class Public<K, V> extends Private<K, V> { + } + + private static class Private<K, V> { + private HashMap<K, V> map = new HashMap<K, V>(); + + public void put(K key, V value) { + this.map.put(key, value); + } + + public Set<Entry<K, V>> getAll() { + return this.map.entrySet(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/io/File/NulFile.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,625 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 8003992 + * @summary Test a file whose path name is embedded with NUL character, and + * ensure it is handled correctly. + * @author Dan Xu + */ + +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.RandomAccessFile; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.nio.file.InvalidPathException; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectInputStream; + +public class NulFile { + + private static final char CHAR_NUL = '\u0000'; + + private static final String ExceptionMsg = "Invalid file path"; + + public static void main(String[] args) { + testFile(); + testFileInUnix(); + testFileInWindows(); + testTempFile(); + } + + private static void testFile() { + test(new File(new StringBuilder().append(CHAR_NUL).toString())); + test(new File( + new StringBuilder().append("").append(CHAR_NUL).toString())); + test(new File( + new StringBuilder().append(CHAR_NUL).append("").toString())); + } + + private static void testFileInUnix() { + String osName = System.getProperty("os.name"); + if (osName.startsWith("Windows")) + return; + + String unixFile = "/"; + test(unixFile); + + unixFile = "//"; + test(unixFile); + + unixFile = "data/info"; + test(unixFile); + + unixFile = "/data/info"; + test(unixFile); + + unixFile = "//data//info"; + test(unixFile); + } + + private static void testFileInWindows() { + String osName = System.getProperty("os.name"); + if (!osName.startsWith("Windows")) + return; + + String windowsFile = "\\"; + test(windowsFile); + + windowsFile = "\\\\"; + test(windowsFile); + + windowsFile = "/"; + test(windowsFile); + + windowsFile = "//"; + test(windowsFile); + + windowsFile = "/\\"; + test(windowsFile); + + windowsFile = "\\/"; + test(windowsFile); + + windowsFile = "data\\info"; + test(windowsFile); + + windowsFile = "\\data\\info"; + test(windowsFile); + + windowsFile = "\\\\server\\data\\info"; + test(windowsFile); + + windowsFile = "z:data\\info"; + test(windowsFile); + + windowsFile = "z:\\data\\info"; + test(windowsFile); + } + + private static void test(final String name) { + int length = name.length(); + + for (int i = 0; i <= length; i++) { + StringBuilder sbName = new StringBuilder(name); + sbName.insert(i, CHAR_NUL); + String curName = sbName.toString(); + + // test File(String parent, String child) + File testFile = new File(curName, "child"); + test(testFile); + testFile = new File("parent", curName); + test(testFile); + + // test File(String pathname) + testFile = new File(curName); + test(testFile); + + // test File(File parent, String child) + testFile = new File(new File(curName), "child"); + test(testFile); + testFile = new File(new File("parent"), curName); + test(testFile); + + // test FileInputStream + testFileInputStream(curName); + + // test FileOutputStream + testFileOutputStream(curName); + + // test RandomAccessFile + testRandomAccessFile(curName); + } + } + + private static void testFileInputStream(final String str) { + boolean exceptionThrown = false; + FileInputStream is = null; + try { + is = new FileInputStream(str); + } catch (FileNotFoundException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("FileInputStream constructor" + + " should throw FileNotFoundException"); + } + if (is != null) { + throw new RuntimeException("FileInputStream constructor" + + " should fail"); + } + + exceptionThrown = false; + is = null; + try { + is = new FileInputStream(new File(str)); + } catch (FileNotFoundException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("FileInputStream constructor" + + " should throw FileNotFoundException"); + } + if (is != null) { + throw new RuntimeException("FileInputStream constructor" + + " should fail"); + } + } + + private static void testFileOutputStream(final String str) { + boolean exceptionThrown = false; + FileOutputStream os = null; + try { + os = new FileOutputStream(str); + } catch (FileNotFoundException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("FileOutputStream constructor" + + " should throw FileNotFoundException"); + } + if (os != null) { + throw new RuntimeException("FileOutputStream constructor" + + " should fail"); + } + + exceptionThrown = false; + os = null; + try { + os = new FileOutputStream(new File(str)); + } catch (FileNotFoundException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("FileOutputStream constructor" + + " should throw FileNotFoundException"); + } + if (os != null) { + throw new RuntimeException("FileOutputStream constructor" + + " should fail"); + } + } + + private static void testRandomAccessFile(final String str) { + boolean exceptionThrown = false; + RandomAccessFile raf = null; + String[] modes = {"r", "rw", "rws", "rwd"}; + + for (String mode : modes) { + try { + raf = new RandomAccessFile(str, mode); + } catch (FileNotFoundException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("RandomAccessFile constructor" + + " should throw FileNotFoundException"); + } + if (raf != null) { + throw new RuntimeException("RandomAccessFile constructor" + + " should fail"); + } + + exceptionThrown = false; + raf = null; + try { + raf = new RandomAccessFile(new File(str), mode); + } catch (FileNotFoundException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("RandomAccessFile constructor" + + " should throw FileNotFoundException"); + } + if (raf != null) { + throw new RuntimeException("RandomAccessFile constructor" + + " should fail"); + } + } + } + + private static void test(File testFile) { + test(testFile, false); + // test serialization + testSerialization(testFile); + } + + @SuppressWarnings("deprecation") + private static void test(File testFile, boolean derived) { + boolean exceptionThrown = false; + + if (testFile == null) { + throw new RuntimeException("test file should not be null."); + } + + // getPath() + if (testFile.getPath().indexOf(CHAR_NUL) < 0) { + throw new RuntimeException( + "File path should contain Nul character"); + } + // getAbsolutePath() + if (testFile.getAbsolutePath().indexOf(CHAR_NUL) < 0) { + throw new RuntimeException( + "File absolute path should contain Nul character"); + } + // getAbsoluteFile() + File derivedAbsFile = testFile.getAbsoluteFile(); + if (derived) { + if (derivedAbsFile.getPath().indexOf(CHAR_NUL) < 0) { + throw new RuntimeException( + "Derived file path should also contain Nul character"); + } + } else { + test(derivedAbsFile, true); + } + // getCanonicalPath() + try { + exceptionThrown = false; + testFile.getCanonicalPath(); + } catch (IOException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException( + "getCanonicalPath() should throw IOException with" + + " message \"" + ExceptionMsg + "\""); + } + // getCanonicalFile() + try { + exceptionThrown = false; + testFile.getCanonicalFile(); + } catch (IOException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException( + "getCanonicalFile() should throw IOException with" + + " message \"" + ExceptionMsg + "\""); + } + // toURL() + try { + exceptionThrown = false; + testFile.toURL(); + } catch (MalformedURLException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("toURL() should throw IOException with" + + " message \"" + ExceptionMsg + "\""); + } + // canRead() + if (testFile.canRead()) + throw new RuntimeException("File should not be readable"); + // canWrite() + if (testFile.canWrite()) + throw new RuntimeException("File should not be writable"); + // exists() + if (testFile.exists()) + throw new RuntimeException("File should not be existed"); + // isDirectory() + if (testFile.isDirectory()) + throw new RuntimeException("File should not be a directory"); + // isFile() + if (testFile.isFile()) + throw new RuntimeException("File should not be a file"); + // isHidden() + if (testFile.isHidden()) + throw new RuntimeException("File should not be hidden"); + // lastModified() + if (testFile.lastModified() != 0L) + throw new RuntimeException("File last modified time should be 0L"); + // length() + if (testFile.length() != 0L) + throw new RuntimeException("File length should be 0L"); + // createNewFile() + try { + exceptionThrown = false; + testFile.createNewFile(); + } catch (IOException ex) { + if (ExceptionMsg.equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException( + "createNewFile() should throw IOException with" + + " message \"" + ExceptionMsg + "\""); + } + // delete() + if (testFile.delete()) + throw new RuntimeException("Delete operation should fail"); + // list() + if (testFile.list() != null) + throw new RuntimeException("File list() should return null"); + // list(FilenameFilter) + FilenameFilter fnFilter = new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return false; + } + }; + if (testFile.list(fnFilter) != null) { + throw new RuntimeException("File list(FilenameFilter) should" + + " return null"); + } + // listFiles() + if (testFile.listFiles() != null) + throw new RuntimeException("File listFiles() should return null"); + // listFiles(FilenameFilter) + if (testFile.listFiles(fnFilter) != null) { + throw new RuntimeException("File listFiles(FilenameFilter)" + + " should return null"); + } + // listFiles(FileFilter) + FileFilter fFilter = new FileFilter() { + @Override + public boolean accept(File file) { + return false; + } + }; + if (testFile.listFiles(fFilter) != null) { + throw new RuntimeException("File listFiles(FileFilter)" + + " should return null"); + } + // mkdir() + if (testFile.mkdir()) { + throw new RuntimeException("File should not be able to" + + " create directory"); + } + // mkdirs() + if (testFile.mkdirs()) { + throw new RuntimeException("File should not be able to" + + " create directories"); + } + // renameTo(File) + if (testFile.renameTo(new File("dest"))) + throw new RuntimeException("File rename should fail"); + if (new File("dest").renameTo(testFile)) + throw new RuntimeException("File rename should fail"); + try { + exceptionThrown = false; + testFile.renameTo(null); + } catch (NullPointerException ex) { + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("File rename should thrown NPE"); + } + // setLastModified(long) + if (testFile.setLastModified(0L)) { + throw new RuntimeException("File should fail to set" + + " last modified time"); + } + try { + exceptionThrown = false; + testFile.setLastModified(-1); + } catch (IllegalArgumentException ex) { + if ("Negative time".equals(ex.getMessage())) + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("File should fail to set" + + " last modified time with message \"Negative time\""); + } + // setReadOnly() + if (testFile.setReadOnly()) + throw new RuntimeException("File should fail to set read-only"); + // setWritable(boolean writable, boolean ownerOnly) + if (testFile.setWritable(true, true)) + throw new RuntimeException("File should fail to set writable"); + if (testFile.setWritable(true, false)) + throw new RuntimeException("File should fail to set writable"); + if (testFile.setWritable(false, true)) + throw new RuntimeException("File should fail to set writable"); + if (testFile.setWritable(false, false)) + throw new RuntimeException("File should fail to set writable"); + // setWritable(boolean writable) + if (testFile.setWritable(false)) + throw new RuntimeException("File should fail to set writable"); + if (testFile.setWritable(true)) + throw new RuntimeException("File should fail to set writable"); + // setReadable(boolean readable, boolean ownerOnly) + if (testFile.setReadable(true, true)) + throw new RuntimeException("File should fail to set readable"); + if (testFile.setReadable(true, false)) + throw new RuntimeException("File should fail to set readable"); + if (testFile.setReadable(false, true)) + throw new RuntimeException("File should fail to set readable"); + if (testFile.setReadable(false, false)) + throw new RuntimeException("File should fail to set readable"); + // setReadable(boolean readable) + if (testFile.setReadable(false)) + throw new RuntimeException("File should fail to set readable"); + if (testFile.setReadable(true)) + throw new RuntimeException("File should fail to set readable"); + // setExecutable(boolean executable, boolean ownerOnly) + if (testFile.setExecutable(true, true)) + throw new RuntimeException("File should fail to set executable"); + if (testFile.setExecutable(true, false)) + throw new RuntimeException("File should fail to set executable"); + if (testFile.setExecutable(false, true)) + throw new RuntimeException("File should fail to set executable"); + if (testFile.setExecutable(false, false)) + throw new RuntimeException("File should fail to set executable"); + // setExecutable(boolean executable) + if (testFile.setExecutable(false)) + throw new RuntimeException("File should fail to set executable"); + if (testFile.setExecutable(true)) + throw new RuntimeException("File should fail to set executable"); + // canExecute() + if (testFile.canExecute()) + throw new RuntimeException("File should not be executable"); + // getTotalSpace() + if (testFile.getTotalSpace() != 0L) + throw new RuntimeException("The total space should be 0L"); + // getFreeSpace() + if (testFile.getFreeSpace() != 0L) + throw new RuntimeException("The free space should be 0L"); + // getUsableSpace() + if (testFile.getUsableSpace() != 0L) + throw new RuntimeException("The usable space should be 0L"); + // compareTo(File null) + try { + exceptionThrown = false; + testFile.compareTo(null); + } catch (NullPointerException ex) { + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("compareTo(null) should throw NPE"); + } + // toString() + if (testFile.toString().indexOf(CHAR_NUL) < 0) { + throw new RuntimeException( + "File path should contain Nul character"); + } + // toPath() + try { + exceptionThrown = false; + testFile.toPath(); + } catch (InvalidPathException ex) { + exceptionThrown = true; + } + if (!exceptionThrown) { + throw new RuntimeException("toPath() should throw" + + " InvalidPathException"); + } + } + + private static void testSerialization(File testFile) { + String path = testFile.getPath(); + try { + // serialize test file + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(testFile); + oos.close(); + // deserialize test file + byte[] bytes = baos.toByteArray(); + ByteArrayInputStream is = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(is); + File newFile = (File) ois.readObject(); + // test + String newPath = newFile.getPath(); + if (!path.equals(newPath)) { + throw new RuntimeException( + "Serialization should not change file path"); + } + test(newFile, false); + } catch (IOException | ClassNotFoundException ex) { + System.err.println("Exception happens in testSerialization"); + System.err.println(ex.getMessage()); + } + } + + private static void testTempFile() { + final String[] names = {"x", "xx", "xxx", "xxxx"}; + final String shortPrefix = "sp"; + final String prefix = "prefix"; + final String suffix = "suffix"; + File tmpDir = new File("tmpDir"); + + for (String name : names) { + int length = name.length(); + for (int i = 0; i <= length; i++) { + StringBuilder sbName = new StringBuilder(name); + sbName.insert(i, CHAR_NUL); + String curName = sbName.toString(); + + // test prefix + testCreateTempFile(curName, suffix, tmpDir); + // test suffix + testCreateTempFile(shortPrefix, curName, tmpDir); + testCreateTempFile(prefix, curName, tmpDir); + // test directory + testCreateTempFile(shortPrefix, suffix, new File(curName)); + testCreateTempFile(prefix, suffix, new File(curName)); + } + } + } + + private static void testCreateTempFile(String prefix, String suffix, + File directory) { + // createTempFile(String prefix, String suffix, File directory) + boolean exceptionThrown = false; + boolean shortPrefix = (prefix.length() < 3); + if (shortPrefix) { + try { + File.createTempFile(prefix, suffix, directory); + } catch (IllegalArgumentException ex) { + if ("Prefix string too short".equals(ex.getMessage())) + exceptionThrown = true; + } catch (IOException ioe) { + System.err.println("IOException happens in testCreateTempFile"); + System.err.println(ioe.getMessage()); + } + } else { + try { + File.createTempFile(prefix, suffix, directory); + } catch (IOException ex) { + if ("Unable to create temporary file".equals(ex.getMessage())) + exceptionThrown = true; + } + } + if (!exceptionThrown) { + throw new RuntimeException("createTempFile() should throw" + + (shortPrefix ? " IllegalArgumentException" + : " IOException")); + } + } +}
--- a/test/java/io/File/isDirectory/Applet.html Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -<!----> -<applet code=Applet.class width=100 height=100></applet>
--- a/test/java/io/Serializable/accessConstants/AccessConstants.java Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* -@test -@bug 4067964 -@clean AccessConstants -@build AccessConstants -@summary Verify that ObjectStreamConstants is public accessible. - This test will not compile pre-JDK 1.2. -*/ - -import java.io.ObjectStreamConstants; - -public class AccessConstants { - public static void main(String[] args) { - byte[] ref = new byte[4]; - ref[0] = ObjectStreamConstants.TC_BASE; - ref[1] = ObjectStreamConstants.TC_NULL; - ref[2] = ObjectStreamConstants.TC_REFERENCE; - ref[3] = ObjectStreamConstants.TC_CLASSDESC; - int version = ObjectStreamConstants.PROTOCOL_VERSION_1; - } -}
--- a/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java Fri May 31 15:42:54 2013 -0700 @@ -22,7 +22,6 @@ */ /* @test - * @clean A B Container ReplacerObjectOutputStream * @summary Verify that ClassCastException is thrown when deserializing * an object and one of its object fields is incompatibly replaced * by either replaceObject/resolveObject.
--- a/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java Fri May 31 15:42:54 2013 -0700 @@ -22,7 +22,6 @@ */ /* @test - * @clean A SubstituteObjectOutputStream SubstituteObjectInputStream * @bug 4099013 * @summary Enable substitution of String and Array by ObjectStreams. */
--- a/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java Fri May 31 15:42:54 2013 -0700 @@ -23,7 +23,6 @@ /* @test * @bug 4065313 - * @clean A ReplaceWithNull MyObjectOutputStream * @summary Ensure that it is okay to replace an object with null. */ import java.io.*;
--- a/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java Fri May 31 15:42:54 2013 -0700 @@ -22,7 +22,6 @@ */ /* @test - * @clean A * @bug 4146453 * @summary Test that regrow of object/handle table of ObjectOutputStream works. */
--- a/test/java/nio/channels/DatagramChannel/Connect.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/nio/channels/DatagramChannel/Connect.java Fri May 31 15:42:54 2013 -0700 @@ -22,6 +22,7 @@ */ /* @test + * @bug 4313882 7183800 * @summary Test DatagramChannel's send and receive methods * @author Mike McCloskey */ @@ -88,6 +89,9 @@ bb.put("hello".getBytes()); bb.flip(); InetAddress address = InetAddress.getLocalHost(); + if (address.isLoopbackAddress()) { + address = InetAddress.getLoopbackAddress(); + } InetSocketAddress isa = new InetSocketAddress(address, port); dc.connect(isa); dc.write(bb);
--- a/test/java/nio/channels/DatagramChannel/ConnectedSend.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/nio/channels/DatagramChannel/ConnectedSend.java Fri May 31 15:42:54 2013 -0700 @@ -22,7 +22,7 @@ */ /* @test - * @bug 4849277 + * @bug 4849277 7183800 * @summary Test DatagramChannel send while connected * @author Mike McCloskey */ @@ -46,14 +46,18 @@ DatagramChannel sndChannel = DatagramChannel.open(); sndChannel.socket().bind(null); + InetAddress address = InetAddress.getLocalHost(); + if (address.isLoopbackAddress()) { + address = InetAddress.getLoopbackAddress(); + } InetSocketAddress sender = new InetSocketAddress( - InetAddress.getLocalHost(), + address, sndChannel.socket().getLocalPort()); DatagramChannel rcvChannel = DatagramChannel.open(); rcvChannel.socket().bind(null); InetSocketAddress receiver = new InetSocketAddress( - InetAddress.getLocalHost(), + address, rcvChannel.socket().getLocalPort()); rcvChannel.connect(sender); @@ -80,14 +84,18 @@ private static void test2() throws Exception { DatagramChannel sndChannel = DatagramChannel.open(); sndChannel.socket().bind(null); + InetAddress address = InetAddress.getLocalHost(); + if (address.isLoopbackAddress()) { + address = InetAddress.getLoopbackAddress(); + } InetSocketAddress sender = new InetSocketAddress( - InetAddress.getLocalHost(), + address, sndChannel.socket().getLocalPort()); DatagramChannel rcvChannel = DatagramChannel.open(); rcvChannel.socket().bind(null); InetSocketAddress receiver = new InetSocketAddress( - InetAddress.getLocalHost(), + address, rcvChannel.socket().getLocalPort()); rcvChannel.connect(sender);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/nio/channels/Selector/RacyDeregister.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ + +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; + +/* + * @test + * @bug 6429204 + * @summary SelectionKey.interestOps does not update interest set on Windows. + * @author Frank Ding + */ +public class RacyDeregister { + + static boolean notified; + static final Object selectorLock = new Object(); + static final Object notifyLock = new Object(); + /** + * null: not terminated + * true: passed + * false: failed + */ + static volatile Boolean succTermination = null; + + public static void main(String[] args) throws Exception { + InetAddress addr = InetAddress.getByName(null); + ServerSocketChannel sc = ServerSocketChannel.open(); + sc.socket().bind(new InetSocketAddress(addr, 0)); + + SocketChannel.open(new InetSocketAddress(addr, + sc.socket().getLocalPort())); + + SocketChannel accepted = sc.accept(); + accepted.configureBlocking(false); + + SocketChannel.open(new InetSocketAddress(addr, + sc.socket().getLocalPort())); + SocketChannel accepted2 = sc.accept(); + accepted2.configureBlocking(false); + + final Selector sel = Selector.open(); + SelectionKey key2 = accepted2.register(sel, SelectionKey.OP_READ); + final SelectionKey[] key = new SelectionKey[]{ + accepted.register(sel, SelectionKey.OP_READ)}; + + + // thread that will be changing key[0].interestOps to OP_READ | OP_WRITE + new Thread() { + + public void run() { + try { + for (int k = 0; k < 15; k++) { + for (int i = 0; i < 10000; i++) { + synchronized (notifyLock) { + synchronized (selectorLock) { + sel.wakeup(); + key[0].interestOps(SelectionKey.OP_READ + | SelectionKey.OP_WRITE); + } + notified = false; + long beginTime = System.currentTimeMillis(); + while (true) { + notifyLock.wait(5000); + if (notified) { + break; + } + long endTime = System.currentTimeMillis(); + if (endTime - beginTime > 5000) { + succTermination = false; + // wake up main thread doing select() + sel.wakeup(); + return; + } + } + } + } + } + succTermination = true; + // wake up main thread doing select() + sel.wakeup(); + } catch (Exception e) { + System.out.println(e); + succTermination = true; + // wake up main thread doing select() + sel.wakeup(); + } + } + }.start(); + + // main thread will be doing registering/deregistering with the sel + while (true) { + sel.select(); + if (Boolean.TRUE.equals(succTermination)) { + System.out.println("Test passed"); + sel.close(); + sc.close(); + break; + } else if (Boolean.FALSE.equals(succTermination)) { + System.out.println("Failed to pass the test"); + sel.close(); + sc.close(); + throw new RuntimeException("Failed to pass the test"); + } + synchronized (selectorLock) { + } + if (sel.selectedKeys().contains(key[0]) && key[0].isWritable()) { + synchronized (notifyLock) { + notified = true; + notifyLock.notify(); + key[0].cancel(); + sel.selectNow(); + key2 = accepted2.register(sel, SelectionKey.OP_READ); + key[0] = accepted.register(sel, SelectionKey.OP_READ); + } + } + key2.cancel(); + sel.selectedKeys().clear(); + } + } +}
--- a/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java Fri May 31 15:42:54 2013 -0700 @@ -133,8 +133,11 @@ dc.close(); dc = DatagramChannel.open(); - - InetSocketAddress isa = new InetSocketAddress(InetAddress.getLocalHost(), port); + InetAddress address = InetAddress.getLocalHost(); + if (address.isLoopbackAddress()) { + address = InetAddress.getLoopbackAddress(); + } + InetSocketAddress isa = new InetSocketAddress(address, port); dc.connect(isa); return dc;
--- a/test/java/text/Bidi/Bug6850113.java Wed May 29 13:24:33 2013 -0700 +++ b/test/java/text/Bidi/Bug6850113.java Fri May 31 15:42:54 2013 -0700 @@ -25,6 +25,7 @@ * @bug 6850113 * @summary Verify the return value of digit() for some digits. * @compile -XDignore.symbol.file=true Bug6850113.java + * @run main Bug6850113 */ import sun.text.normalizer.UCharacter;
--- a/test/javax/management/remote/mandatory/connection/RMIConnectionIdTest.java Wed May 29 13:24:33 2013 -0700 +++ b/test/javax/management/remote/mandatory/connection/RMIConnectionIdTest.java Fri May 31 15:42:54 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4901808 + * @bug 4901808 7183800 * @summary Check that RMI connection ids include client host name * @author Eamonn McManus * @run clean RMIConnectionIdTest @@ -60,7 +60,7 @@ } String clientAddr = rest.substring(0, spaceIndex); InetAddress clientInetAddr = InetAddress.getByName(clientAddr); - InetAddress localAddr = InetAddress.getLocalHost(); + InetAddress localAddr = clientInetAddr.isLoopbackAddress() ? InetAddress.getLoopbackAddress() : InetAddress.getLocalHost(); System.out.println("InetAddresses: local=" + localAddr + "; " + "connectionId=" + clientInetAddr); if (!localAddr.equals(clientInetAddr)) {
--- a/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java Wed May 29 13:24:33 2013 -0700 +++ b/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java Fri May 31 15:42:54 2013 -0700 @@ -26,6 +26,7 @@ * @bug 4241676 * @summary getContinuationDirContext() should set CPE environment property. * @build DummyObjectFactory DummyContext + * @run main/othervm GetContDirCtx */ import java.util.Hashtable;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* @test + @bug 8012004 + @summary JINTERNALFRAME NOT BEING FINALIZED AFTER CLOSING + @author mcherkas + @run main InternalFrameIsNotCollectedTest + */ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.beans.PropertyVetoException; +import java.util.Date; + +public class InternalFrameIsNotCollectedTest { + + public static final int waitTime = 10000; + private static Robot robot; + + public static void sync() { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + } + + public static void main(String[] args) throws Exception { + initRobot(); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + initUI(); + try { + closeInternalFrame(); + } catch (PropertyVetoException e) { + throw new RuntimeException(e); + } + } + }); + sync(); + invokeGC(); + Thread.sleep(1000); // it's better to wait 1 sec now then 10 sec later + Date startWaiting = new Date(); + synchronized (CustomInternalFrame.waiter) { + // Sync with finalization thread. + Date now = new Date(); + while (now.getTime() - startWaiting.getTime() < waitTime && !CustomInternalFrame.finalized) { + CustomInternalFrame.waiter.wait(waitTime); + now = new Date(); + } + } + if (!CustomInternalFrame.finalized) { + throw new RuntimeException("Closed internal frame wasn't collected"); + } + } + + private static void initRobot() throws AWTException { + robot = new Robot(); + robot.setAutoDelay(100); + } + + private static void closeInternalFrame() throws PropertyVetoException { + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_F4); + robot.keyRelease(KeyEvent.VK_F4); + robot.keyRelease(KeyEvent.VK_CONTROL); + } + + private static void initUI() { + JFrame frame = new JFrame("Internal Frame Test"); + frame.getContentPane().setLayout(new BorderLayout()); + JDesktopPane desktopPane = new JDesktopPane(); + desktopPane.setDesktopManager(new DefaultDesktopManager()); + frame.getContentPane().add(desktopPane, BorderLayout.CENTER); + + CustomInternalFrame iFrame = new CustomInternalFrame("Dummy Frame"); + + iFrame.setSize(200, 200); + iFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + desktopPane.add(iFrame); + + frame.setSize(800, 600); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + frame.setVisible(true); + iFrame.setVisible(true); + } + + private static void invokeGC() { + System.out.println("Firing garbage collection!"); + try { + StringBuilder sb = new StringBuilder(); + while (true) { + sb.append("any string. some test. a little bit more text." + sb.toString()); + } + } catch (Throwable e) { + // do nothing + } + } + + + public static class CustomInternalFrame extends JInternalFrame { + public static volatile boolean finalized = false; + public static Object waiter = new Object(); + + public CustomInternalFrame(String title) { + super(title, true, true, true, true); + } + + protected void finalize() { + System.out.println("Finalized!"); + finalized = true; + waiter.notifyAll(); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/text/html/8008289/bug8008289.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ +import java.awt.BorderLayout; +import java.awt.Toolkit; + +import java.awt.event.ActionListener; +import javax.swing.DefaultButtonModel; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; +import javax.swing.text.html.HTMLEditorKit; +import sun.awt.SunToolkit; + + +/* + * @test + * @bug 8008289 + * @summary Shared ButtonModel instance should deregister previous listeners. + * @author Frank Ding + */ +public class bug8008289 { + + private static JEditorPane html; + private static JFrame frame; + + private static void setup() { + /** + * Note the input type is not restricted to "submit". Types "image", + * "checkbox", "radio" have the same problem. + */ + html = new JEditorPane("text/html", + "<html><body><form action=\"http://localhost.cgi\">" + + "<input type=submit name=submit value=\"submit\"/>" + + "</form></body></html>"); + frame = new JFrame(); + frame.setLayout(new BorderLayout()); + frame.add(html, BorderLayout.CENTER); + frame.setSize(200, 100); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } + + private static void doTest() { + /* + * Calling updateComponentTreeUI creates a new FormView instance with + * its own associated JButton instance. The same DefaultButtonModel + * instance is used for both FormView's. + * + * The action listeners associated with (the JButton for) the first + * FormView should be unregistered from this common DefaultButtonModel, + * such that only those for the new FormView remain. + */ + SwingUtilities.updateComponentTreeUI(html); + } + + private static void verifySingleDefaultButtonModelListener() { + HTMLEditorKit htmlEditorKit = (HTMLEditorKit) html.getEditorKit(); + StyleContext.NamedStyle style = ((StyleContext.NamedStyle) htmlEditorKit + .getInputAttributes()); + DefaultButtonModel model = ((DefaultButtonModel) style + .getAttribute(StyleConstants.ModelAttribute)); + ActionListener[] listeners = model.getActionListeners(); + int actionListenerNum = listeners.length; + if (actionListenerNum != 1) { + throw new RuntimeException( + "Expected single ActionListener object registered with " + + "DefaultButtonModel; found " + actionListenerNum + + " listeners registered."); + } + + int changeListenerNum = model.getChangeListeners().length; + if (changeListenerNum != 1) { + throw new RuntimeException( + "Expected at most one ChangeListener object registered " + + "with DefaultButtonModel; found " + changeListenerNum + + " listeners registered."); + } + int itemListenerNum = model.getItemListeners().length; + if (itemListenerNum != 1) { + throw new RuntimeException( + "Expected at most one ItemListener object registered " + + "with DefaultButtonModel; found " + itemListenerNum + + " listeners registered."); + } + } + + public static void main(String[] args) throws Exception { + final SunToolkit toolkit = ((SunToolkit) Toolkit.getDefaultToolkit()); + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + setup(); + } + }); + toolkit.realSync(); + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + try { + verifySingleDefaultButtonModelListener(); + doTest(); + verifySingleDefaultButtonModelListener(); + } finally { + frame.dispose(); + } + } + }); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,421 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8008738 + * @summary checks that the mapping implemented by + * com.sun.org.apache.xml.internal.serializer.Encodings + * correctly identifies valid Charset names and + * correctly maps them to their preferred mime names. + * Also checks that the Encodings.properties resource file + * is consistent. + * @compile -XDignore.symbol.file CheckEncodingPropertiesFile.java + * @run main CheckEncodingPropertiesFile + * @author Daniel Fuchs + */ + +import com.sun.org.apache.xml.internal.serializer.EncodingInfo; +import com.sun.org.apache.xml.internal.serializer.Encodings; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; + +public class CheckEncodingPropertiesFile { + + private static final String ENCODINGS_FILE = "com/sun/org/apache/xml/internal/serializer/Encodings.properties"; + + public static void main(String[] args) throws Exception { + Properties props = new Properties(); + try (InputStreamReader is = new InputStreamReader(ClassLoader.getSystemResourceAsStream(ENCODINGS_FILE))) { + props.load(is); + } + + //printAllCharsets(); + + test(props); + } + + + private static final class CheckCharsetMapping { + + /** + * A map that maps Java or XML name to canonical charset names. + * key: upper cased value of Java or XML name. + * value: case-sensitive canonical name of charset. + */ + private final Map<String, String> charsetMap = new HashMap<>(); + + private final Map<String, String> preferredMime = new HashMap<>(); + + /** + * Unresolved alias names. + * For a given set of names pointing to the same unresolved charset, + * this map will contain, for each alias in the set, a mapping + * with the alias.toUpperValue() as key and the set of known aliases + * as value. + */ + private final Map<String, Collection<String>> unresolved = new HashMap<>(); + + public final static class ConflictingCharsetError extends Error { + ConflictingCharsetError(String a, String cs1, String cs2) { + super("Conflicting charset mapping for '"+a+"': '"+cs1+"' and '"+cs2+"'"); + } + } + + public final static class MissingValidCharsetNameError extends Error { + MissingValidCharsetNameError(String name, Collection<String> aliases) { + super(name+": Line "+aliases+" has no recognized charset alias"); + } + } + + public final static class ConflictingPreferredMimeNameError extends Error { + ConflictingPreferredMimeNameError(String a, String cs1, String cs2) { + super("Conflicting preferred mime name for '"+a+"': '"+cs1+"' and '"+cs2+"'"); + } + } + + /** + * For each alias in aliases, attempt to find the canonical + * charset name. + * All names in aliases are supposed to point to the same charset. + * Names in aliases can be java names or XML names, indifferently. + * @param aliases list of names (aliases) for a given charset. + * @return The canonical name of the charset, if found, null otherwise. + */ + private String findCharsetNameFor(String[] aliases) { + String cs = null; + String res = null; + for (String a : aliases) { + final String k = a.toUpperCase(); + String cachedCs = charsetMap.get(k); + if (cs == null) { + cs = cachedCs; + } + if (cachedCs != null && cs != null + && !Charset.forName(cachedCs).name().equals(Charset.forName(cs).name())) { + throw new ConflictingCharsetError(a,cs,cachedCs); + } + try { + final String rcs = Charset.forName(a).name(); + if (cs != null && !Charset.forName(cs).name().equals(rcs)) { + throw new ConflictingCharsetError(a,cs,rcs); + } + if (res == null) { + if (a.equals(aliases[0])) { + res = a; + } else { + res = cs; + } + } + cs = rcs; + charsetMap.put(k, res == null ? cs : res); + } catch (Exception x) { + continue; + } + } + return res == null ? cs : res; + } + + /** + * Register a canonical charset name for a given set of aliases. + * + * @param charsetName the canonical charset name. + * @param aliases a list of aliases for the given charset. + */ + private void registerCharsetNameFor(String charsetName, String[] aliases) { + if (charsetName == null) throw new NullPointerException(); + + for (String a : aliases) { + String k = a.toUpperCase(); + String csv = charsetMap.get(k); + if (csv == null) { + charsetMap.put(k, charsetName); + csv = charsetName; + } else if (!csv.equals(charsetName)) { + throw new ConflictingCharsetError(a,charsetName,csv); + } + + final Collection<String> c = unresolved.get(k); + if (c != null) { + for (String aa : c) { + k = aa.toUpperCase(); + String csvv = charsetMap.get(k); + if (csvv == null) charsetMap.put(k, csv); + unresolved.remove(k); + } + throw new MissingValidCharsetNameError(charsetName,c); + } + } + } + + /** + * Register a set of aliases as being unresolved. + * @param names the list of names - this should be what is returned by + * nameSet.toArray(new String[nameSet.size()]) + * @param nameSet the set of unresolved aliases. + */ + private void registerUnresolvedNamesFor(String[] names, Collection<String> nameSet) { + // This is not necessarily an error: it could happen that some + // charsets are simply not supported on some OS/Arch + System.err.println("Warning: unresolved charset names: '"+ nameSet + + "' This is not necessarily an error " + + "- this charset may not be supported on this platform."); + for (String a : names) { + final String k = a.toUpperCase(); + final Collection<String> c = unresolved.get(k); + if (c != null) { + //System.out.println("Found: "+a+" -> "+c); + //System.out.println("\t merging "+ c + " with " + nameSet); + nameSet.addAll(c); + for (String aa : c) { + unresolved.put(aa.toUpperCase(), nameSet); + } + } + unresolved.put(k, nameSet); + } + } + + + /** + * Add a new charset name mapping + * @param javaName the (supposedly) java name of the charset. + * @param xmlNames a list of corresponding XML names for that charset. + */ + void addMapping(String javaName, Collection<String> xmlNames) { + final LinkedHashSet<String> aliasNames = new LinkedHashSet<>(); + aliasNames.add(javaName); + aliasNames.addAll(xmlNames); + final String[] aliases = aliasNames.toArray(new String[aliasNames.size()]); + final String cs = findCharsetNameFor(aliases); + if (cs != null) { + registerCharsetNameFor(cs, aliases); + if (xmlNames.size() > 0) { + String preferred = xmlNames.iterator().next(); + String cachedPreferred = preferredMime.get(cs.toUpperCase()); + if (cachedPreferred != null && !cachedPreferred.equals(preferred)) { + throw new ConflictingPreferredMimeNameError(cs, cachedPreferred, preferred); + } + preferredMime.put(cs.toUpperCase(), preferred); + } + } else { + registerUnresolvedNamesFor(aliases, aliasNames); + } + } + + /** + * Returns the canonical name of the charset for the given Java or XML + * alias name. + * @param alias the alias name + * @return the canonical charset name - or null if unknown. + */ + public String getCharsetNameFor(String alias) { + return charsetMap.get(alias.toUpperCase()); + } + + } + + public static void test(Properties props) throws Exception { + + // First, build a mapping from the properties read from the resource + // file. + // We're going to check the consistency of the resource file + // while building this mapping, and throw errors if the file + // does not meet our assumptions. + // + Map<String, Collection<String>> lines = new HashMap<>(); + final CheckCharsetMapping mapping = new CheckCharsetMapping(); + + for (String key : props.stringPropertyNames()) { + Collection<String> values = getValues(props.getProperty(key)); + lines.put(key, values); + mapping.addMapping(key, values); + } + + // Then build maps of EncodingInfos, and print along debugging + // information that should help understand the content of the + // resource file and the mapping it defines. + // + Map<String, EncodingInfo> javaInfos = new HashMap<>(); // Map indexed by java names + Map<String, EncodingInfo> xmlMap = new HashMap<>(); // Map indexed by XML names + Map<String, String> preferred = + new HashMap<>(mapping.preferredMime); // Java Name -> Preferred Mime Name + List<EncodingInfo> all = new ArrayList<>(); // unused... + for (Entry<String, Collection<String>> e : lines.entrySet()) { + final String charsetName = mapping.getCharsetNameFor(e.getKey()); + if (charsetName == null) { + System.out.println("!! No charset for: "+e.getKey()+ " "+ e.getValue()); + continue; + } + Charset c = Charset.forName(charsetName); + EncodingInfo info; + final String k = e.getKey().toUpperCase(); + final String kc = charsetName.toUpperCase(); + StringBuilder sb = new StringBuilder(); + for (String xml : e.getValue()) { + final String kx = xml.toUpperCase(); + info = xmlMap.get(kx); + if (info == null) { + info = new EncodingInfo(xml, charsetName); + System.out.println("** XML: "+xml+" -> "+charsetName); + xmlMap.put(kx, info); + all.add(info); + } + if (!javaInfos.containsKey(k)) { + javaInfos.put(k, info); + if (!preferred.containsKey(k)) { + preferred.put(k, xml); + } + sb.append("** Java: ").append(k).append(" -> ") + .append(xml).append(" (charset: ") + .append(charsetName).append(")\n"); + } + if (!javaInfos.containsKey(kc)) { + if (!preferred.containsKey(kc)) { + preferred.put(kc, xml); + } + javaInfos.put(kc, info); + sb.append("** Java: ").append(kc).append(" -> ") + .append(xml).append(" (charset: ") + .append(charsetName).append(")\n"); + } + if (!javaInfos.containsKey(c.name().toUpperCase())) { + if (!preferred.containsKey(c.name().toUpperCase())) { + preferred.put(c.name().toUpperCase(), xml); + } + javaInfos.put(c.name().toUpperCase(), info); + sb.append("** Java: ").append(c.name().toUpperCase()).append(" -> ") + .append(xml).append(" (charset: ") + .append(charsetName).append(")\n"); + } + } + if (sb.length() == 0) { + System.out.println("Nothing new for "+charsetName+": "+e.getKey()+" -> "+e.getValue()); + } else { + System.out.print(sb); + } + + } + + // Now we're going to verify that Encodings.java has done its job + // correctly. We're going to ask Encodings to convert java names to mime + // names and mime names to java names - and verify that the returned + // java names do map to recognized charsets. + // + // We're also going to verify that Encodings has recorded the preferred + // mime name correctly. + + Method m = Encodings.class.getDeclaredMethod("getMimeEncoding", String.class); + m.setAccessible(true); + + Set<String> xNames = new HashSet<>(); + Set<String> jNames = new HashSet<>(); + for (String name: xmlMap.keySet()) { + final String javaName = checkConvertMime2Java(name); + checkPreferredMime(m, javaName, preferred); + jNames.add(javaName); + xNames.add(name); + } + + + for (String javaName : lines.keySet()) { + final String javaCharsetName = mapping.getCharsetNameFor(javaName.toUpperCase()); + if (javaCharsetName == null) continue; + if (!jNames.contains(javaName)) { + checkPreferredMime(m, javaName, preferred); + jNames.add(javaName); + } + for (String xml : lines.get(javaName)) { + if (xNames.contains(xml)) continue; + final String jName = checkConvertMime2Java(xml); + xNames.add(xml); + if (jNames.contains(jName)) continue; + checkPreferredMime(m, jName, preferred); + } + } + } + + private static String checkConvertMime2Java(String xml) { + final String jName = Encodings.convertMime2JavaEncoding(xml); + final String jCharsetName; + try { + jCharsetName = Charset.forName(jName).name(); + } catch (Exception x) { + throw new Error("Unrecognized charset returned by Encodings.convertMime2JavaEncoding(\""+xml+"\")", x); + } + System.out.println("Encodings.convertMime2JavaEncoding(\""+xml+"\") = \""+jName+"\" ("+jCharsetName+")"); + return jName; + } + + private static void checkPreferredMime(Method m, String javaName, Map<String,String> preferred) + throws Exception { + final String mime = (String) m.invoke(null, javaName); + final String expected = preferred.get(javaName.toUpperCase()); + if (Arrays.deepEquals(new String[] {mime}, new String[] {expected})) { + System.out.println("Encodings.getMimeEncoding(\""+javaName+"\") = \""+mime+"\""); + } else { + throw new Error("Bad preferred mime type for: '"+javaName+"': expected '"+ + expected+"' but got '"+mime+"'"); + } + } + + private static Collection<String> getValues(String val) { + int pos = val.indexOf(' '); + if (pos < 0) { + return Collections.singletonList(val); + } + //lastPrintable = + // Integer.decode(val.substring(pos).trim()).intValue(); + StringTokenizer st = + new StringTokenizer(val.substring(0, pos), ","); + final List<String> values = new ArrayList<>(st.countTokens()); + while (st.hasMoreTokens()) { + values.add(st.nextToken()); + } + return values; + } + + // can be called in main() to help debugging. + // Prints out all available charsets and their recognized aliases + // as returned by the Charset API. + private static void printAllCharsets() { + Map<String, Charset> all = Charset.availableCharsets(); + System.out.println("\n=========================================\n"); + for (String can : all.keySet()) { + System.out.println(can + ": " + all.get(can).aliases()); + } + } +}
--- a/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java Wed May 29 13:24:33 2013 -0700 +++ b/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java Fri May 31 15:42:54 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @summary Basic unit test of HotspotClassLoadingMBean.getClassLoadingTime() * @author Steve Bohne * @build ClassToLoad0 + * @run main GetClassLoadingTime */ /* @@ -71,10 +72,8 @@ } long time2 = mbean.getClassLoadingTime(); - long count = mbean.getLoadedClassCount(); if (trace) { - System.out.println("(new count is " + count + ")"); System.out.println("Class loading time2 (ms): " + time2); } @@ -93,8 +92,6 @@ // so we can avoid delegation and spend lots of time loading the // same class over and over, to test the class loading timer. class KlassLoader extends ClassLoader { - static String klassDir=""; - static int index=0; public KlassLoader() { super(null); @@ -102,14 +99,13 @@ protected synchronized Class findClass(String name) throws ClassNotFoundException { - String cname = klassDir - + (klassDir == "" ? "" : "/") - +name.replace('.', '/') + String cname = + name.replace('.', '/') +".class"; FileInputStream in; try { - in=new FileInputStream(cname); + in = new FileInputStream(new File(System.getProperty("test.classes", "."), cname)); if (in == null) { throw new ClassNotFoundException("getResourceAsStream(" +cname+")");
--- a/test/sun/management/jdp/JdpTest.sh Wed May 29 13:24:33 2013 -0700 +++ b/test/sun/management/jdp/JdpTest.sh Fri May 31 15:42:54 2013 -0700 @@ -1,18 +1,18 @@ #!/bin/sh -x -# Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as # published by the Free Software Foundation. -# +# # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # version 2 for more details (a copy is included in the LICENSE file that # accompanied this code). -# +# # You should have received a copy of the GNU General Public License version # 2 along with this work; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. @@ -22,8 +22,8 @@ # questions. # @test -# @bug 7169888 -# @compile -XDignore.symbol.file JdpUnitTest.java JdpClient.java JdpDoSomething.java +# @bug 7169888 +# @compile -XDignore.symbol.file JdpUnitTest.java JdpClient.java JdpDoSomething.java # @run shell JdpTest.sh --jtreg --no-compile # @summary No word Failed expected in the test output @@ -44,17 +44,20 @@ _logname=".classes/output.txt" _last_pid="" +_ip="224.0.23.178" +_port="7095" +_jmxport="4545" _do_compile(){ # If the test run without JTReg, we have to compile it by our self # Under JTReg see @compile statement above - # sun.* packages is not included to symbol file lib/ct.sym so we have + # sun.* packages is not included to symbol file lib/ct.sym so we have # to ignore it if [ ! -d ${_testclasses} ] then mkdir -p ${_testclasses} - fi + fi rm -f ${_testclasses}/*.class @@ -64,11 +67,11 @@ JdpDoSomething.java \ JdpClient.java - + if [ ! -f ${_testclasses}/JdpDoSomething.class -o ! -f ${_testclasses}/JdpClient.class -o ! -f ${_testclasses}/JdpUnitTest.class ] then echo "ERROR: Can't compile" - exit -1 + exit 255 fi } @@ -84,10 +87,10 @@ npid=`_get_pid` if [ "${npid}" = "" ] then - echo "ERROR: Test app not started" + echo "ERROR: Test app not started. Please check machine resources before filing a bug." if [ "${_jtreg}" = "yes" ] then - exit -1 + exit 255 fi fi } @@ -100,53 +103,53 @@ rm ${_lockFileName} # wait until VM is actually shuts down - while true + while true do npid=`_get_pid` - if [ "${npid}" = "" ] + if [ "${npid}" = "" ] then break fi sleep 1 - done + done } - + _testme(){ ${TESTJAVA}/bin/java \ -cp ${_testclasses} \ $* \ - -Dcom.sun.management.jdp.port=7095 \ - -Dcom.sun.management.jdp.address=239.255.255.225 \ - JdpClient + -Dcom.sun.management.jdp.port=${_port} \ + -Dcom.sun.management.jdp.address=${_ip} \ + JdpClient -} +} _jcmd(){ ${TESTJAVA}/bin/jcmd JdpDoSomething $* > /dev/null 2>/dev/null -} +} _echo(){ echo "$*" echo "$*" >> ${_logname} } - + # ============= TESTS ====================================== - + test_01(){ - - _echo "**** Test one ****" + + _echo "**** Test one ****" _app_start JdpUnitTest \ - -Dcom.sun.management.jdp.port=7095 \ - -Dcom.sun.management.jdp.address=239.255.255.225 \ + -Dcom.sun.management.jdp.port=${_port} \ + -Dcom.sun.management.jdp.address=${_ip} \ -Dcom.sun.management.jdp.pause=5 res=`_testme` - case "${res}" in - OK*) + case "${res}" in + OK*) _echo "Passed" ;; *) @@ -155,24 +158,24 @@ esac _app_stop -} +} test_02(){ - - _echo "**** Test two ****" + + _echo "**** Test two ****" _app_start JdpDoSomething \ - -Dcom.sun.management.jdp.port=7095 \ - -Dcom.sun.management.jdp.address=239.255.255.225 \ + -Dcom.sun.management.jdp.port=${_port} \ + -Dcom.sun.management.jdp.address=${_ip} \ -Dcom.sun.management.jdp.pause=5 \ - -Dcom.sun.management.jmxremote.port=4545 \ + -Dcom.sun.management.jmxremote.port=${_jmxport} \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false res=`_testme` - case "${res}" in - OK*) + case "${res}" in + OK*) _echo "Passed" ;; *) @@ -181,26 +184,26 @@ esac _app_stop -} +} test_03(){ - + _echo "**** Test three ****" _app_start JdpDoSomething - + _jcmd ManagementAgent.start\ - jdp.port=7095 \ - jdp.address=239.255.255.225 \ + jdp.port=${_port} \ + jdp.address=${_ip} \ jdp.pause=5 \ - jmxremote.port=4545 \ + jmxremote.port=${_jmxport} \ jmxremote.authenticate=false \ jmxremote.ssl=false res=`_testme` - case "${res}" in - OK*) + case "${res}" in + OK*) _echo "Passed" ;; *) @@ -209,7 +212,7 @@ esac _app_stop -} +} test_04(){ @@ -217,7 +220,7 @@ _app_start JdpDoSomething \ -Dcom.sun.management.jmxremote.autodiscovery=true \ - -Dcom.sun.management.jmxremote.port=4545 \ + -Dcom.sun.management.jmxremote.port=${_jmxport} \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false @@ -243,7 +246,7 @@ _jcmd ManagementAgent.start\ jmxremote.autodiscovery=true \ - jmxremote.port=4545 \ + jmxremote.port=${_jmxport} \ jmxremote.authenticate=false \ jmxremote.ssl=false @@ -279,20 +282,20 @@ #------------------------------------------------------------------------------ -# reading parameters +# reading parameters -for parm in "$@" +for parm in "$@" do case $parm in --verbose) _verbose=yes ;; --jtreg) _jtreg=yes ;; --no-compile) _compile=no ;; --testsuite=*) _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;; - *) - echo "Undefined parameter $parm. Try --help for help" - exit + *) + echo "Undefined parameter $parm. Try --help for help" + exit ;; - esac + esac done if [ "${_compile}" = "yes" ] @@ -325,11 +328,11 @@ cat ${_testsrc}/policy.tpl | \ sed -e "s,@_TESTCLASSES@,${_testclasses},g" -e "s,@TESTJAVA@,${TESTJAVA},g" \ > ${_policyname} - + fi - + # Local mode tests for i in `echo ${_testsuite} | sed -e "s/,/ /g"` do - test_${i} + test_${i} done
--- a/test/sun/misc/Cleaner/ExitOnThrow.java Wed May 29 13:24:33 2013 -0700 +++ b/test/sun/misc/Cleaner/ExitOnThrow.java Fri May 31 15:42:54 2013 -0700 @@ -28,21 +28,17 @@ public class ExitOnThrow { - private static volatile boolean ran = false; - public static void main(String[] args) throws Exception { Cleaner.create(new Object(), new Runnable() { public void run() { - ran = true; throw new RuntimeException("Foo!"); } }); - while (!ran) { + while (true) { System.gc(); Thread.sleep(100); } - System.exit(0); } }
--- a/test/sun/misc/Cleaner/exitOnThrow.sh Wed May 29 13:24:33 2013 -0700 +++ b/test/sun/misc/Cleaner/exitOnThrow.sh Fri May 31 15:42:54 2013 -0700 @@ -25,10 +25,11 @@ # # @test -# @bug 4954921 +# @bug 4954921 8009259 # @summary Ensure that if a cleaner throws an exception then the VM exits # # @build ExitOnThrow +# @run shell exitOnThrow.sh # Command-line usage: sh exitOnThrow.sh /path/to/build
--- a/test/sun/nio/cs/OLD/TestIBMDB.java Wed May 29 13:24:33 2013 -0700 +++ b/test/sun/nio/cs/OLD/TestIBMDB.java Fri May 31 15:42:54 2013 -0700 @@ -26,6 +26,7 @@ * @bug 6843578 * @summary Test IBM DB charsets * @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD EUC_CN_OLD EUC_KR_OLD GBK_OLD Johab_OLD MS932_OLD MS936_OLD MS949_OLD MS950_OLD + * @run main TestIBMDB */ import java.nio.charset.*;
--- a/test/sun/nio/cs/OLD/TestX11CS.java Wed May 29 13:24:33 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 1234567 - * @summary Test updated X11 charsets - * @build X11GB2312_OLD X11GBK_OLD X11KSC5601_OLD - */ - -import java.nio.charset.*; -import java.nio.*; -import java.util.*; - -public class TestX11CS { - - static char[] decode(byte[] bb, Charset cs) - throws Exception { - CharsetDecoder dec = cs.newDecoder(); - ByteBuffer bbf = ByteBuffer.wrap(bb); - CharBuffer cbf = CharBuffer.allocate(bb.length); - CoderResult cr = dec.decode(bbf, cbf, true); - if (cr != CoderResult.UNDERFLOW) { - System.out.println("DEC-----------------"); - int pos = bbf.position(); - System.out.printf(" cr=%s, bbf.pos=%d, bb[pos]=%x,%x,%x,%x%n", - cr.toString(), pos, - bb[pos++]&0xff, bb[pos++]&0xff,bb[pos++]&0xff, bb[pos++]&0xff); - throw new RuntimeException("Decoding err: " + cs.name()); - } - char[] cc = new char[cbf.position()]; - cbf.flip(); cbf.get(cc); - return cc; - - } - - static byte[] encode(char[] cc, Charset cs) - throws Exception { - ByteBuffer bbf = ByteBuffer.allocate(cc.length * 4); - CharBuffer cbf = CharBuffer.wrap(cc); - CharsetEncoder enc = cs.newEncoder(); - - CoderResult cr = enc.encode(cbf, bbf, true); - if (cr != CoderResult.UNDERFLOW) { - System.out.println("ENC-----------------"); - int pos = cbf.position(); - System.out.printf(" cr=%s, cbf.pos=%d, cc[pos]=%x%n", - cr.toString(), pos, cc[pos]&0xffff); - throw new RuntimeException("Encoding err: " + cs.name()); - } - byte[] bb = new byte[bbf.position()]; - bbf.flip(); bbf.get(bb); - return bb; - } - - static char[] getChars(Charset newCS, Charset oldCS) { - CharsetEncoder enc = oldCS.newEncoder(); - CharsetEncoder encNew = newCS.newEncoder(); - char[] cc = new char[0x10000]; - int pos = 0; - int i = 0; - while (i < 0x10000) { - if (enc.canEncode((char)i) != encNew.canEncode((char)i)) { - System.out.printf(" Err i=%x%n", i); - //throw new RuntimeException("canEncode() err!"); - } - if (enc.canEncode((char)i)) { - cc[pos++] = (char)i; - } - i++; - } - return Arrays.copyOf(cc, pos); - } - - static void compare(Charset newCS, Charset oldCS) throws Exception { - System.out.printf(" Diff <%s> <%s>...%n", newCS.name(), oldCS.name()); - char[] cc = getChars(newCS, oldCS); - - byte[] bb1 = encode(cc, newCS); - byte[] bb2 = encode(cc, oldCS); - - if (!Arrays.equals(bb1, bb2)) { - System.out.printf(" encoding failed!%n"); - } - char[] cc1 = decode(bb1, newCS); - char[] cc2 = decode(bb1, oldCS); - if (!Arrays.equals(cc1, cc2)) { - for (int i = 0; i < cc1.length; i++) { - if (cc1[i] != cc2[i]) { - System.out.printf("i=%d, cc1=%x cc2=%x, bb=<%x%x>%n", - i, - cc1[i]&0xffff, cc2[i]&0xffff, - bb1[i*2]&0xff, bb1[i*2+1]&0xff); - } - - } - - System.out.printf(" decoding failed%n"); - } - } - - public static void main(String[] args) throws Exception { - compare(new sun.awt.motif.X11GBK(), - new X11GBK_OLD()); - - compare(new sun.awt.motif.X11GB2312(), - new X11GB2312_OLD()); - - compare(new sun.awt.motif.X11KSC5601(), - new X11KSC5601_OLD()); - - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/krb5/tools/KtabZero.java Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import sun.security.krb5.internal.ktab.KeyTab; +import sun.security.krb5.internal.ktab.KeyTabConstants; + +import java.io.File; +import java.lang.reflect.Field; +import java.nio.file.Files; +import java.nio.file.Paths; + +/* + * @test + * @bug 8014196 + * @summary ktab creates a file with zero kt_vno + */ +public class KtabZero { + + static final String NAME = "k.tab"; + + public static void main(String[] args) throws Exception { + + // 0. Non-existing keytab + Files.deleteIfExists(Paths.get(NAME)); + check(true); + + // 1. Create with KeyTab + Files.deleteIfExists(Paths.get(NAME)); + KeyTab.getInstance(NAME).save(); + check(false); + + // 2. Create with the tool + Files.deleteIfExists(Paths.get(NAME)); + try { + Class ktab = Class.forName("sun.security.krb5.internal.tools.Ktab"); + ktab.getDeclaredMethod("main", String[].class).invoke(null, + (Object)(("-k " + NAME + " -a me@HERE pass").split(" "))); + } catch (ClassNotFoundException cnfe) { + // Only Windows has ktab tool + System.out.println("No ktab tool here. Ignored."); + return; + } + check(false); + } + + // Checks existence as well as kt-vno + static void check(boolean showBeMissing) throws Exception { + KeyTab kt = KeyTab.getInstance(NAME); + if (kt.isMissing() != showBeMissing) { + throw new Exception("isMissing is not " + showBeMissing); + } + Field f = KeyTab.class.getDeclaredField("kt_vno"); + f.setAccessible(true); + if (f.getInt(kt) != KeyTabConstants.KRB5_KT_VNO) { + throw new Exception("kt_vno is " + f.getInt(kt)); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/krb5/tools/ktzero.sh Fri May 31 15:42:54 2013 -0700 @@ -0,0 +1,74 @@ +# +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8014196 +# @summary ktab creates a file with zero kt_vno +# @run shell ktzero.sh +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +if [ "${TESTSRC}" = "" ] ; then + TESTSRC="." +fi + +OS=`uname -s` +case "$OS" in + CYGWIN* ) + FS="/" + ;; + Windows_* ) + FS="\\" + ;; + * ) + FS="/" + echo "Unsupported system!" + exit 0; + ;; +esac + +KEYTAB=ktzero.tmp + +rm $KEYTAB 2> /dev/null +KTAB="${TESTJAVA}${FS}bin${FS}ktab -k $KEYTAB" + +# Listing non-existing ktab should fail +$KTAB -l && exit 1 + +# Can add to non-existing ktab +$KTAB -a me@LOCAL mine || exit 2 + +# Now can be listed +$KTAB -l || exit 3 + +echo ABCDEFG > $KEYTAB + +# Invalid keytab should fail for all commands +$KTAB -l && exit 4 +$KTAB -a me@LOCAL mine && exit 2 + +exit 0
--- a/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java Wed May 29 13:24:33 2013 -0700 +++ b/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java Fri May 31 15:42:54 2013 -0700 @@ -27,6 +27,7 @@ * @compile JavaxSSLContextImpl.java ComSSLContextImpl.java * JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java * JavaxKeyManagerFactoryImpl.java ComKeyManagerFactoryImpl.java + * @run main ProviderTest * @summary brokenness in the com.sun.net.ssl.SSLSecurity wrappers */
--- a/test/tools/launcher/Arrrghs.java Wed May 29 13:24:33 2013 -0700 +++ b/test/tools/launcher/Arrrghs.java Fri May 31 15:42:54 2013 -0700 @@ -24,7 +24,7 @@ /** * @test * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938 - * 6894719 6968053 7151434 7146424 + * 6894719 6968053 7151434 7146424 8007333 * @summary Argument parsing validation. * @compile -XDignore.symbol.file Arrrghs.java * @run main/othervm Arrrghs @@ -311,6 +311,20 @@ checkArgumentParsing("..\\..\\", "..\\..\\"); checkArgumentParsing("../../", "../../"); checkArgumentParsing("a b\\ c", "a", "b\\", "c"); + // 2 back-slashes + checkArgumentParsing("\\\\?", "\\\\?"); + // 3 back-slashes + checkArgumentParsing("\\\\\\?", "\\\\\\?"); + // 4 back-slashes + checkArgumentParsing("\\\\\\\\?", "\\\\\\\\?"); + // 5 back-slashes + checkArgumentParsing("\\\\\\\\\\?", "\\\\\\\\\\?"); + // 6 back-slashes + checkArgumentParsing("\\\\\\\\\\\\?", "\\\\\\\\\\\\?"); + + // more treatment of mixed slashes + checkArgumentParsing("f1/ f3\\ f4/", "f1/", "f3\\", "f4/"); + checkArgumentParsing("f1/ f2\' ' f3/ f4/", "f1/", "f2\'", "'", "f3/", "f4/"); } private void initEmptyDir(File emptyDir) throws IOException {