Please review this cleanup change in the cgroup subsystem which used to use hard-coded stack allocated buffers for concatenating strings in memory. We can use `stringStream` instead which doesn't have the issue of hard-coding maximum lengths (and related checks) and makes the code, thus, easier to read.
While at it, I've written basic `gtests` verifying current behaviour (and the same for the JDK code). From a functionality point of view this is a no-op (modulo the one bug in the substring case which seems to be there since day one). I'd prefer if we could defer any change in functionality to a separate bug as this is meant to only use stringStream throughout the cgroups code. Testing: - [x] Container tests on Linux x86_64 cgroups v1 and cgroups v2 - [x] Added tests, which I've verified also pass before the stringStream change Thoughts? ------------- Commit messages: - Add cgroups v2 java test - use stringStream in cgroups v2 - Add gtest for cgroups v2 code path - 8287007: [cgroups] Consistently use stringStream throughout parsing code - 8287007: [cgroups] Consistently use stringStream throughout parsing code Changes: https://git.openjdk.java.net/jdk/pull/8969/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8969&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287007 Stats: 270 lines in 5 files changed: 235 ins; 19 del; 16 mod Patch: https://git.openjdk.java.net/jdk/pull/8969.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8969/head:pull/8969 PR: https://git.openjdk.java.net/jdk/pull/8969