Mercurial > hg > openjdk > aarch64-port > jdk
changeset 10687:899877d39566
Merge
author | lana |
---|---|
date | Wed, 18 Mar 2015 18:19:10 -0700 |
parents | 92c0cd4652b9 (current diff) 9a3a791cd28b (diff) |
children | bf4ad581a67b |
files | |
diffstat | 28 files changed, 790 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aix/classes/sun/tools/attach/AixVirtualMachine.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/aix/classes/sun/tools/attach/AixVirtualMachine.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2013 SAP AG. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright 2015 SAP AG. 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,14 +25,14 @@ */ package sun.tools.attach; -import com.sun.tools.attach.VirtualMachine; +import com.sun.tools.attach.AttachOperationFailedException; import com.sun.tools.attach.AgentLoadException; import com.sun.tools.attach.AttachNotSupportedException; import com.sun.tools.attach.spi.AttachProvider; + import java.io.InputStream; import java.io.IOException; import java.io.File; -import java.util.Properties; // Based on 'LinuxVirtualMachine.java'. All occurrences of the string // "Linux" have been textually replaced by "Aix" to avoid confusion. @@ -192,6 +192,8 @@ } if (completionStatus != 0) { + // read from the stream and use that as the error message + String message = readErrorMessage(sis); sis.close(); // In the event of a protocol mismatch then the target VM @@ -206,7 +208,11 @@ if (cmd.equals("load")) { throw new AgentLoadException("Failed to load agent library"); } else { - throw new IOException("Command failed in target VM"); + if (message == null) { + throw new AttachOperationFailedException("Command failed in target VM"); + } else { + throw new AttachOperationFailedException(message); + } } }
--- a/src/aix/native/sun/tools/attach/AixVirtualMachine.c Wed Mar 18 13:57:00 2015 -0700 +++ b/src/aix/native/sun/tools/attach/AixVirtualMachine.c Wed Mar 18 18:19:10 2015 -0700 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2013 SAP AG. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright 2015 SAP AG. 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 @@ -238,14 +238,14 @@ len = remaining; } - RESTARTABLE(read(fd, buf+off, len), n); + RESTARTABLE(read(fd, buf, len), n); if (n == -1) { JNU_ThrowIOExceptionWithLastError(env, "read"); } else { if (n == 0) { n = -1; // EOF } else { - (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off)); + (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf)); } } return n;
--- a/src/macosx/classes/com/apple/laf/AquaMenuUI.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/macosx/classes/com/apple/laf/AquaMenuUI.java Wed Mar 18 18:19:10 2015 -0700 @@ -148,11 +148,15 @@ // In Aqua, we always have a menu delay, regardless of where the menu is. if (!(selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) { - if (menu.getDelay() == 0) { - appendPath(getPath(), menu.getPopupMenu()); - } else { - manager.setSelectedPath(getPath()); - setupPostTimer(menu); + // the condition below prevents from activating menu in other frame + if (!menu.isTopLevelMenu() || (selectedPath.length > 0 && + selectedPath[0] == menu.getParent())) { + if (menu.getDelay() == 0) { + appendPath(getPath(), menu.getPopupMenu()); + } else { + manager.setSelectedPath(getPath()); + setupPostTimer(menu); + } } } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Mar 18 18:19:10 2015 -0700 @@ -488,6 +488,9 @@ } else { deliverZoom(true); + // We need an up to date size of the peer, so we flush the native events + // to be sure that there are no setBounds requests in the queue. + LWCToolkit.flushNativeSelectors(); this.normalBounds = peer.getBounds(); GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Mar 18 18:19:10 2015 -0700 @@ -833,7 +833,7 @@ /** * Just spin a single empty block synchronously. */ - private static native void flushNativeSelectors(); + static native void flushNativeSelectors(); @Override public Clipboard createPlatformClipboard() {
--- a/src/macosx/native/sun/awt/AWTView.m Wed Mar 18 13:57:00 2015 -0700 +++ b/src/macosx/native/sun/awt/AWTView.m Wed Mar 18 18:19:10 2015 -0700 @@ -310,7 +310,10 @@ } - (BOOL) performKeyEquivalent: (NSEvent *) event { - [self deliverJavaKeyEventHelper: event]; + // if IM is active key events should be ignored + if (![self hasMarkedText] && !fInPressAndHold) { + [self deliverJavaKeyEventHelper: event]; + } // Workaround for 8020209: special case for "Cmd =" and "Cmd ." // because Cocoa calls performKeyEquivalent twice for these keystrokes
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Wed Mar 18 13:57:00 2015 -0700 +++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Wed Mar 18 18:19:10 2015 -0700 @@ -131,11 +131,7 @@ NSAutoreleasePool *pool = [NSAutoreleasePool new]; *scaleFactor = 1; char* scaledFile = nil; - __block float screenScaleFactor = 1; - - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - screenScaleFactor = [SplashNSScreen() backingScaleFactor]; - }]; + float screenScaleFactor = 1; if (screenScaleFactor > 1) { NSString *fileName = [NSString stringWithUTF8String: file];
--- a/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -538,6 +538,13 @@ currentFetchThread = null; } + if (nr == null) { + if (logger.traceOn()) { + logger.trace("NotifFetcher-run", + "Recieved null object as notifs, stops fetching because the " + + "notification server is terminated."); + } + } if (nr == null || shouldStop()) { // tell that the thread is REALLY stopped setState(STOPPED); @@ -657,7 +664,7 @@ return null; } - if (shouldStop()) + if (shouldStop() || nr == null) return null; startSequenceNumber = nr.getNextSequenceNumber();
--- a/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -311,7 +311,7 @@ /* * For nonvirtual invokes, method must have a body */ - if ((options & INVOKE_NONVIRTUAL) != 0) { + if (isNonVirtual(options)) { if (method.isAbstract()) { throw new IllegalArgumentException("Abstract method"); } @@ -323,7 +323,7 @@ * method argument types. */ ClassTypeImpl invokedClass; - if ((options & INVOKE_NONVIRTUAL) != 0) { + if (isNonVirtual(options)) { // No overrides in non-virtual invokes invokedClass = clazz; } else { @@ -348,7 +348,7 @@ /* * Only default methods allowed for nonvirtual invokes */ - if (!method.isDefault()) { + if (isNonVirtual(options) && !method.isDefault()) { throw new IllegalArgumentException("Not a default method"); } } @@ -624,4 +624,8 @@ byte typeValueKey() { return JDWP.Tag.OBJECT; } + + private static boolean isNonVirtual(int options) { + return (options & INVOKE_NONVIRTUAL) != 0; + } }
--- a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Wed Mar 18 18:19:10 2015 -0700 @@ -285,6 +285,7 @@ // Forward the SAM method MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, samMethodName, samMethodType.toMethodDescriptorString(), null, null); + mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true); new ForwardingMethodGenerator(mv).generate(samMethodType); // Forward the bridges @@ -292,6 +293,7 @@ for (MethodType mt : additionalBridges) { mv = cw.visitMethod(ACC_PUBLIC|ACC_BRIDGE, samMethodName, mt.toMethodDescriptorString(), null, null); + mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true); new ForwardingMethodGenerator(mv).generate(mt); } }
--- a/src/share/classes/java/util/zip/ZipEntry.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/java/util/zip/ZipEntry.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, 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 @@ -41,7 +41,9 @@ class ZipEntry implements ZipConstants, Cloneable { String name; // entry name - long time = -1; // last modification time + long xdostime = -1; // last modification time (in extended DOS time, + // where milliseconds lost in conversion might + // be encoded into the upper half) FileTime mtime; // last modification time, from extra field data FileTime atime; // last access time, from extra field data FileTime ctime; // creation time, from extra field data @@ -64,6 +66,28 @@ public static final int DEFLATED = 8; /** + * DOS time constant for representing timestamps before 1980. + */ + static final long DOSTIME_BEFORE_1980 = (1 << 21) | (1 << 16); + + /** + * Approximately 128 years, in milliseconds (ignoring leap years etc). + * + * This establish an approximate high-bound value for DOS times in + * milliseconds since epoch, used to enable an efficient but + * sufficient bounds check to avoid generating extended last modified + * time entries. + * + * Calculating the exact number is locale dependent, would require loading + * TimeZone data eagerly, and would make little practical sense. Since DOS + * times theoretically go to 2107 - with compatibility not guaranteed + * after 2099 - setting this to a time that is before but near 2099 + * should be sufficient. + */ + private static final long UPPER_DOSTIME_BOUND = + 128L * 365 * 24 * 60 * 60 * 1000; + + /** * Creates a new zip entry with the specified name. * * @param name @@ -93,7 +117,7 @@ public ZipEntry(ZipEntry e) { Objects.requireNonNull(e, "entry"); name = e.name; - time = e.time; + xdostime = e.xdostime; mtime = e.mtime; atime = e.atime; ctime = e.ctime; @@ -137,8 +161,14 @@ * @see #getLastModifiedTime() */ public void setTime(long time) { - this.time = time; - this.mtime = null; + this.xdostime = javaToExtendedDosTime(time); + // Avoid setting the mtime field if time is in the valid + // range for a DOS time + if (xdostime != DOSTIME_BEFORE_1980 && time <= UPPER_DOSTIME_BOUND) { + this.mtime = null; + } else { + this.mtime = FileTime.from(time, TimeUnit.MILLISECONDS); + } } /** @@ -158,7 +188,10 @@ * @see #setLastModifiedTime(FileTime) */ public long getTime() { - return time; + if (mtime != null) { + return mtime.toMillis(); + } + return (xdostime != -1) ? extendedDosToJavaTime(xdostime) : -1; } /** @@ -181,7 +214,7 @@ */ public ZipEntry setLastModifiedTime(FileTime time) { this.mtime = Objects.requireNonNull(time, "lastModifiedTime"); - this.time = time.to(TimeUnit.MILLISECONDS); + this.xdostime = javaToExtendedDosTime(time.to(TimeUnit.MILLISECONDS)); return this; } @@ -204,9 +237,9 @@ public FileTime getLastModifiedTime() { if (mtime != null) return mtime; - if (time == -1) + if (xdostime == -1) return null; - return FileTime.from(time, TimeUnit.MILLISECONDS); + return FileTime.from(getTime(), TimeUnit.MILLISECONDS); } /**
--- a/src/share/classes/java/util/zip/ZipFile.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/java/util/zip/ZipFile.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2015, 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 @@ -46,7 +46,6 @@ import java.util.stream.StreamSupport; import static java.util.zip.ZipConstants64.*; -import static java.util.zip.ZipUtils.*; /** * This class is used to read entries from a zip file. @@ -567,7 +566,7 @@ e.name = zc.toString(bname, bname.length); } } - e.time = dosToJavaTime(getEntryTime(jzentry)); + e.xdostime = getEntryTime(jzentry); e.crc = getEntryCrc(jzentry); e.size = getEntrySize(jzentry); e.csize = getEntryCSize(jzentry);
--- a/src/share/classes/java/util/zip/ZipInputStream.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/java/util/zip/ZipInputStream.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -303,7 +303,7 @@ throw new ZipException("encrypted ZIP entry not supported"); } e.method = get16(tmpbuf, LOCHOW); - e.time = dosToJavaTime(get32(tmpbuf, LOCTIM)); + e.xdostime = get32(tmpbuf, LOCTIM); if ((flag & 8) == 8) { /* "Data Descriptor" present */ if (e.method != DEFLATED) {
--- a/src/share/classes/java/util/zip/ZipOutputStream.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/java/util/zip/ZipOutputStream.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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,7 +61,6 @@ private static class XEntry { final ZipEntry entry; final long offset; - long dostime; // last modification time in msdos format public XEntry(ZipEntry entry, long offset) { this.entry = entry; this.offset = offset; @@ -192,7 +191,7 @@ if (current != null) { closeEntry(); // close previous entry } - if (e.time == -1) { + if (e.xdostime == -1) { // by default, do NOT use extended timestamps in extra // data, for now. e.setTime(System.currentTimeMillis()); @@ -389,18 +388,12 @@ boolean hasZip64 = false; int elen = getExtraLen(e.extra); - // keep a copy of dostime for writeCEN(), otherwise the tz - // sensitive local time entries in loc and cen might be - // different if the default tz get changed during writeLOC() - // and writeCEN() - xentry.dostime = javaToDosTime(e.time); - writeInt(LOCSIG); // LOC header signature if ((flag & 8) == 8) { writeShort(version(e)); // version needed to extract writeShort(flag); // general purpose bit flag writeShort(e.method); // compression method - writeInt(xentry.dostime); // last modification time + writeInt(e.xdostime); // last modification time // store size, uncompressed size, and crc-32 in data descriptor // immediately following compressed entry data writeInt(0); @@ -415,7 +408,7 @@ } writeShort(flag); // general purpose bit flag writeShort(e.method); // compression method - writeInt(xentry.dostime); // last modification time + writeInt(e.xdostime); // last modification time writeInt(e.crc); // crc-32 if (hasZip64) { writeInt(ZIP64_MAGICVAL); @@ -522,9 +515,7 @@ } writeShort(flag); // general purpose bit flag writeShort(e.method); // compression method - // use the copy in xentry, which has been converted - // from e.time in writeLOC() - writeInt(xentry.dostime); // last modification time + writeInt(e.xdostime); // last modification time writeInt(e.crc); // crc-32 writeInt(csize); // compressed size writeInt(size); // uncompressed size
--- a/src/share/classes/java/util/zip/ZipUtils.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/java/util/zip/ZipUtils.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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,9 +29,6 @@ import java.util.Date; import java.util.concurrent.TimeUnit; -import static java.util.zip.ZipConstants.*; -import static java.util.zip.ZipConstants64.*; - class ZipUtils { // used to adjust values between Windows and java epoch @@ -69,7 +66,7 @@ /** * Converts DOS time to Java time (number of milliseconds since epoch). */ - public static long dosToJavaTime(long dtime) { + private static long dosToJavaTime(long dtime) { @SuppressWarnings("deprecation") // Use of date constructor. Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80), (int)(((dtime >> 21) & 0x0f) - 1), @@ -81,14 +78,26 @@ } /** + * Converts extended DOS time to Java time, where up to 1999 milliseconds + * might be encoded into the upper half of the returned long. + * + * @param xdostime the extended DOS time value + * @return milliseconds since epoch + */ + public static long extendedDosToJavaTime(long xdostime) { + long time = dosToJavaTime(xdostime); + return time + (xdostime >> 32); + } + + /** * Converts Java time to DOS time. */ @SuppressWarnings("deprecation") // Use of date methods - public static long javaToDosTime(long time) { + private static long javaToDosTime(long time) { Date d = new Date(time); int year = d.getYear() + 1900; if (year < 1980) { - return (1 << 21) | (1 << 16); + return ZipEntry.DOSTIME_BEFORE_1980; } return (year - 1980) << 25 | (d.getMonth() + 1) << 21 | d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 | @@ -96,6 +105,23 @@ } /** + * Converts Java time to DOS time, encoding any milliseconds lost + * in the conversion into the upper half of the returned long. + * + * @param time milliseconds since epoch + * @return DOS time with 2s remainder encoded into upper half + */ + public static long javaToExtendedDosTime(long time) { + if (time < 0) { + return ZipEntry.DOSTIME_BEFORE_1980; + } + long dostime = javaToDosTime(time); + return (dostime != ZipEntry.DOSTIME_BEFORE_1980) + ? dostime + ((time % 2000) << 32) + : ZipEntry.DOSTIME_BEFORE_1980; + } + + /** * Fetches unsigned 16-bit value from byte array at specified offset. * The bytes are assumed to be in Intel (little-endian) byte order. */
--- a/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Wed Mar 18 18:19:10 2015 -0700 @@ -1254,10 +1254,11 @@ if (serverTerminated) { // we must not call fetchNotifs() if the server is // terminated (timeout elapsed). - // - return new NotificationResult(0L, 0L, - new TargetedNotification[0]); - + // returns null to force the client to stop fetching + if (logger.debugOn()) logger.debug("fetchNotifications", + "The notification server has been closed, " + + "returns null to force the client to stop fetching"); + return null; } final long csn = clientSequenceNumber; final int mn = maxNotifications;
--- a/src/share/classes/sun/text/resources/fi/FormatData_fi.java Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/classes/sun/text/resources/fi/FormatData_fi.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, 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 @@ -295,8 +295,8 @@ }, { "DatePatterns", new String[] { - "d. MMMM'ta 'yyyy", // full date pattern - "d. MMMM'ta 'yyyy", // long date pattern + "d. MMMM yyyy", // full date pattern + "d. MMMM yyyy", // long date pattern "d.M.yyyy", // medium date pattern "d.M.yyyy", // short date pattern }
--- a/src/share/native/sun/tracing/dtrace/JVM.c Wed Mar 18 13:57:00 2015 -0700 +++ b/src/share/native/sun/tracing/dtrace/JVM.c Wed Mar 18 18:19:10 2015 -0700 @@ -144,32 +144,34 @@ env, provider, &(jvm_provider->argsAttributes)); } -static void readProviderData( +static int readProviderData( JNIEnv* env, jobject provider, JVM_DTraceProvider* jvm_provider) { jmethodID mid; jobjectArray probes; jsize i; - jclass clazz = (*env)->GetObjectClass(env, provider); CHECK + jclass clazz = (*env)->GetObjectClass(env, provider); CHECK_(0) mid = (*env)->GetMethodID( - env, clazz, "getProbes", "()[Lsun/tracing/dtrace/DTraceProbe;"); CHECK + env, clazz, "getProbes", "()[Lsun/tracing/dtrace/DTraceProbe;"); CHECK_(0) probes = (jobjectArray)(*env)->CallObjectMethod( - env, provider, mid); CHECK + env, provider, mid); CHECK_(0) // Fill JVM structure, describing provider - jvm_provider->probe_count = (*env)->GetArrayLength(env, probes); CHECK + jvm_provider->probe_count = (*env)->GetArrayLength(env, probes); CHECK_(0) jvm_provider->probes = (JVM_DTraceProbe*)calloc( jvm_provider->probe_count, sizeof(*jvm_provider->probes)); mid = (*env)->GetMethodID( - env, clazz, "getProviderName", "()Ljava/lang/String;"); CHECK + env, clazz, "getProviderName", "()Ljava/lang/String;"); CHECK_(0) jvm_provider->name = (jstring)(*env)->CallObjectMethod( - env, provider, mid); CHECK + env, provider, mid); CHECK_(0) - readInterfaceAttributes(env, provider, jvm_provider); CHECK + readInterfaceAttributes(env, provider, jvm_provider); CHECK_(0) for (i = 0; i < jvm_provider->probe_count; ++i) { - jobject probe = (*env)->GetObjectArrayElement(env, probes, i); CHECK - readProbeData(env, probe, &jvm_provider->probes[i]); CHECK + jobject probe = (*env)->GetObjectArrayElement(env, probes, i); CHECK_(0) + readProbeData(env, probe, &jvm_provider->probes[i]); CHECK_(0) } + + return 1; } /* @@ -182,6 +184,7 @@ jlong handle = 0; jsize num_providers; jsize i; + jsize count = 0; JVM_DTraceProvider* jvm_providers; initialize(); @@ -195,16 +198,23 @@ jvm_providers = (JVM_DTraceProvider*)calloc( num_providers, sizeof(*jvm_providers)); - for (i = 0; i < num_providers; ++i) { - JVM_DTraceProvider* p = &(jvm_providers[i]); + for (; count < num_providers; ++count) { + JVM_DTraceProvider* p = &(jvm_providers[count]); jobject provider = (*env)->GetObjectArrayElement( - env, providers, i); - readProviderData(env, provider, p); + env, providers, count); + if ((*env)->ExceptionOccurred(env) || + ! readProviderData(env, provider, p)) { + // got an error, bail out! + break; + } } - handle = jvm_symbols->Activate( - env, JVM_TRACING_DTRACE_VERSION, moduleName, - num_providers, jvm_providers); + if (count == num_providers) { + // all providers successfully loaded - get the handle + handle = jvm_symbols->Activate( + env, JVM_TRACING_DTRACE_VERSION, moduleName, + num_providers, jvm_providers); + } for (i = 0; i < num_providers; ++i) { JVM_DTraceProvider* p = &(jvm_providers[i]);
--- a/test/Makefile Wed Mar 18 13:57:00 2015 -0700 +++ b/test/Makefile Wed Mar 18 18:19:10 2015 -0700 @@ -262,8 +262,8 @@ EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY) endif -# Default JTREG to run (win32 script works for everybody) -JTREG = $(JT_HOME)/win32/bin/jtreg +# Default JTREG to run +JTREG = $(JT_HOME)/bin/jtreg # run in agentvm mode JTREG_BASIC_OPTIONS += -agentvm # Only run automatic tests
--- a/test/com/sun/jdi/InterfaceMethodsTest.java Wed Mar 18 13:57:00 2015 -0700 +++ b/test/com/sun/jdi/InterfaceMethodsTest.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -24,6 +24,7 @@ /** * @test * @bug 8031195 + * @bug 8071657 * @summary JDI: Add support for static and default methods in interfaces * * @run build TestScaffold VMConnection TargetListener TargetAdapter @@ -38,6 +39,7 @@ private static final int RESULT_A = 1; private static final int RESULT_B = 1; private static final int RESULT_TARGET = 1; + static interface InterfaceA { static int staticMethodA() { System.out.println("-InterfaceA: static interface method A-"); @@ -202,6 +204,9 @@ // try to invoke static method B on the instance testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A)); + + // try to invoke a virtual method + testInvokePos(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(RESULT_A), true); } private void testInterfaceB(ObjectReference ref) { @@ -302,9 +307,14 @@ private void testInvokePos(ReferenceType targetClass, ObjectReference ref, String methodName, String methodSig, Value value) { + testInvokePos(targetClass, ref, methodName, methodSig, value, false); + } + + private void testInvokePos(ReferenceType targetClass, ObjectReference ref, String methodName, + String methodSig, Value value, boolean virtual) { logInvocation(ref, methodName, methodSig, targetClass); try { - invoke(targetClass, ref, methodName, methodSig, value); + invoke(targetClass, ref, methodName, methodSig, value, virtual); System.err.println("--- PASSED"); } catch (Exception e) { System.err.println("--- FAILED"); @@ -314,9 +324,14 @@ private void testInvokeNeg(ReferenceType targetClass, ObjectReference ref, String methodName, String methodSig, Value value, String msg) { + testInvokeNeg(targetClass, ref, methodName, methodSig, value, msg, false); + } + + private void testInvokeNeg(ReferenceType targetClass, ObjectReference ref, String methodName, + String methodSig, Value value, String msg, boolean virtual) { logInvocation(ref, methodName, methodSig, targetClass); try { - invoke(targetClass, ref, methodName, methodSig, value); + invoke(targetClass, ref, methodName, methodSig, value, virtual); System.err.println("--- FAILED"); failure("FAILED: " + msg); } catch (Exception e) { @@ -326,7 +341,7 @@ } private void invoke(ReferenceType targetClass, ObjectReference ref, String methodName, - String methodSig, Value value) + String methodSig, Value value, boolean virtual) throws Exception { Method method = getMethod(targetClass, methodName, methodSig); if (method == null) { @@ -334,10 +349,15 @@ } println("Invoking " + (method.isAbstract() ? "abstract " : " ") + "method: " + method); + println(method.declaringType().toString()); Value returnValue = null; if (ref != null) { - returnValue = invokeInstance(ref, method); + if (virtual) { + returnValue = invokeVirtual(ref, method); + } else { + returnValue = invokeInstance(ref, method); + } } else { returnValue = invokeStatic(targetClass, method); } @@ -362,6 +382,10 @@ return ref.invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL); } + private Value invokeVirtual(ObjectReference ref, Method method) throws Exception { + return ref.invokeMethod(mainThread, method, Collections.emptyList(), 0); + } + private Value invokeStatic(ReferenceType refType, Method method) throws Exception { if (refType instanceof ClassType) { return ((ClassType)refType).invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/MaximizedNormalBoundsUndecoratedTest/MaximizedNormalBoundsUndecoratedTest.java Wed Mar 18 18:19:10 2015 -0700 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2007, 2015, 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.Frame; +import java.awt.Toolkit; +import java.awt.Dimension; +/* + * @test + * @bug 8066436 + * @summary Set the size of frame. Set extendedState Frame.MAXIMIZED_BOTH and Frame.NORMAL + * sequentially for undecorated Frame and . + * Check if resulted size is equal to original frame size. + * @run main MaximizedNormalBoundsUndecoratedTest + */ + + +public class MaximizedNormalBoundsUndecoratedTest { + private Frame frame; + public static void main(String args[]) { + if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH) + && !Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.NORMAL)) { + return; + } + MaximizedNormalBoundsUndecoratedTest test = new MaximizedNormalBoundsUndecoratedTest(); + boolean doPass = true; + if( !test.doTest() ) { + System.out.println("Maximizing frame not saving correct normal bounds"); + doPass = false; + } + + if(!doPass) { + throw new RuntimeException("Maximizing frame not saving correct normal bounds"); + } + } + + boolean doTest() { + Dimension beforeMaximizeCalled = new Dimension(300,300); + + frame = new Frame("Test Frame"); + frame.setUndecorated(true); + frame.setFocusable(true); + frame.setSize(beforeMaximizeCalled); + frame.setVisible(true); + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + frame.setExtendedState(Frame.NORMAL); + + Dimension afterMaximizedCalled= frame.getBounds().getSize(); + + frame.dispose(); + + if (beforeMaximizeCalled.equals(afterMaximizedCalled)) { + return true; + } + return false; + } +}
--- a/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Wed Mar 18 13:57:00 2015 -0700 +++ b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Wed Mar 18 18:19:10 2015 -0700 @@ -36,7 +36,7 @@ import sun.java2d.SunGraphics2D; /** - * @test + * test * @bug 8043869 * @author Alexander Scherbatiy * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/invoke/lambda/LambdaStackTrace.java Wed Mar 18 18:19:10 2015 -0700 @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2015, 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 8025636 + * @summary Synthetic frames should be hidden in exceptions + * @compile -XDignore.symbol.file LUtils.java LambdaStackTrace.java + * @run main LambdaStackTrace + */ + +import jdk.internal.org.objectweb.asm.ClassWriter; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_ABSTRACT; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_INTERFACE; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static jdk.internal.org.objectweb.asm.Opcodes.V1_7; + +public class LambdaStackTrace { + + static File classes = new File(System.getProperty("test.classes")); + + public static void main(String[] args) throws Exception { + testBasic(); + testBridgeMethods(); + } + + /** + * Test the simple case + */ + private static void testBasic() throws Exception { + try { + Runnable r = () -> { + throw new RuntimeException(); + }; + r.run(); + } catch (Exception ex) { + // Before 8025636 the stacktrace would look like: + // at LambdaStackTrace.lambda$main$0(LambdaStackTrace.java:37) + // at LambdaStackTrace$$Lambda$1/1937396743.run(<Unknown>:1000000) + // at LambdaStackTrace.testBasic(LambdaStackTrace.java:40) + // at ... + // + // We are verifying that the middle frame above is gone. + + verifyFrames(ex.getStackTrace(), + "LambdaStackTrace\\..*", + "LambdaStackTrace.testBasic"); + } + } + + /** + * Test the more complicated case with bridge methods. + * + * We set up the following interfaces: + * + * interface Maker { + * Object make(); + * } + * interface StringMaker extends Maker { + * String make(); + * } + * + * And we will use them like so: + * + * StringMaker sm = () -> { throw new RuntimeException(); }; + * sm.make(); + * ((Maker)m).make(); + * + * The first call is a "normal" interface call, the second will use a + * bridge method. In both cases the generated lambda frame should + * be removed from the stack trace. + */ + private static void testBridgeMethods() throws Exception { + // setup + generateInterfaces(); + compileCaller(); + + // test + StackTraceElement[] frames = call("Caller", "callStringMaker"); + verifyFrames(frames, + "Caller\\..*", + "Caller.callStringMaker"); + + frames = call("Caller", "callMaker"); + verifyFrames(frames, + "Caller\\..*", + "Caller.callMaker"); + } + + private static void generateInterfaces() throws IOException { + // We can't let javac compile these interfaces because in > 1.8 it will insert + // bridge methods into the interfaces - we want code that looks like <= 1.7, + // so we generate it. + try (FileOutputStream fw = new FileOutputStream(new File(classes, "Maker.class"))) { + fw.write(generateMaker()); + } + try (FileOutputStream fw = new FileOutputStream(new File(classes, "StringMaker.class"))) { + fw.write(generateStringMaker()); + } + } + + private static byte[] generateMaker() { + // interface Maker { + // Object make(); + // } + ClassWriter cw = new ClassWriter(0); + cw.visit(V1_7, ACC_INTERFACE | ACC_ABSTRACT, "Maker", null, "java/lang/Object", null); + cw.visitMethod(ACC_PUBLIC | ACC_ABSTRACT, "make", + "()Ljava/lang/Object;", null, null); + cw.visitEnd(); + return cw.toByteArray(); + } + + private static byte[] generateStringMaker() { + // interface StringMaker extends Maker { + // String make(); + // } + ClassWriter cw = new ClassWriter(0); + cw.visit(V1_7, ACC_INTERFACE | ACC_ABSTRACT, "StringMaker", null, "java/lang/Object", new String[]{"Maker"}); + cw.visitMethod(ACC_PUBLIC | ACC_ABSTRACT, "make", + "()Ljava/lang/String;", null, null); + cw.visitEnd(); + return cw.toByteArray(); + } + + + static void emitCode(File f) { + ArrayList<String> scratch = new ArrayList<>(); + scratch.add("public class Caller {"); + scratch.add(" public static void callStringMaker() {"); + scratch.add(" StringMaker sm = () -> { throw new RuntimeException(); };"); + scratch.add(" sm.make();"); + scratch.add(" }"); + scratch.add(" public static void callMaker() {"); + scratch.add(" StringMaker sm = () -> { throw new RuntimeException(); };"); + scratch.add(" ((Maker) sm).make();"); // <-- This will call the bridge method + scratch.add(" }"); + scratch.add("}"); + LUtils.createFile(f, scratch); + } + + static void compileCaller() { + File caller = new File(classes, "Caller.java"); + emitCode(caller); + LUtils.compile("-cp", classes.getAbsolutePath(), "-d", classes.getAbsolutePath(), caller.getAbsolutePath()); + } + + private static void verifyFrames(StackTraceElement[] stack, String... patterns) throws Exception { + for (int i = 0; i < patterns.length; i++) { + String cm = stack[i].getClassName() + "." + stack[i].getMethodName(); + if (!cm.matches(patterns[i])) { + System.err.println("Actual trace did not match expected trace at frame " + i); + System.err.println("Expected frame patterns:"); + for (int j = 0; j < patterns.length; j++) { + System.err.println(" " + j + ": " + patterns[j]); + } + System.err.println("Actual frames:"); + for (int j = 0; j < patterns.length; j++) { + System.err.println(" " + j + ": " + stack[j]); + } + throw new Exception("Incorrect stack frames found"); + } + } + } + + private static StackTraceElement[] call(String clazz, String method) throws Exception { + Class<?> c = Class.forName(clazz); + try { + Method m = c.getDeclaredMethod(method); + m.invoke(null); + } catch(InvocationTargetException ex) { + return ex.getTargetException().getStackTrace(); + } + throw new Exception("Expected exception to be thrown"); + } +}
--- a/test/java/util/zip/TestExtraTime.java Wed Mar 18 13:57:00 2015 -0700 +++ b/test/java/util/zip/TestExtraTime.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 4759491 6303183 7012868 8015666 8023713 8068790 + * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8074694 * @summary Test ZOS and ZIS timestamp in extra field correctly */ @@ -71,6 +71,7 @@ } testNullHandling(); + testTimeConversions(); } static void test(FileTime mtime, FileTime atime, FileTime ctime, @@ -178,4 +179,33 @@ // pass } } + + // verify that setting and getting any time is possible as per the intent + // of 4759491 + static void testTimeConversions() { + // Sample across the entire range + long step = Long.MAX_VALUE / 100L; + testTimeConversions(Long.MIN_VALUE, Long.MAX_VALUE - step, step); + + // Samples through the near future + long currentTime = System.currentTimeMillis(); + testTimeConversions(currentTime, currentTime + 1_000_000, 10_000); + } + + static void testTimeConversions(long from, long to, long step) { + ZipEntry ze = new ZipEntry("TestExtraTime.java"); + for (long time = from; time <= to; time += step) { + ze.setTime(time); + FileTime lastModifiedTime = ze.getLastModifiedTime(); + if (lastModifiedTime.toMillis() != time) { + throw new RuntimeException("setTime should make getLastModifiedTime " + + "return the specified instant: " + time + + " got: " + lastModifiedTime.toMillis()); + } + if (ze.getTime() != time) { + throw new RuntimeException("getTime after setTime, expected: " + + time + " got: " + ze.getTime()); + } + } + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java Wed Mar 18 18:19:10 2015 -0700 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2015, 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 8072900 +@summary Mouse events are captured by the wrong menu in OS X +@author Anton Nashatyrev +@run main WrongSelectionOnMouseOver +*/ + +import javax.swing.*; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +public class WrongSelectionOnMouseOver implements Runnable { + + CountDownLatch firstMenuSelected = new CountDownLatch(1); + CountDownLatch secondMenuMouseEntered = new CountDownLatch(1); + CountDownLatch secondMenuSelected = new CountDownLatch(1); + + JMenu m1, m2; + + private UIManager.LookAndFeelInfo laf; + JFrame frame1; + JFrame frame2; + + public WrongSelectionOnMouseOver(UIManager.LookAndFeelInfo laf) throws Exception { + this.laf = laf; + } + + private void createUI() throws Exception { + System.out.println("Testing UI: " + laf); + UIManager.setLookAndFeel(laf.getClassName()); + + { + frame1 = new JFrame("Frame1"); + JMenuBar mb = new JMenuBar(); + m1 = new JMenu("File"); + JMenuItem i1 = new JMenuItem("Save"); + JMenuItem i2 = new JMenuItem("Load"); + + m1.addMenuListener(new MenuListener() { + @Override + public void menuSelected(MenuEvent e) { + firstMenuSelected.countDown(); + System.out.println("Menu1: menuSelected"); + } + + @Override + public void menuDeselected(MenuEvent e) { + System.out.println("Menu1: menuDeselected"); + } + + @Override + public void menuCanceled(MenuEvent e) { + System.out.println("Menu1: menuCanceled"); + } + }); + + frame1.setJMenuBar(mb); + mb.add(m1); + m1.add(i1); + m1.add(i2); + + frame1.setLayout(new FlowLayout()); + frame1.setBounds(200, 200, 200, 200); + + frame1.setVisible(true); + } + + { + frame2 = new JFrame("Frame2"); + JMenuBar mb = new JMenuBar(); + m2 = new JMenu("File"); + JMenuItem i1 = new JMenuItem("Save"); + JMenuItem i2 = new JMenuItem("Load"); + + m2.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + secondMenuMouseEntered.countDown(); + System.out.println("WrongSelectionOnMouseOver.mouseEntered"); + } + }); + + m2.addMenuListener(new MenuListener() { + @Override + public void menuSelected(MenuEvent e) { + secondMenuSelected.countDown(); + System.out.println("Menu2: menuSelected"); + } + + @Override + public void menuDeselected(MenuEvent e) { + System.out.println("Menu2: menuDeselected"); + } + + @Override + public void menuCanceled(MenuEvent e) { + System.out.println("Menu2: menuCanceled"); + } + }); + + frame2.setJMenuBar(mb); + mb.add(m2); + m2.add(i1); + m2.add(i2); + + frame2.setLayout(new FlowLayout()); + frame2.setBounds(400, 200, 200, 200); + + frame2.setVisible(true); + } + } + + public void disposeUI() { + frame1.dispose(); + frame2.dispose(); + } + + @Override + public void run() { + try { + if (frame1 == null) { + createUI(); + } else { + disposeUI(); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void test() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + + robot.waitForIdle(); + + robot.mouseMove((int) m1.getLocationOnScreen().getX() + 5, + (int) m1.getLocationOnScreen().getY() + 5); + robot.mousePress(MouseEvent.BUTTON1_MASK); + robot.mouseRelease(MouseEvent.BUTTON1_MASK); + + if (!firstMenuSelected.await(5, TimeUnit.SECONDS)) { + throw new RuntimeException("Menu has not been selected."); + }; + + robot.mouseMove((int) m2.getLocationOnScreen().getX() + 5, + (int) m2.getLocationOnScreen().getY() + 5); + + if (!secondMenuMouseEntered.await(5, TimeUnit.SECONDS)) { + throw new RuntimeException("MouseEntered event missed for the second menu"); + }; + + if (secondMenuSelected.await(1, TimeUnit.SECONDS)) { + throw new RuntimeException("The second menu has been selected"); + }; + } + + public static void main(final String[] args) throws Exception { + for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) { + WrongSelectionOnMouseOver test = new WrongSelectionOnMouseOver(laf); + SwingUtilities.invokeAndWait(test); + test.test(); + SwingUtilities.invokeAndWait(test); + } + System.out.println("Test passed"); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/text/resources/Format/Bug8074791.java Wed Mar 18 18:19:10 2015 -0700 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2015, 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 8074791 + * @summary Make sure that Finnish month names are correct in formatted text. + */ + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Locale; +import static java.text.DateFormat.*; +import static java.util.Calendar.JANUARY; + +public class Bug8074791 { + private static Locale FINNISH = new Locale("fi"); + private static String JAN_FORMAT = "tammikuuta"; + private static String JAN_STANDALONE = "tammikuu"; + + public static void main(String[] arg) { + int errors = 0; + + DateFormat df = DateFormat.getDateInstance(LONG, FINNISH); + Date jan20 = new GregorianCalendar(2015, JANUARY, 20).getTime(); + String str = df.format(jan20).toString(); + // Extract the month name (locale data dependent) + String month = str.replaceAll(".+\\s([a-z]+)\\s\\d+$", "$1"); + if (!month.equals(JAN_FORMAT)) { + errors++; + System.err.println("wrong format month name: got '" + month + + "', expected '" + JAN_FORMAT + "'"); + } + + SimpleDateFormat sdf = new SimpleDateFormat("LLLL", FINNISH); // stand-alone month name + month = sdf.format(jan20); + if (!month.equals(JAN_STANDALONE)) { + errors++; + System.err.println("wrong stand-alone month name: got '" + month + + "', expected '" + JAN_STANDALONE + "'"); + } + + if (errors > 0) { + throw new RuntimeException(); + } + } +}
--- a/test/sun/text/resources/LocaleData Wed Mar 18 13:57:00 2015 -0700 +++ b/test/sun/text/resources/LocaleData Wed Mar 18 18:19:10 2015 -0700 @@ -8276,3 +8276,9 @@ FormatData/zh/MonthNarrows/10=11 FormatData/zh/MonthNarrows/11=12 FormatData/zh/MonthNarrows/12= + +# bug #8074791 +FormatData/fi/DatePatterns/0=d. MMMM yyyy +FormatData/fi/DatePatterns/1=d. MMMM yyyy +FormatData/fi/DatePatterns/2=d.M.yyyy +FormatData/fi/DatePatterns/3=d.M.yyyy
--- a/test/sun/text/resources/LocaleDataTest.java Wed Mar 18 13:57:00 2015 -0700 +++ b/test/sun/text/resources/LocaleDataTest.java Wed Mar 18 18:19:10 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -36,7 +36,7 @@ * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495 * 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509 * 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 7090826 - * 8017142 8037343 8055222 8042126 + * 8017142 8037343 8055222 8042126 8074791 * @summary Verify locale data * */