You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2017/08/08 12:53:52 UTC

[4/4] syncope git commit: Raising exception when searching into invalid realms

Raising exception when searching into invalid realms


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1cd6154b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1cd6154b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1cd6154b

Branch: refs/heads/master
Commit: 1cd6154b5a026c3f0072b66fe056b53ed9f1d6ba
Parents: d4a67d4
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Aug 8 14:41:19 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Aug 8 14:53:40 2017 +0200

----------------------------------------------------------------------
 .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/1cd6154b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
index cc44ef8..6af5f27 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
@@ -31,8 +31,10 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.commons.lang3.tuple.Triple;
+import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.core.provisioning.api.utils.RealmUtils;
 import org.apache.syncope.core.provisioning.api.utils.EntityUtils;
 import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
@@ -74,7 +76,9 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO {
             if (realmPath.startsWith("/")) {
                 Realm realm = realmDAO.findByFullPath(realmPath);
                 if (realm == null) {
-                    LOG.warn("Ignoring invalid realm {}", realmPath);
+                    SyncopeClientException noRealm = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
+                    noRealm.getElements().add("Invalid realm specified: " + realmPath);
+                    throw noRealm;
                 } else {
                     CollectionUtils.collect(
                             realmDAO.findDescendants(realm), EntityUtils.<Realm>keyTransformer(), realmKeys);