diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java index 084af68..8293aeb 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java @@ -89,12 +89,17 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa currValue = node.evaluate("/Resource/Profile/Body/EndPoint/Scope/text()"); if (currValue != null && currValue.size() > 0) { List scopes = currValue; - for (int i = 0; i < scopes.size(); i++) - if (currValue.get(i).trim().compareTo(scope.toString()) == 0) { + boolean foundUrl = false; + for (int i = 0; i < scopes.size(); i++) { + if (currValue.get(i).trim().compareTo(scope.toString()) == 0) { toReturn.setUrl(node.evaluate("/Resource/Profile/Body/EndPoint/URL/text()").get(i)); toReturn.setScope(scope.toString()); - } else - throw new ApplicationProfileNotFoundException("Your application EndPoint URL was not found in the profile, consider adding $scopeMyAppurl element in "); + foundUrl = true; + break; + } + } + if (! foundUrl) + throw new ApplicationProfileNotFoundException("Your application URL was not found in the profile for Scope: " + scope.toString()); } else throw new ApplicationProfileNotFoundException("Your application EndPoint was not found in the profile, consider adding element in "); return toReturn;