# HG changeset patch # User lana # Date 1415988204 28800 # Node ID 31dac938108da722c56a0526fba7f6ae84773056 # Parent f5ba1bbe180b17451a9cc8a4b88543a77818dcc8# Parent 5a29fd30ffaa3186d90d6c1ea2d257cef55117fb Merge diff -r f5ba1bbe180b -r 31dac938108d make/mapfiles/libsplashscreen/mapfile-vers --- a/make/mapfiles/libsplashscreen/mapfile-vers Wed Nov 12 13:47:21 2014 -0800 +++ b/make/mapfiles/libsplashscreen/mapfile-vers Fri Nov 14 10:03:24 2014 -0800 @@ -35,6 +35,7 @@ Java_java_awt_SplashScreen__1getImageFileName; Java_java_awt_SplashScreen__1getImageJarName; Java_java_awt_SplashScreen__1setImageData; + Java_java_awt_SplashScreen__1getScaleFactor; SplashLoadMemory; SplashLoadFile; diff -r f5ba1bbe180b -r 31dac938108d src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Nov 14 10:03:24 2014 -0800 @@ -676,7 +676,7 @@ final long nsWindowPtr = getNSWindowPtr(); LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit(); Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); - if( w != null + if( w != null && w.getPeer() != null && ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME && !lwcToolkit.isApplicationActive()) { lwcToolkit.activateApplicationIgnoringOtherApps(); diff -r f5ba1bbe180b -r 31dac938108d src/macosx/native/apple/security/KeystoreImpl.m --- a/src/macosx/native/apple/security/KeystoreImpl.m Wed Nov 12 13:47:21 2014 -0800 +++ b/src/macosx/native/apple/security/KeystoreImpl.m Fri Nov 14 10:03:24 2014 -0800 @@ -299,11 +299,21 @@ // Make a java array of certificate data from the chain. jclass byteArrayClass = (*env)->FindClass(env, "[B"); + if (byteArrayClass == NULL) { + goto errOut; + } jobjectArray javaCertArray = (*env)->NewObjectArray(env, certCount, byteArrayClass, NULL); + // Cleanup first then check for a NULL return code (*env)->DeleteLocalRef(env, byteArrayClass); + if (javaCertArray == NULL) { + goto errOut; + } // And, make an array of the certificate refs. jlongArray certRefArray = (*env)->NewLongArray(env, certCount); + if (certRefArray == NULL) { + goto errOut; + } SecCertificateRef currCertRef = NULL; @@ -318,6 +328,9 @@ bzero(&currCertData, sizeof(CSSM_DATA)); err = SecCertificateGetData(currCertRef, &currCertData); jbyteArray encodedCertData = (*env)->NewByteArray(env, currCertData.Length); + if (encodedCertData == NULL) { + goto errOut; + } (*env)->SetByteArrayRegion(env, encodedCertData, 0, currCertData.Length, (jbyte *)currCertData.Data); (*env)->SetObjectArrayElement(env, javaCertArray, i, encodedCertData); jlong certRefElement = ptr_to_jlong(currCertRef); @@ -330,6 +343,9 @@ // Find the label. It's a 'blob', but we interpret as characters. jstring alias = getLabelFromItem(env, (SecKeychainItemRef)certificate); + if (alias == NULL) { + goto errOut; + } // Find the creation date. jlong creationDate = getModDateFromItem(env, (SecKeychainItemRef)certificate); @@ -340,6 +356,7 @@ } } while (searchResult == noErr); +errOut: if (identitySearch != NULL) { CFRelease(identitySearch); } @@ -362,10 +379,16 @@ CSSM_DATA currCertificate; err = SecCertificateGetData(certRef, &currCertificate); jbyteArray certData = (*env)->NewByteArray(env, currCertificate.Length); + if (certData == NULL) { + goto errOut; + } (*env)->SetByteArrayRegion(env, certData, 0, currCertificate.Length, (jbyte *)currCertificate.Data); // Find the label. It's a 'blob', but we interpret as characters. jstring alias = getLabelFromItem(env, theItem); + if (alias == NULL) { + goto errOut; + } // Find the creation date. jlong creationDate = getModDateFromItem(env, theItem); @@ -376,6 +399,7 @@ } } while (searchResult == noErr); +errOut: if (keychainItemSearch != NULL) { CFRelease(keychainItemSearch); } @@ -404,6 +428,9 @@ if (passwordLen > 0) { passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL); + if (passwordChars == NULL) { + goto errOut; + } passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen); } } @@ -423,9 +450,13 @@ if (err == noErr) { CFIndex size = CFDataGetLength(exportedData); returnValue = (*env)->NewByteArray(env, size); + if (returnValue == NULL) { + goto errOut; + } (*env)->SetByteArrayRegion(env, returnValue, 0, size, (jbyte *)CFDataGetBytePtr(exportedData)); } +errOut: if (exportedData) CFRelease(exportedData); if (passwordStrRef) CFRelease(passwordStrRef); @@ -466,6 +497,9 @@ jsize dataSize = (*env)->GetArrayLength(env, rawDataObj); jbyte *rawData = (*env)->GetByteArrayElements(env, rawDataObj, NULL); + if (rawData == NULL) { + goto errOut; + } CFDataRef cfDataToImport = CFDataCreate(kCFAllocatorDefault, (UInt8 *)rawData, dataSize); CFArrayRef createdItems = NULL; @@ -522,6 +556,8 @@ CFRelease(createdItems); } +errOut: ; + JNF_COCOA_EXIT(env); return returnValue; diff -r f5ba1bbe180b -r 31dac938108d src/macosx/native/java/util/MacOSXPreferencesFile.m --- a/src/macosx/native/java/util/MacOSXPreferencesFile.m Wed Nov 12 13:47:21 2014 -0800 +++ b/src/macosx/native/java/util/MacOSXPreferencesFile.m Fri Nov 14 10:03:24 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,6 +71,8 @@ static jclass exceptionClass = NULL; jclass c; + (*env)->ExceptionClear(env); // If an exception is pending, clear it before + // calling FindClass() and/or ThrowNew(). if (exceptionClass) { c = exceptionClass; } else { @@ -534,8 +536,13 @@ (JNIEnv *env, jobject klass, jobject jpath, jobject jname, jlong juser, jlong jhost) { - CFStringRef path = toCF(env, jpath); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFDictionaryRef node = NULL; @@ -579,8 +586,13 @@ (JNIEnv *env, jobject klass, jobject jpath, jobject jname, jlong juser, jlong jhost) { - CFStringRef path = toCF(env, jpath); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFStringRef parentName; @@ -647,9 +659,17 @@ jobject jname, jlong juser, jlong jhost) { // like addNode, but can put a three-level-deep dict into the root file - CFStringRef path = toCF(env, jpath); - CFStringRef child = toCF(env, jchild); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef child = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + child = toCF(env, jchild); + } + if (child != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFMutableDictionaryRef parent; @@ -693,9 +713,17 @@ (JNIEnv *env, jobject klass, jobject jpath, jobject jchild, jobject jname, jlong juser, jlong jhost) { - CFStringRef path = toCF(env, jpath); - CFStringRef child = toCF(env, jchild); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef child = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + child = toCF(env, jchild); + } + if (child != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFDictionaryRef constParent; @@ -734,10 +762,21 @@ (JNIEnv *env, jobject klass, jobject jpath, jobject jkey, jobject jvalue, jobject jname, jlong juser, jlong jhost) { - CFStringRef path = toCF(env, jpath); - CFStringRef key = toCF(env, jkey); - CFStringRef value = toCF(env, jvalue); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef key = NULL; + CFStringRef value = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + key = toCF(env, jkey); + } + if (key != NULL) { + value = toCF(env, jvalue); + } + if (value != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFMutableDictionaryRef node = NULL; @@ -771,9 +810,17 @@ (JNIEnv *env, jobject klass, jobject jpath, jobject jkey, jobject jname, jlong juser, jlong jhost) { - CFStringRef path = toCF(env, jpath); - CFStringRef key = toCF(env, jkey); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef key = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + key = toCF(env, jkey); + } + if (key != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFDictionaryRef constNode; @@ -812,9 +859,17 @@ (JNIEnv *env, jobject klass, jobject jpath, jobject jkey, jobject jname, jlong juser, jlong jhost) { - CFStringRef path = toCF(env, jpath); - CFStringRef key = toCF(env, jkey); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef key = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + key = toCF(env, jkey); + } + if (key != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFPropertyListRef value; @@ -914,8 +969,13 @@ jobject jname, jlong juser, jlong jhost, Boolean allowSlash) { - CFStringRef path = toCF(env, jpath); - CFStringRef name = toCF(env, jname); + CFStringRef path = NULL; + CFStringRef name = NULL; + + path = toCF(env, jpath); + if (path != NULL) { + name = toCF(env, jname); + } CFStringRef user = (CFStringRef)jlong_to_ptr(juser); CFStringRef host = (CFStringRef)jlong_to_ptr(jhost); CFDictionaryRef node; diff -r f5ba1bbe180b -r 31dac938108d src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m --- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Wed Nov 12 13:47:21 2014 -0800 +++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Fri Nov 14 10:03:24 2014 -0800 @@ -45,6 +45,7 @@ #include #include +#import "ThreadUtilities.h" static NSScreen* SplashNSScreen() { @@ -125,6 +126,43 @@ return buf; } +char* SplashGetScaledImageName(const char* jar, const char* file, + float *scaleFactor) { + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + *scaleFactor = 1; + char* scaledFile = nil; + __block float screenScaleFactor = 1; + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + screenScaleFactor = [SplashNSScreen() backingScaleFactor]; + }]; + + if (screenScaleFactor > 1) { + NSString *fileName = [NSString stringWithUTF8String: file]; + NSUInteger length = [fileName length]; + NSRange range = [fileName rangeOfString: @"." + options:NSBackwardsSearch]; + NSUInteger dotIndex = range.location; + NSString *fileName2x = nil; + + if (dotIndex == NSNotFound) { + fileName2x = [fileName stringByAppendingString: @"@2x"]; + } else { + fileName2x = [fileName substringToIndex: dotIndex]; + fileName2x = [fileName2x stringByAppendingString: @"@2x"]; + fileName2x = [fileName2x stringByAppendingString: + [fileName substringFromIndex: dotIndex]]; + } + + if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager] + fileExistsAtPath: fileName2x])){ + *scaleFactor = 2; + scaledFile = strdup([fileName2x UTF8String]); + } + } + [pool drain]; + return scaledFile; +} void SplashInitPlatform(Splash * splash) { @@ -132,7 +170,7 @@ splash->maskRequired = 0; - + //TODO: the following is too much of a hack but should work in 90% cases. // besides we don't use device-dependant drawing, so probably // that's very fine indeed @@ -218,7 +256,15 @@ [image setBackgroundColor: [NSColor clearColor]]; [image addRepresentation: rep]; - + float scaleFactor = splash->scaleFactor; + if (scaleFactor > 0 && scaleFactor != 1) { + [image setScalesWhenResized:YES]; + NSSize size = [image size]; + size.width /= scaleFactor; + size.height /= scaleFactor; + [image setSize: size]; + } + NSImageView * view = [[NSImageView alloc] init]; [view setImage: image]; diff -r f5ba1bbe180b -r 31dac938108d src/share/bin/java.c --- a/src/share/bin/java.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/bin/java.c Fri Nov 14 10:03:24 2014 -0800 @@ -1874,20 +1874,48 @@ const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY); const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY); int data_size; - void *image_data; + void *image_data = NULL; + float scale_factor = 1; + char *scaled_splash_name = NULL; + + if (file_name == NULL){ + return; + } + + scaled_splash_name = DoSplashGetScaledImageName( + jar_name, file_name, &scale_factor); if (jar_name) { - image_data = JLI_JarUnpackFile(jar_name, file_name, &data_size); + + if (scaled_splash_name) { + image_data = JLI_JarUnpackFile( + jar_name, scaled_splash_name, &data_size); + } + + if (!image_data) { + scale_factor = 1; + image_data = JLI_JarUnpackFile( + jar_name, file_name, &data_size); + } if (image_data) { DoSplashInit(); + DoSplashSetScaleFactor(scale_factor); DoSplashLoadMemory(image_data, data_size); JLI_MemFree(image_data); } - } else if (file_name) { + } else { DoSplashInit(); - DoSplashLoadFile(file_name); - } else { - return; + if (scaled_splash_name) { + DoSplashSetScaleFactor(scale_factor); + DoSplashLoadFile(scaled_splash_name); + } else { + DoSplashLoadFile(file_name); + } } + + if (scaled_splash_name) { + JLI_MemFree(scaled_splash_name); + } + DoSplashSetFileJarName(file_name, jar_name); /* diff -r f5ba1bbe180b -r 31dac938108d src/share/bin/splashscreen.h --- a/src/share/bin/splashscreen.h Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/bin/splashscreen.h Fri Nov 14 10:03:24 2014 -0800 @@ -29,3 +29,6 @@ void DoSplashInit(void); void DoSplashClose(void); void DoSplashSetFileJarName(const char* fileName, const char* jarName); +void DoSplashSetScaleFactor(float scaleFactor); +char* DoSplashGetScaledImageName(const char* jarName, const char* fileName, + float* scaleFactor); diff -r f5ba1bbe180b -r 31dac938108d src/share/bin/splashscreen_stubs.c --- a/src/share/bin/splashscreen_stubs.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/bin/splashscreen_stubs.c Fri Nov 14 10:03:24 2014 -0800 @@ -37,6 +37,9 @@ typedef void (*SplashClose_t)(void); typedef void (*SplashSetFileJarName_t)(const char* fileName, const char* jarName); +typedef void (*SplashSetScaleFactor_t)(float scaleFactor); +typedef char* (*SplashGetScaledImageName_t)(const char* fileName, + const char* jarName, float* scaleFactor); /* * This macro invokes a function from the shared lib. @@ -58,11 +61,11 @@ #define INVOKEV(name) _INVOKE(name, ,;) int DoSplashLoadMemory(void* pdata, int size) { - INVOKE(SplashLoadMemory,0)(pdata, size); + INVOKE(SplashLoadMemory, NULL)(pdata, size); } int DoSplashLoadFile(const char* filename) { - INVOKE(SplashLoadFile,0)(filename); + INVOKE(SplashLoadFile, NULL)(filename); } void DoSplashInit(void) { @@ -76,3 +79,12 @@ void DoSplashSetFileJarName(const char* fileName, const char* jarName) { INVOKEV(SplashSetFileJarName)(fileName, jarName); } + +void DoSplashSetScaleFactor(float scaleFactor) { + INVOKEV(SplashSetScaleFactor)(scaleFactor); +} + +char* DoSplashGetScaledImageName(const char* fileName, const char* jarName, + float* scaleFactor) { + INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor); +} \ No newline at end of file diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/awt/SplashScreen.java --- a/src/share/classes/java/awt/SplashScreen.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/awt/SplashScreen.java Fri Nov 14 10:03:24 2014 -0800 @@ -245,7 +245,14 @@ public Rectangle getBounds() throws IllegalStateException { synchronized (SplashScreen.class) { checkVisible(); - return _getBounds(splashPtr); + float scale = _getScaleFactor(splashPtr); + Rectangle bounds = _getBounds(splashPtr); + assert scale > 0; + if (scale > 0 && scale != 1) { + bounds.setSize((int) (bounds.getWidth() / scale), + (int) (bounds.getWidth() / scale)); + } + return bounds; } } @@ -287,10 +294,19 @@ public Graphics2D createGraphics() throws IllegalStateException { synchronized (SplashScreen.class) { if (image==null) { - Dimension dim = getSize(); - image = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB); + // get unscaled splash image size + Dimension dim = _getBounds(splashPtr).getSize(); + image = new BufferedImage(dim.width, dim.height, + BufferedImage.TYPE_INT_ARGB); } - return image.createGraphics(); + float scale = _getScaleFactor(splashPtr); + Graphics2D g = image.createGraphics(); + assert (scale > 0); + if (scale <= 0) { + scale = 1; + } + g.scale(scale, scale); + return g; } } @@ -401,5 +417,6 @@ private native static String _getImageFileName(long splashPtr); private native static String _getImageJarName(long SplashPtr); private native static boolean _setImageData(long SplashPtr, byte[] data); + private native static float _getScaleFactor(long SplashPtr); }; diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/awt/Window.java --- a/src/share/classes/java/awt/Window.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/awt/Window.java Fri Nov 14 10:03:24 2014 -0800 @@ -2247,7 +2247,18 @@ } firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop); } - for (WeakReference ref : ownedWindowList) { + setOwnedWindowsAlwaysOnTop(alwaysOnTop); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private void setOwnedWindowsAlwaysOnTop(boolean alwaysOnTop) { + WeakReference[] ownedWindowArray; + synchronized (ownedWindowList) { + ownedWindowArray = new WeakReference[ownedWindowList.size()]; + ownedWindowList.copyInto(ownedWindowArray); + } + + for (WeakReference ref : ownedWindowArray) { Window window = ref.get(); if (window != null) { try { diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/io/SequenceInputStream.java --- a/src/share/classes/java/io/SequenceInputStream.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/io/SequenceInputStream.java Fri Nov 14 10:03:24 2014 -0800 @@ -135,7 +135,7 @@ * @since JDK1.1 */ public int available() throws IOException { - if(in == null) { + if (in == null) { return 0; // no way to signal EOF from available() } return in.available(); @@ -160,15 +160,14 @@ * @exception IOException if an I/O error occurs. */ public int read() throws IOException { - if (in == null) { - return -1; + while (in != null) { + int c = in.read(); + if (c != -1) { + return c; + } + nextStream(); } - int c = in.read(); - if (c == -1) { - nextStream(); - return read(); - } - return c; + return -1; } /** @@ -204,13 +203,14 @@ } else if (len == 0) { return 0; } - - int n = in.read(b, off, len); - if (n <= 0) { + do { + int n = in.read(b, off, len); + if (n > 0) { + return n; + } nextStream(); - return read(b, off, len); - } - return n; + } while (in != null); + return -1; } /** diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/lang/invoke/MethodType.java --- a/src/share/classes/java/lang/invoke/MethodType.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/lang/invoke/MethodType.java Fri Nov 14 10:03:24 2014 -0800 @@ -891,11 +891,6 @@ * with MHs.eCE. * 3a. unboxing conversions can be followed by the full matrix of primitive conversions * 3b. unboxing of null is permitted (creates a zero primitive value) - * Most unboxing conversions, like {@code Object->int}, has potentially - * different behaviors for asType vs. MHs.eCE, because the dynamic value - * might be a wrapper of a type that requires narrowing, like {@code (Object)1L->byte}. - * The equivalence is only certain if the static src type is a wrapper, - * and the conversion will be a widening one. * Other than interfaces, reference-to-reference conversions are the same. * Boxing primitives to references is the same for both operators. */ @@ -906,11 +901,8 @@ // Or a boxing conversion, which is always to an exact wrapper class. return canConvert(src, dst); } else if (dst.isPrimitive()) { - Wrapper dw = Wrapper.forPrimitiveType(dst); - // Watch out: If src is Number or Object, we could get dynamic narrowing conversion. - // The conversion is known to be widening only if the wrapper type is statically visible. - return (Wrapper.isWrapperType(src) && - dw.isConvertibleFrom(Wrapper.forWrapperType(src))); + // Unboxing behavior is different between MHs.eCA & MH.asType (see 3b). + return false; } else { // R->R always works, but we have to avoid a check-cast to an interface. return !dst.isInterface() || dst.isAssignableFrom(src); diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/lang/ref/ReferenceQueue.java --- a/src/share/classes/java/lang/ref/ReferenceQueue.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/lang/ref/ReferenceQueue.java Fri Nov 14 10:03:24 2014 -0800 @@ -138,11 +138,17 @@ synchronized (lock) { Reference r = reallyPoll(); if (r != null) return r; + long start = (timeout == 0) ? 0 : System.nanoTime(); for (;;) { lock.wait(timeout); r = reallyPoll(); if (r != null) return r; - if (timeout != 0) return null; + if (timeout != 0) { + long end = System.nanoTime(); + timeout -= (end - start) / 1000_000; + if (timeout <= 0) return null; + start = end; + } } } } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/util/BitSet.java --- a/src/share/classes/java/util/BitSet.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/util/BitSet.java Fri Nov 14 10:03:24 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -696,6 +696,9 @@ *
 {@code
      * for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
      *     // operate on index i here
+     *     if (i == Integer.MAX_VALUE) {
+     *         break; // or (i+1) would overflow
+     *     }
      * }}
