changeset 13345:7cef11a5e1af

8136597: java/lang/ProcessHandle/InfoTest.java fails Summary: Correct for truncated command line Reviewed-by: redestad
author rriggs
date Mon, 21 Dec 2015 15:26:56 -0500
parents 70ae19973321
children bb61b1821253
files test/java/lang/ProcessHandle/InfoTest.java
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/ProcessHandle/InfoTest.java	Mon Dec 21 20:54:00 2015 +0100
+++ b/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'");