8134420: sun/tools/jps/TestJpsClass fails with java.lang.RuntimeException: The line 'line 2' does not match pattern '^\\d+\\s+.*': expected true, was false
authorjbachorik
Fri, 04 Sep 2015 12:18:03 +0200
changeset 32474 5b41b53a4997
parent 32473 09672cd2a4a0
child 32475 d4e63a5e73c8
8134420: sun/tools/jps/TestJpsClass fails with java.lang.RuntimeException: The line 'line 2' does not match pattern '^\\d+\\s+.*': expected true, was false Reviewed-by: sla, dsamersoff
jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java
jdk/test/ProblemList.txt
jdk/test/sun/tools/jps/JpsBase.java
jdk/test/sun/tools/jps/JpsHelper.java
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java	Fri Sep 04 09:31:47 2015 -0700
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java	Fri Sep 04 12:18:03 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. 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
@@ -106,7 +106,11 @@
                         errorString = " -- jvm args information unavailable";
                         String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
                         if (jvmArgs != null && jvmArgs.length() > 0) {
-                          output.append(' ').append(jvmArgs);
+                          output.append(' ')
+                            .append(
+                                // multi-line args are permitted
+                                jvmArgs.replace("\n", "\\n").replace("\r", "\\r")
+                            );
                         }
                     }
                     if (arguments.showVmFlags()) {
--- a/jdk/test/ProblemList.txt	Fri Sep 04 09:31:47 2015 -0700
+++ b/jdk/test/ProblemList.txt	Fri Sep 04 12:18:03 2015 +0200
@@ -387,11 +387,6 @@
 # 6456333
 sun/tools/jps/TestJpsJarRelative.java				generic-all
 
-# 8134420
-sun/tools/jps/TestJpsClass.java				generic-all
-sun/tools/jps/TestJpsJar.java					generic-all
-sun/tools/jps/TestJpsSanity.java				generic-all
-
 # 6734748
 sun/tools/jinfo/JInfoRunningProcessFlagTest.java		generic-all
 
--- a/jdk/test/sun/tools/jps/JpsBase.java	Fri Sep 04 09:31:47 2015 -0700
+++ b/jdk/test/sun/tools/jps/JpsBase.java	Fri Sep 04 12:18:03 2015 +0200
@@ -138,6 +138,8 @@
         String tmp = str.replace("\\", "\\\\");
         tmp = tmp.replace("+", "\\+");
         tmp = tmp.replace(".", "\\.");
+        tmp = tmp.replace("\n", "\\\\n");
+        tmp = tmp.replace("\r", "\\\\r");
         return tmp;
     }
 
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Fri Sep 04 09:31:47 2015 -0700
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Fri Sep 04 12:18:03 2015 +0200
@@ -97,7 +97,10 @@
      * VM arguments to start test application with.
      * -XX:+UsePerfData is required for running the tests on embedded platforms.
      */
-    public static final String[] VM_ARGS = {"-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails"};
+    public static final String[] VM_ARGS = {
+        "-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails",
+        "-Dmultiline.prop=value1\nvalue2\r\nvalue3"
+    };
     /**
      * VM flag to start test application with
      */