8136597: java/lang/ProcessHandle/InfoTest.java fails
authorrriggs
Mon, 21 Dec 2015 15:26:56 -0500
changeset 34775 311773a49782
parent 34774 03b4e6dc367b
child 34779 b48aefdd9a34
8136597: java/lang/ProcessHandle/InfoTest.java fails Summary: Correct for truncated command line Reviewed-by: redestad
jdk/test/java/lang/ProcessHandle/InfoTest.java
--- a/jdk/test/java/lang/ProcessHandle/InfoTest.java	Mon Dec 21 20:54:00 2015 +0100
+++ b/jdk/test/java/lang/ProcessHandle/InfoTest.java	Mon Dec 21 15:26:56 2015 -0500
@@ -49,7 +49,7 @@
 
 /*
  * @test
- * @bug 8077350 8081566 8081567 8098852
+ * @bug 8077350 8081566 8081567 8098852 8136597
  * @build jdk.testlibrary.*
  * @library /lib/testlibrary
  * @summary Functions of ProcessHandle.Info
@@ -210,10 +210,12 @@
                             Assert.assertTrue(commandLine.contains(allArgs.get(i)),
                                               "commandLine() must contain argument: " + allArgs.get(i));
                         }
-                    } else if (info.commandLine().isPresent()) {
+                    } else if (info.commandLine().isPresent() &&
+                            command.isPresent() &&
+                            command.get().length() < info.commandLine().get().length()) {
                         // If we only have the commandLine() we can only do some basic checks...
                         String commandLine = info.commandLine().get();
-                        String javaExe = "java" + (Platform.isWindows() ? ".exe": "");
+                        String javaExe = "java" + (Platform.isWindows() ? ".exe" : "");
                         int pos = commandLine.indexOf(javaExe);
                         Assert.assertTrue(pos > 0, "commandLine() should at least contain 'java'");