Fix: Java agent should use LTTNG_HOME
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 May 2016 00:33:00 +0000 (20:33 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 May 2016 00:38:42 +0000 (20:38 -0400)
Both in UST C/C++ support and Python agent, LTTNG_HOME can be used to
override HOME for lttng-ust. Ensure the Java agent has the same
behavior.

Fixes: #881
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java

index 6177feac7a849cefb44e959197e30894b295f529..e9b52f1de9bdd91bec480fe3abd86820936801e6 100644 (file)
@@ -179,7 +179,16 @@ public class LttngTcpSessiondClient implements Runnable {
        }
 
        private static String getHomePath() {
-               return System.getProperty("user.home");
+               /*
+                * The environment variable LTTNG_HOME overrides HOME if
+                * defined.
+                */
+               String homePath = System.getenv("LTTNG_HOME");
+
+               if (homePath == null) {
+                       homePath = System.getProperty("user.home");
+               }
+               return homePath;
        }
 
        /**
This page took 0.026249 seconds and 4 git commands to generate.