You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/03/14 08:06:18 UTC

[incubator-skywalking] branch master updated: bugfix: fix bug when spaces in agent path. resolve #1219 (#2350)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new d5d46ae  bugfix: fix bug when spaces in agent path. resolve #1219 (#2350)
d5d46ae is described below

commit d5d46ae02aa999038f2f9f50eb4db287b955b87c
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Thu Mar 14 16:06:13 2019 +0800

    bugfix: fix bug when spaces in agent path. resolve #1219 (#2350)
    
    * bugfix: fix bug when spaces in agent path. resolve #1219
    
    * fix code style
    
    * fix code style
---
 .../org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java
index 8d6aa7d..a7574ef 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.java
@@ -19,6 +19,7 @@
 
 package org.apache.skywalking.apm.agent.core.boot;
 
+import java.net.URISyntaxException;
 import org.apache.skywalking.apm.agent.core.logging.api.ILog;
 import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
 
@@ -61,9 +62,11 @@ public class AgentPackagePath {
                 urlString = urlString.substring(urlString.indexOf("file:"), insidePathIndex);
                 File agentJarFile = null;
                 try {
-                    agentJarFile = new File(new URL(urlString).getFile());
+                    agentJarFile = new File(new URL(urlString).toURI());
                 } catch (MalformedURLException e) {
                     logger.error(e, "Can not locate agent jar file by url:" + urlString);
+                } catch (URISyntaxException e) {
+                    logger.error(e, "Can not locate agent jar file by url:" + urlString);
                 }
                 if (agentJarFile.exists()) {
                     return agentJarFile.getParentFile();