From b8d9c38a39a6e9f1556658c14e227b078e8e9e2f Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 14 Apr 2016 22:52:07 +0200 Subject: [PATCH 1/7] Smack 4.1.8-SNAPSHOT --- version.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.gradle b/version.gradle index 26b5c5a05..d19cd230a 100644 --- a/version.gradle +++ b/version.gradle @@ -1,7 +1,7 @@ allprojects { ext { - shortVersion = '4.1.7' - isSnapshot = false + shortVersion = '4.1.8' + isSnapshot = true jxmppVersion = '0.4.2' smackMinAndroidSdk = 8 } From 1f87185ee843496831f09f51ffb8f5632a8217c6 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 1 Jun 2016 13:10:11 +0200 Subject: [PATCH 2/7] Do not base64 twice in SASL X-OAUTH2 Fixes SMACK-722. --- .../jivesoftware/smack/sasl/core/SASLXOauth2Mechanism.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SASLXOauth2Mechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SASLXOauth2Mechanism.java index a271f01a7..e066fb87d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SASLXOauth2Mechanism.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SASLXOauth2Mechanism.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2015 Florian Schmaus + * Copyright 2014-2016 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import javax.security.auth.callback.CallbackHandler; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.sasl.SASLMechanism; -import org.jivesoftware.smack.util.stringencoder.Base64; /** * The SASL X-OAUTH2 mechanism as described in Date: Sun, 19 Jun 2016 12:06:21 +0200 Subject: [PATCH 3/7] Do not re-use the Socket after connect() failed Fixes SMACK-724. --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index 8a1d6e5a1..d0ca18bf2 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -579,6 +579,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { throw new UnknownHostException(host); } innerloop: while (inetAddresses.hasNext()) { + // Create a *new* Socket before every connection attempt, i.e. connect() call, since Sockets are not + // re-usable after a failed connection attempt. See also SMACK-724. + socket = socketFactory.createSocket(); + final InetAddress inetAddress = inetAddresses.next(); final String inetAddressAndPort = inetAddress + " at port " + port; LOGGER.finer("Trying to establish TCP connection to " + inetAddressAndPort); From e943bbbd91d7de1c98276c01c8cfffe218bd608c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 1 Jul 2016 08:18:56 +0200 Subject: [PATCH 4/7] Handle AlreadyLoggedInException in ReconnectionManager Fixes SMACK-725. --- .../java/org/jivesoftware/smack/ReconnectionManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java index f14362736..b75159b51 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java @@ -250,6 +250,12 @@ public class ReconnectionManager { // Successfully reconnected. attempts = 0; } + catch (SmackException.AlreadyLoggedInException e) { + // This can happen if another thread concurrently triggers a reconnection + // and/or login. Obviously it should not be handled as a reconnection + // failure. See also SMACK-725. + LOGGER.log(Level.FINER, "Reconnection not required, was already logged in", e); + } catch (SmackException | IOException | XMPPException e) { // Fires the failed reconnection notification for (ConnectionListener listener : connection.connectionListeners) { From 45b04800a43583f0e7b3909cbdb23f203eb8d559 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 4 Jul 2016 08:20:57 +0200 Subject: [PATCH 5/7] Handle AlreadyConnectedException in ReconnectionManager Fixes SMACK-725. --- .../java/org/jivesoftware/smack/ReconnectionManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java index b75159b51..f6711e74e 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java @@ -238,7 +238,11 @@ public class ReconnectionManager { // Makes a reconnection attempt try { if (isReconnectionPossible(connection)) { - connection.connect(); + try { + connection.connect(); + } catch (SmackException.AlreadyConnectedException e) { + LOGGER.log(Level.FINER, "Connection was already connected on reconnection attempt", e); + } } // TODO Starting with Smack 4.2, connect() will no // longer login automatically. So change this and the From 66f4b9cdffa503c37f2d5f55359b88744cc0137b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 6 Jul 2016 08:38:26 +0200 Subject: [PATCH 6/7] Change type of purge/remove IQ (XEP-0013) to 'set' Fixes SMACK-726 --- .../org/jivesoftware/smackx/offline/OfflineMessageManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java index f47817b08..ef3c64a8a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java @@ -26,6 +26,7 @@ import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.StanzaExtensionFilter; import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.StanzaTypeFilter; +import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; @@ -222,6 +223,7 @@ public class OfflineMessageManager { */ public void deleteMessages(List nodes) throws NoResponseException, XMPPErrorException, NotConnectedException { OfflineMessageRequest request = new OfflineMessageRequest(); + request.setType(IQ.Type.set); for (String node : nodes) { OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node); item.setAction("remove"); @@ -240,6 +242,7 @@ public class OfflineMessageManager { */ public void deleteMessages() throws NoResponseException, XMPPErrorException, NotConnectedException { OfflineMessageRequest request = new OfflineMessageRequest(); + request.setType(IQ.Type.set); request.setPurge(true); connection.createPacketCollectorAndSend(request).nextResultOrThrow(); } From a87007fb7795b52f067f907af628afed5e52fda5 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 30 Jul 2016 10:29:30 +0200 Subject: [PATCH 7/7] Smack 4.1.8 --- resources/releasedocs/changelog.html | 15 +++++++++++++++ version.gradle | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/resources/releasedocs/changelog.html b/resources/releasedocs/changelog.html index b844e1e00..01c8a003b 100644 --- a/resources/releasedocs/changelog.html +++ b/resources/releasedocs/changelog.html @@ -141,6 +141,21 @@ hr {
+

4.1.8 -- 2016-07-30

+ +

Bug +

+
    +
  • [SMACK-722] - SASL X-OAUTH2 implementation incorrectly performs Base64 encoding twice +
  • +
  • [SMACK-724] - Do not re-use the Socket after connect() failed. +
  • +
  • [SMACK-725] - ReconnectionManager should handle AlreadyConnectedException and AlreadyLoggedInException not as failure +
  • +
  • [SMACK-726] - 'purge' and 'remove' IQ of XEP-0013 must be of type 'set' +
  • +
+

4.1.7 -- 2016-04-14

Bug diff --git a/version.gradle b/version.gradle index d19cd230a..41a5580b6 100644 --- a/version.gradle +++ b/version.gradle @@ -1,7 +1,7 @@ allprojects { ext { shortVersion = '4.1.8' - isSnapshot = true + isSnapshot = false jxmppVersion = '0.4.2' smackMinAndroidSdk = 8 }