From 29471627dabaccc80e6f00ff5791d6602cb8f0fa Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Fri, 12 Apr 2024 17:01:16 +0200 Subject: [PATCH] bug fix --- CHANGELOG.md | 2 +- pom.xml | 2 +- .../server/DBCassandraAstyanaxImpl.java | 36 ++++++++++--------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e90b45..080355e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [v2.0.0] - 2023-12-04 +## [v2.0.0-SNAPSHOT] - 2023-12-04 - Support for Cassandra 4.1.3 using DataStax java driver diff --git a/pom.xml b/pom.xml index e671a3b..48cad3a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.gcube.portal social-networking-library - 2.0.0 + 2.0.0-SNAPSHOT gCube Social Networking Library The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities. diff --git a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java index 1b40f90..6defd6e 100644 --- a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java +++ b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java @@ -2190,24 +2190,28 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { public List getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException { _log.info("Asking for Single Notification preference of " + userid + " Type: " + notificationType); List toReturn = new ArrayList(); - NotificationChannelType[] toProcess = getUserNotificationPreferences(userid).get(notificationType); - //_log.info("size of user notification preferences" + toProcess.length); - if (toProcess == null) { - _log.info("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default"); - return createNewNotificationType(userid, notificationType); - } - else if (toProcess.length == 0){ - _log.info("size of user notification preferences " + 0); - return toReturn; - } - else - { - _log.info("size of user notification preferences " + toProcess.length); - for (int i = 0; i < toProcess.length; i++) { - toReturn.add(toProcess[i]); + Map userNotPref = getUserNotificationPreferences(userid); + if(userNotPref!=null){ + NotificationChannelType[] toProcess = userNotPref.get(notificationType); + //_log.info("size of user notification preferences" + toProcess.length); + if (toProcess == null) { + _log.info("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default"); + return createNewNotificationType(userid, notificationType); + } + else if (toProcess.length == 0){ + _log.info("size of user notification preferences " + 0); + return toReturn; + } + else + { + _log.info("size of user notification preferences " + toProcess.length); + for (int i = 0; i < toProcess.length; i++) { + toReturn.add(toProcess[i]); + } + return toReturn; } - return toReturn; } + return toReturn; } /**