1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-12 05:51:08 +01:00

Introduce CloseableUtil

This commit is contained in:
Florian Schmaus 2018-08-15 17:25:22 +02:00
parent 1136e8a2e9
commit a00aa726fe
19 changed files with 109 additions and 256 deletions

View file

@ -29,6 +29,7 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.CloseableUtil;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smack.util.stringencoder.Base64;
@ -191,22 +192,8 @@ public class JivePropertiesExtension implements ExtensionElement {
valueStr = "Serializing error: " + e.getMessage();
}
finally {
if (out != null) {
try {
out.close();
}
catch (Exception e) {
// Ignore.
}
}
if (byteStream != null) {
try {
byteStream.close();
}
catch (Exception e) {
// Ignore.
}
}
CloseableUtil.maybeClose(out, LOGGER);
CloseableUtil.maybeClose(byteStream, LOGGER);
}
}
xml.attribute("type", type);