This commit is contained in:
Yuri Nesterenko 2009-06-01 01:06:28 -07:00
commit 86df48bb43
25 changed files with 631 additions and 138 deletions

View file

@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
tzdata2009a
tzdata2009g

View file

@ -258,7 +258,46 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 -
# unless discontinued, next DST may end Thursday 28 August 2008.
# From Paul Eggert (2007-08-17):
# For lack of better info, assume the new rule is last Thursday in August.
Rule Egypt 2008 max - Aug lastThu 23:00s 0 -
# From Petr Machata (2009-04-06):
# The following appeared in Red Hat bugzilla[1] (edited):
#
# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC =3D Thu =
# Apr 23
# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC =3D Fri =
# Apr 24
# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC =3D Thu =
# Aug 27
# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC =3D Thu =
# Aug 27
# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
#
# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
# :59)
# > http://support.microsoft.com/kb/958729/
#
# timeanddate[2] and another site I've found[3] also support that.
#
# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=3D492263">
# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
# </a>
# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=3D53">
# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
# </a>
# [3] <a href="http://wwp.greenwichmeantime.com/time-zone/africa/egypt/">
# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
# </a>
# From Arthur David Olson (2009-04-20):
# In 2009 (and for the next several years), Ramadan ends before the fourth
# Thursday in September; Egypt is expected to revert to the last Thursday
# in September.
Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
Rule Egypt 2009 max - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
@ -586,6 +625,40 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# <a href="http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html">
# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
# </a>
# From Steffen Thorsen (2009-03-17):
# Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
# to many sources, such as
# <a href="http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html">
# http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
# </a>
# <a href="http://www.medi1sat.ma/fr/depeche.aspx?idp=2312">
# http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
# </a>
# (French)
#
# Our summary:
# <a href="http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html">
# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
# </a>
# From Alexander Krivenyshev (2009-03-17):
# Here is a link to official document from Royaume du Maroc Premier Ministre,
# Ministere de la Modernisation des Secteurs Publics
#
# Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
# concerning the amendment of the legal time, the Ministry of Modernization of
# Public Sectors announced that the official time in the Kingdom will be
# advanced 60 minutes from Sunday 31 May 2009 at midnight.
#
# <a href="http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf">
# http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
# </a>
#
# <a href="http://www.worldtimezone.com/dst_news/dst_news_morocco03.html">
# http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
# </a>
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
@ -605,6 +678,8 @@ Rule Morocco 1978 only - Jun 1 0:00 1:00 S
Rule Morocco 1978 only - Aug 4 0:00 0 -
Rule Morocco 2008 only - Jun 1 0:00 1:00 S
Rule Morocco 2008 only - Sep 1 0:00 0 -
Rule Morocco 2009 only - Jun 1 0:00 1:00 S
Rule Morocco 2009 only - Aug 21 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
@ -809,6 +884,43 @@ Zone Africa/Lome 0:04:52 - LMT 1893
# Ending : the last Sunday of October at 03:00 ...
# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=1188&Itemid=50
# From Steffen Thorsen (2009-03-16):
# According to several news sources, Tunisia will not observe DST this year.
# (Arabic)
# <a href="http://www.elbashayer.com/?page=viewn&nid=42546">
# http://www.elbashayer.com/?page=viewn&nid=42546
# </a>
# <a href="http://www.babnet.net/kiwidetail-15295.asp">
# http://www.babnet.net/kiwidetail-15295.asp
# </a>
#
# We have also confirmed this with the US embassy in Tunisia.
# We have a wrap-up about this on the following page:
# <a href="http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html">
# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
# </a>
# From Alexander Krivenyshev (2009-03-17):
# Here is a link to Tunis Afrique Presse News Agency
#
# Standard time to be kept the whole year long (tap.info.tn):
#
# (in English)
# <a href="http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157">
# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
# </a>
#
# (in Arabic)
# <a href="http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1">
# http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
# </a>
# From Arthur David Olson (2009--3-18):
# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
# that the fasting month of ramadan coincides with the period concerned by summer time.
# Therefore, the standard time will be kept unchanged the whole year long."
# So foregoing DST seems to be an exception (albeit one that may be repeated in the future).
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Tunisia 1939 only - Apr 15 23:00s 1:00 S
Rule Tunisia 1939 only - Nov 18 23:00s 0 -
@ -833,8 +945,10 @@ Rule Tunisia 1989 only - Mar 26 0:00s 1:00 S
Rule Tunisia 1990 only - May 1 0:00s 1:00 S
Rule Tunisia 2005 only - May 1 0:00s 1:00 S
Rule Tunisia 2005 only - Sep 30 1:00s 0 -
Rule Tunisia 2006 max - Mar lastSun 2:00s 1:00 S
Rule Tunisia 2006 max - Oct lastSun 2:00s 0 -
Rule Tunisia 2006 2008 - Mar lastSun 2:00s 1:00 S
Rule Tunisia 2006 2008 - Oct lastSun 2:00s 0 -
Rule Tunisia 2010 max - Mar lastSun 2:00s 1:00 S
Rule Tunisia 2010 max - Oct lastSun 2:00s 0 -
# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
# more precise 0:09:21.
# Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.

View file

@ -1071,6 +1071,40 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u
# http://www.petranews.gov.jo/nepras/2006/Sep/05/4000.htm
# "Jordan will switch to winter time on Friday, October 27".
#
# From Phil Pizzey (2009-04-02):
# ...I think I may have spotted an error in the timezone data for
# Jordan.
# The current (2009d) asia file shows Jordan going to daylight
# saving
# time on the last Thursday in March.
#
# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
#
# However timeanddate.com, which I usually find reliable, shows Jordan
# going to daylight saving time on the last Friday in March since 2002.
# Please see
# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
# http://www.timeanddate.com/worldclock/timezone.html?n=11
# </a>
# From Steffen Thorsen (2009-04-02):
# This single one might be good enough, (2009-03-24, Arabic):
# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
# http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279
# </a>
#
# Google's translation:
#
# > The Council of Ministers decided in 2002 to adopt the principle of timely
# > submission of the summer at 60 minutes as of midnight on the last Thursday
# > of the month of March of each year.
#
# So - this means the midnight between Thursday and Friday since 2002.
# From Arthur David Olson (2009-04-06):
# We still have Jordan switching to DST on Thursdays in 2000 and 2001.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Jordan 1973 only - Jun 6 0:00 1:00 S
Rule Jordan 1973 1975 - Oct 1 0:00 0 -
@ -1093,8 +1127,9 @@ Rule Jordan 1993 1998 - Apr Fri>=1 0:00 1:00 S
Rule Jordan 1994 only - Sep Fri>=15 0:00 0 -
Rule Jordan 1995 1998 - Sep Fri>=15 0:00s 0 -
Rule Jordan 1999 only - Jul 1 0:00s 1:00 S
Rule Jordan 1999 2002 - Sep lastThu 0:00s 0 -
Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
Rule Jordan 1999 2002 - Sep lastFri 0:00s 0 -
Rule Jordan 2000 2001 - Mar lastThu 0:00s 1:00 S
Rule Jordan 2002 max - Mar lastFri 0:00s 1:00 S
Rule Jordan 2003 only - Oct 24 0:00s 0 -
Rule Jordan 2004 only - Oct 15 0:00s 0 -
Rule Jordan 2005 only - Sep lastFri 0:00s 0 -
@ -1576,11 +1611,46 @@ Zone Asia/Muscat 3:54:20 - LMT 1920
# http://dailymailnews.com/200808/28/news/dmbrn03.html
# </a>
# From Alexander Krivenyshev (2009-04-08):
# Based on previous media reports that "... proposed plan to
# advance clocks by one hour from May 1 will cause disturbance
# to the working schedules rather than bringing discipline in
# official working."
# <a href="http://www.thenews.com.pk/daily_detail.asp?id=171280">
# http://www.thenews.com.pk/daily_detail.asp?id=171280
# </a>
#
# recent news that instead of May 2009 - Pakistan plan to
# introduce DST from April 15, 2009
#
# FYI: Associated Press Of Pakistan
# April 08, 2009
# Cabinet okays proposal to advance clocks by one hour from April 15
# <a href="http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1">
# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
# </a>
#
# or
#
# <a href="http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html">
# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
# </a>
#
# ....
# The Federal Cabinet on Wednesday approved the proposal to
# advance clocks in the country by one hour from April 15 to
# conserve energy"
# From Arthur David Olson (2009-04-10):
# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Pakistan 2002 only - Apr Sun>=2 0:01 1:00 S
Rule Pakistan 2002 only - Oct Sun>=2 0:01 0 -
Rule Pakistan 2008 only - Jun 1 0:00 1:00 S
Rule Pakistan 2008 only - Nov 1 0:00 0 -
Rule Pakistan 2009 only - Apr 15 0:00 1:00 S
Rule Pakistan 2009 only - Nov 1 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Karachi 4:28:12 - LMT 1907
5:30 - IST 1942 Sep
@ -1717,6 +1787,22 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.worldtimezone.com/dst_news/dst_news_gazastrip01.html
# </a>
# From Alexander Krivenyshev (2009-03-26):
# According to the Palestine News Network (arabic.pnn.ps), Palestinian
# government decided to start Daylight Time on Thursday night March
# 26 and continue until the night of 27 September 2009.
#
# (in Arabic)
# <a href="http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850">
# http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850
# </a>
#
# or
# (English translation)
# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank01.html">
# http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
# </a>
# The rules for Egypt are stolen from the `africa' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@ -1730,10 +1816,12 @@ Rule Palestine 1999 2005 - Apr Fri>=15 0:00 1:00 S
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 max - Apr 1 0:00 1:00 S
Rule Palestine 2006 2008 - 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 max - Aug lastThu 2:00 0 -
Rule Palestine 2008 only - Aug lastFri 2:00 0 -
Rule Palestine 2009 max - Mar lastFri 0:00 1:00 S
Rule Palestine 2009 max - Sep lastMon 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
@ -1991,8 +2079,29 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# http://sana.sy/ara/2/2008/10/07/195459.htm
# </a>
Rule Syria 2008 max - Apr Fri>=1 0:00 1:00 S
# From Steffen Thorsen (2009-03-19):
# Syria will start DST on 2009-03-27 00:00 this year according to many sources,
# two examples:
#
# <a href="http://www.sana.sy/eng/21/2009/03/17/217563.htm">
# http://www.sana.sy/eng/21/2009/03/17/217563.htm
# </a>
# (English, Syrian Arab News # Agency)
# <a href="http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209">
# http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209
# </a>
# (Arabic, gov-site)
#
# We have not found any sources saying anything about when DST ends this year.
#
# Our summary
# <a href="http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html">
# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
# </a>
Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
Rule Syria 2008 max - Nov 1 0:00 0 -
Rule Syria 2009 max - Mar lastFri 0:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq

