From 5b12e23382ced9b7c7ff14a43010c0c368473385 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 21 Apr 2020 12:00:13 +0200 Subject: [PATCH] improve logging for throws from native callbacks --- .../xmpp/jingle/JingleConnectionManager.java | 8 +++++--- .../eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 5fd89aea2..b25647854 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -90,7 +90,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { final boolean sessionEnded = this.endedSessions.asMap().containsKey(PersistableSessionId.of(id)); final boolean stranger = isWithStrangerAndStrangerNotificationsAreOff(account, id.with); if (isBusy() || sessionEnded || stranger) { - Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": rejected session with " + id.with + " because busy. sessionEnded=" + sessionEnded+", stranger="+stranger); + Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": rejected session with " + id.with + " because busy. sessionEnded=" + sessionEnded + ", stranger=" + stranger); mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null); final JinglePacket sessionTermination = new JinglePacket(JinglePacket.Action.SESSION_TERMINATE, id.sessionId); sessionTermination.setTo(id.with); @@ -220,7 +220,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { if (isBusy() || stranger) { writeLogMissedIncoming(account, id.with.asBareJid(), id.sessionId, serverMsgId, timestamp); if (stranger) { - Log.d(Config.LOGTAG,id.account.getJid().asBareJid()+": ignoring call proposal from stranger "+id.with); + Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": ignoring call proposal from stranger " + id.with); return; } final int activeDevices = account.countPresences(); @@ -545,7 +545,9 @@ public class JingleConnectionManager extends AbstractConnectionManager { if (connections.containsValue(connection)) { return; } - throw new IllegalStateException("JingleConnection has not been registered with connection manager"); + final IllegalStateException e = new IllegalStateException("JingleConnection has not been registered with connection manager"); + Log.e(Config.LOGTAG, "ensureConnectionIsRegistered() failed. Going to throw", e); + throw e; } public void endSession(AbstractJingleConnection.Id id, final AbstractJingleConnection.State state) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index defe85291..cb4deed2c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -254,7 +254,9 @@ public class WebRTCWrapper { || this.eglBase != null || this.localVideoTrack != null || this.remoteVideoTrack != null) { - throw new IllegalStateException("WebRTCWrapper hasn't been closed properly"); + final IllegalStateException e = new IllegalStateException("WebRTCWrapper hasn't been closed properly"); + Log.e(Config.LOGTAG, "verifyClosed() failed. Going to throw", e); + throw e; } }