changeset 9973:c0192683fb63

Merge
author ngthomas
date Tue, 29 Apr 2014 14:40:26 -0700
parents bcf64fb3407f 6ff36c51c2bc
children 69ca0ba20534
files
diffstat 141 files changed, 9343 insertions(+), 819 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Apr 29 15:46:16 2014 -0400
+++ b/.hgtags	Tue Apr 29 14:40:26 2014 -0700
@@ -250,3 +250,6 @@
 263198a1d8f1f4cb97d35f40c61704b08ebd3686 jdk9-b05
 cac7b28b8b1e0e11d7a8e1ac1fe75a03b3749eab jdk9-b06
 f4e624447514f12dd7c51f1e5b0cb97efcd15be2 jdk9-b07
+9e7bd44ea85c72318130379c34b98716b9c7c248 jdk9-b08
+2cef452ba711b17950da275fd15931925799f07c jdk9-b09
+ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
--- a/make/CompileJavaClasses.gmk	Tue Apr 29 15:46:16 2014 -0400
+++ b/make/CompileJavaClasses.gmk	Tue Apr 29 14:40:26 2014 -0700
@@ -326,7 +326,7 @@
 ifeq ($(ENABLE_SJAVAC),yes)
   # With sjavac enabled, excluded sources are not even considered for linking. 
   # Explicitly add the security sources to sourcepath for linking.
-  BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
+  BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%/*,$(SECURITY_PKGS)) \
       -sourcepath $(JDK_TOPDIR)/src/share/classes
 endif
 
--- a/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Tue Apr 29 14:40:26 2014 -0700
@@ -154,7 +154,10 @@
                 if (pmStr != NULL) {
                     CFStringGetCString(pmStr, buf, BUFLEN, kCFStringEncodingUTF8);
                     CFRelease(pmStr);
-                    (*env)->SetObjectArrayElement(env, ampms, 1, (*env)->NewStringUTF(env, buf));
+                    tmp_string = (*env)->NewStringUTF(env, buf);
+                    if (tmp_string != NULL) {
+                        (*env)->SetObjectArrayElement(env, ampms, 1, tmp_string);
+                    }
                 }
             }
             CFRelease(df);
--- a/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Tue Apr 29 14:40:26 2014 -0700
@@ -35,7 +35,7 @@
  * @since 1.5
  * @author Vincent Ryan
  */
-
+@jdk.Exported
 public interface ContentSignerParameters {
 
     /**
@@ -64,7 +64,20 @@
      *
      * @return The TSAPolicyID. May be null.
      */
-    public String getTSAPolicyID();
+    public default String getTSAPolicyID() {
+        return null;
+    }
+
+    /**
+     * Retreives the message digest algorithm that is used to generate
+     * the message imprint to be sent to the TSA server.
+     *
+     * @since 1.9
+     * @return The non-null string of the message digest algorithm name.
+     */
+    public default String getTSADigestAlg() {
+        return "SHA-256";
+    }
 
     /**
      * Retrieves the JAR file's signature.
--- a/src/share/classes/com/sun/jndi/ldap/Obj.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/com/sun/jndi/ldap/Obj.java	Tue Apr 29 14:40:26 2014 -0700
@@ -38,13 +38,11 @@
 import java.io.ObjectStreamClass;
 import java.io.InputStream;
 
+import java.util.Base64;
 import java.util.Hashtable;
 import java.util.Vector;
 import java.util.StringTokenizer;
 
-import sun.misc.BASE64Encoder;
-import sun.misc.BASE64Decoder;
-
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Modifier;
 
@@ -324,7 +322,7 @@
 
             Attribute refAttr = new BasicAttribute(JAVA_ATTRIBUTES[REF_ADDR]);
             RefAddr refAddr;
-            BASE64Encoder encoder = null;
+            Base64.Encoder encoder = null;
 
             for (int i = 0; i < count; i++) {
                 refAddr = ref.get(i);
@@ -335,12 +333,12 @@
                         separator + refAddr.getContent());
                 } else {
                     if (encoder == null)
-                        encoder = new BASE64Encoder();
+                        encoder = Base64.getMimeEncoder();
 
                     refAttr.add(""+ separator + i +
                         separator + refAddr.getType() +
                         separator + separator +
-                        encoder.encodeBuffer(serializeObject(refAddr)));
+                        encoder.encodeToString(serializeObject(refAddr)));
                 }
             }
             attrs.put(refAttr);
@@ -403,7 +401,7 @@
             String val, posnStr, type;
             char separator;
             int start, sep, posn;
-            BASE64Decoder decoder = null;
+            Base64.Decoder decoder = null;
 
             ClassLoader cl = helper.getURLClassLoader(codebases);
 
@@ -472,11 +470,11 @@
                     // %%% RL: exception if empty after double separator
 
                     if (decoder == null)
-                        decoder = new BASE64Decoder();
+                        decoder = Base64.getMimeDecoder();
 
                     RefAddr ra = (RefAddr)
                         deserializeObject(
-                            decoder.decodeBuffer(val.substring(start)),
+                            decoder.decode(val.substring(start).getBytes()),
                             cl);
 
                     refAddrList.setElementAt(ra, posn);
--- a/src/share/classes/java/math/BigDecimal.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/math/BigDecimal.java	Tue Apr 29 14:40:26 2014 -0700
@@ -29,8 +29,8 @@
 
 package java.math;
 
+import static java.math.BigInteger.LONG_MASK;
 import java.util.Arrays;
-import static java.math.BigInteger.LONG_MASK;
 
 /**
  * Immutable, arbitrary-precision signed decimal numbers.  A
@@ -283,7 +283,7 @@
     };
 
     // Cache of common small BigDecimal values.
-    private static final BigDecimal zeroThroughTen[] = {
+    private static final BigDecimal ZERO_THROUGH_TEN[] = {
         new BigDecimal(BigInteger.ZERO,       0,  0, 1),
         new BigDecimal(BigInteger.ONE,        1,  0, 1),
         new BigDecimal(BigInteger.valueOf(2), 2,  0, 1),
@@ -299,7 +299,7 @@
 
     // Cache of zero scaled by 0 - 15
     private static final BigDecimal[] ZERO_SCALED_BY = {
-        zeroThroughTen[0],
+        ZERO_THROUGH_TEN[0],
         new BigDecimal(BigInteger.ZERO, 0, 1, 1),
         new BigDecimal(BigInteger.ZERO, 0, 2, 1),
         new BigDecimal(BigInteger.ZERO, 0, 3, 1),
@@ -328,7 +328,7 @@
      * @since  1.5
      */
     public static final BigDecimal ZERO =
-        zeroThroughTen[0];
+        ZERO_THROUGH_TEN[0];
 
     /**
      * The value 1, with a scale of 0.
@@ -336,7 +336,7 @@
      * @since  1.5
      */
     public static final BigDecimal ONE =
-        zeroThroughTen[1];
+        ZERO_THROUGH_TEN[1];
 
     /**
      * The value 10, with a scale of 0.
@@ -344,7 +344,7 @@
      * @since  1.5
      */
     public static final BigDecimal TEN =
-        zeroThroughTen[10];
+        ZERO_THROUGH_TEN[10];
 
     // Constructors
 
@@ -920,20 +920,20 @@
             significand >>= 1;
             exponent++;
         }
-        int scale = 0;
+        int scl = 0;
         // Calculate intVal and scale
-        BigInteger intVal;
+        BigInteger rb;
         long compactVal = sign * significand;
         if (exponent == 0) {
-            intVal = (compactVal == INFLATED) ? INFLATED_BIGINT : null;
+            rb = (compactVal == INFLATED) ? INFLATED_BIGINT : null;
         } else {
             if (exponent < 0) {
-                intVal = BigInteger.valueOf(5).pow(-exponent).multiply(compactVal);
-                scale = -exponent;
+                rb = BigInteger.valueOf(5).pow(-exponent).multiply(compactVal);
+                scl = -exponent;
             } else { //  (exponent > 0)
-                intVal = BigInteger.valueOf(2).pow(exponent).multiply(compactVal);
+                rb = BigInteger.valueOf(2).pow(exponent).multiply(compactVal);
             }
-            compactVal = compactValFor(intVal);
+            compactVal = compactValFor(rb);
         }
         int prec = 0;
         int mcp = mc.precision;
@@ -941,16 +941,16 @@
             int mode = mc.roundingMode.oldMode;
             int drop;
             if (compactVal == INFLATED) {
-                prec = bigDigitLength(intVal);
+                prec = bigDigitLength(rb);
                 drop = prec - mcp;
                 while (drop > 0) {
-                    scale = checkScaleNonZero((long) scale - drop);
-                    intVal = divideAndRoundByTenPow(intVal, drop, mode);
-                    compactVal = compactValFor(intVal);
+                    scl = checkScaleNonZero((long) scl - drop);
+                    rb = divideAndRoundByTenPow(rb, drop, mode);
+                    compactVal = compactValFor(rb);
                     if (compactVal != INFLATED) {
                         break;
                     }
-                    prec = bigDigitLength(intVal);
+                    prec = bigDigitLength(rb);
                     drop = prec - mcp;
                 }
             }
@@ -958,17 +958,17 @@
                 prec = longDigitLength(compactVal);
                 drop = prec - mcp;
                 while (drop > 0) {
-                    scale = checkScaleNonZero((long) scale - drop);
+                    scl = checkScaleNonZero((long) scl - drop);
                     compactVal = divideAndRound(compactVal, LONG_TEN_POWERS_TABLE[drop], mc.roundingMode.oldMode);
                     prec = longDigitLength(compactVal);
                     drop = prec - mcp;
                 }
-                intVal = null;
+                rb = null;
             }
         }
-        this.intVal = intVal;
+        this.intVal = rb;
         this.intCompact = compactVal;
-        this.scale = scale;
+        this.scale = scl;
         this.precision = prec;
     }
 
@@ -1098,13 +1098,13 @@
     public BigDecimal(int val, MathContext mc) {
         int mcp = mc.precision;
         long compactVal = val;
-        int scale = 0;
+        int scl = 0;
         int prec = 0;
         if (mcp > 0) { // do rounding
             prec = longDigitLength(compactVal);
             int drop = prec - mcp; // drop can't be more than 18
             while (drop > 0) {
-                scale = checkScaleNonZero((long) scale - drop);
+                scl = checkScaleNonZero((long) scl - drop);
                 compactVal = divideAndRound(compactVal, LONG_TEN_POWERS_TABLE[drop], mc.roundingMode.oldMode);
                 prec = longDigitLength(compactVal);
                 drop = prec - mcp;
@@ -1112,7 +1112,7 @@
         }
         this.intVal = null;
         this.intCompact = compactVal;
-        this.scale = scale;
+        this.scale = scl;
         this.precision = prec;
     }
 
@@ -1144,20 +1144,20 @@
         int mcp = mc.precision;
         int mode = mc.roundingMode.oldMode;
         int prec = 0;
-        int scale = 0;
-        BigInteger intVal = (val == INFLATED) ? INFLATED_BIGINT : null;
+        int scl = 0;
+        BigInteger rb = (val == INFLATED) ? INFLATED_BIGINT : null;
         if (mcp > 0) { // do rounding
             if (val == INFLATED) {
                 prec = 19;
                 int drop = prec - mcp;
                 while (drop > 0) {
-                    scale = checkScaleNonZero((long) scale - drop);
-                    intVal = divideAndRoundByTenPow(intVal, drop, mode);
-                    val = compactValFor(intVal);
+                    scl = checkScaleNonZero((long) scl - drop);
+                    rb = divideAndRoundByTenPow(rb, drop, mode);
+                    val = compactValFor(rb);
                     if (val != INFLATED) {
                         break;
                     }
-                    prec = bigDigitLength(intVal);
+                    prec = bigDigitLength(rb);
                     drop = prec - mcp;
                 }
             }
@@ -1165,17 +1165,17 @@
                 prec = longDigitLength(val);
                 int drop = prec - mcp;
                 while (drop > 0) {
-                    scale = checkScaleNonZero((long) scale - drop);
+                    scl = checkScaleNonZero((long) scl - drop);
                     val = divideAndRound(val, LONG_TEN_POWERS_TABLE[drop], mc.roundingMode.oldMode);
                     prec = longDigitLength(val);
                     drop = prec - mcp;
                 }
-                intVal = null;
+                rb = null;
             }
         }
-        this.intVal = intVal;
+        this.intVal = rb;
         this.intCompact = val;
-        this.scale = scale;
+        this.scale = scl;
         this.precision = prec;
     }
 
@@ -1215,16 +1215,16 @@
      * @return a {@code BigDecimal} whose value is {@code val}.
      */
     public static BigDecimal valueOf(long val) {
-        if (val >= 0 && val < zeroThroughTen.length)
-            return zeroThroughTen[(int)val];
+        if (val >= 0 && val < ZERO_THROUGH_TEN.length)
+            return ZERO_THROUGH_TEN[(int)val];
         else if (val != INFLATED)
             return new BigDecimal(null, val, 0, 0);
         return new BigDecimal(INFLATED_BIGINT, val, 0, 0);
     }
 
     static BigDecimal valueOf(long unscaledVal, int scale, int prec) {
-        if (scale == 0 && unscaledVal >= 0 && unscaledVal < zeroThroughTen.length) {
-            return zeroThroughTen[(int) unscaledVal];
+        if (scale == 0 && unscaledVal >= 0 && unscaledVal < ZERO_THROUGH_TEN.length) {
+            return ZERO_THROUGH_TEN[(int) unscaledVal];
         } else if (unscaledVal == 0) {
             return zeroValueOf(scale);
         }
@@ -1236,8 +1236,8 @@
         long val = compactValFor(intVal);
         if (val == 0) {
             return zeroValueOf(scale);
-        } else if (scale == 0 && val >= 0 && val < zeroThroughTen.length) {
-            return zeroThroughTen[(int) val];
+        } else if (scale == 0 && val >= 0 && val < ZERO_THROUGH_TEN.length) {
+            return ZERO_THROUGH_TEN[(int) val];
         }
         return new BigDecimal(intVal, val, scale, prec);
     }
@@ -2620,6 +2620,7 @@
      * @return -1, 0, or 1 as this {@code BigDecimal} is numerically
      *          less than, equal to, or greater than {@code val}.
      */
+    @Override
     public int compareTo(BigDecimal val) {
         // Quick path for equal scale and non-inflated case.
         if (scale == val.scale) {
@@ -2659,14 +2660,13 @@
                 return -1;
             if (xae > yae)
                 return 1;
-            BigInteger rb = null;
             if (sdiff < 0) {
                 // The cases sdiff <= Integer.MIN_VALUE intentionally fall through.
                 if ( sdiff > Integer.MIN_VALUE &&
                       (xs == INFLATED ||
                       (xs = longMultiplyPowerTen(xs, (int)-sdiff)) == INFLATED) &&
                      ys == INFLATED) {
-                    rb = bigMultiplyPowerTen((int)-sdiff);
+                    BigInteger rb = bigMultiplyPowerTen((int)-sdiff);
                     return rb.compareMagnitude(val.intVal);
                 }
             } else { // sdiff > 0
@@ -2675,7 +2675,7 @@
                       (ys == INFLATED ||
                       (ys = longMultiplyPowerTen(ys, (int)sdiff)) == INFLATED) &&
                      xs == INFLATED) {
-                    rb = val.bigMultiplyPowerTen((int)sdiff);
+                    BigInteger rb = val.bigMultiplyPowerTen((int)sdiff);
                     return this.intVal.compareMagnitude(rb);
                 }
             }
@@ -2880,8 +2880,9 @@
     @Override
     public String toString() {
         String sc = stringCache;
-        if (sc == null)
+        if (sc == null) {
             stringCache = sc = layoutChars(true);
+        }
         return sc;
     }
 
@@ -2958,18 +2959,19 @@
             if(signum()==0) {
                 return "0";
             }
-            int tailingZeros = checkScaleNonZero((-(long)scale));
+            int trailingZeros = checkScaleNonZero((-(long)scale));
             StringBuilder buf;
             if(intCompact!=INFLATED) {
-                buf = new StringBuilder(20+tailingZeros);
+                buf = new StringBuilder(20+trailingZeros);
                 buf.append(intCompact);
             } else {
                 String str = intVal.toString();
-                buf = new StringBuilder(str.length()+tailingZeros);
+                buf = new StringBuilder(str.length()+trailingZeros);
                 buf.append(str);
             }
-            for (int i = 0; i < tailingZeros; i++)
+            for (int i = 0; i < trailingZeros; i++) {
                 buf.append('0');
+            }
             return buf.toString();
         }
         String str ;
@@ -2996,8 +2998,9 @@
         } else { /* We must insert zeros between point and intVal */
             buf = new StringBuilder(3-insertionPoint + intString.length());
             buf.append(signum<0 ? "-0." : "0.");
-            for (int i=0; i<-insertionPoint; i++)
+            for (int i=0; i<-insertionPoint; i++) {
                 buf.append('0');
+            }
             buf.append(intString);
         }
         return buf.toString();
@@ -3056,6 +3059,7 @@
      *
      * @return this {@code BigDecimal} converted to a {@code long}.
      */
