Merge branch 'release/2.11'
diff --git a/pom.xml b/pom.xml
index daa2e7f..de208de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
 
   <groupId>edu.psu.swe.scim</groupId>
   <artifactId>scim-parent</artifactId>
-  <version>2.10</version>
+  <version>2.11</version>
   <packaging>pom</packaging>
   <name>SCIM - Parent</name>
   <description>Penn State's Open Source JavaEE implmentation of the SCIM version 2.0 specification (RFC7642, RFC7643 and RFC7644)</description>
diff --git a/scim-client/pom.xml b/scim-client/pom.xml
index 22b343a..550877f 100644
--- a/scim-client/pom.xml
+++ b/scim-client/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
   <artifactId>scim-client</artifactId>
   <name>SCIM - Client</name>
diff --git a/scim-common/pom.xml b/scim-common/pom.xml
index c5b364a..d6e9b61 100644
--- a/scim-common/pom.xml
+++ b/scim-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-common</artifactId>
@@ -14,12 +14,12 @@
     <dependency>
       <groupId>edu.psu.swe.scim</groupId>
       <artifactId>scim-spec-protocol</artifactId>
-      <version>2.10</version>
+      <version>2.11</version>
     </dependency>
     <dependency>
       <groupId>edu.psu.swe.scim</groupId>
       <artifactId>scim-spec-schema</artifactId>
-      <version>2.10</version>
+      <version>2.11</version>
     </dependency>
   </dependencies>
 
diff --git a/scim-compliance/pom.xml b/scim-compliance/pom.xml
index cc06395..722dfca 100644
--- a/scim-compliance/pom.xml
+++ b/scim-compliance/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-compliance</artifactId>
diff --git a/scim-compliance/scim-compliance-client/pom.xml b/scim-compliance/scim-compliance-client/pom.xml
index c9c2983..6228b7a 100644
--- a/scim-compliance/scim-compliance-client/pom.xml
+++ b/scim-compliance/scim-compliance-client/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-compliance</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-compliance-client</artifactId>
diff --git a/scim-compliance/scim-compliance-server/pom.xml b/scim-compliance/scim-compliance-server/pom.xml
index a018dfd..0fdf570 100644
--- a/scim-compliance/scim-compliance-server/pom.xml
+++ b/scim-compliance/scim-compliance-server/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-compliance</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-compliance-server</artifactId>
diff --git a/scim-errai/pom.xml b/scim-errai/pom.xml
index 33dadf3..ba6b64e 100644
--- a/scim-errai/pom.xml
+++ b/scim-errai/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-errai</artifactId>
diff --git a/scim-server/pom.xml b/scim-server/pom.xml
index 32995c3..cde7009 100644
--- a/scim-server/pom.xml
+++ b/scim-server/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-server</artifactId>
diff --git a/scim-server/scim-server-common/pom.xml b/scim-server/scim-server-common/pom.xml
index 2a18e27..552b864 100644
--- a/scim-server/scim-server-common/pom.xml
+++ b/scim-server/scim-server-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-server-common</artifactId>
diff --git a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java
index e335952..ba902dd 100644
--- a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java
+++ b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java
@@ -4,7 +4,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Comparator;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -163,6 +163,46 @@
     // TODO Auto-generated method stub
     return resource;
   }
