1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-24 04:52:05 +01:00

[build] Bump error prone from 2.9.0 to 2.32.0

This commit is contained in:
Florian Schmaus 2024-09-25 21:32:17 +02:00
parent 07d9d694da
commit beacb5eb8e
69 changed files with 265 additions and 255 deletions

View file

@ -142,8 +142,7 @@ dependencies {
testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2' testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
errorprone 'com.google.errorprone:error_prone_core:2.9.0' errorprone 'com.google.errorprone:error_prone_core:2.32.0'
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
} }
test { test {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2021 Florian Schmaus * Copyright © 2014-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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() { private static final BroadcastReceiver ALARM_BROADCAST_RECEIVER = new BroadcastReceiver() {
@Override @Override
@SuppressWarnings("LockOnNonEnclosingClassLiteral")
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
LOGGER.fine("Ping Alarm broadcast received"); LOGGER.fine("Ping Alarm broadcast received");
Set<Map.Entry<XMPPConnection, ServerPingWithAlarmManager>> managers; Set<Map.Entry<XMPPConnection, ServerPingWithAlarmManager>> managers;

View file

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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()); private static final Logger LOGGER = Logger.getLogger(SmackInitialization.class.getName());
/** /*
* Loads the configuration from the smack-config.xml and system properties file. * Loads the configuration from the smack-config.xml and system properties file.
* <p> * <p>
* So far this means that: * So far this means that:

View file

@ -667,7 +667,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class DisconnectedState extends State { private final class DisconnectedState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private DisconnectedState(StateDescriptor stateDescriptor, private DisconnectedState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -708,6 +709,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
private final class LookupRemoteConnectionEndpointsState extends State { private final class LookupRemoteConnectionEndpointsState extends State {
boolean outgoingElementsQueueWasShutdown; boolean outgoingElementsQueueWasShutdown;
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private LookupRemoteConnectionEndpointsState(StateDescriptor stateDescriptor, private LookupRemoteConnectionEndpointsState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -818,6 +821,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class ConnectedButUnauthenticatedState extends State { private final class ConnectedButUnauthenticatedState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private ConnectedButUnauthenticatedState(StateDescriptor stateDescriptor, private ConnectedButUnauthenticatedState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -850,6 +855,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class SaslAuthenticationState extends State { private final class SaslAuthenticationState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private SaslAuthenticationState(StateDescriptor stateDescriptor, private SaslAuthenticationState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -893,6 +900,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
public static final class ResourceBindingStateDescriptor extends StateDescriptor { public static final class ResourceBindingStateDescriptor extends StateDescriptor {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private ResourceBindingStateDescriptor() { private ResourceBindingStateDescriptor() {
super(ResourceBindingState.class, "RFC 6120 § 7"); super(ResourceBindingState.class, "RFC 6120 § 7");
addSuccessor(AuthenticatedAndResourceBoundStateDescriptor.class); addSuccessor(AuthenticatedAndResourceBoundStateDescriptor.class);
@ -900,6 +909,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class ResourceBindingState extends State { private final class ResourceBindingState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private ResourceBindingState(StateDescriptor stateDescriptor, private ResourceBindingState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -955,6 +966,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class AuthenticatedAndResourceBoundState extends State { private final class AuthenticatedAndResourceBoundState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private AuthenticatedAndResourceBoundState(StateDescriptor stateDescriptor, private AuthenticatedAndResourceBoundState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -995,6 +1008,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class ShutdownState extends State { private final class ShutdownState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private ShutdownState(StateDescriptor stateDescriptor, private ShutdownState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);
@ -1057,6 +1072,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private static final class InstantShutdownState extends NoOpState { private static final class InstantShutdownState extends NoOpState {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private InstantShutdownState(ModularXmppClientToServerConnection connection, StateDescriptor stateDescriptor, private InstantShutdownState(ModularXmppClientToServerConnection connection, StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(connection, stateDescriptor, connectionInternal); super(connection, stateDescriptor, connectionInternal);
@ -1078,6 +1095,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
} }
private final class CloseConnectionState extends State { private final class CloseConnectionState extends State {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private CloseConnectionState(StateDescriptor stateDescriptor, private CloseConnectionState(StateDescriptor stateDescriptor,
ModularXmppClientToServerConnectionInternal connectionInternal) { ModularXmppClientToServerConnectionInternal connectionInternal) {
super(stateDescriptor, connectionInternal); super(stateDescriptor, connectionInternal);

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2018-2020 Florian Schmaus * Copyright 2018-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 { public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) { private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) {
super(connectionConfigurationBuilder); super(connectionConfigurationBuilder);
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2018-2021 Florian Schmaus * Copyright 2018-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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) { PrintWriter dotOut, boolean breakStateName) {
dotOut.append("digraph {\n"); dotOut.append("digraph {\n");
dfs(vertexes, dfs(vertexes,

View file

@ -41,6 +41,8 @@ public class InstantStreamResumptionModuleDescriptor extends ModularXmppClientTo
public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder { public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder {
// Unfinished implementation.
@SuppressWarnings("UnusedMethod")
private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) { private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) {
super(connectionConfigurationBuilder); super(connectionConfigurationBuilder);
} }

View file

@ -23,6 +23,7 @@ import java.io.StringReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -58,7 +59,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
proxyLine = "\r\nProxy-Authorization: Basic " + Base64.encode(username + ":" + password); proxyLine = "\r\nProxy-Authorization: Basic " + Base64.encode(username + ":" + password);
} }
socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: " 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(); InputStream in = socket.getInputStream();
StringBuilder got = new StringBuilder(100); StringBuilder got = new StringBuilder(100);

View file

@ -55,6 +55,7 @@ public class CollectionUtil {
boolean test(T t); boolean test(T t);
} }
@SuppressWarnings("NonApiType")
public static <T> ArrayList<T> newListWith(Collection<? extends T> collection) { public static <T> ArrayList<T> newListWith(Collection<? extends T> collection) {
if (collection == null) { if (collection == null) {
return null; return null;

View file

@ -26,12 +26,12 @@ public final class Pair<F, S> {
this.second = second; 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); return new Pair<>(first, second);
} }
@SuppressWarnings("ReturnValueIgnored") @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<F, S> pair = new Pair<>(first, second);
pair.hashCode(); pair.hashCode();
return pair; return pair;

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2019 Florian Schmaus. * Copyright 2019-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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); private static final LruCache<Class<? extends Provider>, Void> INSERTED_PROVIDERS_CACHE = new LruCache<>(8);
@SuppressWarnings("LockOnNonEnclosingClassLiteral")
public static void ensureProviderAtFirstPosition(Class<? extends Provider> providerClass) { public static void ensureProviderAtFirstPosition(Class<? extends Provider> providerClass) {
if (INSERTED_PROVIDERS_CACHE.containsKey(providerClass)) { if (INSERTED_PROVIDERS_CACHE.containsKey(providerClass)) {
return; return;
@ -41,7 +42,7 @@ public class SecurityUtil {
String providerName = provider.getName(); String providerName = provider.getName();
int installedPosition ; int installedPosition;
synchronized (Security.class) { synchronized (Security.class) {
Security.removeProvider(providerName); Security.removeProvider(providerName);
installedPosition = Security.insertProviderAt(provider, 1); installedPosition = Security.insertProviderAt(provider, 1);

View file

@ -464,7 +464,7 @@ public class StringUtils {
appendTo(collection, ", ", sb); 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) { Consumer<O> appendFunction) {
appendTo(collection, ", ", sb, appendFunction); appendTo(collection, ", ", sb, appendFunction);
} }
@ -473,7 +473,7 @@ public class StringUtils {
appendTo(collection, delimiter, sb, o -> sb.append(o)); 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) { Consumer<O> appendFunction) {
for (Iterator<O> it = collection.iterator(); it.hasNext();) { for (Iterator<O> it = collection.iterator(); it.hasNext();) {
O cs = it.next(); O cs = it.next();

View file

@ -185,7 +185,7 @@ public class OmemoClient {
BareJid contact = JidCreate.bareFrom(com[1]); BareJid contact = JidCreate.bareFrom(com[1]);
HashMap<OmemoDevice, OmemoFingerprint> devices; Map<OmemoDevice, OmemoFingerprint> devices;
try { try {
devices = omemoManager.getActiveFingerprints(contact); devices = omemoManager.getActiveFingerprints(contact);
} catch (CorruptedOmemoKeyException | CannotEstablishOmemoSessionException | SmackException.NoResponseException e) { } catch (CorruptedOmemoKeyException | CannotEstablishOmemoSessionException | SmackException.NoResponseException e) {

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.muclight; package org.jivesoftware.smackx.muclight;
import java.util.HashMap; import java.util.Map;
/** /**
* MUC Light room configuration class. * MUC Light room configuration class.
@ -28,7 +28,7 @@ public class MUCLightRoomConfiguration {
private final String roomName; private final String roomName;
private final String subject; private final String subject;
private final HashMap<String, String> customConfigs; private final Map<String, String> customConfigs;
/** /**
* MUC Light room configuration model constructor. * MUC Light room configuration model constructor.
@ -37,7 +37,7 @@ public class MUCLightRoomConfiguration {
* @param subject TODO javadoc me please * @param subject TODO javadoc me please
* @param customConfigs 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.roomName = roomName;
this.subject = subject; this.subject = subject;
this.customConfigs = customConfigs; this.customConfigs = customConfigs;
@ -66,7 +66,7 @@ public class MUCLightRoomConfiguration {
* *
* @return the custom configurations of the room. * @return the custom configurations of the room.
*/ */
public HashMap<String, String> getCustomConfigs() { public Map<String, String> getCustomConfigs() {
return customConfigs; return customConfigs;
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.muclight; package org.jivesoftware.smackx.muclight;
import java.util.HashMap; import java.util.Map;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
@ -30,7 +30,7 @@ public class MUCLightRoomInfo {
private final String version; private final String version;
private final Jid room; private final Jid room;
private final MUCLightRoomConfiguration configuration; private final MUCLightRoomConfiguration configuration;
private final HashMap<Jid, MUCLightAffiliation> occupants; private final Map<Jid, MUCLightAffiliation> occupants;
/** /**
* MUC Light room info model constructor. * MUC Light room info model constructor.
@ -41,7 +41,7 @@ public class MUCLightRoomInfo {
* @param occupants TODO javadoc me please * @param occupants TODO javadoc me please
*/ */
public MUCLightRoomInfo(String version, Jid roomJid, MUCLightRoomConfiguration configuration, public MUCLightRoomInfo(String version, Jid roomJid, MUCLightRoomConfiguration configuration,
HashMap<Jid, MUCLightAffiliation> occupants) { Map<Jid, MUCLightAffiliation> occupants) {
this.version = version; this.version = version;
this.room = roomJid; this.room = roomJid;
this.configuration = configuration; this.configuration = configuration;
@ -80,7 +80,7 @@ public class MUCLightRoomInfo {
* *
* @return the occupants of the room. * @return the occupants of the room.
*/ */
public HashMap<Jid, MUCLightAffiliation> getOccupants() { public Map<Jid, MUCLightAffiliation> getOccupants() {
return occupants; return occupants;
} }

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
@ -279,7 +280,7 @@ public class MultiUserChatLight {
* @param occupants TODO javadoc me please * @param occupants TODO javadoc me please
* @throws Exception 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 { throws Exception {
MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants); MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants);
@ -313,7 +314,7 @@ public class MultiUserChatLight {
* @throws XMPPErrorException if there was an XMPP error returned. * @throws XMPPErrorException if there was an XMPP error returned.
*/ */
public void leave() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException { 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); affiliations.put(connection.getUser(), MUCLightAffiliation.none);
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations); MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
@ -402,7 +403,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected. * @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @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 { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version); MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version);
@ -421,7 +422,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected. * @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @throws InterruptedException if the calling thread was interrupted.
*/ */
public HashMap<Jid, MUCLightAffiliation> getAffiliations() public Map<Jid, MUCLightAffiliation> getAffiliations()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliations(null); return getAffiliations(null);
} }
@ -435,7 +436,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected. * @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @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 { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations); MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
connection.sendIqRequestAndWaitForResponse(changeAffiliationsIQ); connection.sendIqRequestAndWaitForResponse(changeAffiliationsIQ);
@ -498,7 +499,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected. * @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @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 { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
setRoomConfigs(null, customConfigs); setRoomConfigs(null, customConfigs);
} }
@ -513,7 +514,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected. * @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @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 { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, customConfigs); MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, customConfigs);
connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ); connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ);

View file

@ -274,7 +274,7 @@ public final class MultiUserChatLightManager extends Manager {
sendBlockRooms(mucLightService, rooms); 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 { throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null); MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(IQ.Type.set); mucLightBlockingIQ.setType(IQ.Type.set);
@ -318,7 +318,7 @@ public final class MultiUserChatLightManager extends Manager {
sendBlockUsers(mucLightService, users); 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 { throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users); MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(IQ.Type.set); mucLightBlockingIQ.setType(IQ.Type.set);
@ -362,7 +362,7 @@ public final class MultiUserChatLightManager extends Manager {
sendUnblockRooms(mucLightService, rooms); 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 { throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null); MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(IQ.Type.set); mucLightBlockingIQ.setType(IQ.Type.set);
@ -406,7 +406,7 @@ public final class MultiUserChatLightManager extends Manager {
sendUnblockUsers(mucLightService, users); 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 { throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users); MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(IQ.Type.set); mucLightBlockingIQ.setType(IQ.Type.set);

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.muclight.element; package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -40,7 +39,7 @@ public class MUCLightAffiliationsIQ extends IQ {
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS; public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
private final String version; private final String version;
private HashMap<Jid, MUCLightAffiliation> affiliations; private Map<Jid, MUCLightAffiliation> affiliations;
/** /**
* MUC Light affiliations response IQ constructor. * MUC Light affiliations response IQ constructor.
@ -49,7 +48,7 @@ public class MUCLightAffiliationsIQ extends IQ {
* @param affiliations TODO javadoc me please * @param affiliations TODO javadoc me please
*/ */
@SuppressWarnings("this-escape") @SuppressWarnings("this-escape")
public MUCLightAffiliationsIQ(String version, HashMap<Jid, MUCLightAffiliation> affiliations) { public MUCLightAffiliationsIQ(String version, Map<Jid, MUCLightAffiliation> affiliations) {
super(ELEMENT, NAMESPACE); super(ELEMENT, NAMESPACE);
this.version = version; this.version = version;
this.affiliations = affiliations; this.affiliations = affiliations;
@ -83,7 +82,7 @@ public class MUCLightAffiliationsIQ extends IQ {
* *
* @return the affiliations of the room * @return the affiliations of the room
*/ */
public HashMap<Jid, MUCLightAffiliation> getAffiliations() { public Map<Jid, MUCLightAffiliation> getAffiliations() {
return affiliations; return affiliations;
} }

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.muclight.element; package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -38,8 +37,8 @@ public class MUCLightBlockingIQ extends IQ {
public static final String ELEMENT = QUERY_ELEMENT; public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.BLOCKING; public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.BLOCKING;
private final HashMap<Jid, Boolean> rooms; private final Map<Jid, Boolean> rooms;
private final HashMap<Jid, Boolean> users; private final Map<Jid, Boolean> users;
/** /**
* MUC Light blocking IQ constructor. * MUC Light blocking IQ constructor.
@ -47,7 +46,7 @@ public class MUCLightBlockingIQ extends IQ {
* @param rooms TODO javadoc me please * @param rooms TODO javadoc me please
* @param users 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); super(ELEMENT, NAMESPACE);
this.rooms = rooms; this.rooms = rooms;
this.users = users; this.users = users;
@ -58,7 +57,7 @@ public class MUCLightBlockingIQ extends IQ {
* *
* @return the rooms JIDs with booleans (true if allow, false if deny) * @return the rooms JIDs with booleans (true if allow, false if deny)
*/ */
public HashMap<Jid, Boolean> getRooms() { public Map<Jid, Boolean> getRooms() {
return rooms; return rooms;
} }
@ -67,7 +66,7 @@ public class MUCLightBlockingIQ extends IQ {
* *
* @return the users JIDs with booleans (true if allow, false if deny) * @return the users JIDs with booleans (true if allow, false if deny)
*/ */
public HashMap<Jid, Boolean> getUsers() { public Map<Jid, Boolean> getUsers() {
return users; return users;
} }
@ -86,7 +85,7 @@ public class MUCLightBlockingIQ extends IQ {
return xml; 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(); Iterator<Map.Entry<Jid, Boolean>> it = map.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry<Jid, Boolean> pair = it.next(); Map.Entry<Jid, Boolean> pair = it.next();

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.muclight.element; package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -39,7 +38,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
public static final String ELEMENT = QUERY_ELEMENT; public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS; public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
private HashMap<Jid, MUCLightAffiliation> affiliations; private Map<Jid, MUCLightAffiliation> affiliations;
/** /**
* MUCLight change affiliations IQ constructor. * MUCLight change affiliations IQ constructor.
@ -48,7 +47,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
* @param affiliations TODO javadoc me please * @param affiliations TODO javadoc me please
*/ */
@SuppressWarnings("this-escape") @SuppressWarnings("this-escape")
public MUCLightChangeAffiliationsIQ(Jid room, HashMap<Jid, MUCLightAffiliation> affiliations) { public MUCLightChangeAffiliationsIQ(Jid room, Map<Jid, MUCLightAffiliation> affiliations) {
super(ELEMENT, NAMESPACE); super(ELEMENT, NAMESPACE);
this.setType(Type.set); this.setType(Type.set);
this.setTo(room); this.setTo(room);
@ -60,7 +59,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
* *
* @return the affiliations * @return the affiliations
*/ */
public HashMap<Jid, MUCLightAffiliation> getAffiliations() { public Map<Jid, MUCLightAffiliation> getAffiliations() {
return affiliations; return affiliations;
} }

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
@ -42,7 +43,7 @@ public class MUCLightCreateIQ extends IQ {
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.CREATE; public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.CREATE;
private MUCLightRoomConfiguration configuration; private MUCLightRoomConfiguration configuration;
private final HashMap<Jid, MUCLightAffiliation> occupants; private final Map<Jid, MUCLightAffiliation> occupants;
/** /**
* MUCLight create IQ constructor. * MUCLight create IQ constructor.
@ -54,7 +55,7 @@ public class MUCLightCreateIQ extends IQ {
* @param occupants TODO javadoc me please * @param occupants TODO javadoc me please
*/ */
@SuppressWarnings("this-escape") @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) { List<Jid> occupants) {
super(ELEMENT, NAMESPACE); super(ELEMENT, NAMESPACE);
this.configuration = new MUCLightRoomConfiguration(roomName, subject, customConfigs); this.configuration = new MUCLightRoomConfiguration(roomName, subject, customConfigs);
@ -93,7 +94,7 @@ public class MUCLightCreateIQ extends IQ {
* *
* @return the room occupants * @return the room occupants
*/ */
public HashMap<Jid, MUCLightAffiliation> getOccupants() { public Map<Jid, MUCLightAffiliation> getOccupants() {
return occupants; return occupants;
} }

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.muclight.element; package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -48,11 +47,11 @@ public abstract class MUCLightElements {
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS; public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
public static final QName QNAME = new QName(NAMESPACE, ELEMENT); 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 prevVersion;
private final String version; private final String version;
public AffiliationsChangeExtension(HashMap<Jid, MUCLightAffiliation> affiliations, String prevVersion, public AffiliationsChangeExtension(Map<Jid, MUCLightAffiliation> affiliations, String prevVersion,
String version) { String version) {
this.affiliations = affiliations; this.affiliations = affiliations;
this.prevVersion = prevVersion; this.prevVersion = prevVersion;
@ -74,7 +73,7 @@ public abstract class MUCLightElements {
* *
* @return the affiliations * @return the affiliations
*/ */
public HashMap<Jid, MUCLightAffiliation> getAffiliations() { public Map<Jid, MUCLightAffiliation> getAffiliations() {
return affiliations; return affiliations;
} }
@ -135,7 +134,7 @@ public abstract class MUCLightElements {
private final String version; private final String version;
private final String roomName; private final String roomName;
private final String subject; private final String subject;
private final HashMap<String, String> customConfigs; private final Map<String, String> customConfigs;
/** /**
* Configurations change extension constructor. * Configurations change extension constructor.
@ -147,7 +146,7 @@ public abstract class MUCLightElements {
* @param customConfigs TODO javadoc me please * @param customConfigs TODO javadoc me please
*/ */
public ConfigurationsChangeExtension(String prevVersion, String version, String roomName, String subject, public ConfigurationsChangeExtension(String prevVersion, String version, String roomName, String subject,
HashMap<String, String> customConfigs) { Map<String, String> customConfigs) {
this.prevVersion = prevVersion; this.prevVersion = prevVersion;
this.version = version; this.version = version;
this.roomName = roomName; this.roomName = roomName;
@ -206,7 +205,7 @@ public abstract class MUCLightElements {
* *
* @return the room custom configurations * @return the room custom configurations
*/ */
public HashMap<String, String> getCustomConfigs() { public Map<String, String> getCustomConfigs() {
return customConfigs; return customConfigs;
} }
@ -287,14 +286,14 @@ public abstract class MUCLightElements {
*/ */
public static class OccupantsElement implements Element { public static class OccupantsElement implements Element {
private HashMap<Jid, MUCLightAffiliation> occupants; private Map<Jid, MUCLightAffiliation> occupants;
/** /**
* Occupants element constructor. * Occupants element constructor.
* *
* @param occupants TODO javadoc me please * @param occupants TODO javadoc me please
*/ */
public OccupantsElement(HashMap<Jid, MUCLightAffiliation> occupants) { public OccupantsElement(Map<Jid, MUCLightAffiliation> occupants) {
this.occupants = occupants; this.occupants = occupants;
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.muclight.element; package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap; import java.util.Map;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
@ -41,7 +41,7 @@ public class MUCLightInfoIQ extends IQ {
private final String version; private final String version;
private final MUCLightRoomConfiguration configuration; private final MUCLightRoomConfiguration configuration;
private final HashMap<Jid, MUCLightAffiliation> occupants; private final Map<Jid, MUCLightAffiliation> occupants;
/** /**
* MUCLight info response IQ constructor. * MUCLight info response IQ constructor.
@ -51,7 +51,7 @@ public class MUCLightInfoIQ extends IQ {
* @param occupants TODO javadoc me please * @param occupants TODO javadoc me please
*/ */
public MUCLightInfoIQ(String version, MUCLightRoomConfiguration configuration, public MUCLightInfoIQ(String version, MUCLightRoomConfiguration configuration,
HashMap<Jid, MUCLightAffiliation> occupants) { Map<Jid, MUCLightAffiliation> occupants) {
super(ELEMENT, NAMESPACE); super(ELEMENT, NAMESPACE);
this.version = version; this.version = version;
this.configuration = configuration; this.configuration = configuration;
@ -90,7 +90,7 @@ public class MUCLightInfoIQ extends IQ {
* *
* @return the occupants of the room * @return the occupants of the room
*/ */
public HashMap<Jid, MUCLightAffiliation> getOccupants() { public Map<Jid, MUCLightAffiliation> getOccupants() {
return occupants; return occupants;
} }

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.muclight.element; package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -39,7 +38,7 @@ public class MUCLightSetConfigsIQ extends IQ {
private String roomName; private String roomName;
private String subject; private String subject;
private HashMap<String, String> customConfigs; private Map<String, String> customConfigs;
/** /**
* MUC Light set configuration IQ constructor. * MUC Light set configuration IQ constructor.
@ -50,7 +49,7 @@ public class MUCLightSetConfigsIQ extends IQ {
* @param customConfigs TODO javadoc me please * @param customConfigs TODO javadoc me please
*/ */
@SuppressWarnings("this-escape") @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); super(ELEMENT, NAMESPACE);
this.roomName = roomName; this.roomName = roomName;
this.subject = subject; this.subject = subject;
@ -66,7 +65,7 @@ public class MUCLightSetConfigsIQ extends IQ {
* @param roomName TODO javadoc me please * @param roomName TODO javadoc me please
* @param customConfigs 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); this(roomJid, roomName, null, customConfigs);
} }

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData; import org.jivesoftware.smack.packet.IqData;
@ -42,8 +43,8 @@ public class MUCLightBlockingIQProvider extends IqProvider<MUCLightBlockingIQ> {
@Override @Override
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException { public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
HashMap<Jid, Boolean> rooms = null; Map<Jid, Boolean> rooms = null;
HashMap<Jid, Boolean> users = null; Map<Jid, Boolean> users = null;
outerloop: while (true) { outerloop: while (true) {
XmlPullParser.Event eventType = parser.next(); XmlPullParser.Event eventType = parser.next();
@ -70,7 +71,7 @@ public class MUCLightBlockingIQProvider extends IqProvider<MUCLightBlockingIQ> {
return 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 { throws XmppStringprepException, XmlPullParserException, IOException {
if (map == null) { if (map == null) {
map = new HashMap<>(); map = new HashMap<>();

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.IqData; import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.packet.XmlEnvironment;
@ -45,8 +46,8 @@ public class MUCLightInfoIQProvider extends IqProvider<MUCLightInfoIQ> {
String version = null; String version = null;
String roomName = null; String roomName = null;
String subject = null; String subject = null;
HashMap<String, String> customConfigs = null; Map<String, String> customConfigs = null;
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>(); Map<Jid, MUCLightAffiliation> occupants = new HashMap<>();
outerloop: while (true) { outerloop: while (true) {
XmlPullParser.Event eventType = parser.next(); 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); return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants);
} }
private static HashMap<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException { private static Map<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException {
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>(); Map<Jid, MUCLightAffiliation> occupants = new HashMap<>();
int depth = parser.getDepth(); int depth = parser.getDepth();
outerloop: while (true) { outerloop: while (true) {

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.push_notifications; package org.jivesoftware.smackx.push_notifications;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
@ -122,7 +121,7 @@ public final class PushNotificationsManager extends Manager {
* @throws NotConnectedException if the XMPP connection is not connected. * @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted. * @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 { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(pushJid, node, EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(pushJid, node,
publishOptions); publishOptions);

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.push_notifications.element; package org.jivesoftware.smackx.push_notifications.element;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -51,10 +50,10 @@ public class EnablePushNotificationsIQ extends IQ {
private final Jid jid; private final Jid jid;
private final String node; private final String node;
private final HashMap<String, String> publishOptions; private final Map<String, String> publishOptions;
@SuppressWarnings("this-escape") @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); super(ELEMENT, NAMESPACE);
this.jid = jid; this.jid = jid;
this.node = node; this.node = node;
@ -89,7 +88,7 @@ public class EnablePushNotificationsIQ extends IQ {
* *
* @return the publish options * @return the publish options
*/ */
public HashMap<String, String> getPublishOptions() { public Map<String, String> getPublishOptions() {
return publishOptions; return publishOptions;
} }

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals; 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.packet.Message;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
@ -55,7 +55,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
.from(changeAffiliationsMessage); .from(changeAffiliationsMessage);
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations(); Map<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
assertEquals(affiliations.size(), 3); assertEquals(affiliations.size(), 3);
assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner); assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member); assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
@ -68,7 +68,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
.from(changeAffiliationsMessage); .from(changeAffiliationsMessage);
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations(); Map<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
assertEquals(affiliations.size(), 2); assertEquals(affiliations.size(), 2);
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member); assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
assertEquals(affiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none); assertEquals(affiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);
@ -83,7 +83,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
.from(changeAffiliationsMessage); .from(changeAffiliationsMessage);
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations(); Map<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
assertEquals(affiliations.size(), 2); assertEquals(affiliations.size(), 2);
assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner); assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member); assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
@ -32,7 +33,7 @@ public class MUCLightChangeAffiliationsIQTest {
@Test @Test
public void checkChangeAffiliationsMUCLightStanza() throws Exception { 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("sarasa2@shakespeare.lit"), MUCLightAffiliation.owner);
affiliations.put(JidCreate.from("sarasa1@shakespeare.lit"), MUCLightAffiliation.member); affiliations.put(JidCreate.from("sarasa1@shakespeare.lit"), MUCLightAffiliation.member);
affiliations.put(JidCreate.from("sarasa3@shakespeare.lit"), MUCLightAffiliation.none); 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.getTo(), "coven@muclight.shakespeare.lit");
assertEquals(mucLightChangeAffiliationsIQ.getType(), IQ.Type.set); 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("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
assertEquals(iqAffiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner); assertEquals(iqAffiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
assertEquals(iqAffiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none); assertEquals(iqAffiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);

View file

@ -19,8 +19,8 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.jivesoftware.smackx.muclight.element.MUCLightCreateIQ; import org.jivesoftware.smackx.muclight.element.MUCLightCreateIQ;
@ -43,7 +43,7 @@ public class MUCLightCreateIQTest {
assertEquals(mucLightCreateIQ.getConfiguration().getRoomName(), "test"); 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("charlie@test.com")), MUCLightAffiliation.member);
assertEquals(iqOccupants.get(JidCreate.from("pep@test.com")), MUCLightAffiliation.member); assertEquals(iqOccupants.get(JidCreate.from("pep@test.com")), MUCLightAffiliation.member);
} }

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals; 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.IQ;
import org.jivesoftware.smack.packet.StreamOpen; import org.jivesoftware.smack.packet.StreamOpen;
@ -57,7 +57,7 @@ public class MUCLightGetAffiliationsTest {
assertEquals("123456", mucLightAffiliationsIQ.getVersion()); assertEquals("123456", mucLightAffiliationsIQ.getVersion());
HashMap<Jid, MUCLightAffiliation> affiliations = mucLightAffiliationsIQ.getAffiliations(); Map<Jid, MUCLightAffiliation> affiliations = mucLightAffiliationsIQ.getAffiliations();
assertEquals(3, affiliations.size()); assertEquals(3, affiliations.size());
assertEquals(MUCLightAffiliation.owner, affiliations.get(JidCreate.from("user1@shakespeare.lit"))); assertEquals(MUCLightAffiliation.owner, affiliations.get(JidCreate.from("user1@shakespeare.lit")));
assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user2@shakespeare.lit"))); assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user2@shakespeare.lit")));

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull; 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.IQ;
import org.jivesoftware.smack.packet.StreamOpen; import org.jivesoftware.smack.packet.StreamOpen;
@ -74,7 +74,7 @@ public class MUCLightGetConfigsTest {
assertEquals("A Dark Cave", mucLightConfigurationIQ.getConfiguration().getRoomName()); assertEquals("A Dark Cave", mucLightConfigurationIQ.getConfiguration().getRoomName());
assertNull(mucLightConfigurationIQ.getConfiguration().getSubject()); assertNull(mucLightConfigurationIQ.getConfiguration().getSubject());
HashMap<String, String> customConfigs = mucLightConfigurationIQ.getConfiguration().getCustomConfigs(); Map<String, String> customConfigs = mucLightConfigurationIQ.getConfiguration().getCustomConfigs();
assertEquals("blue", customConfigs.get("color")); assertEquals("blue", customConfigs.get("color"));
assertEquals("20", customConfigs.get("size")); assertEquals("20", customConfigs.get("size"));
} }

View file

@ -85,7 +85,7 @@ public final class AdHocCommandManager extends Manager {
*/ */
private static final Map<XMPPConnection, AdHocCommandManager> instances = new WeakHashMap<>(); private static final Map<XMPPConnection, AdHocCommandManager> instances = new WeakHashMap<>();
/** /*
* Register the listener for all the connection creations. When a new * Register the listener for all the connection creations. When a new
* connection is created a new AdHocCommandManager is also created and * connection is created a new AdHocCommandManager is also created and
* related to that connection. * related to that connection.
@ -463,7 +463,7 @@ public final class AdHocCommandManager extends Manager {
private AdHocCommandData processAdHocCommandOfExistingSession(AdHocCommandData request, AdHocCommandHandler command, AdHocCommandDataBuilder responseBuilder) { private AdHocCommandData processAdHocCommandOfExistingSession(AdHocCommandData request, AdHocCommandHandler command, AdHocCommandDataBuilder responseBuilder) {
// Check if the Session data has expired (default is 10 minutes) // Check if the Session data has expired (default is 10 minutes)
long creationStamp = command.getCreationDate(); long creationStamp = command.getCreationDate();
if (System.currentTimeMillis() - creationStamp > sessionTimeoutSecs * 1000) { if (System.currentTimeMillis() - creationStamp > sessionTimeoutSecs * 1000L) {
// Remove the expired session // Remove the expired session
executingCommands.remove(command.getSessionId()); executingCommands.remove(command.getSessionId());
@ -553,7 +553,7 @@ public final class AdHocCommandManager extends Manager {
// after the time out, then once the user requests to // after the time out, then once the user requests to
// continue the execution he will received an // continue the execution he will received an
// invalid session error and not a time out error. // invalid session error and not a time out error.
if (currentTime - creationStamp > getSessionRemovalTimeoutSecs() * 1000) { if (currentTime - creationStamp > getSessionRemovalTimeoutSecs() * 1000L) {
// Remove the expired session // Remove the expired session
it.remove(); it.remove();
} }

View file

@ -46,7 +46,7 @@ public class JivePropertiesExtensionProvider extends ExtensionElementProvider<Ji
* down the entire connection. ClassCastExceptions will occur when both the sender and receiver * 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. * of the stanza don't have identical versions of the same class.
* <p> * <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)} * {@link JivePropertiesManager#setJavaObjectEnabled(boolean)}
* *
* @param parser the XML parser, positioned at the start of a properties sub-packet. * @param parser the XML parser, positioned at the start of a properties sub-packet.

View file

@ -143,7 +143,6 @@ public final class PrivacyListManager extends Manager {
else { else {
cachedActiveListName = activeListName; cachedActiveListName = activeListName;
} }
return;
} }
}, iqResultReplyFilter); }, iqResultReplyFilter);
} }
@ -165,7 +164,6 @@ public final class PrivacyListManager extends Manager {
else { else {
cachedDefaultListName = defaultListName; cachedDefaultListName = defaultListName;
} }
return;
} }
}, iqResultReplyFilter); }, iqResultReplyFilter);
} }

View file

@ -386,7 +386,7 @@ public abstract class FormField implements XmlElement {
protected transient List<XmlElement> extraXmlChildElements; 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() { protected void populateExtraXmlChildElements() {
List<Value> values = getRawValues(); List<Value> values = getRawValues();

View file

@ -179,7 +179,7 @@ public class Socks5ByteStreamManagerTest {
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection); Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */
@ -231,7 +231,7 @@ public class Socks5ByteStreamManagerTest {
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection); Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */
@ -292,7 +292,7 @@ public class Socks5ByteStreamManagerTest {
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection); Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */
@ -375,7 +375,7 @@ public class Socks5ByteStreamManagerTest {
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection); Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * 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. // TODO: It appears that it is not required to disable the local stream host for this unit test.
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */
@ -541,7 +541,7 @@ public class Socks5ByteStreamManagerTest {
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
byteStreamManager.setProxyConnectionTimeout(3000); byteStreamManager.setProxyConnectionTimeout(3000);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */
@ -634,7 +634,7 @@ public class Socks5ByteStreamManagerTest {
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection); Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
byteStreamManager.setAnnounceLocalStreamHost(false); byteStreamManager.setAnnounceLocalStreamHost(false);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */
@ -760,7 +760,7 @@ public class Socks5ByteStreamManagerTest {
// get Socks5ByteStreamManager for connection // get Socks5ByteStreamManager for connection
Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection); Socks5BytestreamManager byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
/** /*
* create responses in the order they should be queried specified by the XEP-0065 * create responses in the order they should be queried specified by the XEP-0065
* specification * specification
*/ */

View file

@ -28,6 +28,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
@ -787,6 +788,6 @@ public final class Configuration {
if (specification == null || specification.isBlank()) { if (specification == null || specification.isBlank()) {
return null; return null;
} }
return specification.replaceAll("[\\s-]", "").toUpperCase(); return specification.replaceAll("[\\s-]", "").toUpperCase(Locale.ROOT);
} }
} }

View file

@ -82,7 +82,7 @@ public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest
URL getUrl = hfumOne.uploadFile(file, new UploadProgressListener() { URL getUrl = hfumOne.uploadFile(file, new UploadProgressListener() {
@Override @Override
public void onUploadProgress(long uploadedBytes, long totalBytes) { 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 + ')'); LOGGER.fine("HTTP File Upload progress " + progress + "% (" + uploadedBytes + '/' + totalBytes + ')');
} }
}); });

View file

@ -21,8 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -54,7 +54,7 @@ public class OmemoManagerSetupHelper {
} }
alice.requestDeviceListUpdateFor(bob.getOwnJid()); 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()) { for (OmemoDevice device : fingerprints.keySet()) {
OmemoFingerprint fingerprint = fingerprints.get(device); OmemoFingerprint fingerprint = fingerprints.get(device);
@ -67,7 +67,7 @@ public class OmemoManagerSetupHelper {
SmackException.NoResponseException, CannotEstablishOmemoSessionException, CorruptedOmemoKeyException, SmackException.NoResponseException, CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, IOException { XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, IOException {
alice.requestDeviceListUpdateFor(bob.getOwnJid()); alice.requestDeviceListUpdateFor(bob.getOwnJid());
HashMap<OmemoDevice, OmemoFingerprint> fps1 = alice.getActiveFingerprints(bob.getOwnJid()); Map<OmemoDevice, OmemoFingerprint> fps1 = alice.getActiveFingerprints(bob.getOwnJid());
assertFalse(fps1.isEmpty()); assertFalse(fps1.isEmpty());
assertAllDevicesAreUndecided(alice, fps1); assertAllDevicesAreUndecided(alice, fps1);
@ -75,7 +75,7 @@ public class OmemoManagerSetupHelper {
trustAllIdentities(alice, bob); trustAllIdentities(alice, bob);
HashMap<OmemoDevice, OmemoFingerprint> fps2 = alice.getActiveFingerprints(bob.getOwnJid()); Map<OmemoDevice, OmemoFingerprint> fps2 = alice.getActiveFingerprints(bob.getOwnJid());
assertEquals(fps1.size(), fps2.size()); assertEquals(fps1.size(), fps2.size());
assertTrue(Maps.difference(fps1, fps2).areEqual()); assertTrue(Maps.difference(fps1, fps2).areEqual());
@ -95,28 +95,28 @@ public class OmemoManagerSetupHelper {
return manager; 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()) { for (OmemoDevice device : devices.keySet()) {
// All fingerprints MUST be neither decided, nor trusted. // All fingerprints MUST be neither decided, nor trusted.
assertFalse(manager.isDecidedOmemoIdentity(device, devices.get(device))); 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()) { for (OmemoDevice device : devices.keySet()) {
// All fingerprints MUST be neither decided, nor trusted. // All fingerprints MUST be neither decided, nor trusted.
assertFalse(manager.isTrustedOmemoIdentity(device, devices.get(device))); 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()) { for (OmemoDevice device : devices.keySet()) {
// All fingerprints MUST be neither decided, nor trusted. // All fingerprints MUST be neither decided, nor trusted.
assertTrue(manager.isDecidedOmemoIdentity(device, devices.get(device))); 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()) { for (OmemoDevice device : devices.keySet()) {
// All fingerprints MUST be neither decided, nor trusted. // All fingerprints MUST be neither decided, nor trusted.
assertTrue(manager.isTrustedOmemoIdentity(device, devices.get(device))); assertTrue(manager.isTrustedOmemoIdentity(device, devices.get(device)));

View file

@ -31,26 +31,26 @@ import org.junit.jupiter.api.Test;
public class SmackIntegrationTestFrameWorkTest { public class SmackIntegrationTestFrameWorkTest {
private static class ValidLowLevelList { private static class ValidLowLevelList {
@SuppressWarnings("unused") @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(List<AbstractXMPPConnection> connections) { public void test(List<AbstractXMPPConnection> connections) {
} }
} }
private static class InvalidLowLevelList { private static class InvalidLowLevelList {
@SuppressWarnings("unused") @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(List<AbstractXMPPConnection> connections, boolean invalid) { public void test(List<AbstractXMPPConnection> connections, boolean invalid) {
} }
} }
private static class ValidLowLevelVarargs { private static class ValidLowLevelVarargs {
@SuppressWarnings("unused") @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractXMPPConnection connectionOne, AbstractXMPPConnection connectionTwo, public void test(AbstractXMPPConnection connectionOne, AbstractXMPPConnection connectionTwo,
AbstractXMPPConnection connectionThree) { AbstractXMPPConnection connectionThree) {
} }
} }
private static class InvalidLowLevelVarargs { private static class InvalidLowLevelVarargs {
@SuppressWarnings("unused") @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractXMPPConnection connectionOne, Integer invalid, AbstractXMPPConnection connectionTwo, public void test(AbstractXMPPConnection connectionOne, Integer invalid, AbstractXMPPConnection connectionTwo,
AbstractXMPPConnection connectionThree) { AbstractXMPPConnection connectionThree) {
} }
@ -97,7 +97,7 @@ public class SmackIntegrationTestFrameWorkTest {
} }
private static class ValidUnconnectedConnectionSource { private static class ValidUnconnectedConnectionSource {
@SuppressWarnings("unused") @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractSmackLowLevelIntegrationTest.UnconnectedConnectionSource source) { public void test(AbstractSmackLowLevelIntegrationTest.UnconnectedConnectionSource source) {
} }
} }

View file

@ -43,7 +43,7 @@ public class JMFInit extends Frame implements Runnable {
private boolean visible = false; private boolean visible = false;
@SuppressWarnings("this-escape") @SuppressWarnings({"this-escape", "DoNotCall"})
public JMFInit(String[] args, boolean visible) { public JMFInit(String[] args, boolean visible) {
super("Initializing JMF..."); super("Initializing JMF...");

View file

@ -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 { 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); SpeexFormat.setFramesPerPacket(1);
/** /*
* The master key. Hardcoded for now. * 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}; 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. * 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}; 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};

View file

@ -23,6 +23,7 @@ import java.net.SocketException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -135,7 +136,7 @@ public class STUNResolver extends TransportResolver {
* @param stunConfigStream An InputStream with the configuration file. * @param stunConfigStream An InputStream with the configuration file.
* @return A list of loaded servers * @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<>(); ArrayList<STUNService> serversList = new ArrayList<>();
String serverName; String serverName;
int serverPort; int serverPort;
@ -211,7 +212,7 @@ public class STUNResolver extends TransportResolver {
* *
* @return a list of services * @return a list of services
*/ */
public ArrayList<STUNService> loadSTUNServers() { public List<STUNService> loadSTUNServers() {
ArrayList<STUNService> serversList = new ArrayList<>(); ArrayList<STUNService> serversList = new ArrayList<>();
// Load the STUN configuration // Load the STUN configuration
@ -248,7 +249,7 @@ public class STUNResolver extends TransportResolver {
* *
* @return the best STUN server that can be used. * @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()) { if (listServers.isEmpty()) {
return null; return null;
} else { } else {

View file

@ -17,13 +17,13 @@
package org.jivesoftware.smackx.jingleold.nat; package org.jivesoftware.smackx.jingleold.nat;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.DatagramPacket; import java.net.DatagramPacket;
import java.net.DatagramSocket; import java.net.DatagramSocket;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.SocketException; import java.net.SocketException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -661,21 +661,13 @@ public abstract class TransportCandidate {
String local = id.substring(0, keySplitIndex) + ";" + localUser; String local = id.substring(0, keySplitIndex) + ";" + localUser;
String remote = id.substring(keySplitIndex) + ";" + remoteUser; String remote = id.substring(keySplitIndex) + ";" + remoteUser;
try { if (session.getConnection().getUser().equals(session.getInitiator())) {
if (session.getConnection().getUser().equals(session.getInitiator())) { this.send = local.getBytes(StandardCharsets.UTF_8);
this.receive = remote.getBytes(StandardCharsets.UTF_8);
this.send = local.getBytes("UTF-8"); } else {
this.receive = remote.getBytes("UTF-8"); this.receive = local.getBytes(StandardCharsets.UTF_8);
} else { this.send = remote.getBytes(StandardCharsets.UTF_8);
this.receive = local.getBytes("UTF-8");
this.send = remote.getBytes("UTF-8");
}
} }
catch (UnsupportedEncodingException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
} }
@SuppressWarnings("UnusedVariable") @SuppressWarnings("UnusedVariable")
@ -706,7 +698,7 @@ public abstract class TransportCandidate {
long delay = 100 / replyTries; 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 pass = str[0];
String[] address = str[1].split(":"); String[] address = str[1].split(":");
String ip = address[0]; String ip = address[0];
@ -714,13 +706,7 @@ public abstract class TransportCandidate {
if (pass.equals(candidate.getPassword()) && !accept) { if (pass.equals(candidate.getPassword()) && !accept) {
byte[] cont = null; byte[] cont = (password + ";" + candidate.getIp() + ":" + candidate.getPort()).getBytes(StandardCharsets.UTF_8);
try {
cont = (password + ";" + candidate.getIp() + ":" + candidate.getPort()).getBytes("UTF-8");
}
catch (UnsupportedEncodingException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
packet.setData(cont); packet.setData(cont);
packet.setLength(cont.length); packet.setLength(cont.length);
@ -778,31 +764,24 @@ public abstract class TransportCandidate {
DatagramListener listener = new DatagramListener() { DatagramListener listener = new DatagramListener() {
@Override @Override
public boolean datagramReceived(DatagramPacket datagramPacket) { 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 { // CHECKSTYLE:OFF
LOGGER.fine("ECHO Received to: " + candidate.getIp() + ":" + candidate.getPort() + " data: " + new String(datagramPacket.getData(), "UTF-8")); if (pass.equals(password)
String[] str = new String(datagramPacket.getData(), "UTF-8").split(";"); && transportCandidate.getIp().indexOf(ip) != -1
String pass = str[0]; && transportCandidate.getPort() == Integer.parseInt(pt)) {
String[] addr = str[1].split(":"); // CHECKSTYLE:ON
String ip = addr[0]; LOGGER.fine("ECHO OK: " + candidate.getIp() + ":" + candidate.getPort() + " <-> " + transportCandidate.getIp() + ":" + transportCandidate.getPort());
String pt = addr[1]; TestResult testResult = new TestResult();
testResult.setResult(true);
// CHECKSTYLE:OFF ended = true;
if (pass.equals(password) fireTestResult(testResult, transportCandidate);
&& transportCandidate.getIp().indexOf(ip) != -1 return true;
&& 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);
} }
LOGGER.fine("ECHO Wrong Data: " + datagramPacket.getAddress().getHostAddress() + ":" + datagramPacket.getPort()); LOGGER.fine("ECHO Wrong Data: " + datagramPacket.getAddress().getHostAddress() + ":" + datagramPacket.getPort());
@ -812,13 +791,7 @@ public abstract class TransportCandidate {
addListener(listener); addListener(listener);
byte[] content = null; byte[] content = new String(password + ";" + getIp() + ":" + getPort()).getBytes(StandardCharsets.UTF_8);
try {
content = new String(password + ";" + getIp() + ":" + getPort()).getBytes("UTF-8");
}
catch (UnsupportedEncodingException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
DatagramPacket packet = new DatagramPacket(content, content.length); DatagramPacket packet = new DatagramPacket(content, content.length);

View file

@ -311,7 +311,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
// Sleep for some time, waiting for the candidates checks // Sleep for some time, waiting for the candidates checks
int totalTime = CANDIDATES_ACCEPT_PERIOD + TransportResolver.CHECK_TIMEOUT; 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++) { for (int i = 0; i < tries - 1; i++) {
try { try {
@ -478,7 +478,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* *
* @return The list of valid (ie, already checked) remote candidates. * @return The list of valid (ie, already checked) remote candidates.
*/ */
final ArrayList<TransportCandidate> getValidRemoteCandidatesList() { final List<TransportCandidate> getValidRemoteCandidatesList() {
synchronized (validRemoteCandidates) { synchronized (validRemoteCandidates) {
return new ArrayList<>(validRemoteCandidates); return new ArrayList<>(validRemoteCandidates);
} }
@ -872,7 +872,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
@Override @Override
public TransportCandidate getBestRemoteCandidate() { public TransportCandidate getBestRemoteCandidate() {
// Hopefully, we only have one validRemoteCandidate // Hopefully, we only have one validRemoteCandidate
ArrayList<TransportCandidate> cands = getValidRemoteCandidatesList(); List<TransportCandidate> cands = getValidRemoteCandidatesList();
if (!cands.isEmpty()) { if (!cands.isEmpty()) {
LOGGER.fine("RAW CAND"); LOGGER.fine("RAW CAND");
return cands.get(0); return cands.get(0);
@ -930,7 +930,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
public TransportCandidate getBestRemoteCandidate() { public TransportCandidate getBestRemoteCandidate() {
ICECandidate result = null; ICECandidate result = null;
ArrayList<TransportCandidate> cands = getValidRemoteCandidatesList(); List<TransportCandidate> cands = getValidRemoteCandidatesList();
if (!cands.isEmpty()) { if (!cands.isEmpty()) {
int highest = -1; int highest = -1;
ICECandidate chose = null; ICECandidate chose = null;

View file

@ -210,7 +210,7 @@ public abstract class TransportResolver {
* *
* @return the list of listeners * @return the list of listeners
*/ */
public ArrayList<TransportResolverListener> getListenersList() { public List<TransportResolverListener> getListenersList() {
synchronized (listeners) { synchronized (listeners) {
return new ArrayList<>(listeners); return new ArrayList<>(listeners);
} }

View file

@ -105,7 +105,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
* *
* @return a list for the audio payloads in the packet. * @return a list for the audio payloads in the packet.
*/ */
public ArrayList<JinglePayloadType> getJinglePayloadTypesList() { public List<JinglePayloadType> getJinglePayloadTypesList() {
synchronized (payloads) { synchronized (payloads) {
return new ArrayList<>(payloads); return new ArrayList<>(payloads);
} }
@ -116,7 +116,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
* *
* @return a list of PayloadType.Audio * @return a list of PayloadType.Audio
*/ */
public ArrayList<PayloadType.Audio> getAudioPayloadTypesList() { public List<PayloadType.Audio> getAudioPayloadTypesList() {
ArrayList<PayloadType.Audio> result = new ArrayList<>(); ArrayList<PayloadType.Audio> result = new ArrayList<>();
Iterator<JinglePayloadType> jinglePtsIter = getJinglePayloadTypes(); Iterator<JinglePayloadType> jinglePtsIter = getJinglePayloadTypes();

View file

@ -349,15 +349,9 @@ public class AgentSession {
new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence);
presence = collector.nextResultOrThrow(); 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... // Otherwise the user is going offline...
else { else {
// Update this iv now since we don't care at this point of any error
this.online = online;
presence = connection.getStanzaFactory().buildPresenceStanza() presence = connection.getStanzaFactory().buildPresenceStanza()
.ofType(Presence.Type.unavailable) .ofType(Presence.Type.unavailable)
.to(workgroupJID) .to(workgroupJID)
@ -714,7 +708,7 @@ public class AgentSession {
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) { private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) {
Offer offer = new Offer(this.connection, this, requestPacket.getUserID(), Offer offer = new Offer(this.connection, this, requestPacket.getUserID(),
requestPacket.getUserJID(), this.getWorkgroupJID(), 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()); requestPacket.getSessionID(), requestPacket.getMetaData(), requestPacket.getContent());
synchronized (offerListeners) { synchronized (offerListeners) {

View file

@ -137,7 +137,7 @@ public class Workgroup {
} }
}); });
/** /*
* Internal handling of an invitation. Receiving an invitation removes the user from the queue. * Internal handling of an invitation. Receiving an invitation removes the user from the queue.
*/ */
MultiUserChatManager.getInstanceFor(connection).addInvitationListener( MultiUserChatManager.getInstanceFor(connection).addInvitationListener(

View file

@ -55,6 +55,7 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
} }
@Override @Override
@SuppressWarnings("NonApiType")
public TreeMap<Integer, PreKeyRecord> generateOmemoPreKeys(int currentPreKeyId, int count) { public TreeMap<Integer, PreKeyRecord> generateOmemoPreKeys(int currentPreKeyId, int count) {
List<PreKeyRecord> preKeyRecords = KeyHelper.generatePreKeys(currentPreKeyId, count); List<PreKeyRecord> preKeyRecords = KeyHelper.generatePreKeys(currentPreKeyId, count);
TreeMap<Integer, PreKeyRecord> map = new TreeMap<>(); TreeMap<Integer, PreKeyRecord> map = new TreeMap<>();

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.omemo;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.TreeSet; import java.util.TreeSet;
@ -268,8 +269,9 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
} }
@Override @Override
@SuppressWarnings("NonApiType")
public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException { 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) { if (preKeys.isEmpty() && persistent != null) {
preKeys.putAll(persistent.loadOmemoPreKeys(userDevice)); preKeys.putAll(persistent.loadOmemoPreKeys(userDevice));
@ -293,8 +295,9 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
} }
@Override @Override
@SuppressWarnings("NonApiType")
public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException { 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) { if (sigPreKeys.isEmpty() && persistent != null) {
sigPreKeys.putAll(persistent.loadOmemoSignedPreKeys(userDevice)); sigPreKeys.putAll(persistent.loadOmemoSignedPreKeys(userDevice));
@ -341,7 +344,7 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
} }
@Override @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); HashMap<Integer, T_Sess> sessions = getCache(userDevice).sessions.get(contact);
if (sessions == null) { if (sessions == null) {
sessions = new HashMap<>(); sessions = new HashMap<>();

View file

@ -200,6 +200,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
} }
@Override @Override
@SuppressWarnings("NonApiType")
public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException { public TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException {
File preKeyDirectory = hierarchy.getPreKeysDirectory(userDevice); File preKeyDirectory = hierarchy.getPreKeysDirectory(userDevice);
TreeMap<Integer, T_PreKey> preKeys = new TreeMap<>(); TreeMap<Integer, T_PreKey> preKeys = new TreeMap<>();
@ -240,6 +241,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
} }
@Override @Override
@SuppressWarnings("NonApiType")
public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException { public TreeMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws IOException {
File signedPreKeysDirectory = hierarchy.getSignedPreKeysDirectory(userDevice); File signedPreKeysDirectory = hierarchy.getSignedPreKeysDirectory(userDevice);
TreeMap<Integer, T_SigPreKey> signedPreKeys = new TreeMap<>(); TreeMap<Integer, T_SigPreKey> signedPreKeys = new TreeMap<>();
@ -296,6 +298,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
} }
@Override @Override
@SuppressWarnings("NonApiType")
public HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException { public HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws IOException {
File contactsDirectory = hierarchy.getContactsDir(userDevice, contact); File contactsDirectory = hierarchy.getContactsDir(userDevice, contact);
HashMap<Integer, T_Sess> sessions = new HashMap<>(); HashMap<Integer, T_Sess> sessions = new HashMap<>();

View file

@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; 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 SmackException.NoResponseException if there was no response from the remote entity.
* @throws IOException if an I/O error occurred. * @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, throws SmackException.NotLoggedInException, CorruptedOmemoKeyException,
CannotEstablishOmemoSessionException, SmackException.NotConnectedException, InterruptedException, CannotEstablishOmemoSessionException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException, IOException { SmackException.NoResponseException, IOException {
@ -641,7 +642,7 @@ public final class OmemoManager extends Manager {
throw new SmackException.NotLoggedInException(); throw new SmackException.NotLoggedInException();
} }
HashMap<OmemoDevice, OmemoFingerprint> fingerprints = new HashMap<>(); Map<OmemoDevice, OmemoFingerprint> fingerprints = new HashMap<>();
OmemoCachedDeviceList deviceList = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(), OmemoCachedDeviceList deviceList = getOmemoService().getOmemoStoreBackend().loadCachedDeviceList(getOwnDevice(),
contact); contact);

View file

@ -22,6 +22,7 @@ import static org.jivesoftware.smackx.omemo.util.OmemoConstants.OMEMO_NAMESPACE_
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
@ -78,7 +79,7 @@ public class OmemoMessage {
*/ */
public static class Sent extends OmemoMessage { public static class Sent extends OmemoMessage {
private final Set<OmemoDevice> intendedDevices = new HashSet<>(); 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. * Create a new outgoing OMEMO message.
@ -90,7 +91,7 @@ public class OmemoMessage {
* @param skippedDevices devices which were skipped during encryption process because encryption * @param skippedDevices devices which were skipped during encryption process because encryption
* failed for some reason * 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); super(element, key, iv);
this.intendedDevices.addAll(intendedDevices); this.intendedDevices.addAll(intendedDevices);
this.skippedDevices.putAll(skippedDevices); this.skippedDevices.putAll(skippedDevices);
@ -110,7 +111,7 @@ public class OmemoMessage {
* *
* @return map of skipped recipients and reasons for that. * @return map of skipped recipients and reasons for that.
*/ */
public HashMap<OmemoDevice, Throwable> getSkippedDevices() { public Map<OmemoDevice, Throwable> getSkippedDevices() {
return skippedDevices; return skippedDevices;
} }

View file

@ -30,6 +30,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
@ -794,7 +795,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
} }
// Select random Bundle // 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()); int randomIndex = new Random().nextInt(bundlesList.size());
T_Bundle randomPreKeyBundle = new ArrayList<>(bundlesList.values()).get(randomIndex); T_Bundle randomPreKeyBundle = new ArrayList<>(bundlesList.values()).get(randomIndex);

View file

@ -20,7 +20,6 @@ import static org.jivesoftware.smackx.omemo.util.OmemoConstants.PRE_KEY_COUNT_PE
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeMap; import java.util.TreeMap;
@ -229,7 +228,7 @@ public abstract class OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
storeOmemoIdentityKeyPair(userDevice, identityKeyPair); storeOmemoIdentityKeyPair(userDevice, identityKeyPair);
} }
TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice); Map<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
if (signedPreKeys.size() == 0) { if (signedPreKeys.size() == 0) {
changeSignedPreKey(userDevice); 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(); int startId = preKeys.size() == 0 ? 0 : preKeys.lastKey();
if (newKeysCount > 0) { if (newKeysCount > 0) {
TreeMap<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount); Map<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount);
storeOmemoPreKeys(userDevice, newKeys); 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 * @param count how many keys do we want to generate
* @return Map of new preKeys * @return Map of new preKeys
*/ */
@SuppressWarnings("NonApiType")
public TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count) { public TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count) {
return keyUtil().generateOmemoPreKeys(startId, 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. * @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()) { for (Map.Entry<Integer, T_PreKey> entry : preKeyHashMap.entrySet()) {
storeOmemoPreKey(userDevice, entry.getKey(), entry.getValue()); 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. * @throws IOException if an I/O error occurred.
*/ */
@SuppressWarnings("NonApiType")
public abstract TreeMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws IOException; 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. * @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; 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. * @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. * Store a crypto-lib specific session to storage.

View file

@ -47,8 +47,8 @@ public abstract class OmemoBundleElement implements ExtensionElement {
private byte[] signedPreKeySignature; private byte[] signedPreKeySignature;
private final String identityKeyB64; private final String identityKeyB64;
private byte[] identityKey; private byte[] identityKey;
private final HashMap<Integer, String> preKeysB64; private final Map<Integer, String> preKeysB64;
private HashMap<Integer, byte[]> preKeys; private Map<Integer, byte[]> preKeys;
/** /**
* Constructor to create a Bundle Element from base64 Strings. * 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 signedPreKeyB64 base64 encoded signedPreKey
* @param signedPreKeySigB64 base64 encoded signedPreKeySignature * @param signedPreKeySigB64 base64 encoded signedPreKeySignature
* @param identityKeyB64 base64 encoded identityKey * @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) { if (signedPreKeyId < 0) {
throw new IllegalArgumentException("signedPreKeyId MUST be greater than or equal to 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 signedPreKey signedPreKey
* @param signedPreKeySig signedPreKeySignature * @param signedPreKeySig signedPreKeySignature
* @param identityKey identityKey * @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, this(signedPreKeyId,
signedPreKey != null ? Base64.encodeToString(signedPreKey) : null, signedPreKey != null ? Base64.encodeToString(signedPreKey) : null,
signedPreKeySig != null ? Base64.encodeToString(signedPreKeySig) : null, signedPreKeySig != null ? Base64.encodeToString(signedPreKeySig) : null,
@ -95,12 +95,12 @@ public abstract class OmemoBundleElement implements ExtensionElement {
this.preKeys = preKeys; 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) { if (preKeys == null) {
return null; return null;
} }
HashMap<Integer, String> converted = new HashMap<>(); Map<Integer, String> converted = new HashMap<>();
for (Integer id : preKeys.keySet()) { for (Integer id : preKeys.keySet()) {
converted.put(id, Base64.encodeToString(preKeys.get(id))); 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. * The map uses the preKeys ids as key and the preKeys as value.
* *
* @return preKeys Pre-Keys contained in the bundle * @return preKeys Pre-Keys contained in the bundle
*/ */
public HashMap<Integer, byte[]> getPreKeys() { public Map<Integer, byte[]> getPreKeys() {
if (preKeys == null) { if (preKeys == null) {
preKeys = new HashMap<>(); preKeys = new HashMap<>();
for (int id : preKeysB64.keySet()) { for (int id : preKeysB64.keySet()) {

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.omemo.element;
import static org.jivesoftware.smackx.omemo.util.OmemoConstants.OMEMO_NAMESPACE_V_AXOLOTL; 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. * OMEMO device bundle as described by the protocol.
@ -29,11 +29,11 @@ import java.util.HashMap;
*/ */
public class OmemoBundleElement_VAxolotl extends OmemoBundleElement { 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); 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); super(signedPreKeyId, signedPreKey, signedPreKeySig, identityKey, preKeys);
} }

View file

@ -57,7 +57,7 @@ public abstract class OmemoHeaderElement implements XmlElement {
return sid; return sid;
} }
public ArrayList<OmemoKeyElement> getKeys() { public List<OmemoKeyElement> getKeys() {
return new ArrayList<>(keys); return new ArrayList<>(keys);
} }

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.omemo.exceptions;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smackx.omemo.internal.OmemoDevice; import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
@ -32,8 +33,8 @@ import org.jxmpp.jid.BareJid;
public class CannotEstablishOmemoSessionException extends Exception { public class CannotEstablishOmemoSessionException extends Exception {
private static final long serialVersionUID = 3165844730283295249L; private static final long serialVersionUID = 3165844730283295249L;
private final HashMap<BareJid, HashMap<OmemoDevice, Throwable>> failures = new HashMap<>(); private final Map<BareJid, Map<OmemoDevice, Throwable>> failures = new HashMap<>();
private final HashMap<BareJid, ArrayList<OmemoDevice>> successes = new HashMap<>(); private final Map<BareJid, List<OmemoDevice>> successes = new HashMap<>();
public CannotEstablishOmemoSessionException(OmemoDevice failed, Throwable reason) { public CannotEstablishOmemoSessionException(OmemoDevice failed, Throwable reason) {
super(); super();
@ -41,7 +42,7 @@ public class CannotEstablishOmemoSessionException extends Exception {
} }
public void addFailures(CannotEstablishOmemoSessionException otherFailures) { 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()); getFailsOfContact(entry.getKey()).putAll(entry.getValue());
} }
} }
@ -50,16 +51,16 @@ public class CannotEstablishOmemoSessionException extends Exception {
getSuccessesOfContact(success.getJid()).add(success); getSuccessesOfContact(success.getJid()).add(success);
} }
public HashMap<BareJid, HashMap<OmemoDevice, Throwable>> getFailures() { public Map<BareJid, Map<OmemoDevice, Throwable>> getFailures() {
return failures; return failures;
} }
public HashMap<BareJid, ArrayList<OmemoDevice>> getSuccesses() { public Map<BareJid, List<OmemoDevice>> getSuccesses() {
return successes; return successes;
} }
private HashMap<OmemoDevice, Throwable> getFailsOfContact(BareJid contact) { private Map<OmemoDevice, Throwable> getFailsOfContact(BareJid contact) {
HashMap<OmemoDevice, Throwable> h = failures.get(contact); Map<OmemoDevice, Throwable> h = failures.get(contact);
if (h == null) { if (h == null) {
h = new HashMap<>(); h = new HashMap<>();
failures.put(contact, h); failures.put(contact, h);
@ -67,8 +68,8 @@ public class CannotEstablishOmemoSessionException extends Exception {
return h; return h;
} }
private ArrayList<OmemoDevice> getSuccessesOfContact(BareJid contact) { private List<OmemoDevice> getSuccessesOfContact(BareJid contact) {
ArrayList<OmemoDevice> suc = successes.get(contact); List<OmemoDevice> suc = successes.get(contact);
if (suc == null) { if (suc == null) {
suc = new ArrayList<>(); suc = new ArrayList<>();
successes.put(contact, suc); successes.put(contact, suc);
@ -83,8 +84,8 @@ public class CannotEstablishOmemoSessionException extends Exception {
* @return true if the exception requires to be thrown * @return true if the exception requires to be thrown
*/ */
public boolean requiresThrowing() { public boolean requiresThrowing() {
for (Map.Entry<BareJid, HashMap<OmemoDevice, Throwable>> entry : failures.entrySet()) { for (Map.Entry<BareJid, Map<OmemoDevice, Throwable>> entry : failures.entrySet()) {
ArrayList<OmemoDevice> suc = successes.get(entry.getKey()); List<OmemoDevice> suc = successes.get(entry.getKey());
if (suc == null || suc.isEmpty()) { if (suc == null || suc.isEmpty()) {
return true; return true;
} }

View file

@ -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 * @throws CorruptedOmemoKeyException when one of the keys cannot be parsed
*/ */
public HashMap<Integer, T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException { public Map<Integer, T_Bundle> bundles(OmemoBundleElement bundle, OmemoDevice contact) throws CorruptedOmemoKeyException {
HashMap<Integer, T_Bundle> bundles = new HashMap<>(); Map<Integer, T_Bundle> bundles = new HashMap<>();
for (int deviceId : bundle.getPreKeys().keySet()) { for (int deviceId : bundle.getPreKeys().keySet()) {
try { try {
bundles.put(deviceId, bundleFromOmemoBundle(bundle, contact, deviceId)); 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 * @param count how many keys do we want to generate
* @return Map of new preKeys * @return Map of new preKeys
*/ */
// We use TreeMap.lastKey()
@SuppressWarnings("NonApiType")
public abstract TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count); 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 * @param preKeyHashMap HashMap of preKeys
* @return HashMap of byte arrays but with the same keyIds as key * @return HashMap of byte arrays but with the same keyIds as key
*/ */
public HashMap<Integer, byte[]> preKeyPublicKeysForBundle(TreeMap<Integer, T_PreKey> preKeyHashMap) { public Map<Integer, byte[]> preKeyPublicKeysForBundle(Map<Integer, T_PreKey> preKeyHashMap) {
HashMap<Integer, byte[]> out = new HashMap<>(); Map<Integer, byte[]> out = new HashMap<>();
for (Map.Entry<Integer, T_PreKey> e : preKeyHashMap.entrySet()) { for (Map.Entry<Integer, T_PreKey> e : preKeyHashMap.entrySet()) {
out.put(e.getKey(), preKeyForBundle(e.getValue())); out.put(e.getKey(), preKeyForBundle(e.getValue()));
} }

File diff suppressed because one or more lines are too long

View file

@ -27,8 +27,8 @@ import static junit.framework.TestCase.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException; 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() public void storeLoadRemoveOmemoPreKeys()
throws IOException, InterruptedException { 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()); assertEquals("The store must have no prekeys before this test.", 0, store.loadOmemoPreKeys(alice).size());
store.storeOmemoPreKeys(alice, before); store.storeOmemoPreKeys(alice, before);
@ -305,7 +305,7 @@ public abstract class OmemoStoreTest<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey
@Test @Test
public void loadAllRawSessionsReturnsEmptyMapTest() throws IOException { 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); assertNotNull(sessions);
assertEquals(0, sessions.size()); assertEquals(0, sessions.size());
} }

View file

@ -40,7 +40,7 @@ public final class PublicKeysListElement implements ExtensionElement {
private final Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata; 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)); this.metadata = Collections.unmodifiableMap(Objects.requireNonNull(metadata));
} }
@ -48,7 +48,8 @@ public final class PublicKeysListElement implements ExtensionElement {
return new Builder(); return new Builder();
} }
public TreeMap<OpenPgpV4Fingerprint, PubkeyMetadataElement> getMetadata() { @SuppressWarnings("NonApiType")
public Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> getMetadata() {
return new TreeMap<>(metadata); return new TreeMap<>(metadata);
} }
@ -72,7 +73,7 @@ public final class PublicKeysListElement implements ExtensionElement {
public static final class Builder { public static final class Builder {
private final TreeMap<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata = new TreeMap<>(); private final Map<OpenPgpV4Fingerprint, PubkeyMetadataElement> metadata = new TreeMap<>();
private Builder() { private Builder() {
// Empty // Empty

View file

@ -84,6 +84,7 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer {
} }
@Override @Override
@SuppressWarnings("BanJNDI")
protected List<SRV> lookupSrvRecords0(DnsName name, List<RemoteConnectionEndpointLookupFailure> lookupFailures, protected List<SRV> lookupSrvRecords0(DnsName name, List<RemoteConnectionEndpointLookupFailure> lookupFailures,
DnssecMode dnssecMode) { DnssecMode dnssecMode) {
Attribute srvAttribute; Attribute srvAttribute;

View file

@ -1256,8 +1256,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
final boolean smResumptionPossible = isSmResumptionPossible(); final boolean smResumptionPossible = isSmResumptionPossible();
// Don't throw a NotConnectedException is there is an resumable stream available // Don't throw a NotConnectedException is there is an resumable stream available
if (!smResumptionPossible) { if (!smResumptionPossible) {
throw new NotConnectedException(XMPPTCPConnection.this, "done=" + done throw new NotConnectedException(XMPPTCPConnection.this, "done=true smResumptionPossible=false");
+ " smResumptionPossible=" + smResumptionPossible);
} }
} }
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2019-2020 Florian Schmaus * Copyright 2019-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 { public static final class Builder extends ModularXmppClientToServerConnectionModuleDescriptor.Builder {
// Invoked via reflection.
@SuppressWarnings("UnusedMethod")
private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) { private Builder(ModularXmppClientToServerConnectionConfiguration.Builder connectionConfigurationBuilder) {
super(connectionConfigurationBuilder); super(connectionConfigurationBuilder);
} }