From 92d629b83c79c8f5523e1e4c1021b1050f73a2dd Mon Sep 17 00:00:00 2001 From: "Alexander.Glukhov" Date: Wed, 9 Jul 2025 15:33:57 +0200 Subject: [PATCH] [java-debugger][IDEA-375478] getArtifactPathForBundledAgent: use the resolved `bundledAgentPath` for EEL operations GitOrigin-RevId: 4f4930b6225e8c22f877cac32ea33f6703950387 --- .../debugger/engine/AsyncStacksUtils.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java b/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java index 9d381920a5dc..50761f9e7c1d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java @@ -383,8 +383,10 @@ public final class AsyncStacksUtils { "https://cache-redirector.jetbrains.com/intellij-dependencies", new BuildDependenciesCommunityRoot(Path.of(PathManager.getCommunityHomePath()))); - // The agent file must have a fixed name (AGENT_JAR_NAME) which is mentioned in MANIFEST.MF inside - Files.copy(downloadedAgent, agentArtifactPath); + // The agent file must have a fixed name (AGENT_JAR_NAME) which is mentioned in MANIFEST.MF inside. + // The copy operation is used as the rename operation. + // toRealPath is required because EEL does not support copying of symbolic links + Files.copy(downloadedAgent.toRealPath(), agentArtifactPath); return asEelPath(agentArtifactPath).toString(); } @@ -413,10 +415,16 @@ public final class AsyncStacksUtils { ); } Path temporaryAgentPath = createTemporaryAgentPath(project, disposable); - EelPathUtils.transferLocalContentToRemote( - bundledAgentPath, - new EelPathUtils.TransferTarget.Explicit(temporaryAgentPath) - ); + try { + // toRealPath is required because EEL does not support copying of symbolic links + EelPathUtils.transferLocalContentToRemote( + bundledAgentPath.toRealPath(), + new EelPathUtils.TransferTarget.Explicit(temporaryAgentPath) + ); + } catch (IOException e) { + LOG.error(String.format("Unable to copy the java-debugger agent file from %s to %s", bundledAgentPath, temporaryAgentPath), e); + return null; + } return asEelPath(temporaryAgentPath).toString(); }