1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-19 10:32:05 +01:00

Merge branch '4.4'

This commit is contained in:
Florian Schmaus 2021-01-06 13:51:38 +01:00
commit 35a71f0131
3 changed files with 38 additions and 2 deletions

View file

@ -389,6 +389,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}.
*

View file

@ -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);

View file

@ -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);
@ -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) {