changeset 7056:d1eb22609ec2

Merge
author asaha
date Fri, 27 Sep 2013 13:09:14 -0700
parents ae5a0572178d (current diff) 3c9a6d9eafd3 (diff)
children 8c343a783777 d76613074ff3
files .hgtags
diffstat 9 files changed, 98 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Sep 19 15:01:29 2013 -0700
+++ b/.hgtags	Fri Sep 27 13:09:14 2013 -0700
@@ -357,3 +357,6 @@
 d4506b816f63330489e00ba0b9e3c6583a8a9efa jdk7u45-b10
 ee87452ba9e2b4b7d847bd2a7910a8aaeacfea7b jdk7u45-b11
 d5e393a55e6adc2f1b9aaa752a5004fa07561480 jdk7u45-b12
+34997920efe962b2e4422e2c2de8ae91cd1d563d jdk7u45-b13
+59a78e4ca635a469a763ee408b11f8e1033f2584 jdk7u45-b14
+96782fe0c38c41cc4806e27ee64b20dc647ea808 jdk7u45-b15
--- a/make/common/shared/Defs.gmk	Thu Sep 19 15:01:29 2013 -0700
+++ b/make/common/shared/Defs.gmk	Fri Sep 27 13:09:14 2013 -0700
@@ -296,10 +296,8 @@
   RELEASE      = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
 endif
 
-# FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
-ifdef BUILD_NUMBER
-  FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
-else
+# Define default USER_RELEASE_SUFFIX if BUILD_NUMBER and USER_RELEASE_SUFFIX are not set
+ifndef BUILD_NUMBER
   BUILD_NUMBER = b00
   ifndef USER_RELEASE_SUFFIX
     BUILD_DATE := $(shell $(DATE) '+%Y_%m_%d_%H_%M')
@@ -307,6 +305,12 @@
     USER_RELEASE_SUFFIX := $(shell $(ECHO) "$(CLEAN_USERNAME)_$(BUILD_DATE)" | $(TR) '[:upper:]' '[:lower:]' )
   endif
   export USER_RELEASE_SUFFIX
+endif
+
+# FULL_VERSION is RELEASE and BUILD_NUMBER if USER_RELEASE_SUFFIX is not set
+ifndef USER_RELEASE_SUFFIX
+  FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
+else
   FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
 endif
 
--- a/src/share/classes/java/io/File.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/src/share/classes/java/io/File.java	Fri Sep 27 13:09:14 2013 -0700
@@ -1885,10 +1885,18 @@
             } else {
                 n = Math.abs(n);
             }
+
+            // Use only the file name from the supplied prefix
+            prefix = (new File(prefix)).getName();
+
             String name = prefix + Long.toString(n) + suffix;
             File f = new File(dir, name);
-            if (!name.equals(f.getName()))
-                throw new IOException("Unable to create temporary file");
+            if (!name.equals(f.getName())) {
+                if (System.getSecurityManager() != null)
+                    throw new IOException("Unable to create temporary file");
+                else
+                    throw new IOException("Unable to create temporary file, " + f);
+            }
             return f;
         }
     }
--- a/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/src/solaris/classes/sun/nio/ch/DevPollArrayWrapper.java	Fri Sep 27 13:09:14 2013 -0700
@@ -26,9 +26,11 @@
 package sun.nio.ch;
 
 import java.io.IOException;
+import java.security.AccessController;
 import java.util.BitSet;
 import java.util.Map;
 import java.util.HashMap;
