changeset 808:175b6adf65b3

Merge
author tbell
date Sat, 24 Jan 2009 16:35:17 -0800
parents 527b426497a2 cb641d17bbb3
children f3ad2ee4600b
files
diffstat 41 files changed, 1191 insertions(+), 136 deletions(-) [+]
line wrap: on
line diff
--- a/make/com/sun/org/apache/xml/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/com/sun/org/apache/xml/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -41,7 +41,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jre
-NEW_RESOURCE_BUNDLES_PROPERTIES = \
+NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = \
    $(PKGDIR)/internal/security/resource/config.dtd \
    $(PKGDIR)/internal/security/resource/config.xml \
    $(PKGDIR)/internal/security/resource/xmlsecurity_de.properties \
--- a/make/com/sun/rowset/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/com/sun/rowset/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -41,7 +41,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jre
-RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/RowSetResourceBundle.properties
+RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/RowSetResourceBundle.properties
 
 #
 # Rules
--- a/make/common/internal/Resources.gmk	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/common/internal/Resources.gmk	Sat Jan 24 16:35:17 2009 -0800
@@ -44,12 +44,8 @@
 #
 #   NEW_RESOURCE_BUNDLES_JAVA        - new resource bundles implemented in
 #                                      Java, not localized
-#   NEW_RESOURCE_BUNDLES_PROPERTIES  - new resource bundles implemented as
-#                                      properties files, not localized
 #   RESOURCE_BUNDLES_JAVA            - resource bundles implemented in
 #                                      Java, localized
-#   RESOURCE_BUNDLES_PROPERTIES      - new resource bundles implemented as
-#                                      properties files, localized
 #
 # The following variable is now used for most .properties files in the JDK. 
 # These properties files are converted into java and compiled with javac.
@@ -61,6 +57,13 @@
 #                                          properties files, localized
 #   NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES - same as above, not localized
 #
+# For non-compiled properties files, use the following variables:
+#
+#   NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES  - new resource bundles implemented as
+#                                      properties files, not localized
+#   RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES      - resource bundles implemented as
+#                                      properties files, localized
+#
 # Other properties files to be installed are identified using the variable:
 #
 #   OTHER_PROPERTIES
@@ -109,11 +112,12 @@
 FILES_java += $(COMPILED_PROPERTIES:%.properties=%.java)
 
 # Non-compiled files
