From f3e007bad568bdf863e5997db2eb5468fff9ee53 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 9 Mar 2014 23:43:34 +0100 Subject: [PATCH] NPE check in SmackConfiguration --- .../java/org/jivesoftware/smack/SmackConfiguration.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java b/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java index bff22d06b..bfcf57805 100644 --- a/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java +++ b/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java @@ -291,7 +291,13 @@ public final class SmackConfiguration { try { loadSmackClass(classToLoad, optional); } catch (Exception e) { - exceptions.add(e); + // Don't throw the exception if an exceptions collection is given, instead + // record it there. This is used for unit testing purposes. + if (exceptions != null) { + exceptions.add(e); + } else { + throw e; + } } } }