Author: mdisabatino
Date: Mon Sep 29 14:19:38 2014
New Revision: 1628189
URL: http://svn.apache.org/r1628189
Log:
[SYNCOPE-553]
Modified:
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
Modified:
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
URL:
http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java?rev=1628189&r1=1628188&r2=1628189&view=diff
==============================================================================
---
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
(original)
+++
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
Mon Sep 29 14:19:38 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/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
URL:
http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java?rev=1628189&r1=1628188&r2=1628189&view=diff
==============================================================================
---
syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
(original)
+++
syncope/branches/1_2_X/core/src/test/java/org/apache/syncope/core/rest/PolicyTestITCase.java
Mon Sep 29 14:19:38 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);
+ }
}