changeset 8338:971b3f90ebdc

8160119: Utils.tryFindJvmPid sometimes find incorrect pid Summary: Fixed pattern Reviewed-by: iignatyev, dholmes
author bmoloden
date Thu, 29 Sep 2016 14:51:54 +0300
parents 8b37c5a17316
children 40d65a63379b
files test/testlibrary/com/oracle/java/testlibrary/Utils.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/testlibrary/com/oracle/java/testlibrary/Utils.java	Tue Oct 11 14:07:13 2016 -0400
+++ b/test/testlibrary/com/oracle/java/testlibrary/Utils.java	Thu Sep 29 14:51:54 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -260,8 +260,8 @@
             output = ProcessTools.executeProcess(jcmdLauncher.getCommand());
             output.shouldHaveExitValue(0);
 
-            // Search for a line starting with numbers (pid), follwed by the key.
-            Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n");
+            // Search for a line starting with numbers (pid), followed by the key.
+            Pattern pattern = Pattern.compile("^([0-9]+)\\s.*(" + key + ")", Pattern.MULTILINE);
             Matcher matcher = pattern.matcher(output.getStdout());
 
             int pid = -1;