changeset 282:b6601ba7f6df

Merge
author xdono
date Tue, 27 May 2008 17:18:01 -0700
parents 7971bbb6dc42 cbd182c404d8
children 02e4c5348592 2d5d4282d0fa bb99fb855bdc f9467b4496dc
files
diffstat 114 files changed, 2513 insertions(+), 599 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu May 15 13:04:31 2008 -0700
+++ b/.hgtags	Tue May 27 17:18:01 2008 -0700
@@ -1,3 +1,4 @@
 37a05a11f281b4d238e2f9e7ebb67c63f64d0e77 jdk7-b24
 75fca0b0ab83ab1392e615910cea020f66535390 jdk7-b25
 fb57027902e04ecafceae31a605e69b436c23d57 jdk7-b26
+3e599d98875ddf919c8ea11cff9b3a99ba631a9b jdk7-b27
--- a/make/com/sun/tracing/Makefile	Thu May 15 13:04:31 2008 -0700
+++ b/make/com/sun/tracing/Makefile	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 #
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+# Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
 #
 
 #
@@ -12,7 +32,7 @@
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
 
-SUBDIRS = dtrace 
+SUBDIRS = dtrace
 all build:
 	$(SUBDIRS-loop)
 clean clobber::
--- a/make/com/sun/tracing/dtrace/Makefile	Thu May 15 13:04:31 2008 -0700
+++ b/make/com/sun/tracing/dtrace/Makefile	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 #
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+# Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
 #
 
 #
--- a/make/sun/tracing/Makefile	Thu May 15 13:04:31 2008 -0700
+++ b/make/sun/tracing/Makefile	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 #
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+# Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
 #
 
 #
@@ -12,7 +32,7 @@
 PRODUCT = sun
 include $(BUILDDIR)/common/Defs.gmk
 
-SUBDIRS = dtrace 
+SUBDIRS = dtrace
 all build:
 	$(SUBDIRS-loop)
 clean clobber::
--- a/make/sun/tracing/dtrace/Makefile	Thu May 15 13:04:31 2008 -0700
+++ b/make/sun/tracing/dtrace/Makefile	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 #
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+# Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
 #
 
 #
@@ -30,7 +50,7 @@
     sun/tracing/dtrace/DTraceProvider.java \
     sun/tracing/dtrace/DTraceProbe.java \
     sun/tracing/dtrace/DTraceProviderFactory.java \
-    sun/tracing/dtrace/JVM.java 
+    sun/tracing/dtrace/JVM.java
 
 FILES_export = $(FILES_java)
 
@@ -46,7 +66,7 @@
 #
 # Don't need to link against -ljava
 #
-JAVALIB= 
+JAVALIB=
 
 #
 # Rules.
--- a/make/sun/tracing/dtrace/mapfile-vers	Thu May 15 13:04:31 2008 -0700
+++ b/make/sun/tracing/dtrace/mapfile-vers	Tue May 27 17:18:01 2008 -0700
@@ -1,8 +1,26 @@
 #
-#ident "@(#)mapfile-vers	1.1 07/08/14"
-# 
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+# Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
 #
 
 # Define library interface.
