From ca3679add92f5199d1d756ba6030f5d354794d02 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 6 Dec 2020 12:15:19 +0100 Subject: [PATCH 1/5] Smack 4.4.1-SNAPSHOT --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index fdc669880..1122ad10a 100644 --- a/version +++ b/version @@ -1 +1 @@ -4.4.0 +4.4.1-SNAPSHOT From fcc372754e4e984368cc00b66311e70be065d741 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 6 Jan 2021 13:45:13 +0100 Subject: [PATCH 2/5] Fix NPE in BoBIQ by adding XmlStringBuilder.optIntAttribute(String, Integer) The method was missing and hence BoBIQ used optIntAttribute(String, int) instead, which resulted in an NPE if the Integer was null. Fixes SMACK-895. --- .../smack/util/XmlStringBuilder.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 629b0b969..a494307e7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -390,6 +390,22 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { return this; } + /** + * If the provided Integer argument is not null, then add a new XML attribute with the given name and the Integer as + * value. + * + * @param name the XML attribute name. + * @param value the optional integer to use as the attribute's value. + * @return a reference to this object. + * @since 4.4.1 + */ + public XmlStringBuilder optIntAttribute(String name, Integer value) { + if (value != null) { + attribute(name, value.toString()); + } + return this; + } + /** * Add the given attribute if value not null and {@code value => 0}. * From d64ee785bd7804332a7061042163dda7941156f2 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 6 Jan 2021 13:47:09 +0100 Subject: [PATCH 3/5] [extensions] Add BoBDataExtension getBobData() and getContentId() Those two methods where missing after the BoB API redesign. Fixes SMACK-896. --- .../smackx/bob/element/BoBDataExtension.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBDataExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBDataExtension.java index 76414d9bc..7b7f81709 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBDataExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBDataExtension.java @@ -60,6 +60,26 @@ public class BoBDataExtension implements ExtensionElement { return NAMESPACE; } + /** + * Get the content ID. + * + * @return the content ID. + * @since 4.4.1 + */ + public final ContentId getContentId() { + return cid; + } + + /** + * Get the Bits of Binary (BOB) data. + * + * @return the BoB data. + * @since 4.4.1 + */ + public final BoBData getBobData() { + return bobData; + } + @Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); From 40aa9e87b7953c968b2926994adff61fe7443f55 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 6 Jan 2021 13:48:03 +0100 Subject: [PATCH 4/5] [im] DirectoryRosterStore.readEntry() should also catch IllegalArgumentException Fixes SMACK-897. --- .../smack/roster/rosterstore/DirectoryRosterStore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java index a78a44c28..f32157d48 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java @@ -195,7 +195,7 @@ public final class DirectoryRosterStore implements RosterStore { Item item = RosterPacketProvider.parseItem(parser); reader.close(); return item; - } catch (XmlPullParserException | IOException e) { + } catch (XmlPullParserException | IOException | IllegalArgumentException e) { boolean deleted = file.delete(); String message = "Exception while parsing roster entry."; if (deleted) { From 65d7c1c1b87dee112c7ea1ad454548d7cf10cc38 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 6 Jan 2021 13:48:49 +0100 Subject: [PATCH 5/5] [im] Update DirectoryRosterStore TODO note regarding Android API 26. --- .../smack/roster/rosterstore/DirectoryRosterStore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java index f32157d48..3b8e70bb8 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java @@ -183,7 +183,7 @@ public final class DirectoryRosterStore implements RosterStore { private static Item readEntry(File file) { Reader reader; try { - // TODO: Should use Files.newBufferedReader() but it is not available on Android. + // TODO: Use Files.newBufferedReader() once Smack's minimum Android API level is 26 or higher. reader = new FileReader(file); } catch (FileNotFoundException e) { LOGGER.log(Level.FINE, "Roster entry file not found", e);