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

syncope git commit: [SYNCOPE-1130] fix the issue by handling NPE + fix a further NPE issue aoccurring in case of missing information during user approval (case of test user)

Repository: syncope
Updated Branches:
  refs/heads/2_0_X 16cf99b53 -> 32c50bd44


[SYNCOPE-1130] fix the issue by handling NPE + fix a further NPE issue aoccurring in case of missing information during user approval (case of test user)


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

Branch: refs/heads/2_0_X
Commit: 32c50bd44f65d7fd51e3fa8ef8011272c7f685d3
Parents: 16cf99b
Author: fmartelli <fa...@gmail.com>
Authored: Tue Jun 27 17:37:43 2017 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Tue Jun 27 17:37:43 2017 +0200

----------------------------------------------------------------------
 .../syncope/client/console/approvals/ApprovalDetails.java     | 5 +++++
 .../java/org/apache/syncope/client/console/pages/Realms.java  | 5 ++++-
 .../apache/syncope/client/console/wizards/any/ResultPage.java | 7 +++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/32c50bd4/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDetails.java
index c14dab9..2d169f6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/approvals/ApprovalDetails.java
@@ -41,6 +41,11 @@ public class ApprovalDetails extends MultilevelPanel.SecondLevel {
         if (formTO.getUserPatch() == null) {
             newUserTO = formTO.getUserTO();
             previousUserTO = null;
+        } else if (formTO.getUserTO() == null) {
+            // make it stronger by handling NPE in case of test users or missing approval info
+            previousUserTO = new UserTO();
+            previousUserTO.setKey(formTO.getUserPatch().getKey());
+            newUserTO = AnyOperations.patch(previousUserTO, formTO.getUserPatch());
         } else {
             formTO.getUserTO().setKey(formTO.getUserPatch().getKey());
             newUserTO = AnyOperations.patch(formTO.getUserTO(), formTO.getUserPatch());

http://git-wip-us.apache.org/repos/asf/syncope/blob/32c50bd4/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
index d9558a8..d1c204c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
@@ -33,6 +33,7 @@ import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.Bas
 import org.apache.syncope.client.console.wizards.AjaxWizard;
 import org.apache.syncope.client.console.wizards.any.ResultPage;
 import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.lib.to.TemplatableTO;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -194,8 +195,10 @@ public class Realms extends BasePage {
                         target.add(realmChoicePanel.reloadRealmTree(target));
 
                         if (modal.getContent() instanceof ResultPage) {
+                            Serializable result = ResultPage.class.cast(modal.getContent()).getResult();
+
                             updateRealmContent(RealmTO.class.cast(
-                                    ResultPage.class.cast(modal.getContent()).getItem()), selectedIndex);
+                                    ProvisioningResult.class.cast(result).getEntity()), selectedIndex);
                             target.add(content);
                         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/32c50bd4/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/ResultPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/ResultPage.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/ResultPage.java
index 2be32df..a195b8a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/ResultPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/ResultPage.java
@@ -33,10 +33,13 @@ public abstract class ResultPage<T extends Serializable> extends Panel implement
 
     private final T item;
 
+    private final Serializable result;
+
     public ResultPage(final T item, final Serializable result) {
         super(BaseModal.CONTENT_ID);
         setOutputMarkupId(true);
         this.item = item;
+        this.result = result;
 
         add(customResultBody("customResultBody", item, result));
 
@@ -64,4 +67,8 @@ public abstract class ResultPage<T extends Serializable> extends Panel implement
     public T getItem() {
         return this.item;
     }
+
+    public Serializable getResult() {
+        return result;
+    }
 }