changeset 5862:1fc4a8d78ef7

Merge
author lana
date Wed, 03 Apr 2013 12:49:46 -0700
parents eb4807b899c8 885ad3351534
children bb8764ec11c2
files
diffstat 38 files changed, 1036 insertions(+), 161 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/Defs.gmk	Wed Mar 27 16:18:43 2013 -0700
+++ b/make/common/Defs.gmk	Wed Apr 03 12:49:46 2013 -0700
@@ -312,6 +312,7 @@
 
 JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-image
 JRE_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-image
+JDK_SERVER_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-server-image
 
 #where the demo source can be found
 DEMOSRCDIR          = $(SHARE_SRC)/demo
--- a/make/common/Release-macosx.gmk	Wed Mar 27 16:18:43 2013 -0700
+++ b/make/common/Release-macosx.gmk	Wed Apr 03 12:49:46 2013 -0700
@@ -31,6 +31,8 @@
 
 JDK_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
 JRE_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_SERVER_BUNDLE_DIR = $(ABS_OUTPUTDIR)/j2sdk-server-bundle/jdk$(JDK_VERSION).jdk/Contents
+JDK_SERVER_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-server-image
 
 MACOSX_SRC	 = $(JDK_TOPDIR)/src/macosx
 
@@ -70,6 +72,13 @@
 	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" < $(MACOSX_SRC)/bundle/JDK-Info.plist > $(JDK_BUNDLE_DIR)/Info.plist
 	/usr/bin/SetFile -a B $(JDK_BUNDLE_DIR)/../
 
-EXTRA_IMAGE_TARGETS += jre-bundle-setup jdk-bundle-setup jre-bundle-files jdk-bundle-files
+jdk-server-bundle-files:
+	$(MKDIR) -p $(JDK_SERVER_BUNDLE_DIR)/MacOS
+	ln -s ../Home/jre/lib/jli/libjli.dylib $(JDK_SERVER_BUNDLE_DIR)/MacOS/
+	$(CP) -r $(JDK_IMAGE_DIR) $(JDK_SERVER_BUNDLE_DIR)/Home
+	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" -e "s/@@NAME@@/$(BUNDE_NAME_JDK)/g" -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" < $(MACOSX_SRC)/bundle/JDK-Info.plist > $(JDK_SERVER_BUNDLE_DIR)/Info.plist
+	/usr/bin/SetFile -a B $(JDK_SERVER_BUNDLE_DIR)/../
+
+EXTRA_IMAGE_TARGETS += jre-bundle-setup jdk-bundle-setup jre-bundle-files jdk-bundle-files jdk-server-bundle-files
 
 .PHONY: $(EXTRA_JRE_TARGETS) $(EXTRA_IMAGE_TARGETS)
--- a/make/common/Release.gmk	Wed Mar 27 16:18:43 2013 -0700
+++ b/make/common/Release.gmk	Wed Apr 03 12:49:46 2013 -0700
@@ -245,7 +245,7 @@
 identify-image-jre identify-image-jdk \
 process-image-jre process-image-jdk \
 compare-image \
-sec-files sec-files-win jgss-files ::
+sec-files sec-files-win jgss-files server-jdk-image ::
 	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
 
 # Order is important here, trim jre after jdk image is created
@@ -254,16 +254,17 @@
 images:: sanity-images post-sanity-images  \
 	 $(INITIAL_IMAGE_JRE) $(EXTRA_JRE_TARGETS) $(INITIAL_IMAGE_JDK) \
 	 trim-image-jre trim-image-jdk \
-     identify-image-jre identify-image-jdk \
-	 process-image-jre process-image-jdk sec-files sec-files-win jgss-files \
-	 $(EXTRA_IMAGE_TARGETS)
+	identify-image-jre identify-image-jdk \
+	 process-image-jre process-image-jdk sec-files sec-files-win \
+	 jgss-files $(EXTRA_IMAGE_TARGETS) server-jdk-image
 else
 
 images:: sanity-images post-sanity-images  \
 	 $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
 	 trim-image-jre trim-image-jdk \
          identify-image-jre identify-image-jdk \
-	 process-image-jre process-image-jdk sec-files sec-files-win jgss-files 
+	 process-image-jre process-image-jdk sec-files sec-files-win \
+	 jgss-files server-jdk-image
 endif
 
 # Don't use these
@@ -939,6 +940,27 @@
 	done
 	$(RM) $(JRE_BIN_LIST)
 
