1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

[sinttest] Treat NPE as test failure not as abort condition

This commit is contained in:
Florian Schmaus 2021-07-16 08:55:40 +02:00
parent c9af25c674
commit f64288ba6d

View file

@ -590,6 +590,14 @@ public class SmackIntegrationTestFramework {
if (e instanceof InterruptedException) { if (e instanceof InterruptedException) {
throw (InterruptedException) e; 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) { if (e instanceof RuntimeException) {
throw (RuntimeException) e; throw (RuntimeException) e;
} }