Commit 4e43996f authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

[JM-1406] When CS is down and a session in OF Admin console is active, going...

[JM-1406] When CS is down and a session in OF Admin console is active, going to Users/Groups in OF console throws HTTP ERROR: 500. To be reviewed.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10636 b35dd754-fafc-0310-a699-88a17e54d16e
parent b505bf4f
......@@ -18,6 +18,7 @@ import org.jivesoftware.openfire.XMPPServer;
import static org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.*;
import org.jivesoftware.openfire.user.*;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
import org.xmpp.packet.JID;
import java.util.*;
......@@ -114,8 +115,9 @@ public class ClearspaceUserProvider implements UserProvider {
} catch (UserAlreadyExistsException uaee) {
throw uaee;
} catch (Exception e) {
throw new UnsupportedOperationException("Error creating the user", e);
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
return new User(username, name, email, new Date(), new Date());
}
/**
......@@ -137,8 +139,7 @@ public class ClearspaceUserProvider implements UserProvider {
} catch (UserNotFoundException gnfe) {
// it is OK, the user doesn't exist "anymore"
} catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Unexpected error", e);
Log.error(e);
}
}
......@@ -153,9 +154,9 @@ public class ClearspaceUserProvider implements UserProvider {
Element element = ClearspaceManager.getInstance().executeRequest(GET, path);
return Integer.valueOf(WSUtils.getReturn(element));
} catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Unexpected error", e);
Log.error(e);
}
return 0;
}
/**
......@@ -180,9 +181,9 @@ public class ClearspaceUserProvider implements UserProvider {
return WSUtils.parseUsernameArray(element);
} catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Unexpected error", e);
Log.error(e);
}
return new ArrayList<String>();
}
/**
......@@ -217,6 +218,7 @@ public class ClearspaceUserProvider implements UserProvider {
throw new UnsupportedOperationException();
}
try {
// Creates the params
Element userUpdateParams = getUserUpdateParams(username);
......@@ -226,6 +228,11 @@ public class ClearspaceUserProvider implements UserProvider {
// Updates the user
updateUser(userUpdateParams);
} catch (UserNotFoundException e) {
throw e;
} catch (Exception e) {
throw new UserNotFoundException(e);
}
}
/**
......@@ -241,6 +248,7 @@ public class ClearspaceUserProvider implements UserProvider {
throw new UnsupportedOperationException();
}
try {
// Creates the params
Element userUpdateParams = getUserUpdateParams(username);
......@@ -250,6 +258,11 @@ public class ClearspaceUserProvider implements UserProvider {
// Updates the user
updateUser(userUpdateParams);
} catch (UserNotFoundException e) {
throw e;
} catch (Exception e) {
throw new UserNotFoundException(e);
}
}
......@@ -266,6 +279,7 @@ public class ClearspaceUserProvider implements UserProvider {
throw new UnsupportedOperationException();
}
try {
// Creates the params
Element userUpdateParams = getUserUpdateParams(username);
......@@ -276,6 +290,11 @@ public class ClearspaceUserProvider implements UserProvider {
// Updates the user
updateUser(userUpdateParams);
} catch (UserNotFoundException e) {
throw e;
} catch (Exception e) {
throw new UserNotFoundException(e);
}
}
/**
......@@ -291,6 +310,7 @@ public class ClearspaceUserProvider implements UserProvider {
throw new UnsupportedOperationException();
}
try {
// Creates the params
Element userUpdateParams = getUserUpdateParams(username);
......@@ -301,6 +321,11 @@ public class ClearspaceUserProvider implements UserProvider {
// Updates the user
updateUser(userUpdateParams);
} catch (UserNotFoundException e) {
throw e;
} catch (Exception e) {
throw new UserNotFoundException(e);
}
}
/**
......@@ -377,8 +402,8 @@ public class ClearspaceUserProvider implements UserProvider {
queryE.addElement("searchEmail").addText("true");
queryE.addElement("searchProfile").addText("false");
try {
List<String> usernames = new ArrayList<String>();
try {
//TODO create a service on CS to get only the username field
String path = SEARCH_URL_PREFIX + "searchProfile";
......@@ -391,12 +416,10 @@ public class ClearspaceUserProvider implements UserProvider {
username = JID.escapeNode(username);
usernames.add(username);
}
return new UserCollection(usernames.toArray(new String[usernames.size()]));
} catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Unexpected error", e);
Log.error(e);
}
return new UserCollection(usernames.toArray(new String[usernames.size()]));
}
/**
......@@ -426,8 +449,8 @@ public class ClearspaceUserProvider implements UserProvider {
paramsE.addElement("startIndex").addText(String.valueOf(startIndex));
paramsE.addElement("numResults").addText(String.valueOf(numResults));
try {
List<String> usernames = new ArrayList<String>();
try {
//TODO create a service on CS to get only the username field
String path = SEARCH_URL_PREFIX + "searchProfile";
......@@ -441,11 +464,10 @@ public class ClearspaceUserProvider implements UserProvider {
usernames.add(username);
}
return new UserCollection(usernames.toArray(new String[usernames.size()]));
} catch (Exception e) {
// It is not supported exception, wrap it into an UnsupportedOperationException
throw new UnsupportedOperationException("Unexpected error", e);
Log.error(e);
}
return new UserCollection(usernames.toArray(new String[usernames.size()]));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment