mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Fix warnings
This commit is contained in:
parent
6203d163c4
commit
80eaaf2d71
15 changed files with 73 additions and 95 deletions
|
@ -52,7 +52,10 @@ import org.jivesoftware.smackx.hashes.element.HashElement;
|
|||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
/**
|
||||
* Manager that can be used to determine support for hash functions.
|
||||
* Manager that can be used to determine support for hash functions. By default the Manager announces support for
|
||||
* XEP-0300, as well as for the recommended set of hash algorithms. Those contain SHA256, SHA384, SHA512, SHA3-256,
|
||||
* SHA3-384, SHA3-512, BLAKE2B256, BLAKE2B384 and BLAKE2B512. Those algorithms got recommended here:
|
||||
* <a href="https://xmpp.org/extensions/xep-0300.html#recommendations">https://xmpp.org/extensions/xep-0300.html#recommendations</a>.
|
||||
*/
|
||||
public final class HashManager extends Manager {
|
||||
|
||||
|
@ -88,9 +91,7 @@ public final class HashManager extends Manager {
|
|||
|
||||
/**
|
||||
* Constructor of the HashManager.
|
||||
* By default the Manager announces support for XEP-0300, as well as for the RECOMMENDED set of hash algorithms.
|
||||
* Those contain SHA256, SHA384, SHA512, SHA3-256, SHA3-384, SHA3-512, BLAKE2B256, BLAKE2B384 and BLAKE2B512.
|
||||
* Those algorithms got recommended here: https://xmpp.org/extensions/xep-0300.html#recommendations
|
||||
*
|
||||
* @param connection connection
|
||||
*/
|
||||
private HashManager(XMPPConnection connection) {
|
||||
|
@ -122,9 +123,9 @@ public final class HashManager extends Manager {
|
|||
/**
|
||||
* Get an instance of the HashManager for the given connection.
|
||||
* @param connection
|
||||
* @return
|
||||
* @return the manager for the given connection.
|
||||
*/
|
||||
public HashManager getInstanceFor(XMPPConnection connection) {
|
||||
public static synchronized HashManager getInstanceFor(XMPPConnection connection) {
|
||||
HashManager hashManager = INSTANCES.get(connection);
|
||||
if (hashManager == null) {
|
||||
hashManager = new HashManager(connection);
|
||||
|
@ -457,11 +458,11 @@ public final class HashManager extends Manager {
|
|||
return blake2b384(utf8(data));
|
||||
}
|
||||
|
||||
public String blake2b384HexString(byte[] data) {
|
||||
public static String blake2b384HexString(byte[] data) {
|
||||
return hex(blake2b384(data));
|
||||
}
|
||||
|
||||
public String blake2b384HexString(String data) {
|
||||
public static String blake2b384HexString(String data) {
|
||||
return hex(blake2b384(data));
|
||||
}
|
||||
|
||||
|
@ -473,11 +474,11 @@ public final class HashManager extends Manager {
|
|||
return blake2b512(utf8(data));
|
||||
}
|
||||
|
||||
public String blake2b512HexString(byte[] data) {
|
||||
public static String blake2b512HexString(byte[] data) {
|
||||
return hex(blake2b512(data));
|
||||
}
|
||||
|
||||
public String blake2b512HexString(String data) {
|
||||
public static String blake2b512HexString(String data) {
|
||||
return hex(blake2b512(data));
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ public class HashElement implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Return the hash algorithm used in this HashElement.
|
||||
* @return algorithm
|
||||
*
|
||||
* @return algorithm the algorithm.
|
||||
*/
|
||||
public HashManager.ALGORITHM getAlgorithm() {
|
||||
return algorithm;
|
||||
|
@ -70,7 +71,8 @@ public class HashElement implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Return the checksum as a byte array.
|
||||
* @return
|
||||
*
|
||||
* @return the hash.
|
||||
*/
|
||||
public byte[] getHash() {
|
||||
return hash;
|
||||
|
@ -78,7 +80,8 @@ public class HashElement implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Return the checksum as a base16 (hex) string.
|
||||
* @return
|
||||
*
|
||||
* @return the hash.
|
||||
*/
|
||||
public String getHashB64() {
|
||||
return hashB64;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class UploadService {
|
|||
enum Version {
|
||||
v0_2,
|
||||
v0_3,
|
||||
};
|
||||
}
|
||||
|
||||
private final DomainBareJid address;
|
||||
private final Version version;
|
||||
|
|
|
@ -146,6 +146,7 @@ public class MultiUserChatLight {
|
|||
* for the newly created chat.
|
||||
* @return new Chat for sending private messages to a given room occupant.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
// Do not re-use Chat API, which was designed for XMPP-IM 1:1 chats and not MUClight private chats.
|
||||
public org.jivesoftware.smack.chat.Chat createPrivateChat(EntityJid occupant, ChatMessageListener listener) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class MUCLightBlockingIQProvider extends IQProvider<MUCLightBlockingIQ> {
|
|||
return mucLightBlockingIQ;
|
||||
}
|
||||
|
||||
private HashMap<Jid, Boolean> parseBlocking(XmlPullParser parser, HashMap<Jid, Boolean> map)
|
||||
private static HashMap<Jid, Boolean> parseBlocking(XmlPullParser parser, HashMap<Jid, Boolean> map)
|
||||
throws XmppStringprepException, XmlPullParserException, IOException {
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
|
|
|
@ -93,7 +93,7 @@ public class MUCLightInfoIQProvider extends IQProvider<MUCLightInfoIQ> {
|
|||
return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants);
|
||||
}
|
||||
|
||||
private HashMap<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws Exception {
|
||||
private static HashMap<Jid, MUCLightAffiliation> iterateOccupants(XmlPullParser parser) throws Exception {
|
||||
HashMap<Jid, MUCLightAffiliation> occupants = new HashMap<>();
|
||||
int depth = parser.getDepth();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue