mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 02:58:00 +01:00
[build] Bump error prone from 2.9.0 to 2.32.0
This commit is contained in:
parent
07d9d694da
commit
beacb5eb8e
69 changed files with 265 additions and 255 deletions
|
@ -142,8 +142,7 @@ dependencies {
|
|||
|
||||
testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
|
||||
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.9.0'
|
||||
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.32.0'
|
||||
}
|
||||
|
||||
test {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014-2021 Florian Schmaus
|
||||
* Copyright © 2014-2024 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -121,6 +121,7 @@ public final class ServerPingWithAlarmManager extends Manager {
|
|||
|
||||
private static final BroadcastReceiver ALARM_BROADCAST_RECEIVER = new BroadcastReceiver() {
|
||||
@Override
|
||||
@SuppressWarnings("LockOnNonEnclosingClassLiteral")
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
LOGGER.fine("Ping Alarm broadcast received");
|
||||
Set<Map.Entry<XMPPConnection, ServerPingWithAlarmManager>> managers;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2003-2007 Jive Software, 2014-2020 Florian Schmaus
|
||||
* Copyright 2003-2007 Jive Software, 2014-2024 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -63,7 +63,7 @@ public final class SmackInitialization {
|
|||
|
||||
private static final Logger LOGGER = Logger.getLogger(SmackInitialization.class.getName());
|
||||
|
||||
/**
|
||||
/*
|
||||
* Loads the configuration from the smack-config.xml and system properties file.
|
||||
* <p>
|
||||
* So far this means that:
|
||||
|
|
|
@ -667,7 +667,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class DisconnectedState extends State {
|
||||
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private DisconnectedState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -708,6 +709,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
private final class LookupRemoteConnectionEndpointsState extends State {
|
||||
boolean outgoingElementsQueueWasShutdown;
|
||||
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private LookupRemoteConnectionEndpointsState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -818,6 +821,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class ConnectedButUnauthenticatedState extends State {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private ConnectedButUnauthenticatedState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -850,6 +855,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class SaslAuthenticationState extends State {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private SaslAuthenticationState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -893,6 +900,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
public static final class ResourceBindingStateDescriptor extends StateDescriptor {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private ResourceBindingStateDescriptor() {
|
||||
super(ResourceBindingState.class, "RFC 6120 § 7");
|
||||
addSuccessor(AuthenticatedAndResourceBoundStateDescriptor.class);
|
||||
|
@ -900,6 +909,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class ResourceBindingState extends State {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private ResourceBindingState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -955,6 +966,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class AuthenticatedAndResourceBoundState extends State {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private AuthenticatedAndResourceBoundState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -995,6 +1008,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class ShutdownState extends State {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private ShutdownState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
@ -1057,6 +1072,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private static final class InstantShutdownState extends NoOpState {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private InstantShutdownState(ModularXmppClientToServerConnection connection, StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(connection, stateDescriptor, connectionInternal);
|
||||
|
@ -1078,6 +1095,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
}
|
||||
|
||||
private final class CloseConnectionState extends State {
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private CloseConnectionState(StateDescriptor stateDescriptor,
|
||||
ModularXmppClientToServerConnectionInternal connectionInternal) {
|
||||
super(stateDescriptor, connectionInternal);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2018-2020 Florian Schmaus
|
||||
* Copyright 2018-2024 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -41,6 +41,8 @@ public class CompressionModuleDescriptor extends ModularXmppClientToServerConnec
|
|||
|
||||
public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder {
|
||||
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) {
|
||||
super(connectionConfigurationBuilder);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2018-2021 Florian Schmaus
|
||||
* Copyright 2018-2024 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -368,7 +368,7 @@ public class StateDescriptorGraph {
|
|||
}
|
||||
}
|
||||
|
||||
public static <E> void stateDescriptorGraphToDot(Collection<GraphVertex<StateDescriptor>> vertexes,
|
||||
public static void stateDescriptorGraphToDot(Collection<GraphVertex<StateDescriptor>> vertexes,
|
||||
PrintWriter dotOut, boolean breakStateName) {
|
||||
dotOut.append("digraph {\n");
|
||||
dfs(vertexes,
|
||||
|
|
|
@ -41,6 +41,8 @@ public class InstantStreamResumptionModuleDescriptor extends ModularXmppClientTo
|
|||
|
||||
public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder {
|
||||
|
||||
// Unfinished implementation.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) {
|
||||
super(connectionConfigurationBuilder);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.io.StringReader;
|
|||
import java.net.HttpURLConnection;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -58,7 +59,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
|
|||
proxyLine = "\r\nProxy-Authorization: Basic " + Base64.encode(username + ":" + password);
|
||||
}
|
||||
socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: "
|
||||
+ host + ":" + port + proxyLine + "\r\n\r\n").getBytes("UTF-8"));
|
||||
+ host + ":" + port + proxyLine + "\r\n\r\n").getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
InputStream in = socket.getInputStream();
|
||||
StringBuilder got = new StringBuilder(100);
|
||||
|
|
|
@ -55,6 +55,7 @@ public class CollectionUtil {
|
|||
boolean test(T t);
|
||||
}
|
||||
|
||||
@SuppressWarnings("NonApiType")
|
||||
public static <T> ArrayList<T> newListWith(Collection<? extends T> collection) {
|
||||
if (collection == null) {
|
||||
return null;
|
||||
|
|
|
@ -26,12 +26,12 @@ public final class Pair<F, S> {
|
|||
this.second = second;
|
||||
}
|
||||
|
||||
public static <F extends Object, S extends Object> Pair<F, S> create(F first, S second) {
|
||||
public static <F, S> Pair<F, S> create(F first, S second) {
|
||||
return new Pair<>(first, second);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ReturnValueIgnored")
|
||||
public static <F extends Object, S extends Object> Pair<F, S> createAndInitHashCode(F first, S second) {
|
||||
public static <F, S> Pair<F, S> createAndInitHashCode(F first, S second) {
|
||||
Pair<F, S> pair = new Pair<>(first, second);
|
||||
pair.hashCode();
|
||||
return pair;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2019 Florian Schmaus.
|
||||
* Copyright 2019-2024 Florian Schmaus.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -26,6 +26,7 @@ public class SecurityUtil {
|
|||
|
||||
private static final LruCache<Class<? extends Provider>, Void> INSERTED_PROVIDERS_CACHE = new LruCache<>(8);
|
||||
|
||||
@SuppressWarnings("LockOnNonEnclosingClassLiteral")
|
||||
public static void ensureProviderAtFirstPosition(Class<? extends Provider> providerClass) {
|
||||
if (INSERTED_PROVIDERS_CACHE.containsKey(providerClass)) {
|
||||
return;
|
||||
|
@ -41,7 +42,7 @@ public class SecurityUtil {
|
|||
|
||||
String providerName = provider.getName();
|
||||
|
||||
int installedPosition ;
|
||||
int installedPosition;
|
||||
synchronized (Security.class) {
|
||||
Security.removeProvider(providerName);
|
||||
installedPosition = Security.insertProviderAt(provider, 1);
|
||||
|
|
|
@ -464,7 +464,7 @@ public class StringUtils {
|
|||
appendTo(collection, ", ", sb);
|
||||
}
|
||||
|
||||
public static <O extends Object> void appendTo(Collection<O> collection, StringBuilder sb,
|
||||
public static <O> void appendTo(Collection<O> collection, StringBuilder sb,
|
||||
Consumer<O> appendFunction) {
|
||||
appendTo(collection, ", ", sb, appendFunction);
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ public class StringUtils {
|
|||
appendTo(collection, delimiter, sb, o -> sb.append(o));
|
||||
}
|
||||
|
||||
public static <O extends Object> void appendTo(Collection<O> collection, String delimiter, StringBuilder sb,
|
||||
public static <O> void appendTo(Collection<O> collection, String delimiter, StringBuilder sb,
|
||||
Consumer<O> appendFunction) {
|
||||
for (Iterator<O> it = collection.iterator(); it.hasNext();) {
|
||||
O cs = it.next();
|
||||
|
|
|
@ -185,7 +185,7 @@ public class OmemoClient {
|
|||
|
||||
BareJid contact = JidCreate.bareFrom(com[1]);
|
||||
|
||||
HashMap<OmemoDevice, OmemoFingerprint> devices;
|
||||
Map<OmemoDevice, OmemoFingerprint> devices;
|
||||
try {
|
||||
devices = omemoManager.getActiveFingerprints(contact);
|
||||
} catch (CorruptedOmemoKeyException | CannotEstablishOmemoSessionException | SmackException.NoResponseException e) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* MUC Light room configuration class.
|
||||
|
@ -28,7 +28,7 @@ public class MUCLightRoomConfiguration {
|
|||
|
||||
private final String roomName;
|
||||
private final String subject;
|
||||
private final HashMap<String, String> customConfigs;
|
||||
private final Map<String, String> customConfigs;
|
||||
|
||||
/**
|
||||
* MUC Light room configuration model constructor.
|
||||
|
@ -37,7 +37,7 @@ public class MUCLightRoomConfiguration {
|
|||
* @param subject TODO javadoc me please
|
||||
* @param customConfigs TODO javadoc me please
|
||||
*/
|
||||
public MUCLightRoomConfiguration(String roomName, String subject, HashMap<String, String> customConfigs) {
|
||||
public MUCLightRoomConfiguration(String roomName, String subject, Map<String, String> customConfigs) {
|
||||
this.roomName = roomName;
|
||||
this.subject = subject;
|
||||
this.customConfigs = customConfigs;
|
||||
|
@ -66,7 +66,7 @@ public class MUCLightRoomConfiguration {
|
|||
*
|
||||
* @return the custom configurations of the room.
|
||||
*/
|
||||
public HashMap<String, String> getCustomConfigs() {
|
||||
public Map<String, String> getCustomConfigs() {
|
||||
return customConfigs;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class MUCLightRoomInfo {
|
|||
private final String version;
|
||||
private final Jid room;
|
||||
private final MUCLightRoomConfiguration configuration;
|
||||
private final HashMap<Jid, MUCLightAffiliation> occupants;
|
||||
private final Map<Jid, MUCLightAffiliation> occupants;
|
||||
|
||||
/**
|
||||
* MUC Light room info model constructor.
|
||||
|
@ -41,7 +41,7 @@ public class MUCLightRoomInfo {
|
|||
* @param occupants TODO javadoc me please
|
||||
*/
|
||||
public MUCLightRoomInfo(String version, Jid roomJid, MUCLightRoomConfiguration configuration,
|
||||
HashMap<Jid, MUCLightAffiliation> occupants) {
|
||||
Map<Jid, MUCLightAffiliation> occupants) {
|
||||
this.version = version;
|
||||
this.room = roomJid;
|
||||
this.configuration = configuration;
|
||||
|
@ -80,7 +80,7 @@ public class MUCLightRoomInfo {
|
|||
*
|
||||
* @return the occupants of the room.
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getOccupants() {
|
||||
public Map<Jid, MUCLightAffiliation> getOccupants() {
|
||||
return occupants;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
|
@ -279,7 +280,7 @@ public class MultiUserChatLight {
|
|||
* @param occupants TODO javadoc me please
|
||||
* @throws Exception TODO javadoc me please
|
||||
*/
|
||||
public void create(String roomName, String subject, HashMap<String, String> customConfigs, List<Jid> occupants)
|
||||
public void create(String roomName, String subject, Map<String, String> customConfigs, List<Jid> occupants)
|
||||
throws Exception {
|
||||
MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants);
|
||||
|
||||
|
@ -313,7 +314,7 @@ public class MultiUserChatLight {
|
|||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
*/
|
||||
public void leave() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
|
||||
Map<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
|
||||
affiliations.put(connection.getUser(), MUCLightAffiliation.none);
|
||||
|
||||
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
|
||||
|
@ -402,7 +403,7 @@ public class MultiUserChatLight {
|
|||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getAffiliations(String version)
|
||||
public Map<Jid, MUCLightAffiliation> getAffiliations(String version)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version);
|
||||
|
||||
|
@ -421,7 +422,7 @@ public class MultiUserChatLight {
|
|||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getAffiliations()
|
||||
public Map<Jid, MUCLightAffiliation> getAffiliations()
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return getAffiliations(null);
|
||||
}
|
||||
|
@ -435,7 +436,7 @@ public class MultiUserChatLight {
|
|||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public void changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations)
|
||||
public void changeAffiliations(Map<Jid, MUCLightAffiliation> affiliations)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
|
||||
connection.sendIqRequestAndWaitForResponse(changeAffiliationsIQ);
|
||||
|
@ -498,7 +499,7 @@ public class MultiUserChatLight {
|
|||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public void setRoomConfigs(HashMap<String, String> customConfigs)
|
||||
public void setRoomConfigs(Map<String, String> customConfigs)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
setRoomConfigs(null, customConfigs);
|
||||
}
|
||||
|
@ -513,7 +514,7 @@ public class MultiUserChatLight {
|
|||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public void setRoomConfigs(String roomName, HashMap<String, String> customConfigs)
|
||||
public void setRoomConfigs(String roomName, Map<String, String> customConfigs)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, customConfigs);
|
||||
connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ);
|
||||
|
|
|
@ -274,7 +274,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
sendBlockRooms(mucLightService, rooms);
|
||||
}
|
||||
|
||||
private void sendBlockRooms(DomainBareJid mucLightService, HashMap<Jid, Boolean> rooms)
|
||||
private void sendBlockRooms(DomainBareJid mucLightService, Map<Jid, Boolean> rooms)
|
||||
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
|
@ -318,7 +318,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
sendBlockUsers(mucLightService, users);
|
||||
}
|
||||
|
||||
private void sendBlockUsers(DomainBareJid mucLightService, HashMap<Jid, Boolean> users)
|
||||
private void sendBlockUsers(DomainBareJid mucLightService, Map<Jid, Boolean> users)
|
||||
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
|
@ -362,7 +362,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
sendUnblockRooms(mucLightService, rooms);
|
||||
}
|
||||
|
||||
private void sendUnblockRooms(DomainBareJid mucLightService, HashMap<Jid, Boolean> rooms)
|
||||
private void sendUnblockRooms(DomainBareJid mucLightService, Map<Jid, Boolean> rooms)
|
||||
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
|
@ -406,7 +406,7 @@ public final class MultiUserChatLightManager extends Manager {
|
|||
sendUnblockUsers(mucLightService, users);
|
||||
}
|
||||
|
||||
private void sendUnblockUsers(DomainBareJid mucLightService, HashMap<Jid, Boolean> users)
|
||||
private void sendUnblockUsers(DomainBareJid mucLightService, Map<Jid, Boolean> users)
|
||||
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
|
||||
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
|
||||
mucLightBlockingIQ.setType(IQ.Type.set);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class MUCLightAffiliationsIQ extends IQ {
|
|||
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
|
||||
|
||||
private final String version;
|
||||
private HashMap<Jid, MUCLightAffiliation> affiliations;
|
||||
private Map<Jid, MUCLightAffiliation> affiliations;
|
||||
|
||||
/**
|
||||
* MUC Light affiliations response IQ constructor.
|
||||
|
@ -49,7 +48,7 @@ public class MUCLightAffiliationsIQ extends IQ {
|
|||
* @param affiliations TODO javadoc me please
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public MUCLightAffiliationsIQ(String version, HashMap<Jid, MUCLightAffiliation> affiliations) {
|
||||
public MUCLightAffiliationsIQ(String version, Map<Jid, MUCLightAffiliation> affiliations) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.version = version;
|
||||
this.affiliations = affiliations;
|
||||
|
@ -83,7 +82,7 @@ public class MUCLightAffiliationsIQ extends IQ {
|
|||
*
|
||||
* @return the affiliations of the room
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getAffiliations() {
|
||||
public Map<Jid, MUCLightAffiliation> getAffiliations() {
|
||||
return affiliations;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -38,8 +37,8 @@ public class MUCLightBlockingIQ extends IQ {
|
|||
public static final String ELEMENT = QUERY_ELEMENT;
|
||||
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.BLOCKING;
|
||||
|
||||
private final HashMap<Jid, Boolean> rooms;
|
||||
private final HashMap<Jid, Boolean> users;
|
||||
private final Map<Jid, Boolean> rooms;
|
||||
private final Map<Jid, Boolean> users;
|
||||
|
||||
/**
|
||||
* MUC Light blocking IQ constructor.
|
||||
|
@ -47,7 +46,7 @@ public class MUCLightBlockingIQ extends IQ {
|
|||
* @param rooms TODO javadoc me please
|
||||
* @param users TODO javadoc me please
|
||||
*/
|
||||
public MUCLightBlockingIQ(HashMap<Jid, Boolean> rooms, HashMap<Jid, Boolean> users) {
|
||||
public MUCLightBlockingIQ(Map<Jid, Boolean> rooms, Map<Jid, Boolean> users) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.rooms = rooms;
|
||||
this.users = users;
|
||||
|
@ -58,7 +57,7 @@ public class MUCLightBlockingIQ extends IQ {
|
|||
*
|
||||
* @return the rooms JIDs with booleans (true if allow, false if deny)
|
||||
*/
|
||||
public HashMap<Jid, Boolean> getRooms() {
|
||||
public Map<Jid, Boolean> getRooms() {
|
||||
return rooms;
|
||||
}
|
||||
|
||||
|
@ -67,7 +66,7 @@ public class MUCLightBlockingIQ extends IQ {
|
|||
*
|
||||
* @return the users JIDs with booleans (true if allow, false if deny)
|
||||
*/
|
||||
public HashMap<Jid, Boolean> getUsers() {
|
||||
public Map<Jid, Boolean> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
|
@ -86,7 +85,7 @@ public class MUCLightBlockingIQ extends IQ {
|
|||
return xml;
|
||||
}
|
||||
|
||||
private static void parseBlocking(IQChildElementXmlStringBuilder xml, HashMap<Jid, Boolean> map, boolean isRoom) {
|
||||
private static void parseBlocking(IQChildElementXmlStringBuilder xml, Map<Jid, Boolean> map, boolean isRoom) {
|
||||
Iterator<Map.Entry<Jid, Boolean>> it = map.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<Jid, Boolean> pair = it.next();
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -39,7 +38,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
|
|||
public static final String ELEMENT = QUERY_ELEMENT;
|
||||
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
|
||||
|
||||
private HashMap<Jid, MUCLightAffiliation> affiliations;
|
||||
private Map<Jid, MUCLightAffiliation> affiliations;
|
||||
|
||||
/**
|
||||
* MUCLight change affiliations IQ constructor.
|
||||
|
@ -48,7 +47,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
|
|||
* @param affiliations TODO javadoc me please
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public MUCLightChangeAffiliationsIQ(Jid room, HashMap<Jid, MUCLightAffiliation> affiliations) {
|
||||
public MUCLightChangeAffiliationsIQ(Jid room, Map<Jid, MUCLightAffiliation> affiliations) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.setType(Type.set);
|
||||
this.setTo(room);
|
||||
|
@ -60,7 +59,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
|
|||
*
|
||||
* @return the affiliations
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getAffiliations() {
|
||||
public Map<Jid, MUCLightAffiliation> getAffiliations() {
|
||||
return affiliations;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight.element;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class MUCLightCreateIQ extends IQ {
|
|||
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.CREATE;
|
||||
|
||||
private MUCLightRoomConfiguration configuration;
|
||||
private final HashMap<Jid, MUCLightAffiliation> occupants;
|
||||
private final Map<Jid, MUCLightAffiliation> occupants;
|
||||
|
||||
/**
|
||||
* MUCLight create IQ constructor.
|
||||
|
@ -54,7 +55,7 @@ public class MUCLightCreateIQ extends IQ {
|
|||
* @param occupants TODO javadoc me please
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public MUCLightCreateIQ(EntityJid room, String roomName, String subject, HashMap<String, String> customConfigs,
|
||||
public MUCLightCreateIQ(EntityJid room, String roomName, String subject, Map<String, String> customConfigs,
|
||||
List<Jid> occupants) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.configuration = new MUCLightRoomConfiguration(roomName, subject, customConfigs);
|
||||
|
@ -93,7 +94,7 @@ public class MUCLightCreateIQ extends IQ {
|
|||
*
|
||||
* @return the room occupants
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getOccupants() {
|
||||
public Map<Jid, MUCLightAffiliation> getOccupants() {
|
||||
return occupants;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -48,11 +47,11 @@ public abstract class MUCLightElements {
|
|||
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
|
||||
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||
|
||||
private final HashMap<Jid, MUCLightAffiliation> affiliations;
|
||||
private final Map<Jid, MUCLightAffiliation> affiliations;
|
||||
private final String prevVersion;
|
||||
private final String version;
|
||||
|
||||
public AffiliationsChangeExtension(HashMap<Jid, MUCLightAffiliation> affiliations, String prevVersion,
|
||||
public AffiliationsChangeExtension(Map<Jid, MUCLightAffiliation> affiliations, String prevVersion,
|
||||
String version) {
|
||||
this.affiliations = affiliations;
|
||||
this.prevVersion = prevVersion;
|
||||
|
@ -74,7 +73,7 @@ public abstract class MUCLightElements {
|
|||
*
|
||||
* @return the affiliations
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getAffiliations() {
|
||||
public Map<Jid, MUCLightAffiliation> getAffiliations() {
|
||||
return affiliations;
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,7 @@ public abstract class MUCLightElements {
|
|||
private final String version;
|
||||
private final String roomName;
|
||||
private final String subject;
|
||||
private final HashMap<String, String> customConfigs;
|
||||
private final Map<String, String> customConfigs;
|
||||
|
||||
/**
|
||||
* Configurations change extension constructor.
|
||||
|
@ -147,7 +146,7 @@ public abstract class MUCLightElements {
|
|||
* @param customConfigs TODO javadoc me please
|
||||
*/
|
||||
public ConfigurationsChangeExtension(String prevVersion, String version, String roomName, String subject,
|
||||
HashMap<String, String> customConfigs) {
|
||||
Map<String, String> customConfigs) {
|
||||
this.prevVersion = prevVersion;
|
||||
this.version = version;
|
||||
this.roomName = roomName;
|
||||
|
@ -206,7 +205,7 @@ public abstract class MUCLightElements {
|
|||
*
|
||||
* @return the room custom configurations
|
||||
*/
|
||||
public HashMap<String, String> getCustomConfigs() {
|
||||
public Map<String, String> getCustomConfigs() {
|
||||
return customConfigs;
|
||||
}
|
||||
|
||||
|
@ -287,14 +286,14 @@ public abstract class MUCLightElements {
|
|||
*/
|
||||
public static class OccupantsElement implements Element {
|
||||
|
||||
private HashMap<Jid, MUCLightAffiliation> occupants;
|
||||
private Map<Jid, MUCLightAffiliation> occupants;
|
||||
|
||||
/**
|
||||
* Occupants element constructor.
|
||||
*
|
||||
* @param occupants TODO javadoc me please
|
||||
*/
|
||||
public OccupantsElement(HashMap<Jid, MUCLightAffiliation> occupants) {
|
||||
public OccupantsElement(Map<Jid, MUCLightAffiliation> occupants) {
|
||||
this.occupants = occupants;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class MUCLightInfoIQ extends IQ {
|
|||
|
||||
private final String version;
|
||||
private final MUCLightRoomConfiguration configuration;
|
||||
private final HashMap<Jid, MUCLightAffiliation> occupants;
|
||||
private final Map<Jid, MUCLightAffiliation> occupants;
|
||||
|
||||
/**
|
||||
* MUCLight info response IQ constructor.
|
||||
|
@ -51,7 +51,7 @@ public class MUCLightInfoIQ extends IQ {
|
|||
* @param occupants TODO javadoc me please
|
||||
*/
|
||||
public MUCLightInfoIQ(String version, MUCLightRoomConfiguration configuration,
|
||||
HashMap<Jid, MUCLightAffiliation> occupants) {
|
||||
Map<Jid, MUCLightAffiliation> occupants) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.version = version;
|
||||
this.configuration = configuration;
|
||||
|
@ -90,7 +90,7 @@ public class MUCLightInfoIQ extends IQ {
|
|||
*
|
||||
* @return the occupants of the room
|
||||
*/
|
||||
public HashMap<Jid, MUCLightAffiliation> getOccupants() {
|
||||
public Map<Jid, MUCLightAffiliation> getOccupants() {
|
||||
return occupants;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -39,7 +38,7 @@ public class MUCLightSetConfigsIQ extends IQ {
|
|||
|
||||
private String roomName;
|
||||
private String subject;
|
||||
private HashMap<String, String> customConfigs;
|
||||
private Map<String, String> customConfigs;
|
||||
|
||||
/**
|
||||
* MUC Light set configuration IQ constructor.
|
||||
|
@ -50,7 +49,7 @@ public class MUCLightSetConfigsIQ extends IQ {
|
|||
* @param customConfigs TODO javadoc me please
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public MUCLightSetConfigsIQ(Jid roomJid, String roomName, String subject, HashMap<String, String> customConfigs) {
|
||||
public MUCLightSetConfigsIQ(Jid roomJid, String roomName, String subject, Map<String, String> customConfigs) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.roomName = roomName;
|
||||
this.subject = subject;
|
||||
|
@ -66,7 +65,7 @@ public class MUCLightSetConfigsIQ extends IQ {
|
|||
* @param roomName TODO javadoc me please
|
||||
* @param customConfigs TODO javadoc me please
|
||||
*/
|
||||
public MUCLightSetConfigsIQ(Jid roomJid, String roomName, HashMap<String, String> customConfigs) {
|
||||
public MUCLightSetConfigsIQ(Jid roomJid, String roomName, Map<String, String> customConfigs) {
|
||||
this(roomJid, roomName, null, customConfigs);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight.provider;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IqData;
|
||||
|
@ -42,8 +43,8 @@ public class MUCLightBlockingIQProvider extends IqProvider<MUCLightBlockingIQ> {
|
|||
|
||||
@Override
|
||||
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
|
||||
HashMap<Jid, Boolean> rooms = null;
|
||||
HashMap<Jid, Boolean> users = null;
|
||||
Map<Jid, Boolean> rooms = null;
|
||||
Map<Jid, Boolean> users = null;
|
||||
|
||||
outerloop: while (true) {
|
||||
XmlPullParser.Event eventType = parser.next();
|
||||
|
@ -70,7 +71,7 @@ public class MUCLightBlockingIQProvider extends IqProvider<MUCLightBlockingIQ> {
|
|||
return mucLightBlockingIQ;
|
||||
}
|
||||
|
||||
private static HashMap<Jid, Boolean> parseBlocking(XmlPullParser parser, HashMap<Jid, Boolean> map)
|
||||
private static Map<Jid, Boolean> parseBlocking(XmlPullParser parser, Map<Jid, Boolean> map)
|
||||
throws XmppStringprepException, XmlPullParserException, IOException {
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight.provider;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IqData;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
|
@ -45,8 +46,8 @@ public class MUCLightInfoIQProvider extends IqProvider<MUCLightInfoIQ> {
|
|||
String version = null;
|
||||
String roomName = null;
|
||||
String subject = null;
|
||||
HashMap<String, String> customConfigs = null;
|
||||
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
Map<String, String> customConfigs = null;
|
||||
Map<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
|
||||
outerloop: while (true) {
|
||||
XmlPullParser.Event eventType = parser.next();
|
||||
|
@ -97,8 +98,8 @@ public class MUCLightInfoIQProvider extends IqProvider<MUCLightInfoIQ> {
|
|||
return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants);
|
||||
}
|
||||
|
||||
private static HashMap<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
private static Map<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
Map<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
int depth = parser.getDepth();
|
||||
|
||||
outerloop: while (true) {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.push_notifications;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
|
@ -122,7 +121,7 @@ public final class PushNotificationsManager extends Manager {
|
|||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public boolean enable(Jid pushJid, String node, HashMap<String, String> publishOptions)
|
||||
public boolean enable(Jid pushJid, String node, Map<String, String> publishOptions)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(pushJid, node,
|
||||
publishOptions);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.push_notifications.element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -51,10 +50,10 @@ public class EnablePushNotificationsIQ extends IQ {
|
|||
|
||||
private final Jid jid;
|
||||
private final String node;
|
||||
private final HashMap<String, String> publishOptions;
|
||||
private final Map<String, String> publishOptions;
|
||||
|
||||
@SuppressWarnings("this-escape")
|
||||
public EnablePushNotificationsIQ(Jid jid, String node, HashMap<String, String> publishOptions) {
|
||||
public EnablePushNotificationsIQ(Jid jid, String node, Map<String, String> publishOptions) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
this.jid = jid;
|
||||
this.node = node;
|
||||
|
@ -89,7 +88,7 @@ public class EnablePushNotificationsIQ extends IQ {
|
|||
*
|
||||
* @return the publish options
|
||||
*/
|
||||
public HashMap<String, String> getPublishOptions() {
|
||||
public Map<String, String> getPublishOptions() {
|
||||
return publishOptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
@ -55,7 +55,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
|
|||
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
||||
.from(changeAffiliationsMessage);
|
||||
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
|
||||
Map<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
|
||||
assertEquals(affiliations.size(), 3);
|
||||
assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
|
||||
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
|
||||
|
@ -68,7 +68,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
|
|||
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
||||
.from(changeAffiliationsMessage);
|
||||
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
|
||||
Map<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
|
||||
assertEquals(affiliations.size(), 2);
|
||||
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
|
||||
assertEquals(affiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);
|
||||
|
@ -83,7 +83,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
|
|||
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
||||
.from(changeAffiliationsMessage);
|
||||
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
|
||||
Map<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
|
||||
assertEquals(affiliations.size(), 2);
|
||||
assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
|
||||
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class MUCLightChangeAffiliationsIQTest {
|
|||
|
||||
@Test
|
||||
public void checkChangeAffiliationsMUCLightStanza() throws Exception {
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
|
||||
Map<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
|
||||
affiliations.put(JidCreate.from("sarasa2@shakespeare.lit"), MUCLightAffiliation.owner);
|
||||
affiliations.put(JidCreate.from("sarasa1@shakespeare.lit"), MUCLightAffiliation.member);
|
||||
affiliations.put(JidCreate.from("sarasa3@shakespeare.lit"), MUCLightAffiliation.none);
|
||||
|
@ -44,7 +45,7 @@ public class MUCLightChangeAffiliationsIQTest {
|
|||
assertEquals(mucLightChangeAffiliationsIQ.getTo(), "coven@muclight.shakespeare.lit");
|
||||
assertEquals(mucLightChangeAffiliationsIQ.getType(), IQ.Type.set);
|
||||
|
||||
HashMap<Jid, MUCLightAffiliation> iqAffiliations = mucLightChangeAffiliationsIQ.getAffiliations();
|
||||
Map<Jid, MUCLightAffiliation> iqAffiliations = mucLightChangeAffiliationsIQ.getAffiliations();
|
||||
assertEquals(iqAffiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
|
||||
assertEquals(iqAffiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
|
||||
assertEquals(iqAffiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.jivesoftware.smackx.muclight;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightCreateIQ;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class MUCLightCreateIQTest {
|
|||
|
||||
assertEquals(mucLightCreateIQ.getConfiguration().getRoomName(), "test");
|
||||
|
||||
HashMap<Jid, MUCLightAffiliation> iqOccupants = mucLightCreateIQ.getOccupants();
|
||||
Map<Jid, MUCLightAffiliation> iqOccupants = mucLightCreateIQ.getOccupants();
|
||||
assertEquals(iqOccupants.get(JidCreate.from("charlie@test.com")), MUCLightAffiliation.member);
|
||||
assertEquals(iqOccupants.get(JidCreate.from("pep@test.com")), MUCLightAffiliation.member);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
@ -57,7 +57,7 @@ public class MUCLightGetAffiliationsTest {
|
|||
|
||||
assertEquals("123456", mucLightAffiliationsIQ.getVersion());
|
||||
|
||||
HashMap<Jid, MUCLightAffiliation> affiliations = mucLightAffiliationsIQ.getAffiliations();
|
||||
Map<Jid, MUCLightAffiliation> affiliations = mucLightAffiliationsIQ.getAffiliations();
|
||||
assertEquals(3, affiliations.size());
|
||||
assertEquals(MUCLightAffiliation.owner, affiliations.get(JidCreate.from("user1@shakespeare.lit")));
|
||||
assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user2@shakespeare.lit")));
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
@ -74,7 +74,7 @@ public class MUCLightGetConfigsTest {
|
|||
assertEquals("A Dark Cave", mucLightConfigurationIQ.getConfiguration().getRoomName());
|
||||
assertNull(mucLightConfigurationIQ.getConfiguration().getSubject());
|
||||
|
||||
HashMap<String, String> customConfigs = mucLightConfigurationIQ.getConfiguration().getCustomConfigs();
|
||||
Map<String, String> customConfigs = mucLightConfigurationIQ.getConfiguration().getCustomConfigs();
|
||||
assertEquals("blue", customConfigs.get("color"));
|
||||
assertEquals("20", customConfigs.get("size"));
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
*/
|
||||
private static final Map<XMPPConnection, AdHocCommandManager> instances = new WeakHashMap<>();
|
||||
|
||||
/**
|
||||
/*
|
||||
* Register the listener for all the connection creations. When a new
|
||||
* connection is created a new AdHocCommandManager is also created and
|
||||
* related to that connection.
|
||||
|
@ -463,7 +463,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
private AdHocCommandData processAdHocCommandOfExistingSession(AdHocCommandData request, AdHocCommandHandler command, AdHocCommandDataBuilder responseBuilder) {
|
||||
// Check if the Session data has expired (default is 10 minutes)
|
||||
long creationStamp = command.getCreationDate();
|
||||
if (System.currentTimeMillis() - creationStamp > sessionTimeoutSecs * 1000) {
|
||||
if (System.currentTimeMillis() - creationStamp > sessionTimeoutSecs * 1000L) {
|
||||
// Remove the expired session
|
||||
executingCommands.remove(command.getSessionId());
|
||||
|
||||
|
@ -553,7 +553,7 @@ public final class AdHocCommandManager extends Manager {
|
|||
// after the time out, then once the user requests to
|
||||
// continue the execution he will received an
|
||||
// invalid session error and not a time out error.
|
||||
if (currentTime - creationStamp > getSessionRemovalTimeoutSecs() * 1000) {
|
||||
if (currentTime - creationStamp > getSessionRemovalTimeoutSecs() * 1000L) {
|
||||
// Remove the expired session
|
||||
it.remove();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class JivePropertiesExtensionProvider extends ExtensionElementProvider<Ji
|
|||
* down the entire connection. ClassCastExceptions will occur when both the sender and receiver
|
||||
* of the stanza don't have identical versions of the same class.
|
||||
* <p>
|
||||
* Note that you have to explicitly enabled Java object deserialization with @{link
|
||||
* Note that you have to explicitly enabled Java object deserialization with
|
||||
* {@link JivePropertiesManager#setJavaObjectEnabled(boolean)}
|
||||
*
|
||||
* @param parser the XML parser, positioned at the start of a properties sub-packet.
|
||||
|
|
|
@ -143,7 +143,6 @@ public final class PrivacyListManager extends Manager {
|
|||
else {
|
||||
cachedActiveListName = activeListName;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}, iqResultReplyFilter);
|
||||
}
|
||||
|
@ -165,7 +164,6 @@ public final class PrivacyListManager extends Manager {
|
|||
else {
|
||||
cachedDefaultListName = defaultListName;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}, iqResultReplyFilter);
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ public abstract class FormField implements XmlElement {
|
|||
protected transient List<XmlElement> extraXmlChildElements;
|
||||
|
||||
/**
|
||||
* Populate @{link {@link #extraXmlChildElements}}. Note that this method may be overridden by subclasses.
|
||||
* Populate {@link #extraXmlChildElements}. Note that this method may be overridden by subclasses.
|
||||
*/
|
||||
protected void populateExtraXmlChildElements() {
|
||||
List<Value> values = getRawValues();
|
||||
|
|
|
@ -179,7 +179,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -231,7 +231,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -292,7 +292,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -375,7 +375,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -454,7 +454,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
// TODO: It appears that it is not required to disable the local stream host for this unit test.
|
||||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -541,7 +541,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
byteStreamManager.setProxyConnectionTimeout(3000);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -634,7 +634,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
byteStreamManager.setAnnounceLocalStreamHost(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
@ -760,7 +760,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
// get Socks5ByteStreamManager for connection
|
||||
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
|
||||
/**
|
||||
/*
|
||||
* create responses in the order they should be queried specified by the XEP-0065
|
||||
* specification
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
@ -787,6 +788,6 @@ public final class Configuration {
|
|||
if (specification == null || specification.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
return specification.replaceAll("[\\s-]", "").toUpperCase();
|
||||
return specification.replaceAll("[\\s-]", "").toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest
|
|||
URL getUrl = hfumOne.uploadFile(file, new UploadProgressListener() {
|
||||
@Override
|
||||
public void onUploadProgress(long uploadedBytes, long totalBytes) {
|
||||
double progress = uploadedBytes / totalBytes;
|
||||
double progress = uploadedBytes / ((double) totalBytes);
|
||||
LOGGER.fine("HTTP File Upload progress " + progress + "% (" + uploadedBytes + '/' + totalBytes + ')');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,8 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
|
@ -54,7 +54,7 @@ public class OmemoManagerSetupHelper {
|
|||
}
|
||||
|
||||
alice.requestDeviceListUpdateFor(bob.getOwnJid());
|
||||
HashMap<OmemoDevice, OmemoFingerprint> fingerprints = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
Map<OmemoDevice, OmemoFingerprint> fingerprints = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
|
||||
for (OmemoDevice device : fingerprints.keySet()) {
|
||||
OmemoFingerprint fingerprint = fingerprints.get(device);
|
||||
|
@ -67,7 +67,7 @@ public class OmemoManagerSetupHelper {
|
|||
SmackException.NoResponseException, CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
|
||||
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, IOException {
|
||||
alice.requestDeviceListUpdateFor(bob.getOwnJid());
|
||||
HashMap<OmemoDevice, OmemoFingerprint> fps1 = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
Map<OmemoDevice, OmemoFingerprint> fps1 = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
|
||||
assertFalse(fps1.isEmpty());
|
||||
assertAllDevicesAreUndecided(alice, fps1);
|
||||
|
@ -75,7 +75,7 @@ public class OmemoManagerSetupHelper {
|
|||
|
||||
trustAllIdentities(alice, bob);
|
||||
|
||||
HashMap<OmemoDevice, OmemoFingerprint> fps2 = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
Map<OmemoDevice, OmemoFingerprint> fps2 = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
assertEquals(fps1.size(), fps2.size());
|
||||
assertTrue(Maps.difference(fps1, fps2).areEqual());
|
||||
|
||||
|
@ -95,28 +95,28 @@ public class OmemoManagerSetupHelper {
|
|||
return manager;
|
||||
}
|
||||
|
||||
public static void assertAllDevicesAreUndecided(OmemoManager manager, HashMap<OmemoDevice, OmemoFingerprint> devices) {
|
||||
public static void assertAllDevicesAreUndecided(OmemoManager manager, Map<OmemoDevice, OmemoFingerprint> devices) {
|
||||
for (OmemoDevice device : devices.keySet()) {
|
||||
// All fingerprints MUST be neither decided, nor trusted.
|
||||
assertFalse(manager.isDecidedOmemoIdentity(device, devices.get(device)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertAllDevicesAreUntrusted(OmemoManager manager, HashMap<OmemoDevice, OmemoFingerprint> devices) {
|
||||
public static void assertAllDevicesAreUntrusted(OmemoManager manager, Map<OmemoDevice, OmemoFingerprint> devices) {
|
||||
for (OmemoDevice device : devices.keySet()) {
|
||||
// All fingerprints MUST be neither decided, nor trusted.
|
||||
assertFalse(manager.isTrustedOmemoIdentity(device, devices.get(device)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertAllDevicesAreDecided(OmemoManager manager, HashMap<OmemoDevice, OmemoFingerprint> devices) {
|
||||
public static void assertAllDevicesAreDecided(OmemoManager manager, Map<OmemoDevice, OmemoFingerprint> devices) {
|
||||
for (OmemoDevice device : devices.keySet()) {
|
||||
// All fingerprints MUST be neither decided, nor trusted.
|
||||
assertTrue(manager.isDecidedOmemoIdentity(device, devices.get(device)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertAllDevicesAreTrusted(OmemoManager manager, HashMap<OmemoDevice, OmemoFingerprint> devices) {
|
||||
public static void assertAllDevicesAreTrusted(OmemoManager manager, Map<OmemoDevice, OmemoFingerprint> devices) {
|
||||
for (OmemoDevice device : devices.keySet()) {
|
||||
// All fingerprints MUST be neither decided, nor trusted.
|
||||
assertTrue(manager.isTrustedOmemoIdentity(device, devices.get(device)));
|
||||
|
|
|
@ -31,26 +31,26 @@ import org.junit.jupiter.api.Test;
|
|||
public class SmackIntegrationTestFrameWorkTest {
|
||||
|
||||
private static class ValidLowLevelList {
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "MethodCanBeStatic"})
|
||||
public void test(List<AbstractXMPPConnection> connections) {
|
||||
}
|
||||
}
|
||||
|
||||
private static class InvalidLowLevelList {
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "MethodCanBeStatic"})
|
||||
public void test(List<AbstractXMPPConnection> connections, boolean invalid) {
|
||||
}
|
||||
}
|
||||
|
||||
private static class ValidLowLevelVarargs {
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "MethodCanBeStatic"})
|
||||
public void test(AbstractXMPPConnection connectionOne, AbstractXMPPConnection connectionTwo,
|
||||
AbstractXMPPConnection connectionThree) {
|
||||
}
|
||||
}
|
||||
|
||||
private static class InvalidLowLevelVarargs {
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "MethodCanBeStatic"})
|
||||
public void test(AbstractXMPPConnection connectionOne, Integer invalid, AbstractXMPPConnection connectionTwo,
|
||||
AbstractXMPPConnection connectionThree) {
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class SmackIntegrationTestFrameWorkTest {
|
|||
}
|
||||
|
||||
private static class ValidUnconnectedConnectionSource {
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "MethodCanBeStatic"})
|
||||
public void test(AbstractSmackLowLevelIntegrationTest.UnconnectedConnectionSource source) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class JMFInit extends Frame implements Runnable {
|
|||
|
||||
private boolean visible = false;
|
||||
|
||||
@SuppressWarnings("this-escape")
|
||||
@SuppressWarnings({"this-escape", "DoNotCall"})
|
||||
public JMFInit(String[] args, boolean visible) {
|
||||
super("Initializing JMF...");
|
||||
|
||||
|
|
|
@ -76,12 +76,12 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
|||
public static MediaSession createSession(String localhost, int localPort, String remoteHost, int remotePort, MediaSessionListener eventHandler, int quality, boolean secure, boolean micOn) throws NoProcessorException, UnsupportedFormatException, IOException, GeneralSecurityException {
|
||||
|
||||
SpeexFormat.setFramesPerPacket(1);
|
||||
/**
|
||||
/*
|
||||
* The master key. Hardcoded for now.
|
||||
*/
|
||||
byte[] masterKey = new byte[] {(byte) 0xE1, (byte) 0xF9, 0x7A, 0x0D, 0x3E, 0x01, (byte) 0x8B, (byte) 0xE0, (byte) 0xD6, 0x4F, (byte) 0xA3, 0x2C, 0x06, (byte) 0xDE, 0x41, 0x39};
|
||||
|
||||
/**
|
||||
/*
|
||||
* The master salt. Hardcoded for now.
|
||||
*/
|
||||
byte[] masterSalt = new byte[] {0x0E, (byte) 0xC6, 0x75, (byte) 0xAD, 0x49, (byte) 0x8A, (byte) 0xFE, (byte) 0xEB, (byte) 0xB6, (byte) 0x96, 0x0B, 0x3A, (byte) 0xAB, (byte) 0xE6};
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.net.SocketException;
|
|||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -135,7 +136,7 @@ public class STUNResolver extends TransportResolver {
|
|||
* @param stunConfigStream An InputStream with the configuration file.
|
||||
* @return A list of loaded servers
|
||||
*/
|
||||
public ArrayList<STUNService> loadSTUNServers(java.io.InputStream stunConfigStream) {
|
||||
public List<STUNService> loadSTUNServers(java.io.InputStream stunConfigStream) {
|
||||
ArrayList<STUNService> serversList = new ArrayList<>();
|
||||
String serverName;
|
||||
int serverPort;
|
||||
|
@ -211,7 +212,7 @@ public class STUNResolver extends TransportResolver {
|
|||
*
|
||||
* @return a list of services
|
||||
*/
|
||||
public ArrayList<STUNService> loadSTUNServers() {
|
||||
public List<STUNService> loadSTUNServers() {
|
||||
ArrayList<STUNService> serversList = new ArrayList<>();
|
||||
|
||||
// Load the STUN configuration
|
||||
|
@ -248,7 +249,7 @@ public class STUNResolver extends TransportResolver {
|
|||
*
|
||||
* @return the best STUN server that can be used.
|
||||
*/
|
||||
private static STUNService bestSTUNServer(ArrayList<STUNService> listServers) {
|
||||
private static STUNService bestSTUNServer(List<STUNService> listServers) {
|
||||
if (listServers.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
package org.jivesoftware.smackx.jingleold.nat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -661,21 +661,13 @@ public abstract class TransportCandidate {
|
|||
String local = id.substring(0, keySplitIndex) + ";" + localUser;
|
||||
String remote = id.substring(keySplitIndex) + ";" + remoteUser;
|
||||
|
||||
try {
|
||||
if (session.getConnection().getUser().equals(session.getInitiator())) {
|
||||
|
||||
this.send = local.getBytes("UTF-8");
|
||||
this.receive = remote.getBytes("UTF-8");
|
||||
} else {
|
||||
this.receive = local.getBytes("UTF-8");
|
||||
this.send = remote.getBytes("UTF-8");
|
||||
}
|
||||
if (session.getConnection().getUser().equals(session.getInitiator())) {
|
||||
this.send = local.getBytes(StandardCharsets.UTF_8);
|
||||
this.receive = remote.getBytes(StandardCharsets.UTF_8);
|
||||
} else {
|
||||
this.receive = local.getBytes(StandardCharsets.UTF_8);
|
||||
this.send = remote.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
LOGGER.log(Level.WARNING, "exception", e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedVariable")
|
||||
|
@ -706,7 +698,7 @@ public abstract class TransportCandidate {
|
|||
|
||||
long delay = 100 / replyTries;
|
||||
|
||||
String[] str = new String(packet.getData(), "UTF-8").split(";");
|
||||
String[] str = new String(packet.getData(), StandardCharsets.UTF_8).split(";");
|
||||
String pass = str[0];
|
||||
String[] address = str[1].split(":");
|
||||
String ip = address[0];
|
||||
|
@ -714,13 +706,7 @@ public abstract class TransportCandidate {
|
|||
|
||||
if (pass.equals(candidate.getPassword()) && !accept) {
|
||||
|
||||
byte[] cont = null;
|
||||
try {
|
||||
cont = (password + ";" + candidate.getIp() + ":" + candidate.getPort()).getBytes("UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
LOGGER.log(Level.WARNING, "exception", e);
|
||||
}
|
||||
byte[] cont = (password + ";" + candidate.getIp() + ":" + candidate.getPort()).getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
packet.setData(cont);
|
||||
packet.setLength(cont.length);
|
||||
|
@ -778,31 +764,24 @@ public abstract class TransportCandidate {
|
|||
DatagramListener listener = new DatagramListener() {
|
||||
@Override
|
||||
public boolean datagramReceived(DatagramPacket datagramPacket) {
|
||||
LOGGER.fine("ECHO Received to: " + candidate.getIp() + ":" + candidate.getPort() + " data: " + new String(datagramPacket.getData(), StandardCharsets.UTF_8));
|
||||
String[] str = new String(datagramPacket.getData(), StandardCharsets.UTF_8).split(";");
|
||||
String pass = str[0];
|
||||
String[] addr = str[1].split(":");
|
||||
String ip = addr[0];
|
||||
String pt = addr[1];
|
||||
|
||||
try {
|
||||
LOGGER.fine("ECHO Received to: " + candidate.getIp() + ":" + candidate.getPort() + " data: " + new String(datagramPacket.getData(), "UTF-8"));
|
||||
String[] str = new String(datagramPacket.getData(), "UTF-8").split(";");
|
||||
String pass = str[0];
|
||||
String[] addr = str[1].split(":");
|
||||
String ip = addr[0];
|
||||
String pt = addr[1];
|
||||
|
||||
// CHECKSTYLE:OFF
|
||||
if (pass.equals(password)
|
||||
&& transportCandidate.getIp().indexOf(ip) != -1
|
||||
&& transportCandidate.getPort() == Integer.parseInt(pt)) {
|
||||
// CHECKSTYLE:ON
|
||||
LOGGER.fine("ECHO OK: " + candidate.getIp() + ":" + candidate.getPort() + " <-> " + transportCandidate.getIp() + ":" + transportCandidate.getPort());
|
||||
TestResult testResult = new TestResult();
|
||||
testResult.setResult(true);
|
||||
ended = true;
|
||||
fireTestResult(testResult, transportCandidate);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
LOGGER.log(Level.WARNING, "exception", e);
|
||||
// CHECKSTYLE:OFF
|
||||
if (pass.equals(password)
|
||||
&& transportCandidate.getIp().indexOf(ip) != -1
|
||||
&& transportCandidate.getPort() == Integer.parseInt(pt)) {
|
||||
// CHECKSTYLE:ON
|
||||
LOGGER.fine("ECHO OK: " + candidate.getIp() + ":" + candidate.getPort() + " <-> " + transportCandidate.getIp() + ":" + transportCandidate.getPort());
|
||||
TestResult testResult = new TestResult();
|
||||
testResult.setResult(true);
|
||||
ended = true;
|
||||
fireTestResult(testResult, transportCandidate);
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGGER.fine("ECHO Wrong Data: " + datagramPacket.getAddress().getHostAddress() + ":" + datagramPacket.getPort());
|
||||
|
@ -812,13 +791,7 @@ public abstract class TransportCandidate {
|
|||
|
||||
addListener(listener);
|
||||
|
||||
byte[] content = null;
|
||||
try {
|
||||
content = new String(password + ";" + getIp() + ":" + getPort()).getBytes("UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
LOGGER.log(Level.WARNING, "exception", e);
|
||||
}
|
||||
byte[] content = new String(password + ";" + getIp() + ":" + getPort()).getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
DatagramPacket packet = new DatagramPacket(content, content.length);
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
// Sleep for some time, waiting for the candidates checks
|
||||
|
||||
int totalTime = CANDIDATES_ACCEPT_PERIOD + TransportResolver.CHECK_TIMEOUT;
|
||||
int tries = (int) Math.ceil(totalTime / 1000);
|
||||
int tries = (int) Math.ceil(totalTime / 1000.0);
|
||||
|
||||
for (int i = 0; i < tries - 1; i++) {
|
||||
try {
|
||||
|
@ -478,7 +478,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
*
|
||||
* @return The list of valid (ie, already checked) remote candidates.
|
||||
*/
|
||||
final ArrayList<TransportCandidate> getValidRemoteCandidatesList() {
|
||||
final List<TransportCandidate> getValidRemoteCandidatesList() {
|
||||
synchronized (validRemoteCandidates) {
|
||||
return new ArrayList<>(validRemoteCandidates);
|
||||
}
|
||||
|
@ -872,7 +872,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
@Override
|
||||
public TransportCandidate getBestRemoteCandidate() {
|
||||
// Hopefully, we only have one validRemoteCandidate
|
||||
ArrayList<TransportCandidate> cands = getValidRemoteCandidatesList();
|
||||
List<TransportCandidate> cands = getValidRemoteCandidatesList();
|
||||
if (!cands.isEmpty()) {
|
||||
LOGGER.fine("RAW CAND");
|
||||
return cands.get(0);
|
||||
|
@ -930,7 +930,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
|||
public TransportCandidate getBestRemoteCandidate() {
|
||||
ICECandidate result = null;
|
||||
|
||||
ArrayList<TransportCandidate> cands = getValidRemoteCandidatesList();
|
||||
List<TransportCandidate> cands = getValidRemoteCandidatesList();
|
||||
if (!cands.isEmpty()) {
|
||||
int highest = -1;
|
||||
ICECandidate chose = null;
|
||||
|
|
|
@ -210,7 +210,7 @@ public abstract class TransportResolver {
|
|||
*
|
||||
* @return the list of listeners
|
||||
*/
|
||||
public ArrayList<TransportResolverListener> getListenersList() {
|
||||
public List<TransportResolverListener> getListenersList() {
|
||||
synchronized (listeners) {
|
||||
return new ArrayList<>(listeners);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
|||
*
|
||||
* @return a list for the audio payloads in the packet.
|
||||
*/
|
||||
public ArrayList<JinglePayloadType> getJinglePayloadTypesList() {
|
||||
public List<JinglePayloadType> getJinglePayloadTypesList() {
|
||||
synchronized (payloads) {
|
||||
return new ArrayList<>(payloads);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
|||
*
|
||||
* @return a list of PayloadType.Audio
|
||||
*/
|
||||
public ArrayList<PayloadType.Audio> getAudioPayloadTypesList() {
|
||||
public List<PayloadType.Audio> getAudioPayloadTypesList() {
|
||||
ArrayList<PayloadType.Audio> result = new ArrayList<>();
|
||||
Iterator<JinglePayloadType> jinglePtsIter = getJinglePayloadTypes();
|
||||
|
||||
|
|
|
@ -349,15 +349,9 @@ public class AgentSession {
|
|||
new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence);
|
||||
|
||||
presence = collector.nextResultOrThrow();
|
||||
|
||||
// We can safely update this iv since we didn't get any error
|
||||
this.online = online;
|
||||
}
|
||||
// Otherwise the user is going offline...
|
||||
else {
|
||||
// Update this iv now since we don't care at this point of any error
|
||||
this.online = online;
|
||||
|
||||
presence = connection.getStanzaFactory().buildPresenceStanza()
|
||||
.ofType(Presence.Type.unavailable)
|
||||
.to(workgroupJID)
|
||||
|
@ -714,7 +708,7 @@ public class AgentSession {
|
|||
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) {
|
||||
Offer offer = new Offer(this.connection, this, requestPacket.getUserID(),
|
||||
requestPacket.getUserJID(), this.getWorkgroupJID(),
|
||||
new Date(new Date().getTime() + (requestPacket.getTimeout() * 1000)),
|
||||
new Date(new Date().getTime() + (requestPacket.getTimeout() * 1000L)),
|
||||
requestPacket.getSessionID(), requestPacket.getMetaData(), requestPacket.getContent());
|
||||
|
||||
synchronized (offerListeners) {
|
||||
|
|
|
@ -137,7 +137,7 @@ public class Workgroup {
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
/*
|
||||
* Internal handling of an invitation. Receiving an invitation removes the user from the queue.
|
||||
*/
|
||||
MultiUserChatManager.getInstanceFor(connection).addInvitationListener(
|
||||
|
|
|
@ -55,6 +55,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NonApiType")
|
||||
public TreeMap<Integer, PreKeyRecord> generateOmemoPreKeys(int currentPreKeyId, int count) {
|
||||
List<PreKeyRecord> preKeyRecords = KeyHelper.generatePreKeys(currentPreKeyId, count);
|
||||
TreeMap<Integer, PreKeyRecord> map = new TreeMap<>();
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.omemo;
|
|||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
@ -268,8 +269,9 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NonApiType")
|
||||
public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException {
|
||||
TreeMap<Integer, T_PreKey> preKeys = getCache(userDevice).preKeys;
|
||||
Map<Integer, T_PreKey> preKeys = getCache(userDevice).preKeys;
|
||||
|
||||
if (preKeys.isEmpty() && persistent != null) {
|
||||
preKeys.putAll(persistent.loadOmemoPreKeys(userDevice));
|
||||
|
@ -293,8 +295,9 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NonApiType")
|
||||
public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException {
|
||||
TreeMap<Integer, T_SigPreKey> sigPreKeys = getCache(userDevice).signedPreKeys;
|
||||
Map<Integer, T_SigPreKey> sigPreKeys = getCache(userDevice).signedPreKeys;
|
||||
|
||||
if (sigPreKeys.isEmpty() && persistent != null) {
|
||||
sigPreKeys.putAll(persistent.loadOmemoSignedPreKeys(userDevice));
|
||||
|
@ -341,7 +344,7 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
|
|||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException {
|
||||
public Map<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException {
|
||||
HashMap<Integer, T_Sess> sessions = getCache(userDevice).sessions.get(contact);
|
||||
if (sessions == null) {
|
||||
sessions = new HashMap<>();
|
||||
|
|
|
@ -200,6 +200,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NonApiType")
|
||||
public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException {
|
||||
File preKeyDirectory = hierarchy.getPreKeysDirectory(userDevice);
|
||||
TreeMap<Integer, T_PreKey> preKeys = new TreeMap<>();
|
||||
|
@ -240,6 +241,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NonApiType")
|
||||
public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException {
|
||||
File signedPreKeysDirectory = hierarchy.getSignedPreKeysDirectory(userDevice);
|
||||
TreeMap<Integer, T_SigPreKey> signedPreKeys = new TreeMap<>();
|
||||
|
@ -296,6 +298,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NonApiType")
|
||||
public HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException {
|
||||
File contactsDirectory = hierarchy.getContactsDir(userDevice, contact);
|
||||
HashMap<Integer, T_Sess> sessions = new HashMap<>();
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
@ -633,7 +634,7 @@ public final class OmemoManager extends Manager {
|
|||
* @throws SmackException.NoResponseException if there was no response from the remote entity.
|
||||
* @throws IOException if an I/O error occurred.
|
||||
*/
|
||||
public synchronized HashMap<OmemoDevice, OmemoFingerprint> getActiveFingerprints(BareJid contact)
|
||||
public synchronized Map<OmemoDevice, OmemoFingerprint> getActiveFingerprints(BareJid contact)
|
||||
throws SmackException.NotLoggedInException, CorruptedOmemoKeyException,
|
||||
CannotEstablishOmemoSessionException, SmackException.NotConnectedException, InterruptedException,
|
||||
SmackException.NoResponseException, IOException {
|
||||
|
@ -641,7 +642,7 @@ public final class OmemoManager extends Manager {
|
|||
throw new SmackException.NotLoggedInException();
|
||||
}
|
||||
|
||||
HashMap<OmemoDevice, OmemoFingerprint> fingerprints = new HashMap<>();
|
||||
Map<OmemoDevice, OmemoFingerprint> fingerprints = new HashMap<>();
|
||||
OmemoCachedDeviceList deviceList = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(),
|
||||
contact);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.jivesoftware.smackx.omemo.util.OmemoConstants.OMEMO_NAMESPACE_
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
@ -78,7 +79,7 @@ public class OmemoMessage {
|
|||
*/
|
||||
public static class Sent extends OmemoMessage {
|
||||
private final Set<OmemoDevice> intendedDevices = new HashSet<>();
|
||||
private final HashMap<OmemoDevice, Throwable> skippedDevices = new HashMap<>();
|
||||
private final Map<OmemoDevice, Throwable> skippedDevices = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Create a new outgoing OMEMO message.
|
||||
|
@ -90,7 +91,7 @@ public class OmemoMessage {
|
|||
* @param skippedDevices devices which were skipped during encryption process because encryption
|
||||
* failed for some reason
|
||||
*/
|
||||
Sent(OmemoElement element, byte[] key, byte[] iv, Set<OmemoDevice> intendedDevices, HashMap<OmemoDevice, Throwable> skippedDevices) {
|
||||
Sent(OmemoElement element, byte[] key, byte[] iv, Set<OmemoDevice> intendedDevices, Map<OmemoDevice, Throwable> skippedDevices) {
|
||||
super(element, key, iv);
|
||||
this.intendedDevices.addAll(intendedDevices);
|
||||
this.skippedDevices.putAll(skippedDevices);
|
||||
|
@ -110,7 +111,7 @@ public class OmemoMessage {
|
|||
*
|
||||
* @return map of skipped recipients and reasons for that.
|
||||
*/
|
||||
public HashMap<OmemoDevice, Throwable> getSkippedDevices() {
|
||||
public Map<OmemoDevice, Throwable> getSkippedDevices() {
|
||||
return skippedDevices;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
@ -794,7 +795,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
}
|
||||
|
||||
// Select random Bundle
|
||||
HashMap<Integer, T_Bundle> bundlesList = getOmemoStoreBackend().keyUtil().BUNDLE.bundles(bundleElement, contactsDevice);
|
||||
Map<Integer, T_Bundle> bundlesList = getOmemoStoreBackend().keyUtil().BUNDLE.bundles(bundleElement, contactsDevice);
|
||||
int randomIndex = new Random().nextInt(bundlesList.size());
|
||||
T_Bundle randomPreKeyBundle = new ArrayList<>(bundlesList.values()).get(randomIndex);
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import static org.jivesoftware.smackx.omemo.util.OmemoConstants.PRE_KEY_COUNT_PE
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
|
@ -229,7 +228,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
storeOmemoIdentityKeyPair(userDevice, identityKeyPair);
|
||||
}
|
||||
|
||||
TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
|
||||
Map<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
|
||||
if (signedPreKeys.size() == 0) {
|
||||
changeSignedPreKey(userDevice);
|
||||
}
|
||||
|
@ -239,7 +238,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
int startId = preKeys.size() == 0 ? 0 : preKeys.lastKey();
|
||||
|
||||
if (newKeysCount > 0) {
|
||||
TreeMap<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount);
|
||||
Map<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount);
|
||||
storeOmemoPreKeys(userDevice, newKeys);
|
||||
}
|
||||
}
|
||||
|
@ -417,6 +416,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
* @param count how many keys do we want to generate
|
||||
* @return Map of new preKeys
|
||||
*/
|
||||
@SuppressWarnings("NonApiType")
|
||||
public TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count) {
|
||||
return keyUtil().generateOmemoPreKeys(startId, count);
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
*
|
||||
* @throws IOException if an I/O error occurred.
|
||||
*/
|
||||
public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) throws IOException {
|
||||
public void storeOmemoPreKeys(OmemoDevice userDevice, Map<Integer, T_PreKey> preKeyHashMap) throws IOException {
|
||||
for (Map.Entry<Integer, T_PreKey> entry : preKeyHashMap.entrySet()) {
|
||||
storeOmemoPreKey(userDevice, entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
@ -474,6 +474,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
*
|
||||
* @throws IOException if an I/O error occurred.
|
||||
*/
|
||||
@SuppressWarnings("NonApiType")
|
||||
public abstract TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException;
|
||||
|
||||
/**
|
||||
|
@ -499,6 +500,8 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
*
|
||||
* @throws IOException if an I/O error occurred.
|
||||
*/
|
||||
// TreeMap seems to be required for this function.
|
||||
@SuppressWarnings("NonApiType")
|
||||
public abstract TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException;
|
||||
|
||||
/**
|
||||
|
@ -554,7 +557,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
*
|
||||
* @throws IOException if an I/O error occurred.
|
||||
*/
|
||||
public abstract HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException;
|
||||
public abstract Map<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException;
|
||||
|
||||
/**
|
||||
* Store a crypto-lib specific session to storage.
|
||||
|
|
|
@ -47,8 +47,8 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
private byte[] signedPreKeySignature;
|
||||
private final String identityKeyB64;
|
||||
private byte[] identityKey;
|
||||
private final HashMap<Integer, String> preKeysB64;
|
||||
private HashMap<Integer, byte[]> preKeys;
|
||||
private final Map<Integer, String> preKeysB64;
|
||||
private Map<Integer, byte[]> preKeys;
|
||||
|
||||
/**
|
||||
* Constructor to create a Bundle Element from base64 Strings.
|
||||
|
@ -57,9 +57,9 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
* @param signedPreKeyB64 base64 encoded signedPreKey
|
||||
* @param signedPreKeySigB64 base64 encoded signedPreKeySignature
|
||||
* @param identityKeyB64 base64 encoded identityKey
|
||||
* @param preKeysB64 HashMap of base64 encoded preKeys
|
||||
* @param preKeysB64 Map of base64 encoded preKeys
|
||||
*/
|
||||
public OmemoBundleElement(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, HashMap<Integer, String> preKeysB64) {
|
||||
public OmemoBundleElement(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, Map<Integer, String> preKeysB64) {
|
||||
if (signedPreKeyId < 0) {
|
||||
throw new IllegalArgumentException("signedPreKeyId MUST be greater than or equal to 0.");
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
* @param signedPreKey signedPreKey
|
||||
* @param signedPreKeySig signedPreKeySignature
|
||||
* @param identityKey identityKey
|
||||
* @param preKeys HashMap of preKeys
|
||||
* @param preKeys Map of preKeys
|
||||
*/
|
||||
public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) {
|
||||
public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, Map<Integer, byte[]> preKeys) {
|
||||
this(signedPreKeyId,
|
||||
signedPreKey != null ? Base64.encodeToString(signedPreKey) : null,
|
||||
signedPreKeySig != null ? Base64.encodeToString(signedPreKeySig) : null,
|
||||
|
@ -95,12 +95,12 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
this.preKeys = preKeys;
|
||||
}
|
||||
|
||||
private static HashMap<Integer, String> base64EncodePreKeys(HashMap<Integer, byte[]> preKeys) {
|
||||
private static Map<Integer, String> base64EncodePreKeys(Map<Integer, byte[]> preKeys) {
|
||||
if (preKeys == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
HashMap<Integer, String> converted = new HashMap<>();
|
||||
Map<Integer, String> converted = new HashMap<>();
|
||||
for (Integer id : preKeys.keySet()) {
|
||||
converted.put(id, Base64.encodeToString(preKeys.get(id)));
|
||||
}
|
||||
|
@ -155,12 +155,12 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the HashMap of preKeys in the bundle.
|
||||
* Return the Map of preKeys in the bundle.
|
||||
* The map uses the preKeys ids as key and the preKeys as value.
|
||||
*
|
||||
* @return preKeys Pre-Keys contained in the bundle
|
||||
*/
|
||||
public HashMap<Integer, byte[]> getPreKeys() {
|
||||
public Map<Integer, byte[]> getPreKeys() {
|
||||
if (preKeys == null) {
|
||||
preKeys = new HashMap<>();
|
||||
for (int id : preKeysB64.keySet()) {
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.omemo.element;
|
|||
|
||||
import static org.jivesoftware.smackx.omemo.util.OmemoConstants.OMEMO_NAMESPACE_V_AXOLOTL;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* OMEMO device bundle as described by the protocol.
|
||||
|
@ -29,11 +29,11 @@ import java.util.HashMap;
|
|||
*/
|
||||
public class OmemoBundleElement_VAxolotl extends OmemoBundleElement {
|
||||
|
||||
public OmemoBundleElement_VAxolotl(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, HashMap<Integer, String> preKeysB64) {
|
||||
public OmemoBundleElement_VAxolotl(int signedPreKeyId, String signedPreKeyB64, String signedPreKeySigB64, String identityKeyB64, Map<Integer, String> preKeysB64) {
|
||||
super(signedPreKeyId, signedPreKeyB64, signedPreKeySigB64, identityKeyB64, preKeysB64);
|
||||
}
|
||||
|
||||
public OmemoBundleElement_VAxolotl(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) {
|
||||
public OmemoBundleElement_VAxolotl(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, Map<Integer, byte[]> preKeys) {
|
||||
super(signedPreKeyId, signedPreKey, signedPreKeySig, identityKey, preKeys);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public abstract class OmemoHeaderElement implements XmlElement {
|
|||
return sid;
|
||||
}
|
||||
|
||||
public ArrayList<OmemoKeyElement> getKeys() {
|
||||
public List<OmemoKeyElement> getKeys() {
|
||||
return new ArrayList<>(keys);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.omemo.exceptions;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
|
||||
|
@ -32,8 +33,8 @@ import org.jxmpp.jid.BareJid;
|
|||
public class CannotEstablishOmemoSessionException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 3165844730283295249L;
|
||||
private final HashMap<BareJid, HashMap<OmemoDevice, Throwable>> failures = new HashMap<>();
|
||||
private final HashMap<BareJid, ArrayList<OmemoDevice>> successes = new HashMap<>();
|
||||
private final Map<BareJid, Map<OmemoDevice, Throwable>> failures = new HashMap<>();
|
||||
private final Map<BareJid, List<OmemoDevice>> successes = new HashMap<>();
|
||||
|
||||
public CannotEstablishOmemoSessionException(OmemoDevice failed, Throwable reason) {
|
||||
super();
|
||||
|
@ -41,7 +42,7 @@ public class CannotEstablishOmemoSessionException extends Exception {
|
|||
}
|
||||
|
||||
public void addFailures(CannotEstablishOmemoSessionException otherFailures) {
|
||||
for (Map.Entry<BareJid, HashMap<OmemoDevice, Throwable>> entry : otherFailures.getFailures().entrySet()) {
|
||||
for (Map.Entry<BareJid, Map<OmemoDevice, Throwable>> entry : otherFailures.getFailures().entrySet()) {
|
||||
getFailsOfContact(entry.getKey()).putAll(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -50,16 +51,16 @@ public class CannotEstablishOmemoSessionException extends Exception {
|
|||
getSuccessesOfContact(success.getJid()).add(success);
|
||||
}
|
||||
|
||||
public HashMap<BareJid, HashMap<OmemoDevice, Throwable>> getFailures() {
|
||||
public Map<BareJid, Map<OmemoDevice, Throwable>> getFailures() {
|
||||
return failures;
|
||||
}
|
||||
|
||||
public HashMap<BareJid, ArrayList<OmemoDevice>> getSuccesses() {
|
||||
public Map<BareJid, List<OmemoDevice>> getSuccesses() {
|
||||
return successes;
|
||||
}
|
||||
|
||||
private HashMap<OmemoDevice, Throwable> getFailsOfContact(BareJid contact) {
|
||||
HashMap<OmemoDevice, Throwable> h = failures.get(contact);
|
||||
private Map<OmemoDevice, Throwable> getFailsOfContact(BareJid contact) {
|
||||
Map<OmemoDevice, Throwable> h = failures.get(contact);
|
||||
if (h == null) {
|
||||
h = new HashMap<>();
|
||||
failures.put(contact, h);
|
||||
|
@ -67,8 +68,8 @@ public class CannotEstablishOmemoSessionException extends Exception {
|
|||
return h;
|
||||
}
|
||||
|
||||
private ArrayList<OmemoDevice> getSuccessesOfContact(BareJid contact) {
|
||||
ArrayList<OmemoDevice> suc = successes.get(contact);
|
||||
private List<OmemoDevice> getSuccessesOfContact(BareJid contact) {
|
||||
List<OmemoDevice> suc = successes.get(contact);
|
||||
if (suc == null) {
|
||||
suc = new ArrayList<>();
|
||||
successes.put(contact, suc);
|
||||
|
@ -83,8 +84,8 @@ public class CannotEstablishOmemoSessionException extends Exception {
|
|||
* @return true if the exception requires to be thrown
|
||||
*/
|
||||
public boolean requiresThrowing() {
|
||||
for (Map.Entry<BareJid, HashMap<OmemoDevice, Throwable>> entry : failures.entrySet()) {
|
||||
ArrayList<OmemoDevice> suc = successes.get(entry.getKey());
|
||||
for (Map.Entry<BareJid, Map<OmemoDevice, Throwable>> entry : failures.entrySet()) {
|
||||
List<OmemoDevice> suc = successes.get(entry.getKey());
|
||||
if (suc == null || suc.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -119,8 +119,8 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
*
|
||||
* @throws CorruptedOmemoKeyException when one of the keys cannot be parsed
|
||||
*/
|
||||
public HashMap<Integer, T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException {
|
||||
HashMap<Integer, T_Bundle> bundles = new HashMap<>();
|
||||
public Map<Integer, T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException {
|
||||
Map<Integer, T_Bundle> bundles = new HashMap<>();
|
||||
for (int deviceId : bundle.getPreKeys().keySet()) {
|
||||
try {
|
||||
bundles.put(deviceId, bundleFromOmemoBundle(bundle, contact, deviceId));
|
||||
|
@ -211,6 +211,8 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param count how many keys do we want to generate
|
||||
* @return Map of new preKeys
|
||||
*/
|
||||
// We use TreeMap.lastKey()
|
||||
@SuppressWarnings("NonApiType")
|
||||
public abstract TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count);
|
||||
|
||||
/**
|
||||
|
@ -338,8 +340,8 @@ public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
|||
* @param preKeyHashMap HashMap of preKeys
|
||||
* @return HashMap of byte arrays but with the same keyIds as key
|
||||
*/
|
||||
public HashMap<Integer, byte[]> preKeyPublicKeysForBundle(TreeMap<Integer, T_PreKey> preKeyHashMap) {
|
||||
HashMap<Integer, byte[]> out = new HashMap<>();
|
||||
public Map<Integer, byte[]> preKeyPublicKeysForBundle(Map<Integer, T_PreKey> preKeyHashMap) {
|
||||
Map<Integer, byte[]> out = new HashMap<>();
|
||||
for (Map.Entry<Integer, T_PreKey> e : preKeyHashMap.entrySet()) {
|
||||
out.put(e.getKey(), preKeyForBundle(e.getValue()));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27,8 +27,8 @@ import static junit.framework.TestCase.assertTrue;
|
|||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
|
||||
|
@ -174,7 +174,7 @@ public abstract class OmemoStoreTest<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey
|
|||
public void storeLoadRemoveOmemoPreKeys()
|
||||
throws IOException, InterruptedException {
|
||||
|
||||
TreeMap<Integer, T_PreKey> before = store.generateOmemoPreKeys(1, 10);
|
||||
Map<Integer, T_PreKey> before = store.generateOmemoPreKeys(1, 10);
|
||||
assertEquals("The store must have no prekeys before this test.", 0, store.loadOmemoPreKeys(alice).size());
|
||||
|
||||
store.storeOmemoPreKeys(alice, before);
|
||||
|
@ -305,7 +305,7 @@ public abstract class OmemoStoreTest<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey
|
|||
|
||||
@Test
|
||||
public void loadAllRawSessionsReturnsEmptyMapTest() throws IOException {
|
||||
HashMap<Integer, T_Sess> sessions = store.loadAllRawSessionsOf(alice, bob.getJid());
|
||||
Map<Integer, T_Sess> sessions = store.loadAllRawSessionsOf(alice, bob.getJid());
|
||||
assertNotNull(sessions);
|
||||
assertEquals(0, sessions.size());
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class PublicKeysListElement implements ExtensionElement {
|
|||
|
||||
private final Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata;
|
||||
|
||||
private PublicKeysListElement(TreeMap<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata) {
|
||||
private PublicKeysListElement(Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata) {
|
||||
this.metadata = Collections.unmodifiableMap(Objects.requireNonNull(metadata));
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ public final class PublicKeysListElement implements ExtensionElement {
|
|||
return new Builder();
|
||||
}
|
||||
|
||||
public TreeMap<OpenPgpV4Fingerprint, PubkeyMetadataElement> getMetadata() {
|
||||
@SuppressWarnings("NonApiType")
|
||||
public Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> getMetadata() {
|
||||
return new TreeMap<>(metadata);
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@ public final class PublicKeysListElement implements ExtensionElement {
|
|||
|
||||
public static final class Builder {
|
||||
|
||||
private final TreeMap<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata = new TreeMap<>();
|
||||
private final Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata = new TreeMap<>();
|
||||
|
||||
private Builder() {
|
||||
// Empty
|
||||
|
|
|
@ -84,6 +84,7 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("BanJNDI")
|
||||
protected List<SRV> lookupSrvRecords0(DnsName name, List<RemoteConnectionEndpointLookupFailure> lookupFailures,
|
||||
DnssecMode dnssecMode) {
|
||||
Attribute srvAttribute;
|
||||
|
|
|
@ -1256,8 +1256,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
final boolean smResumptionPossible = isSmResumptionPossible();
|
||||
// Don't throw a NotConnectedException is there is an resumable stream available
|
||||
if (!smResumptionPossible) {
|
||||
throw new NotConnectedException(XMPPTCPConnection.this, "done=" + done
|
||||
+ " smResumptionPossible=" + smResumptionPossible);
|
||||
throw new NotConnectedException(XMPPTCPConnection.this, "done=true smResumptionPossible=false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2019-2020 Florian Schmaus
|
||||
* Copyright 2019-2024 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -65,6 +65,8 @@ public class XmppTcpTransportModuleDescriptor extends ModularXmppClientToServerC
|
|||
|
||||
public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder {
|
||||
|
||||
// Invoked via reflection.
|
||||
@SuppressWarnings("UnusedMethod")
|
||||
private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) {
|
||||
super(connectionConfigurationBuilder);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue