changeset 4517:9bd06beac455

Merge
author sherman
date Fri, 26 Aug 2011 15:40:32 -0700
parents 973d923af88c 6d2f09eed4e3
children e4729ad0d7b5
files
diffstat 53 files changed, 1286 insertions(+), 252 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/security/ntlm/Client.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/security/ntlm/Client.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/com/sun/security/ntlm/NTLMException.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/security/ntlm/NTLMException.java	Fri Aug 26 15:40:32 2011 -0700
@@ -65,6 +65,11 @@
      */
     public final static int BAD_VERSION = 5;
 
+    /**
+     * Protocol errors.
+     */
+    public final static int PROTOCOL = 6;
+
     private int errorCode;
 
     /**
--- a/src/share/classes/com/sun/security/ntlm/Server.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/security/ntlm/Server.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/com/sun/servicetag/SunConnection.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/com/sun/servicetag/SunConnection.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/io/BufferedReader.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/io/BufferedReader.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/io/BufferedWriter.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/io/BufferedWriter.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/io/Closeable.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/io/Closeable.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/io/FilterOutputStream.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/io/FilterOutputStream.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/lang/AutoCloseable.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/lang/AutoCloseable.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/lang/InternalError.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/lang/InternalError.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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 s) {
-        super(s);
+    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 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/src/share/classes/java/lang/System.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/lang/System.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/lang/VirtualMachineError.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/lang/VirtualMachineError.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/net/HttpCookie.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/net/HttpCookie.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/util/Observable.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/util/Observable.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/java/util/prefs/Preferences.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/java/util/prefs/Preferences.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/javax/swing/RepaintManager.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/javax/swing/RepaintManager.java	Fri Aug 26 15:40:32 2011 -0700
@@ -758,6 +758,11 @@
             for(i=0 ; i < count ; i++) {
                 dirtyComponent = roots.get(i);
                 rect = tmpDirtyComponents.get(dirtyComponent);
+                // Sometimes when RepaintManager is changed during the painting
+                // we may get null here, see #6995769 for details
+                if (rect == null) {
+                    continue;
+                }
                 localBoundsH = dirtyComponent.getHeight();
                 localBoundsW = dirtyComponent.getWidth();
 
--- a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Aug 26 15:40:32 2011 -0700
@@ -2167,7 +2167,7 @@
     /**
      * Returns a {@code LayoutStyle} implementing the Java look and feel
      * design guidelines as specified at
-     * <a href="http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html">http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html</a>.
+     * <a href="http://www.oracle.com/technetwork/java/hig-136467.html">http://www.oracle.com/technetwork/java/hig-136467.html</a>.
      *
      * @return LayoutStyle implementing the Java look and feel design
      *         guidelines
--- a/src/share/classes/sun/font/FontManagerFactory.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/font/FontManagerFactory.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/management/ManagementFactoryHelper.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/management/ManagementFactoryHelper.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/misc/URLClassPath.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/misc/URLClassPath.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/reflect/MethodAccessorGenerator.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/reflect/MethodAccessorGenerator.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/reflect/generics/parser/SignatureParser.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/reflect/generics/parser/SignatureParser.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/security/pkcs11/Session.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/security/pkcs11/Session.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/security/pkcs11/Token.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/security/pkcs11/Token.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/security/x509/X500Name.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/security/x509/X500Name.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/share/classes/sun/swing/DefaultLayoutStyle.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/swing/DefaultLayoutStyle.java	Fri Aug 26 15:40:32 2011 -0700
@@ -48,10 +48,12 @@
     @Override
     public int getPreferredGap(JComponent component1, JComponent component2,
             ComponentPlacement type, int position, Container parent) {
-
         if (component1 == null || component2 == null || type == null) {
             throw new NullPointerException();
         }
+
+        checkPosition(position);
+
         if (type == ComponentPlacement.INDENT &&
                 (position == SwingConstants.EAST ||
                  position == SwingConstants.WEST)) {
--- a/src/share/classes/sun/tools/jconsole/ProxyClient.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/share/classes/sun/tools/jconsole/ProxyClient.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/solaris/classes/sun/nio/ch/InheritedChannel.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/solaris/classes/sun/nio/ch/InheritedChannel.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/solaris/lib/content-types.properties	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/solaris/lib/content-types.properties	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/src/windows/lib/content-types.properties	Fri Aug 26 15:36:21 2011 -0700
+++ b/src/windows/lib/content-types.properties	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/ProblemList.txt	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/ProblemList.txt	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/com/sun/security/sasl/ntlm/Conformance.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Fri Aug 26 15:40:32 2011 -0700
@@ -0,0 +1,129 @@
+/*
+ * 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 sun.awt.SunToolkit;
+
+import java.awt.Button;
+import java.awt.CardLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+
+/**
+ * @test
+ * @bug 6263470
+ * @summary Tries to change font of MenuBar. Test passes if the font has changed
+ * fails otherwise.
+ * @author Vyacheslav.Baranov: area=menu
+ * @run main MenuBarSetFont
+ */
+public final class MenuBarSetFont {
+
+    private static final Frame frame = new Frame();
+    private static final MenuBar mb = new MenuBar();
+    private static volatile boolean clicked;
+
+    private static final class Listener implements ActionListener {
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            //Click on this button is performed
+            //_only_ if font of MenuBar is not changed on time
+            MenuBarSetFont.clicked = true;
+        }
+    }
+
+    private static void addMenu() {
+        mb.add(new Menu("w"));
+        frame.validate();
+    }
+
+    public static void main(final String[] args) throws Exception {
+        //Components initialization.
+        frame.setMenuBar(mb);
+        mb.setFont(new Font("Helvetica", Font.ITALIC, 5));
+
+        final Button button = new Button("Click Me");
+        button.addActionListener(new Listener());
+        frame.setLayout(new CardLayout());
+        frame.add(button, "First");
+        frame.setSize(400, 400);
+        frame.setVisible(true);
+        sleep();
+
+        final int fInsets = frame.getInsets().top;  //Frame insets without menu.
+        addMenu();
+        final int fMenuInsets = frame.getInsets().top; //Frame insets with menu.
+        final int menuBarHeight = fMenuInsets - fInsets;
+        // There is no way to change menubar height on windows. But on windows
+        // we can try to split menubar in 2 rows.
+        for (int i = 0; i < 100 && fMenuInsets == frame.getInsets().top; ++i) {
+            // Fill whole menubar.
+            addMenu();
+        }
+
+        mb.remove(0);
+        frame.validate();
+        sleep();
+
+        // Test execution.
+        // On XToolkit, menubar font should be changed to 60.
+        // On WToolkit, menubar font should be changed to default and menubar
+        // should be splitted in 2 rows.
+        mb.setFont(new Font("Helvetica", Font.ITALIC, 60));
+        sleep();
+
+        final Robot r = new Robot();
+        r.setAutoDelay(200);
+        final Point pt = frame.getLocation();
+        r.mouseMove(pt.x + frame.getWidth() / 2,
+                    pt.y + fMenuInsets + menuBarHeight / 2);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        sleep();
+        frame.dispose();
+
+        if (clicked) {
+            fail("Font was not changed");
+        }
+    }
+
+    private static void sleep() {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(500L);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    private static void fail(final String message) {
+        throw new RuntimeException(message);
+    }
+}
--- a/test/java/io/IOException/LastErrorString.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/java/io/IOException/LastErrorString.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/io/etc/FailingFlushAndClose.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/lang/ProcessBuilder/Basic.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/java/lang/ProcessBuilder/Basic.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/lang/management/ManagementFactory/GetObjectName.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/lang/reflect/Generics/Probe.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/java/lang/reflect/Generics/Probe.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/lang/reflect/Generics/SignatureTest.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/lang/reflect/Generics/TestBadSignatures.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/net/CookieHandler/TestHttpCookie.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/java/net/CookieHandler/TestHttpCookie.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java	Fri Aug 26 15:36:21 2011 -0700
+++ b/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/GroupLayout/7071166/bug7071166.java	Fri Aug 26 15:40:32 2011 -0700
@@ -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 7071166
+ * @summary LayoutStyle.getPreferredGap() - IAE is expected but not thrown
+ * @author Pavel Porvatov
+ */
+
+import javax.swing.*;
+import static javax.swing.SwingConstants.*;
+import java.awt.*;
+
+public class bug7071166 {
+    private static final int[] POSITIONS = {NORTH, EAST, SOUTH, WEST, // valid positions
+            NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST, 123, -456}; // invalid positions
+
+    public static void main(String[] args) throws Exception {
+        for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
+            UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
+
+            System.out.println("LookAndFeel: " + lookAndFeelInfo.getName());
+
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    LayoutStyle layoutStyle = LayoutStyle.getInstance();
+
+                    System.out.println("LayoutStyle: " + layoutStyle);
+
+                    for (int i = 0; i < POSITIONS.length; i++) {
+                        int position = POSITIONS[i];
+
+                        try {
+                            layoutStyle.getPreferredGap(new JButton(), new JButton(),
+                                    LayoutStyle.ComponentPlacement.RELATED, position, new Container());
+
+                            if (i > 3) {
+                                throw new RuntimeException("IllegalArgumentException is not thrown for position " +
+                                        position);
+                            }
+                        } catch (IllegalArgumentException e) {
+                            if (i <= 3) {
+                                throw new RuntimeException("IllegalArgumentException is thrown for position " +
+                                        position);
+                            }
+                        }
+                    }
+                }
+            });
+
+            System.out.println("passed");
+        }
+    }
+}