View file

@ -75,40 +75,32 @@ Leap 2008 Dec 31 23:59:60 + S
# SERVICE DE LA ROTATION TERRESTRE
# OBSERVATOIRE DE PARIS
# 61, Av. de l'Observatoire 75014 PARIS (France)
# Tel. : 33 (0) 1 40 51 22 26
# Tel. : 33 (0) 1 40 51 22 29
# FAX : 33 (0) 1 40 51 22 91
# e-mail : services.iers@obspm.fr
# http://hpiers.obspm.fr/eop-pc
# Internet : services.iers@obspm.fr
#
# Paris, 4 July 2008
# Paris, 15 January 2009
#
# Bulletin C 36
# Bulletin C 37
#
# To authorities responsible
# for the measurement and
# distribution of time
#
# UTC TIME STEP
# on the 1st of January 2009
# INFORMATION ON UTC - TAI
#
# A positive leap second will be introduced at the end of December 2008.
# The sequence of dates of the UTC second markers will be:
# NO positive leap second will be introduced at the end of June 2009.
# The difference between Coordinated Universal Time UTC and the
# International Atomic Time TAI is :
#
# 2008 December 31, 23h 59m 59s
# 2008 December 31, 23h 59m 60s
# 2009 January 1, 0h 0m 0s
#
# The difference between UTC and the International Atomic Time TAI is:
#
# from 2006 January 1, 0h UTC, to 2009 January 1 0h UTC : UTC-TAI = - 33s
# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = - 34s
# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
#
# Leap seconds can be introduced in UTC at the end of the months of December
# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
# six months, either to announce a time step in UTC or to confirm that there
# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
# six months, either to announce a time step in UTC, or to confirm that there
# will be no time step at the next possible date.
#
# Daniel GAMBIS
# Head
# Earth Orientation Center of IERS
# Head
# Earth Orientation Center of the IERS
# Observatoire de Paris, France

