From 54d6bc865830fc80bdbe38bed56ef3230d284490 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 22 May 2020 15:35:56 +0200 Subject: [PATCH] [softwareinfo] Remove SoftwareInfoManager.isSupported(Jid) SoftwareInfoManager.fromJid(Jid) will return 'null' if the jid in question does not announce or support this. --- .../softwareinfo/SoftwareInfoManager.java | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoManager.java index 595eb3b7c..c27fb6f48 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoManager.java @@ -20,7 +20,6 @@ import java.util.Map; import java.util.WeakHashMap; import org.jivesoftware.smack.Manager; -import org.jivesoftware.smack.SmackException.FeatureNotSupportedException; import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; @@ -41,7 +40,6 @@ import org.jxmpp.jid.Jid; */ public final class SoftwareInfoManager extends Manager { - private static final String FEATURE = "http://jabber.org/protocol/disco"; private static final Map INSTANCES = new WeakHashMap<>(); private final ServiceDiscoveryManager serviceDiscoveryManager; @@ -59,20 +57,6 @@ public final class SoftwareInfoManager extends Manager { serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); } - /** - * Returns true if the feature is supported by the Jid. - *
- * @param jid Jid to be checked for support - * @return boolean - * @throws NoResponseException if there was no response from the remote entity - * @throws XMPPErrorException if there was an XMPP error returned - * @throws NotConnectedException if the XMPP connection is not connected - * @throws InterruptedException if the calling thread was interrupted - */ - public boolean isSupported(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { - return serviceDiscoveryManager.supportsFeatures(jid, FEATURE); - } - /** * Publishes the provided {@link SoftwareInfoForm} as an extended info. *
@@ -83,20 +67,16 @@ public final class SoftwareInfoManager extends Manager { } /** - * Get SoftwareInfoForm from Jid provided. - *
+ * Get Software Information from the provided XMPP address. Returns null in case the queried entity does not announce that information. + * * @param jid jid to get software information from - * @return {@link SoftwareInfoForm} Form containing software information + * @return {@link SoftwareInfoForm} Form containing software information or null. * @throws NoResponseException if there was no response from the remote entity * @throws XMPPErrorException if there was an XMPP error returned * @throws NotConnectedException if the XMPP connection is not connected * @throws InterruptedException if the calling thread was interrupted - * @throws FeatureNotSupportedException if the feature is not supported */ - public SoftwareInfoForm fromJid(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, FeatureNotSupportedException { - if (!isSupported(jid)) { - throw new FeatureNotSupportedException(SoftwareInfoForm.FORM_TYPE, jid); - } + public SoftwareInfoForm fromJid(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverInfo discoverInfo = serviceDiscoveryManager.discoverInfo(jid); DataForm dataForm = DataForm.from(discoverInfo, SoftwareInfoForm.FORM_TYPE); if (dataForm == null) {