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 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - OpenJDK 7 Command + OpenJDK 8 Command CFBundleShortVersionString 1.0 CFBundleVersion 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(Classc) 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 objectPool = new ArrayList<>(); static class AllocatorThread extends Thread { public void doTask() { int iterations = 0; int numElements = (int) (chunkSize / 4); // minimal object size - while (!listenerInvoked) { + while (!listenerInvoked || mpool.getUsage().getUsed() < mpool.getUsageThreshold()) { iterations++; if (trace) { System.out.println(" Iteration " + iterations + @@ -234,23 +232,25 @@ public class LowMemoryTest { goSleep(100); } } + @Override public void run() { for (int i = 1; i <= NUM_TRIGGERS; i++) { - System.out.println("AllocatorThread is doing task " + i); + // Sync with SweeperThread's second phase. + phaser.arriveAndAwaitAdvance(); + System.out.println("AllocatorThread is doing task " + i + + " phase " + phaser.getPhase()); doTask(); - synchronized (sweep) { - sweep.notify(); + // Sync with SweeperThread's first phase. + phaser.arriveAndAwaitAdvance(); + System.out.println("AllocatorThread done task " + i + + " phase " + phaser.getPhase()); + if (testFailed) { + return; } - // System.out.print(" Allocater Thread "); - // If sweeper thread is waiting then send notify - // else wait for notification from sweeper thread. - wait_or_notify(); - if (testFailed) return; } } } - private static Object sweep = new Object(); static class SweeperThread extends Thread { private void doTask() { for (; mpool.getUsage().getUsed() >= @@ -261,28 +261,21 @@ public class LowMemoryTest { goSleep(100); } } + @Override public void run() { for (int i = 1; i <= NUM_TRIGGERS; i++) { - synchronized (sweep) { - while (!listenerInvoked) { - try { - sweep.wait(); - } catch (InterruptedException e) { - e.printStackTrace(); - System.out.println("Unexpected exception."); - testFailed = true; - } - } - } - System.out.println("SweepThread is doing task " + i); + // Sync with AllocatorThread's first phase. + phaser.arriveAndAwaitAdvance(); + System.out.println("SweepThread is doing task " + i + + " phase " + phaser.getPhase()); doTask(); listenerInvoked = false; - // System.out.print(" Sweeper Thread "); - // If Allocater thread is waiting wait send notify - // else wait for notfication from allocater thread. - wait_or_notify(); + // Sync with AllocatorThread's second phase. + phaser.arriveAndAwaitAdvance(); + System.out.println("SweepThread done task " + i + + " phase " + phaser.getPhase()); if (testFailed) return; } } diff --git a/test/java/lang/management/MemoryMXBean/LowMemoryTestConcMarkSweepGC.sh b/test/java/lang/management/MemoryMXBean/LowMemoryTestConcMarkSweepGC.sh deleted file mode 100644 index 159804ddf6bff8462d5fc433971b3da09750bf2c..0000000000000000000000000000000000000000 --- a/test/java/lang/management/MemoryMXBean/LowMemoryTestConcMarkSweepGC.sh +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2003, 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 4530538 -# @summary Test LowMemoryTest with concurrent mark sweep GC -# @author Mandy Chung -# -# @run build LowMemoryTest -# @run shell/timeout=600 LowMemoryTestConcMarkSweepGC.sh -# - -#Set appropriate jdk - -if [ ! -z "${TESTJAVA}" ] ; then - jdk="$TESTJAVA" -else - echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." - exit 1 -fi - -runOne() -{ - echo "runOne $@" - $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2 -} - -# Test LowMemoryTest with concurrent collector -runOne -XX:+UseConcMarkSweepGC LowMemoryTest - -exit 0 diff --git a/test/java/lang/management/MemoryMXBean/LowMemoryTestParallelGC.sh b/test/java/lang/management/MemoryMXBean/LowMemoryTestParallelGC.sh deleted file mode 100644 index 985a2e2e4f4fa98fcd10461ef5862f60e656852c..0000000000000000000000000000000000000000 --- a/test/java/lang/management/MemoryMXBean/LowMemoryTestParallelGC.sh +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2003, 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 4530538 -# @summary Test LowMemoryTest with parallel GC -# @author Mandy Chung -# -# @run build LowMemoryTest -# @run shell/timeout=600 LowMemoryTestParallelGC.sh -# - -#Set appropriate jdk - -if [ ! -z "${TESTJAVA}" ] ; then - jdk="$TESTJAVA" -else - echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." - exit 1 -fi - -runOne() -{ - echo "runOne $@" - $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2 -} - -# Test LowMemoryTest with parallel scavenger collector -runOne -XX:+UseParallelGC LowMemoryTest - -exit 0 diff --git a/test/java/lang/management/MemoryMXBean/LowMemoryTestSerialGC.sh b/test/java/lang/management/MemoryMXBean/LowMemoryTestSerialGC.sh deleted file mode 100644 index 282901958d47d7d62b7c3a84552672d10871514d..0000000000000000000000000000000000000000 --- a/test/java/lang/management/MemoryMXBean/LowMemoryTestSerialGC.sh +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2003, 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 4530538 -# @summary Test LowMemoryTest with Serial GC -# @author Mandy Chung -# -# @run build LowMemoryTest -# @run shell/timeout=600 LowMemoryTestSerialGC.sh -# - -#Set appropriate jdk - -if [ ! -z "${TESTJAVA}" ] ; then - jdk="$TESTJAVA" -else - echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." - exit 1 -fi - -runOne() -{ - echo "runOne $@" - $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2 -} - -# Test LowMemoryTest with serial collector -runOne -XX:+UseSerialGC LowMemoryTest - -exit 0 diff --git a/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java b/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java index 312db6bb313889ee4798ee6469cc60d51abc323f..f15fd2b007d47969d16d9307b8e62efb64b287c8 100644 --- a/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java +++ b/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java @@ -32,11 +32,9 @@ * @summary Basic Test for MemoryPool.resetPeakUsage() * @author Mandy Chung * - * @build ResetPeakMemoryUsage MemoryUtil - * @run main/othervm -XX:+PrintGCDetails -XX:+UseSerialGC -Xms256m -XX:MarkSweepAlwaysCompactCount=1 -Xmn8m ResetPeakMemoryUsage - * @run main/othervm -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -Xms256m -Xmn8m ResetPeakMemoryUsage - * @run main/othervm -XX:+PrintGCDetails -XX:+UseParallelGC -Xms256m -Xmn8m ResetPeakMemoryUsage - * @run main/othervm -XX:+PrintGCDetails -XX:+UseG1GC -Xms256m -Xmn8m -XX:G1HeapRegionSize=1m ResetPeakMemoryUsage + * @library /lib/testlibrary/ + * @build ResetPeakMemoryUsage MemoryUtil RunUtil + * @run main ResetPeakMemoryUsage */ import java.lang.management.*; @@ -47,24 +45,42 @@ public class ResetPeakMemoryUsage { // make public so that it can't be optimized away easily public static Object[] obj; - public static void main(String[] argv) { - List pools = ManagementFactory.getMemoryPoolMXBeans(); - ListIterator iter = pools.listIterator(); - boolean found = false; - while (iter.hasNext()) { - MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next(); - // only check heap pools that support usage threshold - // this is typically only the old generation space - // since the other spaces are expected to get filled up - if (p.getType() == MemoryType.HEAP && - p.isUsageThresholdSupported()) - { - found = true; - testPool(p); + /** + * Run the test multiple times with different GC versions. + * First with default command line specified by the framework. + * Then with all GC versions specified by the test. + */ + public static void main(String a[]) throws Throwable { + final String main = "ResetPeakMemoryUsage$TestMain"; + final String ms = "-Xms256m"; + final String mn = "-Xmn8m"; + RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseConcMarkSweepGC"); + RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseParallelGC"); + RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseG1GC", "-XX:G1HeapRegionSize=1m"); + RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseSerialGC", + "-XX:MarkSweepAlwaysCompactCount=1"); + } + + private static class TestMain { + public static void main(String[] argv) { + List pools = ManagementFactory.getMemoryPoolMXBeans(); + ListIterator iter = pools.listIterator(); + boolean found = false; + while (iter.hasNext()) { + MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next(); + // only check heap pools that support usage threshold + // this is typically only the old generation space + // since the other spaces are expected to get filled up + if (p.getType() == MemoryType.HEAP && + p.isUsageThresholdSupported()) + { + found = true; + testPool(p); + } + } + if (!found) { + throw new RuntimeException("No heap pool found"); } - } - if (!found) { - throw new RuntimeException("No heap pool found"); } } @@ -142,7 +158,7 @@ public class ResetPeakMemoryUsage { formatSize("previous peak", peak2.getUsed())); } - System.out.println("Test passed."); + System.out.println(RunUtil.successMessage); } private static String INDENT = " "; diff --git a/test/java/lang/management/MemoryMXBean/RunUtil.java b/test/java/lang/management/MemoryMXBean/RunUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..5f9d07c1a00496d558b050a2787365233a629fa7 --- /dev/null +++ b/test/java/lang/management/MemoryMXBean/RunUtil.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/** + * Utility class for launching a test in a separate JVM. + */ + +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; +import jdk.testlibrary.OutputAnalyzer; +import jdk.testlibrary.Utils; +import jdk.testlibrary.ProcessTools; +import jdk.testlibrary.JDKToolFinder; + +public class RunUtil { + + // Used to mark that the test has passed successfully. + public static final String successMessage = "Test passed."; + + public static void runTestClearGcOpts(String main, String... testOpts) throws Throwable { + runTest(main, true, testOpts); + } + + public static void runTestKeepGcOpts(String main, String... testOpts) throws Throwable { + runTest(main, false, testOpts); + } + + /** + * Runs a test in a separate JVM. + * command line like: + * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main + * + * {defaultopts} are the default java options set by the framework. + * Default GC options in {defaultopts} may be removed. + * This is used when the test specifies its own GC options. + * + * @param main Name of the main class. + * @param clearGcOpts true if the default GC options should be removed. + * @param testOpts java options specified by the test. + */ + private static void runTest(String main, boolean clearGcOpts, String... testOpts) + throws Throwable { + List opts = new ArrayList<>(); + opts.add(JDKToolFinder.getJDKTool("java")); + opts.addAll(Arrays.asList(Utils.getTestJavaOpts())); + opts.add("-cp"); + opts.add(System.getProperty("test.class.path", "test.class.path")); + opts.add("-XX:+PrintGCDetails"); + + if (clearGcOpts) { + opts = Utils.removeGcOpts(opts); + } + opts.addAll(Arrays.asList(testOpts)); + opts.add(main); + + OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0])); + output.shouldHaveExitValue(0); + if (output.getStdout().indexOf(successMessage) < 0) { + throw new Exception("output missing '" + successMessage + "'"); + } + } + +} diff --git a/test/java/net/Authenticator/B8034170.java b/test/java/net/Authenticator/B8034170.java new file mode 100644 index 0000000000000000000000000000000000000000..3767732c2e82ac7412557622b121446e00935258 --- /dev/null +++ b/test/java/net/Authenticator/B8034170.java @@ -0,0 +1,192 @@ +/* + * 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.io.*; +import java.net.*; +import java.util.*; + +/** + * @test + * @bug 8034170 + * @summary Digest authentication interop issue + * @run main/othervm B8034170 unquoted + * @run main/othervm -Dhttp.auth.digest.quoteParameters=true B8034170 quoted + */ + +public class B8034170 { + + static boolean expectQuotes; + + static class BasicServer extends Thread { + + ServerSocket server; + + Socket s; + InputStream is; + OutputStream os; + + static final String realm = "wallyworld"; + + String reply1 = "HTTP/1.1 401 Unauthorized\r\n"+ + "WWW-Authenticate: Digest realm=\""+realm+"\", qop=\"auth\"" + + ", nonce=\"8989de95ea2402b64d73cecdb15da255\"" + + ", opaque=\"bbfb4c9ee92ddccc73521c3e6e841ba2\"\r\n\r\n"; + + String OKreply = "HTTP/1.1 200 OK\r\n"+ + "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" + + "Server: Apache/1.3.14 (Unix)\r\n" + + "Connection: close\r\n" + + "Content-Type: text/plain; charset=iso-8859-1\r\n" + + "Content-Length: 10\r\n\r\n"; + + String ERRreply = "HTTP/1.1 500 Internal server error\r\n"+ + "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" + + "Server: Apache/1.3.14 (Unix)\r\n" + + "Connection: close\r\n" + + "Content-Length: 0\r\n\r\n"; + + BasicServer (ServerSocket s) { + server = s; + } + + int readAll (Socket s, byte[] buf) throws IOException { + int pos = 0; + InputStream is = s.getInputStream (); + // wait two seconds for request, as client doesn't close + // the connection + s.setSoTimeout(2000); + try { + int n; + while ((n=is.read(buf, pos, buf.length-pos)) > 0) + pos +=n; + } catch (SocketTimeoutException x) { } + return pos; + } + + public void run () { + byte[] buf = new byte[5000]; + try { + System.out.println ("Server 1: accept"); + s = server.accept (); + System.out.println ("accepted"); + os = s.getOutputStream(); + os.write (reply1.getBytes()); + readAll (s, buf); + s.close (); + + System.out.println ("Server 2: accept"); + s = server.accept (); + System.out.println ("accepted"); + os = s.getOutputStream(); + int count = readAll (s, buf); + String reply = new String(buf, 0, count); + + boolean error; + + if (expectQuotes) { + error = false; + if (!reply.contains("qop=\"auth\"")) { + System.out.println ("Expecting quoted qop. Not found"); + error = true; + } + if (!reply.contains("algorithm=\"MD5\"")) { + System.out.println ("Expecting quoted algorithm. Not found"); + error = true; + } + } else { + error = false; + if (!reply.contains("qop=auth")) { + System.out.println ("Expecting unquoted qop. Not found"); + error = true; + } + if (!reply.contains("algorithm=MD5")) { + System.out.println ("Expecting unquoted algorithm. Not found"); + error = true; + } + } + if (error) { + os.write(ERRreply.getBytes()); + os.flush(); + s.close(); + } else { + os.write((OKreply+"HelloWorld").getBytes()); + os.flush(); + s.close(); + } + } + catch (Exception e) { + System.out.println (e); + } + finished (); + } + + public synchronized void finished () { + notifyAll(); + } + + } + + static class MyAuthenticator3 extends Authenticator { + PasswordAuthentication pw; + MyAuthenticator3 () { + super (); + pw = new PasswordAuthentication ("user", "passwordNotCheckedAnyway".toCharArray()); + } + + public PasswordAuthentication getPasswordAuthentication () + { + System.out.println ("Auth called"); + return pw; + } + } + + + static void read (InputStream is) throws IOException { + int c; + System.out.println ("reading"); + while ((c=is.read()) != -1) { + System.out.write (c); + } + System.out.println (""); + System.out.println ("finished reading"); + } + + public static void main (String args[]) throws Exception { + expectQuotes = args[0].equals("quoted"); + + MyAuthenticator3 auth = new MyAuthenticator3 (); + Authenticator.setDefault (auth); + ServerSocket ss = new ServerSocket (0); + int port = ss.getLocalPort (); + BasicServer server = new BasicServer (ss); + synchronized (server) { + server.start(); + System.out.println ("client 1"); + URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html"); + URLConnection urlc = url.openConnection (); + InputStream is = urlc.getInputStream (); + read (is); + is.close (); + } + } +} diff --git a/test/java/net/URLClassLoader/closetest/CloseTest.java b/test/java/net/URLClassLoader/closetest/CloseTest.java index 4fcb7a5c310cb0465df63835ca4420ac450116c4..790c3bf76c56c7925d664bc9ab34e6e727a7ec09 100644 --- a/test/java/net/URLClassLoader/closetest/CloseTest.java +++ b/test/java/net/URLClassLoader/closetest/CloseTest.java @@ -26,7 +26,7 @@ * @bug 4167874 * @library ../../../../com/sun/net/httpserver * @library /lib/testlibrary - * @build FileServerHandler jdk.testlibrary.FileUtils + * @build jdk.testlibrary.* FileServerHandler * @run shell build.sh * @run main/othervm CloseTest * @summary URL-downloaded jar files can consume all available file descriptors diff --git a/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java b/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java index a11d58afe8fe9b1e85fb8486a0f2d4faa180305c..bffbb2c23bb07dc1de9b503dcc11497d743405e0 100644 --- a/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java +++ b/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java @@ -25,7 +25,7 @@ * @test * @bug 6899919 * @library /lib/testlibrary - * @build jdk.testlibrary.FileUtils + * @build jdk.testlibrary.* * @run shell build2.sh * @run main/othervm GetResourceAsStream */ diff --git a/test/java/net/URLPermission/nstest/lookup.sh b/test/java/net/URLPermission/nstest/lookup.sh index 89cfd101d21ee3c595cc635c25b1d71e169e8a0d..e97ea339200347e12ff99d2f3f1b556f3e62c3c9 100644 --- a/test/java/net/URLPermission/nstest/lookup.sh +++ b/test/java/net/URLPermission/nstest/lookup.sh @@ -26,6 +26,7 @@ # @library /lib/testlibrary # @compile -XDignore.symbol.file=true SimpleNameService.java # LookupTest.java SimpleNameServiceDescriptor.java +# @build jdk.testlibrary.* # @run shell/timeout=50 lookup.sh # diff --git a/test/java/util/zip/ZipFile/MultiThreadedReadTest.java b/test/java/util/zip/ZipFile/MultiThreadedReadTest.java index c1f69a90587381cdd43f7ae454b0b8d3ef1ac9bd..d4cbd5384d086ee66190dc247797908e0ea15148 100644 --- a/test/java/util/zip/ZipFile/MultiThreadedReadTest.java +++ b/test/java/util/zip/ZipFile/MultiThreadedReadTest.java @@ -25,7 +25,7 @@ * @bug 8038491 * @summary Crash in ZipFile.read() when ZipFileInputStream is shared between threads * @library /lib/testlibrary - * @build jdk.testlibrary.FileUtils + * @build jdk.testlibrary.* * @run main MultiThreadedReadTest */ diff --git a/test/javax/management/monitor/StartStopTest.java b/test/javax/management/monitor/StartStopTest.java index 80694c63e05c27f3db4a37499caf17067b57a96a..2f4175985726a562f8b8fdc452d4503a81973e2f 100644 --- a/test/javax/management/monitor/StartStopTest.java +++ b/test/javax/management/monitor/StartStopTest.java @@ -28,9 +28,8 @@ * monitors are started and stopped in a loop. * @author Luis-Miguel Alventosa * @library /lib/testlibrary - * @run build jdk.testlibrary.Utils * @run clean StartStopTest - * @run build StartStopTest + * @run build jdk.testlibrary.* StartStopTest * @run main/othervm/timeout=300 StartStopTest 1 * @run main/othervm/timeout=300 StartStopTest 2 * @run main/othervm/timeout=300 StartStopTest 3 diff --git a/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java b/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9976730a67fa67f5594a42deabb4fee6d6d14860 --- /dev/null +++ b/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java @@ -0,0 +1,88 @@ +/* + * 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 javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.awt.Robot; +import java.awt.Toolkit; +import sun.awt.SunToolkit; + +/* + @test + @bug 8031485 + @summary Combo box consuming escape and enter key events + @author Petr Pchelko + @run main ConsumedEscTest +*/ +public class ConsumedEscTest { + private static volatile JFrame frame; + private static volatile boolean passed = false; + + public static void main(String... args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame(); + JComboBox combo = new JComboBox<>(new String[]{"one", "two", "three"}); + JPanel panel = new JPanel(); + panel.add(combo); + combo.requestFocusInWindow(); + frame.setBounds(100, 150, 300, 100); + addAction(panel); + frame.add(panel); + frame.setVisible(true); + }); + + Robot robot = new Robot(); + robot.waitForIdle(); + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + if (!passed) { + throw new RuntimeException("FAILED: ESC was consumed by combo box"); + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + private static void addAction(JComponent comp) { + KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); + Object actionKey = "cancel"; + comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey); + Action cancelAction = new AbstractAction() { + @Override + public void actionPerformed(ActionEvent ev) { + passed = true; + } + }; + comp.getActionMap().put(actionKey, cancelAction); + } + +} diff --git a/test/javax/swing/plaf/nimbus/8041725/bug8041725.java b/test/javax/swing/plaf/nimbus/8041725/bug8041725.java new file mode 100644 index 0000000000000000000000000000000000000000..d668a3411de5a49f7728877944ea29d2c66569cd --- /dev/null +++ b/test/javax/swing/plaf/nimbus/8041725/bug8041725.java @@ -0,0 +1,82 @@ +/* + * 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 8041725 + @summary JList selection colors are not UIResource instances in Nimbus L&F + @author Anton Litvinov +*/ + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.nimbus.*; + +public class bug8041725 { + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new NimbusLookAndFeel()); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + JFrame frame = new JFrame("bug8041725"); + frame.setSize(200, 200); + JList list = new JList(new String[]{"Item1", "Item2", "Item3"}); + frame.getContentPane().add(list); + frame.pack(); + frame.setVisible(true); + + System.err.println("Test #1: No items are selected, list is enabled."); + testSelectionColors(list); + + System.err.println("Test #2: No items are selected, list is disabled."); + list.setEnabled(false); + testSelectionColors(list); + + System.err.println("Test #3: One item is selected, list is disabled."); + list.setSelectedIndex(0); + testSelectionColors(list); + + System.err.println("Test #4: One item is selected, list is enabled."); + list.setEnabled(true); + testSelectionColors(list); + + frame.dispose(); + } + }); + } + + private static void testSelectionColors(JList list) { + Color selBackColor = list.getSelectionBackground(); + if (!(selBackColor instanceof UIResource)) { + throw new RuntimeException(String.format( + "JList.getSelectionBackground() returned instance of '%s' instead of UIResource.", + selBackColor.getClass())); + } + Color selForeColor = list.getSelectionForeground(); + if (!(selForeColor instanceof UIResource)) { + throw new RuntimeException(String.format( + "JList.getSelectionForeground() returned instance of '%s' instead of UIResource.", + selForeColor.getClass())); + } + } +} diff --git a/test/javax/swing/plaf/synth/Test8043627.java b/test/javax/swing/plaf/synth/Test8043627.java new file mode 100644 index 0000000000000000000000000000000000000000..2a36634a5fd164c0c4527afd1ca846e004e6d555 --- /dev/null +++ b/test/javax/swing/plaf/synth/Test8043627.java @@ -0,0 +1,39 @@ +/* + * 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 javax.swing.JButton; +import javax.swing.plaf.synth.SynthButtonUI; + +/* + * @test + * @bug 8043627 + * @summary Tests that SynthContext can be created with SecurityManager installed + * @author Sergey Malenkov + */ + +public class Test8043627 { + public static void main(String[] args) { + System.setSecurityManager(new SecurityManager()); + new SynthButtonUI().getContext(new JButton()); + } +} diff --git a/test/lib/testlibrary/jdk/testlibrary/Utils.java b/test/lib/testlibrary/jdk/testlibrary/Utils.java index 2388d1d39bebdbfeae231829177fc8afa5e3e975..5d4a441f2ea39acbb57d3a5eede2b779f2de078a 100644 --- a/test/lib/testlibrary/jdk/testlibrary/Utils.java +++ b/test/lib/testlibrary/jdk/testlibrary/Utils.java @@ -117,6 +117,26 @@ public final class Utils { return opts.toArray(new String[0]); } + /** + * Removes any options specifying which GC to use, for example "-XX:+UseG1GC". + * Removes any options matching: -XX:(+/-)Use*GC + * Used when a test need to set its own GC version. Then any + * GC specified by the framework must first be removed. + * @return A copy of given opts with all GC options removed. + */ + private static final Pattern useGcPattern = Pattern.compile("\\-XX\\:[\\+\\-]Use.+GC"); + public static List removeGcOpts(List opts) { + List optsWithoutGC = new ArrayList(); + for (String opt : opts) { + if (useGcPattern.matcher(opt).matches()) { + System.out.println("removeGcOpts: removed " + opt); + } else { + optsWithoutGC.add(opt); + } + } + return optsWithoutGC; + } + /** * Splits a string by white space. * Works like String.split(), but returns an empty array diff --git a/test/sun/awt/image/bug8038000.java b/test/sun/awt/image/bug8038000.java new file mode 100644 index 0000000000000000000000000000000000000000..2bfdc27d2b7de54e58d9db2e821b9ab1bb06ec2b --- /dev/null +++ b/test/sun/awt/image/bug8038000.java @@ -0,0 +1,153 @@ +/* + * 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 8038000 + * + * @summary Verifies that we could create different type of Rasters with height 1 + * and strideline which exceeds raster width. + * Also checks that a set of RasterOp work correctly with such kind of Rasters. + * + * @run main bug8038000 + */ + +import java.awt.*; +import java.awt.color.ColorSpace; +import java.awt.geom.AffineTransform; +import java.awt.image.*; +import java.util.Arrays; + +public class bug8038000 { + + public static void main(String[] args) throws Exception { + new bug8038000().checkOps(); + + // No exceptions - Passed + } + + private void checkOps() throws Exception { + + RasterOp[] ops = new RasterOp[] { + new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB), + ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), null), + new AffineTransformOp(AffineTransform.getScaleInstance(1, 1.1), null) + }; + + + for (RasterOp op: ops) { + // Banded rasters + checkOp(Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 10, 1, 10, + new int[] {0, 1, 2}, new int[]{2,1,0}, null), + Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 10, 1, 1001, + new int[] {0, 1, 2}, new int[]{2,1,0}, null), op); + checkOp(Raster.createBandedRaster(DataBuffer.TYPE_USHORT, 10, 1, 10, + new int[] {0, 1, 2}, new int[]{2,1,0}, null), + Raster.createBandedRaster(DataBuffer.TYPE_USHORT, 10, 1, 1001, + new int[] {0, 1, 2}, new int[]{2,1,0}, null), op); + checkOp(Raster.createBandedRaster(DataBuffer.TYPE_INT, 10, 1, 10, + new int[] {0, 1, 2}, new int[]{2,1,0}, null), + Raster.createBandedRaster(DataBuffer.TYPE_INT, 10, 1, 1001, + new int[] {0, 1, 2}, new int[]{2,1,0}, null), op); + + // Interleaved rasters + checkOp(Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, + 10, 1, 30, 3, new int[]{0, 1, 2}, null), + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, + 10, 1, 1001, 3, new int[]{0, 1, 2}, null), + op); + + checkOp(Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT, + 10, 1, 30, 3, new int[]{0, 1, 2}, null), + Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT, + 10, 1, 1001, 3, new int[]{0, 1, 2}, null), + op); + + // Packed rasters + checkOp(Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 10, + new int[] {0x01, 0x02, 0x04}, null), + Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 2000, + new int[] {0x01, 0x02, 0x04}, null), + op); + checkOp(Raster.createPackedRaster(new DataBufferInt(10), 10, 1, 10, + new int[] {0xff0000, 0x00ff00, 0x0000ff}, null), + Raster.createPackedRaster(new DataBufferInt(10), 10, 1, 20, + new int[] {0xff0000, 0x00ff00, 0x0000ff}, null), + op); + + } + } + + /** + * Takes two identical rasters (identical with the exception of scanline stride) + * fills their pixels with identical data, applies the RasterOp to both rasters + * and checks that the result is the same + */ + private void checkOp(WritableRaster wr1, WritableRaster wr2, RasterOp op) { + System.out.println("Checking " + op + " with rasters: \n " + wr1 + + "\n " + wr2); + try { + WritableRaster r1 = op.filter(fillRaster(wr1), null); + WritableRaster r2 = op.filter(fillRaster(wr2), null); + compareRasters(r1, r2); + } catch (ImagingOpException e) { + System.out.println(" Skip: Op is not supported: " + e); + } + } + + private WritableRaster fillRaster(WritableRaster wr) { + int c = 0; + for(int x = wr.getMinX(); x < wr.getMinX() + wr.getWidth(); x++) { + for(int y = wr.getMinY(); y < wr.getMinY() + wr.getHeight(); y++) { + for (int b = 0; b < wr.getNumBands(); b++) { + wr.setSample(x, y, b, c++); + } + } + } + return wr; + } + + private void compareRasters(Raster r1, Raster r2) { + Rectangle bounds = r1.getBounds(); + if (!bounds.equals(r2.getBounds())) { + throw new RuntimeException("Bounds differ."); + } + + if (r1.getNumBands() != r2.getNumBands()) { + throw new RuntimeException("Bands differ."); + } + + int[] b1 = new int[r1.getNumBands()]; + int[] b2 = new int[r1.getNumBands()]; + + for (int x = (int) bounds.getX(); x < bounds.getMaxX(); x++) { + for (int y = (int) bounds.getY(); y < bounds.getMaxY(); y++) { + r1.getPixel(x,y, b1); + r2.getPixel(x,y, b2); + if (!Arrays.equals(b1, b2)) { + throw new RuntimeException("Pixels differ."); + } + } + } + } +} diff --git a/test/sun/management/jdp/JdpDefaultsTest.java b/test/sun/management/jdp/JdpDefaultsTest.java index 9067be7cc05f33be8b4b6496c70b334c684bbae3..35a145fd330e7ee8ed10e0c4ab25423cc3467f80 100644 --- a/test/sun/management/jdp/JdpDefaultsTest.java +++ b/test/sun/management/jdp/JdpDefaultsTest.java @@ -28,7 +28,7 @@ * @test JdpDefaultsTest * @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port. * @library /lib/testlibrary - * @build ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher + * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher * @run main JdpDefaultsTest */ diff --git a/test/sun/management/jdp/JdpOffTest.java b/test/sun/management/jdp/JdpOffTest.java index 7810400abbe6c64cd59aed1b034996e459bb8d92..15b082e01ef11a49731b3b60843ac484ca981625 100644 --- a/test/sun/management/jdp/JdpOffTest.java +++ b/test/sun/management/jdp/JdpOffTest.java @@ -29,7 +29,7 @@ * @test JdpOffTest.java * @summary Assert that no JDP packets are sent to the default address and port. * @library /lib/testlibrary - * @build ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher + * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher * @run main JdpOffTest */ diff --git a/test/sun/management/jdp/JdpSpecificAddressTest.java b/test/sun/management/jdp/JdpSpecificAddressTest.java index 8a791766d85a92d7cb703430022a7d4a25cc6603..0b9d8e0232836cabba58ebffb7da4f9f2f681c25 100644 --- a/test/sun/management/jdp/JdpSpecificAddressTest.java +++ b/test/sun/management/jdp/JdpSpecificAddressTest.java @@ -28,7 +28,7 @@ * @test JdpSpecificAddressTest * @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port. * @library /lib/testlibrary - * @build ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher + * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher * @run main JdpSpecificAddressTest */ diff --git a/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java b/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java index 620b828caba07145cacfb5e78bf902fadeb21837..777fde340f0a8053a1056a47f3d12aba70a04879 100644 --- a/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java +++ b/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,7 @@ public class LocalRMIServerSocketFactoryTest { private static final SynchronousQueue queue = new SynchronousQueue(); + private static volatile boolean isRunning = true; static final class Result extends Exception { @@ -91,19 +92,23 @@ public class LocalRMIServerSocketFactoryTest { Thread t = new Thread() { public void run() { - while (true) { + while (isRunning) { Exception error = Result.SUCCESS; try { System.err.println("Accepting: "); final Socket ss = s.accept(); System.err.println(ss.getInetAddress() + " accepted"); } catch (Exception x) { - x.printStackTrace(); + if (isRunning) { + x.printStackTrace(); + } error = x; } finally { try { - // wait for the client to get the exception. - queue.put(error); + if (isRunning) { + // wait for the client to get the exception. + queue.put(error); + } } catch (Exception x) { // too bad! System.err.println("Could't send result to client!"); @@ -114,32 +119,38 @@ public class LocalRMIServerSocketFactoryTest { } } }; - t.setDaemon(true); - t.start(); - - System.err.println("new Socket((String)null, port)"); - final Socket s1 = new Socket((String) null, port); - checkError("new Socket((String)null, port)"); - s1.close(); - System.err.println("new Socket((String)null, port): PASSED"); - - System.err.println("new Socket(InetAddress.getByName(null), port)"); - final Socket s2 = new Socket(InetAddress.getByName(null), port); - checkError("new Socket(InetAddress.getByName(null), port)"); - s2.close(); - System.err.println("new Socket(InetAddress.getByName(null), port): PASSED"); - - System.err.println("new Socket(localhost, port)"); - final Socket s3 = new Socket("localhost", port); - checkError("new Socket(localhost, port)"); - s3.close(); - System.err.println("new Socket(localhost, port): PASSED"); - - System.err.println("new Socket(127.0.0.1, port)"); - final Socket s4 = new Socket("127.0.0.1", port); - checkError("new Socket(127.0.0.1, port)"); - s4.close(); - System.err.println("new Socket(127.0.0.1, port): PASSED"); + try { + t.start(); + + System.err.println("new Socket((String)null, port)"); + final Socket s1 = new Socket((String) null, port); + checkError("new Socket((String)null, port)"); + s1.close(); + System.err.println("new Socket((String)null, port): PASSED"); + + System.err.println("new Socket(InetAddress.getByName(null), port)"); + final Socket s2 = new Socket(InetAddress.getByName(null), port); + checkError("new Socket(InetAddress.getByName(null), port)"); + s2.close(); + System.err.println("new Socket(InetAddress.getByName(null), port): PASSED"); + + System.err.println("new Socket(localhost, port)"); + final Socket s3 = new Socket("localhost", port); + checkError("new Socket(localhost, port)"); + s3.close(); + System.err.println("new Socket(localhost, port): PASSED"); + + System.err.println("new Socket(127.0.0.1, port)"); + final Socket s4 = new Socket("127.0.0.1", port); + checkError("new Socket(127.0.0.1, port)"); + s4.close(); + System.err.println("new Socket(127.0.0.1, port): PASSED"); + } + finally { + isRunning = false; + s.close(); + t.join(); + } } } diff --git a/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java b/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java index ca448159cd10f2551aee3644c8fca5daed099af4..54c1b6150994eca85aa267958f5f71b71a9863eb 100644 --- a/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java +++ b/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java @@ -41,8 +41,7 @@ import jdk.testlibrary.ProcessTools; * @test * @bug 6434402 8004926 * @library /lib/testlibrary - * @build jdk.testlibrary.ProcessTools - * @build TestManager TestApplication CustomLauncherTest + * @build jdk.testlibrary.* TestManager TestApplication CustomLauncherTest * @run main/othervm CustomLauncherTest * @author Jaroslav Bachorik */ diff --git a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java index 1d4bbb1fb79aa4206c9fa06768e9ae4ef5f7257d..6eecbda4d2291aa43b4d18e90570a5a80b216169 100644 --- a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java +++ b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java @@ -42,8 +42,7 @@ import jdk.testlibrary.ProcessTools; * without connection or username/password details. * TestManager will attempt a connection to the address obtained from * both agent properties and jvmstat buffer. - * @build jdk.testlibrary.ProcessTools - * @build TestManager TestApplication + * @build jdk.testlibrary.* TestManager TestApplication * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest */ diff --git a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java index fe3a77483774caeb5098f4396e1e101847b9b421..cacb7087c27bb3c56d207b6769d47d399ab1c1a0 100644 --- a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -54,10 +54,7 @@ import jdk.testlibrary.JDKToolLauncher; * @test * @bug 7110104 * @library /lib/testlibrary - * @build jdk.testlibrary.ProcessTools - * @build jdk.testlibrary.JDKToolLauncher - * @build jdk.testlibrary.Utils - * @build JMXStartStopTest JMXStartStopDoSomething + * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething * @run main/othervm JMXStartStopTest * @summary Makes sure that enabling/disabling the management agent through * JCMD achieves the desired results diff --git a/test/sun/nio/cs/TestUTF8.java b/test/sun/nio/cs/TestUTF8.java index c54ae66f4d9dff78fe8c87828334a37efada34b9..010fbf17b436c2ee72c61d5701565f84546d32b0 100644 --- a/test/sun/nio/cs/TestUTF8.java +++ b/test/sun/nio/cs/TestUTF8.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4486841 7040220 7096080 + * @bug 4486841 7040220 7096080 8039751 * @summary Test UTF-8 charset */ @@ -291,14 +291,18 @@ public class TestUTF8 { {1, (byte)0xE0, (byte)0xC0, (byte)0xBF }, // invalid second byte {2, (byte)0xE0, (byte)0xA0, (byte)0x7F }, // invalid third byte {2, (byte)0xE0, (byte)0xA0, (byte)0xC0 }, // invalid third byte + {2, (byte)0xE1, (byte)0x80, (byte)0x42}, // invalid third byte + {1, (byte)0xFF, (byte)0xFF, (byte)0xFF }, // all ones {1, (byte)0xE0, (byte)0xC0, (byte)0x80 }, // invalid second byte {1, (byte)0xE0, (byte)0x80, (byte)0xC0 }, // invalid first byte {1, (byte)0xE0, (byte)0x41,}, // invalid second byte & 2 bytes + {1, (byte)0xE1, (byte)0x40,}, // invalid second byte & 2 bytes {3, (byte)0xED, (byte)0xAE, (byte)0x80 }, // 3 bytes surrogate {3, (byte)0xED, (byte)0xB0, (byte)0x80 }, // 3 bytes surrogate + // Four-byte sequences {1, (byte)0xF0, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded {1, (byte)0xF0, (byte)0x80, (byte)0x81, (byte)0xBF }, // U+007F zero-padded @@ -323,6 +327,32 @@ public class TestUTF8 { {1, (byte)0xF4, (byte)0xC0, (byte)0x80, (byte)0xC0 }, // out-range 4-byte {1, (byte)0xF5, (byte)0x80, (byte)0x80, (byte)0xC0 }, // out-range 4-byte + // #8039751 + {1, (byte)0xF6, (byte)0x80, (byte)0x80, (byte)0x80 }, // out-range 1st byte + {1, (byte)0xF6, (byte)0x80, (byte)0x80, }, + {1, (byte)0xF6, (byte)0x80, }, + {1, (byte)0xF6, }, + {1, (byte)0xF5, (byte)0x80, (byte)0x80, (byte)0x80 }, // out-range 1st byte + {1, (byte)0xF5, (byte)0x80, (byte)0x80, }, + {1, (byte)0xF5, (byte)0x80, }, + {1, (byte)0xF5 }, + + {1, (byte)0xF4, (byte)0x90, (byte)0x80, (byte)0x80 }, // out-range 2nd byte + {1, (byte)0xF4, (byte)0x90, (byte)0x80 }, + {1, (byte)0xF4, (byte)0x90 }, + + {1, (byte)0xF4, (byte)0x7f, (byte)0x80, (byte)0x80 }, // out-range/ascii 2nd byte + {1, (byte)0xF4, (byte)0x7f, (byte)0x80 }, + {1, (byte)0xF4, (byte)0x7f }, + + {1, (byte)0xF0, (byte)0x80, (byte)0x80, (byte)0x80 }, // out-range 2nd byte + {1, (byte)0xF0, (byte)0x80, (byte)0x80 }, + {1, (byte)0xF0, (byte)0x80 }, + + {1, (byte)0xF0, (byte)0xc0, (byte)0x80, (byte)0x80 }, // out-range 2nd byte + {1, (byte)0xF0, (byte)0xc0, (byte)0x80 }, + {1, (byte)0xF0, (byte)0xc0 }, + // Five-byte sequences {1, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80}, // invalid first byte {1, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded @@ -553,7 +583,6 @@ public class TestUTF8 { check4ByteSurrs("UTF-8"); checkMalformed("UTF-8", malformed); checkUnderOverflow("UTF-8"); - checkRoundtrip("CESU-8"); check6ByteSurrs("CESU-8"); checkMalformed("CESU-8", malformed_cesu8); diff --git a/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java b/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java index ae5c6596c1f8882a5f758d59885342b35fcf4a33..063746b175a96aa862f3b9982440f932ddf05cb8 100644 --- a/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java +++ b/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java @@ -28,6 +28,7 @@ * @author Robert Field * @library /lib/testlibrary * @compile -XDignore.symbol.file ManyNewInstanceAnonTest.java + * @build jdk.testlibrary.* * @run main ClassFileInstaller ManyNewInstanceAnonTest * @run main/othervm -Xbootclasspath/a:. -Xverify:all ManyNewInstanceAnonTest * @run main/othervm -Xbootclasspath/a:. -Xverify:all -Dsun.reflection.noInflation=true ManyNewInstanceAnonTest diff --git a/test/sun/tools/jstatd/JstatdTest.java b/test/sun/tools/jstatd/JstatdTest.java index f07ce6b1742e2270900b97f3c34d1488d31d1bd4..0c003cfcb5eeaa88f1db70a25db497abfd3e82ff 100644 --- a/test/sun/tools/jstatd/JstatdTest.java +++ b/test/sun/tools/jstatd/JstatdTest.java @@ -27,6 +27,7 @@ import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.Arrays; +import java.util.regex.Pattern; import static jdk.testlibrary.Asserts.*; import jdk.testlibrary.JDKToolLauncher; @@ -34,6 +35,7 @@ import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessThread; import jdk.testlibrary.TestThread; import jdk.testlibrary.Utils; +import jdk.testlibrary.ProcessTools; /** * The base class for tests of jstatd. @@ -93,8 +95,11 @@ public final class JstatdTest { if (tool == "rmiregistry") { processName = "registryimpl"; } + + Pattern toolInJpsPattern = + Pattern.compile("^\\d+\\s{1}" + processName + "\\s{1}.*-dparent\\.pid\\." + ProcessTools.getProcessId() + ".*"); for (String line : lines) { - if (line.toLowerCase().matches("^\\d+\\s{1}" + processName + "$")) { + if (toolInJpsPattern.matcher(line.toLowerCase()).matches()) { pid = line.split(" ")[0]; count++; } @@ -167,6 +172,8 @@ public final class JstatdTest { private OutputAnalyzer runJps() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps"); launcher.addVMArg("-XX:+UsePerfData"); + // Run jps with -v flag to obtain -Dparent.pid. + launcher.addToolArg("-v"); launcher.addToolArg(getDestination()); String[] cmd = launcher.getCommand(); @@ -286,7 +293,7 @@ public final class JstatdTest { * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName */ - private String[] getJstatdCmd() throws UnknownHostException { + private String[] getJstatdCmd() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd"); launcher.addVMArg("-XX:+UsePerfData"); String testSrc = System.getProperty("test.src"); @@ -294,6 +301,8 @@ public final class JstatdTest { assertTrue(policy.exists() && policy.isFile(), "Security policy " + policy.getAbsolutePath() + " does not exist or not a file"); launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath()); + // -Dparent.pid. will help to identify jstad process started by this test + launcher.addVMArg("-Dparent.pid." + ProcessTools.getProcessId()); if (port != null) { launcher.addToolArg("-p"); launcher.addToolArg(port); diff --git a/test/sun/tools/jstatd/TestJstatdDefaults.java b/test/sun/tools/jstatd/TestJstatdDefaults.java index d68f384c35ca464b2f7d293ee83282692db5f04d..c3973f824e96c68b45287e085195b7748a4fe254 100644 --- a/test/sun/tools/jstatd/TestJstatdDefaults.java +++ b/test/sun/tools/jstatd/TestJstatdDefaults.java @@ -25,7 +25,7 @@ * @test * @bug 4990825 * @library /lib/testlibrary - * @build JstatdTest JstatGCUtilParser + * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser * @run main/timeout=60 TestJstatdDefaults */ public class TestJstatdDefaults { diff --git a/test/sun/tools/jstatd/TestJstatdExternalRegistry.java b/test/sun/tools/jstatd/TestJstatdExternalRegistry.java index da81db13bc909ca7e4e3576b5d1f9f9012705b80..fdf2e484c46e8cda4bf713127fb4f03f5ce798df 100644 --- a/test/sun/tools/jstatd/TestJstatdExternalRegistry.java +++ b/test/sun/tools/jstatd/TestJstatdExternalRegistry.java @@ -25,7 +25,7 @@ * @test * @bug 4990825 7092186 * @library /lib/testlibrary - * @build JstatdTest JstatGCUtilParser + * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser * @run main/timeout=60 TestJstatdExternalRegistry */ public class TestJstatdExternalRegistry { diff --git a/test/sun/tools/jstatd/TestJstatdPort.java b/test/sun/tools/jstatd/TestJstatdPort.java index f2d479b6e307f483d82805bb9b8c3e7f5c35eae2..bba8732bad92732ac4ddaa99a7e219d138147b3d 100644 --- a/test/sun/tools/jstatd/TestJstatdPort.java +++ b/test/sun/tools/jstatd/TestJstatdPort.java @@ -25,7 +25,7 @@ * @test * @bug 4990825 * @library /lib/testlibrary - * @build JstatdTest JstatGCUtilParser + * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser * @run main/timeout=60 TestJstatdPort */ public class TestJstatdPort { diff --git a/test/sun/tools/jstatd/TestJstatdPortAndServer.java b/test/sun/tools/jstatd/TestJstatdPortAndServer.java index e771561e99cd087c756a27e2eedff56306a630eb..6b516f9140df500bbfcf97b6db25d86075fe3c29 100644 --- a/test/sun/tools/jstatd/TestJstatdPortAndServer.java +++ b/test/sun/tools/jstatd/TestJstatdPortAndServer.java @@ -25,7 +25,7 @@ * @test * @bug 4990825 * @library /lib/testlibrary - * @build JstatdTest JstatGCUtilParser + * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser * @run main/timeout=60 TestJstatdPortAndServer */ public class TestJstatdPortAndServer { diff --git a/test/sun/tools/jstatd/TestJstatdServer.java b/test/sun/tools/jstatd/TestJstatdServer.java index f8e87a668fc4df3203316351668a78c4b6e003ac..fbf1c56026f5dcb078849eb196406c6ab97ee116 100644 --- a/test/sun/tools/jstatd/TestJstatdServer.java +++ b/test/sun/tools/jstatd/TestJstatdServer.java @@ -25,7 +25,7 @@ * @test * @bug 4990825 * @library /lib/testlibrary - * @build JstatdTest JstatGCUtilParser + * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser * @run main/timeout=60 TestJstatdServer */ public class TestJstatdServer { diff --git a/test/sun/tools/jstatd/TestJstatdUsage.java b/test/sun/tools/jstatd/TestJstatdUsage.java index 3fd5efc19f37aef5c2ac887b00c18caef31351c5..abec798df6f8f040d62f411fbe4f025341a1c171 100644 --- a/test/sun/tools/jstatd/TestJstatdUsage.java +++ b/test/sun/tools/jstatd/TestJstatdUsage.java @@ -28,7 +28,7 @@ import jdk.testlibrary.OutputAnalyzer; * @test * @bug 4990825 * @library /lib/testlibrary - * @build jdk.testlibrary.JDKToolLauncher jdk.testlibrary.OutputAnalyzer + * @build jdk.testlibrary.* * @run main TestJstatdUsage */ public class TestJstatdUsage {