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/1855b0b4 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1855b0b4 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1855b0b4 Branch: refs/heads/2_0_X Commit: 1855b0b4dd1d6d100663f04f1cec7a9cf5decad6 Parents: 671780f Author: Francesco Chicchiriccò <ilgro...@apache.org> Authored: Tue Aug 8 14:41:19 2017 +0200 Committer: Francesco Chicchiriccò <ilgro...@apache.org> Committed: Tue Aug 8 14:41:19 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/1855b0b4/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);