Merge
authormullan
Mon, 29 Aug 2011 12:23:54 -0400
changeset 10371 7da2112e4236
parent 10370 5db0cf452a50 (current diff)
parent 10369 e9d2e59e53f0 (diff)
child 10372 2f6d68f22eae
child 10416 61d6ccadbfa2
Merge
jdk/src/share/classes/sun/security/x509/X500Name.java
--- a/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java	Mon Aug 29 12:23:54 2011 -0400
@@ -25,6 +25,7 @@
 
 package com.sun.jndi.ldap;
 
+import java.util.Locale;
 import java.util.Arrays; // JDK 1.2
 import java.io.OutputStream;
 import javax.naming.ldap.Control;
@@ -71,7 +72,7 @@
     ClientId(int version, String hostname, int port, String protocol,
             Control[] bindCtls, OutputStream trace, String socketFactory) {
         this.version = version;
-        this.hostname = hostname.toLowerCase();  // ignore case
+        this.hostname = hostname.toLowerCase(Locale.ENGLISH);  // ignore case
         this.port = port;
         this.protocol = protocol;
         this.bindCtls = (bindCtls != null ? bindCtls.clone() : null);
@@ -83,13 +84,15 @@
         if ((socketFactory != null) &&
              !socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
             try {
-                Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
+                Class<?> socketFactoryClass =
+                        Obj.helper.loadClass(socketFactory);
                 Class<?> objClass = Class.forName("java.lang.Object");
                 this.sockComparator = socketFactoryClass.getMethod(
                                 "compare", new Class<?>[]{objClass, objClass});
-                Method getDefault =
-                    socketFactoryClass.getMethod("getDefault", new Class<?>[]{});
-                this.factory = (SocketFactory) getDefault.invoke(null, new Object[]{});
+                Method getDefault = socketFactoryClass.getMethod(
+                                            "getDefault", new Class<?>[]{});
+                this.factory =
+                        (SocketFactory)getDefault.invoke(null, new Object[]{});
             } catch (Exception e) {
                 // Ignore it here, the same exceptions are/will be handled by
                 // LdapPoolManager and Connection classes.
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java	Mon Aug 29 12:23:54 2011 -0400
@@ -26,6 +26,7 @@
 package com.sun.jndi.ldap;
 
 import java.io.*;
+import java.util.Locale;
 import java.util.Vector;
 import java.util.Hashtable;
 
@@ -738,14 +739,15 @@
         if (hasBinaryValues) {
             la.add(ber.parseOctetString(ber.peekByte(), len));
         } else {
-            la.add(ber.parseStringWithTag(Ber.ASN_SIMPLE_STRING, isLdapv3, len));
+            la.add(ber.parseStringWithTag(
+                                    Ber.ASN_SIMPLE_STRING, isLdapv3, len));
         }
         return len[0];
     }
 
     private boolean isBinaryValued(String attrid,
                                    Hashtable<String, Boolean> binaryAttrs) {
-        String id = attrid.toLowerCase();
+        String id = attrid.toLowerCase(Locale.ENGLISH);
 
         return ((id.indexOf(";binary") != -1) ||
             defaultBinaryAttrs.containsKey(id) ||
@@ -753,8 +755,8 @@
     }
 
     // package entry point; used by Connection
-    static void parseResult(BerDecoder replyBer, LdapResult res, boolean isLdapv3)
-        throws IOException {
+    static void parseResult(BerDecoder replyBer, LdapResult res,
+            boolean isLdapv3) throws IOException {
 
         res.status = replyBer.parseEnumeration();
         res.matchedDN = replyBer.parseString(isLdapv3);
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java	Mon Aug 29 12:23:54 2011 -0400
@@ -33,6 +33,7 @@
 import javax.naming.ldap.LdapName;
 import javax.naming.ldap.Rdn;
 
+import java.util.Locale;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.List;
@@ -2597,7 +2598,7 @@
         } else {
             binaryAttrs = new Hashtable<>(11, 0.75f);
             StringTokenizer tokens =
-                new StringTokenizer(attrIds.toLowerCase(), " ");
+                new StringTokenizer(attrIds.toLowerCase(Locale.ENGLISH), " ");
 
             while (tokens.hasMoreTokens()) {
                 binaryAttrs.put(tokens.nextToken(), Boolean.TRUE);
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java	Mon Aug 29 12:23:54 2011 -0400
@@ -28,6 +28,7 @@
 
 import java.util.Enumeration;
 import java.util.Vector;
+import java.util.Locale;
 
 import javax.naming.*;
 import javax.naming.directory.Attributes;
@@ -707,7 +708,7 @@
 
             TypeAndValue that = (TypeAndValue)obj;
 
-            int diff = type.toUpperCase().compareTo(that.type.toUpperCase());
+            int diff = type.compareToIgnoreCase(that.type);
             if (diff != 0) {
                 return diff;
             }
@@ -730,7 +731,7 @@
 
         public int hashCode() {
             // If two objects are equal, their hash codes must match.
-            return (type.toUpperCase().hashCode() +
+            return (type.toUpperCase(Locale.ENGLISH).hashCode() +
                     getValueComparable().hashCode());
         }
 
@@ -764,11 +765,12 @@
 
             // cache result
             if (binary) {
-                comparable = value.toUpperCase();
+                comparable = value.toUpperCase(Locale.ENGLISH);
             } else {
                 comparable = (String)unescapeValue(value);
                 if (!valueCaseSensitive) {
-                    comparable = comparable.toUpperCase(); // ignore case
+                    // ignore case
+                    comparable = comparable.toUpperCase(Locale.ENGLISH);
                 }
             }
             return comparable;
@@ -836,7 +838,7 @@
                 buf.append(Character.forDigit(0xF & b, 16));
             }
 
-            return (new String(buf)).toUpperCase();
+            return (new String(buf)).toUpperCase(Locale.ENGLISH);
         }
 
         /*
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Mon Aug 29 12:23:54 2011 -0400
@@ -28,6 +28,7 @@
 import java.io.PrintStream;
 import java.io.OutputStream;
 import java.util.Hashtable;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 import javax.naming.ldap.Control;
@@ -133,7 +134,7 @@
         String mech;
         int p;
         for (int i = 0; i < count; i++) {
-            mech = parser.nextToken().toLowerCase();
+            mech = parser.nextToken().toLowerCase(Locale.ENGLISH);
             if (mech.equals("anonymous")) {
                 mech = "none";
             }
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/HierMemDirCtx.java	Mon Aug 29 12:23:54 2011 -0400
@@ -910,7 +910,7 @@
     public int hashCode() {
         if (hashValue == -1) {
 
-            String name = toString().toUpperCase();
+            String name = toString().toUpperCase(Locale.ENGLISH);
             int len = name.length();
             int off = 0;
             char val[] = new char[len];
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Mon Aug 29 12:23:54 2011 -0400
@@ -29,6 +29,7 @@
 import java.util.Enumeration;
 import java.util.StringTokenizer;
 import java.util.Vector;
+import java.util.Locale;
 
 /**
   * A class for parsing LDAP search filters (defined in RFC 1960, 2254)
@@ -395,19 +396,21 @@
 
             // do we need to begin with the first token?
             if(proto.charAt(0) != WILDCARD_TOKEN &&
-               !value.toString().toLowerCase().startsWith(
-                      subStrs.nextToken().toLowerCase())) {
-                if(debug) {System.out.println("faild initial test");}
+                    !value.toString().toLowerCase(Locale.ENGLISH).startsWith(
+                        subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
+                if(debug) {
+                    System.out.println("faild initial test");
+                }
                 return false;
             }
 
-
             while(subStrs.hasMoreTokens()) {
                 String currentStr = subStrs.nextToken();
                 if (debug) {System.out.println("looking for \"" +
                                                currentStr +"\"");}
-                currentPos = value.toLowerCase().indexOf(
-                       currentStr.toLowerCase(), currentPos);
+                currentPos = value.toLowerCase(Locale.ENGLISH).indexOf(
+                       currentStr.toLowerCase(Locale.ENGLISH), currentPos);
+
                 if(currentPos == -1) {
                     return false;
                 }
--- a/jdk/src/share/classes/com/sun/security/ntlm/Client.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/ntlm/Client.java	Mon Aug 29 12:23:54 2011 -0400
@@ -69,14 +69,16 @@
      * This method does not make any modification to this parameter, it neither
      * needs to access the content of this parameter after this method call,
      * so you are free to modify or nullify this parameter after this call.
-     * @throws NullPointerException if {@code username} or {@code password} is null.
-     * @throws NTLMException if {@code version} is illegal
+     * @throws NTLMException if {@code username} or {@code password} is null,
+     * or {@code version} is illegal.
+     *
      */
     public Client(String version, String hostname, String username,
             String domain, char[] password) throws NTLMException {
         super(version);
         if ((username == null || password == null)) {
-            throw new NullPointerException("username/password cannot be null");
+            throw new NTLMException(NTLMException.PROTOCOL,
+                    "username/password cannot be null");
         }
         this.hostname = hostname;
         this.username = username;
@@ -117,13 +119,13 @@
      * @param nonce random 8-byte array to be used in message generation,
      * must not be null except for original NTLM v1
      * @return the message generated
-     * @throws NullPointerException if {@code type2} or {@code nonce} is null
-     * for NTLM v1.
-     * @throws NTLMException if the incoming message is invalid
+     * @throws NTLMException if the incoming message is invalid, or
+     * {@code nonce} is null for NTLM v1.
      */
     public byte[] type3(byte[] type2, byte[] nonce) throws NTLMException {
         if (type2 == null || (v != Version.NTLM && nonce == null)) {
-            throw new NullPointerException("type2 and nonce cannot be null");
+            throw new NTLMException(NTLMException.PROTOCOL,
+                    "type2 and nonce cannot be null");
         }
         debug("NTLM Client: Type 2 received\n");
         debug(type2);
--- a/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/ntlm/NTLM.java	Mon Aug 29 12:23:54 2011 -0400
@@ -33,6 +33,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
 import java.util.Arrays;
+import java.util.Locale;
 import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;
 import javax.crypto.IllegalBlockSizeException;
@@ -410,7 +411,8 @@
 
     static byte[] getP1(char[] password) {
         try {
-            return new String(password).toUpperCase().getBytes("ISO8859_1");
+            return new String(password).toUpperCase(
+                                    Locale.ENGLISH).getBytes("ISO8859_1");
         } catch (UnsupportedEncodingException ex) {
             return null;
         }
--- a/jdk/src/share/classes/com/sun/security/ntlm/NTLMException.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/ntlm/NTLMException.java	Mon Aug 29 12:23:54 2011 -0400
@@ -65,6 +65,11 @@
      */
     public final static int BAD_VERSION = 5;
 
+    /**
+     * Protocol errors.
+     */
+    public final static int PROTOCOL = 6;
+
     private int errorCode;
 
     /**
--- a/jdk/src/share/classes/com/sun/security/ntlm/Server.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/ntlm/Server.java	Mon Aug 29 12:23:54 2011 -0400
@@ -62,12 +62,13 @@
      * is selected, authentication succeeds if one of LM (or LMv2) or
      * NTLM (or NTLMv2) is verified.
      * @param domain the domain, must not be null
-     * @throws NullPointerException if {@code domain} is null.
+     * @throws NTLMException if {@code domain} is null.
      */
     public Server(String version, String domain) throws NTLMException {
         super(version);
         if (domain == null) {
-            throw new NullPointerException("domain cannot be null");
+            throw new NTLMException(NTLMException.PROTOCOL,
+                    "domain cannot be null");
         }
         this.allVersion = (version == null);
         this.domain = domain;
@@ -80,12 +81,13 @@
      * @param nonce the random 8-byte array to be used in message generation,
      * must not be null
      * @return the message generated
-     * @throws NullPointerException if type1 or nonce is null
-     * @throws NTLMException if the incoming message is invalid
+     * @throws NTLMException if the incoming message is invalid, or
+     * {@code nonce} is null.
      */
-    public byte[] type2(byte[] type1, byte[] nonce) {
+    public byte[] type2(byte[] type1, byte[] nonce) throws NTLMException {
         if (nonce == null) {
-            throw new NullPointerException("nonce cannot be null");
+            throw new NTLMException(NTLMException.PROTOCOL,
+                    "nonce cannot be null");
         }
         debug("NTLM Server: Type 1 received\n");
         if (type1 != null) debug(type1);
@@ -105,13 +107,14 @@
      * @param type3 the incoming Type3 message from client, must not be null
      * @param nonce the same nonce provided in {@link #type2}, must not be null
      * @return username and hostname of the client in a byte array
-     * @throws NullPointerException if {@code type3} or {@code nonce} is null
-     * @throws NTLMException if the incoming message is invalid
+     * @throws NTLMException if the incoming message is invalid, or
+     * {@code nonce} is null.
      */
     public String[] verify(byte[] type3, byte[] nonce)
             throws NTLMException {
         if (type3 == null || nonce == null) {
-            throw new NullPointerException("type1 or nonce cannot be null");
+            throw new NTLMException(NTLMException.PROTOCOL,
+                    "type1 or nonce cannot be null");
         }
         debug("NTLM Server: Type 3 received\n");
         if (type3 != null) debug(type3);
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java	Mon Aug 29 12:23:54 2011 -0400
@@ -70,6 +70,12 @@
             if (mechs[i].equals("NTLM") &&
                     PolicyUtils.checkPolicy(mechPolicies[0], props)) {
 
+                if (cbh == null) {
+                    throw new SaslException(
+                        "Callback handler with support for " +
+                        "RealmCallback, NameCallback, and PasswordCallback " +
+                        "required");
+                }
                 return new NTLMClient(mechs[i], authorizationId,
                     protocol, serverName, props, cbh);
             }
@@ -98,9 +104,9 @@
              }
              if (cbh == null) {
                  throw new SaslException(
-                        "Callback handler with support for AuthorizeCallback, "+
-                        "RealmCallback, NameCallback, and PasswordCallback " +
-                        "required");
+                     "Callback handler with support for " +
+                     "RealmCallback, NameCallback, and PasswordCallback " +
+                     "required");
              }
              return new NTLMServer(mech, protocol, serverName, props, cbh);
          }
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java	Mon Aug 29 12:23:54 2011 -0400
@@ -107,7 +107,7 @@
      * @param protocol non-null for Sasl, useless for NTLM
      * @param serverName non-null for Sasl, but can be null for NTLM
      * @param props can be null
-     * @param cbh can be null for Sasl, but will throw NPE for NTLM
+     * @param cbh can be null for Sasl, already null-checked in factory
      * @throws SaslException
      */
     NTLMClient(String mech, String authzid, String protocol, String serverName,
@@ -166,7 +166,7 @@
                     pcb.getPassword());
         } catch (NTLMException ne) {
             throw new SaslException(
-                    "NTLM: Invalid version string: " + version, ne);
+                    "NTLM: client creation failure", ne);
         }
     }
 
@@ -183,17 +183,20 @@
     @Override
     public byte[] unwrap(byte[] incoming, int offset, int len)
             throws SaslException {
-        throw new UnsupportedOperationException("Not supported.");
+        throw new IllegalStateException("Not supported.");
     }
 
     @Override
     public byte[] wrap(byte[] outgoing, int offset, int len)
             throws SaslException {
-        throw new UnsupportedOperationException("Not supported.");
+        throw new IllegalStateException("Not supported.");
     }
 
     @Override
     public Object getNegotiatedProperty(String propName) {
+        if (!isComplete()) {
+            throw new IllegalStateException("authentication not complete");
+        }
         switch (propName) {
             case Sasl.QOP:
                 return "auth";
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Mon Aug 29 12:23:54 2011 -0400
@@ -106,7 +106,7 @@
      * @param serverName not null for Sasl, can be null in NTLM. If non-null,
      * might be used as domain if not provided in props
      * @param props can be null
-     * @param cbh can be null for Sasl, but will throw NPE in auth for NTLM
+     * @param cbh can be null for Sasl, already null-checked in factory
      * @throws SaslException
      */
     NTLMServer(String mech, String protocol, String serverName,
@@ -132,7 +132,7 @@
             domain = serverName;
         }
         if (domain == null) {
-            throw new NullPointerException("Domain must be provided as"
+            throw new SaslException("Domain must be provided as"
                     + " the serverName argument or in props");
         }
 
@@ -159,7 +159,7 @@
             };
         } catch (NTLMException ne) {
             throw new SaslException(
-                    "NTLM: Invalid version string: " + version, ne);
+                    "NTLM: server creation failure", ne);
         }
         nonce = new byte[8];
     }
@@ -182,8 +182,8 @@
                 hostname = out[1];
                 return null;
             }
-        } catch (GeneralSecurityException ex) {
-            throw new SaslException("", ex);
+        } catch (NTLMException ex) {
+            throw new SaslException("NTLM: generate response failure", ex);
         }
     }
 
@@ -194,23 +194,29 @@
 
     @Override
     public String getAuthorizationID() {
+        if (!isComplete()) {
+            throw new IllegalStateException("authentication not complete");
+        }
         return authzId;
     }
 
     @Override
     public byte[] unwrap(byte[] incoming, int offset, int len)
             throws SaslException {
-        throw new UnsupportedOperationException("Not supported yet.");
+        throw new IllegalStateException("Not supported yet.");
     }
 
     @Override
     public byte[] wrap(byte[] outgoing, int offset, int len)
             throws SaslException {
-        throw new UnsupportedOperationException("Not supported yet.");
+        throw new IllegalStateException("Not supported yet.");
     }
 
     @Override
     public Object getNegotiatedProperty(String propName) {
+        if (!isComplete()) {
+            throw new IllegalStateException("authentication not complete");
+        }
         switch (propName) {
             case Sasl.QOP:
                 return "auth";
--- a/jdk/src/share/classes/com/sun/servicetag/SunConnection.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/com/sun/servicetag/SunConnection.java	Mon Aug 29 12:23:54 2011 -0400
@@ -101,10 +101,7 @@
             return new URL(registerURL);
         } catch (MalformedURLException ex) {
             // should never reach here
-            InternalError x =
-                new InternalError(ex.getMessage());
-            x.initCause(ex);
-            throw x;
+            throw new InternalError(ex.getMessage(), ex);
         }
     }
 
@@ -171,9 +168,7 @@
         try {
             BrowserSupport.browse(url.toURI());
         } catch (URISyntaxException ex) {
-            InternalError x = new InternalError("Error in registering: " + ex.getMessage());
-            x.initCause(ex);
-            throw x;
+            throw new InternalError("Error in registering: " + ex.getMessage(), ex);
         } catch (IllegalArgumentException ex) {
             if (Util.isVerbose()) {
                 ex.printStackTrace();
@@ -232,9 +227,7 @@
             return (returnCode == HttpURLConnection.HTTP_OK);
         } catch (MalformedURLException me) {
             // should never reach here
-            InternalError x = new InternalError("Error in registering: " + me.getMessage());
-            x.initCause(me);
-            throw x;
+            throw new InternalError("Error in registering: " + me.getMessage(), me);
         } catch (Exception ioe) {
             // SocketTimeoutException, IOException or UnknownHostException
             if (Util.isVerbose()) {
@@ -262,10 +255,9 @@
             BrowserSupport.browse(registerPage.toURI());
         } catch (FileNotFoundException ex) {
             // should never reach here
-            InternalError x =
-                new InternalError("Error in launching " + registerPage + ": " + ex.getMessage());
-            x.initCause(ex);
-            throw x;
+            throw new InternalError(
+                    "Error in launching " + registerPage + ": " + ex.getMessage()
+                    , ex);
         } catch (IllegalArgumentException ex) {
             if (Util.isVerbose()) {
                 ex.printStackTrace();
--- a/jdk/src/share/classes/java/io/BufferedReader.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/io/BufferedReader.java	Mon Aug 29 12:23:54 2011 -0400
@@ -514,9 +514,12 @@
         synchronized (lock) {
             if (in == null)
                 return;
-            in.close();
-            in = null;
-            cb = null;
+            try {
+                in.close();
+            } finally {
+                in = null;
+                cb = null;
+            }
         }
     }
 }
--- a/jdk/src/share/classes/java/io/BufferedWriter.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/io/BufferedWriter.java	Mon Aug 29 12:23:54 2011 -0400
@@ -255,15 +255,15 @@
         }
     }
 
+    @SuppressWarnings("try")
     public void close() throws IOException {
         synchronized (lock) {
             if (out == null) {
                 return;
             }
-            try {
+            try (Writer w = out) {
                 flushBuffer();
             } finally {
-                out.close();
                 out = null;
                 cb = null;
             }
--- a/jdk/src/share/classes/java/io/Closeable.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/io/Closeable.java	Mon Aug 29 12:23:54 2011 -0400
@@ -42,6 +42,12 @@
      * with it. If the stream is already closed then invoking this
      * method has no effect.
      *
+     * <p> As noted in {@link AutoCloseable#close()}, cases where the
+     * close may fail require careful attention. It is strongly advised
+     * to relinquish the underlying resources and to internally
+     * <em>mark</em> the {@code Closeable} as closed, prior to throwing
+     * the {@code IOException}.
+     *
      * @throws IOException if an I/O error occurs
      */
     public void close() throws IOException;
--- a/jdk/src/share/classes/java/io/FilterOutputStream.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/io/FilterOutputStream.java	Mon Aug 29 12:23:54 2011 -0400
@@ -152,11 +152,10 @@
      * @see        java.io.FilterOutputStream#flush()
      * @see        java.io.FilterOutputStream#out
      */
+    @SuppressWarnings("try")
     public void close() throws IOException {
-        try {
-          flush();
-        } catch (IOException ignored) {
+        try (OutputStream ostream = out) {
+            flush();
         }
-        out.close();
     }
 }
--- a/jdk/src/share/classes/java/lang/AutoCloseable.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/lang/AutoCloseable.java	Mon Aug 29 12:23:54 2011 -0400
@@ -43,6 +43,15 @@
      * throw more specific exceptions, or to throw no exception at all
      * if the close operation cannot fail.
      *
+     * <p> Cases where the close operation may fail require careful
+     * attention by implementers. It is strongly advised to relinquish
+     * the underlying resources and to internally <em>mark</em> the
+     * resource as closed, prior to throwing the exception. The {@code
+     * close} method is unlikely to be invoked more than once and so
+     * this ensures that the resources are released in a timely manner.
+     * Furthermore it reduces problems that could arise when the resource
+     * wraps, or is wrapped, by another resource.
+     *
      * <p><em>Implementers of this interface are also strongly advised
      * to not have the {@code close} method throw {@link
      * InterruptedException}.</em>
--- a/jdk/src/share/classes/java/lang/InternalError.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/lang/InternalError.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,7 @@
  * @author  unascribed
  * @since   JDK1.0
  */
-public
-class InternalError extends VirtualMachineError {
+public class InternalError extends VirtualMachineError {
     private static final long serialVersionUID = -9062593416125562365L;
 
     /**
@@ -47,9 +46,45 @@
      * Constructs an <code>InternalError</code> with the specified
      * detail message.
      *
-     * @param   s   the detail message.
+     * @param   message   the detail message.
+     */
+    public InternalError(String message) {
+        super(message);
+    }
+
+
+    /**
+     * Constructs an {@code InternalError} with the specified detail
+     * message and cause.  <p>Note that the detail message associated
+     * with {@code cause} is <i>not</i> automatically incorporated in
+     * this error's detail message.
+     *
+     * @param  message the detail message (which is saved for later retrieval
+     *         by the {@link #getMessage()} method).
+     * @param  cause the cause (which is saved for later retrieval by the
+     *         {@link #getCause()} method).  (A {@code null} value is
+     *         permitted, and indicates that the cause is nonexistent or
+     *         unknown.)
+     * @since  1.8
      */
-    public InternalError(String s) {
-        super(s);
+    public InternalError(String message, Throwable cause) {
+        super(message, cause);
     }
+
+    /**
+     * Constructs an {@code InternalError} with the specified cause
+     * and a detail message of {@code (cause==null ? null :
+     * cause.toString())} (which typically contains the class and
+     * detail message of {@code cause}).
+     *
+     * @param  cause the cause (which is saved for later retrieval by the
+     *         {@link #getCause()} method).  (A {@code null} value is
+     *         permitted, and indicates that the cause is nonexistent or
+     *         unknown.)
+     * @since  1.8
+     */
+    public InternalError(Throwable cause) {
+        super(cause);
+    }
+
 }
--- a/jdk/src/share/classes/java/lang/System.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/lang/System.java	Mon Aug 29 12:23:54 2011 -0400
@@ -632,6 +632,7 @@
      *
      * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
      * Windows systems it returns {@code "\r\n"}.
+     * @since 1.7
      */
     public static String lineSeparator() {
         return lineSeparator;
--- a/jdk/src/share/classes/java/lang/VirtualMachineError.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/lang/VirtualMachineError.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,9 +1,9 @@
 /*
- * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2011, 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
+ * under the terms of the GNU General Public License version 2 only, asP
  * published by the Free Software Foundation.  Oracle designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Oracle in the LICENSE file that accompanied this code.
@@ -33,8 +33,9 @@
  * @author  Frank Yellin
  * @since   JDK1.0
  */
-abstract public
-class VirtualMachineError extends Error {
+abstract public class VirtualMachineError extends Error {
+    private static final long serialVersionUID = 4161983926571568670L;
+
     /**
      * Constructs a <code>VirtualMachineError</code> with no detail message.
      */
@@ -46,9 +47,43 @@
      * Constructs a <code>VirtualMachineError</code> with the specified
      * detail message.
      *
-     * @param   s   the detail message.
+     * @param   message   the detail message.
      */
-    public VirtualMachineError(String s) {
-        super(s);
+    public VirtualMachineError(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a {@code VirtualMachineError} with the specified
+     * detail message and cause.  <p>Note that the detail message
+     * associated with {@code cause} is <i>not</i> automatically
+     * incorporated in this error's detail message.
+     *
+     * @param  message the detail message (which is saved for later retrieval
+     *         by the {@link #getMessage()} method).
+     * @param  cause the cause (which is saved for later retrieval by the
+     *         {@link #getCause()} method).  (A {@code null} value is
+     *         permitted, and indicates that the cause is nonexistent or
+     *         unknown.)
+     * @since  1.8
+     */
+    public VirtualMachineError(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs an a {@code VirtualMachineError} with the specified
+     * cause and a detail message of {@code (cause==null ? null :
+     * cause.toString())} (which typically contains the class and
+     * detail message of {@code cause}).
+     *
+     * @param  cause the cause (which is saved for later retrieval by the
+     *         {@link #getCause()} method).  (A {@code null} value is
+     *         permitted, and indicates that the cause is nonexistent or
+     *         unknown.)
+     * @since  1.8
+     */
+    public VirtualMachineError(Throwable cause) {
+        super(cause);
     }
 }
--- a/jdk/src/share/classes/java/net/HttpCookie.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/net/HttpCookie.java	Mon Aug 29 12:23:54 2011 -0400
@@ -748,10 +748,14 @@
             && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1))
             return false;
 
-        // if the host name contains no dot and the domain name is .local
+        // if the host name contains no dot and the domain name
+        // is .local or host.local
         int firstDotInHost = host.indexOf('.');
-        if (firstDotInHost == -1 && isLocalDomain)
+        if (firstDotInHost == -1 &&
+            (isLocalDomain ||
+             domain.equalsIgnoreCase(host + ".local"))) {
             return true;
+        }
 
         int domainLength = domain.length();
         int lengthDiff = host.length() - domainLength;
--- a/jdk/src/share/classes/java/security/KeyRep.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/security/KeyRep.java	Mon Aug 29 12:23:54 2011 -0400
@@ -26,6 +26,7 @@
 package java.security;
 
 import java.io.*;
+import java.util.Locale;
 
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.security.spec.X509EncodedKeySpec;
@@ -137,7 +138,7 @@
 
         this.type = type;
         this.algorithm = algorithm;
-        this.format = format.toUpperCase();
+        this.format = format.toUpperCase(Locale.ENGLISH);
         this.encoded = encoded.clone();
     }
 
--- a/jdk/src/share/classes/java/security/Security.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/security/Security.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1087,8 +1087,10 @@
             // Check the keys for each provider.
             for (Enumeration<Object> e = providers[i].keys();
                                                 e.hasMoreElements(); ) {
-                String currentKey = ((String)e.nextElement()).toUpperCase();
-                if (currentKey.startsWith(serviceName.toUpperCase())) {
+                String currentKey =
+                        ((String)e.nextElement()).toUpperCase(Locale.ENGLISH);
+                if (currentKey.startsWith(
+                        serviceName.toUpperCase(Locale.ENGLISH))) {
                     // We should skip the currentKey if it contains a
                     // whitespace. The reason is: such an entry in the
                     // provider property contains attributes for the
@@ -1096,7 +1098,8 @@
                     // in entries which lead to the implementation
                     // classes.
                     if (currentKey.indexOf(" ") < 0) {
-                        result.add(currentKey.substring(serviceName.length() + 1));
+                        result.add(currentKey.substring(
+                                                serviceName.length() + 1));
                     }
                 }
             }
--- a/jdk/src/share/classes/java/util/Observable.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/util/Observable.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, 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
@@ -44,7 +44,7 @@
  * notifications on separate threads, or may guarantee that their
  * subclass follows this order, as they choose.
  * <p>
- * Note that this notification mechanism is has nothing to do with threads
+ * Note that this notification mechanism has nothing to do with threads
  * and is completely separate from the <tt>wait</tt> and <tt>notify</tt>
  * mechanism of class <tt>Object</tt>.
  * <p>
--- a/jdk/src/share/classes/java/util/prefs/Preferences.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/java/util/prefs/Preferences.java	Mon Aug 29 12:23:54 2011 -0400
@@ -256,11 +256,9 @@
                                       .getContextClassLoader())
                         .newInstance();
                 } catch (Exception e) {
-                    InternalError error = new InternalError(
+                    throw new InternalError(
                         "Can't instantiate Preferences factory "
-                        + factoryName);
-                    error.initCause(e);
-                    throw error;
+                        + factoryName, e);
                 }
             }
         }
@@ -299,11 +297,9 @@
             return (PreferencesFactory)
                 Class.forName(platformFactory, false, null).newInstance();
         } catch (Exception e) {
-            InternalError error = new InternalError(
+            throw new InternalError(
                 "Can't instantiate platform default Preferences factory "
-                + platformFactory);
-            error.initCause(e);
-            throw error;
+                + platformFactory, e);
         }
     }
 
--- a/jdk/src/share/classes/javax/naming/NameImpl.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/javax/naming/NameImpl.java	Mon Aug 29 12:23:54 2011 -0400
@@ -25,6 +25,7 @@
 
 package javax.naming;
 
+import java.util.Locale;
 import java.util.Vector;
 import java.util.Enumeration;
 import java.util.Properties;
@@ -216,7 +217,8 @@
     }
 
     private static boolean toBoolean(String name) {
-        return ((name != null) && name.toLowerCase().equals("true"));
+        return ((name != null) &&
+            name.toLowerCase(Locale.ENGLISH).equals("true"));
     }
 
     private final void recordNamingConvention(Properties p) {
@@ -526,11 +528,14 @@
                 comp1 = comp1.trim();
                 comp2 = comp2.trim();
             }
+
+            int local;
             if (syntaxCaseInsensitive) {
-                comp1 = comp1.toLowerCase();
-                comp2 = comp2.toLowerCase();
+                local = comp1.compareToIgnoreCase(comp2);
+            } else {
+                local = comp1.compareTo(comp2);
             }
-            int local = comp1.compareTo(comp2);
+
             if (local != 0) {
                 return local;
             }
@@ -696,7 +701,7 @@
                 comp = comp.trim();
             }
             if (syntaxCaseInsensitive) {
-                comp = comp.toLowerCase();
+                comp = comp.toLowerCase(Locale.ENGLISH);
             }
 
             hash += comp.hashCode();
--- a/jdk/src/share/classes/javax/naming/directory/BasicAttributes.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/javax/naming/directory/BasicAttributes.java	Mon Aug 29 12:23:54 2011 -0400
@@ -28,6 +28,7 @@
 
 import java.util.Hashtable;
 import java.util.Enumeration;
+import java.util.Locale;
 
 import javax.naming.NamingException;
 import javax.naming.NamingEnumeration;
@@ -160,7 +161,7 @@
 
     public Attribute get(String attrID) {
         Attribute attr = attrs.get(
-                ignoreCase ? attrID.toLowerCase() : attrID);
+                ignoreCase ? attrID.toLowerCase(Locale.ENGLISH) : attrID);
         return (attr);
     }
 
@@ -179,13 +180,13 @@
     public Attribute put(Attribute attr) {
         String id = attr.getID();
         if (ignoreCase) {
-            id = id.toLowerCase();
+            id = id.toLowerCase(Locale.ENGLISH);
         }
         return attrs.put(id, attr);
     }
 
     public Attribute remove(String attrID) {
-        String id = (ignoreCase ? attrID.toLowerCase() : attrID);
+        String id = (ignoreCase ? attrID.toLowerCase(Locale.ENGLISH) : attrID);
         return attrs.remove(id);
     }
 
--- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Mon Aug 29 12:23:54 2011 -0400
@@ -28,6 +28,7 @@
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.Collections;
 
 import javax.naming.InvalidNameException;
@@ -434,8 +435,7 @@
         }
 
         public int compareTo(RdnEntry that) {
-            int diff = type.toUpperCase().compareTo(
-                        that.type.toUpperCase());
+            int diff = type.compareToIgnoreCase(that.type);
             if (diff != 0) {
                 return diff;
             }
@@ -462,7 +462,7 @@
         }
 
         public int hashCode() {
-            return (type.toUpperCase().hashCode() +
+            return (type.toUpperCase(Locale.ENGLISH).hashCode() +
                 getValueComparable().hashCode());
         }
 
@@ -479,7 +479,7 @@
             if (value instanceof byte[]) {
                 comparable = escapeBinaryValue((byte[]) value);
             } else {
-                comparable = ((String) value).toUpperCase();
+                comparable = ((String) value).toUpperCase(Locale.ENGLISH);
             }
             return comparable;
         }
@@ -569,7 +569,6 @@
             builder.append(Character.forDigit(0xF & b, 16));
         }
         return builder.toString();
-        // return builder.toString().toUpperCase();
     }
 
     /**
--- a/jdk/src/share/classes/javax/net/ssl/HttpsURLConnection.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/javax/net/ssl/HttpsURLConnection.java	Mon Aug 29 12:23:54 2011 -0400
@@ -144,8 +144,7 @@
             throws SSLPeerUnverifiedException {
 
         java.security.cert.Certificate[] certs = getServerCertificates();
-        return ((X500Principal)
-                ((X509Certificate)certs[0]).getSubjectX500Principal());
+        return ((X509Certificate)certs[0]).getSubjectX500Principal();
     }
 
     /**
@@ -173,8 +172,7 @@
 
         java.security.cert.Certificate[] certs = getLocalCertificates();
         if (certs != null) {
-            return ((X500Principal)
-                ((X509Certificate)certs[0]).getSubjectX500Principal());
+            return ((X509Certificate)certs[0]).getSubjectX500Principal();
         } else {
             return null;
         }
--- a/jdk/src/share/classes/sun/font/FontManagerFactory.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/font/FontManagerFactory.java	Mon Aug 29 12:23:54 2011 -0400
@@ -78,20 +78,11 @@
                     ClassLoader cl = ClassLoader.getSystemClassLoader();
                     Class fmClass = Class.forName(fmClassName, true, cl);
                     instance = (FontManager) fmClass.newInstance();
-                } catch (ClassNotFoundException ex) {
-                    InternalError err = new InternalError();
-                    err.initCause(ex);
-                    throw err;
+                } catch (ClassNotFoundException |
+                         InstantiationException |
+                         IllegalAccessException ex) {
+                    throw new InternalError(ex);
 
-                } catch (InstantiationException ex) {
-                    InternalError err = new InternalError();
-                    err.initCause(ex);
-                    throw err;
-
-                } catch (IllegalAccessException ex) {
-                    InternalError err = new InternalError();
-                    err.initCause(ex);
-                    throw err;
                 }
                 return null;
             }
--- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Mon Aug 29 12:23:54 2011 -0400
@@ -171,7 +171,8 @@
             ObjectName result = objname;
             if (result == null) {
                 synchronized (this) {
-                    if (objname == null) {
+                    result = objname;
+                    if (result == null) {
                         result = Util.newObjectName(LOGGING_MXBEAN_NAME);
                         objname = result;
                     }
@@ -228,7 +229,8 @@
                 ObjectName result = objname;
                 if (result == null) {
                     synchronized (this) {
-                        if (objname == null) {
+                        result = objname;
+                        if (result == null) {
                             result = Util.newObjectName(BUFFER_POOL_MXBEAN_NAME +
                                 ",name=" + pool.getName());
                             objname = result;
--- a/jdk/src/share/classes/sun/misc/URLClassPath.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/misc/URLClassPath.java	Mon Aug 29 12:23:54 2011 -0400
@@ -717,7 +717,7 @@
             try {
                 ensureOpen();
             } catch (IOException e) {
-                throw (InternalError) new InternalError().initCause(e);
+                throw new InternalError(e);
             }
             return index;
         }
@@ -812,7 +812,7 @@
             try {
                 ensureOpen();
             } catch (IOException e) {
-                throw (InternalError) new InternalError().initCause(e);
+                throw new InternalError(e);
             }
             final JarEntry entry = jar.getJarEntry(name);
             if (entry != null)
@@ -900,7 +900,7 @@
                         try {
                             newLoader.ensureOpen();
                         } catch (IOException e) {
-                            throw (InternalError) new InternalError().initCause(e);
+                            throw new InternalError(e);
                         }
                         final JarEntry entry = newLoader.jar.getJarEntry(name);
                         if (entry != null) {
--- a/jdk/src/share/classes/sun/reflect/MethodAccessorGenerator.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/reflect/MethodAccessorGenerator.java	Mon Aug 29 12:23:54 2011 -0400
@@ -401,10 +401,8 @@
                                  0,
                                  bytes.length,
                                  declaringClass.getClassLoader()).newInstance();
-                        } catch (InstantiationException |
-                                 IllegalAccessException e) {
-                            throw (InternalError)
-                                new InternalError().initCause(e);
+                        } catch (InstantiationException | IllegalAccessException e) {
+                            throw new InternalError(e);
                         }
                     }
                 });
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -40,6 +40,7 @@
  * @since   1.5
  */
 class AnnotationInvocationHandler implements InvocationHandler, Serializable {
+    private static final long serialVersionUID = 6182022883658399397L;
     private final Class<? extends Annotation> type;
     private final Map<String, Object> memberValues;
 
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
  * @since   1.5
  */
 class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
+    private static final long serialVersionUID = 7844069490309503934L;
     private Method member;
     private String foundType;
 
--- a/jdk/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
  * @since   1.5
  */
 public class EnumConstantNotPresentExceptionProxy extends ExceptionProxy {
+    private static final long serialVersionUID = -604662101303187330L;
     Class<? extends Enum<?>> enumType;
     String constName;
 
--- a/jdk/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -33,6 +33,7 @@
  * @since   1.5
  */
 public class TypeNotPresentExceptionProxy extends ExceptionProxy {
+    private static final long serialVersionUID = 5565925172427947573L;
     String typeName;
     Throwable cause;
 
--- a/jdk/src/share/classes/sun/reflect/generics/parser/SignatureParser.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/reflect/generics/parser/SignatureParser.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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,17 +25,15 @@
 
 package sun.reflect.generics.parser;
 
-
 import java.lang.reflect.GenericSignatureFormatError;
 import java.util.*;
 import sun.reflect.generics.tree.*;
 
-
 /**
  * Parser for type signatures, as defined in the Java Virtual
-// Machine Specification (JVMS) chapter 4.
+ * Machine Specification (JVMS) chapter 4.
  * Converts the signatures into an abstract syntax tree (AST) representation.
-// See the package sun.reflect.generics.tree for details of the AST.
+ * See the package sun.reflect.generics.tree for details of the AST.
  */
 public class SignatureParser {
     // The input is conceptually a character stream (though currently it's
@@ -58,8 +56,8 @@
     // if (current != x {error("expected an x");
     //
     // where x is some character constant.
-    // The assertion inidcates, that, as currently written,
-    // the code should nver reach this point unless the input is an
+    // The assertion indicates, that, as currently written,
+    // the code should never reach this point unless the input is an
     // x. On the other hand, the test is there to check the legality
     // of the input wrt to a given production. It may be that at a later
     // time the code might be called directly, and if the input is
@@ -68,7 +66,7 @@
 
     private char[] input; // the input signature
     private int index = 0; // index into the input
-// used to mark end of input
+    // used to mark end of input
     private static final char EOI = ':';
     private static final boolean DEBUG = false;
 
@@ -104,6 +102,11 @@
         index++;
     }
 
+    // For debugging, prints current character to the end of the input.
+    private String remainder() {
+        return new String(input, index, input.length-index);
+    }
+
     // Match c against a "set" of characters
     private boolean matches(char c, char... set) {
         for (char e : set) {
@@ -117,8 +120,17 @@
     // Currently throws a GenericSignatureFormatError.
 
     private Error error(String errorMsg) {
-        if (DEBUG) System.out.println("Parse error:" + errorMsg);
-        return new GenericSignatureFormatError();
+        return new GenericSignatureFormatError("Signature Parse error: " + errorMsg +
+                                               "\n\tRemaining input: " + remainder());
+    }
+
+    /**
+     * Verify the parse has made forward progress; throw an exception
+     * if no progress.
+     */
+    private void progress(int startingPosition) {
+        if (index <= startingPosition)
+            throw error("Failure to make progress!");
     }
 
     /**
@@ -163,6 +175,7 @@
     /**
      * Parses a type signature
      * and produces an abstract syntax tree representing it.
+     *
      * @param s a string representing the input type signature
      * @return An abstract syntax tree for a type signature
      * corresponding to the input string
@@ -183,38 +196,58 @@
     // and when it completes parsing, it leaves the input at the first
     // character after the input parses.
 
-    // parse a class signature based on the implicit input.
+    /*
+     * Note on grammar conventions: a trailing "*" matches zero or
+     * more occurrences, a trailing "+" matches one or more occurrences,
+     * "_opt" indicates an optional component.
+     */
+
+    /**
+     * ClassSignature:
+     *     FormalTypeParameters_opt SuperclassSignature SuperinterfaceSignature*
+     */
     private ClassSignature parseClassSignature() {
+        // parse a class signature based on the implicit input.
         assert(index == 0);
         return ClassSignature.make(parseZeroOrMoreFormalTypeParameters(),
-                                   parseClassTypeSignature(),
+                                   parseClassTypeSignature(), // Only rule for SuperclassSignature
                                    parseSuperInterfaces());
     }
 
     private FormalTypeParameter[] parseZeroOrMoreFormalTypeParameters(){
-        if (current() == '<') { return parseFormalTypeParameters();}
-        else {return new FormalTypeParameter[0];}
+        if (current() == '<') {
+            return parseFormalTypeParameters();
+        } else {
+            return new FormalTypeParameter[0];
+        }
     }
 
-
+    /**
+     * FormalTypeParameters:
+     *     "<" FormalTypeParameter+ ">"
+     */
     private FormalTypeParameter[] parseFormalTypeParameters(){
-        Collection<FormalTypeParameter> ftps =
-            new ArrayList<FormalTypeParameter>(3);
+        List<FormalTypeParameter> ftps =  new ArrayList<>(3);
         assert(current() == '<'); // should not have been called at all
-        if (current() != '<') { throw error("expected <");}
+        if (current() != '<') { throw error("expected '<'");}
         advance();
         ftps.add(parseFormalTypeParameter());
         while (current() != '>') {
+            int startingPosition = index;
             ftps.add(parseFormalTypeParameter());
+            progress(startingPosition);
         }
         advance();
-        FormalTypeParameter[] ftpa = new FormalTypeParameter[ftps.size()];
-        return ftps.toArray(ftpa);
+        return ftps.toArray(new FormalTypeParameter[ftps.size()]);
     }
 
+    /**
+     * FormalTypeParameter:
+     *     Identifier ClassBound InterfaceBound*
+     */
     private FormalTypeParameter parseFormalTypeParameter(){
         String id = parseIdentifier();
-        FieldTypeSignature[] bs = parseZeroOrMoreBounds();
+        FieldTypeSignature[] bs = parseBounds();
         return FormalTypeParameter.make(id, bs);
     }
 
@@ -229,7 +262,8 @@
             case '[':
             case ':':
             case '>':
-            case '<': return result.toString();
+            case '<':
+                return result.toString();
             default:{
                 result.append(c);
                 advance();
@@ -239,26 +273,42 @@
         }
         return result.toString();
     }
+    /**
+     * FieldTypeSignature:
+     *     ClassTypeSignature
+     *     ArrayTypeSignature
+     *     TypeVariableSignature
+     */
+    private FieldTypeSignature parseFieldTypeSignature() {
+        return parseFieldTypeSignature(true);
+    }
 
-    private FieldTypeSignature parseFieldTypeSignature() {
+    private FieldTypeSignature parseFieldTypeSignature(boolean allowArrays) {
         switch(current()) {
         case 'L':
            return parseClassTypeSignature();
         case 'T':
             return parseTypeVariableSignature();
         case '[':
-            return parseArrayTypeSignature();
+            if (allowArrays)
+                return parseArrayTypeSignature();
+            else
+                throw error("Array signature not allowed here.");
         default: throw error("Expected Field Type Signature");
         }
     }
 
+    /**
+     * ClassTypeSignature:
+     *     "L" PackageSpecifier_opt SimpleClassTypeSignature ClassTypeSignatureSuffix* ";"
+     */
     private ClassTypeSignature parseClassTypeSignature(){
         assert(current() == 'L');
         if (current() != 'L') { throw error("expected a class type");}
         advance();
-        List<SimpleClassTypeSignature> scts =
-            new ArrayList<SimpleClassTypeSignature>(5);
-        scts.add(parseSimpleClassTypeSignature(false));
+        List<SimpleClassTypeSignature> scts = new ArrayList<>(5);
+        scts.add(parsePackageNameAndSimpleClassTypeSignature());
+
         parseClassTypeSignatureSuffix(scts);
         if (current() != ';')
             throw error("expected ';' got '" + current() + "'");
@@ -267,25 +317,65 @@
         return ClassTypeSignature.make(scts);
     }
 
-    private SimpleClassTypeSignature parseSimpleClassTypeSignature(boolean dollar){
-            String id = parseIdentifier();
-            char c = current();
-            switch (c) {
-            case ';':
-            case '/':
-                return SimpleClassTypeSignature.make(id, dollar, new TypeArgument[0]) ;
-            case '<': {
-                return SimpleClassTypeSignature.make(id, dollar, parseTypeArguments());
+    /**
+     * PackageSpecifier:
+     *     Identifier "/" PackageSpecifier*
+     */
+    private SimpleClassTypeSignature parsePackageNameAndSimpleClassTypeSignature() {
+        // Parse both any optional leading PackageSpecifier as well as
+        // the following SimpleClassTypeSignature.
+
+        String id = parseIdentifier();
+
+        if (current() == '/') { // package name
+            StringBuilder idBuild = new StringBuilder(id);
+
+            while(current() == '/') {
+                advance();
+                idBuild.append(".");
+                idBuild.append(parseIdentifier());
             }
-            default: {throw error("expected < or ; or /");}
-            }
+            id = idBuild.toString();
+        }
+
+        switch (current()) {
+        case ';':
+            return SimpleClassTypeSignature.make(id, false, new TypeArgument[0]); // all done!
+        case '<':
+            if (DEBUG) System.out.println("\t remainder: " + remainder());
+            return SimpleClassTypeSignature.make(id, false, parseTypeArguments());
+        default:
+            throw error("expected '<' or ';' but got " + current());
+        }
     }
 
+    /**
+     * SimpleClassTypeSignature:
+     *     Identifier TypeArguments_opt
+     */
+    private SimpleClassTypeSignature parseSimpleClassTypeSignature(boolean dollar){
+        String id = parseIdentifier();
+        char c = current();
+
+        switch (c) {
+        case ';':
+        case '.':
+            return SimpleClassTypeSignature.make(id, dollar, new TypeArgument[0]) ;
+        case '<':
+            return SimpleClassTypeSignature.make(id, dollar, parseTypeArguments());
+        default:
+            throw error("expected '<' or ';' or '.', got '" + c + "'.");
+        }
+    }
+
+    /**
+     * ClassTypeSignatureSuffix:
+     *     "." SimpleClassTypeSignature
+     */
     private void parseClassTypeSignatureSuffix(List<SimpleClassTypeSignature> scts) {
-        while (current() == '/' || current() == '.') {
-            boolean dollar = (current() == '.');
+        while (current() == '.') {
             advance();
-            scts.add(parseSimpleClassTypeSignature(dollar));
+            scts.add(parseSimpleClassTypeSignature(true));
         }
     }
 
@@ -294,10 +384,14 @@
         else {return new TypeArgument[0];}
     }
 
+    /**
+     * TypeArguments:
+     *     "<" TypeArgument+ ">"
+     */
     private TypeArgument[] parseTypeArguments() {
-        Collection<TypeArgument> tas = new ArrayList<TypeArgument>(3);
+        List<TypeArgument> tas = new ArrayList<>(3);
         assert(current() == '<');
-        if (current() != '<') { throw error("expected <");}
+        if (current() != '<') { throw error("expected '<'");}
         advance();
         tas.add(parseTypeArgument());
         while (current() != '>') {
@@ -305,10 +399,14 @@
             tas.add(parseTypeArgument());
         }
         advance();
-        TypeArgument[] taa = new TypeArgument[tas.size()];
-        return tas.toArray(taa);
+        return tas.toArray(new TypeArgument[tas.size()]);
     }
 
+    /**
+     * TypeArgument:
+     *     WildcardIndicator_opt FieldTypeSignature
+     *     "*"
+     */
     private TypeArgument parseTypeArgument() {
         FieldTypeSignature[] ub, lb;
         ub = new FieldTypeSignature[1];
@@ -334,18 +432,20 @@
             ub[0] = SimpleClassTypeSignature.make("java.lang.Object", false, ta);
             return Wildcard.make(ub, lb);
         }
-        default: return parseFieldTypeSignature();
+        default:
+            return parseFieldTypeSignature();
         }
     }
 
-    // TypeVariableSignature -> T identifier
-
-    private TypeVariableSignature parseTypeVariableSignature(){
+    /**
+     * TypeVariableSignature:
+     *     "T" Identifier ";"
+     */
+    private TypeVariableSignature parseTypeVariableSignature() {
         assert(current() == 'T');
         if (current() != 'T') { throw error("expected a type variable usage");}
         advance();
-        TypeVariableSignature ts =
-            TypeVariableSignature.make(parseIdentifier());
+        TypeVariableSignature ts = TypeVariableSignature.make(parseIdentifier());
         if (current() != ';') {
             throw error("; expected in signature of type variable named" +
                   ts.getIdentifier());
@@ -354,16 +454,21 @@
         return ts;
     }
 
-        // ArrayTypeSignature -> [ TypeSignature
-
+    /**
+     * ArrayTypeSignature:
+     *     "[" TypeSignature
+     */
     private ArrayTypeSignature parseArrayTypeSignature() {
         if (current() != '[') {throw error("expected array type signature");}
         advance();
         return ArrayTypeSignature.make(parseTypeSignature());
     }
 
-    // TypeSignature -> BaseType | FieldTypeSignature
-
+    /**
+     * TypeSignature:
+     *     FieldTypeSignature
+     *     BaseType
+     */
     private TypeSignature parseTypeSignature() {
         switch (current()) {
         case 'B':
@@ -373,8 +478,11 @@
         case 'I':
         case 'J':
         case 'S':
-        case 'Z':return parseBaseType();
-        default: return parseFieldTypeSignature();
+        case 'Z':
+            return parseBaseType();
+
+        default:
+            return parseFieldTypeSignature();
         }
     }
 
@@ -408,12 +516,18 @@
             assert(false);
             throw error("expected primitive type");
         }
-    }
+        }
     }
 
-    private FieldTypeSignature[] parseZeroOrMoreBounds() {
-        Collection<FieldTypeSignature> fts =
-            new ArrayList<FieldTypeSignature>(3);
+    /**
+     * ClassBound:
+     *     ":" FieldTypeSignature_opt
+     *
+     * InterfaceBound:
+     *     ":" FieldTypeSignature
+     */
+    private FieldTypeSignature[] parseBounds() {
+        List<FieldTypeSignature> fts = new ArrayList<>(3);
 
         if (current() == ':') {
             advance();
@@ -430,24 +544,31 @@
                 advance();
                 fts.add(parseFieldTypeSignature());
             }
-        }
+        } else
+            error("Bound expected");
 
-        FieldTypeSignature[] fta = new FieldTypeSignature[fts.size()];
-        return fts.toArray(fta);
+        return fts.toArray(new FieldTypeSignature[fts.size()]);
     }
 
+    /**
+     * SuperclassSignature:
+     *     ClassTypeSignature
+     */
     private ClassTypeSignature[] parseSuperInterfaces() {
-        Collection<ClassTypeSignature> cts =
-            new ArrayList<ClassTypeSignature>(5);
+        List<ClassTypeSignature> cts = new ArrayList<>(5);
         while(current() == 'L') {
             cts.add(parseClassTypeSignature());
         }
-        ClassTypeSignature[] cta = new ClassTypeSignature[cts.size()];
-        return cts.toArray(cta);
+        return cts.toArray(new ClassTypeSignature[cts.size()]);
     }
 
-    // parse a method signature based on the implicit input.
+
+    /**
+     * MethodTypeSignature:
+     *     FormalTypeParameters_opt "(" TypeSignature* ")" ReturnType ThrowsSignature*
+     */
     private MethodTypeSignature parseMethodTypeSignature() {
+        // Parse a method signature based on the implicit input.
         FieldTypeSignature[] ets;
 
         assert(index == 0);
@@ -457,19 +578,19 @@
                                         parseZeroOrMoreThrowsSignatures());
     }
 
-    // (TypeSignature*)
+    // "(" TypeSignature* ")"
     private TypeSignature[] parseFormalParameters() {
-        if (current() != '(') {throw error("expected (");}
+        if (current() != '(') {throw error("expected '('");}
         advance();
         TypeSignature[] pts = parseZeroOrMoreTypeSignatures();
-        if (current() != ')') {throw error("expected )");}
+        if (current() != ')') {throw error("expected ')'");}
         advance();
         return pts;
     }
 
-        // TypeSignature*
+    // TypeSignature*
     private TypeSignature[] parseZeroOrMoreTypeSignatures() {
-        Collection<TypeSignature> ts = new ArrayList<TypeSignature>();
+        List<TypeSignature> ts = new ArrayList<>();
         boolean stop = false;
         while (!stop) {
             switch(current()) {
@@ -484,47 +605,46 @@
             case 'L':
             case 'T':
             case '[': {
-                    ts.add(parseTypeSignature());
-                    break;
-                }
+                ts.add(parseTypeSignature());
+                break;
+            }
             default: stop = true;
             }
         }
-        /*      while( matches(current(),
-                       'B', 'C', 'D', 'F', 'I', 'J', 'S', 'Z', 'L', 'T', '[')
-               ) {
-            ts.add(parseTypeSignature());
-            }*/
-        TypeSignature[] ta = new TypeSignature[ts.size()];
-        return ts.toArray(ta);
+        return ts.toArray(new TypeSignature[ts.size()]);
     }
 
-    // ReturnType -> V | TypeSignature
-
+    /**
+     * ReturnType:
+     *     TypeSignature
+     *     VoidDescriptor
+     */
     private ReturnType parseReturnType(){
-        if  (current() == 'V') {
+        if (current() == 'V') {
             advance();
             return VoidDescriptor.make();
-        } else return parseTypeSignature();
+        } else
+            return parseTypeSignature();
     }
 
     // ThrowSignature*
     private FieldTypeSignature[] parseZeroOrMoreThrowsSignatures(){
-        Collection<FieldTypeSignature> ets =
-            new ArrayList<FieldTypeSignature>(3);
+        List<FieldTypeSignature> ets = new ArrayList<>(3);
         while( current() == '^') {
             ets.add(parseThrowsSignature());
         }
-        FieldTypeSignature[] eta = new FieldTypeSignature[ets.size()];
-        return ets.toArray(eta);
+        return ets.toArray(new FieldTypeSignature[ets.size()]);
     }
 
-    // ThrowSignature -> ^ FieldTypeSignature
-
+    /**
+     * ThrowsSignature:
+     *     "^" ClassTypeSignature
+     *     "^" TypeVariableSignature
+     */
     private FieldTypeSignature parseThrowsSignature() {
         assert(current() == '^');
         if (current() != '^') { throw error("expected throws signature");}
         advance();
-        return parseFieldTypeSignature();
+        return parseFieldTypeSignature(false);
     }
  }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java	Mon Aug 29 12:23:54 2011 -0400
@@ -35,6 +35,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.security.Provider;
+import java.util.Locale;
 
 /**
  * Implements the GSSNameSpi for the krb5 mechanism.
@@ -184,7 +185,7 @@
             } catch (UnknownHostException e) {
                 // use hostname as it is
             }
-            hostName = hostName.toLowerCase();
+            hostName = hostName.toLowerCase(Locale.ENGLISH);
 
             temp = temp.append('/').append(hostName);
             return temp.toString();
--- a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java	Mon Aug 29 12:23:54 2011 -0400
@@ -35,6 +35,7 @@
 import sun.security.util.*;
 import java.net.*;
 import java.util.Vector;
+import java.util.Locale;
 import java.io.IOException;
 import java.math.BigInteger;
 import sun.security.krb5.internal.ccache.CCacheOutputStream;
@@ -389,14 +390,14 @@
                     // Looks if canonicalized is a longer format of hostName,
                     // we accept cases like
                     //     bunny -> bunny.rabbit.hole
-                    if (canonicalized.toLowerCase()
-                            .startsWith(hostName.toLowerCase()+".")) {
+                    if (canonicalized.toLowerCase(Locale.ENGLISH).startsWith(
+                                hostName.toLowerCase(Locale.ENGLISH)+".")) {
                         hostName = canonicalized;
                     }
                 } catch (UnknownHostException e) {
                     // no canonicalization, use old
                 }
-                nameParts[1] = hostName.toLowerCase();
+                nameParts[1] = hostName.toLowerCase(Locale.ENGLISH);
             }
             nameStrings = nameParts;
             nameType = type;
--- a/jdk/src/share/classes/sun/security/pkcs11/Session.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/pkcs11/Session.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -87,7 +87,7 @@
     }
 
     long id() {
-        if (token.isPresent(this) == false) {
+        if (token.isPresent(this.id) == false) {
             throw new ProviderException("Token has been removed");
         }
         lastAccess = System.currentTimeMillis();
@@ -167,7 +167,9 @@
     void dispose() {
         refList.remove(this);
         try {
-            token.p11.C_CloseSession(id);
+            if (token.isPresent(id)) {
+                token.p11.C_CloseSession(id);
+            }
         } catch (PKCS11Exception e1) {
             // ignore
         } catch (ProviderException e2) {
--- a/jdk/src/share/classes/sun/security/pkcs11/Token.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/pkcs11/Token.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -217,7 +217,7 @@
 
     // return whether a token is present (i.e. token not removed)
     // returns cached value if current, otherwise performs new check
-    boolean isPresent(Session session) {
+    boolean isPresent(long sessionID) {
         if (removable == false) {
             return true;
         }
@@ -238,7 +238,7 @@
                             // the token should return an error
                             CK_SESSION_INFO sessInfo =
                                     provider.p11.C_GetSessionInfo
-                                    (session.idInternal());
+                                    (sessionID);
                             ok = true;
                         }
                     } catch (PKCS11Exception e) {
--- a/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Mon Aug 29 12:23:54 2011 -0400
@@ -219,7 +219,7 @@
     public Key engineGetKey(String alias, char[] password)
         throws NoSuchAlgorithmException, UnrecoverableKeyException
     {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         Key key = null;
 
         if (entry == null) {
@@ -296,7 +296,7 @@
      * <i>key entry</i> without a certificate chain).
      */
     public Certificate[] engineGetCertificateChain(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             if (entry.chain == null) {
                 return null;
@@ -324,7 +324,7 @@
      * does not contain a certificate.
      */
     public Certificate engineGetCertificate(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             if (entry.chain == null) {
                 return null;
@@ -345,7 +345,7 @@
      * not exist
      */
     public Date engineGetCreationDate(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             return new Date(entry.date.getTime());
         } else {
@@ -409,10 +409,10 @@
             // set the keyId to current date
             entry.keyId = ("Time " + (entry.date).getTime()).getBytes("UTF8");
             // set the alias
-            entry.alias = alias.toLowerCase();
+            entry.alias = alias.toLowerCase(Locale.ENGLISH);
 
             // add the entry
-            entries.put(alias.toLowerCase(), entry);
+            entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
         } catch (Exception nsae) {
             throw new KeyStoreException("Key protection " +
                        " algorithm not found: " + nsae, nsae);
@@ -465,7 +465,7 @@
             // Won't happen
         }
         // set the alias
-        entry.alias = alias.toLowerCase();
+        entry.alias = alias.toLowerCase(Locale.ENGLISH);
 
         entry.protectedPrivKey = key.clone();
         if (chain != null) {
@@ -473,7 +473,7 @@
         }
 
         // add the entry
-        entries.put(alias.toLowerCase(), entry);
+        entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
     }
 
 
@@ -618,7 +618,7 @@
     public synchronized void engineSetCertificateEntry(String alias,
         Certificate cert) throws KeyStoreException
     {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             throw new KeyStoreException("Cannot overwrite own certificate");
         } else
@@ -635,7 +635,7 @@
     public synchronized void engineDeleteEntry(String alias)
         throws KeyStoreException
     {
-        entries.remove(alias.toLowerCase());
+        entries.remove(alias.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -655,7 +655,7 @@
      * @return true if the alias exists, false otherwise
      */
     public boolean engineContainsAlias(String alias) {
-        return entries.containsKey(alias.toLowerCase());
+        return entries.containsKey(alias.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -675,7 +675,7 @@
      * <i>key entry</i>, false otherwise.
      */
     public boolean engineIsKeyEntry(String alias) {
-        KeyEntry entry = entries.get(alias.toLowerCase());
+        KeyEntry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry != null) {
             return true;
         } else {
@@ -1274,7 +1274,8 @@
         if (password != null && s.available() > 0) {
            MacData macData = new MacData(s);
            try {
-                String algName = macData.getDigestAlgName().toUpperCase();
+                String algName =
+                        macData.getDigestAlgName().toUpperCase(Locale.ENGLISH);
                 if (algName.equals("SHA")  ||
                     algName.equals("SHA1") ||
                     algName.equals("SHA-1")) {
@@ -1479,7 +1480,7 @@
                 if (alias == null)
                    alias = getUnfriendlyName();
                 entry.alias = alias;
-                entries.put(alias.toLowerCase(), entry);
+                entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
             } else if (bagItem instanceof X509Certificate) {
                 X509Certificate cert = (X509Certificate)bagItem;
                 // Insert a localKeyID for the corresponding cert
--- a/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/provider/JavaKeyStore.java	Mon Aug 29 12:23:54 2011 -0400
@@ -54,7 +54,7 @@
     // regular JKS
     public static final class JKS extends JavaKeyStore {
         String convertAlias(String alias) {
-            return alias.toLowerCase();
+            return alias.toLowerCase(Locale.ENGLISH);
         }
     }
 
--- a/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Mon Aug 29 12:23:54 2011 -0400
@@ -105,7 +105,13 @@
         super("X.509");
 
         // Ensure that the List contains only X509Certificates
-        for (Certificate obj : certs) {
+        //
+        // Note; The certs parameter is not necessarily to be of Certificate
+        // for some old code. For compatibility, to make sure the exception
+        // is CertificateException, rather than ClassCastException, please
+        // don't use
+        //     for (Certificate obj : certs)
+        for (Object obj : certs) {
             if (obj instanceof X509Certificate == false) {
                 throw new CertificateException
                     ("List is not all X509Certificates: "
--- a/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Mon Aug 29 12:23:54 2011 -0400
@@ -879,7 +879,8 @@
             if (hashCode == 0) {
                 int result = 17;
                 result = 37*result + getPort();
-                result = 37*result + getServerName().toLowerCase().hashCode();
+                result = 37*result +
+                    getServerName().toLowerCase(Locale.ENGLISH).hashCode();
                 hashCode = result;
             }
             return hashCode;
--- a/jdk/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java	Mon Aug 29 12:23:54 2011 -0400
@@ -33,6 +33,7 @@
 import java.util.Hashtable;
 import java.util.NoSuchElementException;
 import java.util.Vector;
+import java.util.Locale;
 
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSessionContext;
@@ -166,7 +167,8 @@
     }
 
     private String getKey(String hostname, int port) {
-        return (hostname + ":" + String.valueOf(port)).toLowerCase();
+        return (hostname + ":" +
+            String.valueOf(port)).toLowerCase(Locale.ENGLISH);
     }
 
     // cache a SSLSession
--- a/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	Mon Aug 29 12:23:54 2011 -0400
@@ -25,6 +25,8 @@
 
 package sun.security.tools;
 
+import java.util.Locale;
+
 /**
  * <p> This class provides several utilities to <code>KeyStore</code>.
  *
@@ -63,7 +65,7 @@
         } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
             return "Windows-ROOT";
         } else {
-            return storetype.toUpperCase();
+            return storetype.toUpperCase(Locale.ENGLISH);
         }
     }
 }
--- a/jdk/src/share/classes/sun/security/util/HostnameChecker.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/util/HostnameChecker.java	Mon Aug 29 12:23:54 2011 -0400
@@ -266,8 +266,8 @@
      */
     private static boolean matchAllWildcards(String name,
          String template) {
-        name = name.toLowerCase();
-        template = template.toLowerCase();
+        name = name.toLowerCase(Locale.ENGLISH);
+        template = template.toLowerCase(Locale.ENGLISH);
         StringTokenizer nameSt = new StringTokenizer(name, ".");
         StringTokenizer templateSt = new StringTokenizer(template, ".");
 
@@ -296,8 +296,8 @@
      */
     private static boolean matchLeftmostWildcard(String name,
                          String template) {
-        name = name.toLowerCase();
-        template = template.toLowerCase();
+        name = name.toLowerCase(Locale.ENGLISH);
+        template = template.toLowerCase(Locale.ENGLISH);
 
         // Retreive leftmost component
         int templateIdx = template.indexOf(".");
--- a/jdk/src/share/classes/sun/security/x509/DNSName.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/x509/DNSName.java	Mon Aug 29 12:23:54 2011 -0400
@@ -159,7 +159,7 @@
      * @return a hash code value for this object.
      */
     public int hashCode() {
-        return name.toUpperCase().hashCode();
+        return name.toUpperCase(Locale.ENGLISH).hashCode();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/x509/RFC822Name.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/x509/RFC822Name.java	Mon Aug 29 12:23:54 2011 -0400
@@ -153,7 +153,7 @@
      * @return a hash code value for this object.
      */
     public int hashCode() {
-        return name.toUpperCase().hashCode();
+        return name.toUpperCase(Locale.ENGLISH).hashCode();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/x509/X500Name.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/security/x509/X500Name.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1401,8 +1401,7 @@
             principalConstructor = constr;
             principalField = (Field)result[1];
         } catch (Exception e) {
-            throw (InternalError)new InternalError("Could not obtain "
-                + "X500Principal access").initCause(e);
+            throw new InternalError("Could not obtain X500Principal access", e);
         }
     }
 
--- a/jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/classes/sun/tools/jconsole/ProxyClient.java	Mon Aug 29 12:23:54 2011 -0400
@@ -208,7 +208,7 @@
             serverStubClass = Class.forName(rmiServerImplStubClassName).asSubclass(Remote.class);
         } catch (ClassNotFoundException e) {
             // should never reach here
-            throw (InternalError) new InternalError(e.getMessage()).initCause(e);
+            throw new InternalError(e.getMessage(), e);
         }
         rmiServerImplStubClass = serverStubClass;
     }
@@ -395,18 +395,10 @@
         } catch (MalformedObjectNameException e) {
             // should not reach here
             throw new InternalError(e.getMessage());
-        } catch (IntrospectionException e) {
-            InternalError ie = new InternalError(e.getMessage());
-            ie.initCause(e);
-            throw ie;
-        } catch (InstanceNotFoundException e) {
-            InternalError ie = new InternalError(e.getMessage());
-            ie.initCause(e);
-            throw ie;
-        } catch (ReflectionException e) {
-            InternalError ie = new InternalError(e.getMessage());
-            ie.initCause(e);
-            throw ie;
+        } catch (IntrospectionException |
+                 InstanceNotFoundException |
+                 ReflectionException e) {
+            throw new InternalError(e.getMessage(), e);
         }
 
         if (hasPlatformMXBeans) {
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Mon Aug 29 12:23:54 2011 -0400
@@ -31,6 +31,7 @@
 
 package com.sun.nio.zipfs;
 
+import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
@@ -1165,7 +1166,6 @@
     // sync the zip file system, if there is any udpate
     private void sync() throws IOException {
         //System.out.printf("->sync(%s) starting....!%n", toString());
-
         // check ex-closer
         if (!exChClosers.isEmpty()) {
             for (ExChannelCloser ecc : exChClosers) {
@@ -1179,84 +1179,84 @@
         if (!hasUpdate)
             return;
         Path tmpFile = createTempFileInSameDirectoryAs(zfpath);
-        OutputStream os = Files.newOutputStream(tmpFile, WRITE);
-        ArrayList<Entry> elist = new ArrayList<>(inodes.size());
-        long written = 0;
-        byte[] buf = new byte[8192];
-        Entry e = null;
+        try (OutputStream os = new BufferedOutputStream(Files.newOutputStream(tmpFile, WRITE)))
+        {
+            ArrayList<Entry> elist = new ArrayList<>(inodes.size());
+            long written = 0;
+            byte[] buf = new byte[8192];
+            Entry e = null;
 
-        // write loc
-        for (IndexNode inode : inodes.values()) {
-            if (inode instanceof Entry) {    // an updated inode
-                e = (Entry)inode;
-                try {
-                    if (e.type == Entry.COPY) {
-                        // entry copy: the only thing changed is the "name"
-                        // and "nlen" in LOC header, so we udpate/rewrite the
-                        // LOC in new file and simply copy the rest (data and
-                        // ext) without enflating/deflating from the old zip
-                        // file LOC entry.
-                        written += copyLOCEntry(e, true, os, written, buf);
-                    } else {                          // NEW, FILECH or CEN
-                        e.locoff = written;
-                        written += e.writeLOC(os);    // write loc header
-                        if (e.bytes != null) {        // in-memory, deflated
-                            os.write(e.bytes);        // already
-                            written += e.bytes.length;
-                        } else if (e.file != null) {  // tmp file
-                            try (InputStream is = Files.newInputStream(e.file)) {
-                                int n;
-                                if (e.type == Entry.NEW) {  // deflated already
-                                    while ((n = is.read(buf)) != -1) {
-                                        os.write(buf, 0, n);
-                                        written += n;
+            // write loc
+            for (IndexNode inode : inodes.values()) {
+                if (inode instanceof Entry) {    // an updated inode
+                    e = (Entry)inode;
+                    try {
+                        if (e.type == Entry.COPY) {
+                            // entry copy: the only thing changed is the "name"
+                            // and "nlen" in LOC header, so we udpate/rewrite the
+                            // LOC in new file and simply copy the rest (data and
+                            // ext) without enflating/deflating from the old zip
+                            // file LOC entry.
+                            written += copyLOCEntry(e, true, os, written, buf);
+                        } else {                          // NEW, FILECH or CEN
+                            e.locoff = written;
+                            written += e.writeLOC(os);    // write loc header
+                            if (e.bytes != null) {        // in-memory, deflated
+                                os.write(e.bytes);        // already
+                                written += e.bytes.length;
+                            } else if (e.file != null) {  // tmp file
+                                try (InputStream is = Files.newInputStream(e.file)) {
+                                    int n;
+                                    if (e.type == Entry.NEW) {  // deflated already
+                                        while ((n = is.read(buf)) != -1) {
+                                            os.write(buf, 0, n);
+                                            written += n;
+                                        }
+                                    } else if (e.type == Entry.FILECH) {
+                                        // the data are not deflated, use ZEOS
+                                        try (OutputStream os2 = new EntryOutputStream(e, os)) {
+                                            while ((n = is.read(buf)) != -1) {
+                                                os2.write(buf, 0, n);
+                                            }
+                                        }
+                                        written += e.csize;
+                                        if ((e.flag & FLAG_DATADESCR) != 0)
+                                            written += e.writeEXT(os);
                                     }
-                                } else if (e.type == Entry.FILECH) {
-                                    // the data are not deflated, use ZEOS
-                                    try (OutputStream os2 = new EntryOutputStream(e, os)) {
-                                        while ((n = is.read(buf)) != -1) {
-                                            os2.write(buf, 0, n);
-                                        }
-                                    }
-                                    written += e.csize;
-                                    if ((e.flag & FLAG_DATADESCR) != 0)
-                                        written += e.writeEXT(os);
                                 }
+                                Files.delete(e.file);
+                                tmppaths.remove(e.file);
+                            } else {
+                                // dir, 0-length data
                             }
-                            Files.delete(e.file);
-                            tmppaths.remove(e.file);
-                        } else {
-                            // dir, 0-length data
                         }
+                        elist.add(e);
+                    } catch (IOException x) {
+                        x.printStackTrace();    // skip any in-accurate entry
                     }
-                    elist.add(e);
-                } catch (IOException x) {
-                    x.printStackTrace();    // skip any in-accurate entry
-                }
-            } else {                        // unchanged inode
-                if (inode.pos == -1) {
-                    continue;               // pseudo directory node
-                }
-                e = Entry.readCEN(this, inode.pos);
-                try {
-                    written += copyLOCEntry(e, false, os, written, buf);
-                    elist.add(e);
-                } catch (IOException x) {
-                    x.printStackTrace();    // skip any wrong entry
+                } else {                        // unchanged inode
+                    if (inode.pos == -1) {
+                        continue;               // pseudo directory node
+                    }
+                    e = Entry.readCEN(this, inode.pos);
+                    try {
+                        written += copyLOCEntry(e, false, os, written, buf);
+                        elist.add(e);
+                    } catch (IOException x) {
+                        x.printStackTrace();    // skip any wrong entry
+                    }
                 }
             }
+
+            // now write back the cen and end table
+            end.cenoff = written;
+            for (Entry entry : elist) {
+                written += entry.writeCEN(os);
+            }
+            end.centot = elist.size();
+            end.cenlen = written - end.cenoff;
+            end.write(os, written);
         }
-
-        // now write back the cen and end table
-        end.cenoff = written;
-        for (Entry entry : elist) {
-            written += entry.writeCEN(os);
-        }
-        end.centot = elist.size();
-        end.cenlen = written - end.cenoff;
-        end.write(os, written);
-        os.close();
-
         if (!streams.isEmpty()) {
             //
             // TBD: ExChannelCloser should not be necessary if we only
@@ -1959,7 +1959,7 @@
             writeBytes(os, name);
             if (elen64 != 0) {
                 writeShort(os, EXTID_ZIP64);// Zip64 extra
-                writeShort(os, elen64);     // size of "this" extra block
+                writeShort(os, elen64 - 4); // size of "this" extra block
                 if (size0 == ZIP64_MINVAL)
                     writeLong(os, size);
                 if (csize0 == ZIP64_MINVAL)
--- a/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java	Mon Aug 29 12:23:54 2011 -0400
@@ -166,8 +166,8 @@
         // is implemented.
 
         Class paramTypes[] = { int.class };
-        Constructor ctr = Reflect.lookupConstructor("java.io.FileDescriptor",
-                                                    paramTypes);
+        Constructor<?> ctr = Reflect.lookupConstructor("java.io.FileDescriptor",
+                                                       paramTypes);
         Object args[] = { new Integer(fdVal) };
         FileDescriptor fd = (FileDescriptor)Reflect.invoke(ctr, args);
 
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java	Mon Aug 29 12:23:54 2011 -0400
@@ -58,7 +58,10 @@
         try {
             ifd = inotifyInit();
         } catch (UnixException x) {
-            throw new IOException(x.errorString());
+            String msg = (x.errno() == EMFILE) ?
+                "User limit of inotify instances reached or too many open files" :
+                x.errorString();
+            throw new IOException(msg);
         }
 
         // configure inotify to be non-blocking
--- a/jdk/src/solaris/lib/content-types.properties	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/solaris/lib/content-types.properties	Mon Aug 29 12:23:54 2011 -0400
@@ -225,6 +225,10 @@
 	icon=png;\
 	action=browser
 
+image/bmp: \
+	description=Bitmap Image;\
+	file_extensions=.bmp;
+
 text/html: \
 	description=HTML Document;\
 	file_extensions=.htm,.html;\
--- a/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c	Mon Aug 29 12:23:54 2011 -0400
@@ -108,6 +108,7 @@
     DEF(EROFS);
     DEF(ENODATA);
     DEF(ERANGE);
+    DEF(EMFILE);
 
     // flags used with openat/unlinkat/etc.
 #if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)
--- a/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Mon Aug 29 12:23:54 2011 -0400
@@ -55,9 +55,7 @@
             try {
                 return new Iocp(null, ThreadPool.createDefault()).start();
             } catch (IOException ioe) {
-                InternalError e = new InternalError();
-                e.initCause(ioe);
-                throw e;
+                throw new InternalError(ioe);
             }
         }
     }
--- a/jdk/src/windows/lib/content-types.properties	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/src/windows/lib/content-types.properties	Mon Aug 29 12:23:54 2011 -0400
@@ -222,6 +222,10 @@
 	icon=png;\
 	action=browser
 
+image/bmp: \
+	description=Bitmap Image;\
+	file_extensions=.bmp;
+
 text/html: \
 	description=HTML Document;\
 	file_extensions=.htm,.html;\
--- a/jdk/test/ProblemList.txt	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/ProblemList.txt	Mon Aug 29 12:23:54 2011 -0400
@@ -198,10 +198,16 @@
 # requires junit
 java/lang/invoke/InvokeDynamicPrintArgs.java                    generic-all
 
+# 7079093
+java/lang/instrument/ManifestTest.sh				windows-all
+
 ############################################################################
 
 # jdk_management
 
+# 6944188
+java/lang/management/ThreadMXBean/ThreadStateTest.java		generic-all
+
 # 7067973
 java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
 
@@ -368,6 +374,12 @@
 # 7079145 java/net/ipv6tests/UdpTest.java hang at IPv6 only data exchange
 java/net/ipv6tests/UdpTest.java                                 linux-all
 
+# 7079012
+java/net/NetworkInterface/NetParamsTest.java			solaris-all
+
+# 7081476
+java/net/InetSocketAddress/B6469803.java			generic-all
+
 ############################################################################
 
 # jdk_io
@@ -375,6 +387,12 @@
 # 6962637
 java/io/File/MaxPathLength.java                                 windows-all
 
+# 6671616
+java/io/File/BlockIsDirectory.java				solaris-all
+
+# 7076644
+java/io/File/Basic.java						windows-all
+
 ############################################################################
 
 # jdk_nio
@@ -382,6 +400,9 @@
 # 6963118
 java/nio/channels/Selector/Wakeup.java                          windows-all
 
+# 7076700
+java/nio/channels/SocketChannel/AdaptSocket.java		generic-all
+
 ############################################################################
 
 # jdk_rmi
@@ -499,6 +520,12 @@
 # 7079203 sun/security/tools/keytool/printssl.sh fails on solaris with timeout
 sun/security/tools/keytool/printssl.sh                          solaris-all
 
+# 7054637
+sun/security/tools/jarsigner/ec.sh                             solaris-all
+
+# 7081817
+sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java 	generic-all
+
 ############################################################################
 
 # jdk_swing (not using samevm)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/security/sasl/ntlm/Conformance.java	Mon Aug 29 12:23:54 2011 -0400
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2011, 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 7043847 7043860 7043882 7043938 7043959
+ * @summary NTML impl of SaslServer conformance errors
+ */
+import java.io.IOException;
+import javax.security.sasl.*;
+import java.util.*;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+public class Conformance {
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Sasl.createSaslClient(new String[] {"NTLM"}, "abc", "ldap",
+                    "server", new HashMap<String, Object>(), null);
+        } catch (SaslException se) {
+            System.out.println(se);
+        }
+        try {
+            Sasl.createSaslServer("NTLM", "ldap",
+                    "server", new HashMap<String, Object>(), null);
+        } catch (SaslException se) {
+            System.out.println(se);
+        }
+        try {
+            Sasl.createSaslClient(new String[] {"NTLM"}, "abc", "ldap",
+                    "server", null, new CallbackHandler() {
+                        @Override
+                        public void handle(Callback[] callbacks) throws
+                                IOException, UnsupportedCallbackException {  }
+                    });
+        } catch (SaslException se) {
+            System.out.println(se);
+        }
+        try {
+            SaslServer saslServer =
+                    Sasl.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
+                        @Override
+                        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {  }
+                    });
+            System.err.println("saslServer = " + saslServer);
+            System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
+            // IllegalStateException is expected here
+            saslServer.getNegotiatedProperty("prop");
+            System.err.println("No IllegalStateException");
+        } catch (IllegalStateException se) {
+            System.out.println(se);
+        }
+        try {
+            SaslServer saslServer =
+                    Sasl.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
+                        @Override
+                        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {  }
+                    });
+            System.err.println("saslServer = " + saslServer);
+            System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
+            // IllegalStateException is expected here
+            saslServer.getAuthorizationID();
+            System.err.println("No IllegalStateException");
+        } catch (IllegalStateException se) {
+            System.out.println(se);
+        }
+        try {
+            SaslServer saslServer =
+                    Sasl.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
+                        @Override
+                        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {  }
+                    });
+            System.err.println("saslServer = " + saslServer);
+            System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
+            // IllegalStateException is expected here
+            saslServer.wrap(new byte[0], 0, 0);
+            System.err.println("No IllegalStateException");
+        } catch (IllegalStateException se) {
+            System.out.println(se);
+        }
+    }
+}
--- a/jdk/test/java/io/IOException/LastErrorString.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/io/IOException/LastErrorString.java	Mon Aug 29 12:23:54 2011 -0400
@@ -23,6 +23,7 @@
 
 /* @test
    @bug 4167937
+   @ignore Test truncates system files when run as root, see 7042603
    @summary Test code paths that use the JVM_LastErrorString procedure
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/etc/FailingFlushAndClose.java	Mon Aug 29 12:23:54 2011 -0400
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+
+/**
+ * @test
+ * @bug 7015589
+ * @summary Test that buffering streams are considered closed even when the
+ *    close or flush from the underlying stream fails.
+ */
+
+public class FailingFlushAndClose {
+
+    static int failed;
+
+    static void fail(String msg) {
+        System.err.println("FAIL: " + msg);
+        failed++;
+    }
+
+    static void failWithIOE(String msg) throws IOException {
+        fail(msg);
+        throw new IOException(msg);
+    }
+
+    static class FailingCloseInputStream extends InputStream {
+        boolean closed;
+        @Override
+        public int read()throws IOException {
+            if (closed)
+                failWithIOE("input stream is closed");
+            return 1;
+        }
+        @Override
+        public void close() throws IOException {
+            if (!closed) {
+                closed = true;
+                throw new IOException("close failed");
+            }
+        }
+    }
+
+    static class FailingCloseOutputStream extends OutputStream {
+        boolean closed;
+        @Override
+        public void write(int b) throws IOException {
+            if (closed)
+                failWithIOE("output stream is closed");
+        }
+        @Override
+        public void flush() throws IOException {
+            if (closed)
+                failWithIOE("output stream is closed");
+        }
+        @Override
+        public void close() throws IOException {
+            if (!closed) {
+                closed = true;
+                throw new IOException("close failed");
+            }
+        }
+    }
+
+    static class FailingFlushOutputStream extends OutputStream {
+        boolean closed;
+        @Override
+        public void write(int b) throws IOException {
+            if (closed)
+                failWithIOE("output stream is closed");
+        }
+        @Override
+        public void flush() throws IOException {
+            if (closed) {
+                failWithIOE("output stream is closed");
+            } else {
+                throw new IOException("flush failed");
+            }
+        }
+        @Override
+        public void close() throws IOException {
+            closed = true;
+        }
+    }
+
+    static class FailingCloseReader extends Reader {
+        boolean closed;
+        @Override
+        public int read(char[] cbuf, int off, int len) throws IOException {
+            if (closed)
+                failWithIOE("reader is closed");
+            return 1;
+        }
+        @Override
+        public void close() throws IOException {
+            if (!closed) {
+                closed = true;
+                throw new IOException("close failed");
+            }
+        }
+    }
+
+    static class FailingCloseWriter extends Writer {
+        boolean closed;
+        @Override
+        public void write(char[] cbuf, int off, int len) throws IOException {
+            if (closed)
+                failWithIOE("writer is closed");
+        }
+        @Override
+        public void flush() throws IOException {
+            if (closed)
+                failWithIOE("writer is closed");
+        }
+        @Override
+        public void close() throws IOException {
+            if (!closed) {
+                closed = true;
+                throw new IOException("close failed");
+            }
+        }
+    }
+
+    static class FailingFlushWriter extends Writer {
+        boolean closed;
+        @Override
+        public void write(char[] cbuf, int off, int len) throws IOException {
+            if (closed)
+                failWithIOE("writer is closed");
+        }
+        @Override
+        public void flush() throws IOException {
+            if (closed) {
+                failWithIOE("writer is closed");
+            } else {
+                throw new IOException("flush failed");
+            }
+        }
+        @Override
+        public void close() throws IOException {
+            if (!closed) {
+                closed = true;
+                throw new IOException("close failed");
+            }
+        }
+    }
+
+    static void testFailingClose(InputStream in) throws IOException {
+        System.out.println(in.getClass());
+        in.read(new byte[100]);
+        try {
+            in.close();
+            fail("close did not fail");
+        } catch (IOException expected) { }
+        try {
+            in.read(new byte[100]);
+            fail("read did not fail");
+        } catch (IOException expected) { }
+    }
+
+    static void testFailingClose(OutputStream out) throws IOException {
+        System.out.println(out.getClass());
+        out.write(1);
+        try {
+            out.close();
+            fail("close did not fail");
+        } catch (IOException expected) { }
+        try {
+            out.write(1);
+            if (!(out instanceof BufferedOutputStream))
+                fail("write did not fail");
+        } catch (IOException expected) { }
+    }
+
+    static void testFailingFlush(OutputStream out) throws IOException {
+        System.out.println(out.getClass());
+        out.write(1);
+        try {
+            out.flush();
+            fail("flush did not fail");
+        } catch (IOException expected) { }
+        if (out instanceof BufferedOutputStream) {
+            out.write(1);
+            try {
+                out.close();
+                fail("close did not fail");
+            } catch (IOException expected) { }
+        }
+    }
+
+    static void testFailingClose(Reader r) throws IOException {
+        System.out.println(r.getClass());
+        r.read(new char[100]);
+        try {
+            r.close();
+            fail("close did not fail");
+        } catch (IOException expected) { }
+        try {
+            r.read(new char[100]);
+            fail("read did not fail");
+        } catch (IOException expected) { }
+    }
+
+    static void testFailingClose(Writer w) throws IOException {
+        System.out.println(w.getClass());
+        w.write("message");
+        try {
+            w.close();
+            fail("close did not fail");
+        } catch (IOException expected) { }
+        try {
+            w.write("another message");
+            fail("write did not fail");
+        } catch (IOException expected) { }
+    }
+
+    static void testFailingFlush(Writer w) throws IOException {
+        System.out.println(w.getClass());
+        w.write("message");
+        try {
+            w.flush();
+            fail("flush did not fail");
+        } catch (IOException expected) { }
+        if (w instanceof BufferedWriter) {
+            // assume this message will be buffered
+            w.write("another message");
+            try {
+                w.close();
+                fail("close did not fail");
+            } catch (IOException expected) { }
+        }
+    }
+
+    public static void main(String[] args) throws IOException {
+
+        testFailingClose(new BufferedInputStream(new FailingCloseInputStream()));
+        testFailingClose(new BufferedOutputStream(new FailingCloseOutputStream()));
+
+        testFailingClose(new BufferedReader(new FailingCloseReader()));
+        testFailingClose(new BufferedWriter(new FailingCloseWriter()));
+
+        testFailingFlush(new BufferedOutputStream(new FailingFlushOutputStream()));
+        testFailingFlush(new BufferedWriter(new FailingFlushWriter()));
+
+        if (failed > 0)
+            throw new RuntimeException(failed + " test(s) failed - see log for details");
+    }
+}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1803,7 +1803,7 @@
 
             p.getInputStream().close();
             p.getErrorStream().close();
-            p.getOutputStream().close();
+            try { p.getOutputStream().close(); } catch (IOException flushFailed) { }
 
             InputStream[] streams = { p.getInputStream(), p.getErrorStream() };
             for (final InputStream in : streams) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/GetObjectName.java	Mon Aug 29 12:23:54 2011 -0400
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011, 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 7068328
+ * @summary Test if getObjectName handles properly when called by
+ *          multiple threads simultaneously. Run in othervm mode to
+ *          make sure the object name is not initialized to begin with.
+ * @run main/othervm GetObjectName
+ */
+
+import java.lang.management.BufferPoolMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.PlatformLoggingMXBean;
+import java.lang.management.PlatformManagedObject;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class GetObjectName {
+    private static boolean failed = false;
+    public static void main(String[] args) throws Exception {
+        int tasks = 10000;
+        ExecutorService executor = Executors.newFixedThreadPool(10);
+        submitTasks(executor, tasks);
+        executor.shutdown();
+        executor.awaitTermination(10, TimeUnit.SECONDS);
+        if (!failed) {
+            System.out.println("Test passed.");
+        }
+    }
+
+    static void submitTasks(ExecutorService executor, int count) {
+        for (int i=0; i < count && !failed; i++) {
+            executor.execute(new Runnable() {
+                @Override
+                public void run() {
+                    List<PlatformManagedObject> mbeans = new ArrayList<>();
+                    mbeans.add(ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class));
+                    mbeans.addAll(ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class));
+                    for (PlatformManagedObject pmo : mbeans) {
+                        // Name should not be null
+                        if (pmo.getObjectName() == null) {
+                            failed = true;
+                            throw new RuntimeException("TEST FAILED: getObjectName() returns null");
+                        }
+                    }
+                }
+            });
+        }
+    }
+}
--- a/jdk/test/java/lang/reflect/Generics/Probe.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/lang/reflect/Generics/Probe.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5003916 6704655 6873951
+ * @bug 5003916 6704655 6873951 6476261
  * @summary Testing parsing of signatures attributes of nested classes
  * @author Joseph D. Darcy
  */
@@ -38,12 +38,12 @@
           "java.util.concurrent.ConcurrentHashMap$KeyIterator",
           "java.util.concurrent.ConcurrentHashMap$ValueIterator",
           "java.util.AbstractList$ListItr",
-//          "java.util.EnumMap$EntryIterator",
-//          "java.util.EnumMap$KeyIterator",
-//          "java.util.EnumMap$ValueIterator",
-//          "java.util.IdentityHashMap$EntryIterator",
-//          "java.util.IdentityHashMap$KeyIterator",
-//          "java.util.IdentityHashMap$ValueIterator",
+          "java.util.EnumMap$EntryIterator",
+          "java.util.EnumMap$KeyIterator",
+          "java.util.EnumMap$ValueIterator",
+          "java.util.IdentityHashMap$EntryIterator",
+          "java.util.IdentityHashMap$KeyIterator",
+          "java.util.IdentityHashMap$ValueIterator",
           "java.util.WeakHashMap$EntryIterator",
           "java.util.WeakHashMap$KeyIterator",
           "java.util.WeakHashMap$ValueIterator",
@@ -52,12 +52,12 @@
           "java.util.HashMap$ValueIterator",
           "java.util.LinkedHashMap$EntryIterator",
           "java.util.LinkedHashMap$KeyIterator",
-          "java.util.LinkedHashMap$ValueIterator"})
+          "java.util.LinkedHashMap$ValueIterator",
+          "javax.swing.JComboBox$AccessibleJComboBox"})
 public class Probe {
     public static void main (String... args) throws Throwable {
         Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class);
-        List<String> names =
-            new ArrayList<String>(asList(classesAnnotation.value()));
+        List<String> names = new ArrayList<>(asList(classesAnnotation.value()));
 
         int errs = 0;
         for(String name: names) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Generics/SignatureTest.java	Mon Aug 29 12:23:54 2011 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2006, 2011, 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 6476261
+ * @summary More testing of parsing of signatures attributes of nested classes
+ */
+
+import java.lang.reflect.*;
+
+public class SignatureTest<T> {
+   class Inner1 {
+      class Inner11 {
+      }
+   }
+
+   public void f(SignatureTest<String>.Inner1.Inner11 x) {}
+   public void g(SignatureTest<String>.Inner1 x) {}
+
+   public static void main(String[] args) throws Exception {
+      Class clazz = SignatureTest.class;
+      for (Method m : clazz.getDeclaredMethods()) {
+          System.out.println();
+          System.out.println(m.toString());
+          System.out.println(m.toGenericString());
+          System.out.println(m.getGenericParameterTypes());
+      }
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Generics/TestBadSignatures.java	Mon Aug 29 12:23:54 2011 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011, 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 6832374 7052898
+ * @summary Test bad signatures get a GenericSignatureFormatError thrown.
+ * @author Joseph D. Darcy
+ */
+
+import java.lang.reflect.*;
+import sun.reflect.generics.parser.SignatureParser;
+
+public class TestBadSignatures {
+    public static void main(String[] args) {
+        String[] badSignatures = {
+            // Missing ":" after first type bound
+            "<T:Lfoo/tools/nsc/symtab/Names;Lfoo/tools/nsc/symtab/Symbols;",
+
+            // Arrays improperly indicated for exception information
+            "<E:Ljava/lang/Exception;>(TE;[Ljava/lang/RuntimeException;)V^[TE;",
+        };
+
+        for(String badSig : badSignatures) {
+            try {
+                SignatureParser.make().parseMethodSig(badSig);
+                throw new RuntimeException("Expected GenericSignatureFormatError for " +
+                                           badSig);
+            } catch(GenericSignatureFormatError gsfe) {
+                System.out.println(gsfe.toString()); // Expected
+            }
+        }
+    }
+}
--- a/jdk/test/java/net/CookieHandler/TestHttpCookie.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/net/CookieHandler/TestHttpCookie.java	Mon Aug 29 12:23:54 2011 -0400
@@ -362,12 +362,13 @@
         eq(c1, c2, false);
 
         header("Test domainMatches()");
-        dm(".foo.com",  "y.x.foo.com",      false);
-        dm(".foo.com",  "x.foo.com",        true);
-        dm(".com",      "whatever.com",     false);
-        dm(".com.",     "whatever.com",     false);
-        dm(".ajax.com", "ajax.com",         true);
-        dm(".local",    "example.local",    true);
+        dm(".foo.com",      "y.x.foo.com",      false);
+        dm(".foo.com",      "x.foo.com",        true);
+        dm(".com",          "whatever.com",     false);
+        dm(".com.",         "whatever.com",     false);
+        dm(".ajax.com",     "ajax.com",         true);
+        dm(".local",        "example.local",    true);
+        dm("example.local", "example",          true);
 
         // bug 6277808
         testCount++;
--- a/jdk/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java	Mon Aug 29 12:23:54 2011 -0400
@@ -57,11 +57,22 @@
         return ip6Interfaces.get(nif);
     }
 
+    // IPv6 not supported for Windows XP/Server 2003
+    static boolean isIPv6Supported() {
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            String ver = System.getProperty("os.version");
+            int major = Integer.parseInt(ver.split("\\.")[0]);
+            return (major >= 6);
+        }
+        return true;
+    }
+
     static NetworkConfiguration probe() throws IOException {
         Map<NetworkInterface,List<InetAddress>> ip4Interfaces =
             new HashMap<NetworkInterface,List<InetAddress>>();
         Map<NetworkInterface,List<InetAddress>> ip6Interfaces =
             new HashMap<NetworkInterface,List<InetAddress>>();
+        boolean isIPv6Supported = isIPv6Supported();
 
         // find the interfaces that support IPv4 and IPv6
         List<NetworkInterface> nifs = Collections
@@ -81,7 +92,7 @@
                         }
                         list.add(addr);
                         ip4Interfaces.put(nif, list);
-                    } else if (addr instanceof Inet6Address) {
+                    } else if (isIPv6Supported && (addr instanceof Inet6Address)) {
                         List<InetAddress> list = ip6Interfaces.get(nif);
                         if (list == null) {
                             list = new LinkedList<InetAddress>();
--- a/jdk/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java	Mon Aug 29 12:23:54 2011 -0400
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 6935563
+ * @bug 6935563 7044870
  * @summary Test that Selector does not select an unconnected DatagramChannel when
  *    ICMP port unreachable received
  */
@@ -35,14 +35,15 @@
 public class SelectWhenRefused {
 
     public static void main(String[] args) throws IOException {
-        DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0));
-        int port = dc.socket().getLocalPort();
-        dc.close();
+        DatagramChannel dc1 = DatagramChannel.open().bind(new InetSocketAddress(0));
+        int port = dc1.socket().getLocalPort();
 
         // datagram sent to this address should be refused
         SocketAddress refuser = new InetSocketAddress(InetAddress.getLocalHost(), port);
 
-        dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        dc1.close();
+
         Selector sel = Selector.open();
         try {
             dc.configureBlocking(false);
@@ -52,6 +53,10 @@
             sendDatagram(dc, refuser);
             int n = sel.select(2000);
             if (n > 0) {
+                sel.selectedKeys().clear();
+                // BindException will be thrown if another service is using
+                // our expected refuser port, cannot run just exit.
+                DatagramChannel.open().bind(refuser).close();
                 throw new RuntimeException("Unexpected wakeup");
             }
 
@@ -80,6 +85,8 @@
                 throw new RuntimeException("Unexpected wakeup after disconnect");
             }
 
+        } catch(BindException e) {
+            // Do nothing, some other test has used this port
         } finally {
             sel.close();
             dc.close();
--- a/jdk/test/java/util/zip/LargeZip.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/java/util/zip/LargeZip.java	Mon Aug 29 12:23:54 2011 -0400
@@ -25,173 +25,242 @@
 
 import java.io.*;
 import java.nio.*;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.nio.file.spi.*;
 import java.util.*;
 import java.util.zip.*;
 
-public class LargeZip {
-    // If true, don't delete large ZIP file created for test.
-    static final boolean debug = System.getProperty("debug") != null;
+import static java.nio.file.StandardCopyOption.*;
 
-    //static final int DATA_LEN = 1024 * 1024;
-    static final int DATA_LEN = 80 * 1024;
-    static final int DATA_SIZE = 8;
+public class LargeZip {
+     // If true, don't delete large ZIP file created for test.
+     static final boolean debug = System.getProperty("debug") != null;
 
-    static long fileSize = 6L * 1024L * 1024L * 1024L; // 6GB
-
-    static boolean userFile = false;
+     //static final int DATA_LEN = 1024 * 1024;
+     static final int DATA_LEN = 80 * 1024;
+     static final int DATA_SIZE = 8;
 
-    static byte[] data;
-    static File largeFile;
-    static String lastEntryName;
+     static long fileSize = 6L * 1024L * 1024L * 1024L; // 6GB
+
+     static boolean userFile = false;
+     static byte[] data;
+     static File largeFile;
+     static String lastEntryName;
 
-    /* args can be empty, in which case check a 3 GB file which is created for
-     * this test (and then deleted).  Or it can be a number, in which case
-     * that designates the size of the file that's created for this test (and
-     * then deleted).  Or it can be the name of a file to use for the test, in
-     * which case it is *not* deleted.  Note that in this last case, the data
-     * comparison might fail.
-     */
-    static void realMain (String[] args) throws Throwable {
-        if (args.length > 0) {
-            try {
-                fileSize = Long.parseLong(args[0]);
-                System.out.println("Testing with file of size " + fileSize);
-            } catch (NumberFormatException ex) {
-                largeFile = new File(args[0]);
-                if (!largeFile.exists()) {
-                    throw new Exception("Specified file " + args[0] + " does not exist");
-                }
-                userFile = true;
-                System.out.println("Testing with user-provided file " + largeFile);
-            }
-        }
-        File testDir = null;
-        if (largeFile == null) {
-            testDir = new File(System.getProperty("test.scratch", "."),
-                                    "LargeZip");
-            if (testDir.exists()) {
-                if (!testDir.delete()) {
-                    throw new Exception("Cannot delete already-existing test directory");
-                }
-            }
-            check(!testDir.exists() && testDir.mkdirs());
-            largeFile = new File(testDir, "largezip.zip");
-            createLargeZip();
-        }
+     /* args can be empty, in which case check a 3 GB file which is created for
+      * this test (and then deleted).  Or it can be a number, in which case
+      * that designates the size of the file that's created for this test (and
+      * then deleted).  Or it can be the name of a file to use for the test, in
+      * which case it is *not* deleted.  Note that in this last case, the data
+      * comparison might fail.
+      */
+     static void realMain (String[] args) throws Throwable {
+         if (args.length > 0) {
+             try {
+                 fileSize = Long.parseLong(args[0]);
+                 System.out.println("Testing with file of size " + fileSize);
+             } catch (NumberFormatException ex) {
+                 largeFile = new File(args[0]);
+                 if (!largeFile.exists()) {
+                     throw new Exception("Specified file " + args[0] + " does not exist");
+                 }
+                 userFile = true;
+                 System.out.println("Testing with user-provided file " + largeFile);
+             }
+         }
+         File testDir = null;
+         if (largeFile == null) {
+             testDir = new File(System.getProperty("test.scratch", "."),
+                                     "LargeZip");
+             if (testDir.exists()) {
+                 if (!testDir.delete()) {
+                     throw new Exception("Cannot delete already-existing test directory");
+                 }
+             }
+             check(!testDir.exists() && testDir.mkdirs());
+             largeFile = new File(testDir, "largezip.zip");
+             createLargeZip();
+         } else {
+             if (args.length > 1)
+                 updateLargeZip(args[1]); // add new entry with zfs
+         }
+         readLargeZip1();
+         readLargeZip2();
 
-        readLargeZip1();
-        readLargeZip2();
+         if (!userFile && !debug) {
+             check(largeFile.delete());
+             check(testDir.delete());
+         }
+     }
+
+     static void createLargeZip() throws Throwable {
+         int iterations = DATA_LEN / DATA_SIZE;
+         ByteBuffer bb = ByteBuffer.allocate(DATA_SIZE);
+         ByteArrayOutputStream baos = new ByteArrayOutputStream();
+         for (int i = 0; i < iterations; i++) {
+             bb.putDouble(0, Math.random());
+             baos.write(bb.array(), 0, DATA_SIZE);
+         }
+         data = baos.toByteArray();
+
+         try (FileOutputStream fos = new FileOutputStream(largeFile);
+              BufferedOutputStream bos = new BufferedOutputStream(fos);
+              ZipOutputStream zos = new ZipOutputStream(bos))
+         {
+             long length = 0;
+             while (length < fileSize) {
+                 ZipEntry ze = new ZipEntry("entry-" + length);
+                 lastEntryName = ze.getName();
+                 zos.putNextEntry(ze);
+                 zos.write(data, 0, data.length);
+                 zos.closeEntry();
+                 length = largeFile.length();
+             }
+             System.out.println("Last entry written is " + lastEntryName);
+         }
+     }
+
+     private static byte buf[] = new byte[4096];
+
+     static void checkEntry(ZipEntry e, InputStream is) throws Throwable {
+         long N = 0;
+         int n = 0;
+         while ((n = is.read(buf)) >= 0) {
+            N += n;
+         }
+         check(N == e.getSize());
+     }
 
-        if (!userFile && !debug) {
-            check(largeFile.delete());
-            check(testDir.delete());
-        }
-    }
+     static void readLargeZip1() throws Throwable {
+          ZipFile zipFile = new ZipFile(largeFile);
+          ZipEntry entry = null;
+          String entryName = null;
+          int count = 0;
+          System.out.println("ZipFile:");
+          Enumeration<? extends ZipEntry> entries = zipFile.entries();
+          while (entries.hasMoreElements()) {
+               entry = entries.nextElement();
+               entryName = entry.getName();
+               System.out.println("    checking " + entryName);
+               if (!entry.isDirectory()) {
+                    try (InputStream zeis = zipFile.getInputStream(entry)) {
+                        checkEntry(entry, zeis);
+                    }
+               }
+               count++;
+          }
+          System.out.println("Number of entries read: " + count);
+          check(!entry.isDirectory());
+          if (userFile || check(entryName.equals(lastEntryName))) {
+               ByteArrayOutputStream baos = new ByteArrayOutputStream();
+               InputStream is = zipFile.getInputStream(entry);
+               int len;
+               while ((len = is.read(buf)) >= 0) {
+                    baos.write(buf, 0, len);
+               }
+               baos.close();
+               is.close();
+               if (!userFile)
+                   check(Arrays.equals(data, baos.toByteArray()));
+          }
+     }
 
-    static void createLargeZip() throws Throwable {
-        int iterations = DATA_LEN / DATA_SIZE;
-        ByteBuffer bb = ByteBuffer.allocate(DATA_SIZE);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        for (int i = 0; i < iterations; i++) {
-            bb.putDouble(0, Math.random());
-            baos.write(bb.array(), 0, DATA_SIZE);
-        }
-        data = baos.toByteArray();
+     static void readLargeZip2() throws Throwable {
+         System.out.println("ZipInputStream:");
+         try (FileInputStream fis = new FileInputStream(largeFile);
+              BufferedInputStream bis = new BufferedInputStream(fis);
+              ZipInputStream zis = new ZipInputStream(bis))
+         {
+             ZipEntry entry = null;
+             String entryName = null;
+             int count = 0;
+             while ((entry = zis.getNextEntry()) != null) {
+                  entryName = entry.getName();
 
-        try (FileOutputStream fos = new FileOutputStream(largeFile);
-             BufferedOutputStream bos = new BufferedOutputStream(fos);
-             ZipOutputStream zos = new ZipOutputStream(bos))
-        {
-            long length = 0;
-            while (length < fileSize) {
-                ZipEntry ze = new ZipEntry("entry-" + length);
-                lastEntryName = ze.getName();
-                zos.putNextEntry(ze);
-                zos.write(data, 0, data.length);
-                zos.closeEntry();
-                length = largeFile.length();
-            }
-            System.out.println("Last entry written is " + lastEntryName);
-        }
-    }
+                  System.out.println("    checking " + entryName +
+                                     ", method=" + entry.getMethod());
+                  if (entryName.equals(lastEntryName)) {
+                       break;
+                  }
+                  if (!entry.isDirectory()) {
+                       checkEntry(entry, zis);
+                  }
+                  count++;
+             }
+             System.out.println("Number of entries read: " + count);
+             System.out.println("Last entry read is " + entryName);
+             if (!userFile) {
+                  check(!entry.isDirectory());
+                  ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                  byte buf[] = new byte[4096];
+                  int len;
+                  while ((len = zis.read(buf)) >= 0) {
+                       baos.write(buf, 0, len);
+                  }
+                  baos.close();
+                  check(Arrays.equals(data, baos.toByteArray()));
+                  check(zis.getNextEntry() == null);
+             }
+         }
+     }
 
-    static void readLargeZip1() throws Throwable {
-        ZipFile zipFile = new ZipFile(largeFile);
-        ZipEntry entry = null;
-        String entryName = null;
-        int count = 0;
-        Enumeration<? extends ZipEntry> entries = zipFile.entries();
-        while (entries.hasMoreElements()) {
-            entry = entries.nextElement();
-            entryName = entry.getName();
-            count++;
-        }
-        System.out.println("Number of entries read: " + count);
-        System.out.println("Last entry read is " + entryName);
-        check(!entry.isDirectory());
-        if (check(entryName.equals(lastEntryName))) {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            InputStream is = zipFile.getInputStream(entry);
-            byte buf[] = new byte[4096];
-            int len;
-            while ((len = is.read(buf)) >= 0) {
-                baos.write(buf, 0, len);
-            }
-            baos.close();
-            is.close();
-            check(Arrays.equals(data, baos.toByteArray()));
-        }
-    }
+     private static void updateFile(FileSystem fs, Path src) throws IOException {
+          Path dst = fs.getPath(src.toString());
+          Path parent = dst.getParent();
+          if (parent != null && Files.notExists(parent))
+               Files.createDirectories(parent);
+          Files.copy(src, dst, REPLACE_EXISTING);
+     }
+
+     private static FileSystemProvider getZipFSProvider() {
+         for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
+              if ("jar".equalsIgnoreCase(provider.getScheme()))
+                   return provider;
+         }
+         return null;
+     }
+
+     static void updateLargeZip(String pName) throws Throwable {
+         FileSystemProvider provider = getZipFSProvider();
+         if (provider == null) {
+             System.err.println("ZIP filesystem provider is not installed");
+             System.exit(1);
+         }
+         Map<String, Object> env = env = new HashMap<>();
+         try (FileSystem fs = provider.newFileSystem(largeFile.toPath(), env)) {
+             Path path = FileSystems.getDefault().getPath(pName);
+             Files.walkFileTree(
+                 path,
+                 new SimpleFileVisitor<Path>() {
+                     @Override
+                     public FileVisitResult visitFile(Path file,
+                                                      BasicFileAttributes attrs)
+                         throws IOException
+                     {
+                         updateFile(fs, file);
+                         return FileVisitResult.CONTINUE;
+                     }
+             });
+         }
+     }
 
 
-    static void readLargeZip2() throws Throwable {
-        try (FileInputStream fis = new FileInputStream(largeFile);
-             BufferedInputStream bis = new BufferedInputStream(fis);
-             ZipInputStream zis = new ZipInputStream(bis))
-        {
-            ZipEntry entry = null;
-            String entryName = null;
-            int count = 0;
-            while ((entry = zis.getNextEntry()) != null) {
-                entryName = entry.getName();
-                if (entryName.equals(lastEntryName)) {
-                    break;
-                }
-                count++;
-            }
-            System.out.println("Number of entries read: " + count);
-            System.out.println("Last entry read is " + entryName);
-            check(!entry.isDirectory());
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            byte buf[] = new byte[4096];
-            int len;
-            while ((len = zis.read(buf)) >= 0) {
-                baos.write(buf, 0, len);
-            }
-            baos.close();
-            check(Arrays.equals(data, baos.toByteArray()));
-            check(zis.getNextEntry() == null);
-        }
-    }
-
-
-    //--------------------- Infrastructure ---------------------------
-    static volatile int passed = 0, failed = 0;
-    static void pass() {passed++;}
-    static void pass(String msg) {System.out.println(msg); passed++;}
-    static void fail() {failed++; Thread.dumpStack();}
-    static void fail(String msg) {System.out.println(msg); fail();}
-    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
-    static void unexpected(Throwable t, String msg) {
-        System.out.println(msg); failed++; t.printStackTrace();}
-    static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
-    static void equal(Object x, Object y) {
-        if (x == null ? y == null : x.equals(y)) pass();
-        else fail(x + " not equal to " + y);}
-    public static void main(String[] args) throws Throwable {
-        try {realMain(args);} catch (Throwable t) {unexpected(t);}
-        System.out.println("\nPassed = " + passed + " failed = " + failed);
-        if (failed > 0) throw new AssertionError("Some tests failed");}
+     //--------------------- Infrastructure ---------------------------
+     static volatile int passed = 0, failed = 0;
+     static void pass() {passed++;}
+     static void pass(String msg) {System.out.println(msg); passed++;}
+     static void fail() {failed++; Thread.dumpStack();}
+     static void fail(String msg) {System.out.println(msg); fail();}
+     static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+     static void unexpected(Throwable t, String msg) {
+         System.out.println(msg); failed++; t.printStackTrace();}
+     static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
+     static void equal(Object x, Object y) {
+          if (x == null ? y == null : x.equals(y)) pass();
+          else fail(x + " not equal to " + y);}
+     public static void main(String[] args) throws Throwable {
+          try {realMain(args);} catch (Throwable t) {unexpected(t);}
+          System.out.println("\nPassed = " + passed + " failed = " + failed);
+          if (failed > 0) throw new AssertionError("Some tests failed");}
 }
--- a/jdk/test/javax/naming/ldap/LdapName/CompareToEqualsTests.java	Mon Aug 29 12:22:06 2011 -0400
+++ b/jdk/test/javax/naming/ldap/LdapName/CompareToEqualsTests.java	Mon Aug 29 12:23:54 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,14 @@
 
 /*
  * @test
- * @bug 4635618
+ * @bug 4635618 7059542
  * @summary Support for manipulating LDAP Names
+ *          JNDI name operations should be locale independent
  */
 
 import javax.naming.ldap.*;
 import java.util.ArrayList;
+import java.util.Locale;
 import java.util.List;
 import javax.naming.InvalidNameException;
 
@@ -39,52 +41,61 @@
 
     public static void main(String args[])
                 throws Exception {
-
-        /**
-         * Test cases:
-         * 1) Same RDNs.
-         * 2) same RDN sequence with an AVA ordered differently.
-         * 3) RDN sequences of a differing AVA.
-         * 4) RDN sequence of different length.
-         * 5) RDN sequence of different Case.
-         * 6) Matching binary return values.
-         * 7) Binary values that don't match.
-         */
-        String names1[] = new String [] {
+         Locale reservedLocale = Locale.getDefault();
+         try {
+            /**
+             * Test cases:
+             * 1) Same RDNs.
+             * 2) same RDN sequence with an AVA ordered differently.
+             * 3) RDN sequences of a differing AVA.
+             * 4) RDN sequence of different length.
+             * 5) RDN sequence of different Case.
+             * 6) Matching binary return values.
+             * 7) Binary values that don't match.
+             */
+            String names1[] = new String [] {
                 "ou=Sales+cn=Bob", "ou=Sales+cn=Bob", "ou=Sales+cn=Bob",
                 "ou=Sales+cn=Scott+c=US", "cn=config"};
 
-        String names2[] = new String [] {
+            String names2[] = new String [] {
                 "ou=Sales+cn=Bob", "cn=Bob+ou=Sales", "ou=Sales+cn=Scott",
                 "ou=Sales+cn=Scott", "Cn=COnFIG"};
 
-        int expectedResults[] = {0, 0, -1, -1, 0};
-
+            int expectedResults[] = {0, 0, -1, -1, 0};
 
-        for (int i = 0; i < names1.length; i++) {
-            checkResults(new LdapName(names1[i]),
+            for (Locale locale : Locale.getAvailableLocales()) {
+                // reset the default locale
+                Locale.setDefault(locale);
+
+                for (int i = 0; i < names1.length; i++) {
+                    checkResults(new LdapName(names1[i]),
                         new LdapName(names2[i]), expectedResults[i]);
-        }
+                }
 
-        byte[] value = "abcxyz".getBytes();
-        Rdn rdn1 = new Rdn("binary", value);
-        ArrayList rdns1 = new ArrayList();
-        rdns1.add(rdn1);
-        LdapName l1 = new LdapName(rdns1);
+                byte[] value = "abcxyz".getBytes();
+                Rdn rdn1 = new Rdn("binary", value);
+                ArrayList rdns1 = new ArrayList();
+                rdns1.add(rdn1);
+                LdapName l1 = new LdapName(rdns1);
 
-        Rdn rdn2 = new Rdn("binary", value);
-        ArrayList rdns2 = new ArrayList();
-        rdns2.add(rdn2);
-        LdapName l2 = new LdapName(rdns2);
-        checkResults(l1, l2, 0);
+                Rdn rdn2 = new Rdn("binary", value);
+                ArrayList rdns2 = new ArrayList();
+                rdns2.add(rdn2);
+                LdapName l2 = new LdapName(rdns2);
+                checkResults(l1, l2, 0);
+
+                l2 = new LdapName("binary=#61626378797A");
+                checkResults(l1, l2, 0);
 
-        l2 = new LdapName("binary=#61626378797A");
-        checkResults(l1, l2, 0);
+                l2 = new LdapName("binary=#61626378797B");
+                checkResults(l1, l2, -1);
 
-        l2 = new LdapName("binary=#61626378797B");
-        checkResults(l1, l2, -1);
-
-        System.out.println("Tests passed");
+                System.out.println("Tests passed");
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }