diff --git a/make/CopyFiles.gmk b/make/CopyFiles.gmk
index 0ac509cc7be3fd44811e3f0e18ec4c948989df35..e2ff9c9890e11f23cf39248a1f80ca1178bcbee2 100644
--- a/make/CopyFiles.gmk
+++ b/make/CopyFiles.gmk
@@ -183,9 +183,9 @@ COPY_FILES += $(LIBDIR)/hijrah-config-umalqura.properties
##########################################################################################
-ifeq ($(OPENJDK_TARGET_OS), windows)
+ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
- TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
+ TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/lib
$(LIBDIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
$(call install-file)
diff --git a/src/aix/lib/tzmappings b/src/aix/lib/tzmappings
new file mode 100644
index 0000000000000000000000000000000000000000..079d2c937ba276b4974753fb65d52ee447799458
--- /dev/null
+++ b/src/aix/lib/tzmappings
@@ -0,0 +1,586 @@
+#
+#
+# Copyright (c) 1994, 2014, 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.
+#
+
+#
+# Portions Copyright (c) 2014 IBM Corporation
+#
+
+# This table describes mappings between AIX time zone IDs and Java time zone
+# IDs. Fields are separated by a single TAB ('\t'). Lines must be in the ascending
+# order in ASCII. (non-ASCII characters can't be used.)
+# NOTE
+# This table format is not a public interface of any Java
+# platforms. No applications should depend on this file in any form.
+# This file has been generated using programs. Do not edit this file manually.
+#
+# Solaris Java
+
+ACST-9:30ACDT Australia/Adelaide
+AST4 America/Curacao
+AST4ADT America/Halifax
+AST9 Pacific/Gambier
+AST9ADT America/Anchorage
+AZOREST1 Atlantic/Cape_Verde
+AZOREST1AZOREDT Atlantic/Azores
+Africa/Abidjan Africa/Abidjan
+Africa/Accra Africa/Accra
+Africa/Addis_Ababa Africa/Addis_Ababa
+Africa/Algiers Africa/Algiers
+Africa/Asmera Africa/Asmera
+Africa/Bamako GMT
+Africa/Bangui Africa/Bangui
+Africa/Banjul Africa/Banjul
+Africa/Bissau Africa/Bissau
+Africa/Blantyre Africa/Blantyre
+Africa/Brazzaville Africa/Luanda
+Africa/Bujumbura Africa/Bujumbura
+Africa/Cairo Africa/Cairo
+Africa/Casablanca Africa/Casablanca
+Africa/Ceuta Europe/Paris
+Africa/Conakry Africa/Conakry
+Africa/Dakar Africa/Dakar
+Africa/Dar_es_Salaam Africa/Dar_es_Salaam
+Africa/Djibouti Africa/Djibouti
+Africa/Douala Africa/Douala
+Africa/El_Aaiun Africa/Casablanca
+Africa/Freetown Africa/Freetown
+Africa/Gaborone Africa/Gaborone
+Africa/Harare Africa/Harare
+Africa/Johannesburg Africa/Johannesburg
+Africa/Kampala Africa/Kampala
+Africa/Khartoum Africa/Khartoum
+Africa/Kigali Africa/Kigali
+Africa/Kinshasa Africa/Kinshasa
+Africa/Lagos Africa/Lagos
+Africa/Libreville Africa/Libreville
+Africa/Lome Africa/Lome
+Africa/Luanda Africa/Luanda
+Africa/Lubumbashi Africa/Lubumbashi
+Africa/Lusaka Africa/Lusaka
+Africa/Malabo Africa/Malabo
+Africa/Maputo Africa/Maputo
+Africa/Maseru Africa/Maseru
+Africa/Mbabane Africa/Mbabane
+Africa/Mogadishu Africa/Mogadishu
+Africa/Monrovia Africa/Monrovia
+Africa/Nairobi Africa/Nairobi
+Africa/Ndjamena Africa/Ndjamena
+Africa/Niamey Africa/Niamey
+Africa/Nouakchott Africa/Nouakchott
+Africa/Ouagadougou Africa/Ouagadougou
+Africa/Porto-Novo Africa/Porto-Novo
+Africa/Sao_Tome Africa/Sao_Tome
+Africa/Timbuktu Africa/Timbuktu
+Africa/Tripoli Africa/Tripoli
+Africa/Tunis Africa/Tunis
+Africa/Windhoek Africa/Windhoek
+America/Adak America/Adak
+America/Anchorage America/Anchorage
+America/Anguilla America/Anguilla
+America/Antigua America/Antigua
+America/Araguaina America/Sao_Paulo
+America/Argentina/Buenos_Aires America/Argentina/Buenos_Aires
+America/Argentina/Catamarca America/Argentina/Catamarca
+America/Argentina/ComodRivadavia America/Argentina/Catamarca
+America/Argentina/Cordoba America/Argentina/Cordoba
+America/Argentina/Jujuy America/Argentina/Jujuy
+America/Argentina/La_Rioja America/Argentina/La_Rioja
+America/Argentina/Mendoza America/Argentina/Mendoza
+America/Argentina/Rio_Gallegos America/Argentina/Rio_Gallegos
+America/Argentina/Salta America/Argentina/Salta
+America/Argentina/San_Juan America/Argentina/San_Juan
+America/Argentina/San_Luis America/Argentina/San_Luis
+America/Argentina/Tucuman America/Argentina/Tucuman
+America/Argentina/Ushuaia America/Argentina/Ushuaia
+America/Aruba America/Aruba
+America/Asuncion America/Asuncion
+America/Atka America/Adak
+America/Barbados America/Barbados
+America/Belize America/Belize
+America/Bogota America/Bogota
+America/Boise America/Denver
+America/Buenos_Aires America/Argentina/Buenos_Aires
+America/Cancun America/Chicago
+America/Caracas America/Caracas
+America/Catamarca America/Argentina/Catamarca
+America/Cayenne America/Cayenne
+America/Cayman America/Cayman
+America/Chicago America/Chicago
+America/Chihuahua America/Denver
+America/Coral_Harbour America/Atikokan
+America/Cordoba America/Argentina/Cordoba
+America/Costa_Rica America/Costa_Rica
+America/Cuiaba America/Cuiaba
+America/Curacao America/Curacao
+America/Dawson America/Los_Angeles
+America/Dawson_Creek America/Dawson_Creek
+America/Denver America/Denver
+America/Detroit America/New_York
+America/Dominica America/Dominica
+America/Edmonton America/Edmonton
+America/El_Salvador America/El_Salvador
+America/Ensenada America/Los_Angeles
+America/Fort_Wayne America/Indiana/Indianapolis
+America/Fortaleza America/Fortaleza
+America/Glace_Bay America/Halifax
+America/Godthab America/Godthab
+America/Goose_Bay America/Thule
+America/Grand_Turk America/Grand_Turk
+America/Grenada America/Grenada
+America/Guadeloupe America/Guadeloupe
+America/Guatemala America/Guatemala
+America/Guayaquil America/Guayaquil
+America/Guyana America/Guyana
+America/Halifax America/Halifax
+America/Havana America/Havana
+America/Indiana/Indianapolis America/Indianapolis
+America/Indianapolis America/Indiana/Indianapolis
+America/Inuvik America/Denver
+America/Iqaluit America/New_York
+America/Jamaica America/Jamaica
+America/Jujuy America/Argentina/Jujuy
+America/Juneau America/Anchorage
+America/Knox_IN America/Indiana/Knox
+America/La_Paz America/La_Paz
+America/Lima America/Lima
+America/Los_Angeles America/Los_Angeles
+America/Louisville America/Kentucky/Louisville
+America/Managua America/Managua
+America/Manaus America/Manaus
+America/Marigot America/Guadeloupe
+America/Martinique America/Martinique
+America/Mazatlan America/Mazatlan
+America/Mendoza America/Argentina/Mendoza
+America/Menominee America/Winnipeg
+America/Mexico_City America/Mexico_City
+America/Miquelon America/Miquelon
+America/Moncton America/Moncton
+America/Montevideo America/Montevideo
+America/Montreal America/Montreal
+America/Montserrat America/Montserrat
+America/Nassau America/Nassau
+America/New_York America/New_York
+America/Nipigon America/New_York
+America/Nome America/Anchorage
+America/Noronha America/Noronha
+America/Panama America/Panama
+America/Pangnirtung America/Thule
+America/Paramaribo America/Paramaribo
+America/Phoenix America/Phoenix
+America/Port-au-Prince America/Port-au-Prince
+America/Port_of_Spain America/Port_of_Spain
+America/Porto_Acre America/Rio_Branco
+America/Puerto_Rico America/Puerto_Rico
+America/Rainy_River America/Chicago
+America/Rankin_Inlet America/Chicago
+America/Regina America/Regina
+America/Rio_Branco America/Rio_Branco
+America/Rosario America/Argentina/Cordoba
+America/Santiago America/Santiago
+America/Santo_Domingo America/Santo_Domingo
+America/Sao_Paulo America/Sao_Paulo
+America/Scoresbysund America/Scoresbysund
+America/Shiprock America/Denver
+America/St_Barthelemy America/Guadeloupe
+America/St_Johns America/St_Johns
+America/St_Kitts America/St_Kitts
+America/St_Lucia America/St_Lucia
+America/St_Thomas America/St_Thomas
+America/St_Vincent America/St_Vincent
+America/Tegucigalpa America/Tegucigalpa
+America/Thule America/Thule
+America/Thunder_Bay America/New_York
+America/Tijuana America/Tijuana
+America/Toronto America/Toronto
+America/Tortola America/Tortola
+America/Vancouver America/Vancouver
+America/Virgin America/St_Thomas
+America/Whitehorse America/Los_Angeles
+America/Winnipeg America/Winnipeg
+America/Yakutat America/Anchorage
+America/Yellowknife America/Denver
+Antarctica/Casey Antarctica/Casey
+Antarctica/DumontDUrville Antarctica/DumontDUrville
+Antarctica/Mawson Antarctica/Mawson
+Antarctica/McMurdo Antarctica/McMurdo
+Antarctica/Palmer Antarctica/Palmer
+Antarctica/South_Pole Antarctica/McMurdo
+Arctic/Longyearbyen Europe/Oslo
+Asia/Aden Asia/Aden
+Asia/Almaty Asia/Almaty
+Asia/Amman Asia/Amman
+Asia/Anadyr Asia/Anadyr
+Asia/Aqtau Asia/Aqtau
+Asia/Aqtobe Asia/Aqtobe
+Asia/Ashkhabad Asia/Ashkhabad
+Asia/Baghdad Asia/Baghdad
+Asia/Bahrain Asia/Bahrain
+Asia/Baku Asia/Baku
+Asia/Bangkok Asia/Bangkok
+Asia/Beirut Asia/Beirut
+Asia/Bishkek Asia/Bishkek
+Asia/Brunei Asia/Brunei
+Asia/Calcutta Asia/Calcutta
+Asia/Chungking Asia/Shanghai
+Asia/Colombo Asia/Colombo
+Asia/Dacca Asia/Dacca
+Asia/Damascus Asia/Damascus
+Asia/Dhaka Asia/Dhaka
+Asia/Dubai Asia/Dubai
+Asia/Dushanbe Asia/Dushanbe
+Asia/Gaza Asia/Amman
+Asia/Harbin Asia/Shanghai
+Asia/Hong_Kong Asia/Hong_Kong
+Asia/Irkutsk Asia/Irkutsk
+Asia/Istanbul Europe/Istanbul
+Asia/Jakarta Asia/Jakarta
+Asia/Jayapura Asia/Jayapura
+Asia/Jerusalem Asia/Jerusalem
+Asia/Kabul Asia/Kabul
+Asia/Kamchatka Asia/Kamchatka
+Asia/Karachi Asia/Karachi
+Asia/Kashgar Asia/Shanghai
+Asia/Katmandu Asia/Katmandu
+Asia/Kolkata Asia/Kolkata
+Asia/Krasnoyarsk Asia/Krasnoyarsk
+Asia/Kuala_Lumpur Asia/Kuala_Lumpur
+Asia/Kuwait Asia/Kuwait
+Asia/Macao Asia/Macao
+Asia/Magadan Asia/Magadan
+Asia/Manila Asia/Manila
+Asia/Muscat Asia/Muscat
+Asia/Nicosia Asia/Nicosia
+Asia/Novosibirsk Asia/Novosibirsk
+Asia/Omsk Asia/Novosibirsk
+Asia/Phnom_Penh Asia/Phnom_Penh
+Asia/Pyongyang Asia/Pyongyang
+Asia/Qatar Asia/Qatar
+Asia/Rangoon Asia/Rangoon
+Asia/Riyadh Asia/Riyadh
+Asia/Saigon Asia/Ho_Chi_Minh
+Asia/Seoul Asia/Seoul
+Asia/Shanghai Asia/Shanghai
+Asia/Singapore Asia/Singapore
+Asia/Taipei Asia/Taipei
+Asia/Tashkent Asia/Tashkent
+Asia/Tbilisi Asia/Tbilisi
+Asia/Tehran Asia/Tehran
+Asia/Tel_Aviv Asia/Jerusalem
+Asia/Thimbu Asia/Thimbu
+Asia/Tokyo Asia/Tokyo
+Asia/Ujung_Pandang Asia/Ujung_Pandang
+Asia/Ulan_Bator Asia/Ulaanbaatar
+Asia/Urumqi Asia/Shanghai
+Asia/Vientiane Asia/Vientiane
+Asia/Vladivostok Asia/Vladivostok
+Asia/Yakutsk Asia/Yakutsk
+Asia/Yekaterinburg Asia/Yekaterinburg
+Asia/Yerevan Asia/Yerevan
+Atlantic/Azores Atlantic/Azores
+Atlantic/Bermuda Atlantic/Bermuda
+Atlantic/Canary Atlantic/Canary
+Atlantic/Cape_Verde Atlantic/Cape_Verde
+Atlantic/Faeroe Atlantic/Faeroe
+Atlantic/Jan_Mayen Atlantic/Jan_Mayen
+Atlantic/Madeira Europe/London
+Atlantic/Reykjavik Atlantic/Reykjavik
+Atlantic/South_Georgia Atlantic/South_Georgia
+Atlantic/St_Helena Atlantic/St_Helena
+Atlantic/Stanley Atlantic/Stanley
+Australia/ACT Australia/Sydney
+Australia/Adelaide Australia/Adelaide
+Australia/Brisbane Australia/Brisbane
+Australia/Broken_Hill Australia/Broken_Hill
+Australia/Canberra Australia/Sydney
+Australia/Darwin Australia/Darwin
+Australia/Hobart Australia/Hobart
+Australia/LHI Australia/Lord_Howe
+Australia/Lord_Howe Australia/Lord_Howe
+Australia/Melbourne Australia/Sydney
+Australia/NSW Australia/Sydney
+Australia/North Australia/Darwin
+Australia/Perth Australia/Perth
+Australia/Queensland Australia/Brisbane
+Australia/South Australia/Adelaide
+Australia/Sydney Australia/Sydney
+Australia/Tasmania Australia/Hobart
+Australia/Victoria Australia/Melbourne
+Australia/West Australia/Perth
+Australia/Yancowinna Australia/Broken_Hill
+BRT3BRST America/Sao_Paulo
+BST11 Pacific/Apia
+BST11BDT Pacific/Apia
+Brazil/Acre America/Rio_Branco
+Brazil/DeNoronha America/Noronha
+Brazil/East America/Sao_Paulo
+Brazil/West America/Manaus
+CET Europe/Paris
+CET-1CEST Europe/Paris
+CET-1CEST-2 Europe/Berlin
+CET-1CET-2 Europe/Paris
+CST6 America/Costa_Rica
+CST6CDT America/Chicago
+CUT0 UTC
+CUT0GDT Europe/London
+Canada/Atlantic America/Halifax
+Canada/Central America/Winnipeg
+Canada/East-Saskatchewan America/Regina
+Canada/Eastern America/Montreal
+Canada/Mountain America/Edmonton
+Canada/Newfoundland America/St_Johns
+Canada/Pacific America/Vancouver
+Canada/Saskatchewan America/Regina
+Canada/Yukon America/Whitehorse
+Chile/Continental America/Santiago
+Chile/EasterIsland Pacific/Easter
+Cuba America/Havana
+EET Europe/Istanbul
+EET-10 Australia/Brisbane
+EET-10EETDT Australia/Sydney
+EST America/Indianapolis
+EST5 America/Indianapolis
+EST5EDT America/New_York
+Egypt Africa/Cairo
+Eire Europe/Dublin
+Etc/GMT GMT
+Etc/GMT0 GMT
+Etc/Greenwich GMT
+Etc/UCT UTC
+Etc/UTC UTC
+Etc/Universal UTC
+Etc/Zulu UTC
+Europe/Amsterdam Europe/Amsterdam
+Europe/Andorra Europe/Andorra
+Europe/Athens Europe/Athens
+Europe/Belfast Europe/London
+Europe/Belgrade Europe/Belgrade
+Europe/Berlin Europe/Berlin
+Europe/Bratislava Europe/Prague
+Europe/Brussels Europe/Brussels
+Europe/Bucharest Europe/Bucharest
+Europe/Budapest Europe/Budapest
+Europe/Chisinau Europe/Chisinau
+Europe/Copenhagen Europe/Copenhagen
+Europe/Dublin Europe/Dublin
+Europe/Gibraltar Europe/Gibraltar
+Europe/Guernsey Europe/London
+Europe/Helsinki Europe/Helsinki
+Europe/Isle_of_Man Europe/London
+Europe/Istanbul Europe/Istanbul
+Europe/Jersey Europe/London
+Europe/Kaliningrad Europe/Kaliningrad
+Europe/Kiev Europe/Kiev
+Europe/Lisbon Europe/Lisbon
+Europe/Ljubljana Europe/Belgrade
+Europe/London Europe/London
+Europe/Luxembourg Europe/Luxembourg
+Europe/Madrid Europe/Madrid
+Europe/Malta Europe/Malta
+Europe/Mariehamn Europe/Helsinki
+Europe/Minsk Europe/Minsk
+Europe/Monaco Europe/Monaco
+Europe/Moscow Europe/Moscow
+Europe/Nicosia Asia/Nicosia
+Europe/Oslo Europe/Oslo
+Europe/Paris Europe/Paris
+Europe/Podgorica Europe/Belgrade
+Europe/Prague Europe/Prague
+Europe/Riga Europe/Riga
+Europe/Rome Europe/Rome
+Europe/Samara Europe/Samara
+Europe/San_Marino Europe/Rome
+Europe/Sarajevo Europe/Belgrade
+Europe/Simferopol Europe/Simferopol
+Europe/Skopje Europe/Belgrade
+Europe/Sofia Europe/Sofia
+Europe/Stockholm Europe/Stockholm
+Europe/Tallinn Europe/Tallinn
+Europe/Tirane Europe/Tirane
+Europe/Vaduz Europe/Vaduz
+Europe/Vatican Europe/Rome
+Europe/Vienna Europe/Vienna
+Europe/Vilnius Europe/Vilnius
+Europe/Warsaw Europe/Warsaw
+Europe/Zagreb Europe/Belgrade
+Europe/Zurich Europe/Zurich
+FALKST2 Atlantic/South_Georgia
+FALKST2FALKDT Atlantic/South_Georgia
+Factory GMT
+GB Europe/London
+GB-Eire Europe/London
+GMT GMT
+GMT0 GMT
+GMT0BST Europe/London
+GMT0BST-1 Europe/London
+GMT0WET Europe/Lisbon
+GRNLNDST3 America/Buenos_Aires
+GRNLNDST3GRNLNDDT America/Godthab
+Greenwich GMT
+HST Pacific/Honolulu
+HST10 Pacific/Honolulu
+HST10HDT America/Adak
+Hongkong Asia/Hong_Kong
+Iceland Atlantic/Reykjavik
+Indian/Antananarivo Indian/Antananarivo
+Indian/Chagos Indian/Chagos
+Indian/Christmas Indian/Christmas
+Indian/Cocos Indian/Cocos
+Indian/Comoro Indian/Comoro
+Indian/Kerguelen Indian/Kerguelen
+Indian/Mahe Indian/Mahe
+Indian/Maldives Indian/Maldives
+Indian/Mauritius Indian/Mauritius
+Indian/Mayotte Indian/Mayotte
+Indian/Reunion Indian/Reunion
+Iran Asia/Tehran
+Israel Asia/Jerusalem
+JST-9 Asia/Tokyo
+JST-9JSTDT Asia/Tokyo
+Jamaica America/Jamaica
+Japan Asia/Tokyo
+KORST-9 Asia/Seoul
+KORST-9KORDT Asia/Seoul
+Kwajalein Pacific/Kwajalein
+Libya Africa/Tripoli
+MEST-2 Europe/Istanbul
+MEST-2MEDT Europe/Istanbul
+MEST-3 Asia/Riyadh
+MEST-3MEDT Europe/Moscow
+MET Europe/Paris
+MET-11 Pacific/Guadalcanal
+MET-11METDT Asia/Magadan
+MET-1MEST Europe/Paris
+MET-1MST-2 Europe/Berlin
+MEZ-1MESZ Europe/Berlin
+MEZ-1MESZ-2 Europe/Berlin
+MSK-3MSD Europe/Moscow
+MST America/Phoenix
+MST7 America/Phoenix
+MST7MDT America/Denver
+Mexico/BajaNorte America/Tijuana
+Mexico/BajaSur America/Mazatlan
+Mexico/General America/Mexico_City
+Mideast/Riyadh87 Asia/Riyadh87
+Mideast/Riyadh88 Asia/Riyadh88
+Mideast/Riyadh89 Asia/Riyadh89
+NFT-1 Africa/Algiers
+NFT-1DFT Europe/Paris
+NFT-1DST Europe/Paris
+NZ Pacific/Auckland
+NZ-CHAT Pacific/Chatham
+NZST-12 Pacific/Fiji
+NZST-12NZDT Pacific/Auckland
+Navajo America/Denver
+PAKST-5 Asia/Karachi
+PAKST-5PAKDT Asia/Yekaterinburg
+PRC Asia/Shanghai
+PST8 Pacific/Pitcairn
+PST8PDT America/Los_Angeles
+PST8PDT7 America/Tijuana
+Pacific/Apia Pacific/Apia
+Pacific/Auckland Pacific/Auckland
+Pacific/Chatham Pacific/Chatham
+Pacific/Easter Pacific/Easter
+Pacific/Efate Pacific/Efate
+Pacific/Enderbury Pacific/Enderbury
+Pacific/Fakaofo Pacific/Fakaofo
+Pacific/Fiji Pacific/Fiji
+Pacific/Funafuti Pacific/Funafuti
+Pacific/Galapagos Pacific/Galapagos
+Pacific/Gambier Pacific/Gambier
+Pacific/Guadalcanal Pacific/Guadalcanal
+Pacific/Guam Pacific/Guam
+Pacific/Honolulu Pacific/Honolulu
+Pacific/Kiritimati Pacific/Kiritimati
+Pacific/Kosrae Pacific/Kosrae
+Pacific/Majuro Pacific/Majuro
+Pacific/Marquesas Pacific/Marquesas
+Pacific/Nauru Pacific/Nauru
+Pacific/Niue Pacific/Niue
+Pacific/Norfolk Pacific/Norfolk
+Pacific/Noumea Pacific/Noumea
+Pacific/Pago_Pago Pacific/Pago_Pago
+Pacific/Palau Pacific/Palau
+Pacific/Pitcairn Pacific/Pitcairn
+Pacific/Ponape Pacific/Ponape
+Pacific/Port_Moresby Pacific/Port_Moresby
+Pacific/Rarotonga Pacific/Rarotonga
+Pacific/Saipan Pacific/Saipan
+Pacific/Samoa Pacific/Pago_Pago
+Pacific/Tahiti Pacific/Tahiti
+Pacific/Tarawa Pacific/Tarawa
+Pacific/Tongatapu Pacific/Tongatapu
+Pacific/Truk Pacific/Truk
+Pacific/Wake Pacific/Wake
+Pacific/Wallis Pacific/Wallis
+Poland Europe/Warsaw
+Portugal Europe/Lisbon
+ROC Asia/Taipei
+ROK Asia/Seoul
+SAUST-3 Asia/Riyadh
+SAUST-3SAUDT Europe/Moscow
+Singapore Asia/Singapore
+SystemV/AST4ADT America/Thule
+SystemV/CST6CDT America/Chicago
+SystemV/EST5EDT America/New_York
+SystemV/MST7MDT America/Denver
+SystemV/PST8PDT America/Los_Angeles
+SystemV/YST9YDT America/Anchorage
+TAIST-8 Asia/Taipei
+TAIST-8TAIDT Asia/Irkutsk
+TASHST-6 Asia/Dacca
+TASHST-6TASHDT Asia/Novosibirsk
+THAIST-7 Asia/Bangkok
+THAIST-7THAIDT Asia/Krasnoyarsk
+Turkey Europe/Istanbul
+UCT UTC
+US/Alaska America/Anchorage
+US/Aleutian America/Adak
+US/Arizona America/Phoenix
+US/Central America/Chicago
+US/East-Indiana America/Indiana/Indianapolis
+US/Eastern America/New_York
+US/Hawaii Pacific/Honolulu
+US/Indiana-Starke America/Indiana/Knox
+US/Michigan America/New_York
+US/Mountain America/Denver
+US/Pacific America/Los_Angeles
+US/Pacific-New America/Los_Angeles
+US/Samoa Pacific/Pago_Pago
+USAST-2 Africa/Johannesburg
+USAST-2USADT Europe/Istanbul
+UTC UTC
+UYT3UYST America/Montevideo
+Universal UTC
+W-SU Europe/Moscow
+WAUST-8 Australia/Perth
+WAUST-8WAUDT Australia/Perth
+WET WET
+WET-2 Africa/Johannesburg
+WET-2WET Europe/Helsinki
+WST-4 Asia/Dubai
+WST-4WDT Europe/Samara
+Zulu UTC
diff --git a/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java b/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
index 4b9c78b3dcd43c95e95f85392d0150f3c029a374..c9a86b85188efe3ff1ba726bac70759d925e825b 100644
--- a/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
+++ b/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
@@ -510,15 +510,17 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
}
};
- private static Action hideAction = new AbstractAction() {
+ private final Action hideAction = new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
final JComboBox comboBox = (JComboBox)e.getSource();
+ comboBox.firePopupMenuCanceled();
+ comboBox.setPopupVisible(false);
+ }
- if (comboBox.isPopupVisible()) {
- comboBox.firePopupMenuCanceled();
- comboBox.setPopupVisible(false);
- }
+ @Override
+ public boolean isEnabled() {
+ return comboBox.isPopupVisible() && super.isEnabled();
}
};
diff --git a/src/macosx/lib/Info-privileged.plist b/src/macosx/lib/Info-privileged.plist
index 776967ab384051ab628a806847d3f7e16c19ed7c..1d5ef39c5f440bd00e63b14dab77a3820597f6ee 100644
--- a/src/macosx/lib/Info-privileged.plist
+++ b/src/macosx/lib/Info-privileged.plist
@@ -7,7 +7,7 @@
CFBundleInfoDictionaryVersion6.0CFBundleName
- OpenJDK 7 Command
+ OpenJDK 8 CommandCFBundleShortVersionString1.0CFBundleVersion
diff --git a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
index 44b28f032b6d56c7251a93f6557d251ba5f9ecf0..40f380bdeb15ce87704f89cad8ce2891a49c868e 100644
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
@@ -142,10 +142,9 @@ SplashInitPlatform(Splash * splash) {
splash->screenFormat.byteOrder = 1 ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
splash->screenFormat.depthBytes = 4;
- dispatch_async(dispatch_get_main_queue(), ^(void) {
- NSApplication * app = [NSApplicationAWT sharedApplication];
- [NSApplicationAWT runAWTLoopWithApp: app];
- });
+ [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+ [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
+ }];
}
void
diff --git a/src/share/bin/java.c b/src/share/bin/java.c
index 73c532676b3c6bc9485c15a6185348c813ee8881..ed45f085de941f862f4f01ceb09a39f35b57468b 100644
--- a/src/share/bin/java.c
+++ b/src/share/bin/java.c
@@ -732,6 +732,9 @@ SetClassPath(const char *s)
if (s == NULL)
return;
s = JLI_WildcardExpandClasspath(s);
+ if (sizeof(format) - 2 + JLI_StrLen(s) < JLI_StrLen(s))
+ // s is corrupted after wildcard expansion
+ return;
def = JLI_MemAlloc(sizeof(format)
- 2 /* strlen("%s") */
+ JLI_StrLen(s));
@@ -1351,9 +1354,11 @@ AddApplicationOptions(int cpathc, const char **cpathv)
if (s) {
s = (char *) JLI_WildcardExpandClasspath(s);
/* 40 for -Denv.class.path= */
- envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
- sprintf(envcp, "-Denv.class.path=%s", s);
- AddOption(envcp, NULL);
+ if (JLI_StrLen(s) + 40 > JLI_StrLen(s)) { // Safeguard from overflow
+ envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
+ sprintf(envcp, "-Denv.class.path=%s", s);
+ AddOption(envcp, NULL);
+ }
}
}
diff --git a/src/share/classes/java/awt/MediaTracker.java b/src/share/classes/java/awt/MediaTracker.java
index 91e074aeb2720e29444847c8fb994d323246a822..a96dda614a727e454350414c4ba7680629008d2b 100644
--- a/src/share/classes/java/awt/MediaTracker.java
+++ b/src/share/classes/java/awt/MediaTracker.java
@@ -226,7 +226,9 @@ public class MediaTracker implements java.io.Serializable {
addImageImpl(image, id, w, h);
Image rvImage = getResolutionVariant(image);
if (rvImage != null) {
- addImageImpl(rvImage, id, 2 * w, 2 * h);
+ addImageImpl(rvImage, id,
+ w == -1 ? -1 : 2 * w,
+ h == -1 ? -1 : 2 * h);
}
}
@@ -810,8 +812,9 @@ public class MediaTracker implements java.io.Serializable {
removeImageImpl(image, id, width, height);
Image rvImage = getResolutionVariant(image);
if (rvImage != null) {
- removeImageImpl(rvImage, id, 2 * width, 2 * height);
-
+ removeImageImpl(rvImage, id,
+ width == -1 ? -1 : 2 * width,
+ height == -1 ? -1 : 2 * height);
}
notifyAll(); // Notify in case remaining images are "done".
}
diff --git a/src/share/classes/java/awt/datatransfer/DataFlavor.java b/src/share/classes/java/awt/datatransfer/DataFlavor.java
index 9ca61a34af1841274514b26c14f4712c20b444f9..2df8e5ac831ca7f6d3b9de58fd8fca688139c1d3 100644
--- a/src/share/classes/java/awt/datatransfer/DataFlavor.java
+++ b/src/share/classes/java/awt/datatransfer/DataFlavor.java
@@ -25,13 +25,28 @@
package java.awt.datatransfer;
-import java.io.*;
-import java.nio.*;
-import java.util.*;
-
import sun.awt.datatransfer.DataTransferer;
import sun.reflect.misc.ReflectUtil;
+import java.io.ByteArrayInputStream;
+import java.io.CharArrayReader;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.OptionalDataException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Objects;
+
import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
/**
@@ -501,7 +516,7 @@ public class DataFlavor implements Externalizable, Cloneable {
* @throws ClassNotFoundException
* @throws NullPointerException if mimeType is null
*
- * @see tryToLoadClass
+ * @see #tryToLoadClass
*/
private void initialize(String mimeType, String humanPresentableName, ClassLoader classLoader) throws MimeTypeParseException, ClassNotFoundException {
if (mimeType == null) {
@@ -990,14 +1005,8 @@ public class DataFlavor implements Externalizable, Cloneable {
return true;
}
- if (representationClass == null) {
- if (that.getRepresentationClass() != null) {
- return false;
- }
- } else {
- if (!representationClass.equals(that.getRepresentationClass())) {
- return false;
- }
+ if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) {
+ return false;
}
if (mimeType == null) {
@@ -1010,34 +1019,22 @@ public class DataFlavor implements Externalizable, Cloneable {
}
if ("text".equals(getPrimaryType())) {
- if (DataTransferer.doesSubtypeSupportCharset(this) &&
- representationClass != null &&
- !(isRepresentationClassReader() ||
- String.class.equals(representationClass) ||
- isRepresentationClassCharBuffer() ||
- char[].class.equals(representationClass)))
- {
+ if (DataTransferer.doesSubtypeSupportCharset(this)
+ && representationClass != null
+ && !isStandardTextRepresentationClass()) {
String thisCharset =
- DataTransferer.canonicalName(getParameter("charset"));
+ DataTransferer.canonicalName(this.getParameter("charset"));
String thatCharset =
- DataTransferer.canonicalName(that.getParameter("charset"));
- if (thisCharset == null) {
- if (thatCharset != null) {
- return false;
- }
- } else {
- if (!thisCharset.equals(thatCharset)) {
- return false;
- }
+ DataTransferer.canonicalName(that.getParameter("charset"));
+ if (!Objects.equals(thisCharset, thatCharset)) {
+ return false;
}
}
- if ("html".equals(getSubType()) &&
- this.getParameter("document") != null )
- {
- if (!this.getParameter("document").
- equals(that.getParameter("document")))
- {
+ if ("html".equals(getSubType())) {
+ String thisDocument = this.getParameter("document");
+ String thatDocument = that.getParameter("document");
+ if (!Objects.equals(thisDocument, thatDocument)) {
return false;
}
}
@@ -1094,18 +1091,21 @@ public class DataFlavor implements Externalizable, Cloneable {
// MimeType.match which reports a match if one or both of the
// subTypes is '*', regardless of the other subType.
- if ("text".equals(primaryType) &&
- DataTransferer.doesSubtypeSupportCharset(this) &&
- representationClass != null &&
- !(isRepresentationClassReader() ||
- String.class.equals(representationClass) ||
- isRepresentationClassCharBuffer() ||
- char[].class.equals(representationClass)))
- {
- String charset =
- DataTransferer.canonicalName(getParameter("charset"));
- if (charset != null) {
- total += charset.hashCode();
+ if ("text".equals(primaryType)) {
+ if (DataTransferer.doesSubtypeSupportCharset(this)
+ && representationClass != null
+ && !isStandardTextRepresentationClass()) {
+ String charset = DataTransferer.canonicalName(getParameter("charset"));
+ if (charset != null) {
+ total += charset.hashCode();
+ }
+ }
+
+ if ("html".equals(getSubType())) {
+ String document = this.getParameter("document");
+ if (document != null) {
+ total += document.hashCode();
+ }
}
}
}
@@ -1181,6 +1181,20 @@ public class DataFlavor implements Externalizable, Cloneable {
return mimeType.match(mtype);
}
+ /**
+ * Checks if the representation class is one of the standard text
+ * representation classes.
+ *
+ * @return true if the representation class is one of the standard text
+ * representation classes, otherwise false
+ */
+ private boolean isStandardTextRepresentationClass() {
+ return isRepresentationClassReader()
+ || String.class.equals(representationClass)
+ || isRepresentationClassCharBuffer()
+ || char[].class.equals(representationClass);
+ }
+
/**
* Does the DataFlavor represent a serialized object?
*/
diff --git a/src/share/classes/java/awt/dnd/DragSourceContext.java b/src/share/classes/java/awt/dnd/DragSourceContext.java
index cbc4c83b148f6a15d379b120584543d766348e64..3397f8168b19542c06f8d11d8a0e94e02fdb6767 100644
--- a/src/share/classes/java/awt/dnd/DragSourceContext.java
+++ b/src/share/classes/java/awt/dnd/DragSourceContext.java
@@ -576,9 +576,9 @@ public class DragSourceContext
throw new InvalidObjectException("Null trigger component");
}
- int DGRActions = newTrigger.getSourceAsDragGestureRecognizer().getSourceActions()
+ int newSourceActions = f.get("sourceActions", 0)
& (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
- if (DGRActions == DnDConstants.ACTION_NONE) {
+ if (newSourceActions == DnDConstants.ACTION_NONE) {
throw new InvalidObjectException("Invalid source actions");
}
int triggerActions = newTrigger.getDragAction();
@@ -591,8 +591,7 @@ public class DragSourceContext
cursor = (Cursor)f.get("cursor", null);
useCustomCursor = f.get("useCustomCursor", false);
- sourceActions = f.get("sourceActions", 0)
- & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+ sourceActions = newSourceActions;
transferable = (Transferable)s.readObject();
listener = (DragSourceListener)s.readObject();
diff --git a/src/share/classes/java/lang/ConditionalSpecialCasing.java b/src/share/classes/java/lang/ConditionalSpecialCasing.java
index fd849545b9931b094be464f60d8cd9354d0d59f2..79fda55fb07a0f61c864631151b2b6b3ceb786f8 100644
--- a/src/share/classes/java/lang/ConditionalSpecialCasing.java
+++ b/src/share/classes/java/lang/ConditionalSpecialCasing.java
@@ -62,6 +62,7 @@ final class ConditionalSpecialCasing {
//# Conditional mappings
//# ================================================================================
new Entry(0x03A3, new char[]{0x03C2}, new char[]{0x03A3}, null, FINAL_CASED), // # GREEK CAPITAL LETTER SIGMA
+ new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, null, 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
//# ================================================================================
//# Locale-sensitive mappings
@@ -77,8 +78,8 @@ final class ConditionalSpecialCasing {
//# ================================================================================
//# Turkish and Azeri
-// new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
-// new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
+ new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
+ new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
new Entry(0x0307, new char[]{}, new char[]{0x0307}, "tr", AFTER_I), // # COMBINING DOT ABOVE
new Entry(0x0307, new char[]{}, new char[]{0x0307}, "az", AFTER_I), // # COMBINING DOT ABOVE
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
@@ -148,21 +149,25 @@ final class ConditionalSpecialCasing {
private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) {
HashSet set = entryTable.get(new Integer(src.codePointAt(index)));
+ char[] ret = null;
if (set != null) {
Iterator iter = set.iterator();
String currentLang = locale.getLanguage();
while (iter.hasNext()) {
Entry entry = iter.next();
- String conditionLang= entry.getLanguage();
+ String conditionLang = entry.getLanguage();
if (((conditionLang == null) || (conditionLang.equals(currentLang))) &&
isConditionMet(src, index, locale, entry.getCondition())) {
- return (bLowerCasing ? entry.getLowerCase() : entry.getUpperCase());
+ ret = bLowerCasing ? entry.getLowerCase() : entry.getUpperCase();
+ if (conditionLang != null) {
+ break;
+ }
}
}
}
- return null;
+ return ret;
}
private static boolean isConditionMet(String src, int index, Locale locale, int condition) {
diff --git a/src/share/classes/java/lang/String.java b/src/share/classes/java/lang/String.java
index 6565f6434e8ea1dbf89b9a1f0f9401f4564d5de3..ce7d8f779d5303d9001d7aee15de516c32dac1fb 100644
--- a/src/share/classes/java/lang/String.java
+++ b/src/share/classes/java/lang/String.java
@@ -2597,7 +2597,9 @@ public final class String
} else {
srcCount = 1;
}
- if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
+ if (localeDependent ||
+ srcChar == '\u03A3' || // GREEK CAPITAL LETTER SIGMA
+ srcChar == '\u0130') { // LATIN CAPITAL LETTER I WITH DOT ABOVE
lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
} else {
lowerChar = Character.toLowerCase(srcChar);
diff --git a/src/share/classes/java/util/Random.java b/src/share/classes/java/util/Random.java
index 069242c6e3043cdeef1e8942c506404f65eeb77a..1061b59361e57f5d79f8a135cc3aecca80660584 100644
--- a/src/share/classes/java/util/Random.java
+++ b/src/share/classes/java/util/Random.java
@@ -874,7 +874,7 @@ class Random implements java.io.Serializable {
* (inclusive) and one (exclusive).
*
*
A pseudorandom {@code double} value is generated as if it's the result
- * of calling the method {@link #nextDouble()}}.
+ * of calling the method {@link #nextDouble()}.
*
* @param streamSize the number of values to generate
* @return a stream of {@code double} values
@@ -897,7 +897,7 @@ class Random implements java.io.Serializable {
* (exclusive).
*
*
A pseudorandom {@code double} value is generated as if it's the result
- * of calling the method {@link #nextDouble()}}.
+ * of calling the method {@link #nextDouble()}.
*
* @implNote This method is implemented to be equivalent to {@code
* doubles(Long.MAX_VALUE)}.
diff --git a/src/share/classes/javax/crypto/JceSecurity.java b/src/share/classes/javax/crypto/JceSecurity.java
index 7e062462211e23ebdf2e8bad3b3c9e5c2925c5bf..fb7052d244d20da01ce96f66be79ce1815fcd9bb 100644
--- a/src/share/classes/javax/crypto/JceSecurity.java
+++ b/src/share/classes/javax/crypto/JceSecurity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -216,26 +216,28 @@ final class JceSecurity {
new WeakHashMap<>();
/*
- * Retuns the CodeBase for the given class.
+ * Returns the CodeBase for the given class.
*/
static URL getCodeBase(final Class> clazz) {
- URL url = codeBaseCacheRef.get(clazz);
- if (url == null) {
- url = AccessController.doPrivileged(new PrivilegedAction() {
- public URL run() {
- ProtectionDomain pd = clazz.getProtectionDomain();
- if (pd != null) {
- CodeSource cs = pd.getCodeSource();
- if (cs != null) {
- return cs.getLocation();
+ synchronized (codeBaseCacheRef) {
+ URL url = codeBaseCacheRef.get(clazz);
+ if (url == null) {
+ url = AccessController.doPrivileged(new PrivilegedAction() {
+ public URL run() {
+ ProtectionDomain pd = clazz.getProtectionDomain();
+ if (pd != null) {
+ CodeSource cs = pd.getCodeSource();
+ if (cs != null) {
+ return cs.getLocation();
+ }
}
+ return NULL_URL;
}
- return NULL_URL;
- }
- });
- codeBaseCacheRef.put(clazz, url);
+ });
+ codeBaseCacheRef.put(clazz, url);
+ }
+ return (url == NULL_URL) ? null : url;
}
- return (url == NULL_URL) ? null : url;
}
private static void setupJurisdictionPolicies() throws Exception {
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index 28494fe6f56bc4d4e455524a86747b67d00018a1..82be7d0f9a48ddbdf3964423d0839fc880f591c5 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -379,15 +379,11 @@ public class BasicInternalFrameTitlePane extends JComponent
InternalFrameEvent e = new InternalFrameEvent(
frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
// Try posting event, unless there's a SecurityManager.
- if (JInternalFrame.class.getClassLoader() == null) {
- try {
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
- return;
- } catch (SecurityException se) {
- // Use dispatchEvent instead.
- }
+ try {
+ Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
+ } catch (SecurityException se) {
+ frame.dispatchEvent(e);
}
- frame.dispatchEvent(e);
}
diff --git a/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java b/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
index ff3eab8f1931e5bcac546c9285dac6f511124111..01aa45ff0c7579a12758e92ac72c5fa57d1551fb 100644
--- a/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
+++ b/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
@@ -31,6 +31,7 @@ import javax.swing.*;
import javax.swing.plaf.UIResource;
import javax.swing.Painter;
import java.awt.print.PrinterGraphics;
+import sun.reflect.misc.MethodUtil;
/**
* Convenient base class for defining Painter instances for rendering a
@@ -445,8 +446,8 @@ public abstract class AbstractRegionPainter implements Painter {
} else {
String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
try {
- Method method = c.getClass().getMethod(s);
- color = (Color) method.invoke(c);
+ Method method = MethodUtil.getMethod(c.getClass(), s, null);
+ color = (Color) MethodUtil.invoke(method, c, null);
} catch (Exception e) {
//don't do anything, it just didn't work, that's all.
//This could be a normal occurance if you use a property
diff --git a/src/share/classes/javax/swing/plaf/nimbus/skin.laf b/src/share/classes/javax/swing/plaf/nimbus/skin.laf
index 39010042190d9ba490c45fb1b6217433cf85f654..394721e1c41d5b7b86c22ead86721ea00ebdb29f 100644
--- a/src/share/classes/javax/swing/plaf/nimbus/skin.laf
+++ b/src/share/classes/javax/swing/plaf/nimbus/skin.laf
@@ -1,7 +1,7 @@
+
+
+
+
+ Unsigned applet can retrieve the dragged information before drop action occurs
+
+
+
+
DragInterceptorAppletTest Bug ID: 6887703
+
+
This is an AUTOMATIC test, simply wait for completion
+
+
+
+
diff --git a/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java b/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..5f70e2de35b18a8e85a2d8aa3a96c11e671faefe
--- /dev/null
+++ b/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2007, 2014, 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 6887703
+ @summary Unsigned applet can retrieve the dragged information before drop action occurs
+ @author : area=dnd
+ @run applet DragInterceptorAppletTest.html
+*/
+
+/**
+ * DragInterceptorAppletTest.java
+ *
+ * summary: Unsigned applet can retrieve the dragged information before drop action occurs
+ */
+
+import static java.lang.Thread.sleep;
+
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+import test.java.awt.regtesthelpers.Util;
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class DragInterceptorAppletTest extends Applet {
+
+ public void init() {
+ setLayout(new BorderLayout());
+ }//End init()
+
+ public void start() {
+
+ SourceFrame sourceFrame = new SourceFrame();
+
+ Util.waitForIdle(null);
+
+ String [] args = new String [] {
+ String.valueOf(sourceFrame.getNextLocationX()),
+ String.valueOf(sourceFrame.getNextLocationY()),
+ String.valueOf(sourceFrame.getDragSourcePointX()),
+ String.valueOf(sourceFrame.getDragSourcePointY()),
+ };
+ String classpath = System.getProperty("java.class.path");
+ ProcessResults processResults =
+ ProcessCommunicator.executeChildProcess(this.getClass(),classpath,args);
+
+ verifyTestResults(processResults);
+
+ }// start()
+
+ private static void verifyTestResults(ProcessResults processResults) {
+
+ switch (processResults.getExitValue()) {
+ case InterprocessMessages.DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED:
+ processResults.printProcessErrorOutput(System.err);
+ throw new RuntimeException("TEST IS FAILED: Target applet can intercept data " +
+ "without a clipboard permission and an exception handler was not triggered.");
+ //Unreachable...
+
+ case InterprocessMessages.DATA_WAS_INTERCEPTED:
+ processResults.printProcessErrorOutput(System.err);
+ throw new RuntimeException("TEST IS FAILED: Target applet can intercept data " +
+ "without a clipboard permission");
+ //Unreachable...
+
+ case InterprocessMessages.EXCEPTION_HANDLER_WAS_NOT_TRIGGERED:
+ processResults.printProcessErrorOutput(System.err);
+ throw new RuntimeException("TEST IS FAILED: An exception handler was not triggered.");
+ //Unreachable...
+
+ }
+
+ // The child process throws an exception. do not look at the stderr.
+ processResults.verifyStdErr(System.err);
+ processResults.verifyProcessExitValue(System.err);
+ processResults.printProcessStandartOutput(System.out);
+ }
+
+ //We cannot make an instance of the applet without the default constructor
+ public DragInterceptorAppletTest() {
+ super();
+ }
+
+ //We need in this constructor to pass frame position between JVMs
+ public DragInterceptorAppletTest(Point targetFrameLocation, Point dragSourcePoint)
+ throws InterruptedException
+ {
+ DragInterceptorFrame targetFrame = new DragInterceptorFrame(targetFrameLocation);
+
+ Util.waitForIdle(null);
+
+ final Robot robot = Util.createRobot();
+
+ robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
+ sleep(100);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ sleep(100);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ sleep(100);
+
+ Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
+ InputEvent.BUTTON1_MASK);
+
+ sleep(2000);
+ ProcessCommunicator.destroyProcess();
+ }
+
+ enum InterprocessArguments {
+ TARGET_FRAME_X_POSITION_ARGUMENT,
+ TARGET_FRAME_Y_POSITION_ARGUMENT,
+ DRAG_SOURCE_POINT_X_ARGUMENT,
+ DRAG_SOURCE_POINT_Y_ARGUMENT;
+
+ int extract (String [] args) {
+ return Integer.parseInt(args[this.ordinal()]);
+ }
+ }
+
+ public static void main (String [] args) {
+ Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
+ InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
+ Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
+ InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
+ try {
+ new DragInterceptorAppletTest(targetFrameLocation, dragSourcePoint);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+}// class DragInterceptorAppletTest
diff --git a/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java b/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java
new file mode 100644
index 0000000000000000000000000000000000000000..69d4a014ba988d11d151b21332d0dcf5157102fa
--- /dev/null
+++ b/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.dnd.*;
+import java.io.IOException;
+import java.security.Permission;
+import java.security.AccessControlException;
+
+class DragInterceptorFrame extends Frame implements DropTargetListener {
+
+ private static int exitMessage = InterprocessMessages.TEST_PASSED;
+ private static boolean dataIsAccessible = false;
+ private static boolean exceptionHasBeenThrown = false;
+
+ DragInterceptorFrame(Point location) {
+ System.setSecurityManager(new ClipboardDefender());
+ initGUI(location);
+ setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY,
+ this));
+ }
+
+ private void initGUI(Point location) {
+ this.setLocation(location);
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ DragInterceptorFrame.this.dispose();
+ }
+ });
+ setSize (200, 200);
+ this.setVisible(true);
+ }
+
+ public void dragEnter(DropTargetDragEvent dtde) {
+ // We want to set the exception handler on EDT
+ Thread.currentThread().setUncaughtExceptionHandler (
+ new Thread.UncaughtExceptionHandler() {
+ public void uncaughtException(Thread t, Throwable e) {
+ exceptionHasBeenThrown = true;
+ }
+ }
+ );
+ examineTransferable(dtde);
+ }
+
+ public void dragOver(DropTargetDragEvent dtde) {
+ examineTransferable(dtde);
+ }
+
+ public void dropActionChanged(DropTargetDragEvent dtde) {
+ examineTransferable(dtde);
+ }
+
+ public void dragExit(DropTargetEvent dte) {}
+
+ public void drop(DropTargetDropEvent dtde) {
+
+ if (dataIsAccessible && !exceptionHasBeenThrown) {
+ exitMessage = InterprocessMessages.DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED;
+ } else if (dataIsAccessible) {
+ exitMessage = InterprocessMessages.DATA_WAS_INTERCEPTED;
+ } else if (!exceptionHasBeenThrown) {
+ exitMessage = InterprocessMessages.EXCEPTION_HANDLER_WAS_NOT_TRIGGERED;
+ }
+
+ // This returns the diagnostic code from the child VM
+ System.exit(exitMessage);
+ }
+
+ Point getDropTargetPoint() {
+ return new Point((int)getLocationOnScreen().getX()+(getWidth()/2),
+ (int)getLocationOnScreen().getY()+(getHeight()/2));
+ }
+
+ private void examineTransferable(DropTargetDragEvent dtde) {
+ if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.stringFlavor)) {
+ dtde.acceptDrag(DnDConstants.ACTION_COPY);
+ try{
+ if (null != dtde.getTransferable().getTransferData(DataFlavor.stringFlavor)) {
+ dataIsAccessible = true;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ exitMessage = InterprocessMessages.UNEXPECTED_IO_EXCEPTION;
+ } catch (UnsupportedFlavorException e) {
+ e.printStackTrace();
+ exitMessage = InterprocessMessages.UNEXPECTED_UNSUPPORTED_FLAVOR_EXCEPTION;
+ }
+ }
+ }
+
+ static class ClipboardDefender extends SecurityManager {
+ public void checkPermission(Permission p) {
+ if (p instanceof java.awt.AWTPermission &&
+ p.getName().equals("accessClipboard")) {
+ throw new AccessControlException("access denied ");
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ new DragInterceptorFrame(new Point(200,200));
+ }
+}
diff --git a/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java b/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java
new file mode 100644
index 0000000000000000000000000000000000000000..6506565cd050aec45d829529a5cae23c5e699666
--- /dev/null
+++ b/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+public interface InterprocessMessages {
+ final static int TEST_PASSED = 0;
+ final static int DATA_WAS_INTERCEPTED = 212;
+ final static int EXCEPTION_HANDLER_WAS_NOT_TRIGGERED = 213;
+ final static int DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED = 214;
+
+ final static int UNEXPECTED_IO_EXCEPTION = 400;
+ final static int UNEXPECTED_UNSUPPORTED_FLAVOR_EXCEPTION = 401;
+}
diff --git a/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java b/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java
new file mode 100644
index 0000000000000000000000000000000000000000..7a7c833b91ab0f868ab152a153a53ab962a25113
--- /dev/null
+++ b/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 2014, 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 test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+
+class SourceFrame extends Frame implements DragGestureListener {
+
+ SourceFrame() {
+ super("Source File List Frame");
+ initGUI();
+ new DragSource().createDefaultDragGestureRecognizer(this,
+ DnDConstants.ACTION_COPY,this);
+ }
+
+ private void initGUI() {
+ this.addWindowListener(Util.getClosingWindowAdapter());
+ this.setLocation(300,250);
+ this.setSize(200,200);
+ this.setVisible(true);
+ }
+
+ int getNextLocationX() {
+ return getX()+getWidth();
+ }
+
+ int getNextLocationY() {
+ return getY();
+ }
+
+ int getDragSourcePointX() {
+ return (int)getLocationOnScreen().getX()+(getWidth()/2);
+ }
+
+ int getDragSourcePointY() {
+ return (int)getLocationOnScreen().getY()+ (getHeight()/2);
+ }
+
+ public void dragGestureRecognized(DragGestureEvent dge) {
+ dge.startDrag(null, new StringSelection("A TEXT"));
+ }
+}
diff --git a/test/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.java b/test/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..2087c6035bb74860148b91daef97e0cf3306a4e0
--- /dev/null
+++ b/test/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2014, 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 4422345 8039083
+ @summary tests serialization of DragSourceListeners
+ @author das@sparc.spb.su area=dnd
+ @library ../../../../lib/testlibrary
+ @build jdk.testlibrary.Asserts
+ @run main/othervm DragSourceListenerSerializationTest
+*/
+
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Point;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceAdapter;
+import java.awt.dnd.DragSourceContext;
+import java.awt.dnd.DragSourceListener;
+import java.awt.dnd.DragSourceMotionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.TooManyListenersException;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static jdk.testlibrary.Asserts.assertEquals;
+
+public class DragSourceListenerSerializationTest {
+ public static void main(String[] args) throws Exception {
+ DragSource ds = new DragSource();
+ TestDragSourceAdapter dsa1 = new TestDragSourceAdapter(1);
+ TestDragSourceAdapter dsa2 = new TestDragSourceAdapter(2);
+ Component c = new Button();
+ DragGestureRecognizer dgr = ds.createDefaultDragGestureRecognizer(c,
+ DnDConstants.ACTION_COPY,
+ e -> e.startDrag(null, null));
+ MouseEvent me = new MouseEvent(c, MouseEvent.MOUSE_PRESSED, 0,
+ InputEvent.CTRL_MASK, 100, 100, 0, false);
+ DragGestureEvent dge = new DragGestureEvent(dgr, DnDConstants.ACTION_COPY,
+ new Point(100, 100),
+ Arrays.asList(me));
+ DragSourceContext dsc = new DragSourceContext(
+ Toolkit.getDefaultToolkit().createDragSourceContextPeer(dge),
+ dge,
+ new Cursor(Cursor.HAND_CURSOR),
+ null, null, new StringSelection("TEXT"), null);
+
+ ds.addDragSourceListener(dsa1);
+ ds.addDragSourceListener(dsa2);
+ ds.addDragSourceListener(dsa2);
+ ds.addDragSourceMotionListener(dsa1);
+ ds.addDragSourceMotionListener(dsa1);
+ ds.addDragSourceMotionListener(dsa2);
+ dsc.addDragSourceListener(dsa2);
+
+ byte[] serialized;
+ try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos)) {
+ oos.writeObject(dsc);
+ serialized = bos.toByteArray();
+ }
+
+ DragSourceContext dsc_copy;
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
+ ObjectInputStream ois = new ObjectInputStream(bis)) {
+ dsc_copy = (DragSourceContext) ois.readObject();
+ }
+
+ try {
+ dsc_copy.addDragSourceListener(dsa1);
+ throw new RuntimeException("Test failed. Listener addition succeeded");
+ } catch (TooManyListenersException ignored) {
+ }
+
+ try {
+ dsc_copy.addDragSourceListener(dsa2);
+ throw new RuntimeException("Test failed. Listener addition succeeded");
+ } catch (TooManyListenersException ignored) {
+ }
+
+ try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos)) {
+ oos.writeObject(ds);
+ serialized = bos.toByteArray();
+ }
+
+ DragSource ds_copy;
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
+ ObjectInputStream ois = new ObjectInputStream(bis)) {
+ ds_copy = (DragSource) ois.readObject();
+ }
+
+ DragSourceListener[] dsls = ds_copy.getDragSourceListeners();
+ assertEquals(3, dsls.length, "DragSourceListeners number");
+ assertEquals(1, Stream.of(dsls).filter(dsa1::equals).collect(Collectors.counting()).intValue());
+ assertEquals(2, Stream.of(dsls).filter(dsa2::equals).collect(Collectors.counting()).intValue());
+
+ DragSourceMotionListener[] dsmls = ds_copy.getDragSourceMotionListeners();
+ assertEquals(3, dsmls.length, "DragSourceMotionListeners number");
+ assertEquals(2, Stream.of(dsmls).filter(dsa1::equals).collect(Collectors.counting()).intValue());
+ assertEquals(1, Stream.of(dsmls).filter(dsa2::equals).collect(Collectors.counting()).intValue());
+ }
+}
+
+class TestDragSourceAdapter extends DragSourceAdapter implements Serializable {
+ final int id;
+
+ TestDragSourceAdapter(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof TestDragSourceAdapter) {
+ TestDragSourceAdapter tdsa = (TestDragSourceAdapter) obj;
+ return tdsa.getId() == getId();
+ }
+ return false;
+ }
+}
diff --git a/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html b/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html
new file mode 100644
index 0000000000000000000000000000000000000000..2b3aa7aa60c5caf3a013461649cd8a269224884b
--- /dev/null
+++ b/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
InterJVMGetDropSuccessTest Bug ID: 4658741
+
+
This is an AUTOMATIC test, simply wait for completion
+
+
+
+
diff --git a/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java b/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..9307fa26df579e3665018aeb6ad5ce8f705ea1d0
--- /dev/null
+++ b/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2014, 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 4658741
+ @summary verifies that getDropSuccess() returns correct value for inter-JVM DnD
+ @author das@sparc.spb.su area=dnd
+ @run applet InterJVMGetDropSuccessTest.html
+*/
+
+// Note there is no @ in front of test above. This is so that the
+// harness will not mistake this file as a test file. It should
+// only see the html file as a test file. (the harness runs all
+// valid test files, so it would run this test twice if this file
+// were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag. Here, you
+// should put which functional area the test falls in. See the
+// AWT-core home page -> test areas and/or -> AWT team for a list of
+// areas.
+// Note also the 'InterJVMGetDropSuccessTest.html' in the run tag. This should
+// be changed to the name of the test.
+
+
+/**
+ * InterJVMGetDropSuccessTest.java
+ *
+ * summary: verifies that getDropSuccess() returns correct value for inter-JVM DnD
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.*;
+import java.awt.event.*;
+import java.io.*;
+import javax.swing.*;
+
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors. (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems). Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class InterJVMGetDropSuccessTest extends Applet {
+
+ private int returnCode = Util.CODE_NOT_RETURNED;
+ private boolean successCodes[] = { true, false };
+ private int dropCount = 0;
+
+ final Frame frame = new Frame("Target Frame");
+
+ final DropTargetListener dropTargetListener = new DropTargetAdapter() {
+ public void drop(DropTargetDropEvent dtde) {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY);
+ dtde.dropComplete(successCodes[dropCount]);
+ dropCount++;
+ }
+ };
+ final DropTarget dropTarget = new DropTarget(frame, dropTargetListener);
+
+ public void init() {
+ //Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+
+ String[] instructions =
+ {
+ "This is an AUTOMATIC test",
+ "simply wait until it is done"
+ };
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+
+ frame.setTitle("Test frame");
+ frame.setBounds(100, 100, 150, 150);
+ } // init()
+
+ public void start() {
+
+ frame.setVisible(true);
+
+ try {
+ Thread.sleep(Util.FRAME_ACTIVATION_TIMEOUT);
+
+ Point p = frame.getLocationOnScreen();
+ Dimension d = frame.getSize();
+
+ String javaPath = System.getProperty("java.home", "");
+ String command = javaPath + File.separator + "bin" +
+ File.separator + "java -cp " + System.getProperty("test.classes", ".") +
+ " Child " +
+ p.x + " " + p.y + " " + d.width + " " + d.height;
+
+ Process process = Runtime.getRuntime().exec(command);
+ returnCode = process.waitFor();
+
+ InputStream errorStream = process.getErrorStream();
+ int count = errorStream.available();
+ if (count > 0) {
+ byte[] b = new byte[count];
+ errorStream.read(b);
+ System.err.println("========= Child VM System.err ========");
+ System.err.print(new String(b));
+ System.err.println("======================================");
+ }
+
+ InputStream outputStream = process.getInputStream();
+ count = outputStream.available();
+ if (count > 0) {
+ byte[] b = new byte[count];
+ outputStream.read(b);
+ System.err.println("========= Child VM System.out ========");
+ System.err.print(new String(b));
+ System.err.println("======================================");
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ switch (returnCode) {
+ case Util.CODE_NOT_RETURNED:
+ throw new RuntimeException("Child VM: failed to start");
+ case Util.CODE_FAILURE:
+ throw new RuntimeException("Child VM: abnormal termination");
+ default:
+ if (dropCount == 2) {
+ int expectedRetCode = 0;
+ if (successCodes[0]) {
+ expectedRetCode |= Util.CODE_FIRST_SUCCESS;
+ }
+ if (successCodes[1]) {
+ expectedRetCode |= Util.CODE_SECOND_SUCCESS;
+ }
+ if (expectedRetCode != returnCode) {
+ throw new RuntimeException("The test failed. Expected:" +
+ expectedRetCode + ". Returned:" +
+ returnCode);
+ }
+ }
+ break;
+ }
+ } // start()
+} // class InterJVMGetDropSuccessTest
+
+final class Util implements AWTEventListener {
+ public static final int CODE_NOT_RETURNED = -1;
+ public static final int CODE_FIRST_SUCCESS = 0x2;
+ public static final int CODE_SECOND_SUCCESS = 0x2;
+ public static final int CODE_FAILURE = 0x1;
+
+ public static final int FRAME_ACTIVATION_TIMEOUT = 3000;
+
+ static final Object SYNC_LOCK = new Object();
+ static final int MOUSE_RELEASE_TIMEOUT = 1000;
+
+ static final Util theInstance = new Util();
+
+ static {
+ Toolkit.getDefaultToolkit().addAWTEventListener(theInstance, AWTEvent.MOUSE_EVENT_MASK);
+ }
+
+ public static Point getCenterLocationOnScreen(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+ p.translate(d.width / 2, d.height / 2);
+ return p;
+ }
+
+ public static int sign(int n) {
+ return n < 0 ? -1 : n == 0 ? 0 : 1;
+ }
+
+ private Component clickedComponent = null;
+
+ private void reset() {
+ clickedComponent = null;
+ }
+
+ public void eventDispatched(AWTEvent e) {
+ if (e.getID() == MouseEvent.MOUSE_RELEASED) {
+ clickedComponent = (Component)e.getSource();
+ synchronized (SYNC_LOCK) {
+ SYNC_LOCK.notifyAll();
+ }
+ }
+ }
+
+ public static boolean pointInComponent(Robot robot, Point p, Component comp)
+ throws InterruptedException {
+ return theInstance.pointInComponentImpl(robot, p, comp);
+ }
+
+ private boolean pointInComponentImpl(Robot robot, Point p, Component comp)
+ throws InterruptedException {
+ robot.waitForIdle();
+ reset();
+ robot.mouseMove(p.x, p.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ synchronized (SYNC_LOCK) {
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT);
+ }
+
+ Component c = clickedComponent;
+
+ while (c != null && c != comp) {
+ c = c.getParent();
+ }
+
+ return c == comp;
+ }
+}
+
+class Child {
+ static class DragSourceDropListener extends DragSourceAdapter {
+ private boolean finished = false;
+ private boolean dropSuccess = false;
+
+ public void reset() {
+ finished = false;
+ dropSuccess = false;
+ }
+
+ public boolean isDropFinished() {
+ return finished;
+ }
+
+ public boolean getDropSuccess() {
+ return dropSuccess;
+ }
+
+ public void dragDropEnd(DragSourceDropEvent dsde) {
+ finished = true;
+ dropSuccess = dsde.getDropSuccess();
+ synchronized (Util.SYNC_LOCK) {
+ Util.SYNC_LOCK.notifyAll();
+ }
+ }
+ }
+
+ final Frame frame = new Frame("Source Frame");
+ final DragSource dragSource = DragSource.getDefaultDragSource();
+ final DragSourceDropListener dragSourceListener = new DragSourceDropListener();
+ final Transferable transferable = new StringSelection("TEXT");
+ final DragGestureListener dragGestureListener = new DragGestureListener() {
+ public void dragGestureRecognized(DragGestureEvent dge) {
+ dge.startDrag(null, transferable, dragSourceListener);
+ }
+ };
+ final DragGestureRecognizer dragGestureRecognizer =
+ dragSource.createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_COPY,
+ dragGestureListener);
+
+ public static void main(String[] args) {
+ Child child = new Child();
+ child.run(args);
+ }
+
+ public void run(String[] args) {
+ try {
+ if (args.length != 4) {
+ throw new RuntimeException("Incorrect command line arguments.");
+ }
+
+ int x = Integer.parseInt(args[0]);
+ int y = Integer.parseInt(args[1]);
+ int w = Integer.parseInt(args[2]);
+ int h = Integer.parseInt(args[3]);
+
+ frame.setBounds(300, 200, 150, 150);
+ frame.setVisible(true);
+
+ Thread.sleep(Util.FRAME_ACTIVATION_TIMEOUT);
+
+ Point sourcePoint = Util.getCenterLocationOnScreen(frame);
+
+ Point targetPoint = new Point(x + w / 2, y + h / 2);
+
+ Robot robot = new Robot();
+ robot.mouseMove(sourcePoint.x, sourcePoint.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ for (Point p = new Point(sourcePoint); !p.equals(targetPoint);
+ p.translate(Util.sign(targetPoint.x - p.x),
+ Util.sign(targetPoint.y - p.y))) {
+ robot.mouseMove(p.x, p.y);
+ Thread.sleep(50);
+ }
+
+ synchronized (Util.SYNC_LOCK) {
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ Util.SYNC_LOCK.wait(Util.FRAME_ACTIVATION_TIMEOUT);
+ }
+
+ if (!dragSourceListener.isDropFinished()) {
+ throw new RuntimeException("Drop not finished");
+ }
+
+ boolean success1 = dragSourceListener.getDropSuccess();
+
+ dragSourceListener.reset();
+ robot.mouseMove(sourcePoint.x, sourcePoint.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ for (Point p = new Point(sourcePoint); !p.equals(targetPoint);
+ p.translate(Util.sign(targetPoint.x - p.x),
+ Util.sign(targetPoint.y - p.y))) {
+ robot.mouseMove(p.x, p.y);
+ Thread.sleep(50);
+ }
+
+ synchronized (Util.SYNC_LOCK) {
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ Util.SYNC_LOCK.wait(Util.FRAME_ACTIVATION_TIMEOUT);
+ }
+
+ if (!dragSourceListener.isDropFinished()) {
+ throw new RuntimeException("Drop not finished");
+ }
+
+ boolean success2 = dragSourceListener.getDropSuccess();
+ int retCode = 0;
+
+ if (success1) {
+ retCode |= Util.CODE_FIRST_SUCCESS;
+ }
+ if (success2) {
+ retCode |= Util.CODE_SECOND_SUCCESS;
+ }
+ // This returns the diagnostic code from the child VM
+ System.exit(retCode);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ // This returns the diagnostic code from the child VM
+ System.exit(Util.CODE_FAILURE);
+ }
+ } // run()
+} // class child
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+ {
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+ }// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+ {
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("South", messageText);
+
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ }
+
+ }// TestDialog class
diff --git a/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html b/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html
new file mode 100644
index 0000000000000000000000000000000000000000..c19a0a023545c19f3afc12d1205b4cd52a85076d
--- /dev/null
+++ b/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
NoFormatsCrashTest Bug ID: 4870762
+
+
This is an AUTOMATIC test, simply wait for completion
+
+
+
+
+
diff --git a/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java b/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3be0adc666e5bd729ee7794f4da596871dd7024d
--- /dev/null
+++ b/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 2014, 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 4870762
+ @summary tests that a drop target JVM doesn't crash if the source doesn't export
+ data in native formats.
+ @author das@sparc.spb.su area=dnd
+ @compile NoFormatsCrashTest.java
+ @run applet NoFormatsCrashTest.html
+*/
+
+// Note there is no @ in front of test above. This is so that the
+// harness will not mistake this file as a test file. It should
+// only see the html file as a test file. (the harness runs all
+// valid test files, so it would run this test twice if this file
+// were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag. Here, you
+// should put which functional area the test falls in. See the
+// AWT-core home page -> test areas and/or -> AWT team for a list of
+// areas.
+// Note also the 'NoFormatsCrashTest.html' in the run tag. This should
+// be changed to the name of the test.
+
+
+/**
+ * NoFormatsCrashTest.java
+ *
+ * summary: tests that a drop target JVM doesn't crash if the source doesn't export
+ * data in native formats.
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.*;
+import java.awt.event.*;
+import java.io.*;
+
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors. (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems). Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class NoFormatsCrashTest extends Applet {
+
+ final Frame frame = new Frame();
+ private volatile Process process;
+
+ static final int FRAME_ACTIVATION_TIMEOUT = 2000;
+
+ public static void main(String[] args) {
+ NoFormatsCrashTest test = new NoFormatsCrashTest();
+ test.run(args);
+ }
+
+ public void run(String[] args) {
+ try {
+ if (args.length != 4) {
+ throw new RuntimeException("Incorrect command line arguments.");
+ }
+
+ int x = Integer.parseInt(args[0]);
+ int y = Integer.parseInt(args[1]);
+ int w = Integer.parseInt(args[2]);
+ int h = Integer.parseInt(args[3]);
+
+ Panel panel = new DragSourcePanel();
+
+ frame.setTitle("Drag source frame");
+ frame.setLocation(500, 200);
+ frame.add(panel);
+ frame.pack();
+ frame.setVisible(true);
+
+ Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+ Point sourcePoint = panel.getLocationOnScreen();
+ Dimension d = panel.getSize();
+ sourcePoint.translate(d.width / 2, d.height / 2);
+
+ Point targetPoint = new Point(x + w / 2, y + h / 2);
+
+ Robot robot = new Robot();
+ robot.mouseMove(sourcePoint.x, sourcePoint.y);
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ for (; !sourcePoint.equals(targetPoint);
+ sourcePoint.translate(sign(targetPoint.x - sourcePoint.x),
+ sign(targetPoint.y - sourcePoint.y))) {
+ robot.mouseMove(sourcePoint.x, sourcePoint.y);
+ Thread.sleep(50);
+ }
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+
+ Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+ if (process.isAlive()) {
+ process.destroy();
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ } // run()
+
+ public void init() {
+ //Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+
+ String[] instructions =
+ {
+ "This is an AUTOMATIC test",
+ "simply wait until it is done"
+ };
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+
+ frame.setTitle("Drop target frame");
+ frame.setLocation(200, 200);
+
+ } // init()
+
+ public void start() {
+ DropTargetPanel panel = new DropTargetPanel();
+ frame.add(panel);
+ frame.pack();
+ frame.setVisible(true);
+
+ try {
+ Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+ Point p = frame.getLocationOnScreen();
+ Dimension d = frame.getSize();
+
+ String javaPath = System.getProperty("java.home", "");
+ String command = javaPath + File.separator + "bin" +
+ File.separator + "java -cp " + System.getProperty("test.classes", ".") +
+ " NoFormatsCrashTest " +
+ p.x + " " + p.y + " " + d.width + " " + d.height;
+
+ process = Runtime.getRuntime().exec(command);
+ ProcessResults pres = ProcessResults.doWaitFor(process);
+ System.err.println("Child VM return code: " + pres.exitValue);
+
+ if (pres.stderr != null && pres.stderr.length() > 0) {
+ System.err.println("========= Child VM System.err ========");
+ System.err.print(pres.stderr);
+ System.err.println("======================================");
+ }
+
+ if (pres.stdout != null && pres.stdout.length() > 0) {
+ System.err.println("========= Child VM System.out ========");
+ System.err.print(pres.stdout);
+ System.err.println("======================================");
+ }
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+
+ if (panel.isTestFailed()) {
+ throw new RuntimeException();
+ }
+ } // start()
+
+ public static int sign(int n) {
+ return n < 0 ? -1 : n > 0 ? 1 : 0;
+ }
+} // class NoFormatsCrashTest
+
+class TestTransferable implements Transferable {
+
+ public static DataFlavor dataFlavor = null;
+ static final Object data = new Object();
+
+ static {
+ DataFlavor df = null;
+ try {
+ df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+ "; class=java.lang.Object");
+ } catch (ClassNotFoundException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ dataFlavor = df;
+ }
+
+ public DataFlavor[] getTransferDataFlavors() {
+ return new DataFlavor[] { dataFlavor };
+ }
+
+ public boolean isDataFlavorSupported(DataFlavor df) {
+ return dataFlavor.equals(df);
+ }
+
+ public Object getTransferData(DataFlavor df)
+ throws UnsupportedFlavorException, IOException {
+ if (!isDataFlavorSupported(df)) {
+ throw new UnsupportedFlavorException(df);
+ }
+ return data;
+ }
+}
+
+class DragSourcePanel extends Panel {
+ public DragSourcePanel() {
+ final Transferable t = new TestTransferable();
+ final DragSourceListener dsl = new DragSourceAdapter() {
+ public void dragDropEnd(DragSourceDropEvent dtde) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // This finishes child VM
+ System.exit(0);
+ }
+ };
+ final DragGestureListener dgl = new DragGestureListener() {
+ public void dragGestureRecognized(DragGestureEvent dge) {
+ dge.startDrag(null, t, dsl);
+ }
+ };
+ final DragSource ds = DragSource.getDefaultDragSource();
+ final DragGestureRecognizer dgr =
+ ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY,
+ dgl);
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(100, 100);
+ }
+}
+
+class DropTargetPanel extends Panel {
+ private boolean testFailed = false;
+ public DropTargetPanel() {
+ final DropTargetListener dtl = new DropTargetAdapter() {
+ public void dragOver(DropTargetDragEvent dtde) {
+ try {
+ dtde.getCurrentDataFlavorsAsList();
+ } catch (Exception e) {
+ testFailed = true;
+ e.printStackTrace();
+ }
+ }
+ public void drop(DropTargetDropEvent dtde) {
+ dtde.rejectDrop();
+ }
+ };
+ final DropTarget dt = new DropTarget(this, dtl);
+ }
+
+ public boolean isTestFailed() {
+ return testFailed;
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(100, 100);
+ }
+}
+
+class ProcessResults {
+ public int exitValue;
+ public String stdout;
+ public String stderr;
+
+ public ProcessResults() {
+ exitValue = -1;
+ stdout = "";
+ stderr = "";
+ }
+
+ /**
+ * Method to perform a "wait" for a process and return its exit value.
+ * This is a workaround for Process.waitFor() never returning.
+ */
+ public static ProcessResults doWaitFor(Process p) {
+ ProcessResults pres = new ProcessResults();
+
+ InputStream in = null;
+ InputStream err = null;
+
+ try {
+ in = p.getInputStream();
+ err = p.getErrorStream();
+
+ boolean finished = false;
+
+ while (!finished) {
+ try {
+ while (in.available() > 0) {
+ pres.stdout += (char)in.read();
+ }
+ while (err.available() > 0) {
+ pres.stderr += (char)err.read();
+ }
+ // Ask the process for its exitValue. If the process
+ // is not finished, an IllegalThreadStateException
+ // is thrown. If it is finished, we fall through and
+ // the variable finished is set to true.
+ pres.exitValue = p.exitValue();
+ finished = true;
+ }
+ catch (IllegalThreadStateException e) {
+ // Process is not finished yet;
+ // Sleep a little to save on CPU cycles
+ Thread.currentThread().sleep(500);
+ }
+ }
+ if (in != null) in.close();
+ if (err != null) err.close();
+ }
+ catch (Throwable e) {
+ System.err.println("doWaitFor(): unexpected exception");
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ return pres;
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+ {
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+ }// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+ {
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("South", messageText);
+
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ }
+
+ }// TestDialog class
diff --git a/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java b/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..57a54386f0c648e2ea47660634c2f536fb8f2193
--- /dev/null
+++ b/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2014, 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.Color;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import static java.awt.image.ImageObserver.ALLBITS;
+import java.io.File;
+import javax.imageio.ImageIO;
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+import sun.awt.image.MultiResolutionToolkitImage;
+
+/**
+ * @test
+ * @bug 8040291
+ * @author Alexander Scherbatiy
+ * @summary [macosx] Http-Images are not fully loaded when using ImageIcon
+ * @run main MultiResolutionToolkitImageTest
+ */
+public class MultiResolutionToolkitImageTest {
+
+ private static final int IMAGE_WIDTH = 300;
+ private static final int IMAGE_HEIGHT = 200;
+ private static final Color COLOR_1X = Color.GREEN;
+ private static final Color COLOR_2X = Color.BLUE;
+ private static final String IMAGE_NAME_1X = "image.png";
+ private static final String IMAGE_NAME_2X = "image@2x.png";
+ private static final int WAIT_TIME = 400;
+ private static volatile boolean isImageLoaded = false;
+ private static volatile boolean isRVObserverCalled = false;
+
+ public static void main(String[] args) throws Exception {
+
+ if (!checkOS()) {
+ return;
+ }
+ generateImages();
+ testToolkitMultiResolutionImageLoad();
+ }
+
+ static void testToolkitMultiResolutionImageLoad() throws Exception {
+ File imageFile = new File(IMAGE_NAME_1X);
+ String fileName = imageFile.getAbsolutePath();
+ Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ toolkit.prepareImage(image, -1, -1, new LoadImageObserver());
+
+ final long time = WAIT_TIME + System.currentTimeMillis();
+ while ((!isImageLoaded || !isRVObserverCalled)
+ && System.currentTimeMillis() < time) {
+ Thread.sleep(50);
+ }
+
+ if(!isImageLoaded){
+ throw new RuntimeException("Image is not loaded!");
+ }
+
+ if(!isRVObserverCalled){
+ throw new RuntimeException("Resolution Variant observer is not called!");
+ }
+ }
+
+ static void generateImages() throws Exception {
+ if (!new File(IMAGE_NAME_1X).exists()) {
+ generateImage(1);
+ }
+
+ if (!new File(IMAGE_NAME_2X).exists()) {
+ generateImage(2);
+ }
+ }
+
+ static void generateImage(int scale) throws Exception {
+ BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
+ Graphics g = image.getGraphics();
+ g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
+ g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
+ File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
+ ImageIO.write(image, "png", file);
+ }
+
+ static boolean checkOS() {
+ return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
+ }
+
+ static class LoadImageObserver implements ImageObserver {
+
+ @Override
+ public boolean imageUpdate(Image img, int infoflags, int x, int y,
+ int width, int height) {
+
+ if (isRVObserver()) {
+ isRVObserverCalled = true;
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Image resolutionVariant = getResolutionVariant(img);
+ int rvFlags = toolkit.checkImage(resolutionVariant, width, height,
+ new IdleImageObserver());
+ if (rvFlags < infoflags) {
+ throw new RuntimeException("Info flags are greater than"
+ + " resolution varint info flags");
+ }
+ } else if ((infoflags & ALLBITS) != 0) {
+ isImageLoaded = true;
+ }
+
+ return (infoflags & ALLBITS) == 0;
+ }
+ }
+
+ static boolean isRVObserver() {
+ Exception e = new Exception();
+
+ for (StackTraceElement elem : e.getStackTrace()) {
+ if (elem.getClassName().endsWith("MultiResolutionToolkitImage")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static class IdleImageObserver implements ImageObserver {
+
+ @Override
+ public boolean imageUpdate(Image img, int infoflags, int x, int y,
+ int width, int height) {
+ return false;
+ }
+ }
+
+ static Image getResolutionVariant(Image image) {
+ return ((MultiResolutionToolkitImage) image).getResolutionVariant();
+ }
+}
diff --git a/test/java/awt/regtesthelpers/process/ProcessCommunicator.java b/test/java/awt/regtesthelpers/process/ProcessCommunicator.java
index 8c0e6db916a5288cac88302b5efe0ee225f07e58..8177a2d2ab32ea36b29e8be32f32b901972098ee 100644
--- a/test/java/awt/regtesthelpers/process/ProcessCommunicator.java
+++ b/test/java/awt/regtesthelpers/process/ProcessCommunicator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,22 @@ package test.java.awt.regtesthelpers.process;
import java.io.*;
-/** This class is created to solve interprocess communication problems.
+/**
+ * This class is created to solve interprocess communication problems.
* When you need to write a regression test which should verify inter jvm
* behavior such as DnD data transfer, Clipboard data transfer, focus
* transfer etc., you could use the next scenario:
*
* 1. Write an implementation for the parent JVM, using applet test.
- * 2. Write an implimentation for the child JVM or native application, using
+ * 2. Write an implementation for the child JVM or native application, using
* main() function.
* 3. Execute child process using ProcessCommunicator.executeChildProcess()
* method.
- * 4. You can decide whetherthe test is passed on the basis of
+ * 4. You can decide whether the test is passed on the basis of
* ProcessResults class data.
*
- * Note: The class is not thread safe. You should access its methods only from the same
- * thread.
+ * Note: The class is not thread safe. You should access its methods only from
+ * the same thread.
*/
public class ProcessCommunicator {
@@ -48,31 +49,34 @@ public class ProcessCommunicator {
private static final String javaPath = javaHome + File.separator + "bin" +
File.separator + "java ";
private static String command = "";
+ private static volatile Process process;
private ProcessCommunicator() {}
- /** The same as {#link #executeChildProcess(Class,String)} except
- * the {@code classPathArgument} parameter. The class path
- * parameter is for the debug purposes
+ /**
+ * The same as {#link #executeChildProcess(Class,String)} except
+ * the {@code classPathArgument} parameter. The class path
+ * parameter is for the debug purposes
*
- * @param classToExecute is passed to the child JVM
- * @param classPathArguments class path for the child JVM
- * @param args arguments that will be passed to the executed class
- * @return results of the executed {@code Process}
+ * @param classToExecute is passed to the child JVM
+ * @param classPathArguments class path for the child JVM
+ * @param args arguments that will be passed to the executed class
+ * @return results of the executed {@code Process}
*/
public static ProcessResults executeChildProcess(final Class classToExecute,
final String classPathArguments, final String [] args)
{
try {
String command = buildCommand(classToExecute, classPathArguments, args);
- Process process = Runtime.getRuntime().exec(command);
+ process = Runtime.getRuntime().exec(command);
return doWaitFor(process);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
- /** Executes child {code Process}
+ /**
+ * Executes child {code Process}
*
* @param classToExecute class to be executed as a child java process
* @param args args to be passed in to the child process
@@ -86,11 +90,11 @@ public class ProcessCommunicator {
/**
* Waits for a process and return its results.
- * This is a workaround for Process.waitFor() never returning.
+ * This is a workaround for {@code Process.waitFor()} never returning.
*
* @return results of the executed {@code Process}
*/
- private static ProcessResults doWaitFor(final Process p) {
+ public static ProcessResults doWaitFor(final Process p) {
ProcessResults pres = new ProcessResults();
final InputStream in;
@@ -133,13 +137,14 @@ public class ProcessCommunicator {
return pres;
}
- /** Builds command on the basis of the passed class name,
- * class path and arguments.
+ /**
+ * Builds command on the basis of the passed class name,
+ * class path and arguments.
*
* @param classToExecute with class will be executed in the new JVM
* @param classPathArguments java class path (only for test purposes)
* @param args arguments for the new application. This could be used
- * to pass some information from the parnent to child JVM.
+ * to pass some information from the parent to child JVM.
* @return command to execute the {@code Process}
*/
private static String buildCommand(final Class classToExecute,
@@ -162,11 +167,24 @@ public class ProcessCommunicator {
return command;
}
- /** Could be used for the debug purposes.
+ /**
+ * Could be used for the debug purposes.
*
- * @return command that was build to execute the child process
+ * @return command that was build to execute the child process
*/
public static String getExecutionCommand () {
return command;
}
+
+ /**
+ * Terminates the process created by {@code executeChildProcess} methods.
+ */
+ public static void destroyProcess() {
+ if (process != null) {
+ if (process.isAlive()) {
+ process.destroy();
+ }
+ process = null;
+ }
+ }
}
diff --git a/test/java/io/BufferedInputStream/LargeCopyWithMark.java b/test/java/io/BufferedInputStream/LargeCopyWithMark.java
index 2555a1faa5fa1808b9dea21012cc97c397138626..74aeda92932e629866e72b82bbdb92b6284aeddc 100644
--- a/test/java/io/BufferedInputStream/LargeCopyWithMark.java
+++ b/test/java/io/BufferedInputStream/LargeCopyWithMark.java
@@ -26,6 +26,7 @@
* @summary BufferedInputStream calculates negative array size with large
* streams and mark
* @library /lib/testlibrary
+ * @build jdk.testlibrary.*
* @run main/othervm LargeCopyWithMark
*/
diff --git a/test/java/lang/String/ToLowerCase.java b/test/java/lang/String/ToLowerCase.java
index 7cf35ed3c5ae86a44662b103177dce1d60eb120e..bd5f1ee6302769130f640d06f9b94f0798754473 100644
--- a/test/java/lang/String/ToLowerCase.java
+++ b/test/java/lang/String/ToLowerCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -23,7 +23,7 @@
/*
@test
- @bug 4217441 4533872 4900935 8020037
+ @bug 4217441 4533872 4900935 8020037 8041791
@summary toLowerCase should lower-case Greek Sigma correctly depending
on the context (final/non-final). Also it should handle
Locale specific (lt, tr, and az) lowercasings and supplementary
@@ -72,8 +72,10 @@ public class ToLowerCase {
// I-dot tests
test("\u0130", turkish, "i");
test("\u0130", az, "i");
- test("\u0130", lt, "i");
- test("\u0130", Locale.US, "i");
+ test("\u0130", lt, "\u0069\u0307");
+ test("\u0130", Locale.US, "\u0069\u0307");
+ test("\u0130", Locale.JAPAN, "\u0069\u0307");
+ test("\u0130", Locale.ROOT, "\u0069\u0307");
// Remove dot_above in the sequence I + dot_above (Turkish and Azeri)
test("I\u0307", turkish, "i");
diff --git a/test/java/lang/annotation/TypeVariableBounds.java b/test/java/lang/annotation/TypeVariableBounds.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a2e33ae3969afb6c393bb396ecfb0d94f2bcc42
--- /dev/null
+++ b/test/java/lang/annotation/TypeVariableBounds.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2014, 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 8038994
+ * @summary Test that getAnnotatedBounds().getType() match getBounds()
+ * @run testng TypeVariableBounds
+ */
+
+import java.io.Serializable;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.concurrent.Callable;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+public class TypeVariableBounds {
+ @Test(dataProvider = "classData")
+ public void testClass(Class> c) throws Exception {
+ assertNotEquals(c.getTypeParameters().length, 0);
+
+ TypeVariable[] tv = c.getTypeParameters();
+
+ for(TypeVariable t : tv)
+ testTv(t);
+
+ }
+
+ @Test(dataProvider = "methodData")
+ public void testMethod(Class>c) throws Exception {
+ Method m = c.getMethod("aMethod");
+ TypeVariable[] tv = m.getTypeParameters();
+
+ for(TypeVariable t : tv)
+ testTv(t);
+
+ }
+
+ public void testTv(TypeVariable> tv) {
+ Type[] t = tv.getBounds();
+ AnnotatedType[] at = tv.getAnnotatedBounds();
+
+ assertEquals(t.length, at.length, Arrays.asList(t) + " and " + Arrays.asList(at) + " should be the same length");
+
+ for (int i = 0; i < t.length; i++)
+ assertSame(at[i].getType(), t[i], "T: " + t[i] + ", AT: " + at[i] + ", AT.getType(): " + at[i].getType() + "\n");
+ }
+
+ @DataProvider
+ public Object[][] classData() { return CLASS_TESTS; }
+
+ @DataProvider
+ public Object[][] methodData() { return METHOD_TESTS; }
+
+ public static final Object[][] CLASS_TESTS = {
+ { Case1.class, },
+ { Case2.class, },
+ { Case5.class, },
+ { Case6.class, },
+ };
+
+ public static final Object[][] METHOD_TESTS = {
+ { Case3.class, },
+ { Case4.class, },
+ { Case5.class, },
+ { Case6.class, },
+ };
+
+ // Class type var
+ public static class Case1 {}
+ public static class Case2 {}
+
+ // Method type var
+ public static class Case3 { public void aMethod() {}}
+ public static class Case4 { public void aMethod() {}}
+
+ // Both
+ public static class Case5 {
+ public
+ void aMethod() {}}
+
+ public static class Case6 <@TA C6CT1, C6CT2 extends @TB Runnable> {
+ public <@TA C6MT1,
+ C6MT2 extends @TB AnnotatedElement,
+ C6MT3 extends @TB AnnotatedElement & @TB2 Type & Serializable,
+ C6MT4 extends @TB2 C6CT2>
+ void aMethod() {}}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_PARAMETER)
+ public @interface TA {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_USE)
+ public @interface TB {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_USE)
+ public @interface TB2 {}
+}
diff --git a/test/java/lang/instrument/DaemonThread/TestDaemonThread.java b/test/java/lang/instrument/DaemonThread/TestDaemonThread.java
index 20c9077d02fdc9ba28c2cb5068fa04ae70d54d51..12246b1a6764a0904b4a1047aba45d5b78a691bd 100644
--- a/test/java/lang/instrument/DaemonThread/TestDaemonThread.java
+++ b/test/java/lang/instrument/DaemonThread/TestDaemonThread.java
@@ -26,7 +26,7 @@
* @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
* @library /lib/testlibrary
*
- * @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
+ * @build jdk.testlibrary.* DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
* @run shell ../MakeJAR3.sh DummyAgent
* @run main TestDaemonThreadLauncher /timeout=240
*
diff --git a/test/java/lang/instrument/PremainClass/NoPremainAgentTest.java b/test/java/lang/instrument/PremainClass/NoPremainAgentTest.java
index 9d08a7bd9ec96df9d5fbf05924e6b8d1eb934b26..a59756900b8b7ad2c49b9ce5177e8bafdda2733b 100644
--- a/test/java/lang/instrument/PremainClass/NoPremainAgentTest.java
+++ b/test/java/lang/instrument/PremainClass/NoPremainAgentTest.java
@@ -30,7 +30,7 @@ import jdk.testlibrary.Utils;
* @bug 6289149
* @summary test when the agent's class is missing the premain() function.
* @library /lib/testlibrary
- * @run build DummyMain
+ * @build jdk.testlibrary.* DummyMain
* @run shell ../MakeJAR3.sh NoPremainAgent
* @run main NoPremainAgentTest
*/
diff --git a/test/java/lang/instrument/PremainClass/PremainClassTest.java b/test/java/lang/instrument/PremainClass/PremainClassTest.java
index 9ebe4a68d2cee9c818bcae44f6f27081dc9e9d43..dd83fa807cf429613c257d292add1aba7207fce7 100644
--- a/test/java/lang/instrument/PremainClass/PremainClassTest.java
+++ b/test/java/lang/instrument/PremainClass/PremainClassTest.java
@@ -30,7 +30,7 @@ import jdk.testlibrary.Utils;
* @bug 5055293
* @summary Test non ascii characters in the Premain-Class attribute.
* @library /lib/testlibrary
- * @run build DummyMain
+ * @build jdk.testlibrary.* DummyMain
* @run main PremainClassTest
*/
public class PremainClassTest {
diff --git a/test/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java b/test/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java
index 7b67e4c31b786011e1347917846c19b149e49551..1dadbd09f015a9b4235643be21cf4a0fecb39576 100644
--- a/test/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java
+++ b/test/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java
@@ -30,7 +30,7 @@ import jdk.testlibrary.Utils;
* @bug 6289149
* @summary test when the agent's class has a zero arg premain() function.
* @library /lib/testlibrary
- * @run build DummyMain
+ * @build jdk.testlibrary.* DummyMain
* @run shell ../MakeJAR3.sh ZeroArgPremainAgent
* @run main ZeroArgPremainAgentTest
*/
diff --git a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
index 739ca6dc255920bb7ee910287f74ffdbe2d44975..38baeae69f03f2c81d16286a02e1317c70804b7c 100644
--- a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
+++ b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
@@ -37,6 +37,7 @@ import java.util.function.Supplier;
/* @test
* @library /lib/testlibrary/jsr292 /lib/testlibrary/
* @compile CatchExceptionTest.java
+ * @build jdk.testlibrary.*
* @run main/othervm -esa test.java.lang.invoke.MethodHandles.CatchExceptionTest
*/
public class CatchExceptionTest {
diff --git a/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java b/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
index 42ae7d05ab14163dff56876caf4ff5e132ff6d7c..1309e9c39498eaafe9c696b37424c39e28db569b 100644
--- a/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
+++ b/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
@@ -30,11 +30,9 @@
*
* @author Mandy Chung
*
- * @build CollectionUsageThreshold MemoryUtil
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseSerialGC CollectionUsageThreshold
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseParallelGC CollectionUsageThreshold
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseG1GC CollectionUsageThreshold
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC CollectionUsageThreshold
+ * @library /lib/testlibrary/
+ * @build CollectionUsageThreshold MemoryUtil RunUtil
+ * @run main/timeout=300 CollectionUsageThreshold
*/
import java.util.*;
@@ -61,6 +59,20 @@ public class CollectionUsageThreshold {
// finishes checking the low memory notification result
private static final CyclicBarrier barrier = new CyclicBarrier(2);
+ /**
+ * Run the test multiple times with different GC versions.
+ * First with default command line specified by the framework.
+ * Then with GC versions specified by the test.
+ */
+ public static void main(String a[]) throws Throwable {
+ final String main = "CollectionUsageThreshold$TestMain";
+ RunUtil.runTestKeepGcOpts(main);
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
+ }
+
static class PoolRecord {
private final MemoryPoolMXBean pool;
private final AtomicInteger listenerInvoked = new AtomicInteger(0);
@@ -110,88 +122,90 @@ public class CollectionUsageThreshold {
}
}
- public static void main(String args[]) throws Exception {
- if (args.length > 0 && args[0].equals("trace")) {
- trace = true;
- }
+ private static class TestMain {
+ public static void main(String args[]) throws Exception {
+ if (args.length > 0 && args[0].equals("trace")) {
+ trace = true;
+ }
- List pools = getMemoryPoolMXBeans();
- List managers = getMemoryManagerMXBeans();
+ List pools = getMemoryPoolMXBeans();
+ List managers = getMemoryManagerMXBeans();
- if (trace) {
- MemoryUtil.printMemoryPools(pools);
- MemoryUtil.printMemoryManagers(managers);
- }
+ if (trace) {
+ MemoryUtil.printMemoryPools(pools);
+ MemoryUtil.printMemoryManagers(managers);
+ }
- // Find the Old generation which supports low memory detection
- for (MemoryPoolMXBean p : pools) {
- if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
- if (p.getName().toLowerCase().contains("perm")) {
- // if we have a "perm gen" pool increase the number of expected
- // memory pools by one.
- numMemoryPools++;
- }
- PoolRecord pr = new PoolRecord(p);
- result.put(p.getName(), pr);
- if (result.size() == numMemoryPools) {
- break;
+ // Find the Old generation which supports low memory detection
+ for (MemoryPoolMXBean p : pools) {
+ if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
+ if (p.getName().toLowerCase().contains("perm")) {
+ // if we have a "perm gen" pool increase the number of expected
+ // memory pools by one.
+ numMemoryPools++;
+ }
+ PoolRecord pr = new PoolRecord(p);
+ result.put(p.getName(), pr);
+ if (result.size() == numMemoryPools) {
+ break;
+ }
}
}
- }
- if (result.size() != numMemoryPools) {
- throw new RuntimeException("Unexpected number of selected pools");
- }
+ if (result.size() != numMemoryPools) {
+ throw new RuntimeException("Unexpected number of selected pools");
+ }
- try {
- // This test creates a checker thread responsible for checking
- // the low memory notifications. It blocks until a permit
- // from the signals semaphore is available.
- Checker checker = new Checker("Checker thread");
- checker.setDaemon(true);
- checker.start();
+ try {
+ // This test creates a checker thread responsible for checking
+ // the low memory notifications. It blocks until a permit
+ // from the signals semaphore is available.
+ Checker checker = new Checker("Checker thread");
+ checker.setDaemon(true);
+ checker.start();
- for (PoolRecord pr : result.values()) {
- pr.getPool().setCollectionUsageThreshold(THRESHOLD);
- System.out.println("Collection usage threshold of " +
- pr.getPool().getName() + " set to " + THRESHOLD);
- }
+ for (PoolRecord pr : result.values()) {
+ pr.getPool().setCollectionUsageThreshold(THRESHOLD);
+ System.out.println("Collection usage threshold of " +
+ pr.getPool().getName() + " set to " + THRESHOLD);
+ }
- SensorListener listener = new SensorListener();
- NotificationEmitter emitter = (NotificationEmitter) mm;
- emitter.addNotificationListener(listener, null, null);
-
- // The main thread invokes GC to trigger the VM to perform
- // low memory detection and then waits until the checker thread
- // finishes its work to check for a low-memory notification.
- //
- // At GC time, VM will issue low-memory notification and invoke
- // the listener which will release a permit to the signals semaphore.
- // When the checker thread acquires the permit and finishes
- // checking the low-memory notification, it will also call
- // barrier.await() to signal the main thread to resume its work.
- for (int i = 0; i < NUM_GCS; i++) {
- invokeGC();
- barrier.await();
- }
- } finally {
- // restore the default
- for (PoolRecord pr : result.values()) {
- pr.getPool().setCollectionUsageThreshold(0);
+ SensorListener listener = new SensorListener();
+ NotificationEmitter emitter = (NotificationEmitter) mm;
+ emitter.addNotificationListener(listener, null, null);
+
+ // The main thread invokes GC to trigger the VM to perform
+ // low memory detection and then waits until the checker thread
+ // finishes its work to check for a low-memory notification.
+ //
+ // At GC time, VM will issue low-memory notification and invoke
+ // the listener which will release a permit to the signals semaphore.
+ // When the checker thread acquires the permit and finishes
+ // checking the low-memory notification, it will also call
+ // barrier.await() to signal the main thread to resume its work.
+ for (int i = 0; i < NUM_GCS; i++) {
+ invokeGC();
+ barrier.await();
+ }
+ } finally {
+ // restore the default
+ for (PoolRecord pr : result.values()) {
+ pr.getPool().setCollectionUsageThreshold(0);
+ }
}
+ System.out.println(RunUtil.successMessage);
}
- System.out.println("Test passed.");
- }
- private static void invokeGC() {
- System.out.println("Calling System.gc()");
- numGCs++;
- mm.gc();
+ private static void invokeGC() {
+ System.out.println("Calling System.gc()");
+ numGCs++;
+ mm.gc();
- if (trace) {
- for (PoolRecord pr : result.values()) {
- System.out.println("Usage after GC for: " + pr.getPool().getName());
- MemoryUtil.printMemoryUsage(pr.getPool().getUsage());
+ if (trace) {
+ for (PoolRecord pr : result.values()) {
+ System.out.println("Usage after GC for: " + pr.getPool().getName());
+ MemoryUtil.printMemoryUsage(pr.getPool().getUsage());
+ }
}
}
}
diff --git a/test/java/lang/management/MemoryMXBean/LowMemoryTest.java b/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
index e83eb067790e10dca90a7fedf39e1ae4131e3e8c..379b12930602969f0aa964d1a56fe10bc952666d 100644
--- a/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
+++ b/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
@@ -30,19 +30,21 @@
*
* @author Mandy Chung
*
- * @build LowMemoryTest MemoryUtil
- * @run main/othervm/timeout=600 LowMemoryTest
+ * @library /lib/testlibrary/
+ * @build LowMemoryTest MemoryUtil RunUtil
+ * @run main/timeout=600 LowMemoryTest
*/
import java.lang.management.*;
import java.util.*;
+import java.util.concurrent.Phaser;
import javax.management.*;
import javax.management.openmbean.CompositeData;
public class LowMemoryTest {
- private static MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
- private static List pools = ManagementFactory.getMemoryPoolMXBeans();
- private static List managers = ManagementFactory.getMemoryManagerMXBeans();
+ private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
+ private static final List pools = ManagementFactory.getMemoryPoolMXBeans();
+ private static final Phaser phaser = new Phaser(2);
private static MemoryPoolMXBean mpool = null;
private static boolean trace = false;
private static boolean testFailed = false;
@@ -50,8 +52,23 @@ public class LowMemoryTest {
private static final int NUM_CHUNKS = 2;
private static long chunkSize;
- private static boolean listenerInvoked = false;
+ /**
+ * Run the test multiple times with different GC versions.
+ * First with default command line specified by the framework.
+ * Then with GC versions specified by the test.
+ */
+ public static void main(String a[]) throws Throwable {
+ final String main = "LowMemoryTest$TestMain";
+ RunUtil.runTestKeepGcOpts(main);
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
+ RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
+ }
+
+ private static volatile boolean listenerInvoked = false;
static class SensorListener implements NotificationListener {
+ @Override
public void handleNotification(Notification notif, Object handback) {
String type = notif.getType();
if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
@@ -69,8 +86,9 @@ public class LowMemoryTest {
static class TestListener implements NotificationListener {
private int triggers = 0;
- private long[] count = new long[NUM_TRIGGERS * 2];
- private long[] usedMemory = new long[NUM_TRIGGERS * 2];
+ private final long[] count = new long[NUM_TRIGGERS * 2];
+ private final long[] usedMemory = new long[NUM_TRIGGERS * 2];
+ @Override
public void handleNotification(Notification notif, Object handback) {
MemoryNotificationInfo minfo = MemoryNotificationInfo.
from((CompositeData) notif.getUserData());
@@ -101,117 +119,97 @@ public class LowMemoryTest {
}
private static long newThreshold;
- public static void main(String args[]) throws Exception {
- if (args.length > 0 && args[0].equals("trace")) {
- trace = true;
- }
- // Find the Old generation which supports low memory detection
- ListIterator iter = pools.listIterator();
- while (iter.hasNext()) {
- MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
- if (p.getType() == MemoryType.HEAP &&
+ private static class TestMain {
+ public static void main(String args[]) throws Exception {
+ if (args.length > 0 && args[0].equals("trace")) {
+ trace = true;
+ }
+
+ // Find the Old generation which supports low memory detection
+ ListIterator iter = pools.listIterator();
+ while (iter.hasNext()) {
+ MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
+ if (p.getType() == MemoryType.HEAP &&
p.isUsageThresholdSupported()) {
- mpool = p;
- if (trace) {
- System.out.println("Selected memory pool for low memory " +
- "detection.");
- MemoryUtil.printMemoryPool(mpool);
+ mpool = p;
+ if (trace) {
+ System.out.println("Selected memory pool for low memory " +
+ "detection.");
+ MemoryUtil.printMemoryPool(mpool);
+ }
+ break;
}
- break;
}
- }
- TestListener listener = new TestListener();
- SensorListener l2 = new SensorListener();
- NotificationEmitter emitter = (NotificationEmitter) mm;
- emitter.addNotificationListener(listener, null, null);
- emitter.addNotificationListener(l2, null, null);
+ TestListener listener = new TestListener();
+ SensorListener l2 = new SensorListener();
+ NotificationEmitter emitter = (NotificationEmitter) mm;
+ emitter.addNotificationListener(listener, null, null);
+ emitter.addNotificationListener(l2, null, null);
- Thread allocator = new AllocatorThread();
- Thread sweeper = new SweeperThread();
+ Thread allocator = new AllocatorThread();
+ Thread sweeper = new SweeperThread();
- // Now set threshold
- MemoryUsage mu = mpool.getUsage();
- chunkSize = (mu.getMax() - mu.getUsed()) / 20;
- newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
+ // Now set threshold
+ MemoryUsage mu = mpool.getUsage();
+ chunkSize = (mu.getMax() - mu.getUsed()) / 20;
+ newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
- System.out.println("Setting threshold for " + mpool.getName() +
- " from " + mpool.getUsageThreshold() + " to " + newThreshold +
- ". Current used = " + mu.getUsed());
- mpool.setUsageThreshold(newThreshold);
+ System.out.println("Setting threshold for " + mpool.getName() +
+ " from " + mpool.getUsageThreshold() + " to " + newThreshold +
+ ". Current used = " + mu.getUsed());
+ mpool.setUsageThreshold(newThreshold);
- if (mpool.getUsageThreshold() != newThreshold) {
- throw new RuntimeException("TEST FAILED: " +
+ if (mpool.getUsageThreshold() != newThreshold) {
+ throw new RuntimeException("TEST FAILED: " +
"Threshold for Memory pool " + mpool.getName() +
"is " + mpool.getUsageThreshold() + " but expected to be" +
newThreshold);
- }
+ }
- allocator.start();
- sweeper.start();
- try {
- allocator.join();
- sweeper.join();
- } catch (InterruptedException e) {
- e.printStackTrace();
- System.out.println("Unexpected exception.");
- testFailed = true;
- }
+ allocator.start();
+ // Force Allocator start first
+ phaser.arriveAndAwaitAdvance();
+ sweeper.start();
+
+
+ try {
+ allocator.join();
+ // Wait until AllocatorThread's done
+ phaser.arriveAndAwaitAdvance();
+ sweeper.join();
+ } catch (InterruptedException e) {
+ System.out.println("Unexpected exception:" + e);
+ testFailed = true;
+ }
- listener.checkResult();
+ listener.checkResult();
- if (testFailed)
- throw new RuntimeException("TEST FAILED.");
+ if (testFailed)
+ throw new RuntimeException("TEST FAILED.");
- System.out.println("Test passed.");
+ System.out.println(RunUtil.successMessage);
+ }
}
private static void goSleep(long ms) {
try {
Thread.sleep(ms);
} catch (InterruptedException e) {
- e.printStackTrace();
- System.out.println("Unexpected exception.");
+ System.out.println("Unexpected exception:" + e);
testFailed = true;
}
}
- private static Object go = new Object();
- private static boolean waiting = false; // No thread is waiting.
-
- // Synchronizes two thread. If no thread is waiting then wait
- // for notification from a different thread and if it is
- // is waiting then send notification.
- // In this test case this method is used to synchronize sweeper
- // thread and alocater thread to reach a particular point.
- private static void wait_or_notify() {
- synchronized (go) {
- if (waiting == false) {
- waiting = true;
- System.out.println(" Waiting ");
- try {
- go.wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
- testFailed = true;
- }
- waiting = false;
- } else {
- System.out.println(" Notify ");
- go.notify();
- }
- }
- }
-
- private static List objectPool = new ArrayList();
+ private static final List