[kune-commits] r1290 - trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Mar 22 14:35:59 CET 2011


Author: vjrj_
Date: 2011-03-22 14:35:57 +0100 (Tue, 22 Mar 2011)
New Revision: 1290

Modified:
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
Log:
Somte test fixed

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java	2011-03-22 12:36:43 UTC (rev 1289)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java	2011-03-22 13:35:57 UTC (rev 1290)
@@ -20,6 +20,7 @@
 package org.ourproject.kune.platf.server.manager.impl;
 
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.TimeZone;
 
@@ -33,6 +34,7 @@
 import org.jivesoftware.smack.RosterEntry;
 import org.jivesoftware.smack.packet.RosterPacket.ItemType;
 import org.ourproject.kune.chat.server.managers.ChatConnection;
+import org.ourproject.kune.chat.server.managers.ChatException;
 import org.ourproject.kune.chat.server.managers.XmppManager;
 import org.ourproject.kune.platf.server.manager.I18nCountryManager;
 import org.ourproject.kune.platf.server.manager.I18nLanguageManager;
@@ -178,9 +180,18 @@
         final UserBuddiesData buddiesData = new UserBuddiesData();
 
         final User user = finder.getByShortName(shortName);
-        final ChatConnection connection = xmppManager.login(user.getShortName() + domain, user.getPassword(), "kserver");
-        final Collection<RosterEntry> roster = xmppManager.getRoster(connection);
-        xmppManager.disconnect(connection);
+        Collection<RosterEntry> roster;
+        try {
+            final ChatConnection connection = xmppManager.login(user.getShortName() + domain, user.getPassword(),
+                    "kserver");
+            roster = xmppManager.getRoster(connection);
+            xmppManager.disconnect(connection);
+        } catch (final ChatException e) {
+            // Seems that it not possible to get the buddy list, then we follow
+            // with a empty buddy list
+            log.error("Cannot retrieve the buddie list", e);
+            roster = new HashSet<RosterEntry>();
+        }
         for (final RosterEntry entry : roster) {
             if (entry.getType().equals(ItemType.both)) {
                 // only show buddies with subscription 'both'




More information about the kune-commits mailing list