You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2014/09/29 16:25:41 UTC

svn commit: r1628191 - in /syncope/trunk: ./ core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java

Author: mdisabatino
Date: Mon Sep 29 14:25:40 2014
New Revision: 1628191

URL: http://svn.apache.org/r1628191
Log:
[SYNCOPE-553] Merge from 1_2_X

Modified:
    syncope/trunk/   (props changed)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java

Propchange: syncope/trunk/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_2_X:r1627815-1628190

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java?rev=1628191&r1=1628190&r2=1628191&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java Mon Sep 29 14:25:40 2014
@@ -170,7 +170,10 @@ public class PolicyDataBinder {
                 }
                 policy.setSpecification(((AccountPolicyTO) policyTO).getSpecification());
 
-                ((AccountPolicy) policy).getResources().clear();
+                if (((AccountPolicy) policy).getResources() != null
+                        && !((AccountPolicy) policy).getResources().isEmpty()) {
+                    ((AccountPolicy) policy).getResources().clear();
+                }
                 for (String resourceName : ((AccountPolicyTO) policyTO).getResources()) {
                     ExternalResource resource = getResource(resourceName);
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java?rev=1628191&r1=1628190&r2=1628191&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java Mon Sep 29 14:25:40 2014
@@ -29,6 +29,7 @@ import java.util.List;
 import org.apache.syncope.common.to.AccountPolicyTO;
 import org.apache.syncope.common.to.PasswordPolicyTO;
 import org.apache.syncope.common.to.SyncPolicyTO;
+import org.apache.syncope.common.types.AccountPolicySpec;
 import org.apache.syncope.common.types.PasswordPolicySpec;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.common.types.SyncPolicySpec;
@@ -221,4 +222,18 @@ public class PolicyTestITCase extends Ab
             assertEquals(ClientExceptionType.InvalidPolicy, e.getType());
         }
     }
+
+    @Test
+    public void issueSYNCOPE553() {
+        AccountPolicyTO policy = new AccountPolicyTO(false);
+        policy.setDescription("SYNCOPE553");
+        
+        final AccountPolicySpec accountPolicySpec = new AccountPolicySpec();
+        accountPolicySpec.setMinLength(3);
+        accountPolicySpec.setMaxLength(8);
+        policy.setSpecification(accountPolicySpec);
+        
+        policy = createPolicy(policy);
+        assertNotNull(policy);
+    }
 }