+import sun.security.action.GetIntegerAction;
 
 
 /**
@@ -78,10 +80,11 @@
     static final int   NUM_POLLFDS   = Math.min(OPEN_MAX-1, 8192);
 
     // Initial size of arrays for fd registration changes
-    private final int INITIAL_PENDING_UPDATE_SIZE = 64;
+    private static final int INITIAL_PENDING_UPDATE_SIZE = 64;
 
     // maximum size of updatesLow
-    private final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024);
+    private static final int MAX_UPDATE_ARRAY_SIZE = AccessController.doPrivileged(
+        new GetIntegerAction("sun.nio.ch.maxUpdateArraySize", Math.min(OPEN_MAX, 64*1024)));
 
     // The pollfd array for results from devpoll driver
     private final AllocatedNativeObject pollArray;
--- a/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java	Fri Sep 27 13:09:14 2013 -0700
@@ -26,9 +26,11 @@
 package sun.nio.ch;
 
 import java.io.IOException;
+import java.security.AccessController;
 import java.util.BitSet;
 import java.util.HashMap;
 import java.util.Map;
+import sun.security.action.GetIntegerAction;
 
 /**
  * Manipulates a native array of epoll_event structs on Linux:
@@ -78,8 +80,8 @@
     private static final int INITIAL_PENDING_UPDATE_SIZE = 64;
 
     // maximum size of updatesLow
-    private static final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024);
-
+    private static final int MAX_UPDATE_ARRAY_SIZE = AccessController.doPrivileged(
+        new GetIntegerAction("sun.nio.ch.maxUpdateArraySize", Math.min(OPEN_MAX, 64*1024)));
 
     // The fd of the epoll driver
     private final int epfd;
@@ -164,6 +166,16 @@
     }
 
     /**
+     * Returns {@code true} if updates for the given key (file
+     * descriptor) are killed.
+     */
+    private boolean isEventsHighKilled(Integer key) {
+        assert key >= MAX_UPDATE_ARRAY_SIZE;
+        Byte value = eventsHigh.get(key);
+        return (value != null && value == KILLED);
+    }
+
+    /**
      * Sets the pending update events for the given file descriptor. This
      * method has no effect if the update events is already set to KILLED,
      * unless {@code force} is {@code true}.
@@ -175,7 +187,7 @@
             }
         } else {
             Integer key = Integer.valueOf(fd);
-            if ((eventsHigh.get(key) != KILLED) || force) {
+            if (!isEventsHighKilled(key) || force) {
                 eventsHigh.put(key, Byte.valueOf(events));
             }
         }
--- a/src/solaris/classes/sun/nio/ch/EventPortWrapper.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/src/solaris/classes/sun/nio/ch/EventPortWrapper.java	Fri Sep 27 13:09:14 2013 -0700
@@ -25,9 +25,14 @@
 
 package sun.nio.ch;
 
+import java.io.IOException;
+import java.security.AccessController;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.Map;
+
 import sun.misc.Unsafe;
-import java.io.IOException;
-import java.util.*;
+import sun.security.action.GetIntegerAction;
 import static sun.nio.ch.SolarisEventPort.*;
 
 /**
@@ -49,7 +54,8 @@
     private final int INITIAL_PENDING_UPDATE_SIZE = 256;
 
     // maximum size of updateArray
-    private final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024);
+    private static final int MAX_UPDATE_ARRAY_SIZE = AccessController.doPrivileged(
+        new GetIntegerAction("sun.nio.ch.maxUpdateArraySize", Math.min(OPEN_MAX, 64*1024)));
 
     // special update status to indicate that it should be ignored
     private static final byte IGNORE = -1;
--- a/test/java/io/File/createTempFile/SpecialTempFile.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/test/java/io/File/createTempFile/SpecialTempFile.java	Fri Sep 27 13:09:14 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8013827 8011950
+ * @bug 8013827 8011950 8025128
  * @summary Check whether File.createTempFile can handle special parameters
  *          on Windows platforms
  * @author Dan Xu
@@ -34,7 +34,9 @@
 
 public class SpecialTempFile {
 
-    private static void test(String name, String[] prefix, String[] suffix) {
+    private static void test(String name, String[] prefix, String[] suffix,
+                             boolean expectedException) throws IOException
+    {
         if (prefix == null || suffix == null
             || prefix.length != suffix.length)
         {
@@ -42,39 +44,59 @@
         }
 
         final String exceptionMsg = "Unable to create temporary file";
-        final String errMsg = "IOException is expected";
 
         for (int i = 0; i < prefix.length; i++) {
             boolean exceptionThrown = false;
             File f = null;
-            System.out.println("In test " + name
-                               + ", creating temp file with prefix, "
-                               + prefix[i] + ", suffix, " + suffix[i]);
-            try {
-                f = File.createTempFile(prefix[i], suffix[i]);
-            } catch (IOException e) {
-                if (exceptionMsg.equals(e.getMessage()))
-                    exceptionThrown = true;
-                else
-                    System.out.println("Wrong error message:" + e.getMessage());
+
+            String[] dirs = { null, "." };
+
+            for (String dir : dirs ) {
+                System.out.println("In test " + name +
+                                   ", creating temp file with prefix, " +
+                                   prefix[i] + ", suffix, " + suffix[i] +
+                                   ", in dir, " + dir);
+
+                try {
+                    if (dir == null || dir.isEmpty())
+                        f = File.createTempFile(prefix[i], suffix[i]);
+                    else
+                        f = File.createTempFile(prefix[i], suffix[i], new File(dir));
+                } catch (IOException e) {
+                    if (expectedException) {
+                        if (e.getMessage().startsWith(exceptionMsg))
+                            exceptionThrown = true;
+                        else
+                            System.out.println("Wrong error message:" +
+                                               e.getMessage());
+                    } else {
+                        throw e;
+                    }
+                }
+
+                if (expectedException && (!exceptionThrown || f != null))
+                    throw new RuntimeException("IOException is expected");
             }
-            if (!exceptionThrown || f != null)
-                throw new RuntimeException(errMsg);
         }
     }
 
     public static void main(String[] args) throws Exception {
+        // Test JDK-8025128
+        String[] goodPre = { "///..///", "/foo" };
+        String[] goodSuf = { ".temp", ".tmp" };
+        test("goodName", goodPre, goodSuf, false);
+
+        // Test JDK-8011950
+        String[] slashPre = { "temp", "///..///", "/foo" };
+        String[] slashSuf = { "///..///..", "///..///..", "///..///.." };
+        test("SlashedName", slashPre, slashSuf, true);
+
         if (!System.getProperty("os.name").startsWith("Windows"))
             return;
 
         // Test JDK-8013827
         String[] resvPre = { "LPT1.package.zip", "com7.4.package.zip" };
         String[] resvSuf = { ".temp", ".temp" };
-        test("ReservedName", resvPre, resvSuf);
-
-        // Test JDK-8011950
-        String[] slashPre = { "///..///", "temp", "///..///" };
-        String[] slashSuf = { ".temp", "///..///..", "///..///.." };
-        test("SlashedName", slashPre, slashSuf);
+        test("ReservedName", resvPre, resvSuf, true);
     }
 }
--- a/test/java/nio/channels/Selector/LotsOfChannels.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/test/java/nio/channels/Selector/LotsOfChannels.java	Fri Sep 27 13:09:14 2013 -0700
@@ -22,9 +22,10 @@
  */
 
 /* @test
- * @bug 4503092
+ * @bug 4503092 8024883
  * @summary Tests that Windows Selector can use more than 63 channels
- * @run main/timeout=300 LotsOfChannels
+ * @run main LotsOfChannels
+ * @run main/othervm -Dsun.nio.ch.maxUpdateArraySize=64 LotsOfChannels
  * @author kladko
  */
 
--- a/test/java/nio/channels/Selector/SelectorLimit.java	Thu Sep 19 15:01:29 2013 -0700
+++ b/test/java/nio/channels/Selector/SelectorLimit.java	Fri Sep 27 13:09:14 2013 -0700
@@ -22,12 +22,13 @@
  */
 
 /* @test
- * @bug 4777504
+ * @bug 4777504 8024883
  * @summary Ensure that a Selector can return at least 100 selected keys
  * @author Mark Reinhold
  * @library ..
  * @build SelectorLimit
  * @run main/othervm SelectorLimit
+ * @run main/othervm -Dsun.nio.ch.maxUpdateArraySize=128 SelectorLimit
  */
 
 import java.io.*;