+  
+  /**
+   * There is a know issue with the diffing tool that the tool will attempt to move empty arrays. By
+   * nulling out the empty arrays during comparison, this will prevent that error from occurring. Because
+   * deleting requires the parent node
+   * @param node Parent node.
+   */
+  private static void nullEmptyLists(JsonNode node) {
+    List<String> objectsToDelete = new ArrayList<>();
+    
+    if (node != null) {
+      Iterator<Map.Entry<String, JsonNode>> children = node.fields();
+      while(children.hasNext()) {
+        Map.Entry<String, JsonNode> child = children.next();
+        String name = child.getKey();
+        JsonNode childNode = child.getValue();
+        
+        //Attempt to delete children before analyzing 
+        if (childNode.isContainerNode()) {
+          nullEmptyLists(childNode);
+        }
+        
+        if (childNode != null && childNode instanceof ArrayNode) {
+          ArrayNode ar = (ArrayNode)childNode;
+          if (ar.size() == 0) {
+            objectsToDelete.add(name);
+          }
+        }
+      }
+      
+      if (!objectsToDelete.isEmpty()) {
+        if (node instanceof ObjectNode) {
+          ObjectNode on = (ObjectNode)node;
+          for(String name : objectsToDelete) {
+            on.remove(name);
+          }
+        }
+      }
+    }
+  }
 
   private List<PatchOperation> createPatchOperations() throws IllegalArgumentException, IllegalAccessException {
 
@@ -184,7 +224,9 @@
                                                            // better way?
 
     JsonNode node1 = objMapper.valueToTree(original);
+    nullEmptyLists(node1);
     JsonNode node2 = objMapper.valueToTree(resource);
+    nullEmptyLists(node2);
     JsonNode differences = JsonDiff.asJson(node1, node2);
 
     try {
diff --git a/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/provider/UpdateRequestTest.java b/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/provider/UpdateRequestTest.java
index d0f6998..02c0420 100644
--- a/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/provider/UpdateRequestTest.java
+++ b/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/provider/UpdateRequestTest.java
@@ -8,6 +8,8 @@
 
 import javax.enterprise.inject.Instance;
 
+import lombok.extern.slf4j.Slf4j;
+
 import org.assertj.core.api.Assertions;
 import org.junit.Assert;
 import org.junit.Before;
@@ -24,6 +26,7 @@
 import edu.psu.swe.scim.server.rest.ObjectMapperContextResolver;
 import edu.psu.swe.scim.server.schema.Registry;
 import edu.psu.swe.scim.server.utility.ExampleObjectExtension;
+import edu.psu.swe.scim.server.utility.Subobject;
 import edu.psu.swe.scim.spec.extension.EnterpriseExtension;
 import edu.psu.swe.scim.spec.extension.EnterpriseExtension.Manager;
 import edu.psu.swe.scim.spec.extension.ScimExtensionRegistry;
@@ -36,12 +39,15 @@
 import edu.psu.swe.scim.spec.resources.Email;
 import edu.psu.swe.scim.spec.resources.Name;
 import edu.psu.swe.scim.spec.resources.PhoneNumber;
-import static edu.psu.swe.scim.spec.resources.PhoneNumber.GlobalPhoneNumberBuilder;
+import edu.psu.swe.scim.spec.resources.PhoneNumber.GlobalPhoneNumberBuilder;
+import edu.psu.swe.scim.spec.resources.Photo;
 import edu.psu.swe.scim.spec.resources.ScimUser;
-import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class UpdateRequestTest {
+  
+  private static final String FIRST = "first";
+  private static final String SECOND = "second";
 
   @Rule
   public MockitoRule mockito = MockitoJUnit.rule();
@@ -328,7 +334,7 @@
   }
   
   @Test
-  public void forceMoveError() throws Exception {
+  public void verifyEmptyArraysDoNotCauseMove() throws Exception {
     UpdateRequest<ScimUser> updateRequest = new UpdateRequest<>(registry);
 
     ScimUser user1 = createUser1();
@@ -343,12 +349,39 @@
     user2.addExtension(ext2);
     
     updateRequest.initWithResource("1234", user1, user2);
-    try {
-      updateRequest.getPatchOperations();
-      Assert.fail("There should have been a runtime error where PatchOperation is a move");
-    } catch (IllegalStateException e) {
-      Assert.assertEquals("Error creating the patch list", e.getMessage());
-    }
+    List<PatchOperation> operations = updateRequest.getPatchOperations();
+    Assert.assertTrue("Empty Arrays caused a diff", operations.isEmpty());
+  }
+  
+  @Test
+  public void verifyEmptyArraysAreNulled() throws Exception {
+    UpdateRequest<ScimUser> updateRequest = new UpdateRequest<>(registry);
+
+    ScimUser user1 = createUser1();
+    ScimUser user2 = copy(user1);
+    
+    //Set empty list on root object and verify no differences
+    user1.setPhotos(new ArrayList<>());
+    updateRequest.initWithResource("1234", user1, user2);
+    List<PatchOperation> operations = updateRequest.getPatchOperations();
+    Assert.assertTrue("Empty Arrays are not being nulled out", operations.isEmpty());
+    
+    //Reset user 1 and empty list on Extension and verify no differences
+    user1 = createUser1();
+    ExampleObjectExtension ext = new ExampleObjectExtension();
+    ext.setList(new ArrayList<String>());
+    updateRequest.initWithResource("1234", user1, user2);
+    operations = updateRequest.getPatchOperations();
+    Assert.assertTrue("Empty Arrays are not being nulled out", operations.isEmpty());
+    
+    //Reset extension and set empty list on element of extension then verify no differences
+    Subobject subobject = new Subobject();
+    subobject.setList1(new ArrayList<String>());
+    ext = new ExampleObjectExtension();
+    ext.setSubobject(subobject);
+    updateRequest.initWithResource("1234", user1, user2);
+    operations = updateRequest.getPatchOperations();
+    Assert.assertTrue("Empty Arrays are not being nulled out", operations.isEmpty());
   }
   
   /**
@@ -359,22 +392,26 @@
     UpdateRequest<ScimUser> updateRequest = new UpdateRequest<>(registry);
 
     ScimUser user1 = createUser1();
-    user1.setPhotos(new ArrayList<>());
     ScimUser user2 = copy(user1);
     
+    Photo photo = new Photo();
+    photo.setType("photo");
+    photo.setValue("photo1.png");
+    user2.setPhotos(Stream.of(photo).collect(Collectors.toList()));
+    
     
     ExampleObjectExtension ext1 = new ExampleObjectExtension();
     ext1.setList(null);
     user1.addExtension(ext1);
     
     ExampleObjectExtension ext2 = new ExampleObjectExtension();
-    ext2.setList(new ArrayList<String>());
+    ext2.setList(Stream.of(FIRST,SECOND).collect(Collectors.toList()));
     user2.addExtension(ext2);
     
     updateRequest.initWithResource("1234", user1, user2);
     List<PatchOperation> operations = updateRequest.getPatchOperations();
     Assert.assertNotNull(operations);
-    Assert.assertEquals(1, operations.size());
+    Assert.assertEquals(2, operations.size());
     PatchOperation operation = operations.get(0);
     Assert.assertNotNull(operation.getValue());
     Assert.assertEquals(Type.ADD, operation.getOperation());
@@ -386,12 +423,16 @@
     UpdateRequest<ScimUser> updateRequest = new UpdateRequest<>(registry);
 
     ScimUser user1 = createUser1();
-    user1.setPhotos(new ArrayList<>());
     ScimUser user2 = copy(user1);
     
+    Photo photo = new Photo();
+    photo.setType("photo");
+    photo.setValue("photo1.png");
+    user1.setPhotos(Stream.of(photo).collect(Collectors.toList()));
+    
     
     ExampleObjectExtension ext1 = new ExampleObjectExtension();
-    ext1.setList(new ArrayList<String>());
+    ext1.setList(Stream.of(FIRST,SECOND).collect(Collectors.toList()));
     user1.addExtension(ext1);
     
     ExampleObjectExtension ext2 = new ExampleObjectExtension();
@@ -401,7 +442,7 @@
     updateRequest.initWithResource("1234", user1, user2);
     List<PatchOperation> operations = updateRequest.getPatchOperations();
     Assert.assertNotNull(operations);
-    Assert.assertEquals(1, operations.size());
+    Assert.assertEquals(2, operations.size());
     PatchOperation operation = operations.get(0);
     Assert.assertEquals(Type.REMOVE, operation.getOperation());
     Assert.assertNull(operation.getValue());
diff --git a/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/ExampleObjectExtension.java b/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/ExampleObjectExtension.java
index d2fc8e5..8319564 100644
--- a/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/ExampleObjectExtension.java
+++ b/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/ExampleObjectExtension.java
@@ -12,8 +12,6 @@
 import lombok.Data;
 import edu.psu.swe.scim.spec.annotation.ScimAttribute;
 import edu.psu.swe.scim.spec.annotation.ScimExtensionType;
-import edu.psu.swe.scim.spec.extension.EnterpriseExtension;
-import edu.psu.swe.scim.spec.extension.EnterpriseExtension.Manager;
 import edu.psu.swe.scim.spec.resources.ScimExtension;
 import edu.psu.swe.scim.spec.schema.Schema.Attribute.Mutability;
 import edu.psu.swe.scim.spec.schema.Schema.Attribute.Returned;
@@ -67,7 +65,10 @@
   @ScimAttribute
   @XmlElement
   private List<String> list;
-
+  
+  @ScimAttribute
+  @XmlElement
+  private Subobject subobject;
 
   @Override
   public String getUrn() {
diff --git a/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/Subobject.java b/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/Subobject.java
new file mode 100644
index 0000000..be84a5a
--- /dev/null
+++ b/scim-server/scim-server-common/src/test/java/edu/psu/swe/scim/server/utility/Subobject.java
@@ -0,0 +1,39 @@
+package edu.psu.swe.scim.server.utility;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import edu.psu.swe.scim.spec.annotation.ScimAttribute;
+import lombok.Data;
+
+@Data
+public class Subobject implements Serializable {
+  
+  private static final long serialVersionUID = -8081556701833520316L;
+
+  @ScimAttribute
+  @XmlElement
+  private String string1;
+  
+  @ScimAttribute
+  @XmlElement
+  private String string2;
+  
+  @ScimAttribute
+  @XmlElement
+  private Boolean boolean1;
+  
+  @ScimAttribute
+  @XmlElement
+  private Boolean boolean2;
+  
+  @ScimAttribute
+  @XmlElement
+  private List<String> list1;
+
+  @ScimAttribute
+  @XmlElement
+  private List<String> list2;
+}
diff --git a/scim-server/scim-server-example/pom.xml b/scim-server/scim-server-example/pom.xml
index 053d92c..7c5dd53 100644
--- a/scim-server/scim-server-example/pom.xml
+++ b/scim-server/scim-server-example/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-server-examples</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-couchdb/pom.xml b/scim-server/scim-server-example/scim-server-couchdb/pom.xml
index 5b158e8..f422905 100644
--- a/scim-server/scim-server-example/scim-server-couchdb/pom.xml
+++ b/scim-server/scim-server-example/scim-server-couchdb/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-server-couchdb</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-memory/pom.xml b/scim-server/scim-server-example/scim-server-memory/pom.xml
index f6eca2f..bda8c2a 100644
--- a/scim-server/scim-server-example/scim-server-memory/pom.xml
+++ b/scim-server/scim-server-example/scim-server-memory/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-server-memory</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-rdbms/pom.xml b/scim-server/scim-server-example/scim-server-rdbms/pom.xml
index 5885461..0d7e2ec 100644
--- a/scim-server/scim-server-example/scim-server-rdbms/pom.xml
+++ b/scim-server/scim-server-example/scim-server-rdbms/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-server-rdbms</artifactId>
diff --git a/scim-spec/pom.xml b/scim-spec/pom.xml
index 9853d8c..6222638 100644
--- a/scim-spec/pom.xml
+++ b/scim-spec/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-spec</artifactId>
diff --git a/scim-spec/scim-spec-protocol/pom.xml b/scim-spec/scim-spec-protocol/pom.xml
index aaec8ac..152967d 100644
--- a/scim-spec/scim-spec-protocol/pom.xml
+++ b/scim-spec/scim-spec-protocol/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-spec</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-spec-protocol</artifactId>
diff --git a/scim-spec/scim-spec-schema/pom.xml b/scim-spec/scim-spec-schema/pom.xml
index 8980fe7..c60f79a 100644
--- a/scim-spec/scim-spec-schema/pom.xml
+++ b/scim-spec/scim-spec-schema/pom.xml
@@ -4,7 +4,7 @@
 	<parent>
 		<groupId>edu.psu.swe.scim</groupId>
 		<artifactId>scim-spec</artifactId>
-		<version>2.10</version>
+		<version>2.11</version>
 	</parent>
 
 	<artifactId>scim-spec-schema</artifactId>
diff --git a/scim-tools/pom.xml b/scim-tools/pom.xml
index 8173b6a..b6a6266 100644
--- a/scim-tools/pom.xml
+++ b/scim-tools/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-tools</artifactId>
diff --git a/scim-tools/scim-tools-cli/pom.xml b/scim-tools/scim-tools-cli/pom.xml
index 08b8ea7..33ac5d4 100644
--- a/scim-tools/scim-tools-cli/pom.xml
+++ b/scim-tools/scim-tools-cli/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-tools-cli</artifactId>
diff --git a/scim-tools/scim-tools-common/pom.xml b/scim-tools/scim-tools-common/pom.xml
index 855deca..dd39348 100644
--- a/scim-tools/scim-tools-common/pom.xml
+++ b/scim-tools/scim-tools-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-tools-common</artifactId>
diff --git a/scim-tools/scim-tools-studio/pom.xml b/scim-tools/scim-tools-studio/pom.xml
index 6d76f2f..200c1e9 100644
--- a/scim-tools/scim-tools-studio/pom.xml
+++ b/scim-tools/scim-tools-studio/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.10</version>
+    <version>2.11</version>
   </parent>
 
   <artifactId>scim-tools-studio</artifactId>