+    @Override
     public long longValue(){
         return (intCompact != INFLATED && scale == 0) ?
             intCompact:
@@ -3124,6 +3128,7 @@
      *
      * @return this {@code BigDecimal} converted to an {@code int}.
      */
+    @Override
     public int intValue() {
         return  (intCompact != INFLATED && scale == 0) ?
             (int)intCompact :
@@ -3206,6 +3211,7 @@
      *
      * @return this {@code BigDecimal} converted to a {@code float}.
      */
+    @Override
     public float floatValue(){
         if(intCompact != INFLATED) {
             if (scale == 0) {
@@ -3221,10 +3227,10 @@
                     // Don't have too guard against
                     // Math.abs(MIN_VALUE) because of outer check
                     // against INFLATED.
-                    if (scale > 0 && scale < float10pow.length) {
-                        return (float)intCompact / float10pow[scale];
-                    } else if (scale < 0 && scale > -float10pow.length) {
-                        return (float)intCompact * float10pow[-scale];
+                    if (scale > 0 && scale < FLOAT_10_POW.length) {
+                        return (float)intCompact / FLOAT_10_POW[scale];
+                    } else if (scale < 0 && scale > -FLOAT_10_POW.length) {
+                        return (float)intCompact * FLOAT_10_POW[-scale];
                     }
                 }
             }
@@ -3249,6 +3255,7 @@
      *
      * @return this {@code BigDecimal} converted to a {@code double}.
      */
+    @Override
     public double doubleValue(){
         if(intCompact != INFLATED) {
             if (scale == 0) {
@@ -3264,10 +3271,10 @@
                     // Don't have too guard against
                     // Math.abs(MIN_VALUE) because of outer check
                     // against INFLATED.
-                    if (scale > 0 && scale < double10pow.length) {
-                        return (double)intCompact / double10pow[scale];
-                    } else if (scale < 0 && scale > -double10pow.length) {
-                        return (double)intCompact * double10pow[-scale];
+                    if (scale > 0 && scale < DOUBLE_10_POW.length) {
+                        return (double)intCompact / DOUBLE_10_POW[scale];
+                    } else if (scale < 0 && scale > -DOUBLE_10_POW.length) {
+                        return (double)intCompact * DOUBLE_10_POW[-scale];
                     }
                 }
             }
@@ -3280,7 +3287,7 @@
      * Powers of 10 which can be represented exactly in {@code
      * double}.
      */
-    private static final double double10pow[] = {
+    private static final double DOUBLE_10_POW[] = {
         1.0e0,  1.0e1,  1.0e2,  1.0e3,  1.0e4,  1.0e5,
         1.0e6,  1.0e7,  1.0e8,  1.0e9,  1.0e10, 1.0e11,
         1.0e12, 1.0e13, 1.0e14, 1.0e15, 1.0e16, 1.0e17,
@@ -3291,7 +3298,7 @@
      * Powers of 10 which can be represented exactly in {@code
      * float}.
      */
-    private static final float float10pow[] = {
+    private static final float FLOAT_10_POW[] = {
         1.0e0f, 1.0e1f, 1.0e2f, 1.0e3f, 1.0e4f, 1.0e5f,
         1.0e6f, 1.0e7f, 1.0e8f, 1.0e9f, 1.0e10f
     };
@@ -3504,8 +3511,9 @@
                 } else if (sig >= coeffLen) {   // significand all in integer
                     buf.append(coeff, offset, coeffLen);
                     // may need some zeros, too
-                    for (int i = sig - coeffLen; i > 0; i--)
+                    for (int i = sig - coeffLen; i > 0; i--) {
                         buf.append('0');
+                    }
                 } else {                     // xx.xxE form
                     buf.append(coeff, offset, sig);
                     buf.append('.');
@@ -3559,11 +3567,13 @@
             // to prevent multiple threads from expanding the same array.
             if (curLen <= n) {
                 int newLen = curLen << 1;
-                while (newLen <= n)
+                while (newLen <= n) {
                     newLen <<= 1;
+                }
                 pows = Arrays.copyOf(pows, newLen);
-                for (int i = curLen; i < newLen; i++)
+                for (int i = curLen; i < newLen; i++) {
                     pows[i] = pows[i - 1].multiply(BigInteger.TEN);
+                }
                 // Based on the following facts:
                 // 1. pows is a private local varible;
                 // 2. the following store is a volatile store.
@@ -3703,9 +3713,7 @@
      *         {@code BigDecimal}s to be aligned.
      */
     private static void matchScale(BigDecimal[] val) {
-        if (val[0].scale == val[1].scale) {
-            return;
-        } else if (val[0].scale < val[1].scale) {
+        if (val[0].scale < val[1].scale) {
             val[0] = val[0].setScale(val[1].scale, ROUND_UNNECESSARY);
         } else if (val[1].scale < val[0].scale) {
             val[1] = val[1].setScale(val[0].scale, ROUND_UNNECESSARY);
@@ -4209,16 +4217,16 @@
      * do rounding based on the passed in roundingMode.
      */
     private static BigInteger divideAndRound(BigInteger bdividend, long ldivisor, int roundingMode) {
-        boolean isRemainderZero; // record remainder is zero or not
-        int qsign; // quotient sign
-        long r = 0; // store quotient & remainder in long
-        MutableBigInteger mq = null; // store quotient
         // Descend into mutables for faster remainder checks
         MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
-        mq = new MutableBigInteger();
-        r = mdividend.divide(ldivisor, mq);
-        isRemainderZero = (r == 0);
-        qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
+        // store quotient
+        MutableBigInteger mq = new MutableBigInteger();
+        // store quotient & remainder in long
+        long r = mdividend.divide(ldivisor, mq);
+        // record remainder is zero or not
+        boolean isRemainderZero = (r == 0);
+        // quotient sign
+        int qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
         if (!isRemainderZero) {
             if(needIncrement(ldivisor, roundingMode, qsign, mq, r)) {
                 mq.add(MutableBigInteger.ONE);
@@ -4238,16 +4246,16 @@
      */
     private static BigDecimal divideAndRound(BigInteger bdividend,
                                              long ldivisor, int scale, int roundingMode, int preferredScale) {
-        boolean isRemainderZero; // record remainder is zero or not
-        int qsign; // quotient sign
-        long r = 0; // store quotient & remainder in long
-        MutableBigInteger mq = null; // store quotient
         // Descend into mutables for faster remainder checks
         MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
-        mq = new MutableBigInteger();
-        r = mdividend.divide(ldivisor, mq);
-        isRemainderZero = (r == 0);
-        qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
+        // store quotient
+        MutableBigInteger mq = new MutableBigInteger();
+        // store quotient & remainder in long
+        long r = mdividend.divide(ldivisor, mq);
+        // record remainder is zero or not
+        boolean isRemainderZero = (r == 0);
+        // quotient sign
+        int qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
         if (!isRemainderZero) {
             if(needIncrement(ldivisor, roundingMode, qsign, mq, r)) {
                 mq.add(MutableBigInteger.ONE);
--- a/src/share/classes/java/net/DatagramSocketImpl.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/net/DatagramSocketImpl.java	Tue Apr 29 14:40:26 2014 -0700
@@ -311,6 +311,7 @@
      *
      * @since 1.9
      */
+    @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
         if (name == StandardSocketOptions.SO_SNDBUF) {
             return (T) getOption(SocketOptions.SO_SNDBUF);
--- a/src/share/classes/java/net/SocketImpl.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/net/SocketImpl.java	Tue Apr 29 14:40:26 2014 -0700
@@ -408,6 +408,7 @@
      *
      * @since 1.9
      */
+    @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
         if (name == StandardSocketOptions.SO_KEEPALIVE) {
             return (T)getOption(SocketOptions.SO_KEEPALIVE);
--- a/src/share/classes/java/time/temporal/IsoFields.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/time/temporal/IsoFields.java	Tue Apr 29 14:40:26 2014 -0700
@@ -535,11 +535,17 @@
                 if (isSupportedBy(temporal) == false) {
                     throw new UnsupportedTemporalTypeException("Unsupported field: WeekBasedYear");
                 }
-                int newVal = range().checkValidIntValue(newValue, WEEK_BASED_YEAR);  // strict check
+                int newWby = range().checkValidIntValue(newValue, WEEK_BASED_YEAR);  // strict check
                 LocalDate date = LocalDate.from(temporal);
+                int dow = date.get(DAY_OF_WEEK);
                 int week = getWeek(date);
-                date = date.withDayOfYear(180).withYear(newVal).with(WEEK_OF_WEEK_BASED_YEAR, week);
-                return (R) date.with(date);
+                if (week == 53 && getWeekRange(newWby) == 52) {
+                    week = 52;
+                }
+                LocalDate resolved = LocalDate.of(newWby, 1, 4);  // 4th is guaranteed to be in week one
+                int days = (dow - resolved.get(DAY_OF_WEEK)) + ((week - 1) * 7);
+                resolved = resolved.plusDays(days);
+                return (R) temporal.with(resolved);
             }
             @Override
             public String toString() {
@@ -577,12 +583,16 @@
 
         private static ValueRange getWeekRange(LocalDate date) {
             int wby = getWeekBasedYear(date);
-            date = date.withDayOfYear(1).withYear(wby);
+            return ValueRange.of(1, getWeekRange(wby));
+        }
+
+        private static int getWeekRange(int wby) {
+            LocalDate date = LocalDate.of(wby, 1, 1);
             // 53 weeks if standard year starts on Thursday, or Wed in a leap year
             if (date.getDayOfWeek() == THURSDAY || (date.getDayOfWeek() == WEDNESDAY && date.isLeapYear())) {
-                return ValueRange.of(1, 53);
+                return 53;
             }
-            return ValueRange.of(1, 52);
+            return 52;
         }
 
         private static int getWeek(LocalDate date) {
--- a/src/share/classes/java/time/temporal/WeekFields.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/time/temporal/WeekFields.java	Tue Apr 29 14:40:26 2014 -0700
@@ -700,7 +700,7 @@
          * @see WeekFields#weekOfWeekBasedYear()
          */
         static ComputedDayOfField ofWeekOfWeekBasedYearField(WeekFields weekDef) {
-            return new ComputedDayOfField("WeekOfWeekBasedYear", weekDef, WEEKS, IsoFields.WEEK_BASED_YEARS, WEEK_OF_YEAR_RANGE);
+            return new ComputedDayOfField("WeekOfWeekBasedYear", weekDef, WEEKS, IsoFields.WEEK_BASED_YEARS, WEEK_OF_WEEK_BASED_YEAR_RANGE);
         }
 
         /**
@@ -753,6 +753,7 @@
         private static final ValueRange DAY_OF_WEEK_RANGE = ValueRange.of(1, 7);
         private static final ValueRange WEEK_OF_MONTH_RANGE = ValueRange.of(0, 1, 4, 6);
         private static final ValueRange WEEK_OF_YEAR_RANGE = ValueRange.of(0, 1, 52, 54);
+        private static final ValueRange WEEK_OF_WEEK_BASED_YEAR_RANGE = ValueRange.of(1, 52, 53);
 
         @Override
         public long getFrom(TemporalAccessor temporal) {
--- a/src/share/classes/java/util/ArrayList.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/util/ArrayList.java	Tue Apr 29 14:40:26 2014 -0700
@@ -30,33 +30,33 @@
 import java.util.function.UnaryOperator;
 
 /**
- * Resizable-array implementation of the <tt>List</tt> interface.  Implements
+ * Resizable-array implementation of the {@code List} interface.  Implements
  * all optional list operations, and permits all elements, including
- * <tt>null</tt>.  In addition to implementing the <tt>List</tt> interface,
+ * {@code null}.  In addition to implementing the {@code List} interface,
  * this class provides methods to manipulate the size of the array that is
  * used internally to store the list.  (This class is roughly equivalent to
- * <tt>Vector</tt>, except that it is unsynchronized.)
+ * {@code Vector}, except that it is unsynchronized.)
  *
- * <p>The <tt>size</tt>, <tt>isEmpty</tt>, <tt>get</tt>, <tt>set</tt>,
- * <tt>iterator</tt>, and <tt>listIterator</tt> operations run in constant
- * time.  The <tt>add</tt> operation runs in <i>amortized constant time</i>,
+ * <p>The {@code size}, {@code isEmpty}, {@code get}, {@code set},
+ * {@code iterator}, and {@code listIterator} operations run in constant
+ * time.  The {@code add} operation runs in <i>amortized constant time</i>,
  * that is, adding n elements requires O(n) time.  All of the other operations
  * run in linear time (roughly speaking).  The constant factor is low compared
- * to that for the <tt>LinkedList</tt> implementation.
+ * to that for the {@code LinkedList} implementation.
  *
- * <p>Each <tt>ArrayList</tt> instance has a <i>capacity</i>.  The capacity is
+ * <p>Each {@code ArrayList} instance has a <i>capacity</i>.  The capacity is
  * the size of the array used to store the elements in the list.  It is always
  * at least as large as the list size.  As elements are added to an ArrayList,
  * its capacity grows automatically.  The details of the growth policy are not
  * specified beyond the fact that adding an element has constant amortized
  * time cost.
  *
- * <p>An application can increase the capacity of an <tt>ArrayList</tt> instance
- * before adding a large number of elements using the <tt>ensureCapacity</tt>
+ * <p>An application can increase the capacity of an {@code ArrayList} instance
+ * before adding a large number of elements using the {@code ensureCapacity}
  * operation.  This may reduce the amount of incremental reallocation.
  *
  * <p><strong>Note that this implementation is not synchronized.</strong>
- * If multiple threads access an <tt>ArrayList</tt> instance concurrently,
+ * If multiple threads access an {@code ArrayList} instance concurrently,
  * and at least one of the threads modifies the list structurally, it
  * <i>must</i> be synchronized externally.  (A structural modification is
  * any operation that adds or deletes one or more elements, or explicitly
@@ -94,6 +94,8 @@
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
  *
+ * @param <E> the type of elements in this list
+ *
  * @author  Josh Bloch
  * @author  Neal Gafter
  * @see     Collection
@@ -119,10 +121,17 @@
     private static final Object[] EMPTY_ELEMENTDATA = {};
 
     /**
+     * Shared empty array instance used for default sized empty instances. We
+     * distinguish this from EMPTY_ELEMENTDATA to know how much to inflate when
+     * first element is added.
+     */
+    private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};
+
+    /**
      * The array buffer into which the elements of the ArrayList are stored.
      * The capacity of the ArrayList is the length of this array buffer. Any
-     * empty ArrayList with elementData == EMPTY_ELEMENTDATA will be expanded to
-     * DEFAULT_CAPACITY when the first element is added.
+     * empty ArrayList with elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA
+     * will be expanded to DEFAULT_CAPACITY when the first element is added.
      */
     transient Object[] elementData; // non-private to simplify nested class access
 
@@ -141,19 +150,21 @@
      *         is negative
      */
     public ArrayList(int initialCapacity) {
-        super();
-        if (initialCapacity < 0)
+        if (initialCapacity > 0) {
+            this.elementData = new Object[initialCapacity];
+        } else if (initialCapacity == 0) {
+            this.elementData = EMPTY_ELEMENTDATA;
+        } else {
             throw new IllegalArgumentException("Illegal Capacity: "+
                                                initialCapacity);
-        this.elementData = new Object[initialCapacity];
+        }
     }
 
     /**
      * Constructs an empty list with an initial capacity of ten.
      */
     public ArrayList() {
-        super();
-        this.elementData = EMPTY_ELEMENTDATA;
+        this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA;
     }
 
     /**
@@ -166,37 +177,43 @@
      */
     public ArrayList(Collection<? extends E> c) {
         elementData = c.toArray();
-        size = elementData.length;
-        // c.toArray might (incorrectly) not return Object[] (see 6260652)
-        if (elementData.getClass() != Object[].class)
-            elementData = Arrays.copyOf(elementData, size, Object[].class);
+        if ((size = elementData.length) != 0) {
+            // c.toArray might (incorrectly) not return Object[] (see 6260652)
+            if (elementData.getClass() != Object[].class)
+                elementData = Arrays.copyOf(elementData, size, Object[].class);
+        } else {
+            // replace with empty array.
+            this.elementData = EMPTY_ELEMENTDATA;
+        }
     }
 
     /**
-     * Trims the capacity of this <tt>ArrayList</tt> instance to be the
+     * Trims the capacity of this {@code ArrayList} instance to be the
      * list's current size.  An application can use this operation to minimize
-     * the storage of an <tt>ArrayList</tt> instance.
+     * the storage of an {@code ArrayList} instance.
      */
     public void trimToSize() {
         modCount++;
         if (size < elementData.length) {
-            elementData = Arrays.copyOf(elementData, size);
+            elementData = (size == 0)
+              ? EMPTY_ELEMENTDATA
+              : Arrays.copyOf(elementData, size);
         }
     }
 
     /**
-     * Increases the capacity of this <tt>ArrayList</tt> instance, if
+     * Increases the capacity of this {@code ArrayList} instance, if
      * necessary, to ensure that it can hold at least the number of elements
      * specified by the minimum capacity argument.
      *
      * @param   minCapacity   the desired minimum capacity
      */
     public void ensureCapacity(int minCapacity) {
-        int minExpand = (elementData != EMPTY_ELEMENTDATA)
-            // any size if real element table
+        int minExpand = (elementData != DEFAULTCAPACITY_EMPTY_ELEMENTDATA)
+            // any size if not default element table
             ? 0
-            // larger than default for empty table. It's already supposed to be
-            // at default size.
+            // larger than default for default empty table. It's already
+            // supposed to be at default size.
             : DEFAULT_CAPACITY;
 
         if (minCapacity > minExpand) {
@@ -205,7 +222,7 @@
     }
 
     private void ensureCapacityInternal(int minCapacity) {
-        if (elementData == EMPTY_ELEMENTDATA) {
+        if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA) {
             minCapacity = Math.max(DEFAULT_CAPACITY, minCapacity);
         }
 
@@ -264,22 +281,22 @@
     }
 
     /**
-     * Returns <tt>true</tt> if this list contains no elements.
+     * Returns {@code true} if this list contains no elements.
      *
-     * @return <tt>true</tt> if this list contains no elements
+     * @return {@code true} if this list contains no elements
      */
     public boolean isEmpty() {
         return size == 0;
     }
 
     /**
-     * Returns <tt>true</tt> if this list contains the specified element.
-     * More formally, returns <tt>true</tt> if and only if this list contains
-     * at least one element <tt>e</tt> such that
+     * Returns {@code true} if this list contains the specified element.
+     * More formally, returns {@code true} if and only if this list contains
+     * at least one element {@code e} such that
      * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
      *
      * @param o element whose presence in this list is to be tested
-     * @return <tt>true</tt> if this list contains the specified element
+     * @return {@code true} if this list contains the specified element
      */
     public boolean contains(Object o) {
         return indexOf(o) >= 0;
@@ -288,7 +305,7 @@
     /**
      * Returns the index of the first occurrence of the specified element
      * in this list, or -1 if this list does not contain the element.
-     * More formally, returns the lowest index <tt>i</tt> such that
+     * More formally, returns the lowest index {@code i} such that
      * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>,
      * or -1 if there is no such index.
      */
@@ -308,7 +325,7 @@
     /**
      * Returns the index of the last occurrence of the specified element
      * in this list, or -1 if this list does not contain the element.
-     * More formally, returns the highest index <tt>i</tt> such that
+     * More formally, returns the highest index {@code i} such that
      * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>,
      * or -1 if there is no such index.
      */
@@ -326,10 +343,10 @@
     }
 
     /**
-     * Returns a shallow copy of this <tt>ArrayList</tt> instance.  (The
+     * Returns a shallow copy of this {@code ArrayList} instance.  (The
      * elements themselves are not copied.)
      *
-     * @return a clone of this <tt>ArrayList</tt> instance
+     * @return a clone of this {@code ArrayList} instance
      */
     public Object clone() {
         try {
@@ -372,7 +389,7 @@
      * <p>If the list fits in the specified array with room to spare
      * (i.e., the array has more elements than the list), the element in
      * the array immediately following the end of the collection is set to
-     * <tt>null</tt>.  (This is useful in determining the length of the
+     * {@code null}.  (This is useful in determining the length of the
      * list <i>only</i> if the caller knows that the list does not contain
      * any null elements.)
      *
@@ -437,7 +454,7 @@
      * Appends the specified element to the end of this list.
      *
      * @param e element to be appended to this list
-     * @return <tt>true</tt> (as specified by {@link Collection#add})
+     * @return {@code true} (as specified by {@link Collection#add})
      */
     public boolean add(E e) {
         ensureCapacityInternal(size + 1);  // Increments modCount!!
@@ -492,14 +509,14 @@
      * Removes the first occurrence of the specified element from this list,
      * if it is present.  If the list does not contain the element, it is
      * unchanged.  More formally, removes the element with the lowest index
-     * <tt>i</tt> such that
+     * {@code i} such that
      * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>
-     * (if such an element exists).  Returns <tt>true</tt> if this list
+     * (if such an element exists).  Returns {@code true} if this list
      * contained the specified element (or equivalently, if this list
      * changed as a result of the call).
      *
      * @param o element to be removed from this list, if present
-     * @return <tt>true</tt> if this list contained the specified element
+     * @return {@code true} if this list contained the specified element
      */
     public boolean remove(Object o) {
         if (o == null) {
@@ -555,7 +572,7 @@
      * list is nonempty.)
      *
      * @param c collection containing elements to be added to this list
-     * @return <tt>true</tt> if this list changed as a result of the call
+     * @return {@code true} if this list changed as a result of the call
      * @throws NullPointerException if the specified collection is null
      */
     public boolean addAll(Collection<? extends E> c) {
@@ -578,7 +595,7 @@
      * @param index index at which to insert the first element from the
      *              specified collection
      * @param c collection containing elements to be added to this list
-     * @return <tt>true</tt> if this list changed as a result of the call
+     * @return {@code true} if this list changed as a result of the call
      * @throws IndexOutOfBoundsException {@inheritDoc}
      * @throws NullPointerException if the specified collection is null
      */
@@ -736,12 +753,12 @@
     }
 
     /**
-     * Save the state of the <tt>ArrayList</tt> instance to a stream (that
+     * Save the state of the {@code ArrayList} instance to a stream (that
      * is, serialize it).
      *
-     * @serialData The length of the array backing the <tt>ArrayList</tt>
+     * @serialData The length of the array backing the {@code ArrayList}
      *             instance is emitted (int), followed by all of its elements
-     *             (each an <tt>Object</tt>) in the proper order.
+     *             (each an {@code Object}) in the proper order.
      */
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException{
@@ -763,7 +780,7 @@
     }
 
     /**
-     * Reconstitute the <tt>ArrayList</tt> instance from a stream (that is,
+     * Reconstitute the {@code ArrayList} instance from a stream (that is,
      * deserialize it).
      */
     private void readObject(java.io.ObjectInputStream s)
--- a/src/share/classes/java/util/Locale.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/util/Locale.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -3040,6 +3040,7 @@
          *     2616</a>
          * @param map a map containing information to customize language ranges
          * @return a Language Priority List with customization. The list is
+         *     modifiable.
          * @throws NullPointerException if {@code ranges} is null
          * @throws IllegalArgumentException if a language range or a weight
          *     found in the given {@code ranges} is ill-formed
--- a/src/share/classes/java/util/Random.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/util/Random.java	Tue Apr 29 14:40:26 2014 -0700
@@ -874,7 +874,7 @@
      * (inclusive) and one (exclusive).
      *
      * <p>A pseudorandom {@code double} value is generated as if it's the result
-     * of calling the method {@link #nextDouble()}}.
+     * of calling the method {@link #nextDouble()}.
      *
      * @param streamSize the number of values to generate
      * @return a stream of {@code double} values
@@ -897,7 +897,7 @@
      * (exclusive).
      *
      * <p>A pseudorandom {@code double} value is generated as if it's the result
-     * of calling the method {@link #nextDouble()}}.
+     * of calling the method {@link #nextDouble()}.
      *
      * @implNote This method is implemented to be equivalent to {@code
      * doubles(Long.MAX_VALUE)}.
--- a/src/share/classes/java/util/stream/Collectors.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/java/util/stream/Collectors.java	Tue Apr 29 14:40:26 2014 -0700
@@ -120,17 +120,63 @@
     private Collectors() { }
 
     /**
-     * Returns a merge function, suitable for use in
-     * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
-     * {@link #toMap(Function, Function, BinaryOperator) toMap()}, which always
-     * throws {@code IllegalStateException}.  This can be used to enforce the
-     * assumption that the elements being collected are distinct.
+     * Construct an {@code IllegalStateException} with appropriate message.
      *
-     * @param <T> the type of input arguments to the merge function
-     * @return a merge function which always throw {@code IllegalStateException}
+     * @param k the duplicate key
+     * @param u 1st value to be accumulated/merged
+     * @param v 2nd value to be accumulated/merged
      */
-    private static <T> BinaryOperator<T> throwingMerger() {
-        return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); };
+    private static IllegalStateException duplicateKeyException(
+            Object k, Object u, Object v) {
+        return new IllegalStateException(String.format(
+            "Duplicate key %s (attempted merging values %s and %s)",
+            k, u, v));
+    }
+
+    /**
+     * {@code BinaryOperator<Map>} that merges the contents of its right
+     * argument into its left argument, throwing {@code IllegalStateException}
+     * if duplicate keys are encountered.
+     *
+     * @param <K> type of the map keys
+     * @param <V> type of the map values
+     * @param <M> type of the map
+     * @return a merge function for two maps
+     */
+    private static <K, V, M extends Map<K,V>>
+    BinaryOperator<M> uniqKeysMapMerger() {
+        return (m1, m2) -> {
+            for (Map.Entry<K,V> e : m2.entrySet()) {
+                K k = e.getKey();
+                V v = Objects.requireNonNull(e.getValue());
+                V u = m1.putIfAbsent(k, v);
+                if (u != null) throw duplicateKeyException(k, u, v);
+            }
+            return m1;
+        };
+    }
+
+    /**
+     * {@code BiConsumer<Map, T>} that accumulates (key, value) pairs
+     * extracted from elements into the map, throwing {@code IllegalStateException}
+     * if duplicate keys are encountered.
+     *
+     * @param keyMapper a function that maps an element into a key
+     * @param valueMapper a function that maps an element into a value
+     * @param <T> type of elements
+     * @param <K> type of map keys
+     * @param <V> type of map values
+     * @return an accumulating consumer
+     */
+    private static <T, K, V>
+    BiConsumer<Map<K, V>, T> uniqKeysMapAccumulator(Function<? super T, ? extends K> keyMapper,
+                                                    Function<? super T, ? extends V> valueMapper) {
+        return (map, element) -> {
+            K k = keyMapper.apply(element);
+            V v = Objects.requireNonNull(valueMapper.apply(element));
+            V u = map.putIfAbsent(k, v);
+            if (u != null) throw duplicateKeyException(k, u, v);
+        };
     }
 
     @SuppressWarnings("unchecked")
@@ -1209,7 +1255,10 @@
     public static <T, K, U>
     Collector<T, ?, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
                                     Function<? super T, ? extends U> valueMapper) {
-        return toMap(keyMapper, valueMapper, throwingMerger(), HashMap::new);
+        return new CollectorImpl<>(HashMap::new,
+                                   uniqKeysMapAccumulator(keyMapper, valueMapper),
+                                   uniqKeysMapMerger(),
+                                   CH_ID);
     }
 
     /**
@@ -1372,7 +1421,10 @@
     public static <T, K, U>
     Collector<T, ?, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
                                                         Function<? super T, ? extends U> valueMapper) {
-        return toConcurrentMap(keyMapper, valueMapper, throwingMerger(), ConcurrentHashMap::new);
+        return new CollectorImpl<>(ConcurrentHashMap::new,
+                                   uniqKeysMapAccumulator(keyMapper, valueMapper),
+                                   uniqKeysMapMerger(),
+                                   CH_CONCURRENT_ID);
     }
 
     /**
--- a/src/share/classes/sun/net/InetAddressCachePolicy.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/net/InetAddressCachePolicy.java	Tue Apr 29 14:40:26 2014 -0700
@@ -84,19 +84,31 @@
      * Initialize
      */
     static {
-        Integer tmp = null;
 
-        try {
-            tmp = new Integer(
-              java.security.AccessController.doPrivileged (
-                new PrivilegedAction<String>() {
-                  public String run() {
-                      return Security.getProperty(cachePolicyProp);
-                  }
-              }));
-        } catch (NumberFormatException e) {
-            // ignore
-        }
+        Integer tmp = java.security.AccessController.doPrivileged(
+          new PrivilegedAction<Integer>() {
+            public Integer run() {
+                try {
+                    String tmpString = Security.getProperty(cachePolicyProp);
+                    if (tmpString != null) {
+                        return Integer.valueOf(tmpString);
+                    }
+                } catch (NumberFormatException ignored) {
+                    // Ignore
+                }
+
+                try {
+                    String tmpString = System.getProperty(cachePolicyPropFallback);
+                    if (tmpString != null) {
+                        return Integer.decode(tmpString);
+                    }
+                } catch (NumberFormatException ignored) {
+                    // Ignore
+                }
+                return null;
+            }
+          });
+
         if (tmp != null) {
             cachePolicy = tmp.intValue();
             if (cachePolicy < 0) {
@@ -104,35 +116,36 @@
             }
             propertySet = true;
         } else {
-            tmp = java.security.AccessController.doPrivileged
-                (new sun.security.action.GetIntegerAction(cachePolicyPropFallback));
-            if (tmp != null) {
-                cachePolicy = tmp.intValue();
-                if (cachePolicy < 0) {
-                    cachePolicy = FOREVER;
-                }
-                propertySet = true;
-            } else {
-                /* No properties defined for positive caching. If there is no
-                 * security manager then use the default positive cache value.
-                 */
-                if (System.getSecurityManager() == null) {
-                    cachePolicy = DEFAULT_POSITIVE;
-                }
+            /* No properties defined for positive caching. If there is no
+             * security manager then use the default positive cache value.
+             */
+            if (System.getSecurityManager() == null) {
+                cachePolicy = DEFAULT_POSITIVE;
             }
         }
+        tmp = java.security.AccessController.doPrivileged (
+          new PrivilegedAction<Integer>() {
+            public Integer run() {
+                try {
+                    String tmpString = Security.getProperty(negativeCachePolicyProp);
+                    if (tmpString != null) {
+                        return Integer.valueOf(tmpString);
+                    }
+                } catch (NumberFormatException ignored) {
+                    // Ignore
+                }
 
-        try {
-            tmp = new Integer(
-              java.security.AccessController.doPrivileged (
-                new PrivilegedAction<String>() {
-                  public String run() {
-                      return Security.getProperty(negativeCachePolicyProp);
-                  }
-              }));
-        } catch (NumberFormatException e) {
-            // ignore
-        }
+                try {
+                    String tmpString = System.getProperty(negativeCachePolicyPropFallback);
+                    if (tmpString != null) {
+                        return Integer.decode(tmpString);
+                    }
+                } catch (NumberFormatException ignored) {
+                    // Ignore
+                }
+                return null;
+            }
+          });
 
         if (tmp != null) {
             negativeCachePolicy = tmp.intValue();
@@ -140,16 +153,6 @@
                 negativeCachePolicy = FOREVER;
             }
             propertyNegativeSet = true;
-        } else {
-            tmp = java.security.AccessController.doPrivileged
-                (new sun.security.action.GetIntegerAction(negativeCachePolicyPropFallback));
-            if (tmp != null) {
-                negativeCachePolicy = tmp.intValue();
-                if (negativeCachePolicy < 0) {
-                    negativeCachePolicy = FOREVER;
-                }
-                propertyNegativeSet = true;
-            }
         }
     }
 
--- a/src/share/classes/sun/net/ftp/impl/FtpClient.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/net/ftp/impl/FtpClient.java	Tue Apr 29 14:40:26 2014 -0700
@@ -32,6 +32,7 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Base64;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Iterator;
@@ -42,8 +43,6 @@
 import java.util.regex.Pattern;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
 import sun.net.ftp.*;
 import sun.util.logging.PlatformLogger;
 
@@ -1899,22 +1898,16 @@
     }
 
     private boolean sendSecurityData(byte[] buf) throws IOException {
-        BASE64Encoder encoder = new BASE64Encoder();
-        String s = encoder.encode(buf);
+        String s = Base64.getMimeEncoder().encodeToString(buf);
         return issueCommand("ADAT " + s);
     }
 
     private byte[] getSecurityData() {
         String s = getLastResponseString();
         if (s.substring(4, 9).equalsIgnoreCase("ADAT=")) {
-            BASE64Decoder decoder = new BASE64Decoder();
-            try {
-                // Need to get rid of the leading '315 ADAT='
-                // and the trailing newline
-                return decoder.decodeBuffer(s.substring(9, s.length() - 1));
-            } catch (IOException e) {
-                //
-            }
+            // Need to get rid of the leading '315 ADAT='
+            // and the trailing newline
+            return Base64.getMimeDecoder().decode(s.substring(9, s.length() - 1));
         }
         return null;
     }
--- a/src/share/classes/sun/net/util/IPAddressUtil.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/net/util/IPAddressUtil.java	Tue Apr 29 14:40:26 2014 -0700
@@ -37,89 +37,72 @@
      * @param src a String representing an IPv4 address in standard format
      * @return a byte array representing the IPv4 numeric address
      */
+    @SuppressWarnings("fallthrough")
     public static byte[] textToNumericFormatV4(String src)
     {
-        if (src.length() == 0) {
+        byte[] res = new byte[INADDR4SZ];
+
+        long tmpValue = 0;
+        int currByte = 0;
+
+        int len = src.length();
+        if (len == 0 || len > 15) {
             return null;
         }
-
-        byte[] res = new byte[INADDR4SZ];
-        String[] s = src.split("\\.", -1);
-        long val;
-        try {
-            switch(s.length) {
+        /*
+         * When only one part is given, the value is stored directly in
+         * the network address without any byte rearrangement.
+         *
+         * When a two part address is supplied, the last part is
+         * interpreted as a 24-bit quantity and placed in the right
+         * most three bytes of the network address. This makes the
+         * two part address format convenient for specifying Class A
+         * network addresses as net.host.
+         *
+         * When a three part address is specified, the last part is
+         * interpreted as a 16-bit quantity and placed in the right
+         * most two bytes of the network address. This makes the
+         * three part address format convenient for specifying
+         * Class B net- work addresses as 128.net.host.
+         *
+         * When four parts are specified, each is interpreted as a
+         * byte of data and assigned, from left to right, to the
+         * four bytes of an IPv4 address.
+         *
+         * We determine and parse the leading parts, if any, as single
+         * byte values in one pass directly into the resulting byte[],
+         * then the remainder is treated as a 8-to-32-bit entity and
+         * translated into the remaining bytes in the array.
+         */
+        for (int i = 0; i < len; i++) {
+            char c = src.charAt(i);
+            if (c == '.') {
+                if (tmpValue < 0 || tmpValue > 0xff || currByte == 3) {
+                    return null;
+                }
+                res[currByte++] = (byte) (tmpValue & 0xff);
+                tmpValue = 0;
+            } else {
+                int digit = Character.digit(c, 10);
+                if (digit < 0) {
+                    return null;
+                }
+                tmpValue *= 10;
+                tmpValue += digit;
+            }
+        }
+        if (tmpValue < 0 || tmpValue >= (1L << ((4 - currByte) * 8))) {
+            return null;
+        }
+        switch (currByte) {
+            case 0:
+                res[0] = (byte) ((tmpValue >> 24) & 0xff);
             case 1:
-                /*
-                 * When only one part is given, the value is stored directly in
-                 * the network address without any byte rearrangement.
-                 */
-
-                val = Long.parseLong(s[0]);
-                if (val < 0 || val > 0xffffffffL)
-                    return null;
-                res[0] = (byte) ((val >> 24) & 0xff);
-                res[1] = (byte) (((val & 0xffffff) >> 16) & 0xff);
-                res[2] = (byte) (((val & 0xffff) >> 8) & 0xff);
-                res[3] = (byte) (val & 0xff);
-                break;
+                res[1] = (byte) ((tmpValue >> 16) & 0xff);
             case 2:
-                /*
-                 * When a two part address is supplied, the last part is
-                 * interpreted as a 24-bit quantity and placed in the right
-                 * most three bytes of the network address. This makes the
-                 * two part address format convenient for specifying Class A
-                 * network addresses as net.host.
-                 */
-
-                val = Integer.parseInt(s[0]);
-                if (val < 0 || val > 0xff)
-                    return null;
-                res[0] = (byte) (val & 0xff);
-                val = Integer.parseInt(s[1]);
-                if (val < 0 || val > 0xffffff)
-                    return null;
-                res[1] = (byte) ((val >> 16) & 0xff);
-                res[2] = (byte) (((val & 0xffff) >> 8) &0xff);
-                res[3] = (byte) (val & 0xff);
-                break;
+                res[2] = (byte) ((tmpValue >>  8) & 0xff);
             case 3:
-                /*
-                 * When a three part address is specified, the last part is
-                 * interpreted as a 16-bit quantity and placed in the right
-                 * most two bytes of the network address. This makes the
-                 * three part address format convenient for specifying
-                 * Class B net- work addresses as 128.net.host.
-                 */
-                for (int i = 0; i < 2; i++) {
-                    val = Integer.parseInt(s[i]);
-                    if (val < 0 || val > 0xff)
-                        return null;
-                    res[i] = (byte) (val & 0xff);
-                }
-                val = Integer.parseInt(s[2]);
-                if (val < 0 || val > 0xffff)
-                    return null;
-                res[2] = (byte) ((val >> 8) & 0xff);
-                res[3] = (byte) (val & 0xff);
-                break;
-            case 4:
-                /*
-                 * When four parts are specified, each is interpreted as a
-                 * byte of data and assigned, from left to right, to the
-                 * four bytes of an IPv4 address.
-                 */
-                for (int i = 0; i < 4; i++) {
-                    val = Integer.parseInt(s[i]);
-                    if (val < 0 || val > 0xff)
-                        return null;
-                    res[i] = (byte) (val & 0xff);
-                }
-                break;
-            default:
-                return null;
-            }
-        } catch(NumberFormatException e) {
-            return null;
+                res[3] = (byte) ((tmpValue >>  0) & 0xff);
         }
         return res;
     }
--- a/src/share/classes/sun/net/www/http/HttpClient.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/net/www/http/HttpClient.java	Tue Apr 29 14:40:26 2014 -0700
@@ -665,7 +665,9 @@
                     // try once more
                     openServer();
                     if (needsTunneling()) {
+                        MessageHeader origRequests = requests;
                         httpuc.doTunneling();
+                        requests = origRequests;
                     }
                     afterConnect();
                     writeRequests(requests, poster);
@@ -776,7 +778,9 @@
                         cachedHttpClient = false;
                         openServer();
                         if (needsTunneling()) {
+                            MessageHeader origRequests = requests;
                             httpuc.doTunneling();
+                            requests = origRequests;
                         }
                         afterConnect();
                         writeRequests(requests, poster);
--- a/src/share/classes/sun/security/pkcs/PKCS7.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/security/pkcs/PKCS7.java	Tue Apr 29 14:40:26 2014 -0700
@@ -802,7 +802,8 @@
                                             byte[] content,
                                             String signatureAlgorithm,
                                             URI tsaURI,
-                                            String tSAPolicyID)
+                                            String tSAPolicyID,
+                                            String tSADigestAlg)
         throws CertificateException, IOException, NoSuchAlgorithmException
     {
 
@@ -811,7 +812,8 @@
         if (tsaURI != null) {
             // Timestamp the signature
             HttpTimestamper tsa = new HttpTimestamper(tsaURI);
-            byte[] tsToken = generateTimestampToken(tsa, tSAPolicyID, signature);
+            byte[] tsToken = generateTimestampToken(
+                    tsa, tSAPolicyID, tSADigestAlg, signature);
 
             // Insert the timestamp token into the PKCS #7 signer info element
             // (as an unsigned attribute)
@@ -869,6 +871,7 @@
      */
     private static byte[] generateTimestampToken(Timestamper tsa,
                                                  String tSAPolicyID,
+                                                 String tSADigestAlg,
                                                  byte[] toBeTimestamped)
         throws IOException, CertificateException
     {
@@ -876,11 +879,10 @@
         MessageDigest messageDigest = null;
         TSRequest tsQuery = null;
         try {
-            // SHA-1 is always used.
-            messageDigest = MessageDigest.getInstance("SHA-1");
+            messageDigest = MessageDigest.getInstance(tSADigestAlg);
             tsQuery = new TSRequest(tSAPolicyID, toBeTimestamped, messageDigest);
         } catch (NoSuchAlgorithmException e) {
-            // ignore
+            throw new IllegalArgumentException(e);
         }
 
         // Generate a nonce
@@ -908,9 +910,13 @@
         PKCS7 tsToken = tsReply.getToken();
 
         TimestampToken tst = tsReply.getTimestampToken();
-        if (!tst.getHashAlgorithm().getName().equals("SHA-1")) {
-            throw new IOException("Digest algorithm not SHA-1 in "
-                                  + "timestamp token");
+        try {
+            if (!tst.getHashAlgorithm().equals(AlgorithmId.get(tSADigestAlg))) {
+                throw new IOException("Digest algorithm not " + tSADigestAlg + " in "
+                                      + "timestamp token");
+            }
+        } catch (NoSuchAlgorithmException nase) {
+            throw new IllegalArgumentException();   // should have been caught before
         }
         if (!MessageDigest.isEqual(tst.getHashedMessage(),
                                    tsQuery.getHashedMessage())) {
--- a/src/share/classes/sun/security/tools/jarsigner/Main.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/security/tools/jarsigner/Main.java	Tue Apr 29 14:40:26 2014 -0700
@@ -139,6 +139,7 @@
     String tsaAlias; // alias for the Timestamping Authority's certificate
     String altCertChain; // file to read alternative cert chain from
     String tSAPolicyID;
+    String tSADigestAlg = "SHA-256";
     boolean verify = false; // verify the jar
     String verbose = null; // verbose output when signing/verifying
     boolean showcerts = false; // show certs when verifying
@@ -342,6 +343,9 @@
             } else if (collator.compare(flags, "-tsapolicyid") ==0) {
                 if (++n == args.length) usageNoArg();
                 tSAPolicyID = args[n];
+            } else if (collator.compare(flags, "-tsadigestalg") ==0) {
+                if (++n == args.length) usageNoArg();
+                tSADigestAlg = args[n];
             } else if (collator.compare(flags, "-debug") ==0) {
                 debug = true;
             } else if (collator.compare(flags, "-keypass") ==0) {
@@ -536,6 +540,9 @@
                 (".tsapolicyid.tsapolicyid.for.Timestamping.Authority"));
         System.out.println();
         System.out.println(rb.getString
+                (".tsadigestalg.algorithm.of.digest.data.in.timestamping.request"));
+        System.out.println();
+        System.out.println(rb.getString
                 (".altsigner.class.class.name.of.an.alternative.signing.mechanism"));
         System.out.println();
         System.out.println(rb.getString
@@ -1270,8 +1277,8 @@
             try {
                 block =
                     sf.generateBlock(privateKey, sigalg, certChain,
-                        externalSF, tsaUrl, tsaCert, tSAPolicyID, signingMechanism, args,
-                        zipFile);
+                        externalSF, tsaUrl, tsaCert, tSAPolicyID, tSADigestAlg,
+                        signingMechanism, args, zipFile);
             } catch (SocketTimeoutException e) {
                 // Provide a helpful message when TSA is beyond a firewall
                 error(rb.getString("unable.to.sign.jar.") +
@@ -2254,13 +2261,14 @@
                                boolean externalSF, String tsaUrl,
                                X509Certificate tsaCert,
                                String tSAPolicyID,
+                               String tSADigestAlg,
                                ContentSigner signingMechanism,
                                String[] args, ZipFile zipFile)
         throws NoSuchAlgorithmException, InvalidKeyException, IOException,
             SignatureException, CertificateException
     {
         return new Block(this, privateKey, sigalg, certChain, externalSF,
-                tsaUrl, tsaCert, tSAPolicyID, signingMechanism, args, zipFile);
+                tsaUrl, tsaCert, tSAPolicyID, tSADigestAlg, signingMechanism, args, zipFile);
     }
 
 
@@ -2274,8 +2282,8 @@
          */
         Block(SignatureFile sfg, PrivateKey privateKey, String sigalg,
             X509Certificate[] certChain, boolean externalSF, String tsaUrl,
-            X509Certificate tsaCert, String tSAPolicyID, ContentSigner signingMechanism,
-            String[] args, ZipFile zipFile)
+            X509Certificate tsaCert, String tSAPolicyID, String tSADigestAlg,
+            ContentSigner signingMechanism, String[] args, ZipFile zipFile)
             throws NoSuchAlgorithmException, InvalidKeyException, IOException,
             SignatureException, CertificateException {
 
@@ -2357,7 +2365,8 @@
 
             // Assemble parameters for the signing mechanism
             ContentSignerParameters params =
-                new JarSignerParameters(args, tsaUri, tsaCert, tSAPolicyID, signature,
+                new JarSignerParameters(args, tsaUri, tsaCert, tSAPolicyID,
+                        tSADigestAlg, signature,
                     signatureAlgorithm, certChain, content, zipFile);
 
             // Generate the signature block
@@ -2402,24 +2411,26 @@
     private byte[] content;
     private ZipFile source;
     private String tSAPolicyID;
+    private String tSADigestAlg;
 
     /**
      * Create a new object.
      */
     JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
-        String tSAPolicyID,
+        String tSAPolicyID, String tSADigestAlg,
         byte[] signature, String signatureAlgorithm,
         X509Certificate[] signerCertificateChain, byte[] content,
         ZipFile source) {
 
         if (signature == null || signatureAlgorithm == null ||
-            signerCertificateChain == null) {
+            signerCertificateChain == null || tSADigestAlg == null) {
             throw new NullPointerException();
         }
         this.args = args;
         this.tsa = tsa;
         this.tsaCertificate = tsaCertificate;
         this.tSAPolicyID = tSAPolicyID;
+        this.tSADigestAlg = tSADigestAlg;
         this.signature = signature;
         this.signatureAlgorithm = signatureAlgorithm;
         this.signerCertificateChain = signerCertificateChain;
@@ -2458,6 +2469,10 @@
         return tSAPolicyID;
     }
 
+    public String getTSADigestAlg() {
+        return tSADigestAlg;
+    }
+
     /**
      * Retrieves the signature.
      *
--- a/src/share/classes/sun/security/tools/jarsigner/Resources.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/security/tools/jarsigner/Resources.java	Tue Apr 29 14:40:26 2014 -0700
@@ -88,6 +88,8 @@
                 "[-tsacert <alias>]          public key certificate for Timestamping Authority"},
         {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
                 "[-tsapolicyid <oid>]        TSAPolicyID for Timestamping Authority"},
+        {".tsadigestalg.algorithm.of.digest.data.in.timestamping.request",
+                "[-tsadigestalg <algorithm>] algorithm of digest data in timestamping request"},
         {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
                 "[-altsigner <class>]        class name of an alternative signing mechanism"},
         {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
--- a/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Tue Apr 29 14:40:26 2014 -0700
@@ -134,7 +134,8 @@
         }
         return PKCS7.generateSignedData(signature, signerChain, content,
                                         params.getSignatureAlgorithm(), tsaURI,
-                                        params.getTSAPolicyID());
+                                        params.getTSAPolicyID(),
+                                        params.getTSADigestAlg());
     }
 
     /**
--- a/src/share/classes/sun/tools/jinfo/JInfo.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/share/classes/sun/tools/jinfo/JInfo.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -39,42 +39,73 @@
  * and decides if the command should be satisfied using the VM attach mechanism
  * or an SA tool.
  */
-public class JInfo {
+final public class JInfo {
+    private boolean useSA = false;
+    private String[] args = null;
 
-    @SuppressWarnings("fallthrough")
-    public static void main(String[] args) throws Exception {
+    private JInfo(String[] args) throws IllegalArgumentException {
         if (args.length == 0) {
-            usage(1); // no arguments
+            throw new IllegalArgumentException();
         }
 
+        int argCopyIndex = 0;
         // First determine if we should launch SA or not
-        boolean useSA = false;
         if (args[0].equals("-F")) {
             // delete the -F
-            args = Arrays.copyOfRange(args, 1, args.length);
+            argCopyIndex = 1;
             useSA = true;
         } else if (args[0].equals("-flags")
-            || args[0].equals("-sysprops"))
+                   || args[0].equals("-sysprops"))
         {
             if (args.length == 2) {
-                if (!args[1].matches("[0-9]+")) {
+                if (!isPid(args[1])) {
                     // If args[1] doesn't parse to a number then
                     // it must be the SA debug server
                     // (otherwise it is the pid)
                     useSA = true;
                 }
-            }
-            if (args.length == 3) {
+            } else if (args.length == 3) {
                 // arguments include an executable and a core file
                 useSA = true;
+            } else {
+                throw new IllegalArgumentException();
             }
         } else if (!args[0].startsWith("-")) {
             if (args.length == 2) {
                 // the only arguments are an executable and a core file
                 useSA = true;
+            } else if (args.length == 1) {
+                if (!isPid(args[0])) {
+                    // The only argument is not a PID; it must be SA debug
+                    // server
+                    useSA = true;
+                }
+            } else {
+                throw new IllegalArgumentException();
             }
-        } else if (args[0].equals("-h")
-                || args[0].equals("-help")) {
+        } else if (args[0].equals("-h") || args[0].equals("-help")) {
+            if (args.length > 1) {
+                throw new IllegalArgumentException();
+            }
+        } else if (args[0].equals("-flag")) {
+            if (args.length == 3) {
+                if (!isPid(args[2])) {
+                    throw new IllegalArgumentException();
+                }
+            } else {
+                throw new IllegalArgumentException();
+            }
+        } else {
+            throw new IllegalArgumentException();
+        }
+
+        this.args = Arrays.copyOfRange(args, argCopyIndex, args.length);
+    }
+
+    @SuppressWarnings("fallthrough")
+    private void execute() throws Exception {
+        if (args[0].equals("-h")
+            || args[0].equals("-help")) {
             usage(0);
         }
 
@@ -87,55 +118,69 @@
             }
 
             // invoke SA which does it's own argument parsing
-            runTool(args);
+            runTool();
 
         } else {
             // Now we can parse arguments for the non-SA case
             String pid = null;
 
             switch(args[0]) {
-            case "-flag":
-                if (args.length != 3) {
-                    usage(1);
-                }
-                String option = args[1];
-                pid = args[2];
-                flag(pid, option);
-                break;
-            case "-flags":
-                if (args.length != 2) {
-                    usage(1);
-                }
-                pid = args[1];
-                flags(pid);
-                break;
-            case "-sysprops":
-                if (args.length != 2) {
-                    usage(1);
-                }
-                pid = args[1];
-                sysprops(pid);
-                break;
-            case "-help":
-            case "-h":
-                usage(0);
-                // Fall through
-            default:
-               if (args.length == 1) {
-                   // no flags specified, we do -sysprops and -flags
-                   pid = args[0];
-                   sysprops(pid);
-                   System.out.println();
-                   flags(pid);
-               } else {
-                   usage(1);
-               }
+                case "-flag":
+                    if (args.length != 3) {
+                        usage(1);
+                    }
+                    String option = args[1];
+                    pid = args[2];
+                    flag(pid, option);
+                    break;
+                case "-flags":
+                    if (args.length != 2) {
+                        usage(1);
+                    }
+                    pid = args[1];
+                    flags(pid);
+                    break;
+                case "-sysprops":
+                    if (args.length != 2) {
+                        usage(1);
+                    }
+                    pid = args[1];
+                    sysprops(pid);
+                    break;
+                case "-help":
+                case "-h":
+                    usage(0);
+                    // Fall through
+                default:
+                    if (args.length == 1) {
+                        // no flags specified, we do -sysprops and -flags
+                        pid = args[0];
+                        sysprops(pid);
+                        System.out.println();
+                        flags(pid);
+                    } else {
+                        usage(1);
+                    }
             }
         }
     }
 
+    public static void main(String[] args) throws Exception {
+        JInfo jinfo = null;
+        try {
+            jinfo = new JInfo(args);
+            jinfo.execute();
+        } catch (IllegalArgumentException e) {
+            usage(1);
+        }
+    }
+
+    private static boolean isPid(String arg) {
+        return arg.matches("[0-9]+");
+    }
+
     // Invoke SA tool with the given arguments
-    private static void runTool(String args[]) throws Exception {
+    private void runTool() throws Exception {
         String tool = "sun.jvm.hotspot.tools.JInfo";
         // Tool not available on this platform.
         Class<?> c = loadClass(tool);
--- a/src/solaris/classes/java/net/PlainDatagramSocketImpl.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/solaris/classes/java/net/PlainDatagramSocketImpl.java	Tue Apr 29 14:40:26 2014 -0700
@@ -56,6 +56,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
             return super.getOption(name);
@@ -70,7 +71,7 @@
     }
 
     protected Set<SocketOption<?>> supportedOptions() {
-        HashSet<SocketOption<?>> options = new HashSet(
+        HashSet<SocketOption<?>> options = new HashSet<>(
             super.supportedOptions());
 
         if (flowSupported()) {
--- a/src/solaris/classes/java/net/PlainSocketImpl.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/solaris/classes/java/net/PlainSocketImpl.java	Tue Apr 29 14:40:26 2014 -0700
@@ -70,6 +70,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     protected <T> T getOption(SocketOption<T> name) throws IOException {
         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
             return super.getOption(name);
@@ -84,7 +85,7 @@
     }
 
     protected Set<SocketOption<?>> supportedOptions() {
-        HashSet<SocketOption<?>> options = new HashSet(
+        HashSet<SocketOption<?>> options = new HashSet<>(
             super.supportedOptions());
 
         if (getSocket() != null && flowSupported()) {
--- a/src/windows/classes/sun/nio/fs/WindowsConstants.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/windows/classes/sun/nio/fs/WindowsConstants.java	Tue Apr 29 14:40:26 2014 -0700
@@ -98,6 +98,7 @@
     public static final int ERROR_DISK_FULL             = 112;
     public static final int ERROR_INSUFFICIENT_BUFFER   = 122;
     public static final int ERROR_INVALID_LEVEL         = 124;
+    public static final int ERROR_DIR_NOT_ROOT          = 144;
     public static final int ERROR_DIR_NOT_EMPTY         = 145;
     public static final int ERROR_ALREADY_EXISTS        = 183;
     public static final int ERROR_MORE_DATA             = 234;
--- a/src/windows/classes/sun/nio/fs/WindowsFileStore.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/windows/classes/sun/nio/fs/WindowsFileStore.java	Tue Apr 29 14:40:26 2014 -0700
@@ -86,14 +86,28 @@
                 WindowsFileAttributes.get(file, true);
                 target = file.getPathForWin32Calls();
             }
-            String root = GetVolumePathName(target);
-            return new WindowsFileStore(root);
+            try {
+                return createFromPath(target);
+            } catch (WindowsException e) {
+                if (e.lastError() != ERROR_DIR_NOT_ROOT)
+                    throw e;
+                target = WindowsLinkSupport.getFinalPath(file);
+                if (target == null)
+                    throw new FileSystemException(file.getPathForExceptionMessage(),
+                            null, "Couldn't resolve path");
+                return createFromPath(target);
+            }
         } catch (WindowsException x) {
             x.rethrowAsIOException(file);
             return null; // keep compiler happy
         }
     }
 
+    private static WindowsFileStore createFromPath(String target) throws WindowsException {
+        String root = GetVolumePathName(target);
+        return new WindowsFileStore(root);
+    }
+
     VolumeInformation volumeInformation() {
         return volInfo;
     }
--- a/src/windows/classes/sun/nio/fs/WindowsLinkSupport.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/windows/classes/sun/nio/fs/WindowsLinkSupport.java	Tue Apr 29 14:40:26 2014 -0700
@@ -66,7 +66,7 @@
      * Returns the final path (all symbolic links resolved) or null if this
      * operation is not supported.
      */
-    private static String getFinalPath(WindowsPath input) throws IOException {
+    static String getFinalPath(WindowsPath input) throws IOException {
         long h = 0;
         try {
             h = input.openForReadAttributeAccess(true);
--- a/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Tue Apr 29 15:46:16 2014 -0400
+++ b/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Tue Apr 29 14:40:26 2014 -0700
@@ -235,7 +235,7 @@
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
-    return (*env)->NewString(env, pattern, wcslen(pattern));
+    return (*env)->NewString(env, pattern, (jsize)wcslen(pattern));
 }
 
 /*
@@ -263,6 +263,7 @@
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray ampms) {
     WCHAR buf[BUFLEN];
     const jchar *langtag;
+    jstring tmp_string;
 
     // AM
     int got;
@@ -270,13 +271,21 @@
     CHECK_NULL_RETURN(langtag, NULL);
     got = getLocaleInfoWrapper(langtag, LOCALE_S1159, buf, BUFLEN);
     if (got) {
-        (*env)->SetObjectArrayElement(env, ampms, 0, (*env)->NewString(env, buf, wcslen(buf)));
+        tmp_string = (*env)->NewString(env, buf, (jsize)wcslen(buf));
+        if (tmp_string != NULL) {
+            (*env)->SetObjectArrayElement(env, ampms, 0, tmp_string);
+        }
     }
 
-    // PM
-    got = getLocaleInfoWrapper(langtag, LOCALE_S2359, buf, BUFLEN);
-    if (got) {
-        (*env)->SetObjectArrayElement(env, ampms, 1, (*env)->NewString(env, buf, wcslen(buf)));
+    if (!(*env)->ExceptionCheck(env)){
+        // PM
+        got = getLocaleInfoWrapper(langtag, LOCALE_S2359, buf, BUFLEN);
+        if (got) {
+            tmp_string = (*env)->NewString(env, buf, (jsize)wcslen(buf));
+            if (tmp_string != NULL) {
+                (*env)->SetObjectArrayElement(env, ampms, 1, tmp_string);
+            }
+        }
     }
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
@@ -293,13 +302,17 @@
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray eras) {
     WCHAR ad[BUFLEN];
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    jstring tmp_string;
     CHECK_NULL_RETURN(langtag, eras);
 
     getCalendarInfoWrapper(langtag, getCalendarID(langtag), NULL,
                       CAL_SERASTRING, ad, BUFLEN, NULL);
 
     // Windows does not provide B.C. era.
-    (*env)->SetObjectArrayElement(env, eras, 1, (*env)->NewString(env, ad, wcslen(ad)));
+    tmp_string = (*env)->NewString(env, ad, (jsize)wcslen(ad));
+    if (tmp_string != NULL) {
+        (*env)->SetObjectArrayElement(env, eras, 1, tmp_string);
+    }
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
@@ -371,7 +384,7 @@
     CHECK_NULL_RETURN(pattern, NULL);
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
-    ret = (*env)->NewString(env, pattern, wcslen(pattern));
+    ret = (*env)->NewString(env, pattern, (jsize)wcslen(pattern));
     free(pattern);
 
     return ret;
@@ -411,7 +424,7 @@
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return currencySymbol;
     }
@@ -474,7 +487,7 @@
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return infinity;
     }
@@ -495,7 +508,7 @@
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return internationalCurrencySymbol;
     }
@@ -558,7 +571,7 @@
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return nan;
     }
@@ -701,7 +714,7 @@
     (*env)->ReleaseStringChars(env, jStr, pjChar);
 
     if (got) {
-        return (*env)->NewString(env, buf, wcslen(buf));
+        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
     } else {
         return NULL;
     }
@@ -754,9 +767,10 @@
 
 void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jobjectArray jarray, CALTYPE* pCalTypes, int offset, int length) {
     WCHAR name[BUFLEN];
-    const jchar *langtag;
+    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
     int calid;
-    langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    jstring tmp_string;
+
     CHECK_NULL(langtag);
     calid = getCalendarID(langtag);
 
@@ -765,8 +779,10 @@
         for (i = 0; i < length; i++) {
             getCalendarInfoWrapper(langtag, calid, NULL,
                               pCalTypes[i], name, BUFLEN, NULL);
-            (*env)->SetObjectArrayElement(env, jarray, i + offset,
-                          (*env)->NewString(env, name, wcslen(name)));
+            tmp_string = (*env)->NewString(env, name, (jsize)wcslen(name));
+            if (tmp_string != NULL) {
+                (*env)->SetObjectArrayElement(env, jarray, i + offset, tmp_string);
+            }
         }
     }
 
--- a/test/ProblemList.txt	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/ProblemList.txt	Tue Apr 29 14:40:26 2014 -0700
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 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
@@ -120,9 +120,6 @@
 
 # jdk_lang
 
-# 8029415
-java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java generic-all
-
 ############################################################################
 
 # jdk_management
@@ -151,9 +148,6 @@
 
 # jdk_net
 
-# Filed 7052625
-com/sun/net/httpserver/bugs/6725892/Test.java                   generic-all
-
 # 7148829
 sun/net/InetAddress/nameservice/simple/CacheTest.java		generic-all
 sun/net/InetAddress/nameservice/simple/DefaultCaching.java	generic-all
--- a/test/TEST.groups	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/TEST.groups	Tue Apr 29 14:40:26 2014 -0700
@@ -194,7 +194,7 @@
     com/sun/jndi \
     com/sun/corba \
     lib/testlibrary \
-    demo/zipfs \
+    jdk/nio/zipfs \
     sample
 
 #
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jarsigner/DefaultMethod.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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 8039358
+ * @summary com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID() should be default
+ * @compile DefaultMethod.java
+ */
+
+import com.sun.jarsigner.ContentSignerParameters;
+
+import java.net.URI;
+import java.security.cert.X509Certificate;
+import java.util.zip.ZipFile;
+
+public class DefaultMethod implements ContentSignerParameters {
+
+    @Override
+    public String[] getCommandLine() {
+        return new String[0];
+    }
+
+    @Override
+    public URI getTimestampingAuthority() {
+        return null;
+    }
+
+    @Override
+    public X509Certificate getTimestampingAuthorityCertificate() {
+        return null;
+    }
+
+    @Override
+    public byte[] getSignature() {
+        return new byte[0];
+    }
+
+    @Override
+    public String getSignatureAlgorithm() {
+        return null;
+    }
+
+    @Override
+    public X509Certificate[] getSignerCertificateChain() {
+        return new X509Certificate[0];
+    }
+
+    @Override
+    public byte[] getContent() {
+        return new byte[0];
+    }
+
+    @Override
+    public ZipFile getSource() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jndi/ldap/Base64Test.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,214 @@
+/*
+ * 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 8035807
+ * @summary Confirm that old and new Base64 encodings are compatible.
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.naming.directory.*;
+
+import sun.misc.BASE64Decoder;
+
+/*
+ * RFC 2713 specifies an encoding for Java objects stored in an LDAP directory.
+ * Section 3.6 specifies how a binary-valued JNDI RefAddr object is encoded
+ * in the value of a javaReferenceAttribute LDAP attribute: first the RefAddr
+ * object is serialized and then it is encoded using Base64.
+ *
+ * Since JDK 9, the JNDI/LDAP provider uses the public Base64 encoder which
+ * adheres strictly to the MIME encoding rules. The encoder inserts '\r\n'
+ * as the line separator at intervals of 76 characters. Previously the
+ * JNDI/LDAP provider used a private Base64 encoder which inserted '\n'
+ * as the line separator. It is a compatible change.
+ *
+ * This test demonstrates that there is no compatability problem when
+ * encoding and decoding using either Base64 coder:
+ *
+ *   encode with s.m.BASE64Encoder,  decode with s.m.BASE64Decoder  => OK
+ *   encode with s.m.BASE64Encoder,  decode with j.u.Base64.Decoder => OK
+ *   encode with j.u.Base64.Encoder, decode with s.m.BASE64Decoder  => OK
+ *   encode with j.u.Base64.Encoder, decode with j.u.Base64.Decoder => OK
+ *
+ *
+ * NOTE: The two Base64 encodings used in this test were captured from
+ *       LDAP protocol exchanges during attempts by the JNDI/LDAP provider
+ *       to store a JNDI Reference test object.
+ */
+
+public class Base64Test {
+    /*
+     * The old Base64 encoding uses '\n' as the line separator at 76 character
+     * intervals:
+     *
+     * 0000: 72 4F 30 41 42 58 4E 79 41 42 70 71 59 58 5A 68  rO0ABXNyABpqYXZh
+     * 0010: 65 43 35 75 59 57 31 70 62 6D 63 75 51 6D 6C 75  eC5uYW1pbmcuQmlu
+     * 0020: 59 58 4A 35 55 6D 56 6D 51 57 52 6B 63 74 43 61  YXJ5UmVmQWRkctCa
+     * 0030: 6B 37 4C 65 73 34 68 48 41 67 41 42 57 77 41 44  k7Les4hHAgABWwAD
+     * 0040: 59 6E 56 6D 64 41 41 43 57 30 4A 34 0A 63 67 41  YnVmdAACW0J4.cgA <
+     * 0050: 55 61 6D 46 32 59 58 67 75 62 6D 46 74 61 57 35  UamF2YXgubmFtaW5
+     * 0060: 6E 4C 6C 4A 6C 5A 6B 46 6B 5A 48 4C 72 6F 41 65  nLlJlZkFkZHLroAe
+     * 0070: 61 41 6A 69 76 53 67 49 41 41 55 77 41 43 47 46  aAjivSgIAAUwACGF
+     * 0080: 6B 5A 48 4A 55 65 58 42 6C 64 41 41 53 54 47 70  kZHJUeXBldAASTGp
+     * 0090: 68 64 6D 45 76 62 47 46 75 0A 5A 79 39 54 64 48  hdmEvbGFu.Zy9TdH <
+     * 00A0: 4A 70 62 6D 63 37 65 48 42 30 41 41 52 30 5A 58  Jpbmc7eHB0AAR0ZX
+     * 00B0: 4E 30 64 58 49 41 41 6C 74 43 72 50 4D 58 2B 41  N0dXIAAltCrPMX+A
+     * 00C0: 59 49 56 4F 41 43 41 41 42 34 63 41 41 41 41 49  YIVOACAAB4cAAAAI
+     * 00D0: 41 41 41 51 49 44 42 41 55 47 42 77 67 4A 43 67  AAAQIDBAUGBwgJCg
+     * 00E0: 73 4D 44 51 34 50 0A 45 42 45 53 45 78 51 56 46  sMDQ4P.EBESExQVF <
+     * 00F0: 68 63 59 47 52 6F 62 48 42 30 65 48 79 41 68 49  hcYGRobHB0eHyAhI
+     * 0100: 69 4D 6B 4A 53 59 6E 4B 43 6B 71 4B 79 77 74 4C  iMkJSYnKCkqKywtL
+     * 0110: 69 38 77 4D 54 49 7A 4E 44 55 32 4E 7A 67 35 4F  i8wMTIzNDU2Nzg5O
+     * 0120: 6A 73 38 50 54 34 2F 51 45 46 43 51 30 52 46 52  js8PT4/QEFCQ0RFR
+     * 0130: 6B 64 49 0A 53 55 70 4C 54 45 31 4F 54 31 42 52  kdI.SUpLTE1OT1BR <
+     * 0140: 55 6C 4E 55 56 56 5A 58 57 46 6C 61 57 31 78 64  UlNUVVZXWFlaW1xd
+     * 0150: 58 6C 39 67 59 57 4A 6A 5A 47 56 6D 5A 32 68 70  Xl9gYWJjZGVmZ2hp
+     * 0160: 61 6D 74 73 62 57 35 76 63 48 46 79 63 33 52 31  amtsbW5vcHFyc3R1
+     * 0170: 64 6E 64 34 65 58 70 37 66 48 31 2B 66 77 3D 3D  dnd4eXp7fH1+fw==
+     * 0180: 0A                                                                <
+     */
+    private static final String OLD_ENCODING = "rO0ABXNyABpqYXZheC5uYW1pbmcuQmluYXJ5UmVmQWRkctCak7Les4hHAgABWwADYnVmdAACW0J4\ncgAUamF2YXgubmFtaW5nLlJlZkFkZHLroAeaAjivSgIAAUwACGFkZHJUeXBldAASTGphdmEvbGFu\nZy9TdHJpbmc7eHB0AAR0ZXN0dXIAAltCrPMX+AYIVOACAAB4cAAAAIAAAQIDBAUGBwgJCgsMDQ4P\nEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdI\nSUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+fw==\n";
+
+    /*
+     * The new Base64 encoding uses '\r\n' as the line separator at 76 character
+     * intervals:
+     *
+     * 0000: 72 4F 30 41 42 58 4E 79 41 42 70 71 59 58 5A 68  rO0ABXNyABpqYXZh
+     * 0010: 65 43 35 75 59 57 31 70 62 6D 63 75 51 6D 6C 75  eC5uYW1pbmcuQmlu
+     * 0020: 59 58 4A 35 55 6D 56 6D 51 57 52 6B 63 74 43 61  YXJ5UmVmQWRkctCa
+     * 0030: 6B 37 4C 65 73 34 68 48 41 67 41 42 57 77 41 44  k7Les4hHAgABWwAD
+     * 0040: 59 6E 56 6D 64 41 41 43 57 30 4A 34 0D 0A 63 67  YnVmdAACW0J4..cg <
+     * 0050: 41 55 61 6D 46 32 59 58 67 75 62 6D 46 74 61 57  AUamF2YXgubmFtaW
+     * 0060: 35 6E 4C 6C 4A 6C 5A 6B 46 6B 5A 48 4C 72 6F 41  5nLlJlZkFkZHLroA
+     * 0070: 65 61 41 6A 69 76 53 67 49 41 41 55 77 41 43 47  eaAjivSgIAAUwACG
+     * 0080: 46 6B 5A 48 4A 55 65 58 42 6C 64 41 41 53 54 47  FkZHJUeXBldAASTG
+     * 0090: 70 68 64 6D 45 76 62 47 46 75 0D 0A 5A 79 39 54  phdmEvbGFu..Zy9T <
+     * 00A0: 64 48 4A 70 62 6D 63 37 65 48 42 30 41 41 52 30  dHJpbmc7eHB0AAR0
+     * 00B0: 5A 58 4E 30 64 58 49 41 41 6C 74 43 72 50 4D 58  ZXN0dXIAAltCrPMX
+     * 00C0: 2B 41 59 49 56 4F 41 43 41 41 42 34 63 41 41 41  +AYIVOACAAB4cAAA
+     * 00D0: 41 49 41 41 41 51 49 44 42 41 55 47 42 77 67 4A  AIAAAQIDBAUGBwgJ
+     * 00E0: 43 67 73 4D 44 51 34 50 0D 0A 45 42 45 53 45 78  CgsMDQ4P..EBESEx <
+     * 00F0: 51 56 46 68 63 59 47 52 6F 62 48 42 30 65 48 79  QVFhcYGRobHB0eHy
+     * 0100: 41 68 49 69 4D 6B 4A 53 59 6E 4B 43 6B 71 4B 79  AhIiMkJSYnKCkqKy
+     * 0110: 77 74 4C 69 38 77 4D 54 49 7A 4E 44 55 32 4E 7A  wtLi8wMTIzNDU2Nz
+     * 0120: 67 35 4F 6A 73 38 50 54 34 2F 51 45 46 43 51 30  g5Ojs8PT4/QEFCQ0
+     * 0130: 52 46 52 6B 64 49 0D 0A 53 55 70 4C 54 45 31 4F  RFRkdI..SUpLTE1O <
+     * 0140: 54 31 42 52 55 6C 4E 55 56 56 5A 58 57 46 6C 61  T1BRUlNUVVZXWFla
+     * 0150: 57 31 78 64 58 6C 39 67 59 57 4A 6A 5A 47 56 6D  W1xdXl9gYWJjZGVm
+     * 0160: 5A 32 68 70 61 6D 74 73 62 57 35 76 63 48 46 79  Z2hpamtsbW5vcHFy
+     * 0170: 63 33 52 31 64 6E 64 34 65 58 70 37 66 48 31 2B  c3R1dnd4eXp7fH1+
+     * 0180: 66 77 3D 3D
+     */
+    private static final String NEW_ENCODING = "rO0ABXNyABpqYXZheC5uYW1pbmcuQmluYXJ5UmVmQWRkctCak7Les4hHAgABWwADYnVmdAACW0J4\r\ncgAUamF2YXgubmFtaW5nLlJlZkFkZHLroAeaAjivSgIAAUwACGFkZHJUeXBldAASTGphdmEvbGFu\r\nZy9TdHJpbmc7eHB0AAR0ZXN0dXIAAltCrPMX+AYIVOACAAB4cAAAAIAAAQIDBAUGBwgJCgsMDQ4P\r\nEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdI\r\nSUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+fw==";
+
+    /*
+     * Binary-valued JNDI RefAddr test object
+     */
+    private static final RefAddr BINARY_REF_ADDR =
+        new BinaryRefAddr("test", new byte[] {
+        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+        0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+        0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+        0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
+        0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+        0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
+        0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
+        0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
+        0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+        0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F
+    });
+
+    public static void main(String[] args) throws Exception {
+
+        System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
+        System.out.println("Old Base64 encoded serialized RefAddr object:\n" +
+            OLD_ENCODING);
+        System.out.println("Decode using old Base64 decoder...");
+        deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
+
+        System.out.println("----");
+
+        System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
+        System.out.println("Old Base64 encoded serialized RefAddr object:\n" +
+            OLD_ENCODING);
+        System.out.println("Decode using new Base64 decoder...");
+        deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
+
+        System.out.println("----");
+
+        System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
+        System.out.println("New Base64 encoded serialized RefAddr object:\n" +
+            NEW_ENCODING + "\n");
+        System.out.println("Decode using old Base64 decoder...");
+        deserialize(new BASE64Decoder().decodeBuffer(OLD_ENCODING));
+
+        System.out.println("----");
+
+        System.out.println("\nOriginal RefAddr object:\n" + BINARY_REF_ADDR);
+        System.out.println("New Base64 encoded serialized RefAddr object:\n" +
+            NEW_ENCODING + "\n");
+        System.out.println("Decode using new Base64 decoder...");
+        deserialize(Base64.getMimeDecoder().decode(NEW_ENCODING));
+
+        System.out.println("----");
+    }
+
+    /*
+     * Deserialize the decoded Base64 bytes to recover the BinaryRefAddr object.
+     */
+    private static void deserialize(byte[] bytes) throws Exception {
+
+        //System.out.println("\nSerialized RefAddr object: ");
+        //System.out.println(new sun.misc.HexDumpEncoder().encode(bytes));
+
+        ObjectInputStream objectStream =
+            new ObjectInputStream(new ByteArrayInputStream(bytes));
+        Object object = objectStream.readObject();
+        if (!BINARY_REF_ADDR.equals(object)) {
+            throw new Exception("Recovered object does not match the original");
+        }
+        System.out.println("Recovered RefAddr object:\n" + object);
+    }
+
+    /*
+     * Dumps the encoding of a JNDI Reference object during an attempt to store
+     * in an LDAP directory.
+     */
+    private static void storeObjectInLDAP() {
+        Hashtable env = new Hashtable();
+        env.put(Context.REFERRAL, "follow"); // omit an LDAP control
+        env.put("java.naming.ldap.version", "3"); // omit LDAP bind operation
+        env.put("com.sun.jndi.ldap.trace.ber", System.err); // dump protocol
+        try {
+            DirContext ctx = new InitialDirContext(env);
+            Reference reference = new Reference("test", BINARY_REF_ADDR);
+            ctx.bind("ldap://ldap.example.com/cn=test", reference);
+        } catch (NamingException ignore) {
+        }
+    }
+}
--- a/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Tue Apr 29 14:40:26 2014 -0700
@@ -58,6 +58,7 @@
 
             ProcessBuilder pb = ProcessTools.
                 createJavaProcessBuilder(
+                    "-XX:+UseConcMarkSweepGC",  // this will cause UseParNewGC to be FLAG_SET_ERGO
                     "-XX:+PrintGCDetails",
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
                     "-cp", System.getProperty("test.class.path") + File.pathSeparator + getToolsJarPath(),
@@ -84,12 +85,20 @@
             setOptionUsingAttach("HeapDumpPath", "/a/sample/path");
 
             // check the origin field for all the options we set
+
+            // Not set, so should be default
             checkOrigin("ManagementServer", Origin.DEFAULT);
+            // Set on the command line
             checkOrigin("PrintGCDetails", Origin.VM_CREATION);
+            // Set in _JAVA_OPTIONS
             checkOrigin("PrintOopAddress", Origin.ENVIRON_VAR);
+            // Set in -XX:Flags file
             checkOrigin("PrintSafepointStatistics", Origin.CONFIG_FILE);
+            // Set through j.l.m
             checkOrigin("HeapDumpOnOutOfMemoryError", Origin.MANAGEMENT);
-            checkOrigin("NewSize", Origin.ERGONOMIC);
+            // Should be set by the VM, when we set UseConcMarkSweepGC
+            checkOrigin("UseParNewGC", Origin.ERGONOMIC);
+            // Set using attach
             checkOrigin("HeapDumpPath", Origin.ATTACH_ON_DEMAND);
         }
     }
--- a/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -39,13 +39,13 @@
 import com.sun.nio.sctp.SctpServerChannel;
 import com.sun.nio.sctp.SctpSocketOption;
 import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
+import java.security.PrivilegedAction;
 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static java.lang.System.out;
 
 public class SocketOptionTests {
     final String osName = AccessController.doPrivileged(
-                    new GetPropertyAction("os.name"));
+                    (PrivilegedAction<String>)() -> System.getProperty("os.name"));
 
     <T> void checkOption(SctpChannel sc, SctpSocketOption<T> name,
             T expectedValue) throws IOException {
--- a/test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -47,13 +47,13 @@
 import com.sun.nio.sctp.SctpServerChannel;
 import com.sun.nio.sctp.SctpSocketOption;
 import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
+import java.security.PrivilegedAction;
 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static java.lang.System.out;
 
 public class SocketOptionTests {
     final String osName = AccessController.doPrivileged(
-                    new GetPropertyAction("os.name"));
+                    (PrivilegedAction<String>)() -> System.getProperty("os.name"));
 
     <T> void checkOption(SctpMultiChannel smc, SctpSocketOption<T> name,
             T expectedValue) throws IOException {
--- a/test/demo/jvmti/mtrace/TraceJFrame.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/demo/jvmti/mtrace/TraceJFrame.java	Tue Apr 29 14:40:26 2014 -0700
@@ -36,7 +36,7 @@
 
 public class TraceJFrame {
     public static void main(String args[]) throws Exception {
-        if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
+        if (GraphicsEnvironment.isHeadless()) {
             System.out.println("JFrame test was skipped due to headless mode");
         } else {
             DemoRun demo;
--- a/test/java/lang/StringCoding/Enormous.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/StringCoding/Enormous.java	Tue Apr 29 14:40:26 2014 -0700
@@ -34,6 +34,6 @@
         new String(bytes,"ASCII");
 
         // Another manifestation of this bug, reported in bug 6192102.
-        new sun.misc.BASE64Encoder().encode(bytes);
+        java.util.Base64.getEncoder().encodeToString(bytes);
     }
 }
--- a/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,15 +25,18 @@
  * @test
  * @summary Test consistent parsing of ex-RUNTIME annotations that
  *          were changed and separately compiled to have CLASS retention
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.IOUtils
+ * @run main AnnotationTypeRuntimeAssumptionTest
  */
 
-import sun.misc.IOUtils;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
+import jdk.testlibrary.IOUtils;
+
 import static java.lang.annotation.RetentionPolicy.CLASS;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
@@ -137,7 +140,7 @@
                 String altPath = altName.replace('.', '/').concat(".class");
                 try (InputStream is = getResourceAsStream(altPath)) {
                     if (is != null) {
-                        byte[] bytes = IOUtils.readFully(is, -1, true);
+                        byte[] bytes = IOUtils.readFully(is);
                         // patch class bytes to contain original name
                         for (int i = 0; i < bytes.length - 2; i++) {
                             if (bytes[i] == '_' &&
@@ -160,7 +163,7 @@
                 String path = name.replace('.', '/').concat(".class");
                 try (InputStream is = getResourceAsStream(path)) {
                     if (is != null) {
-                        byte[] bytes = IOUtils.readFully(is, -1, true);
+                        byte[] bytes = IOUtils.readFully(is);
                         return defineClass(name, bytes, 0, bytes.length);
                     }
                     else {
--- a/test/java/lang/invoke/lambda/LambdaClassLoaderSerialization.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/invoke/lambda/LambdaClassLoaderSerialization.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,11 +22,14 @@
  */
 
 /*
-@test
-@bug 8004970
-@summary Lambda serialization in the presence of class loaders
-@author Peter Levart
-*/
+ * @test
+ * @bug 8004970
+ * @summary Lambda serialization in the presence of class loaders
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.IOUtils
+ * @run main LambdaClassLoaderSerialization
+ * @author Peter Levart
+ */
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -37,6 +40,8 @@
 import java.io.Serializable;
 import java.util.Arrays;
 
+import jdk.testlibrary.IOUtils;
+
 public class LambdaClassLoaderSerialization {
 
     public interface SerializableRunnable extends Runnable, Serializable {}
@@ -125,7 +130,7 @@
             String path = name.replace('.', '/').concat(".class");
             try (InputStream is = getResourceAsStream(path)) {
                 if (is != null) {
-                    byte[] bytes = readFully(is);
+                    byte[] bytes = IOUtils.readFully(is);
                     return defineClass(name, bytes, 0, bytes.length);
                 } else {
                     throw new ClassNotFoundException(name);
@@ -135,30 +140,5 @@
                 throw new ClassNotFoundException(name, e);
             }
         }
-
-        static byte[] readFully(InputStream is) throws IOException {
-            byte[] output = {};
-            int pos = 0;
-            while (true) {
-                int bytesToRead;
-                if (pos >= output.length) { // Only expand when there's no room
-                    bytesToRead = output.length + 1024;
-                    if (output.length < pos + bytesToRead) {
-                        output = Arrays.copyOf(output, pos + bytesToRead);
-                    }
-                } else {
-                    bytesToRead = output.length - pos;
-                }
-                int cc = is.read(output, pos, bytesToRead);
-                if (cc < 0) {
-                    if (output.length != pos) {
-                        output = Arrays.copyOf(output, pos);
-                    }
-                    break;
-                }
-                pos += cc;
-            }
-            return output;
-        }
     }
 }
--- a/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Tue Apr 29 14:40:26 2014 -0700
@@ -30,11 +30,9 @@
  *
  * @author  Mandy Chung
  *
- * @build CollectionUsageThreshold MemoryUtil
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseSerialGC CollectionUsageThreshold
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseParallelGC CollectionUsageThreshold
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseG1GC CollectionUsageThreshold
- * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC CollectionUsageThreshold
+ * @library /lib/testlibrary/
+ * @build CollectionUsageThreshold MemoryUtil RunUtil
+ * @run main/timeout=300 CollectionUsageThreshold
  */
 
 import java.util.*;
@@ -61,6 +59,20 @@
     // finishes checking the low memory notification result
     private static final CyclicBarrier barrier = new CyclicBarrier(2);
 
+    /**
+     * Run the test multiple times with different GC versions.
+     * First with default command line specified by the framework.
+     * Then with GC versions specified by the test.
+     */
+    public static void main(String a[]) throws Throwable {
+        final String main = "CollectionUsageThreshold$TestMain";
+        RunUtil.runTestKeepGcOpts(main);
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
+    }
+
     static class PoolRecord {
         private final MemoryPoolMXBean pool;
         private final AtomicInteger listenerInvoked = new AtomicInteger(0);
@@ -110,88 +122,90 @@
         }
     }
 
-    public static void main(String args[]) throws Exception {
-        if (args.length > 0 && args[0].equals("trace")) {
-            trace = true;
+    private static class TestMain {
+        public static void main(String args[]) throws Exception {
+            if (args.length > 0 && args[0].equals("trace")) {
+                trace = true;
+            }
+
+            List<MemoryPoolMXBean> pools = getMemoryPoolMXBeans();
+            List<MemoryManagerMXBean> managers = getMemoryManagerMXBeans();
+
+            if (trace) {
+                MemoryUtil.printMemoryPools(pools);
+                MemoryUtil.printMemoryManagers(managers);
+            }
+
+            // Find the Old generation which supports low memory detection
+            for (MemoryPoolMXBean p : pools) {
+                if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
+                    if (p.getName().toLowerCase().contains("perm")) {
+                        // if we have a "perm gen" pool increase the number of expected
+                        // memory pools by one.
+                        numMemoryPools++;
+                    }
+                    PoolRecord pr = new PoolRecord(p);
+                    result.put(p.getName(), pr);
+                    if (result.size() == numMemoryPools) {
+                        break;
+                    }
+                }
+            }
+            if (result.size() != numMemoryPools) {
+                throw new RuntimeException("Unexpected number of selected pools");
+            }
+
+            try {
+                // This test creates a checker thread responsible for checking
+                // the low memory notifications.  It blocks until a permit
+                // from the signals semaphore is available.
+                Checker checker = new Checker("Checker thread");
+                checker.setDaemon(true);
+                checker.start();
+
+                for (PoolRecord pr : result.values()) {
+                    pr.getPool().setCollectionUsageThreshold(THRESHOLD);
+                    System.out.println("Collection usage threshold of " +
+                        pr.getPool().getName() + " set to " + THRESHOLD);
+                }
+
+                SensorListener listener = new SensorListener();
+                NotificationEmitter emitter = (NotificationEmitter) mm;
+                emitter.addNotificationListener(listener, null, null);
+
+                // The main thread invokes GC to trigger the VM to perform
+                // low memory detection and then waits until the checker thread
+                // finishes its work to check for a low-memory notification.
+                //
+                // At GC time, VM will issue low-memory notification and invoke
+                // the listener which will release a permit to the signals semaphore.
+                // When the checker thread acquires the permit and finishes
+                // checking the low-memory notification, it will also call
+                // barrier.await() to signal the main thread to resume its work.
+                for (int i = 0; i < NUM_GCS; i++) {
+                    invokeGC();
+                    barrier.await();
+                }
+            } finally {
+                // restore the default
+                for (PoolRecord pr : result.values()) {
+                    pr.getPool().setCollectionUsageThreshold(0);
+                }
+            }
+            System.out.println(RunUtil.successMessage);
         }
 
-        List<MemoryPoolMXBean> pools = getMemoryPoolMXBeans();
-        List<MemoryManagerMXBean> managers = getMemoryManagerMXBeans();
 
-        if (trace) {
-            MemoryUtil.printMemoryPools(pools);
-            MemoryUtil.printMemoryManagers(managers);
-        }
+        private static void invokeGC() {
+            System.out.println("Calling System.gc()");
+            numGCs++;
+            mm.gc();
 
-        // Find the Old generation which supports low memory detection
-        for (MemoryPoolMXBean p : pools) {
-            if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
-                if (p.getName().toLowerCase().contains("perm")) {
-                    // if we have a "perm gen" pool increase the number of expected
-                    // memory pools by one.
-                    numMemoryPools++;
+            if (trace) {
+                for (PoolRecord pr : result.values()) {
+                    System.out.println("Usage after GC for: " + pr.getPool().getName());
+                    MemoryUtil.printMemoryUsage(pr.getPool().getUsage());
                 }
-                PoolRecord pr = new PoolRecord(p);
-                result.put(p.getName(), pr);
-                if (result.size() == numMemoryPools) {
-                    break;
-                }
-            }
-        }
-        if (result.size() != numMemoryPools) {
-            throw new RuntimeException("Unexpected number of selected pools");
-        }
-
-        try {
-            // This test creates a checker thread responsible for checking
-            // the low memory notifications.  It blocks until a permit
-            // from the signals semaphore is available.
-            Checker checker = new Checker("Checker thread");
-            checker.setDaemon(true);
-            checker.start();
-
-            for (PoolRecord pr : result.values()) {
-                pr.getPool().setCollectionUsageThreshold(THRESHOLD);
-                System.out.println("Collection usage threshold of " +
-                    pr.getPool().getName() + " set to " + THRESHOLD);
-            }
-
-            SensorListener listener = new SensorListener();
-            NotificationEmitter emitter = (NotificationEmitter) mm;
-            emitter.addNotificationListener(listener, null, null);
-
-            // The main thread invokes GC to trigger the VM to perform
-            // low memory detection and then waits until the checker thread
-            // finishes its work to check for a low-memory notification.
-            //
-            // At GC time, VM will issue low-memory notification and invoke
-            // the listener which will release a permit to the signals semaphore.
-            // When the checker thread acquires the permit and finishes
-            // checking the low-memory notification, it will also call
-            // barrier.await() to signal the main thread to resume its work.
-            for (int i = 0; i < NUM_GCS; i++) {
-                invokeGC();
-                barrier.await();
-            }
-        } finally {
-            // restore the default
-            for (PoolRecord pr : result.values()) {
-                pr.getPool().setCollectionUsageThreshold(0);
-            }
-        }
-        System.out.println("Test passed.");
-    }
-
-
-    private static void invokeGC() {
-        System.out.println("Calling System.gc()");
-        numGCs++;
-        mm.gc();
-
-        if (trace) {
-            for (PoolRecord pr : result.values()) {
-                System.out.println("Usage after GC for: " + pr.getPool().getName());
-                MemoryUtil.printMemoryUsage(pr.getPool().getUsage());
             }
         }
     }
--- a/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Apr 29 14:40:26 2014 -0700
@@ -30,11 +30,9 @@
  *
  * @author  Mandy Chung
  *
- * @build LowMemoryTest MemoryUtil
- * @run main/othervm/timeout=600 LowMemoryTest
- * @run main/othervm/timeout=600 -XX:+UseConcMarkSweepGC LowMemoryTest
- * @run main/othervm/timeout=600 -XX:+UseParallelGC LowMemoryTest
- * @run main/othervm/timeout=600 -XX:+UseSerialGC LowMemoryTest
+ * @library /lib/testlibrary/
+ * @build LowMemoryTest MemoryUtil RunUtil
+ * @run main/timeout=600 LowMemoryTest
  */
 
 import java.lang.management.*;
@@ -54,6 +52,20 @@
     private static final int NUM_CHUNKS = 2;
     private static long chunkSize;
 
+    /**
+     * Run the test multiple times with different GC versions.
+     * First with default command line specified by the framework.
+     * Then with GC versions specified by the test.
+     */
+    public static void main(String a[]) throws Throwable {
+        final String main = "LowMemoryTest$TestMain";
+        RunUtil.runTestKeepGcOpts(main);
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
+        RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
+    }
+
     private static volatile boolean listenerInvoked = false;
     static class SensorListener implements NotificationListener {
         @Override
@@ -107,77 +119,80 @@
     }
 
     private static long newThreshold;
-    public static void main(String args[]) throws Exception {
-        if (args.length > 0 && args[0].equals("trace")) {
-            trace = true;
-        }
 
-        // Find the Old generation which supports low memory detection
-        ListIterator iter = pools.listIterator();
-        while (iter.hasNext()) {
-            MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
-            if (p.getType() == MemoryType.HEAP &&
+    private static class TestMain {
+        public static void main(String args[]) throws Exception {
+            if (args.length > 0 && args[0].equals("trace")) {
+                trace = true;
+            }
+
+            // Find the Old generation which supports low memory detection
+            ListIterator iter = pools.listIterator();
+            while (iter.hasNext()) {
+                MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
+                if (p.getType() == MemoryType.HEAP &&
                     p.isUsageThresholdSupported()) {
-                mpool = p;
-                if (trace) {
-                    System.out.println("Selected memory pool for low memory " +
-                        "detection.");
-                    MemoryUtil.printMemoryPool(mpool);
+                    mpool = p;
+                    if (trace) {
+                        System.out.println("Selected memory pool for low memory " +
+                            "detection.");
+                        MemoryUtil.printMemoryPool(mpool);
+                    }
+                    break;
                 }
-                break;
             }
-        }
 
-        TestListener listener = new TestListener();
-        SensorListener l2 = new SensorListener();
-        NotificationEmitter emitter = (NotificationEmitter) mm;
-        emitter.addNotificationListener(listener, null, null);
-        emitter.addNotificationListener(l2, null, null);
+            TestListener listener = new TestListener();
+            SensorListener l2 = new SensorListener();
+            NotificationEmitter emitter = (NotificationEmitter) mm;
+            emitter.addNotificationListener(listener, null, null);
+            emitter.addNotificationListener(l2, null, null);
 
-        Thread allocator = new AllocatorThread();
-        Thread sweeper = new SweeperThread();
+            Thread allocator = new AllocatorThread();
+            Thread sweeper = new SweeperThread();
 
-        // Now set threshold
-        MemoryUsage mu = mpool.getUsage();
-        chunkSize = (mu.getMax() - mu.getUsed()) / 20;
-        newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
+            // Now set threshold
+            MemoryUsage mu = mpool.getUsage();
+            chunkSize = (mu.getMax() - mu.getUsed()) / 20;
+            newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
 
-        System.out.println("Setting threshold for " + mpool.getName() +
-            " from " + mpool.getUsageThreshold() + " to " + newThreshold +
-            ".  Current used = " + mu.getUsed());
-        mpool.setUsageThreshold(newThreshold);
+            System.out.println("Setting threshold for " + mpool.getName() +
+                " from " + mpool.getUsageThreshold() + " to " + newThreshold +
+                ".  Current used = " + mu.getUsed());
+            mpool.setUsageThreshold(newThreshold);
 
-        if (mpool.getUsageThreshold() != newThreshold) {
-            throw new RuntimeException("TEST FAILED: " +
+            if (mpool.getUsageThreshold() != newThreshold) {
+                throw new RuntimeException("TEST FAILED: " +
                 "Threshold for Memory pool " + mpool.getName() +
                 "is " + mpool.getUsageThreshold() + " but expected to be" +
                 newThreshold);
+            }
+
+
+            allocator.start();
+            // Force Allocator start first
+            phaser.arriveAndAwaitAdvance();
+            sweeper.start();
+
+
+            try {
+                allocator.join();
+                // Wait until AllocatorThread's done
+                phaser.arriveAndAwaitAdvance();
+                sweeper.join();
+            } catch (InterruptedException e) {
+                System.out.println("Unexpected exception:" + e);
+                testFailed = true;
+            }
+
+            listener.checkResult();
+
+            if (testFailed)
+                throw new RuntimeException("TEST FAILED.");
+
+            System.out.println(RunUtil.successMessage);
+
         }
-
-
-        allocator.start();
-        // Force Allocator start first
-        phaser.arriveAndAwaitAdvance();
-        sweeper.start();
-
-
-        try {
-            allocator.join();
-            // Wait until AllocatorThread's done
-            phaser.arriveAndAwaitAdvance();
-            sweeper.join();
-        } catch (InterruptedException e) {
-            System.out.println("Unexpected exception:" + e);
-            testFailed = true;
-        }
-
-        listener.checkResult();
-
-        if (testFailed)
-            throw new RuntimeException("TEST FAILED.");
-
-        System.out.println("Test passed.");
-
     }
 
     private static void goSleep(long ms) {
--- a/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Tue Apr 29 14:40:26 2014 -0700
@@ -32,11 +32,9 @@
  * @summary Basic Test for MemoryPool.resetPeakUsage()
  * @author  Mandy Chung
  *
- * @build ResetPeakMemoryUsage MemoryUtil
- * @run main/othervm -XX:+PrintGCDetails -XX:+UseSerialGC -Xms256m -XX:MarkSweepAlwaysCompactCount=1 -Xmn8m ResetPeakMemoryUsage
- * @run main/othervm -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -Xms256m -Xmn8m ResetPeakMemoryUsage
- * @run main/othervm -XX:+PrintGCDetails -XX:+UseParallelGC -Xms256m -Xmn8m ResetPeakMemoryUsage
- * @run main/othervm -XX:+PrintGCDetails -XX:+UseG1GC -Xms256m -Xmn8m -XX:G1HeapRegionSize=1m ResetPeakMemoryUsage
+ * @library /lib/testlibrary/
+ * @build ResetPeakMemoryUsage MemoryUtil RunUtil
+ * @run main ResetPeakMemoryUsage
  */
 
 import java.lang.management.*;
@@ -47,24 +45,42 @@
     // make public so that it can't be optimized away easily
     public static Object[] obj;
 
-    public static void main(String[] argv) {
-        List pools = ManagementFactory.getMemoryPoolMXBeans();
-        ListIterator iter = pools.listIterator();
-        boolean found = false;
-        while (iter.hasNext()) {
-            MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
-            // only check heap pools that support usage threshold
-            // this is typically only the old generation space
-            // since the other spaces are expected to get filled up
-            if (p.getType() == MemoryType.HEAP &&
-                p.isUsageThresholdSupported())
-            {
-                found = true;
-                testPool(p);
+    /**
+     * Run the test multiple times with different GC versions.
+     * First with default command line specified by the framework.
+     * Then with all GC versions specified by the test.
+     */
+    public static void main(String a[]) throws Throwable {
+        final String main = "ResetPeakMemoryUsage$TestMain";
+        final String ms = "-Xms256m";
+        final String mn = "-Xmn8m";
+        RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseConcMarkSweepGC");
+        RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseParallelGC");
+        RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseG1GC", "-XX:G1HeapRegionSize=1m");
+        RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseSerialGC",
+                "-XX:MarkSweepAlwaysCompactCount=1");
+    }
+
+    private static class TestMain {
+        public static void main(String[] argv) {
+            List pools = ManagementFactory.getMemoryPoolMXBeans();
+            ListIterator iter = pools.listIterator();
+            boolean found = false;
+            while (iter.hasNext()) {
+                MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
+                // only check heap pools that support usage threshold
+                // this is typically only the old generation space
+                // since the other spaces are expected to get filled up
+                if (p.getType() == MemoryType.HEAP &&
+                    p.isUsageThresholdSupported())
+                {
+                    found = true;
+                    testPool(p);
+                }
             }
-        }
-        if (!found) {
-            throw new RuntimeException("No heap pool found");
+            if (!found) {
+                throw new RuntimeException("No heap pool found");
+            }
         }
     }
 
@@ -142,7 +158,7 @@
                 formatSize("previous peak", peak2.getUsed()));
         }
 
-        System.out.println("Test passed.");
+        System.out.println(RunUtil.successMessage);
     }
 
     private static String INDENT = "    ";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/management/MemoryMXBean/RunUtil.java	Tue Apr 29 14:40:26 2014 -0700
@@ -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.
+ */
+
+/**
+ * Utility class for launching a test in a separate JVM.
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.Utils;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.JDKToolFinder;
+
+public class RunUtil {
+
+    // Used to mark that the test has passed successfully.
+    public static final String successMessage = "Test passed.";
+
+    public static void runTestClearGcOpts(String main, String... testOpts) throws Throwable {
+        runTest(main, true, testOpts);
+    }
+
+    public static void runTestKeepGcOpts(String main, String... testOpts) throws Throwable {
+        runTest(main, false, testOpts);
+    }
+
+    /**
+     * Runs a test in a separate JVM.
+     * command line like:
+     * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
+     *
+     * {defaultopts} are the default java options set by the framework.
+     * Default GC options in {defaultopts} may be removed.
+     * This is used when the test specifies its own GC options.
+     *
+     * @param main Name of the main class.
+     * @param clearGcOpts true if the default GC options should be removed.
+     * @param testOpts java options specified by the test.
+     */
+    private static void runTest(String main, boolean clearGcOpts, String... testOpts)
+                throws Throwable {
+        List<String> opts = new ArrayList<>();
+        opts.add(JDKToolFinder.getJDKTool("java"));
+        opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
+        opts.add("-cp");
+        opts.add(System.getProperty("test.class.path", "test.class.path"));
+        opts.add("-XX:+PrintGCDetails");
+
+        if (clearGcOpts) {
+            opts = Utils.removeGcOpts(opts);
+        }
+        opts.addAll(Arrays.asList(testOpts));
+        opts.add(main);
+
+        OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0]));
+        output.shouldHaveExitValue(0);
+        if (output.getStdout().indexOf(successMessage) < 0) {
+            throw new Exception("output missing '" + successMessage + "'");
+        }
+    }
+
+}
--- a/test/java/lang/ref/EarlyTimeout.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/ref/EarlyTimeout.java	Tue Apr 29 14:40:26 2014 -0700
@@ -33,6 +33,7 @@
 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)
@@ -93,9 +94,9 @@
     public void run() {
         try {
             startedSignal.countDown();
-            long start = System.currentTimeMillis();
+            long start = System.nanoTime();
             reference = queue.remove(TIMEOUT);
-            actual = System.currentTimeMillis() - start;
+            actual = NANOSECONDS.toMillis(System.nanoTime() - start);
         } catch (InterruptedException ex) {
             throw new RuntimeException(ex);
         }
--- a/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,6 +27,9 @@
  * @summary Test that a static method on an interface doesn't hide a default
  *          method with the same name and signature in a separate compilation
  *          scenario.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.IOUtils
+ * @run main StaticInterfaceMethodInWayOfDefault
  */
 
 import java.io.IOException;
@@ -35,7 +38,7 @@
 import java.lang.reflect.Method;
 import java.util.concurrent.Callable;
 
-import sun.misc.IOUtils;
+import jdk.testlibrary.IOUtils;
 
 public class StaticInterfaceMethodInWayOfDefault {
     public interface A_v1 {
@@ -144,7 +147,7 @@
                 String altPath = altName.replace('.', '/').concat(".class");
                 try (InputStream is = getResourceAsStream(altPath)) {
                     if (is != null) {
-                        byte[] bytes = IOUtils.readFully(is, -1, true);
+                        byte[] bytes = IOUtils.readFully(is);
                         // patch class bytes to contain original name
                         for (int i = 0; i < bytes.length - 2; i++) {
                             if (bytes[i] == '_' &&
@@ -167,7 +170,7 @@
                 String path = name.replace('.', '/').concat(".class");
                 try (InputStream is = getResourceAsStream(path)) {
                     if (is != null) {
-                        byte[] bytes = IOUtils.readFully(is, -1, true);
+                        byte[] bytes = IOUtils.readFully(is);
                         return defineClass(name, bytes, 0, bytes.length);
                     }
                     else {
--- a/test/java/math/BigInteger/BitLengthOverflow.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/math/BigInteger/BitLengthOverflow.java	Tue Apr 29 14:40:26 2014 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * @ test
+ * @test
  * @bug 6910473
  * @summary Test that bitLength() is not negative
  * @author Dmitry Nadezhin
@@ -32,18 +32,19 @@
 public class BitLengthOverflow {
 
     public static void main(String[] args) {
-
         try {
             BigInteger x = BigInteger.ONE.shiftLeft(Integer.MAX_VALUE); // x = pow(2,Integer.MAX_VALUE)
-            if (x.bitLength() != (1L << 31))
+            if (x.bitLength() != (1L << 31)) {
                 throw new RuntimeException("Incorrect bitLength() " + x.bitLength());
+            }
             System.out.println("Surprisingly passed with correct bitLength() " + x.bitLength());
         } catch (ArithmeticException e) {
             // expected
             System.out.println("Overflow is reported by ArithmeticException, as expected");
         } catch (OutOfMemoryError e) {
             // possible
-            System.out.println("OutOfMemoryError");
+            System.err.println("BitLengthOverflow skipped: OutOfMemoryError");
+            System.err.println("Run jtreg with -javaoption:-Xmx8g");
         }
     }
 }
--- a/test/java/math/BigInteger/DivisionOverflow.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/math/BigInteger/DivisionOverflow.java	Tue Apr 29 14:40:26 2014 -0700
@@ -22,9 +22,10 @@
  */
 
 /*
- * @ test
+ * @test
  * @bug 8022780
  * @summary Test division of large values
+ * @run main/othervm -Xshare:off DivisionOverflow
  * @author Dmitry Nadezhin
  */
 import java.math.BigInteger;
@@ -38,14 +39,17 @@
             BigInteger[] qr = a.divideAndRemainder(b);
             BigInteger q = qr[0];
             BigInteger r = qr[1];
-            if (!r.equals(BigInteger.ZERO))
-                throw new RuntimeException("Incorrect singum() of remainder " + r.signum());
-            if (q.bitLength() != 2147482079)
+            if (!r.equals(BigInteger.ZERO)) {
+                throw new RuntimeException("Incorrect signum() of remainder " + r.signum());
+            }
+            if (q.bitLength() != 2147482079) {
                 throw new RuntimeException("Incorrect bitLength() of quotient " + q.bitLength());
+            }
             System.out.println("Division of large values passed without overflow.");
         } catch (OutOfMemoryError e) {
             // possible
-            System.out.println("OutOfMemoryError");
+            System.err.println("DivisionOverflow skipped: OutOfMemoryError");
+            System.err.println("Run jtreg with -javaoption:-Xmx8g");
         }
     }
 }
--- a/test/java/math/BigInteger/DoubleValueOverflow.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/math/BigInteger/DoubleValueOverflow.java	Tue Apr 29 14:40:26 2014 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * @ test
+ * @test
  * @bug 8021203
  * @summary Test that doubleValue() doesn't overflow
  * @author Dmitry Nadezhin
@@ -32,18 +32,19 @@
 public class DoubleValueOverflow {
 
     public static void main(String[] args) {
-
         try {
             BigInteger x = BigInteger.valueOf(2).shiftLeft(Integer.MAX_VALUE); // x = pow(2,pow(2,31))
-            if (x.doubleValue() != Double.POSITIVE_INFINITY)
+            if (x.doubleValue() != Double.POSITIVE_INFINITY) {
                 throw new RuntimeException("Incorrect doubleValue() " + x.doubleValue());
+            }
             System.out.println("Passed with correct result");
         } catch (ArithmeticException e) {
             // expected
             System.out.println("Overflow is reported by ArithmeticException, as expected");
         } catch (OutOfMemoryError e) {
             // possible
-            System.out.println("OutOfMemoryError");
+            System.err.println("DoubleValueOverflow skipped: OutOfMemoryError");
+            System.err.println("Run jtreg with -javaoption:-Xmx8g");
         }
     }
 }
--- a/test/java/math/BigInteger/StringConstructorOverflow.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/math/BigInteger/StringConstructorOverflow.java	Tue Apr 29 14:40:26 2014 -0700
@@ -22,9 +22,11 @@
  */
 
 /*
- * @ test
+ * @test
+ * @ignore This test has huge memory requirements
  * @bug 8021204
  * @summary Test constructor BigInteger(String val, int radix) on very long string
+ * @run main/othervm -Xshare:off -Xmx8g StringConstructorOverflow
  * @author Dmitry Nadezhin
  */
 import java.math.BigInteger;
@@ -45,15 +47,16 @@
     public static void main(String[] args) {
         try {
             BigInteger bi = new BigInteger(makeLongHexString(), 16);
-            if (bi.compareTo(BigInteger.ONE) <= 0)
+            if (bi.compareTo(BigInteger.ONE) <= 0) {
                 throw new RuntimeException("Incorrect result " + bi.toString());
+            }
         } catch (ArithmeticException e) {
             // expected
             System.out.println("Overflow is reported by ArithmeticException, as expected");
         } catch (OutOfMemoryError e) {
             // possible
-            System.out.println("OutOfMemoryError");
-            System.out.println("Run jtreg with -javaoption:-Xmx8g");
+            System.err.println("StringConstructorOverflow skipped: OutOfMemoryError");
+            System.err.println("Run jtreg with -javaoption:-Xmx8g");
         }
     }
 }
--- a/test/java/math/BigInteger/SymmetricRangeTests.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/math/BigInteger/SymmetricRangeTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -22,8 +22,8 @@
  */
 
 /*
- * This test is intentionally ignored because of huge memory requirements
- * @ test
+ * @test
+ * @ignore This test has huge memory requirements
  * @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests
  * @bug 6910473 8021204 8021203 9005933
  * @summary Test range of BigInteger values
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/Inet4Address/DummyNameService.java	Tue Apr 29 14:40:26 2014 -0700
@@ -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.
+ */
+
+/*
+ * A simple name service which throws an exception when invoked
+ */
+
+import java.net.UnknownHostException;
+import java.net.InetAddress;
+import sun.net.spi.nameservice.*;
+import java.util.*;
+
+public final class DummyNameService implements NameService {
+
+    public DummyNameService() throws Exception {
+    }
+
+    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
+        throw new UnknownHostException("Dummy name service");
+    }
+
+    public String getHostByAddr(byte[] addr) throws UnknownHostException {
+        throw new UnknownHostException("Dummy name service");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/Inet4Address/DummyNameServiceDescriptor.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+/*
+ * Descriptor for the dummy name service
+ */
+
+import sun.net.spi.nameservice.*;
+
+public final class DummyNameServiceDescriptor implements NameServiceDescriptor {
+
+    /**
+     * Create a new instance of the corresponding name service.
+     */
+    public NameService createNameService() throws Exception {
+        return new DummyNameService();
+    }
+
+    /**
+     * Returns this service provider's name
+     *
+     */
+    public String getProviderName() {
+        return "oracle";
+    }
+
+    /**
+     * Returns this name service type
+     * "dns" "nis" etc
+     */
+    public String getType() {
+        return "dummy";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/Inet4Address/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,22 @@
+# 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.
+
+DummyNameServiceDescriptor    # name service provider descriptor
--- a/test/java/net/Inet4Address/textToNumericFormat.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/net/Inet4Address/textToNumericFormat.java	Tue Apr 29 14:40:26 2014 -0700
@@ -25,8 +25,18 @@
  * @test
  * @bug 4749938
  * @summary Bug in the parsing IPv4 literal addresses
+ * @compile -XDignore.symbol.file=true DummyNameService.java DummyNameServiceDescriptor.java
+ * @run main/othervm -Dsun.net.spi.nameservice.provider.1=dummy,oracle textToNumericFormat
 */
 
+/**
+ * We use a dummy name service which throws UHE any time it is called.
+ * We do this because the "good" tests here should parse correctly
+ * without needing to call the name service, and the bad tests will
+ * not parse and then invoke the name service, where we expect
+ * the exception.
+ */
+
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.*;
@@ -34,19 +44,25 @@
 public class textToNumericFormat {
 
     public static void main(String[] args) throws UnknownHostException {
-        List goodList = new ArrayList();
-        List badList = new ArrayList();
+        List<String> goodList = new ArrayList<>();
+        List<String> badList = new ArrayList<>();
         String goodAddrs[] = {
                            "224.0.1.0",
                            "238.255.255.255",
-                           "239.255.255.255" };
+                           "239.255.255.255",
+                           "239.255.65535",
+                           "239.16777215",
+                           "4294967295" };
 
         String badAddrs[] = {
                            "238.255.255.2550",
                            "256.255.255.255",
                            "238.255.2550.255",
                            "238.2550.255.255",
-                           "2380.255.255.255"};
+                           "2380.255.255.255",
+                           "239.255.65536",
+                           "239.16777216",
+                           "4294967296" };
 
         for (int i=0; i<goodAddrs.length; i++) {
             try {
--- a/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java	Tue Apr 29 14:40:26 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -36,6 +36,8 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.charset.Charset;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -89,12 +91,10 @@
     private static void addCharsets(Set charsets, final String packageName)
             throws Exception {
 
-        String classPath =
-            (String) java.security.AccessController.doPrivileged(
-             new sun.security.action.GetPropertyAction("sun.boot.class.path"));
-        String s =
-            (String) java.security.AccessController.doPrivileged(
-             new sun.security.action.GetPropertyAction("java.class.path"));
+        String classPath = AccessController.doPrivileged(
+             (PrivilegedAction<String>)() -> System.getProperty("sun.boot.class.path"));
+        String s = AccessController.doPrivileged(
+             (PrivilegedAction<String>)() -> System.getProperty("java.class.path"));
 
         // Search combined system and application class path
         if (s != null && s.length() != 0) {
--- a/test/java/security/Provider/NewInstance.java	Tue Apr 29 15:46:16 2014 -0400
+++ b/test/java/security/Provider/NewInstance.java	Tue Apr 29 14:40:26 2014 -0700
@@ -53,6 +53,9 @@
                     System.out.println("  check");
                     Throwable t = e.getCause();
                     if (!(t instanceof InvalidAlgorithmParameterException)) {
+                        // Some engines require certain parameters to be
+                        // present on creation. Calling newInstance(null) will
+                        // trigger this exception and it's OK.
                         throw e;
                     }
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/TEST.properties	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,3 @@
+# JDBC unit tests uses TestNG
+TestNG.dirs = .
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/BatchUpdateExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,326 @@
+/*
+ * 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 test.sql;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.ObjectInputStream;
+import java.sql.BatchUpdateException;
+import java.sql.SQLException;
+import java.util.Arrays;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.SerializedBatchUpdateException;
+import util.BaseTest;
+
+public class BatchUpdateExceptionTests extends BaseTest {
+
+    private final int[] uc = {1, 2, 3};
+    private final long[] luc = {1, 2, 3};
+
+    private final String testSrcDir = System.getProperty("test.src", ".")
+            + File.separatorChar;
+
+    /**
+     * Create BatchUpdateException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        BatchUpdateException be = new BatchUpdateException(null,
+                null, errorCode, (int[]) null, null);
+        assertTrue(be.getMessage() == null && be.getSQLState() == null
+                && be.getUpdateCounts() == null && be.getCause() == null
+                && be.getLargeUpdateCounts() == null
+                && be.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create BatchUpdateException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        BatchUpdateException ex = new BatchUpdateException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getUpdateCounts() == null
+                && ex.getLargeUpdateCounts() == null);
+    }
+
+    /**
+     * Create BatchUpdateException with null Throwable
+     */
+    @Test
+    public void test2() {
+        BatchUpdateException ex = new BatchUpdateException((Throwable) null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getUpdateCounts() == null
+                && ex.getLargeUpdateCounts() == null);
+    }
+
+    /**
+     * Create BatchUpdateException with message and update counts
+     */
+    @Test
+    public void test3() {
+
+        BatchUpdateException ex = new BatchUpdateException(reason, uc);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Create BatchUpdateException with update counts
+     */
+    @Test
+    public void test4() {
+        BatchUpdateException ex = new BatchUpdateException(uc);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Create BatchUpdateException with Throwable and update counts
+     */
+    @Test
+    public void test5() {
+        BatchUpdateException ex = new BatchUpdateException(uc, t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Create BatchUpdateException with message, Throwable, and update counts
+     */
+    @Test
+    public void test6() {
+        BatchUpdateException ex = new BatchUpdateException(reason, uc, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Create BatchUpdateException with message, SQLState, Throwable, and update
+     * counts
+     */
+    @Test
+    public void test7() {
+        BatchUpdateException ex = new BatchUpdateException(reason, state, uc, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Create BatchUpdateException with message, SQLState, errorCode code
+     * Throwable, and update counts
+     */
+    @Test
+    public void test8() {
+        BatchUpdateException ex = new BatchUpdateException(reason, state, errorCode,
+                uc, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Create BatchUpdateException with message, SQLState, errorCode code
+     * Throwable, and long [] update counts
+     */
+    @Test
+    public void test9() {
+        BatchUpdateException ex = new BatchUpdateException(reason, state, errorCode,
+                luc, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode
+                && Arrays.equals(ex.getUpdateCounts(), uc)
+                && Arrays.equals(ex.getLargeUpdateCounts(), luc)
+        );
+    }
+
+    /**
+     * Validate that a copy of the update counts array is made
+     */
+    @Test
+    public void test10() {
+        int[] uc1 = {1, 2};
+        BatchUpdateException ex = new BatchUpdateException(uc1);
+        assertTrue(Arrays.equals(ex.getUpdateCounts(), uc1));
+        uc1[0] = 6689;
+        assertFalse(Arrays.equals(ex.getUpdateCounts(), uc1));
+    }
+
+    /**
+     * Validate that if null is specified for the update count, it is returned
+     * as null
+     */
+    @Test
+    public void test11() {
+        BatchUpdateException ex = new BatchUpdateException((int[]) null);
+        assertTrue(ex.getMessage() == null && ex.getSQLState() == null
+                && ex.getErrorCode() == 0 && ex.getUpdateCounts() == null
+                && ex.getLargeUpdateCounts() == null);
+    }
+
+    /**
+     * Serialize a BatchUpdateException and make sure you can read it back
+     * properly
+     */
+    @Test
+    public void test12() throws Exception {
+        BatchUpdateException be = new BatchUpdateException(reason, state, errorCode,
+                uc, t);
+        BatchUpdateException bue
+                = createSerializedException(be);
+        assertTrue(reason.equals(bue.getMessage())
+                && bue.getSQLState().equals(state)
+                && cause.equals(bue.getCause().toString())
+                && bue.getErrorCode() == errorCode
+                && Arrays.equals(bue.getLargeUpdateCounts(), luc)
+                && Arrays.equals(bue.getUpdateCounts(), uc));
+    }
+
+
+
+    /**
+     * De-Serialize a BatchUpdateException from JDBC 4.0 and make sure you can
+     * read it back properly
+     */
+    @Test
+    public void test13() throws Exception {
+        String reason1 = "This was the error msg";
+        String state1 = "user defined sqlState";
+        String cause1 = "java.lang.Throwable: throw 1";
+        int errorCode1 = 99999;
+        Throwable t = new Throwable("throw 1");
+        int[] uc1 = {1, 2, 21};
+        long[] luc1 = {1, 2, 21};
+
+        ObjectInputStream ois = new ObjectInputStream(
+                new ByteArrayInputStream(SerializedBatchUpdateException.DATA));
+        BatchUpdateException bue = (BatchUpdateException) ois.readObject();
+        assertTrue(reason1.equals(bue.getMessage())
+                && bue.getSQLState().equals(state1)
+                && bue.getErrorCode() == errorCode1
+                && cause1.equals(bue.getCause().toString())
+                && Arrays.equals(bue.getLargeUpdateCounts(), luc1)
+                && Arrays.equals(bue.getUpdateCounts(), uc1));
+    }
+
+    /**
+     * Serialize a BatchUpdateException with an Integer.MAX_VALUE + 1 and
+     * validate you can read it back properly
+     */
+    @Test
+    public void test14() throws Exception {
+        int[] uc1 = {Integer.MAX_VALUE, Integer.MAX_VALUE + 1};
+        long[] luc1 = {Integer.MAX_VALUE, Integer.MAX_VALUE + 1};
+        BatchUpdateException be = new BatchUpdateException(reason, state, errorCode,
+                luc1, t);
+                BatchUpdateException bue
+                = createSerializedException(be);
+        assertTrue(reason.equals(bue.getMessage())
+                && bue.getSQLState().equals(state)
+                && cause.equals(bue.getCause().toString())
+                && bue.getErrorCode() == errorCode
+                && Arrays.equals(bue.getLargeUpdateCounts(), luc1)
+                && Arrays.equals(bue.getUpdateCounts(), uc1));
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test15() {
+        BatchUpdateException ex = new BatchUpdateException("Exception 1", uc, t1);
+        BatchUpdateException ex1 = new BatchUpdateException("Exception 2", uc);
+        BatchUpdateException ex2 = new BatchUpdateException("Exception 3", uc, t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test16() {
+        BatchUpdateException ex = new BatchUpdateException("Exception 1", uc,  t1);
+        BatchUpdateException ex1 = new BatchUpdateException("Exception 2", uc);
+        BatchUpdateException ex2 = new BatchUpdateException("Exception 3", uc, t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        SQLException sqe = ex;
+        int num = 0;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/DataTruncationTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,209 @@
+/*
+ * 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 test.sql;
+
+import java.sql.DataTruncation;
+import java.sql.SQLException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class DataTruncationTests extends BaseTest {
+
+    private final String READ_TRUNCATION = "01004";
+    private final String WRITE_TRUNCATION = "22001";
+    private final String dtReason = "Data truncation";
+    private final int dterrorCode = 0;
+    private final String[] dtmsgs = {dtReason, "cause 1", dtReason,
+        dtReason, "cause 2"};
+    private boolean onRead = false;
+    private final boolean parameter = false;
+    private final int index = 21;
+    private final int dataSize = 25;
+    private final int transferSize = 10;
+
+    /**
+     * Create DataTruncation object indicating a truncation on read
+     */
+    @Test
+    public void test() {
+        onRead = true;
+        DataTruncation e = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize);
+        assertTrue(e.getMessage().equals(dtReason)
+                && e.getSQLState().equals(READ_TRUNCATION)
+                && e.getCause() == null
+                && e.getErrorCode() == dterrorCode
+                && e.getParameter() == parameter
+                && e.getRead() == onRead
+                && e.getDataSize() == dataSize
+                && e.getTransferSize() == transferSize
+                && e.getIndex() == index);
+    }
+
+    /**
+     * Create DataTruncation object indicating a truncation on write
+     */
+    @Test
+    public void test1() {
+        onRead = false;
+        DataTruncation e = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize);
+        assertTrue(e.getMessage().equals(dtReason)
+                && e.getSQLState().equals(WRITE_TRUNCATION)
+                && e.getCause() == null
+                && e.getErrorCode() == dterrorCode
+                && e.getParameter() == parameter
+                && e.getRead() == onRead
+                && e.getDataSize() == dataSize
+                && e.getTransferSize() == transferSize
+                && e.getIndex() == index);
+    }
+
+    /**
+     * Create DataTruncation object indicating a truncation on read with a
+     * Throwable
+     */
+    @Test
+    public void test2() {
+        onRead = true;
+        DataTruncation e = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize, t);
+        assertTrue(e.getMessage().equals(dtReason)
+                && e.getSQLState().equals(READ_TRUNCATION)
+                && cause.equals(e.getCause().toString())
+                && e.getErrorCode() == dterrorCode
+                && e.getParameter() == parameter
+                && e.getRead() == onRead
+                && e.getDataSize() == dataSize
+                && e.getTransferSize() == transferSize
+                && e.getIndex() == index);
+    }
+
+    /**
+     * Create DataTruncation object indicating a truncation on read with null
+     * specified for the Throwable
+     */
+    @Test
+    public void test3() {
+        onRead = true;;
+        DataTruncation e = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize, null);
+        assertTrue(e.getMessage().equals(dtReason)
+                && e.getSQLState().equals(READ_TRUNCATION)
+                && e.getCause() == null
+                && e.getErrorCode() == dterrorCode
+                && e.getParameter() == parameter
+                && e.getRead() == onRead
+                && e.getDataSize() == dataSize
+                && e.getTransferSize() == transferSize
+                && e.getIndex() == index);
+    }
+
+    /**
+     * Create DataTruncation object indicating a truncation on read and you can
+     * pass a -1 for the index
+     */
+    @Test
+    public void test4() {
+        onRead = true;
+        int negIndex = -1;
+        DataTruncation e = new DataTruncation(negIndex, parameter, onRead,
+                dataSize, transferSize);
+        assertTrue(e.getMessage().equals(dtReason)
+                && e.getSQLState().equals(READ_TRUNCATION)
+                && e.getCause() == null
+                && e.getErrorCode() == dterrorCode
+                && e.getParameter() == parameter
+                && e.getRead() == onRead
+                && e.getDataSize() == dataSize
+                && e.getTransferSize() == transferSize
+                && e.getIndex() == negIndex);
+    }
+
+    /**
+     * Serialize a DataTruncation and make sure you can read it back properly
+     */
+    @Test
+    public void test5() throws Exception {
+        DataTruncation e = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize);
+        DataTruncation ex1 = createSerializedException(e);
+        assertTrue(e.getMessage().equals(dtReason)
+                && e.getSQLState().equals(READ_TRUNCATION)
+                && e.getCause() == null
+                && e.getErrorCode() == dterrorCode
+                && e.getParameter() == parameter
+                && e.getRead() == onRead
+                && e.getDataSize() == dataSize
+                && e.getTransferSize() == transferSize
+                && e.getIndex() == index);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test11() {
+        DataTruncation ex = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize, t1);
+        DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize);
+        DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize, t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(dtmsgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test12() {
+        DataTruncation ex = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize, t1);
+        DataTruncation ex1 = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize);
+        DataTruncation ex2 = new DataTruncation(index, parameter, onRead,
+                dataSize, transferSize, t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(dtmsgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(dtmsgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/DateTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,542 @@
+/*
+ * 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 test.sql;
+
+import java.sql.Date;
+import java.time.Instant;
+import java.time.LocalDate;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class DateTests {
+
+    public DateTests() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_year() throws Exception {
+        String expResult = "20009-11-01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_year2() throws Exception {
+        String expResult = "09-11-01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_year3() throws Exception {
+        String expResult = "-11-01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_month() throws Exception {
+        String expResult = "2009-111-01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_month3() throws Exception {
+        String expResult = "2009--01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_month4() throws Exception {
+        String expResult = "2009-13-01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_day() throws Exception {
+        String expResult = "2009-11-011";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_day3() throws Exception {
+        String expResult = "2009-11-";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_day4() throws Exception {
+        String expResult = "2009-11-00";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_day5() throws Exception {
+        String expResult = "2009-11-33";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf() throws Exception {
+        String expResult = "--";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf2() throws Exception {
+        String expResult = "";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf3() throws Exception {
+        String expResult = null;
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf4() throws Exception {
+        String expResult = "-";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf5() throws Exception {
+        String expResult = "2009";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf6() throws Exception {
+        String expResult = "2009-01";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf7() throws Exception {
+        String expResult = "---";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf8() throws Exception {
+        String expResult = "2009-13--1";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Date string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_valueOf10() {
+        String expResult = "1900-1-0";
+        Date.valueOf(expResult);
+    }
+
+    /**
+     * Test that a date created from a date string is equal to the value
+     * returned from toString()
+     */
+    @Test
+    public void test_valueOf() {
+        String expResult = "2009-08-30";
+        Date d = Date.valueOf(expResult);
+        assertEquals(expResult, d.toString());
+    }
+
+    /**
+     * Test that two dates, one with lead 0s omitted for month are equal
+     */
+    @Test
+    public void testValid_month_single_digit() {
+        String testDate = "2009-1-01";
+        String expResult = "2009-01-01";
+        Date d = Date.valueOf(testDate);
+        Date d2 = Date.valueOf(expResult);
+        assertEquals(d, d2);
+    }
+
+    /**
+     * Test that two dates, one with lead 0s omitted for day are equal
+     */
+    @Test
+    public void testValid_day_single_digit() {
+        String testDate = "2009-11-1";
+        String expResult = "2009-11-01";
+        Date d = Date.valueOf(testDate);
+        Date d2 = Date.valueOf(expResult);
+        assertEquals(d, d2);
+    }
+
+    /**
+     * Test that two dates, one with lead 0s omitted for month and day are equal
+     */
+    @Test
+    public void testValid_month_day_single_digit() {
+        String testDate = "2009-1-1";
+        String expResult = "2009-01-01";
+        Date d = Date.valueOf(testDate);
+        Date d2 = Date.valueOf(expResult);
+        assertEquals(d, d2);
+    }
+
+    /**
+     * Validate that a Date.after() returns false when same date is compared
+     */
+    @Test
+    public void test1() {
+        Date d = Date.valueOf("1961-08-30");
+        assertFalse(d.after(d), "Error d.after(d) = true");
+    }
+
+    /**
+     * Validate that a Date.after() returns true when later date is compared to
+     * earlier date
+     */
+    @Test
+    public void test2() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(System.currentTimeMillis());
+        assertTrue(d2.after(d), "Error d2.after(d) = false");
+    }
+
+    /**
+     * Validate that a Date.after() returns false when earlier date is compared
+     * to later date
+     */
+    @Test
+    public void test3() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(d.getTime());
+        assertFalse(d.after(d2), "Error d.after(d2) = true");
+    }
+
+    /**
+     * Validate that a Date.after() returns false when date compared to another
+     * date created from the original date
+     */
+    @Test
+    public void test4() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(d.getTime());
+        assertFalse(d.after(d2), "Error d.after(d2) = true");
+        assertFalse(d2.after(d), "Error d2.after(d) = true");
+    }
+
+    /**
+     * Validate that a Date.before() returns false when same date is compared
+     */
+    @Test
+    public void test5() {
+        Date d = Date.valueOf("1961-08-30");
+        assertFalse(d.before(d), "Error d.before(d) = true");
+    }
+
+    /**
+     * Validate that a Date.before() returns true when earlier date is compared
+     * to later date
+     */
+    @Test
+    public void test6() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(System.currentTimeMillis());
+        assertTrue(d.before(d2), "Error d.before(d2) = false");
+    }
+
+    /**
+     * Validate that a Date.before() returns false when later date is compared
+     * to earlier date
+     */
+    @Test
+    public void test7() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(d.getTime());
+        assertFalse(d2.before(d), "Error d2.before(d) = true");
+    }
+
+    /**
+     * Validate that a Date.before() returns false when date compared to another
+     * date created from the original date
+     */
+    @Test
+    public void test8() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(d.getTime());
+        assertFalse(d.before(d2), "Error d.before(d2) = true");
+        assertFalse(d2.before(d), "Error d2.before(d) = true");
+    }
+
+    /**
+     * Validate that a Date.compareTo returns 0 when both Date objects are the
+     * same
+     */
+    @Test
+    public void test9() {
+        Date d = Date.valueOf("1961-08-30");
+        assertTrue(d.compareTo(d) == 0, "Error d.compareTo(d) !=0");
+    }
+
+    /**
+     * Validate that a Date.compareTo returns 0 when both Date objects represent
+     * the same date
+     */
+    @Test
+    public void test10() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(d.getTime());
+        assertTrue(d.compareTo(d2) == 0, "Error d.compareTo(d2) !=0");
+    }
+
+    /**
+     * Validate that a Date.compareTo returns -1 when comparing a date to a
+     * later date
+     */
+    @Test
+    public void test11() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(System.currentTimeMillis());
+        assertTrue(d.compareTo(d2) == -1, "Error d.compareTo(d2) != -1");
+    }
+
+    /**
+     * Validate that a Date.compareTo returns 1 when comparing a date to an
+     * earlier date
+     */
+    @Test
+    public void test12() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(System.currentTimeMillis());
+        assertTrue(d2.compareTo(d) == 1, "Error d.compareTo(d2) != 1");
+    }
+
+    /**
+     * Validate that a Date made from a LocalDate are equal
+     */
+    @Test
+    public void test13() {
+        Date d = Date.valueOf("1961-08-30");
+        LocalDate ldt = d.toLocalDate();
+        Date d2 = Date.valueOf(ldt);
+        assertTrue(d.equals(d2), "Error d != d2");
+    }
+
+    /**
+     * Validate that a Date LocalDate value, made from a LocalDate are equal
+     */
+    @Test
+    public void test14() {
+        LocalDate ldt = LocalDate.now();
+        Date d = Date.valueOf(ldt);
+        assertTrue(ldt.equals(d.toLocalDate()),
+                "Error LocalDate values are not equal");
+    }
+
+    /**
+     * Validate an NPE occurs when a null LocalDate is passed to valueOf
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test15() throws Exception {
+        LocalDate ld = null;
+        Date.valueOf(ld);
+    }
+
+    /**
+     * Validate an UnsupportedOperationException occurs when toInstant() is
+     * called
+     */
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void test16() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        Instant instant = d.toInstant();
+    }
+
+    /**
+     * Validate that two Date objects are equal when one is created from the
+     * toString() of the other
+     */
+    @Test
+    public void test17() {
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = Date.valueOf(d.toString());
+        assertTrue(d.equals(d2) && d2.equals(d), "Error d != d2");
+    }
+
+    /**
+     * Validate that two Date values one created using valueOf and another via a
+     * constructor are equal
+     */
+    @Test
+    public void test18() {
+
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(61, 7, 30);
+        assertTrue(d.equals(d2), "Error d != d2");
+    }
+
+    /**
+     * Validate that two Date values one created using getTime() of the other
+     * are equal
+     */
+    @Test
+    public void test19() {
+
+        Date d = Date.valueOf("1961-08-30");
+        Date d2 = new Date(d.getTime());
+        assertTrue(d.equals(d2), "Error d != d2");
+    }
+
+    /**
+     * Validate that a Date value is equal to itself
+     */
+    @Test
+    public void test20() {
+
+        Date d = Date.valueOf("1961-08-30");
+        assertTrue(d.equals(d), "Error d != d");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getHours
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test21() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        d.getHours();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getMinutes
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test22() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        d.getMinutes();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getSeconds
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test23() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        d.getSeconds();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling setHours
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test24() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        d.setHours(8);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling setMinutes
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test25() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        d.setMinutes(0);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling setSeconds
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test26() throws Exception {
+        Date d = Date.valueOf("1961-08-30");
+        d.setSeconds(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/DriverManagerTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,354 @@
+/*
+ * 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 test.sql;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.StubDriver;
+
+public class DriverManagerTests {
+
+    private final String StubDriverURL = "jdbc:tennis:boy";
+    private final String StubDriverDAURL = "jdbc:luckydog:tennis";
+    private final String InvalidURL = "jdbc:cardio:tennis";
+    private String[] results = {"output", "more output", "and more", "the end"};
+    private String noOutput = "should not find this";
+
+    public DriverManagerTests() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+        removeAllDrivers();
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /**
+     * Utility method to remove all registered drivers
+     */
+    private static void removeAllDrivers() {
+        java.util.Enumeration e = DriverManager.getDrivers();
+        while (e.hasMoreElements()) {
+            try {
+                DriverManager.deregisterDriver((Driver) (e.nextElement()));
+            } catch (SQLException ex) {
+                System.out.print(ex.getMessage());
+            }
+        }
+    }
+
+    /**
+     * Utility method to see if a driver is registered
+     */
+    private boolean isDriverRegistered(Driver d) {
+        boolean foundDriver = false;
+        java.util.Enumeration e = DriverManager.getDrivers();
+        while (e.hasMoreElements()) {
+            if (d == (Driver) e.nextElement()) {
+                foundDriver = true;
+                break;
+            }
+        }
+        return foundDriver;
+    }
+
+    /**
+     * Validate that values set using setLoginTimeout will be returned by
+     * getLoginTimeout
+     */
+    @Test
+    public void test() {
+        int[] vals = {-1, 0, 5};
+        for (int val : vals) {
+            DriverManager.setLoginTimeout(val);
+            assertEquals(val, DriverManager.getLoginTimeout());
+        }
+    }
+
+    /**
+     * Validate that NullPointerException is thrown when null is passed to
+     * registerDriver
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test1() throws Exception {
+        Driver d = null;
+        DriverManager.registerDriver(d);
+    }
+
+    /**
+     * Validate that NullPointerException is thrown when null is passed to
+     * registerDriver
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test2() throws Exception {
+        Driver d = null;
+        DriverManager.registerDriver(d, null);
+    }
+
+    /**
+     * Validate that a null value allows for deRegisterDriver to return
+     */
+    @Test
+    public void test3() throws Exception {
+        DriverManager.deregisterDriver(null);
+
+    }
+
+    /**
+     * Validate that SQLException is thrown when there is no Driver to service
+     * the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test4() throws Exception {
+        DriverManager.getConnection(InvalidURL);
+    }
+
+    /**
+     * Validate that SQLException is thrown when there is no Driver to service
+     * the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test5() throws Exception {
+        DriverManager.getConnection(InvalidURL, new Properties());
+    }
+
+    /**
+     * Validate that SQLException is thrown when there is no Driver to service
+     * the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test6() throws Exception {
+        DriverManager.getConnection(InvalidURL, "LuckyDog", "tennisanyone");
+    }
+
+    /**
+     * Validate that SQLException is thrown when null is passed for the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test7() throws Exception {
+        DriverManager.getConnection(null);
+    }
+
+    /**
+     * Validate that SQLException is thrown when null is passed for the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test8() throws Exception {
+        DriverManager.getConnection(null, new Properties());
+    }
+
+    /**
+     * Validate that SQLException is thrown when null is passed for the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test9() throws Exception {
+        DriverManager.getConnection(null, "LuckyDog", "tennisanyone");
+    }
+
+    /**
+     * Validate that SQLException is thrown when there is no Driver to service
+     * the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test10() throws Exception {
+        DriverManager.getDriver(InvalidURL);
+    }
+
+    /**
+     * Validate that SQLException is thrown when null is passed for the URL
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test11() throws Exception {
+        DriverManager.getDriver(null);
+    }
+
+    /**
+     * Validate that a non-null Driver is returned by getDriver when a valid URL
+     * is specified
+     */
+    @Test
+    public void test12() throws Exception {
+
+        DriverManager.registerDriver(new StubDriver());
+        assertTrue(DriverManager.getDriver(StubDriverURL) != null);
+    }
+
+    /**
+     * Validate that SQLException is thrown when the URL is not valid for any of
+     * the registered drivers
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test13() throws Exception {
+        DriverManager.registerDriver(new StubDriver());
+        DriverManager.getDriver(InvalidURL);
+    }
+
+    /**
+     * Validate that a Connection object is returned when a valid URL is
+     * specified to getConnection
+     *
+     */
+    @Test
+    public void test14() throws Exception {
+
+        DriverManager.registerDriver(new StubDriver());
+        assertTrue(
+                DriverManager.getConnection(StubDriverURL) != null);
+        assertTrue(DriverManager.getConnection(StubDriverURL,
+                "LuckyDog", "tennisanyone") != null);
+        Properties props = new Properties();
+        props.put("user", "LuckyDog");
+        props.put("password", "tennisanyone");
+        assertTrue(
+                DriverManager.getConnection(StubDriverURL,
+                        props) != null);
+    }
+
+    /**
+     * Register a driver and make sure you find it via its URL. Deregister the
+     * driver and validate it is not longer registered
+     *
+     * @throws Exception
+     */
+    @Test()
+    public void test15() throws Exception {
+        DriverManager.registerDriver(new StubDriver());
+        Driver d = DriverManager.getDriver(StubDriverURL);
+        assertTrue(d != null);
+        assertTrue(isDriverRegistered(d));
+        DriverManager.deregisterDriver(d);
+        assertFalse(isDriverRegistered(d));
+    }
+
+    /**
+     * Validate that DriverAction.release is called when a driver is registered
+     * via registerDriver(Driver, DriverAction)
+     *
+     * @throws Exception
+     */
+    @Test
+    public void test16() throws Exception {
+        File file = new File(util.StubDriverDA.DriverActionCalled);
+        file.delete();
+        assertFalse(file.exists());
+        Driver d = null;
+        Class.forName("util.StubDriverDA");
+        d = DriverManager.getDriver(StubDriverDAURL);
+        DriverManager.deregisterDriver(d);
+        assertFalse(isDriverRegistered(d), "Driver is registered");
+        assertTrue(file.exists());
+    }
+
+    /**
+     * Create a PrintStream and use to send output via DriverManager.println
+     * Validate that if you disable the stream, the output sent is not present
+     */
+    @Test
+    public void tests17() throws Exception {
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        PrintStream ps = new PrintStream(os);
+        DriverManager.setLogStream(ps);
+        assertTrue(DriverManager.getLogStream() == ps);
+
+        DriverManager.println(results[0]);
+        DriverManager.setLogStream((PrintStream) null);
+        assertTrue(DriverManager.getLogStream() == null);
+        DriverManager.println(noOutput);
+        DriverManager.setLogStream(ps);
+        DriverManager.println(results[1]);
+        DriverManager.println(results[2]);
+        DriverManager.println(results[3]);
+        DriverManager.setLogStream((PrintStream) null);
+        DriverManager.println(noOutput);
+
+        /*
+         * Check we do not get the output when the stream is disabled
+         */
+        InputStreamReader is
+                = new InputStreamReader(new ByteArrayInputStream(os.toByteArray()));
+        BufferedReader reader = new BufferedReader(is);
+        for (String result : results) {
+            assertTrue(result.equals(reader.readLine()));
+        }
+    }
+
+    /**
+     * Create a PrintWriter and use to to send output via DriverManager.println
+     * Validate that if you disable the writer, the output sent is not present
+     */
+    @Test
+    public void tests18() throws Exception {
+        CharArrayWriter cw = new CharArrayWriter();
+        PrintWriter pw = new PrintWriter(cw);
+        DriverManager.setLogWriter(pw);
+        assertTrue(DriverManager.getLogWriter() == pw);
+
+        DriverManager.println(results[0]);
+        DriverManager.setLogWriter(null);
+        assertTrue(DriverManager.getLogWriter() == null);
+        DriverManager.println(noOutput);
+        DriverManager.setLogWriter(pw);
+        DriverManager.println(results[1]);
+        DriverManager.println(results[2]);
+        DriverManager.println(results[3]);
+        DriverManager.setLogWriter(null);
+        DriverManager.println(noOutput);
+
+        /*
+         * Check we do not get the output when the stream is disabled
+         */
+        BufferedReader reader
+                = new BufferedReader(new CharArrayReader(cw.toCharArray()));
+        for (String result : results) {
+            assertTrue(result.equals(reader.readLine()));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLClientInfoExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,227 @@
+/*
+ * 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 test.sql;
+
+import java.sql.ClientInfoStatus;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.util.HashMap;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLClientInfoExceptionTests extends BaseTest {
+
+    private final HashMap<String, ClientInfoStatus> map = new HashMap<>();
+
+    public SQLClientInfoExceptionTests() {
+        map.put("1", ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
+        map.put("21", ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
+    }
+
+    /**
+     * Create SQLClientInfoException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLClientInfoException e = new SQLClientInfoException(null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == 0
+                && e.getFailedProperties() == null);
+    }
+
+    /**
+     * Create SQLClientInfoException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLClientInfoException ex = new SQLClientInfoException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getFailedProperties() == null);
+    }
+
+    /**
+     * Create SQLClientInfoException with null Throwable
+     */
+    @Test
+    public void test2() {
+
+        SQLClientInfoException ex = new SQLClientInfoException(map, null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Create SQLClientInfoException with message
+     */
+    @Test
+    public void test3() {
+        SQLClientInfoException ex = new SQLClientInfoException(reason, map);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Create SQLClientInfoException with null Throwable
+     */
+    @Test
+    public void test4() {
+        SQLClientInfoException ex = new SQLClientInfoException(reason, map, null);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Create SQLClientInfoException with message, and SQLState
+     */
+    @Test
+    public void test5() {
+        SQLClientInfoException ex = new SQLClientInfoException(reason, state,
+                map);
+
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Create SQLClientInfoException with message, and SQLState
+     */
+    @Test
+    public void test6() {
+        SQLClientInfoException ex = new SQLClientInfoException(reason, state,
+                map, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Create SQLClientInfoException with message, SQLState, errorCode, and
+     * Throwable
+     */
+    @Test
+    public void test7() {
+        SQLClientInfoException ex = new SQLClientInfoException(reason, state,
+                errorCode, map);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Create SQLClientInfoException with message, SQLState, and error code
+     */
+    @Test
+    public void test8() {
+        SQLClientInfoException ex = new SQLClientInfoException(reason, state,
+                errorCode, map, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode
+                && ex.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Serialize a SQLClientInfoException and make sure you can read it back
+     * properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLClientInfoException e = new SQLClientInfoException(reason, state,
+                errorCode, map, t);
+        SQLClientInfoException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode
+                && ex1.getFailedProperties().equals(map));
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLClientInfoException ex = new SQLClientInfoException("Exception 1",
+                map, t1);
+        SQLClientInfoException ex1 = new SQLClientInfoException("Exception 2",
+                map);
+        SQLClientInfoException ex2 = new SQLClientInfoException("Exception 3",
+                map, t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLClientInfoException ex = new SQLClientInfoException("Exception 1",
+                map, t1);
+        SQLClientInfoException ex1 = new SQLClientInfoException("Exception 2",
+                map);
+        SQLClientInfoException ex2 = new SQLClientInfoException("Exception 3",
+                map, t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLDataExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,215 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLDataException;
+import java.sql.SQLException;
+import java.sql.SQLNonTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLDataExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLDataException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLDataException e = new SQLDataException(null, null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLDataException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLDataException ex = new SQLDataException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLDataException with message
+     */
+    @Test
+    public void test2() {
+        SQLDataException ex = new SQLDataException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLDataException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLDataException ex = new SQLDataException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLDataException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLDataException ex = new SQLDataException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLDataException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLDataException ex = new SQLDataException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLDataException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLDataException ex = new SQLDataException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLDataException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLDataException ex = new SQLDataException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLDataException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLDataException ex = new SQLDataException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLDataException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLDataException ex = new SQLDataException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLDataException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLDataException e = new SQLDataException(reason, state, errorCode, t);
+        SQLDataException ex1 = createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLDataException ex = new SQLDataException("Exception 1", t1);
+        SQLDataException ex1 = new SQLDataException("Exception 2");
+        SQLDataException ex2 = new SQLDataException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLDataException ex = new SQLDataException("Exception 1", t1);
+        SQLDataException ex1 = new SQLDataException("Exception 2");
+        SQLDataException ex2 = new SQLDataException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLDataException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLDataException();
+        assertTrue(ex instanceof SQLNonTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,202 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLException e = new SQLException(null, null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLException ex = new SQLException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLException with message
+     */
+    @Test
+    public void test2() {
+        SQLException ex = new SQLException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLException ex = new SQLException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLException ex = new SQLException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLException ex = new SQLException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLException ex = new SQLException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLException ex = new SQLException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLException ex = new SQLException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLException ex = new SQLException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLException e = new SQLException(reason, state, errorCode, t);
+        SQLException ex1 = createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLException ex = new SQLException("Exception 1", t1);
+        SQLException ex1 = new SQLException("Exception 2");
+        SQLException ex2 = new SQLException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLException ex = new SQLException("Exception 1", t1);
+        SQLException ex1 = new SQLException("Exception 2");
+        SQLException ex2 = new SQLException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        while (ex != null) {
+            assertTrue(msgs[num++].equals(ex.getMessage()));
+            Throwable c = ex.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            ex = ex.getNextException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLFeatureNotSupportedExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,232 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLNonTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLFeatureNotSupportedExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLFeatureNotSupportedException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLFeatureNotSupportedException e =
+                new SQLFeatureNotSupportedException(null, null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLFeatureNotSupportedException ex = new SQLFeatureNotSupportedException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with message
+     */
+    @Test
+    public void test2() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException((Throwable) null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLFeatureNotSupportedException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLFeatureNotSupportedException e =
+                new SQLFeatureNotSupportedException(reason, state, errorCode, t);
+        SQLFeatureNotSupportedException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException("Exception 1", t1);
+        SQLFeatureNotSupportedException ex1 =
+                new SQLFeatureNotSupportedException("Exception 2");
+        SQLFeatureNotSupportedException ex2 =
+                new SQLFeatureNotSupportedException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLFeatureNotSupportedException ex =
+                new SQLFeatureNotSupportedException("Exception 1", t1);
+        SQLFeatureNotSupportedException ex1 =
+                new SQLFeatureNotSupportedException("Exception 2");
+        SQLFeatureNotSupportedException ex2 =
+                new SQLFeatureNotSupportedException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLFeatureNotSupportedException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLFeatureNotSupportedException();
+        assertTrue(ex instanceof SQLNonTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLIntegrityConstraintViolationExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,235 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.sql.SQLNonTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLIntegrityConstraintViolationExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLIntegrityConstraintViolationException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLIntegrityConstraintViolationException e =
+                new SQLIntegrityConstraintViolationException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with message
+     */
+    @Test
+    public void test2() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLIntegrityConstraintViolationException and make sure
+     * you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLIntegrityConstraintViolationException e =
+                new SQLIntegrityConstraintViolationException(reason, state, errorCode, t);
+        SQLIntegrityConstraintViolationException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException("Exception 1", t1);
+        SQLIntegrityConstraintViolationException ex1 =
+                new SQLIntegrityConstraintViolationException("Exception 2");
+        SQLIntegrityConstraintViolationException ex2 =
+                new SQLIntegrityConstraintViolationException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLIntegrityConstraintViolationException ex =
+                new SQLIntegrityConstraintViolationException("Exception 1", t1);
+        SQLIntegrityConstraintViolationException ex1 =
+                new SQLIntegrityConstraintViolationException("Exception 2");
+        SQLIntegrityConstraintViolationException ex2 =
+                new SQLIntegrityConstraintViolationException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLIntegrityConstraintViolationException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLIntegrityConstraintViolationException();
+        assertTrue(ex instanceof SQLNonTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLInvalidAuthorizationSpecExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,239 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLInvalidAuthorizationSpecException;
+import java.sql.SQLNonTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLInvalidAuthorizationSpecExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException and setting all objects to
+     * null
+     */
+    @Test
+    public void test() {
+        SQLInvalidAuthorizationSpecException e
+                = new SQLInvalidAuthorizationSpecException(null,
+                        null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with message
+     */
+    @Test
+    public void test2() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with message, SQLState, and
+     * error code
+     */
+    @Test
+    public void test4() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with message, SQLState,
+     * errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with message, SQLState, and
+     * Throwable
+     */
+    @Test
+    public void test6() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException((Throwable) null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLInvalidAuthorizationSpecException and make sure you can
+     * read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLInvalidAuthorizationSpecException e
+                = new SQLInvalidAuthorizationSpecException(reason, state, errorCode, t);
+        SQLInvalidAuthorizationSpecException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException("Exception 1", t1);
+        SQLInvalidAuthorizationSpecException ex1
+                = new SQLInvalidAuthorizationSpecException("Exception 2");
+        SQLInvalidAuthorizationSpecException ex2
+                = new SQLInvalidAuthorizationSpecException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLInvalidAuthorizationSpecException ex
+                = new SQLInvalidAuthorizationSpecException("Exception 1", t1);
+        SQLInvalidAuthorizationSpecException ex1
+                = new SQLInvalidAuthorizationSpecException("Exception 2");
+        SQLInvalidAuthorizationSpecException ex2
+                = new SQLInvalidAuthorizationSpecException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLInvalidAuthorizationSpecException and validate it is an
+     * instance of SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLInvalidAuthorizationSpecException();
+        assertTrue(ex instanceof SQLNonTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLNonTransientConnectionExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,235 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLNonTransientConnectionException;
+import java.sql.SQLNonTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLNonTransientConnectionExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLNonTransientConnectionException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLNonTransientConnectionException e =
+                new SQLNonTransientConnectionException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with message
+     */
+    @Test
+    public void test2() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLNonTransientConnectionException and make sure you can
+     * read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLNonTransientConnectionException e =
+                new SQLNonTransientConnectionException(reason, state, errorCode, t);
+        SQLNonTransientConnectionException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException("Exception 1", t1);
+        SQLNonTransientConnectionException ex1 =
+                new SQLNonTransientConnectionException("Exception 2");
+        SQLNonTransientConnectionException ex2 =
+                new SQLNonTransientConnectionException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLNonTransientConnectionException ex =
+                new SQLNonTransientConnectionException("Exception 1", t1);
+        SQLNonTransientConnectionException ex1 =
+                new SQLNonTransientConnectionException("Exception 2");
+        SQLNonTransientConnectionException ex2 =
+                new SQLNonTransientConnectionException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLNonTransientConnectionException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLNonTransientConnectionException();
+        assertTrue(ex instanceof SQLNonTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLNonTransientExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,209 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLNonTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLNonTransientExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLNonTransientException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLNonTransientException e = new SQLNonTransientException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLNonTransientException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLNonTransientException ex = new SQLNonTransientException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientException with message
+     */
+    @Test
+    public void test2() {
+        SQLNonTransientException ex = new SQLNonTransientException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLNonTransientException ex = new SQLNonTransientException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {;
+        SQLNonTransientException ex =
+                new SQLNonTransientException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLNonTransientException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLNonTransientException ex =
+                new SQLNonTransientException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLNonTransientException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLNonTransientException ex = new SQLNonTransientException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLNonTransientException ex = new SQLNonTransientException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLNonTransientException ex = new SQLNonTransientException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLNonTransientException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLNonTransientException ex = new SQLNonTransientException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLNonTransientException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLNonTransientException e =
+                new SQLNonTransientException(reason, state, errorCode, t);
+        SQLNonTransientException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLNonTransientException ex = new SQLNonTransientException("Exception 1", t1);
+        SQLNonTransientException ex1 = new SQLNonTransientException("Exception 2");
+        SQLNonTransientException ex2 = new SQLNonTransientException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLNonTransientException ex = new SQLNonTransientException("Exception 1", t1);
+        SQLNonTransientException ex1 = new SQLNonTransientException("Exception 2");
+        SQLNonTransientException ex2 = new SQLNonTransientException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLRecoverableExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,209 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLRecoverableException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLRecoverableExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLRecoverableException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLRecoverableException e = new SQLRecoverableException(null,
+               null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLRecoverableException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLRecoverableException ex = new SQLRecoverableException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLRecoverableException with message
+     */
+    @Test
+    public void test2() {
+        SQLRecoverableException ex = new SQLRecoverableException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLRecoverableException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLRecoverableException ex = new SQLRecoverableException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLRecoverableException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLRecoverableException ex =
+                new SQLRecoverableException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLRecoverableException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLRecoverableException ex =
+                new SQLRecoverableException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLRecoverableException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLRecoverableException ex = new SQLRecoverableException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLRecoverableException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLRecoverableException ex = new SQLRecoverableException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLRecoverableException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLRecoverableException ex = new SQLRecoverableException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLRecoverableException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLRecoverableException ex = new SQLRecoverableException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLRecoverableException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLRecoverableException e =
+                new SQLRecoverableException(reason, state, errorCode, t);
+        SQLRecoverableException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
+        SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
+        SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
+        SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
+        SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLSyntaxErrorExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,221 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLNonTransientException;
+import java.sql.SQLSyntaxErrorException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLSyntaxErrorExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLSyntaxErrorException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLSyntaxErrorException e = new SQLSyntaxErrorException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with message
+     */
+    @Test
+    public void test2() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLSyntaxErrorException ex =
+                new SQLSyntaxErrorException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLSyntaxErrorException ex =
+                new SQLSyntaxErrorException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLSyntaxErrorException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLSyntaxErrorException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+
+        SQLSyntaxErrorException e =
+                new SQLSyntaxErrorException(reason, state, errorCode, t);
+        SQLSyntaxErrorException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException("Exception 1", t1);
+        SQLSyntaxErrorException ex1 = new SQLSyntaxErrorException("Exception 2");
+        SQLSyntaxErrorException ex2 = new SQLSyntaxErrorException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLSyntaxErrorException ex = new SQLSyntaxErrorException("Exception 1", t1);
+        SQLSyntaxErrorException ex1 = new SQLSyntaxErrorException("Exception 2");
+        SQLSyntaxErrorException ex2 = new SQLSyntaxErrorException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLSyntaxErrorException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLSyntaxErrorException();
+        assertTrue(ex instanceof SQLNonTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLTimeoutExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,218 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLTimeoutException;
+import java.sql.SQLTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLTimeoutExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLTimeoutException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLTimeoutException e = new SQLTimeoutException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTimeoutException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLTimeoutException ex = new SQLTimeoutException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTimeoutException with message
+     */
+    @Test
+    public void test2() {
+        SQLTimeoutException ex = new SQLTimeoutException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTimeoutException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLTimeoutException ex = new SQLTimeoutException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTimeoutException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLTimeoutException ex = new SQLTimeoutException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTimeoutException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLTimeoutException ex = new SQLTimeoutException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTimeoutException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLTimeoutException ex = new SQLTimeoutException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTimeoutException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLTimeoutException ex = new SQLTimeoutException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTimeoutException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLTimeoutException ex = new SQLTimeoutException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTimeoutException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLTimeoutException ex = new SQLTimeoutException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLTimeoutException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLTimeoutException e =
+                new SQLTimeoutException(reason, state, errorCode, t);
+        SQLTimeoutException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLTimeoutException ex = new SQLTimeoutException("Exception 1", t1);
+        SQLTimeoutException ex1 = new SQLTimeoutException("Exception 2");
+        SQLTimeoutException ex2 = new SQLTimeoutException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLTimeoutException ex = new SQLTimeoutException("Exception 1", t1);
+        SQLTimeoutException ex1 = new SQLTimeoutException("Exception 2");
+        SQLTimeoutException ex2 = new SQLTimeoutException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLTimeoutException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLTimeoutException();
+        assertTrue(ex instanceof SQLTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLTransactionRollbackExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,233 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLTransactionRollbackException;
+import java.sql.SQLTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLTransactionRollbackExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLTransactionRollbackException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLTransactionRollbackException e =
+                new SQLTransactionRollbackException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLTransactionRollbackException ex = new SQLTransactionRollbackException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with message
+     */
+    @Test
+    public void test2() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransactionRollbackException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLTransactionRollbackException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLTransactionRollbackException e =
+                new SQLTransactionRollbackException(reason, state, errorCode, t);
+        SQLTransactionRollbackException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException("Exception 1", t1);
+        SQLTransactionRollbackException ex1 =
+                new SQLTransactionRollbackException("Exception 2");
+        SQLTransactionRollbackException ex2 =
+                new SQLTransactionRollbackException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLTransactionRollbackException ex =
+                new SQLTransactionRollbackException("Exception 1", t1);
+        SQLTransactionRollbackException ex1 =
+                new SQLTransactionRollbackException("Exception 2");
+        SQLTransactionRollbackException ex2 =
+                new SQLTransactionRollbackException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLTransactionRollbackException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLTransactionRollbackException();
+        assertTrue(ex instanceof SQLTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLTransientConnectionExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,233 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLTransientConnectionException;
+import java.sql.SQLTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLTransientConnectionExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLTransientConnectionException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLTransientConnectionException e =
+                new SQLTransientConnectionException( null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLTransientConnectionException ex = new SQLTransientConnectionException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with message
+     */
+    @Test
+    public void test2() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {;
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientConnectionException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLTransientConnectionException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLTransientConnectionException e =
+                new SQLTransientConnectionException(reason, state, errorCode, t);
+        SQLTransientConnectionException ex1 =
+                createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException("Exception 1", t1);
+        SQLTransientConnectionException ex1 =
+                new SQLTransientConnectionException("Exception 2");
+        SQLTransientConnectionException ex2 =
+                new SQLTransientConnectionException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLTransientConnectionException ex =
+                new SQLTransientConnectionException("Exception 1", t1);
+        SQLTransientConnectionException ex1 =
+                new SQLTransientConnectionException("Exception 2");
+        SQLTransientConnectionException ex2 =
+                new SQLTransientConnectionException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Create SQLTransientConnectionException and validate it is an instance of
+     * SQLNonTransientException
+     */
+    @Test
+    public void test13() {
+        Exception ex = new SQLTransientConnectionException();
+        assertTrue(ex instanceof SQLTransientException);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLTransientExceptionTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,207 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLTransientException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLTransientExceptionTests extends BaseTest {
+
+    /**
+     * Create SQLTransientException and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLTransientException e = new SQLTransientException(null,
+                null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransientException with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLTransientException ex = new SQLTransientException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientException with message
+     */
+    @Test
+    public void test2() {
+        SQLTransientException ex = new SQLTransientException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientException with message, and SQLState
+     */
+    @Test
+    public void test3() {
+        SQLTransientException ex = new SQLTransientException(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientException with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLTransientException ex = new SQLTransientException(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransientException with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLTransientException ex =
+                new SQLTransientException(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLTransientException with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLTransientException ex = new SQLTransientException(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientException with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLTransientException ex = new SQLTransientException(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientException with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLTransientException ex = new SQLTransientException((Throwable)null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLTransientException with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLTransientException ex = new SQLTransientException(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLTransientException and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLTransientException e =
+                new SQLTransientException(reason, state, errorCode, t);
+        SQLTransientException ex1 = createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLTransientException ex = new SQLTransientException("Exception 1", t1);
+        SQLTransientException ex1 = new SQLTransientException("Exception 2");
+        SQLTransientException ex2 = new SQLTransientException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct
+     * using traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLTransientException ex = new SQLTransientException("Exception 1", t1);
+        SQLTransientException ex1 = new SQLTransientException("Exception 2");
+        SQLTransientException ex2 = new SQLTransientException("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/SQLWarningTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,249 @@
+/*
+ * 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 test.sql;
+
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SQLWarningTests extends BaseTest {
+
+    private final String[] warnings = {"Warning 1", "cause 1", "Warning 2",
+            "Warning 3", "cause 2"};
+
+    /**
+     * Create SQLWarning and setting all objects to null
+     */
+    @Test
+    public void test() {
+        SQLWarning e = new SQLWarning(null, null, errorCode, null);
+        assertTrue(e.getMessage() == null && e.getSQLState() == null
+                && e.getCause() == null && e.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLWarning with no-arg constructor
+     */
+    @Test
+    public void test1() {
+        SQLWarning ex = new SQLWarning();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLWarning with message
+     */
+    @Test
+    public void test2() {
+        SQLWarning ex = new SQLWarning(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLWarning with message, and SQLState
+     */
+    @Test
+    public void test3() {
+
+        SQLWarning ex = new SQLWarning(reason, state);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLWarning with message, SQLState, and error code
+     */
+    @Test
+    public void test4() {
+        SQLWarning ex = new SQLWarning(reason, state, errorCode);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && ex.getCause() == null
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLWarning with message, SQLState, errorCode, and Throwable
+     */
+    @Test
+    public void test5() {
+        SQLWarning ex = new SQLWarning(reason, state, errorCode, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Create SQLWarning with message, SQLState, and Throwable
+     */
+    @Test
+    public void test6() {
+        SQLWarning ex = new SQLWarning(reason, state, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState().equals(state)
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLWarning with message, and Throwable
+     */
+    @Test
+    public void test7() {
+        SQLWarning ex = new SQLWarning(reason, t);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLWarning with null Throwable
+     */
+    @Test
+    public void test8() {
+        SQLWarning ex = new SQLWarning((Throwable) null);
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Create SQLWarning with Throwable
+     */
+    @Test
+    public void test9() {
+        SQLWarning ex = new SQLWarning(t);
+        assertTrue(ex.getMessage().equals(cause)
+                && ex.getSQLState() == null
+                && cause.equals(ex.getCause().toString())
+                && ex.getErrorCode() == 0);
+    }
+
+    /**
+     * Serialize a SQLWarning and make sure you can read it back properly
+     */
+    @Test
+    public void test10() throws Exception {
+        SQLWarning e = new SQLWarning(reason, state, errorCode, t);
+        SQLWarning ex1 = createSerializedException(e);
+        assertTrue(reason.equals(ex1.getMessage())
+                && ex1.getSQLState().equals(state)
+                && cause.equals(ex1.getCause().toString())
+                && ex1.getErrorCode() == errorCode);
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test11() {
+        SQLWarning ex = new SQLWarning("Exception 1", t1);
+        SQLWarning ex1 = new SQLWarning("Exception 2");
+        SQLWarning ex2 = new SQLWarning("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test12() {
+        SQLWarning ex = new SQLWarning("Exception 1", t1);
+        SQLWarning ex1 = new SQLWarning("Exception 2");
+        SQLWarning ex2 = new SQLWarning("Exception 3", t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        SQLException sqe = ex;
+        while (sqe != null) {
+            assertTrue(msgs[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextException();
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned SQLWarning is correct using
+     * for-each loop
+     */
+    @Test
+    public void test13() {
+        SQLWarning ex = new SQLWarning("Warning 1", t1);
+        SQLWarning ex1 = new SQLWarning("Warning 2");
+        SQLWarning ex2 = new SQLWarning("Warning 3", t2);
+        ex.setNextWarning(ex1);
+        ex.setNextWarning(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(warnings[num++].equals(e.getMessage()));
+        }
+    }
+
+    /**
+     * Validate that the ordering of the returned SQLWarning is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test14() {
+        SQLWarning ex = new SQLWarning("Warning 1", t1);
+        SQLWarning ex1 = new SQLWarning("Warning 2");
+        SQLWarning ex2 = new SQLWarning("Warning 3", t2);
+        ex.setNextWarning(ex1);
+        ex.setNextWarning(ex2);
+        int num = 0;
+        SQLWarning sqe = ex;
+        while (sqe != null) {
+            assertTrue(warnings[num++].equals(sqe.getMessage()));
+            Throwable c = sqe.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            sqe = sqe.getNextWarning();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/TimeTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,376 @@
+/*
+ * 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 test.sql;
+
+import java.sql.Time;
+import java.time.LocalTime;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class TimeTests {
+
+    public TimeTests() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getYear
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test1() {
+        Time t = Time.valueOf("08:30:59");
+        t.getYear();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getMonth
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test2() {
+        Time t = Time.valueOf("08:30:59");
+        t.getMonth();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getDay
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test3() {
+        Time t = Time.valueOf("08:30:59");
+        t.getDay();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getDate
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test4() {
+        Time t = Time.valueOf("08:30:59");
+        t.getDate();
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling setYear
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test5() {
+        Time t = Time.valueOf("08:30:59");
+        t.setYear(8);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling setMonth
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test6() {
+        Time t = Time.valueOf("08:30:59");
+        t.setMonth(8);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling setDate
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test7() {
+        Time t = Time.valueOf("08:30:59");
+        t.setDate(30);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling getDate
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test8() {
+        Time t = Time.valueOf("08:30:59");
+        t.getDate();
+    }
+
+    /**
+     * Validate that a Time made from a toLocalTime() LocalTime are equal
+     */
+    @Test
+    public void test13() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = Time.valueOf(t.toLocalTime());
+        assertTrue(t.equals(t2), "Error t != t2");
+    }
+
+    /**
+     * Validate that a Time LocalTime value, made from a LocalTime are equal
+     */
+    @Test
+    public void test14() {
+        LocalTime lt = LocalTime.of(8, 30, 59);
+        Time t = Time.valueOf(lt);
+        System.out.println("lt=" + lt + ",t=" + t.toLocalTime());
+        assertTrue(lt.equals(t.toLocalTime()),
+                "Error LocalTime values are not equal");
+    }
+
+    /**
+     * Validate an NPE occurs when a null LocalDate is passed to valueOf
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test15() throws Exception {
+        LocalTime ld = null;
+        Time.valueOf(ld);
+    }
+
+    /**
+     * Validate an UnsupportedOperationException occurs when toInstant() is
+     * called
+     */
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void test16() throws Exception {
+        Time t = new Time(System.currentTimeMillis());
+        t.toInstant();
+    }
+
+    /**
+     * Validate that a Time made from valueOf(String) returns the same String
+     * from Time.toString();
+     */
+    @Test
+    public void test17() {
+        String time = "08:30:59";
+        Time t = Time.valueOf(time);
+        assertTrue(time.equals(t.toString()), "Error t != t2");
+    }
+
+    /**
+     * Validate that two Time objects are equal when one is created from the
+     * toString() of the other
+     */
+    @Test
+    public void test18() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = Time.valueOf(t.toString());
+        assertTrue(t.equals(t2) && t2.equals(t), "Error t != t2");
+    }
+
+    /**
+     * Validate that two Time values one created using valueOf and another via a
+     * constructor are equal
+     */
+    @Test
+    public void test19() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(8, 30, 59);
+        assertTrue(t.equals(t2) && t2.equals(t), "Error t != t2");
+    }
+
+    /**
+     * Validate that two Time values one created using valueOf and another via a
+     * constructor are equal
+     */
+    @Test
+    public void test20() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(t.getTime());
+        assertTrue(t.equals(t2) && t2.equals(t), "Error t != t2");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for calling valueOf with a
+     * null String
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test21() {
+        String time = null;
+        Time t = Time.valueOf(time);
+
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Time string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test22() throws Exception {
+        Time.valueOf("1961-08-30");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Time string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test23() throws Exception {
+        Time.valueOf("8:");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Time string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test24() throws Exception {
+        Time.valueOf("a:b:c");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Time string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test25() throws Exception {
+        Time.valueOf("08:10");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Time string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test26() throws Exception {
+        Time.valueOf("08:10:10:10");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Time string
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test27() throws Exception {
+        Time.valueOf("08:10:Batman");
+    }
+
+    /**
+     * Validate that Time.after() returns false when same date is compared
+     */
+    @Test
+    public void test28() {
+        Time t = Time.valueOf("08:30:59");
+        assertFalse(t.after(t), "Error t.after(t) = true");
+    }
+
+    /**
+     * Validate that Time.after() returns true when later date is compared to
+     * earlier date
+     */
+    @Test
+    public void test29() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(System.currentTimeMillis());
+        assertTrue(t2.after(t), "Error t2.after(t) = false");
+    }
+
+    /**
+     * Validate that Time.after() returns false when earlier date is compared to
+     * itself
+     */
+    @Test
+    public void test30() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(t.getTime());
+        assertFalse(t.after(t2), "Error t.after(t2) = true");
+        assertFalse(t2.after(t), "Error t2.after(t) = true");
+    }
+
+    /**
+     * Validate that Time.before() returns false when same date is compared
+     */
+    @Test
+    public void test31() {
+        Time t = Time.valueOf("08:30:59");
+        assertFalse(t.before(t), "Error t.before(t) = true");
+    }
+
+    /**
+     * Validate that Time.before() returns true when earlier date is compared to
+     * later date
+     */
+    @Test
+    public void test32() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(System.currentTimeMillis());
+        assertTrue(t.before(t2), "Error t.before(t2) = false");
+    }
+
+    /**
+     * Validate that Time.before() returns false when earlier date is compared
+     * to itself
+     */
+    @Test
+    public void test33() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(t.getTime());
+        assertFalse(t.before(t2), "Error t.after(t2) = true");
+        assertFalse(t2.before(t), "Error t2.after(t) = true");
+    }
+
+    /**
+     * Validate that Time.compareTo returns 0 when both Date objects are the
+     * same
+     */
+    @Test
+    public void test34() {
+        Time t = Time.valueOf("08:30:59");
+        assertTrue(t.compareTo(t) == 0, "Error t.compareTo(t) !=0");
+    }
+
+    /**
+     * Validate thatTime.compareTo returns 0 when both Time objects are the same
+     */
+    @Test
+    public void test35() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(t.getTime());
+        assertTrue(t.compareTo(t2) == 0, "Error t.compareTo(t2) !=0");
+    }
+
+    /**
+     * Validate that Time.compareTo returns 1 when comparing a later Time to an
+     * earlier Time
+     */
+    @Test
+    public void test36() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(t.getTime() + 1);
+        assertTrue(t2.compareTo(t) == 1, "Error t2.compareTo(t) !=1");
+    }
+
+    /**
+     * Validate thatTime.compareTo returns 1 when comparing a later Time to an
+     * earlier Time
+     */
+    @Test
+    public void test37() {
+        Time t = Time.valueOf("08:30:59");
+        Time t2 = new Time(t.getTime() + 1);
+        assertTrue(t.compareTo(t2) == -1, "Error t.compareTo(t2) != -1");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/test/sql/TimestampTests.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,640 @@
+/*
+ * 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 test.sql;
+
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.util.Calendar;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class TimestampTests {
+
+    public TimestampTests() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Timestamp
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_timestamp() throws Exception {
+        String testTS = "2009-11-01-01 10:50";
+        Timestamp.valueOf(testTS);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Timestamp
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_year2() throws Exception {
+        String testTS = "aaaa-11-01-01 10:50";
+        Timestamp.valueOf(testTS);
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid Timestamp
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testInvalid_year3() throws Exception {
+        String testTS = "aaaa-11-01 10:50";
+        Timestamp.valueOf(testTS);
+    }
+
+    /**
+     * Validate that two Timestamp are equal when the leading 0 in seconds is
+     * omitted
+     */
+    @Test
+    public void test1() throws Exception {
+        String testTS = "2009-01-01 10:50:00";
+        String ExpectedTS = "2009-01-01 10:50:0";
+        Timestamp ts = Timestamp.valueOf(testTS);
+        Timestamp ts2 = Timestamp.valueOf(ExpectedTS);
+        assertEquals(ts, ts2, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate two Timestamps created from the same string are equal
+     */
+    @Test
+    public void test2() throws Exception {
+        String testTS = "2009-01-01 10:50:0";
+        Timestamp ts = Timestamp.valueOf(testTS);
+        Timestamp ts2 = Timestamp.valueOf(testTS);
+        assertEquals(ts, ts2, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one with leading 0s for month and day
+     * equals same string without the leading 0s.
+     */
+    @Test
+    public void test3() throws Exception {
+        String testTS = "2009-1-1 10:50:0";
+        String ExpectedTS = "2009-01-01 10:50:0";
+        Timestamp ts = Timestamp.valueOf(testTS);
+        Timestamp ts2 = Timestamp.valueOf(ExpectedTS);
+        assertEquals(ts, ts2, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one with leading 0s for day omitted
+     * are equal
+     */
+    @Test
+    public void test4() throws Exception {
+        String testTS = "2009-01-1 10:50:0";
+        String ExpectedTS = "2009-01-01 10:50:0";
+        Timestamp ts = Timestamp.valueOf(testTS);
+        Timestamp ts2 = Timestamp.valueOf(ExpectedTS);
+        assertEquals(ts, ts2, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one with leading 0s for month omitted
+     * and both with leading 0s for seconds omitted are equal
+     */
+    @Test
+    public void test5() throws Exception {
+        String testTS = "2009-1-01 10:50:0";
+        String ExpectedTS = "2009-01-01 10:50:0";
+        Timestamp ts = Timestamp.valueOf(testTS);
+        Timestamp ts2 = Timestamp.valueOf(ExpectedTS);
+        assertEquals(ts, ts2, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one with leading 0s for month omitted
+     */
+    @Test
+    public void test6() throws Exception {
+        String testTS = "2005-1-01 10:20:50.00";
+        String ExpectedTS = "2005-01-01 10:20:50.00";
+        Timestamp ts = Timestamp.valueOf(testTS);
+        Timestamp ts2 = Timestamp.valueOf(ExpectedTS);
+        assertEquals(ts, ts2, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one created using valueOf and another
+     * via a constructor are equal
+     */
+    @Test
+    public void test7() {
+
+        Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.001");
+        Timestamp ts2 = new Timestamp(96, 11, 13, 14, 15, 25, 1000000);
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one created using valueOf and another
+     * via a constructor are equal
+     */
+    @Test
+    public void test8() {
+        Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.001");
+        Timestamp ts2 = new Timestamp(ts1.getTime());
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that two Timestamp values one created using valueOf and another
+     * via a constructor are equal
+     */
+    @Test
+    public void test9() {
+
+        Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.0");
+        Timestamp ts2 = new Timestamp(96, 11, 13, 14, 15, 25, 0);
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that a Timestamp cannot be equal to null
+     */
+    @Test
+    public void test10() {
+
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 14:15:25.745634");
+        assertFalse(ts1.equals(null), "Error ts1 == null");
+    }
+
+    /**
+     * Validate that a Timestamp is equal to another timestamp created with the
+     * using the same value but not equal to a Timestamp which is one day later
+     */
+    @Test
+    public void test11() {
+
+        Timestamp ts1 = Timestamp.valueOf("1996-12-10 12:26:19.12");
+        Timestamp ts2 = Timestamp.valueOf("1996-12-10 12:26:19.12");
+        Timestamp ts3 = Timestamp.valueOf("1996-12-11 12:24:19.12");
+        assertTrue(ts1.equals(ts2) && ts2.equals(ts1), "Error ts1 != ts2");
+        assertFalse(ts1.equals(ts3) && ts3.equals(ts1), "Error ts1 == ts3");
+
+    }
+
+    /**
+     * Validate that a Timestamp is equal to itself
+     */
+    @Test
+    public void test12() {
+        Timestamp ts1 = Timestamp.valueOf("1996-10-15 12:26:19.12");
+        assertTrue(ts1.equals(ts1), "Error ts1 != ts1");
+    }
+
+    /**
+     * Validate that two Timestamps are equal when one is created from the
+     * toString() of the other
+     */
+    @Test
+    public void test13() {
+        Timestamp ts1 = Timestamp.valueOf("1996-12-10 12:26:19.12");
+        Timestamp ts2 = Timestamp.valueOf(ts1.toString());
+        assertTrue(ts1.equals(ts2) && ts2.equals(ts1), "Error ts1 != ts2");
+    }
+
+    // Before Tests
+    /**
+     * Validate that Timestamp ts1 is before Timestamp ts2
+     */
+    @Test
+    public void test14() {
+        Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634");
+        Timestamp ts2 = Timestamp.valueOf("1996-12-13 15:15:25.645634");
+        assertTrue(ts1.before(ts2), "Error ts1 not before ts2");
+    }
+
+    /**
+     * Validate that Timestamp ts1 is before Timestamp ts2
+     */
+    @Test
+    public void test15() {
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 14:15:25");
+        Timestamp ts2 = Timestamp.valueOf("1999-12-13 15:15:25");
+        assertTrue(ts1.before(ts2), "Error ts1 not before ts2");
+    }
+
+    /**
+     * Validate that Timestamp ts1 is before Timestamp ts2
+     */
+    @Test
+    public void test16() {
+
+        Timestamp ts1 = Timestamp.valueOf("1999-12-13 14:15:25.745634");
+        Timestamp ts2 = Timestamp.valueOf("1999-11-13 15:15:25.645634");
+        assertFalse(ts1.before(ts2), "Error ts1 before ts2");
+    }
+
+    /*
+     * Validate that a NullPointerException is thrown if a null is passed to
+     * the before method
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test17() throws Exception {
+        Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634");
+        ts1.before(null);
+    }
+
+    /*
+     * Validate a Timestamp cannot be before itself
+     */
+    @Test
+    public void test18() {
+        Timestamp ts1 = Timestamp.valueOf("1999-11-10 12:26:19.3456543");
+        assertFalse(ts1.before(ts1), "Error ts1 before ts1!");
+    }
+
+    /**
+     * Create 3 Timestamps and make sure the 1st is before the other two
+     * Timestamps which are each greater than the one before it
+     */
+    @Test
+    public void test19() {
+
+        Timestamp ts1 = new Timestamp(1234560000);
+        Timestamp ts2 = new Timestamp(1234567000);
+        Timestamp ts3 = new Timestamp(1234569000);
+        assertTrue(ts1.before(ts2) && ts2.before(ts3) && ts1.before(ts3));
+    }
+
+    /**
+     * Validate that Timestamp ts1 is not after Timestamp ts2
+     */
+    @Test
+    public void test20() {
+        Timestamp ts1 = Timestamp.valueOf("1999-12-13 14:15:25.745634");
+        Timestamp ts2 = Timestamp.valueOf("1999-12-13 15:15:25.645634");
+        assertFalse(ts1.after(ts2), "Error ts1 is after ts2");
+
+    }
+
+    /**
+     * Validate that Timestamp ts1 is after Timestamp ts2
+     */
+    @Test
+    public void test21() {
+        Timestamp ts1 = Timestamp.valueOf("1996-12-13 14:15:25.745634");
+        Timestamp ts2 = Timestamp.valueOf("1996-11-13 15:15:25.645634");
+        assertTrue(ts1.after(ts2), "Error ts1 not after ts2");
+    }
+
+    /**
+     * Validate that a NullPointerException is thrown if a null is passed to the
+     * after method
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test22() throws Exception {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        ts1.after(null);
+    }
+
+    /**
+     * Validate that a Timestamp cannot be after itself
+     */
+    @Test
+    public void test23() {
+        Timestamp ts1 = Timestamp.valueOf("1999-11-10 12:26:19.3456543");
+        assertFalse(ts1.after(ts1), "Error ts1 is after itself");
+    }
+    /**
+     * Validate that a Timestamp after() works correctly with Timestamp
+     * created using milliseconds
+     */
+    @Test
+    public void test24() {
+
+        Timestamp ts1 = new Timestamp(1234568000);
+        Timestamp ts2 = new Timestamp(1234565000);
+        Timestamp ts3 = new Timestamp(1234562000);
+        assertTrue(ts1.after(ts2) && ts2.after(ts3) && ts1.after(ts3));
+    }
+
+    /**
+     * Validate compareTo returns 0 for Timestamps that are the same
+     */
+    @Test
+    public void test25() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Timestamp ts2 = new Timestamp(ts1.getTime());
+        assertTrue(ts1.compareTo(ts2) == 0, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate compareTo returns -1 for when the 1st Timestamp is earlier than
+     * the 2nd Timestamp
+     */
+    @Test
+    public void test26() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Timestamp ts2 = new Timestamp(ts1.getTime() + 1000);
+        assertTrue(ts1.compareTo(ts2) == -1, "Error ts1 not before ts2");
+        assertTrue(ts2.compareTo(ts1) == 1, "Error ts1 is not before ts2");
+    }
+
+    /**
+     * Validate compareTo returns 1 for when the 1st Timestamp is later than the
+     * 2nd Timestamp
+     */
+    @Test
+    public void test27() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Timestamp ts2 = new Timestamp(ts1.getTime() - 1000);
+        assertTrue(ts1.compareTo(ts2) == 1, "Error ts1 not after ts2");
+        assertTrue(ts2.compareTo(ts1) == -1, "Error ts1 not after ts2");
+    }
+
+    /**
+     * Validate compareTo returns 0 for Timestamps that are the same
+     */
+    @Test
+    public void test28() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        java.util.Date ts2 = new java.util.Date(ts1.getTime());
+        assertTrue(ts1.compareTo(ts2) == 0, "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate compareTo returns 0 for Timestamps that are the same
+     */
+    @Test
+    public void test29() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        java.util.Date d = new java.util.Date(ts1.getTime());
+        assertFalse(ts1.equals(d), "Error ts1 == d");
+    }
+
+    /**
+     * Validate compareTo returns 0 for Timestamps that are the same
+     */
+    @Test
+    public void test30() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        java.util.Date d = new Timestamp(ts1.getTime());
+        assertTrue(ts1.equals(d), "Error ts1 != d");
+    }
+
+    /**
+     * Validate equals returns false when a Date object is passed to equals
+     */
+    @Test
+    public void test31() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Date d = new Date(ts1.getTime());
+        assertFalse(ts1.equals(d), "Error ts1 != d");
+    }
+
+    /**
+     * Validate equals returns false when a Date object is passed to equals
+     */
+    @Test
+    public void test32() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        java.util.Date d = new Date(ts1.getTime());
+        assertFalse(ts1.equals(d), "Error ts1 != d");
+    }
+
+    /**
+     * Validate equals returns false when a Time object is passed to equals
+     */
+    @Test
+    public void test33() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Time t1 = new Time(ts1.getTime());
+        assertFalse(ts1.equals(t1), "Error ts1 == t1");
+    }
+
+    /**
+     * Validate equals returns false when a String object is passed to equals
+     */
+    @Test
+    public void test34() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        assertFalse(ts1.equals("1966-08-30 08:08:08"), "Error ts1 == a String");
+    }
+
+    /**
+     * Validate getTime() returns the same value from 2 timeStamps created by
+     */
+    @Test
+    public void test35() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Timestamp ts2 = Timestamp.valueOf("1966-08-30 08:08:08");
+        assertTrue(ts2.getTime() == ts1.getTime(),
+                "ts1.getTime() != ts2.getTime()");
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate getTime() returns the same value from 2 timeStamps when
+     * setTime() is used to specify the same value for both Timestamps
+     */
+    @Test
+    public void test36() {
+        Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
+        Timestamp ts2 = Timestamp.valueOf("1961-08-30 00:00:00");
+        ts2.setTime(ts1.getTime());
+        assertTrue(ts2.getTime() == ts1.getTime(),
+                "ts1.getTime() != ts2.getTime()");
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid nanos value
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test38() throws Exception {
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
+        ts1.setNanos(-1);
+
+    }
+
+    /**
+     * Validate an IllegalArgumentException is thrown for an invalid nanos value
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void test39() throws Exception {
+        int nanos = 999999999;
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
+        ts1.setNanos(nanos + 1);
+
+    }
+
+    /**
+     * Validate you can set nanos to 999999999
+     */
+    @Test
+    public void test40() throws Exception {
+        int nanos = 999999999;
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
+        ts1.setNanos(nanos);
+        assertTrue(ts1.getNanos() == nanos, "Error Invalid Nanos value");
+
+    }
+
+    /**
+     * Validate you can set nanos to 0
+     */
+    @Test
+    public void test41() throws Exception {
+        int nanos = 0;
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
+        ts1.setNanos(nanos);
+        assertTrue(ts1.getNanos() == nanos, "Error Invalid Nanos value");
+
+    }
+
+    /**
+     * Validate that a Timestamp made from a LocalDateTime are equal
+     */
+    @Test
+    public void test42() throws Exception {
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
+        LocalDateTime ldt = ts1.toLocalDateTime();
+        Timestamp ts2 = Timestamp.valueOf(ldt);
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that a Timestamp LocalDateTime value, made from a LocalDateTime
+     * are equal
+     */
+    @Test
+    public void test43() throws Exception {
+        LocalDateTime ldt = LocalDateTime.now();
+        Timestamp ts2 = Timestamp.valueOf(ldt);
+        assertTrue(ldt.equals(ts2.toLocalDateTime()),
+                "Error LocalDateTime values are not equal");
+    }
+
+    /**
+     * Validate an NPE occurs when a null LocalDateTime is passed to valueOF
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test44() throws Exception {
+        LocalDateTime ldt = null;
+        Timestamp.valueOf(ldt);
+    }
+
+    /**
+     * Validate that a Timestamp made from a Instant are equal
+     */
+    @Test
+    public void test45() throws Exception {
+        Timestamp ts1 = Timestamp.valueOf("1961-08-30 00:00:00");
+        Instant instant = ts1.toInstant();
+        Timestamp ts2 = Timestamp.from(instant);
+        assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
+    }
+
+    /**
+     * Validate that a Timestamp made from a Instant are equal
+     */
+    @Test
+    public void test46() throws Exception {
+        Instant instant = Instant.now();
+        Timestamp ts2 = Timestamp.from(instant);
+        assertTrue(instant.equals(ts2.toInstant()),
+                "Error Instant values do not match");
+    }
+
+    /**
+     * Validate an NPE occurs when a null instant is passed to from
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test47() throws Exception {
+        Instant instant = null;
+        Timestamp.from(instant);
+    }
+
+    // Added SQE tests
+    /**
+     * Create a Timestamp and a 2nd Timestamp that is 1 month earlier and
+     * validate that it is not before or after the original Timestamp
+     */
+    @Test
+    public void test48() {
+        Calendar cal = Calendar.getInstance();
+        Timestamp ts1 = new Timestamp(System.currentTimeMillis());
+        cal.setTimeInMillis(ts1.getTime());
+        cal.add(Calendar.MONTH, -1);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+        Timestamp ts2 = new Timestamp(cal.getTimeInMillis());
+        assertFalse(ts1.before(ts2) || ts2.after(ts1));
+    }
+
+    /**
+     * Create two Timestamps and validate that compareTo returns 1 to indicate
+     * the 1st Timestamp is greater than the 2nd Timestamp
+     */
+    @Test
+    public void test49() {
+        Calendar cal = Calendar.getInstance();
+        Timestamp ts1 = new Timestamp(System.currentTimeMillis());
+        cal.setTimeInMillis(ts1.getTime());
+        cal.add(Calendar.MONTH, -1);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+        Timestamp ts2 = new Timestamp(cal.getTimeInMillis());
+        assertTrue(ts1.compareTo(ts2) == 1);
+    }
+
+    /**
+     * Create two Timestamps and validate that the 1st Timestamp is not equal to
+     * the 2nd Timestamp but equal to itself
+     */
+    @Test
+    public void test50() {
+        Calendar cal = Calendar.getInstance();
+        Timestamp ts1 = new Timestamp(System.currentTimeMillis());
+        cal.setTimeInMillis(ts1.getTime());
+        cal.add(Calendar.MONTH, -1);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+        Timestamp ts2 = new Timestamp(cal.getTimeInMillis());
+        assertTrue(!ts1.equals(ts2) && ts1.equals(ts1));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/util/BaseTest.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,89 @@
+/*
+ * 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 util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.sql.SQLException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+
+public class BaseTest {
+
+    protected final String reason = "reason";
+    protected final String state = "SQLState";
+    protected final String cause = "java.lang.Throwable: cause";
+    protected final Throwable t = new Throwable("cause");
+    protected final Throwable t1 = new Throwable("cause 1");
+    protected final Throwable t2 = new Throwable("cause 2");
+    protected final int errorCode = 21;
+    protected final String[] msgs = {"Exception 1", "cause 1", "Exception 2",
+        "Exception 3", "cause 2"};
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /**
+     * Take some form of SQLException, serialize and deserialize it
+     *
+     * @param <T> SQLException
+     * @param ex SQLException
+     * @return deserialized SQLException
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    @SuppressWarnings("unchecked")
+    protected <T extends SQLException> T
+            createSerializedException(T ex)
+            throws IOException, ClassNotFoundException {
+        T ex1;
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
+            oos.writeObject(ex);
+        }
+        try (ObjectInputStream ois =
+                new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+            ex1 = (T) ois.readObject();
+        }
+        return ex1;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/util/DriverActionImpl.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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 util;
+
+import java.sql.DriverAction;
+
+/**
+ * Simple implementation of DriverAction which calls back into the Driver when
+ * release is called.
+ */
+class DriverActionImpl implements DriverAction {
+
+    public DriverActionImpl(StubDriverDA d) {
+        driver = d;
+    }
+
+    private final StubDriverDA driver;
+
+    @Override
+    public void deregister() {
+        driver.release();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/sql/util/SerializedBatchUpdateException.java	Tue Apr 29 14:40:26 2014 -0700
@@ -0,0 +1,65 @@
+/*
+ * 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