8010194: java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh fails with "Timed out waiting ..." (sol)
authoralanb
Sun, 02 Mar 2014 15:56:07 +0000
changeset 23041 1aa7ce9cd0f1
parent 23040 0cb50d5761df
child 23042 cf5449a4da71
8010194: java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh fails with "Timed out waiting ..." (sol) Reviewed-by: chegar
jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java
jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java	Sat Mar 01 11:57:57 2014 -0500
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java	Sun Mar 02 15:56:07 2014 +0000
@@ -22,8 +22,6 @@
  */
 
 /*
- *
- *
  * A Launcher to launch a java process with its standard input, output,
  * and error streams connected to a socket.
  */
@@ -40,24 +38,23 @@
     private static native void launch0(String cmdarray[], int fd) throws IOException;
 
     private static void launch(String className, String options[], String args[], int fd) throws IOException {
-        String[] javacmd = Util.javaCommand();
-        int options_len = (options == null) ? 0 : options.length;
-        int args_len = (args == null) ? 0 : args.length;
-
         // java [-options] class [args...]
-        int len = javacmd.length + options_len + 1 + args_len;
-
+        int optsLen = (options == null) ? 0 : options.length;
+        int argsLen = (args == null) ? 0 : args.length;
+        int len = 1 + optsLen + 1 + argsLen;
         String cmdarray[] = new String[len];
         int pos = 0;
-        for (int i=0; i<javacmd.length; i++) {
-            cmdarray[pos++] = javacmd[i];
-        }
-        for (int i=0; i<options_len; i++) {
-            cmdarray[pos++] = options[i];
+        cmdarray[pos++] = Util.javaCommand();
+        if (options != null) {
+            for (String opt: options) {
+                cmdarray[pos++] = opt;
+            }
         }
         cmdarray[pos++] = className;
-        for (int i=0; i<args_len; i++) {
-            cmdarray[pos++] = args[i];
+        if (args != null) {
+            for (String arg: args) {
+                cmdarray[pos++] = arg;
+            }
         }
         launch0(cmdarray, fd);
     }
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java	Sat Mar 01 11:57:57 2014 -0500
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java	Sun Mar 02 15:56:07 2014 +0000
@@ -22,8 +22,6 @@
  */
 
 /*
- *
- *
  * A collection of utility methods used by the SelectorProvider.inheritedChannel
  * unit tests.
  */
@@ -91,26 +89,9 @@
     /*
      * Return the "java" command and any initial arguments to start the runtime
      * in the current configuration.
-     *
-     * Typically it will return something like :-
-     *      cmd[0] = "/usr/local/java/solaris-sparc/bin/java"
-     * or
-     *      cmd[0] = "/usr/local/java/solaris-sparc/bin/sparcv9/java"
-     *      cmd[1] = "-d64"
      */
-    public static String[] javaCommand() {
-        String exe = System.getProperty("java.home") + File.separator + "bin" +
-            File.separator;
-        String arch = System.getProperty("os.arch");
-        if (arch.equals("sparcv9")) {
-            String cmd[] = new String[2];
-            cmd[0] = exe + "sparcv9/java";
-            cmd[1] = "-d64";
-            return cmd;
-        } else {
-            String cmd[] = new String[1];
-            cmd[0] = exe += "java";
-            return cmd;
-        }
+    public static String javaCommand() {
+        return System.getProperty("java.home") + File.separator + "bin" +
+            File.separator + "java";
     }
 }