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 2a11e770c..2f6f8248e 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 @@ -404,6 +404,9 @@ public final class Roster extends Manager { logLevel = Level.SEVERE; } LOGGER.log(logLevel, "Exception reloading roster" , exception); + for (RosterLoadedListener listener : rosterLoadedListeners) { + listener.onRosterLoadingFailed(exception); + } } }); } diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterLoadedListener.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterLoadedListener.java index 94f08f094..853cf31f2 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterLoadedListener.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterLoadedListener.java @@ -35,4 +35,17 @@ public interface RosterLoadedListener { */ public void onRosterLoaded(Roster roster); + /** + * Called when roster loading has failed. + *
+ * Note that the reason for the failure could be as trivial as the connection being not + * connected, in which case the exception will be a + * {@link org.jivesoftware.smack.SmackException.NotConnectedException}. + *
+ * + * @param exception the exception which caused the failure. + * @since 4.2 + */ + public void onRosterLoadingFailed(Exception exception); + }