changeset 14865:9ac2bd4b53d8

8221340: [TESTBUG] TestCgroupMetrics.java fails after fix for JDK-8219562 Reviewed-by: mseledtsov, rriggs
author bobv
date Fri, 10 May 2019 11:15:34 -0400
parents 3b4fb96700f5
children 782926a8b595
files src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java	Fri Nov 27 03:51:54 2020 +0000
+++ b/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java	Fri May 10 11:15:34 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -62,7 +62,7 @@
                     path = mountPoint;
                 }
                 else {
-                    if (root.indexOf(cgroupPath) == 0) {
+                    if (cgroupPath.startsWith(root)) {
                         if (cgroupPath.length() > root.length()) {
                             String cgroupSubstr = cgroupPath.substring(root.length());
                             path = mountPoint + cgroupSubstr;
--- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java	Fri Nov 27 03:51:54 2020 +0000
+++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java	Fri May 10 11:15:34 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -85,7 +85,7 @@
                 String mountPoint = paths[1];
                 if (root != null && cgroupPath != null) {
                     if (root.equals("/")) {
-                        if (cgroupPath.equals("/")) {
+                        if (!cgroupPath.equals("/")) {
                             finalPath = mountPoint + cgroupPath;
                         } else {
                             finalPath = mountPoint;
@@ -94,7 +94,7 @@
                         if (root.equals(cgroupPath)) {
                             finalPath = mountPoint;
                         } else {
-                            if (root.indexOf(cgroupPath) == 0) {
+                            if (cgroupPath.startsWith(root)) {
                                 if (cgroupPath.length() > root.length()) {
                                     String cgroupSubstr = cgroupPath.substring(root.length());
                                     finalPath = mountPoint + cgroupSubstr;
@@ -103,7 +103,7 @@
                         }
                     }
                 }
-                subSystemPaths.put(subSystem, new String[]{finalPath});
+                subSystemPaths.put(subSystem, new String[]{finalPath, mountPoint});
             }
         }
     }