--- a/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java	Tue May 27 17:18:01 2008 -0700
@@ -233,7 +233,6 @@
                MBeanRegistrationException, MBeanException,
                NotCompliantMBeanException, InstanceNotFoundException {
 
-        ObjectName logicalName = name;
         Class theClass;
 
         if (className == null) {
@@ -519,8 +518,7 @@
                                                 QueryExp query) {
         // Query the MBeans on the repository
         //
-        Set<NamedObject> list = null;
-        list = repository.query(name, query);
+        Set<NamedObject> list = repository.query(name, query);
 
         if (queryByRepo) {
             // The repository performs the filtering
@@ -576,8 +574,7 @@
     private Set<ObjectName> queryNamesImpl(ObjectName name, QueryExp query) {
         // Query the MBeans on the repository
         //
-        Set<NamedObject> list = null;
-        list = repository.query(name, query);
+        Set<NamedObject> list = repository.query(name, query);
 
         if (queryByRepo) {
             // The repository performs the filtering
@@ -1042,7 +1039,7 @@
         if (registerFailed && moi instanceof DynamicMBean2)
             ((DynamicMBean2) moi).registerFailed();
         try {
-            moi.postRegister(new Boolean(registrationDone));
+            moi.postRegister(registrationDone);
         } catch (RuntimeException e) {
             throw new RuntimeMBeanException(e,
                       "RuntimeException thrown in postRegister method");
@@ -1094,8 +1091,7 @@
                 IllegalArgumentException("Object name cannot be null"),
                                "Exception occurred trying to get an MBean");
         }
-        DynamicMBean obj = null;
-        obj = repository.retrieve(name);
+        DynamicMBean obj = repository.retrieve(name);
         if (obj == null) {
             if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
                 MBEANSERVER_LOGGER.logp(Level.FINER,
@@ -1568,7 +1564,6 @@
             query.setMBeanServer(server);
             try {
                 for (NamedObject no : list) {
-                    final DynamicMBean obj = no.getObject();
                     boolean res;
                     try {
                         res = query.apply(no.getName());
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Tue May 27 17:18:01 2008 -0700
@@ -205,7 +205,7 @@
      */
     public Object instantiate(Class theClass)
         throws ReflectionException, MBeanException {
-        Object moi = null;
+        Object moi;
 
 
         // ------------------------------
@@ -265,7 +265,7 @@
         // ------------------------------
         // ------------------------------
         final Class[] tab;
-        Object moi= null;
+        Object moi;
         try {
             // Build the signature of the method
             //
@@ -283,8 +283,7 @@
         }
 
         // Query the metadata service to get the right constructor
-        Constructor cons = null;
-        cons = findConstructor(theClass, tab);
+        Constructor cons = findConstructor(theClass, tab);
 
         if (cons == null) {
             throw new ReflectionException(new
@@ -408,7 +407,7 @@
             throw new  RuntimeOperationsException(new
              IllegalArgumentException(), "Null className passed in parameter");
         }
-        Class theClass = null;
+        Class theClass;
         if (loaderName == null) {
             // Load the class using the agent class loader
             theClass = findClass(className, loader);
@@ -621,7 +620,7 @@
     static Class loadClass(String className, ClassLoader loader)
         throws ReflectionException {
 
-        Class theClass = null;
+        Class theClass;
         if (className == null) {
             throw new RuntimeOperationsException(new
                 IllegalArgumentException("The class name cannot be null"),
--- a/src/share/classes/com/sun/jmx/mbeanserver/Repository.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/mbeanserver/Repository.java	Tue May 27 17:18:01 2008 -0700
@@ -89,7 +89,6 @@
 
     /* This class is used to match an ObjectName against a pattern. */
     private final static class ObjectNamePattern {
-        private final char[]   domain;
         private final String[] keys;
         private final String[] values;
         private final String   properties;
@@ -106,8 +105,7 @@
          * @param pattern The ObjectName pattern under examination.
          **/
         public ObjectNamePattern(ObjectName pattern) {
-            this(pattern.getDomain(),
-                 pattern.isPropertyListPattern(),
+            this(pattern.isPropertyListPattern(),
                  pattern.isPropertyValuePattern(),
                  pattern.getCanonicalKeyPropertyListString(),
                  pattern.getKeyPropertyList(),
@@ -124,13 +122,11 @@
          * @param keyPropertyList pattern.getKeyPropertyList().
          * @param pattern The ObjectName pattern under examination.
          **/
-        ObjectNamePattern(String domain,
-                          boolean propertyListPattern,
+        ObjectNamePattern(boolean propertyListPattern,
                           boolean propertyValuePattern,
                           String canonicalProps,
                           Map<String,String> keyPropertyList,
                           ObjectName pattern) {
-            this.domain = domain.toCharArray();
             this.isPropertyListPattern = propertyListPattern;
             this.isPropertyValuePattern = propertyValuePattern;
             this.properties = canonicalProps;
@@ -538,7 +534,7 @@
         // "domain:*", "domain:[key=value],*" : names in the specified domain
 
         // Surely one of the most frequent case ... query on the whole world
-        ObjectName name = null;
+        ObjectName name;
         if (pattern == null ||
             pattern.getCanonicalName().length() == 0 ||
             pattern.equals(ObjectName.WILDCARD))
@@ -660,7 +656,7 @@
      * @return  Number of MBeans.
      */
     public Integer getCount() {
-        return new Integer(nbElements);
+        return nbElements;
     }
 
     /**
@@ -669,7 +665,7 @@
      *
      * @return  A string giving the name of the default domain name.
      */
-    public  String getDefaultDomain() {
+    public String getDefaultDomain() {
         return domain;
     }
 
--- a/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java	Tue May 27 17:18:01 2008 -0700
@@ -435,7 +435,6 @@
 
                     clientSequenceNumber = nr.getNextSequenceNumber();
 
-                    final int size = infoList.size();
                     listeners = new HashMap<Integer, ClientListenerInfo>();
 
                     for (int i = 0 ; i < len ; i++) {
@@ -792,9 +791,6 @@
 
     private Thread currentFetchThread;
 
-    // admin stuff
-    private boolean inited = false;
-
     // state
     /**
      * This state means that a thread is being created for fetching and forwarding notifications.
--- a/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java	Tue May 27 17:18:01 2008 -0700
@@ -269,7 +269,7 @@
                 ", the maxNotifications is " + maxNotifications);
         }
 
-        NotificationResult nr = null;
+        NotificationResult nr;
         final long t = Math.min(connectionTimeout, timeout);
         try {
             nr = notifBuffer.fetchNotifications(bufferFilter,
@@ -322,7 +322,7 @@
 
     private Integer getListenerID() {
         synchronized(listenerCounterLock) {
-            return new Integer(listenerCounter++);
+            return listenerCounter++;
         }
     }
 
@@ -336,7 +336,7 @@
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             AccessControlContext acc = AccessController.getContext();
-            ObjectInstance oi = null;
+            ObjectInstance oi;
             try {
                 oi = AccessController.doPrivileged(
                     new PrivilegedExceptionAction<ObjectInstance>() {
--- a/src/share/classes/com/sun/jmx/remote/security/FileLoginModule.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/remote/security/FileLoginModule.java	Tue May 27 17:18:01 2008 -0700
@@ -437,7 +437,7 @@
         // get the username and password
         getUsernamePassword(usePasswdFromSharedState);
 
-        String localPassword = null;
+        String localPassword;
 
         // userCredentials is initialized in login()
         if (((localPassword = userCredentials.getProperty(username)) == null) ||
@@ -487,10 +487,14 @@
                 throw ace;
             }
         }
-        BufferedInputStream bis = new BufferedInputStream(fis);
-        userCredentials = new Properties();
-        userCredentials.load(bis);
-        bis.close();
+        try {
+            BufferedInputStream bis = new BufferedInputStream(fis);
+            userCredentials = new Properties();
+            userCredentials.load(bis);
+            bis.close();
+        } finally {
+            fis.close();
+        }
     }
 
     /**
--- a/src/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java	Tue May 27 17:18:01 2008 -0700
@@ -295,7 +295,7 @@
 private static class FileLoginConfig extends Configuration {
 
     // The JAAS configuration for file-based authentication
-    private static AppConfigurationEntry[] entries;
+    private AppConfigurationEntry[] entries;
 
     // The classname of the login module for file-based authentication
     private static final String FILE_LOGIN_MODULE =
--- a/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java	Tue May 27 17:18:01 2008 -0700
@@ -231,10 +231,13 @@
     private static Properties propertiesFromFile(String fname)
         throws IOException {
         FileInputStream fin = new FileInputStream(fname);
-        Properties p = new Properties();
-        p.load(fin);
-        fin.close();
-        return p;
+        try {
+            Properties p = new Properties();
+            p.load(fin);
+            return p;
+        } finally {
+            fin.close();
+        }
     }
 
     private void checkAccessLevel(String accessLevel) {
--- a/src/share/classes/com/sun/security/auth/login/ConfigFile.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/security/auth/login/ConfigFile.java	Tue May 27 17:18:01 2008 -0700
@@ -620,9 +620,35 @@
      * start up time noticeably for the new launcher. -- DAC
      */
     private InputStream getInputStream(URL url) throws IOException {
-        if ("file".equals(url.getProtocol())) {
-            String path = url.getFile().replace('/', File.separatorChar);
-            return new FileInputStream(path);
+        if ("file".equalsIgnoreCase(url.getProtocol())) {
+            // Compatibility notes:
+            //
+            // Code changed from
+            //   String path = url.getFile().replace('/', File.separatorChar);
+            //   return new FileInputStream(path);
+            //
+            // The original implementation would search for "/tmp/a%20b"
+            // when url is "file:///tmp/a%20b". This is incorrect. The
+            // current codes fix this bug and searches for "/tmp/a b".
+            // For compatibility reasons, when the file "/tmp/a b" does
+            // not exist, the file named "/tmp/a%20b" will be tried.
+            //
+            // This also means that if both file exists, the behavior of
+            // this method is changed, and the current codes choose the
+            // correct one.
+            try {
+                return url.openStream();
+            } catch (Exception e) {
+                String file = url.getPath();
+                if (url.getHost().length() > 0) {  // For Windows UNC
+                    file = "//" + url.getHost() + file;
+                }
+                if (debugConfig != null) {
+                    debugConfig.println("cannot read " + url +
+                            ", try " + file);
+                }
+                return new FileInputStream(file);
+            }
         } else {
             return url.openStream();
         }
--- a/src/share/classes/com/sun/tracing/Probe.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/Probe.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing;
--- a/src/share/classes/com/sun/tracing/ProbeName.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/ProbeName.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing;
--- a/src/share/classes/com/sun/tracing/Provider.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/Provider.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing;
--- a/src/share/classes/com/sun/tracing/ProviderName.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/ProviderName.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing;
--- a/src/share/classes/com/sun/tracing/dtrace/ArgsAttributes.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/ArgsAttributes.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/Attributes.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/Attributes.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/DependencyClass.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/DependencyClass.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/FunctionAttributes.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/FunctionAttributes.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/FunctionName.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/FunctionName.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/ModuleAttributes.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/ModuleAttributes.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/ModuleName.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/ModuleName.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/NameAttributes.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/NameAttributes.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/ProviderAttributes.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/ProviderAttributes.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/StabilityLevel.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/StabilityLevel.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package com.sun.tracing.dtrace;
--- a/src/share/classes/com/sun/tracing/dtrace/package-info.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/dtrace/package-info.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 /**
--- a/src/share/classes/com/sun/tracing/package-info.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/com/sun/tracing/package-info.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 /**
--- a/src/share/classes/java/net/CookieManager.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/net/CookieManager.java	Tue May 27 17:18:01 2008 -0700
@@ -205,11 +205,31 @@
         if (cookieJar == null)
             return Collections.unmodifiableMap(cookieMap);
 
+        boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
         List<HttpCookie> cookies = new java.util.ArrayList<HttpCookie>();
+        String path = uri.getPath();
+        if (path == null || path.isEmpty()) {
+            path = "/";
+        }
         for (HttpCookie cookie : cookieJar.get(uri)) {
             // apply path-matches rule (RFC 2965 sec. 3.3.4)
-            if (pathMatches(uri.getPath(), cookie.getPath())) {
-                cookies.add(cookie);
+            // and check for the possible "secure" tag (i.e. don't send
+            // 'secure' cookies over unsecure links)
+            if (pathMatches(path, cookie.getPath()) &&
+                    (secureLink || !cookie.getSecure())) {
+                // Let's check the authorize port list if it exists
+                String ports = cookie.getPortlist();
+                if (ports != null && !ports.isEmpty()) {
+                    int port = uri.getPort();
+                    if (port == -1) {
+                        port = "https".equals(uri.getScheme()) ? 443 : 80;
+                    }
+                    if (isInPortList(ports, port)) {
+                        cookies.add(cookie);
+                    }
+                } else {
+                    cookies.add(cookie);
+                }
             }
         }
 
@@ -251,8 +271,46 @@
                 try {
                     List<HttpCookie> cookies = HttpCookie.parse(headerValue);
                     for (HttpCookie cookie : cookies) {
-                        if (shouldAcceptInternal(uri, cookie)) {
-                            cookieJar.add(uri, cookie);
+                        if (cookie.getPath() == null) {
+                            // If no path is specified, then by default
+                            // the path is the directory of the page/doc
+                            String path = uri.getPath();
+                            if (!path.endsWith("/")) {
+                                int i = path.lastIndexOf("/");
+                                if (i > 0) {
+                                    path = path.substring(0, i + 1);
+                                } else {
+                                    path = "/";
+                                }
+                            }
+                            cookie.setPath(path);
+                        }
+                        String ports = cookie.getPortlist();
+                        if (ports != null) {
+                            int port = uri.getPort();
+                            if (port == -1) {
+                                port = "https".equals(uri.getScheme()) ? 443 : 80;
+                            }
+                            if (ports.isEmpty()) {
+                                // Empty port list means this should be restricted
+                                // to the incoming URI port
+                                cookie.setPortlist("" + port );
+                                if (shouldAcceptInternal(uri, cookie)) {
+                                    cookieJar.add(uri, cookie);
+                                }
+                            } else {
+                                // Only store cookies with a port list
+                                // IF the URI port is in that list, as per
+                                // RFC 2965 section 3.3.2
+                                if (isInPortList(ports, port) &&
+                                        shouldAcceptInternal(uri, cookie)) {
+                                    cookieJar.add(uri, cookie);
+                                }
+                            }
+                        } else {
+                            if (shouldAcceptInternal(uri, cookie)) {
+                                cookieJar.add(uri, cookie);
+                            }
                         }
                     }
                 } catch (IllegalArgumentException e) {
@@ -276,6 +334,32 @@
     }
 
 
+    static private boolean isInPortList(String lst, int port) {
+        int i = lst.indexOf(",");
+        int val = -1;
+        while (i > 0) {
+            try {
+                val = Integer.parseInt(lst.substring(0, i));
+                if (val == port) {
+                    return true;
+                }
+            } catch (NumberFormatException numberFormatException) {
+            }
+            lst = lst.substring(i+1);
+            i = lst.indexOf(",");
+        }
+        if (!lst.isEmpty()) {
+            try {
+                val = Integer.parseInt(lst);
+                if (val == port) {
+                    return true;
+                }
+            } catch (NumberFormatException numberFormatException) {
+            }
+        }
+        return false;
+    }
+
     /*
      * path-matches algorithm, as defined by RFC 2965
      */
--- a/src/share/classes/java/net/HttpCookie.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/net/HttpCookie.java	Tue May 27 17:18:01 2008 -0700
@@ -92,9 +92,14 @@
 
 
     //
-    // date format used by Netscape's cookie draft
+    // date formats used by Netscape's cookie draft
+    // as well as formats seen on various sites
     //
-    private final static String NETSCAPE_COOKIE_DATE_FORMAT = "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'";
+    private final static String[] COOKIE_DATE_FORMATS = {
+        "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'",
+        "EEE',' dd MMM yyyy HH:mm:ss 'GMT'",
+        "EEE MMM dd yyyy HH:mm:ss 'GMT'Z"
+    };
 
     //
     // constant strings represent set-cookie header token
@@ -148,6 +153,7 @@
         secure = false;
 
         whenCreated = System.currentTimeMillis();
+        portlist = null;
     }
 
 
@@ -505,14 +511,14 @@
 
 
     /**
-     * Indicates to the browser whether the cookie should only be sent
-     * using a secure protocol, such as HTTPS or SSL.
+     * Indicates whether the cookie should only be sent using a secure protocol,
+     * such as HTTPS or SSL.
      *
      * <p>The default value is <code>false</code>.
      *
-     * @param flag      if <code>true</code>, sends the cookie from the browser
-     *                  to the server using only when using a secure protocol;
-     *                  if <code>false</code>, sent on any protocol
+     * @param flag      If <code>true</code>, the cookie can only be sent over
+     *                  a secure protocol like https.
+     *                  If <code>false</code>, it can be sent over any protocol.
      *
      * @see #getSecure
      *
@@ -526,12 +532,12 @@
 
 
     /**
-     * Returns <code>true</code> if the browser is sending cookies
-     * only over a secure protocol, or <code>false</code> if the
-     * browser can send cookies using any protocol.
+     * Returns <code>true</code> if sending this cookie should be
+     * restricted to a secure protocol, or <code>false</code> if the
+     * it can be sent using any protocol.
      *
-     * @return          <code>true</code> if the browser can use
-     *                  any standard protocol; otherwise, <code>false</code>
+     * @return          <code>false</code> if the cookie can be sent over
+     *                  any standard protocol; otherwise, <code>true</code>
      *
      * @see #setSecure
      *
@@ -748,6 +754,7 @@
      *
      * @return  a string form of the cookie. The string has the defined format
      */
+    @Override
     public String toString() {
         if (getVersion() > 0) {
             return toRFC2965HeaderString();
@@ -768,6 +775,7 @@
      * @return          <tt>true</tt> if 2 http cookies equal to each other;
      *                  otherwise, <tt>false</tt>
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -798,6 +806,7 @@
      *
      * @return          this http cookie's hash code
      */
+    @Override
     public int hashCode() {
         int h1 = name.toLowerCase().hashCode();
         int h2 = (domain!=null) ? domain.toLowerCase().hashCode() : 0;
@@ -811,6 +820,7 @@
      *
      * @return          a clone of this http cookie
      */
+    @Override
     public Object clone() {
         try {
             return super.clone();
@@ -978,7 +988,7 @@
             });
         assignors.put("port", new CookieAttributeAssignor(){
                 public void assign(HttpCookie cookie, String attrName, String attrValue) {
-                    if (cookie.getPortlist() == null) cookie.setPortlist(attrValue);
+                    if (cookie.getPortlist() == null) cookie.setPortlist(attrValue == null ? "" : attrValue);
                 }
             });
         assignors.put("secure", new CookieAttributeAssignor(){
@@ -1050,24 +1060,31 @@
         return sb.toString();
     }
 
+    private static SimpleDateFormat[] cDateFormats = null;
+    static {
+            cDateFormats = new SimpleDateFormat[COOKIE_DATE_FORMATS.length];
+            for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) {
+                cDateFormats[i] = new SimpleDateFormat(COOKIE_DATE_FORMATS[i]);
+                cDateFormats[i].setTimeZone(TimeZone.getTimeZone("GMT"));
+            }
+    }
     /*
-     * @param dateString        a date string in format of
-     *                          "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'",
-     *                          which defined in Netscape cookie spec
+     * @param dateString        a date string in one of the formats
+     *                          defined in Netscape cookie spec
      *
      * @return                  delta seconds between this cookie's creation
      *                          time and the time specified by dateString
      */
     private long expiryDate2DeltaSeconds(String dateString) {
-        SimpleDateFormat df = new SimpleDateFormat(NETSCAPE_COOKIE_DATE_FORMAT);
-        df.setTimeZone(TimeZone.getTimeZone("GMT"));
+        for (SimpleDateFormat df : cDateFormats) {
+            try {
+                Date date = df.parse(dateString);
+                return (date.getTime() - whenCreated) / 1000;
+            } catch (Exception e) {
 
-        try {
-            Date date = df.parse(dateString);
-            return (date.getTime() - whenCreated) / 1000;
-        } catch (Exception e) {
-            return 0;
+            }
         }
+        return 0;
     }
 
 
--- a/src/share/classes/java/net/Socket.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/net/Socket.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1995-2008 Sun Microsystems, Inc.  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
@@ -253,7 +253,8 @@
      *
      * @param host the name of the remote host, or <code>null</code> for the loopback address.
      * @param port the remote port
-     * @param localAddr the local address the socket is bound to
+     * @param localAddr the local address the socket is bound to, or
+     *        <code>null</code> for the <code>anyLocal</code> address.
      * @param localPort the local port the socket is bound to, or
      *        <code>zero</code> for a system selected free port.
      * @exception  IOException  if an I/O error occurs when creating the socket.
--- a/src/share/classes/java/security/AccessControlContext.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/security/AccessControlContext.java	Tue May 27 17:18:01 2008 -0700
@@ -101,13 +101,14 @@
     }
 
     /**
-     * Create an AccessControlContext with the given set of ProtectionDomains.
+     * Create an AccessControlContext with the given array of ProtectionDomains.
      * Context must not be null. Duplicate domains will be removed from the
      * context.
      *
      * @param context the ProtectionDomains associated with this context.
      * The non-duplicate domains are copied from the array. Subsequent
      * changes to the array will not affect this AccessControlContext.
+     * @throws NullPointerException if <code>context</code> is <code>null</code>
      */
     public AccessControlContext(ProtectionDomain context[])
     {
@@ -125,8 +126,10 @@
                 if ((context[i] != null) &&  (!v.contains(context[i])))
                     v.add(context[i]);
             }
-            this.context = new ProtectionDomain[v.size()];
-            this.context = v.toArray(this.context);
+            if (!v.isEmpty()) {
+                this.context = new ProtectionDomain[v.size()];
+                this.context = v.toArray(this.context);
+            }
         }
     }
 
--- a/src/share/classes/java/security/BasicPermission.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/security/BasicPermission.java	Tue May 27 17:18:01 2008 -0700
@@ -27,12 +27,10 @@
 
 import java.security.*;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Collections;
-import java.util.StringTokenizer;
 import java.io.ObjectStreamField;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
@@ -64,14 +62,8 @@
  * @see java.security.Permission
  * @see java.security.Permissions
  * @see java.security.PermissionCollection
- * @see java.lang.RuntimePermission
- * @see java.security.SecurityPermission
- * @see java.util.PropertyPermission
- * @see java.awt.AWTPermission
- * @see java.net.NetPermission
  * @see java.lang.SecurityManager
  *
- *
  * @author Marianne Mueller
  * @author Roland Schemers
  */
@@ -95,7 +87,6 @@
      * initialize a BasicPermission object. Common to all constructors.
      *
      */
-
     private void init(String name)
     {
         if (name == null)
@@ -213,8 +204,8 @@
      * and has the same name as this object.
      * <P>
      * @param obj the object we are testing for equality with this object.
-     * @return true if <i>obj</i> is a BasicPermission, and has the same name
-     *  as this BasicPermission object, false otherwise.
+     * @return true if <i>obj</i>'s class is the same as this object's class
+     *  and has the same name as this BasicPermission object, false otherwise.
      */
     public boolean equals(Object obj) {
         if (obj == this)
@@ -237,7 +228,6 @@
      *
      * @return a hash code value for this object.
      */
-
     public int hashCode() {
         return this.getName().hashCode();
     }
@@ -266,7 +256,6 @@
      * @return a new PermissionCollection object suitable for
      * storing BasicPermissions.
      */
-
     public PermissionCollection newPermissionCollection() {
         return new BasicPermissionCollection(this.getClass());
     }
--- a/src/share/classes/java/util/IdentityHashMap.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/util/IdentityHashMap.java	Tue May 27 17:18:01 2008 -0700
@@ -188,7 +188,6 @@
     /**
      * Use NULL_KEY for key if it is null.
      */
-
     private static Object maskNull(Object key) {
         return (key == null ? NULL_KEY : key);
     }
@@ -378,8 +377,8 @@
      */
     public boolean containsValue(Object value) {
         Object[] tab = table;
-        for (int i = 1; i < tab.length; i+= 2)
-            if (tab[i] == value)
+        for (int i = 1; i < tab.length; i += 2)
+            if (tab[i] == value && tab[i - 1] != null)
                 return true;
 
         return false;
@@ -905,7 +904,6 @@
      * view the first time this view is requested.  The view is stateless,
      * so there's no reason to create more than one.
      */
-
     private transient Set<Map.Entry<K,V>> entrySet = null;
 
     /**
--- a/src/share/classes/java/util/TreeMap.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/java/util/TreeMap.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
@@ -1021,7 +1021,7 @@
     }
 
     Iterator<K> descendingKeyIterator() {
-        return new DescendingKeyIterator(getFirstEntry());
+        return new DescendingKeyIterator(getLastEntry());
     }
 
     static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> {
--- a/src/share/classes/javax/management/AndQueryExp.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/AndQueryExp.java	Tue May 27 17:18:01 2008 -0700
@@ -100,12 +100,13 @@
    /**
     * Returns a string representation of this AndQueryExp
     */
-   public String toString() {
-     return "(" + exp1 + ") and (" + exp2 + ")";
-   }
+    @Override
+    public String toString() {
+        return "(" + exp1 + ") and (" + exp2 + ")";
+    }
 
-   @Override
-   String toQueryString() {
+    @Override
+    String toQueryString() {
         // Parentheses are only added if needed to disambiguate.
         return parens(exp1) + " and " + parens(exp2);
    }
--- a/src/share/classes/javax/management/BetweenQueryExp.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/BetweenQueryExp.java	Tue May 27 17:18:01 2008 -0700
@@ -135,6 +135,7 @@
     /**
      * Returns the string representing the object.
      */
+    @Override
     public String toString()  {
         return "(" + exp1 + ") between (" + exp2 + ") and (" + exp3 + ")";
     }
--- a/src/share/classes/javax/management/BinaryRelQueryExp.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/BinaryRelQueryExp.java	Tue May 27 17:18:01 2008 -0700
@@ -187,11 +187,11 @@
     /**
      * Returns the string representing the object.
      */
+    @Override
     public String toString()  {
         return "(" + exp1 + ") " + relOpString() + " (" + exp2 + ")";
     }
 
-    @Override
     String toQueryString() {
         return exp1 + " " + relOpString() + " " + exp2;
     }
--- a/src/share/classes/javax/management/NotQueryExp.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/NotQueryExp.java	Tue May 27 17:18:01 2008 -0700
@@ -91,7 +91,6 @@
         return "not (" + exp + ")";
     }
 
-    @Override
     String toQueryString() {
         return "not (" + Query.toString(exp) + ")";
     }
--- a/src/share/classes/javax/management/NumericValueExp.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/NumericValueExp.java	Tue May 27 17:18:01 2008 -0700
@@ -83,7 +83,7 @@
      * <p>The <b>serialVersionUID</b> of this class is <code>-4679739485102359104L</code>.
      */
     private static final ObjectStreamField[] serialPersistentFields;
-    private Number val = new Double(0);
+    private Number val = 0.0;
 
     private static boolean compat = false;
     static {
@@ -213,11 +213,11 @@
         }
         if (isLong)
         {
-          this.val = new Long(longVal);
+          this.val = longVal;
         }
         else
         {
-          this.val = new Double(doubleVal);
+          this.val = doubleVal;
         }
       }
       else
--- a/src/share/classes/javax/management/ObjectName.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/ObjectName.java	Tue May 27 17:18:01 2008 -0700
@@ -223,8 +223,7 @@
  * @since 1.5
  */
 @SuppressWarnings("serial") // don't complain serialVersionUID not constant
-public class ObjectName extends ToQueryString
-        implements Comparable<ObjectName>, QueryExp {
+public class ObjectName implements Comparable<ObjectName>, QueryExp {
 
     /**
      * A structure recording property structure and
@@ -450,7 +449,7 @@
         // parses domain part
     domain_parsing:
         while (index < len) {
-            switch (c = name_chars[index]) {
+            switch (name_chars[index]) {
                 case ':' :
                     _domain_length = index++;
                     break domain_parsing;
@@ -620,7 +619,7 @@
                     case '\n' :
                         final String ichar = ((c1=='\n')?"\\n":""+c1);
                         throw new MalformedObjectNameException(
-                                                 "Invalid character '" + c1 +
+                                                 "Invalid character '" + ichar +
                                                  "' in value part of property");
                     default :
                         in_index++;
@@ -1781,7 +1780,6 @@
         return getSerializedNameString();
     }
 
-    @Override
     String toQueryString() {
         return "LIKE " + Query.value(toString());
     }
--- a/src/share/classes/javax/management/OrQueryExp.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/OrQueryExp.java	Tue May 27 17:18:01 2008 -0700
@@ -100,6 +100,7 @@
     /**
      * Returns a string representation of this OrQueryExp
      */
+    @Override
     public String toString() {
         return "(" + exp1 + ") or (" + exp2 + ")";
     }
--- a/src/share/classes/javax/management/Query.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/Query.java	Tue May 27 17:18:01 2008 -0700
@@ -979,8 +979,18 @@
          if (query == null)
              return null;
 
-         if (query instanceof ToQueryString)
-             return ((ToQueryString) query).toQueryString();
+         // This is ugly. At one stage we had a non-public class called
+         // ToQueryString with the toQueryString() method, and every class
+         // mentioned here inherited from that class. But that interfered
+         // with serialization of custom subclasses of e.g. QueryEval. Even
+         // though we could make it work by adding a public constructor to this
+         // non-public class, that seemed fragile because according to the
+         // serialization spec it shouldn't work. If only non-public interfaces
+         // could have non-public methods.
+         if (query instanceof ObjectName)
+             return ((ObjectName) query).toQueryString();
+         if (query instanceof QueryEval)
+             return ((QueryEval) query).toQueryString();
 
          return query.toString();
      }
--- a/src/share/classes/javax/management/QueryEval.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/QueryEval.java	Tue May 27 17:18:01 2008 -0700
@@ -25,20 +25,15 @@
 
 package javax.management;
 
-
 // java import
 import java.io.Serializable;
 
-// RI import
-import javax.management.MBeanServer;
-
-
 /**
  * Allows a query to be performed in the context of a specific MBean server.
  *
  * @since 1.5
  */
-public abstract class QueryEval extends ToQueryString implements Serializable {
+public abstract class QueryEval implements Serializable {
 
     /* Serial version */
     private static final long serialVersionUID = 2675899265640874796L;
@@ -80,4 +75,10 @@
     public static MBeanServer getMBeanServer() {
         return server.get();
     }
+
+    // Subclasses in this package can override this method to return a different
+    // string.
+    String toQueryString() {
+        return toString();
+    }
 }
--- a/src/share/classes/javax/management/StandardMBean.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/StandardMBean.java	Tue May 27 17:18:01 2008 -0700
@@ -750,7 +750,7 @@
      * @return the Descriptor for the new MBeanInfo.
      */
     Descriptor getDescriptor(MBeanInfo info, boolean immutableInfo) {
-        ImmutableDescriptor desc = null;
+        ImmutableDescriptor desc;
         if (info == null ||
             info.getDescriptor() == null ||
             info.getDescriptor().getFieldNames().length == 0) {
--- a/src/share/classes/javax/management/loading/MLet.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/loading/MLet.java	Tue May 27 17:18:01 2008 -0700
@@ -591,8 +591,8 @@
              // Instantiate the class specified in the
              // CODE or OBJECT section of the MLet tag
              //
-             Object o = null;
-             ObjectInstance objInst = null;
+             Object o;
+             ObjectInstance objInst;
 
              if (code != null && serName != null) {
                  final String msg =
@@ -1131,11 +1131,17 @@
              return null;
          } finally {
              // Cleanup ...
-             if (tmpFile!=null) try {
-                 tmpFile.delete();
-             } catch (Exception x) {
-                 MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
-                         "getTmpDir", "Failed to delete temporary file", x);
+             if (tmpFile!=null) {
+                 try {
+                     boolean deleted = tmpFile.delete();
+                     if (!deleted) {
+                         MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
+                                 "getTmpDir", "Failed to delete temp file");
+                     }
+                 } catch (Exception x) {
+                     MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
+                             "getTmpDir", "Failed to delete temporary file", x);
+                 }
              }
         }
      }
@@ -1178,25 +1184,8 @@
     * Removes any white space from a string. This is used to
     * convert strings such as "Windows NT" to "WindowsNT".
     */
-     private String removeSpace(String s) {
-         s = s.trim();
-         int j = s.indexOf(' ');
-         if (j == -1) {
-             return s;
-         }
-         String temp = "";
-         int k = 0;
-         while (j != -1) {
-             s = s.substring(k);
-             j = s.indexOf(' ');
-             if (j != -1) {
-                 temp = temp + s.substring(0, j);
-             } else {
-                 temp = temp + s.substring(0);
-             }
-             k = j + 1;
-         }
-         return temp;
+     private static String removeSpace(String s) {
+         return s.trim().replace(" ", "");
      }
 
      /**
--- a/src/share/classes/javax/management/loading/MLetParser.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/loading/MLetParser.java	Tue May 27 17:18:01 2008 -0700
@@ -240,14 +240,12 @@
                                 MLET_LOGGER.logp(Level.FINER,
                                         MLetParser.class.getName(),
                                         mth, requiresCodeWarning);
-                                atts = null;
                                 throw new IOException(requiresCodeWarning);
                             }
                             if (atts.get("archive") == null) {
                                 MLET_LOGGER.logp(Level.FINER,
                                         MLetParser.class.getName(),
                                         mth, requiresJarsWarning);
-                                atts = null;
                                 throw new IOException(requiresJarsWarning);
                             }
                         }
@@ -265,7 +263,7 @@
     public List<MLetContent> parseURL(String urlname) throws IOException {
         // Parse the document
         //
-        URL url = null;
+        URL url;
         if (urlname.indexOf(':') <= 1) {
             String userDir = System.getProperty("user.dir");
             String prot;
--- a/src/share/classes/javax/management/modelmbean/DescriptorSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/DescriptorSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -591,8 +591,6 @@
         Set returnedSet = descriptorMap.entrySet();
 
         int i = 0;
-        Object currValue = null;
-        Map.Entry currElement = null;
 
         if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
             MODELMBEAN_LOGGER.logp(Level.FINEST,
@@ -600,7 +598,7 @@
                     "getFields()", "Returning " + numberOfEntries + " fields");
         }
         for (Iterator iter = returnedSet.iterator(); iter.hasNext(); i++) {
-            currElement = (Map.Entry) iter.next();
+            Map.Entry currElement = (Map.Entry) iter.next();
 
             if (currElement == null) {
                 if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
@@ -609,7 +607,7 @@
                             "getFields()", "Element is null");
                 }
             } else {
-                currValue = currElement.getValue();
+                Object currValue = currElement.getValue();
                 if (currValue == null) {
                     responseFields[i] = currElement.getKey() + "=";
                 } else {
@@ -1127,7 +1125,7 @@
             final char c = entities[i].charAt(0);
             final String entity = entities[i].substring(1);
             charToEntityMap[c] = entity;
-            entityToCharMap.put(entity, new Character(c));
+            entityToCharMap.put(entity, c);
         }
     }
 
@@ -1325,13 +1323,11 @@
     // utility to convert to int, returns -2 if bogus.
 
     private long toNumeric(String inStr) {
-        long result = -2;
         try {
-            result = java.lang.Long.parseLong(inStr);
+            return java.lang.Long.parseLong(inStr);
         } catch (Exception e) {
             return -2;
         }
-        return result;
     }
 
 
--- a/src/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java	Tue May 27 17:18:01 2008 -0700
@@ -432,7 +432,7 @@
          */
         private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
 
-            Descriptor clone = null;
+            Descriptor clone;
             if (in == null) {
                 clone = new DescriptorSupport();
                 MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
--- a/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java	Tue May 27 17:18:01 2008 -0700
@@ -393,7 +393,7 @@
          * @exception RuntimeOperationsException if Descriptor is invalid
          */
         private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
-           Descriptor clone = null;
+           Descriptor clone;
             if (in == null) {
                 clone = new DescriptorSupport();
                 MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
--- a/src/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -944,7 +944,7 @@
      * @exception RuntimeOperationsException if Descriptor is invalid
      */
     private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
-        Descriptor clone = null;
+        Descriptor clone;
         if (in == null) {
             clone = new DescriptorSupport();
             MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
--- a/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java	Tue May 27 17:18:01 2008 -0700
@@ -328,7 +328,7 @@
      * @exception RuntimeOperationsException if Descriptor is invalid
      */
     private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
-        Descriptor clone = null;
+        Descriptor clone;
         if (in == null) {
             clone = new DescriptorSupport();
             MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
--- a/src/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java	Tue May 27 17:18:01 2008 -0700
@@ -424,7 +424,7 @@
          */
         private Descriptor validDescriptor(final Descriptor in)
         throws RuntimeOperationsException {
-            Descriptor clone = null;
+            Descriptor clone;
             if (in == null) {
                 clone = new DescriptorSupport();
                 MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
--- a/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java	Tue May 27 17:18:01 2008 -0700
@@ -1425,9 +1425,7 @@
         }
 
         /* Check attributeDescriptor for getMethod */
-        ModelMBeanAttributeInfo attrInfo=null;
-        Descriptor attrDescr=null;
-        Object response = null;
+        Object response;
 
         try {
             if (modelMBeanInfo == null)
@@ -1435,14 +1433,14 @@
                       "getAttribute failed: ModelMBeanInfo not found for "+
                       attrName);
 
-            attrInfo = modelMBeanInfo.getAttribute(attrName);
+            ModelMBeanAttributeInfo attrInfo = modelMBeanInfo.getAttribute(attrName);
             Descriptor mmbDesc = modelMBeanInfo.getMBeanDescriptor();
 
             if (attrInfo == null)
                 throw new AttributeNotFoundException("getAttribute failed:"+
                       " ModelMBeanAttributeInfo not found for " + attrName);
 
-            attrDescr = attrInfo.getDescriptor();
+            Descriptor attrDescr = attrInfo.getDescriptor();
             if (attrDescr != null) {
                 if (!attrInfo.isReadable())
                     throw new AttributeNotFoundException(
@@ -1684,14 +1682,13 @@
             "getAttributes(String[])","Entry");
         }
 
-        AttributeList responseList = null;
         if (attrNames == null)
             throw new RuntimeOperationsException(new
                 IllegalArgumentException("attributeNames must not be null"),
                 "Exception occurred trying to get attributes of a "+
                 "RequiredModelMBean");
 
-        responseList = new AttributeList();
+        AttributeList responseList = new AttributeList();
         for (int i = 0; i < attrNames.length; i++) {
             try {
                 responseList.add(new Attribute(attrNames[i],
@@ -1833,8 +1830,6 @@
                 throw new AttributeNotFoundException("setAttribute failed: "
                                           + attrName + " is not writable ");
 
-            Object setResponse = null;
-
             String attrSetMethod = (String)
                 (attrDescr.getFieldValue("setMethod"));
             String attrGetMethod = (String)
@@ -1873,9 +1868,9 @@
                 }
                 updateDescriptor = true;
             } else {
-                setResponse = invoke(attrSetMethod,
-                                 (new Object[] {attrValue}),
-                                 (new String[] {attrType}) );
+                invoke(attrSetMethod,
+                       (new Object[] {attrValue}),
+                       (new String[] {attrType}) );
             }
 
             /* change cached value */
@@ -2023,8 +2018,6 @@
     private synchronized void writeToLog(String logFileName,
                                          String logEntry) throws Exception {
 
-        PrintStream logOut = null;
-        FileOutputStream fos = null;
         if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
             MODELMBEAN_LOGGER.logp(Level.FINER,
                     RequiredModelMBean.class.getName(),
@@ -2041,9 +2034,9 @@
             return;
         }
 
+        FileOutputStream fos = new FileOutputStream(logFileName, true);
         try {
-            fos = new FileOutputStream(logFileName, true);
-            logOut = new PrintStream(fos);
+            PrintStream logOut = new PrintStream(fos);
             logOut.println(logEntry);
             logOut.close();
             if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
@@ -2062,6 +2055,8 @@
                         logFileName);
             }
             throw e;
+        } finally {
+            fos.close();
         }
     }
 
--- a/src/share/classes/javax/management/monitor/CounterMonitor.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/monitor/CounterMonitor.java	Tue May 27 17:18:01 2008 -0700
@@ -740,16 +740,16 @@
                 //
                 switch (o.getType()) {
                     case INTEGER:
-                        o.setThreshold(new Integer((int)threshold_value));
+                        o.setThreshold(Integer.valueOf((int)threshold_value));
                         break;
                     case BYTE:
-                        o.setThreshold(new Byte((byte)threshold_value));
+                        o.setThreshold(Byte.valueOf((byte)threshold_value));
                         break;
                     case SHORT:
-                        o.setThreshold(new Short((short)threshold_value));
+                        o.setThreshold(Short.valueOf((short)threshold_value));
                         break;
                     case LONG:
-                        o.setThreshold(new Long(threshold_value));
+                        o.setThreshold(Long.valueOf(threshold_value));
                         break;
                     default:
                         // Should never occur...
@@ -810,10 +810,10 @@
             derived += modulus.longValue();
 
         switch (o.getType()) {
-        case INTEGER: o.setDerivedGauge(new Integer((int) derived)); break;
-        case BYTE: o.setDerivedGauge(new Byte((byte) derived)); break;
-        case SHORT: o.setDerivedGauge(new Short((short) derived)); break;
-        case LONG: o.setDerivedGauge(new Long(derived)); break;
+        case INTEGER: o.setDerivedGauge(Integer.valueOf((int) derived)); break;
+        case BYTE: o.setDerivedGauge(Byte.valueOf((byte) derived)); break;
+        case SHORT: o.setDerivedGauge(Short.valueOf((short) derived)); break;
+        case LONG: o.setDerivedGauge(Long.valueOf(derived)); break;
         default:
             // Should never occur...
             MONITOR_LOGGER.logp(Level.FINEST, CounterMonitor.class.getName(),
--- a/src/share/classes/javax/management/monitor/GaugeMonitor.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/monitor/GaugeMonitor.java	Tue May 27 17:18:01 2008 -0700
@@ -636,28 +636,28 @@
         Number der;
         switch (o.getType()) {
         case INTEGER:
-            der = new Integer(((Integer)scanGauge).intValue() -
-                              ((Integer)prev).intValue());
+            der = Integer.valueOf(((Integer)scanGauge).intValue() -
+                                  ((Integer)prev).intValue());
             break;
         case BYTE:
-            der = new Byte((byte)(((Byte)scanGauge).byteValue() -
-                                  ((Byte)prev).byteValue()));
+            der = Byte.valueOf((byte)(((Byte)scanGauge).byteValue() -
+                                      ((Byte)prev).byteValue()));
             break;
         case SHORT:
-            der = new Short((short)(((Short)scanGauge).shortValue() -
-                                    ((Short)prev).shortValue()));
+            der = Short.valueOf((short)(((Short)scanGauge).shortValue() -
+                                        ((Short)prev).shortValue()));
             break;
         case LONG:
-            der = new Long(((Long)scanGauge).longValue() -
-                           ((Long)prev).longValue());
+            der = Long.valueOf(((Long)scanGauge).longValue() -
+                               ((Long)prev).longValue());
             break;
         case FLOAT:
-            der = new Float(((Float)scanGauge).floatValue() -
-                            ((Float)prev).floatValue());
+            der = Float.valueOf(((Float)scanGauge).floatValue() -
+                                ((Float)prev).floatValue());
             break;
         case DOUBLE:
-            der = new Double(((Double)scanGauge).doubleValue() -
-                             ((Double)prev).doubleValue());
+            der = Double.valueOf(((Double)scanGauge).doubleValue() -
+                                 ((Double)prev).doubleValue());
             break;
         default:
             // Should never occur...
--- a/src/share/classes/javax/management/monitor/Monitor.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/monitor/Monitor.java	Tue May 27 17:18:01 2008 -0700
@@ -367,7 +367,7 @@
     /**
      * Constant used to initialize all the numeric values.
      */
-    static final Integer INTEGER_ZERO = new Integer(0);
+    static final Integer INTEGER_ZERO = 0;
 
 
     /*
@@ -1122,12 +1122,12 @@
      */
     private void monitor(ObservedObject o, int index, int an[]) {
 
-        String attribute = null;
+        String attribute;
         String notifType = null;
         String msg = null;
         Object derGauge = null;
         Object trigger = null;
-        ObjectName object = null;
+        ObjectName object;
         Comparable<?> value = null;
         MonitorNotification alarm = null;
 
@@ -1565,7 +1565,7 @@
         final ThreadGroup group;
         final AtomicInteger threadNumber = new AtomicInteger(1);
         final String namePrefix;
-        final String nameSuffix = "]";
+        static final String nameSuffix = "]";
 
         public DaemonThreadFactory(String poolName) {
             SecurityManager s = System.getSecurityManager();
--- a/src/share/classes/javax/management/openmbean/ArrayType.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/ArrayType.java	Tue May 27 17:18:01 2008 -0700
@@ -726,7 +726,7 @@
             value += dimension;
             value += elementType.hashCode();
             value += Boolean.valueOf(primitiveArray).hashCode();
-            myHashCode = new Integer(value);
+            myHashCode = Integer.valueOf(value);
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/openmbean/CompositeType.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/CompositeType.java	Tue May 27 17:18:01 2008 -0700
@@ -426,7 +426,7 @@
                 value += key.hashCode();
                 value += this.nameToType.get(key).hashCode();
             }
-            myHashCode = new Integer(value);
+            myHashCode = Integer.valueOf(value);
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -769,7 +769,6 @@
                 "array with same dimensions";
             throw new IllegalArgumentException(msg);
         }
-        Class<?> targetComponentClass = targetArrayClass.getComponentType();
         OpenType<?> componentOpenType;
         if (dim == 1)
             componentOpenType = baseType;
--- a/src/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -252,7 +252,7 @@
             int value = 0;
             value += this.getName().hashCode();
             value += Arrays.asList(this.getSignature()).hashCode();
-            myHashCode = new Integer(value);
+            myHashCode = Integer.valueOf(value);
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/openmbean/OpenMBeanInfoSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/OpenMBeanInfoSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -347,7 +347,7 @@
             value += arraySetHash(this.getConstructors());
             value += arraySetHash(this.getOperations());
             value += arraySetHash(this.getNotifications());
-            myHashCode = new Integer(value);
+            myHashCode = Integer.valueOf(value);
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -352,7 +352,7 @@
             value += Arrays.asList(this.getSignature()).hashCode();
             value += this.getReturnOpenType().hashCode();
             value += this.getImpact();
-            myHashCode = new Integer(value);
+            myHashCode = Integer.valueOf(value);
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/openmbean/SimpleType.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/SimpleType.java	Tue May 27 17:18:01 2008 -0700
@@ -257,7 +257,7 @@
         // Calculate the hash code value if it has not yet been done (ie 1st call to hashCode())
         //
         if (myHashCode == null) {
-            myHashCode = new Integer(this.getClassName().hashCode());
+            myHashCode = Integer.valueOf(this.getClassName().hashCode());
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/openmbean/TabularType.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/openmbean/TabularType.java	Tue May 27 17:18:01 2008 -0700
@@ -332,7 +332,7 @@
             for (Iterator k = indexNames.iterator(); k.hasNext();  ) {
                 value += k.next().hashCode();
             }
-            myHashCode = new Integer(value);
+            myHashCode = Integer.valueOf(value);
         }
 
         // return always the same hash code for this instance (immutable)
--- a/src/share/classes/javax/management/relation/RelationNotification.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/relation/RelationNotification.java	Tue May 27 17:18:01 2008 -0700
@@ -369,7 +369,7 @@
      * @return a {@link List} of {@link ObjectName}.
      */
     public List<ObjectName> getMBeansToUnregister() {
-        List<ObjectName> result = null;
+        List<ObjectName> result;
         if (unregisterMBeanList != null) {
             result = new ArrayList<ObjectName>(unregisterMBeanList);
         } else {
@@ -397,7 +397,7 @@
      * @return the old value of the updated role.
      */
     public List<ObjectName> getOldRoleValue() {
-        List<ObjectName> result = null;
+        List<ObjectName> result;
         if (oldRoleValue != null) {
             result = new ArrayList<ObjectName>(oldRoleValue);
         } else {
@@ -412,7 +412,7 @@
      * @return the new value of the updated role.
      */
     public List<ObjectName> getNewRoleValue() {
-        List<ObjectName> result = null;
+        List<ObjectName> result;
         if (newRoleValue != null) {
             result = new ArrayList<ObjectName>(newRoleValue);
         } else {
--- a/src/share/classes/javax/management/relation/RelationService.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/relation/RelationService.java	Tue May 27 17:18:01 2008 -0700
@@ -35,6 +35,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Level;
 
 import javax.management.Attribute;
@@ -122,7 +123,7 @@
     // Internal counter to provide sequence numbers for notifications sent by:
     // - the Relation Service
     // - a relation handled by the Relation Service
-    private Long myNtfSeqNbrCounter = new Long(0);
+    private final AtomicLong atomicSeqNo = new AtomicLong();
 
     // ObjectName used to register the Relation Service in the MBean Server
     private ObjectName myObjName = null;
@@ -256,19 +257,6 @@
         return;
     }
 
-    // Returns internal counter to be used for Sequence Numbers of
-    // notifications to be raised by:
-    // - a relation handled by this Relation Service (when updated)
-    // - the Relation Service
-    private Long getNotificationSequenceNumber() {
-        Long result = null;
-        synchronized(myNtfSeqNbrCounter) {
-            result = new Long(myNtfSeqNbrCounter.longValue() + 1);
-            myNtfSeqNbrCounter = new Long(result.longValue());
-        }
-        return result;
-    }
-
     //
     // Relation type handling
     //
@@ -369,7 +357,7 @@
      * @return ArrayList of relation type names (Strings)
      */
     public List<String> getAllRelationTypeNames() {
-        ArrayList<String> result = null;
+        ArrayList<String> result;
         synchronized(myRelType2ObjMap) {
             result = new ArrayList<String>(myRelType2ObjMap.keySet());
         }
@@ -684,7 +672,7 @@
         // Can throw InstanceNotFoundException (but detected above)
         // No MBeanException as no exception raised by this method, and no
         // ReflectionException
-        String relId = null;
+        String relId;
         try {
             relId = (String)(myMBeanServer.getAttribute(relationObjectName,
                                                         "RelationId"));
@@ -707,7 +695,7 @@
         // Can throw InstanceNotFoundException (but detected above)
         // No MBeanException as no exception raised by this method, no
         // ReflectionException
-        ObjectName relServObjName = null;
+        ObjectName relServObjName;
         try {
             relServObjName = (ObjectName)
                 (myMBeanServer.getAttribute(relationObjectName,
@@ -737,7 +725,7 @@
         // Can throw InstanceNotFoundException (but detected above)
         // No MBeanException as no exception raised by this method, no
         // ReflectionException
-        String relTypeName = null;
+        String relTypeName;
         try {
             relTypeName = (String)(myMBeanServer.getAttribute(relationObjectName,
                                                               "RelationTypeName"));
@@ -758,7 +746,7 @@
         // Can throw InstanceNotFoundException (but detected above)
         // No MBeanException as no exception raised by this method, no
         // ReflectionException
-        RoleList roleList = null;
+        RoleList roleList;
         try {
             roleList = (RoleList)(myMBeanServer.invoke(relationObjectName,
                                                        "retrieveAllRoles",
@@ -912,7 +900,7 @@
      * @return ArrayList of String
      */
     public List<String> getAllRelationIds() {
-        List<String> result = null;
+        List<String> result;
         synchronized(myRelId2ObjMap) {
             result = new ArrayList<String>(myRelId2ObjMap.keySet());
         }
@@ -948,7 +936,7 @@
         RELATION_LOGGER.entering(RelationService.class.getName(),
                 "checkRoleReading", new Object[] {roleName, relationTypeName});
 
-        Integer result = null;
+        Integer result;
 
         // Can throw a RelationTypeNotFoundException
         RelationType relType = getRelationType(relationTypeName);
@@ -965,7 +953,7 @@
                                    false);
 
         } catch (RoleInfoNotFoundException exc) {
-            result = new Integer(RoleStatus.NO_ROLE_WITH_NAME);
+            result = Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
         }
 
         RELATION_LOGGER.exiting(RelationService.class.getName(),
@@ -1021,13 +1009,13 @@
             writeChkFlag = false;
         }
 
-        RoleInfo roleInfo = null;
+        RoleInfo roleInfo;
         try {
             roleInfo = relType.getRoleInfo(roleName);
         } catch (RoleInfoNotFoundException exc) {
             RELATION_LOGGER.exiting(RelationService.class.getName(),
                     "checkRoleWriting");
-            return new Integer(RoleStatus.NO_ROLE_WITH_NAME);
+            return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
         }
 
         Integer result = checkRoleInt(2,
@@ -1436,7 +1424,7 @@
 
         // Relation id to relation type name map
         // First retrieves the relation type name
-        String relTypeName = null;
+        String relTypeName;
         synchronized(myRelId2RelTypeMap) {
             relTypeName = myRelId2RelTypeMap.get(relationId);
             myRelId2RelTypeMap.remove(relationId);
@@ -1641,7 +1629,7 @@
 
                 // List of relation ids of interest regarding the selected
                 // relation type
-                List<String> relIdList = null;
+                List<String> relIdList;
                 if (relationTypeName == null) {
                     // Considers all relations
                     relIdList = new ArrayList<String>(allRelIdSet);
@@ -1655,7 +1643,7 @@
                     for (String currRelId : allRelIdSet) {
 
                         // Retrieves its relation type
-                        String currRelTypeName = null;
+                        String currRelTypeName;
                         synchronized(myRelId2RelTypeMap) {
                             currRelTypeName =
                                 myRelId2RelTypeMap.get(currRelId);
@@ -1952,7 +1940,7 @@
         // Can throw a RelationNotFoundException
         Object relObj = getRelation(relationId);
 
-        RoleResult result = null;
+        RoleResult result;
 
         if (relObj instanceof RelationSupport) {
             // Internal relation
@@ -2022,7 +2010,7 @@
         // Can throw a RelationNotFoundException
         Object relObj = getRelation(relationId);
 
-        RoleResult result = null;
+        RoleResult result;
 
         if (relObj instanceof RelationSupport) {
             // Internal relation
@@ -2073,7 +2061,7 @@
         // Can throw a RelationNotFoundException
         Object relObj = getRelation(relationId);
 
-        Integer result = null;
+        Integer result;
 
         if (relObj instanceof RelationSupport) {
             // Internal relation
@@ -2268,7 +2256,7 @@
         // Can throw a RelationNotFoundException
         Object relObj = getRelation(relationId);
 
-        RoleResult result = null;
+        RoleResult result;
 
         if (relObj instanceof RelationSupport) {
             // Internal relation
@@ -2390,7 +2378,7 @@
         // Can throw a RelationNotFoundException
         Object relObj = getRelation(relationId);
 
-        String result = null;
+        String result;
 
         if (relObj instanceof RelationSupport) {
             // Internal relation
@@ -2473,7 +2461,7 @@
 
                 // Note: do both tests as a relation can be an MBean and be
                 //       itself referenced in another relation :)
-                String relId = null;
+                String relId;
                 synchronized(myRelMBeanObjName2RelIdMap){
                     relId = myRelMBeanObjName2RelIdMap.get(mbeanName);
                 }
@@ -2511,9 +2499,6 @@
         RELATION_LOGGER.entering(RelationService.class.getName(),
                 "getNotificationInfo");
 
-        MBeanNotificationInfo[] ntfInfoArray =
-            new MBeanNotificationInfo[1];
-
         String ntfClass = "javax.management.relation.RelationNotification";
 
         String[] ntfTypes = new String[] {
@@ -2615,7 +2600,7 @@
                 "getRelationType", relationTypeName);
 
         // No null relation type accepted, so can use get()
-        RelationType relType = null;
+        RelationType relType;
         synchronized(myRelType2ObjMap) {
             relType = (myRelType2ObjMap.get(relationTypeName));
         }
@@ -2659,7 +2644,7 @@
                 "getRelation", relationId);
 
         // No null relation  accepted, so can use get()
-        Object rel = null;
+        Object rel;
         synchronized(myRelId2ObjMap) {
             rel = myRelId2ObjMap.get(relationId);
         }
@@ -3077,7 +3062,7 @@
                 // Retrieves corresponding role info
                 // Can throw a RoleInfoNotFoundException to be converted into a
                 // RoleNotFoundException
-                RoleInfo roleInfo = null;
+                RoleInfo roleInfo;
                 try {
                     roleInfo = relType.getRoleInfo(currRoleName);
                 } catch (RoleInfoNotFoundException exc) {
@@ -3227,7 +3212,7 @@
         if (!(roleName.equals(expName))) {
             RELATION_LOGGER.exiting(RelationService.class.getName(),
                     "checkRoleInt");
-            return new Integer(RoleStatus.NO_ROLE_WITH_NAME);
+            return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
         }
 
         // Checks read access if required
@@ -3236,7 +3221,7 @@
             if (!isReadable) {
                 RELATION_LOGGER.exiting(RelationService.class.getName(),
                         "checkRoleInt");
-                return new Integer(RoleStatus.ROLE_NOT_READABLE);
+                return Integer.valueOf(RoleStatus.ROLE_NOT_READABLE);
             } else {
                 // End of check :)
                 RELATION_LOGGER.exiting(RelationService.class.getName(),
@@ -3572,7 +3557,7 @@
         // Relation type name
         // Note: do not use getRelationTypeName() as if it is a relation MBean
         //       it is already unregistered.
-        String relTypeName = null;
+        String relTypeName;
         synchronized(myRelId2RelTypeMap) {
             relTypeName = (myRelId2RelTypeMap.get(relationId));
         }
@@ -3609,7 +3594,7 @@
         }
 
         // Sequence number
-        Long seqNbr = getNotificationSequenceNumber();
+        Long seqNo = atomicSeqNo.incrementAndGet();
 
         // Timestamp
         Date currDate = new Date();
@@ -3625,7 +3610,7 @@
             // Creation or removal
             ntf = new RelationNotification(ntfType,
                                            this,
-                                           seqNbr.longValue(),
+                                           seqNo.longValue(),
                                            timeStamp,
                                            message,
                                            relationId,
@@ -3640,7 +3625,7 @@
                 // Update
                 ntf = new RelationNotification(ntfType,
                                                this,
-                                               seqNbr.longValue(),
+                                               seqNo.longValue(),
                                                timeStamp,
                                                message,
                                                relationId,
@@ -3732,7 +3717,7 @@
             //
             // Shall not throw RelationTypeNotFoundException or
             // RoleInfoNotFoundException
-            RoleInfo currRoleInfo = null;
+            RoleInfo currRoleInfo;
             try {
                 currRoleInfo = getRoleInfo(currRelTypeName,
                                            currRoleName);
--- a/src/share/classes/javax/management/relation/RelationSupport.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/relation/RelationSupport.java	Tue May 27 17:18:01 2008 -0700
@@ -34,6 +34,7 @@
 import java.util.Map;
 import java.util.List;
 
+import java.util.concurrent.atomic.AtomicBoolean;
 import static com.sun.jmx.defaults.JmxProperties.RELATION_LOGGER;
 import static com.sun.jmx.mbeanserver.Util.cast;
 import javax.management.InstanceNotFoundException;
@@ -110,7 +111,7 @@
     private Map<String,Role> myRoleName2ValueMap = new HashMap<String,Role>();
 
     // Flag to indicate if the object has been added in the Relation Service
-    private Boolean myInRelServFlg = null;
+    private final AtomicBoolean myInRelServFlg = new AtomicBoolean();
 
     //
     // Constructors
@@ -403,7 +404,7 @@
                 "getRoleCardinality", roleName);
 
         // Try to retrieve the role
-        Role role = null;
+        Role role;
         synchronized(myRoleName2ValueMap) {
             // No null Role is allowed, so direct use of get()
             role = (myRoleName2ValueMap.get(roleName));
@@ -427,7 +428,7 @@
 
         RELATION_LOGGER.exiting(RelationSupport.class.getName(),
                 "getRoleCardinality");
-        return new Integer(roleValue.size());
+        return roleValue.size();
     }
 
     /**
@@ -701,11 +702,7 @@
      * the Relation Service.
      */
     public Boolean isInRelationService() {
-        Boolean result = null;
-        synchronized(myInRelServFlg) {
-            result = Boolean.valueOf(myInRelServFlg.booleanValue());
-        }
-        return result;
+        return myInRelServFlg.get();
     }
 
     public void setRelationServiceManagementFlag(Boolean flag)
@@ -715,10 +712,7 @@
             String excMsg = "Invalid parameter.";
             throw new IllegalArgumentException(excMsg);
         }
-        synchronized(myInRelServFlg) {
-            myInRelServFlg = Boolean.valueOf(flag.booleanValue());
-        }
-        return;
+        myInRelServFlg.set(flag);
     }
 
     //
@@ -790,7 +784,7 @@
 
         int pbType = 0;
 
-        Role role = null;
+        Role role;
         synchronized(myRoleName2ValueMap) {
             // No null Role is allowed, so direct use of get()
             role = (myRoleName2ValueMap.get(roleName));
@@ -801,7 +795,7 @@
 
         } else {
             // Checks if the role is readable
-            Integer status = null;
+            Integer status;
 
             if (relationServCallFlg) {
 
@@ -851,7 +845,7 @@
             pbType = status.intValue();
         }
 
-        Object result = null;
+        Object result;
 
         if (pbType == 0) {
             // Role can be retrieved
@@ -937,7 +931,7 @@
         for (int i = 0; i < roleNameArray.length; i++) {
             String currRoleName = roleNameArray[i];
 
-            Object currResult = null;
+            Object currResult;
 
             // Can throw RelationServiceNotRegisteredException
             //
@@ -1102,13 +1096,13 @@
         // handle initialization of role when creating the relation
         // (roles provided in the RoleList parameter are directly set but
         // roles automatically initialized are set using setRole())
-        Role role = null;
+        Role role;
         synchronized(myRoleName2ValueMap) {
             role = (myRoleName2ValueMap.get(roleName));
         }
 
         List<ObjectName> oldRoleValue;
-        Boolean initFlg = null;
+        Boolean initFlg;
 
         if (role == null) {
             initFlg = true;
@@ -1122,7 +1116,7 @@
         // Checks if the role can be set: is writable (except if
         // initialization) and correct value
         try {
-            Integer status = null;
+            Integer status;
 
             if (relationServCallFlg) {
 
@@ -1314,7 +1308,7 @@
             Object[] params = new Object[3];
             params[0] = myRelId;
             params[1] = newRole;
-            params[2] = ((ArrayList)oldRoleValue);
+            params[2] = oldRoleValue;
             String[] signature = new String[3];
             signature[0] = "java.lang.String";
             signature[1] = "javax.management.relation.Role";
@@ -1598,7 +1592,6 @@
         myRelTypeName = relationTypeName;
         // Can throw InvalidRoleValueException
         initRoleMap(list);
-        myInRelServFlg = Boolean.FALSE;
 
         RELATION_LOGGER.exiting(RelationSupport.class.getName(), "initMembers");
         return;
@@ -1710,7 +1703,7 @@
                 roleName, relationServCallFlg, relationServ});
 
         // Retrieves current role value
-        Role role = null;
+        Role role;
         synchronized(myRoleName2ValueMap) {
             role = (myRoleName2ValueMap.get(roleName));
         }
--- a/src/share/classes/javax/management/remote/JMXConnectorFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/remote/JMXConnectorFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -435,7 +435,7 @@
 
         Iterator<JMXConnectorProvider> providers =
                 getProviderIterator(JMXConnectorProvider.class, loader);
-        JMXConnector connection = null;
+        JMXConnector connection;
         IOException exception = null;
         while(providers.hasNext()) {
             try {
@@ -450,7 +450,7 @@
                                  "] Service provider exception: " + e);
                 if (!(e instanceof MalformedURLException)) {
                     if (exception == null) {
-                        if (exception instanceof IOException) {
+                        if (e instanceof IOException) {
                             exception = (IOException) e;
                         } else {
                             exception = EnvHelp.initCause(
--- a/src/share/classes/javax/management/remote/JMXConnectorServerFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/remote/JMXConnectorServerFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -215,12 +215,10 @@
                 JMXConnectorFactory.
                 getProviderIterator(JMXConnectorServerProvider.class, loader);
 
-        JMXConnectorServer connection = null;
         IOException exception = null;
         while (providers.hasNext()) {
             try {
-                connection = providers.next().newJMXConnectorServer(url, map, mbs);
-                return connection;
+                return providers.next().newJMXConnectorServer(url, map, mbs);
             } catch (JMXProviderException e) {
                 throw e;
             } catch (Exception e) {
@@ -230,7 +228,7 @@
                                  "] Service provider exception: " + e);
                 if (!(e instanceof MalformedURLException)) {
                     if (exception == null) {
-                        if (exception instanceof IOException) {
+                        if (e instanceof IOException) {
                             exception = (IOException) e;
                         } else {
                             exception = EnvHelp.initCause(
--- a/src/share/classes/javax/management/remote/JMXServiceURL.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/remote/JMXServiceURL.java	Tue May 27 17:18:01 2008 -0700
@@ -162,8 +162,6 @@
                                             requiredPrefix);
         }
 
-        int[] ptr = new int[1];
-
         // Parse the protocol name
         final int protoStart = requiredPrefixLength;
         final int protoEnd = indexOf(serviceURL, ':', protoStart);
@@ -664,11 +662,6 @@
         hostNameBitSet.set('.');
     }
 
-    private static void addCharsToBitSet(BitSet set, String chars) {
-        for (int i = 0; i < chars.length(); i++)
-            set.set(chars.charAt(i));
-    }
-
     /**
      * The value returned by {@link #getProtocol()}.
      */
--- a/src/share/classes/javax/management/remote/rmi/RMIConnector.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnector.java	Tue May 27 17:18:01 2008 -0700
@@ -1376,12 +1376,12 @@
 
         protected Integer addListenerForMBeanRemovedNotif()
                 throws IOException, InstanceNotFoundException {
-            MarshalledObject<NotificationFilter> sFilter = null;
             NotificationFilterSupport clientFilter =
                 new NotificationFilterSupport();
             clientFilter.enableType(
                 MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
-            sFilter = new MarshalledObject<NotificationFilter>(clientFilter);
+            MarshalledObject<NotificationFilter> sFilter =
+                new MarshalledObject<NotificationFilter>(clientFilter);
 
             Integer[] listenerIDs;
             final ObjectName[] names =
@@ -1434,7 +1434,7 @@
                                               connectionId,
                                               clientNotifCounter++,
                                               message,
-                                              new Long(number));
+                                              Long.valueOf(number));
             sendNotification(n);
         }
     }
@@ -1593,7 +1593,7 @@
 
         protected void doStart() throws IOException {
             // Get RMIServer stub from directory or URL encoding if needed.
-            RMIServer stub = null;
+            RMIServer stub;
             try {
                 stub = (rmiServer!=null)?rmiServer:
                     findRMIServer(jmxServiceURL, env);
@@ -2532,7 +2532,7 @@
      * A static WeakReference to an {@link org.omg.CORBA.ORB ORB} to
      * connect unconnected stubs.
      **/
-    private static WeakReference<ORB> orb = null;
+    private static volatile WeakReference<ORB> orb = null;
 
     // TRACES & DEBUG
     //---------------
--- a/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java	Tue May 27 17:18:01 2008 -0700
@@ -365,7 +365,7 @@
                 // Access file property specified, create an instance
                 // of the MBeanServerFileAccessController class
                 //
-                MBeanServerForwarder mbsf = null;
+                MBeanServerForwarder mbsf;
                 try {
                     mbsf = new MBeanServerFileAccessController(accessFile);
                 } catch (IOException e) {
--- a/src/share/classes/javax/management/timer/Timer.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/management/timer/Timer.java	Tue May 27 17:18:01 2008 -0700
@@ -344,13 +344,11 @@
         //
         if (isActive == true) {
 
-            TimerAlarmClock alarmClock;
-
             for (Object[] obj : timerTable.values()) {
 
                 // Stop all the TimerAlarmClock.
                 //
-                alarmClock = (TimerAlarmClock)obj[ALARM_CLOCK_INDEX];
+                TimerAlarmClock alarmClock = (TimerAlarmClock)obj[ALARM_CLOCK_INDEX];
                 if (alarmClock != null) {
 //                     alarmClock.interrupt();
 //                     try {
@@ -364,7 +362,6 @@
 //                     //
 
                     alarmClock.cancel();
-                    alarmClock = null;
                 }
             }
 
@@ -458,8 +455,7 @@
 
         // Create and add the timer notification into the timer table.
         //
-        Integer notifID = null;
-        notifID = new Integer(++counterID);
+        Integer notifID = Integer.valueOf(++counterID);
 
         // The sequenceNumber and the timeStamp attributes are updated
         // when the notification is emitted by the timer.
@@ -486,8 +482,8 @@
 
         obj[TIMER_NOTIF_INDEX] = (Object)notif;
         obj[TIMER_DATE_INDEX] = (Object)d;
-        obj[TIMER_PERIOD_INDEX] = (Object) new Long(period);
-        obj[TIMER_NB_OCCUR_INDEX] = (Object) new Long(nbOccurences);
+        obj[TIMER_PERIOD_INDEX] = (Object) period;
+        obj[TIMER_NB_OCCUR_INDEX] = (Object) nbOccurences;
         obj[ALARM_CLOCK_INDEX] = (Object)alarmClock;
         obj[FIXED_RATE_INDEX] = Boolean.valueOf(fixedRate);
 
@@ -678,7 +674,6 @@
 //             // Remove the reference on the TimerAlarmClock.
 //             //
             alarmClock.cancel();
-            alarmClock = null;
         }
 
         // Remove the timer notification from the timer table.
@@ -755,7 +750,6 @@
                   //
 //             }
             alarmClock.cancel();
-            alarmClock = null;
         }
 
         // Remove all the timer notifications from the timer table.
@@ -906,8 +900,7 @@
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
-            Long period = (Long)obj[TIMER_PERIOD_INDEX];
-            return (new Long(period.longValue()));
+            return (Long)obj[TIMER_PERIOD_INDEX];
         }
         return null;
     }
@@ -924,8 +917,7 @@
 
         Object[] obj = timerTable.get(id);
         if (obj != null) {
-            Long nbOccurences = (Long)obj[TIMER_NB_OCCUR_INDEX];
-            return (new Long(nbOccurences.longValue()));
+            return (Long)obj[TIMER_NB_OCCUR_INDEX];
         }
         return null;
     }
@@ -1096,7 +1088,7 @@
             if ((nbOccurences.longValue() == 0) || (nbOccurences.longValue() > 1)) {
 
                 date.setTime(date.getTime() + period.longValue());
-                obj[TIMER_NB_OCCUR_INDEX] = new Long(java.lang.Math.max(0L, (nbOccurences.longValue() - 1)));
+                obj[TIMER_NB_OCCUR_INDEX] = Long.valueOf(java.lang.Math.max(0L, (nbOccurences.longValue() - 1)));
                 nbOccurences = (Long)obj[TIMER_NB_OCCUR_INDEX];
 
                 if (isActive == true) {
@@ -1146,9 +1138,6 @@
 //                         // Ignore...
 //                     }
                     alarmClock.cancel();
-                    // Remove the reference on the TimerAlarmClock.
-                    //
-                    alarmClock = null;
                 }
                 timerTable.remove(notifID);
             }
@@ -1165,10 +1154,6 @@
 //                 }
 
                    alarmClock.cancel();
-
-                // Remove the reference on the TimerAlarmClock.
-                //
-                alarmClock = null;
             }
             timerTable.remove(notifID);
         }
--- a/src/share/classes/javax/net/ssl/SSLContext.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/net/ssl/SSLContext.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -134,6 +134,7 @@
      * @exception NoSuchAlgorithmException if no Provider supports a
      *          TrustManagerFactorySpi implementation for the
      *          specified protocol.
+     * @exception NullPointerException if protocol is null.
      *
      * @see java.security.Provider
      */
@@ -175,6 +176,7 @@
      *          registered in the security provider list.
      *
      * @throws IllegalArgumentException if the provider name is null or empty.
+     * @throws NullPointerException if protocol is null.
      *
      * @see java.security.Provider
      */
@@ -210,6 +212,7 @@
      *          from the specified Provider object.
      *
      * @throws IllegalArgumentException if the provider name is null.
+     * @throws NullPointerException if protocol is null.
      *
      * @see java.security.Provider
      */
--- a/src/share/classes/javax/net/ssl/SSLSocket.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/net/ssl/SSLSocket.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc.  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
@@ -212,8 +212,10 @@
      * @param host name of the host with which to connect, or
      *        <code>null</code> for the loopback address.
      * @param port number of the server's port
-     * @param clientAddress the client's host
-     * @param clientPort number of the client's port
+     * @param clientAddress the client's address the socket is bound to, or
+     *        <code>null</code> for the <code>anyLocal</code> address.
+     * @param clientPort the client's port the socket is bound to, or
+     *        <code>zero</code> for a system selected free port.
      * @throws IOException if an I/O error occurs when creating the socket
      * @throws SecurityException if a security manager exists and its
      *         <code>checkConnect</code> method doesn't allow the operation.
@@ -241,8 +243,10 @@
      *
      * @param address the server's host
      * @param port its port
-     * @param clientAddress the client's host
-     * @param clientPort number of the client's port
+     * @param clientAddress the client's address the socket is bound to, or
+     *        <code>null</code> for the <code>anyLocal</code> address.
+     * @param clientPort the client's port the socket is bound to, or
+     *        <code>zero</code> for a system selected free port.
      * @throws IOException if an I/O error occurs when creating the socket
      * @throws SecurityException if a security manager exists and its
      *         <code>checkConnect</code> method doesn't allow the operation.
--- a/src/share/classes/javax/net/ssl/TrustManagerFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/net/ssl/TrustManagerFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -129,6 +129,7 @@
      * @exception NoSuchAlgorithmException if no Provider supports a
      *          TrustManagerFactorySpi implementation for the
      *          specified algorithm.
+     * @exception NullPointerException if algorithm is null.
      *
      * @see java.security.Provider
      */
@@ -171,6 +172,7 @@
      *          registered in the security provider list.
      *
      * @throws IllegalArgumentException if the provider name is null or empty.
+     * @throws NullPointerException if algorithm is null.
      *
      * @see java.security.Provider
      */
@@ -208,6 +210,7 @@
      *          from the specified Provider object.
      *
      * @throws IllegalArgumentException if the provider is null.
+     * @throws NullPointerException if algorithm is null.
      *
      * @see java.security.Provider
      */
@@ -274,6 +277,8 @@
     /**
      * Returns one trust manager for each type of trust material.
      *
+     * @throws IllegalStateException if the factory is not initialized.
+     *
      * @return the trust managers
      */
     public final TrustManager[] getTrustManagers() {
--- a/src/share/classes/javax/net/ssl/TrustManagerFactorySpi.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/net/ssl/TrustManagerFactorySpi.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc.  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
@@ -74,6 +74,8 @@
     /**
      * Returns one trust manager for each type of trust material.
      *
+     * @throws IllegalStateException if the factory is not initialized.
+     *
      * @return the trust managers
      */
     protected abstract TrustManager[] engineGetTrustManagers();
--- a/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  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
@@ -253,7 +253,24 @@
                          Date endTime,
                          Date renewTill,
                          InetAddress[] clientAddresses) {
+        if (sessionKey == null)
+           throw new IllegalArgumentException("Session key for ticket"
+                                              + " cannot be null");
+        init(asn1Encoding, client, server,
+             new KeyImpl(sessionKey, keyType), flags, authTime,
+             startTime, endTime, renewTill, clientAddresses);
+    }
 
+    private void init(byte[] asn1Encoding,
+                         KerberosPrincipal client,
+                         KerberosPrincipal server,
+                         KeyImpl sessionKey,
+                         boolean[] flags,
+                         Date authTime,
+                         Date startTime,
+                         Date endTime,
+                         Date renewTill,
+                         InetAddress[] clientAddresses) {
         if (asn1Encoding == null)
            throw new IllegalArgumentException("ASN.1 encoding of ticket"
                                               + " cannot be null");
@@ -269,10 +286,8 @@
                                               + " cannot be null");
         this.server = server;
 
-        if (sessionKey == null)
-           throw new IllegalArgumentException("Session key for ticket"
-                                              + " cannot be null");
-        this.sessionKey = new KeyImpl(sessionKey, keyType);
+        // Caller needs to make sure `sessionKey` will not be null
+        this.sessionKey = sessionKey;
 
         if (flags != null) {
            if (flags.length >= NUM_FLAGS)
@@ -291,17 +306,22 @@
                 throw new IllegalArgumentException("The renewable period "
                        + "end time cannot be null for renewable tickets.");
 
-           this.renewTill = renewTill;
+           this.renewTill = new Date(renewTill.getTime());
         }
 
-        this.authTime = authTime;
-
-        this.startTime = (startTime != null? startTime: authTime);
+        if (authTime != null) {
+            this.authTime = new Date(authTime.getTime());
+        }
+        if (startTime != null) {
+            this.startTime = new Date(startTime.getTime());
+        } else {
+            this.startTime = this.authTime;
+        }
 
         if (endTime == null)
            throw new IllegalArgumentException("End time for ticket validity"
                                               + " cannot be null");
-        this.endTime = endTime;
+        this.endTime = new Date(endTime.getTime());
 
         if (clientAddresses != null)
            this.clientAddresses = clientAddresses.clone();
@@ -440,7 +460,7 @@
      *         or null if not set.
      */
     public final java.util.Date getAuthTime() {
-        return (authTime == null) ? null : new Date(authTime.getTime());
+        return (authTime == null) ? null : (Date)authTime.clone();
     }
 
     /**
@@ -450,7 +470,7 @@
      *         or null if not set.
      */
     public final java.util.Date getStartTime() {
-        return (startTime == null) ? null : new Date(startTime.getTime());
+        return (startTime == null) ? null : (Date)startTime.clone();
     }
 
     /**
@@ -459,7 +479,7 @@
      * @return the expiration time for this ticket's validity period.
      */
     public final java.util.Date getEndTime() {
-        return endTime;
+        return (Date) endTime.clone();
     }
 
     /**
@@ -469,7 +489,7 @@
      * @return the latest expiration time for this ticket.
      */
     public final java.util.Date getRenewTill() {
-        return (renewTill == null) ? null: new Date(renewTill.getTime());
+        return (renewTill == null) ? null: (Date)renewTill.clone();
     }
 
     /**
@@ -745,4 +765,20 @@
 
         return true;
     }
+
+    private void readObject(ObjectInputStream s)
+        throws IOException, ClassNotFoundException {
+        s.defaultReadObject();
+        if (sessionKey == null) {
+           throw new InvalidObjectException("Session key cannot be null");
+        }
+        try {
+            init(asn1Encoding, client, server, sessionKey,
+                 flags, authTime, startTime, endTime,
+                 renewTill, clientAddresses);
+        } catch (IllegalArgumentException iae) {
+            throw (InvalidObjectException)
+                new InvalidObjectException(iae.getMessage()).initCause(iae);
+        }
+    }
 }
--- a/src/share/classes/sun/misc/URLClassPath.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/misc/URLClassPath.java	Tue May 27 17:18:01 2008 -0700
@@ -961,6 +961,7 @@
      * from a file URL that refers to a directory.
      */
     private static class FileLoader extends Loader {
+        /* Canonicalized File */
         private File dir;
 
         FileLoader(URL url) throws IOException {
@@ -970,7 +971,7 @@
             }
             String path = url.getFile().replace('/', File.separatorChar);
             path = ParseUtil.decode(path);
-            dir = new File(path);
+            dir = (new File(path)).getCanonicalFile();
         }
 
         /*
@@ -997,8 +998,19 @@
 
                 if (check)
                     URLClassPath.check(url);
-                final File file =
-                    new File(dir, name.replace('/', File.separatorChar));
+
+                final File file;
+                if (name.indexOf("..") != -1) {
+                    file = (new File(dir, name.replace('/', File.separatorChar)))
+                          .getCanonicalFile();
+                    if ( !((file.getPath()).startsWith(dir.getPath())) ) {
+                        /* outside of base dir */
+                        return null;
+                    }
+                } else {
+                    file = new File(dir, name.replace('/', File.separatorChar));
+                }
+
                 if (file.exists()) {
                     return new Resource() {
                         public String getName() { return name; };
--- a/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Tue May 27 17:18:01 2008 -0700
@@ -36,6 +36,7 @@
 import sun.net.www.HeaderParser;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import static sun.net.www.protocol.http.HttpURLConnection.HTTP_CONNECT;
 
 
 /**
@@ -210,10 +211,38 @@
 
     /**
      * Reclaculates the request-digest and returns it.
+     *
+     * <P> Used in the common case where the requestURI is simply the
+     * abs_path.
+     *
+     * @param  url
+     *         the URL
+     *
+     * @param  method
+     *         the HTTP method
+     *
      * @return the value of the HTTP header this authentication wants set
      */
     String getHeaderValue(URL url, String method) {
-        return getHeaderValueImpl (url.getFile(), method);
+        return getHeaderValueImpl(url.getFile(), method);
+    }
+
+    /**
+     * Reclaculates the request-digest and returns it.
+     *
+     * <P> Used when the requestURI is not the abs_path. The exact
+     * requestURI can be passed as a String.
+     *
+     * @param  requestURI
+     *         the Request-URI from the HTTP request line
+     *
+     * @param  method
+     *         the HTTP method
+     *
+     * @return the value of the HTTP header this authentication wants set
+     */
+    String getHeaderValue(String requestURI, String method) {
+        return getHeaderValueImpl(requestURI, method);
     }
 
     /**
@@ -249,7 +278,16 @@
         params.setOpaque (p.findValue("opaque"));
         params.setQop (p.findValue("qop"));
 
-        String uri = conn.getURL().getFile();
+        String uri;
+        String method;
+        if (type == PROXY_AUTHENTICATION &&
+                conn.tunnelState() == HttpURLConnection.TunnelState.SETUP) {
+            uri = HttpURLConnection.connectRequestURI(conn.getURL());
+            method = HTTP_CONNECT;
+        } else {
+            uri = conn.getURL().getFile();
+            method = conn.getMethod();
+        }
 
         if (params.nonce == null || authMethod == null || pw == null || realm == null) {
             return false;
@@ -275,7 +313,7 @@
             params.setNewCnonce();
         }
 
-        String value = getHeaderValueImpl (uri, conn.getMethod());
+        String value = getHeaderValueImpl (uri, method);
         if (value != null) {
             conn.setAuthenticationProperty(getHeaderName(), value);
             return true;
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Tue May 27 17:18:01 2008 -0700
@@ -75,6 +75,8 @@
 
     private static Logger logger = Logger.getLogger("sun.net.www.protocol.http.HttpURLConnection");
 
+    static String HTTP_CONNECT = "CONNECT";
+
     static final String version;
     public static final String userAgent;
 
@@ -266,6 +268,20 @@
     /* If we decide we want to reuse a client, we put it here */
     private HttpClient reuseClient = null;
 
+    /* Tunnel states */
+    enum TunnelState {
+        /* No tunnel */
+        NONE,
+
+        /* Setting up a tunnel */
+        SETUP,
+
+        /* Tunnel has been successfully setup */
+        TUNNELING
+    }
+
+    private TunnelState tunnelState = TunnelState.NONE;
+
     /* Redefine timeouts from java.net.URLConnection as we nee -1 to mean
      * not set. This is to ensure backward compatibility.
      */
@@ -338,7 +354,7 @@
          * others that have been set
          */
         // send any pre-emptive authentication
-        if (http.usingProxy) {
+        if (http.usingProxy && tunnelState() != TunnelState.TUNNELING) {
             setPreemptiveProxyAuthentication(requests);
         }
         if (!setRequests) {
@@ -1404,11 +1420,17 @@
             String raw = auth.raw();
             if (proxyAuthentication.isAuthorizationStale (raw)) {
                 /* we can retry with the current credentials */
-                requests.set (proxyAuthentication.getHeaderName(),
-                              proxyAuthentication.getHeaderValue(
-                                                     url, method));
+                String value;
+                if (tunnelState() == TunnelState.SETUP &&
+                      proxyAuthentication instanceof DigestAuthentication) {
+                    value = ((DigestAuthentication)proxyAuthentication)
+                            .getHeaderValue(connectRequestURI(url), HTTP_CONNECT);
+                } else {
+                    value = proxyAuthentication.getHeaderValue(url, method);
+                }
+                requests.set(proxyAuthentication.getHeaderName(), value);
                 currentProxyCredentials = proxyAuthentication;
-                return  proxyAuthentication;
+                return proxyAuthentication;
             } else {
                 proxyAuthentication.removeFromCache();
             }
@@ -1419,6 +1441,24 @@
     }
 
     /**
+     * Returns the tunnel state.
+     *
+     * @return  the state
+     */
+    TunnelState tunnelState() {
+        return tunnelState;
+    }
+
+    /**
+     * Set the tunneling status.
+     *
+     * @param  the state
+     */
+    void setTunnelState(TunnelState tunnelState) {
+        this.tunnelState = tunnelState;
+    }
+
+    /**
      * establish a tunnel through proxy server
      */
     public synchronized void doTunneling() throws IOException {
@@ -1437,6 +1477,9 @@
         boolean inNegotiateProxy = false;
 
         try {
+            /* Actively setting up a tunnel */
+            setTunnelState(TunnelState.SETUP);
+
             do {
                 if (!checkReuseConnection()) {
                     proxiedConnect(url, proxyHost, proxyPort, false);
@@ -1450,6 +1493,9 @@
                 // so ProgressSource is null.
                 http.parseHTTP(responses, null, this);
 
+                /* Log the response to the CONNECT */
+                logger.fine(responses.toString());
+
                 statusLine = responses.getValue(0);
                 StringTokenizer st = new StringTokenizer(statusLine);
                 st.nextToken();
@@ -1509,11 +1555,13 @@
                 }
 
                 if (respCode == HTTP_OK) {
+                    setTunnelState(TunnelState.TUNNELING);
                     break;
                 }
                 // we don't know how to deal with other response code
                 // so disconnect and report error
                 disconnectInternal();
+                setTunnelState(TunnelState.NONE);
                 break;
             } while (retryTunnel < maxRedirects);
 
@@ -1535,6 +1583,14 @@
         responses.reset();
     }
 
+    static String connectRequestURI(URL url) {
+        String host = url.getHost();
+        int port = url.getPort();
+        port = port != -1 ? port : url.getDefaultPort();
+
+        return host + ":" + port;
+    }
+
     /**
      * send a CONNECT request for establishing a tunnel to proxy server
      */
@@ -1548,8 +1604,7 @@
         // otherwise, there may have 2 http methods in headers
         if (setRequests) requests.set(0, null, null);
 
-        requests.prepend("CONNECT " + url.getHost() + ":"
-                         + (port != -1 ? port : url.getDefaultPort())
+        requests.prepend(HTTP_CONNECT + " " + connectRequestURI(url)
                          + " " + httpVersion, null);
         requests.setIfNotSet("User-Agent", userAgent);
 
@@ -1563,6 +1618,10 @@
         requests.setIfNotSet("Accept", acceptString);
 
         setPreemptiveProxyAuthentication(requests);
+
+         /* Log the CONNECT request */
+        logger.fine(requests.toString());
+
         http.writeRequests(requests, null);
         // remove CONNECT header
         requests.set(0, null, null);
@@ -1576,9 +1635,17 @@
             = AuthenticationInfo.getProxyAuth(http.getProxyHostUsed(),
                                               http.getProxyPortUsed());
         if (pauth != null && pauth.supportsPreemptiveAuthorization()) {
+            String value;
+            if (tunnelState() == TunnelState.SETUP &&
+                    pauth instanceof DigestAuthentication) {
+                value = ((DigestAuthentication)pauth)
+                        .getHeaderValue(connectRequestURI(url), HTTP_CONNECT);
+            } else {
+                value = pauth.getHeaderValue(url, method);
+            }
+
             // Sets "Proxy-authorization"
-            requests.set(pauth.getHeaderName(),
-                                 pauth.getHeaderValue(url,method));
+            requests.set(pauth.getHeaderName(), value);
             currentProxyCredentials = pauth;
         }
     }
--- a/src/share/classes/sun/net/www/protocol/http/InMemoryCookieStore.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/net/www/protocol/http/InMemoryCookieStore.java	Tue May 27 17:18:01 2008 -0700
@@ -35,7 +35,6 @@
 import java.util.HashMap;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.Comparator;
 import java.util.concurrent.locks.ReentrantLock;
 
 /**
@@ -89,7 +88,9 @@
             if (cookie.getMaxAge() != 0) {
                 cookieJar.add(cookie);
                 // and add it to domain index
-                addIndex(domainIndex, cookie.getDomain(), cookie);
+                if (cookie.getDomain() != null) {
+                    addIndex(domainIndex, cookie.getDomain(), cookie);
+                }
                 // add it to uri index, too
                 addIndex(uriIndex, getEffectiveURI(uri), cookie);
             }
@@ -113,12 +114,13 @@
         }
 
         List<HttpCookie> cookies = new ArrayList<HttpCookie>();
+        boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
         lock.lock();
         try {
             // check domainIndex first
-            getInternal(cookies, domainIndex, new DomainComparator(uri.getHost()));
+            getInternal1(cookies, domainIndex, uri.getHost(), secureLink);
             // check uriIndex then
-            getInternal(cookies, uriIndex, getEffectiveURI(uri));
+            getInternal2(cookies, uriIndex, getEffectiveURI(uri), secureLink);
         } finally {
             lock.unlock();
         }
@@ -217,19 +219,96 @@
     /* ---------------- Private operations -------------- */
 
 
-    static class DomainComparator implements Comparable<String> {
-        String host = null;
-
-        public DomainComparator(String host) {
-            this.host = host;
+    /*
+     * This is almost the same as HttpCookie.domainMatches except for
+     * one difference: It won't reject cookies when the 'H' part of the
+     * domain contains a dot ('.').
+     * I.E.: RFC 2965 section 3.3.2 says that if host is x.y.domain.com
+     * and the cookie domain is .domain.com, then it should be rejected.
+     * However that's not how the real world works. Browsers don't reject and
+     * some sites, like yahoo.com do actually expect these cookies to be
+     * passed along.
+     * And should be used for 'old' style cookies (aka Netscape type of cookies)
+     */
+    private boolean netscapeDomainMatches(String domain, String host)
+    {
+        if (domain == null || host == null) {
+            return false;
         }
 
-        public int compareTo(String domain) {
-            if (HttpCookie.domainMatches(domain, host)) {
-                return 0;
-            } else {
-                return -1;
+        // if there's no embedded dot in domain and domain is not .local
+        boolean isLocalDomain = ".local".equalsIgnoreCase(domain);
+        int embeddedDotInDomain = domain.indexOf('.');
+        if (embeddedDotInDomain == 0) {
+            embeddedDotInDomain = domain.indexOf('.', 1);
+        }
+        if (!isLocalDomain && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1)) {
+            return false;
+        }
+
+        // if the host name contains no dot and the domain name is .local
+        int firstDotInHost = host.indexOf('.');
+        if (firstDotInHost == -1 && isLocalDomain) {
+            return true;
+        }
+
+        int domainLength = domain.length();
+        int lengthDiff = host.length() - domainLength;
+        if (lengthDiff == 0) {
+            // if the host name and the domain name are just string-compare euqal
+            return host.equalsIgnoreCase(domain);
+        } else if (lengthDiff > 0) {
+            // need to check H & D component
+            String H = host.substring(0, lengthDiff);
+            String D = host.substring(lengthDiff);
+
+            return (D.equalsIgnoreCase(domain));
+        } else if (lengthDiff == -1) {
+            // if domain is actually .host
+            return (domain.charAt(0) == '.' &&
+                    host.equalsIgnoreCase(domain.substring(1)));
+        }
+
+        return false;
+    }
+
+    private void getInternal1(List<HttpCookie> cookies, Map<String, List<HttpCookie>> cookieIndex,
+            String host, boolean secureLink) {
+        // Use a separate list to handle cookies that need to be removed so
+        // that there is no conflict with iterators.
+        ArrayList<HttpCookie> toRemove = new ArrayList<HttpCookie>();
+        for (Map.Entry<String, List<HttpCookie>> entry : cookieIndex.entrySet()) {
+            String domain = entry.getKey();
+            List<HttpCookie> lst = entry.getValue();
+            for (HttpCookie c : lst) {
+                if ((c.getVersion() == 0 && netscapeDomainMatches(domain, host)) ||
+                        (c.getVersion() == 1 && HttpCookie.domainMatches(domain, host))) {
+                    if ((cookieJar.indexOf(c) != -1)) {
+                        // the cookie still in main cookie store
+                        if (!c.hasExpired()) {
+                            // don't add twice and make sure it's the proper
+                            // security level
+                            if ((secureLink || !c.getSecure()) &&
+                                    !cookies.contains(c)) {
+                                cookies.add(c);
+                            }
+                        } else {
+                            toRemove.add(c);
+                        }
+                    } else {
+                        // the cookie has beed removed from main store,
+                        // so also remove it from domain indexed store
+                        toRemove.add(c);
+                    }
+                }
             }
+            // Clear up the cookies that need to be removed
+            for (HttpCookie c : toRemove) {
+                lst.remove(c);
+                cookieJar.remove(c);
+
+            }
+            toRemove.clear();
         }
     }
 
@@ -237,9 +316,9 @@
     // @param cookieIndex       the index
     // @param comparator        the prediction to decide whether or not
     //                          a cookie in index should be returned
-    private <T> void getInternal(List<HttpCookie> cookies,
+    private <T> void getInternal2(List<HttpCookie> cookies,
                                 Map<T, List<HttpCookie>> cookieIndex,
-                                Comparable<T> comparator)
+                                Comparable<T> comparator, boolean secureLink)
     {
         for (T index : cookieIndex.keySet()) {
             if (comparator.compareTo(index) == 0) {
@@ -253,7 +332,8 @@
                             // the cookie still in main cookie store
                             if (!ck.hasExpired()) {
                                 // don't add twice
-                                if (!cookies.contains(ck))
+                                if ((secureLink || !ck.getSecure()) &&
+                                        !cookies.contains(ck))
                                     cookies.add(ck);
                             } else {
                                 it.remove();
@@ -292,14 +372,14 @@
 
 
     //
-    // for cookie purpose, the effective uri should only be scheme://authority
+    // for cookie purpose, the effective uri should only be http://host
     // the path will be taken into account when path-match algorithm applied
     //
     private URI getEffectiveURI(URI uri) {
         URI effectiveURI = null;
         try {
-            effectiveURI = new URI(uri.getScheme(),
-                                   uri.getAuthority(),
+            effectiveURI = new URI("http",
+                                   uri.getHost(),
                                    null,  // path component
                                    null,  // query component
                                    null   // fragment component
--- a/src/share/classes/sun/nio/cs/UTF_8.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/nio/cs/UTF_8.java	Tue May 27 17:18:01 2008 -0700
@@ -326,7 +326,7 @@
 
                         case 12: case 13:
                             // 6 bytes, 31 bits
-                            if (src.remaining() < 4)
+                            if (src.remaining() < 5)
                                 return CoderResult.UNDERFLOW;
                             if (!isContinuation(b2 = src.get()))
                                 return CoderResult.malformedForLength(1);
--- a/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Tue May 27 17:18:01 2008 -0700
@@ -720,9 +720,13 @@
     }
 
     private boolean hasValidToken() {
+        /* Commented out to work with Solaris softtoken impl which
+           returns 0-value flags, e.g. both REMOVABLE_DEVICE and
+           TOKEN_PRESENT are false, when it can't access the token.
         if (removable == false) {
             return true;
         }
+        */
         Token token = this.token;
         return (token != null) && token.isValid();
     }
@@ -752,7 +756,7 @@
         if (slotInfo == null) {
             slotInfo = p11.C_GetSlotInfo(slotID);
         }
-        if ((slotInfo.flags & CKF_TOKEN_PRESENT) == 0) {
+        if (removable && (slotInfo.flags & CKF_TOKEN_PRESENT) == 0) {
             createPoller();
             return;
         }
--- a/src/share/classes/sun/tracing/MultiplexProviderFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/MultiplexProviderFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing;
--- a/src/share/classes/sun/tracing/NullProviderFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/NullProviderFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing;
--- a/src/share/classes/sun/tracing/PrintStreamProviderFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/PrintStreamProviderFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing;
--- a/src/share/classes/sun/tracing/ProbeSkeleton.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/ProbeSkeleton.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing;
--- a/src/share/classes/sun/tracing/ProviderSkeleton.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/ProviderSkeleton.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing;
--- a/src/share/classes/sun/tracing/dtrace/Activation.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/dtrace/Activation.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing.dtrace;
--- a/src/share/classes/sun/tracing/dtrace/DTraceProbe.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/dtrace/DTraceProbe.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing.dtrace;
--- a/src/share/classes/sun/tracing/dtrace/DTraceProvider.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/dtrace/DTraceProvider.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing.dtrace;
--- a/src/share/classes/sun/tracing/dtrace/DTraceProviderFactory.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/dtrace/DTraceProviderFactory.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing.dtrace;
--- a/src/share/classes/sun/tracing/dtrace/JVM.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/dtrace/JVM.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 package sun.tracing.dtrace;
--- a/src/share/classes/sun/tracing/package-info.java	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/classes/sun/tracing/package-info.java	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 /**
--- a/src/share/native/java/net/net_util.c	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/native/java/net/net_util.c	Tue May 27 17:18:01 2008 -0700
@@ -112,6 +112,7 @@
             (*env)->SetIntField(env, iaObj, ia_familyID, IPv4);
         } else {
             static jclass inet6Cls = 0;
+            jint scope;
             if (inet6Cls == 0) {
                 jclass c = (*env)->FindClass(env, "java/net/Inet6Address");
                 CHECK_NULL_RETURN(c, NULL);
@@ -129,7 +130,10 @@
             (*env)->SetObjectField(env, iaObj, ia6_ipaddressID, ipaddress);
 
             (*env)->SetIntField(env, iaObj, ia_familyID, IPv6);
-            (*env)->SetIntField(env, iaObj, ia6_scopeidID, getScopeID(him));
+            scope = getScopeID(him);
+            (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
+            if (scope > 0)
+                (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
         }
         *port = ntohs(him6->sin6_port);
     } else
--- a/src/share/native/sun/tracing/dtrace/JVM.c	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/native/sun/tracing/dtrace/JVM.c	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 #include <stdlib.h>
--- a/src/share/native/sun/tracing/dtrace/jvm_symbols.h	Thu May 15 13:04:31 2008 -0700
+++ b/src/share/native/sun/tracing/dtrace/jvm_symbols.h	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 #ifndef _JVM_SYMBOLS_H
--- a/src/solaris/native/sun/tracing/dtrace/jvm_symbols_md.c	Thu May 15 13:04:31 2008 -0700
+++ b/src/solaris/native/sun/tracing/dtrace/jvm_symbols_md.c	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 #include <dlfcn.h>
--- a/src/windows/native/sun/tracing/dtrace/jvm_symbols_md.c	Thu May 15 13:04:31 2008 -0700
+++ b/src/windows/native/sun/tracing/dtrace/jvm_symbols_md.c	Tue May 27 17:18:01 2008 -0700
@@ -1,6 +1,26 @@
 /*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * Copyright 2008 Sun Microsystems, Inc.  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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  */
 
 #include <windows.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/security/auth/login/ConfigFile/IllegalURL.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6689000
+ * @summary Changes in 6675606 causing regression test failures on windows-i586
+ */
+
+import com.sun.security.auth.login.*;
+import java.io.*;
+import java.net.URL;
+
+public class IllegalURL {
+    public static void main(String[] args) throws Exception {
+        FileOutputStream fos = new FileOutputStream("x.conf");
+        fos.close();
+        use("file:" + System.getProperty("user.dir") + "/x.conf");
+        use("file:x.conf");
+        System.out.println("Test passed");
+    }
+
+    static void use(String f) throws Exception {
+        System.out.println("Testing " + f  + "...");
+        System.setProperty("java.security.auth.login.config", f);
+        try {
+            new FileInputStream(new URL(f).getFile().replace('/', File.separatorChar));
+        } catch (Exception e) {
+            System.out.println("Even old implementation does not support it. Ignored.");
+            return;
+        }
+        new ConfigFile();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/CookieHandler/B6644726.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6644726
+ * @summary Cookie management issues
+ */
+
+import java.net.*;
+import java.util.*;
+
+public class B6644726 {
+    public static void main(String[] args) throws Exception {
+        testCookieStore();
+    }
+
+    private static void testCookieStore() throws Exception {
+        CookieManager cm = new CookieManager();
+        CookieStore cs = cm.getCookieStore();
+        URI uri = new URI("http://www.s1.sun.com/dir/foo/doc.html");
+        URI suri = new URI("https://www.s1.sun.com/dir/foo/index.html");
+        cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
+
+        ArrayList<String> lst = new ArrayList<String>();
+        // Let's test the default path
+        lst.add("myCookie1=foo");
+        // Then some alternate expires format
+        lst.add("myCookie2=bar; path=/dir; expires=Tue, 19 Aug 2025 16:00:00 GMT");
+        lst.add("myCookie3=test; path=/dir; expires=Tue Aug 19 2025 16:00:00 GMT-0100");
+        // Then Netscape draft cookies and domains
+        lst.add("myCookie4=test; domain=.sun.com; path=/dir/foo");
+        HashMap<String, List<String>> map = new HashMap<String, List<String>>();
+        map.put("Set-Cookie", lst);
+        cm.put(uri, map);
+        map.clear();
+        lst.clear();
+        // Test for secure tag
+        lst.add("myCookie5=test; secure");
+        // Test for passing cookies between http and https
+        map.put("Set-Cookie", lst);
+        cm.put(suri, map);
+
+        List<HttpCookie> cookies = cs.getCookies();
+        // There should be 5 cookies if all dates parsed correctly
+        if (cookies.size() != 5) {
+            fail("Should have 5 cookies. Got only "+ cookies.size() + ", expires probably didn't parse correctly");
+        }
+        // Check Path for first Cookie
+        for (HttpCookie c : cookies) {
+            if (c.getName().equals("myCookie1")) {
+                if (!"/dir/foo/".equals(c.getPath())) {
+                    fail("Default path for myCookie1 is " + c.getPath());
+                }
+            }
+        }
+
+        HashMap<String, List<String>> emptyMap = new HashMap<String, List<String>>();
+        // We should get 1 Cookie: MyCookie4, because of the domain
+        Map<String, List<String>>m = cm.get(new URI("http://www.s2.sun.com/dir/foo/doc2.html"),
+                emptyMap);
+        List<String> clst = m.get("Cookie");
+        if (clst.size() != 1) {
+            fail("We should have only 1 cookie, not " + clst.size());
+        } else {
+            if (!clst.get(0).startsWith("myCookie4")) {
+                fail("The cookie should be myCookie4, not " + clst.get(0));
+            }
+        }
+        // We should get 4 cookies for non secure URI, and 5 for the secure one
+        m = cm.get(suri, emptyMap);
+        clst = m.get("Cookie");
+        if (clst.size() != 5) {
+            fail("Cookies didn't cross from http to https. Got only " + clst.size());
+        }
+
+        m = cm.get(uri, emptyMap);
+        clst = m.get("Cookie");
+        if (clst.size() != 4) {
+            fail("We should have gotten only 4 cookies over http (non secure), got " +
+                    clst.size());
+        }
+        if (isIn(clst, "myCookie5=")) {
+            // myCookie5 (the secure one) shouldn't be here
+            fail("Got the secure cookie over a non secure link");
+        }
+
+        // Let's check that empty path is treated correctly
+        uri = new URI("http://www.sun.com/");
+        lst.clear();
+        lst.add("myCookie6=foo");
+        map.clear();
+        map.put("Set-Cookie", lst);
+        cm.put(uri, map);
+        uri = new URI("http://www.sun.com");
+        m = cm.get(uri, emptyMap);
+        clst = m.get("Cookie");
+        if (clst.size() != 1) {
+            fail("Missing a cookie when using an empty path");
+        }
+
+        // And now, the other way around:
+
+        uri = new URI("http://www.sun.com");
+        lst.clear();
+        lst.add("myCookie7=foo");
+        map.clear();
+        map.put("Set-Cookie", lst);
+        cm.put(uri, map);
+        uri = new URI("http://www.sun.com/");
+        m = cm.get(uri, emptyMap);
+        clst = m.get("Cookie");
+        if (!isIn(clst, "myCookie7=")) {
+            fail("Missing a cookie when using an empty path");
+        }
+
+        // Let's make sure the 'Port' optional attributes is enforced
+
+        lst.clear();
+        lst.add("myCookie8=porttest; port");
+        lst.add("myCookie9=porttest; port=\"80,8000\"");
+        lst.add("myCookie10=porttest; port=\"8000\"");
+        map.clear();
+        map.put("Set-Cookie", lst);
+        uri = new URI("http://www.sun.com/");
+        cm.put(uri, map);
+
+        // myCookie10 should have been rejected
+        cookies = cs.getCookies();
+        for (HttpCookie c : cookies) {
+            if (c.getName().equals("myCookie10")) {
+                fail("A cookie with an invalid port list was accepted");
+            }
+        }
+
+        uri = new URI("http://www.sun.com:80/");
+        m = cm.get(uri, emptyMap);
+        clst = m.get("Cookie");
+        // We should find both myCookie8 and myCookie9 but not myCookie10
+        if (!isIn(clst, "myCookie8=") || !isIn(clst, "myCookie9=")) {
+            fail("Missing a cookie on port 80");
+        }
+        uri = new URI("http://www.sun.com:8000/");
+        m = cm.get(uri, emptyMap);
+        clst = m.get("Cookie");
+        // We should find only myCookie9
+        if (!isIn(clst, "myCookie9=")) {
+            fail("Missing a cookie on port 80");
+        }
+        if (isIn(clst, "myCookie8=")) {
+            fail("A cookie with an invalid port list was returned");
+        }
+    }
+
+    private static boolean isIn(List<String> lst, String cookie) {
+        if (lst == null || lst.isEmpty()) {
+            return false;
+        }
+        for (String s : lst) {
+            if (s.startsWith(cookie))
+                return true;
+        }
+        return false;
+    }
+
+    private static void fail(String msg) throws Exception {
+        throw new RuntimeException(msg);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/Inet6Address/B6558853.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6558853
+ * @summary  getHostAddress() on connections using IPv6 link-local addrs should have zone id
+ */
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.*;
+import java.util.Enumeration;
+
+public class B6558853 implements Runnable {
+    private InetAddress addr = null;
+    private int port = 0;
+
+    public static void main(String[] args) throws Exception {
+        ServerSocket ss = new ServerSocket(0);
+        int port = ss.getLocalPort();
+        Enumeration<NetworkInterface> l = NetworkInterface.getNetworkInterfaces();
+        InetAddress dest = null;
+        while (l.hasMoreElements() && dest == null) {
+            NetworkInterface nif = l.nextElement();
+            for (InterfaceAddress a : nif.getInterfaceAddresses()) {
+                if (a.getAddress() instanceof Inet6Address) {
+                    Inet6Address a6 = (Inet6Address) a.getAddress();
+                    if (a6.isLinkLocalAddress()) {
+                        dest = a6;
+                    }
+                    break;
+                }
+            }
+        }
+        if (dest != null) {
+            B6558853 test = new B6558853(dest, port);
+            Thread thread = new Thread(test);
+            thread.start();
+            Socket s = ss.accept();
+            InetAddress a = s.getInetAddress();
+            OutputStream out = s.getOutputStream();
+            out.write(1);
+            out.close();
+            if (!(a instanceof Inet6Address) || a.getHostAddress().indexOf("%") == -1) {
+                // No Scope found in the address String
+                throw new RuntimeException("Wrong address: " + a.getHostAddress());
+            }
+        }
+    }
+
+    public B6558853(InetAddress a, int port) {
+        addr = a;
+        this.port = port;
+    }
+
+    public void run() {
+        try {
+            Socket s = new Socket(addr, port);
+            InputStream in = s.getInputStream();
+            int i = in.read();
+            in.close();
+        } catch (IOException iOException) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/AccessControlContext/CheckCtor.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6631361
+ * @summary Test constructor when PD array is null or contains all null contexts
+ */
+
+import java.security.AccessControlContext;
+import java.security.ProtectionDomain;
+
+public class CheckCtor {
+
+    public static void main(String[] args) throws Exception {
+
+        // check that null PD array throws NPE
+        try {
+            new AccessControlContext(null);
+            throw new Exception("Expected NullPointerException not thrown");
+        } catch (Exception e) {
+            if (!(e instanceof NullPointerException)) {
+                throw new Exception("Expected NullPointerException not thrown");
+            }
+        }
+
+        // check that empty PD array equals PD array of one or more nulls
+        ProtectionDomain zero[] = {};
+        ProtectionDomain null1[] = {null};
+        ProtectionDomain null2[] = {null, null};
+
+        AccessControlContext accZero = new AccessControlContext(zero);
+        AccessControlContext accNull1 = new AccessControlContext(null1);
+        AccessControlContext accNull2 = new AccessControlContext(null2);
+
+        testEquals(accZero, accNull1);
+        testEquals(accZero, accNull2);
+        testEquals(accNull1, accNull2);
+        testEquals(accNull1, accZero);
+        testEquals(accNull2, accZero);
+        testEquals(accNull2, accNull1);
+    }
+
+    private static void testEquals(AccessControlContext acc1,
+        AccessControlContext acc2) throws Exception {
+        if (!acc1.equals(acc2)) {
+            throw new Exception("AccessControlContexts should be equal");
+        }
+    }
+}
--- a/test/java/util/Collection/MOAT.java	Thu May 15 13:04:31 2008 -0700
+++ b/test/java/util/Collection/MOAT.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug     6207984 6272521 6192552 6269713 6197726 6260652 5073546 4137464
  *          4155650 4216399 4294891 6282555 6318622 6355327 6383475 6420753
- *          6431845 4802633 6570566 6570575 6570631 6570924
+ *          6431845 4802633 6570566 6570575 6570631 6570924 6691185 6691215
  * @summary Run many tests on many Collection and Map implementations
  * @author  Martin Buchholz
  */
@@ -155,7 +155,7 @@
         check(c.containsAll(new ArrayList<Integer>()));
     }
 
-    private static void testEmptyCollection(Collection<?> c) {
+    private static <T> void testEmptyCollection(Collection<T> c) {
         check(c.isEmpty());
         equal(c.size(), 0);
         equal(c.toString(),"[]");
@@ -165,6 +165,23 @@
         Object[] a = new Object[1]; a[0] = Boolean.TRUE;
         equal(c.toArray(a), a);
         equal(a[0], null);
+        testEmptyIterator(c.iterator());
+    }
+
+    static <T> void testEmptyIterator(final Iterator<T> it) {
+        if (rnd.nextBoolean())
+            check(! it.hasNext());
+
+        THROWS(NoSuchElementException.class,
+               new Fun(){void f(){ it.next(); }});
+
+        try { it.remove(); }
+        catch (IllegalStateException _) { pass(); }
+        catch (UnsupportedOperationException _) { pass(); }
+        catch (Throwable t) { unexpected(t); }
+
+        if (rnd.nextBoolean())
+            check(! it.hasNext());
     }
 
     private static void testEmptyList(List<?> c) {
@@ -173,10 +190,12 @@
         equal2(c, Collections.<Integer>emptyList());
     }
 
-    private static void testEmptySet(Set<?> c) {
+    private static <T> void testEmptySet(Set<T> c) {
         testEmptyCollection(c);
         equal(c.hashCode(), 0);
         equal2(c, Collections.<Integer>emptySet());
+        if (c instanceof NavigableSet<?>)
+            testEmptyIterator(((NavigableSet<T>)c).descendingIterator());
     }
 
     private static void testImmutableCollection(final Collection<Integer> c) {
@@ -221,13 +240,20 @@
         testEmptyCollection(c);
     }
 
-    private static void testEmptyMap(final Map<?,?> m) {
+    private static <K,V> void testEmptyMap(final Map<K,V> m) {
         check(m.isEmpty());
         equal(m.size(), 0);
         equal(m.toString(),"{}");
         testEmptySet(m.keySet());
         testEmptySet(m.entrySet());
         testEmptyCollection(m.values());
+
+        try { check(! m.containsValue(null)); }
+        catch (NullPointerException _) { /* OK */ }
+        try { check(! m.containsKey(null)); }
+        catch (NullPointerException _) { /* OK */ }
+        check(! m.containsValue(1));
+        check(! m.containsKey(1));
     }
 
     private static void testImmutableMap(final Map<Integer,Integer> m) {
@@ -433,8 +459,18 @@
         if (! supportsAdd(c)) return;
         //System.out.println("add() supported");
 
-        if (c instanceof NavigableSet)
-            testNavigableSet((NavigableSet<Integer>)c);
+        if (c instanceof NavigableSet) {
+            System.out.println("NavigableSet tests...");
+
+            NavigableSet<Integer> ns = (NavigableSet<Integer>)c;
+            testNavigableSet(ns);
+            testNavigableSet(ns.headSet(6, false));
+            testNavigableSet(ns.headSet(5, true));
+            testNavigableSet(ns.tailSet(0, false));
+            testNavigableSet(ns.tailSet(1, true));
+            testNavigableSet(ns.subSet(0, false, 5, true));
+            testNavigableSet(ns.subSet(1, true, 6, false));
+        }
 
         if (c instanceof Queue)
             testQueue((Queue<Integer>)c);
@@ -514,8 +550,19 @@
         if (m instanceof ConcurrentMap)
             testConcurrentMap((ConcurrentMap<Integer,Integer>) m);
 
-        if (m instanceof NavigableMap)
-            testNavigableMap((NavigableMap<Integer,Integer>) m);
+        if (m instanceof NavigableMap) {
+            System.out.println("NavigableMap tests...");
+
+            NavigableMap<Integer,Integer> nm =
+                (NavigableMap<Integer,Integer>) m;
+            testNavigableMap(nm);
+            testNavigableMap(nm.headMap(6, false));
+            testNavigableMap(nm.headMap(5, true));
+            testNavigableMap(nm.tailMap(0, false));
+            testNavigableMap(nm.tailMap(1, true));
+            testNavigableMap(nm.subMap(1, true, 6, false));
+            testNavigableMap(nm.subMap(0, false, 5, true));
+        }
 
         checkFunctionalInvariants(m);
 
@@ -697,8 +744,6 @@
 
     private static void testNavigableMap(NavigableMap<Integer,Integer> m)
     {
-        System.out.println("NavigableMap tests...");
-
         clear(m);
         checkNavigableMapKeys(m, 1, null, null, null, null);
 
@@ -717,9 +762,11 @@
         checkNavigableMapKeys(m, 5,    3,    5,    5, null);
         checkNavigableMapKeys(m, 6,    5,    5, null, null);
 
-        {
-            final Iterator<Integer> it
-                = m.descendingKeySet().iterator();
+        for (final Iterator<Integer> it :
+                 (Iterator<Integer>[])
+                 new Iterator<?>[] {
+                     m.descendingKeySet().iterator(),
+                     m.navigableKeySet().descendingIterator()}) {
             equalNext(it, 5);
             equalNext(it, 3);
             equalNext(it, 1);
@@ -742,8 +789,6 @@
 
 
     private static void testNavigableSet(NavigableSet<Integer> s) {
-        System.out.println("NavigableSet tests...");
-
         clear(s);
         checkNavigableSetKeys(s, 1, null, null, null, null);
 
@@ -762,8 +807,11 @@
         checkNavigableSetKeys(s, 5,    3,    5,    5, null);
         checkNavigableSetKeys(s, 6,    5,    5, null, null);
 
-        {
-            final Iterator<Integer> it = s.descendingIterator();
+        for (final Iterator<Integer> it :
+                 (Iterator<Integer>[])
+                 new Iterator<?>[] {
+                     s.descendingIterator(),
+                     s.descendingSet().iterator()}) {
             equalNext(it, 5);
             equalNext(it, 3);
             equalNext(it, 1);
--- a/test/java/util/NavigableMap/LockStep.java	Thu May 15 13:04:31 2008 -0700
+++ b/test/java/util/NavigableMap/LockStep.java	Tue May 27 17:18:01 2008 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc.  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     6420753 6242436
+ * @bug     6420753 6242436 6691185
  * @summary Compare NavigableMap implementations for identical behavior
  * @author  Martin Buchholz
  */
@@ -159,6 +159,7 @@
         Object[] a = new Object[1]; a[0] = Boolean.TRUE;
         equal(c.toArray(a), a);
         equal(a[0], null);
+        check(! c.iterator().hasNext());
     }
 
     static void testEmptySet(Set<?> c) {
@@ -262,6 +263,16 @@
         }
     }
 
+    static void equalIterators(final Iterator<?> it1,
+                               final Iterator<?> it2) {
+        while (it1.hasNext()) {
+            if (maybe(2))
+                check(it2.hasNext());
+            equal(it1.next(), it2.next());
+        }
+        check(! it2.hasNext());
+    }
+
     static void equalNavigableSetsLeaf(final NavigableSet s1,
                                        final NavigableSet s2) {
         equal2(s1,            s2);
@@ -273,6 +284,8 @@
             equal(s1.first(), s2.first());
             equal(s1.last(),  s2.last());
         }
+        equalIterators(s1.iterator(), s2.iterator());
+        equalIterators(s1.descendingIterator(), s2.descendingIterator());
         checkNavigableSet(s1);
         checkNavigableSet(s2);
     }
@@ -493,30 +506,23 @@
 
     static MapFrobber randomAdder(NavigableMap m) {
         final Integer k = unusedKey(m);
-        MapFrobber f;
-        switch (rnd.nextInt(4)) {
-        case 0: f = new MapFrobber() {void frob(NavigableMap m) {
-            equal(m.put(k, k+1), null);
-            equal(m.get(k), k+1);
-            if (maybe(4)) {
-                equal(m.put(k, k+1), k+1);
-                equal(m.get(k), k+1);}}};
-            break;
-        case 1: f = new MapFrobber() {void frob(NavigableMap m) {
-            m.descendingMap().put(k, k+1);
-            equal(m.get(k), k+1);}};
-            break;
-        case 2: f = new MapFrobber() {void frob(NavigableMap m) {
-            m.tailMap(k,true).headMap(k,true).put(k,k+1);}};
-            break;
-        case 3: f = new MapFrobber() {void frob(NavigableMap m) {
-            m.tailMap(k,true).headMap(k,true).descendingMap().put(k,k+1);}};
-            break;
-        default: throw new Error();
-        }
-        final MapFrobber ff = f;
+        final MapFrobber[] randomAdders = {
+            new MapFrobber() {void frob(NavigableMap m) {
+                equal(m.put(k, k+1), null);
+                equal(m.get(k), k+1);
+                if (maybe(4)) {
+                    equal(m.put(k, k+1), k+1);
+                    equal(m.get(k), k+1);}}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                m.descendingMap().put(k, k+1);
+                equal(m.get(k), k+1);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                m.tailMap(k,true).headMap(k,true).put(k,k+1);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                m.tailMap(k,true).headMap(k,true).descendingMap().put(k,k+1);}}
+        };
         return new MapFrobber() {void frob(NavigableMap m) {
-            ff.frob(m);
+            randomAdders[rnd.nextInt(randomAdders.length)].frob(m);
             if (maybe(2)) equal(m.get(k), k+1);
             if (maybe(4)) {
                 equal(m.put(k, k+1), k+1);
@@ -525,26 +531,19 @@
 
     static SetFrobber randomAdder(NavigableSet s) {
         final Integer e = unusedElt(s);
-        SetFrobber f;
-        switch (rnd.nextInt(4)) {
-        case 0: f = new SetFrobber() {void frob(NavigableSet s) {
-            check(s.add(e));}};
-            break;
-        case 1: f = new SetFrobber() {void frob(NavigableSet s) {
-            s.descendingSet().add(e);}};
-            break;
-        case 2: f = new SetFrobber() {void frob(NavigableSet s) {
-            s.tailSet(e,true).headSet(e,true).add(e);}};
-            break;
-        case 3: f = new SetFrobber() {void frob(NavigableSet s) {
-            s.descendingSet().tailSet(e,true).headSet(e,true).add(e);}};
-            break;
-        default: throw new Error();
-        }
-        final SetFrobber ff = f;
+        final SetFrobber[] randomAdders = {
+            new SetFrobber() {void frob(NavigableSet s) {
+                check(s.add(e));}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                s.descendingSet().add(e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                s.tailSet(e,true).headSet(e,true).add(e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                s.descendingSet().tailSet(e,true).headSet(e,true).add(e);}}
+        };
         return new SetFrobber() {void frob(NavigableSet s) {
             if (maybe(2)) check(! s.contains(e));
-            ff.frob(s);
+            randomAdders[rnd.nextInt(randomAdders.length)].frob(s);
             if (maybe(2)) check(! s.add(e));
             if (maybe(2)) check(s.contains(e));}};
     }
@@ -605,89 +604,112 @@
 
     static MapFrobber randomRemover(NavigableMap m) {
         final Integer k = usedKey(m);
-        switch (rnd.nextInt(7)) {
-        default: throw new Error();
-        case 0: return new MapFrobber() {void frob(NavigableMap m) {
-            Map.Entry e = m.firstEntry();
-            equal(m.pollFirstEntry(), e);
-            checkUnusedKey(m, e.getKey());}};
-        case 1: return new MapFrobber() {void frob(NavigableMap m) {
-            Map.Entry e = m.lastEntry();
-            equal(m.pollLastEntry(), e);
-            checkUnusedKey(m, e.getKey());}};
-        case 2: return new MapFrobber() {void frob(NavigableMap m) {
-            check(m.remove(k) != null);
-            checkUnusedKey(m, k);}};
-        case 3: return new MapFrobber() {void frob(NavigableMap m) {
-            m.subMap(k, true, k, true).clear();
-            checkUnusedKey(m, k);}};
-        case 4: return new MapFrobber() {void frob(NavigableMap m) {
-            m.descendingMap().subMap(k, true, k, true).clear();
-            checkUnusedKey(m, k);}};
-        case 5: return new MapFrobber() {void frob(NavigableMap m) {
-            final Iterator it = m.keySet().iterator();
-            while (it.hasNext())
-                if (it.next().equals(k)) {
-                    it.remove();
-                    if (maybe(2))
-                        THROWS(IllegalStateException.class,
-                               new Fun(){void f(){ it.remove(); }});
-                }
-            checkUnusedKey(m, k);}};
-        case 6: return new MapFrobber() {void frob(NavigableMap m) {
-            final Iterator<Map.Entry> it = m.entrySet().iterator();
-            while (it.hasNext())
-                if (it.next().getKey().equals(k)) {
-                    it.remove();
-                    if (maybe(2))
-                        THROWS(IllegalStateException.class, remover(it));
-                }
-            checkUnusedKey(m, k);}};
-        }
+        final MapFrobber[] randomRemovers = {
+            new MapFrobber() {void frob(NavigableMap m) {
+                Map.Entry e = m.firstEntry();
+                equal(m.pollFirstEntry(), e);
+                checkUnusedKey(m, e.getKey());}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                Map.Entry e = m.lastEntry();
+                equal(m.pollLastEntry(), e);
+                checkUnusedKey(m, e.getKey());}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                check(m.remove(k) != null);
+                checkUnusedKey(m, k);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                m.subMap(k, true, k, true).clear();
+                checkUnusedKey(m, k);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                m.descendingMap().subMap(k, true, k, true).clear();
+                checkUnusedKey(m, k);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                final Iterator it = m.keySet().iterator();
+                while (it.hasNext())
+                    if (it.next().equals(k)) {
+                        it.remove();
+                        if (maybe(2))
+                            THROWS(IllegalStateException.class,
+                                   new Fun(){void f(){ it.remove(); }});
+                    }
+                checkUnusedKey(m, k);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                final Iterator it = m.navigableKeySet().descendingIterator();
+                while (it.hasNext())
+                    if (it.next().equals(k)) {
+                        it.remove();
+                        if (maybe(2))
+                            THROWS(IllegalStateException.class,
+                                   new Fun(){void f(){ it.remove(); }});
+                    }
+                checkUnusedKey(m, k);}},
+            new MapFrobber() {void frob(NavigableMap m) {
+                final Iterator<Map.Entry> it = m.entrySet().iterator();
+                while (it.hasNext())
+                    if (it.next().getKey().equals(k)) {
+                        it.remove();
+                        if (maybe(2))
+                            THROWS(IllegalStateException.class, remover(it));
+                    }
+                checkUnusedKey(m, k);}},
+        };
+
+        return randomRemovers[rnd.nextInt(randomRemovers.length)];
     }
 
     static SetFrobber randomRemover(NavigableSet s) {
         final Integer e = usedElt(s);
-        switch (rnd.nextInt(7)) {
-        default: throw new Error();
-        case 0: return new SetFrobber() {void frob(NavigableSet s) {
-            Object e = s.first();
-            equal(s.pollFirst(), e);
-            checkUnusedElt(s, e);}};
-        case 1: return new SetFrobber() {void frob(NavigableSet s) {
-            Object e = s.last();
-            equal(s.pollLast(), e);
-            checkUnusedElt(s, e);}};
-        case 2: return new SetFrobber() {void frob(NavigableSet s) {
-            check(s.remove(e));
-            checkUnusedElt(s, e);}};
-        case 3: return new SetFrobber() {void frob(NavigableSet s) {
-            s.subSet(e, true, e, true).clear();
-            checkUnusedElt(s, e);}};
-        case 4: return new SetFrobber() {void frob(NavigableSet s) {
-            s.descendingSet().subSet(e, true, e, true).clear();
-            checkUnusedElt(s, e);}};
-        case 5: return new SetFrobber() {void frob(NavigableSet s) {
-            final Iterator it = s.iterator();
-            while (it.hasNext())
-                if (it.next().equals(e)) {
-                    it.remove();
-                    if (maybe(2))
-                        THROWS(IllegalStateException.class,
-                               new Fun(){void f(){ it.remove(); }});
-                }
-            checkUnusedElt(s, e);}};
-        case 6: return new SetFrobber() {void frob(NavigableSet s) {
-            final Iterator it = s.descendingSet().iterator();
-            while (it.hasNext())
-                if (it.next().equals(e)) {
-                    it.remove();
-                    if (maybe(2))
-                        THROWS(IllegalStateException.class,
-                               new Fun(){void f(){ it.remove(); }});
-                }
-            checkUnusedElt(s, e);}};
-        }
+
+        final SetFrobber[] randomRemovers = {
+            new SetFrobber() {void frob(NavigableSet s) {
+                Object e = s.first();
+                equal(s.pollFirst(), e);
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                Object e = s.last();
+                equal(s.pollLast(), e);
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                check(s.remove(e));
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                s.subSet(e, true, e, true).clear();
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                s.descendingSet().subSet(e, true, e, true).clear();
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                final Iterator it = s.iterator();
+                while (it.hasNext())
+                    if (it.next().equals(e)) {
+                        it.remove();
+                        if (maybe(2))
+                            THROWS(IllegalStateException.class,
+                                   new Fun(){void f(){ it.remove(); }});
+                    }
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                final Iterator it = s.descendingSet().iterator();
+                while (it.hasNext())
+                    if (it.next().equals(e)) {
+                        it.remove();
+                        if (maybe(2))
+                            THROWS(IllegalStateException.class,
+                                   new Fun(){void f(){ it.remove(); }});
+                    }
+                checkUnusedElt(s, e);}},
+            new SetFrobber() {void frob(NavigableSet s) {
+                final Iterator it = s.descendingIterator();
+                while (it.hasNext())
+                    if (it.next().equals(e)) {
+                        it.remove();
+                        if (maybe(2))
+                            THROWS(IllegalStateException.class,
+                                   new Fun(){void f(){ it.remove(); }});
+                    }
+                checkUnusedElt(s, e);}}
+        };
+
+        return randomRemovers[rnd.nextInt(randomRemovers.length)];
     }
 
     static void lockStep(NavigableMap m1,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/management/query/CustomQueryTest.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6692027
+ * @summary Check that custom subclasses of QueryEval can be serialized.
+ * @author Eamonn McManus
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.management.ManagementFactory;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.QueryEval;
+import javax.management.QueryExp;
+
+public class CustomQueryTest {
+    public static interface CountMBean {
+        public int getCount();
+        public void increment();
+    }
+
+    public static class Count implements CountMBean {
+        private AtomicInteger count = new AtomicInteger();
+
+        public int getCount() {
+            return count.get();
+        }
+
+        public void increment() {
+            count.incrementAndGet();
+        }
+
+    }
+
+    public static final ObjectName countName;
+    static {
+        try {
+            countName = new ObjectName("d:type=Count");
+        } catch (MalformedObjectNameException e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    /* A query that calls the increment method of the Count MBean every time
+     * it is evaluated.  If there is no ObjectName filter, the query will be
+     * evaluated for every MBean in the MBean Server, so the count will be
+     * incremented by the number of MBeans.
+     */
+    public static class IncrQuery extends QueryEval implements QueryExp {
+        public boolean apply(ObjectName name) {
+            try {
+                getMBeanServer().invoke(countName, "increment", null, null);
+                return true;
+            } catch (Throwable t) {
+                t.printStackTrace();
+                System.exit(1);
+                throw new AssertionError(); // not reached
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        mbs.registerMBean(new Count(), countName);
+        int mbeanCount = mbs.getMBeanCount();
+        QueryExp query = new IncrQuery();
+        Set<ObjectName> names = mbs.queryNames(null, query);
+        assertEquals(mbeanCount, names.size());
+        assertEquals(mbeanCount, mbs.getAttribute(countName, "Count"));
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        ObjectOutputStream oout = new ObjectOutputStream(bout);
+        oout.writeObject(query);
+        oout.close();
+        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+        ObjectInputStream oin = new ObjectInputStream(bin);
+        query = (QueryExp) oin.readObject();
+        names = mbs.queryNames(null, query);
+        assertEquals(mbeanCount * 2, mbs.getAttribute(countName, "Count"));
+    }
+
+    private static void assertEquals(Object expected, Object actual)
+            throws Exception {
+        if (!expected.equals(actual)) {
+            String failure = "FAILED: expected " + expected + ", got " + actual;
+            throw new Exception(failure);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/management/relation/RelationNotificationSeqNoTest.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6701459
+ * @summary Test sequence numbers in RelationService notifications.
+ * @author Eamonn McManus
+ */
+
+/*
+ * Bug 6701459 is for a synchronization problem that is very unlikely to occur
+ * in practice and it would be very hard to test it.  Instead we just check that
+ * the fix has not introduced any obviously-wrong behavior in the sequence
+ * numbers.
+ */
+
+import java.util.Arrays;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import javax.management.JMX;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.relation.RelationServiceMBean;
+import javax.management.relation.Role;
+import javax.management.relation.RoleInfo;
+import javax.management.relation.RoleList;
+
+public class RelationNotificationSeqNoTest {
+    public static void main(String[] args) throws Exception {
+        MBeanServer mbs = MBeanServerFactory.newMBeanServer();
+        ObjectName relSvcName = new ObjectName("a:type=relationService");
+        RelationServiceMBean relSvc =
+                JMX.newMBeanProxy(mbs, relSvcName, RelationServiceMBean.class);
+        mbs.createMBean("javax.management.relation.RelationService",
+                        relSvcName,
+                        new Object[] {Boolean.TRUE},
+                        new String[] {"boolean"});
+
+        final BlockingQueue<Notification> q =
+                new ArrayBlockingQueue<Notification>(100);
+        NotificationListener qListener = new NotificationListener() {
+            public void handleNotification(Notification notification,
+                                           Object handback) {
+                q.add(notification);
+            }
+        };
+        mbs.addNotificationListener(relSvcName, qListener, null, null);
+
+        RoleInfo leftInfo =
+            new RoleInfo("left", "javax.management.timer.TimerMBean");
+        RoleInfo rightInfo =
+            new RoleInfo("right", "javax.management.timer.Timer");
+        relSvc.createRelationType("typeName", new RoleInfo[] {leftInfo, rightInfo});
+        ObjectName timer1 = new ObjectName("a:type=timer,number=1");
+        ObjectName timer2 = new ObjectName("a:type=timer,number=2");
+        mbs.createMBean("javax.management.timer.Timer", timer1);
+        mbs.createMBean("javax.management.timer.Timer", timer2);
+
+        Role leftRole =
+            new Role("left", Arrays.asList(new ObjectName[] {timer1}));
+        Role rightRole =
+            new Role("right", Arrays.asList(new ObjectName[] {timer2}));
+        RoleList roles =
+            new RoleList(Arrays.asList(new Role[] {leftRole, rightRole}));
+
+        final int NREPEAT = 10;
+
+        for (int i = 0; i < NREPEAT; i++) {
+            relSvc.createRelation("relationName", "typeName", roles);
+            relSvc.removeRelation("relationName");
+        }
+
+        Notification firstNotif = q.remove();
+        long seqNo = firstNotif.getSequenceNumber();
+        for (int i = 0; i < NREPEAT * 2 - 1; i++) {
+            Notification n = q.remove();
+            long nSeqNo = n.getSequenceNumber();
+            if (nSeqNo != seqNo + 1) {
+                throw new Exception(
+                        "TEST FAILED: expected seqNo " + (seqNo + 1) + "; got " +
+                        nSeqNo);
+            }
+            seqNo++;
+        }
+        System.out.println("TEST PASSED: got " + (NREPEAT * 2) + " notifications " +
+                "with contiguous sequence numbers");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/security/auth/kerberos/KerberosTixDateTest.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6659990
+ * @summary test the immutability of the Date fields in KerberosTicket class.
+ * @ignore Must set up KDC and setup Kerberos configuration file
+ */
+
+import java.net.InetAddress;
+import java.util.Date;
+import java.io.*;
+import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.kerberos.KerberosTicket;
+import sun.misc.BASE64Decoder;
+
+public class KerberosTixDateTest {
+
+    // Serialized KerberosTicket from JDK6 (encoded in BASE64)
+    // Note: the KerberosTicket object is created using the same values as
+    // the KerberosTicket 't' in main(). Deserialization should succeed
+    // and the deserialized object should equal to 't'.
+    static String serializedKerberosTix =
+"rO0ABXNyACtqYXZheC5zZWN1cml0eS5hdXRoLmtlcmJlcm9zLktlcmJlcm9zVGlja2V0ZqGBbXB3" +
+"w7sCAApbAAxhc24xRW5jb2Rpbmd0AAJbQkwACGF1dGhUaW1ldAAQTGphdmEvdXRpbC9EYXRlO0wA" +
+"BmNsaWVudHQAMExqYXZheC9zZWN1cml0eS9hdXRoL2tlcmJlcm9zL0tlcmJlcm9zUHJpbmNpcGFs" +
+"O1sAD2NsaWVudEFkZHJlc3Nlc3QAF1tMamF2YS9uZXQvSW5ldEFkZHJlc3M7TAAHZW5kVGltZXEA" +
+"fgACWwAFZmxhZ3N0AAJbWkwACXJlbmV3VGlsbHEAfgACTAAGc2VydmVycQB+AANMAApzZXNzaW9u" +
+"S2V5dAAmTGphdmF4L3NlY3VyaXR5L2F1dGgva2VyYmVyb3MvS2V5SW1wbDtMAAlzdGFydFRpbWVx" +
+"AH4AAnhwdXIAAltCrPMX+AYIVOACAAB4cAAAAARhc24xc3IADmphdmEudXRpbC5EYXRlaGqBAUtZ" +
+"dBkDAAB4cHcIAAAAAAC8YU54c3IALmphdmF4LnNlY3VyaXR5LmF1dGgua2VyYmVyb3MuS2VyYmVy" +
+"b3NQcmluY2lwYWyZp31dDx4zKQMAAHhwdXEAfgAIAAAAEzARoAMCAQGhCjAIGwZjbGllbnR1cQB+" +
+"AAgAAAAVGxNKTEFCUy5TRkJBWS5TVU4uQ09NeHBxAH4AC3VyAAJbWlePIDkUuF3iAgAAeHAAAAAg" +
+"AAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABxAH4AC3NxAH4ADHVxAH4ACAAAABMwEaAD" +
+"AgEBoQowCBsGc2VydmVydXEAfgAIAAAAFRsTSkxBQlMuU0ZCQVkuU1VOLkNPTXhzcgAkamF2YXgu" +
+"c2VjdXJpdHkuYXV0aC5rZXJiZXJvcy5LZXlJbXBskoOG6DyvS9cDAAB4cHVxAH4ACAAAABUwE6AD" +
+        "AgEBoQwECnNlc3Npb25LZXl4cQB+AAs=";
+
+    public static void main(String[] args) throws Exception {
+        byte[] asn1Bytes = "asn1".getBytes();
+        KerberosPrincipal client = new KerberosPrincipal("client");
+        KerberosPrincipal server = new KerberosPrincipal("server");
+        byte[] keyBytes = "sessionKey".getBytes();
+        long originalTime = 12345678L;
+        Date inDate = new Date(originalTime);
+        boolean[] flags = new boolean[9];
+        flags[8] = true; // renewable
+        KerberosTicket t = new KerberosTicket(asn1Bytes, client, server,
+                keyBytes, 1 /*keyType*/, flags, inDate /*authTime*/,
+                inDate /*startTime*/, inDate /*endTime*/,
+                inDate /*renewTill*/, null /*clientAddresses*/);
+        inDate.setTime(0); // for testing the constructor
+
+        testDateImmutability(t, originalTime);
+        testS11nCompatibility(t); // S11n: Serialization
+    }
+
+    private static void checkTime(KerberosTicket kt, long timeValue) {
+        if (kt.getAuthTime().getTime() != timeValue) {
+            throw new RuntimeException("authTime check fails!");
+        }
+        if (kt.getStartTime().getTime() != timeValue) {
+            throw new RuntimeException("startTime check fails!");
+        }
+        if (kt.getEndTime().getTime() != timeValue) {
+            throw new RuntimeException("endTime check fails!");
+        }
+        if (kt.getRenewTill().getTime() != timeValue) {
+            throw new RuntimeException("renewTill check fails!");
+        }
+    }
+
+    private static void testDateImmutability(KerberosTicket t, long origTime)
+        throws Exception {
+        // test the constructor
+        System.out.println("Testing constructor...");
+        checkTime(t, origTime);
+
+        // test the getAuth/Start/EndTime() & getRenewTill() methods
+        System.out.println("Testing getAuth/Start/EndTime() & getRenewTill()...");
+        t.getAuthTime().setTime(0);
+        t.getStartTime().setTime(0);
+        t.getEndTime().setTime(0);
+        t.getRenewTill().setTime(0);
+        checkTime(t, origTime);
+
+        System.out.println("DateImmutability Test Passed");
+    }
+
+    private static void checkEqualsAndHashCode(byte[] bytes, KerberosTicket t)
+        throws IOException, ClassNotFoundException {
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        KerberosTicket deserializedTicket = (KerberosTicket)
+                (new ObjectInputStream(bais).readObject());
+        if (!deserializedTicket.equals(t)) {
+            throw new RuntimeException("equals() check fails!");
+        }
+        if (deserializedTicket.hashCode() != t.hashCode()) {
+            throw new RuntimeException("hashCode() check fails!");
+        }
+    }
+
+    private static void testS11nCompatibility(KerberosTicket t)
+        throws Exception {
+
+        System.out.println("Testing against KerberosTicket from JDK6...");
+        byte[] serializedBytes =
+            new BASE64Decoder().decodeBuffer(serializedKerberosTix);
+        checkEqualsAndHashCode(serializedBytes, t);
+
+        System.out.println("Testing against KerberosTicket from current rel...");
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        new ObjectOutputStream(baos).writeObject(t);
+        checkEqualsAndHashCode(baos.toByteArray(), t);
+
+        System.out.println("S11nCompatibility Test Passed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/security/auth/login/Configuration/ConfigFileWithBlank.java	Tue May 27 17:18:01 2008 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6675606
+ * @summary javax.security.auth.login.Configuration does not recognize path with spaces
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import javax.security.auth.login.*;
+
+import java.net.URI;
+import java.security.URIParameter;
+
+public class ConfigFileWithBlank {
+    public static void main(String[] args) throws Exception {
+        File f = new File("a b c");
+        FileOutputStream fos = new FileOutputStream(f);
+        fos.write("".getBytes());
+        fos.close();
+        System.err.println(f.toURI());
+        try {
+            Configuration.getInstance("JavaLoginConfig", new URIParameter(f.toURI()));
+        } finally {
+            f.delete();
+        }
+    }
+}