Skip to content

Commit

Permalink
Use System dependent file separator backport (#91273) (#91282)
Browse files Browse the repository at this point in the history
In windows path separator is different than in linux, therefore a File.separator should be used instead of just /

closes #91265
  • Loading branch information
pgomulka committed Nov 3, 2022
1 parent 9afc9d9 commit 396f062
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/src/main/java/org/elasticsearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@

import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -1128,7 +1129,13 @@ public static void deleteTemporaryApmConfig(JvmInfo jvmInfo, BiConsumer<Exceptio
if (inputArgument.startsWith("-javaagent:")) {
final String agentArg = inputArgument.substring(11);
final String[] parts = agentArg.split("=", 2);
if (parts[0].matches(".*modules/apm/elastic-apm-agent-\\d+\\.\\d+\\.\\d+\\.jar")) {
String APM_AGENT_CONFIG_FILE_REGEX = String.join(
"\\" + File.separator,
".*modules",
"apm",
"elastic-apm-agent-\\d+\\.\\d+\\.\\d+\\.jar"
);
if (parts[0].matches(APM_AGENT_CONFIG_FILE_REGEX)) {
if (parts.length == 2 && parts[1].startsWith("c=")) {
final Path apmConfig = PathUtils.get(parts[1].substring(2));
if (apmConfig.getFileName().toString().matches("^\\.elstcapm\\..*\\.tmp")) {
Expand Down

0 comments on commit 396f062

Please sign in to comment.