aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-01-22 12:54:39 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-01-22 12:54:39 +0100
commitb72d7ec8d0627a30f59c5ace977a6cfce468da2a (patch)
tree5bf1eced1e9c9a53049c73b801e24674a802d056 /src/main
parent5dde9772330bfac6c6b28ef0d06463381295fa91 (diff)
make sure to properly stop tagwriter
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/xml/TagWriter.java7
-rw-r--r--src/main/java/eu/siacs/conversations/xml/XmlReader.java2
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java4
3 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/xml/TagWriter.java b/src/main/java/eu/siacs/conversations/xml/TagWriter.java
index 9d16c338..c0fc1a13 100644
--- a/src/main/java/eu/siacs/conversations/xml/TagWriter.java
+++ b/src/main/java/eu/siacs/conversations/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/eu/siacs/conversations/xml/XmlReader.java b/src/main/java/eu/siacs/conversations/xml/XmlReader.java
index 1e6b89d3..58ef07f9 100644
--- a/src/main/java/eu/siacs/conversations/xml/XmlReader.java
+++ b/src/main/java/eu/siacs/conversations/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/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 08dbdc18..ef5ff854 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -1356,6 +1356,9 @@ public class XmppConnection implements Runnable {
}
private void forceCloseSocket() {
+ if (tagWriter != null) {
+ tagWriter.forceClose();
+ }
if (socket != null) {
try {
socket.close();
@@ -1375,7 +1378,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()) {