Skip to content

Commit 15ce2a0

Browse files
committed
Remove extraneous trim
1 parent ac71c81 commit 15ce2a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

qa/evil-tests/src/test/java/org/elasticsearch/monitor/os/EvilOsProbeTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void testOsPrettyName() throws IOException {
3939
final List<String> lines = Files.readAllLines(PathUtils.get("/etc/os-release"));
4040
for (final String line : lines) {
4141
if (line != null && line.startsWith("PRETTY_NAME=")) {
42-
final Matcher matcher = Pattern.compile("PRETTY_NAME=(\"?|'?)?([^\"']+)\\1\\s*").matcher(line);
42+
final Matcher matcher = Pattern.compile("PRETTY_NAME=(\"?|'?)?([^\"']+)\\1").matcher(line.trim());
4343
assert matcher.matches() : line;
4444
final String prettyName = matcher.group(2);
4545
assertThat(osInfo.getPrettyName(), equalTo(prettyName));

server/src/main/java/org/elasticsearch/monitor/os/OsProbe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ private String getPrettyName() throws IOException {
551551
if (maybePrettyNameLine.isPresent()) {
552552
// we trim since some OS contain trailing space, for example, Oracle Linux Server 6.9 has a trailing space after the quote
553553
final String trimmedPrettyNameLine = maybePrettyNameLine.get().trim();
554-
final Matcher matcher = Pattern.compile("PRETTY_NAME=(\"?|'?)?([^\"']+)\\1\\s*").matcher(trimmedPrettyNameLine);
554+
final Matcher matcher = Pattern.compile("PRETTY_NAME=(\"?|'?)?([^\"']+)\\1").matcher(trimmedPrettyNameLine);
555555
assert matcher.matches() : trimmedPrettyNameLine;
556556
return matcher.group(2);
557557
} else {

0 commit comments

Comments
 (0)