View file

@ -2280,6 +2280,25 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# From Arthur David Olson (2008-03-12):
# Assume Sun>=15 (third Sunday) going forward.
# From Alexander Krivenyshev (2009-03-04)
# According to the Radio Reloj - Cuba will start Daylight Saving Time on
# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
# not on midnight March 14 / March 15 as previously thought.
#
# <a href="http://www.worldtimezone.com/dst_news/dst_news_cuba05.html">
# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
# (in Spanish)
# </a>
# From Arthur David Olson (2009-03-09)
# I listened over the Internet to
# <a href="http://media.enet.cu/readioreloj">
# http://media.enet.cu/readioreloj
# </a>
# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
# the time was announced as "diez cinco"--the same time as here, indicating
# that has indeed switched to DST. Assume second Sunday from 2009 forward.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
Rule Cuba 1928 only - Oct 10 0:00 0 S
@ -2312,7 +2331,8 @@ Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2008 max - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2009 max - Mar Sun>=8 0:00s 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890

View file

@ -373,6 +373,50 @@ Rule Arg 2008 max - Oct Sun>=15 0:00 1:00 S
# keep America/Cordoba a single region rather than splitting it into the
# other 5 subregions.
# From Mariano Absatz (2009-03-13):
# Yesterday (with our usual 2-day notice) the Province of San Luis
# decided that next Sunday instead of "staying" @utc-03:00 they will go
# to utc-04:00 until the second Saturday in October...
#
# The press release is at
# <a href="http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102">
# http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102
# </a>
# (I couldn't find the decree, but
# <a href="http://www.sanluis.gov.ar">
# www.sanluis.gov.ar
# <a/>
# is the official page for the Province Government).
#
# There's also a note in only one of the major national papers (La Nación) at
# <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912">
# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
# </a>
#
# The press release says:
# (...) anunció que el próximo domingo a las 00:00 los puntanos deberán
# atrasar una hora sus relojes.
#
# A partir de entonces, San Luis establecerá el huso horario propio de
# la Provincia. De esta manera, durante el periodo del calendario anual
# 2009, el cambio horario quedará comprendido entre las 00:00 del tercer
# domingo de marzo y las 24:00 del segundo sábado de octubre.
# Quick&dirty translation
# (...) announced that next Sunday, at 00:00, Puntanos (the San Luis
# inhabitants) will have to turn back one hour their clocks
#
# Since then, San Luis will establish its own Province timezone. Thus,
# during 2009, this timezone change will run from 00:00 the third Sunday
# in March until 24:00 of the second Saturday in October.
# From Arthur David Olson (2009-03-16):
# The unofficial claim at
# <a href="http://www.timeanddate.com/news/time/san-luis-new-time-zone.html">
# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
# </a>
# is that "The province will most likely follow the next daylight saving schedule,
# which is planned for the second Sunday in October."
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
@ -520,7 +564,8 @@ Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
-3:00 Arg AR%sT 2008 Jan 21
-3:00 - ART
-3:00 - ART 2009 Mar 15
-4:00 Arg WAR%sT
#
# Santa Cruz (SC)
Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

