From bca96e0e4a84114bdc1912c14c08a24d9b62a025 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 05 Aug 2011 13:47:25 +0000
Subject: [PATCH] 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).
---
opends/src/server/org/opends/server/backends/SchemaBackend.java | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opends/src/server/org/opends/server/backends/SchemaBackend.java
index fbec4d3..1642fe4 100644
--- a/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/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)
{
--
Gitblit v1.10.0