From 374e643609e1bc712bf3930d0b5a3841d76ff890 Mon Sep 17 00:00:00 2001 From: Vladislav Eliseev Date: Mon, 29 Aug 2016 18:37:55 +0300 Subject: [PATCH] [HOTFIX] Fixed issue with launching CLI on Windows platform * Defect JIRA : SPTSDKUX-1887 * issue prevents CLI to launch tracing process on device * solution is to make classpath separator OS-dependent Change-Id: I15a71dafcd1a78cf7da427094196e7a2550d0f8b --- .../dynamicanalyzer/cli/manager/ClientUtils.java | 3 ++- .../cli/manager/TracingProcessManager.java | 3 ++- .../org/tizen/dynamicanalyzer/util/CommonUtil.java | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ClientUtils.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ClientUtils.java index c38f630..5ae04d0 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ClientUtils.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/ClientUtils.java @@ -19,6 +19,7 @@ import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import org.tizen.dynamicanalyzer.common.path.PathManager; +import org.tizen.dynamicanalyzer.util.CommonUtil; import org.tizen.dynamicanalyzer.util.Logger; /** @@ -85,7 +86,7 @@ public class ClientUtils { // set the same classpath for new process "-classpath", - PMA_LIBRARY_PATH + ":" + currentClasspath, + PMA_LIBRARY_PATH + CommonUtil.CLASSPATH_SEPARATOR + currentClasspath, // set main executable class PMA_CANONICAL_NAME); diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java index b8d0b03..0bafbf8 100644 --- a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java +++ b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java @@ -22,6 +22,7 @@ import org.tizen.dynamicanalyzer.cli.utils.Message; import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType; import org.tizen.dynamicanalyzer.common.path.PathManager; import org.tizen.dynamicanalyzer.project.Project; +import org.tizen.dynamicanalyzer.util.CommonUtil; import org.tizen.dynamicanalyzer.util.Logger; /** @@ -63,7 +64,7 @@ public class TracingProcessManager { // set classpath "-classpath", - TRACING_PROCESS_LIBRARY_PATH + ":" + currentClasspath, + TRACING_PROCESS_LIBRARY_PATH + CommonUtil.CLASSPATH_SEPARATOR + currentClasspath, // set main executable class TRACING_PROCESS_CANONICAL_NAME diff --git a/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/CommonUtil.java b/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/CommonUtil.java index 1d0f0d8..e546c35 100644 --- a/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/CommonUtil.java +++ b/org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/CommonUtil.java @@ -46,6 +46,21 @@ public class CommonUtil { private static final String WIN = "win"; //$NON-NLS-1$ private static final String USER_HOME = "user.home"; //$NON-NLS-1$ + /** + * Classpath separator for UNIX-like systems. + */ + public static final String UNIX_CLASSPATH_SEPARATOR = ":"; + + /** + * Classpath separator for Windows-like systems. + */ + public static final String WINDOWS_CLASSPATH_SEPARATOR = ";"; + + /** + * Classpath separator for current OS. + */ + public static final String CLASSPATH_SEPARATOR = getClasspathSeparator(); + private static String pid = null; private static class StreamReader extends Thread { @@ -158,6 +173,13 @@ public class CommonUtil { return System.getProperty(OS_KEY).toLowerCase(); } + /** + * Return classpath separator in accordance with current OS. + */ + private static String getClasspathSeparator() { + return isWin() ? WINDOWS_CLASSPATH_SEPARATOR : UNIX_CLASSPATH_SEPARATOR; + } + public static String getHomeDirectory() { return System.getProperty(USER_HOME); } -- 2.7.4