View file

@ -230,51 +230,46 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh
}
public void run0() {
FileSystemView fileSystem = filechooser.getFileSystemView();
File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
if (isInterrupted()) {
return;
}
final Vector<File> newFileCache = new Vector<File>();
Vector<File> newFiles = new Vector<File>();
// run through the file list, add directories and selectable files to fileCache
// Note that this block must be OUTSIDE of Invoker thread because of
// deadlock possibility with custom synchronized FileSystemView
for (File file : list) {
if (filechooser.accept(file)) {
boolean isTraversable = filechooser.isTraversable(file);
if (isTraversable) {
newFileCache.addElement(file);
} else if (filechooser.isFileSelectionEnabled()) {
newFiles.addElement(file);
}
if (isInterrupted()) {
return;
}
}
}
// First sort alphabetically by filename
sort(newFileCache);
sort(newFiles);
newFileCache.addAll(newFiles);
// To avoid loads of synchronizations with Invoker and improve performance we
// execute the whole block on the COM thread
DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
public DoChangeContents call() throws Exception {
FileSystemView fileSystem = filechooser.getFileSystemView();
File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
Vector<File> acceptsList = new Vector<File>();
if (isInterrupted()) {
return null;
}
// run through the file list, add directories and selectable files to fileCache
for (File file : list) {
if (filechooser.accept(file)) {
acceptsList.addElement(file);
}
}
if (isInterrupted()) {
return null;
}
// First sort alphabetically by filename
sort(acceptsList);
Vector<File> newDirectories = new Vector<File>(50);
Vector<File> newFiles = new Vector<File>();
// run through list grabbing directories in chunks of ten
for (int i = 0; i < acceptsList.size(); i++) {
File f = acceptsList.elementAt(i);
boolean isTraversable = filechooser.isTraversable(f);
if (isTraversable) {
newDirectories.addElement(f);
} else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
newFiles.addElement(f);
}
if (isInterrupted()) {
return null;
}
}
Vector<File> newFileCache = new Vector<File>(newDirectories);
newFileCache.addAll(newFiles);
int newSize = newFileCache.size();
int oldSize = fileCache.size();

View file

@ -4201,8 +4201,9 @@
<stateType key="Disabled"/>
<stateType key="Focused"/>
<stateType key="Editable">
<codeSnippet><![CDATA[
return ((JComboBox)c).isEditable();]]></codeSnippet>
<codeSnippet><![CDATA[
return c instanceof JComboBox && ((JComboBox)c).isEditable();
]]></codeSnippet>
</stateType>
</stateTypes>
<contentMargins top="0" bottom="0" left="0" right="0"/>
@ -16160,12 +16161,14 @@
<stateType key="Disabled"/>
<stateType key="Indeterminate">
<codeSnippet><![CDATA[
return ((JProgressBar)c).isIndeterminate();
return c instanceof JProgressBar &&
((JProgressBar)c).isIndeterminate();
]]></codeSnippet>
</stateType>
<stateType key="Finished">
<codeSnippet><![CDATA[
return ((JProgressBar)c).getPercentComplete() == 1.0;
return c instanceof JProgressBar &&
((JProgressBar)c).getPercentComplete() == 1.0;
]]></codeSnippet>
</stateType>
</stateTypes>
@ -25845,26 +25848,26 @@
<stateTypes>
<stateType key="North">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.NORTH;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.NORTH;
]]></codeSnippet>
</stateType>
<stateType key="East">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.EAST;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.EAST;
]]></codeSnippet>
</stateType>
<stateType key="West">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.WEST;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.WEST;
]]></codeSnippet>
</stateType>
<stateType key="South">
<codeSnippet><![CDATA[
JToolBar toolbar = (JToolBar)c;
return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.SOUTH;
return (c instanceof JToolBar) &&
NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.SOUTH;
]]></codeSnippet>
</stateType>
</stateTypes>

View file

