diff --git a/jdk/.hgtags b/jdk/.hgtags index 45d75f7ebb5..d73a2f18650 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -150,3 +150,4 @@ ec17fbe5b8fbc52da070eec43b4711d9354b2ab8 jdk8-b25 5aca406e87cb9144a9405be312dadd728a9c6fe2 jdk8-b26 c68342532e2e7deb3a25fc04ed3e4c142278f747 jdk8-b27 1e1d41daaded291ab3a370ca6a27f7325701978e jdk8-b28 +c5b882dce0fe27e05dc64debc92b1fb9ebf880ec jdk8-b29 diff --git a/jdk/make/docs/CORE_PKGS.gmk b/jdk/make/docs/CORE_PKGS.gmk index 84c8986370c..6b5f4af797a 100644 --- a/jdk/make/docs/CORE_PKGS.gmk +++ b/jdk/make/docs/CORE_PKGS.gmk @@ -64,7 +64,7 @@ ACTIVE_JSR_PKGS= \ javax.management.* \ javax.script \ javax.sql.* \ - javax.tools \ + javax.tools.* \ javax.xml.* \ org.w3c.* \ org.xml.sax @@ -218,6 +218,7 @@ CORE_PKGS = \ javax.swing.plaf.nimbus \ javax.swing.plaf.synth \ javax.tools \ + javax.tools.annotation \ javax.transaction \ javax.transaction.xa \ javax.xml.parsers \ diff --git a/jdk/src/share/classes/java/beans/ChangeListenerMap.java b/jdk/src/share/classes/java/beans/ChangeListenerMap.java index e623d9b0df9..fa8be4722f3 100644 --- a/jdk/src/share/classes/java/beans/ChangeListenerMap.java +++ b/jdk/src/share/classes/java/beans/ChangeListenerMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -237,12 +237,5 @@ abstract class ChangeListenerMap { * * @return a real listener */ - public final L extract(L listener) { - while (listener instanceof EventListenerProxy) { - @SuppressWarnings("unchecked") - EventListenerProxy proxy = (EventListenerProxy) listener; - listener = proxy.getListener(); - } - return listener; - } + public abstract L extract(L listener); } diff --git a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java index 1ea326e88c9..c3c73179b1a 100644 --- a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java +++ b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -533,5 +533,15 @@ public class PropertyChangeSupport implements Serializable { protected PropertyChangeListener newProxy(String name, PropertyChangeListener listener) { return new PropertyChangeListenerProxy(name, listener); } + + /** + * {@inheritDoc} + */ + public final PropertyChangeListener extract(PropertyChangeListener listener) { + while (listener instanceof PropertyChangeListenerProxy) { + listener = ((PropertyChangeListenerProxy) listener).getListener(); + } + return listener; + } } } diff --git a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java index 318abd23576..6b7e268eba7 100644 --- a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java +++ b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -522,5 +522,15 @@ public class VetoableChangeSupport implements Serializable { protected VetoableChangeListener newProxy(String name, VetoableChangeListener listener) { return new VetoableChangeListenerProxy(name, listener); } + + /** + * {@inheritDoc} + */ + public final VetoableChangeListener extract(VetoableChangeListener listener) { + while (listener instanceof VetoableChangeListenerProxy) { + listener = ((VetoableChangeListenerProxy) listener).getListener(); + } + return listener; + } } } diff --git a/jdk/src/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/share/classes/java/lang/management/ManagementFactory.java index 98f2e4005cc..20906a1fb46 100644 --- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import javax.management.StandardMBean; import java.util.Collections; import java.util.List; import java.util.Set; -import java.util.TreeSet; +import java.util.HashSet; import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; @@ -787,7 +787,7 @@ public class ManagementFactory { getPlatformManagementInterfaces() { Set> result = - new TreeSet<>(); + new HashSet<>(); for (PlatformComponent component: PlatformComponent.values()) { result.add(component.getMXBeanInterface()); } diff --git a/jdk/src/share/classes/java/util/jar/Manifest.java b/jdk/src/share/classes/java/util/jar/Manifest.java index 49612938ab8..b25165b3345 100644 --- a/jdk/src/share/classes/java/util/jar/Manifest.java +++ b/jdk/src/share/classes/java/util/jar/Manifest.java @@ -400,6 +400,8 @@ public class Manifest implements Cloneable { public byte peek() throws IOException { if (pos == count) fill(); + if (pos == count) + return -1; // nothing left in buffer return buf[pos]; } diff --git a/jdk/src/share/classes/javax/swing/SwingUtilities.java b/jdk/src/share/classes/javax/swing/SwingUtilities.java index 656644424bb..ecbe32e293f 100644 --- a/jdk/src/share/classes/javax/swing/SwingUtilities.java +++ b/jdk/src/share/classes/javax/swing/SwingUtilities.java @@ -792,7 +792,8 @@ public class SwingUtilities implements SwingConstants * @return true if the left mouse button was active */ public static boolean isLeftMouseButton(MouseEvent anEvent) { - return (anEvent.getButton() == MouseEvent.BUTTON1); + return ((anEvent.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0 || + anEvent.getButton() == MouseEvent.BUTTON1); } /** @@ -802,7 +803,8 @@ public class SwingUtilities implements SwingConstants * @return true if the middle mouse button was active */ public static boolean isMiddleMouseButton(MouseEvent anEvent) { - return (anEvent.getButton() == MouseEvent.BUTTON2); + return ((anEvent.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0 || + anEvent.getButton() == MouseEvent.BUTTON2); } /** @@ -812,7 +814,8 @@ public class SwingUtilities implements SwingConstants * @return true if the right mouse button was active */ public static boolean isRightMouseButton(MouseEvent anEvent) { - return (anEvent.getButton() == MouseEvent.BUTTON3); + return ((anEvent.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0 || + anEvent.getButton() == MouseEvent.BUTTON3); } /** diff --git a/jdk/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java b/jdk/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java index fcba7acc85c..9e93bd20b44 100644 --- a/jdk/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java +++ b/jdk/src/share/demo/jfc/TransparentRuler/transparentruler/Ruler.java @@ -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. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,12 +40,9 @@ package transparentruler; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GraphicsDevice; +import java.awt.*; import java.awt.GraphicsDevice.WindowTranslucency; -import java.awt.GraphicsEnvironment; +import static java.awt.GraphicsDevice.WindowTranslucency.*; import java.awt.event.ActionEvent; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; @@ -79,16 +76,32 @@ public class Ruler extends JFrame { private static final int F_HEIGHT = 400; private static final int F_WIDTH = (int) (F_HEIGHT * 1.618 + 0.5); - private static void checkTranslucencyMode(WindowTranslucency arg) { + private static boolean translucencySupported; + private static boolean transparencySupported; + + private static boolean checkTranslucencyMode(WindowTranslucency arg) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); - if (!gd.isWindowTranslucencySupported(arg)) { - System.err.println("'" + arg - + "' translucency mode isn't supported."); - System.exit(-1); - } + return gd.isWindowTranslucencySupported(arg); } + + public Shape buildShape() { + int h = getHeight(); + int w = getWidth(); + float a = (float) Math.hypot(h, w); + Float path = new java.awt.geom.Path2D.Float(); + path.moveTo(0, 0); + path.lineTo(w, 0); + path.lineTo(0, h); + path.closePath(); + path.moveTo(W, W); + path.lineTo(W, h - W * (a + h) / w); + path.lineTo(w - W * (a + w) / h, W); + path.closePath(); + return path; + } + private final ComponentAdapter componentListener = new ComponentAdapter() { /** @@ -97,36 +110,32 @@ public class Ruler extends JFrame { */ @Override public void componentResized(ComponentEvent e) { - int h = getHeight(); - int w = getWidth(); - float a = (float) Math.hypot(h, w); - Float path = new java.awt.geom.Path2D.Float(); - path.moveTo(0, 0); - path.lineTo(w, 0); - path.lineTo(0, h); - path.closePath(); - path.moveTo(W, W); - path.lineTo(W, h - W * (a + h) / w); - path.lineTo(w - W * (a + w) / h, W); - path.closePath(); - setShape(path); + + // We do apply shape only if PERPIXEL_TRANSPARENT is supported + if (transparencySupported) { + setShape(buildShape()); + } } }; + private final Action exitAction = new AbstractAction("Exit") { { putValue(Action.MNEMONIC_KEY, KeyEvent.VK_X); } + @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }; + private final JPopupMenu jPopupMenu = new JPopupMenu(); { jPopupMenu.add(new JMenuItem(exitAction)); } + /** * Implements mouse-related behavior: window dragging and popup menu * invocation @@ -157,6 +166,7 @@ public class Ruler extends JFrame { } } }; + /** * Implements keyboard navigation. Arrows move by 5 pixels, Ctrl + arrows * move by 50 pixels, Alt + arrows move by 1 pixel. @@ -201,10 +211,22 @@ public class Ruler extends JFrame { @Override protected void paintComponent(Graphics g) { - Graphics gg = g.create(); + Graphics2D gg = (Graphics2D) g.create(); int w = getWidth(); int h = getHeight(); int hh = gg.getFontMetrics().getAscent(); + + // This is an approach to apply shape when PERPIXEL_TRANSPARENT + // isn't supported + if (!transparencySupported) { + gg.setBackground(new Color(0, 0, 0, 0)); + gg.clearRect(0, 0, w, h); + gg.clip(buildShape()); + + gg.setBackground(Ruler.this.getBackground()); + gg.clearRect(0, 0, w, h); + } + gg.setColor(FOREGROUND); for (int x = 0; x < w * (h - 8) / h - 5; x += 5) { boolean hi = x % 50 == 0; @@ -216,6 +238,7 @@ public class Ruler extends JFrame { gg.drawString(number, x + 5 - ww / 2, 20 + hh); } } + gg.dispose(); } }); @@ -231,9 +254,17 @@ public class Ruler extends JFrame { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { - checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSLUCENT); - checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSPARENT); + translucencySupported = checkTranslucencyMode(PERPIXEL_TRANSLUCENT); + transparencySupported = checkTranslucencyMode(PERPIXEL_TRANSPARENT); + + if (!translucencySupported) { + System.err.println("This application requires " + + "'PERPIXEL_TRANSLUCENT' translucency mode to " + + "be supported."); + System.exit(-1); + } Ruler ruler = new Ruler(); ruler.setVisible(true); diff --git a/jdk/src/solaris/native/java/util/TimeZone_md.c b/jdk/src/solaris/native/java/util/TimeZone_md.c index 48b3c5260d6..3af5d72657f 100644 --- a/jdk/src/solaris/native/java/util/TimeZone_md.c +++ b/jdk/src/solaris/native/java/util/TimeZone_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -96,9 +96,9 @@ getPathName(const char *dir, const char *name) { /* * Scans the specified directory and its subdirectories to find a * zoneinfo file which has the same content as /etc/localtime on Linux - * or /usr/share/lib/zoneinfo/localtime (most likely a symbolic link) - * on Solaris given in 'buf'. Returns a zone ID if found, otherwise, - * NULL is returned. + * or /usr/share/lib/zoneinfo/localtime on Solaris given in 'buf'. + * If file is symbolic link, then the contents it points to are in buf. + * Returns a zone ID if found, otherwise, NULL is returned. */ static char * findZoneinfoFile(char *buf, size_t size, const char *dir) @@ -280,21 +280,27 @@ getPlatformTimeZoneID() tz = getZoneName(linkbuf); if (tz != NULL) { tz = strdup(tz); + return tz; } - return tz; } /* * If it's a regular file, we need to find out the same zoneinfo file * that has been copied as /etc/localtime. + * If initial symbolic link resolution failed, we should treat target + * file as a regular file. */ + if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) { + return NULL; + } + if (fstat(fd, &statbuf) == -1) { + (void) close(fd); + return NULL; + } size = (size_t) statbuf.st_size; buf = (char *) malloc(size); if (buf == NULL) { - return NULL; - } - if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) { - free((void *) buf); + (void) close(fd); return NULL; } diff --git a/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c b/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c index 6d5337cc398..c37686bf962 100644 --- a/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c +++ b/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c @@ -36,6 +36,7 @@ #include #include "nio_util.h" +#include JNIEXPORT jint JNICALL Java_sun_nio_ch_DatagramDispatcher_read0(JNIEnv *env, jclass clazz, @@ -60,23 +61,14 @@ Java_sun_nio_ch_DatagramDispatcher_readv0(JNIEnv *env, jclass clazz, ssize_t result = 0; struct iovec *iov = (struct iovec *)jlong_to_ptr(address); struct msghdr m; - if (len > 16) { - len = 16; + if (len > IOV_MAX) { + len = IOV_MAX; } - m.msg_name = NULL; - m.msg_namelen = 0; + // initialize the message + memset(&m, 0, sizeof(m)); m.msg_iov = iov; m.msg_iovlen = len; -#ifdef __solaris__ - m.msg_accrights = NULL; - m.msg_accrightslen = 0; -#endif - -#if defined(__linux__) || defined(_ALLBSD_SOURCE) - m.msg_control = NULL; - m.msg_controllen = 0; -#endif result = recvmsg(fd, &m, 0); if (result < 0 && errno == ECONNREFUSED) { @@ -108,23 +100,14 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz, struct iovec *iov = (struct iovec *)jlong_to_ptr(address); struct msghdr m; ssize_t result = 0; - if (len > 16) { - len = 16; + if (len > IOV_MAX) { + len = IOV_MAX; } - m.msg_name = NULL; - m.msg_namelen = 0; + // initialize the message + memset(&m, 0, sizeof(m)); m.msg_iov = iov; m.msg_iovlen = len; -#ifdef __solaris__ - m.msg_accrights = NULL; - m.msg_accrightslen = 0; -#endif - -#if defined(__linux__) || defined(_ALLBSD_SOURCE) - m.msg_control = NULL; - m.msg_controllen = 0; -#endif result = sendmsg(fd, &m, 0); if (result < 0 && errno == ECONNREFUSED) { diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 8c481626a12..70a44d7c466 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -212,7 +212,7 @@ java/io/File/MaxPathLength.java windows-all # 7076644 java/io/File/Basic.java windows-all -# Test needs AWT window server, does not work headless +# 7145435 - Test needs AWT window server, does not work headless java/io/Serializable/resolveClass/deserializeButton/run.sh macosx-all ############################################################################ @@ -225,9 +225,6 @@ java/nio/channels/Selector/Wakeup.java windows-all # 7052549 java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all -# 6963118 -java/nio/channels/Selector/Wakeup.java windows-all - # 7133499, 7133497 java/nio/channels/AsyncCloseAndInterrupt.java macosx-all java/nio/channels/AsynchronousFileChannel/Lock.java macosx-all @@ -259,9 +256,6 @@ java/rmi/registry/readTest/readTest.sh windows-all # jdk_security -# 7145024 -sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java solaris-all - # 7147060 com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java generic-all @@ -305,9 +299,6 @@ sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java generic-all # 7079203 sun/security/tools/keytool/printssl.sh fails on solaris with timeout sun/security/tools/keytool/printssl.sh solaris-all -# 7081817 -sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java generic-all - # 7041639, Solaris DSA keypair generation bug (Note: jdk_util also affected) java/security/KeyPairGenerator/SolarisShortDSA.java solaris-all sun/security/tools/jarsigner/onlymanifest.sh solaris-all diff --git a/jdk/test/java/beans/PropertyChangeSupport/Test7148143.java b/jdk/test/java/beans/PropertyChangeSupport/Test7148143.java new file mode 100644 index 00000000000..3ccf9a43195 --- /dev/null +++ b/jdk/test/java/beans/PropertyChangeSupport/Test7148143.java @@ -0,0 +1,58 @@ +/* + * 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 7148143 + * @summary Tests ClassCastException for the PropertyChangeSupport class + * @author Sergey Malenkov + */ + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.EventListener; +import java.util.EventListenerProxy; + +public class Test7148143 { + + private static class CustomProxy + extends EventListenerProxy + implements PropertyChangeListener { + + public CustomProxy() { + super(new EventListener() { + }); + } + + public void propertyChange(PropertyChangeEvent event) { + } + } + + public static void main(String[] args) { + PropertyChangeListener listener = new CustomProxy(); + PropertyChangeSupport support = new PropertyChangeSupport(listener); + support.addPropertyChangeListener(listener); + support.addPropertyChangeListener("foo", listener); // cast class exception + } +} diff --git a/jdk/test/java/beans/VetoableChangeSupport/Test7148143.java b/jdk/test/java/beans/VetoableChangeSupport/Test7148143.java new file mode 100644 index 00000000000..c44c3215bcb --- /dev/null +++ b/jdk/test/java/beans/VetoableChangeSupport/Test7148143.java @@ -0,0 +1,58 @@ +/* + * 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 7148143 + * @summary Tests ClassCastException for the VetoableChangeSupport class + * @author Sergey Malenkov + */ + +import java.beans.PropertyChangeEvent; +import java.beans.VetoableChangeListener; +import java.beans.VetoableChangeSupport; +import java.util.EventListener; +import java.util.EventListenerProxy; + +public class Test7148143 { + + private static class CustomProxy + extends EventListenerProxy + implements VetoableChangeListener { + + public CustomProxy() { + super(new EventListener() { + }); + } + + public void vetoableChange(PropertyChangeEvent event) { + } + } + + public static void main(String[] args) { + VetoableChangeListener listener = new CustomProxy(); + VetoableChangeSupport support = new VetoableChangeSupport(listener); + support.addVetoableChangeListener(listener); + support.addVetoableChangeListener("foo", listener); // cast class exception + } +} diff --git a/jdk/test/java/io/File/isDirectory/Applet.html b/jdk/test/java/io/File/isDirectory/Applet.html deleted file mode 100644 index 69d57f47250..00000000000 --- a/jdk/test/java/io/File/isDirectory/Applet.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/jdk/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java b/jdk/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java index 39d7702623e..ce78220ee76 100644 --- a/jdk/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java +++ b/jdk/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java @@ -22,7 +22,6 @@ */ /* @test - * @clean A B Container ReplacerObjectOutputStream * @summary Verify that ClassCastException is thrown when deserializing * an object and one of its object fields is incompatibly replaced * by either replaceObject/resolveObject. diff --git a/jdk/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java b/jdk/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java index a7b099d1cee..11b2d6d9f1f 100644 --- a/jdk/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java +++ b/jdk/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java @@ -22,7 +22,6 @@ */ /* @test - * @clean A SubstituteObjectOutputStream SubstituteObjectInputStream * @bug 4099013 * @summary Enable substitution of String and Array by ObjectStreams. */ diff --git a/jdk/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java b/jdk/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java index 1d7e11ec1d6..896900b2d62 100644 --- a/jdk/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java +++ b/jdk/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java @@ -23,7 +23,6 @@ /* @test * @bug 4065313 - * @clean A ReplaceWithNull MyObjectOutputStream * @summary Ensure that it is okay to replace an object with null. */ import java.io.*; diff --git a/jdk/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java b/jdk/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java index c2046fe251b..3e8156b0728 100644 --- a/jdk/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java +++ b/jdk/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java @@ -22,7 +22,6 @@ */ /* @test - * @clean A * @bug 4146453 * @summary Test that regrow of object/handle table of ObjectOutputStream works. */ diff --git a/jdk/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java b/jdk/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java new file mode 100644 index 00000000000..a6aa2c905cd --- /dev/null +++ b/jdk/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java @@ -0,0 +1,76 @@ +/* + * 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 7074616 + * @summary Basic unit test of the + * ManagementFactory.getPlatformManagementInterfaces() method + * @author Frederic Parain + * + * @run main GetPlatformManagementInterfaces + */ + +import java.lang.management.*; +import java.io.IOException; +import java.util.*; +import javax.management.*; + +import static java.lang.management.ManagementFactory.*; + +public class GetPlatformManagementInterfaces { + + private static enum ManagementInterfaces { + CLASS_LOADING_MXBEAN(ClassLoadingMXBean.class), + COMPILATION_MXBEAN(CompilationMXBean.class), + MEMORY_MXBEAN(MemoryMXBean.class), + OPERATING_SYSTEM_MXBEAN(OperatingSystemMXBean.class), + RUNTIME_MXBEAN(RuntimeMXBean.class), + THREAD_MXBEAN(ThreadMXBean.class), + GARBAGE_COLLECTOR_MXBEAN(GarbageCollectorMXBean.class), + MEMORY_MANAGER_MXBEAN(MemoryManagerMXBean.class), + MEMORY_POOL_MXBEAN(MemoryPoolMXBean.class); + + private final Class managementInterface; + private ManagementInterfaces(Class minterface) { + managementInterface = minterface; + } + public Class getManagementInterface() { + return managementInterface; + } + }; + + public static void main(String[] args) { + Set> interfaces = + ManagementFactory.getPlatformManagementInterfaces(); + for(Class pom : interfaces) { + List list = + ManagementFactory.getPlatformMXBeans(pom); + } + for(ManagementInterfaces mi : ManagementInterfaces.values()) { + if(!interfaces.contains(mi.getManagementInterface())) { + throw new RuntimeException(mi.getManagementInterface() + " not in ManagementInterfaces set"); + } + } + } +} diff --git a/jdk/test/java/net/Socks/SocksServer.java b/jdk/test/java/net/Socks/SocksServer.java index de2822ab9a9..f6720afd56d 100644 --- a/jdk/test/java/net/Socks/SocksServer.java +++ b/jdk/test/java/net/Socks/SocksServer.java @@ -22,13 +22,14 @@ */ import java.net.*; import java.io.*; +import java.util.HashMap; public class SocksServer extends Thread { // Some useful SOCKS constant - static final int PROTO_VERS4 = 4; + static final int PROTO_VERS4 = 4; static final int PROTO_VERS = 5; - static final int DEFAULT_PORT = 1080; + static final int DEFAULT_PORT = 1080; static final int NO_AUTH = 0; static final int GSSAPI = 1; @@ -36,28 +37,28 @@ public class SocksServer extends Thread { static final int NO_METHODS = -1; static final int CONNECT = 1; - static final int BIND = 2; + static final int BIND = 2; static final int UDP_ASSOC = 3; - static final int IPV4 = 1; - static final int DOMAIN_NAME = 3; - static final int IPV6 = 4; + static final int IPV4 = 1; + static final int DOMAIN_NAME = 3; + static final int IPV6 = 4; static final int REQUEST_OK = 0; static final int GENERAL_FAILURE = 1; - static final int NOT_ALLOWED = 2; + static final int NOT_ALLOWED = 2; static final int NET_UNREACHABLE = 3; static final int HOST_UNREACHABLE = 4; - static final int CONN_REFUSED = 5; - static final int TTL_EXPIRED = 6; + static final int CONN_REFUSED = 5; + static final int TTL_EXPIRED = 6; static final int CMD_NOT_SUPPORTED = 7; static final int ADDR_TYPE_NOT_SUP = 8; private int port; private ServerSocket server; private boolean useV4 = false; - private java.util.Hashtable users = new java.util.Hashtable(); - private boolean done = false; + private HashMap users = new HashMap<>(); + private volatile boolean done = false; // Inner class to handle protocol with client // This is the bulk of the work (protocol handler) class ClientHandler extends Thread { @@ -136,7 +137,7 @@ public class SocksServer extends Thread { System.err.println("User: '" + uname); System.err.println("PSWD: '" + password); if (users.containsKey(uname)) { - String p1 = (String) users.get(uname); + String p1 = users.get(uname); System.err.println("p1 = " + p1); if (p1.equals(password)) { out.write(PROTO_VERS); @@ -492,7 +493,12 @@ public class SocksServer extends Thread { public SocksServer(int port) throws IOException { this.port = port; server = new ServerSocket(); - server.bind(new InetSocketAddress(port)); + if (port == 0) { + server.bind(null); + this.port = server.getLocalPort(); + } else { + server.bind(new InetSocketAddress(port)); + } } public SocksServer() throws IOException { @@ -503,8 +509,13 @@ public class SocksServer extends Thread { users.put(user, passwd); } - public synchronized void terminate() { + public int getPort() { + return port; + } + + public void terminate() { done = true; + try { server.close(); } catch (IOException unused) {} } public void run() { diff --git a/jdk/test/java/net/Socks/SocksV4Test.java b/jdk/test/java/net/Socks/SocksV4Test.java index 0b7cd9ebcdb..d9786a21789 100644 --- a/jdk/test/java/net/Socks/SocksV4Test.java +++ b/jdk/test/java/net/Socks/SocksV4Test.java @@ -26,23 +26,22 @@ * @bug 4727547 * @summary SocksSocketImpl throws NullPointerException * @build SocksServer + * @run main SocksV4Test */ import java.net.*; -import java.io.*; public class SocksV4Test { - public static void main(String[] args) throws IOException { - // Create a SOCKS V4 proxy on port 8888 - SocksServer srvr = new SocksServer(8888, true); + public static void main(String[] args) throws Exception { + // Create a SOCKS V4 proxy + SocksServer srvr = new SocksServer(0, true); srvr.start(); - System.setProperty("socksProxyHost", "localhost"); - System.setProperty("socksProxyPort", "8888"); + Proxy sp = new Proxy(Proxy.Type.SOCKS, + new InetSocketAddress("localhost", srvr.getPort())); // Let's create an unresolved address InetSocketAddress ad = new InetSocketAddress("doesnt.exist.name", 1234); - Socket s = new Socket(); - try { - s.connect(ad,10000); + try (Socket s = new Socket(sp)) { + s.connect(ad, 10000); } catch (UnknownHostException ex) { // OK, that's what we expected } catch (NullPointerException npe) { @@ -50,7 +49,6 @@ public class SocksV4Test { throw new RuntimeException("Got a NUllPointerException"); } finally { srvr.terminate(); - srvr.interrupt(); } } } diff --git a/jdk/test/java/nio/file/Files/CustomOptions.java b/jdk/test/java/nio/file/Files/CustomOptions.java index a39cc6a6c93..a06b97efd75 100644 --- a/jdk/test/java/nio/file/Files/CustomOptions.java +++ b/jdk/test/java/nio/file/Files/CustomOptions.java @@ -28,6 +28,7 @@ * @author Brandon Passanisi * @library .. * @build CustomOptions PassThroughFileSystem + * @run main CustomOptions */ import java.io.IOException; diff --git a/jdk/test/java/text/Bidi/Bug6850113.java b/jdk/test/java/text/Bidi/Bug6850113.java index 91e07420e09..704615049ce 100644 --- a/jdk/test/java/text/Bidi/Bug6850113.java +++ b/jdk/test/java/text/Bidi/Bug6850113.java @@ -25,6 +25,7 @@ * @bug 6850113 * @summary Verify the return value of digit() for some digits. * @compile -XDignore.symbol.file=true Bug6850113.java + * @run main Bug6850113 */ import sun.text.normalizer.UCharacter; diff --git a/jdk/test/java/util/jar/Manifest/CreateManifest.java b/jdk/test/java/util/jar/Manifest/CreateManifest.java new file mode 100644 index 00000000000..87a2b03b9a0 --- /dev/null +++ b/jdk/test/java/util/jar/Manifest/CreateManifest.java @@ -0,0 +1,301 @@ +/* + * 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 7148584 + * @summary Jar tools fails to generate manifest correctly when boundary condition hit + * @compile -XDignore.symbol.file=true CreateManifest.java + * @run main CreateManifest + */ + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.jar.*; + +public class CreateManifest { + +public static void main(String arg[]) throws Exception { + + String jarFileName = "test.jar"; + String ManifestName = "MANIFEST.MF"; + + // create the MANIFEST.MF file + Files.write(Paths.get(ManifestName), FILE_CONTENTS.getBytes()); + + String [] args = new String [] { "cvfm", jarFileName, ManifestName}; + sun.tools.jar.Main jartool = + new sun.tools.jar.Main(System.out, System.err, "jar"); + jartool.run(args); + + try (JarFile jf = new JarFile(jarFileName)) { + Manifest m = jf.getManifest(); + String result = m.getMainAttributes().getValue("Class-path"); + if (result == null) + throw new RuntimeException("Failed to add Class-path attribute to manifest"); + } finally { + Files.deleteIfExists(Paths.get(jarFileName)); + Files.deleteIfExists(Paths.get(ManifestName)); + } + +} + +private static final String FILE_CONTENTS = + "Class-path: \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-host-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-host-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-security-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-security-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-console-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-console-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-rules-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-rules-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-swlib-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-installmediacomponent-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-host-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-security-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohagent-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohcoherence-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohjrockit-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-extensibility-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mpcustom-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfmonitor-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ocheck-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-udmmig-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-multioms-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ocheck-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-services-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-services-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-services-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-eventmobile-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwkmobile-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-logmgmt-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-omsproperties-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohel-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentupgrade-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-regiontest-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uielements-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uielements-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sandbox-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sandbox-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-adfext-bc-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-aslm-services-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-avail-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-charge-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-config-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-connect-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-db-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-public-entity.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-console-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-rules-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-extens-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-filebrowser-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-filebrowser-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ip-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-job-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-me-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-metric-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-paf-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-security-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-templ-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-entity.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agent-patching-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agent-patching-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-adfext-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agentpatching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-avail-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-charge-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-config-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-connect-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-db-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-extens-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ip-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-job-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-me-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-metric-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-paf-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-security-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-templ-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-groups-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-groups-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-resources-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-patching-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-patching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ohinv-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ohinv-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ppc-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ppc-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agentpush-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwkmobile-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-test.jar \n"; +} diff --git a/jdk/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java b/jdk/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java index 80e44b21da4..520da9d3933 100644 --- a/jdk/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java +++ b/jdk/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java @@ -26,6 +26,7 @@ * @bug 4241676 * @summary getContinuationDirContext() should set CPE environment property. * @build DummyObjectFactory DummyContext + * @run main/othervm GetContDirCtx */ import java.util.Hashtable; diff --git a/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java b/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java new file mode 100644 index 00000000000..aedfdc1f9c1 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/4524490/bug4524490.java @@ -0,0 +1,82 @@ +/* + * 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 4524490 + * @summary Tests if in JFileChooser, ALT+L does not bring focus to 'Files' selection list in Motif LAF + * @library ../../regtesthelpers + * @build Util + * @author Konstantin Eremin + * @run main bug4524490 + */ +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.KeyEvent; +import javax.swing.*; +import sun.awt.OSInfo; +import sun.awt.SunToolkit; + +public class bug4524490 { + + private static JFileChooser fileChooser; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(50); + + UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + fileChooser = new JFileChooser(); + fileChooser.showOpenDialog(null); + } + }); + + toolkit.realSync(); + + if (OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())) { + Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_L); + } else { + Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_L); + } + checkFocus(); + } + + private static void checkFocus() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + JList list = (JList) Util.findSubComponent(fileChooser, "javax.swing.JList"); + System.out.println("list focus: " + list.isFocusOwner()); + if (!list.isFocusOwner()) { + throw new RuntimeException("Focus is not transfered to the Folders list."); + } + } + }); + } +} diff --git a/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java b/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java new file mode 100644 index 00000000000..fc75658fb5f --- /dev/null +++ b/jdk/test/javax/swing/JMenuItem/6209975/bug6209975.java @@ -0,0 +1,172 @@ +/* + * 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 6209975 + * @summary regression: JMenuItem icons overimposed on JMenuItem labels under Metal LAF + * @library ../../regtesthelpers + * @build Util + * @author Alexander Zuev + * @run main bug6209975 + */ +import javax.swing.*; +import java.awt.*; +import java.awt.event.InputEvent; +import sun.awt.SunToolkit; + +public class bug6209975 { + + private static final ReturnObject RO1 = new ReturnObject(); + private static final ReturnObject RO2 = new ReturnObject(); + + private static JMenu menu; + private static JButton button; + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(500); + + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + Point clickPoint = getButtonClickPoint(); + robot.mouseMove(clickPoint.x, clickPoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + + clickPoint = getMenuClickPoint(); + robot.mouseMove(clickPoint.x, clickPoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + + if (RO1.itsValue <= RO2.itsValue) { + throw new RuntimeException("Offset if the second icon is invalid."); + } + } + + private static Point getButtonClickPoint() throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + Point p = button.getLocationOnScreen(); + Dimension size = button.getSize(); + result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2); + } + }); + return result[0]; + } + + private static Point getMenuClickPoint() throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + Point p = menu.getLocationOnScreen(); + Dimension size = menu.getSize(); + result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2); + } + }); + return result[0]; + } + + private static void createAndShowGUI() { + JFrame frame = new JFrame("Test6209975"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); + frame.setLayout(new BorderLayout()); + button = new JButton("Focus holder"); + frame.add(button); + + JMenuBar mb = new JMenuBar(); + menu = new JMenu("File"); + + JMenuItem item; + + item = new JMenuItem("Just a menu item"); + item.setIcon(new MyIcon(RO1)); + item.setHorizontalTextPosition(SwingConstants.LEADING); + menu.add(item); + + item = new JMenuItem("Menu Item with another icon"); + item.setIcon(new MyIcon(RO2)); + item.setHorizontalTextPosition(SwingConstants.TRAILING); + menu.add(item); + + mb.add(menu); + + frame.setJMenuBar(mb); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setLocation(400, 300); + frame.setVisible(true); + } + + public static class ReturnObject { + + public volatile int itsValue; + } + + public static class MyIcon implements Icon { + + ReturnObject thisObject = null; + + public MyIcon(ReturnObject ro) { + super(); + thisObject = ro; + } + + public void paintIcon(Component c, Graphics g, int x, int y) { + Color color = g.getColor(); + g.setColor(Color.BLACK); + g.fillRect(x, y, 10, 10); + g.setColor(color); + thisObject.itsValue = x; + } + + public int getIconWidth() { + return 10; + } + + public int getIconHeight() { + return 10; + } + } +} diff --git a/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java b/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java new file mode 100644 index 00000000000..5b5c2b19049 --- /dev/null +++ b/jdk/test/javax/swing/SwingUtilities/7146377/bug7146377.java @@ -0,0 +1,201 @@ +/* + * 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 7146377 + @summary closed/javax/swing/DataTransfer/4876520/bug4876520.java failed since b08 in jdk 8 + @author Pavel Porvatov +*/ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class bug7146377 { + private static JLabel label; + private static JFrame frame; + + private static volatile Point point; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + + label = new JLabel("A label"); + + label.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + checkEvent(e); + } + + @Override + public void mousePressed(MouseEvent e) { + checkEvent(e); + } + + @Override + public void mouseReleased(MouseEvent e) { + checkEvent(e); + } + + @Override + public void mouseEntered(MouseEvent e) { + checkEvent(e); + } + + @Override + public void mouseExited(MouseEvent e) { + checkEvent(e); + } + }); + + frame.add(label); + frame.setSize(200, 100); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } + }); + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + toolkit.realSync(); + + // On Linux platforms realSync doesn't guaranties setSize completion + Thread.sleep(1000); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + point = label.getLocationOnScreen(); + } + }); + + Robot robot = new Robot(); + + robot.setAutoDelay(200); + + // Move mouse + for (int i = 0; i < 20; i++) { + robot.mouseMove(point.x + i, point.y + i); + } + + for (int button : new int[]{InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}) { + robot.mouseMove(point.x, point.y); + + // Mouse Drag + robot.mousePress(button); + + for (int i = 0; i < 20; i++) { + robot.mouseMove(point.x + i, point.y + i); + } + + robot.mouseRelease(button); + } + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.dispose(); + } + }); + + System.out.println("Test passed"); + } + + private static void checkEvent(MouseEvent e) { + String eventAsStr = eventToString(e); + + System.out.println("Checking event " + eventAsStr); + + check("isLeftMouseButton", SwingUtilities.isLeftMouseButton(e), oldIsLeftMouseButton(e), eventAsStr); + check("isRightMouseButton", SwingUtilities.isRightMouseButton(e), oldIsRightMouseButton(e), eventAsStr); + check("isMiddleMouseButton", SwingUtilities.isMiddleMouseButton(e), oldIsMiddleMouseButton(e), eventAsStr); + } + + private static void check(String methodName, boolean newValue, boolean oldValue, String eventAsStr) { + if (newValue != oldValue) { + throw new RuntimeException("Regression on " + methodName + ", newValue = " + newValue + + ", oldValue = " + oldValue + ", e = " + eventAsStr); + } + } + + private static String eventToString(MouseEvent e) { + StringBuilder result = new StringBuilder(); + + switch (e.getID()) { + case MouseEvent.MOUSE_PRESSED: + result.append("MOUSE_PRESSED"); + break; + case MouseEvent.MOUSE_RELEASED: + result.append("MOUSE_RELEASED"); + break; + case MouseEvent.MOUSE_CLICKED: + result.append("MOUSE_CLICKED"); + break; + case MouseEvent.MOUSE_ENTERED: + result.append("MOUSE_ENTERED"); + break; + case MouseEvent.MOUSE_EXITED: + result.append("MOUSE_EXITED"); + break; + case MouseEvent.MOUSE_MOVED: + result.append("MOUSE_MOVED"); + break; + case MouseEvent.MOUSE_DRAGGED: + result.append("MOUSE_DRAGGED"); + break; + case MouseEvent.MOUSE_WHEEL: + result.append("MOUSE_WHEEL"); + break; + default: + result.append("unknown type"); + } + + result.append(", modifiers = " + MouseEvent.getMouseModifiersText(e.getModifiers())); + result.append(", modifiersEx = " + MouseEvent.getMouseModifiersText(e.getModifiersEx())); + result.append(", button = " + e.getButton()); + + return result.toString(); + } + + // Original implementation of SwingUtilities.isLeftMouseButton + private static boolean oldIsLeftMouseButton(MouseEvent e) { + return ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0); + } + + // Original implementation of SwingUtilities.isMiddleMouseButton + private static boolean oldIsMiddleMouseButton(MouseEvent e) { + return ((e.getModifiers() & InputEvent.BUTTON2_MASK) == InputEvent.BUTTON2_MASK); + } + + // Original implementation of SwingUtilities.isRightMouseButton + private static boolean oldIsRightMouseButton(MouseEvent e) { + return ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK); + } +} diff --git a/jdk/test/sun/misc/Cleaner/exitOnThrow.sh b/jdk/test/sun/misc/Cleaner/exitOnThrow.sh index 355f2671fbb..81daf8ba56e 100644 --- a/jdk/test/sun/misc/Cleaner/exitOnThrow.sh +++ b/jdk/test/sun/misc/Cleaner/exitOnThrow.sh @@ -29,6 +29,7 @@ # @summary Ensure that if a cleaner throws an exception then the VM exits # # @build ExitOnThrow +# @run shell exitOnThrow.sh # Command-line usage: sh exitOnThrow.sh /path/to/build diff --git a/jdk/test/sun/nio/cs/OLD/TestIBMDB.java b/jdk/test/sun/nio/cs/OLD/TestIBMDB.java index 38d4991c859..571bf0c6532 100644 --- a/jdk/test/sun/nio/cs/OLD/TestIBMDB.java +++ b/jdk/test/sun/nio/cs/OLD/TestIBMDB.java @@ -26,6 +26,7 @@ * @bug 6843578 * @summary Test IBM DB charsets * @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD EUC_CN_OLD EUC_KR_OLD GBK_OLD Johab_OLD MS932_OLD MS936_OLD MS949_OLD MS950_OLD + * @run main TestIBMDB */ import java.nio.charset.*; diff --git a/jdk/test/sun/nio/cs/OLD/TestX11CS.java b/jdk/test/sun/nio/cs/OLD/TestX11CS.java deleted file mode 100644 index 52b2ef513e2..00000000000 --- a/jdk/test/sun/nio/cs/OLD/TestX11CS.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 1234567 - * @summary Test updated X11 charsets - * @build X11GB2312_OLD X11GBK_OLD X11KSC5601_OLD - */ - -import java.nio.charset.*; -import java.nio.*; -import java.util.*; - -public class TestX11CS { - - static char[] decode(byte[] bb, Charset cs) - throws Exception { - CharsetDecoder dec = cs.newDecoder(); - ByteBuffer bbf = ByteBuffer.wrap(bb); - CharBuffer cbf = CharBuffer.allocate(bb.length); - CoderResult cr = dec.decode(bbf, cbf, true); - if (cr != CoderResult.UNDERFLOW) { - System.out.println("DEC-----------------"); - int pos = bbf.position(); - System.out.printf(" cr=%s, bbf.pos=%d, bb[pos]=%x,%x,%x,%x%n", - cr.toString(), pos, - bb[pos++]&0xff, bb[pos++]&0xff,bb[pos++]&0xff, bb[pos++]&0xff); - throw new RuntimeException("Decoding err: " + cs.name()); - } - char[] cc = new char[cbf.position()]; - cbf.flip(); cbf.get(cc); - return cc; - - } - - static byte[] encode(char[] cc, Charset cs) - throws Exception { - ByteBuffer bbf = ByteBuffer.allocate(cc.length * 4); - CharBuffer cbf = CharBuffer.wrap(cc); - CharsetEncoder enc = cs.newEncoder(); - - CoderResult cr = enc.encode(cbf, bbf, true); - if (cr != CoderResult.UNDERFLOW) { - System.out.println("ENC-----------------"); - int pos = cbf.position(); - System.out.printf(" cr=%s, cbf.pos=%d, cc[pos]=%x%n", - cr.toString(), pos, cc[pos]&0xffff); - throw new RuntimeException("Encoding err: " + cs.name()); - } - byte[] bb = new byte[bbf.position()]; - bbf.flip(); bbf.get(bb); - return bb; - } - - static char[] getChars(Charset newCS, Charset oldCS) { - CharsetEncoder enc = oldCS.newEncoder(); - CharsetEncoder encNew = newCS.newEncoder(); - char[] cc = new char[0x10000]; - int pos = 0; - int i = 0; - while (i < 0x10000) { - if (enc.canEncode((char)i) != encNew.canEncode((char)i)) { - System.out.printf(" Err i=%x%n", i); - //throw new RuntimeException("canEncode() err!"); - } - if (enc.canEncode((char)i)) { - cc[pos++] = (char)i; - } - i++; - } - return Arrays.copyOf(cc, pos); - } - - static void compare(Charset newCS, Charset oldCS) throws Exception { - System.out.printf(" Diff <%s> <%s>...%n", newCS.name(), oldCS.name()); - char[] cc = getChars(newCS, oldCS); - - byte[] bb1 = encode(cc, newCS); - byte[] bb2 = encode(cc, oldCS); - - if (!Arrays.equals(bb1, bb2)) { - System.out.printf(" encoding failed!%n"); - } - char[] cc1 = decode(bb1, newCS); - char[] cc2 = decode(bb1, oldCS); - if (!Arrays.equals(cc1, cc2)) { - for (int i = 0; i < cc1.length; i++) { - if (cc1[i] != cc2[i]) { - System.out.printf("i=%d, cc1=%x cc2=%x, bb=<%x%x>%n", - i, - cc1[i]&0xffff, cc2[i]&0xffff, - bb1[i*2]&0xff, bb1[i*2+1]&0xff); - } - - } - - System.out.printf(" decoding failed%n"); - } - } - - public static void main(String[] args) throws Exception { - compare(new sun.awt.motif.X11GBK(), - new X11GBK_OLD()); - - compare(new sun.awt.motif.X11GB2312(), - new X11GB2312_OLD()); - - compare(new sun.awt.motif.X11KSC5601(), - new X11KSC5601_OLD()); - - } -} diff --git a/jdk/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java b/jdk/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java index e0530edb678..2bb3b37c7b7 100644 --- a/jdk/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java @@ -27,6 +27,7 @@ * @compile JavaxSSLContextImpl.java ComSSLContextImpl.java * JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java * JavaxKeyManagerFactoryImpl.java ComKeyManagerFactoryImpl.java + * @run main ProviderTest * @summary brokenness in the com.sun.net.ssl.SSLSecurity wrappers */