From f64288ba6d3b6b16c8f0eeb2b7b933d782ee6106 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 16 Jul 2021 08:55:40 +0200 Subject: [PATCH] [sinttest] Treat NPE as test failure not as abort condition --- .../smack/inttest/SmackIntegrationTestFramework.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 5eff3eeba..769146c6f 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 @@ -590,6 +590,14 @@ public class SmackIntegrationTestFramework { if (e instanceof InterruptedException) { throw (InterruptedException) e; } + + // We handle NullPointerException as a non fatal exception, as they are mostly caused by an invalid reply where + // a extension element is missing. Consider for example + // assertEquals(StanzaError.Condition.foo, response.getError().getCondition()) + // Otherwise NPEs could be caused by an internal bug in Smack, e.g. missing null handling. + if (e instanceof NullPointerException) { + return (NullPointerException) e; + } if (e instanceof RuntimeException) { throw (RuntimeException) e; }