Fix: Java agent should use LTTNG_HOME
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 May 2016 00:37:36 +0000 (20:37 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 May 2016 00:38:13 +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/org/lttng/ust/agent/LTTngTCPSessiondClient.java

index d376f672e5e04c39c97a02100f0690b52f4d3546..e249492315fc99e653ec379baf20e90ae6ee4232 100644 (file)
@@ -245,7 +245,16 @@ 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.024772 seconds and 4 git commands to generate.