mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 02:39:42 +02:00
Fix warnings
This commit is contained in:
parent
6203d163c4
commit
80eaaf2d71
15 changed files with 73 additions and 95 deletions
|
@ -20,11 +20,8 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
|
@ -33,7 +30,6 @@ import org.jivesoftware.smackx.jingle.transports.JingleTransportSession;
|
|||
import org.jxmpp.jid.FullJid;
|
||||
|
||||
public abstract class JingleSession implements JingleSessionHandler {
|
||||
private static final Logger LOGGER = Logger.getLogger(JingleSession.class.getName());
|
||||
protected HashSet<String> failedTransportMethods = new HashSet<>();
|
||||
|
||||
protected final FullJid local;
|
||||
|
@ -135,47 +131,43 @@ public abstract class JingleSession implements JingleSessionHandler {
|
|||
|
||||
@Override
|
||||
public IQ handleJingleSessionRequest(Jingle jingle) {
|
||||
try {
|
||||
switch (jingle.getAction()) {
|
||||
case content_accept:
|
||||
return handleContentAccept(jingle);
|
||||
case content_add:
|
||||
return handleContentAdd(jingle);
|
||||
case content_modify:
|
||||
return handleContentModify(jingle);
|
||||
case content_reject:
|
||||
return handleContentReject(jingle);
|
||||
case content_remove:
|
||||
return handleContentRemove(jingle);
|
||||
case description_info:
|
||||
return handleDescriptionInfo(jingle);
|
||||
case session_info:
|
||||
return handleSessionInfo(jingle);
|
||||
case security_info:
|
||||
return handleSecurityInfo(jingle);
|
||||
case session_accept:
|
||||
return handleSessionAccept(jingle);
|
||||
case transport_accept:
|
||||
return handleTransportAccept(jingle);
|
||||
case transport_info:
|
||||
return transportSession.handleTransportInfo(jingle);
|
||||
case session_initiate:
|
||||
return handleSessionInitiate(jingle);
|
||||
case transport_reject:
|
||||
return handleTransportReject(jingle);
|
||||
case session_terminate:
|
||||
return handleSessionTerminate(jingle);
|
||||
case transport_replace:
|
||||
return handleTransportReplace(jingle);
|
||||
default:
|
||||
return IQ.createResultIQ(jingle);
|
||||
}
|
||||
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
|
||||
return null; //TODO:
|
||||
switch (jingle.getAction()) {
|
||||
case content_accept:
|
||||
return handleContentAccept(jingle);
|
||||
case content_add:
|
||||
return handleContentAdd(jingle);
|
||||
case content_modify:
|
||||
return handleContentModify(jingle);
|
||||
case content_reject:
|
||||
return handleContentReject(jingle);
|
||||
case content_remove:
|
||||
return handleContentRemove(jingle);
|
||||
case description_info:
|
||||
return handleDescriptionInfo(jingle);
|
||||
case session_info:
|
||||
return handleSessionInfo(jingle);
|
||||
case security_info:
|
||||
return handleSecurityInfo(jingle);
|
||||
case session_accept:
|
||||
return handleSessionAccept(jingle);
|
||||
case transport_accept:
|
||||
return handleTransportAccept(jingle);
|
||||
case transport_info:
|
||||
return transportSession.handleTransportInfo(jingle);
|
||||
case session_initiate:
|
||||
return handleSessionInitiate(jingle);
|
||||
case transport_reject:
|
||||
return handleTransportReject(jingle);
|
||||
case session_terminate:
|
||||
return handleSessionTerminate(jingle);
|
||||
case transport_replace:
|
||||
return handleTransportReplace(jingle);
|
||||
default:
|
||||
return IQ.createResultIQ(jingle);
|
||||
}
|
||||
}
|
||||
|
||||
protected IQ handleSessionInitiate(Jingle sessionInitiate) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
protected IQ handleSessionInitiate(Jingle sessionInitiate) {
|
||||
return IQ.createResultIQ(sessionInitiate);
|
||||
}
|
||||
|
||||
|
@ -187,7 +179,7 @@ public abstract class JingleSession implements JingleSessionHandler {
|
|||
return IQ.createResultIQ(sessionInfo);
|
||||
}
|
||||
|
||||
protected IQ handleSessionAccept(Jingle sessionAccept) throws SmackException.NotConnectedException, InterruptedException {
|
||||
protected IQ handleSessionAccept(Jingle sessionAccept) {
|
||||
return IQ.createResultIQ(sessionAccept);
|
||||
}
|
||||
|
||||
|
@ -219,13 +211,11 @@ public abstract class JingleSession implements JingleSessionHandler {
|
|||
return IQ.createResultIQ(securityInfo);
|
||||
}
|
||||
|
||||
protected IQ handleTransportAccept(Jingle transportAccept) throws SmackException.NotConnectedException, InterruptedException {
|
||||
protected IQ handleTransportAccept(Jingle transportAccept) {
|
||||
return IQ.createResultIQ(transportAccept);
|
||||
}
|
||||
|
||||
protected IQ handleTransportReplace(Jingle transportReplace)
|
||||
throws InterruptedException, XMPPException.XMPPErrorException,
|
||||
SmackException.NotConnectedException, SmackException.NoResponseException {
|
||||
protected IQ handleTransportReplace(Jingle transportReplace) {
|
||||
return IQ.createResultIQ(transportReplace);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public final class JingleTransportMethodManager extends Manager {
|
|||
return getTransportManager(transport.getNamespace());
|
||||
}
|
||||
|
||||
public JingleTransportManager<?> getBestAvailableTransportManager(XMPPConnection connection) {
|
||||
public static JingleTransportManager<?> getBestAvailableTransportManager(XMPPConnection connection) {
|
||||
return getInstanceFor(connection).getBestAvailableTransportManager();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,8 +99,7 @@ public class JingleUtil {
|
|||
JingleContent.Senders contentSenders,
|
||||
JingleContentDescription description,
|
||||
JingleContentTransport transport)
|
||||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
throws SmackException.NotConnectedException, InterruptedException {
|
||||
|
||||
Jingle jingle = createSessionInitiate(recipient, sessionId, contentCreator, contentName, contentSenders,
|
||||
description, transport);
|
||||
|
@ -142,8 +141,7 @@ public class JingleUtil {
|
|||
JingleContent.Senders contentSenders,
|
||||
JingleContentDescription description,
|
||||
JingleContentTransport transport)
|
||||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
throws SmackException.NotConnectedException, InterruptedException {
|
||||
|
||||
Jingle jingle = createSessionAccept(recipient, sessionId, contentCreator, contentName, contentSenders,
|
||||
description, transport);
|
||||
|
@ -168,22 +166,6 @@ public class JingleUtil {
|
|||
return createSessionTerminate(recipient, sessionId, new JingleReason(reason));
|
||||
}
|
||||
|
||||
private IQ sendSessionTerminate(FullJid recipient, String sessionId, JingleReason.Reason reason)
|
||||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
|
||||
return sendSessionTerminate(recipient, sessionId, new JingleReason(reason));
|
||||
}
|
||||
|
||||
private IQ sendSessionTerminate(FullJid recipient, String sessionId, JingleReason reason)
|
||||
throws SmackException.NotConnectedException, InterruptedException,
|
||||
XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
|
||||
Jingle jingle = createSessionTerminate(recipient, sessionId, reason);
|
||||
|
||||
return connection.createStanzaCollectorAndSend(jingle).nextResultOrThrow();
|
||||
}
|
||||
|
||||
public Jingle createSessionTerminateDecline(FullJid recipient, String sessionId) {
|
||||
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.decline);
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ public class MultiUserChat {
|
|||
* @deprecated use {@link #createOrJoin(MucEnterConfiguration)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public MucCreateConfigFormHandle createOrJoin(Resourcepart nickname, String password, DiscussionHistory history, long timeout)
|
||||
public MucCreateConfigFormHandle createOrJoin(Resourcepart nickname, String password, @SuppressWarnings("deprecation") DiscussionHistory history, long timeout)
|
||||
throws NoResponseException, XMPPErrorException, InterruptedException, MucAlreadyJoinedException, NotConnectedException, NotAMucServiceException {
|
||||
MucEnterConfiguration.Builder builder = getEnterConfigurationBuilder(nickname).withPassword(
|
||||
password).timeoutAfter(timeout);
|
||||
|
@ -666,7 +666,7 @@ public class MultiUserChat {
|
|||
public void join(
|
||||
Resourcepart nickname,
|
||||
String password,
|
||||
DiscussionHistory history,
|
||||
@SuppressWarnings("deprecation") DiscussionHistory history,
|
||||
long timeout)
|
||||
throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException, NotAMucServiceException {
|
||||
MucEnterConfiguration.Builder builder = getEnterConfigurationBuilder(nickname).withPassword(
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
|
|||
* to true, otherwise it will be null.
|
||||
* </ul>
|
||||
*
|
||||
* <h3>An Item created to send to a node (via {@link LeafNode#send()} or {@link LeafNode#publish()}</h3>
|
||||
* <h3>An Item created to send to a node (via {@link LeafNode#publish()} or {@link LeafNode#publish()}</h3>
|
||||
* <ul>
|
||||
* <li>The id is optional, since the server will generate one if necessary, but should be used if it is
|
||||
* meaningful in the context of the node. This value must be unique within the node that it is sent to, since
|
||||
|
@ -57,8 +57,8 @@ public class Item extends NodeExtension
|
|||
* Create an empty <tt>Item</tt> with no id. This is a valid item for nodes which are configured
|
||||
* so that {@link ConfigureForm#isDeliverPayloads()} is false. In most cases an id will be generated by the server.
|
||||
* For nodes configured with {@link ConfigureForm#isDeliverPayloads()} and {@link ConfigureForm#isPersistItems()}
|
||||
* set to false, no <tt>Item</tt> is sent to the node, you have to use {@link LeafNode#send()} or {@link LeafNode#publish()}
|
||||
* methods in this case.
|
||||
* set to false, no <tt>Item</tt> is sent to the node, you have to use the {@link LeafNode#publish()}
|
||||
* method in this case.
|
||||
*/
|
||||
public Item()
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
|
|||
* to true, otherwise it will be null.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>An Item created to send to a node (via {@link LeafNode#send()} or {@link LeafNode#publish()}</h3>
|
||||
* <h3>An Item created to send to a node (via {@link LeafNode#publish()}</h3>
|
||||
* <ul>
|
||||
* <li>The id is optional, since the server will generate one if necessary, but should be used if it is
|
||||
* meaningful in the context of the node. This value must be unique within the node that it is sent to, since
|
||||
|
|
|
@ -272,8 +272,8 @@ public final class DeliveryReceiptManager extends Manager {
|
|||
|
||||
/**
|
||||
* Enables automatic requests of delivery receipts for outgoing messages of
|
||||
* {@link Message.Type#normal}, {@link Message.Type#chat} or {@link Message.Type#headline}, and
|
||||
* with a {@link Message.Body} extension.
|
||||
* {@link org.jivesoftware.smack.packet.Message.Type#normal}, {@link org.jivesoftware.smack.packet.Message.Type#chat} or {@link org.jivesoftware.smack.packet.Message.Type#headline}, and
|
||||
* with a {@link org.jivesoftware.smack.packet.Message.Body} extension.
|
||||
*
|
||||
* @since 4.1
|
||||
* @see #dontAutoAddDeliveryReceiptRequests()
|
||||
|
|
|
@ -189,6 +189,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
@Test(expected = IllegalArgumentException.class)
|
||||
public void transportCandidateIllegalPriorityTest() throws XmppStringprepException {
|
||||
FullJid jid = JidCreate.fullFrom("test@test.test/test");
|
||||
@SuppressWarnings("unused")
|
||||
JingleS5BTransportCandidate candidate = new JingleS5BTransportCandidate(
|
||||
"cid", "host", jid, 5555, -30, JingleS5BTransportCandidate.Type.proxy);
|
||||
}
|
||||
|
@ -196,6 +197,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
@Test(expected = IllegalArgumentException.class)
|
||||
public void transportCandidateIllegalPortTest() throws XmppStringprepException {
|
||||
FullJid jid = JidCreate.fullFrom("test@test.test/test");
|
||||
@SuppressWarnings("unused")
|
||||
JingleS5BTransportCandidate candidate = new JingleS5BTransportCandidate(
|
||||
"cid", "host", jid, -5555, 30, JingleS5BTransportCandidate.Type.proxy);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue