Skip to content

Commit 39814a6

Browse files
committed
Reduce use of magic Strings
1 parent 67c9083 commit 39814a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/apache/commons/lang3/RuntimeEnvironment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static boolean fileExists(final String path) {
4040
* @return whether we are running in a container like Docker or Podman. Never null
4141
*/
4242
public static Boolean inContainer() {
43-
return inContainer("");
43+
return inContainer(StringUtils.EMPTY);
4444
}
4545

4646
static boolean inContainer(final String dirPrefix) {
@@ -66,7 +66,7 @@ static boolean inContainer(final String dirPrefix) {
6666
}
6767

6868
/**
69-
* Tests whether the /proc/N/environ file at the given path string contains a specific line prefix.
69+
* Tests whether the {@code /proc/N/environ} file at the given path string contains a specific line prefix.
7070
*
7171
* @param envVarFile The path to a /proc/N/environ file.
7272
* @param key The env var key to find.
@@ -77,7 +77,7 @@ private static String readFile(final String envVarFile, final String key) {
7777
final byte[] bytes = Files.readAllBytes(Paths.get(envVarFile));
7878
final String content = new String(bytes, Charset.defaultCharset());
7979
// Split by null byte character
80-
final String[] lines = content.split("\u0000");
80+
final String[] lines = content.split(String.valueOf(CharUtils.NUL));
8181
final String prefix = key + "=";
8282
return Arrays.stream(lines)
8383
.filter(line -> line.startsWith(prefix))

0 commit comments

Comments
 (0)