From 0602ae064ad854c090edbb409b08db3d25058504 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 11 Aug 2017 23:50:32 +0200 Subject: [PATCH] Remove deprecated methods from XMPPConnection --- .../smack/AbstractXMPPConnection.java | 36 --------- .../jivesoftware/smack/XMPPConnection.java | 75 ------------------- .../admin/ServiceAdministrationManager.java | 4 +- .../jivesoftware/smackx/ping/PingManager.java | 2 +- .../smack/inttest/IntTestUtil.java | 4 +- 5 files changed, 5 insertions(+), 116 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index a4f5ae88a..4b6b73e5c 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -323,12 +323,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return config; } - @SuppressWarnings("deprecation") - @Override - public DomainBareJid getServiceName() { - return getXMPPServiceDomain(); - } - @Override public DomainBareJid getXMPPServiceDomain() { if (xmppServiceDomain != null) { @@ -665,12 +659,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } } - @Deprecated - @Override - public void sendPacket(Stanza packet) throws NotConnectedException, InterruptedException { - sendStanza(packet); - } - @Override public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException { Objects.requireNonNull(stanza, "Stanza must not be null"); @@ -803,18 +791,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { collectors.remove(collector); } - @Override - @Deprecated - public void addPacketListener(StanzaListener packetListener, StanzaFilter packetFilter) { - addAsyncStanzaListener(packetListener, packetFilter); - } - - @Override - @Deprecated - public boolean removePacketListener(StanzaListener packetListener) { - return removeAsyncStanzaListener(packetListener); - } - @Override public void addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter) { if (packetListener == null) { @@ -976,18 +952,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } } - @SuppressWarnings("deprecation") - @Override - public long getPacketReplyTimeout() { - return getReplyTimeout(); - } - - @SuppressWarnings("deprecation") - @Override - public void setPacketReplyTimeout(long timeout) { - setReplyTimeout(timeout); - } - @Override public long getReplyTimeout() { return replyTimeout; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index f6e48b8d4..10894237f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -72,18 +72,6 @@ import org.jxmpp.jid.EntityFullJid; */ public interface XMPPConnection { - /** - * Returns the name of the service provided by the XMPP server for this connection. - * This is also called XMPP domain of the connected server. After - * authenticating with the server the returned value may be different. - * - * @return the name of the service provided by the XMPP server. - // TODO remove this once the java bugs are fixed, causing a warning -// * @deprecated use {@link #getXMPPServiceDomain()} instead. - */ -// @Deprecated - public DomainBareJid getServiceName(); - /** * Returns the XMPP Domain of the service provided by the XMPP server and used for this connection. After * authenticating with the server the returned value may be different. @@ -165,18 +153,6 @@ public interface XMPPConnection { */ public boolean isUsingCompression(); - /** - * Sends the specified stanza(/packet) to the server. - * - * @param packet the stanza(/packet) to send. - * @throws NotConnectedException - * @throws InterruptedException - * @deprecated use {@link #sendStanza(Stanza)} instead. - */ - // TODO Remove in 4.3. - @Deprecated - public void sendPacket(Stanza packet) throws NotConnectedException, InterruptedException; - /** * Sends the specified stanza to the server. * @@ -281,35 +257,6 @@ public interface XMPPConnection { */ public void removeStanzaCollector(StanzaCollector collector); - /** - * Registers a stanza(/packet) listener with this connection. - *

- * This method has been deprecated. It is important to differentiate between using an asynchronous stanza(/packet) listener - * (preferred where possible) and a synchronous stanza(/packet) lister. Refer - * {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)} and - * {@link #addSyncStanzaListener(StanzaListener, StanzaFilter)} for more information. - *

- * - * @param packetListener the stanza(/packet) listener to notify of new received packets. - * @param packetFilter the stanza(/packet) filter to use. - * @deprecated use {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)} or - * {@link #addSyncStanzaListener(StanzaListener, StanzaFilter)}. - */ - // TODO Remove in 4.3. - @Deprecated - public void addPacketListener(StanzaListener packetListener, StanzaFilter packetFilter); - - /** - * Removes a stanza(/packet) listener for received packets from this connection. - * - * @param packetListener the stanza(/packet) listener to remove. - * @return true if the stanza(/packet) listener was removed - * @deprecated use {@link #removeAsyncStanzaListener(StanzaListener)} or {@link #removeSyncStanzaListener(StanzaListener)}. - */ - // TODO Remove in 4.3. - @Deprecated - public boolean removePacketListener(StanzaListener packetListener); - /** * Registers a synchronous stanza(/packet) listener with this connection. A stanza(/packet) listener will be invoked only when * an incoming stanza(/packet) is received. A stanza(/packet) filter determines which packets will be delivered to the listener. If @@ -405,28 +352,6 @@ public interface XMPPConnection { */ public void removePacketInterceptor(StanzaListener packetInterceptor); - /** - * Returns the current value of the reply timeout in milliseconds for request for this - * XMPPConnection instance. - * - * @return the stanza(/packet) reply timeout in milliseconds - * @deprecated use {@link #getReplyTimeout()} instead. - */ - @Deprecated - // TODO Remove in Smack 4.3 - public long getPacketReplyTimeout(); - - /** - * Set the stanza(/packet) reply timeout in milliseconds. In most cases, Smack will throw a - * {@link NoResponseException} if no reply to a request was received within the timeout period. - * - * @param timeout the stanza(/packet) reply timeout in milliseconds - * @deprecated use {@link #setReplyTimeout(long)} instead. - */ - @Deprecated - // TODO Remove in Smack 4.3 - public void setPacketReplyTimeout(long timeout); - /** * Returns the current value of the reply timeout in milliseconds for request for this * XMPPConnection instance. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/admin/ServiceAdministrationManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/admin/ServiceAdministrationManager.java index 369ea7ce9..e133bc805 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/admin/ServiceAdministrationManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/admin/ServiceAdministrationManager.java @@ -62,7 +62,7 @@ public class ServiceAdministrationManager extends Manager { } public RemoteCommand addUser() { - return addUser(connection().getServiceName()); + return addUser(connection().getXMPPServiceDomain()); } public RemoteCommand addUser(Jid service) { @@ -90,7 +90,7 @@ public class ServiceAdministrationManager extends Manager { } public RemoteCommand deleteUser() { - return deleteUser(connection().getServiceName()); + return deleteUser(connection().getXMPPServiceDomain()); } public RemoteCommand deleteUser(Jid service) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java index 79dca32bf..2eb2452bb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java @@ -151,7 +151,7 @@ public final class PingManager extends Manager { private boolean isValidErrorPong(Jid destinationJid, XMPPErrorException xmppErrorException) { // If it is an error error response and the destination was our own service, then this must mean that the // service responded, i.e. is up and pingable. - if (destinationJid.equals(connection().getServiceName())) { + if (destinationJid.equals(connection().getXMPPServiceDomain())) { return true; } diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/IntTestUtil.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/IntTestUtil.java index f38e18a36..ff91480de 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/IntTestUtil.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/IntTestUtil.java @@ -1,6 +1,6 @@ /** * - * Copyright 2015-2016 Florian Schmaus + * Copyright 2015-2017 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ public class IntTestUtil { ServiceAdministrationManager adminManager = ServiceAdministrationManager.getInstanceFor(connection); - EntityBareJid userJid = JidCreate.entityBareFrom(Localpart.from(username), connection.getServiceName()); + EntityBareJid userJid = JidCreate.entityBareFrom(Localpart.from(username), connection.getXMPPServiceDomain()); adminManager.addUser(userJid, password); connection.disconnect();