syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdisabat...@apache.org
Subject syncope git commit: Add a missing try/catch
Date Thu, 29 Jun 2017 10:42:40 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 6f4af4163 -> c0235635a


Add a missing try/catch


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

Branch: refs/heads/2_0_X
Commit: c0235635ae53f08f4993ac2798354029ec7b352c
Parents: 6f4af41
Author: Marco Di Sabatino Di Diodoro <marco.disabatino@tirasa.net>
Authored: Thu Jun 29 12:40:48 2017 +0200
Committer: Marco Di Sabatino Di Diodoro <marco.disabatino@tirasa.net>
Committed: Thu Jun 29 12:40:48 2017 +0200

----------------------------------------------------------------------
 .../resources/ResourceProvisionPanel.java       | 31 ++++++++++++--------
 1 file changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/c0235635/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
index 7bc48d0..28b4605 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java
@@ -42,6 +42,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPan
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.client.console.wizards.AjaxWizard;
 import org.apache.syncope.client.console.wizards.WizardMgtPanel;
+import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.MappingItemTO;
 import org.apache.syncope.common.lib.to.ProvisionTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
@@ -219,20 +220,26 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable>
{
         builder.includes("anyType", "objectClass", "auxClasses");
         builder.setReuseItem(false);
 
-        builder.
-                addAction(new ActionLink<ProvisionTO>() {
+        builder.addAction(new ActionLink<ProvisionTO>() {
 
-                    private static final long serialVersionUID = -3722207913631435504L;
+            private static final long serialVersionUID = -3722207913631435504L;
 
-                    @Override
-                    public void onClick(final AjaxRequestTarget target, final ProvisionTO
provisionTO) {
-                        send(ResourceProvisionPanel.this, Broadcast.DEPTH,
-                                new AjaxWizard.NewItemActionEvent<>(provisionTO, 2,
target).setResourceModel(
-                                        new StringResourceModel("inner.provision.mapping",
-                                                ResourceProvisionPanel.this,
-                                                Model.of(provisionTO))));
-                    }
-                }, ActionLink.ActionType.MAPPING, StandardEntitlement.RESOURCE_UPDATE).
+            @Override
+            public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO)
{
+                try {
+                    send(ResourceProvisionPanel.this, Broadcast.DEPTH,
+                            new AjaxWizard.NewItemActionEvent<>(provisionTO, 2, target).setResourceModel(
+                                    new StringResourceModel("inner.provision.mapping",
+                                            ResourceProvisionPanel.this,
+                                            Model.of(provisionTO))));
+                } catch (SyncopeClientException e) {
+                    LOG.error("While contacting resource", e);
+                    SyncopeConsoleSession.get().error(
+                            StringUtils.isBlank(e.getMessage()) ? e.getClass().getName()
: e.getMessage());
+                    ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+                }
+            }
+        }, ActionLink.ActionType.MAPPING, StandardEntitlement.RESOURCE_UPDATE).
                 addAction(new ActionLink<ProvisionTO>() {
 
                     private static final long serialVersionUID = -7780999687733432439L;


Mime
View raw message