@ -274,45 +274,61 @@ public abstract class ShellFolder extends File {
// Override File methods
public static void sort(List<? extends File> files) {
public static void sort(final List<? extends File> files) {
if (files == null || files.size() <= 1) {
return;
}
// Check that we can use the ShellFolder.sortChildren() method:
// 1. All files have the same non-null parent
// 2. All files is ShellFolders
File commonParent = null;
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
// Check that we can use the ShellFolder.sortChildren() method:
// 1. All files have the same non-null parent
// 2. All files is ShellFolders
File commonParent = null;
for (File file : files) {
File parent = file.getParentFile();
for (File file : files) {
File parent = file.getParentFile();
if (parent == null || !(file instanceof ShellFolder)) {
commonParent = null;
if (parent == null || !(file instanceof ShellFolder)) {
commonParent = null;
break;
}
break;
}
if (commonParent == null) {
commonParent = parent;
} else {
if (commonParent != parent && !commonParent.equals(parent)) {
commonParent = null;
if (commonParent == null) {
commonParent = parent;
} else {
if (commonParent != parent && !commonParent.equals(parent)) {
commonParent = null;
break;
break;
}
}
}
}
}
if (commonParent instanceof ShellFolder) {
((ShellFolder) commonParent).sortChildren(files);
} else {
Collections.sort(files, FILE_COMPARATOR);
}
if (commonParent instanceof ShellFolder) {
((ShellFolder) commonParent).sortChildren(files);
} else {
Collections.sort(files, FILE_COMPARATOR);
}
return null;
}
});
}
public void sortChildren(List<? extends File> files) {
Collections.sort(files, FILE_COMPARATOR);
public void sortChildren(final List<? extends File> files) {
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
Collections.sort(files, FILE_COMPARATOR);
return null;
}
});
}
public boolean isAbsolute() {

View file

@ -402,6 +402,11 @@ public class GTKKeybindings {
"released SPACE", "released",
"RETURN", "pressed"
}),
"RootPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[]{
"shift F10", "postPopup",
"CONTEXT_MENU", "postPopup"
}),
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[]{

View file

@ -360,6 +360,11 @@ public class WindowsKeybindings {
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
"RootPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[]{
"shift F10", "postPopup",
"CONTEXT_MENU", "postPopup"
}),
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[]{

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
"Truk Summer Time", "TRUST"};
String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT",
"Ulaanbaatar Summer Time", "ULAST"};
String WART[] = new String[] {"Western Argentine Time", "WART",
"Western Argentine Summer Time", "WARST"};
String WAT[] = new String[] {"Western African Time", "WAT",
"Western African Summer Time", "WAST"};
String WET[] = new String[] {"Western European Time", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
"Truk Sommerzeit", "TRUST"};
String ULAT[]= new String[] {"Ulaanbaatar Zeit", "ULAT",
"Ulaanbaatar Sommerzeit", "ULAST"};
String WART[] = new String[] {"Argentinische Zeit", "WART",
"Argentinische Sommerzeit", "WARST"};
String WAT[] = new String[] {"Westafrikanische Zeit", "WAT",
"Westafrikanische Sommerzeit", "WAST"};
String WET[] = new String[] {"Westeurop\u00e4ische Zeit", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
"Hora de verano de Truk", "TRUST"};
String ULAT[]= new String[] {"Hora de Ulan Bator", "ULAT",
"Hora de verano de Ulan Bator", "ULAST"};
String WART[] = new String[] {"Hora de Argentina", "WART",
"Hora de verano de Argentina", "WARST"};
String WAT[] = new String[] {"Hora de \u00c1frica Occidental", "WAT",
"Hora de verano de \u00c1frica Occidental", "WAST"};
String WET[] = new String[] {"Hora de Europa Occidental", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
"Heure d'\u00e9t\u00e9 de Truk", "TRUST"};
String ULAT[]= new String[] {"Heure de l'Ulaanbaatar", "ULAT",
"Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"} ;
String WART[] = new String[] {"Heure D'Argentine", "WART",
"Heure d'\u00e9t\u00e9 D'Argentine", "WARST"} ;
String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT",
"Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"} ;
String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
"Ora estiva di Truk", "TRUST"};
String ULAT[]= new String[] {"Ora di Ulaanbaatar", "ULAT",
"Ora estiva di Ulaanbaatar", "ULAST"};
String WART[] = new String[] {"Ora dell'Argentina", "WART",
"Ora estiva dell'Argentina", "WARST"};
String WAT[] = new String[] {"Ora dell'Africa occidentale", "WAT",
"Ora estiva dell'Africa occidentale", "WAST"};
String WET[] = new String[] {"Ora dell'Europa occidentale", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
"\u30c8\u30e9\u30c3\u30af\u590f\u6642\u9593", "TRUST"};
String ULAT[]= new String[] {"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u6642\u9593", "ULAT",
"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u590f\u6642\u9593", "ULAST"};
String WART[] = new String[] {"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART",
"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"};
String WAT[] = new String[] {"\u897f\u30a2\u30d5\u30ea\u30ab\u6642\u9593", "WAT",
"\u897f\u30a2\u30d5\u30ea\u30ab\u590f\u6642\u9593", "WAST"};
String WET[] = new String[] {"\u897f\u30e8\u30fc\u30ed\u30c3\u30d1\u6642\u9593", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
"\ud2b8\ub8e8\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "TRUST"};
String ULAT[]= new String[] {"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc2dc\uac04", "ULAT",
"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ULAST"};
String WART[] = new String[] {"\uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART",
"\uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"};
String WAT[] = new String[] {"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc2dc\uac04", "WAT",
"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WAST"};
String WET[] = new String[] {"\uc11c\uc720\ub7fd \uc2dc\uac04", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
"Truk, sommartid", "TRUST"};
String ULAT[]= new String[] {"Ulaanbaatar, normaltid", "ULAT",
"Ulaanbaatar, sommartid", "ULAST"};
String WART[] = new String[] {"Argentina, normaltid", "WART",
"Argentina, sommartid", "WARST"};
String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT",
"V\u00e4stafrikansk sommartid", "WAST"};
String WET[] = new String[] {"V\u00e4steuropeisk tid", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
"\u7279\u9c81\u514b\u590f\u4ee4\u65f6", "TRUST"};
String ULAT[]= new String[] {"\u5e93\u4f26\u65f6\u95f4", "ULAT",
"\u5e93\u4f26\u590f\u4ee4\u65f6", "ULAST"};
String WART[] = new String[] {"\u963f\u6839\u5ef7\u65f6\u95f4", "WART",
"\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"};
String WAT[] = new String[] {"\u897f\u975e\u65f6\u95f4", "WAT",
"\u897f\u975e\u590f\u4ee4\u65f6", "WAST"};
String WET[] = new String[] {"\u897f\u6b27\u65f6\u95f4", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -171,6 +171,8 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
"\u7279\u9b6f\u514b\u590f\u4ee4\u6642\u9593", "TRUST"};
String ULAT[]= new String[] {"\u5eab\u502b\u6642\u9593", "ULAT",
"\u5eab\u502b\u590f\u4ee4\u6642\u9593", "ULAST"};
String WART[] = new String[] {"\u963f\u6839\u5ef7\u6642\u9593", "WART",
"\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"};
String WAT[] = new String[] {"\u897f\u975e\u6642\u9593", "WAT",
"\u897f\u975e\u590f\u4ee4\u6642\u9593", "WAST"};
String WET[] = new String[] {"\u897f\u6b50\u6642\u9593", "WET",
@ -296,7 +298,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"America/Argentina/Rio_Gallegos", AGT},
{"America/Argentina/Salta", AGT},
{"America/Argentina/San_Juan", AGT},
{"America/Argentina/San_Luis", AGT},
{"America/Argentina/San_Luis", WART},
{"America/Argentina/Tucuman", AGT},
{"America/Argentina/Ushuaia", AGT},
{"America/Aruba", AST},

