From 191c71c7899d2eccb3f37dc37ed13cd559fe4d0c Mon Sep 17 00:00:00 2001 From: bmoloden Date: Thu, 29 Sep 2016 14:51:54 +0300 Subject: [PATCH] 8160119: Utils.tryFindJvmPid sometimes find incorrect pid Summary: Fixed pattern Reviewed-by: iignatyev, dholmes --- test/testlibrary/com/oracle/java/testlibrary/Utils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/testlibrary/com/oracle/java/testlibrary/Utils.java b/test/testlibrary/com/oracle/java/testlibrary/Utils.java index 84215195c..b332c1e3a 100644 --- a/test/testlibrary/com/oracle/java/testlibrary/Utils.java +++ b/test/testlibrary/com/oracle/java/testlibrary/Utils.java @@ -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 @@ public final class Utils { 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; -- GitLab