Skip to content

Commit

Permalink
fix: use iterator to correcly remove OC attribute (#2138)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
  • Loading branch information
pujavs and yurem committed Aug 15, 2022
1 parent 3083a3f commit b590981
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -1063,9 +1064,13 @@ protected <T> List<T> createEntities(Class<T> entryClass, List<PropertyAnnotatio
}

// Process objectClass first
for (Entry<String, AttributeData> attributeEntry : attributesMap.entrySet()) {
for (Iterator<Entry<String, AttributeData>> it = attributesMap.entrySet().iterator(); it.hasNext();) {
Entry<String, AttributeData> attributeEntry = it.next();

AttributeData entryAttribute = attributeEntry.getValue();
if (OBJECT_CLASS.equalsIgnoreCase(entryAttribute.getName())) {
it.remove();

String[] objectClasses = entryAttribute.getStringValues();
if (ArrayHelper.isEmpty(objectClasses)) {
continue;
Expand All @@ -1086,9 +1091,6 @@ public int compare(String o1, String o2) {
customObjectClasses.add(objectClass);
}
}

attributesMap.remove(attributeEntry.getKey());
continue;
}
}

Expand Down

0 comments on commit b590981

Please sign in to comment.