View file

@ -527,7 +527,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return Whether this is a file system shell folder
*/
public synchronized boolean isFileSystem() {
public boolean isFileSystem() {
if (cachedIsFileSystem == null) {
cachedIsFileSystem = hasAttribute(ATTRIB_FILESYSTEM);
}
@ -543,8 +543,8 @@ final class Win32ShellFolder2 extends ShellFolder {
public Boolean call() throws Exception {
// Caching at this point doesn't seem to be cost efficient
return (getAttributes0(getParentIShellFolder(),
getRelativePIDL(), attribute)
& attribute) != 0;
getRelativePIDL(), attribute)
& attribute) != 0;
}
});
}
@ -761,7 +761,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return Whether this shell folder is a link
*/
public synchronized boolean isLink() {
public boolean isLink() {
if (cachedIsLink == null) {
cachedIsLink = hasAttribute(ATTRIB_LINK);
}
@ -1160,8 +1160,16 @@ final class Win32ShellFolder2 extends ShellFolder {
private static native int compareIDsByColumn(long pParentIShellFolder, long pidl1, long pidl2, int columnIdx);
public void sortChildren(List<? extends File> files) {
Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
public void sortChildren(final List<? extends File> files) {
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
return null;
}
});
}
private static class ColumnComparator implements Comparator<File> {

View file

@ -478,21 +478,22 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
public <T> T invoke(Callable<T> task) {
try {
T result;
if (Thread.currentThread() == comThread) {
// if it's already called from the COM
// thread, we don't need to delegate the task
result = task.call();
return task.call();
} else {
Future<T> future = submit(task);
try {
result = future.get();
} catch (InterruptedException e) {
result = null;
future.cancel(true);
while (true) {
Future<T> future = submit(task);
try {
return future.get();
} catch (InterruptedException e) {
// Repeat the attempt
future.cancel(true);
}
}
}
return result;
} catch (Exception e) {
Throwable cause = (e instanceof ExecutionException) ? e.getCause() : e;
if (cause instanceof RuntimeException) {

View file

@ -0,0 +1,105 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6713352
@summary Deadlock in JFileChooser with synchronized custom FileSystemView
@author Pavel Porvatov
@run main bug6713352
*/
import sun.awt.shell.ShellFolder;
import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
public class bug6713352 {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null || !new File(tempDir).isDirectory()) {
tempDir = System.getProperty("user.home");
}
MyFileSystemView systemView = new MyFileSystemView();
synchronized (systemView) { // Get SystemView lock
new JFileChooser(systemView);
// Wait a little bit. BasicDirectoryModel will lock Invoker and stop on
// the bug6713352.MyFileSystemView.getFiles() method
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
try {
System.out.println("Try to get Invokers lock");
ShellFolder.getShellFolder(new File(tempDir)).listFiles(true);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
// To avoid RejectedExecutionException in BasicDirectoryModel wait a second
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
});
}
private static class MyFileSystemView extends FileSystemView {
public File createNewFolder(File containingDir) throws IOException {
return null;
}
public File[] getFiles(File dir, boolean useFileHiding) {
System.out.println("getFiles start");
File[] result;
synchronized (this) {
result = super.getFiles(dir, useFileHiding);
}
System.out.println("getFiles finished");
return result;
}
public synchronized Boolean isTraversable(File f) {
return super.isTraversable(f);
}
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6741426
@summary Tests reusing Nimbus borders across different components (JComboBox border set on a JTextField)
@author Peter Zhelezniakov
@run main Test6741426
*/
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
import javax.swing.*;
import java.awt.image.BufferedImage;
public class Test6741426 implements Runnable {
static final int WIDTH = 160;
static final int HEIGHT = 80;
@Override public void run() {
JComboBox cb = new JComboBox();
JTextField tf = new JTextField();
tf.setBorder(cb.getBorder());
BufferedImage img =
new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
tf.setSize(WIDTH, HEIGHT);
tf.paint(img.getGraphics());
}
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
SwingUtilities.invokeAndWait(new Test6741426());
}
}