bugfix 25760
This commit is contained in:
parent
2e6d0c7521
commit
b86d5501fe
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portal.social.networking.ws.methods.v2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -240,13 +241,15 @@ public class Notifications {
|
|||
*
|
||||
* @param usernameToCheck
|
||||
* @return true if notification are enabled for this user
|
||||
* @throws IOException
|
||||
*/
|
||||
private boolean isNotificationEnabled(String usernameToCheck) {
|
||||
private boolean isNotificationEnabled(String usernameToCheck) throws IOException {
|
||||
MemcachedClient entries = new DistributedCacheClient().getMemcachedClient();
|
||||
String key = SocialUtils.DISABLED_USERS_NOTIFICATIONS_NAMESPACE+usernameToCheck;
|
||||
Boolean userEnabled = false;
|
||||
if(entries.get(key) == null)
|
||||
userEnabled = true;
|
||||
entries.getConnection().shutdown();
|
||||
return userEnabled;
|
||||
}
|
||||
/**
|
||||
|
@ -255,8 +258,9 @@ public class Notifications {
|
|||
* @param callerId the username or clientid of the operation executor
|
||||
* @param disable true if you want to disable the notifications for this user
|
||||
* @return true if the operation was performed
|
||||
* @throws IOException
|
||||
*/
|
||||
private Boolean setUserNotificationsOnOff(String username, boolean disable, String callerId) {
|
||||
private Boolean setUserNotificationsOnOff(String username, boolean disable, String callerId) throws IOException {
|
||||
MemcachedClient entries = new DistributedCacheClient().getMemcachedClient();
|
||||
String key = SocialUtils.DISABLED_USERS_NOTIFICATIONS_NAMESPACE+username;
|
||||
OperationFuture<Boolean> result = null;
|
||||
|
@ -266,8 +270,11 @@ public class Notifications {
|
|||
result = entries.delete(key);
|
||||
}
|
||||
try {
|
||||
return result.getStatus().isSuccess();
|
||||
boolean res = result.getStatus().isSuccess();
|
||||
entries.getConnection().shutdown();
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
entries.getConnection().shutdown();
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue