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