+# Duplicate current j2re-image contents to server-j2re-image
+# for the server version of jre, before deploy build
+server-jdk-image::
+ifeq ($(PLATFORM), macosx)
+	$(RM) -r $(JDK_SERVER_BUNDLE_DIR)/Home/demo
+	$(RM) -r $(JDK_SERVER_BUNDLE_DIR)/Home/sample
+	$(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/bin/jcontrol
+	$(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/jre/bin/jcontrol
+	$(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/man/ja_JP.UTF-8/man1/javaws.1
+	$(RM) $(JDK_SERVER_BUNDLE_DIR)/Home/man/man1/javaws.1
+else
+	$(RM) -r $(JDK_SERVER_IMAGE_DIR)
+	$(CP) -r $(JDK_IMAGE_DIR) $(JDK_SERVER_IMAGE_DIR)
+	$(RM) -r $(JDK_SERVER_IMAGE_DIR)/demo
+	$(RM) -r $(JDK_SERVER_IMAGE_DIR)/sample
+	$(RM) $(JDK_SERVER_IMAGE_DIR)/bin/jcontrol
+	$(RM) $(JDK_SERVER_IMAGE_DIR)/jre/bin/jcontrol
+	$(RM) $(JDK_SERVER_IMAGE_DIR)/man/ja_JP.UTF-8/man1/javaws.1
+	$(RM) $(JDK_SERVER_IMAGE_DIR)/man/man1/javaws.1
+endif
+
 ######################################################
 # JDK Image
 ######################################################
--- a/src/macosx/classes/java/util/prefs/MacOSXPreferences.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/macosx/classes/java/util/prefs/MacOSXPreferences.java	Wed Apr 03 12:49:46 2013 -0700
@@ -25,6 +25,8 @@
 
 package java.util.prefs;
 
+import java.util.Objects;
+
 class MacOSXPreferences extends AbstractPreferences {
     // fixme need security checks?
 
@@ -151,6 +153,7 @@
     // AbstractPreferences implementation
     protected void removeSpi(String key)
     {
+        Objects.requireNonNull(key, "Specified key cannot be null");
         file.removeKeyFromNode(path, key);
     }
 
--- a/src/share/classes/java/beans/PropertyDescriptor.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/java/beans/PropertyDescriptor.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -109,10 +109,6 @@
         if (writeMethodName != null && getWriteMethod() == null) {
             throw new IntrospectionException("Method not found: " + writeMethodName);
         }
-        boundInitialization(beanClass);
-    }
-
-    private void boundInitialization(Class<?> beanClass) {
         // If this class or one of its base classes allow PropertyChangeListener,
         // then we assume that any properties we discover are "bound".
         // See Introspector.getTargetPropertyInfo() method.
@@ -163,7 +159,6 @@
         setReadMethod(read);
         setWriteMethod(write);
         this.baseName = base;
-        boundInitialization(bean);
     }
 
     /**
--- a/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Wed Apr 03 12:49:46 2013 -0700
@@ -57,6 +57,7 @@
      */
     @Override
     protected void installDefaults() {
+        super.installDefaults();
         trackHighlight = NO_HIGHLIGHT;
         if (scrollbar.getLayout() == null ||
                      (scrollbar.getLayout() instanceof UIResource)) {
--- a/src/share/classes/sun/net/www/http/HttpClient.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/sun/net/www/http/HttpClient.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, 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
@@ -46,7 +46,7 @@
     // whether this httpclient comes from the cache
     protected boolean cachedHttpClient = false;
 
-    private boolean inCache;
+    protected boolean inCache;
 
     // Http requests we send
     MessageHeader requests;
@@ -121,7 +121,14 @@
     public boolean reuse = false;
 
     // Traffic capture tool, if configured. See HttpCapture class for info
-     private HttpCapture capture = null;
+    private HttpCapture capture = null;
+
+    private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
+    private static void logFinest(String msg) {
+        if (logger.isLoggable(PlatformLogger.FINEST)) {
+            logger.finest(msg);
+        }
+    }
 
     /**
      * A NOP method kept for backwards binary compatibility
@@ -266,8 +273,11 @@
             if (ret != null && httpuc != null &&
                 httpuc.streaming() &&
                 httpuc.getRequestMethod() == "POST") {
-                if (!ret.available())
+                if (!ret.available()) {
+                    ret.inCache = false;
+                    ret.closeServer();
                     ret = null;
+                }
             }
 
             if (ret != null) {
@@ -279,10 +289,7 @@
                         ret.inCache = false;
                         if (httpuc != null && ret.needsTunneling())
                             httpuc.setTunnelState(TUNNELING);
-                        PlatformLogger logger = HttpURLConnection.getHttpLogger();
-                        if (logger.isLoggable(PlatformLogger.FINEST)) {
-                            logger.finest("KeepAlive stream retrieved from the cache, " + ret);
-                        }
+                        logFinest("KeepAlive stream retrieved from the cache, " + ret);
                     }
                 } else {
                     // We cannot return this connection to the cache as it's
@@ -360,30 +367,33 @@
         }
     }
 
-    protected synchronized boolean available() throws IOException {
+    protected synchronized boolean available() {
         boolean available = true;
-        int old = serverSocket.getSoTimeout();
-        serverSocket.setSoTimeout(1);
-        BufferedInputStream tmpbuf =
-            new BufferedInputStream(serverSocket.getInputStream());
+        int old = -1;
 
-        PlatformLogger logger = HttpURLConnection.getHttpLogger();
         try {
-            int r = tmpbuf.read();
-            if (r == -1) {
-                if (logger.isLoggable(PlatformLogger.FINEST)) {
-                    logger.finest("HttpClient.available(): " +
-                        "read returned -1: not available");
+            try {
+                old = serverSocket.getSoTimeout();
+                serverSocket.setSoTimeout(1);
+                BufferedInputStream tmpbuf =
+                        new BufferedInputStream(serverSocket.getInputStream());
+                int r = tmpbuf.read();
+                if (r == -1) {
+                    logFinest("HttpClient.available(): " +
+                            "read returned -1: not available");
+                    available = false;
                 }
-                available = false;
+            } catch (SocketTimeoutException e) {
+                logFinest("HttpClient.available(): " +
+                        "SocketTimeout: its available");
+            } finally {
+                if (old != -1)
+                    serverSocket.setSoTimeout(old);
             }
-        } catch (SocketTimeoutException e) {
-            if (logger.isLoggable(PlatformLogger.FINEST)) {
-                logger.finest("HttpClient.available(): " +
-                    "SocketTimeout: its available");
-            }
-        } finally {
-            serverSocket.setSoTimeout(old);
+        } catch (IOException e) {
+            logFinest("HttpClient.available(): " +
+                        "SocketException: not available");
+            available = false;
         }
         return available;
     }
@@ -865,10 +875,7 @@
 
             if (isKeepingAlive())   {
                 // Wrap KeepAliveStream if keep alive is enabled.
-                PlatformLogger logger = HttpURLConnection.getHttpLogger();
-                if (logger.isLoggable(PlatformLogger.FINEST)) {
-                    logger.finest("KeepAlive stream used: " + url);
-                }
+                logFinest("KeepAlive stream used: " + url);
                 serverInput = new KeepAliveStream(serverInput, pi, cl, this);
                 failedOnce = false;
             }
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, 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
@@ -2632,7 +2632,7 @@
                 multipleCookies = true;
             }
 
-            return retValue.length() == 0 ? null : retValue.toString();
+            return retValue.length() == 0 ? "" : retValue.toString();
         }
 
         return value;
--- a/src/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java	Wed Apr 03 12:49:46 2013 -0700
@@ -96,7 +96,7 @@
         http = HttpsClient.New (getSSLSocketFactory(),
                                 url,
                                 getHostnameVerifier(),
-                                useCache);
+                                useCache, this);
         ((HttpsClient)http).afterConnect();
     }
 
@@ -149,7 +149,7 @@
         http = HttpsClient.New (getSSLSocketFactory(),
                                 url,
                                 getHostnameVerifier(),
-                                proxyHost, proxyPort, useCache);
+                                proxyHost, proxyPort, useCache, this);
         connected = true;
     }
 
@@ -189,7 +189,8 @@
     protected HttpClient getNewHttpClient(URL url, Proxy p, int connectTimeout)
         throws IOException {
         return HttpsClient.New(getSSLSocketFactory(), url,
-                               getHostnameVerifier(), p, true, connectTimeout);
+                               getHostnameVerifier(), p, true, connectTimeout,
+                               this);
     }
 
     // will open new connection
@@ -198,7 +199,7 @@
         throws IOException {
         return HttpsClient.New(getSSLSocketFactory(), url,
                                getHostnameVerifier(), p,
-                               useCache, connectTimeout);
+                               useCache, connectTimeout, this);
     }
 
     /**
--- a/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Wed Apr 03 12:49:46 2013 -0700
@@ -30,6 +30,7 @@
 import java.io.UnsupportedEncodingException;
 import java.io.PrintStream;
 import java.io.BufferedOutputStream;
+import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
 import java.net.URL;
@@ -46,11 +47,15 @@
 
 import javax.net.ssl.*;
 import sun.net.www.http.HttpClient;
+import sun.net.www.protocol.http.HttpURLConnection;
 import sun.security.action.*;
 
 import sun.security.util.HostnameChecker;
 import sun.security.ssl.SSLSocketImpl;
 
+import sun.util.logging.PlatformLogger;
+import static sun.net.www.protocol.http.HttpURLConnection.TunnelState.*;
+
 
 /**
  * This class provides HTTPS client URL support, building on the standard
@@ -274,15 +279,17 @@
     // This code largely ripped off from HttpClient.New, and
     // it uses the same keepalive cache.
 
-    static HttpClient New(SSLSocketFactory sf, URL url, HostnameVerifier hv)
+    static HttpClient New(SSLSocketFactory sf, URL url, HostnameVerifier hv,
+                          HttpURLConnection httpuc)
             throws IOException {
-        return HttpsClient.New(sf, url, hv, true);
+        return HttpsClient.New(sf, url, hv, true, httpuc);
     }
 
     /** See HttpClient for the model for this method. */
     static HttpClient New(SSLSocketFactory sf, URL url,
-            HostnameVerifier hv, boolean useCache) throws IOException {
-        return HttpsClient.New(sf, url, hv, (String)null, -1, useCache);
+            HostnameVerifier hv, boolean useCache,
+            HttpURLConnection httpuc) throws IOException {
+        return HttpsClient.New(sf, url, hv, (String)null, -1, useCache, httpuc);
     }
 
     /**
@@ -290,37 +297,74 @@
      * the specified proxy server.
      */
     static HttpClient New(SSLSocketFactory sf, URL url, HostnameVerifier hv,
-                           String proxyHost, int proxyPort) throws IOException {
-        return HttpsClient.New(sf, url, hv, proxyHost, proxyPort, true);
+                           String proxyHost, int proxyPort,
+                           HttpURLConnection httpuc) throws IOException {
+        return HttpsClient.New(sf, url, hv, proxyHost, proxyPort, true, httpuc);
     }
 
     static HttpClient New(SSLSocketFactory sf, URL url, HostnameVerifier hv,
-                           String proxyHost, int proxyPort, boolean useCache)
+                           String proxyHost, int proxyPort, boolean useCache,
+                           HttpURLConnection httpuc)
         throws IOException {
-        return HttpsClient.New(sf, url, hv, proxyHost, proxyPort, useCache, -1);
+        return HttpsClient.New(sf, url, hv, proxyHost, proxyPort, useCache, -1,
+                               httpuc);
     }
 
     static HttpClient New(SSLSocketFactory sf, URL url, HostnameVerifier hv,
                           String proxyHost, int proxyPort, boolean useCache,
-                          int connectTimeout)
+                          int connectTimeout, HttpURLConnection httpuc)
         throws IOException {
 
         return HttpsClient.New(sf, url, hv,
                                (proxyHost == null? null :
                                 HttpsClient.newHttpProxy(proxyHost, proxyPort)),
-                               useCache, connectTimeout);
+                               useCache, connectTimeout, httpuc);
     }
 
     static HttpClient New(SSLSocketFactory sf, URL url, HostnameVerifier hv,
                           Proxy p, boolean useCache,
-                          int connectTimeout)
-        throws IOException {
+                          int connectTimeout, HttpURLConnection httpuc)
+        throws IOException
+    {
+        if (p == null) {
+            p = Proxy.NO_PROXY;
+        }
         HttpsClient ret = null;
         if (useCache) {
             /* see if one's already around */
             ret = (HttpsClient) kac.get(url, sf);
+            if (ret != null && httpuc != null &&
+                httpuc.streaming() &&
+                httpuc.getRequestMethod() == "POST") {
+                if (!ret.available())
+                    ret = null;
+            }
+
             if (ret != null) {
-                ret.cachedHttpClient = true;
+                if ((ret.proxy != null && ret.proxy.equals(p)) ||
+                    (ret.proxy == null && p == null)) {
+                    synchronized (ret) {
+                        ret.cachedHttpClient = true;
+                        assert ret.inCache;
+                        ret.inCache = false;
+                        if (httpuc != null && ret.needsTunneling())
+                            httpuc.setTunnelState(TUNNELING);
+                        PlatformLogger logger = HttpURLConnection.getHttpLogger();
+                        if (logger.isLoggable(PlatformLogger.FINEST)) {
+                            logger.finest("KeepAlive stream retrieved from the cache, " + ret);
+                        }
+                    }
+                } else {
+                    // We cannot return this connection to the cache as it's
+                    // KeepAliveTimeout will get reset. We simply close the connection.
+                    // This should be fine as it is very rare that a connection
+                    // to the same host will not use the same proxy.
+                    synchronized(ret) {
+                        ret.inCache = false;
+                        ret.closeServer();
+                    }
+                    ret = null;
+                }
             }
         }
         if (ret == null) {
@@ -328,7 +372,11 @@
         } else {
             SecurityManager security = System.getSecurityManager();
             if (security != null) {
-                security.checkConnect(url.getHost(), url.getPort());
+                if (ret.proxy == Proxy.NO_PROXY || ret.proxy == null) {
+                    security.checkConnect(InetAddress.getByName(url.getHost()).getHostAddress(), url.getPort());
+                } else {
+                    security.checkConnect(url.getHost(), url.getPort());
+                }
             }
             ret.url = url;
         }
@@ -607,6 +655,11 @@
 
     @Override
     protected void putInKeepAliveCache() {
+        if (inCache) {
+            assert false : "Duplicate put to keep alive cache";
+            return;
+        }
+        inCache = true;
         kac.put(url, sslSocketFactory, this);
     }
 
--- a/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java	Wed Apr 03 12:49:46 2013 -0700
@@ -51,7 +51,7 @@
 
     /* the Jar file factory. It handles both retrieval and caching.
      */
-    private static JarFileFactory factory = new JarFileFactory();
+    private static final JarFileFactory factory = JarFileFactory.getInstance();
 
     /* the url for the Jar file */
     private URL jarFileURL;
--- a/src/share/native/java/util/zip/zip_util.h	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/share/native/java/util/zip/zip_util.h	Wed Apr 03 12:49:46 2013 -0700
@@ -177,8 +177,8 @@
  */
 typedef struct jzcell {
     unsigned int hash;    /* 32 bit hashcode on name */
+    unsigned int next;    /* hash chain: index into jzfile->entries */
     jlong cenpos;         /* Offset of central directory file header */
-    unsigned int next;    /* hash chain: index into jzfile->entries */
 } jzcell;
 
 typedef struct cencache {
--- a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Wed Apr 03 12:49:46 2013 -0700
@@ -76,9 +76,12 @@
             accessor.setFiles(fd, null);
         } else {
             // Fix 6987233: add the trailing slash if it's absent
-            accessor.setDirectory(fd, directory +
-                    (directory.endsWith(File.separator) ?
-                     "" : File.separator));
+            String with_separator = directory;
+            if (directory != null) {
+                with_separator = directory.endsWith(File.separator) ?
+                        directory : (directory + File.separator);
+            }
+            accessor.setDirectory(fd, with_separator);
             accessor.setFile(fd, filenames[0]);
 
             int filesNumber = (filenames != null) ? filenames.length : 0;
--- a/src/solaris/classes/sun/net/www/protocol/jar/JarFileFactory.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/solaris/classes/sun/net/www/protocol/jar/JarFileFactory.java	Wed Apr 03 12:49:46 2013 -0700
@@ -43,13 +43,24 @@
 class JarFileFactory implements URLJarFile.URLJarFileCloseController {
 
     /* the url to file cache */
-    private static HashMap<String, JarFile> fileCache = new HashMap<String, JarFile>();
+    private static final HashMap<String, JarFile> fileCache = new HashMap<>();
 
     /* the file to url cache */
-    private static HashMap<JarFile, URL> urlCache = new HashMap<JarFile, URL>();
+    private static final HashMap<JarFile, URL> urlCache = new HashMap<>();
+
+    private static final JarFileFactory instance = new JarFileFactory();
+
+    private JarFileFactory() { }
+
+    public static JarFileFactory getInstance() {
+        return instance;
+    }
 
     URLConnection getConnection(JarFile jarFile) throws IOException {
-        URL u = urlCache.get(jarFile);
+        URL u;
+        synchronized (instance) {
+            u = urlCache.get(jarFile);
+        }
         if (u != null)
             return u.openConnection();
 
@@ -62,16 +73,16 @@
 
     JarFile get(URL url, boolean useCaches) throws IOException {
 
-        JarFile result = null;
-        JarFile local_result = null;
+        JarFile result;
+        JarFile local_result;
 
         if (useCaches) {
-            synchronized (this) {
+            synchronized (instance) {
                 result = getCachedJarFile(url);
             }
             if (result == null) {
                 local_result = URLJarFile.getJarFile(url, this);
-                synchronized (this) {
+                synchronized (instance) {
                     result = getCachedJarFile(url);
                     if (result == null) {
                         fileCache.put(URLUtil.urlNoFragString(url), local_result);
@@ -99,14 +110,15 @@
      * remove the JarFile from the cache
      */
     public void close(JarFile jarFile) {
-        URL urlRemoved = urlCache.remove(jarFile);
-        if( urlRemoved != null) {
+        synchronized (instance) {
+            URL urlRemoved = urlCache.remove(jarFile);
+            if (urlRemoved != null)
                 fileCache.remove(URLUtil.urlNoFragString(urlRemoved));
         }
     }
 
-
     private JarFile getCachedJarFile(URL url) {
+        assert Thread.holdsLock(instance);
         JarFile result = fileCache.get(URLUtil.urlNoFragString(url));
 
         /* if the JAR file is cached, the permission will always be there */
--- a/src/windows/classes/sun/awt/windows/WDesktopPeer.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/windows/classes/sun/awt/windows/WDesktopPeer.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -51,15 +51,15 @@
     }
 
     public void open(File file) throws IOException {
-        this.ShellExecute(file.toURI(), ACTION_OPEN_VERB);
+        this.ShellExecute(file, ACTION_OPEN_VERB);
     }
 
     public void edit(File file) throws IOException {
-        this.ShellExecute(file.toURI(), ACTION_EDIT_VERB);
+        this.ShellExecute(file, ACTION_EDIT_VERB);
     }
 
     public void print(File file) throws IOException {
-        this.ShellExecute(file.toURI(), ACTION_PRINT_VERB);
+        this.ShellExecute(file, ACTION_PRINT_VERB);
     }
 
     public void mail(URI uri) throws IOException {
@@ -70,6 +70,13 @@
         this.ShellExecute(uri, ACTION_OPEN_VERB);
     }
 
+    private void ShellExecute(File file, String verb) throws IOException {
+        String errMsg = ShellExecute(file.getAbsolutePath(), verb);
+        if (errMsg != null) {
+            throw new IOException("Failed to " + verb + " " + file + ". Error message: " + errMsg);
+        }
+    }
+
     private void ShellExecute(URI uri, String verb) throws IOException {
         String errmsg = ShellExecute(uri.toString(), verb);
 
@@ -79,6 +86,6 @@
         }
     }
 
-    private static native String ShellExecute(String uri, String verb);
+    private static native String ShellExecute(String fileOrUri, String verb);
 
 }
--- a/src/windows/classes/sun/net/www/protocol/jar/JarFileFactory.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/windows/classes/sun/net/www/protocol/jar/JarFileFactory.java	Wed Apr 03 12:49:46 2013 -0700
@@ -43,13 +43,24 @@
 class JarFileFactory implements URLJarFile.URLJarFileCloseController {
 
     /* the url to file cache */
-    private static HashMap<String, JarFile> fileCache = new HashMap<String, JarFile>();
+    private static final HashMap<String, JarFile> fileCache = new HashMap<>();
 
     /* the file to url cache */
-    private static HashMap<JarFile, URL> urlCache = new HashMap<JarFile, URL>();
+    private static final HashMap<JarFile, URL> urlCache = new HashMap<>();
+
+    private static final JarFileFactory instance = new JarFileFactory();
+
+    private JarFileFactory() { }
+
+    public static JarFileFactory getInstance() {
+        return instance;
+    }
 
     URLConnection getConnection(JarFile jarFile) throws IOException {
-        URL u = urlCache.get(jarFile);
+        URL u;
+        synchronized (instance) {
+            u = urlCache.get(jarFile);
+        }
         if (u != null)
             return u.openConnection();
 
@@ -72,16 +83,16 @@
             }
         }
 
-        JarFile result = null;
-        JarFile local_result = null;
+        JarFile result;
+        JarFile local_result;
 
         if (useCaches) {
-            synchronized (this) {
+            synchronized (instance) {
                 result = getCachedJarFile(url);
             }
             if (result == null) {
                 local_result = URLJarFile.getJarFile(url, this);
-                synchronized (this) {
+                synchronized (instance) {
                     result = getCachedJarFile(url);
                     if (result == null) {
                         fileCache.put(URLUtil.urlNoFragString(url), local_result);
@@ -109,13 +120,15 @@
      * remove the JarFile from the cache
      */
     public void close(JarFile jarFile) {
-        URL urlRemoved = urlCache.remove(jarFile);
-        if( urlRemoved != null) {
+        synchronized (instance) {
+            URL urlRemoved = urlCache.remove(jarFile);
+            if (urlRemoved != null)
                 fileCache.remove(URLUtil.urlNoFragString(urlRemoved));
         }
     }
 
     private JarFile getCachedJarFile(URL url) {
+        assert Thread.holdsLock(instance);
         JarFile result = fileCache.get(URLUtil.urlNoFragString(url));
 
         /* if the JAR file is cached, the permission will always be there */
--- a/src/windows/native/sun/windows/awt_Desktop.cpp	Wed Mar 27 16:18:43 2013 -0700
+++ b/src/windows/native/sun/windows/awt_Desktop.cpp	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -38,17 +38,17 @@
  * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
-  (JNIEnv *env, jclass cls, jstring uri_j, jstring verb_j)
+  (JNIEnv *env, jclass cls, jstring fileOrUri_j, jstring verb_j)
 {
-    LPCWSTR uri_c = JNU_GetStringPlatformChars(env, uri_j, JNI_FALSE);
+    LPCWSTR fileOrUri_c = JNU_GetStringPlatformChars(env, fileOrUri_j, JNI_FALSE);
     LPCWSTR verb_c = JNU_GetStringPlatformChars(env, verb_j, JNI_FALSE);
 
     // 6457572: ShellExecute possibly changes FPU control word - saving it here
     unsigned oldcontrol87 = _control87(0, 0);
-    HINSTANCE retval = ::ShellExecute(NULL, verb_c, uri_c, NULL, NULL, SW_SHOWNORMAL);
+    HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL, SW_SHOWNORMAL);
     _control87(oldcontrol87, 0xffffffff);
 
-    JNU_ReleaseStringPlatformChars(env, uri_j, uri_c);
+    JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
     JNU_ReleaseStringPlatformChars(env, verb_j, verb_c);
 
     if ((int)retval <= 32) {
--- a/test/ProblemList.txt	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/ProblemList.txt	Wed Apr 03 12:49:46 2013 -0700
@@ -364,6 +364,15 @@
 # 7147060
 com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java        generic-all
 
+# 8000439: NPG: REGRESSION : sun/security/krb5/auto/MaxRetries.java fails with timeout
+sun/security/krb5/auto/MaxRetries.java                          solaris-sparcv9
+
+# 8006690: sun/security/krb5/auto/BadKdc1.java fails intermittently
+sun/security/krb5/auto/BadKdc1.java                             solaris-sparcv9
+sun/security/krb5/auto/BadKdc2.java                             solaris-sparcv9
+sun/security/krb5/auto/BadKdc3.java                             solaris-sparcv9
+sun/security/krb5/auto/BadKdc4.java                             solaris-sparcv9
+
 ############################################################################
 
 # jdk_swing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java	Wed Apr 03 12:49:46 2013 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, 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 6550588
+   @summary java.awt.Desktop cannot open file with Windows UNC filename
+   @author Anton Litvinov
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+
+public class OpenByUNCPathNameTest {
+    private static boolean validatePlatform() {
+        String osName = System.getProperty("os.name");
+        if (osName == null) {
+            throw new RuntimeException("Name of the current OS could not be retrieved.");
+        }
+        return osName.startsWith("Windows");
+    }
+
+    private static void openFile() throws IOException {
+        if (!Desktop.isDesktopSupported()) {
+            System.out.println("java.awt.Desktop is not supported on this platform.");
+        } else {
+            Desktop desktop = Desktop.getDesktop();
+            File file = File.createTempFile("Read Me File", ".txt");
+            try {
+                // Test opening of the file with Windows local file path.
+                desktop.open(file);
+                Robot robot = null;
+                try {
+                    Thread.sleep(5000);
+                    robot = new Robot();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                pressAltF4Keys(robot);
+
+                // Test opening of the file with Windows UNC pathname.
+                String uncFilePath = "\\\\127.0.0.1\\" + file.getAbsolutePath().replace(':', '$');
+                File uncFile = new File(uncFilePath);
+                if (!uncFile.exists()) {
+                    throw new RuntimeException(String.format(
+                        "File with UNC pathname '%s' does not exist.", uncFilePath));
+                }
+                desktop.open(uncFile);
+                try {
+                    Thread.sleep(5000);
+                } catch (InterruptedException ie) {
+                    ie.printStackTrace();
+                }
+                pressAltF4Keys(robot);
+            } finally {
+                file.delete();
+            }
+        }
+    }
+
+    private static void pressAltF4Keys(Robot robot) {
+        if (robot != null) {
+            robot.keyPress(KeyEvent.VK_ALT);
+            robot.keyPress(KeyEvent.VK_F4);
+            robot.delay(50);
+            robot.keyRelease(KeyEvent.VK_F4);
+            robot.keyRelease(KeyEvent.VK_ALT);
+        }
+    }
+
+    public static void main(String[] args) throws IOException {
+        if (!validatePlatform()) {
+            System.out.println("This test is only for MS Windows OS.");
+        } else {
+            openFile();
+        }
+    }
+}
--- a/test/java/beans/Introspector/Test7192955.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/beans/Introspector/Test7192955.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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,17 +23,20 @@
 
 /*
  * @test
- * @bug 7192955
+ * @bug 7192955 8000183
  * @summary Tests that all properties are bound
  * @author Sergey Malenkov
  */
 
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
 import java.beans.PropertyChangeListener;
+import java.beans.PropertyDescriptor;
 import java.util.List;
 
 public class Test7192955 {
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws IntrospectionException {
         if (!BeanUtils.findPropertyDescriptor(MyBean.class, "test").isBound()) {
             throw new Error("a simple property is not bound");
         }
@@ -43,6 +46,12 @@
         if (!BeanUtils.findPropertyDescriptor(MyBean.class, "readOnly").isBound()) {
             throw new Error("a read-only property is not bound");
         }
+        PropertyDescriptor[] pds = Introspector.getBeanInfo(MyBean.class, BaseBean.class).getPropertyDescriptors();
+        for (PropertyDescriptor pd : pds) {
+            if (pd.getName().equals("test") && pd.isBound()) {
+                throw new Error("a simple property is bound without superclass");
+            }
+        }
     }
 
     public static class BaseBean {
--- a/test/java/lang/Runtime/exec/WinCommand.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/lang/Runtime/exec/WinCommand.java	Wed Apr 03 12:49:46 2013 -0700
@@ -135,24 +135,19 @@
 
         // Win9x systems don't have a cmd.exe
         if (new File(systemDirW, "cmd.exe").exists()) {
-            try {
-                out.println("Running cmd.exe tests...");
-                writeFile("cdcmd.cmd", "@echo off\r\nCD\r\n");
-                writeFile("cdbat.bat", "@echo off\r\nCD\r\n");
-                checkCD("cmd",
-                        "cmd.exe",
-                        systemDirW + "\\cmd.exe",
-                        // Only the ".exe" extension can be omitted
-                        systemDirW + "\\cmd",
-                        systemDirM + "/cmd.exe",
-                        systemDirM + "/cmd",
-                        "/" + systemDirM + "/cmd",
-                        "cdcmd.cmd", "./cdcmd.cmd", ".\\cdcmd.cmd",
-                        "cdbat.bat", "./cdbat.bat", ".\\cdbat.bat");
-            } finally {
-                new File("cdcmd.cmd").delete();
-                new File("cdbat.bat").delete();
-            }
+            out.println("Running cmd.exe tests...");
+            writeFile("cdcmd.cmd", "@echo off\r\nCD\r\n");
+            writeFile("cdbat.bat", "@echo off\r\nCD\r\n");
+            checkCD("cmd",
+                    "cmd.exe",
+                    systemDirW + "\\cmd.exe",
+                    // Only the ".exe" extension can be omitted
+                    systemDirW + "\\cmd",
+                    systemDirM + "/cmd.exe",
+                    systemDirM + "/cmd",
+                    "/" + systemDirM + "/cmd",
+                    "cdcmd.cmd", "./cdcmd.cmd", ".\\cdcmd.cmd",
+                    "cdbat.bat", "./cdbat.bat", ".\\cdbat.bat");
         }
 
         // 16-bit apps like command.com must have a console;
--- a/test/java/util/prefs/AddNodeChangeListener.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/AddNodeChangeListener.java	Wed Apr 03 12:49:46 2013 -0700
@@ -24,9 +24,10 @@
  */
 
  /* @test
-  * @bug  7160252
+  * @bug  7160252 7197662
   * @summary Checks if events are delivered to a listener
   *          when a child node is added or removed
+  * @run main/othervm -Djava.util.prefs.userRoot=. AddNodeChangeListener
   */
 
 import java.util.prefs.*;
--- a/test/java/util/prefs/CheckUserPrefsStorage.sh	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/CheckUserPrefsStorage.sh	Wed Apr 03 12:49:46 2013 -0700
@@ -22,10 +22,10 @@
 #
 
 # @test
-# @bug 7198073
+# @bug 7198073 7197662
 # @build CheckUserPrefFirst CheckUserPrefLater
 # @run shell CheckUserPrefsStorage.sh
-# @summary Tests that user preferences are stored in the 
+# @summary Tests that user preferences are stored in the
 #          permanent storage
 #
 
@@ -50,14 +50,14 @@
 esac
 
 # run CheckUserPrefFirst - creates and stores a user pref
-${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} CheckUserPrefFirst
+${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefFirst
 result=$?
 if [ "$result" -ne "0" ]; then
     exit 1
 fi
 
 # run CheckUserPrefLater - Looks for the stored pref
-${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} CheckUserPrefLater
+${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefLater
 result=$?
 if [ "$result" -ne "0" ]; then
     exit 1
--- a/test/java/util/prefs/CommentsInXml.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/CommentsInXml.java	Wed Apr 03 12:49:46 2013 -0700
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 4619564
+ * @bug 4619564 7197662
  * @summary XMl Comments in Preferences File lead to ClassCastException
+ * @run main/othervm -Djava.util.prefs.userRoot=. CommentsInXml
  * @author kladko
  */
 
--- a/test/java/util/prefs/ConflictInFlush.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/ConflictInFlush.java	Wed Apr 03 12:49:46 2013 -0700
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 4703132
+ * @bug 4703132 7197662
  * @summary flush() throws an IllegalStateException on a removed node
+ * @run main/othervm -Djava.util.prefs.userRoot=. ConflictInFlush
  * @author Sucheta Dambalkar
  */
 
--- a/test/java/util/prefs/ExportNode.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/ExportNode.java	Wed Apr 03 12:49:46 2013 -0700
@@ -24,9 +24,10 @@
 
 /*
  * @test
- * @bug 4387136 4947349
+ * @bug 4387136 4947349 7197662
  * @summary Due to a bug in XMLSupport.putPreferencesInXml(...),
  *          node's keys would not get exported.
+ * @run main/othervm -Djava.util.prefs.userRoot=. ExportNode
  * @author Konstantin Kladko
  */
 import java.util.prefs.*;
--- a/test/java/util/prefs/ExportSubtree.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/ExportSubtree.java	Wed Apr 03 12:49:46 2013 -0700
@@ -23,9 +23,10 @@
 
 
 /* @test
-   @bug 6203576 4700020
-   @summary checks if the output of exportSubtree() is identical to
-            the output from previous release.
+ * @bug 6203576 4700020 7197662
+ * @summary checks if the output of exportSubtree() is identical to
+ *          the output from previous release.
+ * @run main/othervm -Djava.util.prefs.userRoot=. ExportSubtree
  */
 
 import java.io.*;
--- a/test/java/util/prefs/PrefsSpi.sh	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/PrefsSpi.sh	Wed Apr 03 12:49:46 2013 -0700
@@ -24,7 +24,7 @@
 #
 
 # @test
-# @bug 4991526 6514993
+# @bug 4991526 6514993 7197662
 # @summary Unit test for Preferences jar providers
 #
 # @build PrefsSpi
@@ -89,12 +89,16 @@
 
 Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \
     -Djava.util.prefs.PreferencesFactory=StubPreferencesFactory \
+    -Djava.util.prefs.userRoot=. \
     PrefsSpi "StubPreferences"
 Sys "$java" "-cp" "$TESTCLASSES" \
+    -Djava.util.prefs.userRoot=. \
     PrefsSpi "java.util.prefs.*"
 Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \
+    -Djava.util.prefs.userRoot=. \
     PrefsSpi "StubPreferences"
 Sys "$java" "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \
+    -Djava.util.prefs.userRoot=. \
     PrefsSpi "StubPreferences"
 
 rm -rf jarDir extDir
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/prefs/RemoveNullKeyCheck.java	Wed Apr 03 12:49:46 2013 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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 7160242
+ * @summary Check if NullPointerException is thrown if the key passed
+ *          to remove() is null.
+ * @run main/othervm -Djava.util.prefs.userRoot=. RemoveNullKeyCheck
+ */
+
+import java.util.prefs.Preferences;
+
+public class RemoveNullKeyCheck {
+
+    public static void main(String[] args) throws Exception {
+       try {
+           Preferences node = Preferences.userRoot().node("N1");
+           node.remove(null);
+           throw new RuntimeException("Expected NullPointerException " +
+                                      "not thrown");
+       } catch (NullPointerException npe) {
+           System.out.println("NullPointerException thrown");
+       }
+    }
+}
--- a/test/java/util/prefs/RemoveReadOnlyNode.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/RemoveReadOnlyNode.java	Wed Apr 03 12:49:46 2013 -0700
@@ -23,10 +23,11 @@
 
 
 /* @test
-   @bug 6178148
-   @summary check if wrong exception gets thrown if one of the child
-            nodes is readonly on underlying filesystem when node is
-            being removed.
+ * @bug 6178148 7197662
+ * @summary check if wrong exception gets thrown if one of the child
+ *          nodes is readonly on underlying filesystem when node is
+ *          being removed.
+ * @run main/othervm -Djava.util.prefs.userRoot=. RemoveReadOnlyNode
  */
 
 import java.io.*;
--- a/test/java/util/prefs/RemoveUnregedListener.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/java/util/prefs/RemoveUnregedListener.java	Wed Apr 03 12:49:46 2013 -0700
@@ -23,9 +23,10 @@
 
 
 /* @test
- * @bug 4705094
+ * @bug 4705094 7197662
  * @summary Checks if correct exception gets thrown when removing an
  *          unregistered NodeChangeListener .
+ * @run main/othervm -Djava.util.prefs.userRoot=. RemoveUnregedListener
  */
 
 import java.util.prefs.*;
--- a/test/javax/management/remote/mandatory/notif/DeadListenerTest.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/javax/management/remote/mandatory/notif/DeadListenerTest.java	Wed Apr 03 12:49:46 2013 -0700
@@ -31,6 +31,7 @@
 import com.sun.jmx.remote.internal.ServerNotifForwarder;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
+import java.lang.ref.WeakReference;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -86,20 +87,26 @@
         Map<ObjectName, Set<?>> listenerMap = (Map<ObjectName, Set<?>>) listenerMapF.get(serverNotifForwarder);
         assertTrue("Server listenerMap initially empty", mapWithoutKey(listenerMap, delegateName).isEmpty());
 
-        CountListener count1 = new CountListener();
+        final AtomicInteger count1Val = new AtomicInteger();
+        CountListener count1 = new CountListener(count1Val);
         mbsc.addNotificationListener(name, count1, null, null);
+        WeakReference<CountListener> count1Ref = new WeakReference<>(count1);
+        count1 = null;
 
-        CountListener count2 = new CountListener();
+        final AtomicInteger count2Val = new AtomicInteger();
+        CountListener count2 = new CountListener(count2Val);
         NotificationFilterSupport dummyFilter = new NotificationFilterSupport();
         dummyFilter.enableType("");
         mbsc.addNotificationListener(name, count2, dummyFilter, "noddy");
+        WeakReference<CountListener> count2Ref = new WeakReference<>(count2);
+        count2 = null;
 
         assertTrue("One entry in listenerMap for two listeners on same MBean", mapWithoutKey(listenerMap, delegateName).size() == 1);
         Set<?> set = listenerMap.get(name);
         assertTrue("Set in listenerMap for MBean has two elements", set != null && set.size() == 2);
 
-        assertTrue("Initial value of count1 == 0", count1.count() == 0);
-        assertTrue("Initial value of count2 == 0", count2.count() == 0);
+        assertTrue("Initial value of count1 == 0", count1Val.get() == 0);
+        assertTrue("Initial value of count2 == 0", count2Val.get() == 0);
 
         Notification notif = new Notification("type", name, 0);
 
@@ -107,11 +114,11 @@
 
         // Make sure notifs are working normally.
         long deadline = System.currentTimeMillis() + 2000;
-        while ((count1.count() != 1 || count2.count() != 1) && System.currentTimeMillis() < deadline) {
+        while ((count1Val.get() != 1 || count2Val.get() != 1) && System.currentTimeMillis() < deadline) {
             Thread.sleep(10);
         }
-        assertTrue("New value of count1 == 1", count1.count() == 1);
-        assertTrue("Initial value of count2 == 1", count2.count() == 1);
+        assertTrue("New value of count1 == 1", count1Val.get() == 1);
+        assertTrue("Initial value of count2 == 1", count2Val.get() == 1);
 
         // Make sure that removing a nonexistent listener from an existent MBean produces ListenerNotFoundException
         CountListener count3 = new CountListener();
@@ -136,28 +143,29 @@
         mbs.unregisterMBean(name);
         mbean.sendNotification(notif);
         Thread.sleep(200);
-        assertTrue("New value of count1 == 1", count1.count() == 1);
-        assertTrue("Initial value of count2 == 1", count2.count() == 1);
+
+        assertTrue("New value of count1 == 1", count1Val.get() == 1);
+        assertTrue("Initial value of count2 == 1", count2Val.get() == 1);
+
+        // wait for the listener cleanup to take place upon processing notifications
+        int countdown = 50; // waiting max. 5 secs
+        while (countdown-- > 0 &&
+                (count1Ref.get() != null ||
+                 count2Ref.get() != null)) {
+            System.gc();
+            Thread.sleep(100);
+            System.gc();
+        }
+        // listener has been removed or the wait has timed out
+
+        assertTrue("count1 notification listener has not been cleaned up", count1Ref.get() == null);
+        assertTrue("count2 notification listener has not been cleaned up", count2Ref.get() == null);
 
         // Check that there is no trace of the listeners any more in ServerNotifForwarder.listenerMap.
         // THIS DEPENDS ON JMX IMPLEMENTATION DETAILS.
         // If the JMX implementation changes, the code here may have to change too.
         Set<?> setForUnreg = listenerMap.get(name);
         assertTrue("No trace of unregistered MBean: " + setForUnreg, setForUnreg == null);
-
-        // Remove attempts should fail.
-        try {
-            mbsc.removeNotificationListener(name, count1);
-            assertTrue("Remove of count1 listener should have failed", false);
-        } catch (ListenerNotFoundException e) {
-            // OK: expected
-        }
-        try {
-            mbsc.removeNotificationListener(name, count2, dummyFilter, "noddy");
-            assertTrue("Remove of count2 listener should have failed", false);
-        } catch (ListenerNotFoundException e) {
-            // OK: expected
-        }
     }
 
     private static <K, V> Map<K, V> mapWithoutKey(Map<K, V> map, K key) {
@@ -173,6 +181,10 @@
     public static class CountListener implements NotificationListener {
         final AtomicInteger count;
 
+        public CountListener(AtomicInteger i) {
+            count = i;
+        }
+
         public CountListener() {
             this.count = new AtomicInteger();
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JMenu/4515762/bug4515762.java	Wed Apr 03 12:49:46 2013 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 4515762
+ * @author Mark Davidson
+ * @summary Tests the ability to support duplicate mnemonics
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug4515762
+ */
+public class bug4515762 {
+
+    private static volatile boolean actionExpected = false;
+    private static volatile boolean actionRecieved = false;
+
+    /**
+     * @param str name of Menu
+     */
+    private static JMenuBar createMenuBar() {
+        JMenuBar menubar = new JMenuBar();
+
+        // Duplicate menu item test for 4515762
+        JMenu menu = new JMenu("Duplicate Menu");
+        menu.setMnemonic('D');
+        menu.add(createMenuItem("Sunday", 'S'));
+        menu.add(createMenuItem("Monday", 'M'));
+
+        menu.add(createMenuItem("Tuesday", 'S'));
+        menu.add(createMenuItem("Wednesday", 'S'));
+        menu.add(createMenuItem("Thursday", 'S'));
+        menu.add(createMenuItem("Friday", 'F'));
+        menu.add(createMenuItem("Saturday", 'S'));
+
+        // Control with unique menu
+        JMenu menu2 = new JMenu("Unique Menu");
+        menu2.setMnemonic('U');
+        menu2.add(createMenuItem("Sunday", 'S'));
+        menu2.add(createMenuItem("Monday", 'M'));
+
+        menu2.add(createMenuItem("Tuesday", 'T'));
+        menu2.add(createMenuItem("Wednesday", 'W'));
+        menu2.add(createMenuItem("Thursday", 'U'));
+        menu2.add(createMenuItem("Friday", 'F'));
+        menu2.add(createMenuItem("Saturday", 'A'));
+
+        menubar.add(menu);
+        menubar.add(menu2);
+
+        return menubar;
+    }
+
+    /**
+     * Creates and returns the menu item.
+     */
+    private static JMenuItem createMenuItem(String name, char mnemonic) {
+        JMenuItem menuItem = new JMenuItem(name, mnemonic);
+        menuItem.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent evt) {
+                JMenuItem item = (JMenuItem) evt.getSource();
+                if (actionExpected == false) {
+                    throw new RuntimeException("Menu Action: "
+                            + item.getText() + " should not be called");
+                } else {
+                    actionRecieved = true;
+                }
+            }
+        });
+
+        return menuItem;
+    }
+
+    public static void checkAction() {
+        if (actionRecieved == true) {
+            actionRecieved = false;
+        } else {
+            throw new RuntimeException("Action has not been received");
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(250);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                JFrame frame = new JFrame("Test");
+                frame.setJMenuBar(createMenuBar());
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_D);
+        toolkit.realSync();
+
+        // Press the S key many times (should not cause an action peformed)
+        int TIMES = 5;
+        for (int i = 0; i < TIMES; i++) {
+            Util.hitKeys(robot, KeyEvent.VK_S);
+        }
+        toolkit.realSync();
+
+        // Unique menu items.
+        actionExpected = true;
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+
+        robot.keyPress(KeyEvent.VK_S);
+        robot.keyRelease(KeyEvent.VK_S);
+        toolkit.realSync();
+
+        checkAction();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+        robot.keyPress(KeyEvent.VK_M);
+        robot.keyRelease(KeyEvent.VK_M);
+        toolkit.realSync();
+
+        checkAction();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+        Util.hitKeys(robot, KeyEvent.VK_T);
+        toolkit.realSync();
+
+        checkAction();
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+        Util.hitKeys(robot, KeyEvent.VK_W);
+        toolkit.realSync();
+
+        checkAction();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+        Util.hitKeys(robot, KeyEvent.VK_U);
+        toolkit.realSync();
+
+        checkAction();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JRootPane/4670486/bug4670486.java	Wed Apr 03 12:49:46 2013 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 4670486
+ * @author Mark Davidson
+ * @summary Regression: Popup menu bindings doesn't work when a default button has been defined.
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug4670486
+ */
+public class bug4670486 {
+
+    public static volatile boolean actionExpected = false;
+    public static volatile boolean actionRecieved = false;
+
+    private static JMenuBar createMenuBar() {
+        JMenuBar menubar = new JMenuBar();
+
+        // Control with unique menu
+        JMenu menu = new JMenu("Unique Menu");
+        menu.setMnemonic('U');
+        menu.add(createMenuItem("Sunday", 'S'));
+        menu.add(createMenuItem("Monday", 'M'));
+
+        menu.add(createMenuItem("Tuesday", 'T'));
+        menu.add(createMenuItem("Wednesday", 'W'));
+        menu.add(createMenuItem("Thursday", 'U'));
+        menu.add(createMenuItem("Friday", 'F'));
+        menu.add(createMenuItem("Saturday", 'A'));
+
+        menubar.add(menu);
+
+        return menubar;
+    }
+
+    private static JPanel createPanel(JFrame frame) {
+        JPanel panel = new JPanel();
+        JButton button = new JButton("Button");
+        JButton button2 = new JButton("Button 2");
+        JButton button3 = new JButton("Button 3");
+
+        JRootPane root = frame.getRootPane();
+        root.setDefaultButton(button);
+
+        panel.add(button);
+        panel.add(button2);
+        panel.add(button3);
+
+        return panel;
+    }
+
+    /**
+     * Creates and returns the menu item.
+     */
+    private static JMenuItem createMenuItem(String name, char mnemonic) {
+        JMenuItem menuItem = new JMenuItem(name, mnemonic);
+        menuItem.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent evt) {
+                actionRecieved = true;
+            }
+        });
+
+        return menuItem;
+    }
+
+    public static void checkAction() {
+        if (actionRecieved == true) {
+            actionRecieved = false;
+        } else {
+            throw new RuntimeException("Action has not been received");
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(250);
+
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                JFrame frame = new JFrame("Test");
+                frame.setContentPane(createPanel(frame));
+                frame.setJMenuBar(createMenuBar());
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        // Change the default button to
+        // force a call to BasicRootPaneUI.updateDefaultButtonBindings()
+        Util.hitKeys(robot, KeyEvent.VK_TAB);
+
+        // If the bug exists, then as soon as the menu appears,
+        // the VK_ENTER, VK_DOWN, VK_UP and VK_ESC will have no
+        // effect.
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+        Util.hitKeys(robot, KeyEvent.VK_ENTER);
+        toolkit.realSync();
+
+        checkAction();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_U);
+        Util.hitKeys(robot, KeyEvent.VK_DOWN);
+        Util.hitKeys(robot, KeyEvent.VK_ENTER);
+        toolkit.realSync();
+
+        checkAction();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JScrollBar/7163696/Test7163696.java	Wed Apr 03 12:49:46 2013 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013, 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 7163696
+ * @summary Tests that JScrollBar scrolls to the left
+ * @author Sergey Malenkov
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+
+import javax.swing.JFrame;
+import javax.swing.JScrollBar;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+
+public class Test7163696 implements Runnable {
+
+    private static final boolean AUTO = null != System.getProperty("test.src", null);
+
+    public static void main(String[] args) throws Exception {
+        new Test7163696().test();
+    }
+
+    private JScrollBar bar;
+
+    private void test() throws Exception {
+        Robot robot = new Robot();
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+            UIManager.setLookAndFeel(info.getClassName());
+
+            SwingUtilities.invokeAndWait(this);
+            toolkit.realSync(500); // after creation
+
+            Point point = this.bar.getLocation();
+            SwingUtilities.convertPointToScreen(point, this.bar);
+            point.x += this.bar.getWidth() >> 2;
+            point.y += this.bar.getHeight() >> 1;
+            robot.mouseMove(point.x, point.y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+            toolkit.realSync(500); // before validation
+            SwingUtilities.invokeAndWait(this);
+
+            if (this.bar != null) {
+                this.bar = null; // allows to reuse the instance
+                if (AUTO) { // error reporting only for automatic testing
+                    throw new Error("TEST FAILED");
+                }
+            }
+        }
+    }
+
+    public void run() {
+        if (this.bar == null) {
+            this.bar = new JScrollBar(JScrollBar.HORIZONTAL, 50, 10, 0, 100);
+            this.bar.setPreferredSize(new Dimension(400, 20));
+
+            JFrame frame = new JFrame();
+            frame.add(this.bar);
+            frame.pack();
+            frame.setVisible(true);
+        }
+        else if (40 != this.bar.getValue()) {
+            System.out.println("name = " + UIManager.getLookAndFeel().getName());
+            System.out.println("value = " + this.bar.getValue());
+        }
+        else {
+            SwingUtilities.getWindowAncestor(this.bar).dispose();
+            this.bar = null;
+        }
+    }
+}
--- a/test/javax/swing/regtesthelpers/Util.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/javax/swing/regtesthelpers/Util.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, 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,11 +23,13 @@
 
 import javax.swing.*;
 import java.awt.*;
+import java.awt.event.*;
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.Callable;
+import sun.swing.*;
 
 /**
  * <p>This class contains utilities useful for regression testing.
@@ -144,6 +146,53 @@
     }
 
      /**
+     * Hits mnemonics by robot.
+     */
+    public static void hitMnemonics(Robot robot, int... keys) {
+
+        ArrayList<Integer> mnemonicKeyCodes = getSystemMnemonicKeyCodes();
+        for (Integer mnemonic : mnemonicKeyCodes) {
+            robot.keyPress(mnemonic);
+        }
+
+        hitKeys(robot, keys);
+
+        for (Integer mnemonic : mnemonicKeyCodes) {
+            robot.keyRelease(mnemonic);
+        }
+    }
+
+    /**
+     * Gets key codes from system mnemonic key mask
+     * @return key codes list
+     */
+    public static ArrayList<Integer> getSystemMnemonicKeyCodes() {
+        return Util.getKeyCodesFromKeyMask(SwingUtilities2.getSystemMnemonicKeyMask());
+    }
+
+    /**
+     * Gets the key codes list from modifiers
+     * @param modifiers an integer combination of the modifier constants
+     * @return key codes list
+     */
+    public static ArrayList<Integer> getKeyCodesFromKeyMask(int modifiers) {
+        ArrayList<Integer> result = new ArrayList<>();
+        if ((modifiers & InputEvent.CTRL_MASK) != 0) {
+            result.add(KeyEvent.VK_CONTROL);
+        }
+        if ((modifiers & InputEvent.ALT_MASK) != 0) {
+            result.add(KeyEvent.VK_ALT);
+        }
+        if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
+            result.add(KeyEvent.VK_SHIFT);
+        }
+        if ((modifiers & InputEvent.META_MASK) != 0) {
+            result.add(KeyEvent.VK_META);
+        }
+        return result;
+    }
+
+     /**
      * Hits keys by robot.
      */
     public static void hitKeys(Robot robot, int... keys) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/net/www/http/HttpClient/IsAvailable.java	Wed Apr 03 12:49:46 2013 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013, 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 8009650
+ * @summary HttpClient available() check throws SocketException when connection
+ * has been closed
+ */
+
+import java.net.URL;
+import java.net.ServerSocket;
+import sun.net.www.http.HttpClient;
+import java.security.*;
+import java.lang.reflect.Method;
+
+public class IsAvailable {
+
+    public static void main(String[] args) throws Exception {
+        int readTimeout = 20;
+        ServerSocket ss = new ServerSocket(0);
+
+        URL url1 = new URL("http://localhost:" + ss.getLocalPort());
+        HttpClient c1 = HttpClient.New(url1);
+
+        Method available = HttpClient.class.
+                getDeclaredMethod("available", null);
+        available.setAccessible(true);
+
+        c1.setReadTimeout(readTimeout);
+        boolean a = (boolean) available.invoke(c1);
+        if (!a) {
+            throw new RuntimeException("connection should be available");
+        }
+        if (c1.getReadTimeout() != readTimeout) {
+            throw new RuntimeException("read timeout has been altered");
+        }
+
+        c1.closeServer();
+
+        a = (boolean) available.invoke(c1);
+        if (a) {
+            throw new RuntimeException("connection shouldn't be available");
+        }
+
+        ss.close();
+    }
+}
--- a/test/sun/net/www/protocol/http/HttpOnly.java	Wed Mar 27 16:18:43 2013 -0700
+++ b/test/sun/net/www/protocol/http/HttpOnly.java	Wed Apr 03 12:49:46 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 /**
  * @test
- * @bug 7095980
+ * @bug 7095980 8007315
  * @summary Ensure HttpURLConnection (and supporting APIs) don't expose
  *          HttpOnly cookies
  */
@@ -52,6 +52,8 @@
  * 4) check HttpOnly cookies received by server
  * 5) server reply with Set-Cookie containing HttpOnly cookie
  * 6) check HttpOnly cookies are not accessible from Http client
+ * 7) check that non-null (empty string) values are returned for
+      scenario where all values are stripped from original key values
  */
 
 public class HttpOnly {
@@ -177,6 +179,36 @@
                           " value " + val);
             }
         }
+
+        // TEST 7 : check that header keys containing empty key values don't return null
+        int i = 1;
+        String key = "";
+        String value = "";
+
+        while (true) {
+            key = uc.getHeaderFieldKey(i);
+            value = uc.getHeaderField(i++);
+            if (key == null && value == null)
+                break;
+
+            if (key != null)
+                check(value != null,
+                    "Encountered a null value for key value : " + key);
+        }
+
+        // TEST 7.5 similar test but use getHeaderFields
+        respHeaders = uc.getHeaderFields();
+        respEntries = respHeaders.entrySet();
+        for (Map.Entry<String,List<String>> entry : respEntries) {
+            String header = entry.getKey();
+            if (header != null) {
+                List<String> listValues = entry.getValue();
+                for (String value1 : listValues)
+                    check(value1 != null,
+                        "getHeaderFields returned null values for header:, "
+                        + header);
+            }
+        }
     }
 
     // HTTP Server