# HG changeset patch
# User lana
# Date 1413392815 25200
# Node ID 3265941b1b6c36e8a7714b57ca60e04da80e3382
# Parent 523b32b699be854445c34aad4849bea0155d3a59# Parent 609145c7dc68ddafbc0d7b3e5271235ce3c90099
Merge
diff -r 523b32b699be -r 3265941b1b6c make/java/java/mapfile-vers
--- a/make/java/java/mapfile-vers Tue Oct 07 12:52:31 2014 -0700
+++ b/make/java/java/mapfile-vers Wed Oct 15 10:06:55 2014 -0700
@@ -275,6 +275,7 @@
Java_sun_misc_VM_latestUserDefinedLoader;
Java_sun_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties;
+ Java_sun_misc_VMSupport_getVMTemporaryDirectory;
# ZipFile.c needs this one
throwFileNotFoundException;
diff -r 523b32b699be -r 3265941b1b6c src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Oct 15 10:06:55 2014 -0700
@@ -674,6 +674,13 @@
@Override // PlatformWindow
public void toFront() {
final long nsWindowPtr = getNSWindowPtr();
+ LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
+ Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ if( w != null
+ && ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
+ && !lwcToolkit.isApplicationActive()) {
+ lwcToolkit.activateApplicationIgnoringOtherApps();
+ }
updateFocusabilityForAutoRequestFocus(false);
nativePushNSWindowToFront(nsWindowPtr);
updateFocusabilityForAutoRequestFocus(true);
diff -r 523b32b699be -r 3265941b1b6c src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Oct 15 10:06:55 2014 -0700
@@ -700,6 +700,11 @@
*/
public native boolean isApplicationActive();
+ /*
+ * Activates application ignoring other apps.
+ */
+ public native void activateApplicationIgnoringOtherApps();
+
/************************
* Native methods section
************************/
diff -r 523b32b699be -r 3265941b1b6c src/macosx/native/sun/awt/LWCToolkit.m
--- a/src/macosx/native/sun/awt/LWCToolkit.m Tue Oct 07 12:52:31 2014 -0700
+++ b/src/macosx/native/sun/awt/LWCToolkit.m Wed Oct 15 10:06:55 2014 -0700
@@ -392,6 +392,23 @@
return active;
}
+/*
+ * Class: sun_lwawt_macosx_LWCToolkit
+ * Method: activateApplicationIgnoringOtherApps
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_activateApplicationIgnoringOtherApps
+(JNIEnv *env, jclass clazz)
+{
+ JNF_COCOA_ENTER(env);
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+ if(![NSApp isActive]){
+ [NSApp activateIgnoringOtherApps:YES];
+ }
+ }];
+ JNF_COCOA_EXIT(env);
+}
+
/*
* Class: sun_awt_SunToolkit
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java
--- a/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Wed Oct 15 10:06:55 2014 -0700
@@ -1062,10 +1062,6 @@
if (ktab != null) {
if (!privCredSet.contains(ktab)) {
privCredSet.add(ktab);
- // Compatibility; also add keys to privCredSet
- for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) {
- privCredSet.add(new Krb5Util.KeysFromKeyTab(key));
- }
}
} else {
succeeded = false;
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/java/net/URL.java
--- a/src/share/classes/java/net/URL.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/java/net/URL.java Wed Oct 15 10:06:55 2014 -0700
@@ -41,17 +41,21 @@
* directory, or it can be a reference to a more complicated object,
* such as a query to a database or to a search engine. More
* information on the types of URLs and their formats can be found at:
- *
- *
- * http://www.socs.uts.edu.au/MosaicDocs-old/url-primer.html
- *
+ *
+ * Types of URL
*
- * In general, a URL can be broken into several parts. The previous
- * example of a URL indicates that the protocol to use is
+ * In general, a URL can be broken into several parts. Consider the
+ * following example:
+ *
+ * http://www.example.com/docs/resource1.html
+ *
+ *
+ * The URL above indicates that the protocol to use is
* http
(HyperText Transfer Protocol) and that the
* information resides on a host machine named
- * www.socs.uts.edu.au
. The information on that host
- * machine is named /MosaicDocs-old/url-primer.html
. The exact
+ * www.example.com
. The information on that host
+ * machine is named /docs/resource1.html
. The exact
* meaning of this name on the host machine is both protocol
* dependent and host dependent. The information normally resides in
* a file, but it could be generated on the fly. This component of
@@ -64,7 +68,7 @@
* http
is 80
. An alternative port could be
* specified as:
*
- * http://www.socs.uts.edu.au:80/MosaicDocs-old/url-primer.html
+ * http://www.example.com:1080/docs/resource1.html
*
*
* The syntax of URL
is defined by instances = new HashMap(7);
+ private static ConcurrentMap instances = new ConcurrentHashMap<>(7);
private static HashSet available;
@@ -286,48 +288,47 @@
private static Currency getInstance(String currencyCode, int defaultFractionDigits,
int numericCode) {
- synchronized (instances) {
- // Try to look up the currency code in the instances table.
- // This does the null pointer check as a side effect.
- // Also, if there already is an entry, the currencyCode must be valid.
- Currency instance = instances.get(currencyCode);
- if (instance != null) {
- return instance;
+ // Try to look up the currency code in the instances table.
+ // This does the null pointer check as a side effect.
+ // Also, if there already is an entry, the currencyCode must be valid.
+ Currency instance = instances.get(currencyCode);
+ if (instance != null) {
+ return instance;
+ }
+
+ if (defaultFractionDigits == Integer.MIN_VALUE) {
+ // Currency code not internally generated, need to verify first
+ // A currency code must have 3 characters and exist in the main table
+ // or in the list of other currencies.
+ if (currencyCode.length() != 3) {
+ throw new IllegalArgumentException();
}
-
- if (defaultFractionDigits == Integer.MIN_VALUE) {
- // Currency code not internally generated, need to verify first
- // A currency code must have 3 characters and exist in the main table
- // or in the list of other currencies.
- if (currencyCode.length() != 3) {
+ char char1 = currencyCode.charAt(0);
+ char char2 = currencyCode.charAt(1);
+ int tableEntry = getMainTableEntry(char1, char2);
+ if ((tableEntry & COUNTRY_TYPE_MASK) == SIMPLE_CASE_COUNTRY_MASK
+ && tableEntry != INVALID_COUNTRY_ENTRY
+ && currencyCode.charAt(2) - 'A' == (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK)) {
+ defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT;
+ numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT;
+ } else {
+ // Check for '-' separately so we don't get false hits in the table.
+ if (currencyCode.charAt(2) == '-') {
throw new IllegalArgumentException();
}
- char char1 = currencyCode.charAt(0);
- char char2 = currencyCode.charAt(1);
- int tableEntry = getMainTableEntry(char1, char2);
- if ((tableEntry & COUNTRY_TYPE_MASK) == SIMPLE_CASE_COUNTRY_MASK
- && tableEntry != INVALID_COUNTRY_ENTRY
- && currencyCode.charAt(2) - 'A' == (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK)) {
- defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT;
- numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT;
- } else {
- // Check for '-' separately so we don't get false hits in the table.
- if (currencyCode.charAt(2) == '-') {
- throw new IllegalArgumentException();
- }
- int index = otherCurrencies.indexOf(currencyCode);
- if (index == -1) {
- throw new IllegalArgumentException();
- }
- defaultFractionDigits = otherCurrenciesDFD[index / 4];
- numericCode = otherCurrenciesNumericCode[index / 4];
+ int index = otherCurrencies.indexOf(currencyCode);
+ if (index == -1) {
+ throw new IllegalArgumentException();
}
+ defaultFractionDigits = otherCurrenciesDFD[index / 4];
+ numericCode = otherCurrenciesNumericCode[index / 4];
}
+ }
- instance = new Currency(currencyCode, defaultFractionDigits, numericCode);
- instances.put(currencyCode, instance);
- return instance;
- }
+ Currency currencyVal =
+ new Currency(currencyCode, defaultFractionDigits, numericCode);
+ instance = instances.putIfAbsent(currencyCode, currencyVal);
+ return (instance != null ? instance : currencyVal);
}
/**
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/java/util/CurrencyData.properties
--- a/src/share/classes/java/util/CurrencyData.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/java/util/CurrencyData.properties Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
@@ -26,10 +26,9 @@
formatVersion=1
# Version of the currency code information in this class.
-# It is a serial number that accompanies with each amendment, such as
-# 'MAxxx.doc'
+# It is a serial number that accompanies with each amendment.
-dataVersion=151
+dataVersion=159
# List of all valid ISO 4217 currency codes.
# To ensure compatibility, do not remove codes.
@@ -49,11 +48,12 @@
NIO558-NLG528-NOK578-NPR524-NZD554-OMR512-PAB590-PEN604-PGK598-PHP608-\
PKR586-PLN985-PTE620-PYG600-QAR634-ROL946-RON946-RSD941-RUB643-RUR810-RWF646-SAR682-\
SBD090-SCR690-SDD736-SDG938-SEK752-SGD702-SHP654-SIT705-SKK703-SLL694-SOS706-\
- SRD968-SRG740-STD678-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\
+ SRD968-SRG740-SSP728-STD678-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\
TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-\
UYU858-UZS860-VEB862-VEF937-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\
XBB956-XBC957-XBD958-XCD951-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\
- XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZWD716-ZWL932-ZWN942-ZWR935
+ XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZMW967-ZWD716-ZWL932-\
+ ZWN942-ZWR935
# Mappings from ISO 3166 country codes to ISO 4217 currency codes.
@@ -71,7 +71,7 @@
#
# The table is based on the following web sites:
# http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/db_en.html
-# http://www.bsi-global.com/iso4217currency
+# http://www.currency-iso.org/iso_index/iso_tables.htm
# http://www.cia.gov/cia/publications/factbook/indexgeo.html
# AFGHANISTAN
@@ -105,7 +105,7 @@
# AUSTRIA
AT=EUR
# AZERBAIJAN
-AZ=AZM;2005-12-31-20-00-00;AZN
+AZ=AZN
# BAHAMAS
BS=BSD
# BAHRAIN
@@ -320,7 +320,7 @@
# LAO PEOPLE'S DEMOCRATIC REPUBLIC
LA=LAK
# LATVIA
-LV=LVL
+LV=LVL;2013-12-31-22-00-00;EUR
# LEBANON
LB=LBP
# LESOTHO
@@ -332,7 +332,7 @@
# LIECHTENSTEIN
LI=CHF
# LITHUANIA
-LT=LTL
+LT=LTL;2014-12-31-22-00-00;EUR
# LUXEMBOURG
LU=EUR
# MACAU
@@ -378,7 +378,7 @@
# MOROCCO
MA=MAD
# MOZAMBIQUE
-MZ=MZM;2006-06-30-22-00-00;MZN
+MZ=MZN
# MYANMAR
MM=MMK
# NAMIBIA
@@ -440,7 +440,7 @@
# REUNION
RE=EUR
# ROMANIA
-RO=ROL;2005-06-30-21-00-00;RON
+RO=RON
# RUSSIAN FEDERATION
RU=RUB
# RWANDA
@@ -463,6 +463,8 @@
WS=WST
# SAN MARINO
SM=EUR
+# SOUTH SUDAN
+SS=SSP
# SAO TOME AND PRINCIPE
ST=STD
# SAUDI ARABIA
@@ -532,7 +534,7 @@
# TUNISIA
TN=TND
# TURKEY
-TR=TRL;2004-12-31-22-00-00;TRY
+TR=TRY
# TURKMENISTAN
TM=TMT
# TURKS AND CAICOS ISLANDS
@@ -558,7 +560,7 @@
# VANUATU
VU=VUV
# VENEZUELA
-VE=VEB;2008-01-01-04-00-00;VEF
+VE=VEF
# VIET NAM
VN=VND
# VIRGIN ISLANDS, BRITISH
@@ -572,7 +574,7 @@
# YEMEN
YE=YER
# ZAMBIA
-ZM=ZMK
+ZM=ZMW
# ZIMBABWE
ZW=ZWL
@@ -583,7 +585,7 @@
minor0=\
ADP-BEF-BIF-BYB-BYR-CLF-CLP-DJF-ESP-GNF-\
GRD-ISK-ITL-JPY-KMF-KRW-LUF-MGF-PYG-PTE-RWF-\
- TPE-TRL-VUV-XAF-XOF-XPF
+ TPE-TRL-UGX-VND-VUV-XAF-XOF-XPF
minor1=
minor3=\
BHD-IQD-JOD-KWD-LYD-OMR-TND
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/java/util/LocaleISOData.java
--- a/src/share/classes/java/util/LocaleISOData.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/java/util/LocaleISOData.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -433,6 +433,7 @@
+ "SN" + "SEN" // Senegal, Republic of
+ "SO" + "SOM" // Somalia, Somali Republic
+ "SR" + "SUR" // Suriname, Republic of
+ + "SS" + "SSD" // South Sudan
+ "ST" + "STP" // Sao Tome and Principe, Democratic Republic of
+ "SV" + "SLV" // El Salvador, Republic of
+ "SX" + "SXM" // Sint Maarten (Dutch part)
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java
--- a/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2008, 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
@@ -33,7 +33,8 @@
import javax.swing.text.View;
import sun.swing.SwingUtilities2;
import sun.awt.AppContext;
-
+import java.util.Enumeration;
+import java.util.HashSet;
/**
* RadioButtonUI implementation for BasicRadioButtonUI
@@ -44,15 +45,27 @@
{
private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object();
+ /**
+ * The icon.
+ */
protected Icon icon;
private boolean defaults_initialized = false;
private final static String propertyPrefix = "RadioButton" + ".";
+ private KeyListener keyListener = null;
+
// ********************************
// Create PLAF
// ********************************
+
+ /**
+ * Returns an instance of {@code BasicRadioButtonUI}.
+ *
+ * @param b a component
+ * @return an instance of {@code BasicRadioButtonUI}
+ */
public static ComponentUI createUI(JComponent b) {
AppContext appContext = AppContext.getAppContext();
BasicRadioButtonUI radioButtonUI =
@@ -64,6 +77,7 @@
return radioButtonUI;
}
+ @Override
protected String getPropertyPrefix() {
return propertyPrefix;
}
@@ -71,7 +85,8 @@
// ********************************
// Install PLAF
// ********************************
- protected void installDefaults(AbstractButton b){
+ @Override
+ protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
icon = UIManager.getIcon(getPropertyPrefix() + "icon");
@@ -82,15 +97,80 @@
// ********************************
// Uninstall PLAF
// ********************************
- protected void uninstallDefaults(AbstractButton b){
+ @Override
+ protected void uninstallDefaults(AbstractButton b) {
super.uninstallDefaults(b);
defaults_initialized = false;
}
+ /**
+ * Returns the default icon.
+ *
+ * @return the default icon
+ */
public Icon getDefaultIcon() {
return icon;
}
+ // ********************************
+ // Install Listeners
+ // ********************************
+ @Override
+ protected void installListeners(AbstractButton button) {
+ super.installListeners(button);
+
+ // Only for JRadioButton
+ if (!(button instanceof JRadioButton))
+ return;
+
+ keyListener = createKeyListener();
+ button.addKeyListener(keyListener);
+
+ // Need to get traversal key event
+ button.setFocusTraversalKeysEnabled(false);
+
+ // Map actions to the arrow keys
+ button.getActionMap().put("Previous", new SelectPreviousBtn());
+ button.getActionMap().put("Next", new SelectNextBtn());
+
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+ put(KeyStroke.getKeyStroke("UP"), "Previous");
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+ put(KeyStroke.getKeyStroke("DOWN"), "Next");
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+ put(KeyStroke.getKeyStroke("LEFT"), "Previous");
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
+ put(KeyStroke.getKeyStroke("RIGHT"), "Next");
+ }
+
+ // ********************************
+ // UnInstall Listeners
+ // ********************************
+ @Override
+ protected void uninstallListeners(AbstractButton button) {
+ super.uninstallListeners(button);
+
+ // Only for JRadioButton
+ if (!(button instanceof JRadioButton))
+ return;
+
+ // Unmap actions from the arrow keys
+ button.getActionMap().remove("Previous");
+ button.getActionMap().remove("Next");
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+ .remove(KeyStroke.getKeyStroke("UP"));
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+ .remove(KeyStroke.getKeyStroke("DOWN"));
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+ .remove(KeyStroke.getKeyStroke("LEFT"));
+ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
+ .remove(KeyStroke.getKeyStroke("RIGHT"));
+
+ if (keyListener != null) {
+ button.removeKeyListener(keyListener);
+ keyListener = null;
+ }
+ }
/* These Dimensions/Rectangles are allocated once for all
* RadioButtonUI.paint() calls. Re-using rectangles
@@ -106,6 +186,7 @@
/**
* paint the radio button
*/
+ @Override
public synchronized void paint(Graphics g, JComponent c) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
@@ -195,7 +276,14 @@
}
}
- protected void paintFocus(Graphics g, Rectangle textRect, Dimension size){
+ /**
+ * Paints focused radio button.
+ *
+ * @param g an instance of {@code Graphics}
+ * @param textRect bounds
+ * @param size the size of radio button
+ */
+ protected void paintFocus(Graphics g, Rectangle textRect, Dimension size) {
}
@@ -213,6 +301,7 @@
/**
* The preferred size of the radio button
*/
+ @Override
public Dimension getPreferredSize(JComponent c) {
if(c.getComponentCount() > 0) {
return null;
@@ -258,4 +347,262 @@
height += prefInsets.top + prefInsets.bottom;
return new Dimension(width, height);
}
+
+ /////////////////////////// Private functions ////////////////////////
+ /**
+ * Creates the key listener to handle tab navigation in JRadioButton Group.
+ */
+ private KeyListener createKeyListener() {
+ if (keyListener == null) {
+ keyListener = new KeyHandler();
+ }
+ return keyListener;
+ }
+
+
+ private boolean isValidRadioButtonObj(Object obj) {
+ return ((obj instanceof JRadioButton) &&
+ ((JRadioButton) obj).isVisible() &&
+ ((JRadioButton) obj).isEnabled());
+ }
+
+ /**
+ * Select radio button based on "Previous" or "Next" operation
+ *
+ * @param event, the event object.
+ * @param next, indicate if it's next one
+ */
+ private void selectRadioButton(ActionEvent event, boolean next) {
+ // Get the source of the event.
+ Object eventSrc = event.getSource();
+
+ // Check whether the source is JRadioButton, it so, whether it is visible
+ if (!isValidRadioButtonObj(eventSrc))
+ return;
+
+ ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
+ btnGroupInfo.selectNewButton(next);
+ }
+
+ /////////////////////////// Inner Classes ////////////////////////
+ @SuppressWarnings("serial")
+ private class SelectPreviousBtn extends AbstractAction {
+ public SelectPreviousBtn() {
+ super("Previous");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ BasicRadioButtonUI.this.selectRadioButton(e, false);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ private class SelectNextBtn extends AbstractAction{
+ public SelectNextBtn() {
+ super("Next");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ BasicRadioButtonUI.this.selectRadioButton(e, true);
+ }
+ }
+
+ /**
+ * ButtonGroupInfo, used to get related info in button group
+ * for given radio button
+ */
+ private class ButtonGroupInfo {
+
+ JRadioButton activeBtn = null;
+
+ JRadioButton firstBtn = null;
+ JRadioButton lastBtn = null;
+
+ JRadioButton previousBtn = null;
+ JRadioButton nextBtn = null;
+
+ HashSet btnsInGroup = null;
+
+ boolean srcFound = false;
+ public ButtonGroupInfo(JRadioButton btn) {
+ activeBtn = btn;
+ btnsInGroup = new HashSet();
+ }
+
+ // Check if given object is in the button group
+ boolean containsInGroup(Object obj){
+ return btnsInGroup.contains(obj);
+ }
+
+ // Check if the next object to gain focus belongs
+ // to the button group or not
+ Component getFocusTransferBaseComponent(boolean next){
+ Component focusBaseComp = activeBtn;
+ Window container = SwingUtilities.getWindowAncestor(activeBtn);
+ if (container != null) {
+ FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
+ Component comp = next ? policy.getComponentAfter(container, activeBtn)
+ : policy.getComponentBefore(container, activeBtn);
+
+ // If next component in the button group, use last/first button as base focus
+ // otherwise, use the activeBtn as the base focus
+ if (containsInGroup(comp)) {
+ focusBaseComp = next ? lastBtn : firstBtn;
+ }
+ }
+
+ return focusBaseComp;
+ }
+
+ boolean getButtonGroupInfo() {
+ if (activeBtn == null)
+ return false;
+
+ btnsInGroup.clear();
+
+ // Get the button model from the source.
+ ButtonModel model = activeBtn.getModel();
+ if (!(model instanceof DefaultButtonModel))
+ return false;
+
+ // If the button model is DefaultButtonModel, and use it, otherwise return.
+ DefaultButtonModel bm = (DefaultButtonModel) model;
+
+ // get the ButtonGroup of the button from the button model
+ ButtonGroup group = bm.getGroup();
+ if (group == null)
+ return false;
+
+ // Get all the buttons in the group
+ Enumeration e = group.getElements();
+ if (e == null)
+ return false;
+
+ while (e.hasMoreElements()) {
+ AbstractButton curElement = e.nextElement();
+ if (!isValidRadioButtonObj(curElement))
+ continue;
+
+ btnsInGroup.add((JRadioButton) curElement);
+
+ // If firstBtn is not set yet, curElement is that first button
+ if (null == firstBtn)
+ firstBtn = (JRadioButton) curElement;
+
+ if (activeBtn == curElement)
+ srcFound = true;
+ else if (!srcFound) {
+ // The source has not been yet found and the current element
+ // is the last previousBtn
+ previousBtn = (JRadioButton) curElement;
+ } else if (nextBtn == null) {
+ // The source has been found and the current element
+ // is the next valid button of the list
+ nextBtn = (JRadioButton) curElement;
+ }
+
+ // Set new last "valid" JRadioButton of the list
+ lastBtn = (JRadioButton) curElement;
+ }
+
+ return true;
+ }
+
+ /**
+ * Find the new radio button that focus needs to be
+ * moved to in the group, select the button
+ *
+ * @param next, indicate if it's arrow up/left or down/right
+ */
+ void selectNewButton(boolean next) {
+ if (!getButtonGroupInfo())
+ return;
+
+ if (srcFound) {
+ JRadioButton newSelectedBtn = null;
+ if (next) {
+ // Select Next button. Cycle to the first button if the source
+ // button is the last of the group.
+ newSelectedBtn = (null == nextBtn) ? firstBtn : nextBtn;
+ } else {
+ // Select previous button. Cycle to the last button if the source
+ // button is the first button of the group.
+ newSelectedBtn = (null == previousBtn) ? lastBtn : previousBtn;
+ }
+ if (newSelectedBtn != null &&
+ (newSelectedBtn != activeBtn)) {
+ newSelectedBtn.requestFocusInWindow();
+ newSelectedBtn.setSelected(true);
+ }
+ }
+ }
+
+ /**
+ * Find the button group the passed in JRadioButton belongs to, and
+ * move focus to next component of the last button in the group
+ * or previous component of first button
+ *
+ * @param next, indicate if jump to next component or previous
+ */
+ void jumpToNextComponent(boolean next) {
+ if (!getButtonGroupInfo()){
+ // In case the button does not belong to any group, it needs
+ // to be treated as a component
+ if (activeBtn != null){
+ lastBtn = activeBtn;
+ firstBtn = activeBtn;
+ }
+ else
+ return;
+ }
+
+ // Update the component we will use as base to transfer
+ // focus from
+ JComponent compTransferFocusFrom = activeBtn;
+
+ // If next component in the parent window is not in
+ // the button group, current active button will be
+ // base, otherwise, the base will be first or last
+ // button in the button group
+ Component focusBase = getFocusTransferBaseComponent(next);
+ if (focusBase != null){
+ if (next) {
+ KeyboardFocusManager.
+ getCurrentKeyboardFocusManager().focusNextComponent(focusBase);
+ } else {
+ KeyboardFocusManager.
+ getCurrentKeyboardFocusManager().focusPreviousComponent(focusBase);
+ }
+ }
+ }
+ }
+
+ /**
+ * Radiobutton KeyListener
+ */
+ private class KeyHandler implements KeyListener {
+
+ // This listener checks if the key event is a KeyEvent.VK_TAB
+ // or shift + KeyEvent.VK_TAB event on a radio button, consume the event
+ // if so and move the focus to next/previous component
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_TAB) {
+ // Get the source of the event.
+ Object eventSrc = e.getSource();
+
+ // Check whether the source is a visible and enabled JRadioButton
+ if (isValidRadioButtonObj(eventSrc)) {
+ e.consume();
+ ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
+ btnGroupInfo.jumpToNextComponent(!e.isShiftDown());
+ }
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+
+ public void keyTyped(KeyEvent e) {
+ }
+ }
}
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/javax/swing/text/html/HTMLDocument.java
--- a/src/share/classes/javax/swing/text/html/HTMLDocument.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/javax/swing/text/html/HTMLDocument.java Wed Oct 15 10:06:55 2014 -0700
@@ -1371,8 +1371,13 @@
Element parent = elem.getParentElement();
if (parent != null) {
+ // If we are going to insert the string into the body
+ // section, it is necessary to set the corrsponding flag.
+ if (HTML.Tag.BODY.name.equals(parent.getName())) {
+ insertInBody = true;
+ }
int offset = elem.getEndOffset();
- if (offset > getLength()) {
+ if (offset > (getLength() + 1)) {
offset--;
}
else if (elem.isLeaf() && getText(offset - 1, 1).
@@ -1380,6 +1385,10 @@
offset--;
}
insertHTML(parent, offset, htmlText, false);
+ // Cleanup the flag, if any.
+ if (insertInBody) {
+ insertInBody = false;
+ }
}
}
}
@@ -1818,6 +1827,11 @@
private static char[] NEWLINE;
/**
+ * Indicates that direct insertion to body section takes place.
+ */
+ private boolean insertInBody = false;
+
+ /**
* I18N property key.
*
* @see AbstractDocument#I18NProperty
@@ -2566,7 +2580,9 @@
// Assume content should be added.
foundInsertTag(false);
foundInsertTag = true;
- inParagraph = impliedP = true;
+ // If content is added directly to the body, it should
+ // be wrapped by p-implied.
+ inParagraph = impliedP = !insertInBody;
}
if (data.length >= 1) {
addContent(data, 0, data.length);
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/awt/datatransfer/DataTransferer.java
--- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java Wed Oct 15 10:06:55 2014 -0700
@@ -2911,6 +2911,14 @@
return comp;
}
+ if (flavor1.isFlavorTextType()) {
+ return 1;
+ }
+
+ if (flavor2.isFlavorTextType()) {
+ return -1;
+ }
+
// Next, look for application/x-java-* types. Prefer unknown
// MIME types because if the user provides his own data flavor,
// it will likely be the most descriptive one.
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Wed Oct 15 10:06:55 2014 -0700
@@ -233,8 +233,6 @@
* does not conform to the expected pattern
*/
public static int getLocalVmId(File file) {
- int lvmid = 0;
-
try {
// try 1.4.2 and later format first
return Integer.parseInt(file.getName());
@@ -287,31 +285,13 @@
return tmpDirName + dirNamePrefix + user + File.separator;
}
- /*
- * this static initializer would not be necessary if the
- * Solaris java.io.tmpdir property were set to /tmp by default
- */
static {
/*
- * Why is java.io.tmpdir on Solaris set to "/var/tmp/" when the
- * HotSpot JVM os:get_temp_path() method returns "/tmp/"
- *
- * Why do Solaris and Windows return a string with a trailing
- * file separator character where as Linix does not? (this change
- * seems to have occurred sometime during hopper beta)
+ * For this to work, the target VM and this code need to use
+ * the same directory. Instead of guessing which directory the
+ * VM is using, we will ask.
*/
- String tmpdir = System.getProperty("java.io.tmpdir");
-
- if (tmpdir.compareTo("/var/tmp/") == 0) {
- /*
- * shared memory files are created in /tmp. Interestingly,
- * java.io.tmpdir is set to "/var/tmp/" on Solaris and Linux,
- * but os::get_temp_directory() is set to "/tmp/" on these
- * platforms. the java.io.logging packages also makes reference
- * to java.io.tmpdir.
- */
- tmpdir = "/tmp/";
- }
+ String tmpdir = sun.misc.VMSupport.getVMTemporaryDirectory();
/*
* Assure that the string returned has a trailing File.separator
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/misc/ProxyGenerator.java
--- a/src/share/classes/sun/misc/ProxyGenerator.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/misc/ProxyGenerator.java Wed Oct 15 10:06:55 2014 -0700
@@ -27,11 +27,15 @@
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
@@ -327,10 +331,16 @@
new java.security.PrivilegedAction() {
public Void run() {
try {
- FileOutputStream file =
- new FileOutputStream(dotToSlash(name) + ".class");
- file.write(classFile);
- file.close();
+ int i = name.lastIndexOf('.');
+ Path path;
+ if (i > 0) {
+ Path dir = Paths.get(name.substring(0, i).replace('.', File.separatorChar));
+ Files.createDirectories(dir);
+ path = dir.resolve(name.substring(i+1, name.length()) + ".class");
+ } else {
+ path = Paths.get(name + ".class");
+ }
+ Files.write(path, classFile);
return null;
} catch (IOException e) {
throw new InternalError(
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/misc/VMSupport.java
--- a/src/share/classes/sun/misc/VMSupport.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/misc/VMSupport.java Wed Oct 15 10:06:55 2014 -0700
@@ -97,4 +97,14 @@
throw new RuntimeException(ioe.getMessage());
}
}
+
+ /*
+ * Return the temporary directory that the VM uses for the attach
+ * and perf data files.
+ *
+ * It is important that this directory is well-known and the
+ * same for all VM instances. It cannot be affected by configuration
+ * variables such as java.io.tmpdir.
+ */
+ public static native String getVMTemporaryDirectory();
}
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/net/httpserver/ServerImpl.java
--- a/src/share/classes/sun/net/httpserver/ServerImpl.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/net/httpserver/ServerImpl.java Wed Oct 15 10:06:55 2014 -0700
@@ -330,15 +330,7 @@
public void run() {
while (!finished) {
try {
- ListIterator li =
- connsToRegister.listIterator();
- for (HttpConnection c : connsToRegister) {
- reRegister(c);
- }
- connsToRegister.clear();
-
List list = null;
- selector.select(1000);
synchronized (lolock) {
if (events.size() > 0) {
list = events;
@@ -352,8 +344,14 @@
}
}
+ for (HttpConnection c : connsToRegister) {
+ reRegister(c);
+ }
+ connsToRegister.clear();
+
+ selector.select(1000);
+
/* process the selected list now */
-
Set selected = selector.selectedKeys();
Iterator iter = selected.iterator();
while (iter.hasNext()) {
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/security/jgss/krb5/Krb5Util.java
--- a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Wed Oct 15 10:06:55 2014 -0700
@@ -40,10 +40,7 @@
import sun.security.krb5.KrbException;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.Objects;
-import java.util.Set;
import sun.misc.SharedSecrets;
import sun.security.krb5.PrincipalName;
/**
@@ -189,16 +186,6 @@
return subject;
}
- // A special KerberosKey, used as keys read from a KeyTab object.
- // Each time new keys are read from KeyTab objects in the private
- // credentials set, old ones are removed and new ones added.
- public static class KeysFromKeyTab extends KerberosKey {
- public KeysFromKeyTab(KerberosKey key) {
- super(key.getPrincipal(), key.getEncoded(),
- key.getKeyType(), key.getVersionNumber());
- }
- }
-
/**
* Credentials of a service, the private secret to authenticate its
* identity, which can be:
@@ -237,7 +224,7 @@
// Compatibility with old behavior: even when there is no
// KerberosPrincipal, we can find one from KerberosKeys
List keys = SubjectComber.findMany(
- subj, null, null, KerberosKey.class);
+ subj, serverPrincipal, null, KerberosKey.class);
if (!keys.isEmpty()) {
sc.kp = keys.get(0).getPrincipal();
serverPrincipal = sc.kp.getName();
@@ -264,38 +251,17 @@
}
public KerberosKey[] getKKeys() {
- if (ktabs.isEmpty()) {
- return kk.toArray(new KerberosKey[kk.size()]);
- } else {
List keys = new ArrayList<>();
+ for (KerberosKey k: kk) {
+ keys.add(k);
+ }
for (KeyTab ktab: ktabs) {
for (KerberosKey k: ktab.getKeys(kp)) {
keys.add(k);
}
}
- // Compatibility: also add keys to privCredSet. Remove old
- // ones first, only remove those from keytab.
- if (!subj.isReadOnly()) {
- Set pcs = subj.getPrivateCredentials();
- synchronized (pcs) {
- Iterator iterator = pcs.iterator();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof KeysFromKeyTab) {
- KerberosKey key = (KerberosKey)obj;
- if (Objects.equals(key.getPrincipal(), kp)) {
- iterator.remove();
- }
- }
- }
- }
- for (KerberosKey key: keys) {
- subj.getPrivateCredentials().add(new KeysFromKeyTab(key));
- }
- }
return keys.toArray(new KerberosKey[keys.size()]);
}
- }
public EncryptionKey[] getEKeys() {
KerberosKey[] kkeys = getKKeys();
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/security/ssl/Handshaker.java
--- a/src/share/classes/sun/security/ssl/Handshaker.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/security/ssl/Handshaker.java Wed Oct 15 10:06:55 2014 -0700
@@ -624,8 +624,15 @@
*/
ProtocolList getActiveProtocols() {
if (activeProtocols == null) {
+ boolean enabledSSL20Hello = false;
ArrayList protocols = new ArrayList<>(4);
for (ProtocolVersion protocol : enabledProtocols.collection()) {
+ // Need not to check the SSL20Hello protocol.
+ if (protocol.v == ProtocolVersion.SSL20Hello.v) {
+ enabledSSL20Hello = true;
+ continue;
+ }
+
boolean found = false;
for (CipherSuite suite : enabledCipherSuites.collection()) {
if (suite.isAvailable() && suite.obsoleted > protocol.v &&
@@ -652,6 +659,11 @@
"No available cipher suite for " + protocol);
}
}
+
+ if (!protocols.isEmpty() && enabledSSL20Hello) {
+ protocols.add(ProtocolVersion.SSL20Hello);
+ }
+
activeProtocols = new ProtocolList(protocols);
}
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/text/resources/FormatData_sv_SE.java
--- a/src/share/classes/sun/text/resources/FormatData_sv_SE.java Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/text/resources/FormatData_sv_SE.java Wed Oct 15 10:06:55 2014 -0700
@@ -52,7 +52,7 @@
new String[] {
"#,##0.###;-#,##0.###", // decimal pattern
"#,##0.00 \u00A4;-#,##0.00 \u00A4", // currency pattern
- "#,##0%" // percent pattern
+ "#,##0 %" // percent pattern
}
},
};
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/util/resources/CurrencyNames.properties
--- a/src/share/classes/sun/util/resources/CurrencyNames.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/util/resources/CurrencyNames.properties Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
#
# COPYRIGHT AND PERMISSION NOTICE
#
-# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
+# Copyright (C) 1991-2012 Unicode, Inc. All rights reserved.
# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -226,6 +226,7 @@
SOS=SOS
SRD=SRD
SRG=SRG
+SSP=SSP
STD=STD
SVC=SVC
SYP=SYP
@@ -277,6 +278,7 @@
YUM=YUM
ZAR=ZAR
ZMK=ZMK
+ZMW=ZMW
ZWD=ZWD
ZWL=ZWL
ZWN=ZWN
@@ -443,6 +445,7 @@
sos=Somali Shilling
srd=Surinamese Dollar
srg=Surinamese Guilder
+ssp=South Sudanese Pound
std=S\u00e3o Tom\u00e9 and Pr\u00edncipe Dobra
svc=Salvadoran Col\u00f3n
syp=Syrian Pound
@@ -486,7 +489,9 @@
xpd=Palladium
xpf=CFP Franc
xpt=Platinum
+xsu=Sucre
xts=Testing Currency Code
+xua=ADB Unit of Account
xxx=Unknown Currency
yer=Yemeni Rial
yum=Yugoslavian New Dinar (1994-2002)
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/util/resources/CurrencyNames_es_PE.properties
--- a/src/share/classes/sun/util/resources/CurrencyNames_es_PE.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/util/resources/CurrencyNames_es_PE.properties Wed Oct 15 10:06:55 2014 -0700
@@ -35,4 +35,4 @@
# This notice and attribution to Taligent may not be removed.
# Taligent is a registered trademark of Taligent, Inc.
-PEN=S/
+PEN=S/.
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/util/resources/CurrencyNames_lt_LT.properties
--- a/src/share/classes/sun/util/resources/CurrencyNames_lt_LT.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/util/resources/CurrencyNames_lt_LT.properties Wed Oct 15 10:06:55 2014 -0700
@@ -35,4 +35,5 @@
# This notice and attribution to Taligent may not be removed.
# Taligent is a registered trademark of Taligent, Inc.
+EUR=\u20AC
LTL=Lt
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/util/resources/CurrencyNames_lv_LV.properties
--- a/src/share/classes/sun/util/resources/CurrencyNames_lv_LV.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/util/resources/CurrencyNames_lv_LV.properties Wed Oct 15 10:06:55 2014 -0700
@@ -35,4 +35,5 @@
# This notice and attribution to Taligent may not be removed.
# Taligent is a registered trademark of Taligent, Inc.
+EUR=\u20AC
LVL=Ls
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/util/resources/LocaleNames.properties
--- a/src/share/classes/sun/util/resources/LocaleNames.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/util/resources/LocaleNames.properties Wed Oct 15 10:06:55 2014 -0700
@@ -1077,6 +1077,7 @@
SN=Senegal
SO=Somalia
SR=Suriname
+SS=South Sudan
ST=Sao Tome And Principe
SV=El Salvador
SX=Sint Maarten (Dutch part)
diff -r 523b32b699be -r 3265941b1b6c src/share/classes/sun/util/resources/LocaleNames_sv.properties
--- a/src/share/classes/sun/util/resources/LocaleNames_sv.properties Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/classes/sun/util/resources/LocaleNames_sv.properties Wed Oct 15 10:06:55 2014 -0700
@@ -1114,7 +1114,7 @@
WS=Samoa
YE=Jemen
YT=Mayotte
-ZA=Sydafrika
+ZA=Sydafrika
ZM=Zambia
ZW=Zimbabwe
diff -r 523b32b699be -r 3265941b1b6c src/share/javavm/export/jvm.h
--- a/src/share/javavm/export/jvm.h Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/javavm/export/jvm.h Wed Oct 15 10:06:55 2014 -0700
@@ -1317,6 +1317,9 @@
JNIEXPORT jobject JNICALL
JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
+JNIEXPORT jstring JNICALL
+JVM_GetTemporaryDirectory(JNIEnv *env);
+
/* Generics reflection support.
*
* Returns information about the given class's EnclosingMethod
diff -r 523b32b699be -r 3265941b1b6c src/share/native/sun/misc/VMSupport.c
--- a/src/share/native/sun/misc/VMSupport.c Tue Oct 07 12:52:31 2014 -0700
+++ b/src/share/native/sun/misc/VMSupport.c Wed Oct 15 10:06:55 2014 -0700
@@ -53,3 +53,9 @@
}
return (*InitAgentProperties_fp)(env, props);
}
+
+JNIEXPORT jstring JNICALL
+Java_sun_misc_VMSupport_getVMTemporaryDirectory(JNIEnv *env, jclass cls)
+{
+ return JVM_GetTemporaryDirectory(env);
+}
diff -r 523b32b699be -r 3265941b1b6c src/solaris/native/java/net/ExtendedOptionsImpl.c
--- a/src/solaris/native/java/net/ExtendedOptionsImpl.c Tue Oct 07 12:52:31 2014 -0700
+++ b/src/solaris/native/java/net/ExtendedOptionsImpl.c Wed Oct 15 10:06:55 2014 -0700
@@ -215,6 +215,9 @@
if (errno == ENOPROTOOPT) {
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
"unsupported socket option");
+ } else if (errno == EACCES || errno == EPERM) {
+ NET_ERROR(env, JNU_JAVANETPKG "SocketException",
+ "Permission denied");
} else {
NET_ERROR(env, JNU_JAVANETPKG "SocketException",
"set option SO_FLOW_SLA failed");
@@ -247,6 +250,9 @@
if (errno == ENOPROTOOPT) {
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
"unsupported socket option");
+ } else if (errno == EACCES || errno == EPERM) {
+ NET_ERROR(env, JNU_JAVANETPKG "SocketException",
+ "Permission denied");
} else {
NET_ERROR(env, JNU_JAVANETPKG "SocketException",
"set option SO_FLOW_SLA failed");
diff -r 523b32b699be -r 3265941b1b6c src/windows/native/sun/windows/awt_TextArea.cpp
--- a/src/windows/native/sun/windows/awt_TextArea.cpp Tue Oct 07 12:52:31 2014 -0700
+++ b/src/windows/native/sun/windows/awt_TextArea.cpp Wed Oct 15 10:06:55 2014 -0700
@@ -47,16 +47,12 @@
jfieldID AwtTextArea::scrollbarVisibilityID;
-WNDPROC AwtTextArea::sm_pDefWindowProc = NULL;
-
/************************************************************************
* AwtTextArea methods
*/
AwtTextArea::AwtTextArea() {
- m_bIgnoreEnChange = FALSE;
m_bCanUndo = FALSE;
- m_hEditCtrl = NULL;
m_lHDeltaAccum = 0;
m_lVDeltaAccum = 0;
}
@@ -67,10 +63,6 @@
void AwtTextArea::Dispose()
{
- if (m_hEditCtrl != NULL) {
- VERIFY(::DestroyWindow(m_hEditCtrl));
- m_hEditCtrl = NULL;
- }
AwtTextComponent::Dispose();
}
@@ -91,10 +83,6 @@
}
}
-void AwtTextArea::EditGetSel(CHARRANGE &cr) {
- SendMessage(EM_EXGETSEL, 0, reinterpret_cast(&cr));
-}
-
/* Count how many '\n's are there in jStr */
size_t AwtTextArea::CountNewLines(JNIEnv *env, jstring jStr, size_t maxlen)
{
@@ -149,159 +137,6 @@
return retValue;
}
-/*
- * This routine is a window procedure for the subclass of the standard edit control
- * used to generate context menu. RichEdit controls don't have built-in context menu.
- * To implement this functionality we have to create an invisible edit control and
- * forward WM_CONTEXTMENU messages from a RichEdit control to this helper edit control.
- * While the edit control context menu is active we intercept the message generated in
- * response to particular item selection and forward it back to the RichEdit control.
- * (See AwtTextArea::WmContextMenu for more details).
- */
-LRESULT
-AwtTextArea::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
-
- static BOOL bContextMenuActive = FALSE;
-
- LRESULT retValue = 0;
- MsgRouting mr = mrDoDefault;
-
- DASSERT(::IsWindow(::GetParent(hWnd)));
-
- switch (message) {
- case WM_UNDO:
- case WM_CUT:
- case WM_COPY:
- case WM_PASTE:
- case WM_CLEAR:
- case EM_SETSEL:
- if (bContextMenuActive) {
- ::SendMessage(::GetParent(hWnd), message, wParam, lParam);
- mr = mrConsume;
- }
- break;
- case WM_CONTEXTMENU:
- bContextMenuActive = TRUE;
- break;
- }
-
- if (mr == mrDoDefault) {
- DASSERT(sm_pDefWindowProc != NULL);
- retValue = ::CallWindowProc(sm_pDefWindowProc,
- hWnd, message, wParam, lParam);
- }
-
- if (message == WM_CONTEXTMENU) {
- bContextMenuActive = FALSE;
- }
-
- return retValue;
-}
-
-MsgRouting
-AwtTextArea::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
- /* Use the system provided edit control class to generate context menu. */
- if (m_hEditCtrl == NULL) {
- DWORD dwStyle = WS_CHILD;
- DWORD dwExStyle = 0;
- m_hEditCtrl = ::CreateWindowEx(dwExStyle,
- L"EDIT",
- L"TEXT",
- dwStyle,
- 0, 0, 0, 0,
- GetHWnd(),
- reinterpret_cast(
- static_cast(
- CreateControlID())),
- AwtToolkit::GetInstance().GetModuleHandle(),
- NULL);
- DASSERT(m_hEditCtrl != NULL);
- if (sm_pDefWindowProc == NULL) {
- sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl,
- GWLP_WNDPROC);
- }
- ::SetLastError(0);
- INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC,
- (INT_PTR)AwtTextArea::EditProc);
- DASSERT(ret != 0 || ::GetLastError() == 0);
- }
-
- /*
- * Tricks on the edit control to ensure that its context menu has
- * the correct set of enabled items according to the RichEdit state.
- */
- ::SetWindowText(m_hEditCtrl, TEXT("TEXT"));
-
- if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) {
- /* Enable 'Undo' item. */
- ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0);
- }
-
- {
- /*
- * Initial selection for the edit control - (0,1).
- * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'.
- */
- INT nStart = 0;
- INT nEnd = 1;
- if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) {
- /*
- * RichEdit selection is empty - clear selection of the edit control.
- * This disables 'Cut', 'Copy' and 'Delete'.
- */
- nStart = -1;
- nEnd = 0;
- } else {
-
- CHARRANGE cr;
- EditGetSel(cr);
- /* Check if all the text is selected. */
- if (cr.cpMin == 0) {
-
- int len = ::GetWindowTextLength(GetHWnd());
- if (cr.cpMin == 0 && cr.cpMax >= len) {
- /*
- * All the text is selected in RichEdit - select all the
- * text in the edit control. This disables 'Select All'.
- */
- nStart = 0;
- nEnd = -1;
- }
- }
- }
- ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd);
- }
-
- /* Disable 'Paste' item if the RichEdit control is read-only. */
- ::SendMessage(m_hEditCtrl, EM_SETREADONLY,
- GetStyle() & ES_READONLY ? TRUE : FALSE, 0);
-
- POINT p;
- p.x = xPos;
- p.y = yPos;
-
- /*
- * If the context menu is requested with SHIFT+F10 or VK_APPS key,
- * we position its top left corner to the center of the RichEdit
- * client rect.
- */
- if (p.x == -1 && p.y == -1) {
- RECT r;
- VERIFY(::GetClientRect(GetHWnd(), &r));
- p.x = (r.left + r.right) / 2;
- p.y = (r.top + r.bottom) / 2;
- VERIFY(::ClientToScreen(GetHWnd(), &p));
- }
-
- // The context menu steals focus from the proxy.
- // So, set the focus-restore flag up.
- SetRestoreFocus(TRUE);
- ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
- SetRestoreFocus(FALSE);
-
- return mrConsume;
-}
-
MsgRouting
AwtTextArea::WmNcHitTest(UINT x, UINT y, LRESULT& retVal)
{
@@ -314,27 +149,8 @@
MsgRouting
-AwtTextArea::WmNotify(UINT notifyCode)
-{
- if (notifyCode == EN_CHANGE) {
- /*
- * Ignore notifications if the text hasn't been changed.
- * EN_CHANGE sent on character formatting changes as well.
- */
- if (m_bIgnoreEnChange == FALSE) {
- m_bCanUndo = TRUE;
- DoCallback("valueChanged", "()V");
- } else {
- m_bCanUndo = FALSE;
- }
- }
- return mrDoDefault;
-}
-
-MsgRouting
AwtTextArea::HandleEvent(MSG *msg, BOOL synthetic)
{
- MsgRouting returnVal;
/*
* RichEdit 1.0 control starts internal message loop if the
* left mouse button is pressed while the cursor is not over
@@ -486,26 +302,6 @@
}
delete msg;
return mrConsume;
- } else if (msg->message == WM_RBUTTONUP ||
- (msg->message == WM_SYSKEYDOWN && msg->wParam == VK_F10 &&
- HIBYTE(::GetKeyState(VK_SHIFT)))) {
- POINT p;
- if (msg->message == WM_RBUTTONUP) {
- VERIFY(::GetCursorPos(&p));
- } else {
- p.x = -1;
- p.y = -1;
- }
-
- if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
- MAKELPARAM(p.x, p.y))) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- JNU_ThrowInternalError(env, "Message not posted, native event queue may be full.");
- env->ExceptionDescribe();
- env->ExceptionClear();
- }
- delete msg;
- return mrConsume;
} else if (msg->message == WM_MOUSEWHEEL) {
// 4417236: If there is an old version of RichEd32.dll which
// does not provide the mouse wheel scrolling we have to
@@ -596,15 +392,7 @@
// 4417236: end of fix
}
- /*
- * Store the 'synthetic' parameter so that the WM_PASTE security check
- * happens only for synthetic events.
- */
- m_synthetic = synthetic;
- returnVal = AwtComponent::HandleEvent(msg, synthetic);
- m_synthetic = FALSE;
-
- return returnVal;
+ return AwtTextComponent::HandleEvent(msg, synthetic);
}
diff -r 523b32b699be -r 3265941b1b6c src/windows/native/sun/windows/awt_TextArea.h
--- a/src/windows/native/sun/windows/awt_TextArea.h Tue Oct 07 12:52:31 2014 -0700
+++ b/src/windows/native/sun/windows/awt_TextArea.h Wed Oct 15 10:06:55 2014 -0700
@@ -57,17 +57,11 @@
static size_t GetALength(JNIEnv* env, jstring jStr, size_t maxlen);
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam);
MsgRouting WmEnable(BOOL fEnabled);
- MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
- MsgRouting WmNotify(UINT notifyCode);
MsgRouting WmNcHitTest(UINT x, UINT y, LRESULT &retVal);
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
- INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
-
virtual BOOL InheritsNativeMouseWheelBehavior();
virtual void Reshape(int x, int y, int w, int h);
@@ -81,22 +75,7 @@
protected:
void EditSetSel(CHARRANGE &cr);
- void EditGetSel(CHARRANGE &cr);
private:
- // RichEdit 1.0 control generates EN_CHANGE notifications not only
- // on text changes, but also on any character formatting change.
- // This flag is true when the latter case is detected.
- BOOL m_bIgnoreEnChange;
-
- // RichEdit 1.0 control undoes a character formatting change
- // if it is the latest. We don't create our own undo buffer,
- // but just prohibit undo in case if the latest operation
- // is a formatting change.
- BOOL m_bCanUndo;
-
- HWND m_hEditCtrl;
- static WNDPROC sm_pDefWindowProc;
-
LONG m_lHDeltaAccum;
LONG m_lVDeltaAccum;
diff -r 523b32b699be -r 3265941b1b6c src/windows/native/sun/windows/awt_TextComponent.cpp
--- a/src/windows/native/sun/windows/awt_TextComponent.cpp Tue Oct 07 12:52:31 2014 -0700
+++ b/src/windows/native/sun/windows/awt_TextComponent.cpp Wed Oct 15 10:06:55 2014 -0700
@@ -66,6 +66,8 @@
m_lLastPos = -1;
m_isLFonly = FALSE;
m_EOLchecked = FALSE;
+ m_hEditCtrl = NULL;
+ m_bIgnoreEnChange = FALSE;
// javaEventsMask = 0; // accessibility support
}
@@ -213,6 +215,16 @@
return c;
}
+void AwtTextComponent::Dispose()
+{
+ if (m_hEditCtrl != NULL) {
+ VERIFY(::DestroyWindow(m_hEditCtrl));
+ m_hEditCtrl = NULL;
+ }
+ AwtComponent::Dispose();
+}
+
+
LRESULT
AwtTextComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
@@ -322,7 +334,16 @@
AwtTextComponent::WmNotify(UINT notifyCode)
{
if (notifyCode == EN_CHANGE) {
- DoCallback("valueChanged", "()V");
+ /*
+ * Ignore notifications if the text hasn't been changed.
+ * EN_CHANGE sent on character formatting changes as well.
+ */
+ if (m_bIgnoreEnChange == FALSE) {
+ m_bCanUndo = TRUE;
+ DoCallback("valueChanged", "()V");
+ } else {
+ m_bCanUndo = FALSE;
+ }
}
return mrDoDefault;
}
@@ -337,6 +358,28 @@
{
MsgRouting returnVal;
+ if (msg->message == WM_RBUTTONUP ||
+ (msg->message == WM_SYSKEYDOWN && msg->wParam == VK_F10 &&
+ HIBYTE(::GetKeyState(VK_SHIFT)))) {
+ POINT p;
+ if (msg->message == WM_RBUTTONUP) {
+ VERIFY(::GetCursorPos(&p));
+ } else {
+ p.x = -1;
+ p.y = -1;
+ }
+
+ if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
+ MAKELPARAM(p.x, p.y))) {
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ JNU_ThrowInternalError(env, "Message not posted, native event queue may be full.");
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ }
+ delete msg;
+ return mrConsume;
+ }
+
/*
* Store the 'synthetic' parameter so that the WM_PASTE security check
* happens only for synthetic events.
@@ -701,6 +744,10 @@
SendMessage(EM_SETBKGNDCOLOR, (WPARAM)FALSE, (LPARAM)GetBackgroundColor());
}
+void AwtTextComponent::EditGetSel(CHARRANGE &cr) {
+ SendMessage(EM_EXGETSEL, 0, reinterpret_cast(&cr));
+}
+
/************************************************************************
* WTextComponentPeer native methods
@@ -982,6 +1029,161 @@
}
+/*
+ * This routine is a window procedure for the subclass of the standard edit control
+ * used to generate context menu. RichEdit controls don't have built-in context menu.
+ * To implement this functionality we have to create an invisible edit control and
+ * forward WM_CONTEXTMENU messages from a RichEdit control to this helper edit control.
+ * While the edit control context menu is active we intercept the message generated in
+ * response to particular item selection and forward it back to the RichEdit control.
+ * (See AwtTextArea::WmContextMenu for more details).
+ */
+
+WNDPROC AwtTextComponent::sm_pDefWindowProc = NULL;
+
+LRESULT
+AwtTextComponent::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
+
+ static BOOL bContextMenuActive = FALSE;
+
+ LRESULT retValue = 0;
+ MsgRouting mr = mrDoDefault;
+
+ DASSERT(::IsWindow(::GetParent(hWnd)));
+
+ switch (message) {
+ case WM_UNDO:
+ case WM_CUT:
+ case WM_COPY:
+ case WM_PASTE:
+ case WM_CLEAR:
+ case EM_SETSEL:
+ if (bContextMenuActive) {
+ ::SendMessage(::GetParent(hWnd), message, wParam, lParam);
+ mr = mrConsume;
+ }
+ break;
+ case WM_CONTEXTMENU:
+ bContextMenuActive = TRUE;
+ break;
+ }
+
+ if (mr == mrDoDefault) {
+ DASSERT(sm_pDefWindowProc != NULL);
+ retValue = ::CallWindowProc(sm_pDefWindowProc,
+ hWnd, message, wParam, lParam);
+ }
+
+ if (message == WM_CONTEXTMENU) {
+ bContextMenuActive = FALSE;
+ }
+
+ return retValue;
+}
+
+MsgRouting
+AwtTextComponent::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
+ /* Use the system provided edit control class to generate context menu. */
+ if (m_hEditCtrl == NULL) {
+ DWORD dwStyle = WS_CHILD;
+ DWORD dwExStyle = 0;
+ m_hEditCtrl = ::CreateWindowEx(dwExStyle,
+ L"EDIT",
+ L"TEXT",
+ dwStyle,
+ 0, 0, 0, 0,
+ GetHWnd(),
+ reinterpret_cast(
+ static_cast(
+ CreateControlID())),
+ AwtToolkit::GetInstance().GetModuleHandle(),
+ NULL);
+ DASSERT(m_hEditCtrl != NULL);
+ if (sm_pDefWindowProc == NULL) {
+ sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl,
+ GWLP_WNDPROC);
+ }
+ ::SetLastError(0);
+ INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC,
+ (INT_PTR)AwtTextArea::EditProc);
+ DASSERT(ret != 0 || ::GetLastError() == 0);
+ }
+
+ /*
+ * Tricks on the edit control to ensure that its context menu has
+ * the correct set of enabled items according to the RichEdit state.
+ */
+ ::SetWindowText(m_hEditCtrl, TEXT("TEXT"));
+
+ if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) {
+ /* Enable 'Undo' item. */
+ ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0);
+ }
+
+ {
+ /*
+ * Initial selection for the edit control - (0,1).
+ * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'.
+ */
+ INT nStart = 0;
+ INT nEnd = 1;
+ if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) {
+ /*
+ * RichEdit selection is empty - clear selection of the edit control.
+ * This disables 'Cut', 'Copy' and 'Delete'.
+ */
+ nStart = -1;
+ nEnd = 0;
+ } else {
+
+ CHARRANGE cr;
+ EditGetSel(cr);
+ /* Check if all the text is selected. */
+ if (cr.cpMin == 0) {
+
+ int len = ::GetWindowTextLength(GetHWnd());
+ if (cr.cpMin == 0 && cr.cpMax >= len) {
+ /*
+ * All the text is selected in RichEdit - select all the
+ * text in the edit control. This disables 'Select All'.
+ */
+ nStart = 0;
+ nEnd = -1;
+ }
+ }
+ }
+ ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd);
+ }
+
+ /* Disable 'Paste' item if the RichEdit control is read-only. */
+ ::SendMessage(m_hEditCtrl, EM_SETREADONLY,
+ GetStyle() & ES_READONLY ? TRUE : FALSE, 0);
+
+ POINT p;
+ p.x = xPos;
+ p.y = yPos;
+
+ /*
+ * If the context menu is requested with SHIFT+F10 or VK_APPS key,
+ * we position its top left corner to the center of the RichEdit
+ * client rect.
+ */
+ if (p.x == -1 && p.y == -1) {
+ RECT r;
+ VERIFY(::GetClientRect(GetHWnd(), &r));
+ p.x = (r.left + r.right) / 2;
+ p.y = (r.top + r.bottom) / 2;
+ VERIFY(::ClientToScreen(GetHWnd(), &p));
+ }
+
+ // The context menu steals focus from the proxy.
+ // So, set the focus-restore flag up.
+ SetRestoreFocus(TRUE);
+ ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
+ SetRestoreFocus(FALSE);
+
+ return mrConsume;
+}
//
// Accessibility support
diff -r 523b32b699be -r 3265941b1b6c src/windows/native/sun/windows/awt_TextComponent.h
--- a/src/windows/native/sun/windows/awt_TextComponent.h Tue Oct 07 12:52:31 2014 -0700
+++ b/src/windows/native/sun/windows/awt_TextComponent.h Wed Oct 15 10:06:55 2014 -0700
@@ -48,6 +48,8 @@
static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline);
+ virtual void Dispose();
+
virtual LPCTSTR GetClassName();
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
@@ -84,6 +86,8 @@
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
MsgRouting WmPaste();
+ INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
+
virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
/* To be fully implemented in a future release
@@ -116,11 +120,24 @@
INLINE VOID SetEndSelectionPos(LONG lPos) { m_lEndPos = lPos; }
INLINE VOID SetLastSelectionPos(LONG lPos) { m_lLastPos = lPos; }
+ void EditGetSel(CHARRANGE &cr);
+
// Used to prevent untrusted code from synthesizing a WM_PASTE message
// by posting a -V KeyEvent
BOOL m_synthetic;
LONG EditGetCharFromPos(POINT& pt);
+ // RichEdit 1.0 control generates EN_CHANGE notifications not only
+ // on text changes, but also on any character formatting change.
+ // This flag is true when the latter case is detected.
+ BOOL m_bIgnoreEnChange;
+
+ // RichEdit 1.0 control undoes a character formatting change
+ // if it is the latest. We don't create our own undo buffer,
+ // but just prohibit undo in case if the latest operation
+ // is a formatting change.
+ BOOL m_bCanUndo;
+
/*****************************************************************
* Inner class OleCallback declaration.
*/
@@ -167,6 +184,13 @@
static OleCallback sm_oleCallback;
+ static WNDPROC sm_pDefWindowProc;
+ HWND m_hEditCtrl;
+
+ static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+ MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
+
//
// Accessibility support
//
diff -r 523b32b699be -r 3265941b1b6c src/windows/native/sun/windows/awt_TextField.cpp
--- a/src/windows/native/sun/windows/awt_TextField.cpp Tue Oct 07 12:52:31 2014 -0700
+++ b/src/windows/native/sun/windows/awt_TextField.cpp Wed Oct 15 10:06:55 2014 -0700
@@ -238,13 +238,8 @@
break;
}
}
- /*
- * Store the 'synthetic' parameter so that the WM_PASTE security check
- * happens only for synthetic events.
- */
- m_synthetic = synthetic;
- returnVal = AwtComponent::HandleEvent(msg, synthetic);
- m_synthetic = FALSE;
+
+ returnVal = AwtTextComponent::HandleEvent(msg, synthetic);
if(systemBeeperEnabled){
SystemParametersInfo(SPI_SETBEEP, 1, NULL, 0);
diff -r 523b32b699be -r 3265941b1b6c test/Makefile
--- a/test/Makefile Tue Oct 07 12:52:31 2014 -0700
+++ b/test/Makefile Wed Oct 15 10:06:55 2014 -0700
@@ -557,7 +557,7 @@
# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_security3
jdk_security3: $(call TestDirs, com/sun/security/auth \
- com/sun/security/sasl lib/security \
+ com/sun/security/sasl lib/security javax/net \
javax/security/sasl javax/security/auth/login \
javax/security/auth/PrivateCredentialPermission \
javax/security/auth/Subject \
diff -r 523b32b699be -r 3265941b1b6c test/ProblemList.txt
--- a/test/ProblemList.txt Tue Oct 07 12:52:31 2014 -0700
+++ b/test/ProblemList.txt Wed Oct 15 10:06:55 2014 -0700
@@ -384,9 +384,6 @@
# jdk_tools
-# 6461635
-com/sun/tools/attach/BasicTests.sh generic-all
-
# Filed 6986875
sun/tools/jps/jps-Vvml.sh generic-all
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/AgentSetup.sh
--- a/test/com/sun/tools/attach/AgentSetup.sh Tue Oct 07 12:52:31 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2006, 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.
-#
-
-
-#
-#
-# Agent set - creates Agent.jar, BadAgent.jar and RedefineAgent.jar in ${TESTCLASSES}
-
-$JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/Agent.java "${TESTSRC}"/BadAgent.java "${TESTSRC}"/RedefineAgent.java
-
-$JAR -cfm "${TESTCLASSES}"/Agent.jar "${TESTSRC}"/agent.mf \
- -C "${TESTCLASSES}" Agent.class
-
-$JAR -cfm "${TESTCLASSES}"/BadAgent.jar "${TESTSRC}"/badagent.mf \
- -C "${TESTCLASSES}" BadAgent.class
-
-$JAR -cfm "${TESTCLASSES}"/RedefineAgent.jar "${TESTSRC}"/redefineagent.mf \
- -C "${TESTCLASSES}" RedefineAgent.class
-
-agent="${TESTCLASSES}${FS}Agent.jar"
-badagent="${TESTCLASSES}${FS}BadAgent.jar"
-redefineagent="${TESTCLASSES}${FS}RedefineAgent.jar"
-
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/Application.java
--- a/test/com/sun/tools/attach/Application.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/Application.java Wed Oct 15 10:06:55 2014 -0700
@@ -22,25 +22,39 @@
*/
/*
- *
- *
* A simple "Application" used by the Attach API unit tests. This application is
* launched by the test. It binds to a random port and shuts down when somebody
* connects to that port.
+ * Used port and pid are written both to stdout and to a specified file.
*/
import java.net.Socket;
import java.net.ServerSocket;
+import java.io.PrintWriter;
+import jdk.testlibrary.ProcessTools;
public class Application {
public static void main(String args[]) throws Exception {
// bind to a random port
+ if (args.length < 1) {
+ System.err.println("First argument should be path to output file.");
+ }
+ String outFileName = args[0];
+
ServerSocket ss = new ServerSocket(0);
int port = ss.getLocalPort();
+ int pid = ProcessTools.getProcessId();
- // signal test that we are started - do not remove this line!!
- System.out.println(port);
+ System.out.println("shutdownPort=" + port);
+ System.out.println("pid=" + pid);
System.out.flush();
+ try (PrintWriter writer = new PrintWriter(outFileName)) {
+ writer.println("shutdownPort=" + port);
+ writer.println("pid=" + pid);
+ writer.println("done");
+ writer.flush();
+ }
+
// wait for test harness to connect
Socket s = ss.accept();
s.close();
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/ApplicationSetup.sh
--- a/test/com/sun/tools/attach/ApplicationSetup.sh Tue Oct 07 12:52:31 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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.
-#
-
-
-#
-#
-# Application Setup - creates ${TESTCLASSES}/Application.jar and the following
-# procedures:
-# startApplication - starts target application
-# stopApplication $1 - stops application via TCP shutdown port $1
-
-$JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/Application.java "${TESTSRC}"/Shutdown.java
-$JAR -cfm "${TESTCLASSES}"/Application.jar "${TESTSRC}"/application.mf \
- -C "${TESTCLASSES}" Application.class
-
-OUTPUTFILE=${TESTCLASSES}/Application.out
-rm -f ${OUTPUTFILE}
-
-startApplication()
-{
- # put all output from the app into ${OUTPUTFILE}
- ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 &
- pid="$!"
-
- # MKS creates an intermediate shell to launch ${JAVA} so
- # ${pid} is not the actual pid. We have put in a small sleep
- # to give the intermediate shell process time to launch the
- # "java" process.
- if [ "$OS" = "Windows" ]; then
- sleep 2
- if [ "${isCygwin}" = "true" ] ; then
- realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'`
- else
- realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
- fi
- pid=${realpid}
- fi
-
- echo "Waiting for Application to initialize..."
- attempts=0
- while true; do
- sleep 1
- port=`tail -1 ${OUTPUTFILE} | sed -e 's@\\r@@g' `
- if [ ! -z "$port" ]; then
- # In case of errors wait time for output to be flushed
- sleep 1
- cat ${OUTPUTFILE}
- break
- fi
- attempts=`expr $attempts + 1`
- echo "Waiting $attempts second(s) ..."
- done
- echo "Application is process $pid, shutdown port is $port"
- return $port
-}
-
-stopApplication()
-{
- $JAVA -classpath "${TESTCLASSES}" Shutdown $1
-}
-
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/BasicTests.java
--- a/test/com/sun/tools/attach/BasicTests.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/BasicTests.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,127 +21,223 @@
* questions.
*/
-/*
- *
- *
- * Unit test for Attach API. Attaches to the given VM and performs a number
- * unit tests.
- */
import com.sun.tools.attach.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.IOException;
import java.util.Properties;
import java.util.List;
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+/*
+ * @test
+ * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
+ * @summary Basic unit tests for the VM attach mechanism.
+ * @library /lib/testlibrary
+ * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy RunnerUtil
+ * @run main BasicTests
+ *
+ * This test will perform a number of basic attach tests.
+ */
public class BasicTests {
- public static void main(String args[]) throws Exception {
- String pid = args[0];
- String agent = args[1];
- String badagent = args[2];
- String redefineagent = args[3];
- System.out.println(" - Attaching to application ...");
- VirtualMachine vm = VirtualMachine.attach(pid);
-
- // Test 1 - read the system properties from the target VM and
- // check that property is set
- System.out.println(" - Test: system properties in target VM");
- Properties props = vm.getSystemProperties();
- String value = props.getProperty("attach.test");
- if (value == null || !value.equals("true")) {
- throw new RuntimeException("attach.test property not set");
+ /*
+ * The actual test is in the nested class TestMain.
+ * The responsibility of this class is to:
+ * 1. Build all needed jars.
+ * 2. Start the Application class in a separate process.
+ * 3. Find the pid and shutdown port of the running Application.
+ * 4. Launches the tests in nested class TestMain that will attach to the Application.
+ * 5. Shut down the Application.
+ */
+ public static void main(String args[]) throws Throwable {
+ final String pidFile = "TestsBasic.Application.pid";
+ ProcessThread processThread = null;
+ RunnerUtil.ProcessInfo info = null;
+ try {
+ buildJars();
+ processThread = RunnerUtil.startApplication(pidFile);
+ info = RunnerUtil.readProcessInfo(pidFile);
+ runTests(info.pid);
+ } catch (Throwable t) {
+ System.out.println("TestBasic got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
+ } finally {
+ // Make sure the Application process is stopped.
+ RunnerUtil.stopApplication(info.shutdownPort, processThread);
}
- System.out.println(" - attach.test property set as expected");
+ }
- // Test 1a - read the agent properties from the target VM.
- // By default, the agent property contains "sun.java.command",
- // "sun.jvm.flags", and "sun.jvm.args".
- // Just sanity check - make sure not empty.
- System.out.println(" - Test: agent properties in target VM");
- props = vm.getAgentProperties();
- if (props == null || props.size() == 0) {
- throw new RuntimeException("Agent properties is empty");
- }
- System.out.println(" - agent properties non-empty as expected");
+ /**
+ * Runs the actual tests in nested class TestMain.
+ * The reason for running the tests in a separate process
+ * is that we need to modify the class path.
+ */
+ private static void runTests(int pid) throws Throwable {
+ final String sep = File.separator;
+
+ // Need to add jdk/lib/tools.jar to classpath.
+ String classpath =
+ System.getProperty("test.class.path", "") + File.pathSeparator +
+ System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+ String testClassDir = System.getProperty("test.classes", "") + sep;
+
+ // Argumenta : -classpath cp BasicTests$TestMain pid agent badagent redefineagent
+ String[] args = {
+ "-classpath",
+ classpath,
+ "BasicTests$TestMain",
+ Integer.toString(pid),
+ testClassDir + "Agent.jar",
+ testClassDir + "BadAgent.jar",
+ testClassDir + "RedefineAgent.jar" };
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
- // Test 2 - attempt to load an agent that does not exist
- System.out.println(" - Test: Load an agent that does not exist");
- try {
- vm.loadAgent("SilverBullet.jar");
- } catch (AgentLoadException x) {
- System.out.println(" - AgentLoadException thrown as expected!");
+ /**
+ * Will build all jars needed by the tests.
+ */
+ private static void buildJars() throws Throwable {
+ String[] jars = {"Agent", "BadAgent", "RedefineAgent", "Application" };
+ for (String jar : jars) {
+ buildJar(jar);
}
+ }
- // Test 3 - load an "bad" agent (agentmain throws an exception)
- System.out.println(" - Test: Load a bad agent");
- System.out.println("INFO: This test will cause error messages "
- + "to appear in the application log about SilverBullet.jar "
- + "not being found and an agent failing to start.");
- try {
- vm.loadAgent(badagent);
- throw new RuntimeException(
- "AgentInitializationException not thrown as expected!");
- } catch (AgentInitializationException x) {
- System.out.println(
- " - AgentInitializationException thrown as expected!");
- }
+ /**
+ * Will build a jar with the given name.
+ * Class file and manifest must already exist.
+ * @param jarName Name of the jar.
+ */
+ private static void buildJar(String jarName) throws Throwable {
+ String testClasses = System.getProperty("test.classes", "?");
+ String testSrc = System.getProperty("test.src", "?");
+ String jar = String.format("%s/%s.jar", testClasses, jarName);
+ String manifest = String.format("%s/%s.mf", testSrc, jarName.toLowerCase());
+ String clazz = String.format("%s.class", jarName);
+
+ // Arguments to the jar command has this format:
+ // "-cfm TESTCLASSES/Agent.jar TESTSRC/agent.mf -C TESTCLASSES Agent.class"
+ RunnerUtil.createJar("-cfm", jar, manifest, "-C", testClasses, clazz);
+ }
- // Test 4 - detach from the VM and attempt a load (should throw IOE)
- System.out.println(" - Test: Detach from VM");
- System.out.println("INFO: This test will cause error messages "
- + "to appear in the application log about a BadAgent including "
- + "a RuntimeException and an InvocationTargetException.");
- vm.detach();
- try {
- vm.loadAgent(agent);
- throw new RuntimeException("loadAgent did not throw an exception!!");
- } catch (IOException ioe) {
- System.out.println(" - IOException as expected");
- }
+ /**
+ * This is the actual test. It will attach to the running Application
+ * and perform a number of basic attach tests.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ String pid = args[0];
+ String agent = args[1];
+ String badagent = args[2];
+ String redefineagent = args[3];
+
+ System.out.println(" - Attaching to application ...");
+ VirtualMachine vm = VirtualMachine.attach(pid);
- // Test 5 - functional "end-to-end" test.
- // Create a listener socket. Load Agent.jar into the target VM passing
- // it the port number of our listener. When agent loads it should connect
- // back to the tool.
+ // Test 1 - read the system properties from the target VM and
+ // check that property is set
+ System.out.println(" - Test: system properties in target VM");
+ Properties props = vm.getSystemProperties();
+ String value = props.getProperty("attach.test");
+ if (value == null || !value.equals("true")) {
+ throw new RuntimeException("attach.test property not set");
+ }
+ System.out.println(" - attach.test property set as expected");
- System.out.println(" - Re-attaching to application ...");
- vm = VirtualMachine.attach(pid);
+ // Test 1a - read the agent properties from the target VM.
+ // By default, the agent property contains "sun.java.command",
+ // "sun.jvm.flags", and "sun.jvm.args".
+ // Just sanity check - make sure not empty.
+ System.out.println(" - Test: agent properties in target VM");
+ props = vm.getAgentProperties();
+ if (props == null || props.size() == 0) {
+ throw new RuntimeException("Agent properties is empty");
+ }
+ System.out.println(" - agent properties non-empty as expected");
- System.out.println(" - Test: End-to-end connection with agent");
-
- ServerSocket ss = new ServerSocket(0);
- int port = ss.getLocalPort();
+ // Test 2 - attempt to load an agent that does not exist
+ System.out.println(" - Test: Load an agent that does not exist");
+ try {
+ vm.loadAgent("SilverBullet.jar");
+ } catch (AgentLoadException x) {
+ System.out.println(" - AgentLoadException thrown as expected!");
+ }
- System.out.println(" - Loading Agent.jar into target VM ...");
- vm.loadAgent(agent, Integer.toString(port));
-
- System.out.println(" - Waiting for agent to connect back to tool ...");
- Socket s = ss.accept();
- System.out.println(" - Connected to agent.");
+ // Test 3 - load an "bad" agent (agentmain throws an exception)
+ System.out.println(" - Test: Load a bad agent");
+ System.out.println("INFO: This test will cause error messages "
+ + "to appear in the application log about SilverBullet.jar "
+ + "not being found and an agent failing to start.");
+ try {
+ vm.loadAgent(badagent);
+ throw new RuntimeException(
+ "AgentInitializationException not thrown as expected!");
+ } catch (AgentInitializationException x) {
+ System.out.println(
+ " - AgentInitializationException thrown as expected!");
+ }
- // Test 5b - functional "end-to-end" test.
- // Now with an agent that does redefine.
+ // Test 4 - detach from the VM and attempt a load (should throw IOE)
+ System.out.println(" - Test: Detach from VM");
+ System.out.println("INFO: This test will cause error messages "
+ + "to appear in the application log about a BadAgent including "
+ + "a RuntimeException and an InvocationTargetException.");
+ vm.detach();
+ try {
+ vm.loadAgent(agent);
+ throw new RuntimeException("loadAgent did not throw an exception!!");
+ } catch (IOException ioe) {
+ System.out.println(" - IOException as expected");
+ }
- System.out.println(" - Re-attaching to application ...");
- vm = VirtualMachine.attach(pid);
-
- System.out.println(" - Test: End-to-end connection with RedefineAgent");
+ // Test 5 - functional "end-to-end" test.
+ // Create a listener socket. Load Agent.jar into the target VM passing
+ // it the port number of our listener. When agent loads it should connect
+ // back to the tool.
- ServerSocket ss2 = new ServerSocket(0);
- int port2 = ss2.getLocalPort();
+ System.out.println(" - Re-attaching to application ...");
+ vm = VirtualMachine.attach(pid);
+
+ System.out.println(" - Test: End-to-end connection with agent");
+
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
- System.out.println(" - Loading RedefineAgent.jar into target VM ...");
- vm.loadAgent(redefineagent, Integer.toString(port2));
+ System.out.println(" - Loading Agent.jar into target VM ...");
+ vm.loadAgent(agent, Integer.toString(port));
+
+ System.out.println(" - Waiting for agent to connect back to tool ...");
+ Socket s = ss.accept();
+ System.out.println(" - Connected to agent.");
+
+ // Test 5b - functional "end-to-end" test.
+ // Now with an agent that does redefine.
- System.out.println(" - Waiting for RedefineAgent to connect back to tool ...");
- Socket s2 = ss2.accept();
- System.out.println(" - Connected to RedefineAgent.");
+ System.out.println(" - Re-attaching to application ...");
+ vm = VirtualMachine.attach(pid);
+
+ System.out.println(" - Test: End-to-end connection with RedefineAgent");
+
+ ServerSocket ss2 = new ServerSocket(0);
+ int port2 = ss2.getLocalPort();
- // Test 6 - list method should list the target VM
- System.out.println(" - Test: VirtualMachine.list");
- List l = VirtualMachine.list();
- if (!l.isEmpty()) {
+ System.out.println(" - Loading RedefineAgent.jar into target VM ...");
+ vm.loadAgent(redefineagent, Integer.toString(port2));
+
+ System.out.println(" - Waiting for RedefineAgent to connect back to tool ...");
+ Socket s2 = ss2.accept();
+ System.out.println(" - Connected to RedefineAgent.");
+
+ // Test 6 - list method should list the target VM
+ System.out.println(" - Test: VirtualMachine.list");
+ List l = VirtualMachine.list();
boolean found = false;
for (VirtualMachineDescriptor vmd: l) {
if (vmd.id().equals(pid)) {
@@ -154,27 +250,26 @@
} else {
throw new RuntimeException(pid + " not found in VM list");
}
- }
- // test 7 - basic hashCode/equals tests
- System.out.println(" - Test: hashCode/equals");
+ // test 7 - basic hashCode/equals tests
+ System.out.println(" - Test: hashCode/equals");
- VirtualMachine vm1 = VirtualMachine.attach(pid);
- VirtualMachine vm2 = VirtualMachine.attach(pid);
- if (!vm1.equals(vm2)) {
- throw new RuntimeException("virtual machines are not equal");
+ VirtualMachine vm1 = VirtualMachine.attach(pid);
+ VirtualMachine vm2 = VirtualMachine.attach(pid);
+ if (!vm1.equals(vm2)) {
+ throw new RuntimeException("virtual machines are not equal");
+ }
+ if (vm.hashCode() != vm.hashCode()) {
+ throw new RuntimeException("virtual machine hashCodes not equal");
+ }
+ System.out.println(" - hashCode/equals okay");
+
+ // ---
+ System.out.println(" - Cleaning up...");
+ s.close();
+ ss.close();
+ s2.close();
+ ss2.close();
}
- if (vm.hashCode() != vm.hashCode()) {
- throw new RuntimeException("virtual machine hashCodes not equal");
- }
- System.out.println(" - hashCode/equals okay");
-
-
- // ---
- System.out.println(" - Cleaning up...");
- s.close();
- ss.close();
- s2.close();
- ss2.close();
}
}
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/BasicTests.sh
--- a/test/com/sun/tools/attach/BasicTests.sh Tue Oct 07 12:52:31 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 6173612 6273707 6277253 6335921 6348630 6342019 6381757
-# @summary Basic unit tests for the VM attach mechanism.
-#
-# @build BasicTests
-# @run shell BasicTests.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-# Windows 2000 is a problem here, so we skip it, see 6962615
-osrev=`uname -a`
-if [ "`echo ${osrev} | grep 'CYGWIN[^ ]*-5\.0'`" != "" ] ; then
- echo "Treating as a pass, not testing Windows 2000"
- exit 0
-fi
-if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
- if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
- echo "Treating as a pass, not testing Windows 2000"
- exit 0
- fi
-fi
-
-. ${TESTSRC}/CommonSetup.sh
-. ${TESTSRC}/ApplicationSetup.sh
-. ${TESTSRC}/AgentSetup.sh
-
-startApplication -Dattach.test=true
-# pid = process-id, port = shutdown port
-
-failures=0
-
-echo "Running tests ..."
-
-$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
- BasicTests $pid $agent $badagent $redefineagent 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-stopApplication $port
-
-# Add these info messages to $OUTPUTFILE just in case someone
-# looks at it and wonders about the failures. We have to do
-# this after the application is stopped because it is writing
-# to $OUTPUTFILE.
-(
-echo ""
-echo "INFO: Test 2 will cause error messages about SilverBullet.jar" \
- "and an agent failing to start."
-echo "INFO: Test 3 will cause error messages about BadAgent" \
- "including a RuntimeException and an InvocationTargetException."
-) >> ${OUTPUTFILE}
-
-if [ $failures = 0 ];
- then echo "All tests passed.";
- else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
-fi
-exit $failures
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/CommonSetup.sh
--- a/test/com/sun/tools/attach/CommonSetup.sh Tue Oct 07 12:52:31 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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.
-#
-
-
-#
-#
-# Common setup for the Attach API unit tests. Setups up the following variables:
-#
-# PS - path sep.
-# FS - file sep.
-# JAVA - java cmd.
-# JAVAC - javac cmd.
-# JAR - jar cmd.
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin )
- PS=":"
- FS="/"
- ;;
- Windows* )
- PS=";"
- OS="Windows"
- FS="\\"
- ;;
- CYGWIN* )
- PS=";"
- OS="Windows"
- FS="\\"
- isCygwin=true
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-
-JAVA="${TESTJAVA}/bin/java"
-JAVAC="${TESTJAVA}/bin/javac"
-JAR="${TESTJAVA}/bin/jar"
-
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/PermissionTest.java
--- a/test/com/sun/tools/attach/PermissionTest.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/PermissionTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,39 +21,119 @@
* questions.
*/
-/*
- *
- *
- * Unit test for Attach API - this checks that a SecurityException is thrown as
- * expected.
- */
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.AttachNotSupportedException;
import java.util.Properties;
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+/*
+ * @test
+ * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
+ * @summary Basic unit tests for the VM attach mechanism.
+ * @library /lib/testlibrary
+ * @run build Application Shutdown
+ * @run main PermissionTest
+ *
+ * Unit test for Attach API -
+ * this checks that a SecurityException is thrown as expected.
+ */
public class PermissionTest {
- public static void main(String args[]) throws Exception {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null) {
- throw new RuntimeException("Test configuration error - no security manager set");
- }
- String pid = args[0];
- boolean shouldFail = Boolean.parseBoolean(args[1]);
-
+ /*
+ * The actual test is in the nested class TestMain.
+ * The responsibility of this class is to:
+ * 1. Start the Application class in a separate process.
+ * 2. Find the pid and shutdown port of the running Application.
+ * 3. Run the tests in TstMain that will attach to the Application.
+ * 4. Shut down the Application.
+ */
+ public static void main(String args[]) throws Throwable {
+ final String pidFile ="TestPermission.Application.pid";
+ ProcessThread processThread = null;
+ RunnerUtil.ProcessInfo info = null;
try {
- VirtualMachine.attach(pid).detach();
- if (shouldFail) {
- throw new RuntimeException("SecurityException should be thrown");
+ processThread = RunnerUtil.startApplication(pidFile);
+ info = RunnerUtil.readProcessInfo(pidFile);
+ runTests(info.pid);
+ } catch (Throwable t) {
+ System.out.println("TestPermission got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
+ } finally {
+ // Make sure the Application process is stopped.
+ RunnerUtil.stopApplication(info.shutdownPort, processThread);
+ }
+ }
+
+ /**
+ * Runs the actual test the nested class TestMain.
+ * The test is run in a separate process because we need to add to the classpath.
+ */
+ private static void runTests(int pid) throws Throwable {
+ final String sep = File.separator;
+
+ // Need to add jdk/lib/tools.jar to classpath.
+ String classpath =
+ System.getProperty("test.class.path", "") + File.pathSeparator +
+ System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+ String testSrc = System.getProperty("test.src", "") + sep;
+
+ // Use a policy that will NOT allow attach. Test will verify exception.
+ String[] args = {
+ "-classpath",
+ classpath,
+ "-Djava.security.manager",
+ String.format("-Djava.security.policy=%sjava.policy.deny", testSrc),
+ "PermissionTest$TestMain",
+ Integer.toString(pid),
+ "true" };
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+
+ // Use a policy that will allow attach.
+ args = new String[] {
+ "-classpath",
+ classpath,
+ "-Djava.security.manager",
+ String.format("-Djava.security.policy=%sjava.policy.allow", testSrc),
+ "PermissionTest$TestMain",
+ Integer.toString(pid),
+ "false" };
+ output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ /**
+ * This is the actual test code. It will attach to the Application and verify
+ * that we get a SecurityException when that is expected.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ throw new RuntimeException("Test configuration error - no security manager set");
}
- System.out.println(" - attached to target VM as expected.");
- } catch (Exception x) {
- // AttachNotSupportedException thrown when no providers can be loaded
- if (shouldFail && ((x instanceof AttachNotSupportedException) ||
- (x instanceof SecurityException))) {
- System.out.println(" - exception thrown as expected.");
- } else {
- throw x;
+
+ String pid = args[0];
+ boolean shouldFail = Boolean.parseBoolean(args[1]);
+
+ try {
+ VirtualMachine.attach(pid).detach();
+ if (shouldFail) {
+ throw new RuntimeException("SecurityException should be thrown");
+ }
+ System.out.println(" - attached to target VM as expected.");
+ } catch (Exception x) {
+ // AttachNotSupportedException thrown when no providers can be loaded
+ if (shouldFail && ((x instanceof AttachNotSupportedException) ||
+ (x instanceof SecurityException))) {
+ System.out.println(" - exception thrown as expected.");
+ } else {
+ throw x;
+ }
}
}
}
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/PermissionTests.sh
--- a/test/com/sun/tools/attach/PermissionTests.sh Tue Oct 07 12:52:31 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 6173612
-# @summary Security manager and permission tests for Attach API
-#
-# @build PermissionTest
-# @run shell PermissionTests.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-. ${TESTSRC}/CommonSetup.sh
-. ${TESTSRC}/ApplicationSetup.sh
-
-failures=0
-
-# Start target VM
-startApplication
-# pid = process-id, port = shutdown port
-
-echo "Deny test"
-# deny
-$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}/java.policy.deny \
- PermissionTest $pid true 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# allow
-echo "Allow test"
-$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}/java.policy.allow \
- PermissionTest $pid false 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# Stop target VM
-stopApplication $port
-
-if [ $failures = 0 ];
- then echo "All tests passed.";
- else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
-fi
-exit $failures
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/ProviderTest.java
--- a/test/com/sun/tools/attach/ProviderTest.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/ProviderTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,24 +21,98 @@
* questions.
*/
-/*
- *
- *
- * Unit test for Attach API. Attaches to the given VM and performs a number
- * unit tests.
- */
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessTools;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.spi.AttachProvider;
+/*
+ * @test
+ * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
+ * @summary Basic unit tests for the VM attach mechanism.
+ * @library /lib/testlibrary
+ * @run build SimpleProvider
+ * @run main ProviderTest
+ *
+ * The test will attach and detach to/from the running Application.
+ */
public class ProviderTest {
- public static void main(String args[]) throws Exception {
- // deal with internal builds where classes are loaded from the
- // 'classes' directory rather than rt.jar
- ClassLoader cl = AttachProvider.class.getClassLoader();
- if (cl != ClassLoader.getSystemClassLoader()) {
- System.out.println("Attach API not loaded by system class loader - test skipped");
- return;
+
+ /*
+ * The actual tests are in the nested class TestMain below.
+ * The responsibility of this class is to:
+ * 1. Build the needed jar.
+ * 2. Run tests in ProviderTest.TestMain.
+ */
+ public static void main(String args[]) throws Throwable {
+ try {
+ buildJar();
+ runTests();
+ } catch (Throwable t) {
+ System.out.println("TestProvider got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
}
- VirtualMachine.attach("simple:1234").detach();
+ }
+
+ /**
+ * Runs the actual tests in the nested class TestMain.
+ * We need to run the tests in a separate process,
+ * because we need to add to the classpath.
+ */
+ private static void runTests() throws Throwable {
+ final String sep = File.separator;
+ String testClassPath = System.getProperty("test.class.path", "");
+ String testClasses = System.getProperty("test.classes", "") + sep;
+ String jdkLib = System.getProperty("test.jdk", ".") + sep + "lib" + sep;
+
+ // Need to add SimpleProvider.jar and tools.jar to classpath.
+ String classpath =
+ testClassPath + File.pathSeparator +
+ testClasses + "SimpleProvider.jar" + File.pathSeparator +
+ jdkLib + "tools.jar";
+
+ String[] args = {
+ "-classpath",
+ classpath,
+ "ProviderTest$TestMain" };
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ /**
+ * Will build the SimpleProvider.jar.
+ */
+ private static void buildJar() throws Throwable {
+ final String sep = File.separator;
+ String testClasses = System.getProperty("test.classes", "?") + sep;
+ String testSrc = System.getProperty("test.src", "?") + sep;
+ String serviceDir = "META-INF" + sep + "services" + sep;
+
+ RunnerUtil.createJar(
+ "-cf", testClasses + "SimpleProvider.jar",
+ "-C", testClasses, "SimpleProvider.class",
+ "-C", testClasses, "SimpleVirtualMachine.class",
+ "-C", testSrc,
+ serviceDir + "com.sun.tools.attach.spi.AttachProvider");
+ }
+
+ /**
+ * This is the actual test code that attaches to the running Application.
+ * This class is run in a separate process.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ // deal with internal builds where classes are loaded from the
+ // 'classes' directory rather than rt.jar
+ ClassLoader cl = AttachProvider.class.getClassLoader();
+ if (cl != ClassLoader.getSystemClassLoader()) {
+ System.out.println("Attach API not loaded by system class loader - test skipped");
+ return;
+ }
+ VirtualMachine.attach("simple:1234").detach();
+ }
}
}
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/ProviderTests.sh
--- a/test/com/sun/tools/attach/ProviderTests.sh Tue Oct 07 12:52:31 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 6173612
-# @summary AttachProvider unit tests
-#
-# @build ProviderTest SimpleProvider
-# @run shell ProviderTests.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-. ${TESTSRC}/CommonSetup.sh
-
-echo "Creating JAR file ..."
-
-$JAR -cf ${TESTCLASSES}/SimpleProvider.jar \
- -C ${TESTCLASSES} SimpleProvider.class \
- -C ${TESTCLASSES} SimpleVirtualMachine.class \
- -C "${TESTSRC}" META-INF/services/com.sun.tools.attach.spi.AttachProvider
-
-echo "Running test ..."
-
-$JAVA -classpath \
- "${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar" \
- ProviderTest
-
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/RedefineAgent.java
--- a/test/com/sun/tools/attach/RedefineAgent.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/RedefineAgent.java Wed Oct 15 10:06:55 2014 -0700
@@ -43,15 +43,15 @@
public class RedefineAgent implements ClassFileTransformer {
static byte[] classfilebytes;
- static final String targetName = "java.math.BigInteger";
- static final String targetNameSlashes = "java/math/BigInteger";
+ static final String targetName = "RedefineDummy";
+ static final String targetNameSlashes = "RedefineDummy";
static boolean gotRedefineTransform = false;
// test transform and capture class bytes for redefine
public byte[] transform(ClassLoader loader,
String className,
Class> classBeingRedefined,
- ProtectionDomain protectionDomain,
+ ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
if (className.equals(targetNameSlashes)) {
if (classBeingRedefined == null) {
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/RedefineDummy.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/tools/attach/RedefineDummy.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Simple dummy class used to test class retransform.
+ */
+public class RedefineDummy {
+ public String toString() {
+ return "RedefineDummy";
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/RunnerUtil.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/tools/attach/RunnerUtil.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.File;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.Utils;
+import jdk.testlibrary.ProcessThread;
+
+/*
+ * Utility functions for test runners.
+ * (Test runner = class that launch a test)
+ */
+public class RunnerUtil {
+
+ /**
+ * The Application process must be run concurrently with our tests since
+ * the tests will attach to the Application.
+ * We will run the Application process in a separate thread.
+ *
+ * The Application must be started with flag "-Xshare:off" for the Retransform
+ * test in TestBasics to pass on all platforms.
+ *
+ * The Application will write its pid and shutdownPort in the given outFile.
+ */
+ public static ProcessThread startApplication(String outFile, String... additionalOpts) throws Throwable {
+ String classpath = System.getProperty("test.class.path", ".");
+ String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application", outFile });
+ String[] args = Utils.addTestJavaOpts(myArgs);
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
+ ProcessThread pt = new ProcessThread("runApplication", pb);
+ pt.start();
+ return pt;
+ }
+
+ public static String[] concat(String[] a, String[] b) {
+ if (a == null) {
+ return b;
+ }
+ if (b == null) {
+ return a;
+ }
+ int aLen = a.length;
+ int bLen = b.length;
+ String[] c = new String[aLen + bLen];
+ System.arraycopy(a, 0, c, 0, aLen);
+ System.arraycopy(b, 0, c, aLen, bLen);
+ return c;
+ }
+
+ /**
+ * Will stop the running Application.
+ * First tries to shutdown nicely by connecting to the shut down port.
+ * If that fails, the process will be killed hard with stopProcess().
+ *
+ * If the nice shutdown fails, then an Exception is thrown and the test should fail.
+ *
+ * @param port The shut down port.
+ * @param processThread The process to stop.
+ */
+ public static void stopApplication(int port, ProcessThread processThread) throws Throwable {
+ if (processThread == null) {
+ System.out.println("RunnerUtil.stopApplication ignored since proc is null");
+ return;
+ }
+ try {
+ System.out.println("RunnerUtil.stopApplication waiting to for shutdown");
+ OutputAnalyzer output = ProcessTools.executeTestJvm(
+ "-classpath",
+ System.getProperty("test.class.path", "."),
+ "Shutdown",
+ Integer.toString(port));
+ // Verify that both the Shutdown command and the Application finished ok.
+ output.shouldHaveExitValue(0);
+ processThread.joinAndThrow();
+ processThread.getOutput().shouldHaveExitValue(0);
+ } catch (Throwable t) {
+ System.out.println("RunnerUtil.stopApplication failed. Will kill it hard: " + t);
+ processThread.stopProcess();
+ throw t;
+ }
+ }
+
+ /**
+ * Creates a jar file.
+ * @param args Command to the jar tool.
+ */
+ public static void createJar(String... args) {
+ System.out.println("Running: jar " + Arrays.toString(args));
+ sun.tools.jar.Main jar = new sun.tools.jar.Main(System.out, System.err, "jar");
+ if (!jar.run(args)) {
+ throw new RuntimeException("jar failed: args=" + Arrays.toString(args));
+ }
+ }
+
+ /**
+ * Read process info for the running Application.
+ * The Application writes its info to a file with this format:
+ * shutdownPort=42994
+ * pid=19597
+ * done
+ *
+ * The final "done" is used to make sure the complete file has been written
+ * before we try to read it.
+ * This function will wait until the file is available.
+ *
+ * @param filename Path to file to read.
+ * @return The ProcessInfo containing pid and shutdownPort.
+ */
+ public static ProcessInfo readProcessInfo(String filename) throws Throwable {
+ System.out.println("Reading port and pid from file: " + filename);
+ File file = new File(filename);
+ String content = null;
+
+ // Read file or wait for it to be created.
+ while (true) {
+ content = readFile(file);
+ if (content != null && content.indexOf("done") >= 0) {
+ break;
+ }
+ Thread.sleep(100);
+ }
+
+ ProcessInfo info = new ProcessInfo();
+ // search for a line with format: key=nnn
+ Pattern pattern = Pattern.compile("(\\w*)=([0-9]+)\\r?\\n");
+ Matcher matcher = pattern.matcher(content);
+ while (matcher.find()) {
+ String key = matcher.group(1);
+ int value = Integer.parseInt(matcher.group(2));
+ if ("pid".equals(key)) {
+ info.pid = value;
+ } else if ("shutdownPort".equals(key)) {
+ info.shutdownPort = value;
+ }
+ }
+ System.out.println("processInfo.pid:" + info.pid);
+ System.out.println("processInfo.shutdownPort:" + info.shutdownPort);
+ return info;
+ }
+
+ /**
+ * Read the content of a file.
+ * @param file The file to read.
+ * @return The file content or null if file does not exists.
+ */
+ public static String readFile(File file) throws IOException {
+ if (!file.exists()) {
+ return null;
+ }
+ try {
+ byte[] bytes = Files.readAllBytes(file.toPath());
+ String content = new String(bytes);
+ return content;
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ /**
+ * Helper class with info of the running Application.
+ */
+ public static class ProcessInfo {
+ public int pid = -1;
+ public int shutdownPort = -1;
+ }
+
+}
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/TempDirTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/tools/attach/TempDirTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,169 @@
+/*
+ * 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 com.sun.tools.attach.*;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Properties;
+import java.util.List;
+import java.io.File;
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+
+/*
+ * @test
+ * @bug 8033104
+ * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
+ * @library /lib/testlibrary
+ * @run build Application Shutdown RunnerUtil
+ * @run main/timeout=10 TempDirTest
+ */
+
+public class TempDirTest {
+
+ public static void main(String args[]) throws Throwable {
+
+ Path clientTmpDir = Files.createTempDirectory("TempDirTest-client");
+ clientTmpDir.toFile().deleteOnExit();
+ Path targetTmpDir = Files.createTempDirectory("TempDirTest-target");
+ targetTmpDir.toFile().deleteOnExit();
+
+ // run the test with all possible combinations of setting java.io.tmpdir
+ runExperiment(null, null);
+ runExperiment(clientTmpDir, null);
+ runExperiment(clientTmpDir, targetTmpDir);
+ runExperiment(null, targetTmpDir);
+
+ }
+
+ private static int counter = 0;
+
+ /*
+ * The actual test is in the nested class TestMain.
+ * The responsibility of this class is to:
+ * 1. Start the Application class in a separate process.
+ * 2. Find the pid and shutdown port of the running Application.
+ * 3. Launches the tests in nested class TestMain that will attach to the Application.
+ * 4. Shut down the Application.
+ */
+ public static void runExperiment(Path clientTmpDir, Path targetTmpDir) throws Throwable {
+
+ System.out.print("### Running tests with overridden tmpdir for");
+ System.out.print(" client: " + (clientTmpDir == null ? "no" : "yes"));
+ System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes"));
+ System.out.println(" ###");
+
+ final String pidFile = "TempDirTest.Application.pid-" + counter++;
+ ProcessThread processThread = null;
+ RunnerUtil.ProcessInfo info = null;
+ try {
+ String[] tmpDirArg = null;
+ if (targetTmpDir != null) {
+ tmpDirArg = new String[] {"-Djava.io.tmpdir=" + targetTmpDir};
+ }
+ processThread = RunnerUtil.startApplication(pidFile, tmpDirArg);
+ info = RunnerUtil.readProcessInfo(pidFile);
+ launchTests(info.pid, clientTmpDir);
+ } catch (Throwable t) {
+ System.out.println("TempDirTest got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
+ } finally {
+ // Make sure the Application process is stopped.
+ RunnerUtil.stopApplication(info.shutdownPort, processThread);
+ }
+ }
+
+ /**
+ * Runs the actual tests in nested class TestMain.
+ * The reason for running the tests in a separate process
+ * is that we need to modify the class path and
+ * the -Djava.io.tmpdir property.
+ */
+ private static void launchTests(int pid, Path clientTmpDir) throws Throwable {
+ final String sep = File.separator;
+
+ // Need to add jdk/lib/tools.jar to classpath.
+ String classpath =
+ System.getProperty("test.class.path", "") + File.pathSeparator +
+ System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+
+ String[] tmpDirArg = null;
+ if (clientTmpDir != null) {
+ tmpDirArg = new String [] {"-Djava.io.tmpdir=" + clientTmpDir};
+ }
+
+ // Arguments : [-Djava.io.tmpdir=] -classpath cp TempDirTest$TestMain pid
+ String[] args = RunnerUtil.concat(
+ tmpDirArg,
+ new String[] {
+ "-classpath",
+ classpath,
+ "TempDirTest$TestMain",
+ Integer.toString(pid) });
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ /**
+ * This is the actual test. It will attach to the running Application
+ * and perform a number of basic attach tests.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ String pid = args[0];
+
+ // Test 1 - list method should list the target VM
+ System.out.println(" - Test: VirtualMachine.list");
+ List l = VirtualMachine.list();
+ boolean found = false;
+ for (VirtualMachineDescriptor vmd: l) {
+ if (vmd.id().equals(pid)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ System.out.println(" - " + pid + " found.");
+ } else {
+ throw new RuntimeException(pid + " not found in VM list");
+ }
+
+ // Test 2 - try to attach and verify connection
+
+ System.out.println(" - Attaching to application ...");
+ VirtualMachine vm = VirtualMachine.attach(pid);
+
+ System.out.println(" - Test: system properties in target VM");
+ Properties props = vm.getSystemProperties();
+ String value = props.getProperty("attach.test");
+ if (value == null || !value.equals("true")) {
+ throw new RuntimeException("attach.test property not set");
+ }
+ System.out.println(" - attach.test property set as expected");
+ }
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/java.policy.allow
--- a/test/com/sun/tools/attach/java.policy.allow Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/java.policy.allow Wed Oct 15 10:06:55 2014 -0700
@@ -13,7 +13,6 @@
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmstat.monitor";
permission java.lang.RuntimePermission "loadLibrary.attach";
permission java.util.PropertyPermission "sun.jvmstat.*", "read";
- permission java.util.PropertyPermission "java.io.tmpdir", "read";
/* to read configuration file in META-INF/services, and write/delete .attach_pid */
permission java.io.FilePermission "<>", "read,write,delete";
diff -r 523b32b699be -r 3265941b1b6c test/com/sun/tools/attach/java.policy.deny
--- a/test/com/sun/tools/attach/java.policy.deny Tue Oct 07 12:52:31 2014 -0700
+++ b/test/com/sun/tools/attach/java.policy.deny Wed Oct 15 10:06:55 2014 -0700
@@ -11,7 +11,6 @@
permission java.lang.RuntimePermission "accessClassInPackage.sun.tools.attach";
permission java.lang.RuntimePermission "loadLibrary.attach";
permission java.util.PropertyPermission "sun.jvmstat.*", "read";
- permission java.util.PropertyPermission "java.io.tmpdir", "read";
/* to read configuration file in META-INF/services, and write/delete .attach_pid */
permission java.io.FilePermission "<>", "read,write,delete";
diff -r 523b32b699be -r 3265941b1b6c test/java/awt/MouseInfo/JContainerMousePositionTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/MouseInfo/JContainerMousePositionTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @summary unit test for a new method in Container class: getMousePosition(boolean)
+ @author dav@sparc.spb.su: area=
+ @bug 4009555
+ @run main JContainerMousePositionTest
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.atomic.AtomicReference;
+
+// this test looks at mouse pointer when it
+// 1 over component
+// 2 over Container, but not over one of its child Components.
+// out of bounds of Container
+// two values of paramater allowChildren are considered.
+
+public class JContainerMousePositionTest {
+ //Declare things used in the test, like buttons and labels here
+ private static JButton jButton1;
+ private static JButton jButton4;
+ private static JFrame frame1;
+ private static Container contentPane;
+
+ public static void main(final String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(200);
+ robot.setAutoWaitForIdle(true);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ JContainerMousePositionTest.init();
+ }
+ });
+
+ robot.delay(500);
+ robot.waitForIdle();
+
+ final AtomicReference centerC4 = new AtomicReference<>();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ centerC4.set(jButton4.getLocation());
+ contentPane.remove(jButton4);
+ contentPane.validate();
+ contentPane.repaint();
+ }
+ });
+ robot.waitForIdle();
+
+ final AtomicReference frameBounds = new AtomicReference<>();
+ final AtomicReference button1Size = new AtomicReference<>();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frameBounds.set(frame1.getBounds());
+ button1Size.set(jButton1.getSize());
+ }
+ });
+
+//point mouse to center of top-left Component (button1)
+ robot.mouseMove(frameBounds.get().x + button1Size.get().width / 2,
+ frameBounds.get().y + button1Size.get().height / 2);
+
+ final AtomicReference pFalse = new AtomicReference<>();
+ final AtomicReference pTrue = new AtomicReference<>();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ pFalse.set(frame1.getMousePosition(false));
+ pTrue.set(frame1.getMousePosition(true));
+ }
+ });
+ robot.waitForIdle();
+ if (pFalse.get() != null) {
+ throw new RuntimeException("Test failed: Container.getMousePosition(false) returned non-null over one of children.");
+ }
+ System.out.println("Test stage completed: Container.getMousePosition(false) returned null result over child Component. Passed.");
+
+ if (pTrue.get() == null) {
+ throw new RuntimeException("Test failed: Container.getMousePosition(true) returned null result over child Component");
+ }
+ System.out.println("Test stage compelted: Container.getMousePosition(true) returned non-null result over child Component. Passed.");
+
+//point mouse out from Container's area
+ robot.mouseMove(frameBounds.get().x + frameBounds.get().width + 10,
+ frameBounds.get().y + frameBounds.get().height + 10);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ pFalse.set(frame1.getMousePosition(false));
+ pTrue.set(frame1.getMousePosition(true));
+ }
+ });
+ robot.waitForIdle();
+ if (pFalse.get() != null || pTrue.get() != null) {
+ throw new RuntimeException("Test failed: Container.getMousePosition(boolean) returned incorrect result outside Container");
+ }
+ System.out.println("Test stage completed: Container.getMousePosition(boolean) returned null result outside Container. Passed.");
+
+//point mouse in place free from child components (right-botton component)
+ robot.mouseMove(frameBounds.get().x + centerC4.get().x,
+ frameBounds.get().y + centerC4.get().y);
+
+ robot.delay(3000);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ pFalse.set(contentPane.getMousePosition(false));
+ pTrue.set(frame1.getMousePosition(true));
+ }
+ });
+ robot.waitForIdle();
+
+ if (pFalse.get() == null || pTrue.get() == null) {
+ throw new RuntimeException("Test failed: Container.getMousePosition(boolean) returned null result inside Container.");
+ }
+ System.out.println("Test stage completed: Container.getMousePosition(boolean) returned non-null results inside Container. Passed.");
+
+ if (pTrue.get().x != centerC4.get().x || pTrue.get().y != centerC4.get().y) {
+ throw new RuntimeException("Test failed: Container.getMousePosition(true) returned incorrect result inside Container.");
+ }
+ System.out.println("Test stage completed: Container.getMousePosition(true) returned correct result inside Container. Passed.");
+
+ System.out.println("TEST PASSED");
+ }
+
+ private static void init() {
+ frame1 = new JFrame("Testing getMousePosition() on LWs");
+ jButton1 = new JButton("C1");
+ jButton4 = new JButton("C4");
+ contentPane = frame1.getContentPane();
+ contentPane.setLayout(new GridLayout(2, 2, 25, 25));
+ contentPane.add(jButton1);
+ contentPane.add(new JButton("C2"));
+ contentPane.add(new JButton("C3"));
+ contentPane.add(jButton4);
+ frame1.setSize(200, 200);
+ frame1.setVisible(true);
+ }
+}
+
+
diff -r 523b32b699be -r 3265941b1b6c test/java/net/InetAddress/IPv4Formats.java
--- a/test/java/net/InetAddress/IPv4Formats.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/java/net/InetAddress/IPv4Formats.java Wed Oct 15 10:06:55 2014 -0700
@@ -27,6 +27,7 @@
* @summary InetAddress.getByName behaves differently on windows
*/
import java.net.*;
+import java.util.UUID;
public class IPv4Formats {
public static void main(String[] args) {
@@ -36,7 +37,7 @@
{"126.1", "126.0.0.1"},
{"128.50.65534", "128.50.255.254"},
{"192.168.1.2", "192.168.1.2"},
- {"hello.foo.bar", null},
+ {"invalidhost.invalid", null},
{"1024.1.2.3", null},
{"128.14.66000", null }
};
diff -r 523b32b699be -r 3265941b1b6c test/java/util/Currency/ValidateISO4217.java
--- a/test/java/util/Currency/ValidateISO4217.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/java/util/Currency/ValidateISO4217.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
*/
/*
* @test
- * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203
+ * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
* @summary Validate ISO 4217 data for Currency class.
*/
@@ -92,7 +92,7 @@
/* Codes that are obsolete, do not have related country */
static final String otherCodes =
- "ADP-AFA-ATS-AYM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-NLG-PTE-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZWD-ZWN-ZWR";
+ "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZMK-ZWD-ZWN-ZWR";
static boolean err = false;
diff -r 523b32b699be -r 3265941b1b6c test/java/util/Currency/tablea1.txt
--- a/test/java/util/Currency/tablea1.txt Tue Oct 07 12:52:31 2014 -0700
+++ b/test/java/util/Currency/tablea1.txt Wed Oct 15 10:06:55 2014 -0700
@@ -1,12 +1,12 @@
#
#
-# Based on BSi's ISO4217 data - "TABLE A1.doc" + amendments up until MA151.doc
-# (As of 7 April 2011)
+# Amendments up until ISO 4217 AMENDMENT NUMBER 159
+# (As of 15 August 2014)
#
# Version
FILEVERSION=1
-DATAVERSION=151
+DATAVERSION=159
# ISO 4217 currency data
AF AFN 971 2
@@ -23,7 +23,7 @@
AU AUD 36 2
AT EUR 978 2
# MA 129
-AZ AZM 31 2 2005-12-31-20-00-00 AZN 944 2
+AZ AZN 944 2
BS BSD 44 2
BH BHD 48 3
BD BDT 50 2
@@ -96,7 +96,7 @@
GM GMD 270 2
GE GEL 981 2
DE EUR 978 2
-GH GHC 288 2 2007-07-01-00-00-00 GHS 936 2
+GH GHS 936 2
GI GIP 292 2
GR EUR 978 2
GL DKK 208 2
@@ -135,14 +135,14 @@
KW KWD 414 3
KG KGS 417 2
LA LAK 418 2
-LV LVL 428 2
+LV LVL 428 2 2013-12-31-22-00-00 EUR 978 2
LB LBP 422 2
#LS ZAR 710 2
LS LSL 426 2
LR LRD 430 2
LY LYD 434 3
LI CHF 756 2
-LT LTL 440 2
+LT LTL 440 2 2014-12-31-22-00-00 EUR 978 2
LU EUR 978 2
MO MOP 446 2
MK MKD 807 2
@@ -166,7 +166,7 @@
MS XCD 951 2
MA MAD 504 2
# MA 130
-MZ MZM 508 2 2006-06-30-22-00-00 MZN 943 2
+MZ MZN 943 2
MM MMK 104 2
# MA 134
ME EUR 978 2
@@ -200,7 +200,7 @@
PR USD 840 2
QA QAR 634 2
RE EUR 978 2
-RO ROL 946 2 2005-06-30-21-00-00 RON 946 2
+RO RON 946 2
RU RUB 643 2
RW RWF 646 0
SH SHP 654 2
@@ -227,6 +227,7 @@
SB SBD 90 2
SO SOS 706 2
ZA ZAR 710 2
+SS SSP 728 2
ES EUR 978 2
LK LKR 144 2
SD SDG 938 2
@@ -255,7 +256,7 @@
TM TMT 934 2
TC USD 840 2
TV AUD 36 2
-UG UGX 800 2
+UG UGX 800 0
UA UAH 980 2
AE AED 784 2
GB GBP 826 2
@@ -266,14 +267,14 @@
UY UYU 858 2
UZ UZS 860 2
VU VUV 548 0
-VE VEB 862 2 2008-01-01-04-00-00 VEF 937 2
-VN VND 704 2
+VE VEF 937 2
+VN VND 704 0
VG USD 840 2
VI USD 840 2
WF XPF 953 0
EH MAD 504 2
YE YER 886 2
-ZM ZMK 894 2
+ZM ZMW 967 2
ZW ZWL 932 2
#XAU XAU 959
#XBA XBA 955
diff -r 523b32b699be -r 3265941b1b6c test/java/util/Locale/LocaleTest.java
--- a/test/java/util/Locale/LocaleTest.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/java/util/Locale/LocaleTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -25,7 +25,7 @@
* @bug 4052404 4052440 4084688 4092475 4101316 4105828 4107014 4107953 4110613
* 4118587 4118595 4122371 4126371 4126880 4135316 4135752 4139504 4139940 4143951
* 4147315 4147317 4147552 4335196 4778440 4940539 5010672 6475525 6544471 6627549
- * 6786276 7066203
+ * 6786276 7066203 7085757
* @summary test Locales
*/
/*
@@ -440,8 +440,8 @@
String[] spotCheck2 = { "US", "CA", "GB", "FR", "DE", "IT", "JP", "KR", "CN", "TW", "TH" };
- if (test.length != 249)
- errln("Expected getISOCountries to return 249 countries; it returned " + test.length);
+ if (test.length != 250)
+ errln("Expected getISOCountries to return 250 countries; it returned " + test.length);
else {
for (int i = 0; i < spotCheck2.length; i++) {
int j;
diff -r 523b32b699be -r 3265941b1b6c test/javax/net/ssl/TLSv12/ProtocolFilter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv12/ProtocolFilter.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,318 @@
+/*
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8052406
+ * @summary SSLv2Hello protocol may be filter out unexpectedly
+ * @run main/othervm ProtocolFilter
+ */
+
+import java.io.*;
+import java.net.*;
+import javax.net.ssl.*;
+
+public class ProtocolFilter {
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = false;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String pathToStores = "../../../../sun/security/ssl/etc";
+ static String keyStoreFile = "keystore";
+ static String trustStoreFile = "truststore";
+ static String passwd = "passphrase";
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ /*
+ * If the client or server is doing some kind of object creation
+ * that the other side depends on, and that thread prematurely
+ * exits, you may experience a hang. The test harness will
+ * terminate all hung threads after its timeout has expired,
+ * currently 3 minutes by default, but you might try to be
+ * smart about it....
+ */
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLServerSocketFactory sslssf =
+ (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
+ SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+ // Only enable cipher suites for TLS v1.2.
+ sslServerSocket.setEnabledCipherSuites(
+ new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA256"});
+
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream();
+
+ sslIS.read();
+ sslOS.write(85);
+ sslOS.flush();
+
+ sslSocket.close();
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ SSLSocketFactory sslsf =
+ (SSLSocketFactory) SSLSocketFactory.getDefault();
+ SSLSocket sslSocket = (SSLSocket)
+ sslsf.createSocket("localhost", serverPort);
+
+ // Enable all supported protocols, including SSLv2Hello.
+ sslSocket.setEnabledProtocols(sslSocket.getSupportedProtocols());
+
+ String[] ciphers = sslSocket.getSupportedCipherSuites();
+ sslSocket.setEnabledCipherSuites(ciphers);
+
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream();
+
+ sslOS.write(280);
+ sslOS.flush();
+ sslIS.read();
+
+ sslSocket.close();
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ public static void main(String[] args) throws Exception {
+ String keyFilename =
+ System.getProperty("test.src", ".") + "/" + pathToStores +
+ "/" + keyStoreFile;
+ String trustFilename =
+ System.getProperty("test.src", ".") + "/" + pathToStores +
+ "/" + trustStoreFile;
+
+ System.setProperty("javax.net.ssl.keyStore", keyFilename);
+ System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+ System.setProperty("javax.net.ssl.trustStore", trustFilename);
+ System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new ProtocolFilter();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ ProtocolFilter() throws Exception {
+ Exception startException = null;
+ try {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+ } catch (Exception e) {
+ startException = e;
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ if (serverThread != null) {
+ serverThread.join();
+ }
+ } else {
+ if (clientThread != null) {
+ clientThread.join();
+ }
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ * Which side threw the error?
+ */
+ Exception local;
+ Exception remote;
+
+ if (separateServerThread) {
+ remote = serverException;
+ local = clientException;
+ } else {
+ remote = clientException;
+ local = serverException;
+ }
+
+ Exception exception = null;
+
+ /*
+ * Check various exception conditions.
+ */
+ if ((local != null) && (remote != null)) {
+ // If both failed, return the curthread's exception.
+ local.initCause(remote);
+ exception = local;
+ } else if (local != null) {
+ exception = local;
+ } else if (remote != null) {
+ exception = remote;
+ } else if (startException != null) {
+ exception = startException;
+ }
+
+ /*
+ * If there was an exception *AND* a startException,
+ * output it.
+ */
+ if (exception != null) {
+ if (exception != startException && startException != null) {
+ exception.addSuppressed(startException);
+ }
+ throw exception;
+ }
+
+ // Fall-through: no exception to throw!
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ serverException = e;
+ } finally {
+ serverReady = true;
+ }
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ clientException = e;
+ }
+ }
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/javax/swing/JRadioButton/8033699/bug8033699.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JRadioButton/8033699/bug8033699.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,255 @@
+/*
+ * 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
+ * @library ../../regtesthelpers
+ * @build Util
+ * @bug 8033699
+ * @summary Incorrect radio button behavior when pressing tab key
+ * @author Vivi An
+ * @run main bug8033699
+ */
+
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import sun.awt.SunToolkit;
+
+public class bug8033699 {
+ private static Robot robot;
+ private static SunToolkit toolkit;
+
+ private static JButton btnStart;
+ private static ButtonGroup btnGrp;
+ private static JButton btnEnd;
+ private static JButton btnMiddle;
+ private static JRadioButton radioBtn1;
+ private static JRadioButton radioBtn2;
+ private static JRadioButton radioBtn3;
+ private static JRadioButton radioBtnSingle;
+
+ public static void main(String args[]) throws Throwable {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ robot = new Robot();
+ Thread.sleep(100);
+
+ robot.setAutoDelay(100);
+ toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+ // tab key test grouped radio button
+ runTest1();
+
+ // tab key test non-grouped radio button
+ runTest2();
+
+ // shift tab key test grouped and non grouped radio button
+ runTest3();
+
+ // left/up key test in grouped radio button
+ runTest4();
+
+ // down/right key test in grouped radio button
+ runTest5();
+
+ // tab from radio button in group to next component in the middle of button group layout
+ runTest6();
+
+ // tab to radio button in group from component in the middle of button group layout
+ runTest7();
+
+ // down key circle back to first button in grouped radio button
+ runTest8();
+ }
+
+ private static void createAndShowGUI() {
+ JFrame mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons");
+
+ btnStart = new JButton("Start");
+ btnEnd = new JButton("End");
+ btnMiddle = new JButton("Middle");
+
+ JPanel box = new JPanel();
+ box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
+ box.setBorder(BorderFactory.createTitledBorder("Grouped Radio Buttons"));
+ radioBtn1 = new JRadioButton("A");
+ radioBtn2 = new JRadioButton("B");
+ radioBtn3 = new JRadioButton("C");
+
+ ButtonGroup btnGrp = new ButtonGroup();
+ btnGrp.add(radioBtn1);
+ btnGrp.add(radioBtn2);
+ btnGrp.add(radioBtn3);
+ radioBtn1.setSelected(true);
+
+ box.add(radioBtn1);
+ box.add(radioBtn2);
+ box.add(btnMiddle);
+ box.add(radioBtn3);
+
+ radioBtnSingle = new JRadioButton("Not Grouped");
+ radioBtnSingle.setSelected(true);
+
+ mainFrame.getContentPane().add(btnStart);
+ mainFrame.getContentPane().add(box);
+ mainFrame.getContentPane().add(radioBtnSingle);
+ mainFrame.getContentPane().add(btnEnd);
+
+ mainFrame.getRootPane().setDefaultButton(btnStart);
+ btnStart.requestFocus();
+
+ mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ mainFrame.setLayout(new BoxLayout(mainFrame.getContentPane(), BoxLayout.Y_AXIS));
+
+ mainFrame.setSize(300, 300);
+ mainFrame.setLocation(200, 200);
+ mainFrame.setVisible(true);
+ mainFrame.toFront();
+ }
+
+ // Radio button Group as a single component when traversing through tab key
+ private static void runTest1() throws Exception{
+ hitKey(robot, KeyEvent.VK_TAB);
+ hitKey(robot, KeyEvent.VK_TAB);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
+ System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
+ throw new RuntimeException("Focus is not on Radio Button Single as Expected");
+ }
+ }
+ });
+ }
+
+ // Non-Grouped Radio button as a single component when traversing through tab key
+ private static void runTest2() throws Exception{
+ hitKey(robot, KeyEvent.VK_TAB);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) {
+ System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed");
+ throw new RuntimeException("Focus is not on Button End as Expected");
+ }
+ }
+ });
+ }
+
+ // Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key
+ private static void runTest3() throws Exception{
+ hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
+ hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+ System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
+ throw new RuntimeException("Focus is not on Radio Button C as Expected");
+ }
+ }
+ });
+ }
+
+ // Using arrow key to move focus in radio button group
+ private static void runTest4() throws Exception{
+ hitKey(robot, KeyEvent.VK_UP);
+ hitKey(robot, KeyEvent.VK_LEFT);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
+ System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
+ throw new RuntimeException("Focus is not on Radio Button A as Expected");
+ }
+ }
+ });
+ }
+
+ private static void runTest5() throws Exception{
+ hitKey(robot, KeyEvent.VK_DOWN);
+ hitKey(robot, KeyEvent.VK_RIGHT);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+ System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
+ throw new RuntimeException("Focus is not on Radio Button C as Expected");
+ }
+ }
+ });
+ }
+
+ private static void runTest6() throws Exception{
+ hitKey(robot, KeyEvent.VK_DOWN);
+ hitKey(robot, KeyEvent.VK_DOWN);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
+ System.out.println("Radio button Group Circle Back To First Button Test");
+ throw new RuntimeException("Focus is not on Radio Button A as Expected");
+ }
+ }
+ });
+ }
+
+ private static void runTest7() throws Exception{
+ hitKey(robot, KeyEvent.VK_TAB);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) {
+ System.out.println("Separate Component added in button group layout");
+ throw new RuntimeException("Focus is not on Middle Button as Expected");
+ }
+ }
+ });
+ }
+
+ private static void runTest8() throws Exception{
+ hitKey(robot, KeyEvent.VK_TAB);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+ System.out.println("Separate Component added in button group layout");
+ throw new RuntimeException("Focus is not on Radio Button C as Expected");
+ }
+ }
+ });
+ }
+
+ private static void hitKey(Robot robot, int keycode) {
+ robot.keyPress(keycode);
+ robot.keyRelease(keycode);
+ toolkit.realSync();
+ }
+
+ private static void hitKey(Robot robot, int mode, int keycode) {
+ robot.keyPress(mode);
+ robot.keyPress(keycode);
+ robot.keyRelease(mode);
+ robot.keyRelease(keycode);
+ toolkit.realSync();
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,109 @@
+/*
+ * 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 8058120
+ * @summary Rendering / caret errors with HTMLDocument
+ * @author Dmitry Markov
+ * @run main bug8058120
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.text.Element;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.awt.*;
+
+public class bug8058120 {
+ private static SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ private static HTMLDocument document = null;
+ private static final String text = "ab
";
+ private static final String textToInsert = "c";
+
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ document.insertAfterEnd(document.getElement("ab"), textToInsert);
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ Element parent = document.getElement("ab").getParentElement();
+ int count = parent.getElementCount();
+ if (count != 2) {
+ throw new RuntimeException("Test Failed! Unexpected Element count = "+count);
+ }
+ Element insertedElement = parent.getElement(count - 1);
+ if (!HTML.Tag.IMPLIED.toString().equals(insertedElement.getName())) {
+ throw new RuntimeException("Test Failed! Inserted text is not wrapped by " + HTML.Tag.IMPLIED + " tag");
+ }
+ }
+ });
+ }
+
+ private static void createAndShowGUI() {
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+
+ JFrame frame = new JFrame("bug8058120");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ JEditorPane editorPane = new JEditorPane();
+ editorPane.setContentType("text/html");
+ editorPane.setEditorKit(new HTMLEditorKit());
+
+ document = (HTMLDocument) editorPane.getDocument();
+
+ editorPane.setText(text);
+
+ frame.add(editorPane);
+ frame.setSize(200, 200);
+ frame.setVisible(true);
+ }
+}
+
+
diff -r 523b32b699be -r 3265941b1b6c test/javax/xml/ws/xsanymixed/CopyingResponse.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/xsanymixed/CopyingResponse.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,35 @@
+/*
+ * 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 org.somewhere.ws.EchoRequest;
+import org.somewhere.ws.EchoResponse;
+
+public class CopyingResponse extends EchoResponse {
+
+ public CopyingResponse() {}
+
+ public CopyingResponse(EchoRequest request) {
+ content = request.getContent();
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/javax/xml/ws/xsanymixed/ServiceImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/xsanymixed/ServiceImpl.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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 org.somewhere.ws.EchoRequest;
+import org.somewhere.ws.EchoResponse;
+import org.somewhere.ws.TestPort;
+
+import java.util.ArrayList;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+
+
+/**
+ * Simple Webservice implementation just copying xml part as is
+ * from incoming request into outgoing response
+ */
+@WebService(
+ endpointInterface = "org.somewhere.ws.TestPort",
+ targetNamespace = "http://ws.somewhere.org/",
+ serviceName = "TestService",
+ portName = "TestPort")
+public class ServiceImpl implements TestPort {
+
+ public static final QName PORT_NAME = new QName("http://ws.somewhere.org/", "TestPort");
+ public static final QName SERVICE_NAME = new QName("http://ws.somewhere.org/", "TestService");
+
+ @Override
+ public EchoResponse echo(EchoRequest request) {
+ System.err.println( "request.getContent="+(ArrayList)(request.getContent()));
+ return new CopyingResponse(request);
+ }
+
+}
diff -r 523b32b699be -r 3265941b1b6c test/javax/xml/ws/xsanymixed/Test.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/xsanymixed/Test.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,197 @@
+/*
+ * 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 8036981 8038966 8051441
+ * @summary the content of xs:any content:mixed should remain as is,
+ * no white space changes and no changes to namespace prefixes
+ * @run shell compile-wsdl.sh
+ * @run main/othervm Test
+ */
+
+import com.sun.net.httpserver.HttpServer;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.nio.file.FileVisitResult;
+import static java.nio.file.FileVisitResult.CONTINUE;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+
+public class Test {
+
+ private static HttpServer httpServer;
+ private static Endpoint endpoint;
+ private static final String NL = System.getProperty("line.separator");
+
+ private static final String XS_ANY_MIXED_PART =
+ "" + NL +
+ " " + NL + NL +
+ "" + NL + NL +
+ " any" + NL +
+ " white" + NL +
+ " space" + NL + NL +
+ " ... and" + NL + NL +
+ " NO namespace prefixes!!!" + NL + NL +
+ " " + NL + NL +
+ " " + NL +
+ " " + NL +
+ " ";
+
+ private static final String XML_REQUEST = "" +
+ "" +
+ "" + NL +
+ XS_ANY_MIXED_PART + NL +
+ " " +
+ " ";
+
+ private static String deployWebservice() throws IOException {
+ // Manually create HttpServer here using ephemeral address for port
+ // so as to not end up with attempt to bind to an in-use port
+ httpServer = HttpServer.create(new InetSocketAddress(0), 0);
+ httpServer.start();
+
+ endpoint = Endpoint.create(new ServiceImpl());
+ endpoint.publish(httpServer.createContext("/wservice"));
+
+ String wsdlAddress = "http://localhost:" + httpServer.getAddress().getPort() + "/wservice?wsdl";
+ log("address = " + wsdlAddress);
+ return wsdlAddress;
+ }
+
+ private static void stopWebservice() {
+ if (endpoint != null && endpoint.isPublished()) {
+ endpoint.stop();
+ }
+ if (httpServer != null) {
+ httpServer.stop(0);
+ }
+ }
+
+ public static void main(String[] args) throws IOException, TransformerException {
+
+ try {
+ String address = deployWebservice();
+ Service service = Service.create(new URL(address), ServiceImpl.SERVICE_NAME);
+
+ log( "PORT="+ServiceImpl.PORT_NAME+" service="+service);
+ Dispatch d = service.createDispatch(ServiceImpl.PORT_NAME, Source.class, Service.Mode.MESSAGE);
+ Source response = d.invoke(new StreamSource(new StringReader(XML_REQUEST)));
+
+ log( "reponse="+response );
+ String resultXml = toString(response);
+
+ log("= request ======== \n");
+ log(XML_REQUEST);
+ log("= result ========= \n");
+ log(resultXml);
+ log("\n==================");
+
+ boolean xsAnyMixedPartSame = resultXml.contains(XS_ANY_MIXED_PART);
+ log("resultXml.contains(XS_ANY_PART) = " + xsAnyMixedPartSame);
+ if (!xsAnyMixedPartSame) {
+ fail("The xs:any content=mixed part is supposed to be same in request and response.");
+ throw new RuntimeException();
+ }
+
+ log("TEST PASSED");
+ } finally {
+ stopWebservice();
+
+ // if you need to debug or explore wsdl generation result
+ // comment this line out:
+ deleteGeneratedFiles();
+ }
+ }
+
+ private static String toString(Source response) throws TransformerException, IOException {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ StreamResult xmlOutput = new StreamResult(new StringWriter());
+ transformer.transform(response, xmlOutput);
+ return xmlOutput.getWriter().toString();
+ }
+
+ private static void fail(String message) {
+ log("TEST FAILED.");
+ throw new RuntimeException(message);
+ }
+
+ private static void log(String msg) {
+ System.out.println(msg);
+ }
+
+ private static void deleteGeneratedFiles() {
+ Path p = Paths.get("..", "classes", "javax", "xml", "ws", "xsanymixed", "org");
+ System.out.println("performing cleanup, deleting wsdl compilation result: " + p.toFile().getAbsolutePath());
+ if (Files.exists(p)) {
+ try {
+ Files.walkFileTree(p, new SimpleFileVisitor() {
+ @Override
+ public FileVisitResult visitFile(
+ Path file,
+ BasicFileAttributes attrs) throws IOException {
+
+ System.out.println("deleting file [" + file.toFile().getAbsoluteFile() + "]");
+ Files.delete(file);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(
+ Path dir,
+ IOException exc) throws IOException {
+
+ System.out.println("deleting dir [" + dir.toFile().getAbsoluteFile() + "]");
+ if (exc == null) {
+ Files.delete(dir);
+ return CONTINUE;
+ } else {
+ throw exc;
+ }
+ }
+ });
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+ }
+
+}
diff -r 523b32b699be -r 3265941b1b6c test/javax/xml/ws/xsanymixed/compile-wsdl.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/xsanymixed/compile-wsdl.sh Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+#
+# 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.
+#
+
+#
+
+if [ "x$TESTJAVA" = x ]; then
+ TESTJAVA=$1; shift
+ TESTCLASSES=.
+fi
+
+echo "compiling [test-service.wsdl] wsdl ..."
+$TESTJAVA/bin/wsimport -keep -d ${TESTCLASSES} ${TESTSRC}/service.wsdl
+
+echo "WSDL compiled. Main test class Test.java can be compiled now."
diff -r 523b32b699be -r 3265941b1b6c test/javax/xml/ws/xsanymixed/service.wsdl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/xsanymixed/service.wsdl Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 523b32b699be -r 3265941b1b6c test/jdk/net/Sockets/Test.java
--- a/test/jdk/net/Sockets/Test.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/jdk/net/Sockets/Test.java Wed Oct 15 10:06:55 2014 -0700
@@ -30,8 +30,10 @@
*/
import java.net.*;
+import java.io.IOException;
import java.nio.channels.*;
import java.util.concurrent.*;
+import java.util.Set;
import jdk.net.*;
public class Test {
@@ -77,6 +79,16 @@
DatagramSocket dg = new DatagramSocket(0);
udp_port = dg.getLocalPort();
+ // If option not available, end test
+ Set> options = Sockets.supportedOptions(
+ DatagramSocket.class
+ );
+
+ if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) {
+ System.out.println("SO_FLOW_SLA not supported");
+ return;
+ }
+
s = new Socket("127.0.0.1", tcp_port);
sc = SocketChannel.open();
sc.connect (new InetSocketAddress("127.0.0.1", tcp_port));
@@ -125,7 +137,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest2() throws Exception {
@@ -138,7 +157,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest3() throws Exception {
@@ -151,7 +177,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest4() throws Exception {
@@ -164,7 +197,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest5() throws Exception {
@@ -179,7 +219,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest6() throws Exception {
@@ -195,7 +242,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest7() throws Exception {
@@ -210,7 +264,14 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
static void doTest8() throws Exception {
@@ -226,6 +287,13 @@
if (success) {
throw new RuntimeException("Test failed");
}
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ System.out.println (e);
+ } catch (IOException e) {
+ // Probably a permission error, but we're not
+ // going to check unless a specific permission exception
+ // is defined.
+ System.out.println (e);
+ }
}
}
diff -r 523b32b699be -r 3265941b1b6c test/sun/awt/datatransfer/DataFlavorComparatorTest1.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/awt/datatransfer/DataFlavorComparatorTest1.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,115 @@
+/*
+ * 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 8058473
+ @summary "Comparison method violates its general contract" when using Clipboard
+ Ensure that DataTransferer.DataFlavorComparator conforms to Comparator contract
+ @author Anton Nashatyrev
+ @run main DataFlavorComparatorTest1
+*/
+import sun.awt.datatransfer.DataTransferer;
+
+import java.awt.datatransfer.DataFlavor;
+import java.util.Comparator;
+
+public class DataFlavorComparatorTest1 {
+
+ public static void main(String[] args) throws Exception {
+ String[] mimes = new String[] {
+ "text/plain",
+ "text/plain; charset=unicode",
+ "text/plain; charset=cp1251",
+ "text/plain; charset=unicode; class=java.io.InputStream",
+ "text/plain; charset=unicode; class=java.io.Serializable",
+ "text/plain; charset=unicode; class=java.lang.Object",
+ "text/plain; class=java.lang.String",
+ "text/plain; class=java.io.Reader",
+ "text/plain; class=java.lang.Object",
+ "text/html",
+ "text/html; charset=unicode",
+ "text/html; charset=cp1251",
+ "text/html; charset=unicode; class=java.io.InputStream",
+ "text/html; charset=unicode; class=java.io.Serializable",
+ "text/html; charset=unicode; class=java.lang.Object",
+ "text/html; class=java.lang.String",
+ "text/html; class=java.io.Reader",
+ "text/html; class=java.lang.Object",
+ "text/unknown",
+ "text/unknown; charset=unicode",
+ "text/unknown; charset=cp1251",
+ "text/unknown; charset=unicode; class=java.io.InputStream",
+ "text/unknown; charset=unicode; class=java.io.Serializable",
+ "text/unknown; charset=unicode; class=java.lang.Object",
+ "text/unknown; class=java.lang.String",
+ "text/unknown; class=java.io.Reader",
+ "text/unknown; class=java.lang.Object",
+ "application/unknown; class=java.io.InputStream",
+ "application/unknown; class=java.lang.Object",
+ "application/unknown",
+ "application/x-java-jvm-local-objectref; class=java.io.InputStream",
+ "application/x-java-jvm-local-objectref; class=java.lang.Object",
+ "application/x-java-jvm-local-objectref",
+ "unknown/flavor",
+ "unknown/flavor; class=java.io.InputStream",
+ "unknown/flavor; class=java.lang.Object",
+ };
+
+ DataFlavor[] flavors = new DataFlavor[mimes.length];
+ for (int i = 0; i < flavors.length; i++) {
+ flavors[i] = new DataFlavor(mimes[i]);
+ }
+
+ testComparator(new DataTransferer.DataFlavorComparator(true), flavors);
+ testComparator(new DataTransferer.DataFlavorComparator(false), flavors);
+
+ }
+
+ private static void testComparator(Comparator cmp, DataFlavor[] flavs)
+ throws ClassNotFoundException {
+
+ for (DataFlavor x: flavs) {
+ for (DataFlavor y: flavs) {
+ if (Math.signum(cmp.compare(x,y)) != -Math.signum(cmp.compare(y,x))) {
+ throw new RuntimeException("Antisymmetry violated: " + x + ", " + y);
+ }
+ if (cmp.compare(x,y) == 0 && !x.equals(y)) {
+ throw new RuntimeException("Equals rule violated: " + x + ", " + y);
+ }
+ for (DataFlavor z: flavs) {
+ if (cmp.compare(x,y) == 0) {
+ if (Math.signum(cmp.compare(x, z)) != Math.signum(cmp.compare(y, z))) {
+ throw new RuntimeException("Transitivity (1) violated: " + x + ", " + y + ", " + z);
+ }
+ } else {
+ if (Math.signum(cmp.compare(x, y)) == Math.signum(cmp.compare(y, z))) {
+ if (Math.signum(cmp.compare(x, y)) != Math.signum(cmp.compare(x, z))) {
+ throw new RuntimeException("Transitivity (2) violated: " + x + ", " + y + ", " + z);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/sun/misc/ProxyGenerator/SaveProxyClassFileTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/misc/ProxyGenerator/SaveProxyClassFileTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,69 @@
+/*
+ * 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 8059563
+ * @summary ProxyGenerator should create intermediate directories
+ * for the generated class file
+ * @build SaveProxyClassFileTest
+ * @run main/othervm -Dsun.misc.ProxyGenerator.saveGeneratedFiles=true SaveProxyClassFileTest
+ */
+
+import java.io.File;
+import sun.misc.ProxyGenerator;
+
+public class SaveProxyClassFileTest {
+
+ static final File dir1 = new File("a");
+ static final File dir2 = new File(dir1, "b");
+ static final File cf = new File(dir2, "c.class");
+
+ public static void main(String[] args) throws Throwable {
+ // remove the files in case they were left from
+ // the previous run
+ deleteFiles();
+
+ try {
+ ProxyGenerator.generateProxyClass("a.b.c",
+ new Class[] {Inf.class});
+
+ if (!cf.exists()) {
+ throw new RuntimeException(cf + " wasn't created");
+ }
+ } finally {
+ deleteFiles();
+ }
+ }
+
+ static interface Inf {
+ }
+
+ /**
+ * Removes generated file and directories
+ */
+ private static void deleteFiles() {
+ cf.delete();
+ dir2.delete();
+ dir1.delete();
+ }
+}
diff -r 523b32b699be -r 3265941b1b6c test/sun/security/krb5/auto/KeyPermissions.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/krb5/auto/KeyPermissions.java Wed Oct 15 10:06:55 2014 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8004488
+ * @summary wrong permissions checked in krb5
+ * @compile -XDignore.symbol.file KeyPermissions.java
+ * @run main/othervm KeyPermissions
+ */
+
+import java.security.AccessControlException;
+import java.security.Permission;
+import javax.security.auth.PrivateCredentialPermission;
+import sun.security.jgss.GSSUtil;
+
+public class KeyPermissions extends SecurityManager {
+
+ @Override
+ public void checkPermission(Permission perm) {
+ if (perm instanceof PrivateCredentialPermission) {
+ if (!perm.getName().startsWith("javax.security.auth.kerberos.")) {
+ throw new AccessControlException(
+ "I don't like this", perm);
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ System.setSecurityManager(new KeyPermissions());
+ new OneKDC(null).writeJAASConf();
+ Context s = Context.fromJAAS("server");
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+ }
+}
+
diff -r 523b32b699be -r 3265941b1b6c test/sun/security/krb5/auto/KeyTabCompat.java
--- a/test/sun/security/krb5/auto/KeyTabCompat.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/sun/security/krb5/auto/KeyTabCompat.java Wed Oct 15 10:06:55 2014 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6894072
+ * @bug 8004488
* @compile -XDignore.symbol.file KeyTabCompat.java
* @run main/othervm KeyTabCompat
* @summary always refresh keytab
@@ -70,21 +71,8 @@
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
s.status();
- if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) {
- throw new Exception("There should be one KerberosKey");
+ if (s.s().getPrivateCredentials(KerberosKey.class).size() != 0) {
+ throw new Exception("There should be no KerberosKey");
}
-
- Thread.sleep(2000); // make sure ktab timestamp is different
-
- kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray());
- kdc.writeKtab(OneKDC.KTAB);
-
- Context.handshake(c, s);
- s.status();
-
- if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) {
- throw new Exception("There should be only one KerberosKey");
}
-
}
-}
diff -r 523b32b699be -r 3265941b1b6c test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineBadBufferArrayAccess.java
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineBadBufferArrayAccess.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineBadBufferArrayAccess.java Wed Oct 15 10:06:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -146,14 +146,14 @@
"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2" };
for (String protocol : protocols) {
- log("Testing " + protocol);
/*
* Run the tests with direct and indirect buffers.
*/
- SSLEngineBadBufferArrayAccess test =
- new SSLEngineBadBufferArrayAccess(protocol);
- test.runTest(true);
- test.runTest(false);
+ log("Testing " + protocol + ":true");
+ new SSLEngineBadBufferArrayAccess(protocol).runTest(true);
+
+ log("Testing " + protocol + ":false");
+ new SSLEngineBadBufferArrayAccess(protocol).runTest(false);
}
System.out.println("Test Passed.");
@@ -287,18 +287,27 @@
if (serverClose) {
serverEngine.closeOutbound();
}
+ }
+
+ if (closed && isEngineClosed(serverEngine)) {
serverIn.flip();
/*
* A sanity check to ensure we got what was sent.
*/
if (serverIn.remaining() != clientMsg.length) {
- throw new Exception("Client: Data length error");
+ throw new Exception("Client: Data length error -" +
+ " IF THIS FAILS, PLEASE REPORT THIS TO THE" +
+ " SECURITY TEAM. WE HAVE BEEN UNABLE TO" +
+ " RELIABLY DUPLICATE.");
}
for (int i = 0; i < clientMsg.length; i++) {
if (clientMsg[i] != serverIn.get()) {
- throw new Exception("Client: Data content error");
+ throw new Exception("Client: Data content error -" +
+ " IF THIS FAILS, PLEASE REPORT THIS TO THE" +
+ " SECURITY TEAM. WE HAVE BEEN UNABLE TO" +
+ " RELIABLY DUPLICATE.");
}
}
serverIn.compact();
diff -r 523b32b699be -r 3265941b1b6c test/sun/text/resources/LocaleData
--- a/test/sun/text/resources/LocaleData Tue Oct 07 12:52:31 2014 -0700
+++ b/test/sun/text/resources/LocaleData Wed Oct 15 10:06:55 2014 -0700
@@ -574,7 +574,6 @@
FormatData/es_PA/NumberElements/0=.
FormatData/es_PA/NumberElements/1=,
FormatData/es_PA/NumberElements/2=;
-CurrencyNames/es_PE/PEN=S/
FormatData/es_PE/NumberPatterns/0=#,##0.###;-#,##0.###
# FormatData/es_PE/NumberPatterns/1=S/#,##0.00;S/-#,##0.00 # Changed; see bug 4122840
FormatData/es_PE/NumberPatterns/2=#,##0%
@@ -7012,3 +7011,25 @@
FormatData/sl/DateTimePatterns/4=EEEE, dd. MMMM y
FormatData/sl/DateTimePatterns/5=dd. MMMM y
+# bug 7085757
+CurrencyNames//SSP=SSP
+CurrencyNames//ssp=South Sudanese Pound
+CurrencyNames//xsu=Sucre
+CurrencyNames//xua=ADB Unit of Account
+LocaleNames//SS=South Sudan
+LocaleNames/en/SS=South Sudan
+
+# bug 7028073
+CurrencyNames/es_PE/PEN=S/.
+
+# bug 7195759
+CurrencyNames//ZMW=ZMW
+
+# bug 8021121
+CurrencyNames/lv_LV/EUR=\u20AC
+
+# bug 6931564
+LocaleNames/sv/ZA=Sydafrika
+
+# bug 8027695
+FormatData/sv_SE/NumberPatterns/2=#,##0 %
diff -r 523b32b699be -r 3265941b1b6c test/sun/text/resources/LocaleDataTest.java
--- a/test/sun/text/resources/LocaleDataTest.java Tue Oct 07 12:52:31 2014 -0700
+++ b/test/sun/text/resources/LocaleDataTest.java Wed Oct 15 10:06:55 2014 -0700
@@ -34,7 +34,7 @@
* 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
* 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7189611
- * 7171028 8013836
+ * 7171028 8013836 7028073 7195759 7085757 6931564 8027695
* @summary Verify locale data
*
*/