Mercurial > hg > icedtea8-forest > jdk
changeset 13498:8e0b55064628 icedtea-3.9.0pre02
Merge jdk8u172-b11
line wrap: on
line diff
--- a/.hgtags Sun Aug 19 04:29:53 2018 +0100 +++ b/.hgtags Mon Aug 27 16:38:06 2018 +0100 @@ -924,3 +924,15 @@ 9c9ff65b03b60abb956fa23ee8403a4a7bec7806 icedtea-3.8.0 9c9ff65b03b60abb956fa23ee8403a4a7bec7806 icedtea-3.9.0pre00 d9b0b4bd2526818afa73b60da77403245554caa8 icedtea-3.9.0pre01 +5ccb2d5ec23d188394fdd87bda27b6e53eeb8f0d jdk8u171-b11 +64df143be721d3ef031d765d86277c1e114d627a jdk8u172-b00 +25f7b0cd25cf13106783050fc8e6f4a78487a7bd jdk8u172-b01 +db8272cb8c99eea536a66c4c368c4bf2bf013a81 jdk8u172-b02 +bd24ee3a9a0494121fd1d96c308b9738f585001b jdk8u172-b03 +cf952b84daa1e74403a4d1df541c0ecca830717d jdk8u172-b04 +076daed81c0a851f6d13fac538834ac465cdc122 jdk8u172-b05 +94491d0dc59590535339a2ffae510166bb16f34c jdk8u172-b06 +7e9eeb74e84beb6d8a6f562441eb7dd0ab0befa9 jdk8u172-b07 +3974ec9cd04057a19d02c04f3484d5686d70d21c jdk8u172-b08 +f52ece1d8708024735f06e7e3bdc771efbc073d0 jdk8u172-b09 +9e9009034e5ce97a97f72c00cd37cf2a638fa1a4 jdk8u172-b10
--- a/make/lib/ServiceabilityLibraries.gmk Sun Aug 19 04:29:53 2018 +0100 +++ b/make/lib/ServiceabilityLibraries.gmk Mon Aug 27 16:38:06 2018 +0100 @@ -290,6 +290,10 @@ BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/share/native/sun/management \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management +ifeq ($(OPENJDK_TARGET_OS),aix) + BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/aix/native/sun/management +endif + BUILD_LIBMANAGEMENT_EXCLUDES := BUILD_LIBMANAGEMENT_CFLAGS += -I$(JDK_TOPDIR)/src/share/native/sun/management
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/aix/native/sun/management/AixOperatingSystem.c Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright 2017 SAP SE. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "sun_management_OperatingSystemImpl.h" + +JNIEXPORT jdouble JNICALL +Java_sun_management_OperatingSystemImpl_getSystemCpuLoad +(JNIEnv *env, jobject dummy) +{ + return -1.0; +} + +JNIEXPORT jdouble JNICALL +Java_sun_management_OperatingSystemImpl_getProcessCpuLoad +(JNIEnv *env, jobject dummy) +{ + return -1.0; +}
--- a/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -34,10 +34,11 @@ import sun.awt.CausedFocusEvent; import sun.awt.LightweightFrame; +import sun.awt.OverrideNativeWindowHandle; import sun.swing.JLightweightFrame; import sun.swing.SwingAccessor; -public class LWLightweightFramePeer extends LWWindowPeer { +public class LWLightweightFramePeer extends LWWindowPeer implements OverrideNativeWindowHandle { public LWLightweightFramePeer(LightweightFrame target, PlatformComponent platformComponent, @@ -116,4 +117,16 @@ public void updateCursorImmediately() { SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget()); } + + // SwingNode + private volatile long overriddenWindowHandle = 0L; + + @Override + public void overrideWindowHandle(final long handle) { + this.overriddenWindowHandle = handle; + } + + public long getOverriddenWindowHandle() { + return overriddenWindowHandle; + } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Aug 27 16:38:06 2018 +0100 @@ -46,6 +46,7 @@ import sun.awt.AWTAccessor.WindowAccessor; import sun.java2d.SurfaceData; import sun.java2d.opengl.CGLSurfaceData; +import sun.lwawt.LWLightweightFramePeer; import sun.lwawt.*; import sun.util.logging.PlatformLogger; @@ -584,6 +585,20 @@ if (!isKeyWindow) { CWrapper.NSWindow.makeKeyWindow(ptr); } + + if (owner != null + && owner.getPeer() instanceof LWLightweightFramePeer) { + LWLightweightFramePeer peer = + (LWLightweightFramePeer) owner.getPeer(); + + long ownerWindowPtr = peer.getOverriddenWindowHandle(); + if (ownerWindowPtr != 0) { + //Place window above JavaFX stage + CWrapper.NSWindow.addChildWindow( + ownerWindowPtr, ptr, + CWrapper.NSWindow.NSWindowAbove); + } + } }); } else { execute(ptr->{
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java Mon Aug 27 16:38:06 2018 +0100 @@ -36,6 +36,8 @@ import java.util.EventListener; import java.io.Serializable; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; /** * Motif rendition of the component. @@ -237,11 +239,15 @@ } void forwardEventToParent(MouseEvent e) { - getParent().dispatchEvent(new MouseEvent( + MouseEvent newEvent = new MouseEvent( getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), - e.isPopupTrigger(), MouseEvent.NOBUTTON)); + e.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(e)); + getParent().dispatchEvent(newEvent); } public boolean isFocusTraversable() { @@ -328,10 +334,14 @@ } void forwardEventToParent(MouseEvent e) { - getParent().dispatchEvent(new MouseEvent( + MouseEvent newEvent = new MouseEvent( getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), - e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON )); + e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON ); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(e)); + getParent().dispatchEvent(newEvent); } public boolean isFocusTraversable() {
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java Mon Aug 27 16:38:06 2018 +0100 @@ -37,6 +37,9 @@ import java.beans.VetoableChangeListener; import java.beans.PropertyVetoException; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; + /** * Class that manages a Motif title bar * @@ -356,11 +359,15 @@ } void forwardEventToParent(MouseEvent e) { - getParent().dispatchEvent(new MouseEvent( + MouseEvent newEvent = new MouseEvent( getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), - e.isPopupTrigger(), MouseEvent.NOBUTTON)); + e.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(e)); + getParent().dispatchEvent(newEvent); } public void paintComponent(Graphics g) {
--- a/src/share/classes/java/awt/Component.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/awt/Component.java Mon Aug 27 16:38:06 2018 +0100 @@ -4965,6 +4965,12 @@ tpeer.handleEvent(e); } } + + if (SunToolkit.isTouchKeyboardAutoShowEnabled() && + (toolkit instanceof SunToolkit) && + ((e instanceof MouseEvent) || (e instanceof FocusEvent))) { + ((SunToolkit)toolkit).showOrHideTouchKeyboard(this, e); + } } // dispatchEventImpl() /*
--- a/src/share/classes/java/awt/Container.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/awt/Container.java Mon Aug 27 16:38:06 2018 +0100 @@ -56,6 +56,7 @@ import sun.awt.AppContext; import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; import sun.awt.CausedFocusEvent; import sun.awt.PeerEvent; import sun.awt.SunToolkit; @@ -4777,6 +4778,9 @@ srcEvent.getClickCount(), srcEvent.isPopupTrigger(), srcEvent.getButton()); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(me, + meAccessor.isCausedByTouchEvent(srcEvent)); ((AWTEvent)srcEvent).copyPrivateDataInto(me); // translate coordinates to this native container final Point ptSrcOrigin = srcComponent.getLocationOnScreen(); @@ -4877,6 +4881,9 @@ e.getClickCount(), e.isPopupTrigger(), e.getButton()); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(retargeted, + meAccessor.isCausedByTouchEvent(e)); } ((AWTEvent)e).copyPrivateDataInto(retargeted);
--- a/src/share/classes/java/awt/event/MouseEvent.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/awt/event/MouseEvent.java Mon Aug 27 16:38:06 2018 +0100 @@ -33,6 +33,8 @@ import java.io.ObjectInputStream; import java.awt.IllegalComponentStateException; import java.awt.MouseInfo; + +import sun.awt.AWTAccessor; import sun.awt.SunToolkit; /** @@ -332,6 +334,11 @@ int clickCount; /** + * Indicates whether the event is a result of a touch event. + */ + private boolean causedByTouchEvent; + + /** * Indicates which, if any, of the mouse buttons has changed state. * * The valid values are ranged from 0 to the value returned by the @@ -399,6 +406,17 @@ //whatever besides SunToolkit) could also operate. cachedNumberOfButtons = 3; } + AWTAccessor.setMouseEventAccessor( + new AWTAccessor.MouseEventAccessor() { + public boolean isCausedByTouchEvent(MouseEvent ev) { + return ev.causedByTouchEvent; + } + + public void setCausedByTouchEvent(MouseEvent ev, + boolean causedByTouchEvent) { + ev.causedByTouchEvent = causedByTouchEvent; + } + }); } /**
--- a/src/share/classes/java/lang/ApplicationShutdownHooks.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/lang/ApplicationShutdownHooks.java Mon Aug 27 16:38:06 2018 +0100 @@ -102,9 +102,13 @@ hook.start(); } for (Thread hook : threads) { - try { - hook.join(); - } catch (InterruptedException x) { } + while (true) { + try { + hook.join(); + break; + } catch (InterruptedException ignored) { + } + } } } }
--- a/src/share/classes/java/lang/ref/Finalizer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/lang/ref/Finalizer.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -82,6 +82,10 @@ add(); } + static ReferenceQueue<Object> getQueue() { + return queue; + } + /* Invoked by VM */ static void register(Object finalizee) { new Finalizer(finalizee);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/java/lang/ref/FinalizerHistogram.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.ref; + + +import java.util.Map; +import java.util.HashMap; +import java.util.Arrays; +import java.util.Comparator; + +/** + * This FinalizerHistogram class is for GC.finalizer_info diagnostic command support. + * It is invoked by the VM. + */ + +final class FinalizerHistogram { + + private static final class Entry { + private int instanceCount; + private final String className; + + int getInstanceCount() { + return instanceCount; + } + + void increment() { + instanceCount += 1; + } + + Entry(String className) { + this.className = className; + } + } + + // Method below is called by VM and VM expect certain + // entry class layout. + + static Entry[] getFinalizerHistogram() { + Map<String, Entry> countMap = new HashMap<>(); + ReferenceQueue<Object> queue = Finalizer.getQueue(); + queue.forEach(r -> { + Object referent = r.get(); + if (referent != null) { + countMap.computeIfAbsent( + referent.getClass().getName(), Entry::new).increment(); + /* Clear stack slot containing this variable, to decrease + the chances of false retention with a conservative GC */ + referent = null; + } + }); + + Entry fhe[] = countMap.values().toArray(new Entry[countMap.size()]); + Arrays.sort(fhe, + Comparator.comparingInt(Entry::getInstanceCount).reversed()); + return fhe; + } +}
--- a/src/share/classes/java/lang/ref/Reference.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/lang/ref/Reference.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -99,7 +99,7 @@ * Inactive: this */ @SuppressWarnings("rawtypes") - Reference next; + volatile Reference next; /* When active: next element in a discovered reference list maintained by GC (or this if last) * pending: next element in the pending list (or null if last)
--- a/src/share/classes/java/lang/ref/ReferenceQueue.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/lang/ref/ReferenceQueue.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ package java.lang.ref; +import java.util.function.Consumer; + /** * Reference queues, to which registered reference objects are appended by the * garbage collector after the appropriate reachability changes are detected. @@ -75,13 +77,12 @@ } } - @SuppressWarnings("unchecked") private Reference<? extends T> reallyPoll() { /* Must hold lock */ Reference<? extends T> r = head; if (r != null) { - head = (r.next == r) ? - null : - r.next; // Unchecked due to the next field having a raw type in Reference + @SuppressWarnings("unchecked") + Reference<? extends T> rn = r.next; + head = (rn == r) ? null : rn; r.queue = NULL; r.next = r; queueLength--; @@ -164,4 +165,32 @@ return remove(0); } + /** + * Iterate queue and invoke given action with each Reference. + * Suitable for diagnostic purposes. + * WARNING: any use of this method should make sure to not + * retain the referents of iterated references (in case of + * FinalReference(s)) so that their life is not prolonged more + * than necessary. + */ + void forEach(Consumer<? super Reference<? extends T>> action) { + for (Reference<? extends T> r = head; r != null;) { + action.accept(r); + @SuppressWarnings("unchecked") + Reference<? extends T> rn = r.next; + if (rn == r) { + if (r.queue == ENQUEUED) { + // still enqueued -> we reached end of chain + r = null; + } else { + // already dequeued: r.queue == NULL; -> + // restart from head when overtaken by queue poller(s) + r = head; + } + } else { + // next in chain + r = rn; + } + } + } }
--- a/src/share/classes/java/security/ProtectionDomain.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/security/ProtectionDomain.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,27 +25,21 @@ package java.security; -import java.lang.ref.Reference; -import java.lang.ref.ReferenceQueue; -import java.lang.ref.SoftReference; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; +import java.util.WeakHashMap; +import sun.misc.JavaSecurityAccess; import sun.misc.JavaSecurityProtectionDomainAccess; import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; +import sun.misc.SharedSecrets; import sun.security.util.Debug; import sun.security.util.SecurityConstants; -import sun.misc.JavaSecurityAccess; -import sun.misc.SharedSecrets; /** - * - *<p> - * This ProtectionDomain class encapsulates the characteristics of a domain, + * The ProtectionDomain class encapsulates the characteristics of a domain, * which encloses a set of classes whose instances are granted a set * of permissions when being executed on behalf of a given set of Principals. * <p> @@ -460,14 +454,25 @@ /** * Used for storing ProtectionDomains as keys in a Map. */ - static final class Key {} + final class Key {} static { SharedSecrets.setJavaSecurityProtectionDomainAccess( new JavaSecurityProtectionDomainAccess() { @Override public ProtectionDomainCache getProtectionDomainCache() { - return new PDCache(); + return new ProtectionDomainCache() { + private final Map<Key, PermissionCollection> map = + Collections.synchronizedMap + (new WeakHashMap<Key, PermissionCollection>()); + public void put(ProtectionDomain pd, + PermissionCollection pc) { + map.put((pd == null ? null : pd.key), pc); + } + public PermissionCollection get(ProtectionDomain pd) { + return pd == null ? map.get(null) : map.get(pd.key); + } + }; } @Override @@ -476,119 +481,4 @@ } }); } - - /** - * A cache of ProtectionDomains and their Permissions. - * - * This class stores ProtectionDomains as weak keys in a ConcurrentHashMap - * with additional support for checking and removing weak keys that are no - * longer in use. There can be cases where the permission collection may - * have a chain of strong references back to the ProtectionDomain, which - * ordinarily would prevent the entry from being removed from the map. To - * address that, we wrap the permission collection in a SoftReference so - * that it can be reclaimed by the garbage collector due to memory demand. - */ - private static class PDCache implements ProtectionDomainCache { - private final ConcurrentHashMap<WeakProtectionDomainKey, - SoftReference<PermissionCollection>> - pdMap = new ConcurrentHashMap<>(); - private final ReferenceQueue<Key> queue = new ReferenceQueue<>(); - - @Override - public void put(ProtectionDomain pd, PermissionCollection pc) { - processQueue(queue, pdMap); - WeakProtectionDomainKey weakPd = - new WeakProtectionDomainKey(pd, queue); - pdMap.put(weakPd, new SoftReference<>(pc)); - } - - @Override - public PermissionCollection get(ProtectionDomain pd) { - processQueue(queue, pdMap); - WeakProtectionDomainKey weakPd = new WeakProtectionDomainKey(pd); - SoftReference<PermissionCollection> sr = pdMap.get(weakPd); - return (sr == null) ? null : sr.get(); - } - - /** - * Removes weak keys from the map that have been enqueued - * on the reference queue and are no longer in use. - */ - private static void processQueue(ReferenceQueue<Key> queue, - ConcurrentHashMap<? extends - WeakReference<Key>, ?> pdMap) { - Reference<? extends Key> ref; - while ((ref = queue.poll()) != null) { - pdMap.remove(ref); - } - } - } - - /** - * A weak key for a ProtectionDomain. - */ - private static class WeakProtectionDomainKey extends WeakReference<Key> { - /** - * Saved value of the referent's identity hash code, to maintain - * a consistent hash code after the referent has been cleared - */ - private final int hash; - - /** - * A key representing a null ProtectionDomain. - */ - private static final Key NULL_KEY = new Key(); - - /** - * Create a new WeakProtectionDomain with the specified domain and - * registered with a queue. - */ - WeakProtectionDomainKey(ProtectionDomain pd, ReferenceQueue<Key> rq) { - this((pd == null ? NULL_KEY : pd.key), rq); - } - - WeakProtectionDomainKey(ProtectionDomain pd) { - this(pd == null ? NULL_KEY : pd.key); - } - - private WeakProtectionDomainKey(Key key, ReferenceQueue<Key> rq) { - super(key, rq); - hash = key.hashCode(); - } - - private WeakProtectionDomainKey(Key key) { - super(key); - hash = key.hashCode(); - } - - /** - * Returns the identity hash code of the original referent. - */ - @Override - public int hashCode() { - return hash; - } - - /** - * Returns true if the given object is an identical - * WeakProtectionDomainKey instance, or, if this object's referent - * has not been cleared and the given object is another - * WeakProtectionDomainKey instance with an identical non-null - * referent as this one. - */ - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (obj instanceof WeakProtectionDomainKey) { - Object referent = get(); - return (referent != null) && - (referent == ((WeakProtectionDomainKey)obj).get()); - } else { - return false; - } - } - } }
--- a/src/share/classes/java/text/DecimalFormat.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/java/text/DecimalFormat.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -968,7 +968,7 @@ * Decimal : min = 0. max = 3. * */ - private void checkAndSetFastPathStatus() { + private boolean checkAndSetFastPathStatus() { boolean fastPathWasOn = isFastPath; @@ -998,12 +998,27 @@ } else isFastPath = false; + resetFastPathData(fastPathWasOn); + fastPathCheckNeeded = false; + + /* + * Returns true after successfully checking the fast path condition and + * setting the fast path data. The return value is used by the + * fastFormat() method to decide whether to call the resetFastPathData + * method to reinitialize fast path data or is it already initialized + * in this method. + */ + return true; + } + + private void resetFastPathData(boolean fastPathWasOn) { // Since some instance properties may have changed while still falling // in the fast-path case, we need to reinitialize fastPathData anyway. if (isFastPath) { // We need to instantiate fastPathData if not already done. - if (fastPathData == null) + if (fastPathData == null) { fastPathData = new FastPathData(); + } // Sets up the locale specific constants used when formatting. // '0' is our default representation of zero. @@ -1011,22 +1026,27 @@ fastPathData.groupingChar = symbols.getGroupingSeparator(); // Sets up fractional constants related to currency/decimal pattern. - fastPathData.fractionalMaxIntBound = (isCurrencyFormat) ? 99 : 999; - fastPathData.fractionalScaleFactor = (isCurrencyFormat) ? 100.0d : 1000.0d; + fastPathData.fractionalMaxIntBound = (isCurrencyFormat) + ? 99 : 999; + fastPathData.fractionalScaleFactor = (isCurrencyFormat) + ? 100.0d : 1000.0d; // Records the need for adding prefix or suffix - fastPathData.positiveAffixesRequired = - (positivePrefix.length() != 0) || (positiveSuffix.length() != 0); - fastPathData.negativeAffixesRequired = - (negativePrefix.length() != 0) || (negativeSuffix.length() != 0); + fastPathData.positiveAffixesRequired + = (positivePrefix.length() != 0) + || (positiveSuffix.length() != 0); + fastPathData.negativeAffixesRequired + = (negativePrefix.length() != 0) + || (negativeSuffix.length() != 0); // Creates a cached char container for result, with max possible size. int maxNbIntegralDigits = 10; int maxNbGroups = 3; - int containerSize = - Math.max(positivePrefix.length(), negativePrefix.length()) + - maxNbIntegralDigits + maxNbGroups + 1 + maximumFractionDigits + - Math.max(positiveSuffix.length(), negativeSuffix.length()); + int containerSize + = Math.max(positivePrefix.length(), negativePrefix.length()) + + maxNbIntegralDigits + maxNbGroups + 1 + + maximumFractionDigits + + Math.max(positiveSuffix.length(), negativeSuffix.length()); fastPathData.fastPathContainer = new char[containerSize]; @@ -1038,17 +1058,18 @@ // Sets up fixed index positions for integral and fractional digits. // Sets up decimal point in cached result container. - int longestPrefixLength = - Math.max(positivePrefix.length(), negativePrefix.length()); - int decimalPointIndex = - maxNbIntegralDigits + maxNbGroups + longestPrefixLength; - - fastPathData.integralLastIndex = decimalPointIndex - 1; + int longestPrefixLength + = Math.max(positivePrefix.length(), + negativePrefix.length()); + int decimalPointIndex + = maxNbIntegralDigits + maxNbGroups + longestPrefixLength; + + fastPathData.integralLastIndex = decimalPointIndex - 1; fastPathData.fractionalFirstIndex = decimalPointIndex + 1; - fastPathData.fastPathContainer[decimalPointIndex] = - isCurrencyFormat ? - symbols.getMonetaryDecimalSeparator() : - symbols.getDecimalSeparator(); + fastPathData.fastPathContainer[decimalPointIndex] + = isCurrencyFormat + ? symbols.getMonetaryDecimalSeparator() + : symbols.getDecimalSeparator(); } else if (fastPathWasOn) { // Previous state was fast-path and is no more. @@ -1059,8 +1080,6 @@ fastPathData.charsPositivePrefix = null; fastPathData.charsNegativePrefix = null; } - - fastPathCheckNeeded = false; } /** @@ -1554,9 +1573,11 @@ * @return the formatted result for {@code d} as a string. */ String fastFormat(double d) { + boolean isDataSet = false; // (Re-)Evaluates fast-path status if needed. - if (fastPathCheckNeeded) - checkAndSetFastPathStatus(); + if (fastPathCheckNeeded) { + isDataSet = checkAndSetFastPathStatus(); + } if (!isFastPath ) // DecimalFormat instance is not in a fast-path state. @@ -1580,9 +1601,21 @@ if (d > MAX_INT_AS_DOUBLE) // Filters out values that are outside expected fast-path range return null; - else + else { + if (!isDataSet) { + /* + * If the fast path data is not set through + * checkAndSetFastPathStatus() and fulfil the + * fast path conditions then reset the data + * directly through resetFastPathData() + */ + resetFastPathData(isFastPath); + } fastDoubleFormat(d, negative); + } + + // Returns a new string from updated fastPathContainer. return new String(fastPathData.fastPathContainer, fastPathData.firstUsedIndex,
--- a/src/share/classes/javax/swing/Autoscroller.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/Autoscroller.java Mon Aug 27 16:38:06 2018 +0100 @@ -28,6 +28,9 @@ import java.awt.*; import java.awt.event.*; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; + /** * Autoscroller is responsible for generating synthetic mouse dragged * events. It is the responsibility of the Component (or its MouseListeners) @@ -96,6 +99,9 @@ e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(event, + meAccessor.isCausedByTouchEvent(e)); if (timer == null) { timer = new Timer(100, this); @@ -173,6 +179,9 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(e, + meAccessor.isCausedByTouchEvent(event)); component.superProcessMouseMotionEvent(e); }
--- a/src/share/classes/javax/swing/JList.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/JList.java Mon Aug 27 16:38:06 2018 +0100 @@ -48,6 +48,8 @@ import java.io.IOException; import java.io.Serializable; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; @@ -1553,6 +1555,10 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = + AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(event)); String tip = ((JComponent)rComponent).getToolTipText( newEvent);
--- a/src/share/classes/javax/swing/JTable.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/JTable.java Mon Aug 27 16:38:06 2018 +0100 @@ -51,6 +51,9 @@ import javax.print.attribute.*; import javax.print.PrintService; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; import sun.reflect.misc.ReflectUtil; import sun.swing.SwingUtilities2; @@ -3404,6 +3407,9 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(event)); tip = ((JComponent)component).getToolTipText(newEvent); }
--- a/src/share/classes/javax/swing/JTree.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/JTree.java Mon Aug 27 16:38:06 2018 +0100 @@ -35,6 +35,9 @@ import javax.swing.tree.*; import javax.swing.text.Position; import javax.accessibility.*; + +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; @@ -1562,6 +1565,10 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = + AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(event)); tip = ((JComponent)rComponent).getToolTipText(newEvent); }
--- a/src/share/classes/javax/swing/MenuSelectionManager.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/MenuSelectionManager.java Mon Aug 27 16:38:06 2018 +0100 @@ -30,6 +30,8 @@ import javax.swing.event.*; import sun.awt.AppContext; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; import sun.swing.SwingUtilities2; /** @@ -304,6 +306,9 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(exitEvent, + meAccessor.isCausedByTouchEvent(event)); currentSelection[currentSelection.length-1]. processMouseEvent(exitEvent, path, this); @@ -316,6 +321,8 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + meAccessor.setCausedByTouchEvent(enterEvent, + meAccessor.isCausedByTouchEvent(event)); subElements[j].processMouseEvent(enterEvent, path, this); } MouseEvent mouseEvent = new MouseEvent(mc, event.getID(),event. getWhen(), @@ -325,6 +332,9 @@ event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(mouseEvent, + meAccessor.isCausedByTouchEvent(event)); subElements[j].processMouseEvent(mouseEvent, path, this); success = true; event.consume();
--- a/src/share/classes/javax/swing/SwingUtilities.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/SwingUtilities.java Mon Aug 27 16:38:06 2018 +0100 @@ -44,6 +44,8 @@ import sun.security.action.GetPropertyAction; import sun.awt.AppContext; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; /** * A collection of utility methods for Swing. @@ -355,6 +357,9 @@ sourceEvent.getClickCount(), sourceEvent.isPopupTrigger(), sourceEvent.getButton()); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(sourceEvent)); } return newEvent; }
--- a/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Mon Aug 27 16:38:06 2018 +0100 @@ -36,6 +36,8 @@ import java.beans.PropertyChangeEvent; import java.io.Serializable; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; /** * This is a basic implementation of the <code>ComboPopup</code> interface. @@ -499,13 +501,18 @@ // Fix for 4234053. Filter out the Control Key from the list. // ie., don't allow CTRL key deselection. Toolkit toolkit = Toolkit.getDefaultToolkit(); - e = new MouseEvent((Component)e.getSource(), e.getID(), e.getWhen(), + MouseEvent newEvent = new MouseEvent( + (Component)e.getSource(), e.getID(), e.getWhen(), e.getModifiers() ^ toolkit.getMenuShortcutKeyMask(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(e)); + e = newEvent; } super.processMouseEvent(e); } @@ -1195,6 +1202,9 @@ e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON ); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(e)); return newEvent; }
--- a/src/share/classes/javax/swing/table/JTableHeader.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/javax/swing/table/JTableHeader.java Mon Aug 27 16:38:06 2018 +0100 @@ -43,6 +43,8 @@ import java.io.ObjectInputStream; import java.io.IOException; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; /** * This is the object which manages the header of the <code>JTable</code>. @@ -420,6 +422,9 @@ p.x, p.y, event.getXOnScreen(), event.getYOnScreen(), event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(event)); tip = ((JComponent)component).getToolTipText(newEvent); }
--- a/src/share/classes/sun/awt/AWTAccessor.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/awt/AWTAccessor.java Mon Aug 27 16:38:06 2018 +0100 @@ -34,6 +34,7 @@ import java.awt.event.InputEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; import java.awt.geom.Point2D; import java.awt.peer.ComponentPeer; import java.awt.peer.MenuComponentPeer; @@ -385,6 +386,21 @@ int[] getButtonDownMasks(); } + /** + * An accessor for the MouseEvent class. + */ + public interface MouseEventAccessor { + /** + * Indicates whether the event is a result of a touch event. + */ + boolean isCausedByTouchEvent(MouseEvent ev); + + /** + * Sets whether the event is a result of a touch event. + */ + void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent); + } + /* * An accessor for the java.awt.Frame class. */ @@ -770,6 +786,7 @@ private static WindowAccessor windowAccessor; private static AWTEventAccessor awtEventAccessor; private static InputEventAccessor inputEventAccessor; + private static MouseEventAccessor mouseEventAccessor; private static FrameAccessor frameAccessor; private static KeyboardFocusManagerAccessor kfmAccessor; private static MenuComponentAccessor menuComponentAccessor; @@ -881,6 +898,23 @@ } /* + * Set an accessor object for the java.awt.event.MouseEvent class. + */ + public static void setMouseEventAccessor(MouseEventAccessor mea) { + mouseEventAccessor = mea; + } + + /* + * Retrieve the accessor object for the java.awt.event.MouseEvent class. + */ + public static MouseEventAccessor getMouseEventAccessor() { + if (mouseEventAccessor == null) { + unsafe.ensureClassInitialized(MouseEvent.class); + } + return mouseEventAccessor; + } + + /* * Set an accessor object for the java.awt.Frame class. */ public static void setFrameAccessor(FrameAccessor fa) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/awt/OverrideNativeWindowHandle.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.awt; + +/** + * Used for replacing window owner with another non-Swing window. + * It is useful in case of JavaFX-Swing interop: + * it helps to keep Swing dialogs above its owner(JavaFX stage). + */ + +public interface OverrideNativeWindowHandle { + + /** + * Replaces an owner window with a window with provided handle. + * @param handle native window handle + */ + void overrideWindowHandle(final long handle); +}
--- a/src/share/classes/sun/awt/SunToolkit.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/awt/SunToolkit.java Mon Aug 27 16:38:06 2018 +0100 @@ -70,6 +70,9 @@ if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) { DebugSettings.init(); } + touchKeyboardAutoShowIsEnabled = Boolean.valueOf( + AccessController.doPrivileged(new GetPropertyAction( + "awt.touchKeyboardAutoShowIsEnabled", "true"))); }; /** @@ -1707,6 +1710,13 @@ */ public abstract void ungrab(Window w); + public void showOrHideTouchKeyboard(Component comp, AWTEvent e) {} + + private static boolean touchKeyboardAutoShowIsEnabled; + + public static boolean isTouchKeyboardAutoShowEnabled() { + return touchKeyboardAutoShowIsEnabled; + } /** * Locates the splash screen library in a platform dependent way and closes
--- a/src/share/classes/sun/management/Agent.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/management/Agent.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -211,7 +211,7 @@ throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified"); } } catch (AgentConfigurationError err) { - error(err.getError(), err.getParams()); + error(err); } } @@ -266,7 +266,7 @@ } } catch (AgentConfigurationError e) { - error(e.getError(), e.getParams()); + error(e); } catch (Exception e) { error(e); } @@ -496,18 +496,6 @@ throw new RuntimeException(keyText); } - public static void error(String key, String[] params) { - if (params == null || params.length == 0) { - error(key); - } else { - StringBuffer message = new StringBuffer(params[0]); - for (int i = 1; i < params.length; i++) { - message.append(" " + params[i]); - } - error(key, message.toString()); - } - } - public static void error(String key, String message) { String keyText = getText(key); System.err.print(getText("agent.err.error") + ": " + keyText); @@ -521,6 +509,23 @@ throw new RuntimeException(e); } + public static void error(AgentConfigurationError e) { + String keyText = getText(e.getError()); + String[] params = e.getParams(); + + System.err.print(getText("agent.err.error") + ": " + keyText); + + if (params != null && params.length != 0) { + StringBuffer message = new StringBuffer(params[0]); + for (int i = 1; i < params.length; i++) { + message.append(" " + params[i]); + } + System.err.println(": " + message); + } + e.printStackTrace(); + throw new RuntimeException(e); + } + public static void warning(String key, String message) { System.err.print(getText("agent.err.warning") + ": " + getText(key)); System.err.println(": " + message);
--- a/src/share/classes/sun/security/tools/KeyStoreUtil.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/security/tools/KeyStoreUtil.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -63,8 +63,9 @@ * MSCAPI KeyStores */ public static boolean isWindowsKeyStore(String storetype) { - return storetype.equalsIgnoreCase("Windows-MY") - || storetype.equalsIgnoreCase("Windows-ROOT"); + return storetype != null + && (storetype.equalsIgnoreCase("Windows-MY") + || storetype.equalsIgnoreCase("Windows-ROOT")); } /**
--- a/src/share/classes/sun/security/tools/keytool/Main.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/security/tools/keytool/Main.java Mon Aug 27 16:38:06 2018 +0100 @@ -464,12 +464,12 @@ passwords.add(storePass); } else if (collator.compare(flags, "-storetype") == 0 || collator.compare(flags, "-deststoretype") == 0) { - storetype = args[++i]; + storetype = KeyStoreUtil.niceStoreTypeName(args[++i]); } else if (collator.compare(flags, "-srcstorepass") == 0) { srcstorePass = getPass(modifier, args[++i]); passwords.add(srcstorePass); } else if (collator.compare(flags, "-srcstoretype") == 0) { - srcstoretype = args[++i]; + srcstoretype = KeyStoreUtil.niceStoreTypeName(args[++i]); } else if (collator.compare(flags, "-srckeypass") == 0) { srckeyPass = getPass(modifier, args[++i]); passwords.add(srckeyPass); @@ -596,16 +596,6 @@ * Execute the commands. */ void doCommands(PrintStream out) throws Exception { - if (storetype == null) { - storetype = KeyStore.getDefaultType(); - } - storetype = KeyStoreUtil.niceStoreTypeName(storetype); - - if (srcstoretype == null) { - srcstoretype = KeyStore.getDefaultType(); - } - srcstoretype = KeyStoreUtil.niceStoreTypeName(srcstoretype); - if (P11KEYSTORE.equalsIgnoreCase(storetype) || KeyStoreUtil.isWindowsKeyStore(storetype)) { token = true; @@ -630,11 +620,6 @@ (".storepasswd.and.keypasswd.commands.not.supported.if.storetype.is.{0}"), storetype)); } - if (P12KEYSTORE.equalsIgnoreCase(storetype) && command == KEYPASSWD) { - throw new UnsupportedOperationException(rb.getString - (".keypasswd.commands.not.supported.if.storetype.is.PKCS12")); - } - if (token && (keyPass != null || newPass != null || destKeyPass != null)) { throw new IllegalArgumentException(MessageFormat.format(rb.getString (".keypass.and.new.can.not.be.specified.if.storetype.is.{0}"), storetype)); @@ -806,6 +791,9 @@ } // Create new keystore + if (storetype == null) { + storetype = KeyStore.getDefaultType(); + } if (providerName == null) { keyStore = KeyStore.getInstance(storetype); } else { @@ -843,6 +831,11 @@ } } + if (P12KEYSTORE.equalsIgnoreCase(storetype) && command == KEYPASSWD) { + throw new UnsupportedOperationException(rb.getString + (".keypasswd.commands.not.supported.if.storetype.is.PKCS12")); + } + // All commands that create or modify the keystore require a keystore // password. @@ -2018,6 +2011,9 @@ KeyStore store; try { + if (srcstoretype == null) { + srcstoretype = KeyStore.getDefaultType(); + } if (srcProviderName == null) { store = KeyStore.getInstance(srcstoretype); } else { @@ -2639,12 +2635,12 @@ if (rfc) { dumpCert(cert, out); } else { - out.println("Certificate #" + i++); + out.println("Certificate #" + i); out.println("===================================="); printX509Cert((X509Certificate)cert, out); out.println(); } - checkWeak(oneInMany(rb.getString("the.certificate"), i, chain.size()), cert); + checkWeak(oneInMany(rb.getString("the.certificate"), i++, chain.size()), cert); } catch (Exception e) { if (debug) { e.printStackTrace();
--- a/src/share/classes/sun/swing/FilePane.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/swing/FilePane.java Mon Aug 27 16:38:06 2018 +0100 @@ -44,6 +44,8 @@ import javax.swing.table.*; import javax.swing.text.*; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.MouseEventAccessor; import sun.awt.shell.*; /** @@ -1835,13 +1837,17 @@ // Make a new event with the list as source, placing the // click in the corresponding list cell. Rectangle r = list.getCellBounds(index, index); - evt = new MouseEvent(list, evt.getID(), + MouseEvent newEvent = new MouseEvent(list, evt.getID(), evt.getWhen(), evt.getModifiers(), r.x + 1, r.y + r.height/2, evt.getXOnScreen(), evt.getYOnScreen(), evt.getClickCount(), evt.isPopupTrigger(), evt.getButton()); + MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor(); + meAccessor.setCausedByTouchEvent(newEvent, + meAccessor.isCausedByTouchEvent(evt)); + evt = newEvent; } } else { return;
--- a/src/share/classes/sun/swing/JLightweightFrame.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/classes/sun/swing/JLightweightFrame.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -61,8 +61,10 @@ import javax.swing.RootPaneContainer; import javax.swing.SwingUtilities; +import sun.awt.AWTAccessor; import sun.awt.DisplayChangedListener; import sun.awt.LightweightFrame; +import sun.awt.OverrideNativeWindowHandle; import sun.security.action.GetPropertyAction; import sun.swing.SwingUtilities2.RepaintListener; @@ -478,6 +480,17 @@ } } + //Called by reflection by SwingNode + public void overrideNativeWindowHandle(long handle, Runnable closeWindow) { + final Object peer = AWTAccessor.getComponentAccessor().getPeer(this); + if (peer instanceof OverrideNativeWindowHandle) { + ((OverrideNativeWindowHandle) peer).overrideWindowHandle(handle); + } + if (closeWindow != null) { + closeWindow.run(); + } + } + public <T extends DragGestureRecognizer> T createDragGestureRecognizer( Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions,
--- a/src/share/sample/scripting/scriptpad/src/scripts/memory.sh Sun Aug 19 04:29:53 2018 +0100 +++ b/src/share/sample/scripting/scriptpad/src/scripts/memory.sh Mon Aug 27 16:38:06 2018 +0100 @@ -1,3 +1,4 @@ +#!/bin/sh # # Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. #
--- a/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -29,10 +29,11 @@ import java.awt.dnd.DropTarget; import sun.awt.LightweightFrame; +import sun.awt.OverrideNativeWindowHandle; import sun.swing.JLightweightFrame; import sun.swing.SwingAccessor; -public class XLightweightFramePeer extends XFramePeer { +public class XLightweightFramePeer extends XFramePeer implements OverrideNativeWindowHandle { XLightweightFramePeer(LightweightFrame target) { super(target); @@ -80,4 +81,15 @@ public void removeDropTarget(DropTarget dt) { getLwTarget().removeDropTarget(dt); } + + private volatile long overriddenWindowHandle = 0L; + + @Override + public void overrideWindowHandle(final long handle) { + overriddenWindowHandle = handle; + } + + public long getOverriddenWindowHandle() { + return overriddenWindowHandle; + } }
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Mon Aug 27 16:38:06 2018 +0100 @@ -1650,6 +1650,16 @@ while (!XlibUtil.isToplevelWindow(tpw) && !XlibUtil.isXAWTToplevelWindow(tpw)) { tpw = XlibUtil.getParentWindow(tpw); } + + XBaseWindow parent = transientForWindow; + if (parent instanceof XLightweightFramePeer) { + XLightweightFramePeer peer = (XLightweightFramePeer) parent; + long ownerWindowPtr = peer.getOverriddenWindowHandle(); + if (ownerWindowPtr != 0) { + tpw = ownerWindowPtr; + } + } + XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw); window.curRealTransientFor = transientForWindow; }
--- a/src/solaris/classes/sun/java2d/xr/XRDrawImage.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/solaris/classes/sun/java2d/xr/XRDrawImage.java Mon Aug 27 16:38:06 2018 +0100 @@ -46,24 +46,28 @@ SurfaceData dstData = sg.surfaceData; SurfaceData srcData = dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor); - int compRule = ((AlphaComposite) sg.composite).getRule(); - float extraAlpha = ((AlphaComposite) sg.composite).getAlpha(); - if (srcData != null && !isBgOperation(srcData, bgColor) + if (sg.composite instanceof AlphaComposite) { + int compRule = ((AlphaComposite) sg.composite).getRule(); + float extraAlpha = ((AlphaComposite) sg.composite).getAlpha(); + + if (srcData != null && !isBgOperation(srcData, bgColor) && interpType <= AffineTransformOp.TYPE_BILINEAR && (XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule)) - || (XRUtils.isTransformQuadrantRotated(tx)) && extraAlpha == 1.0f)) - { - SurfaceType srcType = srcData.getSurfaceType(); - SurfaceType dstType = dstData.getSurfaceType(); + || (XRUtils.isTransformQuadrantRotated(tx)) + && extraAlpha == 1.0f)) + { + SurfaceType srcType = srcData.getSurfaceType(); + SurfaceType dstType = dstData.getSurfaceType(); - TransformBlit blit = TransformBlit.getFromCache(srcType, - sg.imageComp, dstType); - if (blit != null) { - blit.Transform(srcData, dstData, sg.composite, - sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2 + TransformBlit blit = TransformBlit.getFromCache(srcType, + sg.imageComp, dstType); + if (blit != null) { + blit.Transform(srcData, dstData, sg.composite, + sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2 - sx1, sy2 - sy1); return; + } } }
--- a/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java Mon Aug 27 16:38:06 2018 +0100 @@ -127,7 +127,11 @@ vImgSurfaceType = SurfaceType.IntArgbPre; } - if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h) { + if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h || + // Sometimes we get volatile image of wrong dest surface type, + // so recreating it + !(vImg.getDestSurface() instanceof XRSurfaceData)) + { if (vImg != null) { vImg.flush(); } @@ -145,6 +149,11 @@ } Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType); + + if (!(vImg.getDestSurface() instanceof XRSurfaceData)) { + throw new InvalidPipeException("wrong surface data type: " + vImg.getDestSurface()); + } + XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface(); swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null, sx, sy, 0, 0, w, h);
--- a/src/windows/classes/sun/awt/windows/WInputMethod.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/classes/sun/awt/windows/WInputMethod.java Mon Aug 27 16:38:06 2018 +0100 @@ -493,7 +493,7 @@ // set Clause and Reading Information if (clauseBoundary!=null && clauseReading!=null && clauseReading.length!=0 && clauseBoundary.length==clauseReading.length+1 && - clauseBoundary[0]==0 && clauseBoundary[clauseReading.length]==text.length() ) + clauseBoundary[0]==0 && clauseBoundary[clauseReading.length]<=text.length() ) { for (int i=0; i<clauseBoundary.length-1; i++) { attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
--- a/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -32,10 +32,11 @@ import java.awt.event.MouseEvent; import sun.awt.LightweightFrame; +import sun.awt.OverrideNativeWindowHandle; import sun.swing.JLightweightFrame; import sun.swing.SwingAccessor; -public class WLightweightFramePeer extends WFramePeer { +public class WLightweightFramePeer extends WFramePeer implements OverrideNativeWindowHandle { public WLightweightFramePeer(LightweightFrame target) { super(target); @@ -50,6 +51,13 @@ return getLwTarget().getGraphics(); } + private native void overrideNativeHandle(long hwnd); + + @Override + public void overrideWindowHandle(final long handle) { + overrideNativeHandle(handle); + } + @Override public void show() { super.show();
--- a/src/windows/classes/sun/awt/windows/WToolkit.java Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/classes/sun/awt/windows/WToolkit.java Mon Aug 27 16:38:06 2018 +0100 @@ -30,13 +30,19 @@ import java.awt.im.spi.InputMethodDescriptor; import java.awt.image.*; import java.awt.peer.*; +import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; import java.awt.datatransfer.Clipboard; +import java.awt.TextComponent; import java.awt.TrayIcon; import java.beans.PropertyChangeListener; import java.security.AccessController; import java.security.PrivilegedAction; +import javax.swing.text.JTextComponent; + import sun.awt.AppContext; +import sun.awt.AWTAccessor; import sun.awt.AWTAutoShutdown; import sun.awt.LightweightFrame; import sun.awt.SunToolkit; @@ -1101,6 +1107,61 @@ } } + /////////////////////////////////////////////////////////////////////////// + // The following code is used for support of automatic showing of the touch + // keyboard for text components and is accessed only from EDT. + /////////////////////////////////////////////////////////////////////////// + private volatile Component compOnTouchDownEvent; + private volatile Component compOnMousePressedEvent; + + @Override + public void showOrHideTouchKeyboard(Component comp, AWTEvent e) { + if ((comp == null) || (e == null) || + (!(comp instanceof TextComponent) && + !(comp instanceof JTextComponent))) { + return; + } + + if ((e instanceof MouseEvent) && comp.isEnabled() && + (((comp instanceof TextComponent) && + ((TextComponent)comp).isEditable()) || + ((comp instanceof JTextComponent) && + ((JTextComponent)comp).isEditable()))) { + MouseEvent me = (MouseEvent)e; + if (me.getID() == MouseEvent.MOUSE_PRESSED) { + if (AWTAccessor.getMouseEventAccessor() + .isCausedByTouchEvent(me)) { + compOnTouchDownEvent = comp; + } else { + compOnMousePressedEvent = comp; + } + } else if (me.getID() == MouseEvent.MOUSE_RELEASED) { + if (AWTAccessor.getMouseEventAccessor() + .isCausedByTouchEvent(me)) { + if (compOnTouchDownEvent == comp) { + showTouchKeyboard(true); + } + compOnTouchDownEvent = null; + } else { + if (compOnMousePressedEvent == comp) { + showTouchKeyboard(false); + } + compOnMousePressedEvent = null; + } + } + } else if (e instanceof FocusEvent) { + if (e.getID() == FocusEvent.FOCUS_LOST) { + hideTouchKeyboard(); + } + } + } + + private native void showTouchKeyboard(boolean causedByTouchEvent); + private native void hideTouchKeyboard(); + /////////////////////////////////////////////////////////////////////////// + // End of the touch keyboard related code. + /////////////////////////////////////////////////////////////////////////// + @Override public native boolean syncNativeQueue(final long timeout); @Override
--- a/src/windows/lib/tzmappings Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/lib/tzmappings Mon Aug 27 16:38:06 2018 +0100 @@ -164,39 +164,63 @@ GMT Standard Time:88,89::GMT: Greenwich:88,89::GMT: Greenwich Standard Time:88,89::GMT: -Argentina Standard Time:900,900::America/Buenos_Aires: -Azerbaijan Standard Time:901,901:AZ:Asia/Baku: -Bangladesh Standard Time:902,902::Asia/Dhaka: -Central Brazilian Standard Time:903,903:BR:America/Cuiaba: -Central Standard Time (Mexico):904,904::America/Mexico_City: -Georgian Standard Time:905,905:GE:Asia/Tbilisi: -Jordan Standard Time:906,906:JO:Asia/Amman: -Kamchatka Standard Time:907,907:RU:Asia/Kamchatka: -Mauritius Standard Time:908,908:MU:Indian/Mauritius: -Middle East Standard Time:909,909:LB:Asia/Beirut: -Montevideo Standard Time:910,910:UY:America/Montevideo: -Morocco Standard Time:911,911:MA:Africa/Casablanca: -Mountain Standard Time (Mexico):912,912:MX:America/Chihuahua: -Namibia Standard Time:913,913:NA:Africa/Windhoek: -Pacific Standard Time (Mexico):914,914:MX:America/Tijuana: -Pakistan Standard Time:915,915::Asia/Karachi: -Paraguay Standard Time:916,916:PY:America/Asuncion: -Syria Standard Time:917,917:SY:Asia/Damascus: -UTC:918,918::UTC: -UTC+12:919,919::GMT+1200: -UTC-02:920,920::GMT-0200: -UTC-11:921,921::GMT-1100: -Ulaanbaatar Standard Time:922,922::Asia/Ulaanbaatar: -Venezuela Standard Time:923,923::America/Caracas: -Magadan Standard Time:924,924::Asia/Magadan: -Kaliningrad Standard Time:925,925:RU:Europe/Kaliningrad: -Turkey Standard Time:926,926::Asia/Istanbul: -Bahia Standard Time:927,927::America/Bahia: -Libya Standard Time:928,928:LY:Africa/Tripoli: -Belarus Standard Time:929,929:BY:Europe/Minsk: -Line Islands Standard Time:930,930::Pacific/Kiritimati: -Russia Time Zone 10:931,931::Asia/Srednekolymsk: -Russia Time Zone 11:932,932::Asia/Anadyr: -Russia Time Zone 3:933,933::Europe/Samara: -Western Brazilian Standard Time:934,934:BR:America/Rio_Branco: -Armenian Standard Time:935,935:AM:Asia/Yerevan: +Aleutian Standard Time:900,900:US:America/Adak: +Altai Standard Time:901,901::Asia/Barnaul: +Argentina Standard Time:902,902::America/Buenos_Aires: +Armenian Standard Time:903,903:AM:Asia/Yerevan: +Astrakhan Standard Time:904,904::Europe/Astrakhan: +Aus Central W. Standard Time:905,905::Australia/Eucla: +Azerbaijan Standard Time:906,906:AZ:Asia/Baku: +Bahia Standard Time:907,907::America/Bahia: +Bangladesh Standard Time:908,908::Asia/Dhaka: +Belarus Standard Time:909,909:BY:Europe/Minsk: +Bougainville Standard Time:910,910::Pacific/Bougainville: +Central Brazilian Standard Time:911,911:BR:America/Cuiaba: +Central Standard Time (Mexico):912,912::America/Mexico_City: +Chatham Islands Standard Time:913,913::Pacific/Chatham: +Cuba Standard Time:914,914:CU:America/Havana: +Easter Island Standard Time:915,915:CL:Pacific/Easter: +Eastern Standard Time (Mexico):916,916::America/Cancun: +Georgian Standard Time:917,917:GE:Asia/Tbilisi: +Haiti Standard Time:918,918:HT:America/Port-au-Prince: +Jordan Standard Time:919,919:JO:Asia/Amman: +Kaliningrad Standard Time:920,920:RU:Europe/Kaliningrad: +Kamchatka Standard Time:921,921:RU:Asia/Kamchatka: +Libya Standard Time:922,922:LY:Africa/Tripoli: +Line Islands Standard Time:923,923::Pacific/Kiritimati: +Lord Howe Standard Time:924,924::Australia/Lord_Howe: +Magadan Standard Time:925,925::Asia/Magadan: +Marquesas Standard Time:926,926::Pacific/Marquesas: +Mauritius Standard Time:927,927:MU:Indian/Mauritius: +Middle East Standard Time:928,928:LB:Asia/Beirut: +Montevideo Standard Time:929,929:UY:America/Montevideo: +Morocco Standard Time:930,930:MA:Africa/Casablanca: +Mountain Standard Time (Mexico):931,931:MX:America/Chihuahua: +Namibia Standard Time:932,932:NA:Africa/Windhoek: +Norfolk Standard Time:933,933::Pacific/Norfolk: +North Korea Standard Time:934,934:KP:Asia/Pyongyang: +Pacific Standard Time (Mexico):935,935:MX:America/Tijuana: +Pakistan Standard Time:936,936::Asia/Karachi: +Paraguay Standard Time:937,937:PY:America/Asuncion: +Russia Time Zone 10:938,938::Asia/Srednekolymsk: +Russia Time Zone 11:939,939::Asia/Anadyr: +Russia Time Zone 3:940,940::Europe/Samara: +Saint Pierre Standard Time:941,941:PM:America/Miquelon: +Sakhalin Standard Time:942,942::Asia/Sakhalin: +Syria Standard Time:943,943:SY:Asia/Damascus: +Tocantins Standard Time:944,944::America/Araguaina: +Tomsk Standard Time:945,945::Asia/Tomsk: +Transbaikal Standard Time:946,946::Asia/Chita: +Turkey Standard Time:947,947::Asia/Istanbul: +Turks And Caicos Standard Time:948,948:TC:America/Grand_Turk: +UTC+12:949,949::GMT+1200: +UTC-02:950,950::GMT-0200: +UTC-08:951,951::GMT-0800: +UTC-09:952,952::GMT-0900: +UTC-11:953,953::GMT-1100: +UTC:954,954::UTC: +Ulaanbaatar Standard Time:955,955::Asia/Ulaanbaatar: +Venezuela Standard Time:956,956::America/Caracas: +W. Mongolia Standard Time:957,957::Asia/Hovd: +West Bank Standard Time:958,958::Asia/Gaza: +Western Brazilian Standard Time:959,959:BR:America/Rio_Branco:
--- a/src/windows/native/java/net/NetworkInterface_winXP.c Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/java/net/NetworkInterface_winXP.c Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -71,7 +71,8 @@ #endif -static int bufsize = 4096; +const ULONG BUFF_SIZE = 15360; +const int MAX_TRIES = 3; /* * return an array of IP_ADAPTER_ADDRESSES containing one element @@ -82,22 +83,26 @@ DWORD ret, flags; IP_ADAPTER_ADDRESSES *adapterInfo; ULONG len; - adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize); + int try; + + + adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE); if (adapterInfo == NULL) { - JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure"); + JNU_ThrowByName(env, "java/lang/OutOfMemoryError", + "Native heap allocation failure"); return -1; } - len = bufsize; + len = BUFF_SIZE; flags = GAA_FLAG_SKIP_DNS_SERVER; flags |= GAA_FLAG_SKIP_MULTICAST; flags |= GAA_FLAG_INCLUDE_PREFIX; ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len); - if (ret == ERROR_BUFFER_OVERFLOW) { + for (try = 0; ret == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) { IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL; - if (len < (ULONG_MAX - bufsize)) { - len = len + bufsize; + if (len < (ULONG_MAX - BUFF_SIZE)) { + len += BUFF_SIZE; } newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len); @@ -131,20 +136,22 @@ DWORD flags, val; IP_ADAPTER_ADDRESSES *adapterInfo, *ptr, *ret; ULONG len; - adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize); + int try; + adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE); if (adapterInfo == NULL) { - JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure"); + JNU_ThrowByName(env, "java/lang/OutOfMemoryError", + "Native heap allocation failure"); return NULL; } - len = bufsize; + len = BUFF_SIZE; flags = GAA_FLAG_SKIP_DNS_SERVER; flags |= GAA_FLAG_SKIP_MULTICAST; flags |= GAA_FLAG_INCLUDE_PREFIX; val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len); - if (val == ERROR_BUFFER_OVERFLOW) { + for (try = 0; val == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) { IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL; - if (len < (ULONG_MAX - bufsize)) { - len = len + bufsize; + if (len < (ULONG_MAX - BUFF_SIZE)) { + len += BUFF_SIZE; } newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
--- a/src/windows/native/sun/windows/awt.h Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt.h Mon Aug 27 16:38:06 2018 +0100 @@ -175,6 +175,9 @@ #define IS_WIN2000 (LOBYTE(LOWORD(::GetVersion())) >= 5) #define IS_WINXP ((IS_WIN2000 && HIBYTE(LOWORD(::GetVersion())) >= 1) || LOBYTE(LOWORD(::GetVersion())) > 5) #define IS_WINVISTA (LOBYTE(LOWORD(::GetVersion())) >= 6) +#define IS_WIN8 ( \ + (IS_WINVISTA && (HIBYTE(LOWORD(::GetVersion())) >= 2)) || \ + (LOBYTE(LOWORD(::GetVersion())) > 6)) #define IS_WINVER_ATLEAST(maj, min) \ ((maj) < LOBYTE(LOWORD(::GetVersion())) || \
--- a/src/windows/native/sun/windows/awt_Component.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Component.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -221,6 +221,10 @@ AwtComponent::AwtComponent() { m_mouseButtonClickAllowed = 0; + m_touchDownOccurred = FALSE; + m_touchUpOccurred = FALSE; + m_touchDownPoint.x = m_touchDownPoint.y = 0; + m_touchUpPoint.x = m_touchUpPoint.y = 0; m_callbacksEnabled = FALSE; m_hwnd = NULL; @@ -589,6 +593,11 @@ /* Subclass the window now so that we can snoop on its messages */ SubclassHWND(); + AwtToolkit& tk = AwtToolkit::GetInstance(); + if (tk.IsWin8OrLater() && tk.IsTouchKeyboardAutoShowEnabled()) { + tk.TIRegisterTouchWindow(GetHWnd(), TWF_WANTPALM); + } + /* * Fix for 4046446. */ @@ -1715,6 +1724,9 @@ break; } break; + case WM_TOUCH: + WmTouch(wParam, lParam); + break; case WM_SETCURSOR: mr = mrDoDefault; if (LOWORD(lParam) == HTCLIENT) { @@ -2309,6 +2321,38 @@ return mrDoDefault; } +void AwtComponent::WmTouch(WPARAM wParam, LPARAM lParam) { + AwtToolkit& tk = AwtToolkit::GetInstance(); + if (!tk.IsWin8OrLater() || !tk.IsTouchKeyboardAutoShowEnabled()) { + return; + } + + UINT inputsCount = LOWORD(wParam); + TOUCHINPUT* pInputs = new TOUCHINPUT[inputsCount]; + if (pInputs != NULL) { + if (tk.TIGetTouchInputInfo((HTOUCHINPUT)lParam, inputsCount, pInputs, + sizeof(TOUCHINPUT)) != 0) { + for (UINT i = 0; i < inputsCount; i++) { + TOUCHINPUT ti = pInputs[i]; + if (ti.dwFlags & TOUCHEVENTF_PRIMARY) { + if (ti.dwFlags & TOUCHEVENTF_DOWN) { + m_touchDownPoint.x = ti.x / 100; + m_touchDownPoint.y = ti.y / 100; + ::ScreenToClient(GetHWnd(), &m_touchDownPoint); + m_touchDownOccurred = TRUE; + } else if (ti.dwFlags & TOUCHEVENTF_UP) { + m_touchUpPoint.x = ti.x / 100; + m_touchUpPoint.y = ti.y / 100; + ::ScreenToClient(GetHWnd(), &m_touchUpPoint); + m_touchUpOccurred = TRUE; + } + } + } + } + delete[] pInputs; + } +} + /* Double-click variables. */ static jlong multiClickTime = ::GetDoubleClickTime(); static int multiClickMaxX = ::GetSystemMetrics(SM_CXDOUBLECLK); @@ -2351,6 +2395,14 @@ m_mouseButtonClickAllowed |= GetButtonMK(button); lastTime = now; + BOOL causedByTouchEvent = FALSE; + if (m_touchDownOccurred && + (abs(m_touchDownPoint.x - x) <= TOUCH_MOUSE_COORDS_DELTA) && + (abs(m_touchDownPoint.y - y) <= TOUCH_MOUSE_COORDS_DELTA)) { + causedByTouchEvent = TRUE; + m_touchDownOccurred = FALSE; + } + MSG msg; InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y); @@ -2369,7 +2421,7 @@ SendMouseEvent(java_awt_event_MouseEvent_MOUSE_PRESSED, now, x, y, GetJavaModifiers(), clickCount, JNI_FALSE, - GetButton(button), &msg); + GetButton(button), &msg, causedByTouchEvent); /* * NOTE: this call is intentionally placed after all other code, * since AwtComponent::WmMouseDown() assumes that the cached id of the @@ -2391,13 +2443,21 @@ MsgRouting AwtComponent::WmMouseUp(UINT flags, int x, int y, int button) { + BOOL causedByTouchEvent = FALSE; + if (m_touchUpOccurred && + (abs(m_touchUpPoint.x - x) <= TOUCH_MOUSE_COORDS_DELTA) && + (abs(m_touchUpPoint.y - y) <= TOUCH_MOUSE_COORDS_DELTA)) { + causedByTouchEvent = TRUE; + m_touchUpOccurred = FALSE; + } + MSG msg; InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y); SendMouseEvent(java_awt_event_MouseEvent_MOUSE_RELEASED, TimeHelper::getMessageTimeUTC(), x, y, GetJavaModifiers(), clickCount, (GetButton(button) == java_awt_event_MouseEvent_BUTTON3 ? - TRUE : FALSE), GetButton(button), &msg); + TRUE : FALSE), GetButton(button), &msg, causedByTouchEvent); /* * If no movement, then report a click following the button release. * When WM_MOUSEUP comes to a window without previous WM_MOUSEDOWN, @@ -3801,25 +3861,36 @@ if ( m_bitsCandType & bits ) SetCandidateWindow(iCandType, x - p.x, y - p.y); } - if (m_bitsCandType != 0) { - // REMIND: is there any chance GetProxyFocusOwner() returns NULL here? - ::DefWindowProc(ImmGetHWnd(), - WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType); - } } void AwtComponent::SetCandidateWindow(int iCandType, int x, int y) { HWND hwnd = ImmGetHWnd(); HIMC hIMC = ImmGetContext(hwnd); - CANDIDATEFORM cf; - cf.dwIndex = iCandType; - cf.dwStyle = CFS_POINT; - cf.ptCurrentPos.x = x; - cf.ptCurrentPos.y = y; - - ImmSetCandidateWindow(hIMC, &cf); - ImmReleaseContext(hwnd, hIMC); + if (hIMC) { + CANDIDATEFORM cf; + cf.dwStyle = CFS_POINT; + ImmGetCandidateWindow(hIMC, 0, &cf); + if (x != cf.ptCurrentPos.x || y != cf.ptCurrentPos.y) { + cf.dwIndex = iCandType; + cf.dwStyle = CFS_POINT; + cf.ptCurrentPos.x = x; + cf.ptCurrentPos.y = y; + cf.rcArea.left = cf.rcArea.top = cf.rcArea.right = cf.rcArea.bottom = 0; + ImmSetCandidateWindow(hIMC, &cf); + } + COMPOSITIONFORM cfr; + cfr.dwStyle = CFS_POINT; + ImmGetCompositionWindow(hIMC, &cfr); + if (x != cfr.ptCurrentPos.x || y != cfr.ptCurrentPos.y) { + cfr.dwStyle = CFS_POINT; + cfr.ptCurrentPos.x = x; + cfr.ptCurrentPos.y = y; + cfr.rcArea.left = cfr.rcArea.top = cfr.rcArea.right = cfr.rcArea.bottom = 0; + ImmSetCompositionWindow(hIMC, &cfr); + } + ImmReleaseContext(hwnd, hIMC); + } } MsgRouting AwtComponent::WmImeSetContext(BOOL fSet, LPARAM *lplParam) @@ -3847,17 +3918,14 @@ MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType) { if (!m_useNativeCompWindow) { - if (subMsg == IMN_OPENCANDIDATE) { + if (subMsg == IMN_OPENCANDIDATE || subMsg == IMN_CHANGECANDIDATE) { m_bitsCandType = bitsCandType; InquireCandidatePosition(); } else if (subMsg == IMN_OPENSTATUSWINDOW || - subMsg == WM_IME_STARTCOMPOSITION) { - m_bitsCandType = 0; - InquireCandidatePosition(); - } else if (subMsg == IMN_SETCANDIDATEPOS) { + subMsg == WM_IME_STARTCOMPOSITION || + subMsg == IMN_SETCANDIDATEPOS) { InquireCandidatePosition(); } - return mrConsume; } return mrDoDefault; } @@ -4946,7 +5014,7 @@ void AwtComponent::SendMouseEvent(jint id, jlong when, jint x, jint y, jint modifiers, jint clickCount, jboolean popupTrigger, jint button, - MSG *pMsg) + MSG *pMsg, BOOL causedByTouchEvent) { JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); CriticalSection::Lock l(GetLock()); @@ -4996,6 +5064,10 @@ DASSERT(mouseEvent != NULL); CHECK_NULL(mouseEvent); + if (causedByTouchEvent) { + env->SetBooleanField(mouseEvent, AwtMouseEvent::causedByTouchEventID, + JNI_TRUE); + } if (pMsg != 0) { AwtAWTEvent::saveMSG(env, pMsg, mouseEvent); }
--- a/src/windows/native/sun/windows/awt_Component.h Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Component.h Mon Aug 27 16:38:06 2018 +0100 @@ -67,7 +67,10 @@ const int ALL_MK_BUTTONS = MK_LBUTTON|MK_MBUTTON|MK_RBUTTON; const int X_BUTTONS = MK_XBUTTON1|MK_XBUTTON2; - +// The allowable difference between coordinates of the WM_TOUCH event and the +// corresponding WM_LBUTTONDOWN/WM_LBUTTONUP event letting to associate these +// events, when their coordinates are slightly different. +const int TOUCH_MOUSE_COORDS_DELTA = 10; // Whether to check for embedded frame and adjust location #define CHECK_EMBEDDED 0 @@ -384,7 +387,7 @@ void SendMouseEvent(jint id, jlong when, jint x, jint y, jint modifiers, jint clickCount, jboolean popupTrigger, jint button = 0, - MSG *msg = NULL); + MSG *msg = NULL, BOOL causedByTouchEvent = FALSE); /* * Allocate and initialize a new java.awt.event.MouseWheelEvent, and @@ -526,6 +529,7 @@ virtual MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button); virtual MsgRouting WmWindowPosChanging(LPARAM windowPos); virtual MsgRouting WmWindowPosChanged(LPARAM windowPos); + virtual void WmTouch(WPARAM wParam, LPARAM lParam); // NB: 64-bit: vkey is wParam of the message, but other API's take // vkey parameters of type UINT, so we do the cast before dispatching. @@ -762,6 +766,11 @@ */ UINT m_mouseButtonClickAllowed; + BOOL m_touchDownOccurred; + BOOL m_touchUpOccurred; + POINT m_touchDownPoint; + POINT m_touchUpPoint; + BOOL m_bSubclassed; BOOL m_bPauseDestroy;
--- a/src/windows/native/sun/windows/awt_Dialog.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Dialog.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2018, 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 @@ -119,7 +119,8 @@ if (parent != NULL) { JNI_CHECK_PEER_GOTO(parent, done); awtParent = (AwtWindow *)pData; - hwndParent = awtParent->GetHWnd(); + HWND oHWnd = awtParent->GetOverriddenHWnd(); + hwndParent = oHWnd ? oHWnd : awtParent->GetHWnd(); } else { // There is no way to prevent a parentless dialog from showing on // the taskbar other than to specify an invisible parent and set
--- a/src/windows/native/sun/windows/awt_FileDialog.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_FileDialog.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -251,13 +251,7 @@ OPENFILENAME ofn; memset(&ofn, 0, sizeof(ofn)); - /* - * There's a situation (see bug 4906972) when InvokeFunction (by which this method is called) - * returnes earlier than this method returnes. Probably it's caused due to ReplyMessage system call. - * So for the avoidance of this mistiming we need to make new global reference here - * (not local as it's used by the hook) and then manage it independently of the calling thread. - */ - peer = env->NewGlobalRef((jobject)p); + peer = (jobject)p; try { DASSERT(peer);
--- a/src/windows/native/sun/windows/awt_Frame.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Frame.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -169,7 +169,8 @@ JNI_CHECK_PEER_GOTO(parent, done); { AwtFrame* parent = (AwtFrame *)pData; - hwndParent = parent->GetHWnd(); + HWND oHWnd = parent->GetOverriddenHWnd(); + hwndParent = oHWnd ? oHWnd : parent->GetHWnd(); } }
--- a/src/windows/native/sun/windows/awt_InputTextInfor.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_InputTextInfor.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -202,9 +202,15 @@ m_lpClauseW == NULL || m_lpReadClauseW == NULL || m_lpClauseW[0] != 0 || m_lpClauseW[m_cClauseW] != (DWORD)m_cStrW || m_lpReadClauseW[0] != 0 || m_lpReadClauseW[m_cReadClauseW] != (DWORD)m_cReadStrW) { - lpBndClauseW = NULL; - lpReadingClauseW = NULL; - return 0; + // For cases where IMM sends WM_IME_COMPOSITION with both GCS_COMPSTR and GCS_RESULTSTR + // The GCS_RESULTSTR part may have Caluse and Reading information which should not be ignored + if (NULL == m_pResultTextInfor) { + lpBndClauseW = NULL; + lpReadingClauseW = NULL; + return 0; + } else { + return m_pResultTextInfor->GetClauseInfor(lpBndClauseW, lpReadingClauseW); + } } int* bndClauseW = NULL; @@ -346,10 +352,14 @@ // int AwtInputTextInfor::GetAttributeInfor(int*& lpBndAttrW, BYTE*& lpValAttrW) { if (m_cStrW == 0 || m_cAttrW != m_cStrW) { - lpBndAttrW = NULL; - lpValAttrW = NULL; + if (NULL == m_pResultTextInfor) { + lpBndAttrW = NULL; + lpValAttrW = NULL; - return 0; + return 0; + } else { + return m_pResultTextInfor->GetAttributeInfor(lpBndAttrW, lpValAttrW); + } } int* bndAttrW = NULL;
--- a/src/windows/native/sun/windows/awt_MouseEvent.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_MouseEvent.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -32,6 +32,7 @@ jfieldID AwtMouseEvent::xID; jfieldID AwtMouseEvent::yID; +jfieldID AwtMouseEvent::causedByTouchEventID; jfieldID AwtMouseEvent::buttonID; /************************************************************************ @@ -52,6 +53,11 @@ DASSERT(AwtMouseEvent::yID != NULL); CHECK_NULL(AwtMouseEvent::yID); + AwtMouseEvent::causedByTouchEventID = env->GetFieldID( + cls, "causedByTouchEvent", "Z"); + DASSERT(AwtMouseEvent::causedByTouchEventID != NULL); + CHECK_NULL(AwtMouseEvent::causedByTouchEventID); + AwtMouseEvent::buttonID = env->GetFieldID(cls, "button", "I"); DASSERT(AwtMouseEvent::buttonID != NULL); CHECK_NULL(AwtMouseEvent::buttonID);
--- a/src/windows/native/sun/windows/awt_MouseEvent.h Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_MouseEvent.h Mon Aug 27 16:38:06 2018 +0100 @@ -39,6 +39,7 @@ /* java.awt.MouseEvent field ids */ static jfieldID xID; static jfieldID yID; + static jfieldID causedByTouchEventID; static jfieldID buttonID; };
--- a/src/windows/native/sun/windows/awt_Toolkit.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Toolkit.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -29,6 +29,8 @@ #include <signal.h> #include <windowsx.h> #include <process.h> +#include <shellapi.h> +#include <shlwapi.h> #include "awt_DrawingSurface.h" #include "awt_AWTEvent.h" @@ -292,6 +294,13 @@ m_isDynamicLayoutSet = FALSE; m_areExtraMouseButtonsEnabled = TRUE; + m_isWin8OrLater = FALSE; + m_touchKbrdAutoShowIsEnabled = FALSE; + m_touchKbrdExeFilePath = NULL; + m_pRegisterTouchWindow = NULL; + m_pGetTouchInputInfo = NULL; + m_pCloseTouchInputHandle = NULL; + m_verifyComponents = FALSE; m_breakOnError = FALSE; @@ -345,6 +354,149 @@ return hwnd; } +void AwtToolkit::InitTouchKeyboardExeFilePath() { + enum RegistryView { WOW64_32BIT, WOW64_64BIT }; + const TCHAR tabTipCoKeyName[] = _T("SOFTWARE\\Classes\\CLSID\\") + _T("{054AAE20-4BEA-4347-8A35-64A533254A9D}\\LocalServer32"); + HKEY hTabTipCoKey = NULL; + RegistryView regViewWithTabTipCoKey = WOW64_32BIT; + + if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, tabTipCoKeyName, 0, + KEY_READ | KEY_WOW64_32KEY, &hTabTipCoKey) != ERROR_SUCCESS) { + if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, tabTipCoKeyName, 0, + KEY_READ | KEY_WOW64_64KEY, &hTabTipCoKey) != ERROR_SUCCESS) { + return; + } else { + regViewWithTabTipCoKey = WOW64_64BIT; + } + } + + DWORD keyValType = 0; + DWORD bytesCopied = 0; + if ((::RegQueryValueEx(hTabTipCoKey, NULL, NULL, &keyValType, NULL, + &bytesCopied) != ERROR_SUCCESS) || + ((keyValType != REG_EXPAND_SZ) && (keyValType != REG_SZ))) { + if (hTabTipCoKey != NULL) { + ::RegCloseKey(hTabTipCoKey); + } + return; + } + + // Increase the buffer size for 1 additional null-terminating character. + bytesCopied += sizeof(TCHAR); + TCHAR* tabTipFilePath = new TCHAR[bytesCopied / sizeof(TCHAR)]; + ::memset(tabTipFilePath, 0, bytesCopied); + + DWORD oldBytesCopied = bytesCopied; + if (::RegQueryValueEx(hTabTipCoKey, NULL, NULL, NULL, + (LPBYTE)tabTipFilePath, &bytesCopied) == ERROR_SUCCESS) { + const TCHAR searchedStr[] = _T("%CommonProgramFiles%"); + const size_t searchedStrLen = ::_tcslen(searchedStr); + int searchedStrStartIndex = -1; + + TCHAR* commonFilesDirPath = NULL; + DWORD commonFilesDirPathLen = 0; + + // Check, if '%CommonProgramFiles%' string is present in the defined + // path of the touch keyboard executable. + TCHAR* const searchedStrStart = ::_tcsstr(tabTipFilePath, searchedStr); + if (searchedStrStart != NULL) { + searchedStrStartIndex = searchedStrStart - tabTipFilePath; + + // Get value of 'CommonProgramFiles' environment variable, if the + // file path of the touch keyboard executable was found in 32-bit + // registry view, otherwise get value of 'CommonProgramW6432'. + const TCHAR envVar32BitName[] = _T("CommonProgramFiles"); + const TCHAR envVar64BitName[] = _T("CommonProgramW6432"); + const TCHAR* envVarName = (regViewWithTabTipCoKey == WOW64_32BIT ? + envVar32BitName : envVar64BitName); + + DWORD charsStored = ::GetEnvironmentVariable(envVarName, NULL, 0); + if (charsStored > 0) { + commonFilesDirPath = new TCHAR[charsStored]; + ::memset(commonFilesDirPath, 0, charsStored * sizeof(TCHAR)); + + DWORD oldCharsStored = charsStored; + if (((charsStored = ::GetEnvironmentVariable(envVarName, + commonFilesDirPath, charsStored)) > 0) && + (charsStored <= oldCharsStored)) { + commonFilesDirPathLen = charsStored; + } else { + delete[] commonFilesDirPath; + commonFilesDirPath = NULL; + } + } + } + + // Calculate 'm_touchKbrdExeFilePath' length in characters including + // the null-terminating character. + DWORD exeFilePathLen = oldBytesCopied / sizeof(TCHAR); + if (commonFilesDirPathLen > 0) { + exeFilePathLen = exeFilePathLen - searchedStrLen + + commonFilesDirPathLen; + } + + if (m_touchKbrdExeFilePath != NULL) { + delete[] m_touchKbrdExeFilePath; + m_touchKbrdExeFilePath = NULL; + } + m_touchKbrdExeFilePath = new TCHAR[exeFilePathLen]; + ::memset(m_touchKbrdExeFilePath, 0, exeFilePathLen * sizeof(TCHAR)); + + if (commonFilesDirPathLen > 0) { + ::_tcsncpy_s(m_touchKbrdExeFilePath, exeFilePathLen, tabTipFilePath, + searchedStrStartIndex); + DWORD charsCopied = searchedStrStartIndex; + + ::_tcsncpy_s(m_touchKbrdExeFilePath + charsCopied, + exeFilePathLen - charsCopied, commonFilesDirPath, + commonFilesDirPathLen); + charsCopied += commonFilesDirPathLen; + + ::_tcsncpy_s(m_touchKbrdExeFilePath + charsCopied, + exeFilePathLen - charsCopied, searchedStrStart + searchedStrLen, + bytesCopied / sizeof(TCHAR) - + (searchedStrStartIndex + searchedStrLen)); + } else { + ::_tcsncpy_s(m_touchKbrdExeFilePath, exeFilePathLen, tabTipFilePath, + bytesCopied / sizeof(TCHAR)); + } + + // Remove leading and trailing quotation marks. + ::StrTrim(m_touchKbrdExeFilePath, _T("\"")); + + // Verify that a file with the path 'm_touchKbrdExeFilePath' exists. + DWORD fileAttrs = ::GetFileAttributes(m_touchKbrdExeFilePath); + DWORD err = ::GetLastError(); + if ((fileAttrs == INVALID_FILE_ATTRIBUTES) || + (fileAttrs & FILE_ATTRIBUTE_DIRECTORY)) { + delete[] m_touchKbrdExeFilePath; + m_touchKbrdExeFilePath = NULL; + } + + if (commonFilesDirPath != NULL) { + delete[] commonFilesDirPath; + } + } + + if (tabTipFilePath != NULL) { + delete[] tabTipFilePath; + } + if (hTabTipCoKey != NULL) { + ::RegCloseKey(hTabTipCoKey); + } +} + +HWND AwtToolkit::GetTouchKeyboardWindow() { + const TCHAR wndClassName[] = _T("IPTip_Main_Window"); + HWND hwnd = ::FindWindow(wndClassName, NULL); + if ((hwnd != NULL) && ::IsWindow(hwnd) && ::IsWindowEnabled(hwnd) && + ::IsWindowVisible(hwnd)) { + return hwnd; + } + return NULL; +} + struct ToolkitThreadProc_Data { bool result; @@ -503,6 +655,52 @@ awt_dnd_initialize(); + /* + * Initialization of the touch keyboard related variables. + */ + tk.m_isWin8OrLater = IS_WIN8; + + TRY; + + JNIEnv* env = AwtToolkit::GetEnv(); + jclass sunToolkitCls = env->FindClass("sun/awt/SunToolkit"); + DASSERT(sunToolkitCls != 0); + CHECK_NULL_RETURN(sunToolkitCls, FALSE); + + jmethodID isTouchKeyboardAutoShowEnabledMID = env->GetStaticMethodID( + sunToolkitCls, "isTouchKeyboardAutoShowEnabled", "()Z"); + DASSERT(isTouchKeyboardAutoShowEnabledMID != 0); + CHECK_NULL_RETURN(isTouchKeyboardAutoShowEnabledMID, FALSE); + + tk.m_touchKbrdAutoShowIsEnabled = env->CallStaticBooleanMethod( + sunToolkitCls, isTouchKeyboardAutoShowEnabledMID); + + CATCH_BAD_ALLOC_RET(FALSE); + + if (tk.m_isWin8OrLater && tk.m_touchKbrdAutoShowIsEnabled) { + tk.InitTouchKeyboardExeFilePath(); + HMODULE hUser32Dll = ::LoadLibrary(_T("user32.dll")); + if (hUser32Dll != NULL) { + tk.m_pRegisterTouchWindow = (RegisterTouchWindowFunc) + ::GetProcAddress(hUser32Dll, "RegisterTouchWindow"); + tk.m_pGetTouchInputInfo = (GetTouchInputInfoFunc) + ::GetProcAddress(hUser32Dll, "GetTouchInputInfo"); + tk.m_pCloseTouchInputHandle = (CloseTouchInputHandleFunc) + ::GetProcAddress(hUser32Dll, "CloseTouchInputHandle"); + } + + if ((tk.m_pRegisterTouchWindow == NULL) || + (tk.m_pGetTouchInputInfo == NULL) || + (tk.m_pCloseTouchInputHandle == NULL)) { + tk.m_pRegisterTouchWindow = NULL; + tk.m_pGetTouchInputInfo = NULL; + tk.m_pCloseTouchInputHandle = NULL; + } + } + /* + * End of the touch keyboard related initialization code. + */ + return TRUE; } @@ -527,6 +725,14 @@ awt_dnd_uninitialize(); awt_clipboard_uninitialize((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2)); + if (tk.m_touchKbrdExeFilePath != NULL) { + delete[] tk.m_touchKbrdExeFilePath; + tk.m_touchKbrdExeFilePath = NULL; + } + tk.m_pRegisterTouchWindow = NULL; + tk.m_pGetTouchInputInfo = NULL; + tk.m_pCloseTouchInputHandle = NULL; + if (tk.m_inputMethodHWnd != NULL) { ::SendMessage(tk.m_inputMethodHWnd, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0); } @@ -2673,6 +2879,32 @@ CATCH_BAD_ALLOC_RET(NULL); } +JNIEXPORT void JNICALL +Java_sun_awt_windows_WToolkit_showTouchKeyboard(JNIEnv *env, jobject self, + jboolean causedByTouchEvent) +{ + AwtToolkit& tk = AwtToolkit::GetInstance(); + if (!tk.IsWin8OrLater() || !tk.IsTouchKeyboardAutoShowEnabled()) { + return; + } + + if (causedByTouchEvent || + (tk.IsTouchKeyboardAutoShowSystemEnabled() && + !tk.IsAnyKeyboardAttached())) { + tk.ShowTouchKeyboard(); + } +} + +JNIEXPORT void JNICALL +Java_sun_awt_windows_WToolkit_hideTouchKeyboard(JNIEnv *env, jobject self) +{ + AwtToolkit& tk = AwtToolkit::GetInstance(); + if (!tk.IsWin8OrLater() || !tk.IsTouchKeyboardAutoShowEnabled()) { + return; + } + tk.HideTouchKeyboard(); +} + JNIEXPORT jboolean JNICALL Java_sun_awt_windows_WToolkit_syncNativeQueue(JNIEnv *env, jobject self, jlong timeout) { @@ -2745,3 +2977,119 @@ UINT AwtToolkit::GetNumberOfButtons() { return MOUSE_BUTTONS_WINDOWS_SUPPORTED; } + +bool AwtToolkit::IsWin8OrLater() { + return m_isWin8OrLater; +} + +bool AwtToolkit::IsTouchKeyboardAutoShowEnabled() { + return m_touchKbrdAutoShowIsEnabled; +} + +bool AwtToolkit::IsAnyKeyboardAttached() { + UINT numDevs = 0; + UINT numDevsRet = 0; + const UINT devListTypeSize = sizeof(RAWINPUTDEVICELIST); + if ((::GetRawInputDeviceList(NULL, &numDevs, devListTypeSize) != 0) || + (numDevs == 0)) { + return false; + } + + RAWINPUTDEVICELIST* pDevList = new RAWINPUTDEVICELIST[numDevs]; + while (((numDevsRet = ::GetRawInputDeviceList(pDevList, &numDevs, + devListTypeSize)) == (UINT)-1) && + (::GetLastError() == ERROR_INSUFFICIENT_BUFFER)) { + if (pDevList != NULL) { + delete[] pDevList; + } + pDevList = new RAWINPUTDEVICELIST[numDevs]; + } + + bool keyboardIsAttached = false; + if (numDevsRet != (UINT)-1) { + for (UINT i = 0; i < numDevsRet; i++) { + if (pDevList[i].dwType == RIM_TYPEKEYBOARD) { + keyboardIsAttached = true; + break; + } + } + } + + if (pDevList != NULL) { + delete[] pDevList; + } + return keyboardIsAttached; +} + +bool AwtToolkit::IsTouchKeyboardAutoShowSystemEnabled() { + const TCHAR tabTipKeyName[] = _T("SOFTWARE\\Microsoft\\TabletTip\\1.7"); + HKEY hTabTipKey = NULL; + if (::RegOpenKeyEx(HKEY_CURRENT_USER, tabTipKeyName, 0, KEY_READ, + &hTabTipKey) != ERROR_SUCCESS) { + return false; + } + + const TCHAR enableAutoInvokeValName[] = _T("EnableDesktopModeAutoInvoke"); + DWORD keyValType = 0; + bool autoShowIsEnabled = false; + if (::RegQueryValueEx(hTabTipKey, enableAutoInvokeValName, NULL, + &keyValType, NULL, NULL) == ERROR_SUCCESS) { + if (keyValType == REG_DWORD) { + DWORD enableAutoInvokeVal = 0; + DWORD bytesCopied = sizeof(DWORD); + if (::RegQueryValueEx(hTabTipKey, enableAutoInvokeValName, NULL, + NULL, (LPBYTE)(DWORD*)&enableAutoInvokeVal, + &bytesCopied) == ERROR_SUCCESS) { + autoShowIsEnabled = (enableAutoInvokeVal == 0 ? false : true); + } + } + } + + if (hTabTipKey != NULL) { + ::RegCloseKey(hTabTipKey); + } + return autoShowIsEnabled; +} + +void AwtToolkit::ShowTouchKeyboard() { + if (m_isWin8OrLater && m_touchKbrdAutoShowIsEnabled && + (m_touchKbrdExeFilePath != NULL)) { + HINSTANCE retVal = ::ShellExecute(NULL, _T("open"), + m_touchKbrdExeFilePath, NULL, NULL, SW_SHOW); + if ((int)retVal <= 32) { + DTRACE_PRINTLN1("AwtToolkit::ShowTouchKeyboard: Failed" + ", retVal='%d'", (int)retVal); + } + } +} + +void AwtToolkit::HideTouchKeyboard() { + if (m_isWin8OrLater && m_touchKbrdAutoShowIsEnabled) { + HWND hwnd = GetTouchKeyboardWindow(); + if (hwnd != NULL) { + ::PostMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); + } + } +} + +BOOL AwtToolkit::TIRegisterTouchWindow(HWND hWnd, ULONG ulFlags) { + if (m_pRegisterTouchWindow == NULL) { + return FALSE; + } + return m_pRegisterTouchWindow(hWnd, ulFlags); +} + +BOOL AwtToolkit::TIGetTouchInputInfo(HTOUCHINPUT hTouchInput, + UINT cInputs, PTOUCHINPUT pInputs, int cbSize) { + if (m_pGetTouchInputInfo == NULL) { + return FALSE; + } + return m_pGetTouchInputInfo(hTouchInput, cInputs, pInputs, cbSize); +} + +BOOL AwtToolkit::TICloseTouchInputHandle(HTOUCHINPUT hTouchInput) { + if (m_pCloseTouchInputHandle == NULL) { + return FALSE; + } + return m_pCloseTouchInputHandle(hTouchInput); +}
--- a/src/windows/native/sun/windows/awt_Toolkit.h Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Toolkit.h Mon Aug 27 16:38:06 2018 +0100 @@ -158,6 +158,48 @@ GetCurrentThreadId(), &(cs), THIS_FILE, __LINE__); \ } +// Redefine WinAPI values related to touch input, if OS < Windows 7. +#if (!defined(WINVER) || ((WINVER) < 0x0601)) + /* + * RegisterTouchWindow flag values + */ + #define TWF_FINETOUCH (0x00000001) + #define TWF_WANTPALM (0x00000002) + + #define WM_TOUCH 0x0240 + + /* + * Touch input handle + */ + typedef HANDLE HTOUCHINPUT; + + typedef struct tagTOUCHINPUT { + LONG x; + LONG y; + HANDLE hSource; + DWORD dwID; + DWORD dwFlags; + DWORD dwMask; + DWORD dwTime; + ULONG_PTR dwExtraInfo; + DWORD cxContact; + DWORD cyContact; + } TOUCHINPUT, *PTOUCHINPUT; + typedef TOUCHINPUT const * PCTOUCHINPUT; + + /* + * Touch input flag values (TOUCHINPUT.dwFlags) + */ + #define TOUCHEVENTF_MOVE 0x0001 + #define TOUCHEVENTF_DOWN 0x0002 + #define TOUCHEVENTF_UP 0x0004 + #define TOUCHEVENTF_INRANGE 0x0008 + #define TOUCHEVENTF_PRIMARY 0x0010 + #define TOUCHEVENTF_NOCOALESCE 0x0020 + #define TOUCHEVENTF_PEN 0x0040 + #define TOUCHEVENTF_PALM 0x0080 +#endif + /************************************************************************ * AwtToolkit class */ @@ -193,6 +235,17 @@ void setExtraMouseButtonsEnabled(BOOL enable); static UINT GetNumberOfButtons(); + bool IsWin8OrLater(); + bool IsTouchKeyboardAutoShowEnabled(); + bool IsAnyKeyboardAttached(); + bool IsTouchKeyboardAutoShowSystemEnabled(); + void ShowTouchKeyboard(); + void HideTouchKeyboard(); + BOOL TIRegisterTouchWindow(HWND hWnd, ULONG ulFlags); + BOOL TIGetTouchInputInfo(HTOUCHINPUT hTouchInput, + UINT cInputs, PTOUCHINPUT pInputs, int cbSize); + BOOL TICloseTouchInputHandle(HTOUCHINPUT hTouchInput); + INLINE BOOL localPump() { return m_localPump; } INLINE BOOL VerifyComponents() { return FALSE; } // TODO: Use new DebugHelper class to set this flag INLINE HWND GetHWnd() { return m_toolkitHWnd; } @@ -391,6 +444,9 @@ private: HWND CreateToolkitWnd(LPCTSTR name); + void InitTouchKeyboardExeFilePath(); + HWND GetTouchKeyboardWindow(); + BOOL m_localPump; DWORD m_mainThreadId; HWND m_toolkitHWnd; @@ -400,6 +456,18 @@ BOOL m_isDisposed; // set to TRUE at end of Dispose BOOL m_areExtraMouseButtonsEnabled; + typedef BOOL (WINAPI *RegisterTouchWindowFunc)(HWND hWnd, ULONG ulFlags); + typedef BOOL (WINAPI *GetTouchInputInfoFunc)(HTOUCHINPUT hTouchInput, + UINT cInputs, PTOUCHINPUT pInputs, int cbSize); + typedef BOOL (WINAPI *CloseTouchInputHandleFunc)(HTOUCHINPUT hTouchInput); + + BOOL m_isWin8OrLater; + BOOL m_touchKbrdAutoShowIsEnabled; + TCHAR* m_touchKbrdExeFilePath; + RegisterTouchWindowFunc m_pRegisterTouchWindow; + GetTouchInputInfoFunc m_pGetTouchInputInfo; + CloseTouchInputHandleFunc m_pCloseTouchInputHandle; + BOOL m_vmSignalled; // set to TRUE if QUERYENDSESSION has successfully // raised SIGTERM
--- a/src/windows/native/sun/windows/awt_Window.cpp Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Window.cpp Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2018, 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 @@ -148,6 +148,10 @@ jboolean isFSEMState; }; +struct OverrideHandle { + jobject frame; + HWND handle; +}; /************************************************************************ * AwtWindow fields @@ -223,6 +227,7 @@ m_alwaysOnTop = false; fullScreenExclusiveModeState = FALSE; + m_overriddenHwnd = NULL; } AwtWindow::~AwtWindow() @@ -2471,6 +2476,24 @@ delete rfs; } +void AwtWindow::_OverrideHandle(void *param) +{ + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + OverrideHandle* oh = (OverrideHandle *)param; + jobject self = oh->frame; + AwtWindow *f = NULL; + + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + f = (AwtWindow *)pData; + f->OverrideHWnd(oh->handle); +ret: + env->DeleteGlobalRef(self); + + delete oh; +} + /* * This is AwtWindow-specific function that is not intended for reusing */ @@ -3127,7 +3150,29 @@ CATCH_BAD_ALLOC; } -} /* extern "C" */ +/* + +* Class: sun_awt_windows_WLightweightFramePeer +* Method: overrideNativeHandle +* Signature: (J)V +*/ + +JNIEXPORT void JNICALL Java_sun_awt_windows_WLightweightFramePeer_overrideNativeHandle +(JNIEnv *env, jobject self, jlong hwnd) +{ + TRY; + + OverrideHandle *oh = new OverrideHandle; + oh->frame = env->NewGlobalRef(self); + oh->handle = (HWND)hwnd; + + AwtToolkit::GetInstance().SyncCall(AwtFrame::_OverrideHandle, oh); + // global ref and oh are deleted in _OverrideHandle() + + CATCH_BAD_ALLOC; +} + +}/* extern "C" */ /************************************************************************
--- a/src/windows/native/sun/windows/awt_Window.h Sun Aug 19 04:29:53 2018 +0100 +++ b/src/windows/native/sun/windows/awt_Window.h Mon Aug 27 16:38:06 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2018, 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 @@ -242,6 +242,7 @@ static void _RepositionSecurityWarning(void* param); static void _SetFullScreenExclusiveModeState(void* param); static void _GetNativeWindowSize(void* param); + static void _OverrideHandle(void *param); inline static BOOL IsResizing() { return sm_resizing; @@ -257,6 +258,9 @@ static void FocusedWindowChanged(HWND from, HWND to); + inline HWND GetOverriddenHWnd() { return m_overriddenHwnd; } + inline void OverrideHWnd(HWND hwnd) { m_overriddenHwnd = hwnd; } + private: static int ms_instanceCounter; static HHOOK ms_hCBTFilter; @@ -308,6 +312,9 @@ // The tooltip that appears when hovering the icon HWND securityTooltipWindow; + //Allows substitute parent window with JavaFX stage to make it below a dialog + HWND m_overriddenHwnd; + UINT warningWindowWidth; UINT warningWindowHeight; void InitSecurityWarningSize(JNIEnv *env);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/FileDialog/FileDialogMemoryLeak/FileDialogLeakTest.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/** + * @test + * @bug 8177758 + * @requires os.family == "windows" + * @summary Regression in java.awt.FileDialog + * @run main FileDialogLeakTest + */ + +public class FileDialogLeakTest { + static CountDownLatch latch = new CountDownLatch(3); + static boolean passed; + + public static void main(String[] args) throws Exception { + test(); + System.gc(); + System.runFinalization(); + latch.await(1, TimeUnit.SECONDS); + if (!passed) { + throw new RuntimeException("Test failed."); + } + } + + private static void test() throws Exception { + FileDialog fd = new FileDialog((Frame) null) { + @Override + protected void finalize() throws Throwable { + System.out.println("Finalize"); + super.finalize(); + passed = true; + latch.countDown(); + } + }; + + new Thread(() -> { + latch.countDown(); + fd.setVisible(true); + latch.countDown(); + }).start(); + latch.await(1, TimeUnit.SECONDS); + fd.dispose(); + latch.await(1, TimeUnit.SECONDS); + } + +} +
--- a/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java Mon Aug 27 16:38:06 2018 +0100 @@ -41,7 +41,7 @@ /** * @test * @key headful - * @bug 8061831 + * @bug 8061831 8130400 * @summary Tests drawing volatile image to volatile image using different * clips + xor mode. Results of the blit compatibleImage to * compatibleImage is used for comparison.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/Runtime/shutdown/ShutdownInterruptedMain.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016, 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 8154017 + * @library /lib/testlibrary + * @build jdk.testlibrary.* + * @summary Shutdown hooks are racing against shutdown sequence, + if System.exit()-calling thread is interrupted + * @run main ShutdownInterruptedMain exec + */ + +import jdk.testlibrary.OutputAnalyzer; +import static jdk.testlibrary.ProcessTools.createJavaProcessBuilder; +import static jdk.testlibrary.ProcessTools.executeProcess; + +public class ShutdownInterruptedMain { + + public static void main(String[] args) throws Throwable { + if (args.length > 0) { + ProcessBuilder pb = createJavaProcessBuilder(true, "ShutdownInterruptedMain"); + OutputAnalyzer output = executeProcess(pb); + output.shouldContain("Shutdown Hook"); + output.shouldHaveExitValue(0); + return; + } + + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + // Wait for the race to unfold: + try { + Thread.sleep(5_000); + } catch (InterruptedException e) {} + System.out.println("Shutdown Hook"); + System.out.flush(); + } + }); + Thread.currentThread().interrupt(); + System.exit(0); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/ref/FinalizerHistogramTest.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2015, 2017, 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.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; + +import java.lang.reflect.Method; +import java.lang.reflect.Field; + +/* + * @test + * @summary Unit test for FinalizerHistogram + * @run main FinalizerHistogramTest + */ + +public class FinalizerHistogramTest { + static ReentrantLock lock = new ReentrantLock(); + static volatile int wasInitialized = 0; + static volatile int wasTrapped = 0; + static final int objectsCount = 1000; + + static class MyObject { + public MyObject() { + // Make sure object allocation/deallocation is not optimized out + wasInitialized += 1; + } + + protected void finalize() { + // Trap the object in a finalization queue + wasTrapped += 1; + lock.lock(); + } + } + + public static void main(String[] argvs) { + try { + lock.lock(); + for(int i = 0; i < objectsCount; ++i) { + new MyObject(); + } + System.out.println("Objects intialized: " + objectsCount); + System.gc(); + while(wasTrapped < 1); + + Class<?> klass = Class.forName("java.lang.ref.FinalizerHistogram"); + + Method m = klass.getDeclaredMethod("getFinalizerHistogram"); + m.setAccessible(true); + Object entries[] = (Object[]) m.invoke(null); + + Class<?> entryKlass = Class.forName("java.lang.ref.FinalizerHistogram$Entry"); + Field name = entryKlass.getDeclaredField("className"); + name.setAccessible(true); + Field count = entryKlass.getDeclaredField("instanceCount"); + count.setAccessible(true); + + System.out.println("Unreachable instances waiting for finalization"); + System.out.println("#instances class name"); + System.out.println("-----------------------"); + + boolean found = false; + for (Object entry : entries) { + Object e = entryKlass.cast(entry); + System.out.printf("%10d %s\n", count.get(e), name.get(e)); + if (((String) name.get(e)).indexOf("MyObject") != -1 ) { + found = true; + } + } + + if (!found) { + throw new RuntimeException("MyObject is not found in test output"); + } + + System.out.println("Test PASSED"); + } catch(Exception e) { + System.err.println("Test failed with " + e); + e.printStackTrace(System.err); + throw new RuntimeException("Test failed"); + } finally { + lock.unlock(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/text/Format/DecimalFormat/Bug8165466.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2016, 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 8165466 + * @summary Checks the subsequent function calls of the DecimalFormat.format() + * method in which the minimumFractionDigit is set to 0 and one of + * the format() call include formatting of the number with zero + * fraction value e.g. 0.00, 9.00 + */ + +import java.text.DecimalFormat; +import java.util.Locale; + +public class Bug8165466 { + + public static void main(String[] args) { + DecimalFormat nf = (DecimalFormat) DecimalFormat + .getPercentInstance(Locale.US); + nf.setMaximumFractionDigits(3); + nf.setMinimumFractionDigits(0); + nf.setMultiplier(1); + + double d = 0.005678; + String result = nf.format(d); + if (!result.equals("0.006%")) { + throw new RuntimeException("[Failed while formatting the double" + + " value: " + d + " Expected: 0.006%, Found: " + result + + "]"); + } + + d = 0.00; + result = nf.format(d); + if (!result.equals("0%")) { + throw new RuntimeException("[Failed while formatting the double" + + " value: " + d + " Expected: 0%, Found: " + result + + "]"); + } + + d = 0.005678; + result = nf.format(d); + if (!result.equals("0.006%")) { + throw new RuntimeException("[Failed while formatting the double" + + " value: " + d + " Expected: 0.006%, Found: " + result + + "]"); + } + + //checking with the non zero value + d = 0.005678; + result = nf.format(d); + if (!result.equals("0.006%")) { + throw new RuntimeException("[Failed while formatting the double" + + " value: " + d + " Expected: 0.006%, Found: " + result + + "]"); + } + + d = 9.00; + result = nf.format(d); + if (!result.equals("9%")) { + throw new RuntimeException("[Failed while formatting the double" + + " value: " + d + " Expected: 9%, Found: " + result + + "]"); + } + + d = 0.005678; + result = nf.format(d); + if (!result.equals("0.006%")) { + throw new RuntimeException("[Failed while formatting the double" + + " value: " + d + " Expected: 0.006%, Found: " + result + + "]"); + } + } + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JTextField/JapaneseReadingAttributes/JapaneseReadingAttributes.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2017, 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 8176072 + * @summary Checks whether reading attributes are obtained for Japanese IME + * @requires (os.family == "windows") + * @run main/manual JapaneseReadingAttributes + */ + +/** + * This test requires a manual intervention as the keyboard layout has to be + * changed to Japanese IME. Once the keyboard layout has been selected, click on + * Start Test to start the automated tests. Will run two passes, first with an + * enter key in between to generate the yomigana for the first block of + * characters. The second without the intermediate enter key. Without the fix, + * there will be a mismatch in the reading attributes obtained. + */ + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Robot; +import java.awt.event.InputMethodEvent; +import java.awt.event.InputMethodListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import java.awt.event.KeyEvent; +import java.text.AttributedCharacterIterator; +import java.util.ArrayList; +import java.util.concurrent.CountDownLatch; +import javax.swing.JLabel; +import javax.swing.JTextField; + +public class JapaneseReadingAttributes { + private static boolean testPassed = false; + private static boolean startTest = false; + + private static JFrame frame = null; + private static JLabel lblTestStatus = null; + private static JTextField textFieldMain = null; + private static JTextField textFieldReading = null; + private static String testResult; + private static String readingPass1; + private static String readingPass2; + + private static final CountDownLatch testStartLatch = new CountDownLatch(1); + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> { + setupUI(); + }); + + testStartLatch.await(); + + if (startTest) { + glyphTest(); + + frame.dispose(); + + if (testPassed) { + System.out.println(testResult); + } else { + throw new RuntimeException(testResult); + } + } else { + throw new RuntimeException("User has not executed the test"); + } + } + + private static void setupUI() { + String description = " 1. Go to \"Language Preferences -> Add a Language" + + "\" and add \"Japanese\"\n" + + " 2. Set current IM to \"Japanese\" \n" + + " 3. Try typing in the text field to ensure" + + " that Japanese IME has been successfully" + + " selected \n" + + " 4. Now click on \"Start Test\" button \n"; + String title = "Reading Attributes test Japanese IME (Windows)"; + + frame = new JFrame(title); + + JPanel mainPanel = new JPanel(new BorderLayout()); + + JPanel textEditPanel = new JPanel(new FlowLayout()); + + textFieldMain = new JTextField(20); + + textFieldReading = new JTextField(20); + textFieldReading.setEditable(false); + + textEditPanel.add(textFieldMain); + textEditPanel.add(textFieldReading); + + mainPanel.add(textEditPanel, BorderLayout.CENTER); + + JTextArea textArea = new JTextArea(description); + textArea.setEditable(false); + final JButton btnStartTest = new JButton("Start Test"); + final JButton btnCancelTest = new JButton("Cancel Test"); + + btnStartTest.addActionListener((e) -> { + btnStartTest.setEnabled(false); + btnCancelTest.setEnabled(false); + startTest = true; + testStartLatch.countDown(); + }); + + btnCancelTest.addActionListener((e) -> { + frame.dispose(); + testStartLatch.countDown(); + }); + mainPanel.add(textArea, BorderLayout.NORTH); + + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(btnStartTest); + buttonPanel.add(btnCancelTest); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + + lblTestStatus = new JLabel(""); + lblTestStatus.setMinimumSize(new Dimension(250, 20)); + lblTestStatus.setPreferredSize(new Dimension(250, 20)); + lblTestStatus.setVisible(true); + textEditPanel.add(lblTestStatus); + + frame.add(mainPanel); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.pack(); + frame.setLocationRelativeTo(null); + + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + testStartLatch.countDown(); + } + @Override + public void windowOpened( WindowEvent e ){ + textFieldMain.requestFocusInWindow(); + } + }); + + textFieldMain.addInputMethodListener(new InputMethodListener() { + @Override + public void caretPositionChanged(InputMethodEvent event) { + } + + @Override + public void inputMethodTextChanged(InputMethodEvent event) { + AttributedCharacterIterator itr = event.getText(); + if (itr != null) { + int toCopy = event.getCommittedCharacterCount(); + if (toCopy > 0) { + itr.first(); + StringBuilder yomigana = new StringBuilder( + textFieldReading.getText()); + while (toCopy-- > 0) { + if (itr.getIndex() == itr.getRunStart( + AttributedCharacterIterator.Attribute.READING)) { + java.text.Annotation annotatedText + = (java.text.Annotation) itr. + getAttribute(AttributedCharacterIterator.Attribute.READING); + yomigana.append(annotatedText.getValue()); + } + itr.next(); + } + textFieldReading.setText(yomigana.toString()); + } + } + } + }); + + frame.setVisible(true); + } + + private static void glyphTest() throws Exception { + Robot robotKeySimulator = new Robot(); + performTasks(robotKeySimulator); + } + + public static void performTasks(Robot robotForKeyInput) throws Exception { + lblTestStatus.setText("Running Tests.."); + robotForKeyInput.setAutoDelay(500); + + ArrayList<Integer> keyCodesToUse = new ArrayList<Integer>(); + + keyCodesToUse.add(KeyEvent.VK_A); + keyCodesToUse.add(KeyEvent.VK_B); + keyCodesToUse.add(KeyEvent.VK_E); + keyCodesToUse.add(KeyEvent.VK_SPACE); + keyCodesToUse.add(KeyEvent.VK_SPACE); + keyCodesToUse.add(KeyEvent.VK_ENTER); + keyCodesToUse.add(KeyEvent.VK_S); + keyCodesToUse.add(KeyEvent.VK_I); + keyCodesToUse.add(KeyEvent.VK_N); + keyCodesToUse.add(KeyEvent.VK_Z); + keyCodesToUse.add(KeyEvent.VK_O); + keyCodesToUse.add(KeyEvent.VK_U); + keyCodesToUse.add(KeyEvent.VK_SPACE); + keyCodesToUse.add(KeyEvent.VK_ENTER); + + textFieldMain.requestFocusInWindow(); + + robotForKeyInput.waitForIdle(); + + enterInput(robotForKeyInput, keyCodesToUse); + + SwingUtilities.invokeAndWait(() -> { + readingPass1 = textFieldReading.getText(); + }); + + if (setTaskStatus(readingPass1, 1)) { + keyCodesToUse.remove((Integer) KeyEvent.VK_ENTER); + + enterInput(robotForKeyInput, keyCodesToUse); + + SwingUtilities.invokeAndWait(() -> { + readingPass2 = textFieldReading.getText(); + }); + + if (setTaskStatus(readingPass2, 2)) { + if (readingPass1.equals(readingPass2)) { + testPassed = true; + testResult = "Test Passed : Same reading attribute " + + "obtained from both passes "; + lblTestStatus.setText(testResult); + } else { + testResult = "Test Failed : Reading attribute from Pass 1 <" + + readingPass1 + "> != Reading attribute " + + "from Pass 2 <" + readingPass2 + ">"; + } + } + } + } + + private static void enterInput(Robot robotKeyInput, + ArrayList<Integer> keyInputs) { + textFieldReading.setText(""); + textFieldMain.setText(""); + + String strKeyInput = "KeyPress=>"; + int nOfKeyInputs = keyInputs.size(); + for (int i = 0; i < nOfKeyInputs; i++) { + int keyToUse = keyInputs.get(i); + robotKeyInput.keyPress(keyToUse); + robotKeyInput.keyRelease(keyToUse); + strKeyInput += (Integer.toHexString(keyToUse)) + ":"; + } + + System.out.println(strKeyInput); + } + + public static boolean setTaskStatus(String readingValue, int passCount) { + boolean status = false; + + if (!readingValue.isEmpty()) { + testResult = "Attribute : " + readingValue + + "read from pass " + Integer.toString(passCount); + status = true; + } else { + testResult = "Failed to read Reading attribute from pass " + + Integer.toString(passCount); + } + + lblTestStatus.setText(testResult); + + return status; + } +}
--- a/test/sun/security/krb5/auto/AcceptPermissions.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/AcceptPermissions.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 9999999 * @summary default principal can act as anyone * @compile -XDignore.symbol.file AcceptPermissions.java - * @run main/othervm AcceptPermissions two - * @run main/othervm AcceptPermissions unbound + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AcceptPermissions two + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AcceptPermissions unbound */ import java.nio.file.Files;
--- a/test/sun/security/krb5/auto/AcceptorSubKey.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/AcceptorSubKey.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 7077646 * @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY * @compile -XDignore.symbol.file AcceptorSubKey.java - * @run main/othervm AcceptorSubKey 0 - * @run main/othervm AcceptorSubKey 4 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AcceptorSubKey 0 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AcceptorSubKey 4 */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/AddressesAndNameType.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/AddressesAndNameType.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,9 +24,9 @@ /* * @test * @bug 4501327 4868379 8039132 - * @run main/othervm AddressesAndNameType 1 - * @run main/othervm AddressesAndNameType 2 - * @run main/othervm AddressesAndNameType 3 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AddressesAndNameType 1 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AddressesAndNameType 2 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock AddressesAndNameType 3 * @summary noaddresses settings and server name type */
--- a/test/sun/security/krb5/auto/BadKdc1.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BadKdc1.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/othervm/timeout=300 BadKdc1 + * @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock BadKdc1 * @summary krb5 should not try to access unavailable kdc too often */
--- a/test/sun/security/krb5/auto/BadKdc2.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BadKdc2.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/othervm/timeout=300 BadKdc2 + * @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock BadKdc2 * @summary krb5 should not try to access unavailable kdc too often */
--- a/test/sun/security/krb5/auto/BadKdc3.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BadKdc3.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/othervm/timeout=300 BadKdc3 + * @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock BadKdc3 * @summary krb5 should not try to access unavailable kdc too often */
--- a/test/sun/security/krb5/auto/BadKdc4.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BadKdc4.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6843127 - * @run main/othervm/timeout=300 BadKdc4 + * @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock BadKdc4 * @summary krb5 should not try to access unavailable kdc too often */
--- a/test/sun/security/krb5/auto/Basic.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/Basic.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7152176 * @summary More krb5 tests * @compile -XDignore.symbol.file Basic.java - * @run main/othervm Basic + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock Basic */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/BasicKrb5Test.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BasicKrb5Test.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,34 +26,34 @@ * @bug 6706974 * @summary Add krb5 test infrastructure * @compile -XDignore.symbol.file BasicKrb5Test.java - * @run main/othervm BasicKrb5Test - * @run main/othervm BasicKrb5Test des-cbc-crc - * @run main/othervm BasicKrb5Test des-cbc-md5 - * @run main/othervm BasicKrb5Test des3-cbc-sha1 - * @run main/othervm BasicKrb5Test aes128-cts - * @run main/othervm BasicKrb5Test aes256-cts - * @run main/othervm BasicKrb5Test rc4-hmac - * @run main/othervm BasicKrb5Test -s - * @run main/othervm BasicKrb5Test des-cbc-crc -s - * @run main/othervm BasicKrb5Test des-cbc-md5 -s - * @run main/othervm BasicKrb5Test des3-cbc-sha1 -s - * @run main/othervm BasicKrb5Test aes128-cts -s - * @run main/othervm BasicKrb5Test aes256-cts -s - * @run main/othervm BasicKrb5Test rc4-hmac -s - * @run main/othervm BasicKrb5Test -C - * @run main/othervm BasicKrb5Test des-cbc-crc -C - * @run main/othervm BasicKrb5Test des-cbc-md5 -C - * @run main/othervm BasicKrb5Test des3-cbc-sha1 -C - * @run main/othervm BasicKrb5Test aes128-cts -C - * @run main/othervm BasicKrb5Test aes256-cts -C - * @run main/othervm BasicKrb5Test rc4-hmac -C - * @run main/othervm BasicKrb5Test -s -C - * @run main/othervm BasicKrb5Test des-cbc-crc -s -C - * @run main/othervm BasicKrb5Test des-cbc-md5 -s -C - * @run main/othervm BasicKrb5Test des3-cbc-sha1 -s -C - * @run main/othervm BasicKrb5Test aes128-cts -s -C - * @run main/othervm BasicKrb5Test aes256-cts -s -C - * @run main/othervm BasicKrb5Test rc4-hmac -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-crc + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-md5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des3-cbc-sha1 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes128-cts + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes256-cts + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test rc4-hmac + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-crc -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-md5 -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des3-cbc-sha1 -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes128-cts -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes256-cts -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test rc4-hmac -s + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-crc -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-md5 -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des3-cbc-sha1 -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes128-cts -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes256-cts -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test rc4-hmac -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-crc -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des-cbc-md5 -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test des3-cbc-sha1 -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes128-cts -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test aes256-cts -s -C + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicKrb5Test rc4-hmac -s -C */ import org.ietf.jgss.GSSName;
--- a/test/sun/security/krb5/auto/BasicProc.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BasicProc.java Mon Aug 27 16:38:06 2018 +0100 @@ -27,7 +27,7 @@ * @summary A test library to launch multiple Java processes * @library ../../../../java/security/testlibrary/ * @compile -XDignore.symbol.file BasicProc.java - * @run main/othervm BasicProc + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BasicProc */ import java.io.File; @@ -65,6 +65,9 @@ .args("client") .prop("java.security.krb5.conf", CONF) .prop("java.security.manager", "") + .prop("sun.net.spi.nameservice.provider.1", "ns,mock") + .perm(new java.lang.RuntimePermission( + "accessClassInPackage.sun.net.spi.nameservice")) .perm(new java.util.PropertyPermission( "sun.security.krb5.principal", "read")) .perm(new javax.security.auth.AuthPermission( @@ -85,6 +88,9 @@ .args("server") .prop("java.security.krb5.conf", CONF) .prop("java.security.manager", "") + .prop("sun.net.spi.nameservice.provider.1", "ns,mock") + .perm(new java.lang.RuntimePermission( + "accessClassInPackage.sun.net.spi.nameservice")) .perm(new java.util.PropertyPermission( "sun.security.krb5.principal", "read")) .perm(new javax.security.auth.AuthPermission( @@ -107,6 +113,9 @@ .args("backend") .prop("java.security.krb5.conf", CONF) .prop("java.security.manager", "") + .prop("sun.net.spi.nameservice.provider.1", "ns,mock") + .perm(new java.lang.RuntimePermission( + "accessClassInPackage.sun.net.spi.nameservice")) .perm(new java.util.PropertyPermission( "sun.security.krb5.principal", "read")) .perm(new javax.security.auth.AuthPermission( @@ -185,6 +194,7 @@ return p .env("KRB5_CONFIG", CONF) .env("KRB5_KTNAME", KTAB) + .prop("sun.net.spi.nameservice.provider.1", "ns,mock") .prop("sun.security.jgss.native", "true") .prop("javax.security.auth.useSubjectCredsOnly", "false") .prop("sun.security.nativegss.debug", "true");
--- a/test/sun/security/krb5/auto/BogusKDC.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/BogusKDC.java Mon Aug 27 16:38:06 2018 +0100 @@ -36,7 +36,7 @@ * @bug 4515853 8075297 * @summary Checks that Kerberos client tries slave KDC * if master KDC is not responding - * @run main/othervm BogusKDC + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock BogusKDC */ public class BogusKDC {
--- a/test/sun/security/krb5/auto/CleanState.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/CleanState.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 6716534 * @compile -XDignore.symbol.file CleanState.java - * @run main/othervm CleanState + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock CleanState * @summary Krb5LoginModule has not cleaned temp info between authentication attempts */ import com.sun.security.auth.module.Krb5LoginModule;
--- a/test/sun/security/krb5/auto/CrossRealm.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/CrossRealm.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 6706974 * @compile -XDignore.symbol.file CrossRealm.java - * @run main/othervm CrossRealm + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock CrossRealm * @summary Add krb5 test infrastructure */ import java.io.File;
--- a/test/sun/security/krb5/auto/DiffNameSameKey.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/DiffNameSameKey.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 8005447 * @summary default principal can act as anyone * @compile -XDignore.symbol.file DiffNameSameKey.java - * @run main/othervm/fail DiffNameSameKey a - * @run main/othervm DiffNameSameKey b + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock DiffNameSameKey a + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock DiffNameSameKey b */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/DupEtypes.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/DupEtypes.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,11 +26,11 @@ * @bug 7067974 * @summary multiple ETYPE-INFO-ENTRY with same etype and different salt * @compile -XDignore.symbol.file DupEtypes.java - * @run main/othervm DupEtypes 1 - * @run main/othervm DupEtypes 2 - * @run main/othervm/fail DupEtypes 3 - * @run main/othervm DupEtypes 4 - * @run main/othervm DupEtypes 5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock DupEtypes 1 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock DupEtypes 2 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock DupEtypes 3 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock DupEtypes 4 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock DupEtypes 5 */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/DynamicKeytab.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/DynamicKeytab.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 6894072 * @compile -XDignore.symbol.file DynamicKeytab.java - * @run main/othervm DynamicKeytab + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock DynamicKeytab * @summary always refresh keytab */
--- a/test/sun/security/krb5/auto/EmptyPassword.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/EmptyPassword.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 6879540 * @summary enable empty password for kerberos 5 * @compile -XDignore.symbol.file EmptyPassword.java - * @run main/othervm EmptyPassword + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock EmptyPassword */ public class EmptyPassword {
--- a/test/sun/security/krb5/auto/FileKeyTab.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/FileKeyTab.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7152121 * @summary Krb5LoginModule no longer handles keyTabNames with "file:" prefix * @compile -XDignore.symbol.file FileKeyTab.java - * @run main/othervm FileKeyTab + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock FileKeyTab */ import java.io.File;
--- a/test/sun/security/krb5/auto/ForwardableCheck.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/ForwardableCheck.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8022582 * @summary Relax response flags checking in sun.security.krb5.KrbKdcRep.check. * @compile -XDignore.symbol.file ForwardableCheck.java - * @run main/othervm ForwardableCheck + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock ForwardableCheck */ import org.ietf.jgss.GSSException;
--- a/test/sun/security/krb5/auto/GSS.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/GSS.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7152176 * @summary More krb5 tests * @compile -XDignore.symbol.file GSS.java - * @run main/othervm GSS + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock GSS */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/GSSUnbound.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/GSSUnbound.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8001104 * @summary Unbound SASL service: the GSSAPI/krb5 mech * @compile -XDignore.symbol.file GSSUnbound.java - * @run main/othervm GSSUnbound + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock GSSUnbound */ import java.security.Security;
--- a/test/sun/security/krb5/auto/HttpNegotiateServer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/HttpNegotiateServer.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6578647 6829283 - * @run main/othervm HttpNegotiateServer + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock HttpNegotiateServer * @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication() * @summary HTTP/Negotiate: Authenticator triggered again when user cancels the first one */
--- a/test/sun/security/krb5/auto/IgnoreChannelBinding.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/IgnoreChannelBinding.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6851973 - * @run main/othervm IgnoreChannelBinding + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock IgnoreChannelBinding * @summary ignore incoming channel binding if acceptor does not set one */
--- a/test/sun/security/krb5/auto/KDC.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KDC.java Mon Aug 27 16:38:06 2018 +0100 @@ -206,9 +206,9 @@ SENSITIVE_ACCOUNTS, }; - static { - System.setProperty("sun.net.spi.nameservice.provider.1", "ns,mock"); - } + //static { + // System.setProperty("sun.net.spi.nameservice.provider.1", "ns,mock"); + //} /** * A standalone KDC server.
--- a/test/sun/security/krb5/auto/KPEquals.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KPEquals.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8015669 * @summary KerberosPrincipal::equals should ignore name-type * @compile -XDignore.symbol.file KPEquals.java - * @run main/othervm KPEquals + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock KPEquals */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/KerberosHashEqualsTest.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KerberosHashEqualsTest.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 4641821 - * @run main/othervm KerberosHashEqualsTest + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock KerberosHashEqualsTest * @summary hashCode() and equals() for KerberosKey and KerberosTicket */
--- a/test/sun/security/krb5/auto/KeyPermissions.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KeyPermissions.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8004488 * @summary wrong permissions checked in krb5 * @compile -XDignore.symbol.file KeyPermissions.java - * @run main/othervm KeyPermissions + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock KeyPermissions */ import java.security.AccessControlException;
--- a/test/sun/security/krb5/auto/KeyTabCompat.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KeyTabCompat.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 6894072 * @bug 8004488 * @compile -XDignore.symbol.file KeyTabCompat.java - * @run main/othervm KeyTabCompat + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock KeyTabCompat * @summary always refresh keytab */
--- a/test/sun/security/krb5/auto/KrbTicket.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KrbTicket.java Mon Aug 27 16:38:06 2018 +0100 @@ -37,7 +37,7 @@ * @test * @bug 6857795 8075299 * @summary Checks Kerberos ticket properties - * @run main/othervm KrbTicket + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock KrbTicket */ public class KrbTicket {
--- a/test/sun/security/krb5/auto/KvnoNA.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/KvnoNA.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 7197159 * @compile -XDignore.symbol.file KvnoNA.java - * @run main/othervm KvnoNA + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock KvnoNA * @summary accept different kvno if there no match */
--- a/test/sun/security/krb5/auto/LifeTimeInSeconds.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/LifeTimeInSeconds.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6857802 - * @run main/othervm LifeTimeInSeconds + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock LifeTimeInSeconds * @summary GSS getRemainingInitLifetime method returns milliseconds not seconds */ import org.ietf.jgss.GSSCredential;
--- a/test/sun/security/krb5/auto/LoginModuleOptions.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/LoginModuleOptions.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6765491 - * @run main/othervm LoginModuleOptions + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock LoginModuleOptions * @summary Krb5LoginModule a little too restrictive, and the doc is not clear. */ import com.sun.security.auth.module.Krb5LoginModule;
--- a/test/sun/security/krb5/auto/LoginNoPass.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/LoginNoPass.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8028351 * @summary JWS doesn't get authenticated when using kerberos auth proxy * @compile -XDignore.symbol.file LoginNoPass.java - * @run main/othervm LoginNoPass + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock LoginNoPass */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/MSOID2.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/MSOID2.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8078439 * @summary SPNEGO auth fails if client proposes MS krb5 OID * @compile -XDignore.symbol.file MSOID2.java - * @run main/othervm MSOID2 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock MSOID2 */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/MaxRetries.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/MaxRetries.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 6844193 * @compile -XDignore.symbol.file MaxRetries.java - * @run main/othervm/timeout=300 MaxRetries + * @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock MaxRetries * @summary support max_retries in krb5.conf */
--- a/test/sun/security/krb5/auto/MoreKvno.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/MoreKvno.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6893158 6907425 7197159 - * @run main/othervm MoreKvno + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock MoreKvno * @summary AP_REQ check should use key version number */
--- a/test/sun/security/krb5/auto/NewSalt.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/NewSalt.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,9 +25,9 @@ * @test * @bug 6960894 * @summary Better AS-REQ creation and processing - * @run main/othervm NewSalt - * @run main/othervm -Dnopreauth NewSalt - * @run main/othervm -Donlyonepreauth NewSalt + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock NewSalt + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dnopreauth NewSalt + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Donlyonepreauth NewSalt */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/NoAddresses.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/NoAddresses.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,9 +24,9 @@ /* * @test * @bug 7032354 - * @run main/othervm NoAddresses 1 - * @run main/othervm NoAddresses 2 - * @run main/othervm/fail NoAddresses 3 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock NoAddresses 1 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock NoAddresses 2 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock NoAddresses 3 * @summary no-addresses should not be used on acceptor side */
--- a/test/sun/security/krb5/auto/NoInitNoKeytab.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/NoInitNoKeytab.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7089889 * @summary Krb5LoginModule.login() throws an exception if used without a keytab * @compile -XDignore.symbol.file NoInitNoKeytab.java - * @run main/othervm NoInitNoKeytab + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock NoInitNoKeytab */ import java.io.FileOutputStream;
--- a/test/sun/security/krb5/auto/NonMutualSpnego.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/NonMutualSpnego.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6733095 - * @run main/othervm NonMutualSpnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock NonMutualSpnego * @summary Failure when SPNEGO request non-Mutual */
--- a/test/sun/security/krb5/auto/NoneReplayCacheTest.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/NoneReplayCacheTest.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 8001326 - * @run main/othervm NoneReplayCacheTest + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock NoneReplayCacheTest * @summary the replaycache type none cannot stop an authenticator replay, * but it can stop a message replay when s.s.k.acceptor.subkey is true. * You should not really use none in production environment. This test merely
--- a/test/sun/security/krb5/auto/OkAsDelegate.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/OkAsDelegate.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,27 +24,27 @@ /* * @test * @bug 6853328 7172701 - * @run main/othervm OkAsDelegate false true true false false false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OkAsDelegate false true true false false false * FORWARDABLE ticket not allowed, always fail - * @run main/othervm OkAsDelegate true false false false false false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OkAsDelegate true false false false false false * Service ticket no OK-AS-DELEGATE. Request nothing, gain nothing - * @run main/othervm OkAsDelegate true false true false false false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OkAsDelegate true false true false false false * Service ticket no OK-AS-DELEGATE. Request deleg policy, gain nothing - * @run main/othervm OkAsDelegate true true false true false true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OkAsDelegate true true false true false true * Service ticket no OK-AS-DELEGATE. Request deleg, granted - * @run main/othervm OkAsDelegate true true true true false true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OkAsDelegate true true true true false true * Service ticket no OK-AS-DELEGATE. Request deleg and deleg policy, granted, with info not by policy - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true * Service ticket has OK-AS-DELEGATE. Request deleg policy, granted - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true * Service ticket has OK-AS-DELEGATE. granted, with info by policy - * @run main/othervm -Dtest.spnego OkAsDelegate false true true false false false - * @run main/othervm -Dtest.spnego OkAsDelegate true false false false false false - * @run main/othervm -Dtest.spnego OkAsDelegate true false true false false false - * @run main/othervm -Dtest.spnego OkAsDelegate true true false true false true - * @run main/othervm -Dtest.spnego OkAsDelegate true true true true false true - * @run main/othervm -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true - * @run main/othervm -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego OkAsDelegate false true true false false false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego OkAsDelegate true false false false false false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego OkAsDelegate true false true false false false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego OkAsDelegate true true false true false true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego OkAsDelegate true true true true false true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true * @summary Support OK-AS-DELEGATE flag */ import com.sun.security.jgss.ExtendedGSSContext;
--- a/test/sun/security/krb5/auto/OkAsDelegateXRealm.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/OkAsDelegateXRealm.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,13 +24,13 @@ /* * @test * @bug 6853328 7172701 - * @run main/othervm OkAsDelegateXRealm false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OkAsDelegateXRealm false * KDC no OK-AS-DELEGATE, fail - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true * KDC set OK-AS-DELEGATE for all, succeed - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local OkAsDelegateXRealm false + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local OkAsDelegateXRealm false * KDC set OK-AS-DELEGATE for host/host.r3.local only, fail - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local,krbtgt/R2,krbtgt/R3 OkAsDelegateXRealm true + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local,krbtgt/R2,krbtgt/R3 OkAsDelegateXRealm true * KDC set OK-AS-DELEGATE for all three, succeed * @summary Support OK-AS-DELEGATE flag */
--- a/test/sun/security/krb5/auto/OnlyDesLogin.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/OnlyDesLogin.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8014310 * @summary JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679 * @compile -XDignore.symbol.file OnlyDesLogin.java - * @run main/othervm OnlyDesLogin + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock OnlyDesLogin */ import sun.security.krb5.Config;
--- a/test/sun/security/krb5/auto/PrincipalNameEquals.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/PrincipalNameEquals.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7061379 * @summary [Kerberos] Cross-realm authentication fails, due to nameType problem * @compile -XDignore.symbol.file PrincipalNameEquals.java - * @run main/othervm PrincipalNameEquals + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock PrincipalNameEquals */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/RRC.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/RRC.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7077640 * @summary gss wrap for cfx doesn't handle rrc != 0 * @compile -XDignore.symbol.file RRC.java - * @run main/othervm RRC + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock RRC */ import java.util.Arrays;
--- a/test/sun/security/krb5/auto/RefreshKrb5Config.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/RefreshKrb5Config.java Mon Aug 27 16:38:06 2018 +0100 @@ -34,7 +34,7 @@ * @bug 4745056 8075297 * @summary Checks if refreshKrb5Config is set to true for Krb5LoginModule, * then configuration will be refreshed before login() method is called - * @run main/othervm RefreshKrb5Config + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock RefreshKrb5Config */ public class RefreshKrb5Config {
--- a/test/sun/security/krb5/auto/ReplayCacheTest.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/ReplayCacheTest.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,8 +24,8 @@ /* * @test * @bug 7118809 8001326 - * @run main/othervm ReplayCacheTest jvm - * @run main/othervm ReplayCacheTest dfl + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock ReplayCacheTest jvm + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock ReplayCacheTest dfl * @summary rcache deadlock */
--- a/test/sun/security/krb5/auto/ReplayCacheTestProc.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/ReplayCacheTestProc.java Mon Aug 27 16:38:06 2018 +0100 @@ -27,7 +27,7 @@ * @summary More krb5 tests * @library ../../../../java/security/testlibrary/ * @compile -XDignore.symbol.file ReplayCacheTestProc.java - * @run main/othervm/timeout=100 ReplayCacheTestProc + * @run main/othervm/timeout=100 -Dsun.net.spi.nameservice.provider.1=ns,mock ReplayCacheTestProc */ import java.io.*; @@ -277,6 +277,7 @@ .prop("sun.security.jgss.native", "true") .prop("javax.security.auth.useSubjectCredsOnly", "false") .prop("sun.security.nativegss.debug", "true") + .prop("sun.net.spi.nameservice.provider.1", "ns,mock") .debug("N"+i) .start(); } @@ -287,6 +288,7 @@ .args("S"+i) .prop("sun.security.krb5.rcache", "dfl") .prop("java.io.tmpdir", cwd) + .prop("sun.net.spi.nameservice.provider.1", "ns,mock") .start(); } // generates hash of authenticator inside ap-req inside initsectoken
--- a/test/sun/security/krb5/auto/S4U2proxy.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/S4U2proxy.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 6355584 8044215 * @summary Introduce constrained Kerberos delegation * @compile -XDignore.symbol.file S4U2proxy.java - * @run main/othervm S4U2proxy krb5 - * @run main/othervm S4U2proxy spnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock S4U2proxy krb5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock S4U2proxy spnego */ import java.util.Arrays;
--- a/test/sun/security/krb5/auto/S4U2proxyGSS.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/S4U2proxyGSS.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 6355584 * @summary Introduce constrained Kerberos delegation * @compile -XDignore.symbol.file S4U2proxyGSS.java - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS krb5 - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS spnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS krb5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS spnego */ import java.io.File;
--- a/test/sun/security/krb5/auto/S4U2self.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/S4U2self.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,13 +26,13 @@ * @bug 6355584 * @summary Introduce constrained Kerberos delegation * @compile -XDignore.symbol.file S4U2self.java - * @run main/othervm -Dsun.security.krb5.debug=false S4U2self krb5 0 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 1 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 2 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 3 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 4 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 5 - * @run main/othervm -Dsun.security.krb5.debug=false S4U2self spnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self krb5 0 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self krb5 1 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self krb5 2 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self krb5 3 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self krb5 4 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self krb5 5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2self spnego */ import java.util.Arrays;
--- a/test/sun/security/krb5/auto/S4U2selfAsServer.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/S4U2selfAsServer.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 6355584 * @summary Introduce constrained Kerberos delegation * @compile -XDignore.symbol.file S4U2selfAsServer.java - * @run main/othervm S4U2selfAsServer krb5 - * @run main/othervm S4U2selfAsServer spnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock S4U2selfAsServer krb5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock S4U2selfAsServer spnego */ import java.util.Arrays;
--- a/test/sun/security/krb5/auto/S4U2selfAsServerGSS.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/S4U2selfAsServerGSS.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 6355584 * @summary Introduce constrained Kerberos delegation * @compile -XDignore.symbol.file S4U2selfAsServerGSS.java - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS krb5 - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS spnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS krb5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS spnego */ import java.io.File;
--- a/test/sun/security/krb5/auto/S4U2selfGSS.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/S4U2selfGSS.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 6355584 * @summary Introduce constrained Kerberos delegation * @compile -XDignore.symbol.file S4U2selfGSS.java - * @run main/othervm -Dsun.security.krb5.debug=false S4U2selfGSS krb5 - * @run main/othervm -Dsun.security.krb5.debug=false S4U2selfGSS spnego + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2selfGSS krb5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dsun.security.krb5.debug=false S4U2selfGSS spnego */ import java.util.Arrays;
--- a/test/sun/security/krb5/auto/SPNEGO.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SPNEGO.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7040151 * @summary SPNEGO GSS code does not parse tokens in accordance to RFC 2478 * @compile -XDignore.symbol.file SPNEGO.java - * @run main/othervm SPNEGO + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SPNEGO */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/SSL.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SSL.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,17 +26,17 @@ * @bug 6894643 6913636 8005523 8025123 * @summary Test JSSE Kerberos ciphersuite - * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA - * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound - * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound sni - * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA - * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5 - * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_SHA - * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_MD5 - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5 - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_RC4_128_SHA + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_RC4_128_SHA unbound + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_RC4_128_SHA unbound sni + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_DES_CBC_SHA + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_WITH_DES_CBC_MD5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 */ import java.io.*; import java.security.Permission;
--- a/test/sun/security/krb5/auto/SaslBasic.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SaslBasic.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 7110803 * @summary SASL service for multiple hostnames * @compile -XDignore.symbol.file SaslBasic.java - * @run main/othervm SaslBasic bound - * @run main/othervm SaslBasic unbound + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SaslBasic bound + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SaslBasic unbound */ import java.io.IOException; import java.util.Arrays;
--- a/test/sun/security/krb5/auto/SaslGSS.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SaslGSS.java Mon Aug 27 16:38:06 2018 +0100 @@ -27,7 +27,7 @@ * @summary SASL: auth-conf negotiated, but unencrypted data is accepted, * reset to unencrypt * @compile -XDignore.symbol.file SaslGSS.java - * @run main/othervm SaslGSS + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SaslGSS */ import javax.security.auth.callback.Callback;
--- a/test/sun/security/krb5/auto/SaslUnbound.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SaslUnbound.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,11 +26,11 @@ * @bug 8001104 * @summary Unbound SASL service: the GSSAPI/krb5 mech * @compile -XDignore.symbol.file SaslUnbound.java - * @run main/othervm SaslUnbound 0 - * @run main/othervm/fail SaslUnbound 1 - * @run main/othervm/fail SaslUnbound 2 - * @run main/othervm/fail SaslUnbound 3 - * @run main/othervm/fail SaslUnbound 4 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SaslUnbound 0 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock SaslUnbound 1 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock SaslUnbound 2 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock SaslUnbound 3 + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock SaslUnbound 4 */ import java.io.IOException; import java.util.Arrays;
--- a/test/sun/security/krb5/auto/SpnegoLifeTime.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SpnegoLifeTime.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8000653 * @summary SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid) * @compile -XDignore.symbol.file SpnegoLifeTime.java - * @run main/othervm SpnegoLifeTime + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SpnegoLifeTime */ import org.ietf.jgss.Oid;
--- a/test/sun/security/krb5/auto/SpnegoReqFlags.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/SpnegoReqFlags.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6815182 - * @run main/othervm SpnegoReqFlags + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock SpnegoReqFlags * @summary GSSAPI/SPNEGO does not work with server using MIT Kerberos library */
--- a/test/sun/security/krb5/auto/TcpTimeout.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/TcpTimeout.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 6952519 * @compile -XDignore.symbol.file TcpTimeout.java - * @run main/othervm TcpTimeout + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock TcpTimeout * @summary kdc_timeout is not being honoured when using TCP */
--- a/test/sun/security/krb5/auto/Test5653.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/Test5653.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,7 +24,7 @@ /* * @test * @bug 6895424 - * @run main/othervm Test5653 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock Test5653 * @summary RFC 5653 */
--- a/test/sun/security/krb5/auto/TicketSName.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/TicketSName.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 8178794 * @summary krb5 client should ignore sname in incoming tickets * @compile -XDignore.symbol.file TicketSName.java - * @run main/othervm -Dtest.kdc.diff.sname TicketSName + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Dtest.kdc.diff.sname TicketSName */ import sun.security.jgss.GSSUtil;
--- a/test/sun/security/krb5/auto/TwoOrThree.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/TwoOrThree.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,11 +26,11 @@ * @bug 8005447 * @summary default principal can act as anyone * @compile -XDignore.symbol.file TwoOrThree.java - * @run main/othervm TwoOrThree first first - * @run main/othervm/fail TwoOrThree first second - * @run main/othervm TwoOrThree - first - * @run main/othervm TwoOrThree - second - * @run main/othervm/fail TwoOrThree - third + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock TwoOrThree first first + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock TwoOrThree first second + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock TwoOrThree - first + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock TwoOrThree - second + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock TwoOrThree - third */ import java.nio.file.Files;
--- a/test/sun/security/krb5/auto/TwoPrinces.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/TwoPrinces.java Mon Aug 27 16:38:06 2018 +0100 @@ -25,7 +25,7 @@ * @test * @bug 6894072 * @compile -XDignore.symbol.file TwoPrinces.java - * @run main/othervm TwoPrinces + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock TwoPrinces * @summary always refresh keytab */
--- a/test/sun/security/krb5/auto/TwoTab.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/TwoTab.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,7 +26,7 @@ * @bug 7152176 * @summary More krb5 tests * @compile -XDignore.symbol.file TwoTab.java - * @run main/othervm TwoTab + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock TwoTab */ import java.io.File;
--- a/test/sun/security/krb5/auto/UdpTcp.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/UdpTcp.java Mon Aug 27 16:38:06 2018 +0100 @@ -24,8 +24,8 @@ /* * @test * @bug 4966382 8039132 - * @run main/othervm UdpTcp UDP - * @run main/othervm UdpTcp TCP + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UdpTcp UDP + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UdpTcp TCP * @summary udp or tcp */
--- a/test/sun/security/krb5/auto/UnboundSSL.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/UnboundSSL.java Mon Aug 27 16:38:06 2018 +0100 @@ -34,9 +34,9 @@ * @bug 8025123 * @summary Checks if an unbound server can handle connections * only for allowed service principals - * @run main/othervm/java.security.policy=unbound.ssl.policy UnboundSSL + * @run main/othervm/java.security.policy=unbound.ssl.policy -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundSSL * unbound.ssl.jaas.conf server_star - * @run main/othervm/java.security.policy=unbound.ssl.policy UnboundSSL + * @run main/othervm/java.security.policy=unbound.ssl.policy -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundSSL * unbound.ssl.jaas.conf server_multiple_principals */ public class UnboundSSL {
--- a/test/sun/security/krb5/auto/UnboundSSLMultipleKeys.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/UnboundSSLMultipleKeys.java Mon Aug 27 16:38:06 2018 +0100 @@ -33,9 +33,9 @@ * @test * @bug 8025123 * @summary Checks if an unbound server pick up a correct key from keytab - * @run main/othervm UnboundSSLMultipleKeys + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundSSLMultipleKeys * unbound.ssl.jaas.conf server_star - * @run main/othervm UnboundSSLMultipleKeys + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundSSLMultipleKeys * unbound.ssl.jaas.conf server_multiple_principals */ public class UnboundSSLMultipleKeys {
--- a/test/sun/security/krb5/auto/UnboundSSLPrincipalProperty.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/UnboundSSLPrincipalProperty.java Mon Aug 27 16:38:06 2018 +0100 @@ -33,9 +33,9 @@ * @bug 8025123 * @summary Checks if an unbound server uses a service principal * from sun.security.krb5.principal system property if specified - * @run main/othervm UnboundSSLPrincipalProperty + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundSSLPrincipalProperty * unbound.ssl.jaas.conf server_star - * @run main/othervm UnboundSSLPrincipalProperty + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundSSLPrincipalProperty * unbound.ssl.jaas.conf server_multiple_principals */ public class UnboundSSLPrincipalProperty {
--- a/test/sun/security/krb5/auto/UnboundService.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/UnboundService.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,14 +26,14 @@ * @bug 8001104 * @summary Unbound SASL service: the GSSAPI/krb5 mech * @compile -XDignore.symbol.file UnboundService.java - * @run main/othervm UnboundService null null - * @run main/othervm UnboundService server/host.rabbit.hole null - * @run main/othervm UnboundService server/host.rabbit.hole@RABBIT.HOLE null - * @run main/othervm/fail UnboundService backend/host.rabbit.hole null - * @run main/othervm UnboundService null server@host.rabbit.hole - * @run main/othervm UnboundService server/host.rabbit.hole server@host.rabbit.hole - * @run main/othervm UnboundService server/host.rabbit.hole@RABBIT.HOLE server@host.rabbit.hole - * @run main/othervm/fail UnboundService backend/host.rabbit.hole server@host.rabbit.hole + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService null null + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService server/host.rabbit.hole null + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService server/host.rabbit.hole@RABBIT.HOLE null + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService backend/host.rabbit.hole null + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService null server@host.rabbit.hole + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService server/host.rabbit.hole server@host.rabbit.hole + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService server/host.rabbit.hole@RABBIT.HOLE server@host.rabbit.hole + * @run main/othervm/fail -Dsun.net.spi.nameservice.provider.1=ns,mock UnboundService backend/host.rabbit.hole server@host.rabbit.hole */ import java.io.File;
--- a/test/sun/security/krb5/auto/UseCacheAndStoreKey.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/UseCacheAndStoreKey.java Mon Aug 27 16:38:06 2018 +0100 @@ -27,7 +27,7 @@ * @summary Krb5LoginModule shows NPE when both useTicketCache and storeKey * are set to true * @compile -XDignore.symbol.file UseCacheAndStoreKey.java - * @run main/othervm UseCacheAndStoreKey + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock UseCacheAndStoreKey */ import java.io.FileOutputStream;
--- a/test/sun/security/krb5/auto/W83.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/krb5/auto/W83.java Mon Aug 27 16:38:06 2018 +0100 @@ -26,8 +26,8 @@ * @bug 6932525 6951366 6959292 * @summary kerberos login failure on win2008 with AD set to win2000 compat mode * and cannot login if session key and preauth does not use the same etype - * @run main/othervm -D6932525 W83 - * @run main/othervm -D6959292 W83 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -D6932525 W83 + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -D6959292 W83 */ import com.sun.security.auth.module.Krb5LoginModule; import java.io.File;
--- a/test/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java Sun Aug 19 04:29:53 2018 +0100 +++ b/test/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java Mon Aug 27 16:38:06 2018 +0100 @@ -100,8 +100,11 @@ */ serverReady = true; + System.err.println("Server accepting: " + System.nanoTime()); SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept(); + System.err.println("Server accepted: " + System.nanoTime()); sslSocket.startHandshake(); + System.err.println("Server handshake complete: " + System.nanoTime()); while (!clientClosed) { Thread.sleep(500); } @@ -123,10 +126,11 @@ while (!serverReady) { Thread.sleep(50); } + Thread.sleep(500); System.out.println("server ready"); Socket baseSocket = new Socket("localhost", serverPort); - baseSocket.setSoTimeout(100); + baseSocket.setSoTimeout(1000); SSLSocketFactory sslsf = (SSLSocketFactory) SSLSocketFactory.getDefault(); @@ -134,15 +138,16 @@ sslsf.createSocket(baseSocket, "localhost", serverPort, false); // handshaking + System.err.println("Client starting handshake: " + System.nanoTime()); sslSocket.startHandshake(); - System.out.println("handshake done"); + System.err.println("Client handshake done: " + System.nanoTime()); Thread.sleep(500); - System.out.println("client closing"); + System.err.println("Client closing: " + System.nanoTime()); sslSocket.close(); clientClosed = true; - System.out.println("client closed"); + System.err.println("Client closed: " + System.nanoTime()); } /*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/tools/keytool/RealType.java Mon Aug 27 16:38:06 2018 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017, 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 8192987 + * @summary keytool should remember real storetype if it is not provided + * @library /lib/testlibrary + * @run main/othervm RealType + */ + +import jdk.testlibrary.SecurityTools; +import jdk.testlibrary.OutputAnalyzer; + +import java.nio.file.Files; +import java.nio.file.Paths; + +public class RealType { + + public static void main(String[] args) throws Throwable { + + kt("-genkeypair -alias a -dname CN=A -keypass changeit -storetype jks") + .shouldHaveExitValue(0); + + // -keypasswd command should be allowed on JKS + kt("-keypasswd -alias a -new t0ps3cr3t") + .shouldHaveExitValue(0); + + Files.delete(Paths.get("ks")); + + kt("-genkeypair -alias a -dname CN=A -keypass changeit -storetype pkcs12") + .shouldHaveExitValue(0); + + // A pkcs12 keystore cannot be loaded as a JCEKS keystore + kt("-list -storetype jceks").shouldHaveExitValue(1); + } + + static OutputAnalyzer kt(String arg) throws Exception { + return SecurityTools.keytool("-debug -keystore ks -storepass changeit " + arg); + } +}