# HG changeset patch
# User lana
# Date 1415731235 28800
# Node ID 48ff867c7f24c54c155134781e29edd9b34512d9
# Parent ffc348308de2e872f5d510d440604c3726a67a18# Parent f4a778ce0cabbb391f0e8519186453e88a837399
Merge
diff -r ffc348308de2 -r 48ff867c7f24 src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/macosx/native/java/util/MacOSXPreferencesFile.m
--- a/src/macosx/native/java/util/MacOSXPreferencesFile.m Fri Nov 07 09:22:58 2014 -0800
+++ b/src/macosx/native/java/util/MacOSXPreferencesFile.m Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/java/io/SequenceInputStream.java
--- a/src/share/classes/java/io/SequenceInputStream.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/java/io/SequenceInputStream.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/java/lang/invoke/MethodType.java
--- a/src/share/classes/java/lang/invoke/MethodType.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/java/lang/invoke/MethodType.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/java/lang/ref/ReferenceQueue.java
--- a/src/share/classes/java/lang/ref/ReferenceQueue.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/java/lang/ref/ReferenceQueue.java Tue Nov 11 10:40:35 2014 -0800
@@ -138,11 +138,17 @@
synchronized (lock) {
Reference extends T> 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/java/util/BitSet.java
--- a/src/share/classes/java/util/BitSet.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/java/util/BitSet.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/java/util/IdentityHashMap.java
--- a/src/share/classes/java/util/IdentityHashMap.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/java/util/IdentityHashMap.java Tue Nov 11 10:40:35 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 extends K, ? extends V> 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/LookupSwitchInsnNode.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodInsnNode.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
--- a/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/internal/org/objectweb/asm/version.txt
--- a/src/share/classes/jdk/internal/org/objectweb/asm/version.txt Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/version.txt Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/jdk/net/Sockets.java
--- a/src/share/classes/jdk/net/Sockets.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/jdk/net/Sockets.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/sun/invoke/util/Wrapper.java
--- a/src/share/classes/sun/invoke/util/Wrapper.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/sun/invoke/util/Wrapper.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/sun/nio/fs/AbstractPoller.java
--- a/src/share/classes/sun/nio/fs/AbstractPoller.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/sun/nio/fs/AbstractPoller.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/classes/sun/nio/fs/PollingWatchService.java
--- a/src/share/classes/sun/nio/fs/PollingWatchService.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/classes/sun/nio/fs/PollingWatchService.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c
--- a/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c Fri Nov 07 09:22:58 2014 -0800
+++ b/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
--- a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c Fri Nov 07 09:22:58 2014 -0800
+++ b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 src/windows/classes/sun/awt/windows/WPathGraphics.java
--- a/src/windows/classes/sun/awt/windows/WPathGraphics.java Fri Nov 07 09:22:58 2014 -0800
+++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 test/com/sun/jndi/ldap/LdapTimeoutTest.java
--- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri Nov 07 09:22:58 2014 -0800
+++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 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 Tue Nov 11 10:40:35 2014 -0800
@@ -0,0 +1,21 @@
+
+
+
+DisposeStressTest
+
+
+
+
DisposeStressTest Bug ID: 4051487, 4145670
+
+
This is an AUTOMATIC test, simply wait for completion
+
+
+
+
diff -r ffc348308de2 -r 48ff867c7f24 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 Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 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 Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 test/java/io/SequenceInputStream/LotsOfStreams.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/io/SequenceInputStream/LotsOfStreams.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 test/java/lang/invoke/ExplicitCastArgumentsTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/invoke/ExplicitCastArgumentsTest.java Tue Nov 11 10:40:35 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 ffc348308de2 -r 48ff867c7f24 test/java/lang/ref/EarlyTimeout.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/ref/EarlyTimeout.java Tue Nov 11 10:40:35 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