diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-25 19:52:50 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-25 19:52:50 +0100 |
commit | 9271bc0f9ec17387e91f7d5e2980d073ac67cb82 (patch) | |
tree | 97aa762a1d169b183d9827a7e32fa3833c8a7f47 /src/main | |
parent | 5263c457f8ecddb15285dc03e187b439c0ba4cfa (diff) |
make sure to properly stop tagwriter
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/xml/TagWriter.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/xml/XmlReader.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/xml/TagWriter.java b/src/main/java/de/pixart/messenger/xml/TagWriter.java index 0a663ce1b..c96841d56 100644 --- a/src/main/java/de/pixart/messenger/xml/TagWriter.java +++ b/src/main/java/de/pixart/messenger/xml/TagWriter.java @@ -99,6 +99,13 @@ public class TagWriter { public void forceClose() { finish(); + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + //ignoring + } + } outputStream = null; } } diff --git a/src/main/java/de/pixart/messenger/xml/XmlReader.java b/src/main/java/de/pixart/messenger/xml/XmlReader.java index 3c8cfa1f2..efd4dcc95 100644 --- a/src/main/java/de/pixart/messenger/xml/XmlReader.java +++ b/src/main/java/de/pixart/messenger/xml/XmlReader.java @@ -82,7 +82,7 @@ public class XmlReader { } } catch (Throwable throwable) { - throw new IOException("xml parser mishandled " + throwable.getClass().getName(), throwable); + throw new IOException("xml parser mishandled " + throwable.getClass().getSimpleName() + "(" + throwable.getMessage() + ")", throwable); } finally { if (wakeLock.isHeld()) { try { diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 883df52d8..7a8e3cfe2 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -1386,6 +1386,9 @@ public class XmppConnection implements Runnable { } private void forceCloseSocket() { + if (tagWriter != null) { + tagWriter.forceClose(); + } if (socket != null) { try { socket.close(); @@ -1405,7 +1408,6 @@ public class XmppConnection implements Runnable { interrupt(); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": disconnecting force=" + Boolean.valueOf(force)); if (force) { - tagWriter.forceClose(); forceCloseSocket(); } else { if (tagWriter.isActive()) { |