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

Ludovic Poitou
05.47.2011 bca96e0e4a84114bdc1912c14c08a24d9b62a025
Fix OPENDJ-254. The show-all-attributes flag breaks schema modification, when enabled.
Make sure the flag is ignored when getting the entry for modification (actually always but for Searches).
1 files modified
35 ■■■■ changed files
opends/src/server/org/opends/server/backends/SchemaBackend.java 35 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -646,7 +646,7 @@
    {
      if (entryDN.equals(baseDN))
      {
        return getSchemaEntry(entryDN, false);
        return getSchemaEntry(entryDN, false, true);
      }
    }
@@ -656,7 +656,6 @@
  }
  /**
   * Generates and returns a schema entry for the Directory Server.
   *
@@ -669,6 +668,27 @@
   */
  public Entry getSchemaEntry(DN entryDN, boolean includeSchemaFile)
  {
    return getSchemaEntry(entryDN, includeSchemaFile, false);
  }
  /**
   * Generates and returns a schema entry for the Directory Server.
   *
   * @param  entryDN            The DN to use for the generated entry.
   * @param  includeSchemaFile  A boolean indicating if the X-SCHEMA-FILE
   *                            extension should be used when generating
   *                            the entry.
   * @param ignoreShowAllOption A boolean indicating if the showAllAttributes
   *                            parameter should be ignored or not. It must
   *                            only considered for Search operation, and
   *                            definitely ignored for Modify operations, i.e.
   *                            when calling through getEntry().
   *
   * @return  The schema entry that was generated.
   */
  private Entry getSchemaEntry(DN entryDN, boolean includeSchemaFile,
                                          boolean ignoreShowAllOption)
  {
    LinkedHashMap<AttributeType, List<Attribute>> userAttrs =
      new LinkedHashMap<AttributeType, List<Attribute>>();
@@ -767,7 +787,8 @@
    ArrayList<Attribute> attrList = new ArrayList<Attribute>(1);
    attrList.add(builder.toAttribute());
    if (attributeTypesType.isOperational() && (!showAllAttributes))
    if (attributeTypesType.isOperational() &&
        (ignoreShowAllOption || (!showAllAttributes)))
    {
      operationalAttrs.put(attributeTypesType, attrList);
    }
@@ -812,7 +833,8 @@
    attrList = new ArrayList<Attribute>(1);
    attrList.add(builder.toAttribute());
    if (objectClassesType.isOperational() && (!showAllAttributes))
    if (objectClassesType.isOperational() &&
        (ignoreShowAllOption || (!showAllAttributes)))
    {
      operationalAttrs.put(objectClassesType, attrList);
    }
@@ -827,7 +849,8 @@
    attrList = new ArrayList<Attribute>(1);
    attrList.add(builder.toAttribute());
    if (matchingRulesType.isOperational() && (!showAllAttributes))
    if (matchingRulesType.isOperational() &&
        (ignoreShowAllOption || (!showAllAttributes)))
    {
      operationalAttrs.put(matchingRulesType, attrList);
    }
@@ -4313,7 +4336,7 @@
    // writer when we're done.
    try
    {
      ldifWriter.writeEntry(getSchemaEntry(baseDNs[0], true));
      ldifWriter.writeEntry(getSchemaEntry(baseDNs[0], true, true));
    }
    catch (Exception e)
    {