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 2018/02/07 12:35:49 UTC

[01/11] syncope git commit: Some clean up

Repository: syncope
Updated Branches:
  refs/heads/2_0_X 446ddf2c6 -> 188df890f
  refs/heads/master 52c0ad3f2 -> 43fcd1d6a


Some clean up


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

Branch: refs/heads/master
Commit: 7655849e495a52c3ca77624a0065a046afc19bfc
Parents: 52c0ad3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Feb 6 16:05:28 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 6 16:38:58 2018 +0100

----------------------------------------------------------------------
 .../client/console/panels/DerSchemaDetails.java |  5 +--
 .../console/panels/PlainSchemaDetails.java      | 15 ++++-----
 .../client/console/panels/SchemaModalPanel.java | 11 +++++--
 .../client/console/panels/VirSchemaDetails.java |  4 +--
 core/persistence-jpa/pom.xml                    | 12 +++----
 .../attrvalue/validation/BinaryValidator.java   | 33 ++++++++++----------
 pom.xml                                         | 14 ++++-----
 7 files changed, 50 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
index 52fbfe5..eae157c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.console.panels;
 
 import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
 import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.markup.html.form.TextField;
 import org.apache.wicket.model.PropertyModel;
@@ -31,7 +31,8 @@ public class DerSchemaDetails extends AbstractSchemaDetailsPanel {
 
     public DerSchemaDetails(final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final DerSchemaTO schemaTO) {
+
         super(id, pageReference, schemaTO);
 
         TextField<String> expression = new TextField<>("expression", new PropertyModel<>(schemaTO, "expression"));

http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
index c996bcc..c249397 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
@@ -72,7 +72,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
     public PlainSchemaDetails(
             final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final PlainSchemaTO schemaTO) {
+
         super(id, pageReference, schemaTO);
 
         final AjaxDropDownChoicePanel<AttrSchemaType> type = new AjaxDropDownChoicePanel<>(
@@ -115,19 +116,19 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
 
                     @Override
                     public String getValues() {
-                        return PlainSchemaTO.class.cast(schemaTO).getEnumerationValues();
+                        return schemaTO.getEnumerationValues();
                     }
 
                     @Override
                     public void setValues(final List<String> list) {
-                        PlainSchemaTO.class.cast(schemaTO).setEnumerationValues(getEnumValuesAsString(list));
+                        schemaTO.setEnumerationValues(getEnumValuesAsString(list));
                     }
                 };
             }
 
             @Override
             public void setObject(final List<String> object) {
-                PlainSchemaTO.class.cast(schemaTO).setEnumerationValues(PropertyList.getEnumValuesAsString(object));
+                schemaTO.setEnumerationValues(PropertyList.getEnumValuesAsString(object));
             }
         }) {
 
@@ -154,19 +155,19 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
 
                     @Override
                     public String getValues() {
-                        return PlainSchemaTO.class.cast(schemaTO).getEnumerationKeys();
+                        return schemaTO.getEnumerationKeys();
                     }
 
                     @Override
                     public void setValues(final List<String> list) {
-                        PlainSchemaTO.class.cast(schemaTO).setEnumerationKeys(PropertyList.getEnumValuesAsString(list));
+                        schemaTO.setEnumerationKeys(PropertyList.getEnumValuesAsString(list));
                     }
                 };
             }
 
             @Override
             public void setObject(final List<String> object) {
-                PlainSchemaTO.class.cast(schemaTO).setEnumerationKeys(PropertyList.getEnumValuesAsString(object));
+                schemaTO.setEnumerationKeys(PropertyList.getEnumValuesAsString(object));
             }
         }) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
index c49dc36..9c00fd2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
@@ -22,6 +22,9 @@ import java.util.Arrays;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.markup.html.form.Form;
@@ -75,14 +78,16 @@ public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
 
         switch (schemaType) {
             case DERIVED:
-                panel = new DerSchemaDetails(id, pageRef, schemaTO);
+                panel = new DerSchemaDetails(id, pageRef, (DerSchemaTO) schemaTO);
                 break;
+
             case VIRTUAL:
-                panel = new VirSchemaDetails(id, pageRef, schemaTO);
+                panel = new VirSchemaDetails(id, pageRef, (VirSchemaTO) schemaTO);
                 break;
+
             case PLAIN:
             default:
-                panel = new PlainSchemaDetails(id, pageRef, schemaTO);
+                panel = new PlainSchemaDetails(id, pageRef, (PlainSchemaTO) schemaTO);
         }
         panel.setOutputMarkupId(true);
         return panel;

http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index e5d72ea..ef30352 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -33,11 +33,11 @@ import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormCompo
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
 import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -59,7 +59,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
 
     public VirSchemaDetails(final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final VirSchemaTO schemaTO) {
 
         super(id, pageReference, schemaTO);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/core/persistence-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/pom.xml b/core/persistence-jpa/pom.xml
index 545e6cb..1ba5c3a 100644
--- a/core/persistence-jpa/pom.xml
+++ b/core/persistence-jpa/pom.xml
@@ -92,7 +92,12 @@ under the License.
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-jexl3</artifactId>
     </dependency>
-      
+    
+    <dependency>
+      <groupId>org.apache.tika</groupId>
+      <artifactId>tika-core</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.syncope.core</groupId>
       <artifactId>syncope-core-workflow-api</artifactId>
@@ -103,11 +108,6 @@ under the License.
       <artifactId>syncope-core-spring</artifactId>
       <version>${project.version}</version>
     </dependency>
-    
-    <dependency>
-      <groupId>org.apache.tika</groupId>
-      <artifactId>tika-core</artifactId>
-    </dependency>
         
     <!-- TEST -->
     <dependency> 

http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
index a7dbb8d..b32f91c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
@@ -20,9 +20,9 @@ package org.apache.syncope.core.persistence.jpa.attrvalue.validation;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.IOException;
+import javax.ws.rs.core.MediaType;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
 import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.tika.Tika;
 
 public class BinaryValidator extends AbstractValidator {
@@ -31,17 +31,24 @@ public class BinaryValidator extends AbstractValidator {
 
     private static final ObjectMapper MAPPER = new ObjectMapper();
 
+    private static final Tika TIKA = new Tika();
+
+    static {
+        TIKA.setMaxStringLength(-1);
+    }
+
     @Override
     protected void doValidate(final PlainAttrValue attrValue) {
         // check Binary schemas MIME Type mismatches
         if (attrValue.getBinaryValue() != null) {
-            PlainSchema currentSchema = attrValue.getAttr().getSchema();
             byte[] binaryValue = attrValue.getBinaryValue();
-            String mimeType = detectSchemaMimeType(binaryValue);
+            String mimeType = TIKA.detect(binaryValue);
+
             boolean valid = true;
-            if (!mimeType.equals(currentSchema.getMimeType())) {
-                if (mimeType.equals("text/plain")
-                        && currentSchema.getMimeType().equals("application/json")) {
+            if (!mimeType.equals(attrValue.getAttr().getSchema().getMimeType())) {
+                if (MediaType.TEXT_PLAIN.equals(mimeType)
+                        && MediaType.APPLICATION_JSON.equals(attrValue.getAttr().getSchema().getMimeType())) {
+
                     String decoded = new String(binaryValue).trim();
                     valid = (decoded.startsWith("{") && decoded.endsWith("}"))
                             || (decoded.startsWith("[") && decoded.endsWith("]"))
@@ -52,26 +59,18 @@ public class BinaryValidator extends AbstractValidator {
             }
             if (!valid) {
                 throw new InvalidPlainAttrValueException(
-                        "Found MIME type: '"
-                        + mimeType
-                        + "', expecting: '"
-                        + currentSchema.getMimeType()
-                        + "'");
+                        "Found MIME type: '" + mimeType + "', expecting: '"
+                        + attrValue.getAttr().getSchema().getMimeType() + "'");
             }
         }
     }
 
-    private String detectSchemaMimeType(final byte[] value) {
-        Tika tika = new Tika();
-        tika.setMaxStringLength(-1);
-        return tika.detect(value);
-    }
-
     private boolean isValidJSON(final String value) {
         try {
             MAPPER.readTree(value);
             return true;
         } catch (IOException e) {
+            LOG.debug("Invalid JSON string: {}", value, e);
             return false;
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/7655849e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 47752df..bc314b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -975,6 +975,12 @@ under the License.
       </dependency>
 
       <dependency>
+        <groupId>org.apache.tika</groupId>
+        <artifactId>tika-core</artifactId>
+        <version>${tika.version}</version>
+      </dependency>
+
+      <dependency>
         <groupId>net.tirasa.connid</groupId>
         <artifactId>connector-framework</artifactId>
         <version>${connid.version}</version>
@@ -1491,12 +1497,6 @@ under the License.
       </dependency>
       
       <dependency>
-        <groupId>org.apache.tika</groupId>
-        <artifactId>tika-core</artifactId>
-        <version>${tika.version}</version>
-      </dependency>
-
-      <dependency>
         <groupId>org.netbeans.api</groupId>
         <artifactId>org-netbeans-api-annotations-common</artifactId>
         <version>${netbeans.version}</version>
@@ -2241,7 +2241,7 @@ under the License.
             <link>https://commons.apache.org/proper/commons-lang/javadocs/api-release/</link>
             <link>https://commons.apache.org/proper/commons-io/javadocs/api-2.6/</link>
             <link>https://commons.apache.org/proper/commons-jexl/apidocs/</link>
-            <link>http://docs.spring.io/spring/docs/5.0.x/javadoc-api/</link>
+            <link>https://tika.apache.org/1.17/api/</link>
             <link>http://docs.spring.io/spring-security/site/docs/4.2.x/apidocs/</link>
             <link>http://www.flowable.org/docs/javadocs/</link>
             <link>https://build.shibboleth.net/nexus/content/sites/site/java-opensaml/3.3.0/apidocs/</link>


[05/11] syncope git commit: Fixing suspended flag report in UserTO

Posted by il...@apache.org.
Fixing suspended flag report in UserTO


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

Branch: refs/heads/2_0_X
Commit: 1bb9a7ff429199858b6f60466d1c9300003d2871
Parents: 0286886
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 11:47:25 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 11:47:25 2018 +0100

----------------------------------------------------------------------
 .../syncope/core/provisioning/java/data/UserDataBinderImpl.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/1bb9a7ff/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 4b3c517..7fd39c5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -32,6 +32,7 @@ import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
 import org.apache.commons.collections4.SetUtils;
 import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.common.lib.SyncopeClientCompositeException;
@@ -594,6 +595,7 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
         UserTO userTO = new UserTO();
 
         BeanUtils.copyProperties(user, userTO, IGNORE_PROPERTIES);
+        userTO.setSuspended(BooleanUtils.isTrue(user.isSuspended()));
 
         if (user.getSecurityQuestion() != null) {
             userTO.setSecurityQuestion(user.getSecurityQuestion().getKey());


[08/11] syncope git commit: Upgrading ASF parent pom

Posted by il...@apache.org.
Upgrading ASF parent pom


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

Branch: refs/heads/master
Commit: 233c6685bee23d98757f84d10acf9af1515520a1
Parents: f1864b0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 09:24:22 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 12:32:10 2018 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/233c6685/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ab26ddf..7afcc23 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@ under the License.
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>18</version>
+    <version>19</version>
     <relativePath />
   </parent>
 


[02/11] syncope git commit: Some clean up

Posted by il...@apache.org.
Some clean up


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

Branch: refs/heads/2_0_X
Commit: 06d210bf8de6c9f3fb3b83c166304e3b8db0f7a8
Parents: 446ddf2
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Feb 6 16:05:28 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Feb 6 16:48:53 2018 +0100

----------------------------------------------------------------------
 .../client/console/panels/DerSchemaDetails.java |  5 +--
 .../console/panels/PlainSchemaDetails.java      | 15 ++++-----
 .../client/console/panels/SchemaModalPanel.java | 11 +++++--
 .../client/console/panels/VirSchemaDetails.java |  4 +--
 core/persistence-jpa/pom.xml                    | 12 ++++----
 .../attrvalue/validation/BinaryValidator.java   | 32 ++++++++++----------
 pom.xml                                         | 13 ++++----
 7 files changed, 50 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
index d9f8b17..716fcb1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.console.panels;
 
 import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
 import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.markup.html.form.TextField;
 import org.apache.wicket.model.PropertyModel;
@@ -31,7 +31,8 @@ public class DerSchemaDetails extends AbstractSchemaDetailsPanel {
 
     public DerSchemaDetails(final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final DerSchemaTO schemaTO) {
+
         super(id, pageReference, schemaTO);
 
         TextField<String> expression = new TextField<>("expression", new PropertyModel<String>(schemaTO, "expression"));

http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
index 686b1bd..443703b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
@@ -67,7 +67,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
     public PlainSchemaDetails(
             final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final PlainSchemaTO schemaTO) {
+
         super(id, pageReference, schemaTO);
 
         final AjaxDropDownChoicePanel<AttrSchemaType> type = new AjaxDropDownChoicePanel<>(
@@ -110,19 +111,19 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
 
                     @Override
                     public String getValues() {
-                        return PlainSchemaTO.class.cast(schemaTO).getEnumerationValues();
+                        return schemaTO.getEnumerationValues();
                     }
 
                     @Override
                     public void setValues(final List<String> list) {
-                        PlainSchemaTO.class.cast(schemaTO).setEnumerationValues(getEnumValuesAsString(list));
+                        schemaTO.setEnumerationValues(getEnumValuesAsString(list));
                     }
                 };
             }
 
             @Override
             public void setObject(final List<String> object) {
-                PlainSchemaTO.class.cast(schemaTO).setEnumerationValues(PropertyList.getEnumValuesAsString(object));
+                schemaTO.setEnumerationValues(PropertyList.getEnumValuesAsString(object));
             }
         }) {
 
@@ -149,19 +150,19 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
 
                     @Override
                     public String getValues() {
-                        return PlainSchemaTO.class.cast(schemaTO).getEnumerationKeys();
+                        return schemaTO.getEnumerationKeys();
                     }
 
                     @Override
                     public void setValues(final List<String> list) {
-                        PlainSchemaTO.class.cast(schemaTO).setEnumerationKeys(PropertyList.getEnumValuesAsString(list));
+                        schemaTO.setEnumerationKeys(PropertyList.getEnumValuesAsString(list));
                     }
                 };
             }
 
             @Override
             public void setObject(final List<String> object) {
-                PlainSchemaTO.class.cast(schemaTO).setEnumerationKeys(PropertyList.getEnumValuesAsString(object));
+                schemaTO.setEnumerationKeys(PropertyList.getEnumValuesAsString(object));
             }
         }) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
index dabeb85..4b191b5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
@@ -22,6 +22,9 @@ import java.util.Arrays;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.markup.html.form.Form;
@@ -75,14 +78,16 @@ public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
 
         switch (schemaType) {
             case DERIVED:
-                panel = new DerSchemaDetails(id, pageRef, schemaTO);
+                panel = new DerSchemaDetails(id, pageRef, (DerSchemaTO) schemaTO);
                 break;
+
             case VIRTUAL:
-                panel = new VirSchemaDetails(id, pageRef, schemaTO);
+                panel = new VirSchemaDetails(id, pageRef, (VirSchemaTO) schemaTO);
                 break;
+
             case PLAIN:
             default:
-                panel = new PlainSchemaDetails(id, pageRef, schemaTO);
+                panel = new PlainSchemaDetails(id, pageRef, (PlainSchemaTO) schemaTO);
         }
         panel.setOutputMarkupId(true);
         return panel;

http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index ceb51be..041bfda 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -35,11 +35,11 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPan
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.common.lib.EntityTOUtils;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
 import org.apache.syncope.common.lib.to.ProvisionTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -61,7 +61,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
 
     public VirSchemaDetails(final String id,
             final PageReference pageReference,
-            final AbstractSchemaTO schemaTO) {
+            final VirSchemaTO schemaTO) {
 
         super(id, pageReference, schemaTO);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/core/persistence-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/pom.xml b/core/persistence-jpa/pom.xml
index b197eb2..a5567cf 100644
--- a/core/persistence-jpa/pom.xml
+++ b/core/persistence-jpa/pom.xml
@@ -96,7 +96,12 @@ under the License.
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-jexl3</artifactId>
     </dependency>
-      
+    
+    <dependency>
+      <groupId>org.apache.tika</groupId>
+      <artifactId>tika-core</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.syncope.core</groupId>
       <artifactId>syncope-core-workflow-api</artifactId>
@@ -107,11 +112,6 @@ under the License.
       <artifactId>syncope-core-spring</artifactId>
       <version>${project.version}</version>
     </dependency>
-    
-    <dependency>
-      <groupId>org.apache.tika</groupId>
-      <artifactId>tika-core</artifactId>
-    </dependency>
         
     <!-- TEST -->
     <dependency> 

http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
index 182b27f..e608ed7 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/attrvalue/validation/BinaryValidator.java
@@ -20,6 +20,7 @@ package org.apache.syncope.core.persistence.jpa.attrvalue.validation;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.IOException;
+import javax.ws.rs.core.MediaType;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
 import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
 import org.apache.syncope.core.persistence.api.entity.PlainSchema;
@@ -31,6 +32,12 @@ public class BinaryValidator extends AbstractValidator {
 
     private static final ObjectMapper MAPPER = new ObjectMapper();
 
+    private static final Tika TIKA = new Tika();
+
+    static {
+        TIKA.setMaxStringLength(-1);
+    }
+
     public BinaryValidator(final PlainSchema schema) {
         super(schema);
     }
@@ -39,13 +46,14 @@ public class BinaryValidator extends AbstractValidator {
     protected void doValidate(final PlainAttrValue attrValue) {
         // check Binary schemas MIME Type mismatches
         if (attrValue.getBinaryValue() != null) {
-            PlainSchema currentSchema = attrValue.getAttr().getSchema();
             byte[] binaryValue = attrValue.getBinaryValue();
-            String mimeType = detectSchemaMimeType(binaryValue);
+            String mimeType = TIKA.detect(binaryValue);
+
             boolean valid = true;
-            if (!mimeType.equals(currentSchema.getMimeType())) {
-                if (mimeType.equals("text/plain")
-                        && currentSchema.getMimeType().equals("application/json")) {
+            if (!mimeType.equals(attrValue.getAttr().getSchema().getMimeType())) {
+                if (MediaType.TEXT_PLAIN.equals(mimeType)
+                        && MediaType.APPLICATION_JSON.equals(attrValue.getAttr().getSchema().getMimeType())) {
+
                     String decoded = new String(binaryValue).trim();
                     valid = (decoded.startsWith("{") && decoded.endsWith("}"))
                             || (decoded.startsWith("[") && decoded.endsWith("]"))
@@ -56,26 +64,18 @@ public class BinaryValidator extends AbstractValidator {
             }
             if (!valid) {
                 throw new InvalidPlainAttrValueException(
-                        "Found MIME type: '"
-                        + mimeType
-                        + "', expecting: '"
-                        + currentSchema.getMimeType()
-                        + "'");
+                        "Found MIME type: '" + mimeType + "', expecting: '"
+                        + attrValue.getAttr().getSchema().getMimeType() + "'");
             }
         }
     }
 
-    private String detectSchemaMimeType(final byte[] value) {
-        Tika tika = new Tika();
-        tika.setMaxStringLength(-1);
-        return tika.detect(value);
-    }
-
     private boolean isValidJSON(final String value) {
         try {
             MAPPER.readTree(value);
             return true;
         } catch (IOException e) {
+            LOG.debug("Invalid JSON string: {}", value, e);
             return false;
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/06d210bf/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7af96f0..d5a97d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1017,6 +1017,12 @@ under the License.
       </dependency>
 
       <dependency>
+        <groupId>org.apache.tika</groupId>
+        <artifactId>tika-core</artifactId>
+        <version>${tika.version}</version>
+      </dependency>
+
+      <dependency>
         <groupId>net.tirasa.connid</groupId>
         <artifactId>connector-framework</artifactId>
         <version>${connid.version}</version>
@@ -1582,12 +1588,6 @@ under the License.
       </dependency>
       
       <dependency>
-        <groupId>org.apache.tika</groupId>
-        <artifactId>tika-core</artifactId>
-        <version>${tika.version}</version>
-      </dependency>
-
-      <dependency>
         <groupId>org.netbeans.api</groupId>
         <artifactId>org-netbeans-api-annotations-common</artifactId>
         <version>${netbeans.version}</version>
@@ -2297,6 +2297,7 @@ under the License.
             <link>https://commons.apache.org/proper/commons-io/javadocs/api-2.6/</link>
             <link>https://commons.apache.org/proper/commons-jexl/apidocs/</link>
             <link>https://commons.apache.org/proper/commons-collections/javadocs/api-release/</link>
+            <link>https://tika.apache.org/1.17/api/</link>
             <link>http://docs.spring.io/spring/docs/4.3.x/javadoc-api/</link>
             <link>http://docs.spring.io/spring-security/site/docs/4.2.x/apidocs/</link>
             <link>http://activiti.org/javadocs/</link>


[11/11] syncope git commit: Fixing error reporting in case (no more IllegalArgumentException being returned by REST calls)

Posted by il...@apache.org.
Fixing error reporting in case (no more IllegalArgumentException being returned by REST calls)


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

Branch: refs/heads/master
Commit: 43fcd1d6af0f05e618a40cee8b0ba6e5978a7b0d
Parents: 0461265
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 12:31:54 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 13:35:32 2018 +0100

----------------------------------------------------------------------
 .../common/lib/types/ClientExceptionType.java   |  3 +-
 .../common/rest/api/beans/TaskQuery.java        | 53 ++---------
 .../rest/api/service/AccessTokenService.java    |  9 ++
 .../common/rest/api/service/AnyService.java     |  2 -
 .../rest/api/service/AnyTypeClassService.java   |  3 +
 .../common/rest/api/service/AnyTypeService.java |  1 +
 .../rest/api/service/ConfigurationService.java  |  3 +-
 .../api/service/ConnectorHistoryService.java    |  2 +
 .../rest/api/service/ConnectorService.java      |  5 +
 .../common/rest/api/service/DomainService.java  |  3 +
 .../rest/api/service/DynRealmService.java       |  3 +
 .../rest/api/service/ExecutableService.java     |  3 +-
 .../common/rest/api/service/GroupService.java   |  1 +
 .../common/rest/api/service/LoggerService.java  |  2 +
 .../rest/api/service/MailTemplateService.java   |  4 +
 .../rest/api/service/NotificationService.java   |  4 +
 .../common/rest/api/service/PolicyService.java  |  3 +
 .../common/rest/api/service/RealmService.java   |  3 +
 .../api/service/RelationshipTypeService.java    |  3 +
 .../common/rest/api/service/ReportService.java  |  3 +
 .../rest/api/service/ReportTemplateService.java |  2 +-
 .../api/service/ResourceHistoryService.java     |  2 +
 .../rest/api/service/ResourceService.java       |  5 +
 .../common/rest/api/service/RoleService.java    |  5 +
 .../common/rest/api/service/SchemaService.java  |  3 +
 .../api/service/SecurityQuestionService.java    |  3 +
 .../common/rest/api/service/TaskService.java    |  1 +
 .../rest/api/service/UserSelfService.java       |  2 +
 .../rest/api/service/WorkflowService.java       |  2 +
 .../syncope/core/logic/AccessTokenLogic.java    |  6 +-
 .../apache/syncope/core/logic/AnyTypeLogic.java | 16 ++--
 .../apache/syncope/core/logic/TaskLogic.java    | 26 ++++--
 .../persistence/jpa/dao/AbstractAnyDAO.java     | 96 ++++++++++----------
 .../core/persistence/jpa/inner/UserTest.java    | 10 +-
 .../provisioning/java/ConnectorFacadeProxy.java | 18 ++--
 .../provisioning/java/IntAttrNameParser.java    |  5 +-
 .../provisioning/java/MappingManagerImpl.java   | 40 +++++---
 .../java/data/AbstractAnyDataBinder.java        | 11 ++-
 .../java/data/NotificationDataBinderImpl.java   |  9 +-
 .../java/data/RealmDataBinderImpl.java          |  2 +-
 .../java/data/ResourceDataBinderImpl.java       | 13 ++-
 .../java/data/UserDataBinderImpl.java           |  1 +
 .../notification/NotificationManagerImpl.java   |  9 +-
 .../provisioning/java/pushpull/PullUtils.java   | 13 ++-
 .../java/IntAttrNameParserTest.java             | 13 +--
 .../rest/api/service/CamelRouteService.java     |  2 +
 .../core/logic/saml2/SAML2UserManager.java      | 24 +++--
 .../java/data/SAML2IdPDataBinderImpl.java       | 17 +++-
 .../rest/api/service/SAML2IdPService.java       |  3 +
 .../rest/api/service/SCIMConfService.java       |  3 +-
 .../apache/syncope/fit/core/AnyTypeITCase.java  | 10 --
 .../syncope/fit/core/ExceptionMapperITCase.java | 53 +++++++++++
 52 files changed, 352 insertions(+), 186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index b39a94c..7807272 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -63,9 +63,8 @@ public enum ClientExceptionType {
     InvalidRole(Response.Status.BAD_REQUEST),
     InvalidUser(Response.Status.BAD_REQUEST),
     InvalidExternalResource(Response.Status.BAD_REQUEST),
-    InvalidPropagationTask(Response.Status.BAD_REQUEST),
-    InvalidSchedTask(Response.Status.BAD_REQUEST),
     InvalidPullTask(Response.Status.BAD_REQUEST),
+    InvalidRequest(Response.Status.BAD_REQUEST),
     InvalidValues(Response.Status.BAD_REQUEST),
     NotFound(Response.Status.NOT_FOUND),
     RequiredValuesMissing(Response.Status.BAD_REQUEST),

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
index 4ea0ea3..dc74d26 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
@@ -44,66 +44,29 @@ public class TaskQuery extends AbstractQuery {
         }
 
         public Builder resource(final String resource) {
-            switch (getInstance().getType()) {
-                case PROPAGATION:
-                case PULL:
-                case PUSH:
-                    getInstance().setResource(resource);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("resource not allowed for " + getInstance().getType());
-            }
+            getInstance().setResource(resource);
+            return this;
         }
 
         public Builder notification(final String notification) {
-            switch (getInstance().getType()) {
-                case NOTIFICATION:
-                    getInstance().setNotification(notification);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("notification not allowed for " + getInstance().getType());
-            }
+            getInstance().setNotification(notification);
+            return this;
         }
 
         public Builder anyTypeKind(final AnyTypeKind anyTypeKind) {
-            switch (getInstance().getType()) {
-                case PROPAGATION:
-                case NOTIFICATION:
-                    getInstance().setAnyTypeKind(anyTypeKind);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("anyTypeKind not allowed for " + getInstance().getType());
-            }
+            getInstance().setAnyTypeKind(anyTypeKind);
+            return this;
         }
 
         public Builder entityKey(final String entityKey) {
-            switch (getInstance().getType()) {
-                case PROPAGATION:
-                case NOTIFICATION:
-                    getInstance().setEntityKey(entityKey);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("entityKey not allowed for " + getInstance().getType());
-            }
+            getInstance().setEntityKey(entityKey);
+            return this;
         }
 
         public Builder details(final boolean details) {
             getInstance().setDetails(details);
             return this;
         }
-
-        @Override
-        public TaskQuery build() {
-            if (getInstance().type == null) {
-                throw new IllegalArgumentException("type is required");
-            }
-            return super.build();
-        }
-
     }
 
     private TaskType type;

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
index 4b2fc5c..72ee648 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
@@ -22,11 +22,14 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.Authorization;
 import javax.ws.rs.BeanParam;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.to.AccessTokenTO;
 import org.apache.syncope.common.lib.to.PagedResult;
@@ -49,6 +52,7 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "BasicAuthentication") })
     @POST
     @Path("login")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response login();
 
     /**
@@ -61,6 +65,7 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "Bearer") })
     @POST
     @Path("refresh")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response refresh();
 
     /**
@@ -72,6 +77,7 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "Bearer") })
     @POST
     @Path("logout")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response logout();
 
     /**
@@ -84,6 +90,8 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "BasicAuthentication")
         , @Authorization(value = "Bearer") })
     @GET
+    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     PagedResult<AccessTokenTO> list(@BeanParam AccessTokenQuery query);
 
     /**
@@ -97,5 +105,6 @@ public interface AccessTokenService extends JAXRSService {
         , @Authorization(value = "Bearer") })
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
index a72cc16..03f4666 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
@@ -128,7 +128,6 @@ public interface AnyService<TO extends AnyTO> extends JAXRSService {
     @DELETE
     @Path("{key}/{schemaType}/{schema}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("schemaType") SchemaType schemaType,
@@ -144,7 +143,6 @@ public interface AnyService<TO extends AnyTO> extends JAXRSService {
     @DELETE
     @Path("{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
index 311ea9c..1d8ca1e 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
@@ -71,6 +71,7 @@ public interface AnyTypeClassService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull AnyTypeClassTO anyTypeClassTO);
 
     /**
@@ -82,6 +83,7 @@ public interface AnyTypeClassService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull AnyTypeClassTO anyTypeClassTO);
 
     /**
@@ -92,5 +94,6 @@ public interface AnyTypeClassService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
index 836889f..11ae646 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
@@ -92,5 +92,6 @@ public interface AnyTypeService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
index aba2f44..a338a74 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
@@ -80,6 +80,7 @@ public interface ConfigurationService extends JAXRSService {
     @PUT
     @Path("{schema}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response set(@NotNull AttrTO value);
 
     /**
@@ -90,6 +91,6 @@ public interface ConfigurationService extends JAXRSService {
      */
     @DELETE
     @Path("{schema}")
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("schema") String schema);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
index 26dc7fd..da4447a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
@@ -60,6 +60,7 @@ public interface ConnectorHistoryService extends JAXRSService {
      */
     @POST
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response restore(@NotNull @PathParam("key") String key);
 
     /**
@@ -70,5 +71,6 @@ public interface ConnectorHistoryService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
index f78f4a9..882ab35 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
@@ -122,6 +122,7 @@ public interface ConnectorService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull ConnInstanceTO connInstanceTO);
 
     /**
@@ -133,6 +134,7 @@ public interface ConnectorService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull ConnInstanceTO connInstanceTO);
 
     /**
@@ -143,6 +145,7 @@ public interface ConnectorService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -154,6 +157,7 @@ public interface ConnectorService extends JAXRSService {
     @POST
     @Path("check")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response check(@NotNull ConnInstanceTO connInstanceTO);
 
     /**
@@ -163,5 +167,6 @@ public interface ConnectorService extends JAXRSService {
      */
     @POST
     @Path("reload")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response reload();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
index b8592c8..b336636 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
@@ -71,6 +71,7 @@ public interface DomainService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull DomainTO domainTO);
 
     /**
@@ -82,6 +83,7 @@ public interface DomainService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull DomainTO domainTO);
 
     /**
@@ -92,5 +94,6 @@ public interface DomainService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
index 9b55494..50114ce 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
@@ -71,6 +71,7 @@ public interface DynRealmService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull DynRealmTO dynDynRealmTO);
 
     /**
@@ -82,6 +83,7 @@ public interface DynRealmService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull DynRealmTO dynDynRealmTO);
 
     /**
@@ -92,6 +94,7 @@ public interface DynRealmService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
index 11fd1dc..22412cc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
@@ -73,6 +73,7 @@ public interface ExecutableService extends JAXRSService {
      */
     @DELETE
     @Path("executions/{executionKey}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response deleteExecution(@NotNull @PathParam("executionKey") String executionKey);
 
     /**
@@ -83,7 +84,7 @@ public interface ExecutableService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/executions")
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     BulkActionResult deleteExecutions(@BeanParam BulkExecDeleteQuery query);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
index 4d64580..38f34db 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
@@ -104,6 +104,7 @@ public interface GroupService extends AnyService<GroupTO> {
      */
     @POST
     @Path("{key}/members/{actionType}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     ExecTO bulkMembersAction(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("actionType") BulkMembersActionType actionType);

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
index 23e8207..378d118 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
@@ -110,6 +110,7 @@ public interface LoggerService extends JAXRSService {
     @PUT
     @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull @PathParam("type") LoggerType type, @NotNull LoggerTO logger);
 
     /**
@@ -121,6 +122,7 @@ public interface LoggerService extends JAXRSService {
      */
     @DELETE
     @Path("{type}/{name}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") String name);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
index 20f87d1..caf254a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
@@ -62,6 +62,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull MailTemplateTO mailTemplateTO);
 
     /**
@@ -83,6 +84,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -108,6 +110,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @PUT
     @Path("{key}/{format}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response setFormat(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("format") MailTemplateFormat format,
@@ -122,6 +125,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/{format}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response removeFormat(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("format") MailTemplateFormat format);

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
index ba0f4c8..5a4fb81 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
@@ -75,6 +75,7 @@ public interface NotificationService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull NotificationTO notificationTO);
 
     /**
@@ -86,6 +87,7 @@ public interface NotificationService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull NotificationTO notificationTO);
 
     /**
@@ -96,6 +98,7 @@ public interface NotificationService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -116,5 +119,6 @@ public interface NotificationService extends JAXRSService {
      */
     @POST
     @Path("job")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response actionJob(@QueryParam("action") JobAction action);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
index 082446a..a8ca01c 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -76,6 +76,7 @@ public interface PolicyService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull AbstractPolicyTO policyTO);
 
     /**
@@ -87,6 +88,7 @@ public interface PolicyService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull AbstractPolicyTO policyTO);
 
     /**
@@ -97,6 +99,7 @@ public interface PolicyService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
index a178531..75f6621 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
@@ -74,6 +74,7 @@ public interface RealmService extends JAXRSService {
     @POST
     @Path("{parentPath:.*}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull @PathParam("parentPath") String parentPath, @NotNull RealmTO realmTO);
 
     /**
@@ -86,6 +87,7 @@ public interface RealmService extends JAXRSService {
     @PUT
     @Path("{fullPath:.*}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull RealmTO realmTO);
 
     /**
@@ -97,5 +99,6 @@ public interface RealmService extends JAXRSService {
      */
     @DELETE
     @Path("{fullPath:.*}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("fullPath") String fullPath);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
index 74b5ae6..c6ed7bc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
@@ -71,6 +71,7 @@ public interface RelationshipTypeService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull RelationshipTypeTO relationshipTypeTO);
 
     /**
@@ -82,6 +83,7 @@ public interface RelationshipTypeService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull RelationshipTypeTO relationshipTypeTO);
 
     /**
@@ -92,5 +94,6 @@ public interface RelationshipTypeService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
index b2a91f1..2d9fa5a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
@@ -73,6 +73,7 @@ public interface ReportService extends ExecutableService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull ReportTO reportTO);
 
     /**
@@ -84,6 +85,7 @@ public interface ReportService extends ExecutableService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull ReportTO reportTO);
 
     /**
@@ -94,6 +96,7 @@ public interface ReportService extends ExecutableService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
index 247bece..3172891 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
@@ -83,6 +83,7 @@ public interface ReportTemplateService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -91,7 +92,6 @@ public interface ReportTemplateService extends JAXRSService {
      * @param key report template
      * @param format template format
      * @return report template with matching key and format, if available
-     * @return an empty response if operation was successful
      */
     @GET
     @Path("{key}/{format}")

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
index 30dd523..9412522 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
@@ -60,6 +60,7 @@ public interface ResourceHistoryService extends JAXRSService {
      */
     @POST
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response restore(@NotNull @PathParam("key") String key);
 
     /**
@@ -70,5 +71,6 @@ public interface ResourceHistoryService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
index bb7cbb9..af91854 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
@@ -110,6 +110,7 @@ public interface ResourceService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull ResourceTO resourceTO);
 
     /**
@@ -121,6 +122,7 @@ public interface ResourceService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull ResourceTO resourceTO);
 
     /**
@@ -133,6 +135,7 @@ public interface ResourceService extends JAXRSService {
      */
     @POST
     @Path("{key}/{anyTypeKey}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response setLatestSyncToken(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("anyTypeKey") String anyTypeKey);
@@ -146,6 +149,7 @@ public interface ResourceService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/{anyTypeKey}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response removeSyncToken(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("anyTypeKey") String anyTypeKey);
@@ -159,6 +163,7 @@ public interface ResourceService extends JAXRSService {
     @DELETE
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
index 0c961ee..5e55b1e 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
@@ -72,6 +72,7 @@ public interface RoleService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull RoleTO roleTO);
 
     /**
@@ -83,6 +84,7 @@ public interface RoleService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull RoleTO roleTO);
 
     /**
@@ -93,6 +95,7 @@ public interface RoleService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -116,6 +119,7 @@ public interface RoleService extends JAXRSService {
     @PUT
     @Path("{key}/consoleLayout")
     @Consumes({ MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response setConsoleLayoutInfo(@NotNull @PathParam("key") String key, InputStream consoleLayoutInfoIn);
 
     /**
@@ -126,5 +130,6 @@ public interface RoleService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/consoleLayout")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response removeConsoleLayoutInfo(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
index d60d1b2..578e403 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
@@ -82,6 +82,7 @@ public interface SchemaService extends JAXRSService {
     @POST
     @Path("{type}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO);
 
     /**
@@ -94,6 +95,7 @@ public interface SchemaService extends JAXRSService {
     @PUT
     @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO);
 
     /**
@@ -105,5 +107,6 @@ public interface SchemaService extends JAXRSService {
      */
     @DELETE
     @Path("{type}/{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
index 2d5b86e..70c408d 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
@@ -71,6 +71,7 @@ public interface SecurityQuestionService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull SecurityQuestionTO securityQuestionTO);
 
     /**
@@ -82,6 +83,7 @@ public interface SecurityQuestionService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull SecurityQuestionTO securityQuestionTO);
 
     /**
@@ -92,6 +94,7 @@ public interface SecurityQuestionService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
index dac39bb..1e7bcd2 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
@@ -105,6 +105,7 @@ public interface TaskService extends ExecutableService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
index 524f51e..ee16aac 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
@@ -156,6 +156,7 @@ public interface UserSelfService extends JAXRSService {
      */
     @POST
     @Path("requestPasswordReset")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response requestPasswordReset(@NotNull @QueryParam("username") String username, String securityAnswer);
 
     /**
@@ -170,5 +171,6 @@ public interface UserSelfService extends JAXRSService {
      */
     @POST
     @Path("confirmPasswordReset")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response confirmPasswordReset(@NotNull @QueryParam("token") String token, String password);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
index 1a81c92..74febf5 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
@@ -93,6 +93,7 @@ public interface WorkflowService extends JAXRSService {
     @PUT
     @Path("{anyType}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response set(
             @NotNull @PathParam("anyType") String anyType,
             @NotNull @PathParam("key") String key,
@@ -107,6 +108,7 @@ public interface WorkflowService extends JAXRSService {
      */
     @DELETE
     @Path("{anyType}/{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(
             @NotNull @PathParam("anyType") String anyType,
             @NotNull @PathParam("key") String key);

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
index d4915ce..aa71fbd 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
@@ -25,8 +25,10 @@ import java.util.List;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AccessTokenTO;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -70,7 +72,9 @@ public class AccessTokenLogic extends AbstractTransactionalLogic<AccessTokenTO>
     @PreAuthorize("isAuthenticated()")
     public Pair<String, Date> login() {
         if (anonymousUser.equals(AuthContextUtils.getUsername())) {
-            throw new IllegalArgumentException(anonymousUser + " cannot be granted an access token");
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add(anonymousUser + " cannot be granted an access token");
+            throw sce;
         }
 
         return binder.create(

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
index a0c70d0..95944c9 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
@@ -107,17 +107,19 @@ public class AnyTypeLogic extends AbstractTransactionalLogic<AnyTypeTO> {
             throw new NotFoundException(key);
         }
 
-        try {
-            Integer anyObjects = anyObjectDAO.countByType().get(anyType);
-            if (anyObjects != null && anyObjects > 0) {
-                LOG.error("{} AnyObject instances found for {}, aborting", anyObjects, anyType);
+        Integer anyObjects = anyObjectDAO.countByType().get(anyType);
+        if (anyObjects != null && anyObjects > 0) {
+            LOG.error("{} AnyObject instances found for {}, aborting", anyObjects, anyType);
 
-                throw new IllegalArgumentException("AnyObject instances found for " + key);
-            }
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
+            sce.getElements().add("AnyObject instances found for " + key);
+            throw sce;
+        }
 
+        try {
             return binder.delete(anyType);
         } catch (IllegalArgumentException e) {
-            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
             sce.getElements().add(e.getMessage());
             throw sce;
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index 834458d..2a4b316 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -157,16 +157,26 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
             final List<OrderByClause> orderByClauses,
             final boolean details) {
 
-        int count = taskDAO.count(
-                type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey);
+        try {
+            if (type == null) {
+                throw new IllegalArgumentException("type is required");
+            }
 
-        List<T> result = taskDAO.findAll(
-                type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey,
-                page, size, orderByClauses).stream().
-                <T>map(task -> binder.getTaskTO(task, taskUtilsFactory.getInstance(type), details)).
-                collect(Collectors.toList());
+            int count = taskDAO.count(
+                    type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey);
 
-        return Pair.of(count, result);
+            List<T> result = taskDAO.findAll(
+                    type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey,
+                    page, size, orderByClauses).stream().
+                    <T>map(task -> binder.getTaskTO(task, taskUtilsFactory.getInstance(type), details)).
+                    collect(Collectors.toList());
+
+            return Pair.of(count, result);
+        } catch (IllegalArgumentException e) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add(e.getMessage());
+            throw sce;
+        }
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_READ + "')")

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
index d883901..53fb4a9 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
@@ -334,8 +334,8 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
         List<String> attrValues = split(value, literals);
 
         if (attrValues.size() != identifiers.size()) {
-            LOG.error("Ambiguous JEXL expression resolution.");
-            throw new IllegalArgumentException("literals and values have different size");
+            LOG.error("Ambiguous JEXL expression resolution: literals and values have different size");
+            return Collections.emptySet();
         }
 
         // clauses to be used with INTERSECTed queries
@@ -350,53 +350,51 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
         // Create several clauses: one for eanch identifiers
         for (int i = 0; i < identifiers.size(); i++) {
             if (!used.contains(identifiers.get(i))) {
-
                 // verify schema existence and get schema type
                 PlainSchema schema = plainSchemaDAO().find(identifiers.get(i));
                 if (schema == null) {
-                    LOG.error("Invalid schema id '{}'", identifiers.get(i));
-                    throw new IllegalArgumentException("Invalid schema id " + identifiers.get(i));
-                }
-
-                // clear builder
-                bld.delete(0, bld.length());
-
-                bld.append("(");
-
-                // set schema name
-                bld.append("s.id = '").append(identifiers.get(i)).append("'");
-
-                bld.append(" AND ");
-
-                bld.append("s.id = a.schema_id").append(" AND ");
+                    LOG.error("Invalid schema '{}', ignoring", identifiers.get(i));
+                } else {
+                    // clear builder
+                    bld.delete(0, bld.length());
+
+                    bld.append("(");
+
+                    // set schema name
+                    bld.append("s.id = '").append(identifiers.get(i)).append("'");
+
+                    bld.append(" AND ");
+
+                    bld.append("s.id = a.schema_id").append(" AND ");
+
+                    bld.append("a.id = v.attribute_id");
+
+                    bld.append(" AND ");
+
+                    // use a value clause different for eanch different schema type
+                    switch (schema.getType()) {
+                        case Boolean:
+                            bld.append("v.booleanValue = '").append(attrValues.get(i)).append("'");
+                            break;
+                        case Long:
+                            bld.append("v.longValue = ").append(attrValues.get(i));
+                            break;
+                        case Double:
+                            bld.append("v.doubleValue = ").append(attrValues.get(i));
+                            break;
+                        case Date:
+                            bld.append("v.dateValue = '").append(attrValues.get(i)).append("'");
+                            break;
+                        default:
+                            bld.append("v.stringValue = '").append(attrValues.get(i)).append("'");
+                    }
 
-                bld.append("a.id = v.attribute_id");
+                    bld.append(")");
 
-                bld.append(" AND ");
+                    used.add(identifiers.get(i));
 
-                // use a value clause different for eanch different schema type
-                switch (schema.getType()) {
-                    case Boolean:
-                        bld.append("v.booleanValue = '").append(attrValues.get(i)).append("'");
-                        break;
-                    case Long:
-                        bld.append("v.longValue = ").append(attrValues.get(i));
-                        break;
-                    case Double:
-                        bld.append("v.doubleValue = ").append(attrValues.get(i));
-                        break;
-                    case Date:
-                        bld.append("v.dateValue = '").append(attrValues.get(i)).append("'");
-                        break;
-                    default:
-                        bld.append("v.stringValue = '").append(attrValues.get(i)).append("'");
+                    clauses.add(bld.toString());
                 }
-
-                bld.append(")");
-
-                used.add(identifiers.get(i));
-
-                clauses.add(bld.toString());
             }
         }
 
@@ -434,13 +432,15 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
             }
         }
 
-        Query query = entityManager().createNativeQuery(querystring.toString());
-
         List<A> result = new ArrayList<>();
-        for (Object anyKey : query.getResultList()) {
-            A any = find(anyKey.toString());
-            if (!result.contains(any)) {
-                result.add(any);
+        if (querystring.length() > 0) {
+            Query query = entityManager().createNativeQuery(querystring.toString());
+
+            for (Object anyKey : query.getResultList()) {
+                A any = find(anyKey.toString());
+                if (!result.contains(any)) {
+                    result.add(any);
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
index 26417c8..fa32394 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.persistence.jpa.inner;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.Date;
@@ -95,16 +95,12 @@ public class UserTest extends AbstractTest {
 
     @Test
     public void findByInvalidDerAttrValue() {
-        assertThrows(IllegalArgumentException.class, () -> {
-            userDAO.findByDerAttrValue("cn", "Antonio, Maria, Rossi");
-        });
+        assertTrue(userDAO.findByDerAttrValue("cn", "Antonio, Maria, Rossi").isEmpty());
     }
 
     @Test
     public void findByInvalidDerAttrExpression() {
-        assertThrows(IllegalArgumentException.class, () -> {
-            userDAO.findByDerAttrValue("noschema", "Antonio, Maria");
-        });
+        assertTrue(userDAO.findByDerAttrValue("noschema", "Antonio, Maria").isEmpty());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
index 93f8df1..90645b2 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
@@ -146,7 +146,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -180,7 +180,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -216,7 +216,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -250,7 +250,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -289,7 +289,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -346,7 +346,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }
@@ -364,7 +364,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }
@@ -382,7 +382,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }
@@ -412,7 +412,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
index 248daf9..2b77a61 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java;
 
+import java.text.ParseException;
 import org.apache.syncope.core.provisioning.api.IntAttrName;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -88,7 +89,7 @@ public class IntAttrNameParser {
     }
 
     @Transactional(readOnly = true)
-    public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) {
+    public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException {
         IntAttrName result = new IntAttrName();
 
         if (intAttrName.indexOf('.') == -1) {
@@ -113,7 +114,7 @@ public class IntAttrNameParser {
                         result.setMembershipOfGroup(matcher.group(1));
                         setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result);
                     } else {
-                        throw new IllegalArgumentException("Unparsable expression: " + intAttrName);
+                        throw new ParseException("Unparsable expression: " + intAttrName, 0);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
index 8d0d83f..8685d39 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -296,8 +297,13 @@ public class MappingManagerImpl implements MappingManager {
     private Pair<String, Attribute> prepareAttr(
             final Provision provision, final Item mapItem, final Any<?> any, final String password) {
 
-        IntAttrName intAttrName =
-                intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", mapItem.getIntAttrName(), e);
+            return null;
+        }
 
         boolean readOnlyVirSchema = false;
         Schema schema = null;
@@ -588,20 +594,27 @@ public class MappingManagerImpl implements MappingManager {
     private String getGroupOwnerValue(final Provision provision, final Any<?> any) {
         Pair<String, Attribute> preparedAttr =
                 prepareAttr(provision, MappingUtils.getConnObjectKeyItem(provision).get(), any, null);
-        String connObjectKey = preparedAttr.getKey();
 
-        return MappingUtils.evaluateNAME(any, provision, connObjectKey).getNameValue();
+        return preparedAttr == null
+                ? null
+                : MappingUtils.evaluateNAME(any, provision, preparedAttr.getKey()).getNameValue();
     }
 
     @Transactional(readOnly = true)
     @Override
     public Optional<String> getConnObjectKeyValue(final Any<?> any, final Provision provision) {
         MappingItem mapItem = provision.getMapping().getConnObjectKeyItem().get();
-        List<PlainAttrValue> values = getIntValues(
-                provision,
-                mapItem,
-                intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind()),
-                any);
+        List<PlainAttrValue> values;
+        try {
+            values = getIntValues(
+                    provision,
+                    mapItem,
+                    intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind()),
+                    any);
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", mapItem.getIntAttrName(), e);
+            values = Collections.emptyList();
+        }
         return Optional.ofNullable(values.isEmpty()
                 ? null
                 : values.get(0).getValueAsString());
@@ -627,8 +640,13 @@ public class MappingManagerImpl implements MappingManager {
         }
         values = values == null ? Collections.emptyList() : values;
 
-        IntAttrName intAttrName =
-                intAttrNameParser.parse(mapItem.getIntAttrName(), anyUtils.getAnyTypeKind());
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(mapItem.getIntAttrName(), anyUtils.getAnyTypeKind());
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", mapItem.getIntAttrName(), e);
+            return;
+        }
 
         if (intAttrName.getField() != null) {
             switch (intAttrName.getField()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
index 97de7cd..1d1bb16 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -203,9 +204,13 @@ abstract class AbstractAnyDataBinder {
         List<String> missingAttrNames = new ArrayList<>();
 
         MappingUtils.getPropagationItems(provision.getMapping().getItems()).forEach(mapItem -> {
-            IntAttrName intAttrName = intAttrNameParser.
-                    parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
-            if (intAttrName.getSchemaType() != null) {
+            IntAttrName intAttrName = null;
+            try {
+                intAttrName = intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
+            } catch (ParseException e) {
+                LOG.error("Invalid intAttrName '{}', ignoring", mapItem.getIntAttrName(), e);
+            }
+            if (intAttrName != null && intAttrName.getSchemaType() != null) {
                 List<PlainAttrValue> values = mappingManager.getIntValues(provision, mapItem, intAttrName, any);
                 if (values.isEmpty() && JexlUtils.evaluateMandatoryCondition(mapItem.getMandatoryCondition(), any)) {
                     missingAttrNames.add(mapItem.getIntAttrName());

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
index 84a3085..a4efbf5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
@@ -148,7 +149,13 @@ public class NotificationDataBinderImpl implements NotificationDataBinder {
                 collect(Collectors.toList()));
 
         // 3. verify recipientAttrName
-        intAttrNameParser.parse(notification.getRecipientAttrName(), AnyTypeKind.USER);
+        try {
+            intAttrNameParser.parse(notification.getRecipientAttrName(), AnyTypeKind.USER);
+        } catch (ParseException e) {
+            SyncopeClientException invalidRequest = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            invalidRequest.getElements().add(e.getMessage());
+            throw invalidRequest;
+        }
 
         if (notificationTO.getRecipientsProvider() == null) {
             notification.setRecipientsProvider(null);

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
index 8537331..d877700 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
@@ -73,7 +73,7 @@ public class RealmDataBinderImpl implements RealmDataBinder {
 
     private void setTemplates(final RealmTO realmTO, final Realm realm) {
         // validate JEXL expressions from templates and proceed if fine
-        templateUtils.check(realmTO.getTemplates(), ClientExceptionType.InvalidPullTask);
+        templateUtils.check(realmTO.getTemplates(), ClientExceptionType.InvalidRealm);
         realmTO.getTemplates().entrySet().forEach(entry -> {
             AnyType type = anyTypeDAO.find(entry.getKey());
             if (type == null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index db151af..875f58a 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashSet;
@@ -407,11 +408,15 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
                 requiredValuesMissing.getElements().add("intAttrName");
                 scce.addException(requiredValuesMissing);
             } else {
-                IntAttrName intAttrName = intAttrNameParser.parse(
-                        itemTO.getIntAttrName(),
-                        mapping.getProvision().getAnyType().getKind());
+                IntAttrName intAttrName = null;
+                try {
+                    intAttrName = intAttrNameParser.parse(
+                            itemTO.getIntAttrName(), mapping.getProvision().getAnyType().getKind());
+                } catch (ParseException e) {
+                    LOG.error("Invalid intAttrName '{}'", itemTO.getIntAttrName(), e);
+                }
 
-                if (intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
+                if (intAttrName == null || intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
                     LOG.error("'{}' not existing", itemTO.getIntAttrName());
                     invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing");
                 } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 1140c27..c082555 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -29,6 +29,7 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.common.lib.SyncopeClientCompositeException;

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index 75b028f..67b97ed 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.provisioning.java.notification;
 
 import java.io.StringWriter;
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -377,7 +378,13 @@ public class NotificationManagerImpl implements NotificationManager {
     private String getRecipientEmail(final String recipientAttrName, final User user) {
         String email = null;
 
-        IntAttrName intAttrName = intAttrNameParser.parse(recipientAttrName, AnyTypeKind.USER);
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(recipientAttrName, AnyTypeKind.USER);
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified as recipient, ignoring", recipientAttrName, e);
+            return email;
+        }
 
         if ("username".equals(intAttrName.getField())) {
             email = user.getUsername();

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
index 094e88b..40d34f5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.pushpull;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -193,9 +194,15 @@ public class PullUtils {
 
         List<String> result = new ArrayList<>();
 
-        IntAttrName intAttrName = intAttrNameParser.parse(
-                connObjectKeyItem.get().getIntAttrName(),
-                provision.getAnyType().getKind());
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(
+                    connObjectKeyItem.get().getIntAttrName(),
+                    provision.getAnyType().getKind());
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", connObjectKeyItem.get().getIntAttrName(), e);
+            return result;
+        }
 
         if (intAttrName.getField() != null) {
             switch (intAttrName.getField()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
index f84d816..beeb7b0 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
@@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.fail;
 
+import java.text.ParseException;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.core.provisioning.api.IntAttrName;
@@ -37,7 +38,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     private IntAttrNameParser intAttrNameParser;
 
     @Test
-    public void ownFields() {
+    public void ownFields() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("key", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind());
@@ -78,7 +79,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void ownSchema() {
+    public void ownSchema() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("email", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind());
@@ -111,7 +112,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void enclosingGroup() {
+    public void enclosingGroup() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("groups[readers].cn", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.GROUP, intAttrName.getAnyTypeKind());
@@ -124,7 +125,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void relatedAnyObject() {
+    public void relatedAnyObject() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("anyObjects[hp].name", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.ANY_OBJECT, intAttrName.getAnyTypeKind());
@@ -137,7 +138,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void membership() {
+    public void membership() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("memberships[top].cn", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind());
@@ -154,7 +155,7 @@ public class IntAttrNameParserTest extends AbstractTest {
         try {
             intAttrNameParser.parse("memberships.cn", AnyTypeKind.USER);
             fail("This should not happen");
-        } catch (IllegalArgumentException e) {
+        } catch (ParseException e) {
             assertNotNull(e);
         }
     }


[07/11] syncope git commit: Fixing error reporting in case (no more IllegalArgumentException being returned by REST calls)

Posted by il...@apache.org.
Fixing error reporting in case (no more IllegalArgumentException being returned by REST calls)


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

Branch: refs/heads/2_0_X
Commit: 188df890f68001e8ed777d07b8be3dc37370acb0
Parents: 1bb9a7f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 12:31:54 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 12:31:54 2018 +0100

----------------------------------------------------------------------
 .../common/lib/types/ClientExceptionType.java   |  3 +-
 .../common/rest/api/beans/TaskQuery.java        | 53 ++---------
 .../rest/api/service/AccessTokenService.java    |  9 ++
 .../common/rest/api/service/AnyService.java     |  2 -
 .../rest/api/service/AnyTypeClassService.java   |  3 +
 .../common/rest/api/service/AnyTypeService.java |  1 +
 .../rest/api/service/ConfigurationService.java  |  3 +-
 .../api/service/ConnectorHistoryService.java    |  2 +
 .../rest/api/service/ConnectorService.java      |  5 +
 .../common/rest/api/service/DomainService.java  |  3 +
 .../rest/api/service/DynRealmService.java       |  3 +
 .../rest/api/service/ExecutableService.java     |  3 +-
 .../common/rest/api/service/GroupService.java   |  1 +
 .../common/rest/api/service/LoggerService.java  |  2 +
 .../rest/api/service/MailTemplateService.java   |  4 +
 .../rest/api/service/NotificationService.java   |  4 +
 .../common/rest/api/service/PolicyService.java  |  3 +
 .../common/rest/api/service/RealmService.java   |  3 +
 .../api/service/RelationshipTypeService.java    |  3 +
 .../common/rest/api/service/ReportService.java  |  3 +
 .../rest/api/service/ReportTemplateService.java |  2 +-
 .../api/service/ResourceHistoryService.java     |  2 +
 .../rest/api/service/ResourceService.java       |  5 +
 .../common/rest/api/service/RoleService.java    |  5 +
 .../common/rest/api/service/SchemaService.java  |  3 +
 .../api/service/SecurityQuestionService.java    |  3 +
 .../common/rest/api/service/TaskService.java    |  1 +
 .../rest/api/service/UserSelfService.java       |  2 +
 .../rest/api/service/WorkflowService.java       |  2 +
 .../syncope/core/logic/AccessTokenLogic.java    |  6 +-
 .../apache/syncope/core/logic/AnyTypeLogic.java | 16 ++--
 .../apache/syncope/core/logic/TaskLogic.java    | 32 ++++---
 .../persistence/jpa/dao/AbstractAnyDAO.java     | 96 ++++++++++----------
 .../core/persistence/jpa/inner/UserTest.java    |  9 +-
 .../provisioning/java/ConnectorFacadeProxy.java | 18 ++--
 .../provisioning/java/IntAttrNameParser.java    |  5 +-
 .../provisioning/java/MappingManagerImpl.java   | 40 +++++---
 .../java/data/AbstractAnyDataBinder.java        | 11 ++-
 .../java/data/NotificationDataBinderImpl.java   |  9 +-
 .../java/data/RealmDataBinderImpl.java          |  2 +-
 .../java/data/ResourceDataBinderImpl.java       | 13 ++-
 .../notification/NotificationManagerImpl.java   |  9 +-
 .../provisioning/java/pushpull/PullUtils.java   | 11 ++-
 .../java/IntAttrNameParserTest.java             | 13 +--
 .../rest/api/service/CamelRouteService.java     |  2 +
 .../core/logic/saml2/SAML2UserManager.java      | 22 ++++-
 .../java/data/SAML2IdPDataBinderImpl.java       | 17 +++-
 .../rest/api/service/SAML2IdPService.java       |  3 +
 .../rest/api/service/SCIMConfService.java       |  3 +-
 .../apache/syncope/fit/core/AnyTypeITCase.java  | 10 --
 .../syncope/fit/core/ExceptionMapperITCase.java | 53 +++++++++++
 51 files changed, 353 insertions(+), 185 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index 6e9f509..c4077e5 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@ -62,9 +62,8 @@ public enum ClientExceptionType {
     InvalidRole(Response.Status.BAD_REQUEST),
     InvalidUser(Response.Status.BAD_REQUEST),
     InvalidExternalResource(Response.Status.BAD_REQUEST),
-    InvalidPropagationTask(Response.Status.BAD_REQUEST),
-    InvalidSchedTask(Response.Status.BAD_REQUEST),
     InvalidPullTask(Response.Status.BAD_REQUEST),
+    InvalidRequest(Response.Status.BAD_REQUEST),
     InvalidValues(Response.Status.BAD_REQUEST),
     NotFound(Response.Status.NOT_FOUND),
     RequiredValuesMissing(Response.Status.BAD_REQUEST),

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
index 4ea0ea3..dc74d26 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/TaskQuery.java
@@ -44,66 +44,29 @@ public class TaskQuery extends AbstractQuery {
         }
 
         public Builder resource(final String resource) {
-            switch (getInstance().getType()) {
-                case PROPAGATION:
-                case PULL:
-                case PUSH:
-                    getInstance().setResource(resource);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("resource not allowed for " + getInstance().getType());
-            }
+            getInstance().setResource(resource);
+            return this;
         }
 
         public Builder notification(final String notification) {
-            switch (getInstance().getType()) {
-                case NOTIFICATION:
-                    getInstance().setNotification(notification);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("notification not allowed for " + getInstance().getType());
-            }
+            getInstance().setNotification(notification);
+            return this;
         }
 
         public Builder anyTypeKind(final AnyTypeKind anyTypeKind) {
-            switch (getInstance().getType()) {
-                case PROPAGATION:
-                case NOTIFICATION:
-                    getInstance().setAnyTypeKind(anyTypeKind);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("anyTypeKind not allowed for " + getInstance().getType());
-            }
+            getInstance().setAnyTypeKind(anyTypeKind);
+            return this;
         }
 
         public Builder entityKey(final String entityKey) {
-            switch (getInstance().getType()) {
-                case PROPAGATION:
-                case NOTIFICATION:
-                    getInstance().setEntityKey(entityKey);
-                    return this;
-
-                default:
-                    throw new IllegalArgumentException("entityKey not allowed for " + getInstance().getType());
-            }
+            getInstance().setEntityKey(entityKey);
+            return this;
         }
 
         public Builder details(final boolean details) {
             getInstance().setDetails(details);
             return this;
         }
-
-        @Override
-        public TaskQuery build() {
-            if (getInstance().type == null) {
-                throw new IllegalArgumentException("type is required");
-            }
-            return super.build();
-        }
-
     }
 
     private TaskType type;

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
index 4b2fc5c..72ee648 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AccessTokenService.java
@@ -22,11 +22,14 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.Authorization;
 import javax.ws.rs.BeanParam;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.to.AccessTokenTO;
 import org.apache.syncope.common.lib.to.PagedResult;
@@ -49,6 +52,7 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "BasicAuthentication") })
     @POST
     @Path("login")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response login();
 
     /**
@@ -61,6 +65,7 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "Bearer") })
     @POST
     @Path("refresh")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response refresh();
 
     /**
@@ -72,6 +77,7 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "Bearer") })
     @POST
     @Path("logout")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response logout();
 
     /**
@@ -84,6 +90,8 @@ public interface AccessTokenService extends JAXRSService {
         @Authorization(value = "BasicAuthentication")
         , @Authorization(value = "Bearer") })
     @GET
+    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     PagedResult<AccessTokenTO> list(@BeanParam AccessTokenQuery query);
 
     /**
@@ -97,5 +105,6 @@ public interface AccessTokenService extends JAXRSService {
         , @Authorization(value = "Bearer") })
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
index a72cc16..03f4666 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
@@ -128,7 +128,6 @@ public interface AnyService<TO extends AnyTO> extends JAXRSService {
     @DELETE
     @Path("{key}/{schemaType}/{schema}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("schemaType") SchemaType schemaType,
@@ -144,7 +143,6 @@ public interface AnyService<TO extends AnyTO> extends JAXRSService {
     @DELETE
     @Path("{key}")
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
index 311ea9c..1d8ca1e 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeClassService.java
@@ -71,6 +71,7 @@ public interface AnyTypeClassService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull AnyTypeClassTO anyTypeClassTO);
 
     /**
@@ -82,6 +83,7 @@ public interface AnyTypeClassService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull AnyTypeClassTO anyTypeClassTO);
 
     /**
@@ -92,5 +94,6 @@ public interface AnyTypeClassService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
index 836889f..11ae646 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
@@ -92,5 +92,6 @@ public interface AnyTypeService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
index aba2f44..a338a74 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
@@ -80,6 +80,7 @@ public interface ConfigurationService extends JAXRSService {
     @PUT
     @Path("{schema}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response set(@NotNull AttrTO value);
 
     /**
@@ -90,6 +91,6 @@ public interface ConfigurationService extends JAXRSService {
      */
     @DELETE
     @Path("{schema}")
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("schema") String schema);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
index 26dc7fd..da4447a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorHistoryService.java
@@ -60,6 +60,7 @@ public interface ConnectorHistoryService extends JAXRSService {
      */
     @POST
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response restore(@NotNull @PathParam("key") String key);
 
     /**
@@ -70,5 +71,6 @@ public interface ConnectorHistoryService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
index f78f4a9..882ab35 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
@@ -122,6 +122,7 @@ public interface ConnectorService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull ConnInstanceTO connInstanceTO);
 
     /**
@@ -133,6 +134,7 @@ public interface ConnectorService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull ConnInstanceTO connInstanceTO);
 
     /**
@@ -143,6 +145,7 @@ public interface ConnectorService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -154,6 +157,7 @@ public interface ConnectorService extends JAXRSService {
     @POST
     @Path("check")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response check(@NotNull ConnInstanceTO connInstanceTO);
 
     /**
@@ -163,5 +167,6 @@ public interface ConnectorService extends JAXRSService {
      */
     @POST
     @Path("reload")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response reload();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
index b8592c8..b336636 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DomainService.java
@@ -71,6 +71,7 @@ public interface DomainService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull DomainTO domainTO);
 
     /**
@@ -82,6 +83,7 @@ public interface DomainService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull DomainTO domainTO);
 
     /**
@@ -92,5 +94,6 @@ public interface DomainService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
index 9b55494..50114ce 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DynRealmService.java
@@ -71,6 +71,7 @@ public interface DynRealmService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull DynRealmTO dynDynRealmTO);
 
     /**
@@ -82,6 +83,7 @@ public interface DynRealmService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull DynRealmTO dynDynRealmTO);
 
     /**
@@ -92,6 +94,7 @@ public interface DynRealmService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
index 11fd1dc..22412cc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ExecutableService.java
@@ -73,6 +73,7 @@ public interface ExecutableService extends JAXRSService {
      */
     @DELETE
     @Path("executions/{executionKey}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response deleteExecution(@NotNull @PathParam("executionKey") String executionKey);
 
     /**
@@ -83,7 +84,7 @@ public interface ExecutableService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/executions")
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     BulkActionResult deleteExecutions(@BeanParam BulkExecDeleteQuery query);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
index bf3e3d3..217b5d8 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java
@@ -104,6 +104,7 @@ public interface GroupService extends AnyService<GroupTO> {
      */
     @POST
     @Path("{key}/members/{actionType}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     ExecTO bulkMembersAction(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("actionType") BulkMembersActionType actionType);

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
index 23e8207..378d118 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
@@ -110,6 +110,7 @@ public interface LoggerService extends JAXRSService {
     @PUT
     @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull @PathParam("type") LoggerType type, @NotNull LoggerTO logger);
 
     /**
@@ -121,6 +122,7 @@ public interface LoggerService extends JAXRSService {
      */
     @DELETE
     @Path("{type}/{name}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") String name);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
index 20f87d1..caf254a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/MailTemplateService.java
@@ -62,6 +62,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull MailTemplateTO mailTemplateTO);
 
     /**
@@ -83,6 +84,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -108,6 +110,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @PUT
     @Path("{key}/{format}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response setFormat(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("format") MailTemplateFormat format,
@@ -122,6 +125,7 @@ public interface MailTemplateService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/{format}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response removeFormat(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("format") MailTemplateFormat format);

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
index ba0f4c8..5a4fb81 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
@@ -75,6 +75,7 @@ public interface NotificationService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull NotificationTO notificationTO);
 
     /**
@@ -86,6 +87,7 @@ public interface NotificationService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull NotificationTO notificationTO);
 
     /**
@@ -96,6 +98,7 @@ public interface NotificationService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -116,5 +119,6 @@ public interface NotificationService extends JAXRSService {
      */
     @POST
     @Path("job")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response actionJob(@QueryParam("action") JobAction action);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
index 082446a..a8ca01c 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -76,6 +76,7 @@ public interface PolicyService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull AbstractPolicyTO policyTO);
 
     /**
@@ -87,6 +88,7 @@ public interface PolicyService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull AbstractPolicyTO policyTO);
 
     /**
@@ -97,6 +99,7 @@ public interface PolicyService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
index a178531..75f6621 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
@@ -74,6 +74,7 @@ public interface RealmService extends JAXRSService {
     @POST
     @Path("{parentPath:.*}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull @PathParam("parentPath") String parentPath, @NotNull RealmTO realmTO);
 
     /**
@@ -86,6 +87,7 @@ public interface RealmService extends JAXRSService {
     @PUT
     @Path("{fullPath:.*}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull RealmTO realmTO);
 
     /**
@@ -97,5 +99,6 @@ public interface RealmService extends JAXRSService {
      */
     @DELETE
     @Path("{fullPath:.*}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("fullPath") String fullPath);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
index 74b5ae6..c6ed7bc 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RelationshipTypeService.java
@@ -71,6 +71,7 @@ public interface RelationshipTypeService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull RelationshipTypeTO relationshipTypeTO);
 
     /**
@@ -82,6 +83,7 @@ public interface RelationshipTypeService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull RelationshipTypeTO relationshipTypeTO);
 
     /**
@@ -92,5 +94,6 @@ public interface RelationshipTypeService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
index b2a91f1..2d9fa5a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
@@ -73,6 +73,7 @@ public interface ReportService extends ExecutableService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull ReportTO reportTO);
 
     /**
@@ -84,6 +85,7 @@ public interface ReportService extends ExecutableService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull ReportTO reportTO);
 
     /**
@@ -94,6 +96,7 @@ public interface ReportService extends ExecutableService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
index 247bece..3172891 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportTemplateService.java
@@ -83,6 +83,7 @@ public interface ReportTemplateService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -91,7 +92,6 @@ public interface ReportTemplateService extends JAXRSService {
      * @param key report template
      * @param format template format
      * @return report template with matching key and format, if available
-     * @return an empty response if operation was successful
      */
     @GET
     @Path("{key}/{format}")

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
index 30dd523..9412522 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceHistoryService.java
@@ -60,6 +60,7 @@ public interface ResourceHistoryService extends JAXRSService {
      */
     @POST
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response restore(@NotNull @PathParam("key") String key);
 
     /**
@@ -70,5 +71,6 @@ public interface ResourceHistoryService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
index bb7cbb9..af91854 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
@@ -110,6 +110,7 @@ public interface ResourceService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull ResourceTO resourceTO);
 
     /**
@@ -121,6 +122,7 @@ public interface ResourceService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull ResourceTO resourceTO);
 
     /**
@@ -133,6 +135,7 @@ public interface ResourceService extends JAXRSService {
      */
     @POST
     @Path("{key}/{anyTypeKey}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response setLatestSyncToken(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("anyTypeKey") String anyTypeKey);
@@ -146,6 +149,7 @@ public interface ResourceService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/{anyTypeKey}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response removeSyncToken(
             @NotNull @PathParam("key") String key,
             @NotNull @PathParam("anyTypeKey") String anyTypeKey);
@@ -159,6 +163,7 @@ public interface ResourceService extends JAXRSService {
     @DELETE
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
index 0c961ee..5e55b1e 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
@@ -72,6 +72,7 @@ public interface RoleService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull RoleTO roleTO);
 
     /**
@@ -83,6 +84,7 @@ public interface RoleService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull RoleTO roleTO);
 
     /**
@@ -93,6 +95,7 @@ public interface RoleService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**
@@ -116,6 +119,7 @@ public interface RoleService extends JAXRSService {
     @PUT
     @Path("{key}/consoleLayout")
     @Consumes({ MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response setConsoleLayoutInfo(@NotNull @PathParam("key") String key, InputStream consoleLayoutInfoIn);
 
     /**
@@ -126,5 +130,6 @@ public interface RoleService extends JAXRSService {
      */
     @DELETE
     @Path("{key}/consoleLayout")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response removeConsoleLayoutInfo(@NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
index d60d1b2..578e403 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
@@ -82,6 +82,7 @@ public interface SchemaService extends JAXRSService {
     @POST
     @Path("{type}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO);
 
     /**
@@ -94,6 +95,7 @@ public interface SchemaService extends JAXRSService {
     @PUT
     @Path("{type}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull @PathParam("type") SchemaType type, @NotNull AbstractSchemaTO schemaTO);
 
     /**
@@ -105,5 +107,6 @@ public interface SchemaService extends JAXRSService {
      */
     @DELETE
     @Path("{type}/{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
index 2d5b86e..70c408d 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
@@ -71,6 +71,7 @@ public interface SecurityQuestionService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response create(@NotNull SecurityQuestionTO securityQuestionTO);
 
     /**
@@ -82,6 +83,7 @@ public interface SecurityQuestionService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull SecurityQuestionTO securityQuestionTO);
 
     /**
@@ -92,6 +94,7 @@ public interface SecurityQuestionService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
index dac39bb..1e7bcd2 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
@@ -105,6 +105,7 @@ public interface TaskService extends ExecutableService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@NotNull @PathParam("key") String key);
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
index df6014c..4f640dd 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
@@ -156,6 +156,7 @@ public interface UserSelfService extends JAXRSService {
      */
     @POST
     @Path("requestPasswordReset")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response requestPasswordReset(@NotNull @QueryParam("username") String username, String securityAnswer);
 
     /**
@@ -170,5 +171,6 @@ public interface UserSelfService extends JAXRSService {
      */
     @POST
     @Path("confirmPasswordReset")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response confirmPasswordReset(@NotNull @QueryParam("token") String token, String password);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
index 1a81c92..74febf5 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/WorkflowService.java
@@ -93,6 +93,7 @@ public interface WorkflowService extends JAXRSService {
     @PUT
     @Path("{anyType}/{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response set(
             @NotNull @PathParam("anyType") String anyType,
             @NotNull @PathParam("key") String key,
@@ -107,6 +108,7 @@ public interface WorkflowService extends JAXRSService {
      */
     @DELETE
     @Path("{anyType}/{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(
             @NotNull @PathParam("anyType") String anyType,
             @NotNull @PathParam("key") String key);

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
index d4e816b..62f57a2 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AccessTokenLogic.java
@@ -27,8 +27,10 @@ import javax.annotation.Resource;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AccessTokenTO;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -72,7 +74,9 @@ public class AccessTokenLogic extends AbstractTransactionalLogic<AccessTokenTO>
     @PreAuthorize("isAuthenticated()")
     public Pair<String, Date> login() {
         if (anonymousUser.equals(AuthContextUtils.getUsername())) {
-            throw new IllegalArgumentException(anonymousUser + " cannot be granted an access token");
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add(anonymousUser + " cannot be granted an access token");
+            throw sce;
         }
 
         return binder.create(

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
index a7a41ff..5c225d6 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
@@ -115,17 +115,19 @@ public class AnyTypeLogic extends AbstractTransactionalLogic<AnyTypeTO> {
             throw new NotFoundException(key);
         }
 
-        try {
-            Integer anyObjects = anyObjectDAO.countByType().get(anyType);
-            if (anyObjects != null && anyObjects > 0) {
-                LOG.error("{} AnyObject instances found for {}, aborting", anyObjects, anyType);
+        Integer anyObjects = anyObjectDAO.countByType().get(anyType);
+        if (anyObjects != null && anyObjects > 0) {
+            LOG.error("{} AnyObject instances found for {}, aborting", anyObjects, anyType);
 
-                throw new IllegalArgumentException("AnyObject instances found for " + key);
-            }
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
+            sce.getElements().add("AnyObject instances found for " + key);
+            throw sce;
+        }
 
+        try {
             return binder.delete(anyType);
         } catch (IllegalArgumentException e) {
-            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
             sce.getElements().add(e.getMessage());
             throw sce;
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
index 418202b..d1cc82c 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/TaskLogic.java
@@ -159,20 +159,30 @@ public class TaskLogic extends AbstractExecutableLogic<AbstractTaskTO> {
             final List<OrderByClause> orderByClauses,
             final boolean details) {
 
-        int count = taskDAO.count(
-                type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey);
+        try {
+            if (type == null) {
+                throw new IllegalArgumentException("type is required");
+            }
 
-        List<T> result = CollectionUtils.collect(taskDAO.findAll(
-                type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey,
-                page, size, orderByClauses), new Transformer<Task, T>() {
+            int count = taskDAO.count(
+                    type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey);
 
-            @Override
-            public T transform(final Task task) {
-                return (T) binder.getTaskTO(task, taskUtilsFactory.getInstance(type), details);
-            }
-        }, new ArrayList<T>());
+            List<T> result = CollectionUtils.collect(taskDAO.findAll(
+                    type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey,
+                    page, size, orderByClauses), new Transformer<Task, T>() {
 
-        return Pair.of(count, result);
+                @Override
+                public T transform(final Task task) {
+                    return (T) binder.getTaskTO(task, taskUtilsFactory.getInstance(type), details);
+                }
+            }, new ArrayList<T>());
+
+            return Pair.of(count, result);
+        } catch (IllegalArgumentException e) {
+            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add(e.getMessage());
+            throw sce;
+        }
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.TASK_READ + "')")

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
index 894ec21..4588617 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
@@ -342,8 +342,8 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
         List<String> attrValues = split(value, literals);
 
         if (attrValues.size() != identifiers.size()) {
-            LOG.error("Ambiguous JEXL expression resolution.");
-            throw new IllegalArgumentException("literals and values have different size");
+            LOG.error("Ambiguous JEXL expression resolution: literals and values have different size");
+            return Collections.emptySet();
         }
 
         // clauses to be used with INTERSECTed queries
@@ -358,53 +358,51 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
         // Create several clauses: one for eanch identifiers
         for (int i = 0; i < identifiers.size(); i++) {
             if (!used.contains(identifiers.get(i))) {
-
                 // verify schema existence and get schema type
                 PlainSchema schema = plainSchemaDAO().find(identifiers.get(i));
                 if (schema == null) {
-                    LOG.error("Invalid schema id '{}'", identifiers.get(i));
-                    throw new IllegalArgumentException("Invalid schema id " + identifiers.get(i));
-                }
-
-                // clear builder
-                bld.delete(0, bld.length());
-
-                bld.append("(");
-
-                // set schema name
-                bld.append("s.id = '").append(identifiers.get(i)).append("'");
-
-                bld.append(" AND ");
-
-                bld.append("s.id = a.schema_id").append(" AND ");
+                    LOG.error("Invalid schema '{}', ignoring", identifiers.get(i));
+                } else {
+                    // clear builder
+                    bld.delete(0, bld.length());
+
+                    bld.append("(");
+
+                    // set schema name
+                    bld.append("s.id = '").append(identifiers.get(i)).append("'");
+
+                    bld.append(" AND ");
+
+                    bld.append("s.id = a.schema_id").append(" AND ");
+
+                    bld.append("a.id = v.attribute_id");
+
+                    bld.append(" AND ");
+
+                    // use a value clause different for eanch different schema type
+                    switch (schema.getType()) {
+                        case Boolean:
+                            bld.append("v.booleanValue = '").append(attrValues.get(i)).append("'");
+                            break;
+                        case Long:
+                            bld.append("v.longValue = ").append(attrValues.get(i));
+                            break;
+                        case Double:
+                            bld.append("v.doubleValue = ").append(attrValues.get(i));
+                            break;
+                        case Date:
+                            bld.append("v.dateValue = '").append(attrValues.get(i)).append("'");
+                            break;
+                        default:
+                            bld.append("v.stringValue = '").append(attrValues.get(i)).append("'");
+                    }
 
-                bld.append("a.id = v.attribute_id");
+                    bld.append(")");
 
-                bld.append(" AND ");
+                    used.add(identifiers.get(i));
 
-                // use a value clause different for eanch different schema type
-                switch (schema.getType()) {
-                    case Boolean:
-                        bld.append("v.booleanValue = '").append(attrValues.get(i)).append("'");
-                        break;
-                    case Long:
-                        bld.append("v.longValue = ").append(attrValues.get(i));
-                        break;
-                    case Double:
-                        bld.append("v.doubleValue = ").append(attrValues.get(i));
-                        break;
-                    case Date:
-                        bld.append("v.dateValue = '").append(attrValues.get(i)).append("'");
-                        break;
-                    default:
-                        bld.append("v.stringValue = '").append(attrValues.get(i)).append("'");
+                    clauses.add(bld.toString());
                 }
-
-                bld.append(")");
-
-                used.add(identifiers.get(i));
-
-                clauses.add(bld.toString());
             }
         }
 
@@ -442,13 +440,15 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
             }
         }
 
-        Query query = entityManager().createNativeQuery(querystring.toString());
-
         List<A> result = new ArrayList<>();
-        for (Object anyKey : query.getResultList()) {
-            A any = find(anyKey.toString());
-            if (!result.contains(any)) {
-                result.add(any);
+        if (querystring.length() > 0) {
+            Query query = entityManager().createNativeQuery(querystring.toString());
+
+            for (Object anyKey : query.getResultList()) {
+                A any = find(anyKey.toString());
+                if (!result.contains(any)) {
+                    result.add(any);
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
index 5400c31..eb48129 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/UserTest.java
@@ -21,6 +21,7 @@ package org.apache.syncope.core.persistence.jpa.inner;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Date;
@@ -92,14 +93,14 @@ public class UserTest extends AbstractTest {
         assertEquals("did not get expected number of users", 1, list.size());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void findByInvalidDerAttrValue() {
-        userDAO.findByDerAttrValue("cn", "Antonio, Maria, Rossi");
+        assertTrue(userDAO.findByDerAttrValue("cn", "Antonio, Maria, Rossi").isEmpty());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void findByInvalidDerAttrExpression() {
-        userDAO.findByDerAttrValue("noschema", "Antonio, Maria");
+        assertTrue(userDAO.findByDerAttrValue("noschema", "Antonio, Maria").isEmpty());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
index 8680f83..7e94c5b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
@@ -149,7 +149,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -183,7 +183,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -219,7 +219,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -253,7 +253,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -292,7 +292,7 @@ public class ConnectorFacadeProxy implements Connector {
                 if (e.getCause() instanceof RuntimeException) {
                     throw (RuntimeException) e.getCause();
                 } else {
-                    throw new IllegalArgumentException(e.getCause());
+                    throw new RuntimeException(e.getCause());
                 }
             }
         } else {
@@ -356,7 +356,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }
@@ -374,7 +374,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }
@@ -392,7 +392,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }
@@ -422,7 +422,7 @@ public class ConnectorFacadeProxy implements Connector {
             if (e.getCause() instanceof RuntimeException) {
                 throw (RuntimeException) e.getCause();
             } else {
-                throw new IllegalArgumentException(e.getCause());
+                throw new RuntimeException(e.getCause());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
index 248daf9..2b77a61 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/IntAttrNameParser.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java;
 
+import java.text.ParseException;
 import org.apache.syncope.core.provisioning.api.IntAttrName;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -88,7 +89,7 @@ public class IntAttrNameParser {
     }
 
     @Transactional(readOnly = true)
-    public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) {
+    public IntAttrName parse(final String intAttrName, final AnyTypeKind provisionAnyTypeKind) throws ParseException {
         IntAttrName result = new IntAttrName();
 
         if (intAttrName.indexOf('.') == -1) {
@@ -113,7 +114,7 @@ public class IntAttrNameParser {
                         result.setMembershipOfGroup(matcher.group(1));
                         setFieldOrSchemaName(matcher.group(2), result.getAnyTypeKind(), result);
                     } else {
-                        throw new IllegalArgumentException("Unparsable expression: " + intAttrName);
+                        throw new ParseException("Unparsable expression: " + intAttrName, 0);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
index a6f423d..713646f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -296,8 +297,13 @@ public class MappingManagerImpl implements MappingManager {
     private Pair<String, Attribute> prepareAttr(
             final Provision provision, final Item mapItem, final Any<?> any, final String password) {
 
-        IntAttrName intAttrName =
-                intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", mapItem.getIntAttrName(), e);
+            return null;
+        }
 
         boolean readOnlyVirSchema = false;
         Schema schema = null;
@@ -588,20 +594,27 @@ public class MappingManagerImpl implements MappingManager {
     private String getGroupOwnerValue(final Provision provision, final Any<?> any) {
         Pair<String, Attribute> preparedAttr =
                 prepareAttr(provision, MappingUtils.getConnObjectKeyItem(provision), any, null);
-        String connObjectKey = preparedAttr.getKey();
 
-        return MappingUtils.evaluateNAME(any, provision, connObjectKey).getNameValue();
+        return preparedAttr == null
+                ? null
+                : MappingUtils.evaluateNAME(any, provision, preparedAttr.getKey()).getNameValue();
     }
 
     @Transactional(readOnly = true)
     @Override
     public String getConnObjectKeyValue(final Any<?> any, final Provision provision) {
         MappingItem mapItem = provision.getMapping().getConnObjectKeyItem();
-        List<PlainAttrValue> values = getIntValues(
-                provision,
-                mapItem,
-                intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind()),
-                any);
+        List<PlainAttrValue> values;
+        try {
+            values = getIntValues(
+                    provision,
+                    mapItem,
+                    intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind()),
+                    any);
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", mapItem.getIntAttrName(), e);
+            values = Collections.emptyList();
+        }
         return values.isEmpty()
                 ? null
                 : values.get(0).getValueAsString();
@@ -627,8 +640,13 @@ public class MappingManagerImpl implements MappingManager {
         }
         values = ListUtils.emptyIfNull(values);
 
-        IntAttrName intAttrName =
-                intAttrNameParser.parse(mapItem.getIntAttrName(), anyUtils.getAnyTypeKind());
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(mapItem.getIntAttrName(), anyUtils.getAnyTypeKind());
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", mapItem.getIntAttrName(), e);
+            return;
+        }
 
         if (intAttrName.getField() != null) {
             switch (intAttrName.getField()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
index 9740c53..5a243d9 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -205,9 +206,13 @@ abstract class AbstractAnyDataBinder {
         List<String> missingAttrNames = new ArrayList<>();
 
         for (Item mapItem : MappingUtils.getPropagationItems(provision.getMapping().getItems())) {
-            IntAttrName intAttrName =
-                    intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
-            if (intAttrName.getSchemaType() != null) {
+            IntAttrName intAttrName = null;
+            try {
+                intAttrName = intAttrNameParser.parse(mapItem.getIntAttrName(), provision.getAnyType().getKind());
+            } catch (ParseException e) {
+                LOG.error("Invalid intAttrName '{}', ignoring", mapItem.getIntAttrName(), e);
+            }
+            if (intAttrName != null && intAttrName.getSchemaType() != null) {
                 List<PlainAttrValue> values = mappingManager.getIntValues(provision, mapItem, intAttrName, any);
                 if (values.isEmpty() && JexlUtils.evaluateMandatoryCondition(mapItem.getMandatoryCondition(), any)) {
                     missingAttrNames.add(mapItem.getIntAttrName());

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
index ccea817..6461b4b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.Map;
 import java.util.regex.Matcher;
 import org.apache.commons.collections4.CollectionUtils;
@@ -144,6 +145,12 @@ public class NotificationDataBinderImpl implements NotificationDataBinder {
         });
 
         // 3. verify recipientAttrName
-        intAttrNameParser.parse(notification.getRecipientAttrName(), AnyTypeKind.USER);
+        try {
+            intAttrNameParser.parse(notification.getRecipientAttrName(), AnyTypeKind.USER);
+        } catch (ParseException e) {
+            sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
+            sce.getElements().add(e.getMessage());
+            throw sce;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
index 4f7eda9..a07ef06 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
@@ -72,7 +72,7 @@ public class RealmDataBinderImpl implements RealmDataBinder {
 
     private void setTemplates(final RealmTO realmTO, final Realm realm) {
         // validate JEXL expressions from templates and proceed if fine
-        templateUtils.check(realmTO.getTemplates(), ClientExceptionType.InvalidPullTask);
+        templateUtils.check(realmTO.getTemplates(), ClientExceptionType.InvalidRealm);
         for (Map.Entry<String, AnyTO> entry : realmTO.getTemplates().entrySet()) {
             AnyType type = anyTypeDAO.find(entry.getKey());
             if (type == null) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index 9f8e75d..5df9531 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashSet;
@@ -384,11 +385,15 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
                 requiredValuesMissing.getElements().add("intAttrName");
                 scce.addException(requiredValuesMissing);
             } else {
-                IntAttrName intAttrName = intAttrNameParser.parse(
-                        itemTO.getIntAttrName(),
-                        mapping.getProvision().getAnyType().getKind());
+                IntAttrName intAttrName = null;
+                try {
+                    intAttrName = intAttrNameParser.parse(
+                            itemTO.getIntAttrName(), mapping.getProvision().getAnyType().getKind());
+                } catch (ParseException e) {
+                    LOG.error("Invalid intAttrName '{}'", itemTO.getIntAttrName(), e);
+                }
 
-                if (intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
+                if (intAttrName == null || intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
                     LOG.error("'{}' not existing", itemTO.getIntAttrName());
                     invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing");
                 } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index 5438cee..a7adc86 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.provisioning.java.notification;
 
 import java.io.StringWriter;
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -386,7 +387,13 @@ public class NotificationManagerImpl implements NotificationManager {
     private String getRecipientEmail(final String recipientAttrName, final User user) {
         String email = null;
 
-        IntAttrName intAttrName = intAttrNameParser.parse(recipientAttrName, AnyTypeKind.USER);
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(recipientAttrName, AnyTypeKind.USER);
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified as recipient, ignoring", recipientAttrName, e);
+            return email;
+        }
 
         if ("username".equals(intAttrName.getField())) {
             email = user.getUsername();

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
index 3503c9b..2f00978 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.pushpull;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -195,9 +196,13 @@ public class PullUtils {
 
         List<String> result = new ArrayList<>();
 
-        IntAttrName intAttrName = intAttrNameParser.parse(
-                connObjectKeyItem.getIntAttrName(),
-                provision.getAnyType().getKind());
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(connObjectKeyItem.getIntAttrName(), provision.getAnyType().getKind());
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", connObjectKeyItem.getIntAttrName(), e);
+            return result;
+        }
 
         if (intAttrName.getField() != null) {
             switch (intAttrName.getField()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
index c603f8a..adf2871 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/IntAttrNameParserTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
+import java.text.ParseException;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.core.provisioning.api.IntAttrName;
@@ -37,7 +38,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     private IntAttrNameParser intAttrNameParser;
 
     @Test
-    public void ownFields() {
+    public void ownFields() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("key", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind());
@@ -78,7 +79,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void ownSchema() {
+    public void ownSchema() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("email", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind());
@@ -111,7 +112,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void enclosingGroup() {
+    public void enclosingGroup() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("groups[readers].cn", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.GROUP, intAttrName.getAnyTypeKind());
@@ -124,7 +125,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void relatedAnyObject() {
+    public void relatedAnyObject() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("anyObjects[hp].name", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.ANY_OBJECT, intAttrName.getAnyTypeKind());
@@ -137,7 +138,7 @@ public class IntAttrNameParserTest extends AbstractTest {
     }
 
     @Test
-    public void membership() {
+    public void membership() throws ParseException {
         IntAttrName intAttrName = intAttrNameParser.parse("memberships[top].cn", AnyTypeKind.USER);
         assertNotNull(intAttrName);
         assertEquals(AnyTypeKind.USER, intAttrName.getAnyTypeKind());
@@ -154,7 +155,7 @@ public class IntAttrNameParserTest extends AbstractTest {
         try {
             intAttrNameParser.parse("memberships.cn", AnyTypeKind.USER);
             fail();
-        } catch (IllegalArgumentException e) {
+        } catch (ParseException e) {
             assertNotNull(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
----------------------------------------------------------------------
diff --git a/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java b/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
index 4450208..00a14d1 100644
--- a/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
+++ b/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
@@ -75,6 +75,7 @@ public interface CamelRouteService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull CamelRouteTO route);
 
     /**
@@ -84,6 +85,7 @@ public interface CamelRouteService extends JAXRSService {
      */
     @POST
     @Path("restartContext")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response restartContext();
 
     /**


[03/11] syncope git commit: Upgrading CXF

Posted by il...@apache.org.
Upgrading CXF


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

Branch: refs/heads/master
Commit: f1864b00d8e6db0b5ed9c3fbc240818a90d3f92c
Parents: 7655849
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 08:45:10 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 08:45:10 2018 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/f1864b00/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bc314b1..ab26ddf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -365,7 +365,7 @@ under the License.
     <connid.ad.version>1.3.4</connid.ad.version>
     <connid.googleapps.version>1.4.1</connid.googleapps.version>
 
-    <cxf.version>3.2.2-SNAPSHOT</cxf.version>
+    <cxf.version>3.2.2</cxf.version>
 
     <jackson.version>2.9.4</jackson.version>
 


[10/11] syncope git commit: Fixing error reporting in case (no more IllegalArgumentException being returned by REST calls)

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
----------------------------------------------------------------------
diff --git a/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java b/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
index 4450208..00a14d1 100644
--- a/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
+++ b/ext/camel/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/CamelRouteService.java
@@ -75,6 +75,7 @@ public interface CamelRouteService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull CamelRouteTO route);
 
     /**
@@ -84,6 +85,7 @@ public interface CamelRouteService extends JAXRSService {
      */
     @POST
     @Path("restartContext")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response restartContext();
 
     /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
index 4083a45..bdc5887 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.logic.saml2;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -115,8 +116,14 @@ public class SAML2UserManager {
             }
         }
 
-        IntAttrName intAttrName = intAttrNameParser.parse(
-                idp.getConnObjectKeyItem().get().getIntAttrName(), AnyTypeKind.USER);
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(idp.getConnObjectKeyItem().get().getIntAttrName(), AnyTypeKind.USER);
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring",
+                    idp.getConnObjectKeyItem().get().getIntAttrName(), e);
+            return result;
+        }
 
         if (intAttrName.getField() != null) {
             switch (intAttrName.getField()) {
@@ -200,8 +207,6 @@ public class SAML2UserManager {
         }
 
         idp.getItems().forEach(item -> {
-            IntAttrName intAttrName = intAttrNameParser.parse(item.getIntAttrName(), AnyTypeKind.USER);
-
             List<String> values = Collections.emptyList();
             Optional<AttrTO> samlAttr = responseTO.getAttr(item.getExtAttrName());
             if (samlAttr.isPresent() && !samlAttr.get().getValues().isEmpty()) {
@@ -217,7 +222,14 @@ public class SAML2UserManager {
                 }
             }
 
-            if (intAttrName.getField() != null) {
+            IntAttrName intAttrName = null;
+            try {
+                intAttrName = intAttrNameParser.parse(item.getIntAttrName(), AnyTypeKind.USER);
+            } catch (ParseException e) {
+                LOG.error("Invalid intAttrName '{}' specified, ignoring", item.getIntAttrName(), e);
+            }
+
+            if (intAttrName != null && intAttrName.getField() != null) {
                 switch (intAttrName.getField()) {
                     case "username":
                         if (!values.isEmpty()) {
@@ -228,7 +240,7 @@ public class SAML2UserManager {
                     default:
                         LOG.warn("Unsupported: {}", intAttrName.getField());
                 }
-            } else if (intAttrName.getSchemaType() != null) {
+            } else if (intAttrName != null && intAttrName.getSchemaType() != null) {
                 switch (intAttrName.getSchemaType()) {
                     case PLAIN:
                         Optional<AttrTO> attr = userTO.getPlainAttr(intAttrName.getSchemaName());

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java b/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
index 4413fc3..7a15513 100644
--- a/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
+++ b/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
@@ -20,6 +20,7 @@ package org.apache.syncope.core.provisioning.java.data;
 
 import java.util.Base64;
 import java.util.stream.Collectors;
+import java.text.ParseException;
 import org.apache.syncope.common.lib.SyncopeClientCompositeException;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AnyTypeClassTO;
@@ -81,9 +82,10 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
             final AnyTypeClassTO allowedSchemas) {
 
         SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
-        SyncopeClientException invalidMapping = SyncopeClientException.build(ClientExceptionType.InvalidMapping);
-        SyncopeClientException requiredValuesMissing = SyncopeClientException.build(
-                ClientExceptionType.RequiredValuesMissing);
+        SyncopeClientException invalidMapping =
+                SyncopeClientException.build(ClientExceptionType.InvalidMapping);
+        SyncopeClientException requiredValuesMissing =
+                SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
 
         for (ItemTO itemTO : idpTO.getItems()) {
             if (itemTO == null) {
@@ -93,9 +95,14 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
                 requiredValuesMissing.getElements().add("intAttrName");
                 scce.addException(requiredValuesMissing);
             } else {
-                IntAttrName intAttrName = intAttrNameParser.parse(itemTO.getIntAttrName(), AnyTypeKind.USER);
+                IntAttrName intAttrName = null;
+                try {
+                    intAttrName = intAttrNameParser.parse(itemTO.getIntAttrName(), AnyTypeKind.USER);
+                } catch (ParseException e) {
+                    LOG.error("Invalid intAttrName '{}' specified, ignoring", itemTO.getIntAttrName(), e);
+                }
 
-                if (intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
+                if (intAttrName == null || intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
                     LOG.error("'{}' not existing", itemTO.getIntAttrName());
                     invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing");
                 } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java b/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
index fa5b5f3..a3c9bd5 100644
--- a/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
+++ b/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
@@ -83,6 +83,7 @@ public interface SAML2IdPService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response importFromMetadata(@NotNull InputStream input);
 
     /**
@@ -94,6 +95,7 @@ public interface SAML2IdPService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull SAML2IdPTO saml2IdpTO);
 
     /**
@@ -104,5 +106,6 @@ public interface SAML2IdPService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
----------------------------------------------------------------------
diff --git a/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java b/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
index e877f2d..3a98255 100644
--- a/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
+++ b/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
@@ -52,9 +52,10 @@ public interface SCIMConfService extends JAXRSService {
      * Sets SCIM configuration.
      *
      * @param conf SCIM configuration
-     * @return Response.noContent().build();
+     * @return an empty response if operation was successful
      */
     @PUT
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response set(@NotNull SCIMConf conf);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
index ba3f65c..28ae442 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
@@ -126,16 +126,6 @@ public class AnyTypeITCase extends AbstractITCase {
     }
 
     @Test
-    public void deleteInvalid() {
-        try {
-            anyTypeService.delete(AnyTypeKind.USER.name());
-            fail("This should not happen");
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.InvalidAnyType, e.getType());
-        }
-    }
-
-    @Test
     public void deleteTypeClass() {
         AnyTypeClassTO newClass = new AnyTypeClassTO();
         newClass.setKey("new class" + getUUIDString());

http://git-wip-us.apache.org/repos/asf/syncope/blob/43fcd1d6/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
index 08f6532..83e0171 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
@@ -29,11 +29,17 @@ import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTypeClassTO;
 import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ItemTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.to.UserTO;
+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.common.lib.types.SchemaType;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.common.rest.api.beans.TaskQuery;
+import org.apache.syncope.common.rest.api.service.AccessTokenService;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -146,4 +152,51 @@ public class ExceptionMapperITCase extends AbstractITCase {
             assertEquals(2, e.getExceptions().size());
         }
     }
+
+    @Test
+    public void invalidRequests() {
+        try {
+            taskService.list(new TaskQuery.Builder(TaskType.NOTIFICATION).resource(RESOURCE_NAME_LDAP).build());
+            fail("This should not happen");
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+        try {
+            taskService.list(new TaskQuery.Builder(TaskType.PULL).anyTypeKind(AnyTypeKind.ANY_OBJECT).build());
+            fail("This should not happen");
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+        try {
+            taskService.list(new TaskQuery.Builder(TaskType.PULL).
+                    notification("e00945b5-1184-4d43-8e45-4318a8dcdfd4").build());
+            fail("This should not happen");
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+
+        try {
+            anyTypeService.delete(AnyTypeKind.USER.name());
+            fail("This should not happen");
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+
+        try {
+            clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(AccessTokenService.class).login();
+            fail("This should not happen");
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+
+        try {
+            ResourceTO ldap = resourceService.read(RESOURCE_NAME_LDAP);
+            ItemTO mapping = ldap.getProvisions().get(0).getMapping().getItems().get(0);
+            mapping.setIntAttrName("memberships.cn");
+            resourceService.update(ldap);
+            fail("This should not happen");
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidMapping, e.getType());
+        }
+    }
 }


[04/11] syncope git commit: Upgrading ASF parent pom

Posted by il...@apache.org.
Upgrading ASF parent pom


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

Branch: refs/heads/2_0_X
Commit: 0286886dac4702e9a25f61c409531aea28e44606
Parents: 06d210b
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 09:24:22 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 09:24:22 2018 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0286886d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d5a97d2..e8295a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@ under the License.
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>18</version>
+    <version>19</version>
     <relativePath />
   </parent>
 


[06/11] syncope git commit: Fixing error reporting in case (no more IllegalArgumentException being returned by REST calls)

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
index b0f5956..f4374e6 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.logic.saml2;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -100,7 +101,13 @@ public class SAML2UserManager {
             }
         }
 
-        IntAttrName intAttrName = intAttrNameParser.parse(connObjectKeyItem.getIntAttrName(), AnyTypeKind.USER);
+        IntAttrName intAttrName;
+        try {
+            intAttrName = intAttrNameParser.parse(connObjectKeyItem.getIntAttrName(), AnyTypeKind.USER);
+        } catch (ParseException e) {
+            LOG.error("Invalid intAttrName '{}' specified, ignoring", connObjectKeyItem.getIntAttrName(), e);
+            return result;
+        }
 
         if (intAttrName.getField() != null) {
             switch (intAttrName.getField()) {
@@ -187,8 +194,6 @@ public class SAML2UserManager {
 
     private void fill(final SAML2IdPEntity idp, final SAML2LoginResponseTO responseTO, final UserTO userTO) {
         for (ItemTO item : idp.getItems()) {
-            IntAttrName intAttrName = intAttrNameParser.parse(item.getIntAttrName(), AnyTypeKind.USER);
-
             List<String> values = Collections.emptyList();
             AttrTO samlAttr = responseTO.getAttr(item.getExtAttrName());
             if (samlAttr != null && !samlAttr.getValues().isEmpty()) {
@@ -204,7 +209,14 @@ public class SAML2UserManager {
                 }
             }
 
-            if (intAttrName.getField() != null) {
+            IntAttrName intAttrName = null;
+            try {
+                intAttrName = intAttrNameParser.parse(item.getIntAttrName(), AnyTypeKind.USER);
+            } catch (ParseException e) {
+                LOG.error("Invalid intAttrName '{}' specified, ignoring", item.getIntAttrName(), e);
+            }
+
+            if (intAttrName != null && intAttrName.getField() != null) {
                 switch (intAttrName.getField()) {
                     case "username":
                         if (!values.isEmpty()) {
@@ -215,7 +227,7 @@ public class SAML2UserManager {
                     default:
                         LOG.warn("Unsupported: {}", intAttrName.getField());
                 }
-            } else if (intAttrName.getSchemaType() != null) {
+            } else if (intAttrName != null && intAttrName.getSchemaType() != null) {
                 switch (intAttrName.getSchemaType()) {
                     case PLAIN:
                         AttrTO attr = userTO.getPlainAttr(intAttrName.getSchemaName());

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java b/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
index 9e7af26..17842d3 100644
--- a/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
+++ b/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.syncope.common.lib.SyncopeClientCompositeException;
 import org.apache.syncope.common.lib.SyncopeClientException;
@@ -81,9 +82,10 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
             final AnyTypeClassTO allowedSchemas) {
 
         SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
-        SyncopeClientException invalidMapping = SyncopeClientException.build(ClientExceptionType.InvalidMapping);
-        SyncopeClientException requiredValuesMissing = SyncopeClientException.build(
-                ClientExceptionType.RequiredValuesMissing);
+        SyncopeClientException invalidMapping =
+                SyncopeClientException.build(ClientExceptionType.InvalidMapping);
+        SyncopeClientException requiredValuesMissing =
+                SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
 
         for (ItemTO itemTO : idpTO.getItems()) {
             if (itemTO == null) {
@@ -93,9 +95,14 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
                 requiredValuesMissing.getElements().add("intAttrName");
                 scce.addException(requiredValuesMissing);
             } else {
-                IntAttrName intAttrName = intAttrNameParser.parse(itemTO.getIntAttrName(), AnyTypeKind.USER);
+                IntAttrName intAttrName = null;
+                try {
+                    intAttrName = intAttrNameParser.parse(itemTO.getIntAttrName(), AnyTypeKind.USER);
+                } catch (ParseException e) {
+                    LOG.error("Invalid intAttrName '{}' specified, ignoring", itemTO.getIntAttrName(), e);
+                }
 
-                if (intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
+                if (intAttrName == null || intAttrName.getSchemaType() == null && intAttrName.getField() == null) {
                     LOG.error("'{}' not existing", itemTO.getIntAttrName());
                     invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing");
                 } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java b/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
index fa5b5f3..a3c9bd5 100644
--- a/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
+++ b/ext/saml2sp/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPService.java
@@ -83,6 +83,7 @@ public interface SAML2IdPService extends JAXRSService {
      */
     @POST
     @Consumes({ MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response importFromMetadata(@NotNull InputStream input);
 
     /**
@@ -94,6 +95,7 @@ public interface SAML2IdPService extends JAXRSService {
     @PUT
     @Path("{key}")
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response update(@NotNull SAML2IdPTO saml2IdpTO);
 
     /**
@@ -104,5 +106,6 @@ public interface SAML2IdPService extends JAXRSService {
      */
     @DELETE
     @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response delete(@PathParam("key") String key);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
----------------------------------------------------------------------
diff --git a/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java b/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
index e877f2d..3a98255 100644
--- a/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
+++ b/ext/scimv2/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SCIMConfService.java
@@ -52,9 +52,10 @@ public interface SCIMConfService extends JAXRSService {
      * Sets SCIM configuration.
      *
      * @param conf SCIM configuration
-     * @return Response.noContent().build();
+     * @return an empty response if operation was successful
      */
     @PUT
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     Response set(@NotNull SCIMConf conf);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
index 93cd326..a85677d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AnyTypeITCase.java
@@ -126,16 +126,6 @@ public class AnyTypeITCase extends AbstractITCase {
     }
 
     @Test
-    public void deleteInvalid() {
-        try {
-            anyTypeService.delete(AnyTypeKind.USER.name());
-            fail();
-        } catch (SyncopeClientException e) {
-            assertEquals(ClientExceptionType.InvalidAnyType, e.getType());
-        }
-    }
-
-    @Test
     public void deleteTypeClass() {
         AnyTypeClassTO newClass = new AnyTypeClassTO();
         newClass.setKey("new class" + getUUIDString());

http://git-wip-us.apache.org/repos/asf/syncope/blob/188df890/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
index ac1cf5d..ed68dcc 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java
@@ -29,11 +29,17 @@ import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTypeClassTO;
 import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ItemTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.to.UserTO;
+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.common.lib.types.SchemaType;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.common.rest.api.beans.TaskQuery;
+import org.apache.syncope.common.rest.api.service.AccessTokenService;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -146,4 +152,51 @@ public class ExceptionMapperITCase extends AbstractITCase {
             assertEquals(2, e.getExceptions().size());
         }
     }
+
+    @Test
+    public void invalidRequests() {
+        try {
+            taskService.list(new TaskQuery.Builder(TaskType.NOTIFICATION).resource(RESOURCE_NAME_LDAP).build());
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+        try {
+            taskService.list(new TaskQuery.Builder(TaskType.PULL).anyTypeKind(AnyTypeKind.ANY_OBJECT).build());
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+        try {
+            taskService.list(new TaskQuery.Builder(TaskType.PULL).
+                    notification("e00945b5-1184-4d43-8e45-4318a8dcdfd4").build());
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+
+        try {
+            anyTypeService.delete(AnyTypeKind.USER.name());
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+
+        try {
+            clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(AccessTokenService.class).login();
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidRequest, e.getType());
+        }
+
+        try {
+            ResourceTO ldap = resourceService.read(RESOURCE_NAME_LDAP);
+            ItemTO mapping = ldap.getProvisions().get(0).getMapping().getItems().get(0);
+            mapping.setIntAttrName("memberships.cn");
+            resourceService.update(ldap);
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidMapping, e.getType());
+        }
+    }
 }


[09/11] syncope git commit: Fixing suspended flag report in UserTO

Posted by il...@apache.org.
Fixing suspended flag report in UserTO


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

Branch: refs/heads/master
Commit: 0461265f47a61d407397d07fc37ebb6741b396e1
Parents: 233c668
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Feb 7 11:47:25 2018 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Feb 7 12:33:48 2018 +0100

----------------------------------------------------------------------
 .../syncope/core/provisioning/java/data/UserDataBinderImpl.java     | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0461265f/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 044bc99..1140c27 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -580,6 +580,7 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
         UserTO userTO = new UserTO();
 
         BeanUtils.copyProperties(user, userTO, IGNORE_PROPERTIES);
+        userTO.setSuspended(BooleanUtils.isTrue(user.isSuspended()));
 
         if (user.getSecurityQuestion() != null) {
             userTO.setSecurityQuestion(user.getSecurityQuestion().getKey());