From e4fcdb68795fe3d311a78cc44824b9e92c0c64ad Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Wed, 18 Sep 2024 12:18:38 +0200 Subject: [PATCH] [sint] Fix compatibility with Smack 4.5.0-beta2 Due to a change in Smack 4.5.0-beta2, test execution of (all) SINT tests is aborted when `FormTest` is executed. It appears that Smack now has more strict argument validation when setting thread IDs on message stanzas. This validation should not fail for the tests that are shipped with Smack. This is the stack trace when executing the failing test (which no longer occurs after the change in this commit is applied): ``` Exception in thread "main" java.lang.IllegalArgumentException: thread must not be null nor empty at org.jivesoftware.smack.util.StringUtils.requireNotNullNorEmpty(StringUtils.java:533) at org.jivesoftware.smack.packet.Message$Thread.(Message.java:326) at org.jivesoftware.smack.packet.MessageBuilder.setThread(MessageBuilder.java:70) at org.jivesoftware.smack.packet.MessageBuilder.setThread(MessageBuilder.java:66) at org.jivesoftware.smackx.xdata.FormTest.testFilloutForm(FormTest.java:133) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.lambda$runTests$0(SmackIntegrationTestFramework.java:476) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.runConcreteTest(SmackIntegrationTestFramework.java:556) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework$PreparedTest.run(SmackIntegrationTestFramework.java:764) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.runTests(SmackIntegrationTestFramework.java:544) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.run(SmackIntegrationTestFramework.java:277) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.main(SmackIntegrationTestFramework.java:115) ``` --- .../java/org/jivesoftware/smackx/xdata/FormTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java index 667beedb7..9e127b85e 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java @@ -128,22 +128,22 @@ public class FormTest extends AbstractSmackIntegrationTest { completedForm.setAnswer("time", true); completedForm.setAnswer("age", 20); // Create a new message to send with the completed form - msg2 = StanzaBuilder.buildMessage() + Message msg3 = StanzaBuilder.buildMessage() .to(conOne.getUser().asBareJid()) - .setThread(msg.getThread()) + .setThread(msg2.getThread()) .ofType(Message.Type.chat) .setBody("To enter a case please fill out this form and send it back to me") // Add the completed form to the message .addExtension(completedForm.getDataFormToSubmit()) .build(); // Send the message with the completed form - conTwo.sendStanza(msg2); + conTwo.sendStanza(msg3); // Get the message with the completed form - Message msg3 = collector.nextResult(); - assertNotNull(msg3, "Message not found"); + Message msg4 = collector.nextResult(); + assertNotNull(msg4, "Message not found"); // Retrieve the completed form - final DataForm completedForm2 = DataForm.from(msg3); + final DataForm completedForm2 = DataForm.from(msg4); assertNotNull(completedForm2); assertNotNull(completedForm2.getField("name")); assertNotNull(completedForm2.getField("description"));