From 721abe37af3ca6d0f4c3c21e7281a59813085ed9 Mon Sep 17 00:00:00 2001 From: "koo.taejin" Date: Tue, 2 May 2023 12:19:31 +0900 Subject: [PATCH] [#9918] Support version like patch form I have checked that an error occurs when running with agent of latest released 2.5.1-p1 version. ``` java.lang.IllegalStateException: pinpoint-bootstrap-x.x.x(-SNAPSHOT)(-RCx).jar not found. at com.navercorp.pinpoint.bootstrap.agentdir.AgentDirBaseClassPathResolver.resolve(AgentDirBaseClassPathResolver.java:73) at com.navercorp.pinpoint.bootstrap.PinpointBootStrap.resolveAgentDir(PinpointBootStrap.java:132) at com.navercorp.pinpoint.bootstrap.PinpointBootStrap.start(PinpointBootStrap.java:100) ``` It seems that the version like patch from (-p1) is not supported, I have fixed it. --- .../bootstrap/agentdir/AgentDirBaseClassPathResolver.java | 2 +- .../navercorp/pinpoint/bootstrap/agentdir/JarDescription.java | 4 ++-- .../pinpoint/bootstrap/agentdir/AgentVersionTest.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentDirBaseClassPathResolver.java b/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentDirBaseClassPathResolver.java index 91741446ada1..a9f30d8aba83 100644 --- a/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentDirBaseClassPathResolver.java +++ b/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentDirBaseClassPathResolver.java @@ -35,7 +35,7 @@ public class AgentDirBaseClassPathResolver implements ClassPathResolver { private final BootLogger logger = BootLogger.getLogger(this.getClass()); - static final String VERSION_PATTERN = "(-[0-9]+\\.[0-9]+\\.[0-9]+((\\-SNAPSHOT)|(-RC[0-9]+))?)?"; + static final String VERSION_PATTERN = "(-[0-9]+\\.[0-9]+\\.[0-9]+((\\-SNAPSHOT)|(-RC[0-9]+)|(-p[0-9]+))?)?"; static final JarDescription bootstrap = new JarDescription("pinpoint-bootstrap", true); private static final String EXTENSIONS = "*.{jar,xml,properties}"; diff --git a/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarDescription.java b/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarDescription.java index 235cf19814fc..fa3ce148c4bf 100644 --- a/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarDescription.java +++ b/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarDescription.java @@ -24,8 +24,8 @@ */ public class JarDescription { - static final String VERSION_PATTERN = "(-[0-9]+\\.[0-9]+\\.[0-9]+((\\-SNAPSHOT)|(-RC[0-9]+))?)?"; - static final String SIMPLE_PATTERN = "-x.x.x(-SNAPSHOT)(-RCx)"; + static final String VERSION_PATTERN = "(-[0-9]+\\.[0-9]+\\.[0-9]+((\\-SNAPSHOT)|(-RC[0-9]+)|(-p[0-9]+))?)?"; + static final String SIMPLE_PATTERN = "-x.x.x(-SNAPSHOT)(-RCx)(-px)"; private final String prefix; private final boolean required; diff --git a/bootstraps/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentVersionTest.java b/bootstraps/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentVersionTest.java index 9541f1159a95..faf33138785d 100644 --- a/bootstraps/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentVersionTest.java +++ b/bootstraps/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/agentdir/AgentVersionTest.java @@ -42,7 +42,7 @@ public void testVersion() { assertVersion("-1.6.0-RC0"); assertVersion("-1.6.0-RC11"); - + assertVersion("-2.5.1-p1"); } @Test