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:39:07 +0000 (20:39 -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 76e8426b2344cad4f67b8b9e39386f2d493ad343..78dae5e5f4b4ba5f0320660dafcc0349d196ad03 100644 (file)
@@ -262,7 +262,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.024463 seconds and 4 git commands to generate.