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:55 UTC

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

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();
 
     /**