From 5f05da2f7770e10d3e8c6851a67f1f6c085a01ec Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 14 Oct 2018 14:22:00 +0200 Subject: [PATCH 1/2] Smack 4.3.2-SNAPSHOT --- version.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.gradle b/version.gradle index 62b47a3c8..74674db63 100644 --- a/version.gradle +++ b/version.gradle @@ -1,7 +1,7 @@ allprojects { ext { - shortVersion = '4.3.1' - isSnapshot = false + shortVersion = '4.3.2' + isSnapshot = true jxmppVersion = '0.6.3' miniDnsVersion = '0.3.3' smackMinAndroidSdk = 9 From 2900c5ae234345160e197835545c6cdfc3c4a215 Mon Sep 17 00:00:00 2001 From: asokolov Date: Wed, 14 Nov 2018 13:36:10 +0300 Subject: [PATCH 2/2] Move xml-not-well-formed (RFC 3920) condition handling to StreamError Fixes SMACK-842. --- .../jivesoftware/smack/packet/StanzaError.java | 5 ----- .../jivesoftware/smack/packet/StreamError.java | 5 +++++ .../smack/packet/StreamErrorTest.java | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java index 6ebd523ab..fad9f5253 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java @@ -385,11 +385,6 @@ public class StanzaError extends AbstractError implements ExtensionElement { } public static Condition fromString(String string) { - // Backwards compatibility for older implementations still using RFC 3920. RFC 6120 - // changed 'xml-not-well-formed' to 'not-well-formed'. - if ("xml-not-well-formed".equals(string)) { - string = "not-well-formed"; - } string = string.replace('-', '_'); Condition condition = null; try { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java index def48dfbe..67ec3ec2a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java @@ -186,6 +186,11 @@ public class StreamError extends AbstractError implements Nonza { } public static Condition fromString(String string) { + // Backwards compatibility for older implementations still using RFC 3920. RFC 6120 + // changed 'xml-not-well-formed' to 'not-well-formed'. + if ("xml-not-well-formed".equals(string)) { + string = "not-well-formed"; + } string = string.replace('-', '_'); Condition condition = null; try { diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java index f390497f5..515053714 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java @@ -104,4 +104,22 @@ public class StreamErrorTest { assertNotNull(appSpecificElement); } + @Test + public void testStreamErrorXmlNotWellFormed() { + StreamError error = null; + final String xml = + // Usually the stream:stream element has more attributes (to, version, ...) + // We omit those, since they are not relevant for testing + "" + + "" + + ""; + try { + XmlPullParser parser = PacketParserUtils.getParserFor(xml, "error"); + error = PacketParserUtils.parseStreamError(parser); + } catch (Exception e) { + fail(e.getMessage()); + } + assertNotNull(error); + assertEquals(Condition.not_well_formed, error.getCondition()); + } }