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 2013/04/23 17:29:15 UTC

svn commit: r1471010 - /syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java

Author: fmartelli
Date: Tue Apr 23 15:29:15 2013
New Revision: 1471010

URL: http://svn.apache.org/r1471010
Log:
sync task status fix

Modified:
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java?rev=1471010&r1=1471009&r2=1471010&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java Tue Apr 23 15:29:15 2013
@@ -367,8 +367,7 @@ public class SyncopeSyncResultHandler im
 
         final Map<String, Attribute> extValues = new HashMap<String, Attribute>();
 
-        for (AbstractMappingItem item
-                : attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
+        for (AbstractMappingItem item : attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)) {
 
             extValues.put(item.getIntAttrName(), connObj.getAttributeByName(item.getExtAttrName()));
         }
@@ -512,6 +511,7 @@ public class SyncopeSyncResultHandler im
         final SyncResult result = new SyncResult();
         result.setOperation(ResourceOperation.CREATE);
         result.setSubjectType(attrUtil.getType());
+        result.setStatus(SyncResult.Status.SUCCESS);
 
         AbstractAttributableTO subjectTO = connObjectUtil.getAttributableTO(delta.getObject(), syncTask, attrUtil);
 
@@ -525,7 +525,6 @@ public class SyncopeSyncResultHandler im
             if (subjectTO instanceof RoleTO) {
                 result.setName(((RoleTO) subjectTO).getName());
             }
-            result.setStatus(SyncResult.Status.SUCCESS);
         } else {
             try {
                 if (AttributableType.USER == attrUtil.getType()) {
@@ -565,8 +564,10 @@ public class SyncopeSyncResultHandler im
                     result.setId(created.getResult());
                     result.setName(((RoleTO) subjectTO).getName());
                 }
-                result.setStatus(SyncResult.Status.SUCCESS);
+
             } catch (PropagationException e) {
+                // A propagation failure doesn't imply a synchronization failure.
+                // The propagation exception status will be reported into the propagation task execution.
                 LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
             } catch (Exception e) {
                 result.setStatus(SyncResult.Status.FAILURE);
@@ -716,9 +717,8 @@ public class SyncopeSyncResultHandler im
                     result.setName(updated.getName());
                 }
             } catch (PropagationException e) {
-                result.setStatus(SyncResult.Status.FAILURE);
-                result.setMessage(delta.getUid().getUidValue() + "updated but not propagated\n" + e.getMessage());
-
+                // A propagation failure doesn't imply a synchronization failure.
+                // The propagation exception status will be reported into the propagation task execution.
                 LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
             } catch (Exception e) {
                 result.setStatus(SyncResult.Status.FAILURE);
@@ -778,6 +778,8 @@ public class SyncopeSyncResultHandler im
                         }
                         taskExecutor.execute(tasks);
                     } catch (Exception e) {
+                        // A propagation failure doesn't imply a synchronization failure.
+                        // The propagation exception status will be reported into the propagation task execution.
                         LOG.error("Could not propagate user " + id, e);
                     }
 
@@ -789,7 +791,7 @@ public class SyncopeSyncResultHandler im
                             rwfAdapter.delete(id);
                         }
                     } catch (Exception e) {
-                        result.setStatus(SyncResult.Status.SUCCESS);
+                        result.setStatus(SyncResult.Status.FAILURE);
                         result.setMessage(e.getMessage());
                         LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
                     }