From 3764334422404efa2fc335ee2255414a6cf1111a Mon Sep 17 00:00:00 2001 From: Rafael Vasquez Date: Tue, 31 Oct 2023 11:03:54 -0400 Subject: [PATCH 1/3] Removes cmd line string concat Signed-off-by: Rafael Vasquez --- .../java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java b/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java index ef802161..4b2c7f01 100644 --- a/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java +++ b/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java @@ -315,7 +315,8 @@ public static int getPID(Process process) throws Exception { } public static int killProcess(Process process) throws Exception { - int pid = getPID(process); - return Runtime.getRuntime().exec("kill -9 " + pid).waitFor(); + String pid = Integer.toString(getPID(process)); + String command = "kill -9"; + return Runtime.getRuntime().exec(new String[] {command, pid}).waitFor(); } } From 8bec96f90d7e354ae088e96c619d2d6af6d353e1 Mon Sep 17 00:00:00 2001 From: Rafael Vasquez Date: Tue, 31 Oct 2023 13:11:43 -0400 Subject: [PATCH 2/3] Use possessive quantifier Signed-off-by: Rafael Vasquez --- src/main/java/com/ibm/watson/modelmesh/ModelMesh.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java b/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java index 78c776b4..fefa4a5e 100644 --- a/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java +++ b/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java @@ -927,7 +927,7 @@ protected final TProcessor initialize() throws Exception { // "type" or "type:p1=v1;p2=v2;...;pn=vn" private static final Pattern METRICS_CONFIG_PATT = Pattern.compile("([a-z;]+)(:\\w+=[^;]+(?:;\\w+=[^;]+)*)?"); // "metric_name" or "metric:name;l1=v1,l2=v2,...,ln=vn," - private static final Pattern CUSTOM_METRIC_CONFIG_PATT = Pattern.compile("([a-z_:]+);(\\w+=[^;]+(?:;\\w+=[^,]+)*)?"); + private static final Pattern CUSTOM_METRIC_CONFIG_PATT = Pattern.compile("([a-z_:]+);(\\w+=[^;]+(?:;\\w+=[^,]++)*)?"); private static Metrics setUpMetrics() throws Exception { if (System.getenv("MM_METRICS_STATSD_PORT") != null || System.getenv("MM_METRICS_PROMETHEUS_PORT") != null) { From 4379300e108e079bcf168a6cf62dc466909f054f Mon Sep 17 00:00:00 2001 From: Rafael Vasquez Date: Wed, 1 Nov 2023 12:06:27 -0400 Subject: [PATCH 3/3] Fixes command args Signed-off-by: Rafael Vasquez --- .../java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java b/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java index 4b2c7f01..d50aa72c 100644 --- a/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java +++ b/src/test/java/com/ibm/watson/modelmesh/ModelMeshTearDownTest.java @@ -316,7 +316,6 @@ public static int getPID(Process process) throws Exception { public static int killProcess(Process process) throws Exception { String pid = Integer.toString(getPID(process)); - String command = "kill -9"; - return Runtime.getRuntime().exec(new String[] {command, pid}).waitFor(); + return Runtime.getRuntime().exec(new String[] {"kill", "-9", pid}).waitFor(); } }