-PROPERTIES_FILES += $(NEW_RESOURCE_BUNDLES_PROPERTIES)
-PROPERTIES_FILES += $(RESOURCE_BUNDLES_PROPERTIES) \
-    $(foreach file,$(RESOURCE_BUNDLES_PROPERTIES), \
+PROPERTIES_FILES += $(NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES)
+PROPERTIES_FILES += $(RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES) \
+    $(foreach file,$(RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES), \
        $(foreach locale,$(LOCALE_SUFFIXES), \
 	  $(basename $(file))_$(locale)$(suffix $(file))))
+# other properties
 PROPERTIES_FILES += $(OTHER_PROPERTIES)
 
 #
--- a/make/sun/launcher/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/sun/launcher/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -37,7 +37,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jre
-NEW_RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/launcher.properties
+NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES = $(PKGDIR)/resources/launcher.properties
 
 #
 # Rules
--- a/make/sun/rmi/oldtools/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/sun/rmi/oldtools/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -41,7 +41,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = j2sdk
-RESOURCE_BUNDLES_PROPERTIES = sun/tools/javac/resources/javac.properties
+RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = sun/tools/javac/resources/javac.properties
 
 #
 # Rules
--- a/make/sun/rmi/registry/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/sun/rmi/registry/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -41,7 +41,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jre
-RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/rmiregistry.properties
+RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/rmiregistry.properties
 
 #
 # Rules
--- a/make/sun/rmi/rmic/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/sun/rmi/rmic/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -43,7 +43,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jdk
-RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/rmic.properties
+RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/rmic.properties
 
 #
 # Rules
--- a/make/sun/rmi/rmid/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/sun/rmi/rmid/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -39,7 +39,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jre
-RESOURCE_BUNDLES_PROPERTIES = sun/rmi/server/resources/rmid.properties
+RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = sun/rmi/server/resources/rmid.properties
 
 #
 # Extra dependencies.
--- a/make/sun/serialver/Makefile	Thu Jan 22 14:42:13 2009 -0800
+++ b/make/sun/serialver/Makefile	Sat Jan 24 16:35:17 2009 -0800
@@ -41,7 +41,7 @@
 # Resources
 #
 LOCALE_SET_DEFINITION = jdk
-RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/serialver.properties 
+RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/serialver.properties 
 
 #
 # Rules
--- a/src/share/classes/java/lang/Double.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/java/lang/Double.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1994-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1994-2009 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
@@ -404,8 +404,19 @@
      * binary value that is then rounded to type {@code double}
      * by the usual round-to-nearest rule of IEEE 754 floating-point
      * arithmetic, which includes preserving the sign of a zero
-     * value. Finally, a {@code Double} object representing this
-     * {@code double} value is returned.
+     * value.
+     *
+     * Note that the round-to-nearest rule also implies overflow and
+     * underflow behaviour; if the exact value of {@code s} is large
+     * enough in magnitude (greater than or equal to ({@link
+     * #MAX_VALUE} + {@link Math#ulp(double) ulp(MAX_VALUE)}/2),
+     * rounding to {@code double} will result in an infinity and if the
+     * exact value of {@code s} is small enough in magnitude (less
+     * than or equal to {@link #MIN_VALUE}/2), rounding to float will
+     * result in a zero.
+     *
+     * Finally, after rounding a {@code Double} object representing
+     * this {@code double} value is returned.
      *
      * <p> To interpret localized string representations of a
      * floating-point value, use subclasses of {@link
--- a/src/share/classes/java/lang/Float.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/java/lang/Float.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1994-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1994-2009 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
@@ -365,8 +365,19 @@
      * binary value that is then rounded to type {@code float}
      * by the usual round-to-nearest rule of IEEE 754 floating-point
      * arithmetic, which includes preserving the sign of a zero
-     * value. Finally, a {@code Float} object representing this
-     * {@code float} value is returned.
+     * value.
+     *
+     * Note that the round-to-nearest rule also implies overflow and
+     * underflow behaviour; if the exact value of {@code s} is large
+     * enough in magnitude (greater than or equal to ({@link
+     * #MAX_VALUE} + {@link Math#ulp(float) ulp(MAX_VALUE)}/2),
+     * rounding to {@code float} will result in an infinity and if the
+     * exact value of {@code s} is small enough in magnitude (less
+     * than or equal to {@link #MIN_VALUE}/2), rounding to float will
+     * result in a zero.
+     *
+     * Finally, after rounding a {@code Float} object representing
+     * this {@code float} value is returned.
      *
      * <p>To interpret localized string representations of a
      * floating-point value, use subclasses of {@link
--- a/src/share/classes/java/net/DatagramSocket.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/java/net/DatagramSocket.java	Sat Jan 24 16:35:17 2009 -0800
@@ -41,10 +41,11 @@
  * one machine to another may be routed differently, and may arrive in
  * any order.
  *
- * <p>UDP broadcasts sends are always enabled on a DatagramSocket.
- * In order to receive broadcast packets a DatagramSocket
- * should be bound to the wildcard address. In some
- * implementations, broadcast packets may also be received when
+ * <p> Where possible, a newly constructed {@code DatagramSocket} has the
+ * {@link SocketOptions#SO_BROADCAST SO_BROADCAST} socket option enabled so as
+ * to allow the transmission of broadcast datagrams. In order to receive
+ * broadcast packets a DatagramSocket should be bound to the wildcard address.
+ * In some implementations, broadcast packets may also be received when
  * a DatagramSocket is bound to a more specific address.
  * <p>
  * Example:
@@ -1017,9 +1018,18 @@
 
     /**
      * Enable/disable SO_BROADCAST.
-     * @param on     whether or not to have broadcast turned on.
-     * @exception SocketException if there is an error
-     * in the underlying protocol, such as an UDP error.
+     *
+     * <p> Some operating systems may require that the Java virtual machine be
+     * started with implementation specific privileges to enable this option or
+     * send broadcast datagrams.
+     *
+     * @param  on
+     *         whether or not to have broadcast turned on.
+     *
+     * @throws  SocketException
+     *          if there is an error in the underlying protocol, such as an UDP
+     *          error.
+     *
      * @since 1.4
      * @see #getBroadcast()
      */
--- a/src/share/classes/java/util/Collection.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/java/util/Collection.java	Sat Jan 24 16:35:17 2009 -0800
@@ -427,7 +427,7 @@
      * contract for the <tt>Object.hashCode</tt> method, programmers should
      * take note that any class that overrides the <tt>Object.equals</tt>
      * method must also override the <tt>Object.hashCode</tt> method in order
-     * to satisfy the general contract for the <tt>Object.hashCode</tt>method.
+     * to satisfy the general contract for the <tt>Object.hashCode</tt> method.
      * In particular, <tt>c1.equals(c2)</tt> implies that
      * <tt>c1.hashCode()==c2.hashCode()</tt>.
      *
--- a/src/share/classes/java/util/Formatter.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/java/util/Formatter.java	Sat Jan 24 16:35:17 2009 -0800
@@ -39,6 +39,7 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.MathContext;
+import java.math.RoundingMode;
 import java.nio.charset.Charset;
 import java.text.DateFormatSymbols;
 import java.text.DecimalFormat;
@@ -1252,7 +1253,7 @@
  *     Double#toString(double)} respectively, then the value will be rounded
  *     using the {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
  *     algorithm}.  Otherwise, zeros may be appended to reach the precision.
- *     For a canonical representation of the value,use {@link
+ *     For a canonical representation of the value, use {@link
  *     Float#toString(float)} or {@link Double#toString(double)} as
  *     appropriate.
  *
@@ -3569,15 +3570,23 @@
                 // Create a new BigDecimal with the desired precision.
                 int prec = (precision == -1 ? 6 : precision);
                 int scale = value.scale();
-                int compPrec = value.precision();
-                if (scale > prec)
-                    compPrec -= (scale - prec);
-                MathContext mc = new MathContext(compPrec);
-                BigDecimal v
-                    = new BigDecimal(value.unscaledValue(), scale, mc);
-
-                BigDecimalLayout bdl
-                    = new BigDecimalLayout(v.unscaledValue(), v.scale(),
+
+                if (scale > prec) {
+                    // more "scale" digits than the requested "precision
+                    int compPrec = value.precision();
+                    if (compPrec <= scale) {
+                        // case of 0.xxxxxx
+                        value = value.setScale(prec, RoundingMode.HALF_UP);
+                    } else {
+                        compPrec -= (scale - prec);
+                        value = new BigDecimal(value.unscaledValue(),
+                                               scale,
+                                               new MathContext(compPrec));
+                    }
+                }
+                BigDecimalLayout bdl = new BigDecimalLayout(
+                                           value.unscaledValue(),
+                                           value.scale(),
                                            BigDecimalLayoutForm.DECIMAL_FLOAT);
 
                 char mant[] = bdl.mantissa();
--- a/src/share/classes/java/util/Random.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/java/util/Random.java	Sat Jan 24 16:35:17 2009 -0800
@@ -32,7 +32,7 @@
  * An instance of this class is used to generate a stream of
  * pseudorandom numbers. The class uses a 48-bit seed, which is
  * modified using a linear congruential formula. (See Donald Knuth,
- * <i>The Art of Computer Programming, Volume 3</i>, Section 3.2.1.)
+ * <i>The Art of Computer Programming, Volume 2</i>, Section 3.2.1.)
  * <p>
  * If two instances of {@code Random} are created with the same
  * seed, and the same sequence of method calls is made for each, they
--- a/src/share/classes/sun/nio/ch/FileChannelImpl.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/sun/nio/ch/FileChannelImpl.java	Sat Jan 24 16:35:17 2009 -0800
@@ -60,9 +60,6 @@
     // Memory allocation size for mapping buffers
     private static final long allocationGranularity;
 
-    // Cached field for MappedByteBuffer.isAMappedBuffer
-    private static final Field isAMappedBufferField;
-
     // File descriptor
     private final FileDescriptor fd;
 
@@ -1315,8 +1312,6 @@
         Util.load();
         allocationGranularity = initIDs();
         nd = new FileDispatcher();
-        isAMappedBufferField = Reflect.lookupField("java.nio.MappedByteBuffer",
-                                          "isAMappedBuffer");
     }
 
 }
--- a/src/share/classes/sun/security/krb5/Config.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/sun/security/krb5/Config.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2000-2009 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,7 +74,7 @@
     private String defaultRealm;   // default kdc realm.
 
     // used for native interface
-    private static native String getWindowsDirectory();
+    private static native String getWindowsDirectory(boolean isSystem);
 
 
     /**
@@ -661,38 +661,37 @@
     }
 
     /**
-     * Gets the default configuration file name. The file will be searched
-     * in a list of possible loations in the following order:
-     * 1. the location and file name defined by system property
-     * "java.security.krb5.conf",
-     * 2. at Java home lib\security directory with "krb5.conf" name,
-     * 3. "krb5.ini" at Java home,
-     * 4. at windows directory with the name of "krb5.ini" for Windows,
-     * /etc/krb5/krb5.conf for Solaris, /etc/krb5.conf for Linux.
+     * Gets the default configuration file name. This method will never
+     * return null.
+     *
+     * If the system property "java.security.krb5.conf" is defined, we'll
+     * use its value, no matter if the file exists or not. Otherwise,
+     * the file will be searched in a list of possible loations in the
+     * following order:
+     *
+     * 1. at Java home lib\security directory with "krb5.conf" name,
+     * 2. at windows directory with the name of "krb5.ini" for Windows,
+     * /etc/krb5/krb5.conf for Solaris, /etc/krb5.conf otherwise.
+     *
+     * Note: When the Terminal Service is started in Windows (from 2003),
+     * there are two kinds of Windows directories: A system one (say,
+     * C:\Windows), and a user-private one (say, C:\Users\Me\Windows).
+     * We will first look for krb5.ini in the user-private one. If not
+     * found, try the system one instead.
      */
     private String getFileName() {
         String name =
             java.security.AccessController.doPrivileged(
                                 new sun.security.action.
                                 GetPropertyAction("java.security.krb5.conf"));
-        if (name != null) {
-            boolean temp =
-                java.security.AccessController.doPrivileged(
-                                new FileExistsAction(name));
-            if (temp)
-                return name;
-        } else {
+        if (name == null) {
             name = java.security.AccessController.doPrivileged(
                         new sun.security.action.
                         GetPropertyAction("java.home")) + File.separator +
                                 "lib" + File.separator + "security" +
                                 File.separator + "krb5.conf";
-            boolean temp =
-                java.security.AccessController.doPrivileged(
-                                new FileExistsAction(name));
-            if (temp) {
-                return name;
-            } else {
+            if (!fileExists(name)) {
+                name = null;
                 String osname =
                         java.security.AccessController.doPrivileged(
                         new sun.security.action.GetPropertyAction("os.name"));
@@ -703,19 +702,35 @@
                         // ignore exceptions
                     }
                     if (Credentials.alreadyLoaded) {
-                        if ((name = getWindowsDirectory()) == null) {
-                            name = "c:\\winnt\\krb5.ini";
-                        } else if (name.endsWith("\\")) {
-                            name += "krb5.ini";
-                        } else {
-                            name += "\\krb5.ini";
+                        String path = getWindowsDirectory(false);
+                        if (path != null) {
+                            if (path.endsWith("\\")) {
+                                path = path + "krb5.ini";
+                            } else {
+                                path = path + "\\krb5.ini";
+                            }
+                            if (fileExists(path)) {
+                                name = path;
+                            }
                         }
-                    } else {
+                        if (name == null) {
+                            path = getWindowsDirectory(true);
+                            if (path != null) {
+                                if (path.endsWith("\\")) {
+                                    path = path + "krb5.ini";
+                                } else {
+                                    path = path + "\\krb5.ini";
+                                }
+                                name = path;
+                            }
+                        }
+                    }
+                    if (name == null) {
                         name = "c:\\winnt\\krb5.ini";
                     }
                 } else if (osname.startsWith("SunOS")) {
                     name =  "/etc/krb5/krb5.conf";
-                } else if (osname.startsWith("Linux")) {
+                } else {
                     name =  "/etc/krb5.conf";
                 }
             }
@@ -1171,6 +1186,11 @@
         return kdcs;
     }
 
+    private boolean fileExists(String name) {
+        return java.security.AccessController.doPrivileged(
+                                new FileExistsAction(name));
+    }
+
     static class FileExistsAction
         implements java.security.PrivilegedAction<Boolean> {
 
--- a/src/share/classes/sun/tools/jar/Main.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/share/classes/sun/tools/jar/Main.java	Sat Jan 24 16:35:17 2009 -0800
@@ -74,7 +74,6 @@
     static final String MANIFEST = JarFile.MANIFEST_NAME;
     static final String MANIFEST_DIR = "META-INF/";
     static final String VERSION = "1.0";
-    static final char SEPARATOR = File.separatorChar;
     static final String INDEX = JarIndex.INDEX_NAME;
 
     private static ResourceBundle rsrc;
@@ -227,19 +226,32 @@
                     }
                     tmpFile.delete();
                 }
-            } else if (xflag || tflag) {
-                InputStream in;
+            } else if (tflag) {
+                replaceFSC(files);
                 if (fname != null) {
-                    in = new FileInputStream(fname);
+                    list(fname, files);
                 } else {
-                    in = new FileInputStream(FileDescriptor.in);
+                    InputStream in = new FileInputStream(FileDescriptor.in);
+                    try{
+                        list(new BufferedInputStream(in), files);
+                    } finally {
+                        in.close();
+                    }
                 }
-                if (xflag) {
-                    extract(new BufferedInputStream(in), files);
+            } else if (xflag) {
+                replaceFSC(files);
+                if (fname != null && files != null) {
+                    extract(fname, files);
                 } else {
-                    list(new BufferedInputStream(in), files);
+                    InputStream in = (fname == null)
+                        ? new FileInputStream(FileDescriptor.in)
+                        : new FileInputStream(fname);
+                    try {
+                        extract(new BufferedInputStream(in), files);
+                    } finally {
+                        in.close();
+                    }
                 }
-                in.close();
             } else if (iflag) {
                 genIndex(rootjar, files);
             }
@@ -760,6 +772,31 @@
         e.setCrc(crc32.getValue());
     }
 
+    void replaceFSC(String files[]) {
+        if (files != null) {
+            for (String file : files) {
+                file = file.replace(File.separatorChar, '/');
+            }
+        }
+    }
+
+    Set<ZipEntry> newDirSet() {
+        return new HashSet<ZipEntry>() {
+            public boolean add(ZipEntry e) {
+                return ((e == null || useExtractionTime) ? false : super.add(e));
+            }};
+    }
+
+    void updateLastModifiedTime(Set<ZipEntry> zes) throws IOException {
+        for (ZipEntry ze : zes) {
+            long lastModified = ze.getTime();
+            if (lastModified != -1) {
+                File f = new File(ze.getName().replace('/', File.separatorChar));
+                f.setLastModified(lastModified);
+            }
+        }
+    }
+
     /*
      * Extracts specified entries from JAR file.
      */
@@ -768,19 +805,13 @@
         ZipEntry e;
         // Set of all directory entries specified in archive.  Disallows
         // null entries.  Disallows all entries if using pre-6.0 behavior.
-        Set<ZipEntry> dirs = new HashSet<ZipEntry>() {
-            public boolean add(ZipEntry e) {
-                return ((e == null || useExtractionTime) ? false : super.add(e));
-            }};
-
+        Set<ZipEntry> dirs = newDirSet();
         while ((e = zis.getNextEntry()) != null) {
             if (files == null) {
                 dirs.add(extractFile(zis, e));
-
             } else {
                 String name = e.getName();
-                for (int i = 0; i < files.length; i++) {
-                    String file = files[i].replace(File.separatorChar, '/');
+                for (String file : files) {
                     if (name.startsWith(file)) {
                         dirs.add(extractFile(zis, e));
                         break;
@@ -793,13 +824,33 @@
         // timestamps as given in the archive.  We do this after extraction,
         // instead of during, because creating a file in a directory changes
         // that directory's timestamp.
-        for (ZipEntry dirEntry : dirs) {
-            long lastModified = dirEntry.getTime();
-            if (lastModified != -1) {
-                File dir = new File(dirEntry.getName().replace('/', File.separatorChar));
-                dir.setLastModified(lastModified);
+        updateLastModifiedTime(dirs);
+    }
+
+    /*
+     * Extracts specified entries from JAR file, via ZipFile.
+     */
+    void extract(String fname, String files[]) throws IOException {
+        ZipFile zf = new ZipFile(fname);
+        Set<ZipEntry> dirs = newDirSet();
+        Enumeration<? extends ZipEntry> zes = zf.entries();
+        while (zes.hasMoreElements()) {
+            ZipEntry e = zes.nextElement();
+            InputStream is;
+            if (files == null) {
+                dirs.add(extractFile(zf.getInputStream(e), e));
+            } else {
+                String name = e.getName();
+                for (String file : files) {
+                    if (name.startsWith(file)) {
+                        dirs.add(extractFile(zf.getInputStream(e), e));
+                        break;
+                    }
+                }
             }
         }
+        zf.close();
+        updateLastModifiedTime(dirs);
     }
 
     /*
@@ -807,7 +858,7 @@
      * the entry is for a directory which doesn't exist prior to this
      * invocation, returns that entry, otherwise returns null.
      */
-    ZipEntry extractFile(ZipInputStream zis, ZipEntry e) throws IOException {
+    ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
         ZipEntry rc = null;
         String name = e.getName();
         File f = new File(e.getName().replace('/', File.separatorChar));
@@ -838,13 +889,19 @@
                 }
             }
             OutputStream os = new FileOutputStream(f);
-            byte[] b = new byte[512];
+            byte[] b = new byte[8192];
             int len;
-            while ((len = zis.read(b, 0, b.length)) != -1) {
-                os.write(b, 0, len);
+            try {
+                while ((len = is.read(b, 0, b.length)) != -1) {
+                    os.write(b, 0, len);
+                }
+            } finally {
+                if (is instanceof ZipInputStream)
+                    ((ZipInputStream)is).closeEntry();
+                else
+                    is.close();
+                os.close();
             }
-            zis.closeEntry();
-            os.close();
             if (vflag) {
                 if (e.getMethod() == ZipEntry.DEFLATED) {
                     output(formatMsg("out.inflated", name));
@@ -869,7 +926,6 @@
         ZipInputStream zis = new ZipInputStream(in);
         ZipEntry e;
         while ((e = zis.getNextEntry()) != null) {
-            String name = e.getName();
             /*
              * In the case of a compressed (deflated) entry, the entry size
              * is stored immediately following the entry data and cannot be
@@ -877,20 +933,22 @@
              * the entry first before printing out its attributes.
              */
             zis.closeEntry();
-            if (files == null) {
-                printEntry(e);
-            } else {
-                for (int i = 0; i < files.length; i++) {
-                    String file = files[i].replace(File.separatorChar, '/');
-                    if (name.startsWith(file)) {
-                        printEntry(e);
-                        break;
-                    }
-                }
-            }
+            printEntry(e, files);
         }
     }
 
+    /*
+     * Lists contents of JAR file, via ZipFile.
+     */
+    void list(String fname, String files[]) throws IOException {
+        ZipFile zf = new ZipFile(fname);
+        Enumeration<? extends ZipEntry> zes = zf.entries();
+        while (zes.hasMoreElements()) {
+            printEntry(zes.nextElement(), files);
+        }
+        zf.close();
+    }
+
     /**
      * Output the class index table to the INDEX.LIST file of the
      * root jar file.
@@ -974,13 +1032,29 @@
         dumpIndex(rootjar, index);
     }
 
+    /*
+     * Prints entry information, if requested.
+     */
+    void printEntry(ZipEntry e, String[] files) throws IOException {
+        if (files == null) {
+            printEntry(e);
+        } else {
+            String name = e.getName();
+            for (String file : files) {
+                if (name.startsWith(file)) {
+                    printEntry(e);
+                    return;
+                }
+            }
+        }
+    }
 
     /*
      * Prints entry information.
      */
     void printEntry(ZipEntry e) throws IOException {
         if (vflag) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             String s = Long.toString(e.getSize());
             for (int i = 6 - s.length(); i > 0; --i) {
                 sb.append(' ');
--- a/src/windows/native/sun/security/krb5/WindowsDirectory.c	Thu Jan 22 14:42:13 2009 -0800
+++ b/src/windows/native/sun/security/krb5/WindowsDirectory.c	Sat Jan 24 16:35:17 2009 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2009 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,6 +23,7 @@
  * have any questions.
  */
 
+#define UNICODE
 #include <jni.h>
 #include <windows.h>
 #include <stdlib.h>
@@ -30,22 +31,20 @@
 /*
  * Class:     sun_security_krb5_Config
  * Method:    getWindowsDirectory
- * Signature: ()Ljava/lang/String;
+ * Signature: (Z)Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL Java_sun_security_krb5_Config_getWindowsDirectory(
-    JNIEnv* env, jclass configClass) {
-    LPTSTR lpPath = NULL;
-    UINT uLength ;
-    jstring path = NULL;
-
-    if (uLength = GetWindowsDirectory(lpPath, 0)) {
-        lpPath = (LPTSTR)malloc(sizeof(TCHAR) * uLength);
-        if (lpPath != NULL) {
-            if (GetWindowsDirectory(lpPath, uLength)) {
-                path = (*env)->NewStringUTF(env, lpPath);
-            }
-            free(lpPath);
-        }
+        JNIEnv* env, jclass configClass, jboolean isSystem) {
+    TCHAR lpPath[MAX_PATH+1];
+    UINT len;
+    if (isSystem) {
+        len = GetSystemWindowsDirectory(lpPath, MAX_PATH);
+    } else {
+        len = GetWindowsDirectory(lpPath, MAX_PATH);
     }
-    return path;
+    if (len) {
+        return (*env)->NewString(env, lpPath, len);
+    } else {
+        return NULL;
+    }
 }
--- a/test/java/util/Formatter/Basic-X.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/Basic-X.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1054,6 +1054,52 @@
         test("%4.1f", " 1.0", val);
         test("%4.2f", "0.99", val);
         test("%4.3f", "0.990", val);
+
+        // #6476425
+        val = new BigDecimal("0.00001");
+        test("%.0f", "0", val);
+        test("%.1f", "0.0", val);
+        test("%.2f", "0.00", val);
+        test("%.3f", "0.000", val);
+        test("%.4f", "0.0000", val);
+        test("%.5f", "0.00001", val);
+
+        val = new BigDecimal("1.00001");
+        test("%.0f", "1", val);
+        test("%.1f", "1.0", val);
+        test("%.2f", "1.00", val);
+        test("%.3f", "1.000", val);
+        test("%.4f", "1.0000", val);
+        test("%.5f", "1.00001", val);
+
+        val = new BigDecimal("1.23456");
+        test("%.0f", "1", val);
+        test("%.1f", "1.2", val);
+        test("%.2f", "1.23", val);
+        test("%.3f", "1.235", val);
+        test("%.4f", "1.2346", val);
+        test("%.5f", "1.23456", val);
+        test("%.6f", "1.234560", val);
+
+        val = new BigDecimal("9.99999");
+        test("%.0f", "10", val);
+        test("%.1f", "10.0", val);
+        test("%.2f", "10.00", val);
+        test("%.3f", "10.000", val);
+        test("%.4f", "10.0000", val);
+        test("%.5f", "9.99999", val);
+        test("%.6f", "9.999990", val);
+
+
+        val = new BigDecimal("1.99999");
+        test("%.0f", "2", val);
+        test("%.1f", "2.0", val);
+        test("%.2f", "2.00", val);
+        test("%.3f", "2.000", val);
+        test("%.4f", "2.0000", val);
+        test("%.5f", "1.99999", val);
+        test("%.6f", "1.999990", val);
+
 #end[BigDecimal]
 
 #if[float]
--- a/test/java/util/Formatter/Basic.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/Basic.java	Sat Jan 24 16:35:17 2009 -0800
@@ -25,7 +25,7 @@
  * @summary Unit test for formatter
  * @bug 4906370 4962433 4973103 4989961 5005818 5031150 4970931 4989491 5002937
  *      5005104 5007745 5061412 5055180 5066788 5088703 6317248 6318369 6320122
- *      6344623 6369500 6534606 6282094 6286592
+ *      6344623 6369500 6534606 6282094 6286592 6476425
  *
  * @run shell/timeout=240 Basic.sh
  */
--- a/test/java/util/Formatter/BasicBigDecimal.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicBigDecimal.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1055,6 +1055,52 @@
         test("%4.2f", "0.99", val);
         test("%4.3f", "0.990", val);
 
+        // #6476425
+        val = new BigDecimal("0.00001");
+        test("%.0f", "0", val);
+        test("%.1f", "0.0", val);
+        test("%.2f", "0.00", val);
+        test("%.3f", "0.000", val);
+        test("%.4f", "0.0000", val);
+        test("%.5f", "0.00001", val);
+
+        val = new BigDecimal("1.00001");
+        test("%.0f", "1", val);
+        test("%.1f", "1.0", val);
+        test("%.2f", "1.00", val);
+        test("%.3f", "1.000", val);
+        test("%.4f", "1.0000", val);
+        test("%.5f", "1.00001", val);
+
+        val = new BigDecimal("1.23456");
+        test("%.0f", "1", val);
+        test("%.1f", "1.2", val);
+        test("%.2f", "1.23", val);
+        test("%.3f", "1.235", val);
+        test("%.4f", "1.2346", val);
+        test("%.5f", "1.23456", val);
+        test("%.6f", "1.234560", val);
+
+        val = new BigDecimal("9.99999");
+        test("%.0f", "10", val);
+        test("%.1f", "10.0", val);
+        test("%.2f", "10.00", val);
+        test("%.3f", "10.000", val);
+        test("%.4f", "10.0000", val);
+        test("%.5f", "9.99999", val);
+        test("%.6f", "9.999990", val);
+
+
+        val = new BigDecimal("1.99999");
+        test("%.0f", "2", val);
+        test("%.1f", "2.0", val);
+        test("%.2f", "2.00", val);
+        test("%.3f", "2.000", val);
+        test("%.4f", "2.0000", val);
+        test("%.5f", "1.99999", val);
+        test("%.6f", "1.999990", val);
+
+
 
 
 
--- a/test/java/util/Formatter/BasicBigInteger.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicBigInteger.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicBoolean.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicBoolean.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicBooleanObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicBooleanObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicByte.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicByte.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicByteObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicByteObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicChar.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicChar.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicCharObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicCharObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicDateTime.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicDateTime.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicDouble.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicDouble.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1074,6 +1074,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %f - float, double, Double, BigDecimal
         //---------------------------------------------------------------------
--- a/test/java/util/Formatter/BasicDoubleObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicDoubleObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1074,6 +1074,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %f - float, double, Double, BigDecimal
         //---------------------------------------------------------------------
--- a/test/java/util/Formatter/BasicFloat.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicFloat.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1057,6 +1057,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %f - float
         //---------------------------------------------------------------------
--- a/test/java/util/Formatter/BasicFloatObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicFloatObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1090,6 +1090,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %g
         //
--- a/test/java/util/Formatter/BasicInt.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicInt.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicIntObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicIntObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicLong.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicLong.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicLongObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicLongObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicShort.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicShort.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/BasicShortObject.java	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/BasicShortObject.java	Sat Jan 24 16:35:17 2009 -0800
@@ -1524,6 +1524,52 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         //---------------------------------------------------------------------
         // %t
         //
--- a/test/java/util/Formatter/genBasic.sh	Thu Jan 22 14:42:13 2009 -0800
+++ b/test/java/util/Formatter/genBasic.sh	Sat Jan 24 16:35:17 2009 -0800
@@ -23,14 +23,14 @@
 # have any questions.
 #
 
-SPP='sh ../../../../make/java/nio/spp.sh'
+javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java
 
 gen() {
 #  if [ $3 = "true" ]
 #  then $SPP -K$1 -Dtype=$1 -DType=$2 -Kprim<Basic-X.java >Basic$2.java
 #  else $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 <Basic-X.java >Basic$2.java
 #  fi
- $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java >Basic$2.java
+    java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java >Basic$2.java
 }
 
 gen boolean Boolean       prim  ""  ""   ""
@@ -54,3 +54,5 @@
 gen BigDecimal BigDecimal ""    fp  ""   ""
 
 gen Calendar DateTime     ""    ""  ""   datetime
+
+rm -rf build