* * @param fromIndex the index to start checking from (inclusive) @@ -1186,10 +1189,12 @@ int i = nextSetBit(0); if (i != -1) { b.append(i); - for (i = nextSetBit(i+1); i >= 0; i = nextSetBit(i+1)) { + while (true) { + if (++i < 0) break; + if ((i = nextSetBit(i)) < 0) break; int endOfRun = nextClearBit(i); do { b.append(", ").append(i); } - while (++i < endOfRun); + while (++i != endOfRun); } } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/java/util/IdentityHashMap.java --- a/src/share/classes/java/util/IdentityHashMap.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/java/util/IdentityHashMap.java Fri Nov 14 10:03:24 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ package java.util; -import java.io.*; import java.lang.reflect.Array; import java.util.function.BiConsumer; import java.util.function.BiFunction; @@ -74,7 +73,7 @@ * maximum size and the number of buckets is unspecified. * *

If the size of the map (the number of key-value mappings) sufficiently - * exceeds the expected maximum size, the number of buckets is increased + * exceeds the expected maximum size, the number of buckets is increased. * Increasing the number of buckets ("rehashing") may be fairly expensive, so * it pays to create identity hash maps with a sufficiently large expected * maximum size. On the other hand, iteration over collection views requires @@ -160,6 +159,10 @@ * The maximum capacity, used if a higher value is implicitly specified * by either of the constructors with arguments. * MUST be a power of two <= 1<<29. + * + * In fact, the map can hold no more than MAXIMUM_CAPACITY-1 items + * because it has to have at least one slot with the key == null + * in order to avoid infinite loops in get(), put(), remove() */ private static final int MAXIMUM_CAPACITY = 1 << 29; @@ -181,11 +184,6 @@ transient int modCount; /** - * The next size value at which to resize (capacity * load factor). - */ - private transient int threshold; - - /** * Value representing null keys inside tables. */ static final Object NULL_KEY = new Object(); @@ -229,27 +227,18 @@ } /** - * Returns the appropriate capacity for the specified expected maximum - * size. Returns the smallest power of two between MINIMUM_CAPACITY - * and MAXIMUM_CAPACITY, inclusive, that is greater than - * (3 * expectedMaxSize)/2, if such a number exists. Otherwise - * returns MAXIMUM_CAPACITY. If (3 * expectedMaxSize)/2 is negative, it - * is assumed that overflow has occurred, and MAXIMUM_CAPACITY is returned. + * Returns the appropriate capacity for the given expected maximum size. + * Returns the smallest power of two between MINIMUM_CAPACITY and + * MAXIMUM_CAPACITY, inclusive, that is greater than (3 * + * expectedMaxSize)/2, if such a number exists. Otherwise returns + * MAXIMUM_CAPACITY. */ - private int capacity(int expectedMaxSize) { - // Compute min capacity for expectedMaxSize given a load factor of 2/3 - int minCapacity = (3 * expectedMaxSize)/2; - - // Compute the appropriate capacity - int result; - if (minCapacity > MAXIMUM_CAPACITY || minCapacity < 0) { - result = MAXIMUM_CAPACITY; - } else { - result = MINIMUM_CAPACITY; - while (result < minCapacity) - result <<= 1; - } - return result; + private static int capacity(int expectedMaxSize) { + // assert expectedMaxSize >= 0; + return + (expectedMaxSize > MAXIMUM_CAPACITY / 3) ? MAXIMUM_CAPACITY : + (expectedMaxSize <= 2 * MINIMUM_CAPACITY / 3) ? MINIMUM_CAPACITY : + Integer.highestOneBit(expectedMaxSize + (expectedMaxSize << 1)); } /** @@ -262,7 +251,6 @@ // assert initCapacity >= MINIMUM_CAPACITY; // assert initCapacity <= MAXIMUM_CAPACITY; - threshold = (initCapacity * 2)/3; table = new Object[2 * initCapacity]; } @@ -429,52 +417,58 @@ * @see #containsKey(Object) */ public V put(K key, V value) { - Object k = maskNull(key); - Object[] tab = table; - int len = tab.length; - int i = hash(k, len); + final Object k = maskNull(key); + + retryAfterResize: for (;;) { + final Object[] tab = table; + final int len = tab.length; + int i = hash(k, len); - Object item; - while ( (item = tab[i]) != null) { - if (item == k) { - @SuppressWarnings("unchecked") - V oldValue = (V) tab[i + 1]; - tab[i + 1] = value; - return oldValue; + for (Object item; (item = tab[i]) != null; + i = nextKeyIndex(i, len)) { + if (item == k) { + @SuppressWarnings("unchecked") + V oldValue = (V) tab[i + 1]; + tab[i + 1] = value; + return oldValue; + } } - i = nextKeyIndex(i, len); - } + + final int s = size + 1; + // Use optimized form of 3 * s. + // Next capacity is len, 2 * current capacity. + if (s + (s << 1) > len && resize(len)) + continue retryAfterResize; - modCount++; - tab[i] = k; - tab[i + 1] = value; - if (++size >= threshold) - resize(len); // len == 2 * current capacity. - return null; + modCount++; + tab[i] = k; + tab[i + 1] = value; + size = s; + return null; + } } /** - * Resize the table to hold given capacity. + * Resizes the table if necessary to hold given capacity. * * @param newCapacity the new capacity, must be a power of two. + * @return whether a resize did in fact take place */ - private void resize(int newCapacity) { + private boolean resize(int newCapacity) { // assert (newCapacity & -newCapacity) == newCapacity; // power of 2 int newLength = newCapacity * 2; Object[] oldTable = table; int oldLength = oldTable.length; - if (oldLength == 2*MAXIMUM_CAPACITY) { // can't expand any further - if (threshold == MAXIMUM_CAPACITY-1) + if (oldLength == 2 * MAXIMUM_CAPACITY) { // can't expand any further + if (size == MAXIMUM_CAPACITY - 1) throw new IllegalStateException("Capacity exhausted."); - threshold = MAXIMUM_CAPACITY-1; // Gigantic map! - return; + return false; } if (oldLength >= newLength) - return; + return false; Object[] newTable = new Object[newLength]; - threshold = newLength / 3; for (int j = 0; j < oldLength; j += 2) { Object key = oldTable[j]; @@ -490,6 +484,7 @@ } } table = newTable; + return true; } /** @@ -504,8 +499,8 @@ int n = m.size(); if (n == 0) return; - if (n > threshold) // conservatively pre-expand - resize(capacity(n)); + if (n > size) + resize(capacity(n)); // conservatively pre-expand for (Entry e : m.entrySet()) put(e.getKey(), e.getValue()); @@ -542,7 +537,6 @@ return null; i = nextKeyIndex(i, len); } - } /** @@ -1266,8 +1260,8 @@ private static final long serialVersionUID = 8188218128353913216L; /** - * Save the state of the IdentityHashMap instance to a stream - * (i.e., serialize it). + * Saves the state of the IdentityHashMap instance to a stream + * (i.e., serializes it). * * @serialData The size of the HashMap (the number of key-value * mappings) (int), followed by the key (Object) and @@ -1295,8 +1289,8 @@ } /** - * Reconstitute the IdentityHashMap instance from a stream (i.e., - * deserialize it). + * Reconstitutes the IdentityHashMap instance from a stream (i.e., + * deserializes it). */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { @@ -1305,9 +1299,10 @@ // Read in size (number of Mappings) int size = s.readInt(); - - // Allow for 33% growth (i.e., capacity is >= 2* size()). - init(capacity((size*4)/3)); + if (size < 0) + throw new java.io.StreamCorruptedException + ("Illegal mappings count: " + size); + init(capacity(size)); // Read the keys and values, and put the mappings in the table for (int i=0; i= Short.MIN_VALUE && value <= Short.MAX_VALUE) { mv.visitIntInsn(Opcodes.SIPUSH, value); } else { - mv.visitLdcInsn(new Integer(value)); + mv.visitLdcInsn(value); } } @@ -422,7 +422,7 @@ if (value == 0L || value == 1L) { mv.visitInsn(Opcodes.LCONST_0 + (int) value); } else { - mv.visitLdcInsn(new Long(value)); + mv.visitLdcInsn(value); } } @@ -437,7 +437,7 @@ if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2 mv.visitInsn(Opcodes.FCONST_0 + (int) value); } else { - mv.visitLdcInsn(new Float(value)); + mv.visitLdcInsn(value); } } @@ -452,7 +452,7 @@ if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d mv.visitInsn(Opcodes.DCONST_0 + (int) value); } else { - mv.visitLdcInsn(new Double(value)); + mv.visitLdcInsn(value); } } @@ -1647,11 +1647,13 @@ */ public void catchException(final Label start, final Label end, final Type exception) { + Label doCatch = new Label(); if (exception == null) { - mv.visitTryCatchBlock(start, end, mark(), null); + mv.visitTryCatchBlock(start, end, doCatch, null); } else { - mv.visitTryCatchBlock(start, end, mark(), + mv.visitTryCatchBlock(start, end, doCatch, exception.getInternalName()); } + mark(doCatch); } } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Fri Nov 14 10:03:24 2014 -0800 @@ -737,7 +737,7 @@ } else if (cst >= Short.MIN_VALUE && cst <= Short.MAX_VALUE) { mv.visitIntInsn(Opcodes.SIPUSH, cst); } else { - mv.visitLdcInsn(new Integer(cst)); + mv.visitLdcInsn(cst); } } @@ -745,7 +745,7 @@ if (cst == 0L || cst == 1L) { mv.visitInsn(Opcodes.LCONST_0 + (int) cst); } else { - mv.visitLdcInsn(new Long(cst)); + mv.visitLdcInsn(cst); } } @@ -754,7 +754,7 @@ if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2 mv.visitInsn(Opcodes.FCONST_0 + (int) cst); } else { - mv.visitLdcInsn(new Float(cst)); + mv.visitLdcInsn(cst); } } @@ -763,7 +763,7 @@ if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d mv.visitInsn(Opcodes.DCONST_0 + (int) cst); } else { - mv.visitLdcInsn(new Double(cst)); + mv.visitLdcInsn(cst); } } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java Fri Nov 14 10:03:24 2014 -0800 @@ -366,8 +366,7 @@ protected void addSVUID(long svuid) { FieldVisitor fv = super.visitField(Opcodes.ACC_FINAL - + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, new Long( - svuid)); + + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, svuid); if (fv != null) { fv.visitEnd(); } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java Fri Nov 14 10:03:24 2014 -0800 @@ -247,11 +247,13 @@ an.accept(av.visitAnnotation(name, an.desc)); } else if (value instanceof List) { AnnotationVisitor v = av.visitArray(name); - List array = (List) value; - for (int j = 0; j < array.size(); ++j) { - accept(v, null, array.get(j)); + if (v != null) { + List array = (List) value; + for (int j = 0; j < array.size(); ++j) { + accept(v, null, array.get(j)); + } + v.visitEnd(); } - v.visitEnd(); } else { av.visit(name, value); } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java Fri Nov 14 10:03:24 2014 -0800 @@ -110,7 +110,7 @@ : labels.length); if (keys != null) { for (int i = 0; i < keys.length; ++i) { - this.keys.add(new Integer(keys[i])); + this.keys.add(keys[i]); } } if (labels != null) { diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java Fri Nov 14 10:03:24 2014 -0800 @@ -160,6 +160,7 @@ @Override public void accept(final MethodVisitor mv) { mv.visitMethodInsn(opcode, owner, name, desc, itf); + acceptAnnotations(mv); } @Override diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java Fri Nov 14 10:03:24 2014 -0800 @@ -802,7 +802,7 @@ if (labels.get(label) != null) { throw new IllegalArgumentException("Already visited label"); } - labels.put(label, new Integer(insnCount)); + labels.put(label, insnCount); super.visitLabel(label); } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java --- a/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java Fri Nov 14 10:03:24 2014 -0800 @@ -732,7 +732,7 @@ Textifier t = createTextifier(); text.add(t.getText()); text.add(visible ? ") // parameter " : ") // invisible, parameter "); - text.add(new Integer(parameter)); + text.add(parameter); text.add("\n"); return t; } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/internal/org/objectweb/asm/version.txt --- a/src/share/classes/jdk/internal/org/objectweb/asm/version.txt Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/internal/org/objectweb/asm/version.txt Fri Nov 14 10:03:24 2014 -0800 @@ -1,12 +1,12 @@ Path: . -Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-06-19 +Working Copy Root Path: /hudson/jobs/objectweb-init/workspace/asm-svn-2014-10-15 URL: file:///svnroot/asm/trunk/asm Repository Root: file:///svnroot/asm Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9 -Revision: 1750 +Revision: 1772 Node Kind: directory Schedule: normal -Last Changed Author: forax -Last Changed Rev: 1750 -Last Changed Date: 2014-06-06 00:31:02 +0200 (Fri, 06 Jun 2014) +Last Changed Author: ebruneton +Last Changed Rev: 1772 +Last Changed Date: 2014-09-06 09:13:07 +0200 (Sat, 06 Sep 2014) diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/jdk/net/Sockets.java --- a/src/share/classes/jdk/net/Sockets.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/jdk/net/Sockets.java Fri Nov 14 10:03:24 2014 -0800 @@ -371,6 +371,7 @@ set = new HashSet<>(); set.add(StandardSocketOptions.SO_RCVBUF); set.add(StandardSocketOptions.SO_REUSEADDR); + set.add(StandardSocketOptions.IP_TOS); set = Collections.unmodifiableSet(set); options.put(ServerSocket.class, set); diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/invoke/util/Wrapper.java --- a/src/share/classes/sun/invoke/util/Wrapper.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/invoke/util/Wrapper.java Fri Nov 14 10:03:24 2014 -0800 @@ -26,19 +26,19 @@ package sun.invoke.util; public enum Wrapper { - BOOLEAN(Boolean.class, boolean.class, 'Z', (Boolean)false, new boolean[0], Format.unsigned(1)), + // wrapperType primitiveType char zero emptyArray format + BOOLEAN( Boolean.class, boolean.class, 'Z', (Boolean)false, new boolean[0], Format.unsigned( 1)), // These must be in the order defined for widening primitive conversions in JLS 5.1.2 - BYTE(Byte.class, byte.class, 'B', (Byte)(byte)0, new byte[0], Format.signed(8)), - SHORT(Short.class, short.class, 'S', (Short)(short)0, new short[0], Format.signed(16)), - CHAR(Character.class, char.class, 'C', (Character)(char)0, new char[0], Format.unsigned(16)), - INT(Integer.class, int.class, 'I', (Integer)/*(int)*/0, new int[0], Format.signed(32)), - LONG(Long.class, long.class, 'J', (Long)(long)0, new long[0], Format.signed(64)), - FLOAT(Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)), - DOUBLE(Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)), - //NULL(Null.class, null.class, 'N', null, null, Format.other(1)), - OBJECT(Object.class, Object.class, 'L', null, new Object[0], Format.other(1)), + BYTE ( Byte.class, byte.class, 'B', (Byte)(byte)0, new byte[0], Format.signed( 8)), + SHORT ( Short.class, short.class, 'S', (Short)(short)0, new short[0], Format.signed( 16)), + CHAR (Character.class, char.class, 'C', (Character)(char)0, new char[0], Format.unsigned(16)), + INT ( Integer.class, int.class, 'I', (Integer)/*(int)*/0, new int[0], Format.signed( 32)), + LONG ( Long.class, long.class, 'J', (Long)(long)0, new long[0], Format.signed( 64)), + FLOAT ( Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)), + DOUBLE ( Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)), + OBJECT ( Object.class, Object.class, 'L', null, new Object[0], Format.other( 1)), // VOID must be the last type, since it is "assignable" from any other type: - VOID(Void.class, void.class, 'V', null, null, Format.other(0)), + VOID ( Void.class, void.class, 'V', null, null, Format.other( 0)), ; private final Class wrapperType; diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/nio/fs/AbstractPoller.java --- a/src/share/classes/sun/nio/fs/AbstractPoller.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/nio/fs/AbstractPoller.java Fri Nov 14 10:03:24 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,8 +100,6 @@ // validate arguments before request to poller if (dir == null) throw new NullPointerException(); - if (events.length == 0) - throw new IllegalArgumentException("No events to register"); Set> eventSet = new HashSet<>(events.length); for (WatchEvent.Kind event: events) { // standard events @@ -114,17 +112,16 @@ } // OVERFLOW is ignored - if (event == StandardWatchEventKinds.OVERFLOW) { - if (events.length == 1) - throw new IllegalArgumentException("No events to register"); + if (event == StandardWatchEventKinds.OVERFLOW) continue; - } // null/unsupported if (event == null) throw new NullPointerException("An element in event set is 'null'"); throw new UnsupportedOperationException(event.name()); } + if (eventSet.isEmpty()) + throw new IllegalArgumentException("No events to register"); return (WatchKey)invoke(RequestType.REGISTER, dir, eventSet, modifiers); } @@ -192,14 +189,17 @@ * the request. */ Object awaitResult() { + boolean interrupted = false; synchronized (this) { while (!completed) { try { wait(); } catch (InterruptedException x) { - // ignore + interrupted = true; } } + if (interrupted) + Thread.currentThread().interrupt(); return result; } } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/nio/fs/PollingWatchService.java --- a/src/share/classes/sun/nio/fs/PollingWatchService.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/nio/fs/PollingWatchService.java Fri Nov 14 10:03:24 2014 -0800 @@ -74,8 +74,6 @@ throws IOException { // check events - CCE will be thrown if there are invalid elements - if (events.length == 0) - throw new IllegalArgumentException("No events to register"); final Set> eventSet = new HashSet>(events.length); for (WatchEvent.Kind event: events) { @@ -90,8 +88,6 @@ // OVERFLOW is ignored if (event == StandardWatchEventKinds.OVERFLOW) { - if (events.length == 1) - throw new IllegalArgumentException("No events to register"); continue; } @@ -100,6 +96,8 @@ throw new NullPointerException("An element in event set is 'null'"); throw new UnsupportedOperationException(event.name()); } + if (eventSet.isEmpty()) + throw new IllegalArgumentException("No events to register"); // A modifier may be used to specify the sensitivity level SensitivityWatchEventModifier sensivity = SensitivityWatchEventModifier.MEDIUM; diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java --- a/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java Fri Nov 14 10:03:24 2014 -0800 @@ -45,8 +45,8 @@ * core reflection (java.lang.reflect). */ public class CoreReflectionFactory implements GenericsFactory { - private GenericDeclaration decl; - private Scope scope; + private final GenericDeclaration decl; + private final Scope scope; private CoreReflectionFactory(GenericDeclaration d, Scope s) { decl = d; diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java --- a/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java Fri Nov 14 10:03:24 2014 -0800 @@ -40,7 +40,7 @@ * */ public abstract class LazyReflectiveObjectGenerator { - private GenericsFactory factory; // cached factory + private final GenericsFactory factory; // cached factory protected LazyReflectiveObjectGenerator(GenericsFactory f) { factory = f; diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/repository/AbstractRepository.java --- a/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java Fri Nov 14 10:03:24 2014 -0800 @@ -40,9 +40,9 @@ // A factory used to produce reflective objects. Provided when the //repository is created. Will vary across implementations. - private GenericsFactory factory; + private final GenericsFactory factory; - private T tree; // the AST for the generic type info + private final T tree; // the AST for the generic type info //accessors private GenericsFactory getFactory() { return factory;} diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/repository/ClassRepository.java --- a/src/share/classes/sun/reflect/generics/repository/ClassRepository.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/repository/ClassRepository.java Fri Nov 14 10:03:24 2014 -0800 @@ -42,8 +42,8 @@ public static final ClassRepository NONE = ClassRepository.make("Ljava/lang/Object;", null); - private Type superclass; // caches the generic superclass info - private Type[] superInterfaces; // caches the generic superinterface info + private volatile Type superclass; // caches the generic superclass info + private volatile Type[] superInterfaces; // caches the generic superinterface info // private, to enforce use of static factory private ClassRepository(String rawSig, GenericsFactory f) { @@ -80,17 +80,20 @@ */ public Type getSuperclass(){ + Type superclass = this.superclass; if (superclass == null) { // lazily initialize superclass Reifier r = getReifier(); // obtain visitor // Extract superclass subtree from AST and reify getTree().getSuperclass().accept(r); // extract result from visitor and cache it superclass = r.getResult(); + this.superclass = superclass; } return superclass; // return cached result } public Type[] getSuperInterfaces(){ + Type[] superInterfaces = this.superInterfaces; if (superInterfaces == null) { // lazily initialize super interfaces // first, extract super interface subtree(s) from AST TypeTree[] ts = getTree().getSuperInterfaces(); @@ -104,6 +107,7 @@ sis[i] = r.getResult(); } superInterfaces = sis; // cache overall result + this.superInterfaces = superInterfaces; } return superInterfaces.clone(); // return cached result } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java --- a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Fri Nov 14 10:03:24 2014 -0800 @@ -42,7 +42,7 @@ public abstract class GenericDeclRepository extends AbstractRepository { - private TypeVariable[] typeParams; // caches the formal type parameters + private volatile TypeVariable[] typeParams; // caches the formal type parameters protected GenericDeclRepository(String rawSig, GenericsFactory f) { super(rawSig, f); @@ -65,6 +65,7 @@ * @return the formal type parameters of this generic declaration */ public TypeVariable[] getTypeParameters(){ + TypeVariable[] typeParams = this.typeParams; if (typeParams == null) { // lazily initialize type parameters // first, extract type parameter subtree(s) from AST FormalTypeParameter[] ftps = getTree().getFormalTypeParameters(); @@ -78,6 +79,7 @@ tps[i] = (TypeVariable) r.getResult(); } typeParams = tps; // cache overall result + this.typeParams = typeParams; } return typeParams.clone(); // return cached result } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/scope/AbstractScope.java --- a/src/share/classes/sun/reflect/generics/scope/AbstractScope.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/scope/AbstractScope.java Fri Nov 14 10:03:24 2014 -0800 @@ -41,8 +41,8 @@ public abstract class AbstractScope implements Scope { - private D recvr; // the declaration whose scope this instance represents - private Scope enclosingScope; // the enclosing scope of this scope + private final D recvr; // the declaration whose scope this instance represents + private volatile Scope enclosingScope; // the enclosing scope of this scope /** * Constructor. Takes a reflective object whose scope the newly @@ -71,7 +71,11 @@ * @return the enclosing scope */ protected Scope getEnclosingScope(){ - if (enclosingScope == null) {enclosingScope = computeEnclosingScope();} + Scope enclosingScope = this.enclosingScope; + if (enclosingScope == null) { + enclosingScope = computeEnclosingScope(); + this.enclosingScope = enclosingScope; + } return enclosingScope; } diff -r f5ba1bbe180b -r 31dac938108d src/share/classes/sun/reflect/generics/tree/ClassSignature.java --- a/src/share/classes/sun/reflect/generics/tree/ClassSignature.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/classes/sun/reflect/generics/tree/ClassSignature.java Fri Nov 14 10:03:24 2014 -0800 @@ -28,9 +28,9 @@ import sun.reflect.generics.visitor.Visitor; public class ClassSignature implements Signature { - private FormalTypeParameter[] formalTypeParams; - private ClassTypeSignature superclass; - private ClassTypeSignature[] superInterfaces; + private final FormalTypeParameter[] formalTypeParams; + private final ClassTypeSignature superclass; + private final ClassTypeSignature[] superInterfaces; private ClassSignature(FormalTypeParameter[] ftps, ClassTypeSignature sc, diff -r f5ba1bbe180b -r 31dac938108d src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c --- a/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c Fri Nov 14 10:03:24 2014 -0800 @@ -220,3 +220,18 @@ (*env)->ReleaseByteArrayElements(env, data, pBytes, JNI_ABORT); return rc ? JNI_TRUE : JNI_FALSE; } + +/* + * Class: java_awt_SplashScreen + * Method: _getScaleFactor + * Signature: (J)F + */ +JNIEXPORT jfloat JNICALL Java_java_awt_SplashScreen__1getScaleFactor +(JNIEnv *env, jclass thisClass, jlong jsplash) +{ + Splash *splash = (Splash *) jlong_to_ptr(jsplash); + if (!splash) { + return 1; + } + return splash->scaleFactor; +} \ No newline at end of file diff -r f5ba1bbe180b -r 31dac938108d src/share/native/sun/awt/splashscreen/splashscreen_impl.c --- a/src/share/native/sun/awt/splashscreen/splashscreen_impl.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/native/sun/awt/splashscreen/splashscreen_impl.c Fri Nov 14 10:03:24 2014 -0800 @@ -59,6 +59,7 @@ memset(splash, 0, sizeof(Splash)); splash->currentFrame = -1; + splash->scaleFactor = 1; initFormat(&splash->imageFormat, QUAD_RED_MASK, QUAD_GREEN_MASK, QUAD_BLUE_MASK, QUAD_ALPHA_MASK); SplashInitPlatform(splash); @@ -101,6 +102,13 @@ SplashSetFileJarName(NULL, NULL); } +SPLASHEXPORT void +SplashSetScaleFactor(float scaleFactor) +{ + Splash *splash = SplashGetInstance(); + splash->scaleFactor = scaleFactor; +} + void SplashDone(Splash * splash) { diff -r f5ba1bbe180b -r 31dac938108d src/share/native/sun/awt/splashscreen/splashscreen_impl.h --- a/src/share/native/sun/awt/splashscreen/splashscreen_impl.h Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/native/sun/awt/splashscreen/splashscreen_impl.h Fri Nov 14 10:03:24 2014 -0800 @@ -35,6 +35,9 @@ SPLASHEXPORT void SplashInit(void); SPLASHEXPORT void SplashClose(void); +SPLASHEXPORT void SplashSetScaleFactor(float); +SPLASHEXPORT char* SplashGetScaledImageName(const char*, const char*, float*); + SPLASHEXPORT void SplashSetFileJarName(const char* fileName, const char* jarName); @@ -79,6 +82,7 @@ int fileNameLen; char* jarName; /* stored in 16-bit unicode (jchars) */ int jarNameLen; + float scaleFactor; #if defined(WITH_WIN32) BOOL isLayered; HWND hWnd; @@ -115,6 +119,8 @@ unsigned SplashTime(); char* SplashConvertStringAlloc(const char* in, int *size); +char* SplashGetScaledImageName(const char* jarName, + const char* fileName, float *scaleFactor); void SplashLock(Splash * splash); void SplashUnlock(Splash * splash); @@ -138,6 +144,7 @@ void SplashUpdateScreenData(Splash * splash); void SplashCleanup(Splash * splash); +void SplashSetScaleFactor(float scaleFactor); typedef struct SplashStream { diff -r f5ba1bbe180b -r 31dac938108d src/share/native/sun/security/ec/impl/mpi.c --- a/src/share/native/sun/security/ec/impl/mpi.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/native/sun/security/ec/impl/mpi.c Fri Nov 14 10:03:24 2014 -0800 @@ -3376,7 +3376,7 @@ #if !defined(MP_NO_MP_WORD) && !defined(MP_NO_DIV_WORD) mp_word w = 0, q; #else - mp_digit w, q; + mp_digit w = 0, q; #endif int ix; mp_err res; diff -r f5ba1bbe180b -r 31dac938108d src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c --- a/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c Fri Nov 14 10:03:24 2014 -0800 @@ -141,8 +141,8 @@ (CK_BYTE_PTR)(outBufP + jOutOfs), &ckEncryptedPartLen); - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT); (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); ckAssertReturnValueOK(env, rv); return ckEncryptedPartLen; @@ -214,7 +214,7 @@ } if (directOut == 0) { - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT); + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } ckAssertReturnValueOK(env, rv); @@ -266,7 +266,7 @@ //printf("EF: ckLastEncryptedPartLen=%i", ckLastEncryptedPartLen); if (directOut == 0) { - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT); + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } ckAssertReturnValueOK(env, rv); @@ -361,8 +361,8 @@ (CK_BYTE_PTR)(outBufP + jOutOfs), &ckPartLen); - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT); (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); ckAssertReturnValueOK(env, rv); @@ -429,7 +429,7 @@ } if (directOut == 0) { - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT); + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } ckAssertReturnValueOK(env, rv); @@ -478,7 +478,7 @@ &ckLastPartLen); if (directOut == 0) { - (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_ABORT); + (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT); } diff -r f5ba1bbe180b -r 31dac938108d src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c --- a/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Fri Nov 14 10:03:24 2014 -0800 @@ -794,3 +794,11 @@ SplashReconfigure(Splash * splash) { sendctl(splash, SPLASHCTL_RECONFIGURE); } + +SPLASHEXPORT char* +SplashGetScaledImageName(const char* jarName, const char* fileName, + float *scaleFactor) +{ + *scaleFactor = 1; + return NULL; +} diff -r f5ba1bbe180b -r 31dac938108d src/solaris/native/sun/nio/ch/FileDispatcherImpl.c --- a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c Fri Nov 14 10:03:24 2014 -0800 @@ -34,6 +34,10 @@ #include #include #include +#if defined(__linux__) +#include +#include +#endif #include "nio.h" #include "nio_util.h" @@ -177,10 +181,21 @@ JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileDispatcherImpl_size0(JNIEnv *env, jobject this, jobject fdo) { + jint fd = fdval(env, fdo); struct stat64 fbuf; - if (fstat64(fdval(env, fdo), &fbuf) < 0) + if (fstat64(fd, &fbuf) < 0) return handle(env, -1, "Size failed"); + +#ifdef BLKGETSIZE64 + if (S_ISBLK(fbuf.st_mode)) { + uint64_t size; + if (ioctl(fd, BLKGETSIZE64, &size) < 0) + return handle(env, -1, "Size failed"); + return (jlong)size; + } +#endif + return fbuf.st_size; } diff -r f5ba1bbe180b -r 31dac938108d src/windows/classes/sun/awt/windows/WPathGraphics.java --- a/src/windows/classes/sun/awt/windows/WPathGraphics.java Wed Nov 12 13:47:21 2014 -0800 +++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java Fri Nov 14 10:03:24 2014 -0800 @@ -1400,7 +1400,9 @@ * The saved device transform is needed as the current transform * is not likely to be the same. */ - deviceClip(savedClip.getPathIterator(savedTransform)); + if (savedClip != null) { + deviceClip(savedClip.getPathIterator(savedTransform)); + } /* Scale the bounding rectangle by the scale transform. * Because the scaling transform has only x and y diff -r f5ba1bbe180b -r 31dac938108d src/windows/native/sun/awt/splashscreen/splashscreen_sys.c --- a/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c Wed Nov 12 13:47:21 2014 -0800 +++ b/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c Fri Nov 14 10:03:24 2014 -0800 @@ -568,3 +568,11 @@ { PostMessage(splash->hWnd, WM_SPLASHRECONFIGURE, 0, 0); } + +SPLASHEXPORT char* +SplashGetScaledImageName(const char* jarName, const char* fileName, + float *scaleFactor) +{ + *scaleFactor = 1; + return NULL; +} diff -r f5ba1bbe180b -r 31dac938108d src/windows/native/sun/java2d/d3d/D3DBadHardware.h --- a/src/windows/native/sun/java2d/d3d/D3DBadHardware.h Wed Nov 12 13:47:21 2014 -0800 +++ b/src/windows/native/sun/java2d/d3d/D3DBadHardware.h Fri Nov 14 10:03:24 2014 -0800 @@ -51,131 +51,8 @@ static const ADAPTER_INFO badHardware[] = { - // Intel HD - // Clarkdale (Desktop) GMA HD Lines - { 0x8086, 0x0042, NO_VERSION, OS_ALL }, - // Arrandale (Mobile) GMA HD Lines - { 0x8086, 0x0046, NO_VERSION, OS_ALL }, - - // Sandy Bridge HD Graphics 3000/2000 - { 0x8086, 0x0102, NO_VERSION, OS_ALL }, - { 0x8086, 0x0106, NO_VERSION, OS_ALL }, - { 0x8086, 0x0112, NO_VERSION, OS_ALL }, - { 0x8086, 0x0116, NO_VERSION, OS_ALL }, - { 0x8086, 0x0122, NO_VERSION, OS_ALL }, - { 0x8086, 0x0126, NO_VERSION, OS_ALL }, - { 0x8086, 0x010A, NO_VERSION, OS_ALL }, - - // Ivy Bridge - { 0x8086, 0x0162, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0162, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0166, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0166, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x016A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x016A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0152, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0152, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0156, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0156, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x015A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x015A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - - // Haswell - { 0x8086, 0x0402, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0402, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0406, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0406, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0412, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0412, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0416, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0416, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x041E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x041E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x040A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x040A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x041A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x041A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0A06, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0A06, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0A16, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0A16, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0A26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0A26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0A2E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0A2E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0A1E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0A1E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0A0E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0A0E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0D26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0D26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0D22, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0D22, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, - - // Reason: workaround for 6620073, 6612195 - // Intel 740 - { 0x8086, 0x7800, NO_VERSION, OS_ALL }, - { 0x8086, 0x1240, NO_VERSION, OS_ALL }, - { 0x8086, 0x7121, NO_VERSION, OS_ALL }, - { 0x8086, 0x7123, NO_VERSION, OS_ALL }, - { 0x8086, 0x7125, NO_VERSION, OS_ALL }, - { 0x8086, 0x1132, NO_VERSION, OS_ALL }, - // IEG - { 0x8086, 0x2562, NO_VERSION, OS_ALL }, - { 0x8086, 0x3577, NO_VERSION, OS_ALL }, - { 0x8086, 0x2572, NO_VERSION, OS_ALL }, - { 0x8086, 0x3582, NO_VERSION, OS_ALL }, - { 0x8086, 0x358E, NO_VERSION, OS_ALL }, - // GMA - { 0x8086, 0x2582, NO_VERSION, OS_ALL }, - { 0x8086, 0x2782, NO_VERSION, OS_ALL }, - { 0x8086, 0x2592, NO_VERSION, OS_ALL }, - { 0x8086, 0x2792, NO_VERSION, OS_ALL }, - { 0x8086, 0x2772, NO_VERSION, OS_ALL }, - { 0x8086, 0x2776, NO_VERSION, OS_ALL }, - { 0x8086, 0x27A2, NO_VERSION, OS_ALL }, - { 0x8086, 0x27A6, NO_VERSION, OS_ALL }, - { 0x8086, 0x27AE, NO_VERSION, OS_ALL }, - { 0x8086, 0x29D2, NO_VERSION, OS_ALL }, - { 0x8086, 0x29D3, NO_VERSION, OS_ALL }, - { 0x8086, 0x29B2, NO_VERSION, OS_ALL }, - { 0x8086, 0x29B3, NO_VERSION, OS_ALL }, - { 0x8086, 0x29C2, NO_VERSION, OS_ALL }, - { 0x8086, 0x29C3, NO_VERSION, OS_ALL }, - { 0x8086, 0xA001, NO_VERSION, OS_ALL }, - { 0x8086, 0xA002, NO_VERSION, OS_ALL }, - { 0x8086, 0xA011, NO_VERSION, OS_ALL }, - { 0x8086, 0xA012, NO_VERSION, OS_ALL }, - // GMA - { 0x8086, 0x2972, NO_VERSION, OS_ALL }, - { 0x8086, 0x2973, NO_VERSION, OS_ALL }, - { 0x8086, 0x2992, NO_VERSION, OS_ALL }, - { 0x8086, 0x2993, NO_VERSION, OS_ALL }, - { 0x8086, 0x29A2, NO_VERSION, OS_ALL }, - { 0x8086, 0x29A3, NO_VERSION, OS_ALL }, - { 0x8086, 0x2982, NO_VERSION, OS_ALL }, - { 0x8086, 0x2983, NO_VERSION, OS_ALL }, - { 0x8086, 0x2A02, NO_VERSION, OS_ALL }, - { 0x8086, 0x2A03, NO_VERSION, OS_ALL }, - { 0x8086, 0x2A12, NO_VERSION, OS_ALL }, - { 0x8086, 0x2A13, NO_VERSION, OS_ALL }, - - // Eaglelake (Desktop) GMA 4500 Lines - { 0x8086, 0x2E42, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E43, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E92, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E93, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E12, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E13, NO_VERSION, OS_ALL }, - // Eaglelake (Desktop) GMA X4500 Lines - { 0x8086, 0x2E32, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E33, NO_VERSION, OS_ALL }, - { 0x8086, 0x2E22, NO_VERSION, OS_ALL }, - // Eaglelake (Desktop) GMA X4500HD Lines - { 0x8086, 0x2E23, NO_VERSION, OS_ALL }, - // Cantiga (Mobile) GMA 4500MHD Lines - { 0x8086, 0x2A42, NO_VERSION, OS_ALL }, - { 0x8086, 0x2A43, NO_VERSION, OS_ALL }, + // All Intel Chips. + { 0x8086, ALL_DEVICEIDS, NO_VERSION, OS_ALL }, // ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350 // Reason: workaround for 6613066, 6687166 diff -r f5ba1bbe180b -r 31dac938108d test/com/sun/jndi/ldap/LdapTimeoutTest.java --- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java Wed Nov 12 13:47:21 2014 -0800 +++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri Nov 14 10:03:24 2014 -0800 @@ -46,8 +46,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS; public class LdapTimeoutTest { - private static final ScheduledExecutorService pool = - Executors.newScheduledThreadPool(1); + static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} @@ -80,7 +79,6 @@ new LdapTimeoutTest().simpleAuthConnectTest(env); } finally { s.interrupt(); - LdapTimeoutTest.pool.shutdown(); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); @@ -90,7 +88,6 @@ void ldapReadTimeoutTest(Hashtable env, boolean ssl) { InitialContext ctx = null; if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl"); - ScheduledFuture killer = killSwitch(5_000); long start = System.nanoTime(); try { ctx = new InitialDirContext(env); @@ -112,13 +109,12 @@ pass(); } } finally { - if (!shutItDown(killer, ctx)) fail(); + if (!shutItDown(ctx)) fail(); } } void simpleAuthConnectTest(Hashtable env) { InitialContext ctx = null; - ScheduledFuture killer = killSwitch(5_000); long start = System.nanoTime(); try { ctx = new InitialDirContext(env); @@ -141,13 +137,12 @@ fail(); } } finally { - if (!shutItDown(killer, ctx)) fail(); + if (!shutItDown(ctx)) fail(); } } void deadServerNoTimeout(Hashtable env) { InitialContext ctx = null; - ScheduledFuture killer = killSwitch(30_000); long start = System.currentTimeMillis(); try { ctx = new InitialDirContext(env); @@ -169,12 +164,11 @@ pass(); } } finally { - if (!shutItDown(killer, ctx)) fail(); + if (!shutItDown(ctx)) fail(); } } - boolean shutItDown(ScheduledFuture killer, InitialContext ctx) { - killer.cancel(true); + boolean shutItDown(InitialContext ctx) { try { if (ctx != null) ctx.close(); return true; @@ -183,17 +177,6 @@ } } - ScheduledFuture killSwitch(int ms) { - final Thread current = Thread.currentThread(); - return LdapTimeoutTest.pool.schedule(new Callable() { - public Void call() throws Exception { - System.err.println("Fail: killSwitch()"); - System.exit(0); - return null; - } - }, ms, MILLISECONDS); - } - static class Server extends Thread { final ServerSocket serverSock; diff -r f5ba1bbe180b -r 31dac938108d test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,21 @@ + + + +DisposeStressTest + + + +

DisposeStressTest
Bug ID: 4051487, 4145670

+ +

This is an AUTOMATIC test, simply wait for completion

+ + + + diff -r f5ba1bbe180b -r 31dac938108d test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + test + @bug 4051487 4145670 8062021 + @summary Tests that disposing of an empty Frame or a Frame with a MenuBar + while it is being created does not crash the VM. + @author dpm area=Threads + @run applet/timeout=7200 DisposeStressTest.html +*/ + +// Note there is no @ in front of test above. This is so that the +// harness will not mistake this file as a test file. It should +// only see the html file as a test file. (the harness runs all +// valid test files, so it would run this test twice if this file +// were valid as well as the html file.) +// Also, note the area= after Your Name in the author tag. Here, you +// should put which functional area the test falls in. See the +// AWT-core home page -> test areas and/or -> AWT team for a list of +// areas. +// Note also the 'DisposeStressTest.html' in the run tag. This should +// be changed to the name of the test. + + +/** + * DisposeStressTest.java + * + * summary: + */ + +import java.applet.Applet; +import java.awt.*; + + +//Automated tests should run as applet tests if possible because they +// get their environments cleaned up, including AWT threads, any +// test created threads, and any system resources used by the test +// such as file descriptors. (This is normally not a problem as +// main tests usually run in a separate VM, however on some platforms +// such as the Mac, separate VMs are not possible and non-applet +// tests will cause problems). Also, you don't have to worry about +// synchronisation stuff in Applet tests they way you do in main +// tests... + + +public class DisposeStressTest extends Applet + { + //Declare things used in the test, like buttons and labels here + + public void init() + { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + + this.setLayout (new BorderLayout ()); + + String[] instructions = + { + "This is an AUTOMATIC test", + "simply wait until it is done" + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + + }//End init() + + public void start () + { + for (int i = 0; i < 1000; i++) { + Frame f = new Frame(); + f.setBounds(10, 10, 10, 10); + f.show(); + f.dispose(); + + Frame f2 = new Frame(); + f2.setBounds(10, 10, 100, 100); + MenuBar bar = new MenuBar(); + Menu menu = new Menu(); + menu.add(new MenuItem("foo")); + bar.add(menu); + f2.setMenuBar(bar); + f2.show(); + f2.dispose(); + } + }// start() + + }// class DisposeStressTest + + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout + { + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } + + }// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog + { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("South", messageText); + + pack(); + + show(); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + } + + }// TestDialog class diff -r f5ba1bbe180b -r 31dac938108d test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.SplashScreen; +import java.awt.Window; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; +import sun.java2d.SunGraphics2D; + +/** + * @test + * @bug 8043869 + * @author Alexander Scherbatiy + * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina + * support + * @run main MultiResolutionSplashTest GENERATE_IMAGES + * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0 + * @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1 + * @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2 + */ +public class MultiResolutionSplashTest { + + private static final int IMAGE_WIDTH = 300; + private static final int IMAGE_HEIGHT = 200; + + private static final ImageInfo[] tests = { + new ImageInfo("splash1.png", "splash1@2x.png", Color.BLUE, Color.GREEN), + new ImageInfo("splash2", "splash2@2x", Color.WHITE, Color.BLACK), + new ImageInfo("splash3.", "splash3@2x.", Color.YELLOW, Color.RED) + }; + + public static void main(String[] args) throws Exception { + + String test = args[0]; + + switch (test) { + case "GENERATE_IMAGES": + generateImages(); + break; + case "TEST_SPLASH": + int index = Integer.parseInt(args[1]); + testSplash(tests[index]); + break; + default: + throw new RuntimeException("Unknown test: " + test); + } + } + + static void testSplash(ImageInfo test) throws Exception { + SplashScreen splashScreen = SplashScreen.getSplashScreen(); + + if (splashScreen == null) { + throw new RuntimeException("Splash screen is not shown!"); + } + + Graphics2D g = splashScreen.createGraphics(); + Rectangle splashBounds = splashScreen.getBounds(); + int screenX = (int) splashBounds.getCenterX(); + int screenY = (int) splashBounds.getCenterY(); + + Robot robot = new Robot(); + Color splashScreenColor = robot.getPixelColor(screenX, screenY); + + float scaleFactor = getScaleFactor(); + Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x; + + if (!testColor.equals(splashScreenColor)) { + throw new RuntimeException( + "Image with wrong resolution is used for splash screen!"); + } + } + + static float getScaleFactor() { + + final Dialog dialog = new Dialog((Window) null); + dialog.setSize(100, 100); + dialog.setModal(true); + final float[] scaleFactors = new float[1]; + Panel panel = new Panel() { + + @Override + public void paint(Graphics g) { + float scaleFactor = 1; + if (g instanceof SunGraphics2D) { + scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale(); + } + scaleFactors[0] = scaleFactor; + dialog.setVisible(false); + } + }; + + dialog.add(panel); + dialog.setVisible(true); + dialog.dispose(); + + return scaleFactors[0]; + } + + static void generateImages() throws Exception { + for (ImageInfo test : tests) { + generateImage(test.name1x, test.color1x, 1); + generateImage(test.name2x, test.color2x, 2); + } + } + + static void generateImage(String name, Color color, int scale) throws Exception { + File file = new File(name); + if (file.exists()) { + return; + } + BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT, + BufferedImage.TYPE_INT_RGB); + Graphics g = image.getGraphics(); + g.setColor(color); + g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT); + ImageIO.write(image, "png", file); + } + + static class ImageInfo { + + final String name1x; + final String name2x; + final Color color1x; + final Color color2x; + + public ImageInfo(String name1x, String name2x, Color color1x, Color color2x) { + this.name1x = name1x; + this.name2x = name2x; + this.color1x = color1x; + this.color2x = color2x; + } + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Window; + +/** + * @test + * @bug 8064468 + * @author Alexander Scherbatiy + * @summary ownedWindowList access requires synchronization in + * Window.setAlwaysOnTop() method + * @run main SyncAlwaysOnTopFieldTest + */ +public class SyncAlwaysOnTopFieldTest { + + private static final int WINDOWS_COUNT = 200; + private static final int STEPS_COUNT = 20; + + public static void main(String[] args) throws Exception { + final Window rootWindow = createWindow(null); + + new Thread(() -> { + for (int i = 0; i < WINDOWS_COUNT; i++) { + createWindow(rootWindow); + } + }).start(); + + boolean alwaysOnTop = true; + for (int i = 0; i < STEPS_COUNT; i++) { + Thread.sleep(10); + rootWindow.setAlwaysOnTop(alwaysOnTop); + alwaysOnTop = !alwaysOnTop; + } + } + + private static Window createWindow(Window parent) { + Window window = new Window(parent); + window.setSize(200, 200); + window.setVisible(true); + return window; + } +} \ No newline at end of file diff -r f5ba1bbe180b -r 31dac938108d test/java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8061392 + * @summary Test no NPE when printing transparency with null clip. + */ + +import java.awt.*; +import java.awt.image.*; +import java.awt.print.*; + +public class NullClipARGB implements Printable { + + public static void main( String[] args ) { + + try { + PrinterJob pj = PrinterJob.getPrinterJob(); + pj.setPrintable(new NullClipARGB()); + pj.print(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public int print(Graphics g, PageFormat pf, int pageIndex) + throws PrinterException{ + + if (pageIndex != 0) { + return NO_SUCH_PAGE; + } + Graphics2D g2 = (Graphics2D)g; + System.out.println("original clip="+g2.getClip()); + g2.translate(pf.getImageableX(), pf.getImageableY()); + g2.rotate(0.2); + g2.setClip(null); + g2.setColor( Color.BLACK ); + g2.drawString("This text should be visible through the image", 0, 20); + BufferedImage bi = new BufferedImage(100, 100, + BufferedImage.TYPE_INT_ARGB ); + Graphics ig = bi.createGraphics(); + ig.setColor( new Color( 192, 192, 192, 80 ) ); + ig.fillRect( 0, 0, 100, 100 ); + ig.setColor( Color.BLACK ); + ig.drawRect( 0, 0, 99, 99 ); + ig.dispose(); + g2.drawImage(bi, 10, 0, 90, 90, null ); + g2.translate(100, 100); + g2.drawString("This text should also be visible through the image", 0, 20); + g2.drawImage(bi, 10, 0, 90, 90, null ); + return PAGE_EXISTS; + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/io/SequenceInputStream/LotsOfStreams.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/io/SequenceInputStream/LotsOfStreams.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 7011804 + * @summary SequenceInputStream#read() was implemented recursivly, + * which may cause stack overflow + */ + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.util.Enumeration; + +public class LotsOfStreams { + + static final int MAX_SUBSTREAMS = 32000; + + public static void main(String[] argv) throws Exception { + try (InputStream stream = + new SequenceInputStream(new LOSEnumeration())) { + stream.read(); + } + try (InputStream stream = + new SequenceInputStream(new LOSEnumeration())) { + byte[] b = new byte[1]; + stream.read(b, 0, 1); + } + } + + static class LOSEnumeration + implements Enumeration { + + private static InputStream inputStream = + new ByteArrayInputStream(new byte[0]); + private int left = MAX_SUBSTREAMS; + + public boolean hasMoreElements() { + return (left > 0); + } + public InputStream nextElement() { + left--; + return inputStream; + } + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/lang/invoke/ExplicitCastArgumentsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/invoke/ExplicitCastArgumentsTest.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.invoke; + +import sun.invoke.util.Wrapper; + +/* @test + * @summary unit tests for MethodHandles.explicitCastArguments() + * + * @run main/bootclasspath java.lang.invoke.ExplicitCastArgumentsTest + */ +public class ExplicitCastArgumentsTest { + private static final boolean VERBOSE = Boolean.getBoolean("verbose"); + + public static void main(String[] args) throws Throwable { + for (Wrapper from : Wrapper.values()) { + for (Wrapper to : Wrapper.values()) { + if (from == Wrapper.VOID || to == Wrapper.VOID) continue; + testRef2Prim (from, to); + } + } + System.out.println("TEST PASSED"); + } + + public static void testRef2Prim(Wrapper from, Wrapper to) throws Throwable { + // MHs.eCA javadoc: + // If T0 is a reference and T1 a primitive, and if the reference is null at runtime, a zero value is introduced. + test(from.wrapperType(), to.primitiveType(), null, false); + } + + public static void test(Class from, Class to, Object param, boolean failureExpected) throws Throwable { + if (VERBOSE) System.out.printf("%-10s => %-10s: %5s: ", from.getSimpleName(), to.getSimpleName(), param); + + MethodHandle original = MethodHandles.identity(from); + MethodType newType = original.type().changeReturnType(to); + + try { + MethodHandle target = MethodHandles.explicitCastArguments(original, newType); + Object result = target.invokeWithArguments(param); + + if (VERBOSE) { + String resultStr; + if (result != null) { + resultStr = String.format("%10s (%10s)", "'"+result+"'", result.getClass().getSimpleName()); + } else { + resultStr = String.format("%10s", result); + } + System.out.println(resultStr); + } + + if (failureExpected) { + String msg = String.format("No exception thrown: %s => %s; parameter: %s", from, to, param); + throw new AssertionError(msg); + } + } catch (AssertionError e) { + throw e; // report test failure + } catch (Throwable e) { + if (VERBOSE) System.out.printf("%s: %s\n", e.getClass(), e.getMessage()); + if (!failureExpected) { + String msg = String.format("Unexpected exception was thrown: %s => %s; parameter: %s", from, to, param); + throw new AssertionError(msg, e); + } + } + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/lang/ref/EarlyTimeout.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/ref/EarlyTimeout.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 6853696 + * @summary ReferenceQueue#remove(timeout) should not return null before + * timeout is elapsed + */ + +import java.lang.InterruptedException; +import java.lang.System; +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.util.concurrent.CountDownLatch; +import static java.util.concurrent.TimeUnit.NANOSECONDS; + +/** + * In order to demonstrate the issue we make several threads (two appears to be sufficient) + * to block in ReferenceQueue#remove(timeout) at the same time. + * Then, we force a reference to be enqueued by setting its referent to null and calling System.gc(). + * One of the threads gets the reference returned from the remove(). + * The other threads get null: + * 1) with bug: this may happen before the specified timeout is elapsed, + * 2) without bug: this can only happen after the timeout is fully elapsed. + */ + +public class EarlyTimeout extends Thread { + + static final int THREADS_COUNT = 2; + static final int TIMEOUT = 1000; + + static Object referent = new Object(); + static final ReferenceQueue queue = new ReferenceQueue(); + static final WeakReference weakReference = new WeakReference(referent, queue); + static final CountDownLatch startedSignal = new CountDownLatch(THREADS_COUNT); + + long actual; + Reference reference; + + public static void main(String[] args) throws Exception { + EarlyTimeout[] threads = new EarlyTimeout[THREADS_COUNT]; + for (int i = 0; i < THREADS_COUNT; ++i) { + threads[i] = new EarlyTimeout(); + threads[i].start(); + } + // The main thread waits until the threads has started and give it a chance + // for the threads to block on the queue.remove(TIMEOUT) call + startedSignal.await(); + Thread.sleep(TIMEOUT / 2); + referent = null; + System.gc(); + for (EarlyTimeout thread : threads) { + thread.join(); + } + if (weakReference.get() != null) { + throw new RuntimeException("weakReference was not cleared"); + } + int nonNullRefCount = 0; + for (EarlyTimeout thread : threads) { + if (thread.reference == null && thread.actual < TIMEOUT) { + throw new RuntimeException("elapsed time " + thread.actual + + " is less than timeout " + TIMEOUT); + } + if (thread.reference != null && thread.reference == weakReference) { + nonNullRefCount++; + } + } + if (nonNullRefCount > 1) { + throw new RuntimeException("more than one references were removed from queue"); + } + } + + public void run() { + try { + startedSignal.countDown(); + long start = System.nanoTime(); + reference = queue.remove(TIMEOUT); + actual = NANOSECONDS.toMillis(System.nanoTime() - start); + } catch (InterruptedException ex) { + throw new RuntimeException(ex); + } + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/nio/channels/FileChannel/BlockDeviceSize.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/nio/channels/FileChannel/BlockDeviceSize.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 8054029 + * @summary Block devices should not report size=0 on Linux + */ + +import java.io.RandomAccessFile; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.channels.FileChannel; +import java.nio.file.AccessDeniedException; +import java.nio.file.NoSuchFileException; +import static java.nio.file.StandardOpenOption.*; + + +public class BlockDeviceSize { + private static final String BLK_FNAME = "/dev/sda1"; + private static final Path BLK_PATH = Paths.get(BLK_FNAME); + + public static void main(String[] args) throws Throwable { + try (FileChannel ch = FileChannel.open(BLK_PATH, READ); + RandomAccessFile file = new RandomAccessFile(BLK_FNAME, "r")) { + + long size1 = ch.size(); + long size2 = file.length(); + if (size1 != size2) { + throw new RuntimeException("size differs when retrieved" + + " in different ways: " + size1 + " != " + size2); + } + System.out.println("OK"); + + } catch (NoSuchFileException nsfe) { + System.err.println("File " + BLK_FNAME + " not found." + + " Skipping test"); + } catch (AccessDeniedException ade) { + System.err.println("Access to " + BLK_FNAME + " is denied." + + " Run test as root."); + } + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/nio/file/WatchService/Basic.java --- a/test/java/nio/file/WatchService/Basic.java Wed Nov 12 13:47:21 2014 -0800 +++ b/test/java/nio/file/WatchService/Basic.java Fri Nov 14 10:03:24 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6838333 7017446 + * @bug 4313887 6838333 7017446 8011537 8042470 * @summary Unit test for java.nio.file.WatchService * @library .. * @run main Basic @@ -295,24 +295,31 @@ // IllegalArgumentException System.out.println("IllegalArgumentException tests..."); try { - dir.register(watcher, new WatchEvent.Kind[]{ } ); + dir.register(watcher /*empty event list*/); throw new RuntimeException("IllegalArgumentException not thrown"); } catch (IllegalArgumentException x) { } try { // OVERFLOW is ignored so this is equivalent to the empty set - dir.register(watcher, new WatchEvent.Kind[]{ OVERFLOW }); + dir.register(watcher, OVERFLOW); + throw new RuntimeException("IllegalArgumentException not thrown"); + } catch (IllegalArgumentException x) { + } + try { + // OVERFLOW is ignored even if specified multiple times + dir.register(watcher, OVERFLOW, OVERFLOW); throw new RuntimeException("IllegalArgumentException not thrown"); } catch (IllegalArgumentException x) { } // UnsupportedOperationException try { - dir.register(watcher, new WatchEvent.Kind[]{ + dir.register(watcher, new WatchEvent.Kind() { @Override public String name() { return "custom"; } @Override public Class type() { return Object.class; } - }}); + }); + throw new RuntimeException("UnsupportedOperationException not thrown"); } catch (UnsupportedOperationException x) { } try { @@ -328,7 +335,7 @@ // NullPointerException System.out.println("NullPointerException tests..."); try { - dir.register(null, new WatchEvent.Kind[]{ ENTRY_CREATE }); + dir.register(null, ENTRY_CREATE); throw new RuntimeException("NullPointerException not thrown"); } catch (NullPointerException x) { } @@ -380,7 +387,7 @@ try { dir.register(watcher, new WatchEvent.Kind[]{ ENTRY_CREATE }); - throw new RuntimeException("ClosedWatchServiceException not thrown"); + throw new RuntimeException("ClosedWatchServiceException not thrown"); } catch (ClosedWatchServiceException x) { } @@ -468,6 +475,28 @@ } } + /** + * Test that thread interruped status is preserved upon a call + * to register() + */ + static void testThreadInterrupt(Path dir) throws IOException { + System.out.println("-- Thread interrupted status test --"); + + FileSystem fs = FileSystems.getDefault(); + Thread curr = Thread.currentThread(); + try (WatchService watcher = fs.newWatchService()) { + System.out.println("interrupting current thread"); + curr.interrupt(); + dir.register(watcher, ENTRY_CREATE); + if (!curr.isInterrupted()) + throw new RuntimeException("thread should remain interrupted"); + System.out.println("current thread is still interrupted"); + System.out.println("OKAY"); + } finally { + curr.interrupted(); + } + } + public static void main(String[] args) throws IOException { Path dir = TestUtil.createTemporaryDirectory(); try { @@ -478,6 +507,7 @@ testWakeup(dir); testExceptions(dir); testTwoWatchers(dir); + testThreadInterrupt(dir); } finally { TestUtil.removeAll(dir); diff -r f5ba1bbe180b -r 31dac938108d test/java/util/BitSet/BSMethods.java --- a/test/java/util/BitSet/BSMethods.java Wed Nov 12 13:47:21 2014 -0800 +++ b/test/java/util/BitSet/BSMethods.java Fri Nov 14 10:03:24 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,10 @@ /* @test * @bug 4098239 4107540 4080736 4261102 4274710 4305272 - * 4979017 4979028 4979031 5030267 6222207 + * 4979017 4979028 4979031 5030267 6222207 8040806 * @summary Test the operation of the methods of BitSet class * @author Mike McCloskey, Martin Buchholz + * @run main/othervm BSMethods */ import java.util.*; @@ -897,6 +898,21 @@ private static void testToString() { check(new BitSet().toString().equals("{}")); check(makeSet(2,3,42,43,234).toString().equals("{2, 3, 42, 43, 234}")); + + final long MB = 1024*1024; + if (Runtime.getRuntime().maxMemory() >= 512*MB) { + // only run it if we have enough memory + try { + check(makeSet(Integer.MAX_VALUE-1).toString().equals( + "{" + (Integer.MAX_VALUE-1) + "}")); + check(makeSet(Integer.MAX_VALUE).toString().equals( + "{" + Integer.MAX_VALUE + "}")); + check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals( + "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}")); + } catch (IndexOutOfBoundsException exc) { + fail("toString() with indices near MAX_VALUE"); + } + } } private static void testLogicalIdentities() { diff -r f5ba1bbe180b -r 31dac938108d test/java/util/IdentityHashMap/Capacity.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/IdentityHashMap/Capacity.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Random; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +/* + * @test + * @bug 6904367 + * @summary IdentityHashMap reallocates storage when inserting expected + * number of elements + * @run testng Capacity + */ + +@Test +public class Capacity { + static final Field tableField; + static final Random random = new Random(); + static final Object[][] sizesData; + + @DataProvider(name="sizes", parallel = true) + public Object[][] sizesToTest() { return sizesData; } + + static { + try { + tableField = IdentityHashMap.class.getDeclaredField("table"); + tableField.setAccessible(true); + } catch (NoSuchFieldException e) { + throw new LinkageError("table", e); + } + + ArrayList sizes = new ArrayList<>(); + for (int size = 0; size < 200; size++) + sizes.add(new Object[] { size }); + + // some numbers known to demonstrate bug 6904367 + for (int size : new int[] {682, 683, 1365, 2730, 2731, 5461}) + sizes.add(new Object[] { size }); + + // a few more random sizes to try + for (int i = 0; i != 128; i++) + sizes.add(new Object[] { random.nextInt(5000) }); + + sizesData = sizes.toArray(new Object[0][]); + } + + static int capacity(IdentityHashMap map) { + try { + return ((Object[]) tableField.get(map)).length / 2; + } catch (Throwable t) { + throw new LinkageError("table", t); + } + } + + static void assertCapacity(IdentityHashMap map, + int expectedCapacity) { + assertEquals(capacity(map), expectedCapacity); + } + + static void growUsingPut(IdentityHashMap map, + int elementsToAdd) { + for (int i = 0; i < elementsToAdd; i++) + map.put(new Object(), new Object()); + } + + static void growUsingPutAll(IdentityHashMap map, + int elementsToAdd) { + IdentityHashMap other = new IdentityHashMap<>(); + growUsingPut(other, elementsToAdd); + map.putAll(other); + } + + static void growUsingRepeatedPutAll(IdentityHashMap map, + int elementsToAdd) { + for (int i = 0; i < elementsToAdd; i++) + map.putAll(Collections.singletonMap(new Object(), + new Object())); + } + + /** + * Checks that expected number of items can be inserted into + * the map without resizing of the internal storage + */ + @Test(dataProvider = "sizes") + public void canInsertExpectedItemsWithoutResizing(int size) + throws Throwable { + // First try growing using put() + IdentityHashMap m = new IdentityHashMap<>(size); + int initialCapacity = capacity(m); + growUsingPut(m, size); + assertCapacity(m, initialCapacity); + + // Doubling from the expected size will cause exactly one + // resize, except near minimum capacity. + if (size > 1) { + growUsingPut(m, size); + assertCapacity(m, 2 * initialCapacity); + } + + // Try again, growing with putAll() + m = new IdentityHashMap<>(size); + initialCapacity = capacity(m); + growUsingPutAll(m, size); + assertCapacity(m, initialCapacity); + + // Doubling from the expected size will cause exactly one + // resize, except near minimum capacity. + if (size > 1) { + growUsingPutAll(m, size); + assertCapacity(m, 2 * initialCapacity); + } + } + + /** + * Given the expected size, computes such a number N of items that + * inserting (N+1) items will trigger resizing of the internal storage + */ + static int threshold(int size) throws Throwable { + IdentityHashMap m = new IdentityHashMap<>(size); + int initialCapacity = capacity(m); + while (capacity(m) == initialCapacity) + growUsingPut(m, 1); + return m.size() - 1; + } + + /** + * Checks that inserting (threshold+1) item causes resizing + * of the internal storage + */ + @Test(dataProvider = "sizes") + public void passingThresholdCausesResize(int size) throws Throwable { + final int threshold = threshold(size); + IdentityHashMap m = new IdentityHashMap<>(threshold); + int initialCapacity = capacity(m); + + growUsingPut(m, threshold); + assertCapacity(m, initialCapacity); + + growUsingPut(m, 1); + assertCapacity(m, 2 * initialCapacity); + } + + /** + * Checks that 4 methods of requiring capacity lead to the same + * internal capacity, unless sized below default capacity. + */ + @Test(dataProvider = "sizes") + public void differentGrowthPatternsResultInSameCapacity(int size) + throws Throwable { + if (size < 21) // 21 is default maxExpectedSize + return; + + IdentityHashMap m; + m = new IdentityHashMap(size); + int capacity1 = capacity(m); + + m = new IdentityHashMap<>(); + growUsingPut(m, size); + int capacity2 = capacity(m); + + m = new IdentityHashMap<>(); + growUsingPutAll(m, size); + int capacity3 = capacity(m); + + m = new IdentityHashMap<>(); + growUsingRepeatedPutAll(m, size); + int capacity4 = capacity(m); + + if (capacity1 != capacity2 || + capacity2 != capacity3 || + capacity3 != capacity4) + throw new AssertionError("Capacities not equal: " + + capacity1 + " " + + capacity2 + " " + + capacity3 + " " + + capacity4); + } + + public void defaultExpectedMaxSizeIs21() { + assertCapacity(new IdentityHashMap(), 32); + assertCapacity(new IdentityHashMap(21), 32); + } + + public void minimumCapacityIs4() { + assertCapacity(new IdentityHashMap(0), 4); + assertCapacity(new IdentityHashMap(1), 4); + assertCapacity(new IdentityHashMap(2), 4); + assertCapacity(new IdentityHashMap(3), 8); + } + + @Test(enabled = false) + /** needs too much memory to run normally */ + public void maximumCapacityIs2ToThe29() { + assertCapacity(new IdentityHashMap(Integer.MAX_VALUE), + 1 << 29); + } +} diff -r f5ba1bbe180b -r 31dac938108d test/java/util/logging/LoggingDeadlock2.java --- a/test/java/util/logging/LoggingDeadlock2.java Wed Nov 12 13:47:21 2014 -0800 +++ b/test/java/util/logging/LoggingDeadlock2.java Fri Nov 14 10:03:24 2014 -0800 @@ -28,7 +28,7 @@ * @author Serguei Spitsyn / Hitachi / Martin Buchholz * * @build LoggingDeadlock2 - * @run main/timeout=15 LoggingDeadlock2 + * @run main LoggingDeadlock2 * * There is a clear deadlock between LogManager. and * Cleaner.run() methods. diff -r f5ba1bbe180b -r 31dac938108d test/javax/swing/JComboBox/8057893/bug8057893.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JComboBox/8057893/bug8057893.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import sun.awt.SunToolkit; + +/** + * @test + * @bug 8057893 + * @author Alexander Scherbatiy + * @summary JComboBox actionListener never receives "comboBoxEdited" + * from getActionCommand + * @run main bug8057893 + */ +public class bug8057893 { + + private static volatile boolean isComboBoxEdited = false; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(50); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + EventQueue.invokeAndWait(() -> { + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + JComboBox comboBox = new JComboBox<>(new String[]{"one", "two"}); + comboBox.setEditable(true); + comboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if ("comboBoxEdited".equals(e.getActionCommand())) { + isComboBoxEdited = true; + } + } + }); + frame.add(comboBox); + frame.pack(); + frame.setVisible(true); + comboBox.requestFocusInWindow(); + }); + + toolkit.realSync(); + + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + toolkit.realSync(); + + if(!isComboBoxEdited){ + throw new RuntimeException("ComboBoxEdited event is not fired!"); + } + } +} diff -r f5ba1bbe180b -r 31dac938108d test/javax/xml/jaxp/testng/TEST.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/testng/TEST.properties Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,3 @@ +# This file identifies root(s) of the test-ng hierarchy. + +TestNG.dirs = . diff -r f5ba1bbe180b -r 31dac938108d test/javax/xml/jaxp/testng/parse/XMLEntityScannerLoad.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/testng/parse/XMLEntityScannerLoad.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package parse; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import static org.testng.Assert.assertEquals; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +/** + * JDK-8059327: XML parser returns corrupt attribute value + * https://bugs.openjdk.java.net/browse/JDK-8059327 + * + * Also: + * JDK-8061550: XMLEntityScanner can corrupt corrupt content during parsing + * https://bugs.openjdk.java.net/browse/JDK-8061550 + * + * @Summary: verify that the character cache in XMLEntityScanner is reset properly + */ + +public class XMLEntityScannerLoad { + + @Test(dataProvider = "xmls") + public void test(String xml) throws SAXException, IOException, ParserConfigurationException { + Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ChunkInputStream(xml)); + String value = d.getDocumentElement().getAttribute("a1"); + assertEquals(value, "w"); + } + + static class ChunkInputStream extends ByteArrayInputStream { + ChunkInputStream(String xml) { + super(xml.getBytes()); + } + + @Override + public synchronized int read(byte[] b, int off, int len) { + return super.read(b, off, 7); + } + } + + @DataProvider(name = "xmls") + private Object[][] xmls() { + return new Object[][] { + {""}, + {""} + }; + } +} diff -r f5ba1bbe180b -r 31dac938108d test/jdk/net/Sockets/SupportedOptions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/net/Sockets/SupportedOptions.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8062744 + * @run main SupportedOptions + */ + +import java.net.*; +import java.io.IOException; +import jdk.net.*; + +public class SupportedOptions { + + public static void main(String[] args) throws Exception { + if (!Sockets.supportedOptions(ServerSocket.class) + .contains(StandardSocketOptions.IP_TOS)) { + throw new RuntimeException("Test failed"); + } + // Now set the option + ServerSocket ss = new ServerSocket(); + Sockets.setOption(ss, java.net.StandardSocketOptions.IP_TOS, 128); + } +} diff -r f5ba1bbe180b -r 31dac938108d test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java --- a/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java Wed Nov 12 13:47:21 2014 -0800 +++ b/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java Fri Nov 14 10:03:24 2014 -0800 @@ -34,6 +34,7 @@ * @bug 6672135 * @summary setInterval() for local MonitoredHost and local MonitoredVm * @author Tomas Hurka + * @run main/othervm -XX:+UsePerfData CR6672135 */ public class CR6672135 { diff -r f5ba1bbe180b -r 31dac938108d test/sun/security/pkcs11/Cipher/JNICheck.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/pkcs11/Cipher/JNICheck.java Fri Nov 14 10:03:24 2014 -0800 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8063700 + * @run main/othervm -Xcheck:jni JNICheck + */ + +import javax.crypto.Cipher; +import javax.crypto.SealedObject; +import javax.crypto.SecretKey; +import javax.crypto.KeyGenerator; +import java.security.NoSuchProviderException; + +public class JNICheck { + + /* This test is similar to the JCK test that found 8063700. */ + static class SealedObjectTest { + Cipher c; + + SealedObjectTest() throws Exception { + try { + c = Cipher.getInstance("AES", "SunPKCS11-Solaris"); + } catch (NoSuchProviderException nspe) { + System.out.println("No SunPKCS11-Solaris provider. Test skipped"); + return; + } + + String s = "Test string"; + SealedObject so; + SecretKey key = KeyGenerator.getInstance("AES").generateKey(); + + c.init(Cipher.ENCRYPT_MODE, key); + so = new SealedObject(s, c); + + so.getObject(key, "SunPKCS11-Solaris"); + } + } + + public static void main(String args[]) throws Exception { + new SealedObjectTest(); + } +}