diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fa9bb447a..3dfc78a9f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -56,7 +56,7 @@ jobs:
uses: android-actions/setup-android@v3
- name: Install Android SDK
run: |
- sdkmanager "platforms;android-23"
+ sdkmanager "platforms;android-26"
# Testing
- name: Gradle Check
diff --git a/Makefile b/Makefile
index 4689ef8af..c4f435597 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
GRADLE ?= ./gradlew
.PHONY: all
-all: check jacocoRootReport javadocAll sinttest
+all: check codecov eclipse javadocAll sinttest
.PHONY: codecov
codecov:
$(GRADLE) smack-java11-full:testCodeCoverageReport
- echo "Report available at smack-java11-full/build/reports/jacoco/testCodeCoverageReport/html/index.html"
+ echo "code coverage report available at file://$(PWD)/smack-java11-full/build/reports/jacoco/testCodeCoverageReport/html/index.html"
.PHONY: check
check:
@@ -20,11 +20,7 @@ eclipse:
sinttest:
$(GRADLE) $@
-.PHONY: jacocoRootReport
-jacocoRootReport:
- $(GRADLE) $@
-
.PHONY: javadocAll
javadocAll:
$(GRADLE) $@
- echo "Smack javadoc available at build/javadoc/index.html"
+ echo "javadoc available at file://$(PWD)/build/javadoc/index.html"
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
index 94beb432c..83fe952cd 100644
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
@@ -3,7 +3,7 @@ plugins {
id 'org.igniterealtime.smack.global-conventions'
}
dependencies {
- signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:6.0_r3@signature"
+ signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:8.0.0_r2@signature"
}
animalsniffer {
sourceSets = [sourceSets.main]
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
index 5bd92c7ee..751178ed0 100644
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
@@ -1,7 +1,7 @@
ext {
javaVersion = JavaVersion.VERSION_11
javaMajor = javaVersion.getMajorVersion()
- smackMinAndroidSdk = 23
+ smackMinAndroidSdk = 26
androidBootClasspath = { getAndroidRuntimeJar() }
}
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle
index 598fdfa67..dc82489ab 100644
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle
@@ -89,28 +89,7 @@ tasks.withType(JavaCompile) {
'-Xlint:-serial',
'-Werror',
]
-}
-if (JavaVersion.current().isJava8Compatible()) {
- tasks.withType(Javadoc) {
- // The '-quiet' as second argument is actually a hack,
- // since the one parameter addStringOption doesn't seem to
- // work, we extra add '-quiet', which is added anyway by
- // gradle.
- // We disable 'missing' as we do most of javadoc checking via checkstyle.
- options.addStringOption('Xdoclint:all,-missing', '-quiet')
- // Abort on javadoc warnings.
- // See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
- // for information about the -Xwerror option.
- options.addStringOption('Xwerror', '-quiet')
- }
-}
-
-if (JavaVersion.current().isJava9Compatible()) {
- tasks.withType(JavaCompile) {
- options.compilerArgs.addAll([
- '--release', javaMajor,
- ])
- }
+ options.release = Integer.valueOf(javaMajor)
}
jacoco {
@@ -177,7 +156,7 @@ jar {
}
checkstyle {
- toolVersion = '8.27'
+ toolVersion = '10.18.2'
if (project in gplLicensedProjects) {
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
@@ -344,17 +323,6 @@ def getGitCommit() {
gitCommit
}
-def getAndroidRuntimeJar() {
- def androidHome = new File("$System.env.ANDROID_HOME")
- if (!androidHome.isDirectory()) throw new Exception("ANDROID_HOME not found or set")
- def androidJar = new File("$androidHome/platforms/android-$smackMinAndroidSdk/android.jar")
- if (androidJar.isFile()) {
- return androidJar
- } else {
- throw new Exception("Can't find android.jar for $smackMinAndroidSdk API. Please install corresponding SDK platform package")
- }
-}
-
def readVersionFile() {
def versionFile = new File(rootDir, 'version')
if (!versionFile.isFile()) {
diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle
index 61cb8f3c6..34bf7a682 100644
--- a/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle
+++ b/build-logic/src/main/groovy/org.igniterealtime.smack.javadoc-conventions.gradle
@@ -4,25 +4,19 @@ plugins {
id 'org.igniterealtime.smack.global-conventions'
}
-if (JavaVersion.current().isJava8Compatible()) {
- tasks.withType(Javadoc) {
- // The '-quiet' as second argument is actually a hack,
- // since the one parameter addStringOption doesn't seem to
- // work, we extra add '-quiet', which is added anyway by
- // gradle.
- // We disable 'missing' as we do most of javadoc checking via checkstyle.
- options.addStringOption('Xdoclint:all,-missing', '-quiet')
- // Abort on javadoc warnings.
- // See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
- // for information about the -Xwerror option.
- options.addStringOption('Xwerror', '-quiet')
- }
-}
-if (JavaVersion.current().isJava9Compatible()) {
- tasks.withType(Javadoc) {
- options.addStringOption('-release', javaMajor)
- }
+tasks.withType(Javadoc) {
+ // The '-quiet' as second argument is actually a hack,
+ // since the one parameter addStringOption doesn't seem to
+ // work, we extra add '-quiet', which is added anyway by
+ // gradle.
+ // We disable 'missing' as we do most of javadoc checking via checkstyle.
+ options.addStringOption('Xdoclint:all,-missing', '-quiet')
+ // Abort on javadoc warnings.
+ // See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
+ // for information about the -Xwerror option.
+ options.addStringOption('Xwerror', '-quiet')
+ options.addStringOption('-release', javaMajor)
}
tasks.withType(Javadoc) {
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
index ce6b4200d..31df0a8f0 100644
--- a/config/checkstyle/checkstyle.xml
+++ b/config/checkstyle/checkstyle.xml
@@ -104,7 +104,7 @@
-
+
@@ -195,15 +195,15 @@
, TYPE_EXTENSION_AND
"/>
-
-
-
-
-
+
+
+
+
+
diff --git a/resources/eclipse/smack.importorder b/resources/eclipse/smack.importorder
index f87892a1c..2b5f1dadf 100644
--- a/resources/eclipse/smack.importorder
+++ b/resources/eclipse/smack.importorder
@@ -1,6 +1,8 @@
#Organize Import Order
#Wed Jun 14 16:42:40 CEST 2017
-5=
+7=
+6=org.igniterealtime.smackx
+5=org.igniterealtime.smack
4=org.jivesoftware.smackx
3=org.jivesoftware.smack
2=javax
diff --git a/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java b/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java
index 0315629c8..b8d3cde5b 100644
--- a/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java
+++ b/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java
@@ -28,6 +28,7 @@ import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPConnectionRegistry;
import org.jivesoftware.smack.util.Async;
+
import org.jivesoftware.smackx.ping.PingManager;
import android.app.AlarmManager;
@@ -173,7 +174,13 @@ public final class ServerPingWithAlarmManager extends Manager {
*/
public static void onCreate(Context context) {
sContext = context;
- context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
+
+ int receiverFlags = 0;
+ if (Build.VERSION.SDK_INT >= 34) {
+ receiverFlags |= 4; // RECEIVER_NOT_EXPORTED
+ }
+ context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION), receiverFlags);
+
sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
int pendingIntentFlags = 0;
if (Build.VERSION.SDK_INT >= 23) {
diff --git a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
index f1c0b9015..e011e10ab 100644
--- a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
+++ b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
@@ -499,7 +499,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
*
* @author Guenther Niess
*/
- private class BOSHConnectionListener implements BOSHClientConnListener {
+ private final class BOSHConnectionListener implements BOSHClientConnListener {
/**
* Notify the BOSHConnection about connection state changes.
@@ -556,7 +556,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
*
* @author Guenther Niess
*/
- private class BOSHPacketReader implements BOSHClientResponseListener {
+ private final class BOSHPacketReader implements BOSHClientResponseListener {
/**
* Parse the received packets and notify the corresponding connection.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
index a3fc2f941..2967a44f1 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
@@ -281,8 +281,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
*/
protected Writer writer;
- protected SmackException currentSmackException;
- protected XMPPException currentXmppException;
+ private Exception currentConnectionException;
protected boolean tlsHandled;
@@ -511,8 +510,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public abstract boolean isUsingCompression();
protected void initState() {
- currentSmackException = null;
- currentXmppException = null;
+ currentConnectionException = null;
saslFeatureReceived = lastFeaturesReceived = tlsHandled = false;
// TODO: We do not init closingStreamReceived here, as the integration tests use it to check if we waited for
// it.
@@ -686,28 +684,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return streamId;
}
- protected final void throwCurrentConnectionException() throws SmackException, XMPPException {
- if (currentSmackException != null) {
- throw currentSmackException;
- } else if (currentXmppException != null) {
- throw currentXmppException;
- }
-
- throw new AssertionError("No current connection exception set, although throwCurrentException() was called");
- }
-
protected final boolean hasCurrentConnectionException() {
- return currentSmackException != null || currentXmppException != null;
+ return currentConnectionException != null;
}
protected final void setCurrentConnectionExceptionAndNotify(Exception exception) {
- if (exception instanceof SmackException) {
- currentSmackException = (SmackException) exception;
- } else if (exception instanceof XMPPException) {
- currentXmppException = (XMPPException) exception;
- } else {
- currentSmackException = new SmackException.SmackWrappedException(exception);
- }
+ currentConnectionException = exception;
notifyWaitingThreads();
}
@@ -741,10 +723,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return true;
}
- protected final void waitForConditionOrThrowConnectionException(Supplier condition, String waitFor) throws InterruptedException, SmackException, XMPPException {
+ protected final void waitForConditionOrThrowConnectionException(Supplier condition, String waitFor)
+ throws InterruptedException, SmackException.SmackWrappedException, NoResponseException {
boolean success = waitFor(() -> condition.get().booleanValue() || hasCurrentConnectionException());
- if (hasCurrentConnectionException()) {
- throwCurrentConnectionException();
+ final Exception currentConnectionException = this.currentConnectionException;
+ if (currentConnectionException != null) {
+ throw new SmackException.SmackWrappedException(currentConnectionException);
}
// If there was no connection exception and we still did not successfully wait for the condition to hold, then
@@ -1048,7 +1032,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
protected final boolean waitForClosingStreamTagFromServer() {
try {
waitForConditionOrThrowConnectionException(() -> closingStreamReceived, "closing stream tag from the server");
- } catch (InterruptedException | SmackException | XMPPException e) {
+ } catch (InterruptedException | SmackException.SmackWrappedException | NoResponseException e) {
LOGGER.log(Level.INFO, "Exception while waiting for closing stream element from the server " + this, e);
return false;
}
@@ -1460,7 +1444,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
int parserDepth = parser.getDepth();
Stanza stanza = null;
try {
- stanza = PacketParserUtils.parseStanza(parser, incomingStreamXmlEnvironment);
+ try {
+ stanza = PacketParserUtils.parseStanza(parser, incomingStreamXmlEnvironment);
+ } catch (NullPointerException e) {
+ // Those exceptions should probably be wrapped into a SmackParsingException and therefore likely constitute a missing verification in the throwing parser.
+ String message = "Smack parser throw unexpected exception '" + e.getMessage() + "', please report this at " + Smack.BUG_REPORT_URL;
+ LOGGER.log(Level.SEVERE, message, e);
+ throw new IOException(message, e);
+ }
}
catch (XmlPullParserException | SmackParsingException | IOException | IllegalArgumentException e) {
CharSequence content = PacketParserUtils.parseContentDepth(parser,
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/Smack.java b/smack-core/src/main/java/org/jivesoftware/smack/Smack.java
index daa7a18b4..0b7f173bb 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/Smack.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/Smack.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2020-2021 Florian Schmaus
+ * Copyright 2020-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,9 @@
package org.jivesoftware.smack;
import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
import java.util.logging.Logger;
import org.jivesoftware.smack.util.FileUtils;
@@ -29,6 +32,16 @@ public class Smack {
public static final String SMACK_PACKAGE = SMACK_ORG + ".smack";
+ public static final URL BUG_REPORT_URL;
+
+ static {
+ try {
+ BUG_REPORT_URL = URI.create("https://discourse.igniterealtime.org/c/smack/smack-support/9").toURL();
+ } catch (MalformedURLException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
+
/**
* Returns the Smack version information, e.g."1.3.0".
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
index ef1101cff..10d70228e 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
@@ -18,6 +18,7 @@
package org.jivesoftware.smack;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -60,7 +61,7 @@ public final class SmackConfiguration {
static {
try {
- SMACK_URL = new URL(SMACK_URL_STRING);
+ SMACK_URL = URI.create(SMACK_URL_STRING).toURL();
} catch (MalformedURLException e) {
throw new IllegalStateException(e);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java
index 8fc59ab3a..504e38103 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java
@@ -164,7 +164,7 @@ public class SmackReactor {
return scheduledActions.remove(scheduledAction);
}
- private class Reactor extends Thread {
+ private final class Reactor extends Thread {
private volatile long shutdownRequestTimestamp = -1;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/altconnections/HttpLookupMethod.java b/smack-core/src/main/java/org/jivesoftware/smack/altconnections/HttpLookupMethod.java
index e30530be7..f836c5cec 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/altconnections/HttpLookupMethod.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/altconnections/HttpLookupMethod.java
@@ -117,7 +117,7 @@ public final class HttpLookupMethod {
*/
public static InputStream getXrdStream(DomainBareJid xmppServiceAddress) throws IOException {
final String metadataUrl = "https://" + xmppServiceAddress + "/.well-known/host-meta";
- final URL putUrl = new URL(metadataUrl);
+ final URL putUrl = URI.create(metadataUrl).toURL();
final URLConnection urlConnection = putUrl.openConnection();
return urlConnection.getInputStream();
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java
index ca3de8190..8cdac17b9 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java
@@ -39,6 +39,7 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.OutgoingQueueFullException;
+import org.jivesoftware.smack.SmackException.SmackWrappedException;
import org.jivesoftware.smack.SmackFuture;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.FailedNonzaException;
@@ -259,7 +260,7 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
@Override
public void waitForConditionOrThrowConnectionException(Supplier condition, String waitFor)
- throws InterruptedException, SmackException, XMPPException {
+ throws InterruptedException, SmackWrappedException, NoResponseException {
ModularXmppClientToServerConnection.this.waitForConditionOrThrowConnectionException(condition, waitFor);
}
@@ -596,8 +597,7 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
case "error":
StreamError streamError = PacketParserUtils.parseStreamError(parser, null);
StreamErrorException streamErrorException = new StreamErrorException(streamError);
- currentXmppException = streamErrorException;
- notifyWaitingThreads();
+ setCurrentConnectionExceptionAndNotify(streamErrorException);
throw streamErrorException;
case "features":
parseFeatures(parser);
@@ -1048,8 +1048,7 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
XmppInputOutputFilter filter = it.next();
try {
filter.waitUntilInputOutputClosed();
- } catch (IOException | CertificateException | InterruptedException | SmackException
- | XMPPException e) {
+ } catch (IOException | CertificateException | InterruptedException | SmackException | XMPPException e) {
LOGGER.log(Level.WARNING, "waitUntilInputOutputClosed() threw", e);
}
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/c2s/internal/ModularXmppClientToServerConnectionInternal.java b/smack-core/src/main/java/org/jivesoftware/smack/c2s/internal/ModularXmppClientToServerConnectionInternal.java
index bc8b9d441..42cf9c650 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/c2s/internal/ModularXmppClientToServerConnectionInternal.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/c2s/internal/ModularXmppClientToServerConnectionInternal.java
@@ -26,6 +26,7 @@ import java.util.Queue;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
+import org.jivesoftware.smack.SmackException.SmackWrappedException;
import org.jivesoftware.smack.SmackReactor;
import org.jivesoftware.smack.SmackReactor.ChannelSelectedCallback;
import org.jivesoftware.smack.XMPPException;
@@ -127,7 +128,8 @@ public abstract class ModularXmppClientToServerConnectionInternal {
public abstract void asyncGo(Runnable runnable);
- public abstract void waitForConditionOrThrowConnectionException(Supplier condition, String waitFor) throws InterruptedException, SmackException, XMPPException;
+ public abstract void waitForConditionOrThrowConnectionException(Supplier condition, String waitFor)
+ throws InterruptedException, SmackWrappedException, NoResponseException;
public abstract void notifyWaitingThreads();
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProvider.java
index 2831ed864..665ccdb39 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProvider.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProvider.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2019-2021 Florian Schmaus
+ * Copyright 2019-2024 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,15 @@ import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.text.ParseException;
import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.parsing.SmackParsingException;
+import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jivesoftware.smack.xml.XmlPullParserException;
public class AbstractProvider {
@@ -106,4 +111,14 @@ public class AbstractProvider {
return e;
}
+
+ public static URL toUrl(String string) throws SmackUriSyntaxParsingException, MalformedURLException {
+ URI uri;
+ try {
+ uri = new URI(string);
+ } catch (URISyntaxException e) {
+ throw new SmackUriSyntaxParsingException(e);
+ }
+ return uri.toURL();
+ }
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/EventManger.java b/smack-core/src/main/java/org/jivesoftware/smack/util/EventManger.java
index f4750423e..109869bcd 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/EventManger.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/EventManger.java
@@ -87,7 +87,7 @@ public class EventManger {
return true;
}
- private static class Reference {
+ private static final class Reference {
volatile V eventResult;
}
diff --git a/smack-examples/src/main/java/org/igniterealtime/smack/examples/IoT.java b/smack-examples/src/main/java/org/igniterealtime/smack/examples/IoT.java
index 12c74fb2a..34d7bc36b 100644
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/IoT.java
+++ b/smack-examples/src/main/java/org/igniterealtime/smack/examples/IoT.java
@@ -49,6 +49,7 @@ import org.jivesoftware.smackx.iot.provisioning.BecameFriendListener;
import org.jivesoftware.smackx.iot.provisioning.IoTProvisioningManager;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
diff --git a/smack-examples/src/main/java/org/igniterealtime/smack/examples/WebSocketConnection.java b/smack-examples/src/main/java/org/igniterealtime/smack/examples/WebSocketConnection.java
index 9e4e5856f..bed50f8b4 100644
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/WebSocketConnection.java
+++ b/smack-examples/src/main/java/org/igniterealtime/smack/examples/WebSocketConnection.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2021 Florian Schmaus
+ * Copyright 2021-2024 Florian Schmaus
*
* This file is part of smack-examples.
*
@@ -25,7 +25,6 @@ import java.net.URISyntaxException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
-
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration;
import org.jivesoftware.smack.util.TLSUtils;
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
index c44adb157..18c287e11 100644
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppConnectionTool.java
+++ b/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppConnectionTool.java
@@ -31,6 +31,7 @@ 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;
diff --git a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppTools.java b/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppTools.java
index 70bb9f1f2..49da3e518 100644
--- a/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppTools.java
+++ b/smack-examples/src/main/java/org/igniterealtime/smack/examples/XmppTools.java
@@ -37,6 +37,7 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.util.TLSUtils;
+
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.iqregister.AccountManager;
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
index e9f2976bb..dfc5f55cb 100644
--- 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
@@ -32,6 +32,7 @@ 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;
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
index e4212b0ce..cc268b4f5 100644
--- 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
@@ -25,6 +25,7 @@ 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;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java
index 8efcb0dfe..93dde8746 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/AbstractHttpOverXmppProvider.java
@@ -160,7 +160,7 @@ public abstract class AbstractHttpOverXmppProvider {
@Override
- public Slot parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
+ public Slot parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackUriSyntaxParsingException {
final String namespace = parser.getNamespace();
final UploadService.Version version = HttpFileUploadManager.namespaceToVersion(namespace);
@@ -63,7 +65,7 @@ public class SlotProvider extends IqProvider {
switch (version) {
case v0_2:
String putUrlString = parser.nextText();
- putUrl = new URL(putUrlString);
+ putUrl = toUrl(putUrlString);
break;
case v0_3:
putElementV04Content = parsePutElement_V0_4(parser);
@@ -85,7 +87,7 @@ public class SlotProvider extends IqProvider {
default:
throw new AssertionError();
}
- getUrl = new URL(getUrlString);
+ getUrl = toUrl(getUrlString);
break;
}
break;
@@ -114,7 +116,7 @@ public class SlotProvider extends IqProvider {
final int initialDepth = parser.getDepth();
String putUrlString = parser.getAttributeValue(null, "url");
- URL putUrl = new URL(putUrlString);
+ URL putUrl = URI.create(putUrlString).toURL();
Map headers = null;
outerloop: while (true) {
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElementFactory.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElementFactory.java
index 6b0017bbc..78025f364 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElementFactory.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElementFactory.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.xml.XmlPullParser;
+
import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.rsm.packet.RSMSet;
import org.jivesoftware.smackx.xdata.packet.DataForm;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java
index 6e3d7e982..dae64f4c1 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java
@@ -25,6 +25,7 @@ import org.jivesoftware.smack.packet.MessageView;
import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
+
import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jxmpp.jid.Jid;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV1ElementFactory.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV1ElementFactory.java
index e87f79ca7..7e8ce0c2d 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV1ElementFactory.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV1ElementFactory.java
@@ -17,9 +17,11 @@
package org.jivesoftware.smackx.mam.element;
import java.util.List;
+
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.Message;
+
import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.rsm.packet.RSMSet;
import org.jivesoftware.smackx.xdata.packet.DataForm;
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV2ElementFactory.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV2ElementFactory.java
index a706f8632..092c4e329 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV2ElementFactory.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamV2ElementFactory.java
@@ -17,9 +17,11 @@
package org.jivesoftware.smackx.mam.element;
import java.util.List;
+
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.Message;
+
import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.rsm.packet.RSMSet;
import org.jivesoftware.smackx.xdata.packet.DataForm;
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
index 6fc174002..3d3f2fa9a 100644
--- 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
@@ -25,6 +25,7 @@ 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 {
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
index 229581308..23b73a59c 100644
--- 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
@@ -26,6 +26,7 @@ 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;
diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProviderTest.java
index dbaec7c9a..0e0f8a078 100644
--- a/smack-experimental/src/test/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProviderTest.java
+++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/thumbnails/provider/ThumbnailElementProviderTest.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.test.util.SmackTestUtil;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;
import org.junit.jupiter.params.ParameterizedTest;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
index 0e74aa813..147467722 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
@@ -461,7 +461,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* IQIBBInputStream class implements IBBInputStream to be used with IQ stanzas encapsulating the
* data packets.
*/
- private class IQIBBInputStream extends IBBInputStream {
+ private final class IQIBBInputStream extends IBBInputStream {
@Override
protected StanzaListener getDataPacketListener() {
@@ -541,7 +541,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* MessageIBBInputStream class implements IBBInputStream to be used with message stanzas
* encapsulating the data packets.
*/
- private class MessageIBBInputStream extends IBBInputStream {
+ private final class MessageIBBInputStream extends IBBInputStream {
@Override
protected StanzaListener getDataPacketListener() {
@@ -590,7 +590,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* containing an In-Band Bytestream data stanza extension whose session ID matches this sessions
* ID.
*/
- private class IBBDataPacketFilter implements StanzaFilter {
+ private final class IBBDataPacketFilter implements StanzaFilter {
@Override
public boolean accept(Stanza packet) {
@@ -814,7 +814,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* IQIBBOutputStream class implements IBBOutputStream to be used with IQ stanzas encapsulating
* the data packets.
*/
- private class IQIBBOutputStream extends IBBOutputStream {
+ private final class IQIBBOutputStream extends IBBOutputStream {
@Override
protected synchronized void writeToXML(DataPacketExtension data) throws IOException {
@@ -845,7 +845,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* MessageIBBOutputStream class implements IBBOutputStream to be used with message stanzas
* encapsulating the data packets.
*/
- private class MessageIBBOutputStream extends IBBOutputStream {
+ private final class MessageIBBOutputStream extends IBBOutputStream {
@Override
protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException, InterruptedException {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java
index 117333095..8656907f0 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java
@@ -433,7 +433,7 @@ public class Socks5Proxy {
/**
* Implementation of a simplified SOCKS5 proxy server.
*/
- private class Socks5ServerProcess implements Runnable {
+ private final class Socks5ServerProcess implements Runnable {
@Override
public void run() {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AbstractAdHocCommand.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AbstractAdHocCommand.java
index 8a12b29f3..7fb402326 100755
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AbstractAdHocCommand.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AbstractAdHocCommand.java
@@ -25,6 +25,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.StringUtils;
+
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData.Action;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData.AllowedAction;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java
index 0e7fabaaa..4f1a4cda9 100755
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java
@@ -22,6 +22,7 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.Objects;
+
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.xdata.form.FillableForm;
import org.jivesoftware.smackx.xdata.form.SubmitForm;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandHandler.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandHandler.java
index 5eb6d6dda..d1c36d943 100755
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandHandler.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandHandler.java
@@ -20,6 +20,7 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError;
+
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder;
import org.jivesoftware.smackx.xdata.form.SubmitForm;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandResult.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandResult.java
index e0927e277..8dfc51685 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandResult.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandResult.java
@@ -17,6 +17,7 @@
package org.jivesoftware.smackx.commands;
import org.jivesoftware.smack.packet.IQ;
+
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.xdata.form.FillableForm;
import org.jivesoftware.smackx.xdata.packet.DataForm;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationListener.java
index e8ef1af5e..18b6e9071 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationListener.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationListener.java
@@ -17,6 +17,7 @@
package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.packet.Stanza;
+
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
public interface DirectMucInvitationListener {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationManager.java
index b05f10df0..2dcafcea8 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DirectMucInvitationManager.java
@@ -29,6 +29,7 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.MessageBuilder;
+
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java
index b43e33ae9..e1b11103f 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java
@@ -18,10 +18,11 @@
package org.jivesoftware.smackx.muc;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
@@ -215,9 +216,9 @@ public class RoomInfo {
if (urlField != null && !urlField.getValues().isEmpty()) {
String urlString = urlField.getFirstValue();
try {
- logs = new URL(urlString);
- } catch (MalformedURLException e) {
- LOGGER.log(Level.SEVERE, "Could not parse URL", e);
+ logs = new URI(urlString).toURL();
+ } catch (MalformedURLException | URISyntaxException e) {
+ throw new IllegalArgumentException("Could not parse '" + urlString + "' to URL", e);
}
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/GroupChatInvitationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/GroupChatInvitationProvider.java
index 00ddabaf9..a6e2f9384 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/GroupChatInvitationProvider.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/GroupChatInvitationProvider.java
@@ -29,6 +29,7 @@ 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.muc.packet.GroupChatInvitation;
import org.jxmpp.jid.EntityBareJid;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/form/SoftwareInfoForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/form/SoftwareInfoForm.java
index f2327face..50d6136b2 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/form/SoftwareInfoForm.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/form/SoftwareInfoForm.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode;
+
import org.jivesoftware.smackx.formtypes.FormFieldRegistry;
import org.jivesoftware.smackx.mediaelement.element.MediaElement;
import org.jivesoftware.smackx.xdata.FormField;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormFieldWithOptions.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormFieldWithOptions.java
index 677fb8076..3e7b4f6f6 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormFieldWithOptions.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormFieldWithOptions.java
@@ -28,7 +28,7 @@ public interface FormFieldWithOptions {
*/
List getOptions();
- public interface Builder> {
+ interface Builder> {
default B addOption(String option) {
return addOption(new FormField.Option(option));
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java
index 0b32e3adc..f0fc2c5af 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java
@@ -29,6 +29,7 @@ import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
+import org.jivesoftware.smack.parsing.SmackParsingException.RequiredValueMissingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.roster.packet.RosterPacket;
import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
@@ -185,9 +186,8 @@ public class DataFormProvider extends ExtensionElementProvider {
FormField.Type type = null;
{
String fieldTypeString = parser.getAttributeValue("type");
- if (fieldTypeString != null) {
- type = FormField.Type.fromString(fieldTypeString);
- }
+ // FormField.Type.fromString() will return null if its input is null.
+ type = FormField.Type.fromString(fieldTypeString);
}
List values = new ArrayList<>();
@@ -238,6 +238,14 @@ public class DataFormProvider extends ExtensionElementProvider {
}
}
+ if (type != FormField.Type.fixed && fieldName == null) {
+ String typeString = "unspecified";
+ if (type != null) {
+ typeString = type.toString();
+ }
+ throw new RequiredValueMissingException("The data form field of " + typeString + " type has no 'var' attribute, even though one is required as per XEP-0004 § 3.2");
+ }
+
if (type == null) {
// The field name 'FORM_TYPE' is magic.
if (fieldName.equals(FormField.FORM_TYPE)) {
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
index 0c59cf73c..39d0ac609 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
@@ -46,6 +46,7 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.test.util.NetworkUtil;
import org.jivesoftware.smack.util.ExceptionUtil;
+
import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java
index 3ed68d212..0cb0a58f7 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java
@@ -33,6 +33,7 @@ import org.jivesoftware.smack.packet.EmptyResultIQ;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.CloseableUtil;
+
import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java
index 6ffddb7a5..80c0f3f0c 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java
@@ -31,6 +31,7 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.WaitForPacketListener;
+
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.jivesoftware.smackx.muc.packet.MUCUser.Invite;
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitationElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitationElementTest.java
index 1f28be5ce..590152e71 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitationElementTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitationElementTest.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.muc.provider.GroupChatInvitationProvider;
import org.junit.jupiter.api.Test;
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java
index af11468a3..319f230fa 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java
@@ -96,7 +96,7 @@ public class DeliveryReceiptTest extends SmackTestSuite {
rrl.waitUntilInvocationOrTimeout();
}
- private static class TestReceiptReceivedListener extends WaitForPacketListener implements ReceiptReceivedListener {
+ private static final class TestReceiptReceivedListener extends WaitForPacketListener implements ReceiptReceivedListener {
@Override
public void onReceiptReceived(Jid fromJid, Jid toJid, String receiptId, Stanza receipt) {
assertThat("julia@capulet.com", equalsCharSequence(fromJid));
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/provider/DataFormProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/provider/DataFormProviderTest.java
index 3d901a8fc..b08807d82 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/provider/DataFormProviderTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/provider/DataFormProviderTest.java
@@ -17,11 +17,13 @@
package org.jivesoftware.smackx.xdata.provider;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.util.List;
import org.jivesoftware.smack.parsing.SmackParsingException;
+import org.jivesoftware.smack.test.util.SmackTestUtil;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@@ -30,6 +32,8 @@ import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
public class DataFormProviderTest {
@@ -144,4 +148,14 @@ public class DataFormProviderTest {
assertEquals(FormField.Type.hidden, usernameFormField.getType());
assertEquals("", usernameFormField.getLabel());
}
+
+ @ParameterizedTest
+ @EnumSource(SmackTestUtil.XmlPullParserKind.class)
+ public void testShouldThrowSmackParsingException(SmackTestUtil.XmlPullParserKind parserKind) {
+ String form = ""
+ + ""
+ + "";
+ SmackParsingException.RequiredValueMissingException exception = assertThrows(SmackParsingException.RequiredValueMissingException.class, () -> SmackTestUtil.parse(form, DataFormProvider.class, parserKind));
+ assertEquals("The data form field of unspecified type has no 'var' attribute, even though one is required as per XEP-0004 § 3.2", exception.getMessage());
+ }
}
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
index b51542015..3df9b904c 100644
--- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
+++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
@@ -1557,6 +1557,9 @@ public final class Roster extends Manager {
* Ignore ItemTypes as of RFC 6121, 2.1.2.5.
*
* This is used by {@link RosterPushListener} and {@link RosterResultListener}.
+ *
+ * @param item the roster item to check
+ * @return true
if the item type should be ignored
* */
private static boolean hasValidSubscriptionType(RosterPacket.Item item) {
switch (item.getItemType()) {
@@ -1615,7 +1618,7 @@ public final class Roster extends Manager {
/**
* Listens for all presence packets and processes them.
*/
- private class PresencePacketListener implements StanzaListener {
+ private final class PresencePacketListener implements StanzaListener {
@Override
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
@@ -1790,7 +1793,7 @@ public final class Roster extends Manager {
/**
* Handles Roster results as described in RFC 6121 2.1.4.
*/
- private class RosterResultListener implements SuccessCallback {
+ private final class RosterResultListener implements SuccessCallback {
@Override
public void onSuccess(IQ packet) {
diff --git a/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java b/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java
index 62dde5f47..6bd4e74fa 100644
--- a/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java
+++ b/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java
@@ -396,7 +396,7 @@ public class ChatConnectionTest {
}
}
- private static class TestMessageListener implements ChatMessageListener {
+ private static final class TestMessageListener implements ChatMessageListener {
private Chat msgChat;
private int counter = 0;
diff --git a/smack-integration-test/build.gradle b/smack-integration-test/build.gradle
index ede353266..e3d43bf09 100644
--- a/smack-integration-test/build.gradle
+++ b/smack-integration-test/build.gradle
@@ -13,6 +13,7 @@ application {
dependencies {
api project(':smack-java11-full')
+ api project(':smack-websocket-okhttp')
api project(':smack-resolver-dnsjava')
implementation project(':smack-websocket-java11')
implementation "com.google.guava:guava:${guavaVersion}"
diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java
index a0f658977..55b6ce65f 100644
--- a/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java
+++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/XmppConnectionStressTest.java
@@ -44,6 +44,7 @@ import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.ErrorsWhileSendingOrReceivingException;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException;
+
import org.jxmpp.jid.EntityFullJid;
public class XmppConnectionStressTest {
diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java
index fab1e00c9..3cad302cb 100644
--- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java
+++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java
@@ -392,12 +392,12 @@ public final class Configuration {
}
public Builder setEnabledTests(String enabledTestsString) {
- enabledTests = getTestSetFrom(enabledTestsString);
+ enabledTests = getTestSetFrom(enabledTestsString, "enabled");
return this;
}
public Builder setDisabledTests(String disabledTestsString) {
- disabledTests = getTestSetFrom(disabledTestsString);
+ disabledTests = getTestSetFrom(disabledTestsString, "disabled");
return this;
}
@@ -625,7 +625,8 @@ public final class Configuration {
return res;
}
- private static Set getTestSetFrom(String input) {
+ private static Set getTestSetFrom(String input, String name) {
+ StringUtils.requireNullOrNotEmpty(input, "Most provide a value for " + name + " tests");
return split(input, s -> {
s = s.trim();
if (s.startsWith("smackx.") || s.startsWith("smack.")) {
diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
index 3fb4edaae..11e4f6119 100644
--- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
+++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
@@ -74,6 +74,7 @@ import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
+
import org.reflections.Reflections;
import org.reflections.scanners.MethodAnnotationsScanner;
import org.reflections.scanners.MethodParameterScanner;
@@ -150,24 +151,28 @@ public class SmackIntegrationTestFramework {
LOGGER.info("SmackIntegrationTestFramework[" + testRunResult.testRunId + ']' + " finished: "
+ successfulTests + '/' + availableTests + " [" + failedTests + " failed]");
- if (failedTests > 0) {
- LOGGER.warning("💀 The following " + failedTests + " tests failed! 💀");
- final SortedSet bySpecification = new TreeSet<>();
- for (FailedTest failedTest : testRunResult.failedIntegrationTests) {
- final Throwable cause = failedTest.failureReason;
- LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause);
+ if (failedTests == 0) {
+ LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/");
+ return;
+ }
+
+ StringBuilder sb = new StringBuilder("💀 The following " + failedTests + " tests failed! 💀\n -");
+ StringUtils.appendTo(testRunResult.failedIntegrationTests, "\n- ", sb, t -> sb.append(t.concreteTest));
+ LOGGER.warning(sb.toString());
+
+ final SortedSet bySpecification = new TreeSet<>();
+ for (FailedTest failedTest : testRunResult.failedIntegrationTests) {
+ final Throwable cause = failedTest.failureReason;
+ LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause);
if (failedTest.concreteTest.method.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) {
- final String specificationReference = getSpecificationReference(failedTest.concreteTest.method);
- if (specificationReference != null) {
- bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')");
- }
+ final String specificationReference = getSpecificationReference(failedTest.concreteTest.method);
+ if (specificationReference != null) {
+ bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')");
}
}
- if (!bySpecification.isEmpty()) {
- LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification));
- }
- } else {
- LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/");
+ }
+ if (!bySpecification.isEmpty()) {
+ LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification));
}
}
}
diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/XmppConnectionManager.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/XmppConnectionManager.java
index 3b2f21b60..b1c6105e0 100644
--- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/XmppConnectionManager.java
+++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/XmppConnectionManager.java
@@ -47,11 +47,13 @@ import org.jivesoftware.smack.util.MultiMap;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.websocket.java11.Java11WebSocketFactory;
import org.jivesoftware.smack.websocket.okhttp.OkHttpWebSocketFactory;
+
import org.jivesoftware.smackx.admin.ServiceAdministrationManager;
import org.jivesoftware.smackx.iqregister.AccountManager;
import org.igniterealtime.smack.inttest.Configuration.AccountRegistration;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.AccountNum;
+
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java
index fdbb755c7..015919e13 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/StreamManagementTest.java
@@ -32,6 +32,7 @@ import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegration
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
+
import org.jxmpp.jid.EntityFullJid;
public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest {
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java
index 7d536f072..b28dd6d26 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/IncomingMessageListenerIntegrationTest.java
@@ -22,6 +22,7 @@ import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
public class IncomingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java
index 0b0109e98..062f1b84c 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/chat2/OutgoingMessageListenerIntegrationTest.java
@@ -23,6 +23,7 @@ import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
public class OutgoingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java
index 9f150bd7a..f0a5182a5 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/LowLevelRosterIntegrationTest.java
@@ -26,6 +26,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.FullJid;
public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java
index 98db355c6..29cf23f81 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/roster/RosterIntegrationTest.java
@@ -40,6 +40,7 @@ import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.Jid;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java
index 1ece51611..f405afb0d 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java
@@ -24,6 +24,7 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError;
+
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder;
import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder.NextStage;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java
index 25ebb9b2a..b54603a34 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java
@@ -26,6 +26,7 @@ import java.util.Arrays;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.util.StringUtils;
+
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java
index 1cd1d3b8d..ec9ff3846 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java
@@ -36,6 +36,7 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.util.XmppDateTime;
@SpecificationReference(document = "XEP-0080", version = "1.9")
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java
index 4d4844adf..507024cdc 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java
@@ -36,6 +36,7 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.Jid;
@SpecificationReference(document = "XEP-0347", version = "0.5.1")
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java
index 7c3f3dcac..63f851d96 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java
@@ -35,6 +35,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
+
import org.jxmpp.jid.Jid;
@SpecificationReference(document = "XEP-0347", version = "0.5.1")
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java
index 9b9cba7a3..764fdd9e0 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java
@@ -35,6 +35,7 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StanzaBuilder;
import org.jivesoftware.smack.packet.StanzaError;
+
import org.jivesoftware.smackx.mam.MamManager.MamQuery;
import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs;
@@ -44,6 +45,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
@SpecificationReference(document = "XEP-0313", version = "0.6.3")
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java
index 9465ef14a..2b4742769 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/AbstractMultiUserChatIntegrationTest.java
@@ -25,6 +25,7 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.StringUtils;
+
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException;
@@ -34,6 +35,7 @@ import org.jivesoftware.smackx.xdata.form.Form;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
+
import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
@@ -105,7 +107,7 @@ public abstract class AbstractMultiUserChatIntegrationTest extends AbstractSmack
* @throws XmppStringprepException if the prefix isn't a valid XMPP Localpart
*/
public EntityBareJid getRandomRoom(String prefix) throws XmppStringprepException {
- final String roomNameLocal = String.join("-", prefix, testRunId, StringUtils.insecureRandomString(6));
+ final String roomNameLocal = String.join("-", "sinttest", prefix, testRunId, StringUtils.insecureRandomString(3));
return JidCreate.entityBareFrom(Localpart.from(roomNameLocal), mucService.getDomain());
}
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java
index aa30d5b78..196df3b2c 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java
@@ -28,6 +28,7 @@ import java.util.Map;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.StanzaError;
+
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
@@ -97,7 +98,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"service. The service SHOULD return a full list of the public rooms it hosts (i.e., not return any rooms that" +
"are hidden).")
public void mucTestForDiscoveringRooms() throws Exception {
- EntityBareJid mucAddressPublic = getRandomRoom("smack-inttest-publicroom");
+ EntityBareJid mucAddressPublic = getRandomRoom("publicroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddressPublic);
EntityBareJid mucAddressHidden = getRandomRoom("smack-inttest-hiddenroom");
@@ -127,7 +128,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"Using the disco#info protocol, an entity may also query a specific chat room for more detailed information " +
"about the room....The room MUST return its identity and SHOULD return the features it supports")
public void mucTestForDiscoveringRoomInfo() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoinfo");
+ EntityBareJid mucAddress = getRandomRoom("discoinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString));
@@ -154,7 +155,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"of existing occupants if that information is publicly available, or return no list at all if this " +
"information is kept private.")
public void mucTestForDiscoveringRoomItems() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems");
+ EntityBareJid mucAddress = getRandomRoom("discoitems");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString));
@@ -178,7 +179,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"If a non-occupant attempts to send a disco request to an address of the form , a MUC " +
"service MUST return a error")
public void mucTestForRejectingDiscoOnRoomOccupantByNonOccupant() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems");
+ EntityBareJid mucAddress = getRandomRoom("discoitems");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString);
createMuc(mucAsSeenByOne, nicknameOne);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java
index be59229c9..3a2eaba52 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java
@@ -32,6 +32,7 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.StanzaError;
+
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException;
@@ -42,6 +43,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.parts.Resourcepart;
import org.jxmpp.stringprep.XmppStringprepException;
@@ -57,7 +59,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
@SmackIntegrationTest
public void mucTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-message");
+ EntityBareJid mucAddress = getRandomRoom("message");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -98,7 +100,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
"users from the room... and destroys the room")
public void mucDestroyOwnerTest() throws TimeoutException, Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-destroy-owner");
+ EntityBareJid mucAddress = getRandomRoom("destroy-owner");
MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(muc, Resourcepart.from("one-" + randomString));
@@ -145,7 +147,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
"users from the room... and destroys the room")
public void mucDestroyTestOccupant() throws TimeoutException, Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-destroy-occupant");
+ EntityBareJid mucAddress = getRandomRoom("destroy-occupant");
MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByParticipant = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -189,7 +191,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
throws XmppStringprepException, MucAlreadyJoinedException, MissingMucCreationAcknowledgeException,
NotAMucServiceException, NoResponseException, XMPPErrorException, NotConnectedException,
InterruptedException, MucConfigurationNotSupportedException {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-muc-name-change");
+ EntityBareJid mucAddress = getRandomRoom("muc-name-change");
MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(muc, Resourcepart.from("one-" + randomString));
@@ -214,7 +216,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
public void mucTestVisitorNotAllowedToChangeSubject() throws XmppStringprepException, MucAlreadyJoinedException,
MissingMucCreationAcknowledgeException, NotAMucServiceException, NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-visitor-change-subject");
+ final EntityBareJid mucAddress = getRandomRoom("visitor-change-subject");
final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -250,7 +252,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
public void mucTestChangeRoomName() throws XmppStringprepException, MucAlreadyJoinedException,
MissingMucCreationAcknowledgeException, NotAMucServiceException, NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-change-room-name");
+ final EntityBareJid mucAddress = getRandomRoom("change-room-name");
final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java
index e13384940..286a5969b 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java
@@ -34,6 +34,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
+
import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java
index 04ea0253c..108cc010b 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatOccupantIntegrationTest.java
@@ -41,6 +41,7 @@ import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.sm.predicates.ForEveryMessage;
import org.jivesoftware.smack.util.StringUtils;
+
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException;
@@ -49,6 +50,7 @@ import org.jivesoftware.smackx.muc.packet.MUCItem;
import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.igniterealtime.smack.inttest.Configuration;
+import org.igniterealtime.smack.inttest.Configuration.CompatibilityMode;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
@@ -56,6 +58,7 @@ import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.MultiResultSyncPoint;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Resourcepart;
@@ -83,7 +86,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
// stanzas arrive. Instead, it joins a chatroom and listens for its stanzas using basic stanza handling. As
// this uses exactly one stanza listener, that's guaranteed to be invoked in order of stanza arrival, which is
// not necessarily the case when using the MUC API.
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-eventordering");
+ EntityBareJid mucAddress = getRandomRoom("eventordering");
final String mucSubject = "Subject smack-inttest-eventordering " + randomString;
final String mucMessage = "Message smack-inttest-eventordering " + randomString;
@@ -114,8 +117,13 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
final List results = new ArrayList<>();
final StanzaListener stanzaListener = stanza -> {
results.add(stanza);
- if (stanza instanceof Message && ((Message) stanza).getSubject() != null) {
- subjectResultSyncPoint.signal(((Message) stanza).getSubject());
+ // TODO: Use pattern matching for instanceof once Smack is Java 16 or higher.
+ if (stanza instanceof Message) {
+ Message message = (Message) stanza;
+ String subject = message.getSubject();
+ if (subject != null) {
+ subjectResultSyncPoint.signal(subject);
+ }
}
};
conTwo.addStanzaListener(stanzaListener, FromMatchesFilter.create(mucAddress));
@@ -125,7 +133,12 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
subjectResultSyncPoint.waitForResult(timeout); // Wait for subject, as it should be 4th (last)
- assertEquals(4, results.size(), "Unexpected amount of stanzas received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'.");
+ if (sinttestConfiguration.compatibilityMode == CompatibilityMode.ejabberd) {
+ // ejabberd MUCs also send their own presence with caps information as very first presence.
+ results.remove(0);
+ }
+
+ assertEquals(4, results.size(), "Unexpected amount of stanzas received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'. Results: " + results);
assertTrue(results.get(0) instanceof Presence, "Expected the first stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "' to be a presence stanza (but it was not).");
assertEquals(JidCreate.fullFrom(mucAddress, nicknameOne), results.get(0).getFrom(), "Unexpected 'from' address of the first stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'.");
assertTrue(results.get(1) instanceof Presence, "Expected the second stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "' to be a presence stanza (but it was not).");
@@ -162,7 +175,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"§ 7.2.1: In order to participate in the discussions held in a multi-user chat room, a user MUST first become an occupant by entering the room [...] " +
"§ 7.4: If the sender is not an occupant of the room, the service SHOULD return a error to the sender and SHOULD NOT reflect the message to all occupants")
public void mucSendBeforeJoiningTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-send-without-joining");
+ EntityBareJid mucAddress = getRandomRoom("send-without-joining");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -202,7 +215,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"complete list of the existing occupants to the new occupant and only then send the new occupant's own " +
"presence to the new occupant.")
public void mucJoinPresenceInformationTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-presenceinfo");
+ EntityBareJid mucAddress = getRandomRoom("presenceinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -261,7 +274,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"the service MUST also send presence from the new participant's occupant JID to the full JIDs of all the " +
"occupants (including the new occupant)")
public void mucJoinPresenceBroadcastTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-presenceinfo");
+ EntityBareJid mucAddress = getRandomRoom("presenceinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -320,7 +333,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"full JID as shown above), the service MUST warn the user by including a status code of \"100\" in the " +
"initial presence that the room sends to the new occupant.")
public void mucJoinNonAnonymousRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-joinnonanonymousroom");
+ EntityBareJid mucAddress = getRandomRoom("joinnonanonymousroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -377,7 +390,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"option), but MUST include the new occupant's full JID only in the presence notifications it sends to " +
"occupants with a role of \"moderator\" and not to non-moderator occupants.")
public void mucJoinSemiAnonymousRoomReceivedByNonModeratorTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-seminanonymous-by-non-moderator");
+ EntityBareJid mucAddress = getRandomRoom("seminanonymous-by-non-moderator");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -423,7 +436,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"option), but MUST include the new occupant's full JID only in the presence notifications it sends to " +
"occupants with a role of \"moderator\" and not to non-moderator occupants.")
public void mucJoinSemiAnonymousRoomReceivedByModeratorTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-seminanonymous-by-moderator");
+ EntityBareJid mucAddress = getRandomRoom("seminanonymous-by-moderator");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -467,7 +480,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " +
"a presence stanza of type \"error\" specifying a error.")
public void mucJoinPasswordProtectedWithoutPasswordRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-enterpasswordprotectedroom");
+ EntityBareJid mucAddress = getRandomRoom("enterpasswordprotectedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -503,7 +516,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " +
"a presence stanza of type \"error\" specifying a error.")
public void mucJoinPasswordProtectedRoomWrongPasswordTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-enterpasswordprotectedroom");
+ EntityBareJid mucAddress = getRandomRoom("enterpasswordprotectedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -540,7 +553,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " +
"a presence stanza of type \"error\" specifying a error.")
public void mucJoinPasswordProtectedRoomCorrectPasswordTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-enterpasswordprotectedroom");
+ EntityBareJid mucAddress = getRandomRoom("enterpasswordprotectedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -582,7 +595,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room and inform the user that they are not allowed to enter the room; this is done by returning a presence " +
"stanza of type \"error\" specifying a error condition.")
public void mucJoinMembersOnlyRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-entermembersonlyroom");
+ EntityBareJid mucAddress = getRandomRoom("entermembersonlyroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -620,7 +633,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"access to the room and inform the user of the fact that they are banned; this is done by returning a presence " +
"stanza of type \"error\" specifying a error condition.")
public void mucBannedUserJoinRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-banneduser");
+ EntityBareJid mucAddress = getRandomRoom("banneduser");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -656,7 +669,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room and inform the user of the conflict; this is done by returning a presence stanza of type \"error\" " +
"specifying a error condition.")
public void mucNicknameConflictJoinRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-nicknameclash");
+ EntityBareJid mucAddress = getRandomRoom("nicknameclash");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -690,7 +703,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"specifying a error condition. Alternatively, the room could kick an \"idle user\" " +
"in order to free up space (where the definition of \"idle user\" is up to the implementation).")
public void mucMaxUsersLimitJoinRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-maxusersreached");
+ EntityBareJid mucAddress = getRandomRoom("maxusersreached");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -769,7 +782,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this " +
"helps to prevent denial of service attacks caused by stuffing the room with non-admin users.")
public void mucMaxUsersLimitAdminCanStillJoinRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-maxusersreached-adminjoin");
+ EntityBareJid mucAddress = getRandomRoom("maxusersreached-adminjoin");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -821,7 +834,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this " +
"helps to prevent denial of service attacks caused by stuffing the room with non-admin users.")
public void mucMaxUsersLimitOwnerCanStillJoinRoomTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-maxusersreached-ownerjoin");
+ EntityBareJid mucAddress = getRandomRoom("maxusersreached-ownerjoin");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -878,7 +891,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
throw new TestNotPossibleException("ejabberd does not implement MUC locked rooms as per XEP-0045 § 7.2.10");
}
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-lockedroom");
+ EntityBareJid mucAddress = getRandomRoom("lockedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -915,7 +928,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"discussions are logged. This is done by including a status code of \"170\" in the initial presence that the " +
"room sends to the new occupant.")
public void mucJoinRoomWithPublicLoggingTest() throws Exception {
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-publiclogging");
+ final EntityBareJid mucAddress = getRandomRoom("publiclogging");
final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -956,7 +969,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"case, nick='oldhag') - A status code of 303 This enables the recipients to correlate the old roomnick with " +
"the new roomnick.\n")
public void mucChangeNicknameInformationTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-changenickname");
+ EntityBareJid mucAddress = getRandomRoom("changenickname");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -1051,7 +1064,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny the nickname change request and inform the user of the conflict; this is done by " +
"returning a presence stanza of type \"error\" specifying a error condition:")
public void mucBlockChangeNicknameInformationTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-blockchangenickname");
+ EntityBareJid mucAddress = getRandomRoom("blockchangenickname");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -1096,7 +1109,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"JID to the departing occupant's full JIDs, including a status code of \"110\" to indicate that this " +
"notification is \"self-presence\"")
public void mucLeaveTest() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-leave");
+ EntityBareJid mucAddress = getRandomRoom("leave");
MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
try {
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java
index 56c8a6dbb..10316a277 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java
@@ -32,6 +32,7 @@ import java.util.stream.Collectors;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence;
+
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException;
@@ -43,6 +44,7 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.Jid;
@@ -70,7 +72,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.6) The service MUST then send updated presence from this " +
"individual to all occupants, indicating the addition of moderator status...")
public void mucRoleTestForReceivingModerator() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -109,7 +111,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.6) The service MUST then send updated presence from this " +
"individual to all occupants, indicating the addition of moderator status...")
public void mucRoleTestForWitnessingModerator() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -150,7 +152,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.7) The service MUST then send updated presence from this " +
"individual to all occupants, indicating the removal of moderator status...")
public void mucRoleTestForRemovingModerator() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -188,7 +190,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.7) The service MUST then send updated presence from this " +
"individual to all occupants, indicating the removal of moderator status...")
public void mucRoleTestForWitnessingModeratorRemoval() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -228,7 +230,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 8.4) The service MUST then send updated presence from " +
"this individual to all occupants, indicating the removal of voice privileges...")
public void mucRoleTestForRevokingVoice() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -263,7 +265,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 8.4) The service MUST then send updated presence from " +
"this individual to all occupants, indicating the removal of voice privileges...")
public void mucRoleTestForWitnessingRevokingVoice() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -302,7 +304,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate that to all occupants [...] (§ 10.6) If the user is in the room, the service MUST then send " +
"updated presence from this individual to all occupants, indicating the granting of admin status...")
public void mucAffiliationTestForReceivingAdmin() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -341,7 +343,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate that to all occupants [...] (§ 10.6) If the user is in the room, the service MUST then send " +
"updated presence from this individual to all occupants, indicating the granting of admin status...")
public void mucAffiliationTestForWitnessingAdmin() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -381,7 +383,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"updated presence from this individual to all occupants, indicating the loss of admin status by sending a " +
"presence element...")
public void mucAffiliationTestForRemovingAdmin() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -431,7 +433,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"updated presence from this individual to all occupants, indicating the loss of admin status by sending a " +
"presence element...")
public void mucAffiliationTestForWitnessingAdminRemoval() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -473,7 +475,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"presence information, optionally along with the reason (if provided) and the roomnick or bare JID of the " +
"user who initiated the kick.")
public void mucPresenceTestForGettingKicked() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -517,7 +519,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"() to all the remaining occupants (just as it does when occupants exit the room of their " +
"own volition), including the status code and optionally the reason and actor.")
public void mucPresenceTestForWitnessingKick() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -564,7 +566,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"affected by happenings in the room...Affiliations are granted, revoked, and maintained based on the user's " +
"bare JID, not the nick as with roles.")
public void mucTestPersistentAffiliation() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -605,7 +607,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"moderator attempts to revoke voice privileges from such a user, the service MUST deny the request and return " +
"a error to the sender along with the offending item(s)")
public void mucTestModeratorCannotRevokeVoiceFromOwner() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -637,7 +639,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"than themselves (i.e., an unaffiliated moderator SHOULD NOT be allowed to revoke moderation privileges from " +
"an admin or an owner, and an admin SHOULD NOT be allowed to revoke moderation privileges from an owner)")
public void mucTestModeratorCannotBeRevokedFromHigherAffiliation() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest");
+ EntityBareJid mucAddress = getRandomRoom("inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -683,7 +685,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
@SmackIntegrationTest(section = "5.1.2", quote =
"...the initial default roles that a service SHOULD set based on the user's affiliation...")
public void mucTestDefaultRoleForAffiliationInUnmoderatedRoom() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-unmoderatedroles");
+ EntityBareJid mucAddress = getRandomRoom("unmoderatedroles");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -736,7 +738,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
@SmackIntegrationTest(section = "5.1.2", quote =
"...the initial default roles that a service SHOULD set based on the user's affiliation...")
public void mucTestDefaultRoleForAffiliationInModeratedRoom() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-moderatedroles");
+ EntityBareJid mucAddress = getRandomRoom("moderatedroles");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -799,7 +801,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
@SmackIntegrationTest(section = "5.1.2", quote =
"...the initial default roles that a service SHOULD set based on the user's affiliation...")
public void mucTestDefaultRoleForAffiliationInMembersOnlyRoom() throws Exception {
- EntityBareJid mucAddress = getRandomRoom("smack-inttest-membersonlyroles");
+ EntityBareJid mucAddress = getRandomRoom("membersonlyroles");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/ParticipantStatusIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/ParticipantStatusIntegrationTest.java
index 1bf3fdce4..76f32a616 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/ParticipantStatusIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/ParticipantStatusIntegrationTest.java
@@ -24,6 +24,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.impl.JidCreate;
@@ -48,7 +49,7 @@ public class ParticipantStatusIntegrationTest extends AbstractMultiUserChatInteg
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] The service MUST then send updated presence from this individual to all occupants, indicating the loss of membership by sending a presence element that contains an element qualified by the 'http://jabber.org/protocol/muc#user' namespace and containing an child with the 'affiliation' attribute set to a value of \"none\".")
public void testMembershipRevokedInOpenRoom() throws Exception {
// Setup test fixture.
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-participantstatus-membership-revoked-open");
+ final EntityBareJid mucAddress = getRandomRoom("participantstatus-membership-revoked-open");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -89,7 +90,7 @@ public class ParticipantStatusIntegrationTest extends AbstractMultiUserChatInteg
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] If the room is members-only, the service MUST remove the user from the room, including a status code of 321 to indicate that the user was removed because of an affiliation change, and inform all remaining occupants")
public void testMembershipRevokedInMemberOnlyRoom() throws Exception {
// Setup test fixture.
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-participantstatus-membership-revoked-membersonly");
+ final EntityBareJid mucAddress = getRandomRoom("participantstatus-membership-revoked-membersonly");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/UserStatusIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/UserStatusIntegrationTest.java
index 201f1ba21..2b1c5aa9f 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/UserStatusIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/UserStatusIntegrationTest.java
@@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence;
+
import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
@@ -26,6 +27,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.impl.JidCreate;
@@ -50,7 +52,7 @@ public class UserStatusIntegrationTest extends AbstractMultiUserChatIntegrationT
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] The service MUST then send updated presence from this individual to all occupants, indicating the loss of membership by sending a presence element that contains an element qualified by the 'http://jabber.org/protocol/muc#user' namespace and containing an child with the 'affiliation' attribute set to a value of \"none\".")
public void testMembershipRevokedInOpenRoom() throws Exception {
// Setup test fixture.
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-userstatus-membership-revoked-membersonly");
+ final EntityBareJid mucAddress = getRandomRoom("userstatus-membership-revoked-membersonly");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);
@@ -89,7 +91,7 @@ public class UserStatusIntegrationTest extends AbstractMultiUserChatIntegrationT
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] If the room is members-only, the service MUST remove the user from the room, including a status code of 321 to indicate that the user was removed because of an affiliation change, and inform all remaining occupants")
public void testMembershipRevokedInMemberOnlyRoom() throws Exception {
// Setup test fixture.
- final EntityBareJid mucAddress = getRandomRoom("smack-inttest-userstatus-membership-revoked-membersonly");
+ final EntityBareJid mucAddress = getRandomRoom("userstatus-membership-revoked-membersonly");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/AbstractOpenPgpIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/AbstractOpenPgpIntegrationTest.java
index 31d613c85..2d3d68778 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/AbstractOpenPgpIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/AbstractOpenPgpIntegrationTest.java
@@ -26,6 +26,7 @@ import org.jivesoftware.smackx.pep.PepManager;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
+
import org.jxmpp.jid.BareJid;
public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegrationTest {
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java
index 93f936785..c5971f2fc 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java
@@ -31,6 +31,7 @@ import java.security.NoSuchProviderException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.util.StringUtils;
+
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
import org.jivesoftware.smackx.ox.exception.InvalidBackupCodeException;
import org.jivesoftware.smackx.ox.exception.MissingOpenPgpKeyException;
@@ -41,15 +42,16 @@ import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.jivesoftware.smackx.pubsub.PubSubException;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPPublicKeyRing;
-import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
+
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPPublicKeyRing;
+import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java
index 4467dde1f..5ec31757a 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java
@@ -42,6 +42,7 @@ import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.UnprotectedKeysProtector;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java
index a2cbce7ce..d05784ed9 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java
@@ -36,6 +36,7 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
+
import org.jxmpp.jid.Jid;
@SpecificationReference(document = "XEP-0199", version = "2.0.1")
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java
index d3f990a4a..69aad5dbd 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java
@@ -35,6 +35,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
+
import org.jxmpp.jid.DomainBareJid;
@SpecificationReference(document = "XEP-0060", version = "1.26.0")
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java
index f01371f10..2e4becabb 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java
@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.Async.ThrowingRunnable;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.mediaelement.element.MediaElement;
import org.jivesoftware.smackx.softwareinfo.SoftwareInfoManager;
import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm;
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java
index e204031c4..d0c0ddc63 100644
--- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java
@@ -34,6 +34,7 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+
import org.junit.jupiter.api.Assertions;
@SpecificationReference(document = "XEP-0118", version = "1.3.0")
diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java
index fbdfa8cef..bb144febe 100644
--- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java
+++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFrameWorkTest.java
@@ -30,26 +30,26 @@ import org.junit.jupiter.api.Test;
public class SmackIntegrationTestFrameWorkTest {
- private static class ValidLowLevelList {
+ private static final class ValidLowLevelList {
@SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(List connections) {
}
}
- private static class InvalidLowLevelList {
+ private static final class InvalidLowLevelList {
@SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(List connections, boolean invalid) {
}
}
- private static class ValidLowLevelVarargs {
+ private static final class ValidLowLevelVarargs {
@SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractXMPPConnection connectionOne, AbstractXMPPConnection connectionTwo,
AbstractXMPPConnection connectionThree) {
}
}
- private static class InvalidLowLevelVarargs {
+ private static final class InvalidLowLevelVarargs {
@SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractXMPPConnection connectionOne, Integer invalid, AbstractXMPPConnection connectionTwo,
AbstractXMPPConnection connectionThree) {
@@ -96,7 +96,7 @@ public class SmackIntegrationTestFrameWorkTest {
assertNull(determinedParameterType);
}
- private static class ValidUnconnectedConnectionSource {
+ private static final class ValidUnconnectedConnectionSource {
@SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractSmackLowLevelIntegrationTest.UnconnectedConnectionSource source) {
}
diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java
index e1398e73b..4e4760e02 100644
--- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java
+++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java
@@ -44,6 +44,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunRes
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
+
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/MultiResultSyncPointTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/MultiResultSyncPointTest.java
index 5a4db37c4..e525640c2 100644
--- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/MultiResultSyncPointTest.java
+++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/MultiResultSyncPointTest.java
@@ -97,7 +97,7 @@ public class MultiResultSyncPointTest {
}
}
- private static class TestException extends Exception {
+ private static final class TestException extends Exception {
/**
*
diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java
index c6e22bd72..efcbb5b39 100644
--- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java
+++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/util/ResultSyncPointTest.java
@@ -73,7 +73,7 @@ public class ResultSyncPointTest {
}
}
- private static class TestException extends Exception {
+ private static final class TestException extends Exception {
/**
*
diff --git a/smack-java11-full/build.gradle b/smack-java11-full/build.gradle
index 4f4bf0652..24480f524 100644
--- a/smack-java11-full/build.gradle
+++ b/smack-java11-full/build.gradle
@@ -16,8 +16,7 @@ dependencies {
api project(':smack-openpgp')
api project(':smack-resolver-minidns')
api project(':smack-resolver-minidns-dox')
- // TODO: Change this to smack-websocket-java11 once it arrives.
- api project(':smack-websocket-okhttp')
+ api project(':smack-websocket-java11')
api project(':smack-tcp')
testImplementation(testFixtures(project(":smack-core")))
@@ -50,7 +49,7 @@ task convertModularXmppClientToServerConnectionStateGraphDotToPng(type: Exec) {
}
copyJavadocDocFiles.dependsOn convertModularXmppClientToServerConnectionStateGraphDotToPng
-task cleanGenerateFiles(type: Delete) {
+task cleanGeneratedFiles(type: Delete) {
delete 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.dot', 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.png'
}
-clean.dependsOn cleanGenerateFiles
+clean.dependsOn cleanGeneratedFiles
diff --git a/smack-java11/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java b/smack-java11/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java
index a03cd097a..bc88484bf 100644
--- a/smack-java11/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java
+++ b/smack-java11/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java
@@ -221,7 +221,7 @@ public class XmppHostnameVerifier implements HostnameVerifier {
afterWildcard = afterWildcard.substring(wildcardIndex + 1);
int beforeStartIndex = name.indexOf(beforeWildcard);
- if ((beforeStartIndex == -1) || (isBeginning && beforeStartIndex != 0)) {
+ if (beforeStartIndex == -1 || (isBeginning && beforeStartIndex != 0)) {
return false;
}
isBeginning = false;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java
index 768cc42c9..d33508316 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java
@@ -20,6 +20,7 @@ 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.smackx.jingleold.JingleSession;
import org.jivesoftware.smackx.jingleold.media.PayloadType;
import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java
index 55478c276..7afc6bfb1 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java
@@ -20,6 +20,7 @@ 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.smackx.jingleold.nat.TransportCandidate;
/**
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
index 151f6dff1..5929fc78e 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
@@ -21,6 +21,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
+
import org.jivesoftware.smackx.jingleold.JingleSession;
import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener;
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
index b8cb0f850..6d52161c7 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
@@ -25,6 +25,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
+
import org.jivesoftware.smackx.jingleold.JingleSession;
import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener;
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java
index c0f489e8b..988db997b 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java
@@ -301,7 +301,7 @@ public class AgentRoster {
/**
* Listens for all presence packets and processes them.
*/
- private class PresencePacketListener implements StanzaListener {
+ private final class PresencePacketListener implements StanzaListener {
@Override
public void processStanza(Stanza packet) {
Presence presence = (Presence) packet;
@@ -376,7 +376,7 @@ public class AgentRoster {
/**
* Listens for all roster packets and processes them.
*/
- private class AgentStatusListener implements StanzaListener {
+ private final class AgentStatusListener implements StanzaListener {
@Override
public void processStanza(Stanza packet) {
diff --git a/smack-omemo-signal-integration-test/src/main/java/org/igniterealtime/smack/inttest/smack_omemo_signal/SmackOmemoSignalIntegrationTestFramework.java b/smack-omemo-signal-integration-test/src/main/java/org/igniterealtime/smack/inttest/smack_omemo_signal/SmackOmemoSignalIntegrationTestFramework.java
index d79154e4a..a75337243 100644
--- a/smack-omemo-signal-integration-test/src/main/java/org/igniterealtime/smack/inttest/smack_omemo_signal/SmackOmemoSignalIntegrationTestFramework.java
+++ b/smack-omemo-signal-integration-test/src/main/java/org/igniterealtime/smack/inttest/smack_omemo_signal/SmackOmemoSignalIntegrationTestFramework.java
@@ -39,9 +39,10 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
import org.jivesoftware.smackx.omemo.signal.SignalOmemoService;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
public class SmackOmemoSignalIntegrationTestFramework {
static {
diff --git a/smack-omemo-signal/build.gradle b/smack-omemo-signal/build.gradle
index aa0887f94..dd5fd4602 100644
--- a/smack-omemo-signal/build.gradle
+++ b/smack-omemo-signal/build.gradle
@@ -11,7 +11,7 @@ dependencies {
api project(":smack-im")
api project(":smack-extensions")
api project(":smack-omemo")
- implementation 'org.whispersystems:signal-protocol-java:2.8.1'
+ implementation 'org.signal:libsignal-client:0.26.0'
// TODO: Migrate Junit4 tests to Junit5.
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
diff --git a/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalCachingOmemoStore.java b/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalCachingOmemoStore.java
index 135bd96fb..eafd0fb2d 100644
--- a/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalCachingOmemoStore.java
+++ b/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalCachingOmemoStore.java
@@ -23,15 +23,15 @@ package org.jivesoftware.smackx.omemo.signal;
import org.jivesoftware.smackx.omemo.CachingOmemoStore;
import org.jivesoftware.smackx.omemo.OmemoStore;
-import org.whispersystems.libsignal.IdentityKey;
-import org.whispersystems.libsignal.IdentityKeyPair;
-import org.whispersystems.libsignal.SessionCipher;
-import org.whispersystems.libsignal.SignalProtocolAddress;
-import org.whispersystems.libsignal.ecc.ECPublicKey;
-import org.whispersystems.libsignal.state.PreKeyBundle;
-import org.whispersystems.libsignal.state.PreKeyRecord;
-import org.whispersystems.libsignal.state.SessionRecord;
-import org.whispersystems.libsignal.state.SignedPreKeyRecord;
+import org.signal.libsignal.protocol.IdentityKey;
+import org.signal.libsignal.protocol.IdentityKeyPair;
+import org.signal.libsignal.protocol.SessionCipher;
+import org.signal.libsignal.protocol.SignalProtocolAddress;
+import org.signal.libsignal.protocol.ecc.ECPublicKey;
+import org.signal.libsignal.protocol.state.PreKeyBundle;
+import org.signal.libsignal.protocol.state.PreKeyRecord;
+import org.signal.libsignal.protocol.state.SessionRecord;
+import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
/**
* Implementation of the CachingOmemoStore for smack-omemo-signal.
diff --git a/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalFileBasedOmemoStore.java b/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalFileBasedOmemoStore.java
index f474b9b19..9cce37dfb 100644
--- a/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalFileBasedOmemoStore.java
+++ b/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalFileBasedOmemoStore.java
@@ -25,15 +25,15 @@ import java.io.File;
import org.jivesoftware.smackx.omemo.FileBasedOmemoStore;
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
-import org.whispersystems.libsignal.IdentityKey;
-import org.whispersystems.libsignal.IdentityKeyPair;
-import org.whispersystems.libsignal.SessionCipher;
-import org.whispersystems.libsignal.SignalProtocolAddress;
-import org.whispersystems.libsignal.ecc.ECPublicKey;
-import org.whispersystems.libsignal.state.PreKeyBundle;
-import org.whispersystems.libsignal.state.PreKeyRecord;
-import org.whispersystems.libsignal.state.SessionRecord;
-import org.whispersystems.libsignal.state.SignedPreKeyRecord;
+import org.signal.libsignal.protocol.IdentityKey;
+import org.signal.libsignal.protocol.IdentityKeyPair;
+import org.signal.libsignal.protocol.SessionCipher;
+import org.signal.libsignal.protocol.SignalProtocolAddress;
+import org.signal.libsignal.protocol.ecc.ECPublicKey;
+import org.signal.libsignal.protocol.state.PreKeyBundle;
+import org.signal.libsignal.protocol.state.PreKeyRecord;
+import org.signal.libsignal.protocol.state.SessionRecord;
+import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
/**
* Implementation of a FileBasedOmemoStore for the smack-omemo-signal module.
diff --git a/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalOmemoKeyUtil.java b/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalOmemoKeyUtil.java
index c4e5a78d7..dec7bff16 100644
--- a/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalOmemoKeyUtil.java
+++ b/smack-omemo-signal/src/main/java/org/jivesoftware/smackx/omemo/signal/SignalOmemoKeyUtil.java
@@ -21,6 +21,7 @@
package org.jivesoftware.smackx.omemo.signal;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
@@ -30,16 +31,18 @@ import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
-import org.whispersystems.libsignal.IdentityKey;
-import org.whispersystems.libsignal.IdentityKeyPair;
-import org.whispersystems.libsignal.InvalidKeyException;
-import org.whispersystems.libsignal.ecc.Curve;
-import org.whispersystems.libsignal.ecc.ECPublicKey;
-import org.whispersystems.libsignal.state.PreKeyBundle;
-import org.whispersystems.libsignal.state.PreKeyRecord;
-import org.whispersystems.libsignal.state.SessionRecord;
-import org.whispersystems.libsignal.state.SignedPreKeyRecord;
-import org.whispersystems.libsignal.util.KeyHelper;
+import org.signal.libsignal.protocol.IdentityKey;
+import org.signal.libsignal.protocol.IdentityKeyPair;
+import org.signal.libsignal.protocol.InvalidKeyException;
+import org.signal.libsignal.protocol.InvalidMessageException;
+import org.signal.libsignal.protocol.ecc.Curve;
+import org.signal.libsignal.protocol.ecc.ECKeyPair;
+import org.signal.libsignal.protocol.ecc.ECPublicKey;
+import org.signal.libsignal.protocol.state.PreKeyBundle;
+import org.signal.libsignal.protocol.state.PreKeyRecord;
+import org.signal.libsignal.protocol.state.SessionRecord;
+import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
+import org.signal.libsignal.protocol.util.Medium;
/**
* Concrete implementation of the KeyUtil for an implementation using the Signal library.
@@ -51,13 +54,13 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil generateOmemoPreKeys(int currentPreKeyId, int count) {
- List preKeyRecords = KeyHelper.generatePreKeys(currentPreKeyId, count);
+ List preKeyRecords = generatePreKeys(currentPreKeyId, count);
TreeMap map = new TreeMap<>();
for (PreKeyRecord p : preKeyRecords) {
map.put(p.getId(), p);
@@ -65,20 +68,44 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil generatePreKeys(int start, int count) {
+ List results = new ArrayList<>(count);
+
+ start--;
+
+ for (int i = 0; i < count; i++) {
+ int pkIdx = ((start + i) % (Medium.MAX_VALUE - 1)) + 1;
+ results.add(new PreKeyRecord(pkIdx, Curve.generateKeyPair()));
+ }
+
+ return results;
+ }
+
@Override
public SignedPreKeyRecord generateOmemoSignedPreKey(IdentityKeyPair identityKeyPair, int currentPreKeyId)
throws CorruptedOmemoKeyException {
try {
- return KeyHelper.generateSignedPreKey(identityKeyPair, currentPreKeyId);
+ return generateSignedPreKey(identityKeyPair, currentPreKeyId);
} catch (InvalidKeyException e) {
throw new CorruptedOmemoKeyException(e);
}
}
+ private static SignedPreKeyRecord generateSignedPreKey(IdentityKeyPair identityKeyPair, int signedPreKeyId) throws InvalidKeyException {
+ ECKeyPair keyPair = Curve.generateKeyPair();
+ byte[] signature = Curve.calculateSignature(identityKeyPair.getPrivateKey(), keyPair.getPublicKey().serialize());
+
+ return new SignedPreKeyRecord(signedPreKeyId, System.currentTimeMillis(), keyPair, signature);
+ }
+
@Override
public SignedPreKeyRecord signedPreKeyFromBytes(byte[] data) throws IOException {
if (data == null) return null;
- return new SignedPreKeyRecord(data);
+ try {
+ return new SignedPreKeyRecord(data);
+ } catch (InvalidMessageException e) {
+ throw new IOException(e);
+ }
}
@Override
@@ -89,7 +116,11 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil loadExistingSessions(List addresses) throws NoSessionException {
+ throw new RuntimeException("Not implemented.");
+ }
+
@Override
public List getSubDeviceSessions(String s) {
BareJid jid;
diff --git a/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/LegacySignalOmemoKeyUtilTest.java b/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/LegacySignalOmemoKeyUtilTest.java
index e7b91e0a8..db89d04c1 100644
--- a/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/LegacySignalOmemoKeyUtilTest.java
+++ b/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/LegacySignalOmemoKeyUtilTest.java
@@ -32,9 +32,9 @@ import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
import org.jivesoftware.smackx.omemo.signal.SignalOmemoKeyUtil;
import org.junit.Test;
-import org.whispersystems.libsignal.IdentityKey;
-import org.whispersystems.libsignal.IdentityKeyPair;
-import org.whispersystems.libsignal.state.SignedPreKeyRecord;
+import org.signal.libsignal.protocol.IdentityKey;
+import org.signal.libsignal.protocol.IdentityKeyPair;
+import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
/**
* Test SignalOmemoKeyUtil methods.
diff --git a/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoKeyUtilTest.java b/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoKeyUtilTest.java
index d14e08ef5..4dd3e7f44 100644
--- a/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoKeyUtilTest.java
+++ b/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoKeyUtilTest.java
@@ -28,13 +28,13 @@ import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import org.whispersystems.libsignal.IdentityKey;
-import org.whispersystems.libsignal.IdentityKeyPair;
-import org.whispersystems.libsignal.ecc.ECPublicKey;
-import org.whispersystems.libsignal.state.PreKeyBundle;
-import org.whispersystems.libsignal.state.PreKeyRecord;
-import org.whispersystems.libsignal.state.SessionRecord;
-import org.whispersystems.libsignal.state.SignedPreKeyRecord;
+import org.signal.libsignal.protocol.IdentityKey;
+import org.signal.libsignal.protocol.IdentityKeyPair;
+import org.signal.libsignal.protocol.ecc.ECPublicKey;
+import org.signal.libsignal.protocol.state.PreKeyBundle;
+import org.signal.libsignal.protocol.state.PreKeyRecord;
+import org.signal.libsignal.protocol.state.SessionRecord;
+import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
/**
* smack-omemo-signal implementation of {@link OmemoKeyUtilTest}.
diff --git a/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoStoreTest.java b/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoStoreTest.java
index a4a9bedea..ce39a26ad 100644
--- a/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoStoreTest.java
+++ b/smack-omemo-signal/src/test/java/org/jivesoftware/smackx/omemo/SignalOmemoStoreTest.java
@@ -35,15 +35,15 @@ import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.jxmpp.stringprep.XmppStringprepException;
-import org.whispersystems.libsignal.IdentityKey;
-import org.whispersystems.libsignal.IdentityKeyPair;
-import org.whispersystems.libsignal.SessionCipher;
-import org.whispersystems.libsignal.SignalProtocolAddress;
-import org.whispersystems.libsignal.ecc.ECPublicKey;
-import org.whispersystems.libsignal.state.PreKeyBundle;
-import org.whispersystems.libsignal.state.PreKeyRecord;
-import org.whispersystems.libsignal.state.SessionRecord;
-import org.whispersystems.libsignal.state.SignedPreKeyRecord;
+import org.signal.libsignal.protocol.IdentityKey;
+import org.signal.libsignal.protocol.IdentityKeyPair;
+import org.signal.libsignal.protocol.SessionCipher;
+import org.signal.libsignal.protocol.SignalProtocolAddress;
+import org.signal.libsignal.protocol.ecc.ECPublicKey;
+import org.signal.libsignal.protocol.state.PreKeyBundle;
+import org.signal.libsignal.protocol.state.PreKeyRecord;
+import org.signal.libsignal.protocol.state.SessionRecord;
+import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
/**
* smack-omemo-signal implementation of {@link OmemoStoreTest}.
diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/CachingOmemoStore.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/CachingOmemoStore.java
index f4c546bb3..eb1c078b0 100644
--- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/CachingOmemoStore.java
+++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/CachingOmemoStore.java
@@ -468,7 +468,7 @@ public class CachingOmemoStore type of the public signed preKey
* @param type of the OMEMO session
*/
- private static class KeyCache {
+ private static final class KeyCache {
private T_IdKeyPair identityKeyPair;
private final TreeMap preKeys = new TreeMap<>();
private final TreeMap signedPreKeys = new TreeMap<>();
diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoAesCipher.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoAesCipher.java
index 4edb10c4d..313563290 100644
--- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoAesCipher.java
+++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoAesCipher.java
@@ -30,6 +30,7 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.jivesoftware.smack.util.RandomUtil;
+
import org.jivesoftware.smackx.omemo.util.OmemoConstants;
import org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder;
diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java
index 5144b4f02..228157054 100644
--- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java
+++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java
@@ -24,12 +24,14 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
+
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import org.jivesoftware.smack.util.RandomUtil;
+
import org.jivesoftware.smackx.omemo.OmemoRatchet;
import org.jivesoftware.smackx.omemo.OmemoService;
import org.jivesoftware.smackx.omemo.element.OmemoElement;
diff --git a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/WrapperObjectsTest.java b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/WrapperObjectsTest.java
index 88f632640..1777d2eb3 100644
--- a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/WrapperObjectsTest.java
+++ b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/WrapperObjectsTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertFalse;
import java.security.NoSuchAlgorithmException;
import org.jivesoftware.smack.test.util.SmackTestSuite;
+
import org.jivesoftware.smackx.omemo.element.OmemoElement;
import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
import org.jivesoftware.smackx.omemo.internal.CipherAndAuthTag;
diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java
index c575fc5b7..050b62ba0 100644
--- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java
+++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java
@@ -31,6 +31,7 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.util.stringencoder.Base64;
+
import org.jivesoftware.smackx.ox.element.PubkeyElement;
import org.jivesoftware.smackx.ox.element.PublicKeysListElement;
import org.jivesoftware.smackx.ox.exception.MissingUserIdOnKeyException;
diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java
index b4a22c7cc..56d81f122 100644
--- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java
+++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java
@@ -42,6 +42,7 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.Async;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.ox.callback.backup.AskForBackupCodeCallback;
import org.jivesoftware.smackx.ox.callback.backup.SecretKeyBackupSelectionCallback;
diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/OpenPgpProvider.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/OpenPgpProvider.java
index ba0936041..08262cf68 100644
--- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/OpenPgpProvider.java
+++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/OpenPgpProvider.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.Collection;
import org.jivesoftware.smack.XMPPConnection;
+
import org.jivesoftware.smackx.ox.OpenPgpContact;
import org.jivesoftware.smackx.ox.OpenPgpMessage;
import org.jivesoftware.smackx.ox.OpenPgpSelf;
diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/PainlessOpenPgpProvider.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/PainlessOpenPgpProvider.java
index 304e3e006..ed698eee2 100644
--- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/PainlessOpenPgpProvider.java
+++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/crypto/PainlessOpenPgpProvider.java
@@ -29,6 +29,7 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.stringencoder.Base64;
+
import org.jivesoftware.smackx.ox.OpenPgpContact;
import org.jivesoftware.smackx.ox.OpenPgpMessage;
import org.jivesoftware.smackx.ox.OpenPgpSelf;
diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java
index 8954064f9..9c1d91ba1 100644
--- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java
+++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java
@@ -25,8 +25,8 @@ import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
-
import org.jivesoftware.smack.util.stringencoder.Base64;
+
import org.jivesoftware.smackx.ox.util.Util;
/**
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java
index a958d1adb..fcd9465b1 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java
@@ -34,6 +34,7 @@ import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.ox.element.CryptElement;
import org.jivesoftware.smackx.ox.element.OpenPgpElement;
import org.jivesoftware.smackx.ox.element.SignElement;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java
index 30e3f05af..89783d023 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java
@@ -37,6 +37,7 @@ import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.test.util.SmackTestSuite;
+
import org.jivesoftware.smackx.ox.callback.SecretKeyPassphraseCallback;
import org.jivesoftware.smackx.ox.exception.MissingUserIdOnKeyException;
import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java
index 41319bd6f..4f1b87a73 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java
@@ -35,6 +35,7 @@ import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.ox.crypto.OpenPgpElementAndMetadata;
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
import org.jivesoftware.smackx.ox.element.CryptElement;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubSubDelegateTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubSubDelegateTest.java
index 0bb120f8f..1e6b44c81 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubSubDelegateTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubSubDelegateTest.java
@@ -19,6 +19,7 @@ package org.jivesoftware.smackx.ox;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.jivesoftware.smack.test.util.SmackTestSuite;
+
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.junit.jupiter.api.Test;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java
index eb7f3922c..fd05dcdba 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java
@@ -24,6 +24,7 @@ import java.util.Date;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
+
import org.jivesoftware.smackx.ox.element.PublicKeysListElement;
import org.jivesoftware.smackx.ox.provider.PublicKeysListElementProvider;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java
index 74f9471f8..4cc22b7c5 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java
@@ -26,6 +26,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.Collections;
import org.jivesoftware.smack.test.util.SmackTestSuite;
+
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
import org.jivesoftware.smackx.ox.element.SecretkeyElement;
import org.jivesoftware.smackx.ox.exception.InvalidBackupCodeException;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java
index 9e8922cf2..2afdcd8ab 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java
@@ -24,6 +24,7 @@ import java.nio.charset.Charset;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
+
import org.jivesoftware.smackx.ox.element.SecretkeyElement;
import org.jivesoftware.smackx.ox.provider.SecretkeyElementProvider;
diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java
index 668a14204..33e2ac905 100644
--- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java
+++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java
@@ -38,6 +38,7 @@ import org.jivesoftware.smack.packet.StanzaBuilder;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.xml.XmlPullParserException;
+
import org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement;
import org.jivesoftware.smackx.ox.OpenPgpContact;
import org.jivesoftware.smackx.ox.OpenPgpManager;
diff --git a/smack-resolver-minidns-dox/src/test/java/org/jivesoftware/smackx/dox/resolver/minidns/DnsOverXmppMiniDnsResolverTest.java b/smack-resolver-minidns-dox/src/test/java/org/jivesoftware/smackx/dox/resolver/minidns/DnsOverXmppMiniDnsResolverTest.java
index d98b2fdeb..0912a2008 100644
--- a/smack-resolver-minidns-dox/src/test/java/org/jivesoftware/smackx/dox/resolver/minidns/DnsOverXmppMiniDnsResolverTest.java
+++ b/smack-resolver-minidns-dox/src/test/java/org/jivesoftware/smackx/dox/resolver/minidns/DnsOverXmppMiniDnsResolverTest.java
@@ -146,7 +146,7 @@ public final class DnsOverXmppMiniDnsResolverTest {
// TODO: Workaround for NPE-if-no-cache-set bug in MiniDNS. Remove we use a MiniDNS version where this is fixed,
// i.e. one that has 864fbb5 ("Fix NPE in AbstractDnsClient if cache is 'null'")
- private static class NoopDnsCache extends DnsCache {
+ private static final class NoopDnsCache extends DnsCache {
private static final NoopDnsCache INSTANCE = new NoopDnsCache();
diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
index 1e622bedc..61b144cb8 100644
--- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
+++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
@@ -889,8 +889,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
if (startTlsFeature != null) {
if (startTlsFeature.required() && config.getSecurityMode() == SecurityMode.disabled) {
SecurityRequiredByServerException smackException = new SecurityRequiredByServerException();
- currentSmackException = smackException;
- notifyWaitingThreads();
+ setCurrentConnectionExceptionAndNotify(smackException);
throw smackException;
}
@@ -1020,8 +1019,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// situation. It is still possible to authenticate and
// use the connection but using an uncompressed connection
// TODO Parse failure stanza
- currentSmackException = new SmackException.SmackMessageException("Could not establish compression");
- notifyWaitingThreads();
+ SmackException.SmackMessageException exception = new SmackException.SmackMessageException("Could not establish compression");
+ setCurrentConnectionExceptionAndNotify(exception);
break;
default:
parseAndProcessNonza(parser);
@@ -1306,8 +1305,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
*/
void shutdown(boolean instant) {
instantShutdown = instant;
- queue.shutdown();
shutdownTimestamp = System.currentTimeMillis();
+ queue.shutdown();
}
/**
@@ -1799,6 +1798,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
if (smSessionId == null)
return false;
+ // If we are not in instant shutdown, i.e., a shutdown which leaves the connection in a resumable state, then SM resumption is not possible.
+ if (!packetWriter.instantShutdown)
+ return false;
+
final Long shutdownTimestamp = packetWriter.shutdownTimestamp;
// Seems like we are already reconnected, report true
if (shutdownTimestamp == null) {
diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java
index fabfa4d6f..b7f7e6a98 100644
--- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java
+++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java
@@ -46,9 +46,11 @@ import javax.net.ssl.SSLSession;
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.SmackException;
+import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.SecurityRequiredByClientException;
import org.jivesoftware.smack.SmackException.SecurityRequiredByServerException;
import org.jivesoftware.smack.SmackException.SmackCertificateException;
+import org.jivesoftware.smack.SmackException.SmackWrappedException;
import org.jivesoftware.smack.SmackFuture;
import org.jivesoftware.smack.SmackFuture.InternalSmackFuture;
import org.jivesoftware.smack.SmackReactor.SelectionKeyAttachment;
@@ -1201,7 +1203,7 @@ public class XmppTcpTransportModule extends ModularXmppClientToServerConnectionM
return handshakeStatus == TlsHandshakeStatus.successful || handshakeStatus == TlsHandshakeStatus.failed;
}
- private void waitForHandshakeFinished() throws InterruptedException, CertificateException, SSLException, SmackException, XMPPException {
+ private void waitForHandshakeFinished() throws InterruptedException, CertificateException, SSLException, SmackWrappedException, NoResponseException {
connectionInternal.waitForConditionOrThrowConnectionException(() -> isHandshakeFinished(), "TLS handshake to finish");
if (handshakeStatus == TlsHandshakeStatus.failed) {
@@ -1234,8 +1236,7 @@ public class XmppTcpTransportModule extends ModularXmppClientToServerConnectionM
}
@Override
- public void waitUntilInputOutputClosed() throws IOException, CertificateException, InterruptedException,
- SmackException, XMPPException {
+ public void waitUntilInputOutputClosed() throws IOException, CertificateException, InterruptedException, SmackWrappedException, NoResponseException {
waitForHandshakeFinished();
}
diff --git a/smack-websocket/src/test/java/org/jivesoftware/smack/websocket/XmppWebSocketTransportModuleTest.java b/smack-websocket/src/test/java/org/jivesoftware/smack/websocket/XmppWebSocketTransportModuleTest.java
index bc0ee1cd0..94a12d683 100644
--- a/smack-websocket/src/test/java/org/jivesoftware/smack/websocket/XmppWebSocketTransportModuleTest.java
+++ b/smack-websocket/src/test/java/org/jivesoftware/smack/websocket/XmppWebSocketTransportModuleTest.java
@@ -17,7 +17,6 @@
package org.jivesoftware.smack.websocket;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-
import static org.mockito.Mockito.mock;
import java.net.URI;
diff --git a/smack-websocket/src/testFixtures/java/org/jivesoftware/smack/websocket/test/WebSocketFactoryServiceTestUtil.java b/smack-websocket/src/testFixtures/java/org/jivesoftware/smack/websocket/test/WebSocketFactoryServiceTestUtil.java
index cb84133da..8c580548c 100644
--- a/smack-websocket/src/testFixtures/java/org/jivesoftware/smack/websocket/test/WebSocketFactoryServiceTestUtil.java
+++ b/smack-websocket/src/testFixtures/java/org/jivesoftware/smack/websocket/test/WebSocketFactoryServiceTestUtil.java
@@ -17,7 +17,6 @@
package org.jivesoftware.smack.websocket.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-
import static org.mockito.Mockito.mock;
import java.net.URISyntaxException;
diff --git a/smack-xmlparser-xpp3/build.gradle b/smack-xmlparser-xpp3/build.gradle
index 8c5063117..5418728df 100644
--- a/smack-xmlparser-xpp3/build.gradle
+++ b/smack-xmlparser-xpp3/build.gradle
@@ -12,7 +12,7 @@ ext {
dependencies {
api "xpp3:xpp3_min:$xpp3Version"
- implementation "xpp3:xpp3:$xpp3Version"
+ implementation "org.codelibs:xpp3:${xpp3Version}.0"
api project(':smack-xmlparser')
//testCompile project(path: ":smack-xmlparser", configuration: "testRuntime")
}
diff --git a/version b/version
index da70b5b12..0985bbc40 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-4.5.0-beta5-SNAPSHOT
+4.5.0-beta6-SNAPSHOT