Blob Blame Raw
From 86f81bb751bedd9d3b3ecf98f0492d3446d808dd Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 2 May 2018 11:47:16 +0200
Subject: [PATCH 2/2] Backport abrt-java-connector changes

Squashed from:

change abrt-java-connector upstream URL

abrt-java-connector upstream repository was moved from
https://github.com/jfilak/abrt-java-connector/ to
https://github.com/abrt/abrt-java-connector/

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>

extend ABRT Java agent options

If ABRT Java agent is enabled and container-exception-logger is
installed, pass cel=on parameter to libabrt-java-connector.so.

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
 etc/java.conf             |  2 +-
 java-utils/java-functions | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/etc/java.conf b/etc/java.conf
index 6af623a..81b24aa 100644
--- a/etc/java.conf
+++ b/etc/java.conf
@@ -13,5 +13,5 @@ JNI_LIBDIR=@{jnidir}
 #JAVACMD_OPTS=
 
 # You can disable ABRT Java Connector by setting JAVA_ABRT to "off".
-# See: https://github.com/jfilak/abrt-java-connector/
+# See: https://github.com/abrt/abrt-java-connector/
 #JAVA_ABRT=off
diff --git a/java-utils/java-functions b/java-utils/java-functions
index 0c157cc..eafcdd6 100644
--- a/java-utils/java-functions
+++ b/java-utils/java-functions
@@ -106,12 +106,20 @@ _load_java_conf()
 	JAVACMD_OPTS="${java_opts_save}"
     fi
 
-    if [ "_${JAVA_ABRT}" != "_off" -a -f "@{abrtlibdir}/libabrt-java-connector.so" -a -f "@{rundir}/abrt/abrtd.pid" ]; then
-	_log "ABRT Java connector was enabled"
-	_log "Using ABRT Java agent: @{abrtlibdir}/libabrt-java-connector.so"
-	JAVACMD_OPTS="${JAVACMD_OPTS} -agentpath:@{abrtlibdir}/libabrt-java-connector.so=abrt=on"
+    if [ "_${JAVA_ABRT}" != "_off" -a -f "@{abrtlibdir}/libabrt-java-connector.so" ]; then
+        if [ -f "@{rundir}/abrt/abrtd.pid" ]; then
+            ABRT_JAVA_CONNECTOR_OPTS="abrt=on,"
+        fi
+        if [ -f "@{bindir}/container-exception-logger" ]; then
+            ABRT_JAVA_CONNECTOR_OPTS+="cel=on"
+        fi
+        if [ ! -z ${ABRT_JAVA_CONNECTOR_OPTS} ]; then
+            _log "ABRT Java connector was enabled"
+            _log "Using ABRT Java agent: @{abrtlibdir}/libabrt-java-connector.so=${ABRT_JAVA_CONNECTOR_OPTS}"
+            JAVACMD_OPTS="${JAVACMD_OPTS} -agentpath:@{abrtlibdir}/libabrt-java-connector.so=${ABRT_JAVA_CONNECTOR_OPTS}"
+        fi
     else
-	_log "ABRT Java connector is disabled"
+        _log "ABRT Java connector is disabled"
     fi
 }
 
-- 
2.17.0