mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

an-Peter Nilsson
09.06.2020 f366bd375dbee4ab6a44f39889a93a35b22c0d4e
opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java
@@ -147,6 +147,7 @@
   * Example: replication uses this to store its state and GenerationID.
   */
  private Map<String, Attribute> extraAttributes = new HashMap<>();
  private Map<String, org.forgerock.opendj.ldap.Attribute> extraAttributesInitialize = new HashMap<>();
  /** Guards updates to the schema. */
  private final Lock exclusiveLock = new ReentrantLock();
@@ -224,6 +225,15 @@
      {
        throw new ConfigException(e.getMessageObject(), e);
      }
      // Do attribute conversion after fully loading the schema
      // otherwise attributes using types defined in the schema will not be properly converted
      for (final Map.Entry<String, org.forgerock.opendj.ldap.Attribute> entry : extraAttributesInitialize.entrySet())
      {
        Attribute a = Converters.toAttribute(entry.getValue());
        extraAttributes.put(entry.getKey(), a);
      }
      extraAttributesInitialize.clear();
  }
  /**
@@ -960,6 +970,15 @@
    final Entry entry = readSchemaEntry(schemaFile, readSchema);
    if (entry != null)
    {
      for (org.forgerock.opendj.ldap.Attribute a : entry.getAllAttributes())
      {
        AttributeType attrType = a .getAttributeDescription().getAttributeType();
        String attrName = attrType.getNameOrOID();
        if (attrName.startsWith("ds-sync-") || attrName.equals("modifiersName") || attrName.equals("modifyTimestamp"))
        {
          extraAttributesInitialize.put(attrName, a);
        }
      }
      updateSchemaBuilderWithEntry(schemaBuilder, entry, schemaFile.getName(), failOnError);
    }
    return entry;