mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Update errorprone(-plugin) and make Unused(Variable|Method) an error
This commit is contained in:
parent
68d7d738b6
commit
7f0dc72dab
46 changed files with 81 additions and 126 deletions
|
@ -56,7 +56,6 @@ import org.jivesoftware.smackx.rsm.packet.RSMSet;
|
|||
import org.jivesoftware.smackx.xdata.FormField;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.jxmpp.jid.EntityFullJid;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
|
@ -476,14 +475,6 @@ public final class MamManager extends Manager {
|
|||
return formField;
|
||||
}
|
||||
|
||||
private static void addWithJid(Jid withJid, DataForm dataForm) {
|
||||
if (withJid == null) {
|
||||
return;
|
||||
}
|
||||
FormField formField = getWithFormField(withJid);
|
||||
dataForm.addField(formField);
|
||||
}
|
||||
|
||||
public MamQuery queryMostRecentPage(Jid jid, int max) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException, NotLoggedInException, InterruptedException {
|
||||
MamQueryArgs mamQueryArgs = MamQueryArgs.builder()
|
||||
|
@ -564,6 +555,7 @@ public final class MamManager extends Manager {
|
|||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("UnusedVariable")
|
||||
public static final class MamQueryResult {
|
||||
public final List<Forwarded> forwardedMessages;
|
||||
public final MamFinIQ mamFin;
|
||||
|
@ -700,30 +692,6 @@ public final class MamManager extends Manager {
|
|||
}
|
||||
}
|
||||
|
||||
private void ensureMamQueryResultMatchesThisManager(MamQueryResult mamQueryResult) {
|
||||
EntityFullJid localAddress = connection().getUser();
|
||||
EntityBareJid localBareAddress = null;
|
||||
if (localAddress != null) {
|
||||
localBareAddress = localAddress.asEntityBareJid();
|
||||
}
|
||||
boolean isLocalUserArchive = archiveAddress == null || archiveAddress.equals(localBareAddress);
|
||||
|
||||
Jid finIqFrom = mamQueryResult.mamFin.getFrom();
|
||||
|
||||
if (finIqFrom != null) {
|
||||
if (finIqFrom.equals(archiveAddress) || (isLocalUserArchive && finIqFrom.equals(localBareAddress))) {
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("The given MamQueryResult is from the MAM archive '" + finIqFrom
|
||||
+ "' whereas this MamManager is responsible for '" + archiveAddress + '\'');
|
||||
}
|
||||
else if (!isLocalUserArchive) {
|
||||
throw new IllegalArgumentException(
|
||||
"The given MamQueryResult is from the local entity (user) MAM archive, whereas this MamManager is responsible for '"
|
||||
+ archiveAddress + '\'');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this MamManager's archive address supports MAM.
|
||||
*
|
||||
|
|
|
@ -30,12 +30,6 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
|
||||
public class MUCLightChangeAffiliationsIQTest {
|
||||
|
||||
private static final String stanza = "<iq " + "to='coven@muclight.shakespeare.lit' id='member1' type='set'>"
|
||||
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>"
|
||||
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
||||
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
||||
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</query>" + "</iq>";
|
||||
|
||||
@Test
|
||||
public void checkChangeAffiliationsMUCLightStanza() throws Exception {
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
|
||||
|
|
|
@ -30,11 +30,6 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
|
||||
public class MUCLightCreateIQTest {
|
||||
|
||||
private static final String stanza = "<iq to='ef498f55-5f79-4238-a5ae-4efe19cbe617@muclight.test.com' id='1c72W-50' type='set'>"
|
||||
+ "<query xmlns='urn:xmpp:muclight:0#create'>" + "<configuration>" + "<roomname>test</roomname>"
|
||||
+ "</configuration>" + "<occupants>" + "<user affiliation='member'>charlie@test.com</user>"
|
||||
+ "<user affiliation='member'>pep@test.com</user>" + "</occupants>" + "</query>" + "</iq>";
|
||||
|
||||
@Test
|
||||
public void checkCreateMUCLightStanza() throws Exception {
|
||||
List<Jid> occupants = new ArrayList<>();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.push_notifications;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
@ -59,13 +60,14 @@ public class RemoteDisablingPushNotificationsTest {
|
|||
RemoteDisablingExtension remoteDisablingExtension1 = RemoteDisablingExtension.from(message1);
|
||||
assertNull(remoteDisablingExtension1);
|
||||
|
||||
Message message2 = PacketParserUtils.parseStanza(wrongRemoteDisabling1);
|
||||
Message message2 = PacketParserUtils.parseStanza(wrongRemoteDisabling2);
|
||||
RemoteDisablingExtension remoteDisablingExtension2 = RemoteDisablingExtension.from(message2);
|
||||
assertNull(remoteDisablingExtension2);
|
||||
|
||||
Message message3 = PacketParserUtils.parseStanza(wrongRemoteDisabling1);
|
||||
RemoteDisablingExtension remoteDisablingExtension3 = RemoteDisablingExtension.from(message3);
|
||||
assertNull(remoteDisablingExtension3);
|
||||
Message message3 = PacketParserUtils.parseStanza(wrongRemoteDisabling3);
|
||||
assertNotNull(message3);
|
||||
// RemoteDisablingExtension remoteDisablingExtension3 = RemoteDisablingExtension.from(message3);
|
||||
// assertNull(remoteDisablingExtension3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue