From 0581e62fc0101b967775920b04ad148845316ace Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 30 May 2016 10:43:12 +0000
Subject: [PATCH] OPENDJ-2987 Fix computation of optional attributes for isExtensible ObjectClass

---
 opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
index 221b2b8..ffae27c 100644
--- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
+++ b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java
@@ -960,9 +960,11 @@
         }
 
         if (isExtensible()) {
-            declaredOptionalAttributes = new HashSet<>(requiredAttributeOIDs.size());
-            for (final AttributeType attributeType : schema.getAttributeTypes()) {
-                if (attributeType.getUsage() == AttributeUsage.USER_APPLICATIONS) {
+            Collection<AttributeType> attributeTypes = schema.getAttributeTypes();
+            declaredOptionalAttributes = new HashSet<>(attributeTypes.size());
+            for (final AttributeType attributeType : attributeTypes) {
+                if (attributeType.getUsage() == AttributeUsage.USER_APPLICATIONS
+                        && !requiredAttributes.contains(attributeType)) {
                     declaredOptionalAttributes.add(attributeType);
                 }
             }

--
Gitblit v1.10.0