+ * This does not perform a deep clone, as extension elements are shared between the new and old
+ * instance.
+ *
+ * @return a clone of this message.
+ * @deprecated use {@link #asBuilder()} instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ @Override
+ public Message clone() {
+ return new Message(this);
+ }
+
/**
* Represents a message subject, its language and the content of the subject.
*/
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java
index c3aa3d180..f48b794a0 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/MessageOrPresence.java
@@ -20,6 +20,11 @@ import org.jivesoftware.smack.XMPPConnection;
public abstract class MessageOrPresence> extends Stanza {
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ protected MessageOrPresence() {
+ }
+
protected MessageOrPresence(StanzaBuilder> stanzaBuilder) {
super(stanzaBuilder);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Nonza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Nonza.java
index ece665543..a86a4e1db 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Nonza.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Nonza.java
@@ -18,7 +18,7 @@
package org.jivesoftware.smack.packet;
/**
- * A Nonza, i.e. everything that is not a stanza as defined
+ * A Nonza, i.e everything that is not a stanza as defined
* RFC 6120 8. Stanzas are {@link Message}, {@link Presence} and {@link IQ}.
* Everything else should sublcass this class instead of {@link Stanza}.
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
index caa3942dc..3490e1a23 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2003-2007 Jive Software, 2020-2024 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2020-2021 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,12 @@ import java.util.List;
import java.util.Locale;
import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
+import org.jxmpp.jid.Jid;
+
/**
* Represents XMPP presence stanzas. Every presence stanza has a type, which is one of
* the following values:
@@ -75,6 +78,55 @@ public final class Presence extends MessageOrPresence
private Mode mode = null;
+ /**
+ * Creates a new presence update. Status, priority, and mode are left un-set.
+ *
+ * @param type the type.
+ * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public Presence(Type type) {
+ // Ensure that the stanza ID is set by calling super().
+ super();
+ setType(type);
+ }
+
+ /**
+ * Creates a new presence with the given type and using the given XMPP address as recipient.
+ *
+ * @param to the recipient.
+ * @param type the type.
+ * @since 4.2
+ * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public Presence(Jid to, Type type) {
+ this(type);
+ setTo(to);
+ }
+
+ /**
+ * Creates a new presence update with a specified status, priority, and mode.
+ *
+ * @param type the type.
+ * @param status a text message describing the presence update.
+ * @param priority the priority of this presence update.
+ * @param mode the mode type for this presence update.
+ * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public Presence(Type type, String status, int priority, Mode mode) {
+ // Ensure that the stanza ID is set by calling super().
+ super();
+ setType(type);
+ setStatus(status);
+ setPriority(priority);
+ setMode(mode);
+ }
+
Presence(PresenceBuilder presenceBuilder) {
super(presenceBuilder);
type = presenceBuilder.type;
@@ -134,11 +186,36 @@ public final class Presence extends MessageOrPresence
return type;
}
+ /**
+ * Sets the type of the presence packet.
+ *
+ * @param type the type of the presence packet.
+ * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public void setType(Type type) {
+ this.type = Objects.requireNonNull(type, "Type cannot be null");
+ }
+
@Override
public String getStatus() {
return status;
}
+ /**
+ * Sets the status message of the presence update. The status is free-form text
+ * describing a user's presence (i.e., "gone to lunch").
+ *
+ * @param status the status message.
+ * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
@Override
public int getPriority() {
return getPriorityByte();
@@ -156,11 +233,20 @@ public final class Presence extends MessageOrPresence
* Sets the priority of the presence. The valid range is -128 through 127.
*
* @param priority the priority of the presence.
+ * @throws IllegalArgumentException if the priority is outside the valid range.
* @see RFC 6121 § 4.7.2.3. Priority Element
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
- // TODO: Remove in Smack 4.6.
+ // TODO: Remove in Smack 4.5.
+ public void setPriority(int priority) {
+ if (priority < -128 || priority > 127) {
+ throw new IllegalArgumentException("Priority value " + priority +
+ " is not valid. Valid range is -128 through 127.");
+ }
+ setPriority((byte) priority);
+ }
+
public void setPriority(byte priority) {
this.priority = priority;
}
@@ -173,6 +259,19 @@ public final class Presence extends MessageOrPresence
return mode;
}
+ /**
+ * Sets the mode of the presence update. A null presence mode value is interpreted
+ * to be the same thing as {@link Presence.Mode#available}.
+ *
+ * @param mode the mode.
+ * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public void setMode(Mode mode) {
+ this.mode = mode;
+ }
+
@Override
public String getElementName() {
return ELEMENT;
@@ -247,6 +346,37 @@ public final class Presence extends MessageOrPresence
return buf;
}
+ /**
+ * Creates and returns a copy of this presence stanza.
+ *
+ * This does not perform a deep clone, as extension elements are shared between the new and old
+ * instance.
+ *
+ * @return a clone of this presence.
+ * @deprecated use {@link #asBuilder()} instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ @Override
+ public Presence clone() {
+ return new Presence(this);
+ }
+
+ /**
+ * Clone this presence and set a newly generated stanza ID as the clone's ID.
+ *
+ * @return a "clone" of this presence with a different stanza ID.
+ * @since 4.1.2
+ * @deprecated use {@link #asBuilder(XMPPConnection)} or {@link #asBuilder(String)}instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ public Presence cloneWithNewId() {
+ Presence clone = clone();
+ clone.setNewStanzaId();
+ return clone;
+ }
+
/**
* An enum to represent the presence type. Note that presence type is often confused
* with presence mode. Generally, if a user is signed in to a server, they have a presence
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java
index 7e6331bb8..48e0330c6 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java
@@ -39,7 +39,6 @@ public class Session extends SimpleIQ {
public static final String ELEMENT = "session";
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-session";
- @SuppressWarnings("this-escape")
public Session() {
super(ELEMENT, NAMESPACE);
setType(IQ.Type.set);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java
index 9f1959460..8ae1f5a7a 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2015-2024 Florian Schmaus.
+ * Copyright 2015-2021 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,9 @@ public final class StandardExtensionElement implements XmlElement {
/**
* Constructs a new extension element with the given name and namespace and nothing else.
+ *
* This is meant to construct extension elements used as simple flags in Stanzas.
+ *
*
* @param name the name of the extension element.
* @param namespace the namespace of the extension element.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
index 88c30bbfa..7123e82f8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
@@ -98,7 +98,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
protected Stanza(StanzaBuilder> stanzaBuilder) {
if (stanzaBuilder.stanzaIdSource != null) {
id = stanzaBuilder.stanzaIdSource.getNewStanzaId();
- // Note that some stanza ID sources, e.g. StanzaBuilder.PresenceBuilder.EMPTY return null here. Hence, we
+ // Note that some stanza ID sources, e.g. StanzaBuilder.PresenceBuilder.EMPTY return null here. Hence we
// only check that the returned string is not empty.
assert StringUtils.isNullOrNotEmpty(id);
usedStanzaIdSource = stanzaBuilder.stanzaIdSource;
@@ -159,6 +159,22 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
return id != null;
}
+ /**
+ * Set the stanza id if none is set.
+ *
+ * @return the stanza id.
+ * @since 4.2
+ * @deprecated use {@link StanzaBuilder} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public String setStanzaId() {
+ if (!hasStanzaIdSet()) {
+ setNewStanzaId();
+ }
+ return getStanzaId();
+ }
+
/**
* Throws an {@link IllegalArgumentException} if this stanza has no stanza ID set.
*
@@ -203,7 +219,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
* @param to who the packet is being sent to.
*/
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
- public final void setTo(Jid to) {
+ public void setTo(Jid to) {
this.to = to;
}
@@ -239,11 +255,34 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
error = stanzaError;
}
+ /**
+ * Deprecated.
+ * @param stanzaError the stanza error.
+ * @deprecated use {@link StanzaBuilder} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public void setError(StanzaError.Builder stanzaError) {
+ setError(stanzaError.build());
+ }
+
@Override
public final String getLanguage() {
return language;
}
+ /**
+ * Sets the xml:lang of this Stanza.
+ *
+ * @param language the xml:lang of this Stanza.
+ * @deprecated use {@link StanzaBuilder#setLanguage(String)} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
@Override
public final List getExtensions() {
synchronized (extensionElements) {
@@ -335,6 +374,22 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
return packetExtension;
}
+ /**
+ * This method is deprecated. Use preferably {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)}.
+ *
+ * @param the type to cast to.
+ * @param elementName the XML element name of the extension. (May be null)
+ * @param namespace the XML element namespace of the extension.
+ * @return the extension, or null
if it doesn't exist.
+ * @deprecated use {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)} instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @SuppressWarnings("unchecked")
+ @Deprecated
+ public final E getExtension(String elementName, String namespace) {
+ return (E) getExtensionElement(elementName, namespace);
+ }
+
@Override
public final XmlElement getExtension(QName qname) {
synchronized (extensionElements) {
@@ -446,6 +501,27 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
}
}
+ /**
+ * Removes a stanza extension from the packet.
+ *
+ * @param extension the stanza extension to remove.
+ * @return the removed stanza extension or null.
+ * @deprecated use {@link StanzaBuilder} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public final XmlElement removeExtension(XmlElement extension) {
+ QName key = extension.getQName();
+ synchronized (extensionElements) {
+ List list = extensionElements.getAll(key);
+ boolean removed = list.remove(extension);
+ if (removed) {
+ return extension;
+ }
+ }
+ return null;
+ }
+
/**
* Returns a short String describing the Stanza. This method is suited for log purposes.
*/
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaBuilder.java
index 2cc2a20ed..ec8bdac3c 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaBuilder.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaBuilder.java
@@ -87,9 +87,9 @@ public abstract class StanzaBuilder> implements Stanz
}
/**
- * Set the recipient address of the stanza.
+ * Set the recipent address of the stanza.
*
- * @param to whom the stanza is being sent.
+ * @param to whoe the stanza is being sent to.
* @return a reference to this builder.
* @throws XmppStringprepException if the provided character sequence is not a valid XMPP address.
* @see #to(Jid)
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaView.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaView.java
index e435d7159..85c4af1a9 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaView.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaView.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2019-2024 Florian Schmaus
+ * Copyright 2019-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public interface StanzaView extends XmlLangElement {
/**
* Returns who the stanza is being sent "to", or null
if
* the value is not set. The XMPP protocol often makes the "to"
- * attribute optional, so it does not always need to be set.
+ * attribute optional, so it does not always need to be set.
*
* @return who the stanza is being sent to, or null
if the
* value has not been set.
@@ -46,7 +46,7 @@ public interface StanzaView extends XmlLangElement {
/**
* Returns who the stanza is being sent "from" or null
if
* the value is not set. The XMPP protocol often makes the "from"
- * attribute optional, so it does not always need to be set.
+ * attribute optional, so it does not always need to be set.
*
* @return who the stanza is being sent from, or null
if the
* value has not been set.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
index a58599de8..f034be9d3 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
@@ -58,9 +58,9 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
* stream has been authenticated
*
policy-violation | the entity has violated some local service
* policy. |
- * remote-connection-failed | the server is unable to properly connect
+ * |
remote-connection-failed | Rthe server is unable to properly connect
* to a remote entity. |
- * resource-constraint | the server lacks the system resources necessary
+ * |
resource-constraint | Rthe server lacks the system resources necessary
* to service the stream. |
* restricted-xml | the entity has attempted to send restricted XML
* features. |
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java
index 8cd2146f8..e363d2e30 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/UnparsedIQ.java
@@ -16,8 +16,6 @@
*/
package org.jivesoftware.smack.packet;
-import org.jivesoftware.smack.util.StringUtils;
-
/**
* An IQ stanzas that could not be parsed because no provider was found.
*/
@@ -36,12 +34,7 @@ public class UnparsedIQ extends IQ {
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
- if (StringUtils.isEmpty(content)) {
- xml.setEmptyElement();
- } else {
- xml.rightAngleBracket();
- xml.escape(content);
- }
+ xml.escape(content);
return xml;
}
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java
index 2781fe0d9..11da95318 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java
@@ -17,9 +17,9 @@
package org.jivesoftware.smack.provider;
import java.io.InputStream;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -39,11 +39,11 @@ import org.jivesoftware.smack.xml.XmlPullParser;
public class ProviderFileLoader implements ProviderLoader {
private static final Logger LOGGER = Logger.getLogger(ProviderFileLoader.class.getName());
- private final Collection iqProviders = new ArrayList();
- private final Collection extProviders = new ArrayList();
- private final Collection sfProviders = new ArrayList();
+ private final Collection iqProviders = new LinkedList();
+ private final Collection extProviders = new LinkedList();
+ private final Collection sfProviders = new LinkedList();
- private List exceptions = new ArrayList();
+ private List exceptions = new LinkedList();
public ProviderFileLoader(InputStream providerStream) {
this(providerStream, ProviderFileLoader.class.getClassLoader());
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
index b2f08cc3a..0943f31d6 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
@@ -97,7 +97,6 @@ import org.jivesoftware.smack.util.XmppElementUtil;
* </extensionProvider>
* </smackProviders>
*
- *
* If multiple provider entries attempt to register to handle the same element name and namespace,
* the first entry loaded from the classpath will take precedence. Whenever a stanza extension
* is found in a packet, parsing will be passed to the correct provider. Each provider
@@ -107,8 +106,7 @@ import org.jivesoftware.smack.util.XmppElementUtil;
* set the properties of th class using the values in the stanza extension sub-element. When an
* extension provider is not registered for an element name and namespace combination, Smack will
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
- * attach it to the packet.
- *
+ * attach it to the packet.
*
* @author Matt Tucker
*/
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java
index 21fafdfcb..5e40c5639 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/package-info.java
@@ -16,7 +16,7 @@
*/
/**
- * The Smack provider architecture is a system for plugging in custom XML parsing of stanza extensions
+ * The Smack provider architecture is a system for plugging in custom XML parsing of staza extensions
* ({@link org.jivesoftware.smack.packet.ExtensionElement}, {@link org.jivesoftware.smack.packet.IQ} stanzas and
* {@link org.jivesoftware.smack.packet.Nonza}. Hence, there are the the following providers:
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
index bdf0cf390..549406423 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
@@ -23,7 +23,6 @@ import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
-import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -59,7 +58,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
proxyLine = "\r\nProxy-Authorization: Basic " + Base64.encode(username + ":" + password);
}
socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: "
- + host + ":" + port + proxyLine + "\r\n\r\n").getBytes(StandardCharsets.UTF_8));
+ + host + ":" + port + proxyLine + "\r\n\r\n").getBytes("UTF-8"));
InputStream in = socket.getInputStream();
StringBuilder got = new StringBuilder(100);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
index 90433c5c8..402a106a4 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
@@ -41,7 +41,6 @@ public class ProxyInfo {
private ProxyType proxyType;
private final ProxySocketConnection proxySocketConnection;
- @SuppressWarnings("this-escape")
public ProxyInfo(ProxyType pType, String pHost, int pPort, String pUser,
String pPass) {
this.proxyType = pType;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
index 24330a6ac..f1c00ef19 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
@@ -358,7 +358,7 @@ public abstract class SASLMechanism implements Comparable {
* SASLprep the given String. The resulting String is in UTF-8.
*
* @param string the String to sasl prep.
- * @return the given String SASL prepped
+ * @return the given String SASL preped
* @see RFC 4013 - SASLprep: Stringprep Profile for User Names and Passwords
*/
protected static String saslPrep(String string) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java
index 6dc482ce3..8f4133c81 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java
@@ -271,7 +271,6 @@ public abstract class ScramMechanism extends SASLMechanism {
return null;
}
- @SuppressWarnings("MixedMutabilityReturnType")
private static Map parseAttributes(String string) throws SmackSaslException {
if (string.length() == 0) {
return Collections.emptyMap();
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/CollectionUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/CollectionUtil.java
index c3566c6c0..408e00bfd 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/CollectionUtil.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/CollectionUtil.java
@@ -55,7 +55,6 @@ public class CollectionUtil {
boolean test(T t);
}
- @SuppressWarnings("NonApiType")
public static ArrayList newListWith(Collection extends T> collection) {
if (collection == null) {
return null;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java
index 6e0ded134..752fda1cf 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2014-2023 Florian Schmaus
+ * Copyright 2014-2019 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,12 +24,10 @@ public class LazyStringBuilder implements Appendable, CharSequence {
private final List list;
- private transient String cache;
- private int cachedLength = -1;
+ private String cache;
private void invalidateCache() {
cache = null;
- cachedLength = -1;
}
public LazyStringBuilder() {
@@ -67,10 +65,9 @@ public class LazyStringBuilder implements Appendable, CharSequence {
@Override
public int length() {
- if (cachedLength >= 0) {
- return cachedLength;
+ if (cache != null) {
+ return cache.length();
}
-
int length = 0;
try {
for (CharSequence csq : list) {
@@ -81,8 +78,6 @@ public class LazyStringBuilder implements Appendable, CharSequence {
StringBuilder sb = safeToStringBuilder();
throw new RuntimeException("The following LazyStringBuilder threw a NullPointerException: " + sb, npe);
}
-
- cachedLength = length;
return length;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/MAC.java b/smack-core/src/main/java/org/jivesoftware/smack/util/MAC.java
index df177204e..4d78d24f8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/MAC.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/MAC.java
@@ -33,7 +33,7 @@ public class MAC {
HMAC_SHA1 = Mac.getInstance(HMACSHA1);
}
catch (NoSuchAlgorithmException e) {
- // Smack won't be able to function normally if this exception is thrown, wrap it into
+ // Smack wont be able to function normally if this exception is thrown, wrap it into
// an ISE and make the user aware of the problem.
throw new IllegalStateException(e);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/MD5.java b/smack-core/src/main/java/org/jivesoftware/smack/util/MD5.java
index d81c4de5a..26c0547fd 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/MD5.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/MD5.java
@@ -31,7 +31,7 @@ public class MD5 {
MD5_DIGEST = MessageDigest.getInstance(StringUtils.MD5);
}
catch (NoSuchAlgorithmException e) {
- // Smack won't be able to function normally if this exception is thrown, wrap it into
+ // Smack wont be able to function normally if this exception is thrown, wrap it into
// an ISE and make the user aware of the problem.
throw new IllegalStateException(e);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java b/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java
index 7e9889e57..852e01bf7 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2015-2024 Florian Schmaus
+ * Copyright © 2015-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -184,14 +184,13 @@ public class MultiMap {
}
/**
- * Remove the given number of values for a given key. May return less values than requested.
+ * Remove the given number of values for a given key. May return less values then requested.
*
* @param key the key to remove from.
* @param num the number of values to remove.
* @return a list of the removed values.
* @since 4.4.0
*/
- @SuppressWarnings("MixedMutabilityReturnType")
public List remove(K key, int num) {
List values = map.get(key);
if (values == null) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java
index 836796248..98635309d 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2015-2024 Florian Schmaus
+ * Copyright © 2015-2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,18 @@ package org.jivesoftware.smack.util;
public class NumberUtil {
+ /**
+ * Checks if the given long is within the range of an unsigned 32-bit integer, the XML type "xs:unsignedInt".
+ *
+ * @param value TODO javadoc me please
+ * @deprecated use {@link #requireUInt32(long)} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public static void checkIfInUInt32Range(long value) {
+ requireUInt32(value);
+ }
+
/**
* Checks if the given long is within the range of an unsigned 32-bit integer, the XML type "xs:unsignedInt".
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
index 69f0aaca2..042402299 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2003-2007 Jive Software, 2019-2024 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2019-2023 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@@ -86,7 +87,7 @@ public class PacketParserUtils {
return parser;
}
- @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
+ @SuppressWarnings("unchecked")
public static S parseStanza(String stanza) throws XmlPullParserException, SmackParsingException, IOException {
return (S) parseStanza(getParserFor(stanza), XmlEnvironment.EMPTY);
}
@@ -229,7 +230,7 @@ public class PacketParserUtils {
// Assume this is the end tag of the start tag at the
// beginning of this method. Typical examples where this
// happens are body elements containing the empty string,
- // i.e. , which appears to be valid XMPP, or a
+ // ie. , which appears to be valid XMPP, or a
// least it's not explicitly forbidden by RFC 6121 5.2.3
return "";
} else {
@@ -643,7 +644,7 @@ public class PacketParserUtils {
assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
String name;
final int initialDepth = parser.getDepth();
- List methods = new ArrayList<>();
+ List methods = new LinkedList<>();
outerloop: while (true) {
XmlPullParser.Event eventType = parser.next();
switch (eventType) {
@@ -849,7 +850,7 @@ public class PacketParserUtils {
throws XmlPullParserException, IOException {
ParserUtils.assertAtStartTag(parser);
assert parser.getNamespace().equals(StartTls.NAMESPACE);
- int initialDepth = parser.getDepth();
+ int initalDepth = parser.getDepth();
boolean required = false;
outerloop: while (true) {
XmlPullParser.Event event = parser.next();
@@ -863,7 +864,7 @@ public class PacketParserUtils {
}
break;
case END_ELEMENT:
- if (parser.getDepth() == initialDepth) {
+ if (parser.getDepth() == initalDepth) {
break outerloop;
}
break;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java
index 40da6f4d6..a68e91dd0 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2014-2024 Florian Schmaus
+ * Copyright © 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ public class PacketUtil {
*
* @return the extension element
*/
- @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
+ @SuppressWarnings("unchecked")
public static PE extensionElementFrom(Collection collection,
String element, String namespace) {
for (XmlElement packetExtension : collection) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/Pair.java b/smack-core/src/main/java/org/jivesoftware/smack/util/Pair.java
index 13e65e881..08bf41234 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/Pair.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/Pair.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2020-2024 Florian Schmaus.
+ * Copyright 2020 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +26,11 @@ public final class Pair {
this.second = second;
}
- public static Pair create(F first, S second) {
+ public static Pair create(F first, S second) {
return new Pair<>(first, second);
}
- @SuppressWarnings("ReturnValueIgnored")
- public static Pair createAndInitHashCode(F first, S second) {
+ public static Pair createAndInitHashCode(F first, S second) {
Pair pair = new Pair<>(first, second);
pair.hashCode();
return pair;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
index 7c58f8a12..64c18a7fb 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2014-2024 Florian Schmaus
+ * Copyright © 2014-2023 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ import java.text.ParseException;
import java.util.Date;
import java.util.Locale;
+import javax.xml.namespace.QName;
+
import org.jivesoftware.smack.datatypes.UInt16;
import org.jivesoftware.smack.datatypes.UInt32;
import org.jivesoftware.smack.packet.XmlEnvironment;
@@ -144,7 +146,7 @@ public class ParserUtils {
}
/**
- * Phrase a string to a boolean value as per "xs:boolean". Valid input strings are "true", "1" for true, and "false", "0" for false.
+ * Prase a string to a boolean value as per "xs:boolean". Valid input strings are "true", "1" for true, and "false", "0" for false.
*
* @param booleanString the input string.
* @return the boolean representation of the input string
@@ -365,6 +367,19 @@ public class ParserUtils {
return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
}
+ /**
+ * Get the QName of the current element.
+ *
+ * @param parser the parser.
+ * @return the Qname.
+ * @deprecated use {@link XmlPullParser#getQName()} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5
+ public static QName getQName(XmlPullParser parser) {
+ return parser.getQName();
+ }
+
public static InternetAddress getInternetAddressIngoringZoneIdAttribute(XmlPullParser parser, String attribute) {
String inetAddressString = parser.getAttributeValue(attribute);
if (inetAddressString == null) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/SHA1.java b/smack-core/src/main/java/org/jivesoftware/smack/util/SHA1.java
index 3c7d53ac4..89144530b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/SHA1.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/SHA1.java
@@ -31,7 +31,7 @@ public class SHA1 {
SHA1_DIGEST = MessageDigest.getInstance(StringUtils.SHA1);
}
catch (NoSuchAlgorithmException e) {
- // Smack won't be able to function normally if this exception is thrown, wrap it into
+ // Smack wont be able to function normally if this exception is thrown, wrap it into
// an ISE and make the user aware of the problem.
throw new IllegalStateException(e);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/SecurityUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/SecurityUtil.java
index c796ab23e..3521279df 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/SecurityUtil.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/SecurityUtil.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2019-2024 Florian Schmaus.
+ * Copyright 2019 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@ public class SecurityUtil {
private static final LruCache, Void> INSERTED_PROVIDERS_CACHE = new LruCache<>(8);
- @SuppressWarnings("LockOnNonEnclosingClassLiteral")
public static void ensureProviderAtFirstPosition(Class extends Provider> providerClass) {
if (INSERTED_PROVIDERS_CACHE.containsKey(providerClass)) {
return;
@@ -42,7 +41,7 @@ public class SecurityUtil {
String providerName = provider.getName();
- int installedPosition;
+ int installedPosition ;
synchronized (Security.class) {
Security.removeProvider(providerName);
installedPosition = Security.insertProviderAt(provider, 1);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
index 83c9f40bb..5ebe4c116 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2003-2007 Jive Software, 2016-2024 Florian Schmaus.
+ * Copyright 2003-2007 Jive Software, 2016-2021 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,24 @@ public class StringUtils {
public static final String MD5 = "MD5";
public static final String SHA1 = "SHA-1";
+ /**
+ * Deprecated, do not use.
+ *
+ * @deprecated use StandardCharsets.UTF_8 instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ public static final String UTF8 = "UTF-8";
+
+ /**
+ * Deprecated, do not use.
+ *
+ * @deprecated use StandardCharsets.US_ASCII instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ public static final String USASCII = "US-ASCII";
+
public static final String QUOTE_ENCODE = """;
public static final String APOS_ENCODE = "'";
public static final String AMP_ENCODE = "&";
@@ -325,14 +343,11 @@ public class StringUtils {
try {
randomString(charBuffer, random, alphabet, numRandomChars);
} catch (IOException e) {
- // This should never happen if we calculate the buffer size correctly.
+ // This should never happen if we calcuate the buffer size correctly.
throw new AssertionError(e);
}
- // Workaround for Android API not matching Java >=9 API.
- // See https://issuetracker.google.com/issues/369219141
- ((java.nio.Buffer) charBuffer).flip();
- return charBuffer.toString();
+ return charBuffer.flip().toString();
}
private static void randomString(Appendable appendable, Random random, char[] alphabet, int numRandomChars)
@@ -464,7 +479,7 @@ public class StringUtils {
appendTo(collection, ", ", sb);
}
- public static void appendTo(Collection collection, StringBuilder sb,
+ public static void appendTo(Collection collection, StringBuilder sb,
Consumer appendFunction) {
appendTo(collection, ", ", sb, appendFunction);
}
@@ -473,7 +488,7 @@ public class StringUtils {
appendTo(collection, delimiter, sb, o -> sb.append(o));
}
- public static void appendTo(Collection collection, String delimiter, StringBuilder sb,
+ public static void appendTo(Collection collection, String delimiter, StringBuilder sb,
Consumer appendFunction) {
for (Iterator it = collection.iterator(); it.hasNext();) {
O cs = it.next();
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/TLSUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/TLSUtils.java
index 47469f721..c1af8ba61 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/TLSUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/TLSUtils.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2014-2024 Florian Schmaus
+ * Copyright 2014-2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,6 +68,52 @@ public class TLSUtils {
return builder;
}
+ /**
+ * Enable only TLS. Connections created with the given ConnectionConfiguration will only support TLS.
+ *
+ * According to the Encrypted
+ * XMPP Manifesto, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
+ * TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
+ * This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
+ *
+ *
+ * @param builder the configuration builder to apply this setting to
+ * @param Type of the ConnectionConfiguration builder.
+ *
+ * @return the given builder
+ * @deprecated use {@link #setEnabledTlsProtocolsToRecommended(org.jivesoftware.smack.ConnectionConfiguration.Builder)} instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ public static > B setTLSOnly(B builder) {
+ builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1 });
+ return builder;
+ }
+
+ /**
+ * Enable only TLS and SSLv3. Connections created with the given ConnectionConfiguration will
+ * only support TLS and SSLv3.
+ *
+ * According to the Encrypted
+ * XMPP Manifesto, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
+ * TLSv1.1.
+ *
+ *
+ * @param builder the configuration builder to apply this setting to
+ * @param Type of the ConnectionConfiguration builder.
+ *
+ * @return the given builder
+ * @deprecated use {@link #setEnabledTlsProtocolsToRecommended(org.jivesoftware.smack.ConnectionConfiguration.Builder)} instead.
+ */
+ // TODO: Remove in Smack 4.5.
+ @Deprecated
+ public static > B setSSLv3AndTLSOnly(B builder) {
+ builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1, PROTO_SSL3 });
+ return builder;
+ }
+
/**
* Accept all TLS certificates.
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
index 5c327157b..21b192b4c 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2014-2024 Florian Schmaus
+ * Copyright 2014-2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
-import org.jxmpp.jid.Jid;
import org.jxmpp.util.XmppDateTime;
public class XmlStringBuilder implements Appendable, CharSequence, Element {
@@ -47,7 +46,6 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
this(pe, null);
}
- @SuppressWarnings("this-escape")
public XmlStringBuilder(NamedElement e) {
this();
halfOpenElement(e.getElementName());
@@ -57,7 +55,6 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
this(element.getElementName(), element.getNamespace(), element.getLanguage(), enclosingXmlEnvironment);
}
- @SuppressWarnings("this-escape")
public XmlStringBuilder(String elementName, String xmlNs, String xmlLang, XmlEnvironment enclosingXmlEnvironment) {
sb = new LazyStringBuilder();
halfOpenElement(elementName);
@@ -140,6 +137,20 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
return this;
}
+ /**
+ * Deprecated.
+ *
+ * @param element deprecated.
+ * @return deprecated.
+ * @deprecated use {@link #append(Element)} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public XmlStringBuilder element(Element element) {
+ assert element != null;
+ return append(element.toXML());
+ }
+
public XmlStringBuilder optElement(String name, String content) {
if (content != null) {
element(name, content);
@@ -300,18 +311,6 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
return attribute(name, String.valueOf(value));
}
- public XmlStringBuilder jidAttribute(Jid jid) {
- assert jid != null;
- return attribute("jid", jid);
- }
-
- public XmlStringBuilder optJidAttribute(Jid jid) {
- if (jid != null) {
- attribute("jid", jid);
- }
- return this;
- }
-
public XmlStringBuilder optAttribute(String name, String value) {
if (value != null) {
attribute(name, value);
@@ -594,49 +593,10 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
return this;
}
- enum AppendApproach {
- /**
- * Simply add the given CharSequence to this builder.
- */
- SINGLE,
-
- /**
- * If the given CharSequence is a {@link XmlStringBuilder} or {@link LazyStringBuilder}, then copy the
- * references of the lazy strings parts into this builder. This approach flattens the string builders into one,
- * yielding a different performance characteristic.
- */
- FLAT,
- }
-
- private static AppendApproach APPEND_APPROACH = AppendApproach.SINGLE;
-
- /**
- * Set the builders approach on how to append new char sequences.
- *
- * @param appendApproach the append approach.
- */
- public static void setAppendMethod(AppendApproach appendApproach) {
- Objects.requireNonNull(appendApproach);
- APPEND_APPROACH = appendApproach;
- }
-
@Override
public XmlStringBuilder append(CharSequence csq) {
assert csq != null;
- switch (APPEND_APPROACH) {
- case SINGLE:
- sb.append(csq);
- break;
- case FLAT:
- if (csq instanceof XmlStringBuilder) {
- sb.append(((XmlStringBuilder) csq).sb);
- } else if (csq instanceof LazyStringBuilder) {
- sb.append((LazyStringBuilder) csq);
- } else {
- sb.append(csq);
- }
- break;
- }
+ sb.append(csq);
return this;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java
index 7ffe2f2eb..5639a7e5f 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmppElementUtil.java
@@ -71,7 +71,6 @@ public class XmppElementUtil {
return qname;
}
- @SuppressWarnings("MixedMutabilityReturnType")
public static List getElementsFrom(
MultiMap elementMap, Class extensionElementClass) {
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/dns/package-info.java b/smack-core/src/main/java/org/jivesoftware/smack/util/dns/package-info.java
index 1fb7e9b3b..f06cdab84 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/dns/package-info.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/dns/package-info.java
@@ -61,8 +61,8 @@
*
* Best Practices
*
- * We recommend that applications using Smack's DNSSEC API do not ask the user if DNSSEC is available. Instead they
- * should check for DNSSEC support on every connection attempt. Once DNSSEC support has been discovered, the application
+ * We recommend that applications using Smack's DNSSEC API do not ask the user if DNSSEC is avaialble. Instead they
+ * should check for DNSSEC suport on every connection attempt. Once DNSSEC support has been discovered, the application
* should use the `needsDnssec` mode for all future connection attempts. The same scheme can be applied when using DANE.
* This approach is similar to the scheme established by to HTTP Strict
* Transport Security" (HSTS, RFC 6797.
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java
index 2101daca4..b8f192bd7 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/IqTest.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2023-2024 Florian Schmaus
+ * Copyright © 2023 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,7 @@ package org.jivesoftware.smack.packet;
import static org.jivesoftware.smack.test.util.XmlAssertUtil.assertXmlSimilar;
-import org.jivesoftware.smack.test.util.SmackTestUtil;
-import org.jivesoftware.smack.util.PacketParserUtils;
-import org.jivesoftware.smack.xml.XmlPullParser;
-
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.EnumSource;
public class IqTest {
@@ -41,36 +35,4 @@ public class IqTest {
assertXmlSimilar(expected, errorIq.toXML());
}
- @ParameterizedTest
- @EnumSource(SmackTestUtil.XmlPullParserKind.class)
- public void testIqWithXmlns(SmackTestUtil.XmlPullParserKind parserKind) throws Exception {
- final String iqXml = "" +
- "" +
- "foo@tigase.mydomain.org/myresource" +
- "" +
- "";
- final String xml =
- "" +
- iqXml +
- "";
-
- XmlPullParser parser = SmackTestUtil.getParserFor(xml, "iq", parserKind);
- IQ iq = PacketParserUtils.parseIQ(parser);
- assertXmlSimilar(iqXml, iq.toXML());
- }
-
- @ParameterizedTest
- @EnumSource(SmackTestUtil.XmlPullParserKind.class)
- public void testUnparsedIq(SmackTestUtil.XmlPullParserKind parserKind) throws Exception {
- final String iqXml = "" +
- "" +
- "";
- final String expected = ""
- + "<query xmlns='jabber:iq:version'/>"
- + "";
-
- XmlPullParser parser = SmackTestUtil.getParserFor(iqXml, "iq", parserKind);
- IQ iq = PacketParserUtils.parseIQ(parser);
- assertXmlSimilar(expected, iq.toXML());
- }
}
diff --git a/smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java
index 320bb1f9e..7e105d58b 100644
--- a/smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java
+++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2010 Jive Software, 2022-2024 Florian Schmaus.
+ * Copyright 2010 Jive Software, 2022 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,9 +39,9 @@ import org.jxmpp.stringprep.XmppStringprepException;
* A dummy implementation of {@link XMPPConnection}, intended to be used during
* unit tests.
*
- * Instances store any packets that are delivered to be sent using the
+ * Instances store any packets that are delivered to be send using the
* {@link #sendStanza(Stanza)} method in a blocking queue. The content of this queue
- * can be inspected using {@link #getSentPacket()}. Typically, these queues are
+ * can be inspected using {@link #getSentPacket()}. Typically these queues are
* used to retrieve a message that was generated by the client.
*
* Packets that should be processed by the client to simulate a received stanza
@@ -82,7 +82,6 @@ public class DummyConnection extends AbstractXMPPConnection {
}
}
- @SuppressWarnings("this-escape")
public DummyConnection(DummyConnectionConfiguration configuration) {
super(configuration);
@@ -92,7 +91,6 @@ public class DummyConnection extends AbstractXMPPConnection {
user = getUserJid();
}
- @SuppressWarnings("JavaUtilDate")
@Override
protected void connectInternal() {
connected = true;
@@ -164,7 +162,6 @@ public class DummyConnection extends AbstractXMPPConnection {
* @param
the top level stream element class.
* @return a sent packet.
*/
- @SuppressWarnings("TypeParameterUnusedInFormals")
public
P getSentPacket() {
return getSentPacket(5 * 60);
}
@@ -179,7 +176,7 @@ public class DummyConnection extends AbstractXMPPConnection {
* @param
the top level stream element class.
* @return a sent packet.
*/
- @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
+ @SuppressWarnings("unchecked")
public
P getSentPacket(int wait) {
try {
return (P) queue.poll(wait, TimeUnit.SECONDS);
diff --git a/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
index 1eccfd75a..6746e8f13 100644
--- a/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
+++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
@@ -41,7 +41,7 @@ import org.jxmpp.stringprep.XmppStringprepException;
* Note that this test is based on the assumption that it is possible to trigger a full garbage collection run, which is
* not the case. See also this
* stackoverflow
- * question. Hence, the {@link #triggerGarbageCollection()} method defined in this class is not portable and depends
+ * question. Hence the {@link #triggerGarbageCollection()} method defined in this class is not portable and depends
* on implementation depended Java Virtual Machine behavior.
*
*
diff --git a/smack-debug-slf4j/build.gradle b/smack-debug-slf4j/build.gradle
index 71eae05b4..9c2272729 100644
--- a/smack-debug-slf4j/build.gradle
+++ b/smack-debug-slf4j/build.gradle
@@ -1,7 +1,3 @@
-plugins {
- id 'org.igniterealtime.smack.java-common-conventions'
-}
-
description = """\
Smack slf4j debugger.
Inspect the exchanged XMPP stanzas.
@@ -9,5 +5,5 @@ Connect your favourite slf4j backend of choice to get output inside of it"""
dependencies {
api project(':smack-core')
- implementation 'org.slf4j:slf4j-api:[1.7,2.0)'
+ implementation 'org.slf4j:slf4j-api:[1.7,1.8)'
}
diff --git a/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/package-info.java b/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/package-info.java
index bce3b6064..7ebe86244 120000
--- a/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/package-info.java
+++ b/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/package-info.java
@@ -1 +1 @@
-../../../../../../../smack-java11-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
+../../../../../../../smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
diff --git a/smack-debug/build.gradle b/smack-debug/build.gradle
index 7c9fdc0f1..959caff4f 100644
--- a/smack-debug/build.gradle
+++ b/smack-debug/build.gradle
@@ -1,7 +1,3 @@
-plugins {
- id 'org.igniterealtime.smack.java-common-conventions'
-}
-
description = """\
Smack GUI debugger.
Inspect the exchanged XMPP stanzas."""
diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java
index e57b4aaaa..40d2e5263 100644
--- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java
+++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java
@@ -160,7 +160,6 @@ public class EnhancedDebugger extends SmackDebugger {
private ReaderListener readerListener;
private WriterListener writerListener;
- @SuppressWarnings("JavaUtilDate")
private Date creationTime = new Date();
// Statistics variables
@@ -178,7 +177,6 @@ public class EnhancedDebugger extends SmackDebugger {
JTabbedPane tabbedPane;
- @SuppressWarnings("this-escape")
public EnhancedDebugger(XMPPConnection connection) {
super(connection);
@@ -758,7 +756,6 @@ public class EnhancedDebugger extends SmackDebugger {
* @param dateFormatter the SimpleDateFormat to use to format Dates
* @param packet the read stanza to add to the table
*/
- @SuppressWarnings("JavaUtilDate")
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
SwingUtilities.invokeLater(new Runnable() {
@Override
@@ -830,7 +827,6 @@ public class EnhancedDebugger extends SmackDebugger {
* @param dateFormatter the SimpleDateFormat to use to format Dates
* @param packet the sent stanza to add to the table
*/
- @SuppressWarnings("JavaUtilDate")
private void addSentPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
SwingUtilities.invokeLater(new Runnable() {
@Override
diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java
index cadcb0b53..5755207d8 100644
--- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java
+++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java
@@ -204,7 +204,7 @@ public final class EnhancedDebuggerWindow {
* Creates the main debug window that provides information about Smack and also shows
* a tab panel for each connection that is being debugged.
*/
- @SuppressWarnings({ "rawtypes", "unchecked", "JdkObsolete" })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
private void createDebug() {
frame = new JFrame("Smack Debug Window");
diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/package-info.java b/smack-debug/src/main/java/org/jivesoftware/smackx/package-info.java
index bce3b6064..7ebe86244 120000
--- a/smack-debug/src/main/java/org/jivesoftware/smackx/package-info.java
+++ b/smack-debug/src/main/java/org/jivesoftware/smackx/package-info.java
@@ -1 +1 @@
-../../../../../../../smack-java11-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
+../../../../../../../smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java
\ No newline at end of file
diff --git a/smack-examples/build.gradle b/smack-examples/build.gradle
deleted file mode 100644
index 244040dd7..000000000
--- a/smack-examples/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-plugins {
- id 'org.igniterealtime.smack.java-common-conventions'
-}
-
-description = """\
-Examples and test applications for Smack"""
-
-dependencies {
- // Smack's integration test framework (sintest) depends on
- // smack-java*-full and since we may want to use parts of sinttest
- // in smack-examples, we simply depend sinttest.
- api project(':smack-integration-test')
- api project(':smack-omemo-signal')
-}
diff --git a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmlStringBuilderTest.java b/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmlStringBuilderTest.java
deleted file mode 100644
index b02e5cf81..000000000
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmlStringBuilderTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- *
- * Copyright 2023 Florian Schmaus
- *
- * This file is part of smack-examples.
- *
- * smack-examples is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.igniterealtime.smack.examples;
-
-import java.util.function.Supplier;
-
-import org.jivesoftware.smack.util.XmlStringBuilder;
-
-public class XmlStringBuilderTest {
- static int COUNT_OUTER = 500;
- static int COUNT_INNER = 50;
-
- public static void main(String[] args) throws Exception {
- test1();
- test2();
- test3();
- }
-
- public static void test1() throws Exception {
- // CHECKSTYLE:OFF
- System.out.println("Test 1");
- // CHECKSTYLE:ON
- XmlStringBuilder parent = new XmlStringBuilder();
- XmlStringBuilder child = new XmlStringBuilder();
- XmlStringBuilder child2 = new XmlStringBuilder();
-
- for (int i = 1; i < COUNT_OUTER; i++) {
- XmlStringBuilder cs = new XmlStringBuilder();
- for (int j = 0; j < COUNT_INNER; j++) {
- cs.append("abc");
- }
- child2.append((CharSequence) cs);
- }
-
- child.append((CharSequence) child2);
- parent.append((CharSequence) child);
-
- time("test1: parent", () -> "len=" + parent.toString().length());
- time("test1: child", () -> "len=" + child.toString().length());
- time("test1: child2", () -> "len=" + child2.toString().length());
- }
-
- public static void test2() throws Exception {
- // CHECKSTYLE:OFF
- System.out.println("Test 2: evaluate children first");
- // CHECKSTYLE:ON
- XmlStringBuilder parent = new XmlStringBuilder();
- XmlStringBuilder child = new XmlStringBuilder();
- XmlStringBuilder child2 = new XmlStringBuilder();
-
- for (int i = 1; i < COUNT_OUTER; i++) {
- XmlStringBuilder cs = new XmlStringBuilder();
- for (int j = 0; j < COUNT_INNER; j++) {
- cs.append("abc");
- }
- child2.append((CharSequence) cs);
- }
-
- child.append((CharSequence) child2);
- parent.append((CharSequence) child);
-
- time("test2: child2", () -> "len=" + child2.toString().length());
- time("test2: child", () -> "len=" + child.toString().length());
- time("test2: parent", () -> "len=" + parent.toString().length());
- }
-
- public static void test3() throws Exception {
- // CHECKSTYLE:OFF
- System.out.println("Test 3: use append(XmlStringBuilder)");
- // CHECKSTYLE:ON
- XmlStringBuilder parent = new XmlStringBuilder();
- XmlStringBuilder child = new XmlStringBuilder();
- XmlStringBuilder child2 = new XmlStringBuilder();
-
- for (int i = 1; i < COUNT_OUTER; i++) {
- XmlStringBuilder cs = new XmlStringBuilder();
- for (int j = 0; j < COUNT_INNER; j++) {
- cs.append("abc");
- }
- child2.append(cs);
- }
-
- child.append(child2);
- parent.append(child);
-
- time("test3: parent", () -> "len=" + parent.toString().length());
- time("test3: child", () -> "len=" + child.toString().length());
- time("test3: child2", () -> "len=" + child2.toString().length());
- }
-
- static void time(String name, Supplier block) {
- long start = System.currentTimeMillis();
- String result = block.get();
- long end = System.currentTimeMillis();
-
- // CHECKSTYLE:OFF
- System.out.println(name + " took " + (end - start) + "ms: " + result);
- // CHECKSTYLE:ONy
- }
-}
diff --git a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppConnectionTool.java b/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppConnectionTool.java
deleted file mode 100644
index c44adb157..000000000
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppConnectionTool.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- *
- * Copyright 2024 Florian Schmaus.
- *
- * This file is part of smack-examples.
- *
- * smack-examples is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.igniterealtime.smack.examples;
-
-import java.io.IOException;
-
-import org.jivesoftware.smack.SmackException;
-import org.jivesoftware.smack.SmackException.NoResponseException;
-import org.jivesoftware.smack.SmackException.NotConnectedException;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.XMPPException.XMPPErrorException;
-import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
-import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration;
-import org.jivesoftware.smack.debugger.ConsoleDebugger;
-import org.jivesoftware.smack.debugger.SmackDebuggerFactory;
-import org.jivesoftware.smackx.omemo.util.OmemoConstants;
-import org.jivesoftware.smackx.pep.PepManager;
-import org.jivesoftware.smackx.pubsub.PubSubManager;
-
-import org.jxmpp.stringprep.XmppStringprepException;
-
-public class XmppConnectionTool {
-
- public final ModularXmppClientToServerConnection connection;
-
- public XmppConnectionTool(ModularXmppClientToServerConnection connection) {
- this.connection = connection;
- }
-
- public boolean purgeOmemoInformation()
- throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
- PepManager pepManager = PepManager.getInstanceFor(connection);
- PubSubManager pepPubSubManager = pepManager.getPepPubSubManager();
-
- // TODO: Also delete "bundles" nodes.
- return pepPubSubManager.deleteNode(OmemoConstants.PEP_NODE_DEVICE_LIST);
- }
-
- public static XmppConnectionTool of(String jid, String password, boolean debug)
- throws XMPPException, SmackException, IOException, InterruptedException {
- ModularXmppClientToServerConnection connection = createConnectionFor(jid, password, debug);
- connection.connect().login();
- return new XmppConnectionTool(connection);
- }
-
- public static ModularXmppClientToServerConnection createConnectionFor(String jid, String password, boolean debug)
- throws XmppStringprepException {
-
- final SmackDebuggerFactory smackDebuggerFactory;
- if (debug) {
- smackDebuggerFactory = ConsoleDebugger.Factory.INSTANCE;
- } else {
- smackDebuggerFactory = null;
- }
-
- ModularXmppClientToServerConnectionConfiguration.Builder configurationBuilder = ModularXmppClientToServerConnectionConfiguration
- .builder().setXmppAddressAndPassword(jid, password).setDebuggerFactory(smackDebuggerFactory);
-
- ModularXmppClientToServerConnectionConfiguration configuration = configurationBuilder.build();
-
- ModularXmppClientToServerConnection connection = new ModularXmppClientToServerConnection(configuration);
- return connection;
- }
-}
diff --git a/smack-examples/src/main/java/org/igniterealtime/smack/examples/package-info.java b/smack-examples/src/main/java/org/igniterealtime/smack/examples/package-info.java
deleted file mode 100644
index ed3cf17e7..000000000
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- *
- * Copyright 2023 Florian Schmaus
- *
- * This file is part of smack-examples.
- *
- * smack-examples is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * Examples and tests for Smack.
- */
-package org.igniterealtime.smack.examples;
diff --git a/smack-examples/src/test/java/org/igniterealtime/smack/examples/SmackExamplesTest.java b/smack-examples/src/test/java/org/igniterealtime/smack/examples/SmackExamplesTest.java
deleted file mode 100644
index 35aa7190d..000000000
--- a/smack-examples/src/test/java/org/igniterealtime/smack/examples/SmackExamplesTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2023 Florian Schmaus
- *
- * This file is part of smack-examples.
- *
- * smack-examples is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.igniterealtime.smack.examples;
-
-import org.junit.jupiter.api.Test;
-
-public class SmackExamplesTest {
- /**
- * Just here to ensure jacoco is not complaining.
- */
- @Test
- public void emptyTest() {
- }
-
-}
diff --git a/smack-experimental/build.gradle b/smack-experimental/build.gradle
index 7484d56f8..9e945e0d5 100644
--- a/smack-experimental/build.gradle
+++ b/smack-experimental/build.gradle
@@ -1,8 +1,3 @@
-plugins {
- id 'org.igniterealtime.smack.java-common-conventions'
- id 'org.igniterealtime.smack.android-conventions'
-}
-
description = """\
Smack experimental extensions.
Classes and methods for XEPs that are in status 'experimental' or that should
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/Carbon.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/Carbon.java
index 77ef518f6..8f303cdff 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/Carbon.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/Carbon.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2014-2024 Florian Schmaus
+ * Copyright © 2014 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ public class Carbon {
public static class Enable extends SimpleIQ {
public static final String ELEMENT = "enable";
- @SuppressWarnings("this-escape")
public Enable() {
super(ELEMENT, NAMESPACE);
setType(Type.set);
@@ -38,7 +37,6 @@ public class Carbon {
public static class Disable extends SimpleIQ {
public static final String ELEMENT = "disable";
- @SuppressWarnings("this-escape")
public Disable() {
super(ELEMENT, NAMESPACE);
setType(Type.set);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/ChatMarkersManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/ChatMarkersManager.java
index 60b125742..b2f99bd76 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/ChatMarkersManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/ChatMarkersManager.java
@@ -174,10 +174,7 @@ public final class ChatMarkersManager extends Manager {
* @throws XMPPErrorException in case an error response was received.
* @throws NoResponseException if no response was received.
* @throws InterruptedException if the connection is interrupted.
- * @deprecated This method serves no purpose, as servers do not announce this feature.
*/
- // TODO: Remove in Smack 4.6.
- @Deprecated
public boolean isSupportedByServer()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection())
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/dox/element/DnsIq.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/dox/element/DnsIq.java
index 590906549..77c626eae 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/dox/element/DnsIq.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/dox/element/DnsIq.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2019-2024 Florian Schmaus
+ * Copyright 2019 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ public class DnsIq extends IQ {
this(new DnsMessage(dnsMessage));
}
- @SuppressWarnings("this-escape")
public DnsIq(DnsMessage dnsQuery, Jid to) {
this(dnsQuery);
setTo(to);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/element/FileMetadataElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/element/FileMetadataElement.java
deleted file mode 100644
index e9f2976bb..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/element/FileMetadataElement.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/**
- *
- * Copyright 2020 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jivesoftware.smackx.file_metadata.element;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jivesoftware.smack.packet.ExtensionElement;
-import org.jivesoftware.smack.packet.XmlEnvironment;
-import org.jivesoftware.smack.util.CollectionUtil;
-import org.jivesoftware.smack.util.EqualsUtil;
-import org.jivesoftware.smack.util.HashCode;
-import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smack.util.XmlStringBuilder;
-import org.jivesoftware.smackx.hashes.HashManager;
-import org.jivesoftware.smackx.hashes.element.HashElement;
-import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;
-
-/**
- * File metadata element as defined in XEP-0446: File Metadata Element.
- * This element is used in a generic way to provide information about files, e.g. during file sharing.
- */
-public final class FileMetadataElement implements ExtensionElement {
-
- public static final String ELEMENT = "file";
- public static final String NAMESPACE = "urn:xmpp:file:metadata:0";
- public static final String ELEM_DATE = "date";
- public static final String ELEM_HEIGHT = "height";
- public static final String ELEM_WIDTH = "width";
- public static final String ELEM_DESC = "desc";
- public static final String ELEM_LENGTH = "length";
- public static final String ELEM_MEDIA_TYPE = "media-type";
- public static final String ELEM_NAME = "name";
- public static final String ELEM_SIZE = "size";
-
-
- private final Date date;
- private final Integer height;
- private final Integer width;
- private final Map descriptions;
- private final Map hashElements;
- private final Long length;
- private final String mediaType;
- private final String name;
- private final Long size;
- private final List thumbnails;
-
- private FileMetadataElement(Date date, Integer height, Integer width, Map descriptions,
- Map hashElements, Long length,
- String mediaType, String name, Long size,
- List thumbnails) {
- this.date = date;
- this.height = height;
- this.width = width;
- this.descriptions = CollectionUtil.cloneAndSeal(descriptions);
- this.hashElements = CollectionUtil.cloneAndSeal(hashElements);
- this.length = length;
- this.mediaType = mediaType;
- this.name = name;
- this.size = size;
- this.thumbnails = CollectionUtil.cloneAndSeal(thumbnails);
- }
-
- @Override
- public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {
- XmlStringBuilder sb = new XmlStringBuilder(this)
- .rightAngleBracket()
- .optElement(ELEM_DATE, date)
- .optElement(ELEM_HEIGHT, height)
- .optElement(ELEM_WIDTH, width);
- for (String key : descriptions.keySet()) {
- sb.halfOpenElement(ELEM_DESC)
- .optXmlLangAttribute(key)
- .rightAngleBracket()
- .append(descriptions.get(key))
- .closeElement(ELEM_DESC);
- }
- sb.append(hashElements.values())
- .optElement(ELEM_LENGTH, length != null ? Long.toString(length) : null)
- .optElement(ELEM_MEDIA_TYPE, mediaType)
- .optElement(ELEM_NAME, name)
- .optElement(ELEM_SIZE, size != null ? Long.toString(size) : null)
- .append(thumbnails);
- return sb.closeElement(this);
- }
-
- @Override
- public String getNamespace() {
- return NAMESPACE;
- }
-
- @Override
- public String getElementName() {
- return ELEMENT;
- }
-
- public Date getDate() {
- return date;
- }
-
- public Integer getHeight() {
- return height;
- }
-
- public Integer getWidth() {
- return width;
- }
-
- public Map getDescriptions() {
- return Collections.unmodifiableMap(descriptions);
- }
-
- public String getDescription() {
- return getDescription(getLanguage());
- }
-
- public String getDescription(String lang) {
- return descriptions.get(lang != null ? lang : "");
- }
-
- public Map getHashElements() {
- return Collections.unmodifiableMap(hashElements);
- }
-
- public HashElement getHashElement(HashManager.ALGORITHM algorithm) {
- return hashElements.get(algorithm);
- }
-
- public Long getLength() {
- return length;
- }
-
- public String getMediaType() {
- return mediaType;
- }
-
- /**
- * Return the name of the file.
- *
- * @return escaped name
- */
- public String getName() {
- if (name == null) {
- return null;
- }
- try {
- return URLEncoder.encode(name, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new AssertionError(e); // UTF-8 MUST be supported
- }
- }
-
- public String getRawName() {
- return name;
- }
-
- public Long getSize() {
- return size;
- }
-
- public List getThumbnails() {
- return Collections.unmodifiableList(thumbnails);
- }
-
- @Override
- public int hashCode() {
- return HashCode.builder()
- .append(getElementName())
- .append(getNamespace())
- .append(getDate())
- .append(getDescriptions())
- .append(getHeight())
- .append(getWidth())
- .append(getHashElements())
- .append(getLength())
- .append(getMediaType())
- .append(getRawName())
- .append(getSize())
- .append(getThumbnails())
- .build();
- }
-
- @Override
- public boolean equals(Object other) {
- return EqualsUtil.equals(this, other, (equalsBuilder, o) -> equalsBuilder
- .append(getElementName(), o.getElementName())
- .append(getNamespace(), o.getNamespace())
- .append(getDate(), o.getDate())
- .append(getDescriptions(), o.getDescriptions())
- .append(getHeight(), o.getHeight())
- .append(getWidth(), o.getWidth())
- .append(getHashElements(), o.getHashElements())
- .append(getLength(), o.getLength())
- .append(getMediaType(), o.getMediaType())
- .append(getRawName(), o.getRawName())
- .append(getSize(), o.getSize())
- .append(getThumbnails(), o.getThumbnails()));
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
-
- private Date date;
- private Integer height;
- private Integer width;
- private Map descriptions = new HashMap<>();
- private Map hashElements = new HashMap<>();
- private Long length;
- private String mediaType;
- private String name;
- private Long size;
- private List thumbnails = new ArrayList<>();
-
- public Builder setModificationDate(Date date) {
- this.date = date;
- return this;
- }
-
- public Builder setDimensions(int width, int height) {
- return setHeight(height).setWidth(width);
- }
-
- public Builder setHeight(int height) {
- if (height <= 0) {
- throw new IllegalArgumentException("Height must be a positive number");
- }
- this.height = height;
- return this;
- }
-
- public Builder setWidth(int width) {
- if (width <= 0) {
- throw new IllegalArgumentException("Width must be a positive number");
- }
- this.width = width;
- return this;
- }
-
- public Builder addDescription(String description) {
- return addDescription(description, null);
- }
-
- public Builder addDescription(String description, String language) {
- this.descriptions.put(language != null ? language : "", StringUtils.requireNotNullNorEmpty(description, "Description MUST NOT be null nor empty"));
- return this;
- }
-
- public Builder addHash(HashElement hashElement) {
- hashElements.put(hashElement.getAlgorithm(), hashElement);
- return this;
- }
-
- public Builder setLength(long length) {
- if (length < 0) {
- throw new IllegalArgumentException("Length cannot be negative.");
- }
- this.length = length;
- return this;
- }
-
- public Builder setMediaType(String mediaType) {
- this.mediaType = StringUtils.requireNotNullNorEmpty(mediaType, "Media-Type MUST NOT be null nor empty");
- return this;
- }
-
- public Builder setName(String name) {
- this.name = StringUtils.requireNotNullNorEmpty(name, "Name MUST NOT be null nor empty");
- return this;
- }
-
- public Builder setSize(long size) {
- if (size < 0) {
- throw new IllegalArgumentException("Size MUST NOT be negative.");
- }
- this.size = size;
- return this;
- }
-
- public Builder addThumbnail(ThumbnailElement thumbnail) {
- thumbnails.add(thumbnail);
- return this;
- }
-
- public FileMetadataElement build() {
- return new FileMetadataElement(date, height, width, descriptions, hashElements, length,
- mediaType, name, size, thumbnails);
- }
- }
-}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/element/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/element/package-info.java
deleted file mode 100644
index dbea97273..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/element/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- *
- * Copyright 2020 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Smacks implementation of XEP-0446: File Metadata Element.
- */
-package org.jivesoftware.smackx.file_metadata.element;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/package-info.java
deleted file mode 100644
index 8d9825d6c..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- *
- * Copyright 2020 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Smacks implementation of XEP-0446: File Metadata Element.
- */
-package org.jivesoftware.smackx.file_metadata;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/provider/FileMetadataElementProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/provider/FileMetadataElementProvider.java
deleted file mode 100644
index e4212b0ce..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/provider/FileMetadataElementProvider.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- *
- * Copyright 2020 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jivesoftware.smackx.file_metadata.provider;
-
-import java.io.IOException;
-import java.text.ParseException;
-
-import org.jivesoftware.smack.packet.XmlEnvironment;
-import org.jivesoftware.smack.parsing.SmackParsingException;
-import org.jivesoftware.smack.provider.ExtensionElementProvider;
-import org.jivesoftware.smack.util.ParserUtils;
-import org.jivesoftware.smack.xml.XmlPullParser;
-import org.jivesoftware.smack.xml.XmlPullParserException;
-import org.jivesoftware.smackx.file_metadata.element.FileMetadataElement;
-import org.jivesoftware.smackx.hashes.element.HashElement;
-import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
-import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;
-import org.jivesoftware.smackx.thumbnails.provider.ThumbnailElementProvider;
-
-public class FileMetadataElementProvider extends ExtensionElementProvider {
-
- @Override
- public FileMetadataElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
- throws XmlPullParserException, IOException, SmackParsingException, ParseException {
- FileMetadataElement.Builder builder = FileMetadataElement.builder();
-
- outerloop: while (true) {
- XmlPullParser.Event event = parser.next();
- switch (event) {
- case START_ELEMENT:
- String name = parser.getName();
- switch (name) {
- case FileMetadataElement.ELEMENT:
- parser.next();
- break;
- case FileMetadataElement.ELEM_DATE:
- builder.setModificationDate(ParserUtils.getDateFromNextText(parser));
- break;
- case FileMetadataElement.ELEM_DESC:
- String lang = ParserUtils.getXmlLang(parser);
- builder.addDescription(ParserUtils.getRequiredNextText(parser), lang);
- break;
- case "dimensions": // was replaced with width and height
- String dimensions = ParserUtils.getRequiredNextText(parser);
- String[] split = dimensions.split("x");
- if (split.length != 2) {
- throw new IllegalArgumentException("Invalid dimensions.");
- }
- builder.setWidth(Integer.parseInt(split[0]));
- builder.setHeight(Integer.parseInt(split[1]));
- break;
- case FileMetadataElement.ELEM_WIDTH:
- builder.setWidth(Integer.parseInt(ParserUtils.getRequiredNextText(parser)));
- break;
- case FileMetadataElement.ELEM_HEIGHT:
- builder.setHeight(Integer.parseInt(ParserUtils.getRequiredNextText(parser)));
- break;
- case FileMetadataElement.ELEM_LENGTH:
- builder.setLength(Long.parseLong(ParserUtils.getRequiredNextText(parser)));
- break;
- case FileMetadataElement.ELEM_MEDIA_TYPE:
- builder.setMediaType(ParserUtils.getRequiredNextText(parser));
- break;
- case FileMetadataElement.ELEM_NAME:
- builder.setName(ParserUtils.getRequiredNextText(parser));
- break;
- case FileMetadataElement.ELEM_SIZE:
- builder.setSize(Long.parseLong(ParserUtils.getRequiredNextText(parser)));
- break;
- case HashElement.ELEMENT:
- builder.addHash(HashElementProvider.INSTANCE.parse(parser, parser.getDepth(), xmlEnvironment));
- break;
- case ThumbnailElement.ELEMENT:
- ThumbnailElementProvider provider = new ThumbnailElementProvider();
- builder.addThumbnail(provider.parse(parser, parser.getDepth(), xmlEnvironment));
- }
- break;
- case END_ELEMENT:
- if (parser.getDepth() == initialDepth) break outerloop;
- break;
- default:
- // Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
- break;
- }
- }
- return builder.build();
- }
-}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/provider/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/provider/package-info.java
deleted file mode 100644
index e28f0d94b..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/file_metadata/provider/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- *
- * Copyright 2020 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * File metadata element provider.
- */
-package org.jivesoftware.smackx.file_metadata.provider;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/HashManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/HashManager.java
index 68aa79ba7..b3f0c3db4 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/HashManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/HashManager.java
@@ -47,7 +47,7 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.hashes.element.HashElement;
/**
- * Manager that can be used to determine support for hash functions. By default,the Manager announces support for
+ * 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:
* https://xmpp.org/extensions/xep-0300.html#recommendations.
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/package-info.java
index 9ca583637..1b357afa8 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/package-info.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/package-info.java
@@ -103,7 +103,7 @@
* AbstractHttpOverXmpp.Data data = new AbstractHttpOverXmpp.Data(child);
*
* // create request
- * HttpOverXmppReq req = HttpOverXmppReq.builder()
+ * HttpOverXmppReq req = HttpOverXmppReq.buider()
* .setMethod(HttpMethod.POST)
* .setResource("/mailbox")
* .setHeaders(headers)
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/Slot.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/Slot.java
index 48c61bec7..274e59bc0 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/Slot.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/Slot.java
@@ -46,7 +46,6 @@ public class Slot extends IQ {
this(putUrl, getUrl, headers, NAMESPACE);
}
- @SuppressWarnings("this-escape")
protected Slot(URL putUrl, URL getUrl, Map headers, String namespace) {
super(ELEMENT, namespace);
setType(Type.result);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/SlotRequest.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/SlotRequest.java
index 0fa8b484c..961fc27e1 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/SlotRequest.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/SlotRequest.java
@@ -53,7 +53,6 @@ public class SlotRequest extends IQ {
this(uploadServiceAddress, filename, size, contentType, NAMESPACE);
}
- @SuppressWarnings("this-escape")
protected SlotRequest(DomainBareJid uploadServiceAddress, String filename, long size, String contentType, String namespace) {
super(ELEMENT, namespace);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/IoTSetRequest.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/IoTSetRequest.java
index a3dad0268..cd6d0b553 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/IoTSetRequest.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/IoTSetRequest.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2016-2024 Florian Schmaus
+ * Copyright © 2016-2017 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@ public class IoTSetRequest extends IQ {
private final Collection setData;
- @SuppressWarnings("this-escape")
public IoTSetRequest(Collection extends SetData> setData) {
super(ELEMENT, NAMESPACE);
setType(Type.set);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataReadOutAccepted.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataReadOutAccepted.java
index 279476cd2..20d0a125d 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataReadOutAccepted.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataReadOutAccepted.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2016-2024 Florian Schmaus
+ * Copyright © 2016 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,6 @@ public class IoTDataReadOutAccepted extends IQ {
private final boolean queued;
- @SuppressWarnings("this-escape")
public IoTDataReadOutAccepted(int seqNr, boolean queued) {
super(ELEMENT, NAMESPACE);
this.seqNr = seqNr;
@@ -38,7 +37,6 @@ public class IoTDataReadOutAccepted extends IQ {
setType(Type.result);
}
- @SuppressWarnings("this-escape")
public IoTDataReadOutAccepted(IoTDataRequest dataRequest) {
this(dataRequest.getSequenceNr(), false);
setStanzaId(dataRequest.getStanzaId());
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java
index 721b1b657..cb280745f 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java
@@ -83,7 +83,6 @@ public class IoTFieldsExtension implements ExtensionElement {
return xml;
}
- @SuppressWarnings("JavaUtilDate")
public static IoTFieldsExtension buildFor(int seqNr, boolean done, NodeInfo nodeInfo,
List extends IoTDataField> data) {
TimestampElement timestampElement = new TimestampElement(new Date(), data);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/IoTUnregister.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/IoTUnregister.java
index 3b510e55f..bdc536f97 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/IoTUnregister.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/IoTUnregister.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2016-2024 Florian Schmaus
+ * Copyright 2016 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ public class IoTUnregister extends IQ {
private final NodeInfo nodeInfo;
- @SuppressWarnings("this-escape")
public IoTUnregister(NodeInfo nodeInfo) {
super(ELEMENT, NAMESPACE);
this.nodeInfo = nodeInfo;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/package-info.java
index c4b261a27..0b3803a4f 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/package-info.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/package-info.java
@@ -146,7 +146,7 @@
*
*
* IoTDiscoveryManager iotDiscoveryManager = IoTDiscoveryManager.getInstanceFor(connection);
- * iotDiscoveryManager.registerThing(thing);
+ * iotDiscovyerManager.registerThing(thing);
*
*
*
@@ -162,7 +162,7 @@
* Things can usually only be used by other things if they are friends. Since a
* thing normally can't decide on its own if an incoming friendship request
* should be granted or not, we can delegate this decision to a provisioning
- * service. Smack provides the `IoTProvisionManager` to deal with friendship and
+ * service. Smack provides the `IoTProvisinoManager` to deal with friendship and
* provisioning.
*
*
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java
index d17e46c94..fe98b32b3 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCache.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2016-2024 Florian Schmaus
+ * Copyright © 2016 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ public class ClearCache extends SimpleIQ {
public static final String ELEMENT = "clearCache";
public static final String NAMESPACE = Constants.IOT_PROVISIONING_NAMESPACE;
- @SuppressWarnings("this-escape")
public ClearCache() {
super(ELEMENT, NAMESPACE);
// IQs are always of type 'get' (XEP-0324 § 3.5.1, see also the XEPs history remarks)
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCacheResponse.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCacheResponse.java
index 1abfb731c..1c229d153 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCacheResponse.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/ClearCacheResponse.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2016-2024 Florian Schmaus
+ * Copyright © 2016 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,14 +23,12 @@ public class ClearCacheResponse extends SimpleIQ {
public static final String ELEMENT = "clearCacheResponse";
public static final String NAMESPACE = Constants.IOT_PROVISIONING_NAMESPACE;
- @SuppressWarnings("this-escape")
public ClearCacheResponse() {
super(ELEMENT, NAMESPACE);
// IQs are always of type 'result' (XEP-0324 § 3.5.1, see also the XEPs history remarks)
setType(Type.result);
}
- @SuppressWarnings("this-escape")
public ClearCacheResponse(ClearCache clearCacheRequest) {
this();
setStanzaId(clearCacheRequest.getStanzaId());
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java
index cab86e550..b4e9021ec 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2017 Paul Schaub, 2019-2024 Florian Schmaus
+ * Copyright 2017 Paul Schaub, 2019 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -167,7 +167,6 @@ public class JingleFileTransferChild implements JingleContentDescriptionChildEle
return new JingleFileTransferChild(date, desc, hash, mediaType, name, size, range);
}
- @SuppressWarnings("JavaUtilDate")
public Builder setFile(File file) {
return setDate(new Date(file.lastModified()))
.setName(file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("/") + 1))
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java
index 6ce58bdea..94dfc2f07 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright © 2017-2024 Florian Schmaus, 2016-2017 Fernando Ramirez
+ * Copyright © 2017-2020 Florian Schmaus, 2016-2017 Fernando Ramirez
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,8 +44,8 @@ import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.commands.AdHocCommand;
import org.jivesoftware.smackx.commands.AdHocCommandManager;
+import org.jivesoftware.smackx.commands.RemoteCommand;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
@@ -233,7 +233,7 @@ public final class MamManager extends Manager {
super(connection);
this.archiveAddress = archiveAddress;
serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
- adHocCommandManager = AdHocCommandManager.getInstance(connection);
+ adHocCommandManager = AdHocCommandManager.getAddHocCommandsManager(connection);
}
/**
@@ -387,7 +387,6 @@ public final class MamManager extends Manager {
return this;
}
- @SuppressWarnings("JavaUtilDate")
public Builder limitResultsSince(Date start) {
if (start == null) {
return this;
@@ -416,7 +415,6 @@ public final class MamManager extends Manager {
return this;
}
- @SuppressWarnings("JavaUtilDate")
public Builder limitResultsBefore(Date end) {
if (end == null) {
return this;
@@ -761,7 +759,7 @@ public final class MamManager extends Manager {
return false;
}
- public AdHocCommand getAdvancedConfigurationCommand() throws InterruptedException, XMPPException, SmackException {
+ public RemoteCommand getAdvancedConfigurationCommand() throws InterruptedException, XMPPException, SmackException {
DiscoverItems discoverItems = adHocCommandManager.discoverCommands(archiveAddress);
for (DiscoverItems.Item item : discoverItems.getItems()) {
if (item.getNode().equals(ADVANCED_CONFIG_NODE))
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamPrefsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamPrefsIQ.java
index 1a5535135..e5898f4c3 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamPrefsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamPrefsIQ.java
@@ -81,7 +81,6 @@ public class MamPrefsIQ extends IQ {
* @param neverJids TODO javadoc me please
* @param defaultBehavior TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MamPrefsIQ(MamVersion version, List alwaysJids, List neverJids, DefaultBehavior defaultBehavior) {
super(ELEMENT, version.getNamespace());
setType(Type.set);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamQueryIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamQueryIQ.java
index 17b8a5cae..3909b077c 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamQueryIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamQueryIQ.java
@@ -45,7 +45,6 @@ public class MamQueryIQ extends IQ {
* @param version TODO javadoc me please
* @param queryId TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MamQueryIQ(MamVersion version, String queryId) {
this(version, queryId, null, null);
setType(IQ.Type.get);
@@ -80,7 +79,6 @@ public class MamQueryIQ extends IQ {
* @param node TODO javadoc me please
* @param dataForm TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MamQueryIQ(MamVersion version, String queryId, String node, DataForm dataForm) {
super(ELEMENT, version.getNamespace());
this.queryId = queryId;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/package-info.java
index f1d6e981e..5246c33ff 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/package-info.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/package-info.java
@@ -21,7 +21,7 @@
* Usage
*
* The most important class is the {@link org.jivesoftware.smackx.message_markup.element.MarkupElement} class, which
- * contains a Builder to construct message markup.
+ * contains a Builder to construct message markup..
*
*
* To start creating a Message Markup Extension, call
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java
index 7f0595871..aab822087 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomConfiguration.java
@@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.muclight;
-import java.util.Map;
+import java.util.HashMap;
/**
* MUC Light room configuration class.
@@ -28,7 +28,7 @@ public class MUCLightRoomConfiguration {
private final String roomName;
private final String subject;
- private final Map customConfigs;
+ private final HashMap customConfigs;
/**
* MUC Light room configuration model constructor.
@@ -37,7 +37,7 @@ public class MUCLightRoomConfiguration {
* @param subject TODO javadoc me please
* @param customConfigs TODO javadoc me please
*/
- public MUCLightRoomConfiguration(String roomName, String subject, Map customConfigs) {
+ public MUCLightRoomConfiguration(String roomName, String subject, HashMap customConfigs) {
this.roomName = roomName;
this.subject = subject;
this.customConfigs = customConfigs;
@@ -66,7 +66,7 @@ public class MUCLightRoomConfiguration {
*
* @return the custom configurations of the room.
*/
- public Map getCustomConfigs() {
+ public HashMap getCustomConfigs() {
return customConfigs;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomInfo.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomInfo.java
index 532f64bf4..b41066d54 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomInfo.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MUCLightRoomInfo.java
@@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.muclight;
-import java.util.Map;
+import java.util.HashMap;
import org.jxmpp.jid.Jid;
@@ -30,7 +30,7 @@ public class MUCLightRoomInfo {
private final String version;
private final Jid room;
private final MUCLightRoomConfiguration configuration;
- private final Map occupants;
+ private final HashMap occupants;
/**
* MUC Light room info model constructor.
@@ -41,7 +41,7 @@ public class MUCLightRoomInfo {
* @param occupants TODO javadoc me please
*/
public MUCLightRoomInfo(String version, Jid roomJid, MUCLightRoomConfiguration configuration,
- Map occupants) {
+ HashMap occupants) {
this.version = version;
this.room = roomJid;
this.configuration = configuration;
@@ -80,7 +80,7 @@ public class MUCLightRoomInfo {
*
* @return the occupants of the room.
*/
- public Map getOccupants() {
+ public HashMap getOccupants() {
return occupants;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
index 58e5b367d..5ebd11197 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
@@ -18,7 +18,6 @@ package org.jivesoftware.smackx.muclight;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -182,6 +181,21 @@ public class MultiUserChatLight {
;
}
+ /**
+ * Sends a Message to the chat room.
+ *
+ * @param message TODO javadoc me please
+ * the message.
+ * @throws NotConnectedException if the XMPP connection is not connected.
+ * @throws InterruptedException if the calling thread was interrupted.
+ * @deprecated use {@link #sendMessage(MessageBuilder)} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
+ sendMessage(message.asBuilder());
+ }
+
/**
* Sends a Message to the chat room.
*
@@ -280,7 +294,7 @@ public class MultiUserChatLight {
* @param occupants TODO javadoc me please
* @throws Exception TODO javadoc me please
*/
- public void create(String roomName, String subject, Map customConfigs, List occupants)
+ public void create(String roomName, String subject, HashMap customConfigs, List occupants)
throws Exception {
MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants);
@@ -314,7 +328,7 @@ public class MultiUserChatLight {
* @throws XMPPErrorException if there was an XMPP error returned.
*/
public void leave() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
- Map affiliations = new HashMap<>();
+ HashMap affiliations = new HashMap<>();
affiliations.put(connection.getUser(), MUCLightAffiliation.none);
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
@@ -403,7 +417,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
- public Map getAffiliations(String version)
+ public HashMap getAffiliations(String version)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(room, version);
@@ -422,7 +436,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
- public Map getAffiliations()
+ public HashMap getAffiliations()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliations(null);
}
@@ -436,7 +450,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
- public void changeAffiliations(Map affiliations)
+ public void changeAffiliations(HashMap affiliations)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
connection.sendIqRequestAndWaitForResponse(changeAffiliationsIQ);
@@ -499,7 +513,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
- public void setRoomConfigs(Map customConfigs)
+ public void setRoomConfigs(HashMap customConfigs)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
setRoomConfigs(null, customConfigs);
}
@@ -514,7 +528,7 @@ public class MultiUserChatLight {
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
- public void setRoomConfigs(String roomName, Map customConfigs)
+ public void setRoomConfigs(String roomName, HashMap customConfigs)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, roomName, customConfigs);
connection.sendIqRequestAndWaitForResponse(mucLightSetConfigIQ);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java
index 58f030499..d153d499d 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java
@@ -274,7 +274,7 @@ public final class MultiUserChatLightManager extends Manager {
sendBlockRooms(mucLightService, rooms);
}
- private void sendBlockRooms(DomainBareJid mucLightService, Map rooms)
+ private void sendBlockRooms(DomainBareJid mucLightService, HashMap rooms)
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(IQ.Type.set);
@@ -318,7 +318,7 @@ public final class MultiUserChatLightManager extends Manager {
sendBlockUsers(mucLightService, users);
}
- private void sendBlockUsers(DomainBareJid mucLightService, Map users)
+ private void sendBlockUsers(DomainBareJid mucLightService, HashMap users)
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(IQ.Type.set);
@@ -362,7 +362,7 @@ public final class MultiUserChatLightManager extends Manager {
sendUnblockRooms(mucLightService, rooms);
}
- private void sendUnblockRooms(DomainBareJid mucLightService, Map rooms)
+ private void sendUnblockRooms(DomainBareJid mucLightService, HashMap rooms)
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(rooms, null);
mucLightBlockingIQ.setType(IQ.Type.set);
@@ -406,7 +406,7 @@ public final class MultiUserChatLightManager extends Manager {
sendUnblockUsers(mucLightService, users);
}
- private void sendUnblockUsers(DomainBareJid mucLightService, Map users)
+ private void sendUnblockUsers(DomainBareJid mucLightService, HashMap users)
throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException {
MUCLightBlockingIQ mucLightBlockingIQ = new MUCLightBlockingIQ(null, users);
mucLightBlockingIQ.setType(IQ.Type.set);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightAffiliationsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightAffiliationsIQ.java
index 047c7af50..c9e0ead62 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightAffiliationsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightAffiliationsIQ.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.muclight.element;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -39,7 +40,7 @@ public class MUCLightAffiliationsIQ extends IQ {
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
private final String version;
- private Map affiliations;
+ private HashMap affiliations;
/**
* MUC Light affiliations response IQ constructor.
@@ -47,8 +48,7 @@ public class MUCLightAffiliationsIQ extends IQ {
* @param version TODO javadoc me please
* @param affiliations TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
- public MUCLightAffiliationsIQ(String version, Map affiliations) {
+ public MUCLightAffiliationsIQ(String version, HashMap affiliations) {
super(ELEMENT, NAMESPACE);
this.version = version;
this.affiliations = affiliations;
@@ -82,7 +82,7 @@ public class MUCLightAffiliationsIQ extends IQ {
*
* @return the affiliations of the room
*/
- public Map getAffiliations() {
+ public HashMap getAffiliations() {
return affiliations;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightBlockingIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightBlockingIQ.java
index fa6264ff0..f3334b651 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightBlockingIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightBlockingIQ.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.muclight.element;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -37,8 +38,8 @@ public class MUCLightBlockingIQ extends IQ {
public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.BLOCKING;
- private final Map rooms;
- private final Map users;
+ private final HashMap rooms;
+ private final HashMap users;
/**
* MUC Light blocking IQ constructor.
@@ -46,7 +47,7 @@ public class MUCLightBlockingIQ extends IQ {
* @param rooms TODO javadoc me please
* @param users TODO javadoc me please
*/
- public MUCLightBlockingIQ(Map rooms, Map users) {
+ public MUCLightBlockingIQ(HashMap rooms, HashMap users) {
super(ELEMENT, NAMESPACE);
this.rooms = rooms;
this.users = users;
@@ -57,7 +58,7 @@ public class MUCLightBlockingIQ extends IQ {
*
* @return the rooms JIDs with booleans (true if allow, false if deny)
*/
- public Map getRooms() {
+ public HashMap getRooms() {
return rooms;
}
@@ -66,7 +67,7 @@ public class MUCLightBlockingIQ extends IQ {
*
* @return the users JIDs with booleans (true if allow, false if deny)
*/
- public Map getUsers() {
+ public HashMap getUsers() {
return users;
}
@@ -85,7 +86,7 @@ public class MUCLightBlockingIQ extends IQ {
return xml;
}
- private static void parseBlocking(IQChildElementXmlStringBuilder xml, Map map, boolean isRoom) {
+ private static void parseBlocking(IQChildElementXmlStringBuilder xml, HashMap map, boolean isRoom) {
Iterator> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = it.next();
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightChangeAffiliationsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightChangeAffiliationsIQ.java
index e472c84e1..494a7a4d7 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightChangeAffiliationsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightChangeAffiliationsIQ.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.muclight.element;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -38,7 +39,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
- private Map affiliations;
+ private HashMap affiliations;
/**
* MUCLight change affiliations IQ constructor.
@@ -46,8 +47,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
* @param room TODO javadoc me please
* @param affiliations TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
- public MUCLightChangeAffiliationsIQ(Jid room, Map affiliations) {
+ public MUCLightChangeAffiliationsIQ(Jid room, HashMap affiliations) {
super(ELEMENT, NAMESPACE);
this.setType(Type.set);
this.setTo(room);
@@ -59,7 +59,7 @@ public class MUCLightChangeAffiliationsIQ extends IQ {
*
* @return the affiliations
*/
- public Map getAffiliations() {
+ public HashMap getAffiliations() {
return affiliations;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightCreateIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightCreateIQ.java
index ea0db3b21..d15d47db5 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightCreateIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightCreateIQ.java
@@ -18,7 +18,6 @@ package org.jivesoftware.smackx.muclight.element;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jivesoftware.smack.packet.IQ;
@@ -43,7 +42,7 @@ public class MUCLightCreateIQ extends IQ {
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.CREATE;
private MUCLightRoomConfiguration configuration;
- private final Map occupants;
+ private final HashMap occupants;
/**
* MUCLight create IQ constructor.
@@ -54,8 +53,7 @@ public class MUCLightCreateIQ extends IQ {
* @param customConfigs TODO javadoc me please
* @param occupants TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
- public MUCLightCreateIQ(EntityJid room, String roomName, String subject, Map customConfigs,
+ public MUCLightCreateIQ(EntityJid room, String roomName, String subject, HashMap customConfigs,
List occupants) {
super(ELEMENT, NAMESPACE);
this.configuration = new MUCLightRoomConfiguration(roomName, subject, customConfigs);
@@ -94,7 +92,7 @@ public class MUCLightCreateIQ extends IQ {
*
* @return the room occupants
*/
- public Map getOccupants() {
+ public HashMap getOccupants() {
return occupants;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightDestroyIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightDestroyIQ.java
index 6606ae035..8198007cf 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightDestroyIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightDestroyIQ.java
@@ -38,7 +38,6 @@ public class MUCLightDestroyIQ extends IQ {
*
* @param roomJid TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MUCLightDestroyIQ(Jid roomJid) {
super(ELEMENT, NAMESPACE);
this.setType(Type.set);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java
index 27dcbd2e7..33861b29e 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.muclight.element;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -47,11 +48,11 @@ public abstract class MUCLightElements {
public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.AFFILIATIONS;
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
- private final Map affiliations;
+ private final HashMap affiliations;
private final String prevVersion;
private final String version;
- public AffiliationsChangeExtension(Map affiliations, String prevVersion,
+ public AffiliationsChangeExtension(HashMap affiliations, String prevVersion,
String version) {
this.affiliations = affiliations;
this.prevVersion = prevVersion;
@@ -73,7 +74,7 @@ public abstract class MUCLightElements {
*
* @return the affiliations
*/
- public Map getAffiliations() {
+ public HashMap getAffiliations() {
return affiliations;
}
@@ -134,7 +135,7 @@ public abstract class MUCLightElements {
private final String version;
private final String roomName;
private final String subject;
- private final Map customConfigs;
+ private final HashMap customConfigs;
/**
* Configurations change extension constructor.
@@ -146,7 +147,7 @@ public abstract class MUCLightElements {
* @param customConfigs TODO javadoc me please
*/
public ConfigurationsChangeExtension(String prevVersion, String version, String roomName, String subject,
- Map customConfigs) {
+ HashMap customConfigs) {
this.prevVersion = prevVersion;
this.version = version;
this.roomName = roomName;
@@ -205,7 +206,7 @@ public abstract class MUCLightElements {
*
* @return the room custom configurations
*/
- public Map getCustomConfigs() {
+ public HashMap getCustomConfigs() {
return customConfigs;
}
@@ -286,14 +287,14 @@ public abstract class MUCLightElements {
*/
public static class OccupantsElement implements Element {
- private Map occupants;
+ private HashMap occupants;
/**
* Occupants element constructor.
*
* @param occupants TODO javadoc me please
*/
- public OccupantsElement(Map occupants) {
+ public OccupantsElement(HashMap occupants) {
this.occupants = occupants;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetAffiliationsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetAffiliationsIQ.java
index 70249914c..67cd26481 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetAffiliationsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetAffiliationsIQ.java
@@ -41,7 +41,6 @@ public class MUCLightGetAffiliationsIQ extends IQ {
* @param roomJid TODO javadoc me please
* @param version TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MUCLightGetAffiliationsIQ(Jid roomJid, String version) {
super(ELEMENT, NAMESPACE);
this.version = version;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetConfigsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetConfigsIQ.java
index aff4283ee..15ce3e1f9 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetConfigsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetConfigsIQ.java
@@ -41,7 +41,6 @@ public class MUCLightGetConfigsIQ extends IQ {
* @param roomJid TODO javadoc me please
* @param version TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MUCLightGetConfigsIQ(Jid roomJid, String version) {
super(ELEMENT, NAMESPACE);
this.version = version;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetInfoIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetInfoIQ.java
index 6e3d1daa0..112ec1935 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetInfoIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightGetInfoIQ.java
@@ -41,7 +41,6 @@ public class MUCLightGetInfoIQ extends IQ {
* @param roomJid TODO javadoc me please
* @param version TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
public MUCLightGetInfoIQ(Jid roomJid, String version) {
super(ELEMENT, NAMESPACE);
this.version = version;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightInfoIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightInfoIQ.java
index ef33d4b77..42a2b9308 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightInfoIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightInfoIQ.java
@@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.muclight.element;
-import java.util.Map;
+import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
@@ -41,7 +41,7 @@ public class MUCLightInfoIQ extends IQ {
private final String version;
private final MUCLightRoomConfiguration configuration;
- private final Map occupants;
+ private final HashMap occupants;
/**
* MUCLight info response IQ constructor.
@@ -51,7 +51,7 @@ public class MUCLightInfoIQ extends IQ {
* @param occupants TODO javadoc me please
*/
public MUCLightInfoIQ(String version, MUCLightRoomConfiguration configuration,
- Map occupants) {
+ HashMap occupants) {
super(ELEMENT, NAMESPACE);
this.version = version;
this.configuration = configuration;
@@ -90,7 +90,7 @@ public class MUCLightInfoIQ extends IQ {
*
* @return the occupants of the room
*/
- public Map getOccupants() {
+ public HashMap getOccupants() {
return occupants;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightSetConfigsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightSetConfigsIQ.java
index 3e332194a..0751b582f 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightSetConfigsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightSetConfigsIQ.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.muclight.element;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -38,7 +39,7 @@ public class MUCLightSetConfigsIQ extends IQ {
private String roomName;
private String subject;
- private Map customConfigs;
+ private HashMap customConfigs;
/**
* MUC Light set configuration IQ constructor.
@@ -48,8 +49,7 @@ public class MUCLightSetConfigsIQ extends IQ {
* @param subject TODO javadoc me please
* @param customConfigs TODO javadoc me please
*/
- @SuppressWarnings("this-escape")
- public MUCLightSetConfigsIQ(Jid roomJid, String roomName, String subject, Map customConfigs) {
+ public MUCLightSetConfigsIQ(Jid roomJid, String roomName, String subject, HashMap customConfigs) {
super(ELEMENT, NAMESPACE);
this.roomName = roomName;
this.subject = subject;
@@ -65,7 +65,7 @@ public class MUCLightSetConfigsIQ extends IQ {
* @param roomName TODO javadoc me please
* @param customConfigs TODO javadoc me please
*/
- public MUCLightSetConfigsIQ(Jid roomJid, String roomName, Map customConfigs) {
+ public MUCLightSetConfigsIQ(Jid roomJid, String roomName, HashMap customConfigs) {
this(roomJid, roomName, null, customConfigs);
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java
index 1412b2900..b89dba5c8 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightBlockingIQProvider.java
@@ -18,7 +18,6 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
-import java.util.Map;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IqData;
@@ -43,8 +42,8 @@ public class MUCLightBlockingIQProvider extends IqProvider {
@Override
public MUCLightBlockingIQ parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
- Map rooms = null;
- Map users = null;
+ HashMap rooms = null;
+ HashMap users = null;
outerloop: while (true) {
XmlPullParser.Event eventType = parser.next();
@@ -71,7 +70,7 @@ public class MUCLightBlockingIQProvider extends IqProvider {
return mucLightBlockingIQ;
}
- private static Map parseBlocking(XmlPullParser parser, Map map)
+ private static HashMap parseBlocking(XmlPullParser parser, HashMap map)
throws XmppStringprepException, XmlPullParserException, IOException {
if (map == null) {
map = new HashMap<>();
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java
index 50d30bca4..54d0a4218 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/provider/MUCLightInfoIQProvider.java
@@ -18,7 +18,6 @@ package org.jivesoftware.smackx.muclight.provider;
import java.io.IOException;
import java.util.HashMap;
-import java.util.Map;
import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment;
@@ -46,8 +45,8 @@ public class MUCLightInfoIQProvider extends IqProvider {
String version = null;
String roomName = null;
String subject = null;
- Map customConfigs = null;
- Map occupants = new HashMap<>();
+ HashMap customConfigs = null;
+ HashMap occupants = new HashMap<>();
outerloop: while (true) {
XmlPullParser.Event eventType = parser.next();
@@ -98,8 +97,8 @@ public class MUCLightInfoIQProvider extends IqProvider {
return new MUCLightInfoIQ(version, new MUCLightRoomConfiguration(roomName, subject, customConfigs), occupants);
}
- private static Map iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException {
- Map occupants = new HashMap<>();
+ private static HashMap iterateOccupants(XmlPullParser parser) throws XmlPullParserException, IOException {
+ HashMap occupants = new HashMap<>();
int depth = parser.getDepth();
outerloop: while (true) {
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java
index 8615b4759..ff62d96eb 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/PushNotificationsManager.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.push_notifications;
+import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
@@ -121,7 +122,7 @@ public final class PushNotificationsManager extends Manager {
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
- public boolean enable(Jid pushJid, String node, Map publishOptions)
+ public boolean enable(Jid pushJid, String node, HashMap publishOptions)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(pushJid, node,
publishOptions);
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/DisablePushNotificationsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/DisablePushNotificationsIQ.java
index 08342811b..bedf8be02 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/DisablePushNotificationsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/DisablePushNotificationsIQ.java
@@ -43,7 +43,6 @@ public class DisablePushNotificationsIQ extends IQ {
private final Jid jid;
private final String node;
- @SuppressWarnings("this-escape")
public DisablePushNotificationsIQ(Jid jid, String node) {
super(ELEMENT, NAMESPACE);
this.jid = jid;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/EnablePushNotificationsIQ.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/EnablePushNotificationsIQ.java
index c6f8199b4..428b41b67 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/EnablePushNotificationsIQ.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/EnablePushNotificationsIQ.java
@@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.push_notifications.element;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -50,10 +51,9 @@ public class EnablePushNotificationsIQ extends IQ {
private final Jid jid;
private final String node;
- private final Map publishOptions;
+ private final HashMap publishOptions;
- @SuppressWarnings("this-escape")
- public EnablePushNotificationsIQ(Jid jid, String node, Map publishOptions) {
+ public EnablePushNotificationsIQ(Jid jid, String node, HashMap publishOptions) {
super(ELEMENT, NAMESPACE);
this.jid = jid;
this.node = node;
@@ -88,7 +88,7 @@ public class EnablePushNotificationsIQ extends IQ {
*
* @return the publish options
*/
- public Map getPublishOptions() {
+ public HashMap getPublishOptions() {
return publishOptions;
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/package-info.java
index fc8f020be..821577179 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/package-info.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/package-info.java
@@ -29,7 +29,7 @@
*
*
*
- * Message message = new Message("Alice is a really nice person.");
+ * Message message = new Message("Alice is a realy nice person.");
* BareJid alice = JidCreate.bareFrom("alice@capulet.lit");
* ReferenceManager.addMention(message, 0, 5, alice);
*
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java
index f0766de8b..a50fd99e2 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java
@@ -38,6 +38,28 @@ public class OriginIdElement extends StableAndUniqueIdElement {
super(id);
}
+ /**
+ * Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element.
+ *
+ * @param message message.
+ * @return the added origin-id element.
+ * @deprecated use {@link #addTo(MessageBuilder)} instead.
+ */
+ @Deprecated
+ // TODO: Remove in Smack 4.5.
+ public static OriginIdElement addOriginId(Message message) {
+ OriginIdElement originId = message.getExtension(OriginIdElement.class);
+ if (originId != null) {
+ return originId;
+ }
+
+ originId = new OriginIdElement();
+ message.addExtension(originId);
+ // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.
+ // message.setStanzaId(originId.getId());
+ return originId;
+ }
+
/**
* Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element.
*
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
index b18a5af5c..6d5c02fd6 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
@@ -114,7 +114,6 @@ public class SpoilerElement implements ExtensionElement {
* @param message message
* @return map of spoilers
*/
- @SuppressWarnings("MixedMutabilityReturnType")
public static Map getSpoilers(Message message) {
if (!containsSpoiler(message)) {
return Collections.emptyMap();
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/stanza_content_encryption/element/TimestampAffixElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/stanza_content_encryption/element/TimestampAffixElement.java
index eee726085..0c48f7b7a 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/stanza_content_encryption/element/TimestampAffixElement.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/stanza_content_encryption/element/TimestampAffixElement.java
@@ -56,7 +56,6 @@ public class TimestampAffixElement implements NamedElement, AffixElement {
return EqualsUtil.equals(this, obj, (e, o) -> e.append(getTimestamp(), o.getTimestamp()));
}
- @SuppressWarnings("JavaUtilDate")
@Override
public int hashCode() {
return timestamp.hashCode();
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/element/ThumbnailElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/element/ThumbnailElement.java
deleted file mode 100644
index 3bcd4b045..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/element/ThumbnailElement.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- *
- * Copyright 2023 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jivesoftware.smackx.thumbnails.element;
-
-import org.jivesoftware.smack.packet.ExtensionElement;
-import org.jivesoftware.smack.packet.XmlEnvironment;
-import org.jivesoftware.smack.util.Objects;
-import org.jivesoftware.smack.util.XmlStringBuilder;
-
-public class ThumbnailElement implements ExtensionElement {
-
- public static final String ELEMENT = "thumbnail";
- public static final String NAMESPACE = "urn:xmpp:thumbs:1";
- public static final String ELEM_URI = "uri";
- public static final String ELEM_MEDIA_TYPE = "media-type";
- public static final String ELEM_WIDTH = "width";
- public static final String ELEM_HEIGHT = "height";
-
- private final String uri;
- private final String mediaType;
- private final Integer width;
- private final Integer height;
-
- public ThumbnailElement(String uri) {
- this(uri, null, null, null);
- }
-
- public ThumbnailElement(String uri, String mediaType, Integer width, Integer height) {
- this.uri = Objects.requireNonNull(uri);
- this.mediaType = mediaType;
-
- if (width != null && width < 0) {
- throw new IllegalArgumentException("Width cannot be negative.");
- }
- this.width = width;
-
- if (height != null && height < 0) {
- throw new IllegalArgumentException("Height cannot be negative.");
- }
- this.height = height;
- }
-
- public String getUri() {
- return uri;
- }
-
- public String getMediaType() {
- return mediaType;
- }
-
- public Integer getWidth() {
- return width;
- }
-
- public Integer getHeight() {
- return height;
- }
-
- @Override
- public CharSequence toXML(XmlEnvironment xmlEnvironment) {
- XmlStringBuilder sb = new XmlStringBuilder(this, xmlEnvironment);
- return sb.attribute(ELEM_URI, uri)
- .optAttribute(ELEM_MEDIA_TYPE, mediaType)
- .optAttribute(ELEM_WIDTH, width)
- .optAttribute(ELEM_HEIGHT, height)
- .closeEmptyElement();
- }
-
- @Override
- public String getElementName() {
- return ELEMENT;
- }
-
- @Override
- public String getNamespace() {
- return NAMESPACE;
- }
-}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/element/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/element/package-info.java
deleted file mode 100644
index a13671247..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/element/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- *
- * Copyright 2023 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Smacks implementation of XEP-0264: Jingle Content Thumbnails.
- */
-package org.jivesoftware.smackx.thumbnails.element;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProvider.java
deleted file mode 100644
index 6fc174002..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2023 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jivesoftware.smackx.thumbnails.provider;
-
-import java.io.IOException;
-import java.text.ParseException;
-
-import org.jivesoftware.smack.packet.XmlEnvironment;
-import org.jivesoftware.smack.parsing.SmackParsingException;
-import org.jivesoftware.smack.provider.ExtensionElementProvider;
-import org.jivesoftware.smack.util.ParserUtils;
-import org.jivesoftware.smack.xml.XmlPullParser;
-import org.jivesoftware.smack.xml.XmlPullParserException;
-import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;
-
-public class ThumbnailElementProvider extends ExtensionElementProvider {
- @Override
- public ThumbnailElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
- throws XmlPullParserException, IOException, SmackParsingException, ParseException {
- String uri = parser.getAttributeValue(ThumbnailElement.ELEM_URI);
- String mediaType = parser.getAttributeValue(ThumbnailElement.ELEM_MEDIA_TYPE);
- Integer width = ParserUtils.getIntegerAttribute(parser, ThumbnailElement.ELEM_WIDTH);
- Integer height = ParserUtils.getIntegerAttribute(parser, ThumbnailElement.ELEM_HEIGHT);
-
- return new ThumbnailElement(
- uri,
- mediaType,
- width,
- height
- );
- }
-}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/provider/package-info.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/provider/package-info.java
deleted file mode 100644
index 20816c2ce..000000000
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/thumbnails/provider/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- *
- * Copyright 2023 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Smacks implementation of XEP-0264: Jingle Content Thumbnails.
- */
-package org.jivesoftware.smackx.thumbnails.provider;
diff --git a/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers b/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers
index 822bc5837..eb0c1a45f 100644
--- a/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers
+++ b/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers
@@ -2,13 +2,6 @@
-
-
- thumbnail
- urn:xmpp:thumbs:1
- org.jivesoftware.smackx.thumbnails.provider.ThumbnailElementProvider
-
-
sent
@@ -352,13 +345,6 @@
org.jivesoftware.smackx.fallback_indication.provider.FallbackIndicationElementProvider
-
-
- file
- urn:xmpp:file:metadata:0
- org.jivesoftware.smackx.file_metadata.provider.FileMetadataElementProvider
-
-
query
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/eme/ExplicitMessageEncryptionElementTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/eme/ExplicitMessageEncryptionElementTest.java
index b9364b01f..dc14db131 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/eme/ExplicitMessageEncryptionElementTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/eme/ExplicitMessageEncryptionElementTest.java
@@ -39,7 +39,7 @@ public class ExplicitMessageEncryptionElementTest extends SmackTestSuite {
public void addToMessageTest() {
Message message = StanzaBuilder.buildMessage().build();
- // Check initial state (no elements)
+ // Check inital state (no elements)
assertNull(ExplicitMessageEncryptionElement.from(message));
assertFalse(ExplicitMessageEncryptionElement.hasProtocol(message,
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.omemoVAxolotl));
@@ -75,7 +75,7 @@ public class ExplicitMessageEncryptionElementTest extends SmackTestSuite {
assertTrue(ExplicitMessageEncryptionElement.hasProtocol(message,
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.omemoVAxolotl));
- // Check, if adding additional OMEMO won't add another element
+ // Check, if adding additional OMEMO wont add another element
ExplicitMessageEncryptionElement.set(messageBuilder,
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.omemoVAxolotl);
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/file_metadata/FileMetadataElementTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/file_metadata/FileMetadataElementTest.java
deleted file mode 100644
index 229581308..000000000
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/file_metadata/FileMetadataElementTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- *
- * Copyright 2020 Paul Schaub
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jivesoftware.smackx.file_metadata;
-
-import static org.jivesoftware.smack.test.util.XmlAssertUtil.assertXmlSimilar;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import java.text.ParseException;
-import java.util.Date;
-
-import org.jivesoftware.smack.test.util.SmackTestSuite;
-import org.jivesoftware.smack.test.util.SmackTestUtil;
-import org.jivesoftware.smackx.file_metadata.element.FileMetadataElement;
-import org.jivesoftware.smackx.file_metadata.provider.FileMetadataElementProvider;
-import org.jivesoftware.smackx.hashes.HashManager;
-import org.jivesoftware.smackx.hashes.element.HashElement;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.EnumSource;
-import org.jxmpp.util.XmppDateTime;
-
-public class FileMetadataElementTest extends SmackTestSuite {
-
- private static final Date date;
- static {
- try {
- date = XmppDateTime.parseDate("2015-07-26T21:46:00+01:00");
- } catch (ParseException e) {
- throw new IllegalStateException(e);
- }
- }
-
- private static final FileMetadataElement metadataElement = FileMetadataElement.builder()
- .setModificationDate(date)
- .setWidth(1920)
- .setHeight(1080)
- .addDescription("Picture of 24th XSF Summit")
- .addDescription("Foto vom 24. XSF Summit", "de")
- .addHash(new HashElement(HashManager.ALGORITHM.SHA_256, "2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU="))
- .setLength(63000)
- .setMediaType("text/plain")
- .setName("text.txt")
- .setSize(6144)
- .build();
-
- private static final String expectedXml = "" +
- "2015-07-26T20:46:00.000+00:00" +
- "1920" +
- "1080" +
- "Picture of 24th XSF Summit" +
- "Foto vom 24. XSF Summit" +
- "2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=" +
- "63000" +
- "text/plain" +
- "text.txt" +
- "6144" +
- "";
-
- private static final String expectedLegacyXml = "" +
- "2015-07-26T20:46:00.000+00:00" +
- "1920x1080" +
- "Picture of 24th XSF Summit" +
- "Foto vom 24. XSF Summit" +
- "2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=" +
- "63000" +
- "text/plain" +
- "text.txt" +
- "6144" +
- "";
-
- @Test
- public void testSerialization() {
- assertXmlSimilar(expectedXml, metadataElement.toXML().toString());
- }
-
- @ParameterizedTest
- @EnumSource(SmackTestUtil.XmlPullParserKind.class)
- public void testParsing(SmackTestUtil.XmlPullParserKind parserKind) throws Exception {
- FileMetadataElement parsed = SmackTestUtil.parse(expectedXml, FileMetadataElementProvider.class, parserKind);
-
- assertEquals(metadataElement, parsed);
- }
-
- @ParameterizedTest
- @EnumSource(SmackTestUtil.XmlPullParserKind.class)
- public void testLegacyParsing(SmackTestUtil.XmlPullParserKind parserKind) throws Exception {
- FileMetadataElement parsed = SmackTestUtil.parse(expectedLegacyXml, FileMetadataElementProvider.class, parserKind);
-
- assertEquals(metadataElement, parsed);
- }
-
- @ParameterizedTest
- @EnumSource(SmackTestUtil.XmlPullParserKind.class)
- public void testParseUnknownExtension(SmackTestUtil.XmlPullParserKind parserKind) throws Exception {
- final String xml = "" +
- "2015-07-26T20:46:00.000+00:00" +
- "1920" +
- "1080" +
- "foo" +
- "Picture of 24th XSF Summit" +
- "Foto vom 24. XSF Summit" +
- "2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=" +
- "63000" +
- "text/plain" +
- "text.txt" +
- "6144" +
- "";
-
- FileMetadataElement parsed = SmackTestUtil.parse(xml, FileMetadataElementProvider.class, parserKind);
-
- assertEquals(metadataElement, parsed);
- }
-
- @Test
- public void nameIsEscaped() {
- FileMetadataElement e = FileMetadataElement.builder().setName("/etc/passwd").build();
- assertEquals("%2Fetc%2Fpasswd", e.getName());
- }
-
- @Test
- public void rejectNegativeSize() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setSize(-1));
- }
-
- @Test
- public void rejectNegativeLength() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setLength(-1));
- }
-
- @Test
- public void rejectNegativeWidth() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setWidth(-1));
- }
-
- @Test
- public void rejectNegativeHeight() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setHeight(-1));
- }
-
- @Test
- public void rejectEmptyDescription() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().addDescription(""));
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().addDescription(null));
- }
-
- @Test
- public void rejectEmptyNameElement() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setName(""));
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setName(null));
- }
-
- @Test
- public void rejectEmptyMediaTypeElement() {
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setMediaType(""));
- assertThrows(IllegalArgumentException.class, () -> FileMetadataElement.builder().setMediaType(null));
- }
-
- @Test
- public void getDescTest() {
- FileMetadataElement metadataElement = FileMetadataElement.builder()
- .addDescription("Foo", "br")
- .addDescription("Baz")
- .addDescription("Bag", "en")
- .build();
-
- assertEquals("Foo", metadataElement.getDescription("br"));
- assertEquals("Baz", metadataElement.getDescription(null));
- assertEquals("Baz", metadataElement.getDescription());
- assertEquals("Bag", metadataElement.getDescription("en"));
- assertNull(metadataElement.getDescription("null"));
- assertEquals(3, metadataElement.getDescriptions().size());
- }
-}
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java
index df14ea279..b5c974dce 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2016 Fernando Ramirez, 2018-2024 Florian Schmaus
+ * Copyright 2016 Fernando Ramirez, 2018-2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,6 @@ public class FiltersTest extends MamTest {
return xml;
}
- @SuppressWarnings("JavaUtilDate")
@Test
public void checkStartDateFilter() throws Exception {
Date date = new Date();
@@ -62,7 +61,6 @@ public class FiltersTest extends MamTest {
assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString());
}
- @SuppressWarnings("JavaUtilDate")
@Test
public void checkEndDateFilter() throws Exception {
Date date = new Date();
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightAffiliationsChangeExtensionTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightAffiliationsChangeExtensionTest.java
index ab9e53750..a07577748 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightAffiliationsChangeExtensionTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightAffiliationsChangeExtensionTest.java
@@ -18,7 +18,7 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.util.Map;
+import java.util.HashMap;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.PacketParserUtils;
@@ -55,7 +55,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
.from(changeAffiliationsMessage);
- Map affiliations = affiliationsChangeExtension.getAffiliations();
+ HashMap affiliations = affiliationsChangeExtension.getAffiliations();
assertEquals(affiliations.size(), 3);
assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
@@ -68,7 +68,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
.from(changeAffiliationsMessage);
- Map affiliations = affiliationsChangeExtension.getAffiliations();
+ HashMap affiliations = affiliationsChangeExtension.getAffiliations();
assertEquals(affiliations.size(), 2);
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
assertEquals(affiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);
@@ -83,7 +83,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
.from(changeAffiliationsMessage);
- Map affiliations = affiliationsChangeExtension.getAffiliations();
+ HashMap affiliations = affiliationsChangeExtension.getAffiliations();
assertEquals(affiliations.size(), 2);
assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightChangeAffiliationsIQTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightChangeAffiliationsIQTest.java
index ca0e1e4cb..efbb22da7 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightChangeAffiliationsIQTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightChangeAffiliationsIQTest.java
@@ -19,7 +19,6 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
-import java.util.Map;
import org.jivesoftware.smack.packet.IQ;
@@ -33,7 +32,7 @@ public class MUCLightChangeAffiliationsIQTest {
@Test
public void checkChangeAffiliationsMUCLightStanza() throws Exception {
- Map affiliations = new HashMap<>();
+ HashMap affiliations = new HashMap<>();
affiliations.put(JidCreate.from("sarasa2@shakespeare.lit"), MUCLightAffiliation.owner);
affiliations.put(JidCreate.from("sarasa1@shakespeare.lit"), MUCLightAffiliation.member);
affiliations.put(JidCreate.from("sarasa3@shakespeare.lit"), MUCLightAffiliation.none);
@@ -45,7 +44,7 @@ public class MUCLightChangeAffiliationsIQTest {
assertEquals(mucLightChangeAffiliationsIQ.getTo(), "coven@muclight.shakespeare.lit");
assertEquals(mucLightChangeAffiliationsIQ.getType(), IQ.Type.set);
- Map iqAffiliations = mucLightChangeAffiliationsIQ.getAffiliations();
+ HashMap iqAffiliations = mucLightChangeAffiliationsIQ.getAffiliations();
assertEquals(iqAffiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
assertEquals(iqAffiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
assertEquals(iqAffiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightCreateIQTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightCreateIQTest.java
index 4a92da24e..216a2a494 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightCreateIQTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightCreateIQTest.java
@@ -19,8 +19,8 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jivesoftware.smackx.muclight.element.MUCLightCreateIQ;
@@ -43,7 +43,7 @@ public class MUCLightCreateIQTest {
assertEquals(mucLightCreateIQ.getConfiguration().getRoomName(), "test");
- Map iqOccupants = mucLightCreateIQ.getOccupants();
+ HashMap iqOccupants = mucLightCreateIQ.getOccupants();
assertEquals(iqOccupants.get(JidCreate.from("charlie@test.com")), MUCLightAffiliation.member);
assertEquals(iqOccupants.get(JidCreate.from("pep@test.com")), MUCLightAffiliation.member);
}
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightGetAffiliationsTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightGetAffiliationsTest.java
index 5504468ef..782171ae1 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightGetAffiliationsTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightGetAffiliationsTest.java
@@ -18,7 +18,7 @@ package org.jivesoftware.smackx.muclight;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import java.util.Map;
+import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StreamOpen;
@@ -57,7 +57,7 @@ public class MUCLightGetAffiliationsTest {
assertEquals("123456", mucLightAffiliationsIQ.getVersion());
- Map