You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2017/06/26 15:00:30 UTC

syncope git commit: [SYNCOPE-1121] solved NPE with empty sections while updating user

Repository: syncope
Updated Branches:
  refs/heads/master 053cb7e73 -> 00617f7b9


[SYNCOPE-1121] solved NPE with empty sections while updating user


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

Branch: refs/heads/master
Commit: 00617f7b9ad3ed540c8a1d4e22ab84b63f4a1158
Parents: 053cb7e
Author: Andrea Patricelli <an...@apache.org>
Authored: Mon Jun 26 17:00:01 2017 +0200
Committer: Andrea Patricelli <an...@apache.org>
Committed: Mon Jun 26 17:00:18 2017 +0200

----------------------------------------------------------------------
 .../enduser/resources/UserSelfReadResource.java   | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/00617f7b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
index eae1ec7..9e6feba 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -98,12 +98,18 @@ public class UserSelfReadResource extends BaseUserSelfResource {
             Map<String, CustomAttributesInfo> customForm = SyncopeEnduserApplication.get().getCustomForm();
 
             if (customForm != null && !customForm.isEmpty()) {
-                // filter PLAIN attributes
-                customizeAttrs(userTO.getPlainAttrs(), customForm.get(SchemaType.PLAIN.name()).getAttributes());
-                // filter DERIVED attributes
-                customizeAttrs(userTO.getDerAttrs(), customForm.get(SchemaType.DERIVED.name()).getAttributes());
-                // filter VIRTUAL attributes
-                customizeAttrs(userTO.getVirAttrs(), customForm.get(SchemaType.VIRTUAL.name()).getAttributes());
+                if (customForm.get(SchemaType.PLAIN.name()) != null) {
+                    // filter PLAIN attributes
+                    customizeAttrs(userTO.getPlainAttrs(), customForm.get(SchemaType.PLAIN.name()).getAttributes());
+                }
+                if (customForm.get(SchemaType.DERIVED.name()) != null) {
+                    // filter DERIVED attributes
+                    customizeAttrs(userTO.getDerAttrs(), customForm.get(SchemaType.DERIVED.name()).getAttributes());
+                }
+                if (customForm.get(SchemaType.VIRTUAL.name()) != null) {
+                    // filter VIRTUAL attributes
+                    customizeAttrs(userTO.getVirAttrs(), customForm.get(SchemaType.VIRTUAL.name()).getAttributes());
+                }
             }
             final String selfTOJson = MAPPER.writeValueAsString(userTO);
             response.setContentType(MediaType.APPLICATION_JSON);